generated from kontent-ai/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add custom apps API * Update build and release * Update schema to be up to date * Update format settings * Rename initCustomApp to getCustomAppContext --------- Co-authored-by: Daniel Pokorny <[email protected]>
- Loading branch information
Showing
24 changed files
with
687 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[*] | ||
charset=utf-8 | ||
end_of_line=lf | ||
indent_size=2 | ||
indent_style=space | ||
insert_final_newline=true |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1 @@ | ||
# Users referenced in this file will automatically be requested as reviewers for PRs that modify the given paths. | ||
# See https://help.github.com/articles/about-code-owners/ | ||
|
||
# Format: <Path> <Maintainer Team name from: https://kontent-ai.github.io/Guidelines-for-GitHub-permissions-in-Kontent-ai-organization> | ||
# Example: * @kontent-ai/developer-relations | ||
* | ||
* @JiriLojda @kontent-ai/developer-relations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
# For more information do to https://kontent-ai.github.io/ci-and-automation/ci-and-automation | ||
name: Lint & Build | ||
|
||
name: "Build" # Represents the name of the whole action. | ||
on: # Specifies the section where we describe our build triggers. | ||
push: # The action runs with push. | ||
pull_request: # The action runs with a pull request. | ||
schedule: # Specifies the section where we describe the schedule of running the action. | ||
- cron: '0 18 * * 1' # The CRON expression describes when to run the action. | ||
jobs: # Specifies the section where we describe our jobs. | ||
Build: # Specific job section. | ||
runs-on: ubuntu-latest # Describes the environment. | ||
steps: # Specifies the section where we describe the job's steps. | ||
- name: Output some string | ||
run: echo "Set some actual CI steps" | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js from .nvmrc file | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: ".nvmrc" | ||
- run: npm ci | ||
- run: npm run format-check | ||
- run: npm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
on: | ||
release: | ||
types: [published] | ||
|
||
name: publish-to-npm | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.nvmrc' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- run: npm ci | ||
- run: npm run build | ||
|
||
- run: npm publish --access=public | ||
if: ${{!github.event.release.prerelease}} | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_API_KEY }} | ||
- run: npm publish --tag prerelease | ||
if: ${{github.event.release.prerelease}} | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_API_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.DS_Store | ||
.history | ||
.idea | ||
.vscode/settings.json | ||
dist/ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# repo metadata | ||
.github/** | ||
|
||
# tests | ||
tests/** | ||
jest.config.cjs | ||
tsconfig.test.json | ||
|
||
# source | ||
src/** | ||
index.ts | ||
|
||
# docs | ||
media/** | ||
docs/** | ||
showcase/** | ||
|
||
# misc | ||
/.gitignore | ||
/.npmignore | ||
/tsconfig.json | ||
/.eslintrc | ||
/node_modules | ||
.idea/ | ||
.vscode/ | ||
logos/ | ||
profile/ | ||
biome.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lts/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"recommendations": [ | ||
"biomejs.biome" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
// Code formatting | ||
"editor.codeActionsOnSave": { | ||
"quickfix.biome": "explicit", | ||
"source.organizeImports.biome": "explicit" | ||
}, | ||
"editor.defaultFormatter": "biomejs.biome", | ||
"editor.formatOnSave": true, | ||
|
||
// Directories excluded from search | ||
"search.exclude": { | ||
"**/.history": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
# Ways to contribute | ||
# Ways to contribute | ||
<img align="right" width="100" height="100" src="https://i.imgur.com/PYTV0jP.png"> | ||
|
||
There are many different ways in which you can contribute. One of the easiest ways is simply to use our software and provide us with your feedback through the right channel. You can also help us improve the open-source projects by submitting pull requests with code and documentation changes. | ||
|
||
## Where to get support | ||
Please note that **level of provided support is always determined by the LICENSE** of a given open-source project. Also, always make sure you use the **[latest version](../../releases)** of any given OS project. We can't provide any help for older versions. We don't want to make things complicated so we try to take the same approach in all our repositories. | ||
Please note that **level of provided support is always determined by the LICENSE** of a given open-source project. Also, always make sure you use the **[latest version](../../releases)** of any given OS project. We can't provide any help for older versions. We don't want to make things complicated so we try to take the same approach in all our repositories. | ||
|
||
### I found a bug in a Kontent.ai open-source project | ||
<img align="right" width="100" height="100" src="https://i.imgur.com/TYIQdpv.png"> | ||
|
@@ -21,7 +21,7 @@ Our team members and the community monitor these channels on a regular basis. | |
### I want to report a security bug | ||
<img align="right" width="100" height="100" src="https://i.imgur.com/z82nnJB.png"> | ||
|
||
Security issues and bugs should be reported privately, via email, to Kontent.ai Security Team [[email protected]](mailto:[email protected]). For more details, check the [Security policy](SECURITY.md). | ||
Security issues and bugs should be reported privately, via email, to Kontent.ai Security Team [[email protected]](mailto:[email protected]). For more details, check the [Security policy](SECURITY.md). | ||
|
||
### I have an idea for a new feature (or feedback on existing functionality) | ||
<img align="right" width="100" height="100" src="https://i.imgur.com/rUFkyPy.png"> | ||
|
@@ -37,9 +37,9 @@ You might also read these two blogs posts on contributing code: [Open Source Con | |
|
||
|
||
### Example - process of contribution | ||
If not stated otherwise, we use [feature branch workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow). | ||
If not stated otherwise, we use [feature branch workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow). | ||
|
||
To start with coding, fork the repository you want to contribute to, create a new branch, and start coding. Once the functionality is [done](#Definition-of-Done), you can submit a [pull request](https://help.github.com/articles/about-pull-requests/). | ||
To start with coding, fork the repository you want to contribute to, create a new branch, and start coding. Once the functionality is [done](#Definition-of-Done), you can submit a [pull request](https://help.github.com/articles/about-pull-requests/). | ||
|
||
### Definition of Done | ||
<img align="right" width="100" height="100" src="https://i.imgur.com/g82Ohdv.png"> | ||
|
@@ -64,4 +64,4 @@ Your pull request will now go through extensive checks by the subject matter exp | |
## Code of Conduct | ||
<img align="right" width="100" height="100" src="https://i.imgur.com/cObdKQy.png"> | ||
|
||
The Kontent.ai team is committed to fostering a welcoming community, therefore this project has adopted the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md). If you have any additional questions or comments, you can contact us directly at [email protected]. | ||
The Kontent.ai team is committed to fostering a welcoming community, therefore this project has adopted the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md). If you have any additional questions or comments, you can contact us directly at [email protected]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# Kontent.ai Custom app SDK JS | ||
|
||
[![Contributors][contributors-shield]][contributors-url] | ||
[![Forks][forks-shield]][forks-url] | ||
[![Stargazers][stars-shield]][stars-url] | ||
[![Issues][issues-shield]][issues-url] | ||
[![MIT License][license-shield]][license-url] | ||
|
||
[![Discord][discussion-shield]][discussion-url] | ||
|
||
<!-- ABOUT THE PROJECT --> | ||
## About The Project | ||
|
||
The Kontent.ai Custom App SDK enhances the integration of your custom app with the Kontent.ai platform. | ||
<!-- GETTING STARTED --> | ||
## Getting Started | ||
### Installation | ||
```sh | ||
npm install @kontent-ai/custom-app-sdk-js | ||
``` | ||
|
||
<!-- USAGE EXAMPLES --> | ||
## Usage | ||
|
||
```javascript | ||
import { getCustomAppContext, CustomAppContext } from "@kontent-ai/custom-app-sdk-js"; | ||
|
||
const response: CustomAppContext = await getCustomAppContext(); | ||
|
||
if (response.isError) { | ||
console.error({ errorCode: response.code, description: response.description}); | ||
} else { | ||
console.log({ config: response.config, context: response.context }); | ||
} | ||
``` | ||
|
||
### getCustomAppContext function | ||
|
||
Use the `getCustomAppContext` function to retrieve context of the custom app. The function takes no arguments and returns a promise with a value of an object of type `CustomAppContext`. | ||
|
||
### CustomAppContext | ||
|
||
| Property | Type | Description | | ||
|---------------|------------------------|------------------------------------------------------------------------------| | ||
| `isError` | boolean | Determines if there was an error while getting the context of the custom app | | ||
| `code` | ErrorCode enum \| null | The code of the error message | | ||
| `description` | string \| null | The description of the error message | | ||
| `context` | object \| null | Contains data provided by the Kontent.ai application | | ||
| `config` | object \| null | Contains JSON object specified in the custom app configuration | | ||
|
||
### Config object | ||
The `config` object is a JSON object that can be defined within the Custom App configuration under Environment settings in the Kontent.ai app. | ||
|
||
### Context object | ||
The `context` object contains data provided by the Kontent.ai application that you can leverage in your custom app. | ||
|
||
| Property | Type | Description | | ||
|-----------------|-------------------|--------------------------------------------------------------------------| | ||
| `environmentId` | UUID | The environment's ID | | ||
| `userId` | string | The current user's ID | | ||
| `userEmail` | string | The current user's email | | ||
| `userRoles` | Array of UserRole | An array containing all the roles of the current user in the environment | | ||
|
||
#### UserRole object | ||
|
||
| Property | Type | Description | | ||
|------------|--------|----------------------------------------------------------------------| | ||
| `id` | UUID | The role's ID | | ||
| `codename` | string | The role's codename - applicable only for the _Project manager_ role | | ||
|
||
<!-- CONTRIBUTING --> | ||
## Contributing | ||
|
||
For Contributing please see <a href="./CONTRIBUTING.md">`CONTRIBUTING.md`</a> for more information. | ||
|
||
|
||
|
||
<!-- LICENSE --> | ||
## License | ||
|
||
Distributed under the MIT License. See [`LICENSE.md`](./LICENSE.md) for more information. | ||
|
||
|
||
<!-- MARKDOWN LINKS & IMAGES --> | ||
<!-- https://github.com/kontent-ai/Home/wiki/Checklist-for-publishing-a-new-OS-project#badges--> | ||
[contributors-shield]: https://img.shields.io/github/contributors/kontent-ai/custom-app-sdk-js.svg?style=for-the-badge | ||
[contributors-url]: https://github.com/kontent-ai/custom-app-sdk-js/graphs/contributors | ||
[forks-shield]: https://img.shields.io/github/forks/kontent-ai/custom-app-sdk-js.svg?style=for-the-badge | ||
[forks-url]: https://github.com/kontent-ai/custom-app-sdk-js/network/members | ||
[stars-shield]: https://img.shields.io/github/stars/kontent-ai/custom-app-sdk-js.svg?style=for-the-badge | ||
[stars-url]: https://github.com/kontent-ai/custom-app-sdk-js/stargazers | ||
[issues-shield]: https://img.shields.io/github/issues/kontent-ai/custom-app-sdk-js.svg?style=for-the-badge | ||
[issues-url]:https://github.com/kontent-ai/custom-app-sdk-js/issues | ||
[license-shield]: https://img.shields.io/github/license/kontent-ai/custom-app-sdk-js.svg?style=for-the-badge | ||
[license-url]:https://github.com/kontent-ai/custom-app-sdk-js/blob/master/LICENSE.md | ||
[discussion-shield]: https://img.shields.io/discord/821885171984891914?color=%237289DA&label=Kontent%2Eai%20Discord&logo=discord&style=for-the-badge | ||
[discussion-url]: https://discord.com/invite/SKCxwPtevJ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", | ||
"organizeImports": { | ||
"enabled": true | ||
}, | ||
"formatter": { | ||
"indentStyle": "space", | ||
"lineWidth": 100 | ||
}, | ||
"javascript": { | ||
"formatter": { | ||
"quoteStyle": "double", | ||
"indentStyle": "space", | ||
"lineWidth": 100 | ||
} | ||
}, | ||
"json": { | ||
"formatter": { | ||
"indentStyle": "space" | ||
} | ||
}, | ||
"files": { | ||
"ignore": [ | ||
"**/*-lock.json", | ||
"**/.DS_Store", | ||
".idea/**", | ||
".vscode/**", | ||
".history/**", | ||
"node_modules/**" | ||
] | ||
} | ||
} |
Oops, something went wrong.