@prismicio/e2e-tests-utils 1.18.0 → 1.19.0-pr.37.6283e4a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -27
- package/dist/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/clients/apiClient.cjs +38 -38
- package/dist/clients/apiClient.cjs.map +1 -1
- package/dist/clients/apiClient.d.cts +30 -0
- package/dist/clients/apiClient.d.cts.map +1 -0
- package/dist/clients/apiClient.d.ts +23 -23
- package/dist/clients/apiClient.d.ts.map +1 -0
- package/dist/clients/apiClient.js +38 -38
- package/dist/clients/apiClient.js.map +1 -1
- package/dist/clients/assetApi.cjs +81 -93
- package/dist/clients/assetApi.cjs.map +1 -1
- package/dist/clients/assetApi.d.cts +105 -0
- package/dist/clients/assetApi.d.cts.map +1 -0
- package/dist/clients/assetApi.d.ts +96 -97
- package/dist/clients/assetApi.d.ts.map +1 -0
- package/dist/clients/assetApi.js +79 -91
- package/dist/clients/assetApi.js.map +1 -1
- package/dist/clients/authenticationApi.cjs +66 -73
- package/dist/clients/authenticationApi.cjs.map +1 -1
- package/dist/clients/authenticationApi.d.cts +20 -0
- package/dist/clients/authenticationApi.d.cts.map +1 -0
- package/dist/clients/authenticationApi.d.ts +18 -13
- package/dist/clients/authenticationApi.d.ts.map +1 -0
- package/dist/clients/authenticationApi.js +65 -72
- package/dist/clients/authenticationApi.js.map +1 -1
- package/dist/clients/contentApi.cjs +94 -103
- package/dist/clients/contentApi.cjs.map +1 -1
- package/dist/clients/contentApi.d.cts +116 -0
- package/dist/clients/contentApi.d.cts.map +1 -0
- package/dist/clients/contentApi.d.ts +102 -98
- package/dist/clients/contentApi.d.ts.map +1 -0
- package/dist/clients/contentApi.js +94 -103
- package/dist/clients/contentApi.js.map +1 -1
- package/dist/clients/coreApi.cjs +154 -145
- package/dist/clients/coreApi.cjs.map +1 -1
- package/dist/clients/coreApi.d.cts +142 -0
- package/dist/clients/coreApi.d.cts.map +1 -0
- package/dist/clients/coreApi.d.ts +131 -109
- package/dist/clients/coreApi.d.ts.map +1 -0
- package/dist/clients/coreApi.js +153 -144
- package/dist/clients/coreApi.js.map +1 -1
- package/dist/clients/customTypesApi.cjs +90 -99
- package/dist/clients/customTypesApi.cjs.map +1 -1
- package/dist/clients/customTypesApi.d.cts +46 -0
- package/dist/clients/customTypesApi.d.cts.map +1 -0
- package/dist/clients/customTypesApi.d.ts +45 -45
- package/dist/clients/customTypesApi.d.ts.map +1 -0
- package/dist/clients/customTypesApi.js +87 -98
- package/dist/clients/customTypesApi.js.map +1 -1
- package/dist/clients/integrationFields.cjs +96 -87
- package/dist/clients/integrationFields.cjs.map +1 -1
- package/dist/clients/integrationFields.d.cts +30 -0
- package/dist/clients/integrationFields.d.cts.map +1 -0
- package/dist/clients/integrationFields.d.ts +27 -22
- package/dist/clients/integrationFields.d.ts.map +1 -0
- package/dist/clients/integrationFields.js +93 -86
- package/dist/clients/integrationFields.js.map +1 -1
- package/dist/clients/manageV2.cjs +154 -171
- package/dist/clients/manageV2.cjs.map +1 -1
- package/dist/clients/manageV2.d.cts +105 -0
- package/dist/clients/manageV2.d.cts.map +1 -0
- package/dist/clients/manageV2.d.ts +103 -111
- package/dist/clients/manageV2.d.ts.map +1 -0
- package/dist/clients/manageV2.js +149 -169
- package/dist/clients/manageV2.js.map +1 -1
- package/dist/clients/migrationApi.cjs +37 -36
- package/dist/clients/migrationApi.cjs.map +1 -1
- package/dist/clients/migrationApi.d.cts +48 -0
- package/dist/clients/migrationApi.d.cts.map +1 -0
- package/dist/clients/migrationApi.d.ts +45 -39
- package/dist/clients/migrationApi.d.ts.map +1 -0
- package/dist/clients/migrationApi.js +35 -34
- package/dist/clients/migrationApi.js.map +1 -1
- package/dist/clients/wroom.cjs +101 -122
- package/dist/clients/wroom.cjs.map +1 -1
- package/dist/clients/wroom.d.cts +48 -0
- package/dist/clients/wroom.d.cts.map +1 -0
- package/dist/clients/wroom.d.ts +46 -47
- package/dist/clients/wroom.d.ts.map +1 -0
- package/dist/clients/wroom.js +99 -122
- package/dist/clients/wroom.js.map +1 -1
- package/dist/index.cjs +13 -15
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -7
- package/dist/index.js +5 -14
- package/dist/managers/repositories.cjs +159 -169
- package/dist/managers/repositories.cjs.map +1 -1
- package/dist/managers/repositories.d.cts +67 -0
- package/dist/managers/repositories.d.cts.map +1 -0
- package/dist/managers/repositories.d.ts +56 -63
- package/dist/managers/repositories.d.ts.map +1 -0
- package/dist/managers/repositories.js +148 -159
- package/dist/managers/repositories.js.map +1 -1
- package/dist/managers/repository.cjs +591 -616
- package/dist/managers/repository.cjs.map +1 -1
- package/dist/managers/repository.d.cts +338 -0
- package/dist/managers/repository.d.cts.map +1 -0
- package/dist/managers/repository.d.ts +333 -307
- package/dist/managers/repository.d.ts.map +1 -0
- package/dist/managers/repository.js +591 -616
- package/dist/managers/repository.js.map +1 -1
- package/dist/types.d.cts +41 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.ts +35 -37
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/cookies.cjs +19 -17
- package/dist/utils/cookies.cjs.map +1 -1
- package/dist/utils/cookies.js +20 -18
- package/dist/utils/cookies.js.map +1 -1
- package/dist/utils/envVariableManager.cjs +33 -34
- package/dist/utils/envVariableManager.cjs.map +1 -1
- package/dist/utils/envVariableManager.js +34 -35
- package/dist/utils/envVariableManager.js.map +1 -1
- package/dist/utils/log.cjs +18 -19
- package/dist/utils/log.cjs.map +1 -1
- package/dist/utils/log.js +18 -21
- package/dist/utils/log.js.map +1 -1
- package/dist/utils/random.cjs +13 -6
- package/dist/utils/random.cjs.map +1 -1
- package/dist/utils/random.js +13 -6
- package/dist/utils/random.js.map +1 -1
- package/dist/utils/strings.cjs +13 -7
- package/dist/utils/strings.cjs.map +1 -1
- package/dist/utils/strings.js +14 -8
- package/dist/utils/strings.js.map +1 -1
- package/dist/utils/urls.cjs +21 -10
- package/dist/utils/urls.cjs.map +1 -1
- package/dist/utils/urls.js +22 -12
- package/dist/utils/urls.js.map +1 -1
- package/package.json +42 -67
- package/src/clients/apiClient.ts +16 -21
- package/src/clients/assetApi.ts +75 -82
- package/src/clients/authenticationApi.ts +54 -27
- package/src/clients/contentApi.ts +111 -129
- package/src/clients/coreApi.ts +165 -117
- package/src/clients/customTypesApi.ts +54 -74
- package/src/clients/integrationFields.ts +59 -74
- package/src/clients/manageV2.ts +72 -96
- package/src/clients/migrationApi.ts +35 -39
- package/src/clients/wroom.ts +42 -56
- package/src/index.ts +7 -7
- package/src/managers/repositories.ts +85 -108
- package/src/managers/repository.ts +393 -368
- package/src/types.ts +31 -31
- package/src/utils/cookies.ts +8 -8
- package/src/utils/envVariableManager.ts +15 -15
- package/src/utils/log.ts +17 -21
- package/src/utils/random.ts +5 -6
- package/src/utils/strings.ts +7 -9
- package/src/utils/urls.ts +10 -12
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/utils/cookies.d.ts +0 -8
- package/dist/utils/envVariableManager.d.ts +0 -16
- package/dist/utils/log.d.ts +0 -5
- package/dist/utils/random.d.ts +0 -8
- package/dist/utils/strings.d.ts +0 -11
- package/dist/utils/urls.d.ts +0 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.js","sources":["../../../src/managers/repository.ts"],"sourcesContent":["import { expect } from \"@playwright/test\";\nimport { AxiosResponse } from \"axios\";\n\nimport {\n\tCustomType,\n\tSharedSlice,\n} from \"@prismicio/types-internal/lib/customtypes\";\n\nimport { IntegrationFieldConfig } from \"../types\";\n\nimport { AssetApiClient } from \"../clients/assetApi\";\nimport { AuthenticationApiClient } from \"../clients/authenticationApi\";\nimport { ContentApiClient } from \"../clients/contentApi\";\nimport {\n\tCoreApiClient,\n\tCoreApiDocumentCreationPayload,\n\tCoreApiDocumentCreationResponse,\n\tCoreApiDocumentData,\n\tCoreApiDocumentsPayload,\n\tCoreApiDocumentsResponse,\n\tRelease,\n} from \"../clients/coreApi\";\nimport { CustomTypesApiClient } from \"../clients/customTypesApi\";\nimport { IntegrationFieldsClient } from \"../clients/integrationFields\";\nimport { ManageV2Client } from \"../clients/manageV2\";\nimport { MigrationApiClient } from \"../clients/migrationApi\";\nimport { WroomClient } from \"../clients/wroom\";\nimport { logHttpResponse, logger } from \"../utils/log\";\nimport { getRepositoryUrl } from \"../utils/urls\";\n\n/** Utility to manage test data for a Prismic repository */\nexport class RepositoryManager {\n\tconstructor(\n\t\treadonly name: string,\n\t\tprivate readonly coreApiClient: CoreApiClient,\n\t\tprivate readonly authApiClient: AuthenticationApiClient,\n\t\tprivate readonly wroomClient: WroomClient,\n\t\tprivate readonly customTypesApiClient: CustomTypesApiClient,\n\t\tprivate readonly migrationApiClient: MigrationApiClient | undefined,\n\t\tprivate readonly assetApiClient: AssetApiClient,\n\t\tprivate readonly manageV2Client: ManageV2Client,\n\t\tprivate readonly integrationFieldsClient:\n\t\t\t| IntegrationFieldsClient\n\t\t\t| undefined,\n\t) {}\n\n\tasync configure(config: RepositoryConfig): Promise<void> {\n\t\tconst hasLangConfig =\n\t\t\tconfig.defaultLocale || config.locales || config.customLocale;\n\t\tif (hasLangConfig) {\n\t\t\tconst languages = await this.coreApiClient.getLanguages();\n\t\t\tlet updateDefaultLocaleAtTheEnd = false;\n\t\t\t// if no locale exists on repo, the master locale needs to be set first\n\t\t\tif (config.defaultLocale) {\n\t\t\t\tconst master = languages.find(({ is_master }) => is_master === true);\n\t\t\t\tif (!master) {\n\t\t\t\t\tawait this.setDefaultLocale(config.defaultLocale, \"create\");\n\t\t\t\t} else if (master.id !== config.defaultLocale) {\n\t\t\t\t\t// update the master lang at the end, after it is created.\n\t\t\t\t\tupdateDefaultLocaleAtTheEnd = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (config.locales) {\n\t\t\t\t// No need to add default locale and already existing languages\n\t\t\t\tconst localesToAdd = config.locales.filter(\n\t\t\t\t\t(id) => !languages.some((language) => language.id === id),\n\t\t\t\t);\n\t\t\t\tif (localesToAdd.length > 0) {\n\t\t\t\t\tawait this.createLocales(localesToAdd);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (config.customLocale) {\n\t\t\t\tif (!languages.find(({ id }) => id === config.customLocale?.lang.id)) {\n\t\t\t\t\tawait this.createCustomLocale(config.customLocale);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (config.defaultLocale && updateDefaultLocaleAtTheEnd) {\n\t\t\t\tawait this.setDefaultLocale(config.defaultLocale, \"update\");\n\t\t\t}\n\t\t}\n\n\t\tif (config.slices) {\n\t\t\tawait this.createSlices(config.slices);\n\t\t}\n\n\t\tif (config.customTypes) {\n\t\t\tawait this.createCustomTypes(config.customTypes);\n\t\t}\n\n\t\tif (config.preview) {\n\t\t\tawait this.createPreview(config.preview);\n\t\t}\n\n\t\tif (config.simulatorURL) {\n\t\t\tawait this.setSimulatorURL(config.simulatorURL);\n\t\t}\n\n\t\tif (config.rolePerLocal) {\n\t\t\tawait this.toggleRolePerLocal(true);\n\t\t}\n\n\t\tif (config.customRoles) {\n\t\t\tawait this.toggleCustomRoles(true);\n\t\t}\n\n\t\tif (config.integrationFields) {\n\t\t\tawait this.toggleIntegrationFields(true);\n\t\t\tawait this.setupIntegrationFields(config.integrationFields);\n\t\t}\n\t}\n\n\t/** @returns the repository base url, like https://my-repo.prismic.io */\n\tgetBaseURL(): string {\n\t\treturn getRepositoryUrl(this.wroomClient.getBaseURL(), this.name);\n\t}\n\n\t/** @returns the repository base cdn url, like https://my-repo.cdn.prismic.io */\n\tgetBaseCdnURL(): string {\n\t\treturn getRepositoryUrl(this.wroomClient.getBaseURL(), `${this.name}.cdn`);\n\t}\n\n\t/**\n\t * @returns a Content Type api client configured to target the repository CDN\n\t * url. Uses Playwright for requests so if your project uses Playwright too,\n\t * any network request will be present in Playwright test reports.\n\t */\n\tgetContentApiClient(config?: {\n\t\tversion?: \"v1\" | \"v2\";\n\t\taccessToken?: string;\n\t}): ContentApiClient {\n\t\treturn new ContentApiClient(this.getBaseCdnURL(), config);\n\t}\n\n\t/**\n\t * @returns an instance of the Migration api client, see\n\t * https://prismic.io/docs/migration-api-technical-reference\n\t */\n\tgetMigrationApiClient(): MigrationApiClient {\n\t\tif (!this.migrationApiClient) {\n\t\t\tthrow \"No client found for the migration api. Did you provide a migration api url in the configuration?\";\n\t\t}\n\n\t\treturn this.migrationApiClient;\n\t}\n\n\t/**\n\t * @returns an instance of the Asset api client, see\n\t * https://prismic.io/docs/asset-api-technical-reference\n\t */\n\tgetAssetApiClient(): AssetApiClient {\n\t\treturn this.assetApiClient;\n\t}\n\n\t/** @returns the Wroom commit hash deployed on the current repository */\n\tasync getDeployedVersion(): Promise<string | undefined> {\n\t\tconst response = await this.wroomClient.get(\n\t\t\tthis.name,\n\t\t\t\"underground/834b34f16f451e00f268dd5c8c81d16e3c020275\",\n\t\t);\n\n\t\t// Somehow axios directly parses the text response `Prismic version: <commit hash> into a version attribute\n\t\treturn response.data.version;\n\t}\n\n\t/**\n\t * Set additional standard locales for a repository in Wroom, does not fail if\n\t * the locales already exist.\n\t *\n\t * @param locales - An array of all locales to be added to the repository.\n\t *\n\t * @throws Error if setting the locales fails.\n\t */\n\tasync createLocales(locales: string[]): Promise<void> {\n\t\tconst profiler = logger.startTimer();\n\n\t\tconst response = await this.wroomClient.post(\n\t\t\tthis.name,\n\t\t\t\"app/settings/multilanguages\",\n\t\t\t{ languages: locales },\n\t\t);\n\n\t\tconst { data, status } = response;\n\t\tconst success =\n\t\t\tstatus === 200 ||\n\t\t\t(status === 400 &&\n\t\t\t\t(data as string).includes(\"already existing languages\"));\n\t\tif (!success) {\n\t\t\tlogHttpResponse(response);\n\t\t\tthrow new Error(`Could not add locales ${locales.join(\", \")}`);\n\t\t}\n\t\tprofiler.done({ message: `locales '${locales}' created` });\n\t}\n\n\t/**\n\t * Set additional custom locale for a repository in Wroom, does not fail if\n\t * the locales already exist.\n\t *\n\t * @param locale - The locale to be added to the repository.\n\t *\n\t * @throws Error if setting the locale fails.\n\t */\n\tasync createCustomLocale(locale: CustomLocale): Promise<void> {\n\t\tconst profiler = logger.startTimer();\n\n\t\tconst response = await this.wroomClient.post(\n\t\t\tthis.name,\n\t\t\t\"app/settings/multilanguages/custom\",\n\t\t\tlocale,\n\t\t);\n\n\t\tconst { data, status } = response;\n\t\tconst success =\n\t\t\tstatus === 200 ||\n\t\t\t(status === 400 && JSON.stringify(data).includes(\"code is already used\"));\n\t\tif (!success) {\n\t\t\tlogHttpResponse(response);\n\t\t\tthrow new Error(`Could not create custom locale ${locale}`);\n\t\t}\n\t\tprofiler.done({\n\t\t\tmessage: `custom locale ${JSON.stringify(locale)} created`,\n\t\t});\n\t}\n\n\tprivate failIfNot200(response: AxiosResponse, msg: string) {\n\t\tif (response.status !== 200) {\n\t\t\tlogHttpResponse(response);\n\t\t\tthrow new Error(msg);\n\t\t}\n\t}\n\n\t/**\n\t * Delete a locale from a repository.\n\t *\n\t * @param locale - locale to remove from the repository configuration.\n\t *\n\t * @throws Error if deleting the locale fails.\n\t */\n\tasync deleteLocale(locale: string): Promise<void> {\n\t\tconst profiler = logger.startTimer();\n\n\t\tconst response = await this.wroomClient.post(\n\t\t\tthis.name,\n\t\t\t`app/settings/multilanguages/${locale}/delete`,\n\t\t);\n\t\tthis.failIfNot200(response, `Could not delete locale ${locale}`);\n\t\tprofiler.done({ message: `locale '${locale}' deleted` });\n\t}\n\n\t/**\n\t * Create or update the default (master) locale for a repository in Wroom, the\n\t * locale needs to exist in the repository.\n\t *\n\t * @param locale - The locale to be set as the default.\n\t * @param endpoint - \"createMasterLang\" to create it, \"defineAsMaster\" to\n\t * update it.\n\t *\n\t * @throws Error if setting the default locale fails.\n\t */\n\tasync setDefaultLocale(\n\t\tlocale: string,\n\t\taction: \"create\" | \"update\",\n\t): Promise<void> {\n\t\tconst profiler = logger.startTimer();\n\n\t\tconst endpoint = {\n\t\t\tcreate: \"createMasterLang\",\n\t\t\tupdate: \"defineAsMaster\",\n\t\t};\n\t\tconst response = await this.wroomClient.post(\n\t\t\tthis.name,\n\t\t\t`/app/settings/multilanguages/${locale}/${endpoint[action]}`,\n\t\t);\n\n\t\tconst { data, status } = response;\n\t\tconst success =\n\t\t\tstatus === 200 ||\n\t\t\t(status === 400 &&\n\t\t\t\t// returns 400 if master lang is already set\n\t\t\t\tJSON.stringify(data).includes(\"Unable to set as master language\"));\n\t\tif (!success) {\n\t\t\tlogHttpResponse(response);\n\t\t\tthrow new Error(`Could not set default locale to ${locale}`);\n\t\t}\n\t\tprofiler.done({ message: `default locale set to '${locale}'` });\n\t}\n\n\t/**\n\t * Retrieves documents.\n\t *\n\t * @param args - Configure which documents are retrieved.\n\t *\n\t * @returns A paginated set of documents.\n\t */\n\tasync getDocuments(\n\t\targs: CoreApiDocumentsPayload,\n\t): Promise<CoreApiDocumentsResponse> {\n\t\treturn this.coreApiClient.getDocuments(args);\n\t}\n\n\t/**\n\t * Creates a release.\n\t *\n\t * @param label - The label for the release.\n\t *\n\t * @returns A Promise that resolves when the release is created.\n\t */\n\tasync createRelease(label: string): Promise<{ id: string }> {\n\t\tconst profiler = logger.startTimer();\n\n\t\tconst response = await this.wroomClient.post(this.name, \"app/releases\", {\n\t\t\tlabel,\n\t\t});\n\t\tthis.failIfNot200(response, `Could not create release ${label}`);\n\t\tprofiler.done({ message: `release '${label}' created` });\n\n\t\treturn response.data;\n\t}\n\n\t/**\n\t * Retrieves the migration release.\n\t *\n\t * @returns The migration relese metadata.\n\t */\n\tasync getMigrationRelease(): Promise<Release> {\n\t\tconst releases = await this.coreApiClient.getReleases();\n\t\tconst migrationRelease = releases.find((release) => release.migration);\n\t\tif (!migrationRelease) {\n\t\t\tthrow new Error(`The repository does not have a migration release`);\n\t\t}\n\n\t\treturn migrationRelease;\n\t}\n\n\t/**\n\t * Publishes a release.\n\t *\n\t * @param id - The ID of the release.\n\t *\n\t * @returns A Promise that resolves when the release is published and a new\n\t * master ref is available.\n\t */\n\tasync publishRelease(id: string): Promise<void> {\n\t\tconst profiler = logger.startTimer();\n\n\t\tconst contentApi = this.getContentApiClient();\n\t\tconst masterRef = await contentApi.getMasterRef();\n\t\tawait this.coreApiClient.publishRelease(id);\n\t\tawait expect\n\t\t\t.poll(async () => contentApi.getMasterRef(), {\n\t\t\t\ttimeout: 10_000,\n\t\t\t\tmessage: \"Waiting for new master ref to be available\",\n\t\t\t})\n\t\t\t.not.toBe(masterRef);\n\n\t\tprofiler.done({\n\t\t\tmessage: `release '${id}' published and new master ref available`,\n\t\t});\n\t}\n\n\t/**\n\t * Deletes a repository release.\n\t *\n\t * @param id - The ID of the release to be deleted.\n\t */\n\tasync deleteRelease(id: string): Promise<void> {\n\t\tconst profiler = logger.startTimer();\n\n\t\tconst response = await this.wroomClient.post(\n\t\t\tthis.name,\n\t\t\t`app/releases/${id}/delete`,\n\t\t\t{},\n\t\t);\n\n\t\tthis.failIfNot200(response, `Could not delete release with id ${id}`);\n\t\tprofiler.done({ message: `release '${id}' deleted` });\n\t}\n\n\t/**\n\t * Creates a preview for a repository.\n\t *\n\t * @param data - The data for creating the preview.\n\t */\n\tasync createPreview(data: Preview): Promise<void> {\n\t\tconst profiler = logger.startTimer();\n\n\t\tconst response = await this.wroomClient.post(\n\t\t\tthis.name,\n\t\t\t`previews/new`,\n\t\t\tdata,\n\t\t);\n\n\t\tthis.failIfNot200(response, `Could not create preview ${data.name}`);\n\t\tprofiler.done({ message: `preview '${data.name}' created` });\n\n\t\treturn response.data;\n\t}\n\n\t/**\n\t * Set the simulator URL (table of slices) for a repository.\n\t *\n\t * @param data - The simulator URL to set.\n\t */\n\tasync setSimulatorURL(simulatorURL: string): Promise<void> {\n\t\tconst profiler = logger.startTimer();\n\n\t\tconst repository = await this.coreApiClient.getRepository();\n\t\tawait this.coreApiClient.updateRepository({\n\t\t\t...repository,\n\t\t\tsimulator_url: simulatorURL,\n\t\t});\n\n\t\tprofiler.done({\n\t\t\tmessage: `simulator preview '${simulatorURL}' created`,\n\t\t});\n\t}\n\n\t/**\n\t * Deletes a preview from a repository.\n\t *\n\t * @param id - The ID of the preview to be deleted.\n\t */\n\tasync deletePreview(id: string): Promise<void> {\n\t\tconst profiler = logger.startTimer();\n\n\t\tconst response = await this.wroomClient.post(\n\t\t\tthis.name,\n\t\t\t`previews/delete/${id}`,\n\t\t\t{},\n\t\t);\n\n\t\tthis.failIfNot200(response, `Could not delete preview with id ${id}`);\n\t\tprofiler.done({ message: `preview '${id}' deleted` });\n\t}\n\n\t/**\n\t * Create a webhook.\n\t *\n\t * @returns A Promise that resolves with the webhook id.\n\t */\n\tasync createWebhook(\n\t\tname: string,\n\t\turl: string,\n\t\tsecret: string,\n\t\ttriggers: {\n\t\t\tdocumentsPublished?: boolean;\n\t\t\tdocumentsUnpublished?: boolean;\n\t\t\treleasesCreated?: boolean;\n\t\t\treleasesUpdated?: boolean;\n\t\t\ttagsCreated?: boolean;\n\t\t\ttagsDeleted?: boolean;\n\t\t},\n\t\tactive: boolean,\n\t): Promise<string> {\n\t\tconst profiler = logger.startTimer();\n\n\t\tconst response = await this.wroomClient.post(\n\t\t\tthis.name,\n\t\t\t\"app/settings/webhooks/create\",\n\t\t\t{\n\t\t\t\tname,\n\t\t\t\turl,\n\t\t\t\tsecret,\n\t\t\t\tactive: active ? \"on\" : \"off\",\n\t\t\t\t...triggers,\n\t\t\t},\n\t\t);\n\t\tthis.failIfNot200(response, `Could not create webhook ${name}`);\n\t\tprofiler.done({ message: `webhook '${name}' created` });\n\n\t\treturn response.data.created;\n\t}\n\n\t/**\n\t * Deletes a webhook.\n\t *\n\t * @param id - The webhook ID.\n\t */\n\tasync deleteWebhook(id: string): Promise<void> {\n\t\tconst profiler = logger.startTimer();\n\n\t\tconst response = await this.wroomClient.post(\n\t\t\tthis.name,\n\t\t\t`app/settings/webhooks/${id}/delete`,\n\t\t\t{},\n\t\t);\n\n\t\tthis.failIfNot200(response, `Could not delete webhook with id ${id}`);\n\t\tprofiler.done({ message: `webhook '${id}' deleted` });\n\t}\n\n\t/**\n\t * Create Custom Types using the Custom types api.\n\t *\n\t * @param customTypes -\n\t */\n\tasync createCustomTypes(customTypes: CustomType[]): Promise<void> {\n\t\tawait this.customTypesApiClient.createCustomTypes(customTypes);\n\t}\n\n\tasync deleteCustomType(customTypeId: string): Promise<void> {\n\t\tawait this.customTypesApiClient.deleteCustomType(customTypeId);\n\t}\n\n\t/**\n\t * Create slices using the Custom types api.\n\t *\n\t * @param slices -\n\t */\n\tasync createSlices(slices: SharedSlice[]): Promise<void> {\n\t\tawait this.customTypesApiClient.createSlices(slices);\n\t}\n\n\t/**\n\t * Create an access token to query private items of the Content api.\n\t *\n\t * @param appName - mandatory authorized application name\n\t * @param tokenScope - access token scope. Use \"master\" to when your content\n\t * api is fully private or \"master+releases\" to access private releases\n\t */\n\tasync createContentAPIToken(\n\t\tappName: string,\n\t\ttokenScope: \"master\" | \"master+releases\" = \"master\",\n\t): Promise<string> {\n\t\tconst profiler = logger.startTimer();\n\t\ttype AuthorizedAppResponse = {\n\t\t\tid: string;\n\t\t\tname: string;\n\t\t\twroom_auths: { token: string; scope: \"master\" | \"master+releases\" }[];\n\t\t};\n\t\tconst existingApps: AxiosResponse<AuthorizedAppResponse[]> =\n\t\t\tawait this.wroomClient.get(this.name, \"settings/security/contentapi\");\n\n\t\tthis.failIfNot200(\n\t\t\texistingApps,\n\t\t\t`Could not get status of existing applications to generate a content api token`,\n\t\t);\n\t\tlet app = existingApps.data.find(({ name, wroom_auths }) => {\n\t\t\treturn name === appName && wroom_auths.length > 0;\n\t\t});\n\n\t\tif (!app) {\n\t\t\tconst response: AxiosResponse<AuthorizedAppResponse> =\n\t\t\t\tawait this.wroomClient.post(this.name, \"settings/security/oauthapp\", {\n\t\t\t\t\tapp_name: appName,\n\t\t\t\t});\n\n\t\t\tthis.failIfNot200(\n\t\t\t\tresponse,\n\t\t\t\t`Could not create content api app ${appName}`,\n\t\t\t);\n\t\t\tapp = response.data;\n\t\t}\n\n\t\tlet tokenInfo = app.wroom_auths.find(({ scope }) => scope === tokenScope);\n\t\tif (!tokenInfo) {\n\t\t\tconst response = await this.wroomClient.post(\n\t\t\t\tthis.name,\n\t\t\t\t\"settings/security/authorizations\",\n\t\t\t\t{\n\t\t\t\t\tapp: app.id,\n\t\t\t\t\tscope: tokenScope,\n\t\t\t\t},\n\t\t\t);\n\t\t\tthis.failIfNot200(\n\t\t\t\tresponse,\n\t\t\t\t`Could not create content api access token for app ${appName} with scope ${tokenScope}`,\n\t\t\t);\n\t\t\ttokenInfo = response.data;\n\t\t}\n\n\t\tprofiler.done({\n\t\t\tmessage: `content api access token for app '${appName}' created`,\n\t\t});\n\n\t\tif (!tokenInfo?.token) {\n\t\t\tthrow `Could not create content api access token for app ${appName} with scope ${tokenScope}`;\n\t\t}\n\n\t\treturn tokenInfo.token;\n\t}\n\n\t/** Create a permanent access token to authenticate to Prismic public apis. */\n\tasync createPermanentAccessToken(): Promise<string> {\n\t\tconst profiler = logger.startTimer();\n\n\t\tconst token = await this.authApiClient.getMachine2MachineToken(this.name);\n\n\t\tprofiler.done({\n\t\t\tmessage: `machine2machine token created`,\n\t\t});\n\n\t\treturn token;\n\t}\n\n\t/**\n\t * Toggle the Role per Locale workflow\n\t *\n\t * @param enabled - The feature new status\n\t */\n\tasync toggleRolePerLocal(enabled: boolean): Promise<void> {\n\t\tconst profiler = logger.startTimer();\n\n\t\tconst response = await this.manageV2Client.toggleRolePerLocal({\n\t\t\trepository: this.name,\n\t\t\tenabled: enabled,\n\t\t});\n\n\t\tthis.failIfNot200(\n\t\t\tresponse,\n\t\t\t`Could not ${enabled ? \"enable\" : \"disable\"} Role per local for ${\n\t\t\t\tthis.name\n\t\t\t}`,\n\t\t);\n\t\tprofiler.done({\n\t\t\tmessage: `Role per local ${enabled ? \"enabled\" : \"disabled\"}`,\n\t\t});\n\t}\n\n\t/**\n\t * Toggle the Custom Roles workflow\n\t *\n\t * @param enabled - The feature new status\n\t */\n\tasync toggleCustomRoles(enabled: boolean): Promise<void> {\n\t\tconst profiler = logger.startTimer();\n\n\t\tconst response = await this.manageV2Client.toggleCustomRoles({\n\t\t\trepository: this.name,\n\t\t\tenabled: enabled,\n\t\t});\n\n\t\tthis.failIfNot200(\n\t\t\tresponse,\n\t\t\t`Could not ${enabled ? \"enable\" : \"disable\"} Custom Roles for ${\n\t\t\t\tthis.name\n\t\t\t}`,\n\t\t);\n\t\tprofiler.done({\n\t\t\tmessage: `Custom Roles ${enabled ? \"enabled\" : \"disabled\"}`,\n\t\t});\n\t}\n\n\t/**\n\t * Toggle the Integration Fields feature\n\t *\n\t * @param enabled - The feature new status\n\t */\n\tasync toggleIntegrationFields(enabled: boolean): Promise<void> {\n\t\tconst profiler = logger.startTimer();\n\n\t\tconst response = await this.manageV2Client.toggleIntegrationFields({\n\t\t\trepository: this.name,\n\t\t\tenabled: enabled,\n\t\t});\n\n\t\tthis.failIfNot200(\n\t\t\tresponse,\n\t\t\t`Could not ${enabled ? \"enable\" : \"disable\"} Integration Fields for ${\n\t\t\t\tthis.name\n\t\t\t}`,\n\t\t);\n\t\tprofiler.done({\n\t\t\tmessage: `Integration Fields ${enabled ? \"enabled\" : \"disabled\"}`,\n\t\t});\n\t}\n\n\t/**\n\t * Change the Repository Plan\n\t *\n\t * @param {string} newPlanId - The Id of the new Plan to apply\n\t */\n\tasync changePlan(newPlanId: string): Promise<void> {\n\t\tconst profiler = logger.startTimer();\n\n\t\tconst response = await this.manageV2Client.changePlan({\n\t\t\trepository: this.name,\n\t\t\tnewPlanId: newPlanId,\n\t\t\tbypassManualBilling: true, // For now the library does not support Stripe features\n\t\t});\n\n\t\tthis.failIfNot200(response, \"Could not change the Repository Plan\");\n\t\tprofiler.done({\n\t\t\tmessage: `Repository Plan changed to ${newPlanId}`,\n\t\t});\n\t}\n\n\t/**\n\t * Add a new user to the repository\n\t *\n\t * @param {string} email - The email of the user\n\t */\n\tasync addUser(email: string): Promise<void> {\n\t\tconst profiler = logger.startTimer();\n\n\t\tconst response = await this.manageV2Client.addUserToRepository({\n\t\t\trepository: this.name,\n\t\t\temail: email,\n\t\t});\n\n\t\tconst { data, status } = response;\n\t\tconst success =\n\t\t\tstatus === 200 ||\n\t\t\t(status === 409 &&\n\t\t\t\tJSON.stringify(data).includes(\"already a member of the repo\"));\n\t\tif (!success) {\n\t\t\tlogHttpResponse(response);\n\t\t\tthrow new Error(`Could not add a new user ${email} to the repository`);\n\t\t}\n\t\tprofiler.done({\n\t\t\tmessage: `User ${email} was added to the repository`,\n\t\t});\n\t}\n\n\t/**\n\t * Remove a user from the repository\n\t *\n\t * @param {string} email - The email of the user\n\t */\n\tasync removeUser(email: string): Promise<void> {\n\t\tconst profiler = logger.startTimer();\n\n\t\tconst response = await this.manageV2Client.removeUserFromRepository({\n\t\t\trepository: this.name,\n\t\t\temail: email,\n\t\t});\n\n\t\tthis.failIfNot200(\n\t\t\tresponse,\n\t\t\t`Could not remove the user ${email} from the repository`,\n\t\t);\n\t\tprofiler.done({\n\t\t\tmessage: `User ${email} was removed from the repository`,\n\t\t});\n\t}\n\n\t/**\n\t * Update the role of a user in a repository\n\t *\n\t * @param {string} email - The email of the user\n\t * @param {string | Record<string, string>} role - The new Role of the user,\n\t * either a string for basic workflow or an object such as `{ \"lang_id\":\n\t * \"Writer\" }`\n\t *\n\t * Example of roles are\n\t *\n\t * - Administrator\n\t * - Writer\n\t * - Contributor\n\t * - Manager (publisher)\n\t */\n\tasync updateUserRole(\n\t\temail: string,\n\t\trole: string | Record<string, string>,\n\t): Promise<void> {\n\t\tconst profiler = logger.startTimer();\n\n\t\tconst response =\n\t\t\ttypeof role === \"string\"\n\t\t\t\t? await this.wroomClient.updateRole(this.name, email, role)\n\t\t\t\t: await this.wroomClient.updateRolePerLocal(this.name, email, role);\n\n\t\tthis.failIfNot200(\n\t\t\tresponse,\n\t\t\t`Could not update the ${\n\t\t\t\ttypeof role === \"string\" ? \"role\" : \"rolePerLocal\"\n\t\t\t} of the user ${email}`,\n\t\t);\n\t\tprofiler.done({\n\t\t\tmessage: `Updated User's ${\n\t\t\t\ttypeof role === \"string\" ? \"role\" : \"rolePerLocal\"\n\t\t\t} for user ${email}`,\n\t\t});\n\t}\n\n\t/**\n\t * Creates a document using the core api. If the Core api format is too\n\t * specific, use the migration api client to create a document with the\n\t * MigrationApiClient. See the `getMigrationApiClient()` method.\n\t *\n\t * @example To create a document by converting it from the Page Builder to\n\t * Core api format\n\t *\n\t * ```js\n\t * import { DocumentLegacy, UIDContentType } from '@prismicio/types-internal/lib/content';\n\t *\n\t * const document = {\n\t * title: 'A new document',\n\t * custom_type_id: 'home-page',\n\t * locale: 'en-gb',\n\t * integration_field_ids: [],\n\t * tags: [],\n\t * data: DocumentLegacy.encode({\n\t * uid: {\n\t * __TYPE__: UIDContentType,\n\t * value: 'home-page',\n\t * },\n\t * })\n\t * }\n\t * await repository.createDocument(document, 'published');\n\t * \t * ```\n\t * ```\n\t *\n\t * @returns\n\t *\n\t * @param document - in the core api format.\n\t *\n\t * @param status - status of the document, if published, the function will\n\t * wait for a new content api master ref to be created\n\t */\n\tasync createDocument(\n\t\tdocument: CoreApiDocumentCreationPayload,\n\t\tstatus: \"draft\" | \"published\",\n\t): Promise<CoreApiDocumentCreationResponse> {\n\t\tconst profiler = logger.startTimer();\n\t\tconst result = await this.coreApiClient.createDraft(document);\n\n\t\tlet message = `Document created with id '${result.id}'`;\n\t\tif (status === \"published\") {\n\t\t\tconst contentApi = this.getContentApiClient();\n\t\t\tconst masterRef = await contentApi.getMasterRef();\n\t\t\tawait this.coreApiClient.publishDraft(result.id);\n\t\t\tawait expect\n\t\t\t\t.poll(async () => contentApi.getMasterRef(), {\n\t\t\t\t\ttimeout: 10_000,\n\t\t\t\t\tmessage: \"Waiting for new master ref to be available\",\n\t\t\t\t})\n\t\t\t\t.not.toBe(masterRef);\n\t\t\tmessage += \", status 'published' and new master ref available\";\n\t\t}\n\t\tprofiler.done({\n\t\t\tmessage,\n\t\t});\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Retrieves data for a specific document version.\n\t *\n\t * @param versionId - The document's version ID.\n\t *\n\t * @returns The document's version data.\n\t */\n\tasync getDocumentData(versionId: string): Promise<CoreApiDocumentData> {\n\t\treturn await this.coreApiClient.getDocumentData(versionId);\n\t}\n\n\tasync setupIntegrationFields(\n\t\tintegrationFields: IntegrationFieldConfig[],\n\t): Promise<void> {\n\t\tconst profiler = logger.startTimer();\n\n\t\tif (!this.integrationFieldsClient) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Integration Fields client not found. Did you provide a integration fields api url in the configuration?\",\n\t\t\t);\n\t\t}\n\n\t\tawait this.integrationFieldsClient.setupIntegrationFields(\n\t\t\tintegrationFields,\n\t\t);\n\t\tprofiler.done({\n\t\t\tmessage: `Integration Fields setup`,\n\t\t});\n\t}\n}\n\nexport type RepositoryConfig = {\n\tcustomLocale?: CustomLocale;\n\tlocales?: string[];\n\tdefaultLocale?: string;\n\tslices?: SharedSlice[];\n\tcustomTypes?: CustomType[];\n\tpreview?: Preview;\n\tsimulatorURL?: string;\n\trolePerLocal?: boolean;\n\tcustomRoles?: boolean;\n\tintegrationFields?: IntegrationFieldConfig[];\n};\n\nexport type Preview = {\n\tname: string;\n\twebsiteURL: string;\n\tresolverPath: string;\n};\n\nexport type CustomLocale = {\n\tlang: {\n\t\tlabel: string;\n\t\tid: string;\n\t\tuseStandardAnalyzer?: boolean;\n\t};\n\tregion: {\n\t\tlabel: string;\n\t\tid: string;\n\t};\n};\n"],"names":[],"mappings":";;;;;;;;;;MA+Ba,kBAAiB;AAAA,EAC7B,YACU,MACQ,eACA,eACA,aACA,sBACA,oBACA,gBACA,gBACA,yBAEL;AAVH;AACQ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARR,SAAI,OAAJ;AACQ,SAAa,gBAAb;AACA,SAAa,gBAAb;AACA,SAAW,cAAX;AACA,SAAoB,uBAApB;AACA,SAAkB,qBAAlB;AACA,SAAc,iBAAd;AACA,SAAc,iBAAd;AACA,SAAuB,0BAAvB;AAAA,E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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqCA,MAAM,eACL,UACA,QAA6B;AAEvB,UAAA,WAAW,OAAO;AACxB,UAAM,SAAS,MAAM,KAAK,cAAc,YAAY,QAAQ;AAExD,QAAA,UAAU,6BAA6B,OAAO,EAAE;AACpD,QAAI,WAAW,aAAa;AACrB,YAAA,aAAa,KAAK;AAClB,YAAA,YAAY,MAAM,WAAW;AACnC,YAAM,KAAK,cAAc,aAAa,OAAO,EAAE;AAC/C,YAAM,OACJ,KAAK,YAAY,WAAW,gBAAgB;AAAA,QAC5C,SAAS;AAAA,QACT,SAAS;AAAA,MACT,CAAA,EACA,IAAI,KAAK,SAAS;AACT,iBAAA;AAAA,IACZ;AACA,aAAS,KAAK;AAAA,MACb;AAAA,IAAA,CACA;AAEM,WAAA;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,gBAAgB,WAAiB;AACtC,WAAO,MAAM,KAAK,cAAc,gBAAgB,SAAS;AAAA,EAC1D;AAAA,EAEA,MAAM,uBACL,mBAA2C;AAErC,UAAA,WAAW,OAAO;AAEpB,QAAA,CAAC,KAAK,yBAAyB;AAC5B,YAAA,IAAI,MACT,yGAAyG;AAAA,IAE3G;AAEM,UAAA,KAAK,wBAAwB,uBAClC,iBAAiB;AAElB,aAAS,KAAK;AAAA,MACb,SAAS;AAAA,IAAA,CACT;AAAA,EACF;AACA;"}
|
|
1
|
+
{"version":3,"file":"repository.js","names":[],"sources":["../../src/managers/repository.ts"],"sourcesContent":["import { expect } from \"@playwright/test\"\nimport type { DynamicCustomTypeModel, SharedSliceModel } from \"@prismicio/types-internal\"\nimport type { AxiosResponse } from \"axios\"\n\nimport type { AssetApiClient } from \"../clients/assetApi\"\nimport type { AuthenticationApiClient } from \"../clients/authenticationApi\"\nimport { ContentApiClient } from \"../clients/contentApi\"\nimport type {\n\tCoreApiClient,\n\tCoreApiDocumentCreationPayload,\n\tCoreApiDocumentCreationResponse,\n\tCoreApiDocumentData,\n\tCoreApiDocumentsPayload,\n\tCoreApiDocumentsResponse,\n\tCoreApiDocumentUpdatePayload,\n\tRelease,\n} from \"../clients/coreApi\"\nimport type { CustomTypesApiClient } from \"../clients/customTypesApi\"\nimport type { IntegrationFieldsClient } from \"../clients/integrationFields\"\nimport type { ManageV2Client } from \"../clients/manageV2\"\nimport type { MigrationApiClient } from \"../clients/migrationApi\"\nimport type { WroomClient } from \"../clients/wroom\"\nimport type { IntegrationFieldConfig } from \"../types\"\nimport { logHttpResponse, logger } from \"../utils/log\"\nimport { getRepositoryUrl } from \"../utils/urls\"\n\n/** Utility to manage test data for a Prismic repository */\nexport class RepositoryManager {\n\tconstructor(\n\t\treadonly name: string,\n\t\tprivate readonly coreApiClient: CoreApiClient,\n\t\tprivate readonly authApiClient: AuthenticationApiClient,\n\t\tprivate readonly wroomClient: WroomClient,\n\t\tprivate readonly customTypesApiClient: CustomTypesApiClient,\n\t\tprivate readonly migrationApiClient: MigrationApiClient | undefined,\n\t\tprivate readonly assetApiClient: AssetApiClient,\n\t\tprivate readonly manageV2Client: ManageV2Client,\n\t\tprivate readonly integrationFieldsClient: IntegrationFieldsClient | undefined,\n\t) {}\n\n\tasync configure(config: RepositoryConfig): Promise<void> {\n\t\tconst hasLangConfig = config.defaultLocale || config.locales || config.customLocale\n\t\tif (hasLangConfig) {\n\t\t\tconst languages = await this.coreApiClient.getLanguages()\n\t\t\tlet updateDefaultLocaleAtTheEnd = false\n\t\t\t// if no locale exists on repo, the master locale needs to be set first\n\t\t\tif (config.defaultLocale) {\n\t\t\t\tconst master = languages.find(({ is_master }) => is_master === true)\n\t\t\t\tif (!master) {\n\t\t\t\t\tawait this.setDefaultLocale(config.defaultLocale, \"create\")\n\t\t\t\t} else if (master.id !== config.defaultLocale) {\n\t\t\t\t\t// update the master lang at the end, after it is created.\n\t\t\t\t\tupdateDefaultLocaleAtTheEnd = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (config.locales) {\n\t\t\t\t// No need to add default locale and already existing languages\n\t\t\t\tconst localesToAdd = config.locales.filter(\n\t\t\t\t\t(id) => !languages.some((language) => language.id === id),\n\t\t\t\t)\n\t\t\t\tif (localesToAdd.length > 0) {\n\t\t\t\t\tawait this.createLocales(localesToAdd)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (config.customLocale) {\n\t\t\t\tif (!languages.find(({ id }) => id === config.customLocale?.lang.id)) {\n\t\t\t\t\tawait this.createCustomLocale(config.customLocale)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (config.defaultLocale && updateDefaultLocaleAtTheEnd) {\n\t\t\t\tawait this.setDefaultLocale(config.defaultLocale, \"update\")\n\t\t\t}\n\t\t}\n\n\t\tif (config.slices) {\n\t\t\tawait this.createSlices(config.slices)\n\t\t}\n\n\t\tif (config.customTypes) {\n\t\t\tawait this.createCustomTypes(config.customTypes)\n\t\t}\n\n\t\tif (config.preview) {\n\t\t\tawait this.createPreview(config.preview)\n\t\t}\n\n\t\tif (config.simulatorURL) {\n\t\t\tawait this.setSimulatorURL(config.simulatorURL)\n\t\t}\n\n\t\tif (config.rolePerLocal) {\n\t\t\tawait this.toggleRolePerLocal(true)\n\t\t}\n\n\t\tif (config.customRoles) {\n\t\t\tawait this.toggleCustomRoles(true)\n\t\t}\n\n\t\tif (config.integrationFields) {\n\t\t\tawait this.toggleIntegrationFields(true)\n\t\t\tawait this.setupIntegrationFields(config.integrationFields)\n\t\t}\n\t}\n\n\t/** @returns The repository base url, like https://my-repo.prismic.io */\n\tgetBaseURL(): string {\n\t\treturn getRepositoryUrl(this.wroomClient.getBaseURL(), this.name)\n\t}\n\n\t/** @returns The repository base cdn url, like https://my-repo.cdn.prismic.io */\n\tgetBaseCdnURL(): string {\n\t\treturn getRepositoryUrl(this.wroomClient.getBaseURL(), `${this.name}.cdn`)\n\t}\n\n\t/**\n\t * @returns A Content Type api client configured to target the repository CDN url. Uses Playwright\n\t * for requests so if your project uses Playwright too, any network request will be present in\n\t * Playwright test reports.\n\t */\n\tgetContentApiClient(config?: { version?: \"v1\" | \"v2\"; accessToken?: string }): ContentApiClient {\n\t\treturn new ContentApiClient(this.getBaseCdnURL(), config)\n\t}\n\n\t/**\n\t * @returns An instance of the Migration api client, see\n\t * https://prismic.io/docs/migration-api-technical-reference\n\t */\n\tgetMigrationApiClient(): MigrationApiClient {\n\t\tif (!this.migrationApiClient) {\n\t\t\tthrow \"No client found for the migration api. Did you provide a migration api url in the configuration?\"\n\t\t}\n\n\t\treturn this.migrationApiClient\n\t}\n\n\t/**\n\t * @returns An instance of the Asset api client, see\n\t * https://prismic.io/docs/asset-api-technical-reference\n\t */\n\tgetAssetApiClient(): AssetApiClient {\n\t\treturn this.assetApiClient\n\t}\n\n\t/** @returns The Wroom commit hash deployed on the current repository */\n\tasync getDeployedVersion(): Promise<string | undefined> {\n\t\tconst response = await this.wroomClient.get(\n\t\t\tthis.name,\n\t\t\t\"underground/834b34f16f451e00f268dd5c8c81d16e3c020275\",\n\t\t)\n\n\t\t// Somehow axios directly parses the text response `Prismic version: <commit hash> into a version attribute\n\t\treturn response.data.version\n\t}\n\n\t/**\n\t * Set additional standard locales for a repository in Wroom, does not fail if the locales already\n\t * exist.\n\t *\n\t * @param locales - An array of all locales to be added to the repository.\n\t * @throws Error if setting the locales fails.\n\t */\n\tasync createLocales(locales: string[]): Promise<void> {\n\t\tconst profiler = logger.startTimer()\n\n\t\tconst response = await this.wroomClient.post(this.name, \"app/settings/multilanguages\", {\n\t\t\tlanguages: locales,\n\t\t})\n\n\t\tconst { data, status } = response\n\t\tconst success =\n\t\t\tstatus === 200 || (status === 400 && (data as string).includes(\"already existing languages\"))\n\t\tif (!success) {\n\t\t\tlogHttpResponse(response)\n\t\t\tthrow new Error(`Could not add locales ${locales.join(\", \")}`)\n\t\t}\n\t\tprofiler.done({ message: `locales '${locales}' created` })\n\t}\n\n\t/**\n\t * Set additional custom locale for a repository in Wroom, does not fail if the locales already\n\t * exist.\n\t *\n\t * @param locale - The locale to be added to the repository.\n\t * @throws Error if setting the locale fails.\n\t */\n\tasync createCustomLocale(locale: CustomLocale): Promise<void> {\n\t\tconst profiler = logger.startTimer()\n\n\t\tconst response = await this.wroomClient.post(\n\t\t\tthis.name,\n\t\t\t\"app/settings/multilanguages/custom\",\n\t\t\tlocale,\n\t\t)\n\n\t\tconst { data, status } = response\n\t\tconst success =\n\t\t\tstatus === 200 || (status === 400 && JSON.stringify(data).includes(\"code is already used\"))\n\t\tif (!success) {\n\t\t\tlogHttpResponse(response)\n\t\t\tthrow new Error(`Could not create custom locale ${locale}`)\n\t\t}\n\t\tprofiler.done({\n\t\t\tmessage: `custom locale ${JSON.stringify(locale)} created`,\n\t\t})\n\t}\n\n\tprivate failIfNot200(response: AxiosResponse, msg: string) {\n\t\tif (response.status !== 200) {\n\t\t\tlogHttpResponse(response)\n\t\t\tthrow new Error(msg)\n\t\t}\n\t}\n\n\t/**\n\t * Delete a locale from a repository.\n\t *\n\t * @param locale - Locale to remove from the repository configuration.\n\t * @throws Error if deleting the locale fails.\n\t */\n\tasync deleteLocale(locale: string): Promise<void> {\n\t\tconst profiler = logger.startTimer()\n\n\t\tconst response = await this.wroomClient.post(\n\t\t\tthis.name,\n\t\t\t`app/settings/multilanguages/${locale}/delete`,\n\t\t)\n\t\tthis.failIfNot200(response, `Could not delete locale ${locale}`)\n\t\tprofiler.done({ message: `locale '${locale}' deleted` })\n\t}\n\n\t/**\n\t * Create or update the default (master) locale for a repository in Wroom, the locale needs to\n\t * exist in the repository.\n\t *\n\t * @param locale - The locale to be set as the default.\n\t * @param endpoint - \"createMasterLang\" to create it, \"defineAsMaster\" to update it.\n\t * @throws Error if setting the default locale fails.\n\t */\n\tasync setDefaultLocale(locale: string, action: \"create\" | \"update\"): Promise<void> {\n\t\tconst profiler = logger.startTimer()\n\n\t\tconst endpoint = {\n\t\t\tcreate: \"createMasterLang\",\n\t\t\tupdate: \"defineAsMaster\",\n\t\t}\n\t\tconst response = await this.wroomClient.post(\n\t\t\tthis.name,\n\t\t\t`/app/settings/multilanguages/${locale}/${endpoint[action]}`,\n\t\t)\n\n\t\tconst { data, status } = response\n\t\tconst success =\n\t\t\tstatus === 200 ||\n\t\t\t(status === 400 &&\n\t\t\t\t// returns 400 if master lang is already set\n\t\t\t\tJSON.stringify(data).includes(\"Unable to set as master language\"))\n\t\tif (!success) {\n\t\t\tlogHttpResponse(response)\n\t\t\tthrow new Error(`Could not set default locale to ${locale}`)\n\t\t}\n\t\tprofiler.done({ message: `default locale set to '${locale}'` })\n\t}\n\n\t/**\n\t * Retrieves documents.\n\t *\n\t * @param args - Configure which documents are retrieved.\n\t * @returns A paginated set of documents.\n\t */\n\tasync getDocuments(args: CoreApiDocumentsPayload): Promise<CoreApiDocumentsResponse> {\n\t\treturn this.coreApiClient.getDocuments(args)\n\t}\n\n\t/**\n\t * Creates a release.\n\t *\n\t * @param label - The label for the release.\n\t * @returns A Promise that resolves when the release is created.\n\t */\n\tasync createRelease(label: string): Promise<{ id: string }> {\n\t\tconst profiler = logger.startTimer()\n\n\t\tconst response = await this.wroomClient.post(this.name, \"app/releases\", {\n\t\t\tlabel,\n\t\t})\n\t\tthis.failIfNot200(response, `Could not create release ${label}`)\n\t\tprofiler.done({ message: `release '${label}' created` })\n\n\t\treturn response.data\n\t}\n\n\t/**\n\t * Retrieves the migration release.\n\t *\n\t * @returns The migration relese metadata.\n\t */\n\tasync getMigrationRelease(): Promise<Release> {\n\t\tconst releases = await this.coreApiClient.getReleases()\n\t\tconst migrationRelease = releases.find((release) => release.migration)\n\t\tif (!migrationRelease) {\n\t\t\tthrow new Error(`The repository does not have a migration release`)\n\t\t}\n\n\t\treturn migrationRelease\n\t}\n\n\t/**\n\t * Publishes a release.\n\t *\n\t * @param id - The ID of the release.\n\t * @returns A Promise that resolves when the release is published and a new master ref is\n\t * available.\n\t */\n\tasync publishRelease(id: string): Promise<void> {\n\t\tconst profiler = logger.startTimer()\n\n\t\tconst contentApi = this.getContentApiClient()\n\t\tconst masterRef = await contentApi.getMasterRef()\n\t\tawait this.coreApiClient.publishRelease(id)\n\t\tawait expect\n\t\t\t.poll(async () => contentApi.getMasterRef(), {\n\t\t\t\ttimeout: 10_000,\n\t\t\t\tmessage: \"Waiting for new master ref to be available\",\n\t\t\t})\n\t\t\t.not.toBe(masterRef)\n\n\t\tprofiler.done({\n\t\t\tmessage: `release '${id}' published and new master ref available`,\n\t\t})\n\t}\n\n\t/**\n\t * Deletes a repository release.\n\t *\n\t * @param id - The ID of the release to be deleted.\n\t */\n\tasync deleteRelease(id: string): Promise<void> {\n\t\tconst profiler = logger.startTimer()\n\n\t\tconst response = await this.wroomClient.post(this.name, `app/releases/${id}/delete`, {})\n\n\t\tthis.failIfNot200(response, `Could not delete release with id ${id}`)\n\t\tprofiler.done({ message: `release '${id}' deleted` })\n\t}\n\n\t/**\n\t * Creates a preview for a repository.\n\t *\n\t * @param data - The data for creating the preview.\n\t */\n\tasync createPreview(data: Preview): Promise<void> {\n\t\tconst profiler = logger.startTimer()\n\n\t\tconst response = await this.wroomClient.post(this.name, `previews/new`, data)\n\n\t\tthis.failIfNot200(response, `Could not create preview ${data.name}`)\n\t\tprofiler.done({ message: `preview '${data.name}' created` })\n\n\t\treturn response.data\n\t}\n\n\t/**\n\t * Set the simulator URL (table of slices) for a repository.\n\t *\n\t * @param data - The simulator URL to set.\n\t */\n\tasync setSimulatorURL(simulatorURL: string): Promise<void> {\n\t\tconst profiler = logger.startTimer()\n\n\t\tconst repository = await this.coreApiClient.getRepository()\n\t\tawait this.coreApiClient.updateRepository({\n\t\t\t...repository,\n\t\t\tsimulator_url: simulatorURL,\n\t\t})\n\n\t\tprofiler.done({\n\t\t\tmessage: `simulator preview '${simulatorURL}' created`,\n\t\t})\n\t}\n\n\t/**\n\t * Deletes a preview from a repository.\n\t *\n\t * @param id - The ID of the preview to be deleted.\n\t */\n\tasync deletePreview(id: string): Promise<void> {\n\t\tconst profiler = logger.startTimer()\n\n\t\tconst response = await this.wroomClient.post(this.name, `previews/delete/${id}`, {})\n\n\t\tthis.failIfNot200(response, `Could not delete preview with id ${id}`)\n\t\tprofiler.done({ message: `preview '${id}' deleted` })\n\t}\n\n\t/**\n\t * Create a webhook.\n\t *\n\t * @returns A Promise that resolves with the webhook id.\n\t */\n\tasync createWebhook(\n\t\tname: string,\n\t\turl: string,\n\t\tsecret: string,\n\t\ttriggers: {\n\t\t\tdocumentsPublished?: boolean\n\t\t\tdocumentsUnpublished?: boolean\n\t\t\treleasesCreated?: boolean\n\t\t\treleasesUpdated?: boolean\n\t\t\ttagsCreated?: boolean\n\t\t\ttagsDeleted?: boolean\n\t\t},\n\t\tactive: boolean,\n\t): Promise<string> {\n\t\tconst profiler = logger.startTimer()\n\n\t\tconst response = await this.wroomClient.post(this.name, \"app/settings/webhooks/create\", {\n\t\t\tname,\n\t\t\turl,\n\t\t\tsecret,\n\t\t\tactive: active ? \"on\" : \"off\",\n\t\t\t...triggers,\n\t\t})\n\t\tthis.failIfNot200(response, `Could not create webhook ${name}`)\n\t\tprofiler.done({ message: `webhook '${name}' created` })\n\n\t\treturn response.data.created\n\t}\n\n\t/**\n\t * Deletes a webhook.\n\t *\n\t * @param id - The webhook ID.\n\t */\n\tasync deleteWebhook(id: string): Promise<void> {\n\t\tconst profiler = logger.startTimer()\n\n\t\tconst response = await this.wroomClient.post(\n\t\t\tthis.name,\n\t\t\t`app/settings/webhooks/${id}/delete`,\n\t\t\t{},\n\t\t)\n\n\t\tthis.failIfNot200(response, `Could not delete webhook with id ${id}`)\n\t\tprofiler.done({ message: `webhook '${id}' deleted` })\n\t}\n\n\t/**\n\t * Create Custom Types using the Custom types api.\n\t *\n\t * @param customTypes\n\t */\n\tasync createCustomTypes(customTypes: DynamicCustomTypeModel[]): Promise<void> {\n\t\tawait this.customTypesApiClient.createCustomTypes(customTypes)\n\t}\n\n\tasync deleteCustomType(customTypeId: string): Promise<void> {\n\t\tawait this.customTypesApiClient.deleteCustomType(customTypeId)\n\t}\n\n\t/**\n\t * Create slices using the Custom types api.\n\t *\n\t * @param slices\n\t */\n\tasync createSlices(slices: SharedSliceModel[]): Promise<void> {\n\t\tawait this.customTypesApiClient.createSlices(slices)\n\t}\n\n\t/**\n\t * Create an access token to query private items of the Content api.\n\t *\n\t * @param appName - Mandatory authorized application name\n\t * @param tokenScope - Access token scope. Use \"master\" to when your content api is fully private\n\t * or \"master+releases\" to access private releases\n\t */\n\tasync createContentAPIToken(\n\t\tappName: string,\n\t\ttokenScope: \"master\" | \"master+releases\" = \"master\",\n\t): Promise<string> {\n\t\tconst profiler = logger.startTimer()\n\t\ttype AuthorizedAppResponse = {\n\t\t\tid: string\n\t\t\tname: string\n\t\t\twroom_auths: { token: string; scope: \"master\" | \"master+releases\" }[]\n\t\t}\n\t\tconst existingApps: AxiosResponse<AuthorizedAppResponse[]> = await this.wroomClient.get(\n\t\t\tthis.name,\n\t\t\t\"settings/security/contentapi\",\n\t\t)\n\n\t\tthis.failIfNot200(\n\t\t\texistingApps,\n\t\t\t`Could not get status of existing applications to generate a content api token`,\n\t\t)\n\t\tlet app = existingApps.data.find(({ name, wroom_auths }) => {\n\t\t\treturn name === appName && wroom_auths.length > 0\n\t\t})\n\n\t\tif (!app) {\n\t\t\tconst response: AxiosResponse<AuthorizedAppResponse> = await this.wroomClient.post(\n\t\t\t\tthis.name,\n\t\t\t\t\"settings/security/oauthapp\",\n\t\t\t\t{\n\t\t\t\t\tapp_name: appName,\n\t\t\t\t},\n\t\t\t)\n\n\t\t\tthis.failIfNot200(response, `Could not create content api app ${appName}`)\n\t\t\tapp = response.data\n\t\t}\n\n\t\tlet tokenInfo = app.wroom_auths.find(({ scope }) => scope === tokenScope)\n\t\tif (!tokenInfo) {\n\t\t\tconst response = await this.wroomClient.post(this.name, \"settings/security/authorizations\", {\n\t\t\t\tapp: app.id,\n\t\t\t\tscope: tokenScope,\n\t\t\t})\n\t\t\tthis.failIfNot200(\n\t\t\t\tresponse,\n\t\t\t\t`Could not create content api access token for app ${appName} with scope ${tokenScope}`,\n\t\t\t)\n\t\t\ttokenInfo = response.data\n\t\t}\n\n\t\tprofiler.done({\n\t\t\tmessage: `content api access token for app '${appName}' created`,\n\t\t})\n\n\t\tif (!tokenInfo?.token) {\n\t\t\tthrow `Could not create content api access token for app ${appName} with scope ${tokenScope}`\n\t\t}\n\n\t\treturn tokenInfo.token\n\t}\n\n\t/** Create a permanent access token to authenticate to Prismic public apis. */\n\tasync createPermanentAccessToken(): Promise<string> {\n\t\tconst profiler = logger.startTimer()\n\n\t\tconst token = await this.authApiClient.getMachine2MachineToken(this.name)\n\n\t\tprofiler.done({\n\t\t\tmessage: `machine2machine token created`,\n\t\t})\n\n\t\treturn token\n\t}\n\n\t/**\n\t * Toggle the Role per Locale workflow\n\t *\n\t * @param enabled - The feature new status\n\t */\n\tasync toggleRolePerLocal(enabled: boolean): Promise<void> {\n\t\tconst profiler = logger.startTimer()\n\n\t\tconst response = await this.manageV2Client.toggleRolePerLocal({\n\t\t\trepository: this.name,\n\t\t\tenabled: enabled,\n\t\t})\n\n\t\tthis.failIfNot200(\n\t\t\tresponse,\n\t\t\t`Could not ${enabled ? \"enable\" : \"disable\"} Role per local for ${this.name}`,\n\t\t)\n\t\tprofiler.done({\n\t\t\tmessage: `Role per local ${enabled ? \"enabled\" : \"disabled\"}`,\n\t\t})\n\t}\n\n\t/**\n\t * Toggle the Custom Roles workflow\n\t *\n\t * @param enabled - The feature new status\n\t */\n\tasync toggleCustomRoles(enabled: boolean): Promise<void> {\n\t\tconst profiler = logger.startTimer()\n\n\t\tconst response = await this.manageV2Client.toggleCustomRoles({\n\t\t\trepository: this.name,\n\t\t\tenabled: enabled,\n\t\t})\n\n\t\tthis.failIfNot200(\n\t\t\tresponse,\n\t\t\t`Could not ${enabled ? \"enable\" : \"disable\"} Custom Roles for ${this.name}`,\n\t\t)\n\t\tprofiler.done({\n\t\t\tmessage: `Custom Roles ${enabled ? \"enabled\" : \"disabled\"}`,\n\t\t})\n\t}\n\n\t/**\n\t * Toggle the Integration Fields feature\n\t *\n\t * @param enabled - The feature new status\n\t */\n\tasync toggleIntegrationFields(enabled: boolean): Promise<void> {\n\t\tconst profiler = logger.startTimer()\n\n\t\tconst response = await this.manageV2Client.toggleIntegrationFields({\n\t\t\trepository: this.name,\n\t\t\tenabled: enabled,\n\t\t})\n\n\t\tthis.failIfNot200(\n\t\t\tresponse,\n\t\t\t`Could not ${enabled ? \"enable\" : \"disable\"} Integration Fields for ${this.name}`,\n\t\t)\n\t\tprofiler.done({\n\t\t\tmessage: `Integration Fields ${enabled ? \"enabled\" : \"disabled\"}`,\n\t\t})\n\t}\n\n\t/**\n\t * Change the Repository Plan\n\t *\n\t * @param {string} newPlanId - The Id of the new Plan to apply\n\t */\n\tasync changePlan(newPlanId: string): Promise<void> {\n\t\tconst profiler = logger.startTimer()\n\n\t\tconst response = await this.manageV2Client.changePlan({\n\t\t\trepository: this.name,\n\t\t\tnewPlanId: newPlanId,\n\t\t\tbypassManualBilling: true, // For now the library does not support Stripe features\n\t\t})\n\n\t\tthis.failIfNot200(response, \"Could not change the Repository Plan\")\n\t\tprofiler.done({\n\t\t\tmessage: `Repository Plan changed to ${newPlanId}`,\n\t\t})\n\t}\n\n\t/**\n\t * Add a new user to the repository\n\t *\n\t * @param {string} email - The email of the user\n\t */\n\tasync addUser(email: string): Promise<void> {\n\t\tconst profiler = logger.startTimer()\n\n\t\tconst response = await this.manageV2Client.addUserToRepository({\n\t\t\trepository: this.name,\n\t\t\temail: email,\n\t\t})\n\n\t\tconst { data, status } = response\n\t\tconst success =\n\t\t\tstatus === 200 ||\n\t\t\t(status === 409 && JSON.stringify(data).includes(\"already a member of the repo\"))\n\t\tif (!success) {\n\t\t\tlogHttpResponse(response)\n\t\t\tthrow new Error(`Could not add a new user ${email} to the repository`)\n\t\t}\n\t\tprofiler.done({\n\t\t\tmessage: `User ${email} was added to the repository`,\n\t\t})\n\t}\n\n\t/**\n\t * Remove a user from the repository\n\t *\n\t * @param {string} email - The email of the user\n\t */\n\tasync removeUser(email: string): Promise<void> {\n\t\tconst profiler = logger.startTimer()\n\n\t\tconst response = await this.manageV2Client.removeUserFromRepository({\n\t\t\trepository: this.name,\n\t\t\temail: email,\n\t\t})\n\n\t\tthis.failIfNot200(response, `Could not remove the user ${email} from the repository`)\n\t\tprofiler.done({\n\t\t\tmessage: `User ${email} was removed from the repository`,\n\t\t})\n\t}\n\n\t/**\n\t * Update the role of a user in a repository\n\t *\n\t * @param {string} email - The email of the user\n\t * @param {string | Record<string, string>} role - The new Role of the user, either a string for\n\t * basic workflow or an object such as `{ \"lang_id\": \"Writer\" }`\n\t *\n\t * Example of roles are\n\t *\n\t * - Administrator\n\t * - Writer\n\t * - Contributor\n\t * - Manager (publisher)\n\t */\n\tasync updateUserRole(email: string, role: string | Record<string, string>): Promise<void> {\n\t\tconst profiler = logger.startTimer()\n\n\t\tconst response =\n\t\t\ttypeof role === \"string\"\n\t\t\t\t? await this.wroomClient.updateRole(this.name, email, role)\n\t\t\t\t: await this.wroomClient.updateRolePerLocal(this.name, email, role)\n\n\t\tthis.failIfNot200(\n\t\t\tresponse,\n\t\t\t`Could not update the ${\n\t\t\t\ttypeof role === \"string\" ? \"role\" : \"rolePerLocal\"\n\t\t\t} of the user ${email}`,\n\t\t)\n\t\tprofiler.done({\n\t\t\tmessage: `Updated User's ${\n\t\t\t\ttypeof role === \"string\" ? \"role\" : \"rolePerLocal\"\n\t\t\t} for user ${email}`,\n\t\t})\n\t}\n\n\t/**\n\t * Creates a document using the core api. If the Core api format is too specific, use the\n\t * migration api client to create a document with the MigrationApiClient. See the\n\t * `getMigrationApiClient()` method.\n\t *\n\t * @example\n\t * \tTo create a document by converting it from the Page Builder to\n\t * \tCore api format\n\t *\n\t * \t```js\n\t * \timport { DocumentLegacy, UIDContentType } from '@prismicio/types-internal/lib/content';\n\t *\n\t * \tconst document = {\n\t * \ttitle: 'A new document',\n\t * \tcustom_type_id: 'home-page',\n\t * \tlocale: 'en-gb',\n\t * \tintegration_field_ids: [],\n\t * \ttags: [],\n\t * \tdata: DocumentLegacy.encode({\n\t * \tuid: {\n\t * \t__TYPE__: UIDContentType,\n\t * \tvalue: 'home-page',\n\t * \t},\n\t * \t})\n\t * \t}\n\t * \tawait repository.createDocument(document, 'published');\n\t * \t* ```\n\t * \t```\n\t *\n\t * \t@returns\n\t *\n\t * \t@param document - in the core api format.\n\t *\n\t * \t@param status - status of the document, if published, the function will\n\t * \twait for a new content api master ref to be created\n\t */\n\tasync createDocument(\n\t\tdocument: CoreApiDocumentCreationPayload,\n\t\tstatus: \"draft\" | \"published\",\n\t): Promise<CoreApiDocumentCreationResponse> {\n\t\tconst profiler = logger.startTimer()\n\t\tconst result = await this.coreApiClient.createDraft(document)\n\n\t\tlet message = `Document created with id '${result.id}'`\n\t\tif (status === \"published\") {\n\t\t\tconst contentApi = this.getContentApiClient()\n\t\t\tconst masterRef = await contentApi.getMasterRef()\n\t\t\tawait this.coreApiClient.publishDraft(result.id)\n\t\t\tawait expect\n\t\t\t\t.poll(async () => contentApi.getMasterRef(), {\n\t\t\t\t\ttimeout: 10_000,\n\t\t\t\t\tmessage: \"Waiting for new master ref to be available\",\n\t\t\t\t})\n\t\t\t\t.not.toBe(masterRef)\n\t\t\tmessage += \", status 'published' and new master ref available\"\n\t\t}\n\t\tprofiler.done({\n\t\t\tmessage,\n\t\t})\n\n\t\treturn result\n\t}\n\n\t/**\n\t * Updates an existing document using the core api by creating a new draft version on top of the\n\t * given base version. If the status is published, the function will, unless disabled, wait for a\n\t * new content api master ref to be created.\n\t *\n\t * @param documentId - The id of the document to update.\n\t * @param data - The new version payload in the core api format.\n\t * @param baseVersionId - The id of the version the draft is created from.\n\t * @param status - Status of the new version, if published, the function will wait for a new\n\t * content api master ref to be created.\n\t * @param options - Additional options.\n\t * @param options.waitForMasterRef - When publishing, wait for a new content api master ref to be\n\t * available (default true). Set to false to return without waiting for the projection.\n\t * @returns The updated document, including the new version's id.\n\t */\n\tasync updateDocument(\n\t\tdocumentId: string,\n\t\tdata: CoreApiDocumentUpdatePayload,\n\t\tbaseVersionId: string,\n\t\tstatus: \"draft\" | \"published\",\n\t\toptions: { waitForMasterRef?: boolean } = {},\n\t): Promise<CoreApiDocumentCreationResponse> {\n\t\tconst { waitForMasterRef = true } = options\n\t\tconst profiler = logger.startTimer()\n\t\tconst result = await this.coreApiClient.updateDraft(documentId, data, baseVersionId)\n\n\t\tlet message = `Document '${documentId}' updated`\n\t\tif (status === \"published\") {\n\t\t\tif (waitForMasterRef) {\n\t\t\t\tconst contentApi = this.getContentApiClient()\n\t\t\t\tconst masterRef = await contentApi.getMasterRef()\n\t\t\t\tawait this.coreApiClient.publishDraft(documentId)\n\t\t\t\tawait expect\n\t\t\t\t\t.poll(async () => contentApi.getMasterRef(), {\n\t\t\t\t\t\ttimeout: 10_000,\n\t\t\t\t\t\tmessage: \"Waiting for new master ref to be available\",\n\t\t\t\t\t})\n\t\t\t\t\t.not.toBe(masterRef)\n\t\t\t\tmessage += \", status 'published' and new master ref available\"\n\t\t\t} else {\n\t\t\t\tawait this.coreApiClient.publishDraft(documentId)\n\t\t\t\tmessage += \", status 'published'\"\n\t\t\t}\n\t\t}\n\t\tprofiler.done({\n\t\t\tmessage,\n\t\t})\n\n\t\treturn result\n\t}\n\n\t/**\n\t * Unpublishes (archives) a live document using the core api. Unless disabled, waits for a new\n\t * content api master ref to be available.\n\t *\n\t * @param documentId - The id of the document to unpublish.\n\t * @param options - Additional options.\n\t * @param options.waitForMasterRef - Wait for a new content api master ref to be available\n\t * (default true). Set to false to return without waiting for the projection.\n\t */\n\tasync unpublishDocument(\n\t\tdocumentId: string,\n\t\toptions: { waitForMasterRef?: boolean } = {},\n\t): Promise<void> {\n\t\tconst { waitForMasterRef = true } = options\n\t\tconst profiler = logger.startTimer()\n\n\t\tif (!waitForMasterRef) {\n\t\t\tawait this.coreApiClient.unpublishDocument(documentId)\n\t\t\tprofiler.done({ message: `Document '${documentId}' unpublished` })\n\n\t\t\treturn\n\t\t}\n\n\t\tconst contentApi = this.getContentApiClient()\n\t\tconst masterRef = await contentApi.getMasterRef()\n\t\tawait this.coreApiClient.unpublishDocument(documentId)\n\t\tawait expect\n\t\t\t.poll(async () => contentApi.getMasterRef(), {\n\t\t\t\ttimeout: 10_000,\n\t\t\t\tmessage: \"Waiting for new master ref to be available\",\n\t\t\t})\n\t\t\t.not.toBe(masterRef)\n\n\t\tprofiler.done({\n\t\t\tmessage: `Document '${documentId}' unpublished and new master ref available`,\n\t\t})\n\t}\n\n\t/**\n\t * Retrieves data for a specific document version.\n\t *\n\t * @param versionId - The document's version ID.\n\t * @returns The document's version data.\n\t */\n\tasync getDocumentData(versionId: string): Promise<CoreApiDocumentData> {\n\t\treturn await this.coreApiClient.getDocumentData(versionId)\n\t}\n\n\tasync setupIntegrationFields(integrationFields: IntegrationFieldConfig[]): Promise<void> {\n\t\tconst profiler = logger.startTimer()\n\n\t\tif (!this.integrationFieldsClient) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Integration Fields client not found. Did you provide a integration fields api url in the configuration?\",\n\t\t\t)\n\t\t}\n\n\t\tawait this.integrationFieldsClient.setupIntegrationFields(integrationFields)\n\t\tprofiler.done({\n\t\t\tmessage: `Integration Fields setup`,\n\t\t})\n\t}\n}\n\nexport type RepositoryConfig = {\n\tcustomLocale?: CustomLocale\n\tlocales?: string[]\n\tdefaultLocale?: string\n\tslices?: SharedSliceModel[]\n\tcustomTypes?: DynamicCustomTypeModel[]\n\tpreview?: Preview\n\tsimulatorURL?: string\n\trolePerLocal?: boolean\n\tcustomRoles?: boolean\n\tintegrationFields?: IntegrationFieldConfig[]\n}\n\nexport type Preview = {\n\tname: string\n\twebsiteURL: string\n\tresolverPath: string\n}\n\nexport type CustomLocale = {\n\tlang: {\n\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,WAAiD;EACtE,OAAO,MAAM,KAAK,cAAc,gBAAgB,SAAS;CAC1D;CAEA,MAAM,uBAAuB,mBAA4D;EACxF,MAAM,WAAW,OAAO,WAAW;EAEnC,IAAI,CAAC,KAAK,yBACT,MAAM,IAAI,MACT,yGACD;EAGD,MAAM,KAAK,wBAAwB,uBAAuB,iBAAiB;EAC3E,SAAS,KAAK,EACb,SAAS,2BACV,CAAC;CACF;AACD"}
|
package/dist/types.d.cts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
type UrlConfig = {
|
|
3
|
+
/** Prismic base url */baseURL: string; /** Custom types api base url */
|
|
4
|
+
customTypesApi: string; /** Auth service api base url */
|
|
5
|
+
authenticationApi: string; /** Prismic migration api base url */
|
|
6
|
+
migrationApi?: string; /** Asset api base url */
|
|
7
|
+
assetApi: string; /** Integration fields api base url */
|
|
8
|
+
integrationFieldApi?: string;
|
|
9
|
+
};
|
|
10
|
+
type AuthConfig = {
|
|
11
|
+
email: string;
|
|
12
|
+
password: string;
|
|
13
|
+
};
|
|
14
|
+
type ManageV2Config = {
|
|
15
|
+
secret: string;
|
|
16
|
+
audience: string;
|
|
17
|
+
};
|
|
18
|
+
type SetupConfiguration = {
|
|
19
|
+
urlConfig: UrlConfig | string;
|
|
20
|
+
authConfig: AuthConfig;
|
|
21
|
+
manageV2Config?: ManageV2Config;
|
|
22
|
+
cluster?: string;
|
|
23
|
+
environment?: string;
|
|
24
|
+
integrationFieldsConfig?: IntegrationFieldConfig[];
|
|
25
|
+
};
|
|
26
|
+
type IntegrationFieldData = {
|
|
27
|
+
id: string;
|
|
28
|
+
title: string;
|
|
29
|
+
description: string;
|
|
30
|
+
blob: Record<string, unknown>;
|
|
31
|
+
};
|
|
32
|
+
type IntegrationFieldConfig = {
|
|
33
|
+
name: string;
|
|
34
|
+
description: string;
|
|
35
|
+
customTypeId: string;
|
|
36
|
+
fieldId: string;
|
|
37
|
+
data: IntegrationFieldData[];
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
40
|
+
export { AuthConfig, IntegrationFieldConfig, IntegrationFieldData, ManageV2Config, SetupConfiguration, UrlConfig };
|
|
41
|
+
//# sourceMappingURL=types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";KAAY,SAAA;EAAA,uBAEX,OAAA;EAEA,cAAA,UAFA;EAIA,iBAAA;EAEA,YAAA,WAEA;EAAA,QAAA,UAEmB;EAAnB,mBAAA;AAAA;AAAA,KAGW,UAAA;EACX,KAAA;EACA,QAAQ;AAAA;AAAA,KAGG,cAAA;EACX,MAAA;EACA,QAAQ;AAAA;AAAA,KAIG,kBAAA;EAGX,SAAA,EAAW,SAAA;EACX,UAAA,EAAY,UAAA;EACZ,cAAA,GAAiB,cAAA;EACjB,OAAA;EACA,WAAA;EACA,uBAAA,GAA0B,sBAAA;AAAA;AAAA,KAGf,oBAAA;EACX,EAAA;EACA,KAAA;EACA,WAAA;EACA,IAAA,EAAM,MAAM;AAAA;AAAA,KAGD,sBAAA;EACX,IAAA;EACA,WAAA;EACA,YAAA;EACA,OAAA;EACA,IAAA,EAAM,oBAAoB;AAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,43 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
migrationApi?: string;
|
|
10
|
-
/** Asset api base url */
|
|
11
|
-
assetApi: string;
|
|
12
|
-
/** Integration fields api base url */
|
|
13
|
-
integrationFieldApi?: string;
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
type UrlConfig = {
|
|
3
|
+
/** Prismic base url */baseURL: string; /** Custom types api base url */
|
|
4
|
+
customTypesApi: string; /** Auth service api base url */
|
|
5
|
+
authenticationApi: string; /** Prismic migration api base url */
|
|
6
|
+
migrationApi?: string; /** Asset api base url */
|
|
7
|
+
assetApi: string; /** Integration fields api base url */
|
|
8
|
+
integrationFieldApi?: string;
|
|
14
9
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
type AuthConfig = {
|
|
11
|
+
email: string;
|
|
12
|
+
password: string;
|
|
18
13
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
type ManageV2Config = {
|
|
15
|
+
secret: string;
|
|
16
|
+
audience: string;
|
|
22
17
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
type SetupConfiguration = {
|
|
19
|
+
urlConfig: UrlConfig | string;
|
|
20
|
+
authConfig: AuthConfig;
|
|
21
|
+
manageV2Config?: ManageV2Config;
|
|
22
|
+
cluster?: string;
|
|
23
|
+
environment?: string;
|
|
24
|
+
integrationFieldsConfig?: IntegrationFieldConfig[];
|
|
30
25
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
type IntegrationFieldData = {
|
|
27
|
+
id: string;
|
|
28
|
+
title: string;
|
|
29
|
+
description: string;
|
|
30
|
+
blob: Record<string, unknown>;
|
|
36
31
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
type IntegrationFieldConfig = {
|
|
33
|
+
name: string;
|
|
34
|
+
description: string;
|
|
35
|
+
customTypeId: string;
|
|
36
|
+
fieldId: string;
|
|
37
|
+
data: IntegrationFieldData[];
|
|
43
38
|
};
|
|
39
|
+
//#endregion
|
|
40
|
+
export { AuthConfig, IntegrationFieldConfig, IntegrationFieldData, ManageV2Config, SetupConfiguration, UrlConfig };
|
|
41
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";KAAY,SAAA;EAAA,uBAEX,OAAA;EAEA,cAAA,UAFA;EAIA,iBAAA;EAEA,YAAA,WAEA;EAAA,QAAA,UAEmB;EAAnB,mBAAA;AAAA;AAAA,KAGW,UAAA;EACX,KAAA;EACA,QAAQ;AAAA;AAAA,KAGG,cAAA;EACX,MAAA;EACA,QAAQ;AAAA;AAAA,KAIG,kBAAA;EAGX,SAAA,EAAW,SAAA;EACX,UAAA,EAAY,UAAA;EACZ,cAAA,GAAiB,cAAA;EACjB,OAAA;EACA,WAAA;EACA,uBAAA,GAA0B,sBAAA;AAAA;AAAA,KAGf,oBAAA;EACX,EAAA;EACA,KAAA;EACA,WAAA;EACA,IAAA,EAAM,MAAM;AAAA;AAAA,KAGD,sBAAA;EACX,IAAA;EACA,WAAA;EACA,YAAA;EACA,OAAA;EACA,IAAA,EAAM,oBAAoB;AAAA"}
|
package/dist/utils/cookies.cjs
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/utils/cookies.ts
|
|
2
|
+
/**
|
|
3
|
+
* Extract the value of a specific cookie from Axios cookies.
|
|
4
|
+
*
|
|
5
|
+
* @param cookies - Axios cookies, can be a string or an array
|
|
6
|
+
* @param cookieName - The name of the cookie to extract.
|
|
7
|
+
*/
|
|
3
8
|
const extractCookie = (cookies, cookieName) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return match[1];
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return void 0;
|
|
9
|
+
const regex = new RegExp(`${cookieName}=([^;]+)`, "i");
|
|
10
|
+
if (typeof cookies === "string") {
|
|
11
|
+
const match = cookies.match(regex);
|
|
12
|
+
return match ? match[1] : void 0;
|
|
13
|
+
}
|
|
14
|
+
if (Array.isArray(cookies)) for (const cookie of cookies) {
|
|
15
|
+
const match = cookie.match(regex);
|
|
16
|
+
if (match) return match[1];
|
|
17
|
+
}
|
|
18
18
|
};
|
|
19
|
+
//#endregion
|
|
19
20
|
exports.extractCookie = extractCookie;
|
|
20
|
-
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=cookies.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookies.cjs","sources":["
|
|
1
|
+
{"version":3,"file":"cookies.cjs","names":[],"sources":["../../src/utils/cookies.ts"],"sourcesContent":["import type { AxiosHeaderValue } from \"axios\"\n\n/**\n * Extract the value of a specific cookie from Axios cookies.\n *\n * @param cookies - Axios cookies, can be a string or an array\n * @param cookieName - The name of the cookie to extract.\n */\nexport const extractCookie = (\n\tcookies: AxiosHeaderValue | undefined,\n\tcookieName: string,\n): string | undefined => {\n\tconst regex = new RegExp(`${cookieName}=([^;]+)`, \"i\") // 'i' flag for case-insensitivity\n\n\tif (typeof cookies === \"string\") {\n\t\tconst match = cookies.match(regex)\n\n\t\treturn match ? match[1] : undefined\n\t}\n\tif (Array.isArray(cookies)) {\n\t\tfor (const cookie of cookies) {\n\t\t\tconst match = cookie.match(regex)\n\t\t\tif (match) {\n\t\t\t\treturn match[1]\n\t\t\t}\n\t\t}\n\t}\n\n\treturn undefined\n}\n"],"mappings":";;;;;;;AAQA,MAAa,iBACZ,SACA,eACwB;CACxB,MAAM,QAAQ,IAAI,OAAO,GAAG,WAAW,WAAW,GAAG;CAErD,IAAI,OAAO,YAAY,UAAU;EAChC,MAAM,QAAQ,QAAQ,MAAM,KAAK;EAEjC,OAAO,QAAQ,MAAM,KAAK,KAAA;CAC3B;CACA,IAAI,MAAM,QAAQ,OAAO,GACxB,KAAK,MAAM,UAAU,SAAS;EAC7B,MAAM,QAAQ,OAAO,MAAM,KAAK;EAChC,IAAI,OACH,OAAO,MAAM;CAEf;AAIF"}
|
package/dist/utils/cookies.js
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
+
//#region src/utils/cookies.ts
|
|
2
|
+
/**
|
|
3
|
+
* Extract the value of a specific cookie from Axios cookies.
|
|
4
|
+
*
|
|
5
|
+
* @param cookies - Axios cookies, can be a string or an array
|
|
6
|
+
* @param cookieName - The name of the cookie to extract.
|
|
7
|
+
*/
|
|
1
8
|
const extractCookie = (cookies, cookieName) => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return match[1];
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return void 0;
|
|
9
|
+
const regex = new RegExp(`${cookieName}=([^;]+)`, "i");
|
|
10
|
+
if (typeof cookies === "string") {
|
|
11
|
+
const match = cookies.match(regex);
|
|
12
|
+
return match ? match[1] : void 0;
|
|
13
|
+
}
|
|
14
|
+
if (Array.isArray(cookies)) for (const cookie of cookies) {
|
|
15
|
+
const match = cookie.match(regex);
|
|
16
|
+
if (match) return match[1];
|
|
17
|
+
}
|
|
16
18
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
//# sourceMappingURL=cookies.js.map
|
|
19
|
+
//#endregion
|
|
20
|
+
export { extractCookie };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=cookies.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookies.js","sources":["
|
|
1
|
+
{"version":3,"file":"cookies.js","names":[],"sources":["../../src/utils/cookies.ts"],"sourcesContent":["import type { AxiosHeaderValue } from \"axios\"\n\n/**\n * Extract the value of a specific cookie from Axios cookies.\n *\n * @param cookies - Axios cookies, can be a string or an array\n * @param cookieName - The name of the cookie to extract.\n */\nexport const extractCookie = (\n\tcookies: AxiosHeaderValue | undefined,\n\tcookieName: string,\n): string | undefined => {\n\tconst regex = new RegExp(`${cookieName}=([^;]+)`, \"i\") // 'i' flag for case-insensitivity\n\n\tif (typeof cookies === \"string\") {\n\t\tconst match = cookies.match(regex)\n\n\t\treturn match ? match[1] : undefined\n\t}\n\tif (Array.isArray(cookies)) {\n\t\tfor (const cookie of cookies) {\n\t\t\tconst match = cookie.match(regex)\n\t\t\tif (match) {\n\t\t\t\treturn match[1]\n\t\t\t}\n\t\t}\n\t}\n\n\treturn undefined\n}\n"],"mappings":";;;;;;;AAQA,MAAa,iBACZ,SACA,eACwB;CACxB,MAAM,QAAQ,IAAI,OAAO,GAAG,WAAW,WAAW,GAAG;CAErD,IAAI,OAAO,YAAY,UAAU;EAChC,MAAM,QAAQ,QAAQ,MAAM,KAAK;EAEjC,OAAO,QAAQ,MAAM,KAAK,KAAA;CAC3B;CACA,IAAI,MAAM,QAAQ,OAAO,GACxB,KAAK,MAAM,UAAU,SAAS;EAC7B,MAAM,QAAQ,OAAO,MAAM,KAAK;EAChC,IAAI,OACH,OAAO,MAAM;CAEf;AAIF"}
|
|
@@ -1,36 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
//#region src/utils/envVariableManager.ts
|
|
2
|
+
/**
|
|
3
|
+
* Manage a list of strings within an environment variable. This is useful to share data across
|
|
4
|
+
* different test phases (setup, teardown, test execution) as most test frameworks run these in
|
|
5
|
+
* independent states
|
|
6
|
+
*/
|
|
7
|
+
var EnvVariableManager = class {
|
|
8
|
+
variableName;
|
|
9
|
+
constructor(variableName) {
|
|
10
|
+
this.variableName = variableName;
|
|
11
|
+
}
|
|
12
|
+
/** Add a string and persist it in the environment variable */
|
|
13
|
+
add(value) {
|
|
14
|
+
const existingValues = this.getAll();
|
|
15
|
+
existingValues.push(value);
|
|
16
|
+
this.setAll(existingValues);
|
|
17
|
+
}
|
|
18
|
+
/** Remove a string from the environment variable */
|
|
19
|
+
remove(value) {
|
|
20
|
+
const updatedValues = this.getAll().filter((item) => item !== value);
|
|
21
|
+
this.setAll(updatedValues);
|
|
22
|
+
}
|
|
23
|
+
/** Return all items stored in the environment variable */
|
|
24
|
+
getAll() {
|
|
25
|
+
const value = process.env[this.variableName] || "[]";
|
|
26
|
+
return JSON.parse(value);
|
|
27
|
+
}
|
|
28
|
+
setAll(values) {
|
|
29
|
+
process.env[this.variableName] = JSON.stringify(values);
|
|
30
|
+
}
|
|
7
31
|
};
|
|
8
|
-
|
|
9
|
-
class EnvVariableManager {
|
|
10
|
-
constructor(variableName) {
|
|
11
|
-
__publicField(this, "variableName");
|
|
12
|
-
this.variableName = variableName;
|
|
13
|
-
}
|
|
14
|
-
/** add a string and persist it in the environment variable */
|
|
15
|
-
add(value) {
|
|
16
|
-
const existingValues = this.getAll();
|
|
17
|
-
existingValues.push(value);
|
|
18
|
-
this.setAll(existingValues);
|
|
19
|
-
}
|
|
20
|
-
/** remove a string from the environment variable */
|
|
21
|
-
remove(value) {
|
|
22
|
-
const existingValues = this.getAll();
|
|
23
|
-
const updatedValues = existingValues.filter((item) => item !== value);
|
|
24
|
-
this.setAll(updatedValues);
|
|
25
|
-
}
|
|
26
|
-
/** return all items stored in the environment variable */
|
|
27
|
-
getAll() {
|
|
28
|
-
const value = process.env[this.variableName] || "[]";
|
|
29
|
-
return JSON.parse(value);
|
|
30
|
-
}
|
|
31
|
-
setAll(values) {
|
|
32
|
-
process.env[this.variableName] = JSON.stringify(values);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
32
|
+
//#endregion
|
|
35
33
|
exports.EnvVariableManager = EnvVariableManager;
|
|
36
|
-
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=envVariableManager.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envVariableManager.cjs","sources":["
|
|
1
|
+
{"version":3,"file":"envVariableManager.cjs","names":[],"sources":["../../src/utils/envVariableManager.ts"],"sourcesContent":["/**\n * Manage a list of strings within an environment variable. This is useful to share data across\n * different test phases (setup, teardown, test execution) as most test frameworks run these in\n * independent states\n */\nexport class EnvVariableManager {\n\tconstructor(private variableName: string) {}\n\n\t/** Add a string and persist it in the environment variable */\n\tadd(value: string): void {\n\t\tconst existingValues = this.getAll()\n\t\texistingValues.push(value)\n\n\t\tthis.setAll(existingValues)\n\t}\n\n\t/** Remove a string from the environment variable */\n\tremove(value: string): void {\n\t\tconst existingValues = this.getAll()\n\t\tconst updatedValues = existingValues.filter((item) => item !== value)\n\n\t\tthis.setAll(updatedValues)\n\t}\n\n\t/** Return all items stored in the environment variable */\n\tgetAll(): string[] {\n\t\tconst value = process.env[this.variableName] || \"[]\"\n\n\t\treturn JSON.parse(value)\n\t}\n\n\tprivate setAll(values: string[]): void {\n\t\tprocess.env[this.variableName] = JSON.stringify(values)\n\t}\n}\n"],"mappings":";;;;;;AAKA,IAAa,qBAAb,MAAgC;CACX;CAApB,YAAY,cAA8B;EAAtB,KAAA,eAAA;CAAuB;;CAG3C,IAAI,OAAqB;EACxB,MAAM,iBAAiB,KAAK,OAAO;EACnC,eAAe,KAAK,KAAK;EAEzB,KAAK,OAAO,cAAc;CAC3B;;CAGA,OAAO,OAAqB;EAE3B,MAAM,gBADiB,KAAK,OACO,CAAC,CAAC,QAAQ,SAAS,SAAS,KAAK;EAEpE,KAAK,OAAO,aAAa;CAC1B;;CAGA,SAAmB;EAClB,MAAM,QAAQ,QAAQ,IAAI,KAAK,iBAAiB;EAEhD,OAAO,KAAK,MAAM,KAAK;CACxB;CAEA,OAAe,QAAwB;EACtC,QAAQ,IAAI,KAAK,gBAAgB,KAAK,UAAU,MAAM;CACvD;AACD"}
|
|
@@ -1,36 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//#region src/utils/envVariableManager.ts
|
|
2
|
+
/**
|
|
3
|
+
* Manage a list of strings within an environment variable. This is useful to share data across
|
|
4
|
+
* different test phases (setup, teardown, test execution) as most test frameworks run these in
|
|
5
|
+
* independent states
|
|
6
|
+
*/
|
|
7
|
+
var EnvVariableManager = class {
|
|
8
|
+
variableName;
|
|
9
|
+
constructor(variableName) {
|
|
10
|
+
this.variableName = variableName;
|
|
11
|
+
}
|
|
12
|
+
/** Add a string and persist it in the environment variable */
|
|
13
|
+
add(value) {
|
|
14
|
+
const existingValues = this.getAll();
|
|
15
|
+
existingValues.push(value);
|
|
16
|
+
this.setAll(existingValues);
|
|
17
|
+
}
|
|
18
|
+
/** Remove a string from the environment variable */
|
|
19
|
+
remove(value) {
|
|
20
|
+
const updatedValues = this.getAll().filter((item) => item !== value);
|
|
21
|
+
this.setAll(updatedValues);
|
|
22
|
+
}
|
|
23
|
+
/** Return all items stored in the environment variable */
|
|
24
|
+
getAll() {
|
|
25
|
+
const value = process.env[this.variableName] || "[]";
|
|
26
|
+
return JSON.parse(value);
|
|
27
|
+
}
|
|
28
|
+
setAll(values) {
|
|
29
|
+
process.env[this.variableName] = JSON.stringify(values);
|
|
30
|
+
}
|
|
6
31
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
/** add a string and persist it in the environment variable */
|
|
13
|
-
add(value) {
|
|
14
|
-
const existingValues = this.getAll();
|
|
15
|
-
existingValues.push(value);
|
|
16
|
-
this.setAll(existingValues);
|
|
17
|
-
}
|
|
18
|
-
/** remove a string from the environment variable */
|
|
19
|
-
remove(value) {
|
|
20
|
-
const existingValues = this.getAll();
|
|
21
|
-
const updatedValues = existingValues.filter((item) => item !== value);
|
|
22
|
-
this.setAll(updatedValues);
|
|
23
|
-
}
|
|
24
|
-
/** return all items stored in the environment variable */
|
|
25
|
-
getAll() {
|
|
26
|
-
const value = process.env[this.variableName] || "[]";
|
|
27
|
-
return JSON.parse(value);
|
|
28
|
-
}
|
|
29
|
-
setAll(values) {
|
|
30
|
-
process.env[this.variableName] = JSON.stringify(values);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
export {
|
|
34
|
-
EnvVariableManager
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=envVariableManager.js.map
|
|
32
|
+
//#endregion
|
|
33
|
+
export { EnvVariableManager };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=envVariableManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envVariableManager.js","sources":["
|
|
1
|
+
{"version":3,"file":"envVariableManager.js","names":[],"sources":["../../src/utils/envVariableManager.ts"],"sourcesContent":["/**\n * Manage a list of strings within an environment variable. This is useful to share data across\n * different test phases (setup, teardown, test execution) as most test frameworks run these in\n * independent states\n */\nexport class EnvVariableManager {\n\tconstructor(private variableName: string) {}\n\n\t/** Add a string and persist it in the environment variable */\n\tadd(value: string): void {\n\t\tconst existingValues = this.getAll()\n\t\texistingValues.push(value)\n\n\t\tthis.setAll(existingValues)\n\t}\n\n\t/** Remove a string from the environment variable */\n\tremove(value: string): void {\n\t\tconst existingValues = this.getAll()\n\t\tconst updatedValues = existingValues.filter((item) => item !== value)\n\n\t\tthis.setAll(updatedValues)\n\t}\n\n\t/** Return all items stored in the environment variable */\n\tgetAll(): string[] {\n\t\tconst value = process.env[this.variableName] || \"[]\"\n\n\t\treturn JSON.parse(value)\n\t}\n\n\tprivate setAll(values: string[]): void {\n\t\tprocess.env[this.variableName] = JSON.stringify(values)\n\t}\n}\n"],"mappings":";;;;;;AAKA,IAAa,qBAAb,MAAgC;CACX;CAApB,YAAY,cAA8B;EAAtB,KAAA,eAAA;CAAuB;;CAG3C,IAAI,OAAqB;EACxB,MAAM,iBAAiB,KAAK,OAAO;EACnC,eAAe,KAAK,KAAK;EAEzB,KAAK,OAAO,cAAc;CAC3B;;CAGA,OAAO,OAAqB;EAE3B,MAAM,gBADiB,KAAK,OACO,CAAC,CAAC,QAAQ,SAAS,SAAS,KAAK;EAEpE,KAAK,OAAO,aAAa;CAC1B;;CAGA,SAAmB;EAClB,MAAM,QAAQ,QAAQ,IAAI,KAAK,iBAAiB;EAEhD,OAAO,KAAK,MAAM,KAAK;CACxB;CAEA,OAAe,QAAwB;EACtC,QAAQ,IAAI,KAAK,gBAAgB,KAAK,UAAU,MAAM;CACvD;AACD"}
|