├── .env.template ├── .gitattributes ├── .github ├── CODEOWNERS └── workflows │ ├── build.yml │ └── tests.yml ├── .gitignore ├── .npmignore ├── .nvmrc ├── .prettierrc ├── .vscode └── settings.json ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── eslint.config.mjs ├── lib ├── cli │ ├── actions │ │ ├── delivery-action.ts │ │ ├── environment-action.ts │ │ ├── items-action.ts │ │ └── migrate-action.ts │ ├── app.ts │ ├── arg.utils.ts │ ├── args │ │ ├── args-fetcher.ts │ │ └── args-setter.ts │ ├── cli.models.ts │ ├── command.options.ts │ └── commands.ts ├── config.ts ├── core │ ├── comment.utils.ts │ ├── core.models.ts │ ├── core.utils.ts │ ├── element.utils.ts │ ├── error.utils.ts │ ├── importer.ts │ ├── resolvers.ts │ └── type-guards.ts ├── fetch │ ├── delivery-kontent-fetcher.ts │ └── management-kontent-fetcher.ts ├── files │ └── file-manager.ts ├── format │ └── formatter.ts ├── generators │ ├── delivery │ │ ├── delivery-content-type.generator.ts │ │ ├── delivery-func.ts │ │ └── delivery-taxonomy.generator.ts │ ├── environment │ │ ├── environment-func.ts │ │ └── environment.generator.ts │ ├── items │ │ ├── items-func.ts │ │ └── items.generator.ts │ ├── migration │ │ ├── migration-func.ts │ │ └── migration.generator.ts │ └── shared │ │ └── type-codename.generator.ts ├── meta │ └── metadata.ts └── public_api.ts ├── package-lock.json ├── package.json ├── sample ├── delivery │ ├── content-type-snippets │ │ └── index.ts │ ├── content-types │ │ ├── actor.ts │ │ ├── index.ts │ │ └── movie.ts │ ├── index.ts │ ├── system │ │ ├── core.type.ts │ │ ├── delivery.codenames.ts │ │ └── index.ts │ └── taxonomies │ │ ├── index.ts │ │ ├── movietype.ts │ │ └── releasecategory.ts ├── environment │ ├── assetFolders.ts │ ├── collections.ts │ ├── contentTypeSnippets.ts │ ├── contentTypes.ts │ ├── customApps.ts │ ├── index.ts │ ├── languages.ts │ ├── previewUrls.ts │ ├── roles.ts │ ├── spaces.ts │ ├── taxonomies.ts │ ├── webhooks.ts │ └── workflows.ts ├── items │ ├── codenames │ │ ├── actor.codenames.ts │ │ ├── index.ts │ │ └── movie.codenames.ts │ ├── index.ts │ └── items │ │ ├── actor.items.ts │ │ ├── index.ts │ │ └── movie.items.ts └── migration │ ├── content-types │ ├── actor.ts │ ├── index.ts │ └── movie.ts │ ├── environment │ ├── environment.ts │ └── index.ts │ ├── index.ts │ └── migration.ts ├── scripts ├── clean-snapshots.ts ├── clean.ts ├── samples │ ├── delivery-sample.ts │ ├── environment-sample.ts │ ├── item-sample.ts │ └── migration-sample.ts ├── update-version.ts └── utils │ ├── environment.utils.ts │ └── script.utils.ts ├── tests ├── core │ ├── comment.spec.ts │ ├── core.spec.ts │ ├── importer.spec.ts │ └── resolvers.spec.ts ├── generators │ └── type-codename.generator.spec.ts └── integration │ ├── generated-models.spec.ts │ ├── integration-tests.config.ts │ ├── snapshots │ ├── delivery-sdk │ │ ├── basic-js │ │ │ ├── _filesList.json │ │ │ ├── content-type-snippets │ │ │ │ ├── empty_snippet.ts │ │ │ │ ├── index.ts │ │ │ │ └── snippet_a.ts │ │ │ ├── content-types │ │ │ │ ├── _content_type_with_special_chars____.ts │ │ │ │ ├── circular_reference_type_a_b.ts │ │ │ │ ├── circular_reference_type_b____a.ts │ │ │ │ ├── content_type_with_all_elements.ts │ │ │ │ ├── content_type_with_guidelines_only.ts │ │ │ │ ├── content_type_with_snippet_only.ts │ │ │ │ ├── empty_content_type.ts │ │ │ │ ├── index.ts │ │ │ │ ├── page.ts │ │ │ │ ├── type_referencing_deleted_type.ts │ │ │ │ ├── type_with_empty_snippet.ts │ │ │ │ └── web_spotlight_root.ts │ │ │ ├── index.ts │ │ │ ├── system │ │ │ │ ├── core.type.ts │ │ │ │ ├── delivery.codenames.ts │ │ │ │ └── index.ts │ │ │ └── taxonomies │ │ │ │ ├── index.ts │ │ │ │ ├── taxonomy_a.ts │ │ │ │ └── taxonomy_without_terms.ts │ │ ├── basic-ts │ │ │ ├── _filesList.json │ │ │ ├── content-type-snippets │ │ │ │ ├── empty_snippet.ts │ │ │ │ ├── index.ts │ │ │ │ └── snippet_a.ts │ │ │ ├── content-types │ │ │ │ ├── _content_type_with_special_chars____.ts │ │ │ │ ├── circular_reference_type_a_b.ts │ │ │ │ ├── circular_reference_type_b____a.ts │ │ │ │ ├── content_type_with_all_elements.ts │ │ │ │ ├── content_type_with_guidelines_only.ts │ │ │ │ ├── content_type_with_snippet_only.ts │ │ │ │ ├── empty_content_type.ts │ │ │ │ ├── index.ts │ │ │ │ ├── page.ts │ │ │ │ ├── type_referencing_deleted_type.ts │ │ │ │ ├── type_with_empty_snippet.ts │ │ │ │ └── web_spotlight_root.ts │ │ │ ├── index.ts │ │ │ ├── system │ │ │ │ ├── core.type.ts │ │ │ │ ├── delivery.codenames.ts │ │ │ │ └── index.ts │ │ │ └── taxonomies │ │ │ │ ├── index.ts │ │ │ │ ├── taxonomy_a.ts │ │ │ │ └── taxonomy_without_terms.ts │ │ ├── custom-format-options │ │ │ ├── _filesList.json │ │ │ ├── content-type-snippets │ │ │ │ ├── empty_snippet.ts │ │ │ │ ├── index.ts │ │ │ │ └── snippet_a.ts │ │ │ ├── content-types │ │ │ │ ├── _content_type_with_special_chars____.ts │ │ │ │ ├── circular_reference_type_a_b.ts │ │ │ │ ├── circular_reference_type_b____a.ts │ │ │ │ ├── content_type_with_all_elements.ts │ │ │ │ ├── content_type_with_guidelines_only.ts │ │ │ │ ├── content_type_with_snippet_only.ts │ │ │ │ ├── empty_content_type.ts │ │ │ │ ├── index.ts │ │ │ │ ├── page.ts │ │ │ │ ├── type_referencing_deleted_type.ts │ │ │ │ ├── type_with_empty_snippet.ts │ │ │ │ └── web_spotlight_root.ts │ │ │ ├── index.ts │ │ │ ├── system │ │ │ │ ├── core.type.ts │ │ │ │ ├── delivery.codenames.ts │ │ │ │ └── index.ts │ │ │ └── taxonomies │ │ │ │ ├── index.ts │ │ │ │ ├── taxonomy_a.ts │ │ │ │ └── taxonomy_without_terms.ts │ │ └── name-and-file-resolvers │ │ │ ├── _filesList.json │ │ │ ├── content-type-snippets │ │ │ ├── index.ts │ │ │ ├── snippet_empty_snippet.ts │ │ │ └── snippet_snippet_a.ts │ │ │ ├── content-types │ │ │ ├── content_type__content_type_with_special_chars____.ts │ │ │ ├── content_type_circular_reference_type_a_b.ts │ │ │ ├── content_type_circular_reference_type_b____a.ts │ │ │ ├── content_type_content_type_with_all_elements.ts │ │ │ ├── content_type_content_type_with_guidelines_only.ts │ │ │ ├── content_type_content_type_with_snippet_only.ts │ │ │ ├── content_type_empty_content_type.ts │ │ │ ├── content_type_page.ts │ │ │ ├── content_type_type_referencing_deleted_type.ts │ │ │ ├── content_type_type_with_empty_snippet.ts │ │ │ ├── content_type_web_spotlight_root.ts │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ ├── system │ │ │ ├── core.type.ts │ │ │ ├── delivery.codenames.ts │ │ │ └── index.ts │ │ │ └── taxonomies │ │ │ ├── index.ts │ │ │ ├── taxonomy_taxonomy_a.ts │ │ │ └── taxonomy_taxonomy_without_terms.ts │ ├── environment │ │ ├── all-entities-js │ │ │ ├── _filesList.json │ │ │ ├── assetFolders.ts │ │ │ ├── collections.ts │ │ │ ├── contentTypeSnippets.ts │ │ │ ├── contentTypes.ts │ │ │ ├── customApps.ts │ │ │ ├── index.ts │ │ │ ├── languages.ts │ │ │ ├── previewUrls.ts │ │ │ ├── roles.ts │ │ │ ├── spaces.ts │ │ │ ├── taxonomies.ts │ │ │ ├── webhooks.ts │ │ │ └── workflows.ts │ │ ├── all-entities-ts │ │ │ ├── _filesList.json │ │ │ ├── assetFolders.ts │ │ │ ├── collections.ts │ │ │ ├── contentTypeSnippets.ts │ │ │ ├── contentTypes.ts │ │ │ ├── customApps.ts │ │ │ ├── index.ts │ │ │ ├── languages.ts │ │ │ ├── previewUrls.ts │ │ │ ├── roles.ts │ │ │ ├── spaces.ts │ │ │ ├── taxonomies.ts │ │ │ ├── webhooks.ts │ │ │ └── workflows.ts │ │ ├── entities-filter-1 │ │ │ ├── _filesList.json │ │ │ ├── index.ts │ │ │ └── taxonomies.ts │ │ ├── entities-filter-2 │ │ │ ├── _filesList.json │ │ │ ├── contentTypes.ts │ │ │ └── index.ts │ │ └── entities-filter-3 │ │ │ ├── _filesList.json │ │ │ ├── contentTypeSnippets.ts │ │ │ ├── index.ts │ │ │ ├── languages.ts │ │ │ └── workflows.ts │ ├── items │ │ ├── filterByType │ │ │ ├── _filesList.json │ │ │ ├── codenames │ │ │ │ ├── content_type_with_all_elements.codenames.ts │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ └── items │ │ │ │ ├── content_type_with_all_elements.items.ts │ │ │ │ └── index.ts │ │ ├── generateObjectsAndTypes-js │ │ │ ├── _filesList.json │ │ │ ├── codenames │ │ │ │ ├── _content_type_with_special_chars____.codenames.ts │ │ │ │ ├── content_type_with_all_elements.codenames.ts │ │ │ │ ├── index.ts │ │ │ │ └── web_spotlight_root.codenames.ts │ │ │ ├── index.ts │ │ │ └── items │ │ │ │ ├── _content_type_with_special_chars____.items.ts │ │ │ │ ├── content_type_with_all_elements.items.ts │ │ │ │ ├── index.ts │ │ │ │ └── web_spotlight_root.items.ts │ │ ├── generateObjectsAndTypes-ts │ │ │ ├── _filesList.json │ │ │ ├── codenames │ │ │ │ ├── _content_type_with_special_chars____.codenames.ts │ │ │ │ ├── content_type_with_all_elements.codenames.ts │ │ │ │ ├── index.ts │ │ │ │ └── web_spotlight_root.codenames.ts │ │ │ ├── index.ts │ │ │ └── items │ │ │ │ ├── _content_type_with_special_chars____.items.ts │ │ │ │ ├── content_type_with_all_elements.items.ts │ │ │ │ ├── index.ts │ │ │ │ └── web_spotlight_root.items.ts │ │ ├── generateObjectsOnly │ │ │ ├── _filesList.json │ │ │ ├── index.ts │ │ │ └── items │ │ │ │ ├── _content_type_with_special_chars____.items.ts │ │ │ │ ├── content_type_with_all_elements.items.ts │ │ │ │ ├── index.ts │ │ │ │ └── web_spotlight_root.items.ts │ │ └── generateTypessOnly │ │ │ ├── _filesList.json │ │ │ ├── codenames │ │ │ ├── _content_type_with_special_chars____.codenames.ts │ │ │ ├── content_type_with_all_elements.codenames.ts │ │ │ ├── index.ts │ │ │ └── web_spotlight_root.codenames.ts │ │ │ └── index.ts │ └── migration-toolkit │ │ ├── basic-js │ │ ├── _filesList.json │ │ ├── content-types │ │ │ ├── _content_type_with_special_chars____.ts │ │ │ ├── circular_reference_type_a_b.ts │ │ │ ├── circular_reference_type_b____a.ts │ │ │ ├── content_type_with_all_elements.ts │ │ │ ├── content_type_with_guidelines_only.ts │ │ │ ├── content_type_with_snippet_only.ts │ │ │ ├── empty_content_type.ts │ │ │ ├── index.ts │ │ │ ├── page.ts │ │ │ ├── type_referencing_deleted_type.ts │ │ │ ├── type_with_empty_snippet.ts │ │ │ └── web_spotlight_root.ts │ │ ├── environment │ │ │ ├── environment.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ └── migration.ts │ │ └── basic-ts │ │ ├── _filesList.json │ │ ├── content-types │ │ ├── _content_type_with_special_chars____.ts │ │ ├── circular_reference_type_a_b.ts │ │ ├── circular_reference_type_b____a.ts │ │ ├── content_type_with_all_elements.ts │ │ ├── content_type_with_guidelines_only.ts │ │ ├── content_type_with_snippet_only.ts │ │ ├── empty_content_type.ts │ │ ├── index.ts │ │ ├── page.ts │ │ ├── type_referencing_deleted_type.ts │ │ ├── type_with_empty_snippet.ts │ │ └── web_spotlight_root.ts │ │ ├── environment │ │ ├── environment.ts │ │ └── index.ts │ │ ├── index.ts │ │ └── migration.ts │ └── test-cases │ ├── delivery-sdk-snapshots.ts │ ├── environment-snapshots.ts │ ├── items-snapshots.ts │ └── migration-toolkit-snapshots.ts ├── tsconfig.build.json ├── tsconfig.json └── vitest.config.ts /.env.template: -------------------------------------------------------------------------------- 1 | SAMPLE_MANAGEMENT_API_KEY=x 2 | SAMPLE_ENVIRONMENT_ID=y 3 | SAMPLE_DELIVERY_API_KEY=z 4 | 5 | INTEGRATION_MANAGEMENT_API_KEY=y 6 | INTEGRATION_ENVIRONMENT_ID=z 7 | 8 | ADD_TIMESTAMP=false 9 | MODULE_EXTENSION=js 10 | DELIVERY_API_KEY=y 11 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Users referenced in this file will automatically be requested as reviewers for PRs that modify the given paths. 2 | # See https://help.github.com/articles/about-code-owners/ 3 | 4 | * @IvanKiral @Enngage @kontent-ai/javascript-maintainers 5 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Lint & Build 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | pull_request: 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v4 13 | - name: Use Node.js from .nvmrc file 14 | uses: actions/setup-node@v4 15 | with: 16 | node-version-file: '.nvmrc' 17 | - run: npm ci 18 | - run: npm run lint 19 | - run: npm run build 20 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | pull_request: 7 | 8 | env: 9 | INTEGRATION_MANAGEMENT_API_KEY: ${{ secrets.INTEGRATION_MANAGEMENT_API_KEY }} 10 | INTEGRATION_ENVIRONMENT_ID: ${{ secrets.INTEGRATION_ENVIRONMENT_ID }} 11 | 12 | jobs: 13 | build: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v4 17 | - name: Use Node.js from .nvmrc file 18 | uses: actions/setup-node@v4 19 | with: 20 | node-version-file: '.nvmrc' 21 | - run: npm ci 22 | - run: npm run test 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Custom 2 | .editorconfig 3 | .env 4 | 5 | # See http://help.github.com/ignore-files/ for more about ignoring files. 6 | 7 | # compiled output 8 | /definitions 9 | /_commonjs 10 | /_es2015 11 | /_bundles 12 | /tmp 13 | /coverage 14 | /out-tsc 15 | /dist 16 | 17 | # dependencies 18 | /node_modules 19 | 20 | # IDEs and editors 21 | /.idea 22 | .project 23 | .classpath 24 | .c9/ 25 | *.launch 26 | .settings/ 27 | *.sublime-workspace 28 | 29 | # IDE - VSCode 30 | .vscode/* 31 | !.vscode/settings.json 32 | !.vscode/tasks.json 33 | !.vscode/launch.json 34 | !.vscode/extensions.json 35 | 36 | # misc 37 | /.sass-cache 38 | /connect.lock 39 | /coverage 40 | /libpeerconnection.log 41 | npm-debug.log 42 | testem.log 43 | /typings 44 | 45 | # e2e 46 | /e2e/*.js 47 | /e2e/*.map 48 | 49 | # System Files 50 | .DS_Store 51 | Thumbs.db 52 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # Ignore everything 2 | * 3 | 4 | # But descend into directories 5 | 6 | # Recursively allow files under subtree 7 | !/lib/** 8 | !/dist/** 9 | !package.json 10 | !.npmignore 11 | !README.md 12 | !LICENSE.md 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | lts/* -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "printWidth": 140, 4 | "proseWrap": "always", 5 | "tabWidth": 4, 6 | "requireConfig": false, 7 | "useTabs": false, 8 | "trailingComma": "none", 9 | "bracketSpacing": true, 10 | "semi": true 11 | } 12 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.tsdk": "node_modules\\typescript\\lib", 3 | "typescript.updateImportsOnFileMove.enabled": "always", 4 | "editor.codeActionsOnSave": { 5 | "source.organizeImports": "explicit" 6 | }, 7 | "[markdown]": { 8 | "editor.formatOnSave": false 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Kontent.ai 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the 8 | following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 13 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 14 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 15 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | -------------------------------------------------------------------------------- /eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import eslint from '@eslint/js'; 2 | import tseslint from 'typescript-eslint'; 3 | 4 | export default tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommendedTypeChecked, { 5 | languageOptions: { 6 | parserOptions: { 7 | project: ['tsconfig.json'], 8 | tsconfigRootDir: import.meta.dirname 9 | } 10 | }, 11 | rules: { 12 | '@typescript-eslint/no-namespace': 'off', 13 | '@typescript-eslint/consistent-type-imports': 'error', 14 | '@typescript-eslint/naming-convention': [ 15 | 'warn', 16 | { 17 | selector: 'interface', 18 | format: ['PascalCase'], 19 | custom: { 20 | regex: '^I[A-Z]', 21 | match: false 22 | } 23 | } 24 | ] 25 | } 26 | }); 27 | -------------------------------------------------------------------------------- /lib/cli/actions/delivery-action.ts: -------------------------------------------------------------------------------- 1 | import { generateDeliveryModelsAsync } from '../../generators/delivery/delivery-func.js'; 2 | import { parseModuleFileExtension } from '../arg.utils.js'; 3 | import type { CliArgumentsFetcher } from '../cli.models.js'; 4 | import { commandOptions } from '../command.options.js'; 5 | 6 | export async function deliveryActionAsync(cliFetcher: CliArgumentsFetcher): Promise { 7 | await generateDeliveryModelsAsync({ 8 | createFiles: true, 9 | // required 10 | environmentId: cliFetcher.getRequiredArgumentValue(commandOptions.environmentId.name), 11 | managementApiKey: cliFetcher.getRequiredArgumentValue(commandOptions.managementApiKey.name), 12 | // optional 13 | managementBaseUrl: cliFetcher.getOptionalArgumentValue(commandOptions.managementBaseUrl.name), 14 | outputDir: cliFetcher.getOptionalArgumentValue(commandOptions.outputDir.name), 15 | addTimestamp: cliFetcher.getBooleanArgumentValue(commandOptions.addTimestamp.name, false), 16 | moduleFileExtension: parseModuleFileExtension(cliFetcher.getOptionalArgumentValue(commandOptions.moduleFileExtension.name)) 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /lib/cli/actions/environment-action.ts: -------------------------------------------------------------------------------- 1 | import { isEnvironmentEntity } from '../../core/type-guards.js'; 2 | import { generateEnvironmentModelsAsync } from '../../generators/environment/environment-func.js'; 3 | import { parseModuleFileExtension } from '../arg.utils.js'; 4 | import type { CliArgumentsFetcher } from '../cli.models.js'; 5 | import { commandOptions } from '../command.options.js'; 6 | 7 | export async function environmentActionAsync(cliFetcher: CliArgumentsFetcher): Promise { 8 | await generateEnvironmentModelsAsync({ 9 | // required 10 | createFiles: true, 11 | environmentId: cliFetcher.getRequiredArgumentValue(commandOptions.environmentId.name), 12 | managementApiKey: cliFetcher.getRequiredArgumentValue(commandOptions.managementApiKey.name), 13 | // optional 14 | entities: cliFetcher.getOptionalArgumentArrayValue(commandOptions.entities.name).filter(isEnvironmentEntity), 15 | managementBaseUrl: cliFetcher.getOptionalArgumentValue(commandOptions.managementBaseUrl.name), 16 | outputDir: cliFetcher.getOptionalArgumentValue(commandOptions.outputDir.name), 17 | addTimestamp: cliFetcher.getBooleanArgumentValue(commandOptions.addTimestamp.name, false), 18 | moduleFileExtension: parseModuleFileExtension(cliFetcher.getOptionalArgumentValue(commandOptions.moduleFileExtension.name)) 19 | }); 20 | } 21 | -------------------------------------------------------------------------------- /lib/cli/actions/items-action.ts: -------------------------------------------------------------------------------- 1 | import { generateItemsAsync } from '../../generators/items/items-func.js'; 2 | import { parseDeliveryApiMode, parseModuleFileExtension } from '../arg.utils.js'; 3 | import type { CliArgumentsFetcher } from '../cli.models.js'; 4 | import { commandOptions } from '../command.options.js'; 5 | 6 | export async function itemsActionAsync(cliFetcher: CliArgumentsFetcher): Promise { 7 | await generateItemsAsync({ 8 | // required 9 | createFiles: true, 10 | environmentId: cliFetcher.getRequiredArgumentValue(commandOptions.environmentId.name), 11 | managementApiKey: cliFetcher.getRequiredArgumentValue(commandOptions.managementApiKey.name), 12 | // optional 13 | generateTypes: cliFetcher.getBooleanArgumentValue(commandOptions.generateTypes.name, false), 14 | generateObjects: cliFetcher.getBooleanArgumentValue(commandOptions.generateObjects.name, false), 15 | deliveryApiKey: cliFetcher.getOptionalArgumentValue(commandOptions.deliveryApiKey.name), 16 | managementBaseUrl: cliFetcher.getOptionalArgumentValue(commandOptions.managementBaseUrl.name), 17 | deliveryBaseUrl: cliFetcher.getOptionalArgumentValue(commandOptions.deliveryBaseUrl.name), 18 | outputDir: cliFetcher.getOptionalArgumentValue(commandOptions.outputDir.name), 19 | addTimestamp: cliFetcher.getBooleanArgumentValue(commandOptions.addTimestamp.name, false), 20 | apiMode: parseDeliveryApiMode(cliFetcher.getOptionalArgumentValue(commandOptions.apiMode.name)), 21 | filterByTypeCodenames: cliFetcher.getOptionalArgumentArrayValue(commandOptions.contentTypes.name) ?? [], 22 | moduleFileExtension: parseModuleFileExtension(cliFetcher.getOptionalArgumentValue(commandOptions.moduleFileExtension.name)) 23 | }); 24 | } 25 | -------------------------------------------------------------------------------- /lib/cli/actions/migrate-action.ts: -------------------------------------------------------------------------------- 1 | import { generateMigrationModelsAsync } from '../../generators/migration/migration-func.js'; 2 | import { parseModuleFileExtension } from '../arg.utils.js'; 3 | import type { CliArgumentsFetcher } from '../cli.models.js'; 4 | import { commandOptions } from '../command.options.js'; 5 | 6 | export async function migrateActionAsync(cliFetcher: CliArgumentsFetcher): Promise { 7 | await generateMigrationModelsAsync({ 8 | // required 9 | createFiles: true, 10 | environmentId: cliFetcher.getRequiredArgumentValue(commandOptions.environmentId.name), 11 | managementApiKey: cliFetcher.getRequiredArgumentValue(commandOptions.managementApiKey.name), 12 | // optional 13 | managementBaseUrl: cliFetcher.getOptionalArgumentValue(commandOptions.managementBaseUrl.name), 14 | outputDir: cliFetcher.getOptionalArgumentValue(commandOptions.outputDir.name), 15 | addTimestamp: cliFetcher.getBooleanArgumentValue(commandOptions.addTimestamp.name, false), 16 | moduleFileExtension: parseModuleFileExtension(cliFetcher.getOptionalArgumentValue(commandOptions.moduleFileExtension.name)) 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /lib/cli/app.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | import chalk from 'chalk'; 3 | import { match } from 'ts-pattern'; 4 | import { logError } from '../core/error.utils.js'; 5 | import { deliveryActionAsync } from './actions/delivery-action.js'; 6 | import { environmentActionAsync } from './actions/environment-action.js'; 7 | import { itemsActionAsync } from './actions/items-action.js'; 8 | import { migrateActionAsync } from './actions/migrate-action.js'; 9 | import { argumentsFetcherAsync } from './args/args-fetcher.js'; 10 | import { cliArgs } from './commands.js'; 11 | 12 | // This enables --help with all commands, options & samples 13 | cliArgs.registerCommands(); 14 | 15 | try { 16 | const argsFetcher = await argumentsFetcherAsync(); 17 | 18 | await match(argsFetcher.getCliAction()) 19 | .returnType>() 20 | .with('delivery-sdk', async () => await deliveryActionAsync(argsFetcher)) 21 | .with('migration-toolkit', async () => await migrateActionAsync(argsFetcher)) 22 | .with('environment', async () => await environmentActionAsync(argsFetcher)) 23 | .with('items', async () => await itemsActionAsync(argsFetcher)) 24 | .otherwise((action) => { 25 | throw Error(`Invalid action '${chalk.red(action)}'`); 26 | }); 27 | } catch (error) { 28 | logError(error); 29 | } 30 | -------------------------------------------------------------------------------- /lib/cli/arg.utils.ts: -------------------------------------------------------------------------------- 1 | import { defaultDeliveryApiMode, defaultModuleFileExtension } from '../config.js'; 2 | import type { DeliveryApiMode, LiteralUnion, ModuleFileExtension } from '../core/core.models.js'; 3 | 4 | export function parseModuleFileExtension(moduleFileExtension: LiteralUnion | undefined): ModuleFileExtension { 5 | return moduleFileExtensionOptions[moduleFileExtension ?? defaultModuleFileExtension]; 6 | } 7 | 8 | export function parseDeliveryApiMode(apiMode: LiteralUnion | undefined): DeliveryApiMode { 9 | return deliveryApiModeOptions[apiMode ?? defaultDeliveryApiMode]; 10 | } 11 | 12 | export const moduleFileExtensionOptions: Record, ModuleFileExtension> = { 13 | js: 'js', 14 | ts: 'ts', 15 | mts: 'mts', 16 | mjs: 'mjs', 17 | none: 'none' 18 | }; 19 | 20 | export const deliveryApiModeOptions: Record, DeliveryApiMode> = { 21 | default: 'default', 22 | preview: 'preview', 23 | secure: 'secure' 24 | }; 25 | -------------------------------------------------------------------------------- /lib/cli/args/args-setter.ts: -------------------------------------------------------------------------------- 1 | import yargs from 'yargs'; 2 | import { hideBin } from 'yargs/helpers'; 3 | import type { CliAction } from '../../core/core.models.js'; 4 | import type { CliArgumentsSetter, Command, CommandOption } from '../cli.models.js'; 5 | 6 | export function argumentsSetter(): CliArgumentsSetter { 7 | const argv = yargs(hideBin(process.argv)); 8 | 9 | return { 10 | withCommand(command: Command): CliArgumentsSetter { 11 | argv.command(command.name, command.description, (yargs) => { 12 | command.examples.forEach((example) => yargs.example(command.name, example)); 13 | command.options.forEach((option) => { 14 | yargs.positional(option.name, { 15 | alias: option.alias, 16 | describe: option.description, 17 | type: option.type, 18 | demandOption: option.isRequired 19 | }); 20 | }); 21 | }); 22 | 23 | return this; 24 | }, 25 | withOption(option: CommandOption): CliArgumentsSetter { 26 | argv.option(option.name, { 27 | alias: option.alias, 28 | description: option.description, 29 | type: option.type, 30 | demandOption: option.isRequired 31 | }); 32 | 33 | return this; 34 | }, 35 | registerCommands(): void { 36 | argv.parseSync(); 37 | } 38 | }; 39 | } 40 | -------------------------------------------------------------------------------- /lib/cli/cli.models.ts: -------------------------------------------------------------------------------- 1 | import type { CliAction } from '../core/core.models.js'; 2 | 3 | export type CommandOptionNames = 4 | | 'environmentId' 5 | | 'help' 6 | | 'deliveryApiKey' 7 | | 'managementApiKey' 8 | | 'outputDir' 9 | | 'addTimestamp' 10 | | 'moduleFileExtension' 11 | | 'apiMode' 12 | | 'contentTypes' 13 | | 'managementBaseUrl' 14 | | 'deliveryBaseUrl' 15 | | 'entities' 16 | | 'generateTypes' 17 | | 'generateObjects'; 18 | 19 | export type CommandAlias = 'h'; 20 | 21 | export interface Command { 22 | readonly name: TAction; 23 | readonly description: string; 24 | readonly options: readonly CommandOption[]; 25 | readonly examples: readonly string[]; 26 | } 27 | 28 | export interface CommandOption { 29 | readonly name: CommandOptionNames; 30 | readonly isRequired: boolean; 31 | readonly alias?: CommandAlias; 32 | readonly description?: string; 33 | readonly type?: 'boolean' | 'number' | 'string'; 34 | } 35 | 36 | export type CliArgumentsSetter = { 37 | withCommand(command: Command): CliArgumentsSetter; 38 | withOption(option: CommandOption): CliArgumentsSetter; 39 | registerCommands(): void; 40 | }; 41 | 42 | export type CliArgumentsFetcher = { 43 | getCliAction(): CliAction; 44 | getOptionalArgumentValue(argName: CommandOptionNames): string | undefined; 45 | getRequiredArgumentValue(argName: CommandOptionNames): string; 46 | getBooleanArgumentValue(argName: CommandOptionNames, defaultValue: boolean): boolean; 47 | getOptionalArgumentArrayValue(argName: CommandOptionNames): readonly string[]; 48 | }; 49 | -------------------------------------------------------------------------------- /lib/core/comment.utils.ts: -------------------------------------------------------------------------------- 1 | import type { EnvironmentModels } from '@kontent-ai/management-sdk'; 2 | import { libMetadata } from '../meta/metadata.js'; 3 | 4 | export function wrapComment(comment: string): string { 5 | return `/**${toSafeComment(comment)}*/`; 6 | } 7 | 8 | export function toSafeComment(text: string): string { 9 | const replaceContent = ''; 10 | return text.replace(/\/\*/g, replaceContent).replace(/\*\//g, replaceContent); 11 | } 12 | 13 | export function toGuidelinesComment(guidelines: string): string { 14 | return removeLineEndings(guidelines); 15 | } 16 | 17 | export function getEnvironmentInfoComment(data: { 18 | readonly timestampDate?: Date; 19 | readonly environmentInfo: Readonly; 20 | }): string { 21 | return ` 22 | /** 23 | * This file has been auto-generated by '${libMetadata.name}@${libMetadata.version}'. 24 | * 25 | * (c) Kontent.ai 26 | * 27 | * ------------------------------------------------------------------------------- 28 | * 29 | * Project: ${toSafeComment(data.environmentInfo.name)} 30 | * Environment: ${toSafeComment(data.environmentInfo.environment)} 31 | * Id: ${data.environmentInfo.id}${data.timestampDate ? `\n* Generated: ${data.timestampDate.toLocaleString()}` : ''} 32 | * 33 | * ------------------------------------------------------------------------------- 34 | **/`; 35 | } 36 | 37 | function removeLineEndings(value: string): string { 38 | return value.replace(/(\r\n|\n|\r)/g, ' '); 39 | } 40 | -------------------------------------------------------------------------------- /lib/core/importer.ts: -------------------------------------------------------------------------------- 1 | import { parse } from 'path'; 2 | import type { LibraryType, LiteralUnion, ModuleFileExtension } from './core.models.js'; 3 | import { getFileNameWithoutExtension, sortAlphabetically } from './core.utils.js'; 4 | 5 | export function getImporter(moduleFileExtension: ModuleFileExtension) { 6 | const importExtension = moduleFileExtension === 'none' ? '' : `.${moduleFileExtension}`; 7 | 8 | return { 9 | importType: (data: { readonly filePathOrPackage: LiteralUnion; readonly importValue: string }): string => { 10 | if (!data.importValue.length) { 11 | return ''; 12 | } 13 | 14 | const isExternalLib = !data.filePathOrPackage.endsWith('.js') && !data.filePathOrPackage.endsWith('.ts'); 15 | const resolvedFilePath = isExternalLib 16 | ? data.filePathOrPackage 17 | : `${getFileNameWithoutExtension(data.filePathOrPackage)}${importExtension}`; 18 | 19 | return `import type { ${data.importValue} } from '${resolvedFilePath}';`; 20 | }, 21 | getBarrelExportCode(filenames: readonly string[]): string { 22 | if (!filenames.length) { 23 | return 'export {}'; 24 | } 25 | return sortAlphabetically(filenames, (filename) => filename).reduce((barrelCode, filename) => { 26 | const path = parse(filename); 27 | return `${barrelCode} export * from '${path.dir}/${path.name}${importExtension}';`; 28 | }, ''); 29 | } 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /lib/core/type-guards.ts: -------------------------------------------------------------------------------- 1 | import { environmentEntities, type EnvironmentEntity } from './core.models.js'; 2 | 3 | export function isEnvironmentEntity(value: string | undefined | null): value is EnvironmentEntity { 4 | return typeof value === 'string' && (environmentEntities as readonly string[]).includes(value); 5 | } 6 | -------------------------------------------------------------------------------- /lib/format/formatter.ts: -------------------------------------------------------------------------------- 1 | import type { Options} from 'prettier'; 2 | import { format } from 'prettier'; 3 | 4 | export async function formatCodeAsync(code: string, options?: Readonly): Promise { 5 | return await format( 6 | code, 7 | options ?? { 8 | parser: 'typescript', 9 | singleQuote: true, 10 | printWidth: 140, 11 | tabWidth: 4, 12 | useTabs: false, 13 | trailingComma: 'none', 14 | bracketSpacing: true, 15 | semi: true 16 | } 17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /lib/meta/metadata.ts: -------------------------------------------------------------------------------- 1 | 2 | export const libMetadata = { 3 | host: 'npmjs.com', 4 | name: '@kontent-ai/model-generator', 5 | timestamp: 'Thu, 01 May 2025 09:50:41 GMT', 6 | version: '8.1.2' 7 | }; 8 | -------------------------------------------------------------------------------- /lib/public_api.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Public API 3 | */ 4 | export type { CaseType, DeliveryApiMode, ModuleFileExtension } from './core/core.models.js'; 5 | export { resolveCase } from './core/resolvers.js'; 6 | export { generateDeliveryModelsAsync, type GenerateDeliveryModelsConfig } from './generators/delivery/delivery-func.js'; 7 | export { generateEnvironmentModelsAsync, type GenerateEnvironmentModelsConfig } from './generators/environment/environment-func.js'; 8 | export { generateItemsAsync, type GenerateItemsModelsConfig } from './generators/items/items-func.js'; 9 | export { generateMigrationModelsAsync, type GenerateMigrationModelsConfig } from './generators/migration/migration-func.js'; 10 | -------------------------------------------------------------------------------- /sample/delivery/content-type-snippets/index.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | export {}; 17 | -------------------------------------------------------------------------------- /sample/delivery/content-types/index.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | export * from './actor.js'; 17 | export * from './movie.js'; 18 | -------------------------------------------------------------------------------- /sample/delivery/index.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | export * from './content-type-snippets/index.js'; 17 | export * from './content-types/index.js'; 18 | export * from './system/index.js'; 19 | export * from './taxonomies/index.js'; 20 | -------------------------------------------------------------------------------- /sample/delivery/system/delivery.codenames.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | /** 17 | * Type representing all languages 18 | */ 19 | export type LanguageCodenames = 'cz' | 'en' | 'German'; 20 | 21 | /** 22 | * Type representing all content types 23 | */ 24 | export type ContentTypeCodenames = 'actor' | 'movie'; 25 | 26 | /** 27 | * Type representing all collections 28 | */ 29 | export type CollectionCodenames = 'default'; 30 | 31 | /** 32 | * Type representing all workflows 33 | */ 34 | export type WorkflowCodenames = 'default'; 35 | 36 | /** 37 | * Type representing all taxonomies 38 | */ 39 | export type TaxonomyCodenames = 'movietype' | 'releasecategory'; 40 | 41 | /** 42 | * Type representing all worksflow steps across all workflows 43 | */ 44 | export type WorkflowStepCodenames = 'archived' | 'draft' | 'published' | 'ready_to_publish' | 'review' | 'scheduled'; 45 | 46 | /** 47 | * Type representing all element codenames across all content types 48 | */ 49 | export type ElementCodenames = 50 | | 'category' 51 | | 'first_name' 52 | | 'last_name' 53 | | 'length' 54 | | 'photo' 55 | | 'plot' 56 | | 'poster' 57 | | 'releasecategory' 58 | | 'released' 59 | | 'seoname' 60 | | 'stars' 61 | | 'title' 62 | | 'url'; 63 | -------------------------------------------------------------------------------- /sample/delivery/system/index.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | export * from './core.type.js'; 17 | export * from './delivery.codenames.js'; 18 | -------------------------------------------------------------------------------- /sample/delivery/taxonomies/index.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | export * from './movietype.js'; 17 | export * from './releasecategory.js'; 18 | -------------------------------------------------------------------------------- /sample/delivery/taxonomies/movietype.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | /** 17 | * All taxonomy codename values for MovieType 18 | * 19 | * Codename: movietype 20 | * Id: 365a17e6-1929-27ab-9f67-a9273c846717 21 | */ 22 | export const MovieTypeValues = ['student', 'tv', 'blockbuster', 'cinema_only', 'film'] as const; 23 | 24 | /** 25 | * Type representing MovieType taxonomy 26 | * 27 | * Codename: movietype 28 | * Id: 365a17e6-1929-27ab-9f67-a9273c846717 29 | */ 30 | export type MovieType = (typeof MovieTypeValues)[number]; 31 | 32 | /** 33 | * Type guard for MovieType 34 | * 35 | * Codename: movietype 36 | * Id: 365a17e6-1929-27ab-9f67-a9273c846717 37 | */ 38 | export function isMovieType(value: string | undefined | null): value is MovieType { 39 | return typeof value === 'string' && (MovieTypeValues as readonly string[]).includes(value); 40 | } 41 | -------------------------------------------------------------------------------- /sample/delivery/taxonomies/releasecategory.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | /** 17 | * All taxonomy codename values for ReleaseCategory 18 | * 19 | * Codename: releasecategory 20 | * Id: 09b6a348-0f86-7a68-4af3-7cab9a5c60b7 21 | */ 22 | export const ReleaseCategoryValues = ['global_release', 'us_only', 'local_release'] as const; 23 | 24 | /** 25 | * Type representing ReleaseCategory taxonomy 26 | * 27 | * Codename: releasecategory 28 | * Id: 09b6a348-0f86-7a68-4af3-7cab9a5c60b7 29 | */ 30 | export type ReleaseCategory = (typeof ReleaseCategoryValues)[number]; 31 | 32 | /** 33 | * Type guard for ReleaseCategory 34 | * 35 | * Codename: releasecategory 36 | * Id: 09b6a348-0f86-7a68-4af3-7cab9a5c60b7 37 | */ 38 | export function isReleaseCategory(value: string | undefined | null): value is ReleaseCategory { 39 | return typeof value === 'string' && (ReleaseCategoryValues as readonly string[]).includes(value); 40 | } 41 | -------------------------------------------------------------------------------- /sample/environment/collections.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | export const collections = { 17 | /** 18 | * Default 19 | */ 20 | default: { 21 | name: 'Default', 22 | codename: 'default', 23 | id: '00000000-0000-0000-0000-000000000000' 24 | } 25 | } as const; 26 | -------------------------------------------------------------------------------- /sample/environment/contentTypeSnippets.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | export const contentTypeSnippets = {} as const; 17 | -------------------------------------------------------------------------------- /sample/environment/customApps.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | export const customApps = {} as const; 17 | -------------------------------------------------------------------------------- /sample/environment/index.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | export * from './assetFolders.js'; 17 | export * from './collections.js'; 18 | export * from './contentTypes.js'; 19 | export * from './contentTypeSnippets.js'; 20 | export * from './customApps.js'; 21 | export * from './languages.js'; 22 | export * from './previewUrls.js'; 23 | export * from './roles.js'; 24 | export * from './spaces.js'; 25 | export * from './taxonomies.js'; 26 | export * from './webhooks.js'; 27 | export * from './workflows.js'; 28 | -------------------------------------------------------------------------------- /sample/environment/languages.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | export const languages = { 17 | /** 18 | * English 19 | */ 20 | en: { 21 | name: 'English', 22 | codename: 'en', 23 | id: '00000000-0000-0000-0000-000000000000', 24 | isActive: true, 25 | isDefault: true, 26 | fallbackLanguageId: '00000000-0000-0000-0000-000000000000', 27 | externalId: undefined 28 | }, 29 | 30 | /** 31 | * cz 32 | */ 33 | cz: { 34 | name: 'cz', 35 | codename: 'cz', 36 | id: '41ccb26f-ceab-04d0-6ffa-9c7c5358aa8f', 37 | isActive: true, 38 | isDefault: false, 39 | fallbackLanguageId: '00000000-0000-0000-0000-000000000000', 40 | externalId: undefined 41 | }, 42 | 43 | /** 44 | * German 45 | */ 46 | german: { 47 | name: 'German', 48 | codename: 'German', 49 | id: '14f7bcc0-4fd6-4b77-8c22-70e5ccfdae1d', 50 | isActive: false, 51 | isDefault: false, 52 | fallbackLanguageId: '00000000-0000-0000-0000-000000000000', 53 | externalId: undefined 54 | } 55 | } as const; 56 | -------------------------------------------------------------------------------- /sample/environment/previewUrls.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | export const previewUrls = { 17 | /** 18 | * Preview configuration 19 | */ 20 | spaceDomains: { 21 | movies: { 22 | spaceName: 'Movies', 23 | spaceCodename: 'movies', 24 | domain: 'https://siteA.com' 25 | }, 26 | 27 | global: { 28 | spaceName: 'Global', 29 | spaceCodename: 'global', 30 | domain: 'https://siteB.com' 31 | } 32 | }, 33 | previewUrlPatterns: { 34 | actor: { 35 | contentTypeName: 'Actor', 36 | contentTypeCodename: 'actor', 37 | urlPatterns: { 38 | default: { 39 | spaceName: undefined, 40 | spaceCodename: undefined, 41 | url: 'https://sample.com/{codename}' 42 | } 43 | } 44 | }, 45 | 46 | movie: { 47 | contentTypeName: 'Movie', 48 | contentTypeCodename: 'movie', 49 | urlPatterns: { 50 | movies: { 51 | spaceName: 'Movies', 52 | spaceCodename: 'movies', 53 | url: 'https://sample.com/movieA/{itemId}' 54 | }, 55 | 56 | global: { 57 | spaceName: 'Global', 58 | spaceCodename: 'global', 59 | url: 'https://sample.com/movieB/{itemId}' 60 | } 61 | } 62 | } 63 | } 64 | } as const; 65 | -------------------------------------------------------------------------------- /sample/environment/roles.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | export const roles = { 17 | /** 18 | * Content contributor 19 | */ 20 | contentContributor: { 21 | name: 'Content contributor', 22 | codename: undefined, 23 | id: 'dca0ac85-274f-429e-b00e-6f74bf917051' 24 | }, 25 | 26 | /** 27 | * Reviewer 28 | */ 29 | reviewer: { 30 | name: 'Reviewer', 31 | codename: undefined, 32 | id: '94478afa-d898-45dd-8300-ba61b6e0eb4b' 33 | }, 34 | 35 | /** 36 | * Project manager 37 | */ 38 | projectManager: { 39 | name: 'Project manager', 40 | codename: 'project-manager', 41 | id: 'af95ac37-4efa-4b92-aa26-db773cd172c6' 42 | }, 43 | 44 | /** 45 | * Developer 46 | */ 47 | developer: { 48 | name: 'Developer', 49 | codename: undefined, 50 | id: 'b3994090-0818-4969-816b-f4c5d3e526f3' 51 | } 52 | } as const; 53 | -------------------------------------------------------------------------------- /sample/environment/spaces.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | export const spaces = { 17 | /** 18 | * Movies 19 | */ 20 | movies: { 21 | name: 'Movies', 22 | codename: 'movies', 23 | id: 'ae7187c1-b38b-4356-8ebc-4f9f4d84496a' 24 | }, 25 | 26 | /** 27 | * Global 28 | */ 29 | global: { 30 | name: 'Global', 31 | codename: 'global', 32 | id: '2de65a86-d41c-4fea-ba0b-9cf61584a6d5' 33 | } 34 | } as const; 35 | -------------------------------------------------------------------------------- /sample/environment/webhooks.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | export const webhooks = {} as const; 17 | -------------------------------------------------------------------------------- /sample/environment/workflows.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | export const workflows = { 17 | /** 18 | * Default 19 | */ 20 | default: { 21 | name: 'Default', 22 | codename: 'default', 23 | id: '00000000-0000-0000-0000-000000000000', 24 | steps: { 25 | draft: { 26 | name: 'Draft', 27 | codename: 'draft', 28 | id: 'e3ef0816-2203-4456-bfdc-a735b4f339ab' 29 | }, 30 | review: { 31 | name: 'Review', 32 | codename: 'review', 33 | id: 'c5682935-f5a2-4514-8025-57d8bdf7558d' 34 | }, 35 | ready_to_publish: { 36 | name: 'Ready to publish', 37 | codename: 'ready_to_publish', 38 | id: 'aaee1d73-f0cc-4185-9e49-844d161c3634' 39 | }, 40 | scheduled: { 41 | name: 'Scheduled', 42 | codename: 'scheduled', 43 | id: '9d2b0228-4d0d-4c23-8b49-01a698857709' 44 | }, 45 | published: { 46 | name: 'Published', 47 | codename: 'published', 48 | id: 'f05b8a85-c6cc-429a-ac6d-21d5edd268fe' 49 | }, 50 | archived: { 51 | name: 'Archived', 52 | codename: 'archived', 53 | id: '7a535a69-ad34-47f8-806a-def1fdf4d391' 54 | } 55 | } 56 | } 57 | } as const; 58 | -------------------------------------------------------------------------------- /sample/items/codenames/actor.codenames.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | /** 17 | * Type representing available item codenames 18 | * 19 | * Actor 20 | * 21 | * Codename: actor 22 | * Id: 58099989-319f-495f-aa36-cb3710854e36 23 | * Codename: actor 24 | */ 25 | export type ActorCodenames = 26 | | 'anne_hathaway' 27 | | 'bill_nighy' 28 | | 'billy_crystal' 29 | | 'christian_bale' 30 | | 'domhnall_gleeson' 31 | | 'jessica_chastain' 32 | | 'joel_edgerton' 33 | | 'kristen_wiig' 34 | | 'matt_damon' 35 | | 'nathalie_boltt' 36 | | 'rachel_mcadams' 37 | | 'sharlto_copley' 38 | | 'tom_hardy'; 39 | -------------------------------------------------------------------------------- /sample/items/codenames/index.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | export * from './actor.codenames.js'; 17 | export * from './movie.codenames.js'; 18 | -------------------------------------------------------------------------------- /sample/items/codenames/movie.codenames.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | /** 17 | * Type representing available item codenames 18 | * 19 | * Movie 20 | * 21 | * Codename: movie 22 | * Id: b0c0f9c2-ffb6-4e62-bac9-34e14172dd8c 23 | * Codename: movie 24 | */ 25 | export type MovieCodenames = '_the_dark_knight_rises' | 'about_time' | 'district_9' | 'monsters__inc_' | 'the_martian' | 'warrior'; 26 | -------------------------------------------------------------------------------- /sample/items/index.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | export * from './codenames/index.js'; 17 | export * from './items/index.js'; 18 | -------------------------------------------------------------------------------- /sample/items/items/index.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | export * from './actor.items.js'; 17 | export * from './movie.items.js'; 18 | -------------------------------------------------------------------------------- /sample/items/items/movie.items.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | /** 17 | * Object representing identifiers of available items 18 | * 19 | * Movie 20 | * 21 | * Codename: movie 22 | * Id: b0c0f9c2-ffb6-4e62-bac9-34e14172dd8c 23 | * Codename: movie 24 | */ 25 | export const movieItems = { 26 | /** 27 | * The Dark Knight Rises 28 | */ 29 | _the_dark_knight_rises: { 30 | codename: '_the_dark_knight_rises', 31 | id: 'e9ff5385-0f10-469a-8525-98189e295c0d' 32 | }, 33 | 34 | /** 35 | * About Time 36 | */ 37 | about_time: { 38 | codename: 'about_time', 39 | id: 'f5d741ec-e500-4285-97f0-a30196a655bd' 40 | }, 41 | 42 | /** 43 | * District 9 44 | */ 45 | district_9: { 46 | codename: 'district_9', 47 | id: 'e0b67f90-790c-4509-8679-5ca2df42f3b8' 48 | }, 49 | 50 | /** 51 | * Monsters, Inc. 52 | */ 53 | monsters__inc_: { 54 | codename: 'monsters__inc_', 55 | id: '00e96c5c-22a2-4ecf-811d-28881d1d2eda' 56 | }, 57 | 58 | /** 59 | * The Martian 60 | */ 61 | the_martian: { 62 | codename: 'the_martian', 63 | id: 'e9ac3dd7-8129-4f9a-9112-eb24d84d3ecd' 64 | }, 65 | 66 | /** 67 | * Warrior 68 | */ 69 | warrior: { 70 | codename: 'warrior', 71 | id: '325e2acb-1c14-47f6-af9a-27bc8b6c16fe' 72 | } 73 | } as const; 74 | -------------------------------------------------------------------------------- /sample/migration/content-types/index.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | export * from './actor.js'; 17 | export * from './movie.js'; 18 | -------------------------------------------------------------------------------- /sample/migration/environment/environment.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | /** 17 | * Type representing all languages 18 | */ 19 | export type LanguageCodenames = 'cz' | 'en' | 'German'; 20 | 21 | /** 22 | * Type representing all content types 23 | */ 24 | export type ContentTypeCodenames = 'actor' | 'movie'; 25 | 26 | /** 27 | * Type representing all collections 28 | */ 29 | export type CollectionCodenames = 'default'; 30 | 31 | /** 32 | * Type representing all workflows 33 | */ 34 | export type WorkflowCodenames = 'default'; 35 | 36 | /** 37 | * Type representing all worksflow steps across all workflows 38 | */ 39 | export type WorkflowStepCodenames = 'archived' | 'draft' | 'published' | 'ready_to_publish' | 'review' | 'scheduled'; 40 | -------------------------------------------------------------------------------- /sample/migration/environment/index.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | export * from './environment.js'; 17 | -------------------------------------------------------------------------------- /sample/migration/index.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | export * from './content-types/index.js'; 17 | export * from './environment/index.js'; 18 | export * from './migration.js'; 19 | -------------------------------------------------------------------------------- /sample/migration/migration.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This file has been auto-generated by '@kontent-ai/model-generator@8.1.1'. 4 | * 5 | * (c) Kontent.ai 6 | * 7 | * ------------------------------------------------------------------------------- 8 | * 9 | * Project: Movie Database 10 | * Environment: Production 11 | * Id: da5abe9f-fdad-4168-97cd-b3464be2ccb9 12 | * 13 | * ------------------------------------------------------------------------------- 14 | **/ 15 | 16 | import type { MigrationItem, MigrationItemSystem, MigrationElements } from '@kontent-ai/migration-toolkit'; 17 | import type { 18 | CollectionCodenames, 19 | ContentTypeCodenames, 20 | LanguageCodenames, 21 | WorkflowCodenames, 22 | WorkflowStepCodenames 23 | } from './environment/environment.js'; 24 | 25 | /** 26 | * System object shared by all individual content type models 27 | */ 28 | export type CoreMigrationItemSystem = MigrationItemSystem< 29 | TCodename, 30 | LanguageCodenames, 31 | CollectionCodenames, 32 | WorkflowCodenames 33 | >; 34 | 35 | /** 36 | * Item object shared by all individual content type models 37 | */ 38 | export type CoreMigrationItem< 39 | TCodename extends ContentTypeCodenames, 40 | TElements extends MigrationElements = MigrationElements 41 | > = MigrationItem, WorkflowStepCodenames>; 42 | -------------------------------------------------------------------------------- /scripts/clean-snapshots.ts: -------------------------------------------------------------------------------- 1 | import { deleteFolderRecursive } from './utils/script.utils.js'; 2 | 3 | for (const path of ['tests/integration/snapshots']) { 4 | deleteFolderRecursive(path); 5 | } 6 | -------------------------------------------------------------------------------- /scripts/clean.ts: -------------------------------------------------------------------------------- 1 | import { deleteFolderRecursive } from './utils/script.utils.js'; 2 | 3 | for (const path of ['dist']) { 4 | deleteFolderRecursive(path); 5 | } 6 | -------------------------------------------------------------------------------- /scripts/samples/delivery-sample.ts: -------------------------------------------------------------------------------- 1 | import { generateDeliveryModelsAsync } from '../../lib/generators/delivery/delivery-func.js'; 2 | import { deleteFolderRecursive, runScriptAsync } from '../utils/script.utils.js'; 3 | 4 | const outputDir: string = './sample/delivery'; 5 | 6 | await runScriptAsync(async (config) => { 7 | deleteFolderRecursive(outputDir); 8 | 9 | await generateDeliveryModelsAsync({ 10 | // required 11 | environmentId: config.sampleEnv.environmentId, 12 | managementApiKey: config.sampleEnv.managementApiKey, 13 | moduleFileExtension: config.moduleFileExtension, 14 | createFiles: true, 15 | addTimestamp: false, 16 | outputDir: outputDir, // only required when createFiles is true 17 | 18 | // optional 19 | fileResolvers: { contentType: 'camelCase', snippet: 'camelCase', taxonomy: 'camelCase' }, 20 | nameResolvers: { contentType: 'pascalCase', snippet: 'pascalCase', taxonomy: 'pascalCase' }, 21 | formatOptions: undefined, 22 | managementBaseUrl: undefined 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /scripts/samples/environment-sample.ts: -------------------------------------------------------------------------------- 1 | import { generateEnvironmentModelsAsync } from '../../lib/generators/environment/environment-func.js'; 2 | import { deleteFolderRecursive, runScriptAsync } from '../utils/script.utils.js'; 3 | 4 | const outputDir: string = './sample/environment'; 5 | 6 | await runScriptAsync(async (config) => { 7 | deleteFolderRecursive(outputDir); 8 | 9 | await generateEnvironmentModelsAsync({ 10 | // required 11 | environmentId: config.sampleEnv.environmentId, 12 | managementApiKey: config.sampleEnv.managementApiKey, 13 | entities: undefined, // all entity types are exported by default 14 | addTimestamp: false, 15 | moduleFileExtension: config.moduleFileExtension, 16 | createFiles: true, 17 | outputDir: outputDir, // only required when createFiles is true 18 | // optional 19 | managementBaseUrl: undefined, 20 | formatOptions: undefined 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /scripts/samples/item-sample.ts: -------------------------------------------------------------------------------- 1 | import { generateItemsAsync } from '../../lib/generators/items/items-func.js'; 2 | import { deleteFolderRecursive, runScriptAsync } from '../utils/script.utils.js'; 3 | 4 | const outputDir: string = './sample/items'; 5 | 6 | await runScriptAsync(async (config) => { 7 | deleteFolderRecursive(outputDir); 8 | 9 | await generateItemsAsync({ 10 | // required 11 | environmentId: config.sampleEnv.environmentId, 12 | addTimestamp: false, 13 | managementApiKey: config.sampleEnv.managementApiKey, 14 | moduleFileExtension: config.moduleFileExtension, 15 | apiMode: 'default', 16 | deliveryApiKey: config.sampleEnv.deliveryApiKey, 17 | filterByTypeCodenames: [], 18 | generateObjects: true, 19 | generateTypes: true, 20 | createFiles: true, 21 | outputDir: outputDir, 22 | // optional 23 | managementBaseUrl: undefined, 24 | formatOptions: undefined, 25 | deliveryBaseUrl: undefined 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /scripts/samples/migration-sample.ts: -------------------------------------------------------------------------------- 1 | import { generateMigrationModelsAsync } from '../../lib/generators/migration/migration-func.js'; 2 | import { deleteFolderRecursive, runScriptAsync } from '../utils/script.utils.js'; 3 | 4 | const outputDir: string = './sample/migration'; 5 | 6 | await runScriptAsync(async (config) => { 7 | deleteFolderRecursive(outputDir); 8 | 9 | await generateMigrationModelsAsync({ 10 | // required 11 | createFiles: true, 12 | addTimestamp: false, 13 | environmentId: config.sampleEnv.environmentId, 14 | managementApiKey: config.sampleEnv.managementApiKey, 15 | moduleFileExtension: config.moduleFileExtension, 16 | outputDir: outputDir, // only required when createFiles is true 17 | 18 | // optional 19 | managementBaseUrl: undefined, 20 | formatOptions: undefined 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /scripts/update-version.ts: -------------------------------------------------------------------------------- 1 | import packageJson from '../package.json' with { type: 'json' }; 2 | import { createVersionFile } from './utils/script.utils.js'; 3 | 4 | createVersionFile({ 5 | date: new Date(), 6 | filePath: './lib/meta/metadata.ts', 7 | propertyName: 'libMetadata', 8 | packageName: packageJson.name, 9 | packageVersion: packageJson.version 10 | }); 11 | -------------------------------------------------------------------------------- /scripts/utils/environment.utils.ts: -------------------------------------------------------------------------------- 1 | import chalk from 'chalk'; 2 | import * as dotenv from 'dotenv'; 3 | 4 | // needed to load .env environment to current process when run via package.json script 5 | dotenv.config(); 6 | 7 | export function getEnvironmentRequiredValue(variableName: string): string { 8 | const value = getEnvironmentOptionalValue(variableName); 9 | 10 | if (!value) { 11 | throw new Error(`Missing environment variable '${chalk.red(variableName)}'`); 12 | } 13 | 14 | return value; 15 | } 16 | 17 | export function getEnvironmentOptionalValue(variableName: string): string | undefined { 18 | return process.env?.[variableName]; 19 | } 20 | -------------------------------------------------------------------------------- /tests/integration/integration-tests.config.ts: -------------------------------------------------------------------------------- 1 | import type { CliAction, GeneratedFile } from '../../lib/core/core.models.js'; 2 | import { getEnvironmentRequiredValue } from '../../scripts/utils/environment.utils.js'; 3 | 4 | export type SnapshotModelsTest = { 5 | readonly cliAction: CliAction; 6 | readonly folder: string; 7 | readonly getFilesAsync: () => Promise; 8 | }; 9 | 10 | export const integrationEnv = { 11 | id: getEnvironmentRequiredValue('INTEGRATION_ENVIRONMENT_ID'), 12 | apiKey: getEnvironmentRequiredValue('INTEGRATION_MANAGEMENT_API_KEY') 13 | } as const; 14 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-js/_filesList.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "filename": "content-types/content_type_with_snippet_only.ts" }, 3 | { "filename": "content-types/_content_type_with_special_chars____.ts" }, 4 | { "filename": "content-types/circular_reference_type_a_b.ts" }, 5 | { "filename": "content-types/page.ts" }, 6 | { "filename": "content-types/content_type_with_all_elements.ts" }, 7 | { "filename": "content-types/content_type_with_guidelines_only.ts" }, 8 | { "filename": "content-types/circular_reference_type_b____a.ts" }, 9 | { "filename": "content-types/empty_content_type.ts" }, 10 | { "filename": "content-types/type_with_empty_snippet.ts" }, 11 | { "filename": "content-types/web_spotlight_root.ts" }, 12 | { "filename": "content-types/type_referencing_deleted_type.ts" }, 13 | { "filename": "content-types/index.ts" }, 14 | { "filename": "content-type-snippets/snippet_a.ts" }, 15 | { "filename": "content-type-snippets/empty_snippet.ts" }, 16 | { "filename": "content-type-snippets/index.ts" }, 17 | { "filename": "taxonomies/taxonomy_a.ts" }, 18 | { "filename": "taxonomies/taxonomy_without_terms.ts" }, 19 | { "filename": "taxonomies/index.ts" }, 20 | { "filename": "system/core.type.ts" }, 21 | { "filename": "system/delivery.codenames.ts" }, 22 | { "filename": "system/index.ts" }, 23 | { "filename": "index.ts" } 24 | ] 25 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-js/content-type-snippets/empty_snippet.ts: -------------------------------------------------------------------------------- 1 | import type { Snippet } from '@kontent-ai/delivery-sdk'; 2 | 3 | /** 4 | * Empty snippet 5 | * 6 | * Id: 1d7e3745-3320-4107-996b-2c6b240df7ae 7 | * Codename: empty_snippet 8 | */ 9 | export type EmptySnippet = Snippet>; 10 | 11 | /** 12 | * Type representing all available element codenames for Empty snippet 13 | */ 14 | export type EmptySnippetElementCodenames = never; 15 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-js/content-type-snippets/index.ts: -------------------------------------------------------------------------------- 1 | export * from './empty_snippet.js'; 2 | export * from './snippet_a.js'; 3 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-js/content-type-snippets/snippet_a.ts: -------------------------------------------------------------------------------- 1 | import type { Elements, Snippet } from '@kontent-ai/delivery-sdk'; 2 | import type { ContentTypeWithAllElements } from '../content-types/index.js'; 3 | import type { CoreContentType } from '../system/index.js'; 4 | 5 | /** 6 | * Snippet A 7 | * 8 | * Id: b74eb5f6-c851-42f2-9fea-e367d0a3fa61 9 | * Codename: snippet_a 10 | */ 11 | export type SnippetA = Snippet< 12 | SnippetAElementCodenames, 13 | { 14 | /** 15 | * Rich text with all allowed item types 16 | * 17 | * Type: rich_text 18 | * Required: false 19 | * Codename: snippet_a__rich_text_with_all_allowed_item_types 20 | * Id: 72cdc4e7-dead-4baf-99bf-91d8fe62351f 21 | */ 22 | readonly snippet_a__rich_text_with_all_allowed_item_types: Elements.RichTextElement; 23 | /** 24 | * Linked items with specific types 25 | * 26 | * Type: modular_content 27 | * Required: false 28 | * Codename: snippet_a__linked_items_with_specific_types 29 | * Id: 140130dc-84c1-455f-99ab-d31579cf90d1 30 | */ 31 | readonly snippet_a__linked_items_with_specific_types: Elements.LinkedItemsElement; 32 | /** 33 | * Text 34 | * 35 | * Type: text 36 | * Required: true 37 | * Codename: snippet_a__text 38 | * Id: 873e4a7a-e2ea-49a0-b88e-2ff7b6892f60 39 | */ 40 | readonly snippet_a__text: Elements.TextElement; 41 | } 42 | >; 43 | 44 | /** 45 | * Type representing all available element codenames for Snippet A 46 | */ 47 | export type SnippetAElementCodenames = 48 | | 'snippet_a__rich_text_with_all_allowed_item_types' 49 | | 'snippet_a__linked_items_with_specific_types' 50 | | 'snippet_a__text'; 51 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-js/content-types/_content_type_with_special_chars____.ts: -------------------------------------------------------------------------------- 1 | import type { Elements } from '@kontent-ai/delivery-sdk'; 2 | import type { CoreContentType } from '../system/index.js'; 3 | 4 | /** 5 | * 🐧 Content type with special chars #!_' 6 | * 7 | * Id: 66bfcb40-edd7-4edf-8176-33517d0d6f80 8 | * Codename: _content_type_with_special_chars____ 9 | */ 10 | export type ContentTypeWithSpecialChars = CoreContentType< 11 | ContentTypeWithSpecialCharsElementCodenames, 12 | { 13 | /** 14 | * 🦜Parrot_emoji 15 | * 16 | * Type: text 17 | * Required: false 18 | * Codename: parrot__ 19 | * Id: cafaa776-893d-4e8c-b460-9534ac2fe769 20 | */ 21 | readonly parrot__: Elements.TextElement; 22 | /** 23 | * !!!_$NumberElem<>-%@&{}()/§'`?´=^*#~ 24 | * 25 | * Type: number 26 | * Required: false 27 | * Codename: _____numberelem_____________________ 28 | * Id: 3bb33958-71f3-4039-8594-5f0df9378dbb 29 | */ 30 | readonly _____numberelem_____________________: Elements.NumberElement; 31 | }, 32 | '_content_type_with_special_chars____' 33 | >; 34 | 35 | /** 36 | * Type representing all available element codenames for 🐧 Content type with special chars #!_' 37 | */ 38 | export type ContentTypeWithSpecialCharsElementCodenames = 'parrot__' | '_____numberelem_____________________'; 39 | 40 | /** 41 | * Type guard for 🐧 Content type with special chars #!_' 42 | * 43 | * Id: 66bfcb40-edd7-4edf-8176-33517d0d6f80 44 | * Codename: _content_type_with_special_chars____ 45 | */ 46 | export function isContentTypeWithSpecialChars(item: CoreContentType | undefined | null): item is ContentTypeWithSpecialChars { 47 | return item?.system?.type === '_content_type_with_special_chars____'; 48 | } 49 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-js/content-types/circular_reference_type_a_b.ts: -------------------------------------------------------------------------------- 1 | import type { Elements } from '@kontent-ai/delivery-sdk'; 2 | import type { CircularReferenceTypeBA } from './index.js'; 3 | import type { CoreContentType } from '../system/index.js'; 4 | 5 | /** 6 | * Circular reference type A > B 7 | * 8 | * Id: a58680f7-0667-4a0e-8dc2-889233bdbf71 9 | * Codename: circular_reference_type_a_b 10 | */ 11 | export type CircularReferenceTypeAB = CoreContentType< 12 | CircularReferenceTypeABElementCodenames, 13 | { 14 | /** 15 | * Items 16 | * 17 | * Type: modular_content 18 | * Required: false 19 | * Codename: items 20 | * Id: 33ab92dd-e47d-45e2-a060-3b5df0754c24 21 | */ 22 | readonly items: Elements.LinkedItemsElement; 23 | }, 24 | 'circular_reference_type_a_b' 25 | >; 26 | 27 | /** 28 | * Type representing all available element codenames for Circular reference type A > B 29 | */ 30 | export type CircularReferenceTypeABElementCodenames = 'items'; 31 | 32 | /** 33 | * Type guard for Circular reference type A > B 34 | * 35 | * Id: a58680f7-0667-4a0e-8dc2-889233bdbf71 36 | * Codename: circular_reference_type_a_b 37 | */ 38 | export function isCircularReferenceTypeAB(item: CoreContentType | undefined | null): item is CircularReferenceTypeAB { 39 | return item?.system?.type === 'circular_reference_type_a_b'; 40 | } 41 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-js/content-types/circular_reference_type_b____a.ts: -------------------------------------------------------------------------------- 1 | import type { Elements } from '@kontent-ai/delivery-sdk'; 2 | import type { CircularReferenceTypeAB } from './index.js'; 3 | import type { CoreContentType } from '../system/index.js'; 4 | 5 | /** 6 | * Circular reference type B -> A 7 | * 8 | * Id: 919bdcad-fe8e-4f56-9a63-346154b6f6e2 9 | * Codename: circular_reference_type_b____a 10 | */ 11 | export type CircularReferenceTypeBA = CoreContentType< 12 | CircularReferenceTypeBAElementCodenames, 13 | { 14 | /** 15 | * Items 16 | * 17 | * Type: modular_content 18 | * Required: false 19 | * Codename: items 20 | * Id: 019714f7-8c50-492b-8e5c-f7c3d7e2529b 21 | */ 22 | readonly items: Elements.LinkedItemsElement; 23 | }, 24 | 'circular_reference_type_b____a' 25 | >; 26 | 27 | /** 28 | * Type representing all available element codenames for Circular reference type B -> A 29 | */ 30 | export type CircularReferenceTypeBAElementCodenames = 'items'; 31 | 32 | /** 33 | * Type guard for Circular reference type B -> A 34 | * 35 | * Id: 919bdcad-fe8e-4f56-9a63-346154b6f6e2 36 | * Codename: circular_reference_type_b____a 37 | */ 38 | export function isCircularReferenceTypeBA(item: CoreContentType | undefined | null): item is CircularReferenceTypeBA { 39 | return item?.system?.type === 'circular_reference_type_b____a'; 40 | } 41 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-js/content-types/content_type_with_guidelines_only.ts: -------------------------------------------------------------------------------- 1 | import type { CoreContentType } from '../system/index.js'; 2 | 3 | /** 4 | * Content type with guidelines only 5 | * 6 | * Id: 7e38a995-b4d7-46c9-92a4-4359241fa5ef 7 | * Codename: content_type_with_guidelines_only 8 | */ 9 | export type ContentTypeWithGuidelinesOnly = CoreContentType< 10 | ContentTypeWithGuidelinesOnlyElementCodenames, 11 | Record, 12 | 'content_type_with_guidelines_only' 13 | >; 14 | 15 | /** 16 | * Type representing all available element codenames for Content type with guidelines only 17 | */ 18 | export type ContentTypeWithGuidelinesOnlyElementCodenames = never; 19 | 20 | /** 21 | * Type guard for Content type with guidelines only 22 | * 23 | * Id: 7e38a995-b4d7-46c9-92a4-4359241fa5ef 24 | * Codename: content_type_with_guidelines_only 25 | */ 26 | export function isContentTypeWithGuidelinesOnly(item: CoreContentType | undefined | null): item is ContentTypeWithGuidelinesOnly { 27 | return item?.system?.type === 'content_type_with_guidelines_only'; 28 | } 29 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-js/content-types/content_type_with_snippet_only.ts: -------------------------------------------------------------------------------- 1 | import type { CoreContentType } from '../system/index.js'; 2 | import type { SnippetA } from '../content-type-snippets/index.js'; 3 | 4 | /** 5 | * Content type with snippet only 6 | * 7 | * Id: 7fd86bef-8f30-4a02-a1c3-fb130f65e9b4 8 | * Codename: content_type_with_snippet_only 9 | */ 10 | export type ContentTypeWithSnippetOnly = CoreContentType< 11 | ContentTypeWithSnippetOnlyElementCodenames, 12 | Record & SnippetA, 13 | 'content_type_with_snippet_only' 14 | >; 15 | 16 | /** 17 | * Type representing all available element codenames for Content type with snippet only 18 | */ 19 | export type ContentTypeWithSnippetOnlyElementCodenames = 20 | | 'snippet_a__rich_text_with_all_allowed_item_types' 21 | | 'snippet_a__linked_items_with_specific_types' 22 | | 'snippet_a__text'; 23 | 24 | /** 25 | * Type guard for Content type with snippet only 26 | * 27 | * Id: 7fd86bef-8f30-4a02-a1c3-fb130f65e9b4 28 | * Codename: content_type_with_snippet_only 29 | */ 30 | export function isContentTypeWithSnippetOnly(item: CoreContentType | undefined | null): item is ContentTypeWithSnippetOnly { 31 | return item?.system?.type === 'content_type_with_snippet_only'; 32 | } 33 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-js/content-types/empty_content_type.ts: -------------------------------------------------------------------------------- 1 | import type { CoreContentType } from '../system/index.js'; 2 | 3 | /** 4 | * Empty content type 5 | * 6 | * Id: 4e41e105-6ec5-4a08-9680-b85e9cd8b14e 7 | * Codename: empty_content_type 8 | */ 9 | export type EmptyContentType = CoreContentType, 'empty_content_type'>; 10 | 11 | /** 12 | * Type representing all available element codenames for Empty content type 13 | */ 14 | export type EmptyContentTypeElementCodenames = never; 15 | 16 | /** 17 | * Type guard for Empty content type 18 | * 19 | * Id: 4e41e105-6ec5-4a08-9680-b85e9cd8b14e 20 | * Codename: empty_content_type 21 | */ 22 | export function isEmptyContentType(item: CoreContentType | undefined | null): item is EmptyContentType { 23 | return item?.system?.type === 'empty_content_type'; 24 | } 25 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-js/content-types/index.ts: -------------------------------------------------------------------------------- 1 | export * from './_content_type_with_special_chars____.js'; 2 | export * from './circular_reference_type_a_b.js'; 3 | export * from './circular_reference_type_b____a.js'; 4 | export * from './content_type_with_all_elements.js'; 5 | export * from './content_type_with_guidelines_only.js'; 6 | export * from './content_type_with_snippet_only.js'; 7 | export * from './empty_content_type.js'; 8 | export * from './page.js'; 9 | export * from './type_referencing_deleted_type.js'; 10 | export * from './type_with_empty_snippet.js'; 11 | export * from './web_spotlight_root.js'; 12 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-js/content-types/type_referencing_deleted_type.ts: -------------------------------------------------------------------------------- 1 | import type { Elements } from '@kontent-ai/delivery-sdk'; 2 | import type { CoreContentType } from '../system/index.js'; 3 | 4 | /** 5 | * Type referencing deleted type 6 | * 7 | * Id: f7562083-7230-4c20-9136-620ee7a92534 8 | * Codename: type_referencing_deleted_type 9 | */ 10 | export type TypeReferencingDeletedType = CoreContentType< 11 | TypeReferencingDeletedTypeElementCodenames, 12 | { 13 | /** 14 | * Rich text with invalid type 15 | * 16 | * Type: rich_text 17 | * Required: false 18 | * Codename: rich_text_with_invalid_type 19 | * Id: 03df7457-fb30-4d4e-aee2-06b0e1f218a2 20 | */ 21 | readonly rich_text_with_invalid_type: Elements.RichTextElement; 22 | /** 23 | * Linked items with invalid type 24 | * 25 | * Type: modular_content 26 | * Required: false 27 | * Codename: linked_items_with_invalid_type 28 | * Id: cc310017-de8b-42f1-962b-63959367d29a 29 | */ 30 | readonly linked_items_with_invalid_type: Elements.LinkedItemsElement; 31 | }, 32 | 'type_referencing_deleted_type' 33 | >; 34 | 35 | /** 36 | * Type representing all available element codenames for Type referencing deleted type 37 | */ 38 | export type TypeReferencingDeletedTypeElementCodenames = 'rich_text_with_invalid_type' | 'linked_items_with_invalid_type'; 39 | 40 | /** 41 | * Type guard for Type referencing deleted type 42 | * 43 | * Id: f7562083-7230-4c20-9136-620ee7a92534 44 | * Codename: type_referencing_deleted_type 45 | */ 46 | export function isTypeReferencingDeletedType(item: CoreContentType | undefined | null): item is TypeReferencingDeletedType { 47 | return item?.system?.type === 'type_referencing_deleted_type'; 48 | } 49 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-js/content-types/type_with_empty_snippet.ts: -------------------------------------------------------------------------------- 1 | import type { CoreContentType } from '../system/index.js'; 2 | 3 | /** 4 | * Type with empty snippet 5 | * 6 | * Id: 11039462-1d7d-4673-9aa8-af07fb53985c 7 | * Codename: type_with_empty_snippet 8 | */ 9 | export type TypeWithEmptySnippet = CoreContentType, 'type_with_empty_snippet'>; 10 | 11 | /** 12 | * Type representing all available element codenames for Type with empty snippet 13 | */ 14 | export type TypeWithEmptySnippetElementCodenames = never; 15 | 16 | /** 17 | * Type guard for Type with empty snippet 18 | * 19 | * Id: 11039462-1d7d-4673-9aa8-af07fb53985c 20 | * Codename: type_with_empty_snippet 21 | */ 22 | export function isTypeWithEmptySnippet(item: CoreContentType | undefined | null): item is TypeWithEmptySnippet { 23 | return item?.system?.type === 'type_with_empty_snippet'; 24 | } 25 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-js/content-types/web_spotlight_root.ts: -------------------------------------------------------------------------------- 1 | import type { Elements } from '@kontent-ai/delivery-sdk'; 2 | import type { CoreContentType } from '../system/index.js'; 3 | import type { Page } from './index.js'; 4 | 5 | /** 6 | * Web spotlight root 7 | * 8 | * Id: 7e8ca9f3-7f06-44d6-b9db-ae4905531365 9 | * Codename: web_spotlight_root 10 | */ 11 | export type WebSpotlightRoot = CoreContentType< 12 | WebSpotlightRootElementCodenames, 13 | { 14 | /** 15 | * Title 16 | * 17 | * Type: text 18 | * Required: false 19 | * Codename: title 20 | * Id: e9d19fa4-4ad3-4b3f-998a-ca392651f7d0 21 | */ 22 | readonly title: Elements.TextElement; 23 | /** 24 | * Subpages 25 | * 26 | * Type: subpages 27 | * Required: false 28 | * Codename: subpages 29 | * Id: e6702a6b-35b8-4a12-acca-1b1361fc926b 30 | */ 31 | readonly subpages: Elements.LinkedItemsElement; 32 | /** 33 | * Content 34 | * 35 | * Type: modular_content 36 | * Required: false 37 | * Codename: content 38 | * Id: ad185ebb-c7ec-4b89-bf89-4b415b5e0ca8 39 | */ 40 | readonly content: Elements.LinkedItemsElement; 41 | }, 42 | 'web_spotlight_root' 43 | >; 44 | 45 | /** 46 | * Type representing all available element codenames for Web spotlight root 47 | */ 48 | export type WebSpotlightRootElementCodenames = 'title' | 'subpages' | 'content'; 49 | 50 | /** 51 | * Type guard for Web spotlight root 52 | * 53 | * Id: 7e8ca9f3-7f06-44d6-b9db-ae4905531365 54 | * Codename: web_spotlight_root 55 | */ 56 | export function isWebSpotlightRoot(item: CoreContentType | undefined | null): item is WebSpotlightRoot { 57 | return item?.system?.type === 'web_spotlight_root'; 58 | } 59 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-js/index.ts: -------------------------------------------------------------------------------- 1 | export * from './content-type-snippets/index.js'; 2 | export * from './content-types/index.js'; 3 | export * from './system/index.js'; 4 | export * from './taxonomies/index.js'; 5 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-js/system/core.type.ts: -------------------------------------------------------------------------------- 1 | import type { IContentItem, IContentItemElements, IDeliveryClient } from '@kontent-ai/delivery-sdk'; 2 | import type { 3 | ContentTypeCodenames, 4 | CollectionCodenames, 5 | LanguageCodenames, 6 | WorkflowCodenames, 7 | WorkflowStepCodenames, 8 | ElementCodenames, 9 | TaxonomyCodenames 10 | } from './delivery.codenames.js'; 11 | 12 | /** 13 | * Core content type used in favor of default 'IContentItem' 14 | */ 15 | export type CoreContentType< 16 | TElementCodenames extends string = string, 17 | TElements extends IContentItemElements = IContentItemElements, 18 | TContentTypeCodename extends ContentTypeCodenames = ContentTypeCodenames 19 | > = IContentItem; 20 | 21 | /** 22 | * Core types for 'IDeliveryClient' 23 | */ 24 | export type CoreClientTypes = { 25 | readonly collectionCodenames: CollectionCodenames; 26 | readonly contentItemType: CoreContentType; 27 | readonly contentTypeCodenames: ContentTypeCodenames; 28 | readonly elementCodenames: ElementCodenames; 29 | readonly languageCodenames: LanguageCodenames; 30 | readonly taxonomyCodenames: TaxonomyCodenames; 31 | readonly workflowCodenames: WorkflowCodenames; 32 | readonly workflowStepCodenames: WorkflowStepCodenames; 33 | }; 34 | 35 | /** 36 | * Typed delivery client in favor of default 'IDeliveryClient' 37 | */ 38 | export type CoreDeliveryClient = IDeliveryClient; 39 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-js/system/index.ts: -------------------------------------------------------------------------------- 1 | export * from './core.type.js'; 2 | export * from './delivery.codenames.js'; 3 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-js/taxonomies/index.ts: -------------------------------------------------------------------------------- 1 | export * from './taxonomy_a.js'; 2 | export * from './taxonomy_without_terms.js'; 3 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-js/taxonomies/taxonomy_a.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * All taxonomy codename values for Taxonomy A 3 | * 4 | * Codename: taxonomy_a 5 | * Id: bb37a632-3f78-48f8-ba25-7fa806d41a3e 6 | */ 7 | export const taxonomyAValues = ['nested_term_2', 'nested_term_1', 'term_1', 'term_2', 'term_3'] as const; 8 | 9 | /** 10 | * Type representing Taxonomy A taxonomy 11 | * 12 | * Codename: taxonomy_a 13 | * Id: bb37a632-3f78-48f8-ba25-7fa806d41a3e 14 | */ 15 | export type TaxonomyA = (typeof taxonomyAValues)[number]; 16 | 17 | /** 18 | * Type guard for Taxonomy A 19 | * 20 | * Codename: taxonomy_a 21 | * Id: bb37a632-3f78-48f8-ba25-7fa806d41a3e 22 | */ 23 | export function isTaxonomyA(value: string | undefined | null): value is TaxonomyA { 24 | return typeof value === 'string' && (taxonomyAValues as readonly string[]).includes(value); 25 | } 26 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-js/taxonomies/taxonomy_without_terms.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * All taxonomy codename values for Taxonomy without terms 3 | * 4 | * Codename: taxonomy_without_terms 5 | * Id: 01878d46-fcbc-4211-a801-676ad4e72cb2 6 | */ 7 | export const taxonomyWithoutTermsValues = [] as const; 8 | 9 | /** 10 | * Type representing Taxonomy without terms taxonomy 11 | * 12 | * Codename: taxonomy_without_terms 13 | * Id: 01878d46-fcbc-4211-a801-676ad4e72cb2 14 | */ 15 | export type TaxonomyWithoutTerms = (typeof taxonomyWithoutTermsValues)[number]; 16 | 17 | /** 18 | * Type guard for Taxonomy without terms 19 | * 20 | * Codename: taxonomy_without_terms 21 | * Id: 01878d46-fcbc-4211-a801-676ad4e72cb2 22 | */ 23 | export function isTaxonomyWithoutTerms(value: string | undefined | null): value is TaxonomyWithoutTerms { 24 | return typeof value === 'string' && (taxonomyWithoutTermsValues as readonly string[]).includes(value); 25 | } 26 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-ts/_filesList.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "filename": "content-types/content_type_with_snippet_only.ts" }, 3 | { "filename": "content-types/_content_type_with_special_chars____.ts" }, 4 | { "filename": "content-types/circular_reference_type_a_b.ts" }, 5 | { "filename": "content-types/page.ts" }, 6 | { "filename": "content-types/content_type_with_all_elements.ts" }, 7 | { "filename": "content-types/content_type_with_guidelines_only.ts" }, 8 | { "filename": "content-types/circular_reference_type_b____a.ts" }, 9 | { "filename": "content-types/empty_content_type.ts" }, 10 | { "filename": "content-types/type_with_empty_snippet.ts" }, 11 | { "filename": "content-types/web_spotlight_root.ts" }, 12 | { "filename": "content-types/type_referencing_deleted_type.ts" }, 13 | { "filename": "content-types/index.ts" }, 14 | { "filename": "content-type-snippets/snippet_a.ts" }, 15 | { "filename": "content-type-snippets/empty_snippet.ts" }, 16 | { "filename": "content-type-snippets/index.ts" }, 17 | { "filename": "taxonomies/taxonomy_a.ts" }, 18 | { "filename": "taxonomies/taxonomy_without_terms.ts" }, 19 | { "filename": "taxonomies/index.ts" }, 20 | { "filename": "system/core.type.ts" }, 21 | { "filename": "system/delivery.codenames.ts" }, 22 | { "filename": "system/index.ts" }, 23 | { "filename": "index.ts" } 24 | ] 25 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-ts/content-type-snippets/empty_snippet.ts: -------------------------------------------------------------------------------- 1 | import type { Snippet } from '@kontent-ai/delivery-sdk'; 2 | 3 | /** 4 | * Empty snippet 5 | * 6 | * Id: 1d7e3745-3320-4107-996b-2c6b240df7ae 7 | * Codename: empty_snippet 8 | */ 9 | export type EmptySnippet = Snippet>; 10 | 11 | /** 12 | * Type representing all available element codenames for Empty snippet 13 | */ 14 | export type EmptySnippetElementCodenames = never; 15 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-ts/content-type-snippets/index.ts: -------------------------------------------------------------------------------- 1 | export * from './empty_snippet.ts'; 2 | export * from './snippet_a.ts'; 3 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-ts/content-type-snippets/snippet_a.ts: -------------------------------------------------------------------------------- 1 | import type { Elements, Snippet } from '@kontent-ai/delivery-sdk'; 2 | import type { ContentTypeWithAllElements } from '../content-types/index.ts'; 3 | import type { CoreContentType } from '../system/index.ts'; 4 | 5 | /** 6 | * Snippet A 7 | * 8 | * Id: b74eb5f6-c851-42f2-9fea-e367d0a3fa61 9 | * Codename: snippet_a 10 | */ 11 | export type SnippetA = Snippet< 12 | SnippetAElementCodenames, 13 | { 14 | /** 15 | * Rich text with all allowed item types 16 | * 17 | * Type: rich_text 18 | * Required: false 19 | * Codename: snippet_a__rich_text_with_all_allowed_item_types 20 | * Id: 72cdc4e7-dead-4baf-99bf-91d8fe62351f 21 | */ 22 | readonly snippet_a__rich_text_with_all_allowed_item_types: Elements.RichTextElement; 23 | /** 24 | * Linked items with specific types 25 | * 26 | * Type: modular_content 27 | * Required: false 28 | * Codename: snippet_a__linked_items_with_specific_types 29 | * Id: 140130dc-84c1-455f-99ab-d31579cf90d1 30 | */ 31 | readonly snippet_a__linked_items_with_specific_types: Elements.LinkedItemsElement; 32 | /** 33 | * Text 34 | * 35 | * Type: text 36 | * Required: true 37 | * Codename: snippet_a__text 38 | * Id: 873e4a7a-e2ea-49a0-b88e-2ff7b6892f60 39 | */ 40 | readonly snippet_a__text: Elements.TextElement; 41 | } 42 | >; 43 | 44 | /** 45 | * Type representing all available element codenames for Snippet A 46 | */ 47 | export type SnippetAElementCodenames = 48 | | 'snippet_a__rich_text_with_all_allowed_item_types' 49 | | 'snippet_a__linked_items_with_specific_types' 50 | | 'snippet_a__text'; 51 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-ts/content-types/_content_type_with_special_chars____.ts: -------------------------------------------------------------------------------- 1 | import type { Elements } from '@kontent-ai/delivery-sdk'; 2 | import type { CoreContentType } from '../system/index.ts'; 3 | 4 | /** 5 | * 🐧 Content type with special chars #!_' 6 | * 7 | * Id: 66bfcb40-edd7-4edf-8176-33517d0d6f80 8 | * Codename: _content_type_with_special_chars____ 9 | */ 10 | export type ContentTypeWithSpecialChars = CoreContentType< 11 | ContentTypeWithSpecialCharsElementCodenames, 12 | { 13 | /** 14 | * 🦜Parrot_emoji 15 | * 16 | * Type: text 17 | * Required: false 18 | * Codename: parrot__ 19 | * Id: cafaa776-893d-4e8c-b460-9534ac2fe769 20 | */ 21 | readonly parrot__: Elements.TextElement; 22 | /** 23 | * !!!_$NumberElem<>-%@&{}()/§'`?´=^*#~ 24 | * 25 | * Type: number 26 | * Required: false 27 | * Codename: _____numberelem_____________________ 28 | * Id: 3bb33958-71f3-4039-8594-5f0df9378dbb 29 | */ 30 | readonly _____numberelem_____________________: Elements.NumberElement; 31 | }, 32 | '_content_type_with_special_chars____' 33 | >; 34 | 35 | /** 36 | * Type representing all available element codenames for 🐧 Content type with special chars #!_' 37 | */ 38 | export type ContentTypeWithSpecialCharsElementCodenames = 'parrot__' | '_____numberelem_____________________'; 39 | 40 | /** 41 | * Type guard for 🐧 Content type with special chars #!_' 42 | * 43 | * Id: 66bfcb40-edd7-4edf-8176-33517d0d6f80 44 | * Codename: _content_type_with_special_chars____ 45 | */ 46 | export function isContentTypeWithSpecialChars(item: CoreContentType | undefined | null): item is ContentTypeWithSpecialChars { 47 | return item?.system?.type === '_content_type_with_special_chars____'; 48 | } 49 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-ts/content-types/circular_reference_type_a_b.ts: -------------------------------------------------------------------------------- 1 | import type { Elements } from '@kontent-ai/delivery-sdk'; 2 | import type { CircularReferenceTypeBA } from './index.ts'; 3 | import type { CoreContentType } from '../system/index.ts'; 4 | 5 | /** 6 | * Circular reference type A > B 7 | * 8 | * Id: a58680f7-0667-4a0e-8dc2-889233bdbf71 9 | * Codename: circular_reference_type_a_b 10 | */ 11 | export type CircularReferenceTypeAB = CoreContentType< 12 | CircularReferenceTypeABElementCodenames, 13 | { 14 | /** 15 | * Items 16 | * 17 | * Type: modular_content 18 | * Required: false 19 | * Codename: items 20 | * Id: 33ab92dd-e47d-45e2-a060-3b5df0754c24 21 | */ 22 | readonly items: Elements.LinkedItemsElement; 23 | }, 24 | 'circular_reference_type_a_b' 25 | >; 26 | 27 | /** 28 | * Type representing all available element codenames for Circular reference type A > B 29 | */ 30 | export type CircularReferenceTypeABElementCodenames = 'items'; 31 | 32 | /** 33 | * Type guard for Circular reference type A > B 34 | * 35 | * Id: a58680f7-0667-4a0e-8dc2-889233bdbf71 36 | * Codename: circular_reference_type_a_b 37 | */ 38 | export function isCircularReferenceTypeAB(item: CoreContentType | undefined | null): item is CircularReferenceTypeAB { 39 | return item?.system?.type === 'circular_reference_type_a_b'; 40 | } 41 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-ts/content-types/circular_reference_type_b____a.ts: -------------------------------------------------------------------------------- 1 | import type { Elements } from '@kontent-ai/delivery-sdk'; 2 | import type { CircularReferenceTypeAB } from './index.ts'; 3 | import type { CoreContentType } from '../system/index.ts'; 4 | 5 | /** 6 | * Circular reference type B -> A 7 | * 8 | * Id: 919bdcad-fe8e-4f56-9a63-346154b6f6e2 9 | * Codename: circular_reference_type_b____a 10 | */ 11 | export type CircularReferenceTypeBA = CoreContentType< 12 | CircularReferenceTypeBAElementCodenames, 13 | { 14 | /** 15 | * Items 16 | * 17 | * Type: modular_content 18 | * Required: false 19 | * Codename: items 20 | * Id: 019714f7-8c50-492b-8e5c-f7c3d7e2529b 21 | */ 22 | readonly items: Elements.LinkedItemsElement; 23 | }, 24 | 'circular_reference_type_b____a' 25 | >; 26 | 27 | /** 28 | * Type representing all available element codenames for Circular reference type B -> A 29 | */ 30 | export type CircularReferenceTypeBAElementCodenames = 'items'; 31 | 32 | /** 33 | * Type guard for Circular reference type B -> A 34 | * 35 | * Id: 919bdcad-fe8e-4f56-9a63-346154b6f6e2 36 | * Codename: circular_reference_type_b____a 37 | */ 38 | export function isCircularReferenceTypeBA(item: CoreContentType | undefined | null): item is CircularReferenceTypeBA { 39 | return item?.system?.type === 'circular_reference_type_b____a'; 40 | } 41 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-ts/content-types/content_type_with_guidelines_only.ts: -------------------------------------------------------------------------------- 1 | import type { CoreContentType } from '../system/index.ts'; 2 | 3 | /** 4 | * Content type with guidelines only 5 | * 6 | * Id: 7e38a995-b4d7-46c9-92a4-4359241fa5ef 7 | * Codename: content_type_with_guidelines_only 8 | */ 9 | export type ContentTypeWithGuidelinesOnly = CoreContentType< 10 | ContentTypeWithGuidelinesOnlyElementCodenames, 11 | Record, 12 | 'content_type_with_guidelines_only' 13 | >; 14 | 15 | /** 16 | * Type representing all available element codenames for Content type with guidelines only 17 | */ 18 | export type ContentTypeWithGuidelinesOnlyElementCodenames = never; 19 | 20 | /** 21 | * Type guard for Content type with guidelines only 22 | * 23 | * Id: 7e38a995-b4d7-46c9-92a4-4359241fa5ef 24 | * Codename: content_type_with_guidelines_only 25 | */ 26 | export function isContentTypeWithGuidelinesOnly(item: CoreContentType | undefined | null): item is ContentTypeWithGuidelinesOnly { 27 | return item?.system?.type === 'content_type_with_guidelines_only'; 28 | } 29 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-ts/content-types/content_type_with_snippet_only.ts: -------------------------------------------------------------------------------- 1 | import type { CoreContentType } from '../system/index.ts'; 2 | import type { SnippetA } from '../content-type-snippets/index.ts'; 3 | 4 | /** 5 | * Content type with snippet only 6 | * 7 | * Id: 7fd86bef-8f30-4a02-a1c3-fb130f65e9b4 8 | * Codename: content_type_with_snippet_only 9 | */ 10 | export type ContentTypeWithSnippetOnly = CoreContentType< 11 | ContentTypeWithSnippetOnlyElementCodenames, 12 | Record & SnippetA, 13 | 'content_type_with_snippet_only' 14 | >; 15 | 16 | /** 17 | * Type representing all available element codenames for Content type with snippet only 18 | */ 19 | export type ContentTypeWithSnippetOnlyElementCodenames = 20 | | 'snippet_a__rich_text_with_all_allowed_item_types' 21 | | 'snippet_a__linked_items_with_specific_types' 22 | | 'snippet_a__text'; 23 | 24 | /** 25 | * Type guard for Content type with snippet only 26 | * 27 | * Id: 7fd86bef-8f30-4a02-a1c3-fb130f65e9b4 28 | * Codename: content_type_with_snippet_only 29 | */ 30 | export function isContentTypeWithSnippetOnly(item: CoreContentType | undefined | null): item is ContentTypeWithSnippetOnly { 31 | return item?.system?.type === 'content_type_with_snippet_only'; 32 | } 33 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-ts/content-types/empty_content_type.ts: -------------------------------------------------------------------------------- 1 | import type { CoreContentType } from '../system/index.ts'; 2 | 3 | /** 4 | * Empty content type 5 | * 6 | * Id: 4e41e105-6ec5-4a08-9680-b85e9cd8b14e 7 | * Codename: empty_content_type 8 | */ 9 | export type EmptyContentType = CoreContentType, 'empty_content_type'>; 10 | 11 | /** 12 | * Type representing all available element codenames for Empty content type 13 | */ 14 | export type EmptyContentTypeElementCodenames = never; 15 | 16 | /** 17 | * Type guard for Empty content type 18 | * 19 | * Id: 4e41e105-6ec5-4a08-9680-b85e9cd8b14e 20 | * Codename: empty_content_type 21 | */ 22 | export function isEmptyContentType(item: CoreContentType | undefined | null): item is EmptyContentType { 23 | return item?.system?.type === 'empty_content_type'; 24 | } 25 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-ts/content-types/index.ts: -------------------------------------------------------------------------------- 1 | export * from './_content_type_with_special_chars____.ts'; 2 | export * from './circular_reference_type_a_b.ts'; 3 | export * from './circular_reference_type_b____a.ts'; 4 | export * from './content_type_with_all_elements.ts'; 5 | export * from './content_type_with_guidelines_only.ts'; 6 | export * from './content_type_with_snippet_only.ts'; 7 | export * from './empty_content_type.ts'; 8 | export * from './page.ts'; 9 | export * from './type_referencing_deleted_type.ts'; 10 | export * from './type_with_empty_snippet.ts'; 11 | export * from './web_spotlight_root.ts'; 12 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-ts/content-types/type_referencing_deleted_type.ts: -------------------------------------------------------------------------------- 1 | import type { Elements } from '@kontent-ai/delivery-sdk'; 2 | import type { CoreContentType } from '../system/index.ts'; 3 | 4 | /** 5 | * Type referencing deleted type 6 | * 7 | * Id: f7562083-7230-4c20-9136-620ee7a92534 8 | * Codename: type_referencing_deleted_type 9 | */ 10 | export type TypeReferencingDeletedType = CoreContentType< 11 | TypeReferencingDeletedTypeElementCodenames, 12 | { 13 | /** 14 | * Rich text with invalid type 15 | * 16 | * Type: rich_text 17 | * Required: false 18 | * Codename: rich_text_with_invalid_type 19 | * Id: 03df7457-fb30-4d4e-aee2-06b0e1f218a2 20 | */ 21 | readonly rich_text_with_invalid_type: Elements.RichTextElement; 22 | /** 23 | * Linked items with invalid type 24 | * 25 | * Type: modular_content 26 | * Required: false 27 | * Codename: linked_items_with_invalid_type 28 | * Id: cc310017-de8b-42f1-962b-63959367d29a 29 | */ 30 | readonly linked_items_with_invalid_type: Elements.LinkedItemsElement; 31 | }, 32 | 'type_referencing_deleted_type' 33 | >; 34 | 35 | /** 36 | * Type representing all available element codenames for Type referencing deleted type 37 | */ 38 | export type TypeReferencingDeletedTypeElementCodenames = 'rich_text_with_invalid_type' | 'linked_items_with_invalid_type'; 39 | 40 | /** 41 | * Type guard for Type referencing deleted type 42 | * 43 | * Id: f7562083-7230-4c20-9136-620ee7a92534 44 | * Codename: type_referencing_deleted_type 45 | */ 46 | export function isTypeReferencingDeletedType(item: CoreContentType | undefined | null): item is TypeReferencingDeletedType { 47 | return item?.system?.type === 'type_referencing_deleted_type'; 48 | } 49 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-ts/content-types/type_with_empty_snippet.ts: -------------------------------------------------------------------------------- 1 | import type { CoreContentType } from '../system/index.ts'; 2 | 3 | /** 4 | * Type with empty snippet 5 | * 6 | * Id: 11039462-1d7d-4673-9aa8-af07fb53985c 7 | * Codename: type_with_empty_snippet 8 | */ 9 | export type TypeWithEmptySnippet = CoreContentType, 'type_with_empty_snippet'>; 10 | 11 | /** 12 | * Type representing all available element codenames for Type with empty snippet 13 | */ 14 | export type TypeWithEmptySnippetElementCodenames = never; 15 | 16 | /** 17 | * Type guard for Type with empty snippet 18 | * 19 | * Id: 11039462-1d7d-4673-9aa8-af07fb53985c 20 | * Codename: type_with_empty_snippet 21 | */ 22 | export function isTypeWithEmptySnippet(item: CoreContentType | undefined | null): item is TypeWithEmptySnippet { 23 | return item?.system?.type === 'type_with_empty_snippet'; 24 | } 25 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-ts/content-types/web_spotlight_root.ts: -------------------------------------------------------------------------------- 1 | import type { Elements } from '@kontent-ai/delivery-sdk'; 2 | import type { CoreContentType } from '../system/index.ts'; 3 | import type { Page } from './index.ts'; 4 | 5 | /** 6 | * Web spotlight root 7 | * 8 | * Id: 7e8ca9f3-7f06-44d6-b9db-ae4905531365 9 | * Codename: web_spotlight_root 10 | */ 11 | export type WebSpotlightRoot = CoreContentType< 12 | WebSpotlightRootElementCodenames, 13 | { 14 | /** 15 | * Title 16 | * 17 | * Type: text 18 | * Required: false 19 | * Codename: title 20 | * Id: e9d19fa4-4ad3-4b3f-998a-ca392651f7d0 21 | */ 22 | readonly title: Elements.TextElement; 23 | /** 24 | * Subpages 25 | * 26 | * Type: subpages 27 | * Required: false 28 | * Codename: subpages 29 | * Id: e6702a6b-35b8-4a12-acca-1b1361fc926b 30 | */ 31 | readonly subpages: Elements.LinkedItemsElement; 32 | /** 33 | * Content 34 | * 35 | * Type: modular_content 36 | * Required: false 37 | * Codename: content 38 | * Id: ad185ebb-c7ec-4b89-bf89-4b415b5e0ca8 39 | */ 40 | readonly content: Elements.LinkedItemsElement; 41 | }, 42 | 'web_spotlight_root' 43 | >; 44 | 45 | /** 46 | * Type representing all available element codenames for Web spotlight root 47 | */ 48 | export type WebSpotlightRootElementCodenames = 'title' | 'subpages' | 'content'; 49 | 50 | /** 51 | * Type guard for Web spotlight root 52 | * 53 | * Id: 7e8ca9f3-7f06-44d6-b9db-ae4905531365 54 | * Codename: web_spotlight_root 55 | */ 56 | export function isWebSpotlightRoot(item: CoreContentType | undefined | null): item is WebSpotlightRoot { 57 | return item?.system?.type === 'web_spotlight_root'; 58 | } 59 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-ts/index.ts: -------------------------------------------------------------------------------- 1 | export * from './content-type-snippets/index.ts'; 2 | export * from './content-types/index.ts'; 3 | export * from './system/index.ts'; 4 | export * from './taxonomies/index.ts'; 5 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-ts/system/core.type.ts: -------------------------------------------------------------------------------- 1 | import type { IContentItem, IContentItemElements, IDeliveryClient } from '@kontent-ai/delivery-sdk'; 2 | import type { 3 | ContentTypeCodenames, 4 | CollectionCodenames, 5 | LanguageCodenames, 6 | WorkflowCodenames, 7 | WorkflowStepCodenames, 8 | ElementCodenames, 9 | TaxonomyCodenames 10 | } from './delivery.codenames.ts'; 11 | 12 | /** 13 | * Core content type used in favor of default 'IContentItem' 14 | */ 15 | export type CoreContentType< 16 | TElementCodenames extends string = string, 17 | TElements extends IContentItemElements = IContentItemElements, 18 | TContentTypeCodename extends ContentTypeCodenames = ContentTypeCodenames 19 | > = IContentItem; 20 | 21 | /** 22 | * Core types for 'IDeliveryClient' 23 | */ 24 | export type CoreClientTypes = { 25 | readonly collectionCodenames: CollectionCodenames; 26 | readonly contentItemType: CoreContentType; 27 | readonly contentTypeCodenames: ContentTypeCodenames; 28 | readonly elementCodenames: ElementCodenames; 29 | readonly languageCodenames: LanguageCodenames; 30 | readonly taxonomyCodenames: TaxonomyCodenames; 31 | readonly workflowCodenames: WorkflowCodenames; 32 | readonly workflowStepCodenames: WorkflowStepCodenames; 33 | }; 34 | 35 | /** 36 | * Typed delivery client in favor of default 'IDeliveryClient' 37 | */ 38 | export type CoreDeliveryClient = IDeliveryClient; 39 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-ts/system/index.ts: -------------------------------------------------------------------------------- 1 | export * from './core.type.ts'; 2 | export * from './delivery.codenames.ts'; 3 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-ts/taxonomies/index.ts: -------------------------------------------------------------------------------- 1 | export * from './taxonomy_a.ts'; 2 | export * from './taxonomy_without_terms.ts'; 3 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-ts/taxonomies/taxonomy_a.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * All taxonomy codename values for Taxonomy A 3 | * 4 | * Codename: taxonomy_a 5 | * Id: bb37a632-3f78-48f8-ba25-7fa806d41a3e 6 | */ 7 | export const taxonomyAValues = ['nested_term_2', 'nested_term_1', 'term_1', 'term_2', 'term_3'] as const; 8 | 9 | /** 10 | * Type representing Taxonomy A taxonomy 11 | * 12 | * Codename: taxonomy_a 13 | * Id: bb37a632-3f78-48f8-ba25-7fa806d41a3e 14 | */ 15 | export type TaxonomyA = (typeof taxonomyAValues)[number]; 16 | 17 | /** 18 | * Type guard for Taxonomy A 19 | * 20 | * Codename: taxonomy_a 21 | * Id: bb37a632-3f78-48f8-ba25-7fa806d41a3e 22 | */ 23 | export function isTaxonomyA(value: string | undefined | null): value is TaxonomyA { 24 | return typeof value === 'string' && (taxonomyAValues as readonly string[]).includes(value); 25 | } 26 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/basic-ts/taxonomies/taxonomy_without_terms.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * All taxonomy codename values for Taxonomy without terms 3 | * 4 | * Codename: taxonomy_without_terms 5 | * Id: 01878d46-fcbc-4211-a801-676ad4e72cb2 6 | */ 7 | export const taxonomyWithoutTermsValues = [] as const; 8 | 9 | /** 10 | * Type representing Taxonomy without terms taxonomy 11 | * 12 | * Codename: taxonomy_without_terms 13 | * Id: 01878d46-fcbc-4211-a801-676ad4e72cb2 14 | */ 15 | export type TaxonomyWithoutTerms = (typeof taxonomyWithoutTermsValues)[number]; 16 | 17 | /** 18 | * Type guard for Taxonomy without terms 19 | * 20 | * Codename: taxonomy_without_terms 21 | * Id: 01878d46-fcbc-4211-a801-676ad4e72cb2 22 | */ 23 | export function isTaxonomyWithoutTerms(value: string | undefined | null): value is TaxonomyWithoutTerms { 24 | return typeof value === 'string' && (taxonomyWithoutTermsValues as readonly string[]).includes(value); 25 | } 26 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/custom-format-options/_filesList.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "filename": "content-types/content_type_with_snippet_only.ts" }, 3 | { "filename": "content-types/_content_type_with_special_chars____.ts" }, 4 | { "filename": "content-types/circular_reference_type_a_b.ts" }, 5 | { "filename": "content-types/page.ts" }, 6 | { "filename": "content-types/content_type_with_all_elements.ts" }, 7 | { "filename": "content-types/content_type_with_guidelines_only.ts" }, 8 | { "filename": "content-types/circular_reference_type_b____a.ts" }, 9 | { "filename": "content-types/empty_content_type.ts" }, 10 | { "filename": "content-types/type_with_empty_snippet.ts" }, 11 | { "filename": "content-types/web_spotlight_root.ts" }, 12 | { "filename": "content-types/type_referencing_deleted_type.ts" }, 13 | { "filename": "content-types/index.ts" }, 14 | { "filename": "content-type-snippets/snippet_a.ts" }, 15 | { "filename": "content-type-snippets/empty_snippet.ts" }, 16 | { "filename": "content-type-snippets/index.ts" }, 17 | { "filename": "taxonomies/taxonomy_a.ts" }, 18 | { "filename": "taxonomies/taxonomy_without_terms.ts" }, 19 | { "filename": "taxonomies/index.ts" }, 20 | { "filename": "system/core.type.ts" }, 21 | { "filename": "system/delivery.codenames.ts" }, 22 | { "filename": "system/index.ts" }, 23 | { "filename": "index.ts" } 24 | ] 25 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/custom-format-options/content-type-snippets/empty_snippet.ts: -------------------------------------------------------------------------------- 1 | 2 | import type { Snippet } from '@kontent-ai/delivery-sdk'; 3 | 4 | 5 | /** 6 | * Empty snippet 7 | * 8 | * Id: 1d7e3745-3320-4107-996b-2c6b240df7ae 9 | * Codename: empty_snippet 10 | */ 11 | export type EmptySnippet = Snippet>; 13 | 14 | /** 15 | * Type representing all available element codenames for Empty snippet 16 | */ 17 | export type EmptySnippetElementCodenames = never 18 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/custom-format-options/content-type-snippets/index.ts: -------------------------------------------------------------------------------- 1 | export * from './empty_snippet.js'; export * from './snippet_a.js'; -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/custom-format-options/content-types/_content_type_with_special_chars____.ts: -------------------------------------------------------------------------------- 1 | 2 | import type { Elements } from '@kontent-ai/delivery-sdk'; 3 | import type { CoreContentType } from '../system/index.js'; 4 | 5 | /** 6 | * 🐧 Content type with special chars #!_' 7 | * 8 | * Id: 66bfcb40-edd7-4edf-8176-33517d0d6f80 9 | * Codename: _content_type_with_special_chars____ 10 | */ 11 | export type ContentTypeWithSpecialChars = CoreContentType< 12 | ContentTypeWithSpecialCharsElementCodenames, 13 | { 14 | /** 15 | * 🦜Parrot_emoji 16 | * 17 | * Type: text 18 | * Required: false 19 | * Codename: parrot__ 20 | * Id: cafaa776-893d-4e8c-b460-9534ac2fe769 21 | */ 22 | readonly parrot__: Elements.TextElement; 23 | /** 24 | * !!!_$NumberElem<>-%@&{}()/§'`?´=^*#~ 25 | * 26 | * Type: number 27 | * Required: false 28 | * Codename: _____numberelem_____________________ 29 | * Id: 3bb33958-71f3-4039-8594-5f0df9378dbb 30 | */ 31 | readonly _____numberelem_____________________: Elements.NumberElement;}, 32 | '_content_type_with_special_chars____'> 33 | 34 | /** 35 | * Type representing all available element codenames for 🐧 Content type with special chars #!_' 36 | */ 37 | export type ContentTypeWithSpecialCharsElementCodenames = 'parrot__' | '_____numberelem_____________________';; 38 | 39 | /** 40 | * Type guard for 🐧 Content type with special chars #!_' 41 | * 42 | * Id: 66bfcb40-edd7-4edf-8176-33517d0d6f80 43 | * Codename: _content_type_with_special_chars____ 44 | */ 45 | export function isContentTypeWithSpecialChars(item: CoreContentType | undefined | null): item is ContentTypeWithSpecialChars { 46 | return item?.system?.type === '_content_type_with_special_chars____'; 47 | }; 48 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/custom-format-options/content-types/circular_reference_type_a_b.ts: -------------------------------------------------------------------------------- 1 | 2 | import type { Elements } from '@kontent-ai/delivery-sdk'; 3 | import type { CircularReferenceTypeBA } from './index.js'; 4 | import type { CoreContentType } from '../system/index.js'; 5 | 6 | /** 7 | * Circular reference type A > B 8 | * 9 | * Id: a58680f7-0667-4a0e-8dc2-889233bdbf71 10 | * Codename: circular_reference_type_a_b 11 | */ 12 | export type CircularReferenceTypeAB = CoreContentType< 13 | CircularReferenceTypeABElementCodenames, 14 | { 15 | /** 16 | * Items 17 | * 18 | * Type: modular_content 19 | * Required: false 20 | * Codename: items 21 | * Id: 33ab92dd-e47d-45e2-a060-3b5df0754c24 22 | */ 23 | readonly items: Elements.LinkedItemsElement;}, 24 | 'circular_reference_type_a_b'> 25 | 26 | /** 27 | * Type representing all available element codenames for Circular reference type A > B 28 | */ 29 | export type CircularReferenceTypeABElementCodenames = 'items';; 30 | 31 | /** 32 | * Type guard for Circular reference type A > B 33 | * 34 | * Id: a58680f7-0667-4a0e-8dc2-889233bdbf71 35 | * Codename: circular_reference_type_a_b 36 | */ 37 | export function isCircularReferenceTypeAB(item: CoreContentType | undefined | null): item is CircularReferenceTypeAB { 38 | return item?.system?.type === 'circular_reference_type_a_b'; 39 | }; 40 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/custom-format-options/content-types/circular_reference_type_b____a.ts: -------------------------------------------------------------------------------- 1 | 2 | import type { Elements } from '@kontent-ai/delivery-sdk'; 3 | import type { CircularReferenceTypeAB } from './index.js'; 4 | import type { CoreContentType } from '../system/index.js'; 5 | 6 | /** 7 | * Circular reference type B -> A 8 | * 9 | * Id: 919bdcad-fe8e-4f56-9a63-346154b6f6e2 10 | * Codename: circular_reference_type_b____a 11 | */ 12 | export type CircularReferenceTypeBA = CoreContentType< 13 | CircularReferenceTypeBAElementCodenames, 14 | { 15 | /** 16 | * Items 17 | * 18 | * Type: modular_content 19 | * Required: false 20 | * Codename: items 21 | * Id: 019714f7-8c50-492b-8e5c-f7c3d7e2529b 22 | */ 23 | readonly items: Elements.LinkedItemsElement;}, 24 | 'circular_reference_type_b____a'> 25 | 26 | /** 27 | * Type representing all available element codenames for Circular reference type B -> A 28 | */ 29 | export type CircularReferenceTypeBAElementCodenames = 'items';; 30 | 31 | /** 32 | * Type guard for Circular reference type B -> A 33 | * 34 | * Id: 919bdcad-fe8e-4f56-9a63-346154b6f6e2 35 | * Codename: circular_reference_type_b____a 36 | */ 37 | export function isCircularReferenceTypeBA(item: CoreContentType | undefined | null): item is CircularReferenceTypeBA { 38 | return item?.system?.type === 'circular_reference_type_b____a'; 39 | }; 40 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/custom-format-options/content-types/content_type_with_guidelines_only.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | import type { CoreContentType } from '../system/index.js'; 4 | 5 | /** 6 | * Content type with guidelines only 7 | * 8 | * Id: 7e38a995-b4d7-46c9-92a4-4359241fa5ef 9 | * Codename: content_type_with_guidelines_only 10 | */ 11 | export type ContentTypeWithGuidelinesOnly = CoreContentType< 12 | ContentTypeWithGuidelinesOnlyElementCodenames, 13 | Record, 14 | 'content_type_with_guidelines_only'> 15 | 16 | /** 17 | * Type representing all available element codenames for Content type with guidelines only 18 | */ 19 | export type ContentTypeWithGuidelinesOnlyElementCodenames = never; 20 | 21 | /** 22 | * Type guard for Content type with guidelines only 23 | * 24 | * Id: 7e38a995-b4d7-46c9-92a4-4359241fa5ef 25 | * Codename: content_type_with_guidelines_only 26 | */ 27 | export function isContentTypeWithGuidelinesOnly(item: CoreContentType | undefined | null): item is ContentTypeWithGuidelinesOnly { 28 | return item?.system?.type === 'content_type_with_guidelines_only'; 29 | }; 30 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/custom-format-options/content-types/content_type_with_snippet_only.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | import type { CoreContentType } from '../system/index.js'; 4 | import type { SnippetA } from '../content-type-snippets/index.js'; 5 | 6 | /** 7 | * Content type with snippet only 8 | * 9 | * Id: 7fd86bef-8f30-4a02-a1c3-fb130f65e9b4 10 | * Codename: content_type_with_snippet_only 11 | */ 12 | export type ContentTypeWithSnippetOnly = CoreContentType< 13 | ContentTypeWithSnippetOnlyElementCodenames, 14 | Record & SnippetA, 15 | 'content_type_with_snippet_only'> 16 | 17 | /** 18 | * Type representing all available element codenames for Content type with snippet only 19 | */ 20 | export type ContentTypeWithSnippetOnlyElementCodenames = 'snippet_a__rich_text_with_all_allowed_item_types' | 'snippet_a__linked_items_with_specific_types' | 'snippet_a__text';; 21 | 22 | /** 23 | * Type guard for Content type with snippet only 24 | * 25 | * Id: 7fd86bef-8f30-4a02-a1c3-fb130f65e9b4 26 | * Codename: content_type_with_snippet_only 27 | */ 28 | export function isContentTypeWithSnippetOnly(item: CoreContentType | undefined | null): item is ContentTypeWithSnippetOnly { 29 | return item?.system?.type === 'content_type_with_snippet_only'; 30 | }; 31 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/custom-format-options/content-types/empty_content_type.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | import type { CoreContentType } from '../system/index.js'; 4 | 5 | /** 6 | * Empty content type 7 | * 8 | * Id: 4e41e105-6ec5-4a08-9680-b85e9cd8b14e 9 | * Codename: empty_content_type 10 | */ 11 | export type EmptyContentType = CoreContentType< 12 | EmptyContentTypeElementCodenames, 13 | Record, 14 | 'empty_content_type'> 15 | 16 | /** 17 | * Type representing all available element codenames for Empty content type 18 | */ 19 | export type EmptyContentTypeElementCodenames = never; 20 | 21 | /** 22 | * Type guard for Empty content type 23 | * 24 | * Id: 4e41e105-6ec5-4a08-9680-b85e9cd8b14e 25 | * Codename: empty_content_type 26 | */ 27 | export function isEmptyContentType(item: CoreContentType | undefined | null): item is EmptyContentType { 28 | return item?.system?.type === 'empty_content_type'; 29 | }; 30 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/custom-format-options/content-types/index.ts: -------------------------------------------------------------------------------- 1 | export * from './_content_type_with_special_chars____.js'; export * from './circular_reference_type_a_b.js'; export * from './circular_reference_type_b____a.js'; export * from './content_type_with_all_elements.js'; export * from './content_type_with_guidelines_only.js'; export * from './content_type_with_snippet_only.js'; export * from './empty_content_type.js'; export * from './page.js'; export * from './type_referencing_deleted_type.js'; export * from './type_with_empty_snippet.js'; export * from './web_spotlight_root.js'; -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/custom-format-options/content-types/type_with_empty_snippet.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | import type { CoreContentType } from '../system/index.js'; 4 | 5 | /** 6 | * Type with empty snippet 7 | * 8 | * Id: 11039462-1d7d-4673-9aa8-af07fb53985c 9 | * Codename: type_with_empty_snippet 10 | */ 11 | export type TypeWithEmptySnippet = CoreContentType< 12 | TypeWithEmptySnippetElementCodenames, 13 | Record, 14 | 'type_with_empty_snippet'> 15 | 16 | /** 17 | * Type representing all available element codenames for Type with empty snippet 18 | */ 19 | export type TypeWithEmptySnippetElementCodenames = never; 20 | 21 | /** 22 | * Type guard for Type with empty snippet 23 | * 24 | * Id: 11039462-1d7d-4673-9aa8-af07fb53985c 25 | * Codename: type_with_empty_snippet 26 | */ 27 | export function isTypeWithEmptySnippet(item: CoreContentType | undefined | null): item is TypeWithEmptySnippet { 28 | return item?.system?.type === 'type_with_empty_snippet'; 29 | }; 30 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/custom-format-options/index.ts: -------------------------------------------------------------------------------- 1 | export * from './content-type-snippets/index.js'; export * from './content-types/index.js'; export * from './system/index.js'; export * from './taxonomies/index.js'; -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/custom-format-options/system/index.ts: -------------------------------------------------------------------------------- 1 | export * from './core.type.js'; export * from './delivery.codenames.js'; -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/custom-format-options/taxonomies/index.ts: -------------------------------------------------------------------------------- 1 | export * from './taxonomy_a.js'; export * from './taxonomy_without_terms.js'; -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/custom-format-options/taxonomies/taxonomy_a.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | /** 4 | * All taxonomy codename values for Taxonomy A 5 | * 6 | * Codename: taxonomy_a 7 | * Id: bb37a632-3f78-48f8-ba25-7fa806d41a3e 8 | */ 9 | export const taxonomyAValues = ['nested_term_2', 'nested_term_1', 'term_1', 'term_2', 'term_3'] as const; 10 | 11 | /** 12 | * Type representing Taxonomy A taxonomy 13 | * 14 | * Codename: taxonomy_a 15 | * Id: bb37a632-3f78-48f8-ba25-7fa806d41a3e 16 | */ 17 | export type TaxonomyA = typeof taxonomyAValues[number]; 18 | 19 | /** 20 | * Type guard for Taxonomy A 21 | * 22 | * Codename: taxonomy_a 23 | * Id: bb37a632-3f78-48f8-ba25-7fa806d41a3e 24 | */ 25 | export function isTaxonomyA(value: string | undefined | null): value is TaxonomyA { 26 | return typeof value === 'string' && (taxonomyAValues as readonly string[]).includes(value); 27 | } 28 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/custom-format-options/taxonomies/taxonomy_without_terms.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | /** 4 | * All taxonomy codename values for Taxonomy without terms 5 | * 6 | * Codename: taxonomy_without_terms 7 | * Id: 01878d46-fcbc-4211-a801-676ad4e72cb2 8 | */ 9 | export const taxonomyWithoutTermsValues = [] as const; 10 | 11 | /** 12 | * Type representing Taxonomy without terms taxonomy 13 | * 14 | * Codename: taxonomy_without_terms 15 | * Id: 01878d46-fcbc-4211-a801-676ad4e72cb2 16 | */ 17 | export type TaxonomyWithoutTerms = typeof taxonomyWithoutTermsValues[number]; 18 | 19 | /** 20 | * Type guard for Taxonomy without terms 21 | * 22 | * Codename: taxonomy_without_terms 23 | * Id: 01878d46-fcbc-4211-a801-676ad4e72cb2 24 | */ 25 | export function isTaxonomyWithoutTerms(value: string | undefined | null): value is TaxonomyWithoutTerms { 26 | return typeof value === 'string' && (taxonomyWithoutTermsValues as readonly string[]).includes(value); 27 | } 28 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/name-and-file-resolvers/_filesList.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "filename": "content-types/content_type_content_type_with_snippet_only.ts" 4 | }, 5 | { 6 | "filename": "content-types/content_type__content_type_with_special_chars____.ts" 7 | }, 8 | { "filename": "content-types/content_type_circular_reference_type_a_b.ts" }, 9 | { "filename": "content-types/content_type_page.ts" }, 10 | { 11 | "filename": "content-types/content_type_content_type_with_all_elements.ts" 12 | }, 13 | { 14 | "filename": "content-types/content_type_content_type_with_guidelines_only.ts" 15 | }, 16 | { 17 | "filename": "content-types/content_type_circular_reference_type_b____a.ts" 18 | }, 19 | { "filename": "content-types/content_type_empty_content_type.ts" }, 20 | { "filename": "content-types/content_type_type_with_empty_snippet.ts" }, 21 | { "filename": "content-types/content_type_web_spotlight_root.ts" }, 22 | { "filename": "content-types/content_type_type_referencing_deleted_type.ts" }, 23 | { "filename": "content-types/index.ts" }, 24 | { "filename": "content-type-snippets/snippet_snippet_a.ts" }, 25 | { "filename": "content-type-snippets/snippet_empty_snippet.ts" }, 26 | { "filename": "content-type-snippets/index.ts" }, 27 | { "filename": "taxonomies/taxonomy_taxonomy_a.ts" }, 28 | { "filename": "taxonomies/taxonomy_taxonomy_without_terms.ts" }, 29 | { "filename": "taxonomies/index.ts" }, 30 | { "filename": "system/core.type.ts" }, 31 | { "filename": "system/delivery.codenames.ts" }, 32 | { "filename": "system/index.ts" }, 33 | { "filename": "index.ts" } 34 | ] 35 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/name-and-file-resolvers/content-type-snippets/index.ts: -------------------------------------------------------------------------------- 1 | export * from './snippet_empty_snippet.js'; 2 | export * from './snippet_snippet_a.js'; 3 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/name-and-file-resolvers/content-type-snippets/snippet_empty_snippet.ts: -------------------------------------------------------------------------------- 1 | import type { Snippet } from '@kontent-ai/delivery-sdk'; 2 | 3 | /** 4 | * Empty snippet 5 | * 6 | * Id: 1d7e3745-3320-4107-996b-2c6b240df7ae 7 | * Codename: empty_snippet 8 | */ 9 | export type Snippet_empty_snippet = Snippet>; 10 | 11 | /** 12 | * Type representing all available element codenames for Empty snippet 13 | */ 14 | export type Snippet_empty_snippetElementCodenames = never; 15 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/name-and-file-resolvers/content-type-snippets/snippet_snippet_a.ts: -------------------------------------------------------------------------------- 1 | import type { Elements, Snippet } from '@kontent-ai/delivery-sdk'; 2 | import type { ContentType_content_type_with_all_elements } from '../content-types/index.js'; 3 | import type { CoreContentType } from '../system/index.js'; 4 | 5 | /** 6 | * Snippet A 7 | * 8 | * Id: b74eb5f6-c851-42f2-9fea-e367d0a3fa61 9 | * Codename: snippet_a 10 | */ 11 | export type Snippet_snippet_a = Snippet< 12 | Snippet_snippet_aElementCodenames, 13 | { 14 | /** 15 | * Rich text with all allowed item types 16 | * 17 | * Type: rich_text 18 | * Required: false 19 | * Codename: snippet_a__rich_text_with_all_allowed_item_types 20 | * Id: 72cdc4e7-dead-4baf-99bf-91d8fe62351f 21 | */ 22 | readonly snippet_a__rich_text_with_all_allowed_item_types: Elements.RichTextElement; 23 | /** 24 | * Linked items with specific types 25 | * 26 | * Type: modular_content 27 | * Required: false 28 | * Codename: snippet_a__linked_items_with_specific_types 29 | * Id: 140130dc-84c1-455f-99ab-d31579cf90d1 30 | */ 31 | readonly snippet_a__linked_items_with_specific_types: Elements.LinkedItemsElement; 32 | /** 33 | * Text 34 | * 35 | * Type: text 36 | * Required: true 37 | * Codename: snippet_a__text 38 | * Id: 873e4a7a-e2ea-49a0-b88e-2ff7b6892f60 39 | */ 40 | readonly snippet_a__text: Elements.TextElement; 41 | } 42 | >; 43 | 44 | /** 45 | * Type representing all available element codenames for Snippet A 46 | */ 47 | export type Snippet_snippet_aElementCodenames = 48 | | 'snippet_a__rich_text_with_all_allowed_item_types' 49 | | 'snippet_a__linked_items_with_specific_types' 50 | | 'snippet_a__text'; 51 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/name-and-file-resolvers/content-types/content_type__content_type_with_special_chars____.ts: -------------------------------------------------------------------------------- 1 | import type { Elements } from '@kontent-ai/delivery-sdk'; 2 | import type { CoreContentType } from '../system/index.js'; 3 | 4 | /** 5 | * 🐧 Content type with special chars #!_' 6 | * 7 | * Id: 66bfcb40-edd7-4edf-8176-33517d0d6f80 8 | * Codename: _content_type_with_special_chars____ 9 | */ 10 | export type ContentType__content_type_with_special_chars____ = CoreContentType< 11 | ContentType__content_type_with_special_chars____ElementCodenames, 12 | { 13 | /** 14 | * 🦜Parrot_emoji 15 | * 16 | * Type: text 17 | * Required: false 18 | * Codename: parrot__ 19 | * Id: cafaa776-893d-4e8c-b460-9534ac2fe769 20 | */ 21 | readonly parrot__: Elements.TextElement; 22 | /** 23 | * !!!_$NumberElem<>-%@&{}()/§'`?´=^*#~ 24 | * 25 | * Type: number 26 | * Required: false 27 | * Codename: _____numberelem_____________________ 28 | * Id: 3bb33958-71f3-4039-8594-5f0df9378dbb 29 | */ 30 | readonly _____numberelem_____________________: Elements.NumberElement; 31 | }, 32 | '_content_type_with_special_chars____' 33 | >; 34 | 35 | /** 36 | * Type representing all available element codenames for 🐧 Content type with special chars #!_' 37 | */ 38 | export type ContentType__content_type_with_special_chars____ElementCodenames = 'parrot__' | '_____numberelem_____________________'; 39 | 40 | /** 41 | * Type guard for 🐧 Content type with special chars #!_' 42 | * 43 | * Id: 66bfcb40-edd7-4edf-8176-33517d0d6f80 44 | * Codename: _content_type_with_special_chars____ 45 | */ 46 | export function isContentType__content_type_with_special_chars____( 47 | item: CoreContentType | undefined | null 48 | ): item is ContentType__content_type_with_special_chars____ { 49 | return item?.system?.type === '_content_type_with_special_chars____'; 50 | } 51 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/name-and-file-resolvers/content-types/content_type_circular_reference_type_a_b.ts: -------------------------------------------------------------------------------- 1 | import type { Elements } from '@kontent-ai/delivery-sdk'; 2 | import type { ContentType_circular_reference_type_b____a } from './index.js'; 3 | import type { CoreContentType } from '../system/index.js'; 4 | 5 | /** 6 | * Circular reference type A > B 7 | * 8 | * Id: a58680f7-0667-4a0e-8dc2-889233bdbf71 9 | * Codename: circular_reference_type_a_b 10 | */ 11 | export type ContentType_circular_reference_type_a_b = CoreContentType< 12 | ContentType_circular_reference_type_a_bElementCodenames, 13 | { 14 | /** 15 | * Items 16 | * 17 | * Type: modular_content 18 | * Required: false 19 | * Codename: items 20 | * Id: 33ab92dd-e47d-45e2-a060-3b5df0754c24 21 | */ 22 | readonly items: Elements.LinkedItemsElement; 23 | }, 24 | 'circular_reference_type_a_b' 25 | >; 26 | 27 | /** 28 | * Type representing all available element codenames for Circular reference type A > B 29 | */ 30 | export type ContentType_circular_reference_type_a_bElementCodenames = 'items'; 31 | 32 | /** 33 | * Type guard for Circular reference type A > B 34 | * 35 | * Id: a58680f7-0667-4a0e-8dc2-889233bdbf71 36 | * Codename: circular_reference_type_a_b 37 | */ 38 | export function isContentType_circular_reference_type_a_b( 39 | item: CoreContentType | undefined | null 40 | ): item is ContentType_circular_reference_type_a_b { 41 | return item?.system?.type === 'circular_reference_type_a_b'; 42 | } 43 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/name-and-file-resolvers/content-types/content_type_circular_reference_type_b____a.ts: -------------------------------------------------------------------------------- 1 | import type { Elements } from '@kontent-ai/delivery-sdk'; 2 | import type { ContentType_circular_reference_type_a_b } from './index.js'; 3 | import type { CoreContentType } from '../system/index.js'; 4 | 5 | /** 6 | * Circular reference type B -> A 7 | * 8 | * Id: 919bdcad-fe8e-4f56-9a63-346154b6f6e2 9 | * Codename: circular_reference_type_b____a 10 | */ 11 | export type ContentType_circular_reference_type_b____a = CoreContentType< 12 | ContentType_circular_reference_type_b____aElementCodenames, 13 | { 14 | /** 15 | * Items 16 | * 17 | * Type: modular_content 18 | * Required: false 19 | * Codename: items 20 | * Id: 019714f7-8c50-492b-8e5c-f7c3d7e2529b 21 | */ 22 | readonly items: Elements.LinkedItemsElement; 23 | }, 24 | 'circular_reference_type_b____a' 25 | >; 26 | 27 | /** 28 | * Type representing all available element codenames for Circular reference type B -> A 29 | */ 30 | export type ContentType_circular_reference_type_b____aElementCodenames = 'items'; 31 | 32 | /** 33 | * Type guard for Circular reference type B -> A 34 | * 35 | * Id: 919bdcad-fe8e-4f56-9a63-346154b6f6e2 36 | * Codename: circular_reference_type_b____a 37 | */ 38 | export function isContentType_circular_reference_type_b____a( 39 | item: CoreContentType | undefined | null 40 | ): item is ContentType_circular_reference_type_b____a { 41 | return item?.system?.type === 'circular_reference_type_b____a'; 42 | } 43 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/name-and-file-resolvers/content-types/content_type_content_type_with_guidelines_only.ts: -------------------------------------------------------------------------------- 1 | import type { CoreContentType } from '../system/index.js'; 2 | 3 | /** 4 | * Content type with guidelines only 5 | * 6 | * Id: 7e38a995-b4d7-46c9-92a4-4359241fa5ef 7 | * Codename: content_type_with_guidelines_only 8 | */ 9 | export type ContentType_content_type_with_guidelines_only = CoreContentType< 10 | ContentType_content_type_with_guidelines_onlyElementCodenames, 11 | Record, 12 | 'content_type_with_guidelines_only' 13 | >; 14 | 15 | /** 16 | * Type representing all available element codenames for Content type with guidelines only 17 | */ 18 | export type ContentType_content_type_with_guidelines_onlyElementCodenames = never; 19 | 20 | /** 21 | * Type guard for Content type with guidelines only 22 | * 23 | * Id: 7e38a995-b4d7-46c9-92a4-4359241fa5ef 24 | * Codename: content_type_with_guidelines_only 25 | */ 26 | export function isContentType_content_type_with_guidelines_only( 27 | item: CoreContentType | undefined | null 28 | ): item is ContentType_content_type_with_guidelines_only { 29 | return item?.system?.type === 'content_type_with_guidelines_only'; 30 | } 31 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/name-and-file-resolvers/content-types/content_type_content_type_with_snippet_only.ts: -------------------------------------------------------------------------------- 1 | import type { CoreContentType } from '../system/index.js'; 2 | import type { Snippet_snippet_a } from '../content-type-snippets/index.js'; 3 | 4 | /** 5 | * Content type with snippet only 6 | * 7 | * Id: 7fd86bef-8f30-4a02-a1c3-fb130f65e9b4 8 | * Codename: content_type_with_snippet_only 9 | */ 10 | export type ContentType_content_type_with_snippet_only = CoreContentType< 11 | ContentType_content_type_with_snippet_onlyElementCodenames, 12 | Record & Snippet_snippet_a, 13 | 'content_type_with_snippet_only' 14 | >; 15 | 16 | /** 17 | * Type representing all available element codenames for Content type with snippet only 18 | */ 19 | export type ContentType_content_type_with_snippet_onlyElementCodenames = 20 | | 'snippet_a__rich_text_with_all_allowed_item_types' 21 | | 'snippet_a__linked_items_with_specific_types' 22 | | 'snippet_a__text'; 23 | 24 | /** 25 | * Type guard for Content type with snippet only 26 | * 27 | * Id: 7fd86bef-8f30-4a02-a1c3-fb130f65e9b4 28 | * Codename: content_type_with_snippet_only 29 | */ 30 | export function isContentType_content_type_with_snippet_only( 31 | item: CoreContentType | undefined | null 32 | ): item is ContentType_content_type_with_snippet_only { 33 | return item?.system?.type === 'content_type_with_snippet_only'; 34 | } 35 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/name-and-file-resolvers/content-types/content_type_empty_content_type.ts: -------------------------------------------------------------------------------- 1 | import type { CoreContentType } from '../system/index.js'; 2 | 3 | /** 4 | * Empty content type 5 | * 6 | * Id: 4e41e105-6ec5-4a08-9680-b85e9cd8b14e 7 | * Codename: empty_content_type 8 | */ 9 | export type ContentType_empty_content_type = CoreContentType< 10 | ContentType_empty_content_typeElementCodenames, 11 | Record, 12 | 'empty_content_type' 13 | >; 14 | 15 | /** 16 | * Type representing all available element codenames for Empty content type 17 | */ 18 | export type ContentType_empty_content_typeElementCodenames = never; 19 | 20 | /** 21 | * Type guard for Empty content type 22 | * 23 | * Id: 4e41e105-6ec5-4a08-9680-b85e9cd8b14e 24 | * Codename: empty_content_type 25 | */ 26 | export function isContentType_empty_content_type(item: CoreContentType | undefined | null): item is ContentType_empty_content_type { 27 | return item?.system?.type === 'empty_content_type'; 28 | } 29 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/name-and-file-resolvers/content-types/content_type_type_referencing_deleted_type.ts: -------------------------------------------------------------------------------- 1 | import type { Elements } from '@kontent-ai/delivery-sdk'; 2 | import type { CoreContentType } from '../system/index.js'; 3 | 4 | /** 5 | * Type referencing deleted type 6 | * 7 | * Id: f7562083-7230-4c20-9136-620ee7a92534 8 | * Codename: type_referencing_deleted_type 9 | */ 10 | export type ContentType_type_referencing_deleted_type = CoreContentType< 11 | ContentType_type_referencing_deleted_typeElementCodenames, 12 | { 13 | /** 14 | * Rich text with invalid type 15 | * 16 | * Type: rich_text 17 | * Required: false 18 | * Codename: rich_text_with_invalid_type 19 | * Id: 03df7457-fb30-4d4e-aee2-06b0e1f218a2 20 | */ 21 | readonly rich_text_with_invalid_type: Elements.RichTextElement; 22 | /** 23 | * Linked items with invalid type 24 | * 25 | * Type: modular_content 26 | * Required: false 27 | * Codename: linked_items_with_invalid_type 28 | * Id: cc310017-de8b-42f1-962b-63959367d29a 29 | */ 30 | readonly linked_items_with_invalid_type: Elements.LinkedItemsElement; 31 | }, 32 | 'type_referencing_deleted_type' 33 | >; 34 | 35 | /** 36 | * Type representing all available element codenames for Type referencing deleted type 37 | */ 38 | export type ContentType_type_referencing_deleted_typeElementCodenames = 'rich_text_with_invalid_type' | 'linked_items_with_invalid_type'; 39 | 40 | /** 41 | * Type guard for Type referencing deleted type 42 | * 43 | * Id: f7562083-7230-4c20-9136-620ee7a92534 44 | * Codename: type_referencing_deleted_type 45 | */ 46 | export function isContentType_type_referencing_deleted_type( 47 | item: CoreContentType | undefined | null 48 | ): item is ContentType_type_referencing_deleted_type { 49 | return item?.system?.type === 'type_referencing_deleted_type'; 50 | } 51 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/name-and-file-resolvers/content-types/content_type_type_with_empty_snippet.ts: -------------------------------------------------------------------------------- 1 | import type { CoreContentType } from '../system/index.js'; 2 | 3 | /** 4 | * Type with empty snippet 5 | * 6 | * Id: 11039462-1d7d-4673-9aa8-af07fb53985c 7 | * Codename: type_with_empty_snippet 8 | */ 9 | export type ContentType_type_with_empty_snippet = CoreContentType< 10 | ContentType_type_with_empty_snippetElementCodenames, 11 | Record, 12 | 'type_with_empty_snippet' 13 | >; 14 | 15 | /** 16 | * Type representing all available element codenames for Type with empty snippet 17 | */ 18 | export type ContentType_type_with_empty_snippetElementCodenames = never; 19 | 20 | /** 21 | * Type guard for Type with empty snippet 22 | * 23 | * Id: 11039462-1d7d-4673-9aa8-af07fb53985c 24 | * Codename: type_with_empty_snippet 25 | */ 26 | export function isContentType_type_with_empty_snippet( 27 | item: CoreContentType | undefined | null 28 | ): item is ContentType_type_with_empty_snippet { 29 | return item?.system?.type === 'type_with_empty_snippet'; 30 | } 31 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/name-and-file-resolvers/content-types/index.ts: -------------------------------------------------------------------------------- 1 | export * from './content_type__content_type_with_special_chars____.js'; 2 | export * from './content_type_circular_reference_type_a_b.js'; 3 | export * from './content_type_circular_reference_type_b____a.js'; 4 | export * from './content_type_content_type_with_all_elements.js'; 5 | export * from './content_type_content_type_with_guidelines_only.js'; 6 | export * from './content_type_content_type_with_snippet_only.js'; 7 | export * from './content_type_empty_content_type.js'; 8 | export * from './content_type_page.js'; 9 | export * from './content_type_type_referencing_deleted_type.js'; 10 | export * from './content_type_type_with_empty_snippet.js'; 11 | export * from './content_type_web_spotlight_root.js'; 12 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/name-and-file-resolvers/index.ts: -------------------------------------------------------------------------------- 1 | export * from './content-type-snippets/index.js'; 2 | export * from './content-types/index.js'; 3 | export * from './system/index.js'; 4 | export * from './taxonomies/index.js'; 5 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/name-and-file-resolvers/system/core.type.ts: -------------------------------------------------------------------------------- 1 | import type { IContentItem, IContentItemElements, IDeliveryClient } from '@kontent-ai/delivery-sdk'; 2 | import type { 3 | ContentTypeCodenames, 4 | CollectionCodenames, 5 | LanguageCodenames, 6 | WorkflowCodenames, 7 | WorkflowStepCodenames, 8 | ElementCodenames, 9 | TaxonomyCodenames 10 | } from './delivery.codenames.js'; 11 | 12 | /** 13 | * Core content type used in favor of default 'IContentItem' 14 | */ 15 | export type CoreContentType< 16 | TElementCodenames extends string = string, 17 | TElements extends IContentItemElements = IContentItemElements, 18 | TContentTypeCodename extends ContentTypeCodenames = ContentTypeCodenames 19 | > = IContentItem; 20 | 21 | /** 22 | * Core types for 'IDeliveryClient' 23 | */ 24 | export type CoreClientTypes = { 25 | readonly collectionCodenames: CollectionCodenames; 26 | readonly contentItemType: CoreContentType; 27 | readonly contentTypeCodenames: ContentTypeCodenames; 28 | readonly elementCodenames: ElementCodenames; 29 | readonly languageCodenames: LanguageCodenames; 30 | readonly taxonomyCodenames: TaxonomyCodenames; 31 | readonly workflowCodenames: WorkflowCodenames; 32 | readonly workflowStepCodenames: WorkflowStepCodenames; 33 | }; 34 | 35 | /** 36 | * Typed delivery client in favor of default 'IDeliveryClient' 37 | */ 38 | export type CoreDeliveryClient = IDeliveryClient; 39 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/name-and-file-resolvers/system/index.ts: -------------------------------------------------------------------------------- 1 | export * from './core.type.js'; 2 | export * from './delivery.codenames.js'; 3 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/name-and-file-resolvers/taxonomies/index.ts: -------------------------------------------------------------------------------- 1 | export * from './taxonomy_taxonomy_a.js'; 2 | export * from './taxonomy_taxonomy_without_terms.js'; 3 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/name-and-file-resolvers/taxonomies/taxonomy_taxonomy_a.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * All taxonomy codename values for Taxonomy A 3 | * 4 | * Codename: taxonomy_a 5 | * Id: bb37a632-3f78-48f8-ba25-7fa806d41a3e 6 | */ 7 | export const Taxonomy_taxonomy_aValues = ['nested_term_2', 'nested_term_1', 'term_1', 'term_2', 'term_3'] as const; 8 | 9 | /** 10 | * Type representing Taxonomy A taxonomy 11 | * 12 | * Codename: taxonomy_a 13 | * Id: bb37a632-3f78-48f8-ba25-7fa806d41a3e 14 | */ 15 | export type Taxonomy_taxonomy_a = (typeof Taxonomy_taxonomy_aValues)[number]; 16 | 17 | /** 18 | * Type guard for Taxonomy A 19 | * 20 | * Codename: taxonomy_a 21 | * Id: bb37a632-3f78-48f8-ba25-7fa806d41a3e 22 | */ 23 | export function isTaxonomy_taxonomy_a(value: string | undefined | null): value is Taxonomy_taxonomy_a { 24 | return typeof value === 'string' && (Taxonomy_taxonomy_aValues as readonly string[]).includes(value); 25 | } 26 | -------------------------------------------------------------------------------- /tests/integration/snapshots/delivery-sdk/name-and-file-resolvers/taxonomies/taxonomy_taxonomy_without_terms.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * All taxonomy codename values for Taxonomy without terms 3 | * 4 | * Codename: taxonomy_without_terms 5 | * Id: 01878d46-fcbc-4211-a801-676ad4e72cb2 6 | */ 7 | export const Taxonomy_taxonomy_without_termsValues = [] as const; 8 | 9 | /** 10 | * Type representing Taxonomy without terms taxonomy 11 | * 12 | * Codename: taxonomy_without_terms 13 | * Id: 01878d46-fcbc-4211-a801-676ad4e72cb2 14 | */ 15 | export type Taxonomy_taxonomy_without_terms = (typeof Taxonomy_taxonomy_without_termsValues)[number]; 16 | 17 | /** 18 | * Type guard for Taxonomy without terms 19 | * 20 | * Codename: taxonomy_without_terms 21 | * Id: 01878d46-fcbc-4211-a801-676ad4e72cb2 22 | */ 23 | export function isTaxonomy_taxonomy_without_terms(value: string | undefined | null): value is Taxonomy_taxonomy_without_terms { 24 | return typeof value === 'string' && (Taxonomy_taxonomy_without_termsValues as readonly string[]).includes(value); 25 | } 26 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/all-entities-js/_filesList.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "filename": "languages.ts" }, 3 | { "filename": "collections.ts" }, 4 | { "filename": "contentTypes.ts" }, 5 | { "filename": "contentTypeSnippets.ts" }, 6 | { "filename": "workflows.ts" }, 7 | { "filename": "roles.ts" }, 8 | { "filename": "assetFolders.ts" }, 9 | { "filename": "webhooks.ts" }, 10 | { "filename": "taxonomies.ts" }, 11 | { "filename": "customApps.ts" }, 12 | { "filename": "spaces.ts" }, 13 | { "filename": "previewUrls.ts" }, 14 | { "filename": "index.ts" } 15 | ] 16 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/all-entities-js/assetFolders.ts: -------------------------------------------------------------------------------- 1 | export const assetFolders = { 2 | /** 3 | * Folder A 4 | */ 5 | folder_a: { 6 | name: 'Folder A', 7 | codename: 'folder_a', 8 | id: '5cf5c539-6574-4971-b4da-4cd503052f61', 9 | externalId: undefined, 10 | folders: { 11 | /** 12 | * Folder C 13 | */ 14 | folder_c: { 15 | name: 'Folder C', 16 | codename: 'folder_c', 17 | id: 'a829c87a-e627-4d80-af16-2f6c92509452', 18 | externalId: undefined, 19 | folders: { 20 | /** 21 | * Folder D 22 | */ 23 | folder_d: { 24 | name: 'Folder D', 25 | codename: 'folder_d', 26 | id: '8e1edcd2-5b53-4228-aadb-2211ee3ea91e', 27 | externalId: undefined, 28 | folders: {} 29 | } 30 | } 31 | } 32 | } 33 | }, 34 | 35 | /** 36 | * Folder B 37 | */ 38 | folder_b: { 39 | name: 'Folder B', 40 | codename: 'folder_b', 41 | id: '916b6be8-55c3-4a45-80ad-8d860fd7d1f6', 42 | externalId: undefined, 43 | folders: {} 44 | } 45 | } as const; 46 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/all-entities-js/collections.ts: -------------------------------------------------------------------------------- 1 | export const collections = { 2 | /** 3 | * Legacy collection 4 | */ 5 | legacy_collection: { 6 | name: 'Legacy collection', 7 | codename: 'legacy_collection', 8 | id: 'cae5e2ff-6f38-4381-aa55-89fdf8427bcf' 9 | }, 10 | 11 | /** 12 | * Default 13 | */ 14 | default: { 15 | name: 'Default', 16 | codename: 'default', 17 | id: '00000000-0000-0000-0000-000000000000' 18 | } 19 | } as const; 20 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/all-entities-js/customApps.ts: -------------------------------------------------------------------------------- 1 | export const customApps = { 2 | /** 3 | * Custom app 1 4 | */ 5 | customApp1: { 6 | name: 'Custom app 1', 7 | codename: 'custom_app_1', 8 | sourceUrl: 'https://kontent.ai' 9 | }, 10 | 11 | /** 12 | * Custom app 2 13 | */ 14 | customApp2: { 15 | name: 'Custom app 2', 16 | codename: 'custom_app_2', 17 | sourceUrl: 'https://sample.com/A' 18 | } 19 | } as const; 20 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/all-entities-js/index.ts: -------------------------------------------------------------------------------- 1 | export * from './assetFolders.js'; 2 | export * from './collections.js'; 3 | export * from './contentTypes.js'; 4 | export * from './contentTypeSnippets.js'; 5 | export * from './customApps.js'; 6 | export * from './languages.js'; 7 | export * from './previewUrls.js'; 8 | export * from './roles.js'; 9 | export * from './spaces.js'; 10 | export * from './taxonomies.js'; 11 | export * from './webhooks.js'; 12 | export * from './workflows.js'; 13 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/all-entities-js/languages.ts: -------------------------------------------------------------------------------- 1 | export const languages = { 2 | /** 3 | * Default project language 4 | */ 5 | default: { 6 | name: 'Default project language', 7 | codename: 'default', 8 | id: '00000000-0000-0000-0000-000000000000', 9 | isActive: true, 10 | isDefault: true, 11 | fallbackLanguageId: '00000000-0000-0000-0000-000000000000', 12 | externalId: undefined 13 | }, 14 | 15 | /** 16 | * English 17 | */ 18 | enUS: { 19 | name: 'English', 20 | codename: 'en-US', 21 | id: '92b3da35-4f76-4169-be83-dd6ea3e19df4', 22 | isActive: true, 23 | isDefault: false, 24 | fallbackLanguageId: '00000000-0000-0000-0000-000000000000', 25 | externalId: undefined 26 | }, 27 | 28 | /** 29 | * Spanish 30 | */ 31 | esES: { 32 | name: 'Spanish', 33 | codename: 'es-ES', 34 | id: '479cc04e-3cb9-4e4d-962e-8335edb0d42d', 35 | isActive: true, 36 | isDefault: false, 37 | fallbackLanguageId: '00000000-0000-0000-0000-000000000000', 38 | externalId: undefined 39 | }, 40 | 41 | /** 42 | * __jp 43 | */ 44 | jp: { 45 | name: '__jp', 46 | codename: '__jp', 47 | id: '012f5a8a-cd02-4dc0-8967-5fc015cb3ea8', 48 | isActive: true, 49 | isDefault: false, 50 | fallbackLanguageId: '00000000-0000-0000-0000-000000000000', 51 | externalId: undefined 52 | }, 53 | 54 | /** 55 | * 🦉Lang 56 | */ 57 | lang: { 58 | name: '🦉Lang', 59 | codename: '🦉Lang', 60 | id: 'ca74c0e9-be0b-44e9-9d3c-dc2be224df34', 61 | isActive: true, 62 | isDefault: false, 63 | fallbackLanguageId: '00000000-0000-0000-0000-000000000000', 64 | externalId: undefined 65 | } 66 | } as const; 67 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/all-entities-js/previewUrls.ts: -------------------------------------------------------------------------------- 1 | export const previewUrls = { 2 | /** 3 | * Preview configuration 4 | */ 5 | spaceDomains: { 6 | default_space: { 7 | spaceName: 'Default space', 8 | spaceCodename: 'default_space', 9 | domain: 'https://sample.com/A' 10 | }, 11 | 12 | uk_space: { 13 | spaceName: 'UK Space', 14 | spaceCodename: 'uk_space', 15 | domain: 'https://sample.com/B' 16 | } 17 | }, 18 | previewUrlPatterns: { 19 | content_type_with_all_elements: { 20 | contentTypeName: 'Content type with all elements', 21 | contentTypeCodename: 'content_type_with_all_elements', 22 | urlPatterns: { 23 | uk_space: { 24 | spaceName: 'UK Space', 25 | spaceCodename: 'uk_space', 26 | url: 'https://sample.com/{codename}' 27 | }, 28 | 29 | default_space: { 30 | spaceName: 'Default space', 31 | spaceCodename: 'default_space', 32 | url: 'https://sample.com/default/{codename}' 33 | } 34 | } 35 | } 36 | } 37 | } as const; 38 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/all-entities-js/roles.ts: -------------------------------------------------------------------------------- 1 | export const roles = { 2 | /** 3 | * Project manager 4 | */ 5 | projectManager: { 6 | name: 'Project manager', 7 | codename: 'project-manager', 8 | id: '11e8e88f-30a6-4b53-92d6-46f834753fe0' 9 | }, 10 | 11 | /** 12 | * Editor 13 | */ 14 | editor: { 15 | name: 'Editor', 16 | codename: undefined, 17 | id: '1f84cb35-c8d1-4b08-b5ab-de222c0ee971' 18 | } 19 | } as const; 20 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/all-entities-js/spaces.ts: -------------------------------------------------------------------------------- 1 | export const spaces = { 2 | /** 3 | * Default space 4 | */ 5 | defaultSpace: { 6 | name: 'Default space', 7 | codename: 'default_space', 8 | id: '425019d1-b896-4046-b181-7d7676cf5612' 9 | }, 10 | 11 | /** 12 | * UK Space 13 | */ 14 | ukSpace: { 15 | name: 'UK Space', 16 | codename: 'uk_space', 17 | id: '90ddee41-ed12-4ca6-95b7-4aa759b50bcc' 18 | } 19 | } as const; 20 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/all-entities-js/webhooks.ts: -------------------------------------------------------------------------------- 1 | export const webhooks = { 2 | /** 3 | * Webhook A 4 | */ 5 | webhookA: { 6 | name: 'Webhook A', 7 | url: 'https://sample.ai', 8 | id: 'fb8c5f7f-a46e-432a-8c38-212a05d8c337' 9 | }, 10 | 11 | /** 12 | * Webhook B 13 | */ 14 | webhookB: { 15 | name: 'Webhook B', 16 | url: 'https://kontent.ai', 17 | id: '32bff270-82b2-4848-bfb6-249288f1d7dc' 18 | } 19 | } as const; 20 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/all-entities-ts/_filesList.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "filename": "languages.ts" }, 3 | { "filename": "collections.ts" }, 4 | { "filename": "contentTypes.ts" }, 5 | { "filename": "contentTypeSnippets.ts" }, 6 | { "filename": "workflows.ts" }, 7 | { "filename": "roles.ts" }, 8 | { "filename": "assetFolders.ts" }, 9 | { "filename": "webhooks.ts" }, 10 | { "filename": "taxonomies.ts" }, 11 | { "filename": "customApps.ts" }, 12 | { "filename": "spaces.ts" }, 13 | { "filename": "previewUrls.ts" }, 14 | { "filename": "index.ts" } 15 | ] 16 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/all-entities-ts/assetFolders.ts: -------------------------------------------------------------------------------- 1 | export const assetFolders = { 2 | /** 3 | * Folder A 4 | */ 5 | folder_a: { 6 | name: 'Folder A', 7 | codename: 'folder_a', 8 | id: '5cf5c539-6574-4971-b4da-4cd503052f61', 9 | externalId: undefined, 10 | folders: { 11 | /** 12 | * Folder C 13 | */ 14 | folder_c: { 15 | name: 'Folder C', 16 | codename: 'folder_c', 17 | id: 'a829c87a-e627-4d80-af16-2f6c92509452', 18 | externalId: undefined, 19 | folders: { 20 | /** 21 | * Folder D 22 | */ 23 | folder_d: { 24 | name: 'Folder D', 25 | codename: 'folder_d', 26 | id: '8e1edcd2-5b53-4228-aadb-2211ee3ea91e', 27 | externalId: undefined, 28 | folders: {} 29 | } 30 | } 31 | } 32 | } 33 | }, 34 | 35 | /** 36 | * Folder B 37 | */ 38 | folder_b: { 39 | name: 'Folder B', 40 | codename: 'folder_b', 41 | id: '916b6be8-55c3-4a45-80ad-8d860fd7d1f6', 42 | externalId: undefined, 43 | folders: {} 44 | } 45 | } as const; 46 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/all-entities-ts/collections.ts: -------------------------------------------------------------------------------- 1 | export const collections = { 2 | /** 3 | * Legacy collection 4 | */ 5 | legacy_collection: { 6 | name: 'Legacy collection', 7 | codename: 'legacy_collection', 8 | id: 'cae5e2ff-6f38-4381-aa55-89fdf8427bcf' 9 | }, 10 | 11 | /** 12 | * Default 13 | */ 14 | default: { 15 | name: 'Default', 16 | codename: 'default', 17 | id: '00000000-0000-0000-0000-000000000000' 18 | } 19 | } as const; 20 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/all-entities-ts/customApps.ts: -------------------------------------------------------------------------------- 1 | export const customApps = { 2 | /** 3 | * Custom app 1 4 | */ 5 | customApp1: { 6 | name: 'Custom app 1', 7 | codename: 'custom_app_1', 8 | sourceUrl: 'https://kontent.ai' 9 | }, 10 | 11 | /** 12 | * Custom app 2 13 | */ 14 | customApp2: { 15 | name: 'Custom app 2', 16 | codename: 'custom_app_2', 17 | sourceUrl: 'https://sample.com/A' 18 | } 19 | } as const; 20 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/all-entities-ts/index.ts: -------------------------------------------------------------------------------- 1 | export * from './assetFolders.ts'; 2 | export * from './collections.ts'; 3 | export * from './contentTypes.ts'; 4 | export * from './contentTypeSnippets.ts'; 5 | export * from './customApps.ts'; 6 | export * from './languages.ts'; 7 | export * from './previewUrls.ts'; 8 | export * from './roles.ts'; 9 | export * from './spaces.ts'; 10 | export * from './taxonomies.ts'; 11 | export * from './webhooks.ts'; 12 | export * from './workflows.ts'; 13 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/all-entities-ts/languages.ts: -------------------------------------------------------------------------------- 1 | export const languages = { 2 | /** 3 | * Default project language 4 | */ 5 | default: { 6 | name: 'Default project language', 7 | codename: 'default', 8 | id: '00000000-0000-0000-0000-000000000000', 9 | isActive: true, 10 | isDefault: true, 11 | fallbackLanguageId: '00000000-0000-0000-0000-000000000000', 12 | externalId: undefined 13 | }, 14 | 15 | /** 16 | * English 17 | */ 18 | enUS: { 19 | name: 'English', 20 | codename: 'en-US', 21 | id: '92b3da35-4f76-4169-be83-dd6ea3e19df4', 22 | isActive: true, 23 | isDefault: false, 24 | fallbackLanguageId: '00000000-0000-0000-0000-000000000000', 25 | externalId: undefined 26 | }, 27 | 28 | /** 29 | * Spanish 30 | */ 31 | esES: { 32 | name: 'Spanish', 33 | codename: 'es-ES', 34 | id: '479cc04e-3cb9-4e4d-962e-8335edb0d42d', 35 | isActive: true, 36 | isDefault: false, 37 | fallbackLanguageId: '00000000-0000-0000-0000-000000000000', 38 | externalId: undefined 39 | }, 40 | 41 | /** 42 | * __jp 43 | */ 44 | jp: { 45 | name: '__jp', 46 | codename: '__jp', 47 | id: '012f5a8a-cd02-4dc0-8967-5fc015cb3ea8', 48 | isActive: true, 49 | isDefault: false, 50 | fallbackLanguageId: '00000000-0000-0000-0000-000000000000', 51 | externalId: undefined 52 | }, 53 | 54 | /** 55 | * 🦉Lang 56 | */ 57 | lang: { 58 | name: '🦉Lang', 59 | codename: '🦉Lang', 60 | id: 'ca74c0e9-be0b-44e9-9d3c-dc2be224df34', 61 | isActive: true, 62 | isDefault: false, 63 | fallbackLanguageId: '00000000-0000-0000-0000-000000000000', 64 | externalId: undefined 65 | } 66 | } as const; 67 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/all-entities-ts/previewUrls.ts: -------------------------------------------------------------------------------- 1 | export const previewUrls = { 2 | /** 3 | * Preview configuration 4 | */ 5 | spaceDomains: { 6 | default_space: { 7 | spaceName: 'Default space', 8 | spaceCodename: 'default_space', 9 | domain: 'https://sample.com/A' 10 | }, 11 | 12 | uk_space: { 13 | spaceName: 'UK Space', 14 | spaceCodename: 'uk_space', 15 | domain: 'https://sample.com/B' 16 | } 17 | }, 18 | previewUrlPatterns: { 19 | content_type_with_all_elements: { 20 | contentTypeName: 'Content type with all elements', 21 | contentTypeCodename: 'content_type_with_all_elements', 22 | urlPatterns: { 23 | uk_space: { 24 | spaceName: 'UK Space', 25 | spaceCodename: 'uk_space', 26 | url: 'https://sample.com/{codename}' 27 | }, 28 | 29 | default_space: { 30 | spaceName: 'Default space', 31 | spaceCodename: 'default_space', 32 | url: 'https://sample.com/default/{codename}' 33 | } 34 | } 35 | } 36 | } 37 | } as const; 38 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/all-entities-ts/roles.ts: -------------------------------------------------------------------------------- 1 | export const roles = { 2 | /** 3 | * Project manager 4 | */ 5 | projectManager: { 6 | name: 'Project manager', 7 | codename: 'project-manager', 8 | id: '11e8e88f-30a6-4b53-92d6-46f834753fe0' 9 | }, 10 | 11 | /** 12 | * Editor 13 | */ 14 | editor: { 15 | name: 'Editor', 16 | codename: undefined, 17 | id: '1f84cb35-c8d1-4b08-b5ab-de222c0ee971' 18 | } 19 | } as const; 20 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/all-entities-ts/spaces.ts: -------------------------------------------------------------------------------- 1 | export const spaces = { 2 | /** 3 | * Default space 4 | */ 5 | defaultSpace: { 6 | name: 'Default space', 7 | codename: 'default_space', 8 | id: '425019d1-b896-4046-b181-7d7676cf5612' 9 | }, 10 | 11 | /** 12 | * UK Space 13 | */ 14 | ukSpace: { 15 | name: 'UK Space', 16 | codename: 'uk_space', 17 | id: '90ddee41-ed12-4ca6-95b7-4aa759b50bcc' 18 | } 19 | } as const; 20 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/all-entities-ts/webhooks.ts: -------------------------------------------------------------------------------- 1 | export const webhooks = { 2 | /** 3 | * Webhook A 4 | */ 5 | webhookA: { 6 | name: 'Webhook A', 7 | url: 'https://sample.ai', 8 | id: 'fb8c5f7f-a46e-432a-8c38-212a05d8c337' 9 | }, 10 | 11 | /** 12 | * Webhook B 13 | */ 14 | webhookB: { 15 | name: 'Webhook B', 16 | url: 'https://kontent.ai', 17 | id: '32bff270-82b2-4848-bfb6-249288f1d7dc' 18 | } 19 | } as const; 20 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/entities-filter-1/_filesList.json: -------------------------------------------------------------------------------- 1 | [{ "filename": "taxonomies.ts" }, { "filename": "index.ts" }] 2 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/entities-filter-1/index.ts: -------------------------------------------------------------------------------- 1 | export * from './taxonomies.js'; 2 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/entities-filter-2/_filesList.json: -------------------------------------------------------------------------------- 1 | [{ "filename": "contentTypes.ts" }, { "filename": "index.ts" }] 2 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/entities-filter-2/index.ts: -------------------------------------------------------------------------------- 1 | export * from './contentTypes.js'; 2 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/entities-filter-3/_filesList.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "filename": "languages.ts" }, 3 | { "filename": "contentTypeSnippets.ts" }, 4 | { "filename": "workflows.ts" }, 5 | { "filename": "index.ts" } 6 | ] 7 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/entities-filter-3/index.ts: -------------------------------------------------------------------------------- 1 | export * from './contentTypeSnippets.ts'; 2 | export * from './languages.ts'; 3 | export * from './workflows.ts'; 4 | -------------------------------------------------------------------------------- /tests/integration/snapshots/environment/entities-filter-3/languages.ts: -------------------------------------------------------------------------------- 1 | export const languages = { 2 | /** 3 | * Default project language 4 | */ 5 | default: { 6 | name: 'Default project language', 7 | codename: 'default', 8 | id: '00000000-0000-0000-0000-000000000000', 9 | isActive: true, 10 | isDefault: true, 11 | fallbackLanguageId: '00000000-0000-0000-0000-000000000000', 12 | externalId: undefined 13 | }, 14 | 15 | /** 16 | * English 17 | */ 18 | enUS: { 19 | name: 'English', 20 | codename: 'en-US', 21 | id: '92b3da35-4f76-4169-be83-dd6ea3e19df4', 22 | isActive: true, 23 | isDefault: false, 24 | fallbackLanguageId: '00000000-0000-0000-0000-000000000000', 25 | externalId: undefined 26 | }, 27 | 28 | /** 29 | * Spanish 30 | */ 31 | esES: { 32 | name: 'Spanish', 33 | codename: 'es-ES', 34 | id: '479cc04e-3cb9-4e4d-962e-8335edb0d42d', 35 | isActive: true, 36 | isDefault: false, 37 | fallbackLanguageId: '00000000-0000-0000-0000-000000000000', 38 | externalId: undefined 39 | }, 40 | 41 | /** 42 | * __jp 43 | */ 44 | jp: { 45 | name: '__jp', 46 | codename: '__jp', 47 | id: '012f5a8a-cd02-4dc0-8967-5fc015cb3ea8', 48 | isActive: true, 49 | isDefault: false, 50 | fallbackLanguageId: '00000000-0000-0000-0000-000000000000', 51 | externalId: undefined 52 | }, 53 | 54 | /** 55 | * 🦉Lang 56 | */ 57 | lang: { 58 | name: '🦉Lang', 59 | codename: '🦉Lang', 60 | id: 'ca74c0e9-be0b-44e9-9d3c-dc2be224df34', 61 | isActive: true, 62 | isDefault: false, 63 | fallbackLanguageId: '00000000-0000-0000-0000-000000000000', 64 | externalId: undefined 65 | } 66 | } as const; 67 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/filterByType/_filesList.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "filename": "items/content_type_with_all_elements.items.ts" }, 3 | { "filename": "items/index.ts" }, 4 | { "filename": "codenames/content_type_with_all_elements.codenames.ts" }, 5 | { "filename": "codenames/index.ts" }, 6 | { "filename": "index.ts" } 7 | ] 8 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/filterByType/codenames/content_type_with_all_elements.codenames.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Type representing available item codenames 3 | * 4 | * Content type with all elements 5 | * 6 | * Codename: content_type_with_all_elements 7 | * Id: 071c7591-e7f0-41ac-984f-7a3db35f97e8 8 | * Codename: content_type_with_all_elements 9 | */ 10 | export type ContentTypeWithAllElementsCodenames = 'item_a'; 11 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/filterByType/codenames/index.ts: -------------------------------------------------------------------------------- 1 | export * from './content_type_with_all_elements.codenames.js'; 2 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/filterByType/index.ts: -------------------------------------------------------------------------------- 1 | export * from './codenames/index.js'; 2 | export * from './items/index.js'; 3 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/filterByType/items/content_type_with_all_elements.items.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Object representing identifiers of available items 3 | * 4 | * Content type with all elements 5 | * 6 | * Codename: content_type_with_all_elements 7 | * Id: 071c7591-e7f0-41ac-984f-7a3db35f97e8 8 | * Codename: content_type_with_all_elements 9 | */ 10 | export const content_type_with_all_elementsItems = { 11 | /** 12 | * Item A 13 | */ 14 | item_a: { 15 | codename: 'item_a', 16 | id: 'c9084218-1d6a-4346-8042-f0dff2a4251a' 17 | } 18 | } as const; 19 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/filterByType/items/index.ts: -------------------------------------------------------------------------------- 1 | export * from './content_type_with_all_elements.items.js'; 2 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsAndTypes-js/_filesList.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "filename": "items/content_type_with_all_elements.items.ts" }, 3 | { "filename": "items/_content_type_with_special_chars____.items.ts" }, 4 | { "filename": "items/web_spotlight_root.items.ts" }, 5 | { "filename": "items/index.ts" }, 6 | { "filename": "codenames/content_type_with_all_elements.codenames.ts" }, 7 | { "filename": "codenames/_content_type_with_special_chars____.codenames.ts" }, 8 | { "filename": "codenames/web_spotlight_root.codenames.ts" }, 9 | { "filename": "codenames/index.ts" }, 10 | { "filename": "index.ts" } 11 | ] 12 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsAndTypes-js/codenames/_content_type_with_special_chars____.codenames.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Type representing available item codenames 3 | * 4 | * 🐧 Content type with special chars #!_' 5 | * 6 | * Codename: _content_type_with_special_chars____ 7 | * Id: 66bfcb40-edd7-4edf-8176-33517d0d6f80 8 | * Codename: _content_type_with_special_chars____ 9 | */ 10 | export type ContentTypeWithSpecialCharsCodenames = 'item_b' | 'item_c'; 11 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsAndTypes-js/codenames/content_type_with_all_elements.codenames.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Type representing available item codenames 3 | * 4 | * Content type with all elements 5 | * 6 | * Codename: content_type_with_all_elements 7 | * Id: 071c7591-e7f0-41ac-984f-7a3db35f97e8 8 | * Codename: content_type_with_all_elements 9 | */ 10 | export type ContentTypeWithAllElementsCodenames = 'item_a'; 11 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsAndTypes-js/codenames/index.ts: -------------------------------------------------------------------------------- 1 | export * from './_content_type_with_special_chars____.codenames.js'; 2 | export * from './content_type_with_all_elements.codenames.js'; 3 | export * from './web_spotlight_root.codenames.js'; 4 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsAndTypes-js/codenames/web_spotlight_root.codenames.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Type representing available item codenames 3 | * 4 | * Web spotlight root 5 | * 6 | * Codename: web_spotlight_root 7 | * Id: 7e8ca9f3-7f06-44d6-b9db-ae4905531365 8 | * Codename: web_spotlight_root 9 | */ 10 | export type WebSpotlightRootCodenames = 'wsl_root'; 11 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsAndTypes-js/index.ts: -------------------------------------------------------------------------------- 1 | export * from './codenames/index.js'; 2 | export * from './items/index.js'; 3 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsAndTypes-js/items/_content_type_with_special_chars____.items.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Object representing identifiers of available items 3 | * 4 | * 🐧 Content type with special chars #!_' 5 | * 6 | * Codename: _content_type_with_special_chars____ 7 | * Id: 66bfcb40-edd7-4edf-8176-33517d0d6f80 8 | * Codename: _content_type_with_special_chars____ 9 | */ 10 | export const _content_type_with_special_chars____Items = { 11 | /** 12 | * Item B 13 | */ 14 | item_b: { 15 | codename: 'item_b', 16 | id: '48ab3d74-1e06-4eb1-a49b-975593fa990e' 17 | }, 18 | 19 | /** 20 | * Item C 21 | */ 22 | item_c: { 23 | codename: 'item_c', 24 | id: 'b2f155fa-e2fe-4102-9d20-b3b8465b6c49' 25 | } 26 | } as const; 27 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsAndTypes-js/items/content_type_with_all_elements.items.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Object representing identifiers of available items 3 | * 4 | * Content type with all elements 5 | * 6 | * Codename: content_type_with_all_elements 7 | * Id: 071c7591-e7f0-41ac-984f-7a3db35f97e8 8 | * Codename: content_type_with_all_elements 9 | */ 10 | export const content_type_with_all_elementsItems = { 11 | /** 12 | * Item A 13 | */ 14 | item_a: { 15 | codename: 'item_a', 16 | id: 'c9084218-1d6a-4346-8042-f0dff2a4251a' 17 | } 18 | } as const; 19 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsAndTypes-js/items/index.ts: -------------------------------------------------------------------------------- 1 | export * from './_content_type_with_special_chars____.items.js'; 2 | export * from './content_type_with_all_elements.items.js'; 3 | export * from './web_spotlight_root.items.js'; 4 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsAndTypes-js/items/web_spotlight_root.items.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Object representing identifiers of available items 3 | * 4 | * Web spotlight root 5 | * 6 | * Codename: web_spotlight_root 7 | * Id: 7e8ca9f3-7f06-44d6-b9db-ae4905531365 8 | * Codename: web_spotlight_root 9 | */ 10 | export const web_spotlight_rootItems = { 11 | /** 12 | * WSL root 13 | */ 14 | wsl_root: { 15 | codename: 'wsl_root', 16 | id: 'c2d52eb8-30a3-4838-b20c-6ca5aab7e094' 17 | } 18 | } as const; 19 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsAndTypes-ts/_filesList.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "filename": "items/content_type_with_all_elements.items.ts" }, 3 | { "filename": "items/_content_type_with_special_chars____.items.ts" }, 4 | { "filename": "items/web_spotlight_root.items.ts" }, 5 | { "filename": "items/index.ts" }, 6 | { "filename": "codenames/content_type_with_all_elements.codenames.ts" }, 7 | { "filename": "codenames/_content_type_with_special_chars____.codenames.ts" }, 8 | { "filename": "codenames/web_spotlight_root.codenames.ts" }, 9 | { "filename": "codenames/index.ts" }, 10 | { "filename": "index.ts" } 11 | ] 12 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsAndTypes-ts/codenames/_content_type_with_special_chars____.codenames.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Type representing available item codenames 3 | * 4 | * 🐧 Content type with special chars #!_' 5 | * 6 | * Codename: _content_type_with_special_chars____ 7 | * Id: 66bfcb40-edd7-4edf-8176-33517d0d6f80 8 | * Codename: _content_type_with_special_chars____ 9 | */ 10 | export type ContentTypeWithSpecialCharsCodenames = 'item_b' | 'item_c'; 11 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsAndTypes-ts/codenames/content_type_with_all_elements.codenames.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Type representing available item codenames 3 | * 4 | * Content type with all elements 5 | * 6 | * Codename: content_type_with_all_elements 7 | * Id: 071c7591-e7f0-41ac-984f-7a3db35f97e8 8 | * Codename: content_type_with_all_elements 9 | */ 10 | export type ContentTypeWithAllElementsCodenames = 'item_a'; 11 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsAndTypes-ts/codenames/index.ts: -------------------------------------------------------------------------------- 1 | export * from './_content_type_with_special_chars____.codenames.ts'; 2 | export * from './content_type_with_all_elements.codenames.ts'; 3 | export * from './web_spotlight_root.codenames.ts'; 4 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsAndTypes-ts/codenames/web_spotlight_root.codenames.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Type representing available item codenames 3 | * 4 | * Web spotlight root 5 | * 6 | * Codename: web_spotlight_root 7 | * Id: 7e8ca9f3-7f06-44d6-b9db-ae4905531365 8 | * Codename: web_spotlight_root 9 | */ 10 | export type WebSpotlightRootCodenames = 'wsl_root'; 11 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsAndTypes-ts/index.ts: -------------------------------------------------------------------------------- 1 | export * from './codenames/index.ts'; 2 | export * from './items/index.ts'; 3 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsAndTypes-ts/items/_content_type_with_special_chars____.items.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Object representing identifiers of available items 3 | * 4 | * 🐧 Content type with special chars #!_' 5 | * 6 | * Codename: _content_type_with_special_chars____ 7 | * Id: 66bfcb40-edd7-4edf-8176-33517d0d6f80 8 | * Codename: _content_type_with_special_chars____ 9 | */ 10 | export const _content_type_with_special_chars____Items = { 11 | /** 12 | * Item B 13 | */ 14 | item_b: { 15 | codename: 'item_b', 16 | id: '48ab3d74-1e06-4eb1-a49b-975593fa990e' 17 | }, 18 | 19 | /** 20 | * Item C 21 | */ 22 | item_c: { 23 | codename: 'item_c', 24 | id: 'b2f155fa-e2fe-4102-9d20-b3b8465b6c49' 25 | } 26 | } as const; 27 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsAndTypes-ts/items/content_type_with_all_elements.items.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Object representing identifiers of available items 3 | * 4 | * Content type with all elements 5 | * 6 | * Codename: content_type_with_all_elements 7 | * Id: 071c7591-e7f0-41ac-984f-7a3db35f97e8 8 | * Codename: content_type_with_all_elements 9 | */ 10 | export const content_type_with_all_elementsItems = { 11 | /** 12 | * Item A 13 | */ 14 | item_a: { 15 | codename: 'item_a', 16 | id: 'c9084218-1d6a-4346-8042-f0dff2a4251a' 17 | } 18 | } as const; 19 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsAndTypes-ts/items/index.ts: -------------------------------------------------------------------------------- 1 | export * from './_content_type_with_special_chars____.items.ts'; 2 | export * from './content_type_with_all_elements.items.ts'; 3 | export * from './web_spotlight_root.items.ts'; 4 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsAndTypes-ts/items/web_spotlight_root.items.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Object representing identifiers of available items 3 | * 4 | * Web spotlight root 5 | * 6 | * Codename: web_spotlight_root 7 | * Id: 7e8ca9f3-7f06-44d6-b9db-ae4905531365 8 | * Codename: web_spotlight_root 9 | */ 10 | export const web_spotlight_rootItems = { 11 | /** 12 | * WSL root 13 | */ 14 | wsl_root: { 15 | codename: 'wsl_root', 16 | id: 'c2d52eb8-30a3-4838-b20c-6ca5aab7e094' 17 | } 18 | } as const; 19 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsOnly/_filesList.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "filename": "items/content_type_with_all_elements.items.ts" }, 3 | { "filename": "items/_content_type_with_special_chars____.items.ts" }, 4 | { "filename": "items/web_spotlight_root.items.ts" }, 5 | { "filename": "items/index.ts" }, 6 | { "filename": "index.ts" } 7 | ] 8 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsOnly/index.ts: -------------------------------------------------------------------------------- 1 | export * from './items/index.js'; 2 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsOnly/items/_content_type_with_special_chars____.items.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Object representing identifiers of available items 3 | * 4 | * 🐧 Content type with special chars #!_' 5 | * 6 | * Codename: _content_type_with_special_chars____ 7 | * Id: 66bfcb40-edd7-4edf-8176-33517d0d6f80 8 | * Codename: _content_type_with_special_chars____ 9 | */ 10 | export const _content_type_with_special_chars____Items = { 11 | /** 12 | * Item B 13 | */ 14 | item_b: { 15 | codename: 'item_b', 16 | id: '48ab3d74-1e06-4eb1-a49b-975593fa990e' 17 | }, 18 | 19 | /** 20 | * Item C 21 | */ 22 | item_c: { 23 | codename: 'item_c', 24 | id: 'b2f155fa-e2fe-4102-9d20-b3b8465b6c49' 25 | } 26 | } as const; 27 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsOnly/items/content_type_with_all_elements.items.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Object representing identifiers of available items 3 | * 4 | * Content type with all elements 5 | * 6 | * Codename: content_type_with_all_elements 7 | * Id: 071c7591-e7f0-41ac-984f-7a3db35f97e8 8 | * Codename: content_type_with_all_elements 9 | */ 10 | export const content_type_with_all_elementsItems = { 11 | /** 12 | * Item A 13 | */ 14 | item_a: { 15 | codename: 'item_a', 16 | id: 'c9084218-1d6a-4346-8042-f0dff2a4251a' 17 | } 18 | } as const; 19 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsOnly/items/index.ts: -------------------------------------------------------------------------------- 1 | export * from './_content_type_with_special_chars____.items.js'; 2 | export * from './content_type_with_all_elements.items.js'; 3 | export * from './web_spotlight_root.items.js'; 4 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateObjectsOnly/items/web_spotlight_root.items.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Object representing identifiers of available items 3 | * 4 | * Web spotlight root 5 | * 6 | * Codename: web_spotlight_root 7 | * Id: 7e8ca9f3-7f06-44d6-b9db-ae4905531365 8 | * Codename: web_spotlight_root 9 | */ 10 | export const web_spotlight_rootItems = { 11 | /** 12 | * WSL root 13 | */ 14 | wsl_root: { 15 | codename: 'wsl_root', 16 | id: 'c2d52eb8-30a3-4838-b20c-6ca5aab7e094' 17 | } 18 | } as const; 19 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateTypessOnly/_filesList.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "filename": "codenames/content_type_with_all_elements.codenames.ts" }, 3 | { "filename": "codenames/_content_type_with_special_chars____.codenames.ts" }, 4 | { "filename": "codenames/web_spotlight_root.codenames.ts" }, 5 | { "filename": "codenames/index.ts" }, 6 | { "filename": "index.ts" } 7 | ] 8 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateTypessOnly/codenames/_content_type_with_special_chars____.codenames.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Type representing available item codenames 3 | * 4 | * 🐧 Content type with special chars #!_' 5 | * 6 | * Codename: _content_type_with_special_chars____ 7 | * Id: 66bfcb40-edd7-4edf-8176-33517d0d6f80 8 | * Codename: _content_type_with_special_chars____ 9 | */ 10 | export type ContentTypeWithSpecialCharsCodenames = 'item_b' | 'item_c'; 11 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateTypessOnly/codenames/content_type_with_all_elements.codenames.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Type representing available item codenames 3 | * 4 | * Content type with all elements 5 | * 6 | * Codename: content_type_with_all_elements 7 | * Id: 071c7591-e7f0-41ac-984f-7a3db35f97e8 8 | * Codename: content_type_with_all_elements 9 | */ 10 | export type ContentTypeWithAllElementsCodenames = 'item_a'; 11 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateTypessOnly/codenames/index.ts: -------------------------------------------------------------------------------- 1 | export * from './_content_type_with_special_chars____.codenames.js'; 2 | export * from './content_type_with_all_elements.codenames.js'; 3 | export * from './web_spotlight_root.codenames.js'; 4 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateTypessOnly/codenames/web_spotlight_root.codenames.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Type representing available item codenames 3 | * 4 | * Web spotlight root 5 | * 6 | * Codename: web_spotlight_root 7 | * Id: 7e8ca9f3-7f06-44d6-b9db-ae4905531365 8 | * Codename: web_spotlight_root 9 | */ 10 | export type WebSpotlightRootCodenames = 'wsl_root'; 11 | -------------------------------------------------------------------------------- /tests/integration/snapshots/items/generateTypessOnly/index.ts: -------------------------------------------------------------------------------- 1 | export * from './codenames/index.js'; 2 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-js/_filesList.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "filename": "content-types/content_type_with_snippet_only.ts" }, 3 | { "filename": "content-types/_content_type_with_special_chars____.ts" }, 4 | { "filename": "content-types/circular_reference_type_a_b.ts" }, 5 | { "filename": "content-types/page.ts" }, 6 | { "filename": "content-types/content_type_with_all_elements.ts" }, 7 | { "filename": "content-types/content_type_with_guidelines_only.ts" }, 8 | { "filename": "content-types/circular_reference_type_b____a.ts" }, 9 | { "filename": "content-types/empty_content_type.ts" }, 10 | { "filename": "content-types/type_with_empty_snippet.ts" }, 11 | { "filename": "content-types/web_spotlight_root.ts" }, 12 | { "filename": "content-types/type_referencing_deleted_type.ts" }, 13 | { "filename": "content-types/index.ts" }, 14 | { "filename": "migration.ts" }, 15 | { "filename": "environment/environment.ts" }, 16 | { "filename": "environment/index.ts" }, 17 | { "filename": "index.ts" } 18 | ] 19 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-js/content-types/_content_type_with_special_chars____.ts: -------------------------------------------------------------------------------- 1 | import type { MigrationElementModels } from '@kontent-ai/migration-toolkit'; 2 | import type { CoreMigrationItem } from '../migration.js'; 3 | 4 | /** 5 | * 🐧 Content type with special chars #!_' 6 | * 7 | * Codename: _content_type_with_special_chars____ 8 | * Id: 66bfcb40-edd7-4edf-8176-33517d0d6f80 9 | */ 10 | export type ContentTypeWithSpecialCharsItem = CoreMigrationItem< 11 | '_content_type_with_special_chars____', 12 | { 13 | /** 14 | * 🦜Parrot_emoji 15 | * 16 | * Type: text 17 | * Required: false 18 | * Codename: parrot__ 19 | * Id: cafaa776-893d-4e8c-b460-9534ac2fe769 20 | */ 21 | readonly parrot__: MigrationElementModels.TextElement; 22 | 23 | /** 24 | * !!!_$NumberElem<>-%@&{}()/§'`?´=^*#~ 25 | * 26 | * Type: number 27 | * Required: false 28 | * Codename: _____numberelem_____________________ 29 | * Id: 3bb33958-71f3-4039-8594-5f0df9378dbb 30 | */ 31 | readonly _____numberelem_____________________: MigrationElementModels.NumberElement; 32 | } 33 | >; 34 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-js/content-types/circular_reference_type_a_b.ts: -------------------------------------------------------------------------------- 1 | import type { MigrationElementModels } from '@kontent-ai/migration-toolkit'; 2 | import type { CoreMigrationItem } from '../migration.js'; 3 | 4 | /** 5 | * Circular reference type A > B 6 | * 7 | * Codename: circular_reference_type_a_b 8 | * Id: a58680f7-0667-4a0e-8dc2-889233bdbf71 9 | */ 10 | export type CircularReferenceTypeABItem = CoreMigrationItem< 11 | 'circular_reference_type_a_b', 12 | { 13 | /** 14 | * Items 15 | * 16 | * Type: modular_content 17 | * Required: false 18 | * Codename: items 19 | * Id: 33ab92dd-e47d-45e2-a060-3b5df0754c24 20 | */ 21 | readonly items: MigrationElementModels.LinkedItemsElement; 22 | } 23 | >; 24 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-js/content-types/circular_reference_type_b____a.ts: -------------------------------------------------------------------------------- 1 | import type { MigrationElementModels } from '@kontent-ai/migration-toolkit'; 2 | import type { CoreMigrationItem } from '../migration.js'; 3 | 4 | /** 5 | * Circular reference type B -> A 6 | * 7 | * Codename: circular_reference_type_b____a 8 | * Id: 919bdcad-fe8e-4f56-9a63-346154b6f6e2 9 | */ 10 | export type CircularReferenceTypeBAItem = CoreMigrationItem< 11 | 'circular_reference_type_b____a', 12 | { 13 | /** 14 | * Items 15 | * 16 | * Type: modular_content 17 | * Required: false 18 | * Codename: items 19 | * Id: 019714f7-8c50-492b-8e5c-f7c3d7e2529b 20 | */ 21 | readonly items: MigrationElementModels.LinkedItemsElement; 22 | } 23 | >; 24 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-js/content-types/content_type_with_guidelines_only.ts: -------------------------------------------------------------------------------- 1 | import type { CoreMigrationItem } from '../migration.js'; 2 | 3 | /** 4 | * Content type with guidelines only 5 | * 6 | * Codename: content_type_with_guidelines_only 7 | * Id: 7e38a995-b4d7-46c9-92a4-4359241fa5ef 8 | */ 9 | export type ContentTypeWithGuidelinesOnlyItem = CoreMigrationItem<'content_type_with_guidelines_only', Record>; 10 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-js/content-types/content_type_with_snippet_only.ts: -------------------------------------------------------------------------------- 1 | import type { MigrationElementModels } from '@kontent-ai/migration-toolkit'; 2 | import type { CoreMigrationItem } from '../migration.js'; 3 | 4 | /** 5 | * Content type with snippet only 6 | * 7 | * Codename: content_type_with_snippet_only 8 | * Id: 7fd86bef-8f30-4a02-a1c3-fb130f65e9b4 9 | */ 10 | export type ContentTypeWithSnippetOnlyItem = CoreMigrationItem< 11 | 'content_type_with_snippet_only', 12 | { 13 | /** 14 | * Rich text with all allowed item types 15 | * 16 | * Type: rich_text 17 | * Required: false 18 | * Codename: snippet_a__rich_text_with_all_allowed_item_types 19 | * Id: 72cdc4e7-dead-4baf-99bf-91d8fe62351f 20 | */ 21 | readonly snippet_a__rich_text_with_all_allowed_item_types: MigrationElementModels.RichTextElement; 22 | 23 | /** 24 | * Linked items with specific types 25 | * 26 | * Type: modular_content 27 | * Required: false 28 | * Codename: snippet_a__linked_items_with_specific_types 29 | * Id: 140130dc-84c1-455f-99ab-d31579cf90d1 30 | */ 31 | readonly snippet_a__linked_items_with_specific_types: MigrationElementModels.LinkedItemsElement; 32 | 33 | /** 34 | * Text 35 | * 36 | * Type: text 37 | * Required: true 38 | * Codename: snippet_a__text 39 | * Id: 873e4a7a-e2ea-49a0-b88e-2ff7b6892f60 40 | */ 41 | readonly snippet_a__text: MigrationElementModels.TextElement; 42 | } 43 | >; 44 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-js/content-types/empty_content_type.ts: -------------------------------------------------------------------------------- 1 | import type { CoreMigrationItem } from '../migration.js'; 2 | 3 | /** 4 | * Empty content type 5 | * 6 | * Codename: empty_content_type 7 | * Id: 4e41e105-6ec5-4a08-9680-b85e9cd8b14e 8 | */ 9 | export type EmptyContentTypeItem = CoreMigrationItem<'empty_content_type', Record>; 10 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-js/content-types/index.ts: -------------------------------------------------------------------------------- 1 | export * from './_content_type_with_special_chars____.js'; 2 | export * from './circular_reference_type_a_b.js'; 3 | export * from './circular_reference_type_b____a.js'; 4 | export * from './content_type_with_all_elements.js'; 5 | export * from './content_type_with_guidelines_only.js'; 6 | export * from './content_type_with_snippet_only.js'; 7 | export * from './empty_content_type.js'; 8 | export * from './page.js'; 9 | export * from './type_referencing_deleted_type.js'; 10 | export * from './type_with_empty_snippet.js'; 11 | export * from './web_spotlight_root.js'; 12 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-js/content-types/page.ts: -------------------------------------------------------------------------------- 1 | import type { MigrationElementModels } from '@kontent-ai/migration-toolkit'; 2 | import type { CoreMigrationItem } from '../migration.js'; 3 | 4 | /** 5 | * Page 6 | * 7 | * Codename: page 8 | * Id: 4db6e2c7-c25b-4896-a05d-d20206234c04 9 | */ 10 | export type PageItem = CoreMigrationItem< 11 | 'page', 12 | { 13 | /** 14 | * Title 15 | * 16 | * Type: text 17 | * Required: false 18 | * Codename: title 19 | * Id: e9ad8c8f-6fb0-41d2-8caa-4e4e0ba24719 20 | */ 21 | readonly title: MigrationElementModels.TextElement; 22 | 23 | /** 24 | * URL 25 | * 26 | * Type: url_slug 27 | * Required: false 28 | * Codename: url 29 | * Id: e573bfc9-3193-4224-9d2a-9efb83da8849 30 | */ 31 | readonly url: MigrationElementModels.UrlSlugElement; 32 | 33 | /** 34 | * Show in navigation 35 | * 36 | * Type: multiple_choice 37 | * Required: false 38 | * Codename: show_in_navigation 39 | * Id: 07889917-fdc5-4285-bc30-4fed2a218c89 40 | */ 41 | readonly show_in_navigation: MigrationElementModels.MultipleChoiceElement; 42 | 43 | /** 44 | * Subpages 45 | * 46 | * Type: subpages 47 | * Required: false 48 | * Codename: subpages 49 | * Id: b909dc5d-0efe-478a-9257-83e5c90e884d 50 | */ 51 | readonly subpages: MigrationElementModels.SubpagesElement; 52 | 53 | /** 54 | * Content 55 | * 56 | * Type: modular_content 57 | * Required: false 58 | * Codename: content 59 | * Id: dfb0d07c-531e-4eaa-8f7d-e62671d4ca36 60 | */ 61 | readonly content: MigrationElementModels.LinkedItemsElement; 62 | } 63 | >; 64 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-js/content-types/type_referencing_deleted_type.ts: -------------------------------------------------------------------------------- 1 | import type { MigrationElementModels } from '@kontent-ai/migration-toolkit'; 2 | import type { CoreMigrationItem } from '../migration.js'; 3 | 4 | /** 5 | * Type referencing deleted type 6 | * 7 | * Codename: type_referencing_deleted_type 8 | * Id: f7562083-7230-4c20-9136-620ee7a92534 9 | */ 10 | export type TypeReferencingDeletedTypeItem = CoreMigrationItem< 11 | 'type_referencing_deleted_type', 12 | { 13 | /** 14 | * Rich text with invalid type 15 | * 16 | * Type: rich_text 17 | * Required: false 18 | * Codename: rich_text_with_invalid_type 19 | * Id: 03df7457-fb30-4d4e-aee2-06b0e1f218a2 20 | */ 21 | readonly rich_text_with_invalid_type: MigrationElementModels.RichTextElement; 22 | 23 | /** 24 | * Linked items with invalid type 25 | * 26 | * Type: modular_content 27 | * Required: false 28 | * Codename: linked_items_with_invalid_type 29 | * Id: cc310017-de8b-42f1-962b-63959367d29a 30 | */ 31 | readonly linked_items_with_invalid_type: MigrationElementModels.LinkedItemsElement; 32 | } 33 | >; 34 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-js/content-types/type_with_empty_snippet.ts: -------------------------------------------------------------------------------- 1 | import type { CoreMigrationItem } from '../migration.js'; 2 | 3 | /** 4 | * Type with empty snippet 5 | * 6 | * Codename: type_with_empty_snippet 7 | * Id: 11039462-1d7d-4673-9aa8-af07fb53985c 8 | */ 9 | export type TypeWithEmptySnippetItem = CoreMigrationItem<'type_with_empty_snippet', Record>; 10 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-js/content-types/web_spotlight_root.ts: -------------------------------------------------------------------------------- 1 | import type { MigrationElementModels } from '@kontent-ai/migration-toolkit'; 2 | import type { CoreMigrationItem } from '../migration.js'; 3 | 4 | /** 5 | * Web spotlight root 6 | * 7 | * Codename: web_spotlight_root 8 | * Id: 7e8ca9f3-7f06-44d6-b9db-ae4905531365 9 | */ 10 | export type WebSpotlightRootItem = CoreMigrationItem< 11 | 'web_spotlight_root', 12 | { 13 | /** 14 | * Title 15 | * 16 | * Type: text 17 | * Required: false 18 | * Codename: title 19 | * Id: e9d19fa4-4ad3-4b3f-998a-ca392651f7d0 20 | */ 21 | readonly title: MigrationElementModels.TextElement; 22 | 23 | /** 24 | * Subpages 25 | * 26 | * Type: subpages 27 | * Required: false 28 | * Codename: subpages 29 | * Id: e6702a6b-35b8-4a12-acca-1b1361fc926b 30 | */ 31 | readonly subpages: MigrationElementModels.SubpagesElement; 32 | 33 | /** 34 | * Content 35 | * 36 | * Type: modular_content 37 | * Required: false 38 | * Codename: content 39 | * Id: ad185ebb-c7ec-4b89-bf89-4b415b5e0ca8 40 | */ 41 | readonly content: MigrationElementModels.LinkedItemsElement; 42 | } 43 | >; 44 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-js/environment/environment.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Type representing all languages 3 | */ 4 | export type LanguageCodenames = '__jp' | '🦉Lang' | 'default' | 'en-US' | 'es-ES'; 5 | 6 | /** 7 | * Type representing all content types 8 | */ 9 | export type ContentTypeCodenames = 10 | | '_content_type_with_special_chars____' 11 | | 'circular_reference_type_a_b' 12 | | 'circular_reference_type_b____a' 13 | | 'content_type_with_all_elements' 14 | | 'content_type_with_guidelines_only' 15 | | 'content_type_with_snippet_only' 16 | | 'empty_content_type' 17 | | 'page' 18 | | 'type_referencing_deleted_type' 19 | | 'type_with_empty_snippet' 20 | | 'web_spotlight_root'; 21 | 22 | /** 23 | * Type representing all collections 24 | */ 25 | export type CollectionCodenames = 'default' | 'legacy_collection'; 26 | 27 | /** 28 | * Type representing all workflows 29 | */ 30 | export type WorkflowCodenames = 'advanced_workflow' | 'default'; 31 | 32 | /** 33 | * Type representing all worksflow steps across all workflows 34 | */ 35 | export type WorkflowStepCodenames = 'archived' | 'draft_b42a7f1' | 'draft' | 'published' | 'scheduled' | 'step_1' | 'step_2'; 36 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-js/environment/index.ts: -------------------------------------------------------------------------------- 1 | export * from './environment.js'; 2 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-js/index.ts: -------------------------------------------------------------------------------- 1 | export * from './content-types/index.js'; 2 | export * from './environment/index.js'; 3 | export * from './migration.js'; 4 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-js/migration.ts: -------------------------------------------------------------------------------- 1 | import type { MigrationItem, MigrationItemSystem, MigrationElements } from '@kontent-ai/migration-toolkit'; 2 | import type { 3 | CollectionCodenames, 4 | ContentTypeCodenames, 5 | LanguageCodenames, 6 | WorkflowCodenames, 7 | WorkflowStepCodenames 8 | } from './environment/environment.js'; 9 | 10 | /** 11 | * System object shared by all individual content type models 12 | */ 13 | export type CoreMigrationItemSystem = MigrationItemSystem< 14 | TCodename, 15 | LanguageCodenames, 16 | CollectionCodenames, 17 | WorkflowCodenames 18 | >; 19 | 20 | /** 21 | * Item object shared by all individual content type models 22 | */ 23 | export type CoreMigrationItem< 24 | TCodename extends ContentTypeCodenames, 25 | TElements extends MigrationElements = MigrationElements 26 | > = MigrationItem, WorkflowStepCodenames>; 27 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-ts/_filesList.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "filename": "content-types/content_type_with_snippet_only.ts" }, 3 | { "filename": "content-types/_content_type_with_special_chars____.ts" }, 4 | { "filename": "content-types/circular_reference_type_a_b.ts" }, 5 | { "filename": "content-types/page.ts" }, 6 | { "filename": "content-types/content_type_with_all_elements.ts" }, 7 | { "filename": "content-types/content_type_with_guidelines_only.ts" }, 8 | { "filename": "content-types/circular_reference_type_b____a.ts" }, 9 | { "filename": "content-types/empty_content_type.ts" }, 10 | { "filename": "content-types/type_with_empty_snippet.ts" }, 11 | { "filename": "content-types/web_spotlight_root.ts" }, 12 | { "filename": "content-types/type_referencing_deleted_type.ts" }, 13 | { "filename": "content-types/index.ts" }, 14 | { "filename": "migration.ts" }, 15 | { "filename": "environment/environment.ts" }, 16 | { "filename": "environment/index.ts" }, 17 | { "filename": "index.ts" } 18 | ] 19 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-ts/content-types/_content_type_with_special_chars____.ts: -------------------------------------------------------------------------------- 1 | import type { MigrationElementModels } from '@kontent-ai/migration-toolkit'; 2 | import type { CoreMigrationItem } from '../migration.ts'; 3 | 4 | /** 5 | * 🐧 Content type with special chars #!_' 6 | * 7 | * Codename: _content_type_with_special_chars____ 8 | * Id: 66bfcb40-edd7-4edf-8176-33517d0d6f80 9 | */ 10 | export type ContentTypeWithSpecialCharsItem = CoreMigrationItem< 11 | '_content_type_with_special_chars____', 12 | { 13 | /** 14 | * 🦜Parrot_emoji 15 | * 16 | * Type: text 17 | * Required: false 18 | * Codename: parrot__ 19 | * Id: cafaa776-893d-4e8c-b460-9534ac2fe769 20 | */ 21 | readonly parrot__: MigrationElementModels.TextElement; 22 | 23 | /** 24 | * !!!_$NumberElem<>-%@&{}()/§'`?´=^*#~ 25 | * 26 | * Type: number 27 | * Required: false 28 | * Codename: _____numberelem_____________________ 29 | * Id: 3bb33958-71f3-4039-8594-5f0df9378dbb 30 | */ 31 | readonly _____numberelem_____________________: MigrationElementModels.NumberElement; 32 | } 33 | >; 34 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-ts/content-types/circular_reference_type_a_b.ts: -------------------------------------------------------------------------------- 1 | import type { MigrationElementModels } from '@kontent-ai/migration-toolkit'; 2 | import type { CoreMigrationItem } from '../migration.ts'; 3 | 4 | /** 5 | * Circular reference type A > B 6 | * 7 | * Codename: circular_reference_type_a_b 8 | * Id: a58680f7-0667-4a0e-8dc2-889233bdbf71 9 | */ 10 | export type CircularReferenceTypeABItem = CoreMigrationItem< 11 | 'circular_reference_type_a_b', 12 | { 13 | /** 14 | * Items 15 | * 16 | * Type: modular_content 17 | * Required: false 18 | * Codename: items 19 | * Id: 33ab92dd-e47d-45e2-a060-3b5df0754c24 20 | */ 21 | readonly items: MigrationElementModels.LinkedItemsElement; 22 | } 23 | >; 24 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-ts/content-types/circular_reference_type_b____a.ts: -------------------------------------------------------------------------------- 1 | import type { MigrationElementModels } from '@kontent-ai/migration-toolkit'; 2 | import type { CoreMigrationItem } from '../migration.ts'; 3 | 4 | /** 5 | * Circular reference type B -> A 6 | * 7 | * Codename: circular_reference_type_b____a 8 | * Id: 919bdcad-fe8e-4f56-9a63-346154b6f6e2 9 | */ 10 | export type CircularReferenceTypeBAItem = CoreMigrationItem< 11 | 'circular_reference_type_b____a', 12 | { 13 | /** 14 | * Items 15 | * 16 | * Type: modular_content 17 | * Required: false 18 | * Codename: items 19 | * Id: 019714f7-8c50-492b-8e5c-f7c3d7e2529b 20 | */ 21 | readonly items: MigrationElementModels.LinkedItemsElement; 22 | } 23 | >; 24 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-ts/content-types/content_type_with_guidelines_only.ts: -------------------------------------------------------------------------------- 1 | import type { CoreMigrationItem } from '../migration.ts'; 2 | 3 | /** 4 | * Content type with guidelines only 5 | * 6 | * Codename: content_type_with_guidelines_only 7 | * Id: 7e38a995-b4d7-46c9-92a4-4359241fa5ef 8 | */ 9 | export type ContentTypeWithGuidelinesOnlyItem = CoreMigrationItem<'content_type_with_guidelines_only', Record>; 10 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-ts/content-types/content_type_with_snippet_only.ts: -------------------------------------------------------------------------------- 1 | import type { MigrationElementModels } from '@kontent-ai/migration-toolkit'; 2 | import type { CoreMigrationItem } from '../migration.ts'; 3 | 4 | /** 5 | * Content type with snippet only 6 | * 7 | * Codename: content_type_with_snippet_only 8 | * Id: 7fd86bef-8f30-4a02-a1c3-fb130f65e9b4 9 | */ 10 | export type ContentTypeWithSnippetOnlyItem = CoreMigrationItem< 11 | 'content_type_with_snippet_only', 12 | { 13 | /** 14 | * Rich text with all allowed item types 15 | * 16 | * Type: rich_text 17 | * Required: false 18 | * Codename: snippet_a__rich_text_with_all_allowed_item_types 19 | * Id: 72cdc4e7-dead-4baf-99bf-91d8fe62351f 20 | */ 21 | readonly snippet_a__rich_text_with_all_allowed_item_types: MigrationElementModels.RichTextElement; 22 | 23 | /** 24 | * Linked items with specific types 25 | * 26 | * Type: modular_content 27 | * Required: false 28 | * Codename: snippet_a__linked_items_with_specific_types 29 | * Id: 140130dc-84c1-455f-99ab-d31579cf90d1 30 | */ 31 | readonly snippet_a__linked_items_with_specific_types: MigrationElementModels.LinkedItemsElement; 32 | 33 | /** 34 | * Text 35 | * 36 | * Type: text 37 | * Required: true 38 | * Codename: snippet_a__text 39 | * Id: 873e4a7a-e2ea-49a0-b88e-2ff7b6892f60 40 | */ 41 | readonly snippet_a__text: MigrationElementModels.TextElement; 42 | } 43 | >; 44 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-ts/content-types/empty_content_type.ts: -------------------------------------------------------------------------------- 1 | import type { CoreMigrationItem } from '../migration.ts'; 2 | 3 | /** 4 | * Empty content type 5 | * 6 | * Codename: empty_content_type 7 | * Id: 4e41e105-6ec5-4a08-9680-b85e9cd8b14e 8 | */ 9 | export type EmptyContentTypeItem = CoreMigrationItem<'empty_content_type', Record>; 10 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-ts/content-types/index.ts: -------------------------------------------------------------------------------- 1 | export * from './_content_type_with_special_chars____.ts'; 2 | export * from './circular_reference_type_a_b.ts'; 3 | export * from './circular_reference_type_b____a.ts'; 4 | export * from './content_type_with_all_elements.ts'; 5 | export * from './content_type_with_guidelines_only.ts'; 6 | export * from './content_type_with_snippet_only.ts'; 7 | export * from './empty_content_type.ts'; 8 | export * from './page.ts'; 9 | export * from './type_referencing_deleted_type.ts'; 10 | export * from './type_with_empty_snippet.ts'; 11 | export * from './web_spotlight_root.ts'; 12 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-ts/content-types/page.ts: -------------------------------------------------------------------------------- 1 | import type { MigrationElementModels } from '@kontent-ai/migration-toolkit'; 2 | import type { CoreMigrationItem } from '../migration.ts'; 3 | 4 | /** 5 | * Page 6 | * 7 | * Codename: page 8 | * Id: 4db6e2c7-c25b-4896-a05d-d20206234c04 9 | */ 10 | export type PageItem = CoreMigrationItem< 11 | 'page', 12 | { 13 | /** 14 | * Title 15 | * 16 | * Type: text 17 | * Required: false 18 | * Codename: title 19 | * Id: e9ad8c8f-6fb0-41d2-8caa-4e4e0ba24719 20 | */ 21 | readonly title: MigrationElementModels.TextElement; 22 | 23 | /** 24 | * URL 25 | * 26 | * Type: url_slug 27 | * Required: false 28 | * Codename: url 29 | * Id: e573bfc9-3193-4224-9d2a-9efb83da8849 30 | */ 31 | readonly url: MigrationElementModels.UrlSlugElement; 32 | 33 | /** 34 | * Show in navigation 35 | * 36 | * Type: multiple_choice 37 | * Required: false 38 | * Codename: show_in_navigation 39 | * Id: 07889917-fdc5-4285-bc30-4fed2a218c89 40 | */ 41 | readonly show_in_navigation: MigrationElementModels.MultipleChoiceElement; 42 | 43 | /** 44 | * Subpages 45 | * 46 | * Type: subpages 47 | * Required: false 48 | * Codename: subpages 49 | * Id: b909dc5d-0efe-478a-9257-83e5c90e884d 50 | */ 51 | readonly subpages: MigrationElementModels.SubpagesElement; 52 | 53 | /** 54 | * Content 55 | * 56 | * Type: modular_content 57 | * Required: false 58 | * Codename: content 59 | * Id: dfb0d07c-531e-4eaa-8f7d-e62671d4ca36 60 | */ 61 | readonly content: MigrationElementModels.LinkedItemsElement; 62 | } 63 | >; 64 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-ts/content-types/type_referencing_deleted_type.ts: -------------------------------------------------------------------------------- 1 | import type { MigrationElementModels } from '@kontent-ai/migration-toolkit'; 2 | import type { CoreMigrationItem } from '../migration.ts'; 3 | 4 | /** 5 | * Type referencing deleted type 6 | * 7 | * Codename: type_referencing_deleted_type 8 | * Id: f7562083-7230-4c20-9136-620ee7a92534 9 | */ 10 | export type TypeReferencingDeletedTypeItem = CoreMigrationItem< 11 | 'type_referencing_deleted_type', 12 | { 13 | /** 14 | * Rich text with invalid type 15 | * 16 | * Type: rich_text 17 | * Required: false 18 | * Codename: rich_text_with_invalid_type 19 | * Id: 03df7457-fb30-4d4e-aee2-06b0e1f218a2 20 | */ 21 | readonly rich_text_with_invalid_type: MigrationElementModels.RichTextElement; 22 | 23 | /** 24 | * Linked items with invalid type 25 | * 26 | * Type: modular_content 27 | * Required: false 28 | * Codename: linked_items_with_invalid_type 29 | * Id: cc310017-de8b-42f1-962b-63959367d29a 30 | */ 31 | readonly linked_items_with_invalid_type: MigrationElementModels.LinkedItemsElement; 32 | } 33 | >; 34 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-ts/content-types/type_with_empty_snippet.ts: -------------------------------------------------------------------------------- 1 | import type { CoreMigrationItem } from '../migration.ts'; 2 | 3 | /** 4 | * Type with empty snippet 5 | * 6 | * Codename: type_with_empty_snippet 7 | * Id: 11039462-1d7d-4673-9aa8-af07fb53985c 8 | */ 9 | export type TypeWithEmptySnippetItem = CoreMigrationItem<'type_with_empty_snippet', Record>; 10 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-ts/content-types/web_spotlight_root.ts: -------------------------------------------------------------------------------- 1 | import type { MigrationElementModels } from '@kontent-ai/migration-toolkit'; 2 | import type { CoreMigrationItem } from '../migration.ts'; 3 | 4 | /** 5 | * Web spotlight root 6 | * 7 | * Codename: web_spotlight_root 8 | * Id: 7e8ca9f3-7f06-44d6-b9db-ae4905531365 9 | */ 10 | export type WebSpotlightRootItem = CoreMigrationItem< 11 | 'web_spotlight_root', 12 | { 13 | /** 14 | * Title 15 | * 16 | * Type: text 17 | * Required: false 18 | * Codename: title 19 | * Id: e9d19fa4-4ad3-4b3f-998a-ca392651f7d0 20 | */ 21 | readonly title: MigrationElementModels.TextElement; 22 | 23 | /** 24 | * Subpages 25 | * 26 | * Type: subpages 27 | * Required: false 28 | * Codename: subpages 29 | * Id: e6702a6b-35b8-4a12-acca-1b1361fc926b 30 | */ 31 | readonly subpages: MigrationElementModels.SubpagesElement; 32 | 33 | /** 34 | * Content 35 | * 36 | * Type: modular_content 37 | * Required: false 38 | * Codename: content 39 | * Id: ad185ebb-c7ec-4b89-bf89-4b415b5e0ca8 40 | */ 41 | readonly content: MigrationElementModels.LinkedItemsElement; 42 | } 43 | >; 44 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-ts/environment/environment.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Type representing all languages 3 | */ 4 | export type LanguageCodenames = '__jp' | '🦉Lang' | 'default' | 'en-US' | 'es-ES'; 5 | 6 | /** 7 | * Type representing all content types 8 | */ 9 | export type ContentTypeCodenames = 10 | | '_content_type_with_special_chars____' 11 | | 'circular_reference_type_a_b' 12 | | 'circular_reference_type_b____a' 13 | | 'content_type_with_all_elements' 14 | | 'content_type_with_guidelines_only' 15 | | 'content_type_with_snippet_only' 16 | | 'empty_content_type' 17 | | 'page' 18 | | 'type_referencing_deleted_type' 19 | | 'type_with_empty_snippet' 20 | | 'web_spotlight_root'; 21 | 22 | /** 23 | * Type representing all collections 24 | */ 25 | export type CollectionCodenames = 'default' | 'legacy_collection'; 26 | 27 | /** 28 | * Type representing all workflows 29 | */ 30 | export type WorkflowCodenames = 'advanced_workflow' | 'default'; 31 | 32 | /** 33 | * Type representing all worksflow steps across all workflows 34 | */ 35 | export type WorkflowStepCodenames = 'archived' | 'draft_b42a7f1' | 'draft' | 'published' | 'scheduled' | 'step_1' | 'step_2'; 36 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-ts/environment/index.ts: -------------------------------------------------------------------------------- 1 | export * from './environment.ts'; 2 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-ts/index.ts: -------------------------------------------------------------------------------- 1 | export * from './content-types/index.ts'; 2 | export * from './environment/index.ts'; 3 | export * from './migration.ts'; 4 | -------------------------------------------------------------------------------- /tests/integration/snapshots/migration-toolkit/basic-ts/migration.ts: -------------------------------------------------------------------------------- 1 | import type { MigrationItem, MigrationItemSystem, MigrationElements } from '@kontent-ai/migration-toolkit'; 2 | import type { 3 | CollectionCodenames, 4 | ContentTypeCodenames, 5 | LanguageCodenames, 6 | WorkflowCodenames, 7 | WorkflowStepCodenames 8 | } from './environment/environment.ts'; 9 | 10 | /** 11 | * System object shared by all individual content type models 12 | */ 13 | export type CoreMigrationItemSystem = MigrationItemSystem< 14 | TCodename, 15 | LanguageCodenames, 16 | CollectionCodenames, 17 | WorkflowCodenames 18 | >; 19 | 20 | /** 21 | * Item object shared by all individual content type models 22 | */ 23 | export type CoreMigrationItem< 24 | TCodename extends ContentTypeCodenames, 25 | TElements extends MigrationElements = MigrationElements 26 | > = MigrationItem, WorkflowStepCodenames>; 27 | -------------------------------------------------------------------------------- /tests/integration/test-cases/migration-toolkit-snapshots.ts: -------------------------------------------------------------------------------- 1 | import { generateMigrationModelsAsync } from '../../../lib/public_api.js'; 2 | import { integrationEnv, type SnapshotModelsTest } from '../integration-tests.config.js'; 3 | 4 | export const migrationToolkitSnapshots: readonly SnapshotModelsTest[] = [ 5 | { 6 | cliAction: 'migration-toolkit', 7 | folder: 'basic-js', 8 | getFilesAsync: async () => 9 | await generateMigrationModelsAsync({ 10 | addTimestamp: false, 11 | createFiles: false, 12 | environmentId: integrationEnv.id, 13 | managementApiKey: integrationEnv.apiKey, 14 | moduleFileExtension: 'js' 15 | }) 16 | }, 17 | { 18 | cliAction: 'migration-toolkit', 19 | folder: 'basic-ts', 20 | getFilesAsync: async () => 21 | await generateMigrationModelsAsync({ 22 | addTimestamp: false, 23 | createFiles: false, 24 | environmentId: integrationEnv.id, 25 | managementApiKey: integrationEnv.apiKey, 26 | moduleFileExtension: 'ts' 27 | }) 28 | } 29 | ]; 30 | -------------------------------------------------------------------------------- /tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "noEmit": false, 5 | "outDir": "dist" 6 | }, 7 | "include": ["lib/**/*"] 8 | } 9 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "compilerOptions": { 4 | "noEmit": true, 5 | "target": "es2022", 6 | "moduleResolution": "nodenext", 7 | "module": "NodeNext", 8 | "importHelpers": true, 9 | "sourceMap": true, 10 | "declaration": true, 11 | "emitDecoratorMetadata": true, 12 | "experimentalDecorators": true, 13 | "allowSyntheticDefaultImports": true, 14 | "strict": true, 15 | "strictNullChecks": true, 16 | "strictPropertyInitialization": true, 17 | "resolveJsonModule": true, 18 | "noImplicitReturns": true, 19 | "allowUnreachableCode": false, 20 | "skipLibCheck": true, 21 | "alwaysStrict": true, 22 | "forceConsistentCasingInFileNames": true, 23 | "noUnusedParameters": false, 24 | "noUnusedLocals": true, 25 | "strictFunctionTypes": true, 26 | "noImplicitAny": true, 27 | "typeRoots": ["./node_modules/@types"], 28 | "lib": ["esnext"] 29 | }, 30 | "include": ["lib/**/*", "tests/**/*", "eslint.config.mjs", "vitest.config.ts", "sample/**/*", "scripts/**/*"], 31 | "exclude": ["node_modules"] 32 | } 33 | -------------------------------------------------------------------------------- /vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { loadEnv } from 'vite'; 2 | import { defineConfig } from 'vitest/config'; 3 | 4 | export default defineConfig({ 5 | root: '.', 6 | test: { 7 | dir: 'tests', 8 | globals: true, 9 | environment: 'node', 10 | setupFiles: ['dotenv/config'], 11 | env: loadEnv('', process.cwd(), '') // loads .env variables 12 | }, 13 | build: { 14 | target: 'esnext' 15 | } 16 | }); 17 | --------------------------------------------------------------------------------