From 714cee07793e6652ca2723ff253b110fcc745c6e Mon Sep 17 00:00:00 2001 From: Ivan Kiral Date: Thu, 11 Jul 2024 14:07:02 +0200 Subject: [PATCH] update migration scripts --- Migrations/07_sample_migration_publish.js | 35 ------ exampleParams.json | 5 + src/01_collections.ts | 52 ++++++++ src/01_sample_init_createBlogType.ts | 44 ------- src/02_sample_init_createBlogItem.ts | 54 -------- src/02_webSpotlight.ts | 15 +++ src/03_sample_migration_createAuthorType.ts | 38 ------ src/03_taxonomies.ts | 42 +++++++ src/04_assets.ts | 86 +++++++++++++ ...ple_migration_addNewElementIntoBlogType.ts | 39 ------ src/05_sample_migration_migrateAuthors.ts | 105 ---------------- src/05_snippets.ts | 39 ++++++ ..._migration_removeOldElementFromBlogType.ts | 28 ----- src/06_types.ts | 101 +++++++++++++++ src/07_variants.ts | 118 ++++++++++++++++++ src/assets/kontent-ai.png | Bin 0 -> 3207 bytes src/constants/externalIds.ts | 40 ++++++ tsconfig.json | 1 + 18 files changed, 499 insertions(+), 343 deletions(-) delete mode 100644 Migrations/07_sample_migration_publish.js create mode 100644 exampleParams.json create mode 100644 src/01_collections.ts delete mode 100644 src/01_sample_init_createBlogType.ts delete mode 100644 src/02_sample_init_createBlogItem.ts create mode 100644 src/02_webSpotlight.ts delete mode 100644 src/03_sample_migration_createAuthorType.ts create mode 100644 src/03_taxonomies.ts create mode 100644 src/04_assets.ts delete mode 100644 src/04_sample_migration_addNewElementIntoBlogType.ts delete mode 100644 src/05_sample_migration_migrateAuthors.ts create mode 100644 src/05_snippets.ts delete mode 100644 src/06_sample_migration_removeOldElementFromBlogType.ts create mode 100644 src/06_types.ts create mode 100644 src/07_variants.ts create mode 100644 src/assets/kontent-ai.png create mode 100644 src/constants/externalIds.ts diff --git a/Migrations/07_sample_migration_publish.js b/Migrations/07_sample_migration_publish.js deleted file mode 100644 index bc0dd1d..0000000 --- a/Migrations/07_sample_migration_publish.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* Publishes all Author and Blog items. -* -* Note: This migration shows that you can write the migrations directly in Javascript as well. -*/ -const migration = { - order: 7, - run: async (apiClient) => { - const authorLanguageVariantsResponse = await apiClient.listLanguageVariantsOfContentType() - .byTypeCodename('author') - .toPromise(); - - for (const variant of authorLanguageVariantsResponse.data.items) { - await apiClient.publishLanguageVariant() - .byItemId(variant.item.id) - .byLanguageId(variant.language.id) - .withoutData() - .toPromise(); - } - - const blogLanguageVariantsResponse = await apiClient.listLanguageVariantsOfContentType() - .byTypeCodename('blog') - .toPromise(); - - for (const variant of blogLanguageVariantsResponse.data.items) { - await apiClient.publishLanguageVariant() - .byItemId(variant.item.id) - .byLanguageId(variant.language.id) - .withoutData() - .toPromise(); - } - }, -}; - -module.exports = migration; diff --git a/exampleParams.json b/exampleParams.json new file mode 100644 index 0000000..18694f2 --- /dev/null +++ b/exampleParams.json @@ -0,0 +1,5 @@ +{ + "environmentId": "", + "apiKey": "", + "migrationsPath": "./Migrations" +} \ No newline at end of file diff --git a/src/01_collections.ts b/src/01_collections.ts new file mode 100644 index 0000000..5dba2c1 --- /dev/null +++ b/src/01_collections.ts @@ -0,0 +1,52 @@ +import { MigrationModule } from "@kontent-ai/data-ops"; +import { CollectionModels } from "@kontent-ai/management-sdk"; + +import { collectionHealthTechExtId } from "./constants/externalIds.js"; + +const migration: MigrationModule = { + order: 1, + run: async client => { + const setCollectionsData: CollectionModels.ISetCollectionData[] = [ + { + op: "addInto", + value: { + name: "healthtech", + codename: "healthtech", + externalId: collectionHealthTechExtId, + }, + }, + { + op: "replace", + reference: { codename: "default" }, + property_name: "name", + value: "common", + }, + ]; + + await client + .setCollections() + .withData(setCollectionsData) + .toPromise(); + }, + rollback: async client => { + const setCollectionsData: CollectionModels.ISetCollectionData[] = [ + { + op: "remove", + reference: { codename: "healthtech" }, + } as unknown as CollectionModels.ISetCollectionData, + { + op: "replace", + reference: { codename: "default" }, + property_name: "name", + value: "default", + }, + ]; + + await client + .setCollections() + .withData(setCollectionsData) + .toPromise(); + }, +}; + +export default migration; diff --git a/src/01_sample_init_createBlogType.ts b/src/01_sample_init_createBlogType.ts deleted file mode 100644 index 4e85b66..0000000 --- a/src/01_sample_init_createBlogType.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { MigrationModule } from "@kontent-ai/data-ops"; -import { ContentTypeElementsBuilder, ContentTypeModels } from "@kontent-ai/management-sdk"; - -/** - * Creates content type called Blog. - * This content type has three text elements: title, author and text. - */ -const migration: MigrationModule = { - order: 1, - run: async (apiClient) => { - await apiClient - .addContentType() - .withData(BuildBlogPostTypeData) - .toPromise(); - }, -}; - -const BuildBlogPostTypeData = ( - builder: ContentTypeElementsBuilder, -): ContentTypeModels.IAddContentTypeData => { - return { - name: "Blog", - codename: "blog", - elements: [ - builder.textElement({ - name: "Title", - codename: "title", - type: "text", - }), - builder.textElement({ - name: "Author", - codename: "author", - type: "text", - }), - builder.textElement({ - name: "Text", - codename: "text", - type: "text", - }), - ], - }; -}; - -export default migration; diff --git a/src/02_sample_init_createBlogItem.ts b/src/02_sample_init_createBlogItem.ts deleted file mode 100644 index edabb22..0000000 --- a/src/02_sample_init_createBlogItem.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { MigrationModule } from "@kontent-ai/data-ops"; - -/** - * Creates a sample content item of type Blog. - */ -const migration: MigrationModule = { - order: 2, - run: async (apiClient) => { - // Create content item - const itemResponse = await apiClient - .addContentItem() - .withData({ - name: "About coffee", - type: { - codename: "blog", - }, - }) - .toPromise(); - - // Create language variant in default language - await apiClient - .upsertLanguageVariant() - .byItemId(itemResponse.data.id) - .byLanguageCodename("default") - .withData((builder) => { - return { - elements: [ - builder.textElement({ - element: { - codename: "title", - }, - value: "About coffee", - }), - builder.textElement({ - element: { - codename: "author", - }, - value: "Coffee geek", - }), - builder.textElement({ - element: { - codename: "text", - }, - value: - "Coffee is a brewed drink prepared from roasted coffee beans, the seeds of berries from certain Coffee species.", - }), - ], - }; - }) - .toPromise(); - }, -}; - -export default migration; diff --git a/src/02_webSpotlight.ts b/src/02_webSpotlight.ts new file mode 100644 index 0000000..5e2d829 --- /dev/null +++ b/src/02_webSpotlight.ts @@ -0,0 +1,15 @@ +import { MigrationModule } from "@kontent-ai/data-ops"; + +const migration: MigrationModule = { + order: 2, + run: async client => { + client as never; + // TODO: + }, + rollback: async client => { + client as never; + // TODO: + }, +}; + +export default migration; diff --git a/src/03_sample_migration_createAuthorType.ts b/src/03_sample_migration_createAuthorType.ts deleted file mode 100644 index 9d8f007..0000000 --- a/src/03_sample_migration_createAuthorType.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { MigrationModule } from "@kontent-ai/data-ops"; -import { ContentTypeElementsBuilder, ContentTypeModels } from "@kontent-ai/management-sdk"; - -/** - * Creates new content type called Author. - * This content type has two elements: name and Twitter handle. - * - * Note: This starts the actual migration process. - */ -const migration: MigrationModule = { - order: 3, - run: async (apiClient) => { - await apiClient.addContentType().withData(BuildAuthorTypeData).toPromise(); - }, -}; - -const BuildAuthorTypeData = ( - builder: ContentTypeElementsBuilder, -): ContentTypeModels.IAddContentTypeData => { - return { - name: "Author", - codename: "author", - elements: [ - builder.textElement({ - name: "Name", - codename: "name", - type: "text", - }), - builder.textElement({ - name: "Twitter handle", - codename: "twitter_handle", - type: "text", - }), - ], - }; -}; - -export default migration; diff --git a/src/03_taxonomies.ts b/src/03_taxonomies.ts new file mode 100644 index 0000000..a353daa --- /dev/null +++ b/src/03_taxonomies.ts @@ -0,0 +1,42 @@ +import { MigrationModule } from "@kontent-ai/data-ops"; +import { TaxonomyModels } from "@kontent-ai/management-sdk"; + +import { taxonomyArticleTypeExtId } from "./constants/externalIds.js"; + +const migration: MigrationModule = { + order: 3, + run: async client => { + const taxonomyData: TaxonomyModels.IAddTaxonomyRequestModel = { + name: "Article Type", + codename: "article_type", + external_id: taxonomyArticleTypeExtId.taxonomyGroup, + terms: [ + { + name: "Blog Post", + codename: "blog_post", + external_id: taxonomyArticleTypeExtId.terms.blogPost, + terms: [], + }, + { + name: "news", + codename: "news", + external_id: taxonomyArticleTypeExtId.terms.news, + terms: [], + }, + ], + }; + + await client + .addTaxonomy() + .withData(taxonomyData) + .toPromise(); + }, + rollback: async client => { + await client + .deleteTaxonomy() + .byTaxonomyExternalId(taxonomyArticleTypeExtId.taxonomyGroup) + .toPromise(); + }, +}; + +export default migration; diff --git a/src/04_assets.ts b/src/04_assets.ts new file mode 100644 index 0000000..e7cdc0e --- /dev/null +++ b/src/04_assets.ts @@ -0,0 +1,86 @@ +import { MigrationModule } from "@kontent-ai/data-ops"; +import { AssetFolderModels, ManagementClient, SharedContracts } from "@kontent-ai/management-sdk"; +import * as fsPromises from "fs/promises"; +import path from "path"; + +import { assetFoldersImagesExtId, assetKontentExternalId } from "./constants/externalIds.js"; + +const migration: MigrationModule = { + order: 4, + run: async client => { + const assetFoldersData: AssetFolderModels.IAddAssetFoldersData = { + folders: [ + { name: "Images", external_id: assetFoldersImagesExtId, folders: [] }, + ], + }; + + await client + .addAssetFolders() + .withData(assetFoldersData) + .toPromise(); + + await addAsset(client, { + fileName: "kontent-ai.png", + externalId: assetKontentExternalId, + contentType: "image/png", + collection: { codename: "default" }, + }); + }, + rollback: async client => { + await client + .modifyAssetFolders() + .withData([{ + op: "remove", + reference: { external_id: assetFoldersImagesExtId }, + }] as unknown as AssetFolderModels.IModifyAssetFolderData[]) + .toPromise(); + + await client + .deleteAsset() + .byAssetExternalId(assetKontentExternalId) + .toPromise(); + }, +}; + +type AddAssetParams = Readonly<{ + fileName: string; + externalId: string; + contentType: string; + collection: SharedContracts.IReferenceObjectContract; + folderExternalId?: string; + descriptions?: Readonly>; +}>; + +const addAsset = async (client: ManagementClient, params: AddAssetParams) => { + const binaryData = await fsPromises.readFile(path.resolve(process.cwd(), `./src/assets/${params.fileName}`)); + + const fileRef = await client + .uploadBinaryFile() + .withData({ + filename: params.fileName, + binaryData, + contentType: params.contentType, + contentLength: binaryData.length, + }) + .toPromise() + .then(res => res.data); + + return client + .addAsset() + .withData(() => ({ + external_id: params.externalId, + folder: params.folderExternalId ? { external_id: params.folderExternalId } : undefined, + collection: { reference: params.collection }, + file_reference: fileRef, + descriptions: params.descriptions + ? Object.entries(params.descriptions).map(([codename, description]) => ({ + language: { codename }, + description, + })) + : undefined, + })) + .toPromise() + .then(res => res.data); +}; + +export default migration; diff --git a/src/04_sample_migration_addNewElementIntoBlogType.ts b/src/04_sample_migration_addNewElementIntoBlogType.ts deleted file mode 100644 index eb543a1..0000000 --- a/src/04_sample_migration_addNewElementIntoBlogType.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { MigrationModule } from "@kontent-ai/data-ops"; -import { ContentTypeModels } from "@kontent-ai/management-sdk"; - -/** - * Adds new linked items element to content type Blog. - * This element should link the blog with its author. - */ -const migration: MigrationModule = { - order: 4, - run: async (apiClient) => { - const modification: ContentTypeModels.IModifyContentTypeData[] = [ - { - op: "addInto", - path: "/elements", - value: { - name: "Linked author", - codename: "linked_author", - items_count_limit: 1, - type: "modular_content", - }, - }, - { - op: "addInto", - path: "/elements/codename:linked_author/allowed_content_types", - value: { - codename: "author", - }, - }, - ]; - - await apiClient - .modifyContentType() - .byTypeCodename("blog") - .withData(modification) - .toPromise(); - }, -}; - -export default migration; diff --git a/src/05_sample_migration_migrateAuthors.ts b/src/05_sample_migration_migrateAuthors.ts deleted file mode 100644 index 5f9a97c..0000000 --- a/src/05_sample_migration_migrateAuthors.ts +++ /dev/null @@ -1,105 +0,0 @@ -import { MigrationModule } from "@kontent-ai/data-ops"; - -interface IAuthorsMap { - author: string; - itemId: string; -} - -/** - * Fetches all Blog items and extracts its authors. - * Creates an Author item for every unique author. - * Adds the new/existing Author item to the Blog item. - * - * Note: Your website/application should switch to using the new element at this point. - */ -const migration: MigrationModule = { - order: 5, - run: async (apiClient) => { - const contentTypeResponse = await apiClient - .viewContentType() - .byTypeCodename("blog") - .toPromise(); - - const authorElementId = contentTypeResponse.data.elements.filter( - (r) => "codename" in r && r.codename === "author", - )[0].id; - - // Get all Blog language variants - const blogVariantsResponse = await apiClient - .listLanguageVariantsOfContentType() - .byTypeCodename("blog") - .toPromise(); - - const blogLanguageVariants = blogVariantsResponse.data.items; - const existingAuthors: IAuthorsMap[] = []; - - for (const blogLanguageVariant of blogLanguageVariants) { - // Find the value of the old author element - const author = blogLanguageVariant.elements - .find((e) => e.element.id === authorElementId)! - .value?.toString(); - - // If the Author item doesn't exist -> create - if (!existingAuthors.find((x) => x.author === author) && author) { - const authorItem = await apiClient - .addContentItem() - .withData({ - name: author, - type: { - codename: "author", - }, - }) - .toPromise(); - - await apiClient - .upsertLanguageVariant() - .byItemId(authorItem.data.id) - .byLanguageCodename("default") - .withData((builder) => { - return { - elements: [ - builder.textElement({ - element: { - codename: "name", - }, - value: author, - }), - ], - }; - }) - .toPromise(); - - existingAuthors.push({ - author: author, - itemId: authorItem.data.id, - }); - } - - // Update the Blog item - await apiClient - .upsertLanguageVariant() - .byItemId(blogLanguageVariant.item.id!) - .byLanguageCodename("default") - .withData((builder) => { - return { - elements: [ - builder.linkedItemsElement({ - element: { - codename: "linked_author", - }, - value: [ - { - id: existingAuthors.find((x) => x.author === author)! - .itemId, - }, - ], - }), - ], - }; - }) - .toPromise(); - } - }, -}; - -export default migration; diff --git a/src/05_snippets.ts b/src/05_snippets.ts new file mode 100644 index 0000000..f3c0af8 --- /dev/null +++ b/src/05_snippets.ts @@ -0,0 +1,39 @@ +import { MigrationModule } from "@kontent-ai/data-ops"; +import { ContentTypeSnippetModels } from "@kontent-ai/management-sdk"; + +import { snippetMetadataExtIds } from "./constants/externalIds.js"; + +const migration: MigrationModule = { + order: 5, + run: async client => { + const snippetData: ContentTypeSnippetModels.IAddContentTypeSnippetData = { + name: "Metadata", + external_id: snippetMetadataExtIds.entity, + elements: [ + { + name: "Title", + type: "text", + external_id: snippetMetadataExtIds.elements.title, + }, + { + name: "Description", + type: "text", + external_id: snippetMetadataExtIds.elements.description, + }, + ], + }; + + await client + .addContentTypeSnippet() + .withData(() => snippetData) + .toPromise(); + }, + rollback: async client => { + await client + .deleteContentTypeSnippet() + .byTypeExternalId(snippetMetadataExtIds.entity) + .toPromise(); + }, +}; + +export default migration; diff --git a/src/06_sample_migration_removeOldElementFromBlogType.ts b/src/06_sample_migration_removeOldElementFromBlogType.ts deleted file mode 100644 index 0a9b829..0000000 --- a/src/06_sample_migration_removeOldElementFromBlogType.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { MigrationModule } from "@kontent-ai/data-ops"; -import {ContentTypeModels } from "@kontent-ai/management-sdk"; - -/** - * Removes the old text element representing author. - * - * Note: This final cleanup is recommended but is not strictly necessary. - */ -const migration: MigrationModule = { - order: 6, - run: async (apiClient) => { - const modification: ContentTypeModels.IModifyContentTypeData[] = [ - { - op: "remove", - path: "/elements/codename:author", - value: "", - }, - ]; - - await apiClient - .modifyContentType() - .byTypeCodename("blog") - .withData(modification) - .toPromise(); - }, -}; - -export default migration; diff --git a/src/06_types.ts b/src/06_types.ts new file mode 100644 index 0000000..e75bb47 --- /dev/null +++ b/src/06_types.ts @@ -0,0 +1,101 @@ +import { MigrationModule } from "@kontent-ai/data-ops"; +import { ContentTypeModels } from "@kontent-ai/management-sdk"; + +import { + snippetMetadataExtIds, + taxonomyArticleTypeExtId, + typeArticleExtIds, + typeAuthorExtIds, +} from "./constants/externalIds.js"; + +const migration: MigrationModule = { + order: 6, + run: async client => { + const authorType: ContentTypeModels.IAddContentTypeData = { + name: "Author", + external_id: typeAuthorExtIds.entity, + elements: [ + { + name: "Name", + type: "text", + external_id: typeAuthorExtIds.elements.name, + }, + ], + }; + + const articleTypeData: ContentTypeModels.IAddContentTypeData = { + name: "Article", + external_id: typeArticleExtIds.entity, + content_groups: [ + { + name: "content", + external_id: typeArticleExtIds.contentGroups.content, + }, + { + name: "metadata", + external_id: typeArticleExtIds.contentGroups.metadata, + }, + ], + elements: [ + { + name: "Title", + type: "text", + content_group: { external_id: typeArticleExtIds.contentGroups.content }, + external_id: typeArticleExtIds.elements.title, + }, + { + name: "Article type", + type: "taxonomy", + taxonomy_group: { external_id: taxonomyArticleTypeExtId.taxonomyGroup }, + content_group: { external_id: typeArticleExtIds.contentGroups.content }, + external_id: typeArticleExtIds.elements.articleType, + }, + { + name: "Content", + type: "rich_text", + content_group: { external_id: typeArticleExtIds.contentGroups.content }, + external_id: typeArticleExtIds.elements.content, + }, + { + name: "Author", + type: "modular_content", + allowed_content_types: [{ external_id: typeAuthorExtIds.entity }], + content_group: { external_id: typeArticleExtIds.contentGroups.content }, + external_id: typeArticleExtIds.elements.author, + }, + { + type: "snippet", + snippet: { external_id: snippetMetadataExtIds.entity }, + content_group: { external_id: typeArticleExtIds.contentGroups.metadata }, + external_id: typeArticleExtIds.elements.metadata, + }, + ], + }; + + await client + .addContentType() + .withData(() => authorType) + .toPromise(); + + await client + .addContentType() + .withData(() => articleTypeData) + .toPromise(); + }, + rollback: async client => { + // Using Catch to be able to rollback even partial migrations. + await client + .deleteContentType() + .byTypeExternalId(typeAuthorExtIds.entity) + .toPromise() + .catch(e => console.log(`Unsucessful deletion of type Author: ${e}`)); + + await client + .deleteContentType() + .byTypeExternalId(typeArticleExtIds.entity) + .toPromise() + .catch(e => console.log(`Unsucessful deletion of type Author: ${e}`)); + }, +}; + +export default migration; diff --git a/src/07_variants.ts b/src/07_variants.ts new file mode 100644 index 0000000..44be171 --- /dev/null +++ b/src/07_variants.ts @@ -0,0 +1,118 @@ +import { MigrationModule } from "@kontent-ai/data-ops"; +import { LanguageVariantContracts, LanguageVariantElementsBuilder, ManagementClient } from "@kontent-ai/management-sdk"; + +import { + itemExampleArticleExtId, + itemJoeDoeExtId, + taxonomyArticleTypeExtId, + typeArticleExtIds, + typeAuthorExtIds, +} from "./constants/externalIds.js"; + +const migration: MigrationModule = { + order: 7, + run: async client => { + const authorData: LanguageVariantContracts.IUpsertLanguageVariantPostContract = { + elements: [{ + element: { external_id: typeAuthorExtIds.elements.name }, + value: "Joe Doe", + }], + }; + + const articleData: LanguageVariantContracts.IUpsertLanguageVariantPostContract = { + elements: [ + { + element: { external_id: typeArticleExtIds.elements.title }, + value: "Example Article", + }, + { + element: { external_id: typeArticleExtIds.elements.articleType }, + value: [{ external_id: taxonomyArticleTypeExtId.terms.blogPost }], + }, + { + element: { external_id: typeArticleExtIds.elements.author }, + value: [{ external_id: typeAuthorExtIds.entity }], + }, + { + element: { external_id: typeArticleExtIds.elements.content }, + value: "

Hello from Rich Text.

", + }, + ], + }; + + await addItem(client, { + name: "Joe Doe", + externalId: itemJoeDoeExtId, + codename: "joe_doe", + contentType: { external_id: typeAuthorExtIds.entity }, + languageCodename: "default", + collection: { codename: "default" }, + publish: true, + data: () => authorData, + }); + + await addItem(client, { + name: "Example Article", + externalId: itemExampleArticleExtId, + codename: "example_article", + contentType: { external_id: typeArticleExtIds.entity }, + languageCodename: "default", + collection: { codename: "default" }, + publish: true, + data: () => articleData, + }); + }, + rollback: async client => { + await client + .deleteContentItem() + .byItemExternalId(itemExampleArticleExtId) + .toPromise(); + + await client + .deleteContentItem() + .byItemExternalId(itemJoeDoeExtId) + .toPromise(); + }, +}; + +type AddItemParams = Readonly<{ + name: string; + externalId: string; + codename: string; + contentType: Readonly<{ codename: string } | { external_id: string }>; + languageCodename: string; + collection: Readonly<{ codename: string } | { external_id: string }>; + publish?: boolean; + data: (builder: LanguageVariantElementsBuilder) => LanguageVariantContracts.IUpsertLanguageVariantPostContract; +}>; + +export const addItem = async (client: ManagementClient, params: AddItemParams) => { + await client + .addContentItem() + .withData({ + name: params.name, + type: params.contentType, + codename: params.codename, + collection: params.collection, + external_id: params.externalId, + }) + .toPromise(); + + await client + .upsertLanguageVariant() + .byItemExternalId(params.externalId) + .byLanguageCodename(params.languageCodename) + .withData(params.data) + .toPromise(); + + if (params.publish) { + await client + .publishLanguageVariant() + .byItemExternalId(params.externalId) + .byLanguageCodename(params.languageCodename) + .withoutData() + .toPromise(); + } +}; + +export default migration; diff --git a/src/assets/kontent-ai.png b/src/assets/kontent-ai.png new file mode 100644 index 0000000000000000000000000000000000000000..8f4c64c24923b925981d4ab724483e5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}lwq zS(8BD6%V`GfHRQz&N;WQ_RuP#^ESb<3OJY1c95c zR=i$EAv=OZWT_wsM{a)YH|ce|P%-h3G!|P&<9jt6EqnkVB$f;C{b(4LzZf~E<1%_! t4Y!-+E(pVNIShl{ax)&ToI`F!{{iPZ%;al{3Ss~N002ovPDHLkV1i}U0>}UW literal 0 HcmV?d00001 diff --git a/src/constants/externalIds.ts b/src/constants/externalIds.ts new file mode 100644 index 0000000..705c3f1 --- /dev/null +++ b/src/constants/externalIds.ts @@ -0,0 +1,40 @@ +export const collectionHealthTechExtId = "collection_healthtech"; +export const taxonomyArticleTypeExtId = { + taxonomyGroup: "taxonomy_articleType", + terms: { + news: "taxonomy_articleType_term_news", + blogPost: "taxonomy_articleType_term_blogPost", + }, +}; +export const assetFoldersImagesExtId = "assetFolder_images"; +export const assetKontentExternalId = "asset_kontent"; +export const snippetMetadataExtIds = { + entity: "snippet_metadata", + elements: { + title: "snippet_metadata_title", + description: "snippet_metadata_description", + }, +}; +export const typeAuthorExtIds = { + entity: "type_author", + elements: { + name: "type_author_elements_name", + }, +}; +export const typeArticleExtIds = { + entity: "type_article", + contentGroups: { + content: "type_article_group_content", + metadata: "type_article_group_metadata", + }, + elements: { + title: "type_article_elements_title", + articleType: "type_article_elements_articleType", + author: "type_author_elements_author", + content: "type_author_elements_content", + metadata: "type_article_elements_metadata", + }, +}; + +export const itemJoeDoeExtId = "item_joeDoe"; +export const itemExampleArticleExtId = "item_exampleArticle"; diff --git a/tsconfig.json b/tsconfig.json index bcb19bb..c065caf 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -24,6 +24,7 @@ "esModuleInterop": true, "resolveJsonModule": true }, + "include": ["src/**/*"], "exclude": [ "node_modules", "Migrations/*.js"