@prismicio/e2e-tests-utils 1.19.0 → 1.20.0-pr.40.f652adb
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/dist/clients/contentApi.cjs.map +1 -1
- package/dist/clients/contentApi.d.cts.map +1 -1
- package/dist/clients/contentApi.d.ts.map +1 -1
- package/dist/clients/contentApi.js.map +1 -1
- package/dist/clients/coreApi.cjs +31 -0
- package/dist/clients/coreApi.cjs.map +1 -1
- package/dist/clients/coreApi.d.cts +22 -1
- package/dist/clients/coreApi.d.cts.map +1 -1
- package/dist/clients/coreApi.d.ts +22 -1
- package/dist/clients/coreApi.d.ts.map +1 -1
- package/dist/clients/coreApi.js +31 -0
- package/dist/clients/coreApi.js.map +1 -1
- package/dist/clients/customTypesApi.cjs.map +1 -1
- package/dist/clients/customTypesApi.d.cts.map +1 -1
- package/dist/clients/customTypesApi.d.ts.map +1 -1
- package/dist/clients/customTypesApi.js.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/managers/repository.cjs +74 -8
- package/dist/managers/repository.cjs.map +1 -1
- package/dist/managers/repository.d.cts +34 -1
- package/dist/managers/repository.d.cts.map +1 -1
- package/dist/managers/repository.d.ts +34 -1
- package/dist/managers/repository.d.ts.map +1 -1
- package/dist/managers/repository.js +74 -8
- package/dist/managers/repository.js.map +1 -1
- package/package.json +1 -1
- package/src/clients/contentApi.ts +3 -1
- package/src/clients/coreApi.ts +53 -0
- package/src/clients/customTypesApi.ts +3 -1
- package/src/managers/repository.ts +109 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contentApi.cjs","names":["AuthenticatedApiClient"],"sources":["../../src/clients/contentApi.ts"],"sourcesContent":["import type { APIResponse } from \"@playwright/test\"\n\nimport { AuthenticatedApiClient } from \"./apiClient\"\n\nexport interface ContentApiError {\n\ttype: string\n\tmessage: string\n}\nexport interface ContentApiSearchResponse {\n\tpage: number\n\tresults_per_page: number\n\tresults_size: number\n\ttotal_results_size: number\n\ttotal_pages: number\n\tnext_page: string | null\n\tprev_page: string | null\n\tresults: ContentApiDocument[]\n}\n\nexport interface ContentApiDocument {\n\tid: string\n\tuid: string | null\n\turl: string | null\n\ttype: string\n\thref: string\n\ttags: string[]\n\tfirst_publication_date: string\n\tlast_publication_date: string\n\tslugs: string[]\n\tlinked_documents: unknown[]\n\tlang: string\n\talternate_languages: ContentApiAlternateLanguage[]\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tdata: Record<string, any>\n}\n\nexport interface ContentApiGraphQLResponse {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tdata: Record<string, any>\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\terrors?: { message: string; locations: any }[]\n}\n\nexport interface ContentApiRef {\n\tid: string\n\tref: string\n\tlabel: string\n\tisMasterRef?: boolean\n\tscheduledAt?: number | undefined\n}\n\ninterface ContentApiAlternateLanguage {\n\tid: string\n\ttype: string\n\tlang: string\n\tuid?: string\n}\n\ninterface ContentApiRepoConfigResponse {\n\trefs: ContentApiRef[]\n\tbookmarks: Record<string, unknown>\n\ttypes: Record<string, string>\n\tlanguages: {\n\t\tid: string\n\t\tname: string\n\t\tis_master: boolean\n\t}[]\n\toauth_initiate: string\n\toauth_token: string\n\ttags: string[]\n\tlicense: string\n\tversion: string\n}\n\ntype SearchQueryParams = {\n\tref?: string\n\tquery?: string\n\tq?: string\n\tgraphQuery?: string\n\tfetchLinks?: string\n\torderings?: string\n\tpageSize?: number\n\tpage?: number\n\tlang?: string\n\tafter?: string\n\troutes?: string\n}\n\ntype ApiVersions = \"v1\" | \"v2\"\n\n/**\n * Client to query the Prismic content api. Uses Playwright to benefit from network request traces\n * in your reports. See api docs: https://prismic.io/docs/rest-api-technical-reference\n */\nexport class ContentApiClient extends AuthenticatedApiClient {\n\tprivate version: ApiVersions\n\tprivate accessToken: string | undefined\n\n\t/**\n\t * @example\n\t * \tTo instantiate the class:\n\t *\n\t * \t```js\n\t * \tnew ContentApiClient(\"https://my-repo.cdn.prismic.io\", {\n\t * \tversion: \"v2\",\n\t * \taccessToken: \"my-secret-token\",\n\t * \t});\n\t * \t```\n\t *\n\t * @param baseURL - The api base URL like https://my-repo.cdn.prismic.io\n\t * @param config - Optional configuration\n\t *\n\t * - {@link config.version}: Api version, default is \"v2\"\n\t * - {@link config.accessToken}: Access token for the content api -\n\t * https://prismic.io/docs/access-token\n\t */\n\tconstructor(baseURL: string, config: { version?: ApiVersions; accessToken?: string } = {}) {\n\t\t// Use an empty string as Authorization header in case it is already set globally in the project Playwright config file.\n\t\t// This is because the content api returns an error in case it gets an non-empty invalid Authorization\n\t\t// even though it actually checks authorization from the access_token query parameter.\n\t\tsuper(baseURL, config.accessToken || \"\")\n\t\tthis.version = config.version || \"v2\"\n\t\tthis.accessToken = config.accessToken\n\t}\n\n\tasync get(\n\t\tpath: string,\n\t\tparams?: SearchQueryParams,\n\t\theaders?: Record<string, string>,\n\t): Promise<APIResponse> {\n\t\tconst context = await this.getContext()\n\t\tconst securityParams = this.accessToken
|
|
1
|
+
{"version":3,"file":"contentApi.cjs","names":["AuthenticatedApiClient"],"sources":["../../src/clients/contentApi.ts"],"sourcesContent":["import type { APIResponse } from \"@playwright/test\"\n\nimport { AuthenticatedApiClient } from \"./apiClient\"\n\nexport interface ContentApiError {\n\ttype: string\n\tmessage: string\n}\nexport interface ContentApiSearchResponse {\n\tpage: number\n\tresults_per_page: number\n\tresults_size: number\n\ttotal_results_size: number\n\ttotal_pages: number\n\tnext_page: string | null\n\tprev_page: string | null\n\tresults: ContentApiDocument[]\n}\n\nexport interface ContentApiDocument {\n\tid: string\n\tuid: string | null\n\turl: string | null\n\ttype: string\n\thref: string\n\ttags: string[]\n\tfirst_publication_date: string\n\tlast_publication_date: string\n\tslugs: string[]\n\tlinked_documents: unknown[]\n\tlang: string\n\talternate_languages: ContentApiAlternateLanguage[]\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tdata: Record<string, any>\n}\n\nexport interface ContentApiGraphQLResponse {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tdata: Record<string, any>\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\terrors?: { message: string; locations: any }[]\n}\n\nexport interface ContentApiRef {\n\tid: string\n\tref: string\n\tlabel: string\n\tisMasterRef?: boolean\n\tscheduledAt?: number | undefined\n}\n\ninterface ContentApiAlternateLanguage {\n\tid: string\n\ttype: string\n\tlang: string\n\tuid?: string\n}\n\ninterface ContentApiRepoConfigResponse {\n\trefs: ContentApiRef[]\n\tbookmarks: Record<string, unknown>\n\ttypes: Record<string, string>\n\tlanguages: {\n\t\tid: string\n\t\tname: string\n\t\tis_master: boolean\n\t}[]\n\toauth_initiate: string\n\toauth_token: string\n\ttags: string[]\n\tlicense: string\n\tversion: string\n}\n\ntype SearchQueryParams = {\n\tref?: string\n\tquery?: string\n\tq?: string\n\tgraphQuery?: string\n\tfetchLinks?: string\n\torderings?: string\n\tpageSize?: number\n\tpage?: number\n\tlang?: string\n\tafter?: string\n\troutes?: string\n}\n\ntype ApiVersions = \"v1\" | \"v2\"\n\n/**\n * Client to query the Prismic content api. Uses Playwright to benefit from network request traces\n * in your reports. See api docs: https://prismic.io/docs/rest-api-technical-reference\n */\nexport class ContentApiClient extends AuthenticatedApiClient {\n\tprivate version: ApiVersions\n\tprivate accessToken: string | undefined\n\n\t/**\n\t * @example\n\t * \tTo instantiate the class:\n\t *\n\t * \t```js\n\t * \tnew ContentApiClient(\"https://my-repo.cdn.prismic.io\", {\n\t * \tversion: \"v2\",\n\t * \taccessToken: \"my-secret-token\",\n\t * \t});\n\t * \t```\n\t *\n\t * @param baseURL - The api base URL like https://my-repo.cdn.prismic.io\n\t * @param config - Optional configuration\n\t *\n\t * - {@link config.version}: Api version, default is \"v2\"\n\t * - {@link config.accessToken}: Access token for the content api -\n\t * https://prismic.io/docs/access-token\n\t */\n\tconstructor(baseURL: string, config: { version?: ApiVersions; accessToken?: string } = {}) {\n\t\t// Use an empty string as Authorization header in case it is already set globally in the project Playwright config file.\n\t\t// This is because the content api returns an error in case it gets an non-empty invalid Authorization\n\t\t// even though it actually checks authorization from the access_token query parameter.\n\t\tsuper(baseURL, config.accessToken || \"\")\n\t\tthis.version = config.version || \"v2\"\n\t\tthis.accessToken = config.accessToken\n\t}\n\n\tasync get(\n\t\tpath: string,\n\t\tparams?: SearchQueryParams,\n\t\theaders?: Record<string, string>,\n\t): Promise<APIResponse> {\n\t\tconst context = await this.getContext()\n\t\tconst securityParams = this.accessToken\n\t\t\t? { access_token: this.accessToken }\n\t\t\t: ({} as Record<string, never>)\n\n\t\treturn context.get(path, {\n\t\t\tparams: { ...securityParams, ...params },\n\t\t\theaders,\n\t\t})\n\t}\n\n\tasync getAsJson<T>(\n\t\turl: string,\n\t\tparams?: SearchQueryParams,\n\t\theaders?: Record<string, string>,\n\t): Promise<T> {\n\t\tconst response = await this.get(url, params, headers)\n\n\t\treturn response.json() as T\n\t}\n\n\t/** Query the graphql api - https://prismic.io/docs/graphql-technical-reference */\n\tasync graphql(ref: string, query: string): Promise<ContentApiGraphQLResponse> {\n\t\treturn this.getAsJson<ContentApiGraphQLResponse>(\"graphql\", { query }, { \"Prismic-ref\": ref })\n\t}\n\n\tasync getRefs(): Promise<ContentApiRef[]> {\n\t\tconst data = await this.getAsJson<ContentApiRepoConfigResponse>(`api/${this.version}`)\n\n\t\treturn data.refs\n\t}\n\n\tasync getMasterRef(): Promise<string> {\n\t\tconst refs = await this.getRefs()\n\n\t\tconst masterRef = refs.find(({ isMasterRef }) => isMasterRef === true)\n\t\tif (!masterRef) {\n\t\t\tthrow \"No master ref found\"\n\t\t}\n\n\t\treturn masterRef.ref\n\t}\n\n\tasync getRefByReleaseID(releaseID: string): Promise<string> {\n\t\tconst refs = await this.getRefs()\n\t\tconst release = refs.find(({ id }) => id === releaseID)\n\t\tif (!release) {\n\t\t\tthrow `No ref found for release ${releaseID}`\n\t\t}\n\n\t\treturn release.ref\n\t}\n\n\t/** Search documents from the `/api/v<version>/documents/search` endpoint. */\n\tasync search(filters?: SearchQueryParams): Promise<ContentApiSearchResponse> {\n\t\tlet ref = filters?.ref\n\t\tif (!ref) {\n\t\t\tref = await this.getMasterRef()\n\t\t}\n\n\t\treturn this.getAsJson<ContentApiSearchResponse>(`api/${this.version}/documents/search`, {\n\t\t\t...filters,\n\t\t\tref,\n\t\t})\n\t}\n\n\t/**\n\t * Search for a single document by its it, using the `/api/v<version>/documents/search` endpoint\n\t * and a default filter.\n\t */\n\tasync searchByID(id: string, filters?: SearchQueryParams): Promise<ContentApiSearchResponse> {\n\t\treturn this.search({ ...filters, q: `[[at(document.id, \"${id}\")]]` })\n\t}\n\n\t/** Retrieve a single document or undefined if not found. */\n\tasync getDocumentByID(\n\t\tid: string,\n\t\tfilters?: SearchQueryParams,\n\t): Promise<ContentApiDocument | undefined> {\n\t\tconst data = await this.searchByID(id, filters)\n\t\tswitch (data.results_size) {\n\t\t\tcase 0:\n\t\t\t\treturn\n\t\t\tcase 1:\n\t\t\t\treturn data.results[0]\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`Too many documents returned with the same id ${id}`)\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;AA8FA,IAAa,mBAAb,cAAsCA,kBAAAA,uBAAuB;CAC5D;CACA;;;;;;;;;;;;;;;;;;;CAoBA,YAAY,SAAiB,SAA0D,CAAC,GAAG;EAI1F,MAAM,SAAS,OAAO,eAAe,EAAE;EACvC,KAAK,UAAU,OAAO,WAAW;EACjC,KAAK,cAAc,OAAO;CAC3B;CAEA,MAAM,IACL,MACA,QACA,SACuB;EACvB,MAAM,UAAU,MAAM,KAAK,WAAW;EACtC,MAAM,iBAAiB,KAAK,cACzB,EAAE,cAAc,KAAK,YAAY,IAChC,CAAC;EAEL,OAAO,QAAQ,IAAI,MAAM;GACxB,QAAQ;IAAE,GAAG;IAAgB,GAAG;GAAO;GACvC;EACD,CAAC;CACF;CAEA,MAAM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entApi.ts"],"mappings":";;;;UAIiB,eAAA;EAChB,IAAA;EACA,OAAO;AAAA;AAAA,UAES,wBAAA;EAChB,IAAA;EACA,gBAAA;EACA,YAAA;EACA,kBAAA;EACA,WAAA;EACA,SAAA;EACA,SAAA;EACA,OAAA,EAAS,kBAAkB;AAAA;AAAA,UAGX,kBAAA;EAChB,EAAA;EACA,GAAA;EACA,GAAA;EACA,IAAA;EACA,IAAA;EACA,IAAA;EACA,sBAAA;EACA,qBAAA;EACA,KAAA;EACA,gBAAA;EACA,IAAA;EACA,mBAAA,EAAqB,2BAAA;EAErB,IAAA,EAAM,MAAM;AAAA;AAAA,UAGI,yBAAA;EAEhB,IAAA,EAAM,MAAM;EAEZ,MAAA;IAAW,OAAA;IAAiB,SAAA;EAAA;AAAA;AAAA,UAGZ,aAAA;EAChB,EAAA;EACA,GAAA;EACA,KAAA;EACA,WAAA;EACA,WAAA;AAAA;AAAA,UAGS,2BAAA;EACT,EAAA;EACA,IAAA;EACA,IAAA;EACA,GAAA;AAAA;AAAA,KAmBI,iBAAA;EACJ,GAAA;EACA,KAAA;EACA,CAAA;EACA,UAAA;EACA,UAAA;EACA,SAAA;EACA,QAAA;EACA,IAAA;EACA,IAAA;EACA,KAAA;EACA,MAAA;AAAA;AAAA,KAGI,WAAA;;AAxCO;AACX;;cA6CY,gBAAA,SAAyB,sBAAA;EAAA,QAC7B,OAAA;EAAA,QACA,WAAA;EA3CR;;;;AAEG;AAAA;;;;;;;;;;;;;cA6DS,OAAA,UAAiB,MAAA;IAAU,OAAA,GAAU,WAAA;IAAa,WAAA;EAAA;EASxD,GAAA,CACL,IAAA,UACA,MAAA,GAAS,iBAAA,EACT,OAAA,GAAU,MAAA,mBACR,OAAA,CAAQ,WAAA;
|
|
1
|
+
{"version":3,"file":"contentApi.d.cts","names":[],"sources":["../../src/clients/contentApi.ts"],"mappings":";;;;UAIiB,eAAA;EAChB,IAAA;EACA,OAAO;AAAA;AAAA,UAES,wBAAA;EAChB,IAAA;E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AAA;EA3CR;;;;AAEG;AAAA;;;;;;;;;;;;;cA6DS,OAAA,UAAiB,MAAA;IAAU,OAAA,GAAU,WAAA;IAAa,WAAA;EAAA;EASxD,GAAA,CACL,IAAA,UACA,MAAA,GAAS,iBAAA,EACT,OAAA,GAAU,MAAA,mBACR,OAAA,CAAQ,WAAA;
|
|
1
|
+
{"version":3,"file":"contentApi.d.ts","names":[],"sources":["../../src/clients/contentApi.ts"],"mappings":";;;;UAIiB,eAAA;EAChB,IAAA;EACA,OAAO;AAAA;AAAA,UAES,wBAAA;EAChB,IAAA;EACA,gBAAA;EACA,YAAA;EACA,kBAAA;EACA,WAAA;EACA,SAAA;EACA,SAAA;EACA,OAAA,EAAS,kBAAkB;AAAA;AAAA,UAGX,kBAAA;EAChB,EAAA;EACA,GAAA;EACA,GAAA;EACA,IAAA;EACA,IAAA;EACA,IAAA;EACA,sBAAA;EACA,qBAAA;EACA,KAAA;EACA,gBAAA;EACA,IAAA;EACA,mBAAA,EAAqB,2BAAA;EAErB,IAAA,EAAM,MAAM;AAAA;AAAA,UAGI,yBAAA;EAEhB,IAAA,EAAM,MAAM;EAEZ,MAAA;IAAW,OAAA;IAAiB,SAAA;EAAA;AAAA;AAAA,UAGZ,aAAA;EAChB,EAAA;EACA,GAAA;EACA,KAAA;EACA,WAAA;EACA,WAAA;AAAA;AAAA,UAGS,2BAAA;EACT,EAAA;EACA,IAAA;EACA,IAAA;EACA,GAAA;AAAA;AAAA,KAmBI,iBAAA;EACJ,GAAA;EACA,KAAA;EACA,CAAA;EACA,UAAA;EACA,UAAA;EACA,SAAA;EACA,QAAA;EACA,IAAA;EACA,IAAA;EACA,KAAA;EACA,MAAA;AAAA;AAAA,KAGI,WAAA;;AAxCO;AACX;;cA6CY,gBAAA,SAAyB,sBAAA;EAAA,QAC7B,OAAA;EAAA,QACA,WAAA;EA3CR;;;;AAEG;AAAA;;;;;;;;;;;;;cA6DS,OAAA,UAAiB,MAAA;IAAU,OAAA,GAAU,WAAA;IAAa,WAAA;EAAA;EASxD,GAAA,CACL,IAAA,UACA,MAAA,GAAS,iBAAA,EACT,OAAA,GAAU,MAAA,mBACR,OAAA,CAAQ,WAAA;EAYL,SAAA,IACL,GAAA,UACA,MAAA,GAAS,iBAAA,EACT,OAAA,GAAU,MAAA,mBACR,OAAA,CAAQ,CAAA;;EAOL,OAAA,CAAQ,GAAA,UAAa,KAAA,WAAgB,OAAA,CAAQ,yBAAA;EAI7C,OAAA,IAAW,OAAA,CAAQ,aAAA;EAMnB,YAAA,IAAgB,OAAA;EAWhB,iBAAA,CAAkB,SAAA,WAAoB,OAAA;EA/Ef;EA0FvB,MAAA,CAAO,OAAA,GAAU,iBAAA,GAAoB,OAAA,CAAQ,wBAAA;EAzDzC;;;;EAyEJ,UAAA,CAAW,EAAA,UAAY,OAAA,GAAU,iBAAA,GAAoB,OAAA,CAAQ,wBAAA;EAxDxD;EA6DL,eAAA,CACL,EAAA,UACA,OAAA,GAAU,iBAAA,GACR,OAAA,CAAQ,kBAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contentApi.js","names":[],"sources":["../../src/clients/contentApi.ts"],"sourcesContent":["import type { APIResponse } from \"@playwright/test\"\n\nimport { AuthenticatedApiClient } from \"./apiClient\"\n\nexport interface ContentApiError {\n\ttype: string\n\tmessage: string\n}\nexport interface ContentApiSearchResponse {\n\tpage: number\n\tresults_per_page: number\n\tresults_size: number\n\ttotal_results_size: number\n\ttotal_pages: number\n\tnext_page: string | null\n\tprev_page: string | null\n\tresults: ContentApiDocument[]\n}\n\nexport interface ContentApiDocument {\n\tid: string\n\tuid: string | null\n\turl: string | null\n\ttype: string\n\thref: string\n\ttags: string[]\n\tfirst_publication_date: string\n\tlast_publication_date: string\n\tslugs: string[]\n\tlinked_documents: unknown[]\n\tlang: string\n\talternate_languages: ContentApiAlternateLanguage[]\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tdata: Record<string, any>\n}\n\nexport interface ContentApiGraphQLResponse {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tdata: Record<string, any>\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\terrors?: { message: string; locations: any }[]\n}\n\nexport interface ContentApiRef {\n\tid: string\n\tref: string\n\tlabel: string\n\tisMasterRef?: boolean\n\tscheduledAt?: number | undefined\n}\n\ninterface ContentApiAlternateLanguage {\n\tid: string\n\ttype: string\n\tlang: string\n\tuid?: string\n}\n\ninterface ContentApiRepoConfigResponse {\n\trefs: ContentApiRef[]\n\tbookmarks: Record<string, unknown>\n\ttypes: Record<string, string>\n\tlanguages: {\n\t\tid: string\n\t\tname: string\n\t\tis_master: boolean\n\t}[]\n\toauth_initiate: string\n\toauth_token: string\n\ttags: string[]\n\tlicense: string\n\tversion: string\n}\n\ntype SearchQueryParams = {\n\tref?: string\n\tquery?: string\n\tq?: string\n\tgraphQuery?: string\n\tfetchLinks?: string\n\torderings?: string\n\tpageSize?: number\n\tpage?: number\n\tlang?: string\n\tafter?: string\n\troutes?: string\n}\n\ntype ApiVersions = \"v1\" | \"v2\"\n\n/**\n * Client to query the Prismic content api. Uses Playwright to benefit from network request traces\n * in your reports. See api docs: https://prismic.io/docs/rest-api-technical-reference\n */\nexport class ContentApiClient extends AuthenticatedApiClient {\n\tprivate version: ApiVersions\n\tprivate accessToken: string | undefined\n\n\t/**\n\t * @example\n\t * \tTo instantiate the class:\n\t *\n\t * \t```js\n\t * \tnew ContentApiClient(\"https://my-repo.cdn.prismic.io\", {\n\t * \tversion: \"v2\",\n\t * \taccessToken: \"my-secret-token\",\n\t * \t});\n\t * \t```\n\t *\n\t * @param baseURL - The api base URL like https://my-repo.cdn.prismic.io\n\t * @param config - Optional configuration\n\t *\n\t * - {@link config.version}: Api version, default is \"v2\"\n\t * - {@link config.accessToken}: Access token for the content api -\n\t * https://prismic.io/docs/access-token\n\t */\n\tconstructor(baseURL: string, config: { version?: ApiVersions; accessToken?: string } = {}) {\n\t\t// Use an empty string as Authorization header in case it is already set globally in the project Playwright config file.\n\t\t// This is because the content api returns an error in case it gets an non-empty invalid Authorization\n\t\t// even though it actually checks authorization from the access_token query parameter.\n\t\tsuper(baseURL, config.accessToken || \"\")\n\t\tthis.version = config.version || \"v2\"\n\t\tthis.accessToken = config.accessToken\n\t}\n\n\tasync get(\n\t\tpath: string,\n\t\tparams?: SearchQueryParams,\n\t\theaders?: Record<string, string>,\n\t): Promise<APIResponse> {\n\t\tconst context = await this.getContext()\n\t\tconst securityParams = this.accessToken
|
|
1
|
+
{"version":3,"file":"contentApi.js","names":[],"sources":["../../src/clients/contentApi.ts"],"sourcesContent":["import type { APIResponse } from \"@playwright/test\"\n\nimport { AuthenticatedApiClient } from \"./apiClient\"\n\nexport interface ContentApiError {\n\ttype: string\n\tmessage: string\n}\nexport interface ContentApiSearchResponse {\n\tpage: number\n\tresults_per_page: number\n\tresults_size: number\n\ttotal_results_size: number\n\ttotal_pages: number\n\tnext_page: string | null\n\tprev_page: string | null\n\tresults: ContentApiDocument[]\n}\n\nexport interface ContentApiDocument {\n\tid: string\n\tuid: string | null\n\turl: string | null\n\ttype: string\n\thref: string\n\ttags: string[]\n\tfirst_publication_date: string\n\tlast_publication_date: string\n\tslugs: string[]\n\tlinked_documents: unknown[]\n\tlang: string\n\talternate_languages: ContentApiAlternateLanguage[]\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tdata: Record<string, any>\n}\n\nexport interface ContentApiGraphQLResponse {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tdata: Record<string, any>\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\terrors?: { message: string; locations: any }[]\n}\n\nexport interface ContentApiRef {\n\tid: string\n\tref: string\n\tlabel: string\n\tisMasterRef?: boolean\n\tscheduledAt?: number | undefined\n}\n\ninterface ContentApiAlternateLanguage {\n\tid: string\n\ttype: string\n\tlang: string\n\tuid?: string\n}\n\ninterface ContentApiRepoConfigResponse {\n\trefs: ContentApiRef[]\n\tbookmarks: Record<string, unknown>\n\ttypes: Record<string, string>\n\tlanguages: {\n\t\tid: string\n\t\tname: string\n\t\tis_master: boolean\n\t}[]\n\toauth_initiate: string\n\toauth_token: string\n\ttags: string[]\n\tlicense: string\n\tversion: string\n}\n\ntype SearchQueryParams = {\n\tref?: string\n\tquery?: string\n\tq?: string\n\tgraphQuery?: string\n\tfetchLinks?: string\n\torderings?: string\n\tpageSize?: number\n\tpage?: number\n\tlang?: string\n\tafter?: string\n\troutes?: string\n}\n\ntype ApiVersions = \"v1\" | \"v2\"\n\n/**\n * Client to query the Prismic content api. Uses Playwright to benefit from network request traces\n * in your reports. See api docs: https://prismic.io/docs/rest-api-technical-reference\n */\nexport class ContentApiClient extends AuthenticatedApiClient {\n\tprivate version: ApiVersions\n\tprivate accessToken: string | undefined\n\n\t/**\n\t * @example\n\t * \tTo instantiate the class:\n\t *\n\t * \t```js\n\t * \tnew ContentApiClient(\"https://my-repo.cdn.prismic.io\", {\n\t * \tversion: \"v2\",\n\t * \taccessToken: \"my-secret-token\",\n\t * \t});\n\t * \t```\n\t *\n\t * @param baseURL - The api base URL like https://my-repo.cdn.prismic.io\n\t * @param config - Optional configuration\n\t *\n\t * - {@link config.version}: Api version, default is \"v2\"\n\t * - {@link config.accessToken}: Access token for the content api -\n\t * https://prismic.io/docs/access-token\n\t */\n\tconstructor(baseURL: string, config: { version?: ApiVersions; accessToken?: string } = {}) {\n\t\t// Use an empty string as Authorization header in case it is already set globally in the project Playwright config file.\n\t\t// This is because the content api returns an error in case it gets an non-empty invalid Authorization\n\t\t// even though it actually checks authorization from the access_token query parameter.\n\t\tsuper(baseURL, config.accessToken || \"\")\n\t\tthis.version = config.version || \"v2\"\n\t\tthis.accessToken = config.accessToken\n\t}\n\n\tasync get(\n\t\tpath: string,\n\t\tparams?: SearchQueryParams,\n\t\theaders?: Record<string, string>,\n\t): Promise<APIResponse> {\n\t\tconst context = await this.getContext()\n\t\tconst securityParams = this.accessToken\n\t\t\t? { access_token: this.accessToken }\n\t\t\t: ({} as Record<string, never>)\n\n\t\treturn context.get(path, {\n\t\t\tparams: { ...securityParams, ...params },\n\t\t\theaders,\n\t\t})\n\t}\n\n\tasync getAsJson<T>(\n\t\turl: string,\n\t\tparams?: SearchQueryParams,\n\t\theaders?: Record<string, string>,\n\t): Promise<T> {\n\t\tconst response = await this.get(url, params, headers)\n\n\t\treturn response.json() as T\n\t}\n\n\t/** Query the graphql api - https://prismic.io/docs/graphql-technical-reference */\n\tasync graphql(ref: string, query: string): Promise<ContentApiGraphQLResponse> {\n\t\treturn this.getAsJson<ContentApiGraphQLResponse>(\"graphql\", { query }, { \"Prismic-ref\": ref })\n\t}\n\n\tasync getRefs(): Promise<ContentApiRef[]> {\n\t\tconst data = await this.getAsJson<ContentApiRepoConfigResponse>(`api/${this.version}`)\n\n\t\treturn data.refs\n\t}\n\n\tasync getMasterRef(): Promise<string> {\n\t\tconst refs = await this.getRefs()\n\n\t\tconst masterRef = refs.find(({ isMasterRef }) => isMasterRef === true)\n\t\tif (!masterRef) {\n\t\t\tthrow \"No master ref found\"\n\t\t}\n\n\t\treturn masterRef.ref\n\t}\n\n\tasync getRefByReleaseID(releaseID: string): Promise<string> {\n\t\tconst refs = await this.getRefs()\n\t\tconst release = refs.find(({ id }) => id === releaseID)\n\t\tif (!release) {\n\t\t\tthrow `No ref found for release ${releaseID}`\n\t\t}\n\n\t\treturn release.ref\n\t}\n\n\t/** Search documents from the `/api/v<version>/documents/search` endpoint. */\n\tasync search(filters?: SearchQueryParams): Promise<ContentApiSearchResponse> {\n\t\tlet ref = filters?.ref\n\t\tif (!ref) {\n\t\t\tref = await this.getMasterRef()\n\t\t}\n\n\t\treturn this.getAsJson<ContentApiSearchResponse>(`api/${this.version}/documents/search`, {\n\t\t\t...filters,\n\t\t\tref,\n\t\t})\n\t}\n\n\t/**\n\t * Search for a single document by its it, using the `/api/v<version>/documents/search` endpoint\n\t * and a default filter.\n\t */\n\tasync searchByID(id: string, filters?: SearchQueryParams): Promise<ContentApiSearchResponse> {\n\t\treturn this.search({ ...filters, q: `[[at(document.id, \"${id}\")]]` })\n\t}\n\n\t/** Retrieve a single document or undefined if not found. */\n\tasync getDocumentByID(\n\t\tid: string,\n\t\tfilters?: SearchQueryParams,\n\t): Promise<ContentApiDocument | undefined> {\n\t\tconst data = await this.searchByID(id, filters)\n\t\tswitch (data.results_size) {\n\t\t\tcase 0:\n\t\t\t\treturn\n\t\t\tcase 1:\n\t\t\t\treturn data.results[0]\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`Too many documents returned with the same id ${id}`)\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;AA8FA,IAAa,mBAAb,cAAsC,uBAAuB;CAC5D;CACA;;;;;;;;;;;;;;;;;;;CAoBA,YAAY,SAAiB,SAA0D,CAAC,GAAG;EAI1F,MAAM,SAAS,OAAO,eAAe,EAAE;EACvC,KAAK,UAAU,OAAO,WAAW;EACjC,KAAK,cAAc,OAAO;CAC3B;CAEA,MAAM,IACL,MACA,QACA,SACuB;EACvB,MAAM,UAAU,MAAM,KAAK,WAAW;EACtC,MAAM,iBAAiB,KAAK,cACzB,EAAE,cAAc,KAAK,YAAY,IAChC,CAAC;EAEL,OAAO,QAAQ,IAAI,MAAM;GACxB,QAAQ;IAAE,GAAG;IAAgB,GAAG;GAAO;GACvC;EACD,CAAC;CACF;CAEA,MAAM,UACL,KACA,QACA,SACa;EAGb,QAAO,MAFgB,KAAK,IAAI,KAAK,QAAQ,OAAO,EAAA,CAEpC,KAAK;CACtB;;CAGA,MAAM,QAAQ,KAAa,OAAmD;EAC7E,OAAO,KAAK,UAAqC,WAAW,EAAE,MAAM,GAAG,EAAE,eAAe,IAAI,CAAC;CAC9F;CAEA,MAAM,UAAoC;EAGzC,QAAO,MAFY,KAAK,UAAwC,OAAO,KAAK,SAAS,EAAA,CAEzE;CACb;CAEA,MAAM,eAAgC;EAGrC,MAAM,aAAY,MAFC,KAAK,QAAQ,EAAA,CAET,MAAM,EAAE,kBAAkB,gBAAgB,IAAI;EACrE,IAAI,CAAC,WACJ,MAAM;EAGP,OAAO,UAAU;CAClB;CAEA,MAAM,kBAAkB,WAAoC;EAE3D,MAAM,WAAU,MADG,KAAK,QAAQ,EAAA,CACX,MAAM,EAAE,SAAS,OAAO,SAAS;EACtD,IAAI,CAAC,SACJ,MAAM,4BAA4B;EAGnC,OAAO,QAAQ;CAChB;;CAGA,MAAM,OAAO,SAAgE;EAC5E,IAAI,MAAM,SAAS;EACnB,IAAI,CAAC,KACJ,MAAM,MAAM,KAAK,aAAa;EAG/B,OAAO,KAAK,UAAoC,OAAO,KAAK,QAAQ,oBAAoB;GACvF,GAAG;GACH;EACD,CAAC;CACF;;;;;CAMA,MAAM,WAAW,IAAY,SAAgE;EAC5F,OAAO,KAAK,OAAO;GAAE,GAAG;GAAS,GAAG,sBAAsB,GAAG;EAAM,CAAC;CACrE;;CAGA,MAAM,gBACL,IACA,SAC0C;EAC1C,MAAM,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO;EAC9C,QAAQ,KAAK,cAAb;GACC,KAAK,GACJ;GACD,KAAK,GACJ,OAAO,KAAK,QAAQ;GACrB,SACC,MAAM,IAAI,MAAM,gDAAgD,IAAI;EACtE;CACD;AACD"}
|
package/dist/clients/coreApi.cjs
CHANGED
|
@@ -54,6 +54,25 @@ var CoreApiClient = class extends require_apiClient.AuthenticatedApiClient {
|
|
|
54
54
|
}
|
|
55
55
|
return result.json();
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Creates a new draft version of an existing document, on top of the given base version.
|
|
59
|
+
*
|
|
60
|
+
* @param documentId - The id of the document to update.
|
|
61
|
+
* @param data - The new version payload in the core api format.
|
|
62
|
+
* @param baseVersionId - The id of the version the draft is created from.
|
|
63
|
+
* @returns The updated document, including the new version's id.
|
|
64
|
+
*/
|
|
65
|
+
async updateDraft(documentId, data, baseVersionId) {
|
|
66
|
+
const result = await (await this.getContext()).put(`core/documents/${documentId}/draft`, {
|
|
67
|
+
params: { base_version_id: baseVersionId },
|
|
68
|
+
data
|
|
69
|
+
});
|
|
70
|
+
if (200 !== result.status()) {
|
|
71
|
+
await require_log.logPlaywrightApiResponse(result);
|
|
72
|
+
throw new Error(`Could not update draft for document with id ${documentId}`);
|
|
73
|
+
}
|
|
74
|
+
return result.json();
|
|
75
|
+
}
|
|
57
76
|
async publishDraft(documentId) {
|
|
58
77
|
const result = await (await this.getContext()).patch(`core/documents/${documentId}/draft`, { data: { status: "published" } });
|
|
59
78
|
if (204 !== result.status()) {
|
|
@@ -62,6 +81,18 @@ var CoreApiClient = class extends require_apiClient.AuthenticatedApiClient {
|
|
|
62
81
|
}
|
|
63
82
|
}
|
|
64
83
|
/**
|
|
84
|
+
* Unpublishes (archives) a live document.
|
|
85
|
+
*
|
|
86
|
+
* @param documentId - The id of the document to unpublish.
|
|
87
|
+
*/
|
|
88
|
+
async unpublishDocument(documentId) {
|
|
89
|
+
const result = await (await this.getContext()).patch(`core/documents/${documentId}/live`, { data: { status: "archived" } });
|
|
90
|
+
if (204 !== result.status()) {
|
|
91
|
+
await require_log.logPlaywrightApiResponse(result);
|
|
92
|
+
throw new Error(`Could not unpublish document with id ${documentId}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
65
96
|
* Retrieves documents.
|
|
66
97
|
*
|
|
67
98
|
* @param args - Configure which documents are retrieved.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreApi.cjs","names":["AuthenticatedApiClient","logger","logPlaywrightApiResponse"],"sources":["../../src/clients/coreApi.ts"],"sourcesContent":["import { logPlaywrightApiResponse, logger } from \"../utils/log\"\nimport type { AuthServerToken } from \"./apiClient\"\nimport { AuthenticatedApiClient } from \"./apiClient\"\n\ntype Language = {\n\tid: string\n\tname: string\n\tis_master: boolean\n}\n\nexport type Release = {\n\tid: string\n\tlabel: string\n\tmigration: boolean\n}\n\nexport type CoreApiDocumentCreationPayload = {\n\ttitle: string\n\tlocale?: string\n\tgroup_lang_id?: string\n\trelease_id?: string\n\tintegration_field_ids: string[]\n\tdata: Record<string, unknown>\n\tcustom_type_id: string\n\ttags: string[]\n}\n\nexport type CoreApiRepository = Record<string, unknown> & {\n\tsimulator_url?: string\n}\n\nexport type CoreApiDocumentCreationResponse = {\n\tid: string\n\tgroup_lang_id: string\n\tcustom_type_id: string\n\tlocale: string\n\tlanguage: { id: string; name: string }\n\tfirst_publication_date: number | null\n\tlast_publication_date: number | null\n\ttitle: string\n\tversions: {\n\t\tstatus: string\n\t\tversion_id: string\n\t\tauthor: {\n\t\t\tid: string\n\t\t\tfirst_name: string | null\n\t\t\tlast_name: string | null\n\t\t\temail: string\n\t\t}\n\t\trelease_id: string | null\n\t\tlast_modified_date: number\n\t\ttags: string[]\n\t\tcustom_type_label: string\n\t\tpreview_summary?: string\n\t\tpreview_image?: string\n\t\tuid?: string\n\t}[]\n}\n\nexport type CoreApiDocumentsPayload = {\n\tlanguage?: string\n\tlimit?: number\n\tstatuses?: string[]\n\tgroupLangIds?: string[]\n}\n\nexport type CoreApiDocumentsResponse = {\n\ttotal: number\n\tcursor: string\n\tresults: CoreApiDocumentCreationResponse[]\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type CoreApiDocumentData = Record<string, any>\n\nexport class CoreApiClient extends AuthenticatedApiClient {\n\t/**\n\t * @example\n\t * \tTo instantiate the class:\n\t *\n\t * \t```js\n\t * \tnew CoreApiClient(\"https://my-repo.prismic.io\", {\n\t * \tauthToken: \"my-secret-token\",\n\t * \t});\n\t * \t```\n\t *\n\t * @param baseURL - The api base URL like https://my-repo.prismic.io\n\t * @param config - Optional configuration\n\t *\n\t * - {@link config.authToken}: Api token generated from the auth service or a function to fetch it\n\t * when it's needed.\n\t */\n\tconstructor(baseURL: string, config: AuthServerToken) {\n\t\tsuper(baseURL, config)\n\t}\n\n\tasync getLanguages(): Promise<Language[]> {\n\t\tconst profiler = logger.startTimer()\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.get(\"core/repository\")\n\n\t\tif (200 !== result.status() || !(await result.json()).languages) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not get languages from the core api.\")\n\t\t}\n\n\t\tprofiler.done({ message: \"retrieved languages configuration\" })\n\n\t\treturn (await result.json()).languages\n\t}\n\n\t/**\n\t * Retrieves all releases, including the migration release.\n\t *\n\t * @returns An array of release metadata.\n\t */\n\tasync getReleases(): Promise<Release[]> {\n\t\tconst profiler = logger.startTimer()\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.get(\"core/releases\", {\n\t\t\tparams: { include_migration_releases: true },\n\t\t})\n\n\t\tif (200 !== result.status() || !(await result.json()).results) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not get releases from the core api.\")\n\t\t}\n\n\t\tprofiler.done({ message: \"retrieved releases\" })\n\n\t\treturn (await result.json()).results\n\t}\n\n\tasync createDraft(\n\t\tdata: CoreApiDocumentCreationPayload,\n\t): Promise<CoreApiDocumentCreationResponse> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.post(\"core/documents\", {\n\t\t\tdata,\n\t\t})\n\n\t\tif (201 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not create draft document\")\n\t\t}\n\n\t\treturn result.json()\n\t}\n\n\tasync publishDraft(documentId: string): Promise<void> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.patch(`core/documents/${documentId}/draft`, {\n\t\t\tdata: {\n\t\t\t\tstatus: \"published\",\n\t\t\t},\n\t\t})\n\n\t\tif (204 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(`Could not publish document with id ${documentId}`)\n\t\t}\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\tconst context = await this.getContext()\n\t\tconst result = await context.post(\"core/documents/search\", {\n\t\t\tdata: args,\n\t\t})\n\n\t\tif (200 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not search documents\")\n\t\t}\n\n\t\treturn result.json()\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\tconst context = await this.getContext()\n\t\tconst result = await context.get(`core/documents/data/${versionId}`)\n\n\t\tif (200 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not retrieve document data\")\n\t\t}\n\n\t\treturn result.json()\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.\n\t */\n\tasync publishRelease(id: string): Promise<void> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.post(`core/releases/${id}/publish`)\n\n\t\tif (200 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not publish release ${id}\")\n\t\t}\n\t}\n\n\tasync getRepository(): Promise<CoreApiRepository> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.get(`core/repository`)\n\n\t\tif (200 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(`Could not get repository`)\n\t\t}\n\n\t\treturn result.json()\n\t}\n\n\tasync updateRepository(data: CoreApiRepository): Promise<void> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.patch(`core/repository`, {\n\t\t\tdata,\n\t\t})\n\n\t\tif (204 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(`Could not update repository`)\n\t\t}\n\t}\n}\n"],"mappings":";;;AA2EA,IAAa,gBAAb,cAAmCA,kBAAAA,uBAAuB;;;;;;;;;;;;;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,CAAC;EAED,IAAI,QAAQ,OAAO,OAAO,GAAG;GAC5B,MAAMA,YAAAA,yBAAyB,MAAM;GACrC,MAAM,IAAI,MAAM,6BAA6B;EAC9C;CACD;AACD"}
|
|
1
|
+
{"version":3,"file":"coreApi.cjs","names":["AuthenticatedApiClient","logger","logPlaywrightApiResponse"],"sources":["../../src/clients/coreApi.ts"],"sourcesContent":["import { logPlaywrightApiResponse, logger } from \"../utils/log\"\nimport type { AuthServerToken } from \"./apiClient\"\nimport { AuthenticatedApiClient } from \"./apiClient\"\n\ntype Language = {\n\tid: string\n\tname: string\n\tis_master: boolean\n}\n\nexport type Release = {\n\tid: string\n\tlabel: string\n\tmigration: boolean\n}\n\nexport type CoreApiDocumentCreationPayload = {\n\ttitle: string\n\tlocale?: string\n\tgroup_lang_id?: string\n\trelease_id?: string\n\tintegration_field_ids: string[]\n\tdata: Record<string, unknown>\n\tcustom_type_id: string\n\ttags: string[]\n}\n\nexport type CoreApiDocumentUpdatePayload = {\n\tdata: Record<string, unknown>\n\tintegration_field_ids: string[]\n\ttags: string[]\n}\n\nexport type CoreApiRepository = Record<string, unknown> & {\n\tsimulator_url?: string\n}\n\nexport type CoreApiDocumentCreationResponse = {\n\tid: string\n\tgroup_lang_id: string\n\tcustom_type_id: string\n\tlocale: string\n\tlanguage: { id: string; name: string }\n\tfirst_publication_date: number | null\n\tlast_publication_date: number | null\n\ttitle: string\n\tversions: {\n\t\tstatus: string\n\t\tversion_id: string\n\t\tauthor: {\n\t\t\tid: string\n\t\t\tfirst_name: string | null\n\t\t\tlast_name: string | null\n\t\t\temail: string\n\t\t}\n\t\trelease_id: string | null\n\t\tlast_modified_date: number\n\t\ttags: string[]\n\t\tcustom_type_label: string\n\t\tpreview_summary?: string\n\t\tpreview_image?: string\n\t\tuid?: string\n\t}[]\n}\n\nexport type CoreApiDocumentsPayload = {\n\tlanguage?: string\n\tlimit?: number\n\tstatuses?: string[]\n\tgroupLangIds?: string[]\n\tdocumentIds?: string[]\n}\n\nexport type CoreApiDocumentsResponse = {\n\ttotal: number\n\tcursor: string\n\tresults: CoreApiDocumentCreationResponse[]\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type CoreApiDocumentData = Record<string, any>\n\nexport class CoreApiClient extends AuthenticatedApiClient {\n\t/**\n\t * @example\n\t * \tTo instantiate the class:\n\t *\n\t * \t```js\n\t * \tnew CoreApiClient(\"https://my-repo.prismic.io\", {\n\t * \tauthToken: \"my-secret-token\",\n\t * \t});\n\t * \t```\n\t *\n\t * @param baseURL - The api base URL like https://my-repo.prismic.io\n\t * @param config - Optional configuration\n\t *\n\t * - {@link config.authToken}: Api token generated from the auth service or a function to fetch it\n\t * when it's needed.\n\t */\n\tconstructor(baseURL: string, config: AuthServerToken) {\n\t\tsuper(baseURL, config)\n\t}\n\n\tasync getLanguages(): Promise<Language[]> {\n\t\tconst profiler = logger.startTimer()\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.get(\"core/repository\")\n\n\t\tif (200 !== result.status() || !(await result.json()).languages) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not get languages from the core api.\")\n\t\t}\n\n\t\tprofiler.done({ message: \"retrieved languages configuration\" })\n\n\t\treturn (await result.json()).languages\n\t}\n\n\t/**\n\t * Retrieves all releases, including the migration release.\n\t *\n\t * @returns An array of release metadata.\n\t */\n\tasync getReleases(): Promise<Release[]> {\n\t\tconst profiler = logger.startTimer()\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.get(\"core/releases\", {\n\t\t\tparams: { include_migration_releases: true },\n\t\t})\n\n\t\tif (200 !== result.status() || !(await result.json()).results) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not get releases from the core api.\")\n\t\t}\n\n\t\tprofiler.done({ message: \"retrieved releases\" })\n\n\t\treturn (await result.json()).results\n\t}\n\n\tasync createDraft(\n\t\tdata: CoreApiDocumentCreationPayload,\n\t): Promise<CoreApiDocumentCreationResponse> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.post(\"core/documents\", {\n\t\t\tdata,\n\t\t})\n\n\t\tif (201 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not create draft document\")\n\t\t}\n\n\t\treturn result.json()\n\t}\n\n\t/**\n\t * Creates a new draft version of an existing document, on top of the given base version.\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 * @returns The updated document, including the new version's id.\n\t */\n\tasync updateDraft(\n\t\tdocumentId: string,\n\t\tdata: CoreApiDocumentUpdatePayload,\n\t\tbaseVersionId: string,\n\t): Promise<CoreApiDocumentCreationResponse> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.put(`core/documents/${documentId}/draft`, {\n\t\t\tparams: { base_version_id: baseVersionId },\n\t\t\tdata,\n\t\t})\n\n\t\tif (200 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(`Could not update draft for document with id ${documentId}`)\n\t\t}\n\n\t\treturn result.json()\n\t}\n\n\tasync publishDraft(documentId: string): Promise<void> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.patch(`core/documents/${documentId}/draft`, {\n\t\t\tdata: {\n\t\t\t\tstatus: \"published\",\n\t\t\t},\n\t\t})\n\n\t\tif (204 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(`Could not publish document with id ${documentId}`)\n\t\t}\n\t}\n\n\t/**\n\t * Unpublishes (archives) a live document.\n\t *\n\t * @param documentId - The id of the document to unpublish.\n\t */\n\tasync unpublishDocument(documentId: string): Promise<void> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.patch(`core/documents/${documentId}/live`, {\n\t\t\tdata: {\n\t\t\t\tstatus: \"archived\",\n\t\t\t},\n\t\t})\n\n\t\tif (204 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(`Could not unpublish document with id ${documentId}`)\n\t\t}\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\tconst context = await this.getContext()\n\t\tconst result = await context.post(\"core/documents/search\", {\n\t\t\tdata: args,\n\t\t})\n\n\t\tif (200 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not search documents\")\n\t\t}\n\n\t\treturn result.json()\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\tconst context = await this.getContext()\n\t\tconst result = await context.get(`core/documents/data/${versionId}`)\n\n\t\tif (200 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not retrieve document data\")\n\t\t}\n\n\t\treturn result.json()\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.\n\t */\n\tasync publishRelease(id: string): Promise<void> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.post(`core/releases/${id}/publish`)\n\n\t\tif (200 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not publish release ${id}\")\n\t\t}\n\t}\n\n\tasync getRepository(): Promise<CoreApiRepository> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.get(`core/repository`)\n\n\t\tif (200 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(`Could not get repository`)\n\t\t}\n\n\t\treturn result.json()\n\t}\n\n\tasync updateRepository(data: CoreApiRepository): Promise<void> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.patch(`core/repository`, {\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gB,WAAiD;EAEtE,MAAM,SAAS,OAAM,MADC,KAAK,WAAW,EAAA,CACT,IAAI,uBAAuB,WAAW;EAEnE,IAAI,QAAQ,OAAO,OAAO,GAAG;GAC5B,MAAMA,YAAAA,yBAAyB,MAAM;GACrC,MAAM,IAAI,MAAM,kCAAkC;EACnD;EAEA,OAAO,OAAO,KAAK;CACpB;;;;;;;CAQA,MAAM,eAAe,IAA2B;EAE/C,MAAM,SAAS,OAAM,MADC,KAAK,WAAW,EAAA,CACT,KAAK,iBAAiB,GAAG,SAAS;EAE/D,IAAI,QAAQ,OAAO,OAAO,GAAG;GAC5B,MAAMA,YAAAA,yBAAyB,MAAM;GACrC,MAAM,IAAI,MAAM,iCAAiC;EAClD;CACD;CAEA,MAAM,gBAA4C;EAEjD,MAAM,SAAS,OAAM,MADC,KAAK,WAAW,EAAA,CACT,IAAI,iBAAiB;EAElD,IAAI,QAAQ,OAAO,OAAO,GAAG;GAC5B,MAAMA,YAAAA,yBAAyB,MAAM;GACrC,MAAM,IAAI,MAAM,0BAA0B;EAC3C;EAEA,OAAO,OAAO,KAAK;CACpB;CAEA,MAAM,iBAAiB,MAAwC;EAE9D,MAAM,SAAS,OAAM,MADC,KAAK,WAAW,EAAA,CACT,MAAM,mBAAmB,EACrD,KACD,CAAC;EAED,IAAI,QAAQ,OAAO,OAAO,GAAG;GAC5B,MAAMA,YAAAA,yBAAyB,MAAM;GACrC,MAAM,IAAI,MAAM,6BAA6B;EAC9C;CACD;AACD"}
|
|
@@ -21,6 +21,11 @@ type CoreApiDocumentCreationPayload = {
|
|
|
21
21
|
custom_type_id: string;
|
|
22
22
|
tags: string[];
|
|
23
23
|
};
|
|
24
|
+
type CoreApiDocumentUpdatePayload = {
|
|
25
|
+
data: Record<string, unknown>;
|
|
26
|
+
integration_field_ids: string[];
|
|
27
|
+
tags: string[];
|
|
28
|
+
};
|
|
24
29
|
type CoreApiRepository = Record<string, unknown> & {
|
|
25
30
|
simulator_url?: string;
|
|
26
31
|
};
|
|
@@ -59,6 +64,7 @@ type CoreApiDocumentsPayload = {
|
|
|
59
64
|
limit?: number;
|
|
60
65
|
statuses?: string[];
|
|
61
66
|
groupLangIds?: string[];
|
|
67
|
+
documentIds?: string[];
|
|
62
68
|
};
|
|
63
69
|
type CoreApiDocumentsResponse = {
|
|
64
70
|
total: number;
|
|
@@ -92,7 +98,22 @@ declare class CoreApiClient extends AuthenticatedApiClient {
|
|
|
92
98
|
*/
|
|
93
99
|
getReleases(): Promise<Release[]>;
|
|
94
100
|
createDraft(data: CoreApiDocumentCreationPayload): Promise<CoreApiDocumentCreationResponse>;
|
|
101
|
+
/**
|
|
102
|
+
* Creates a new draft version of an existing document, on top of the given base version.
|
|
103
|
+
*
|
|
104
|
+
* @param documentId - The id of the document to update.
|
|
105
|
+
* @param data - The new version payload in the core api format.
|
|
106
|
+
* @param baseVersionId - The id of the version the draft is created from.
|
|
107
|
+
* @returns The updated document, including the new version's id.
|
|
108
|
+
*/
|
|
109
|
+
updateDraft(documentId: string, data: CoreApiDocumentUpdatePayload, baseVersionId: string): Promise<CoreApiDocumentCreationResponse>;
|
|
95
110
|
publishDraft(documentId: string): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Unpublishes (archives) a live document.
|
|
113
|
+
*
|
|
114
|
+
* @param documentId - The id of the document to unpublish.
|
|
115
|
+
*/
|
|
116
|
+
unpublishDocument(documentId: string): Promise<void>;
|
|
96
117
|
/**
|
|
97
118
|
* Retrieves documents.
|
|
98
119
|
*
|
|
@@ -118,5 +139,5 @@ declare class CoreApiClient extends AuthenticatedApiClient {
|
|
|
118
139
|
updateRepository(data: CoreApiRepository): Promise<void>;
|
|
119
140
|
}
|
|
120
141
|
//#endregion
|
|
121
|
-
export { CoreApiClient, CoreApiDocumentCreationPayload, CoreApiDocumentCreationResponse, CoreApiDocumentData, CoreApiDocumentsPayload, CoreApiDocumentsResponse, CoreApiRepository, Release };
|
|
142
|
+
export { CoreApiClient, CoreApiDocumentCreationPayload, CoreApiDocumentCreationResponse, CoreApiDocumentData, CoreApiDocumentUpdatePayload, CoreApiDocumentsPayload, CoreApiDocumentsResponse, CoreApiRepository, Release };
|
|
122
143
|
//# sourceMappingURL=coreApi.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreApi.d.cts","names":[],"sources":["../../src/clients/coreApi.ts"],"mappings":";;;KAIK,QAAA;EACJ,EAAA;EACA,IAAA;EACA,SAAA;AAAA;AAAA,KAGW,OAAA;EACX,EAAA;EACA,KAAA;EACA,SAAA;AAAA;AAAA,KAGW,8BAAA;EACX,KAAA;EACA,MAAA;EACA,aAAA;EACA,UAAA;EACA,qBAAA;EACA,IAAA,EAAM,MAAM;EACZ,cAAA;EACA,IAAA;AAAA;AAAA,KAGW,iBAAA,GAAoB,MAAM;EACrC,aAAa;AAAA;AAAA,KAGF,+BAAA;EACX,EAAA;EACA,aAAA;EACA,cAAA;EACA,MAAA;EACA,QAAA;IAAY,EAAA;IAAY,IAAA;EAAA;EACxB,sBAAA;EACA,qBAAA;EACA,KAAA;EACA,QAAA;IACC,MAAA;IACA,UAAA;IACA,MAAA;MACC,EAAA;MACA,UAAA;MACA,SAAA;MACA,KAAA;IAAA;IAED,UAAA;IACA,kBAAA;IACA,IAAA;IACA,iBAAA;IACA,eAAA;IACA,aAAA;IACA,GAAA;EAAA;AAAA;AAAA,KAIU,uBAAA;EACX,QAAA;EACA,KAAA;EACA,QAAA;EACA,YAAA;AAAA;AAAA,KAGW,wBAAA;EACX,KAAA;EACA,MAAA;EACA,OAAA,EAAS,+BAA+B;AAAA;AAAA,KAI7B,mBAAA,GAAsB,MAAM;AAAA,cAE3B,aAAA,SAAsB,sBAAA;
|
|
1
|
+
{"version":3,"file":"coreApi.d.cts","names":[],"sources":["../../src/clients/coreApi.ts"],"mappings":";;;KAIK,QAAA;EACJ,EAAA;EACA,IAAA;EACA,SAAA;AAAA;AAAA,KAGW,OAAA;EACX,EAAA;EACA,KAAA;EACA,SAAA;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AAA;EA/ExB;;;;;;EAmGf,YAAA,CAAa,IAAA,EAAM,uBAAA,GAA0B,OAAA,CAAQ,wBAAA;EAvCnB;;;;;;EA2DlC,eAAA,CAAgB,SAAA,WAAoB,OAAA,CAAQ,mBAAA;EAkBhB;;;;;;EAA5B,cAAA,CAAe,EAAA,WAAa,OAAA;EAU5B,aAAA,IAAiB,OAAA,CAAQ,iBAAA;EAYzB,gBAAA,CAAiB,IAAA,EAAM,iBAAA,GAAoB,OAAA;AAAA"}
|
|
@@ -21,6 +21,11 @@ type CoreApiDocumentCreationPayload = {
|
|
|
21
21
|
custom_type_id: string;
|
|
22
22
|
tags: string[];
|
|
23
23
|
};
|
|
24
|
+
type CoreApiDocumentUpdatePayload = {
|
|
25
|
+
data: Record<string, unknown>;
|
|
26
|
+
integration_field_ids: string[];
|
|
27
|
+
tags: string[];
|
|
28
|
+
};
|
|
24
29
|
type CoreApiRepository = Record<string, unknown> & {
|
|
25
30
|
simulator_url?: string;
|
|
26
31
|
};
|
|
@@ -59,6 +64,7 @@ type CoreApiDocumentsPayload = {
|
|
|
59
64
|
limit?: number;
|
|
60
65
|
statuses?: string[];
|
|
61
66
|
groupLangIds?: string[];
|
|
67
|
+
documentIds?: string[];
|
|
62
68
|
};
|
|
63
69
|
type CoreApiDocumentsResponse = {
|
|
64
70
|
total: number;
|
|
@@ -92,7 +98,22 @@ declare class CoreApiClient extends AuthenticatedApiClient {
|
|
|
92
98
|
*/
|
|
93
99
|
getReleases(): Promise<Release[]>;
|
|
94
100
|
createDraft(data: CoreApiDocumentCreationPayload): Promise<CoreApiDocumentCreationResponse>;
|
|
101
|
+
/**
|
|
102
|
+
* Creates a new draft version of an existing document, on top of the given base version.
|
|
103
|
+
*
|
|
104
|
+
* @param documentId - The id of the document to update.
|
|
105
|
+
* @param data - The new version payload in the core api format.
|
|
106
|
+
* @param baseVersionId - The id of the version the draft is created from.
|
|
107
|
+
* @returns The updated document, including the new version's id.
|
|
108
|
+
*/
|
|
109
|
+
updateDraft(documentId: string, data: CoreApiDocumentUpdatePayload, baseVersionId: string): Promise<CoreApiDocumentCreationResponse>;
|
|
95
110
|
publishDraft(documentId: string): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Unpublishes (archives) a live document.
|
|
113
|
+
*
|
|
114
|
+
* @param documentId - The id of the document to unpublish.
|
|
115
|
+
*/
|
|
116
|
+
unpublishDocument(documentId: string): Promise<void>;
|
|
96
117
|
/**
|
|
97
118
|
* Retrieves documents.
|
|
98
119
|
*
|
|
@@ -118,5 +139,5 @@ declare class CoreApiClient extends AuthenticatedApiClient {
|
|
|
118
139
|
updateRepository(data: CoreApiRepository): Promise<void>;
|
|
119
140
|
}
|
|
120
141
|
//#endregion
|
|
121
|
-
export { CoreApiClient, CoreApiDocumentCreationPayload, CoreApiDocumentCreationResponse, CoreApiDocumentData, CoreApiDocumentsPayload, CoreApiDocumentsResponse, CoreApiRepository, Release };
|
|
142
|
+
export { CoreApiClient, CoreApiDocumentCreationPayload, CoreApiDocumentCreationResponse, CoreApiDocumentData, CoreApiDocumentUpdatePayload, CoreApiDocumentsPayload, CoreApiDocumentsResponse, CoreApiRepository, Release };
|
|
122
143
|
//# sourceMappingURL=coreApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreApi.d.ts","names":[],"sources":["../../src/clients/coreApi.ts"],"mappings":";;;KAIK,QAAA;EACJ,EAAA;EACA,IAAA;EACA,SAAA;AAAA;AAAA,KAGW,OAAA;EACX,EAAA;EACA,KAAA;EACA,SAAA;AAAA;AAAA,KAGW,8BAAA;EACX,KAAA;EACA,MAAA;EACA,aAAA;EACA,UAAA;EACA,qBAAA;EACA,IAAA,EAAM,MAAM;EACZ,cAAA;EACA,IAAA;AAAA;AAAA,KAGW,iBAAA,GAAoB,MAAM;EACrC,aAAa;AAAA;AAAA,KAGF,+BAAA;EACX,EAAA;EACA,aAAA;EACA,cAAA;EACA,MAAA;EACA,QAAA;IAAY,EAAA;IAAY,IAAA;EAAA;EACxB,sBAAA;EACA,qBAAA;EACA,KAAA;EACA,QAAA;IACC,MAAA;IACA,UAAA;IACA,MAAA;MACC,EAAA;MACA,UAAA;MACA,SAAA;MACA,KAAA;IAAA;IAED,UAAA;IACA,kBAAA;IACA,IAAA;IACA,iBAAA;IACA,eAAA;IACA,aAAA;IACA,GAAA;EAAA;AAAA;AAAA,KAIU,uBAAA;EACX,QAAA;EACA,KAAA;EACA,QAAA;EACA,YAAA;AAAA;AAAA,KAGW,wBAAA;EACX,KAAA;EACA,MAAA;EACA,OAAA,EAAS,+BAA+B;AAAA;AAAA,KAI7B,mBAAA,GAAsB,MAAM;AAAA,cAE3B,aAAA,SAAsB,sBAAA;
|
|
1
|
+
{"version":3,"file":"coreApi.d.ts","names":[],"sources":["../../src/clients/coreApi.ts"],"mappings":";;;KAIK,QAAA;EACJ,EAAA;EACA,IAAA;EACA,SAAA;AAAA;AAAA,KAGW,OAAA;EACX,EAAA;EACA,KAAA;EACA,SAAA;AAAA;AAAA,KAGW,8BAAA;EACX,KAAA;EACA,MAAA;EACA,aAAA;EACA,UAAA;EACA,qBAAA;EACA,IAAA,EAAM,MAAM;EACZ,cAAA;EACA,IAAA;AAAA;AAAA,KAGW,4BAAA;EACX,IAAA,EAAM,MAAM;EACZ,qBAAA;EACA,IAAA;AAAA;AAAA,KAGW,iBAAA,GAAoB,MAAM;EACrC,aAAa;AAAA;AAAA,KAGF,+BAAA;EACX,EAAA;EACA,aAAA;EACA,cAAA;EACA,MAAA;EACA,QAAA;IAAY,EAAA;IAAY,IAAA;EAAA;EACxB,sBAAA;EACA,qBAAA;EACA,KAAA;EACA,QAAA;IACC,MAAA;IACA,UAAA;IACA,MAAA;MACC,EAAA;MACA,UAAA;MACA,SAAA;MACA,KAAA;IAAA;IAED,UAAA;IACA,kBAAA;IACA,IAAA;IACA,iBAAA;IACA,eAAA;IACA,aAAA;IACA,GAAA;EAAA;AAAA;AAAA,KAIU,uBAAA;EACX,QAAA;EACA,KAAA;EACA,QAAA;EACA,YAAA;EACA,WAAA;AAAA;AAAA,KAGW,wBAAA;EACX,KAAA;EACA,MAAA;EACA,OAAA,EAAS,+BAA+B;AAAA;AAAA,KAI7B,mBAAA,GAAsB,MAAM;AAAA,cAE3B,aAAA,SAAsB,sBAAA;EA1BjC;;;;;;;AAKG;AAIL;;;;;;;;cAkCa,OAAA,UAAiB,MAAA,EAAQ,eAAA;EAI/B,YAAA,IAAgB,OAAA,CAAQ,QAAA;EAjCnB;AAGZ;;;;EAkDO,WAAA,IAAe,OAAA,CAAQ,OAAA;EAiBvB,WAAA,CACL,IAAA,EAAM,8BAAA,GACJ,OAAA,CAAQ,+BAAA;EAlEX;;;AAAwC;AAIzC;;;;EAoFO,WAAA,CACL,UAAA,UACA,IAAA,EAAM,4BAAA,EACN,aAAA,WACE,OAAA,CAAQ,+BAAA;EAeL,YAAA,CAAa,UAAA,WAAqB,OAAA;EArGd;;;;;EAwHpB,iBAAA,CAAkB,UAAA,WAAqB,OAAA;EA/ExB;;;;;;EAmGf,YAAA,CAAa,IAAA,EAAM,uBAAA,GAA0B,OAAA,CAAQ,wBAAA;EAvCnB;;;;;;EA2DlC,eAAA,CAAgB,SAAA,WAAoB,OAAA,CAAQ,mBAAA;EAkBhB;;;;;;EAA5B,cAAA,CAAe,EAAA,WAAa,OAAA;EAU5B,aAAA,IAAiB,OAAA,CAAQ,iBAAA;EAYzB,gBAAA,CAAiB,IAAA,EAAM,iBAAA,GAAoB,OAAA;AAAA"}
|
package/dist/clients/coreApi.js
CHANGED
|
@@ -54,6 +54,25 @@ var CoreApiClient = class extends AuthenticatedApiClient {
|
|
|
54
54
|
}
|
|
55
55
|
return result.json();
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Creates a new draft version of an existing document, on top of the given base version.
|
|
59
|
+
*
|
|
60
|
+
* @param documentId - The id of the document to update.
|
|
61
|
+
* @param data - The new version payload in the core api format.
|
|
62
|
+
* @param baseVersionId - The id of the version the draft is created from.
|
|
63
|
+
* @returns The updated document, including the new version's id.
|
|
64
|
+
*/
|
|
65
|
+
async updateDraft(documentId, data, baseVersionId) {
|
|
66
|
+
const result = await (await this.getContext()).put(`core/documents/${documentId}/draft`, {
|
|
67
|
+
params: { base_version_id: baseVersionId },
|
|
68
|
+
data
|
|
69
|
+
});
|
|
70
|
+
if (200 !== result.status()) {
|
|
71
|
+
await logPlaywrightApiResponse(result);
|
|
72
|
+
throw new Error(`Could not update draft for document with id ${documentId}`);
|
|
73
|
+
}
|
|
74
|
+
return result.json();
|
|
75
|
+
}
|
|
57
76
|
async publishDraft(documentId) {
|
|
58
77
|
const result = await (await this.getContext()).patch(`core/documents/${documentId}/draft`, { data: { status: "published" } });
|
|
59
78
|
if (204 !== result.status()) {
|
|
@@ -62,6 +81,18 @@ var CoreApiClient = class extends AuthenticatedApiClient {
|
|
|
62
81
|
}
|
|
63
82
|
}
|
|
64
83
|
/**
|
|
84
|
+
* Unpublishes (archives) a live document.
|
|
85
|
+
*
|
|
86
|
+
* @param documentId - The id of the document to unpublish.
|
|
87
|
+
*/
|
|
88
|
+
async unpublishDocument(documentId) {
|
|
89
|
+
const result = await (await this.getContext()).patch(`core/documents/${documentId}/live`, { data: { status: "archived" } });
|
|
90
|
+
if (204 !== result.status()) {
|
|
91
|
+
await logPlaywrightApiResponse(result);
|
|
92
|
+
throw new Error(`Could not unpublish document with id ${documentId}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
65
96
|
* Retrieves documents.
|
|
66
97
|
*
|
|
67
98
|
* @param args - Configure which documents are retrieved.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreApi.js","names":[],"sources":["../../src/clients/coreApi.ts"],"sourcesContent":["import { logPlaywrightApiResponse, logger } from \"../utils/log\"\nimport type { AuthServerToken } from \"./apiClient\"\nimport { AuthenticatedApiClient } from \"./apiClient\"\n\ntype Language = {\n\tid: string\n\tname: string\n\tis_master: boolean\n}\n\nexport type Release = {\n\tid: string\n\tlabel: string\n\tmigration: boolean\n}\n\nexport type CoreApiDocumentCreationPayload = {\n\ttitle: string\n\tlocale?: string\n\tgroup_lang_id?: string\n\trelease_id?: string\n\tintegration_field_ids: string[]\n\tdata: Record<string, unknown>\n\tcustom_type_id: string\n\ttags: string[]\n}\n\nexport type CoreApiRepository = Record<string, unknown> & {\n\tsimulator_url?: string\n}\n\nexport type CoreApiDocumentCreationResponse = {\n\tid: string\n\tgroup_lang_id: string\n\tcustom_type_id: string\n\tlocale: string\n\tlanguage: { id: string; name: string }\n\tfirst_publication_date: number | null\n\tlast_publication_date: number | null\n\ttitle: string\n\tversions: {\n\t\tstatus: string\n\t\tversion_id: string\n\t\tauthor: {\n\t\t\tid: string\n\t\t\tfirst_name: string | null\n\t\t\tlast_name: string | null\n\t\t\temail: string\n\t\t}\n\t\trelease_id: string | null\n\t\tlast_modified_date: number\n\t\ttags: string[]\n\t\tcustom_type_label: string\n\t\tpreview_summary?: string\n\t\tpreview_image?: string\n\t\tuid?: string\n\t}[]\n}\n\nexport type CoreApiDocumentsPayload = {\n\tlanguage?: string\n\tlimit?: number\n\tstatuses?: string[]\n\tgroupLangIds?: string[]\n}\n\nexport type CoreApiDocumentsResponse = {\n\ttotal: number\n\tcursor: string\n\tresults: CoreApiDocumentCreationResponse[]\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type CoreApiDocumentData = Record<string, any>\n\nexport class CoreApiClient extends AuthenticatedApiClient {\n\t/**\n\t * @example\n\t * \tTo instantiate the class:\n\t *\n\t * \t```js\n\t * \tnew CoreApiClient(\"https://my-repo.prismic.io\", {\n\t * \tauthToken: \"my-secret-token\",\n\t * \t});\n\t * \t```\n\t *\n\t * @param baseURL - The api base URL like https://my-repo.prismic.io\n\t * @param config - Optional configuration\n\t *\n\t * - {@link config.authToken}: Api token generated from the auth service or a function to fetch it\n\t * when it's needed.\n\t */\n\tconstructor(baseURL: string, config: AuthServerToken) {\n\t\tsuper(baseURL, config)\n\t}\n\n\tasync getLanguages(): Promise<Language[]> {\n\t\tconst profiler = logger.startTimer()\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.get(\"core/repository\")\n\n\t\tif (200 !== result.status() || !(await result.json()).languages) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not get languages from the core api.\")\n\t\t}\n\n\t\tprofiler.done({ message: \"retrieved languages configuration\" })\n\n\t\treturn (await result.json()).languages\n\t}\n\n\t/**\n\t * Retrieves all releases, including the migration release.\n\t *\n\t * @returns An array of release metadata.\n\t */\n\tasync getReleases(): Promise<Release[]> {\n\t\tconst profiler = logger.startTimer()\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.get(\"core/releases\", {\n\t\t\tparams: { include_migration_releases: true },\n\t\t})\n\n\t\tif (200 !== result.status() || !(await result.json()).results) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not get releases from the core api.\")\n\t\t}\n\n\t\tprofiler.done({ message: \"retrieved releases\" })\n\n\t\treturn (await result.json()).results\n\t}\n\n\tasync createDraft(\n\t\tdata: CoreApiDocumentCreationPayload,\n\t): Promise<CoreApiDocumentCreationResponse> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.post(\"core/documents\", {\n\t\t\tdata,\n\t\t})\n\n\t\tif (201 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not create draft document\")\n\t\t}\n\n\t\treturn result.json()\n\t}\n\n\tasync publishDraft(documentId: string): Promise<void> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.patch(`core/documents/${documentId}/draft`, {\n\t\t\tdata: {\n\t\t\t\tstatus: \"published\",\n\t\t\t},\n\t\t})\n\n\t\tif (204 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(`Could not publish document with id ${documentId}`)\n\t\t}\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\tconst context = await this.getContext()\n\t\tconst result = await context.post(\"core/documents/search\", {\n\t\t\tdata: args,\n\t\t})\n\n\t\tif (200 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not search documents\")\n\t\t}\n\n\t\treturn result.json()\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\tconst context = await this.getContext()\n\t\tconst result = await context.get(`core/documents/data/${versionId}`)\n\n\t\tif (200 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not retrieve document data\")\n\t\t}\n\n\t\treturn result.json()\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.\n\t */\n\tasync publishRelease(id: string): Promise<void> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.post(`core/releases/${id}/publish`)\n\n\t\tif (200 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not publish release ${id}\")\n\t\t}\n\t}\n\n\tasync getRepository(): Promise<CoreApiRepository> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.get(`core/repository`)\n\n\t\tif (200 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(`Could not get repository`)\n\t\t}\n\n\t\treturn result.json()\n\t}\n\n\tasync updateRepository(data: CoreApiRepository): Promise<void> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.patch(`core/repository`, {\n\t\t\tdata,\n\t\t})\n\n\t\tif (204 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(`Could not update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KACD,CAAC;EAED,IAAI,QAAQ,OAAO,OAAO,GAAG;GAC5B,MAAM,yBAAyB,MAAM;GACrC,MAAM,IAAI,MAAM,6BAA6B;EAC9C;CACD;AACD"}
|
|
1
|
+
{"version":3,"file":"coreApi.js","names":[],"sources":["../../src/clients/coreApi.ts"],"sourcesContent":["import { logPlaywrightApiResponse, logger } from \"../utils/log\"\nimport type { AuthServerToken } from \"./apiClient\"\nimport { AuthenticatedApiClient } from \"./apiClient\"\n\ntype Language = {\n\tid: string\n\tname: string\n\tis_master: boolean\n}\n\nexport type Release = {\n\tid: string\n\tlabel: string\n\tmigration: boolean\n}\n\nexport type CoreApiDocumentCreationPayload = {\n\ttitle: string\n\tlocale?: string\n\tgroup_lang_id?: string\n\trelease_id?: string\n\tintegration_field_ids: string[]\n\tdata: Record<string, unknown>\n\tcustom_type_id: string\n\ttags: string[]\n}\n\nexport type CoreApiDocumentUpdatePayload = {\n\tdata: Record<string, unknown>\n\tintegration_field_ids: string[]\n\ttags: string[]\n}\n\nexport type CoreApiRepository = Record<string, unknown> & {\n\tsimulator_url?: string\n}\n\nexport type CoreApiDocumentCreationResponse = {\n\tid: string\n\tgroup_lang_id: string\n\tcustom_type_id: string\n\tlocale: string\n\tlanguage: { id: string; name: string }\n\tfirst_publication_date: number | null\n\tlast_publication_date: number | null\n\ttitle: string\n\tversions: {\n\t\tstatus: string\n\t\tversion_id: string\n\t\tauthor: {\n\t\t\tid: string\n\t\t\tfirst_name: string | null\n\t\t\tlast_name: string | null\n\t\t\temail: string\n\t\t}\n\t\trelease_id: string | null\n\t\tlast_modified_date: number\n\t\ttags: string[]\n\t\tcustom_type_label: string\n\t\tpreview_summary?: string\n\t\tpreview_image?: string\n\t\tuid?: string\n\t}[]\n}\n\nexport type CoreApiDocumentsPayload = {\n\tlanguage?: string\n\tlimit?: number\n\tstatuses?: string[]\n\tgroupLangIds?: string[]\n\tdocumentIds?: string[]\n}\n\nexport type CoreApiDocumentsResponse = {\n\ttotal: number\n\tcursor: string\n\tresults: CoreApiDocumentCreationResponse[]\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type CoreApiDocumentData = Record<string, any>\n\nexport class CoreApiClient extends AuthenticatedApiClient {\n\t/**\n\t * @example\n\t * \tTo instantiate the class:\n\t *\n\t * \t```js\n\t * \tnew CoreApiClient(\"https://my-repo.prismic.io\", {\n\t * \tauthToken: \"my-secret-token\",\n\t * \t});\n\t * \t```\n\t *\n\t * @param baseURL - The api base URL like https://my-repo.prismic.io\n\t * @param config - Optional configuration\n\t *\n\t * - {@link config.authToken}: Api token generated from the auth service or a function to fetch it\n\t * when it's needed.\n\t */\n\tconstructor(baseURL: string, config: AuthServerToken) {\n\t\tsuper(baseURL, config)\n\t}\n\n\tasync getLanguages(): Promise<Language[]> {\n\t\tconst profiler = logger.startTimer()\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.get(\"core/repository\")\n\n\t\tif (200 !== result.status() || !(await result.json()).languages) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not get languages from the core api.\")\n\t\t}\n\n\t\tprofiler.done({ message: \"retrieved languages configuration\" })\n\n\t\treturn (await result.json()).languages\n\t}\n\n\t/**\n\t * Retrieves all releases, including the migration release.\n\t *\n\t * @returns An array of release metadata.\n\t */\n\tasync getReleases(): Promise<Release[]> {\n\t\tconst profiler = logger.startTimer()\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.get(\"core/releases\", {\n\t\t\tparams: { include_migration_releases: true },\n\t\t})\n\n\t\tif (200 !== result.status() || !(await result.json()).results) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not get releases from the core api.\")\n\t\t}\n\n\t\tprofiler.done({ message: \"retrieved releases\" })\n\n\t\treturn (await result.json()).results\n\t}\n\n\tasync createDraft(\n\t\tdata: CoreApiDocumentCreationPayload,\n\t): Promise<CoreApiDocumentCreationResponse> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.post(\"core/documents\", {\n\t\t\tdata,\n\t\t})\n\n\t\tif (201 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not create draft document\")\n\t\t}\n\n\t\treturn result.json()\n\t}\n\n\t/**\n\t * Creates a new draft version of an existing document, on top of the given base version.\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 * @returns The updated document, including the new version's id.\n\t */\n\tasync updateDraft(\n\t\tdocumentId: string,\n\t\tdata: CoreApiDocumentUpdatePayload,\n\t\tbaseVersionId: string,\n\t): Promise<CoreApiDocumentCreationResponse> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.put(`core/documents/${documentId}/draft`, {\n\t\t\tparams: { base_version_id: baseVersionId },\n\t\t\tdata,\n\t\t})\n\n\t\tif (200 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(`Could not update draft for document with id ${documentId}`)\n\t\t}\n\n\t\treturn result.json()\n\t}\n\n\tasync publishDraft(documentId: string): Promise<void> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.patch(`core/documents/${documentId}/draft`, {\n\t\t\tdata: {\n\t\t\t\tstatus: \"published\",\n\t\t\t},\n\t\t})\n\n\t\tif (204 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(`Could not publish document with id ${documentId}`)\n\t\t}\n\t}\n\n\t/**\n\t * Unpublishes (archives) a live document.\n\t *\n\t * @param documentId - The id of the document to unpublish.\n\t */\n\tasync unpublishDocument(documentId: string): Promise<void> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.patch(`core/documents/${documentId}/live`, {\n\t\t\tdata: {\n\t\t\t\tstatus: \"archived\",\n\t\t\t},\n\t\t})\n\n\t\tif (204 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(`Could not unpublish document with id ${documentId}`)\n\t\t}\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\tconst context = await this.getContext()\n\t\tconst result = await context.post(\"core/documents/search\", {\n\t\t\tdata: args,\n\t\t})\n\n\t\tif (200 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not search documents\")\n\t\t}\n\n\t\treturn result.json()\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\tconst context = await this.getContext()\n\t\tconst result = await context.get(`core/documents/data/${versionId}`)\n\n\t\tif (200 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not retrieve document data\")\n\t\t}\n\n\t\treturn result.json()\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.\n\t */\n\tasync publishRelease(id: string): Promise<void> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.post(`core/releases/${id}/publish`)\n\n\t\tif (200 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not publish release ${id}\")\n\t\t}\n\t}\n\n\tasync getRepository(): Promise<CoreApiRepository> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.get(`core/repository`)\n\n\t\tif (200 !== result.status()) {\n\t\t\tawait logPlaywrightApiResponse(result)\n\t\t\tthrow new Error(`Could not get repository`)\n\t\t}\n\n\t\treturn result.json()\n\t}\n\n\tasync updateRepository(data: CoreApiRepository): Promise<void> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.patch(`core/repository`, {\n\t\t\tdata,\n\t\t})\n\n\t\tif (204 !== result.status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5B,MAAM,yBAAyB,MAAM;GACrC,MAAM,IAAI,MAAM,kCAAkC;EACnD;EAEA,OAAO,OAAO,KAAK;CACpB;;;;;;;CAQA,MAAM,eAAe,IAA2B;EAE/C,MAAM,SAAS,OAAM,MADC,KAAK,WAAW,EAAA,CACT,KAAK,iBAAiB,GAAG,SAAS;EAE/D,IAAI,QAAQ,OAAO,OAAO,GAAG;GAC5B,MAAM,yBAAyB,MAAM;GACrC,MAAM,IAAI,MAAM,iCAAiC;EAClD;CACD;CAEA,MAAM,gBAA4C;EAEjD,MAAM,SAAS,OAAM,MADC,KAAK,WAAW,EAAA,CACT,IAAI,iBAAiB;EAElD,IAAI,QAAQ,OAAO,OAAO,GAAG;GAC5B,MAAM,yBAAyB,MAAM;GACrC,MAAM,IAAI,MAAM,0BAA0B;EAC3C;EAEA,OAAO,OAAO,KAAK;CACpB;CAEA,MAAM,iBAAiB,MAAwC;EAE9D,MAAM,SAAS,OAAM,MADC,KAAK,WAAW,EAAA,CACT,MAAM,mBAAmB,EACrD,KACD,CAAC;EAED,IAAI,QAAQ,OAAO,OAAO,GAAG;GAC5B,MAAM,yBAAyB,MAAM;GACrC,MAAM,IAAI,MAAM,6BAA6B;EAC9C;CACD;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customTypesApi.cjs","names":["AuthenticatedApiClient","logger"],"sources":["../../src/clients/customTypesApi.ts"],"sourcesContent":["import type { DynamicCustomTypeModel, SharedSliceModel } from \"@prismicio/types-internal\"\nimport isEqual from \"lodash.isequal\"\n\nimport { logPlaywrightApiResponse, logger } from \"../utils/log\"\nimport type { AuthServerToken } from \"./apiClient\"\nimport { AuthenticatedApiClient } from \"./apiClient\"\n\ntype ItemType = DynamicCustomTypeModel | SharedSliceModel\ntype ItemTypePath = \"customtypes\" | \"slices\"\ntype ItemOperation = \"insert\" | \"update\"\n\n/** Client for interacting with the Custom Types API to create/update custom types and slices. */\nexport class CustomTypesApiClient extends AuthenticatedApiClient {\n\tconstructor(baseURL: string, config: { authToken: AuthServerToken; repository: string }) {\n\t\tsuper(baseURL, config.authToken, { repository: config.repository })\n\t}\n\n\t/**\n\t * Create or update a custom type or slice.\n\t *\n\t * @param endpoint - - The API endpoint for custom types or slices ('customtypes' or 'slices').\n\t * @param data - - The data representing the custom type or slice.\n\t * @throws Error if the item status cannot be retrieved or the item cannot be\n\t * created/updated.\n\t */\n\tprivate async upsert(endpoint: ItemTypePath, operation: ItemOperation, data: ItemType) {\n\t\tconst profiler = logger.startTimer()\n\t\tconst path = `${endpoint}/${operation}`\n\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.post(path, { data })\n\t\tif (!result.ok()) {\n\t\t\tlogPlaywrightApiResponse(result)\n\t\t\tthrow new Error(`Could not ${operation} item`)\n\t\t}\n\t\tprofiler.done({\n\t\t\tmessage: `called customtypes api /${path} for item with id '${data.id}'`,\n\t\t})\n\t}\n\n\tprivate async getRemoteItems(
|
|
1
|
+
{"version":3,"file":"customTypesApi.cjs","names":["AuthenticatedApiClient","logger"],"sources":["../../src/clients/customTypesApi.ts"],"sourcesContent":["import type { DynamicCustomTypeModel, SharedSliceModel } from \"@prismicio/types-internal\"\nimport isEqual from \"lodash.isequal\"\n\nimport { logPlaywrightApiResponse, logger } from \"../utils/log\"\nimport type { AuthServerToken } from \"./apiClient\"\nimport { AuthenticatedApiClient } from \"./apiClient\"\n\ntype ItemType = DynamicCustomTypeModel | SharedSliceModel\ntype ItemTypePath = \"customtypes\" | \"slices\"\ntype ItemOperation = \"insert\" | \"update\"\n\n/** Client for interacting with the Custom Types API to create/update custom types and slices. */\nexport class CustomTypesApiClient extends AuthenticatedApiClient {\n\tconstructor(baseURL: string, config: { authToken: AuthServerToken; repository: string }) {\n\t\tsuper(baseURL, config.authToken, { repository: config.repository })\n\t}\n\n\t/**\n\t * Create or update a custom type or slice.\n\t *\n\t * @param endpoint - - The API endpoint for custom types or slices ('customtypes' or 'slices').\n\t * @param data - - The data representing the custom type or slice.\n\t * @throws Error if the item status cannot be retrieved or the item cannot be\n\t * created/updated.\n\t */\n\tprivate async upsert(endpoint: ItemTypePath, operation: ItemOperation, data: ItemType) {\n\t\tconst profiler = logger.startTimer()\n\t\tconst path = `${endpoint}/${operation}`\n\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.post(path, { data })\n\t\tif (!result.ok()) {\n\t\t\tlogPlaywrightApiResponse(result)\n\t\t\tthrow new Error(`Could not ${operation} item`)\n\t\t}\n\t\tprofiler.done({\n\t\t\tmessage: `called customtypes api /${path} for item with id '${data.id}'`,\n\t\t})\n\t}\n\n\tprivate async getRemoteItems(\n\t\tendpoint: ItemTypePath,\n\t): Promise<DynamicCustomTypeModel[] | SharedSliceModel[]> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.get(endpoint)\n\n\t\tif (!result.ok()) {\n\t\t\tlogPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not get items status from the Custom Type api.\")\n\t\t}\n\n\t\treturn result.json()\n\t}\n\n\tprivate async getDifference(\n\t\tremoteItems: DynamicCustomTypeModel[] | SharedSliceModel[],\n\t\tlocal: ItemType,\n\t): Promise<ItemOperation | undefined> {\n\t\tconst remoteItem = remoteItems.find(\n\t\t\t(remote: DynamicCustomTypeModel | SharedSliceModel) => remote.id === local.id,\n\t\t)\n\t\tif (!remoteItem) {\n\t\t\treturn \"insert\"\n\t\t}\n\t\tif (!isEqual(local, remoteItem)) {\n\t\t\treturn \"update\"\n\t\t}\n\n\t\treturn\n\t}\n\n\t/** Create items only if they have changed compared to their remote status */\n\tprivate async upsertIfChanged(\n\t\titemType: ItemTypePath,\n\t\tlocalItems: ItemType[] = [],\n\t): Promise<void> {\n\t\tconst remoteItems = await this.getRemoteItems(itemType)\n\t\tawait Promise.all(\n\t\t\tlocalItems.map(async (localItem) => {\n\t\t\t\tconst operation = await this.getDifference(remoteItems, localItem)\n\n\t\t\t\treturn operation && this.upsert(itemType, operation, localItem)\n\t\t\t}),\n\t\t)\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.upsertIfChanged(\"customtypes\", customTypes)\n\t}\n\n\tasync deleteCustomType(customTypeId: string): Promise<void> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.delete(`customtypes/${customTypeId}`)\n\n\t\tif (!result.ok()) {\n\t\t\tlogPlaywrightApiResponse(result)\n\t\t\tthrow new Error(`Could not delete ${customTypeId} from the Custom Type api.`)\n\t\t}\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.upsertIfChanged(\"slices\", slices)\n\t}\n\n\t/**\n\t * Get a custom type by its id.\n\t *\n\t * @param customTypeId - The id of the custom type to get.\n\t */\n\tasync getTypeById(customTypeId: string): Promise<DynamicCustomTypeModel> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.get(`customtypes/${customTypeId}`)\n\n\t\tif (!result.ok()) {\n\t\t\tlogPlaywrightApiResponse(result)\n\t\t\tthrow new Error(`Could not get ${customTypeId} type from the Custom Type api.`)\n\t\t}\n\n\t\treturn result.json()\n\t}\n}\n"],"mappings":";;;;;;;AAYA,IAAa,uBAAb,cAA0CA,kBAAAA,uBAAuB;CAChE,YAAY,SAAiB,QAA4D;EACxF,MAAM,SAAS,OAAO,WAAW,EAAE,YAAY,OAAO,WAAW,CAAC;CACnE;;;;;;;;;CAUA,MAAc,OAAO,UAAwB,WAA0B,MAAgB;EACtF,MAAM,WAAWC,YAAAA,OAAO,WAAW;EACnC,MAAM,OAAO,GAAG,SAAS,GAAG;EAG5B,MAAM,SAAS,OAAM,MADC,KAAK,WAAW,EAAA,CACT,KAAK,MAAM,EAAE,KAAK,CAAC;EAChD,IAAI,CAAC,OAAO,GAAG,GAAG;GACjB,YAAA,yBAAyB,MAAM;GAC/B,MAAM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M,SAAS,OAAM,MADC,KAAK,WAAW,EAAA,CACT,IAAI,eAAe,cAAc;EAE9D,IAAI,CAAC,OAAO,GAAG,GAAG;GACjB,YAAA,yBAAyB,MAAM;GAC/B,MAAM,IAAI,MAAM,iBAAiB,aAAa,gCAAgC;EAC/E;EAEA,OAAO,OAAO,KAAK;CACpB;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customTypesApi.d.cts","names":[],"sources":["../../src/clients/customTypesApi.ts"],"mappings":";;;;;cAYa,oBAAA,SAA6B,sBAAA;cAC7B,OAAA,UAAiB,MAAA;IAAU,SAAA,EAAW,eAAA;IAAiB,UAAA;EAAA;
|
|
1
|
+
{"version":3,"file":"customTypesApi.d.cts","names":[],"sources":["../../src/clients/customTypesApi.ts"],"mappings":";;;;;cAYa,oBAAA,SAA6B,sBAAA;cAC7B,OAAA,UAAiB,MAAA;IAAU,SAAA,EAAW,eAAA;IAAiB,UAAA;EAAA;EA8EE;;;;;;;;EAAA,QAlEvD,MAAA;EAAA,QAeA,cAAA;EAAA,QAcA,aAAA;EAzCF;EAAA,QA2DE,eAAA;EA3DoC;;;;;EA8E5C,iBAAA,CAAkB,WAAA,GAAa,sBAAA,KAAgC,OAAA;EAI/D,gBAAA,CAAiB,YAAA,WAAuB,OAAA;EAJxC;;;;;EAmBA,YAAA,CAAa,MAAA,GAAQ,gBAAA,KAA0B,OAAA;EAfP;;;;;EAwBxC,WAAA,CAAY,YAAA,WAAuB,OAAA,CAAQ,sBAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customTypesApi.d.ts","names":[],"sources":["../../src/clients/customTypesApi.ts"],"mappings":";;;;;cAYa,oBAAA,SAA6B,sBAAA;cAC7B,OAAA,UAAiB,MAAA;IAAU,SAAA,EAAW,eAAA;IAAiB,UAAA;EAAA;
|
|
1
|
+
{"version":3,"file":"customTypesApi.d.ts","names":[],"sources":["../../src/clients/customTypesApi.ts"],"mappings":";;;;;cAYa,oBAAA,SAA6B,sBAAA;cAC7B,OAAA,UAAiB,MAAA;IAAU,SAAA,EAAW,eAAA;IAAiB,UAAA;EAAA;EA8EE;;;;;;;;EAAA,QAlEvD,MAAA;EAAA,QAeA,cAAA;EAAA,QAcA,aAAA;EAzCF;EAAA,QA2DE,eAAA;EA3DoC;;;;;EA8E5C,iBAAA,CAAkB,WAAA,GAAa,sBAAA,KAAgC,OAAA;EAI/D,gBAAA,CAAiB,YAAA,WAAuB,OAAA;EAJxC;;;;;EAmBA,YAAA,CAAa,MAAA,GAAQ,gBAAA,KAA0B,OAAA;EAfP;;;;;EAwBxC,WAAA,CAAY,YAAA,WAAuB,OAAA,CAAQ,sBAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customTypesApi.js","names":[],"sources":["../../src/clients/customTypesApi.ts"],"sourcesContent":["import type { DynamicCustomTypeModel, SharedSliceModel } from \"@prismicio/types-internal\"\nimport isEqual from \"lodash.isequal\"\n\nimport { logPlaywrightApiResponse, logger } from \"../utils/log\"\nimport type { AuthServerToken } from \"./apiClient\"\nimport { AuthenticatedApiClient } from \"./apiClient\"\n\ntype ItemType = DynamicCustomTypeModel | SharedSliceModel\ntype ItemTypePath = \"customtypes\" | \"slices\"\ntype ItemOperation = \"insert\" | \"update\"\n\n/** Client for interacting with the Custom Types API to create/update custom types and slices. */\nexport class CustomTypesApiClient extends AuthenticatedApiClient {\n\tconstructor(baseURL: string, config: { authToken: AuthServerToken; repository: string }) {\n\t\tsuper(baseURL, config.authToken, { repository: config.repository })\n\t}\n\n\t/**\n\t * Create or update a custom type or slice.\n\t *\n\t * @param endpoint - - The API endpoint for custom types or slices ('customtypes' or 'slices').\n\t * @param data - - The data representing the custom type or slice.\n\t * @throws Error if the item status cannot be retrieved or the item cannot be\n\t * created/updated.\n\t */\n\tprivate async upsert(endpoint: ItemTypePath, operation: ItemOperation, data: ItemType) {\n\t\tconst profiler = logger.startTimer()\n\t\tconst path = `${endpoint}/${operation}`\n\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.post(path, { data })\n\t\tif (!result.ok()) {\n\t\t\tlogPlaywrightApiResponse(result)\n\t\t\tthrow new Error(`Could not ${operation} item`)\n\t\t}\n\t\tprofiler.done({\n\t\t\tmessage: `called customtypes api /${path} for item with id '${data.id}'`,\n\t\t})\n\t}\n\n\tprivate async getRemoteItems(
|
|
1
|
+
{"version":3,"file":"customTypesApi.js","names":[],"sources":["../../src/clients/customTypesApi.ts"],"sourcesContent":["import type { DynamicCustomTypeModel, SharedSliceModel } from \"@prismicio/types-internal\"\nimport isEqual from \"lodash.isequal\"\n\nimport { logPlaywrightApiResponse, logger } from \"../utils/log\"\nimport type { AuthServerToken } from \"./apiClient\"\nimport { AuthenticatedApiClient } from \"./apiClient\"\n\ntype ItemType = DynamicCustomTypeModel | SharedSliceModel\ntype ItemTypePath = \"customtypes\" | \"slices\"\ntype ItemOperation = \"insert\" | \"update\"\n\n/** Client for interacting with the Custom Types API to create/update custom types and slices. */\nexport class CustomTypesApiClient extends AuthenticatedApiClient {\n\tconstructor(baseURL: string, config: { authToken: AuthServerToken; repository: string }) {\n\t\tsuper(baseURL, config.authToken, { repository: config.repository })\n\t}\n\n\t/**\n\t * Create or update a custom type or slice.\n\t *\n\t * @param endpoint - - The API endpoint for custom types or slices ('customtypes' or 'slices').\n\t * @param data - - The data representing the custom type or slice.\n\t * @throws Error if the item status cannot be retrieved or the item cannot be\n\t * created/updated.\n\t */\n\tprivate async upsert(endpoint: ItemTypePath, operation: ItemOperation, data: ItemType) {\n\t\tconst profiler = logger.startTimer()\n\t\tconst path = `${endpoint}/${operation}`\n\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.post(path, { data })\n\t\tif (!result.ok()) {\n\t\t\tlogPlaywrightApiResponse(result)\n\t\t\tthrow new Error(`Could not ${operation} item`)\n\t\t}\n\t\tprofiler.done({\n\t\t\tmessage: `called customtypes api /${path} for item with id '${data.id}'`,\n\t\t})\n\t}\n\n\tprivate async getRemoteItems(\n\t\tendpoint: ItemTypePath,\n\t): Promise<DynamicCustomTypeModel[] | SharedSliceModel[]> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.get(endpoint)\n\n\t\tif (!result.ok()) {\n\t\t\tlogPlaywrightApiResponse(result)\n\t\t\tthrow new Error(\"Could not get items status from the Custom Type api.\")\n\t\t}\n\n\t\treturn result.json()\n\t}\n\n\tprivate async getDifference(\n\t\tremoteItems: DynamicCustomTypeModel[] | SharedSliceModel[],\n\t\tlocal: ItemType,\n\t): Promise<ItemOperation | undefined> {\n\t\tconst remoteItem = remoteItems.find(\n\t\t\t(remote: DynamicCustomTypeModel | SharedSliceModel) => remote.id === local.id,\n\t\t)\n\t\tif (!remoteItem) {\n\t\t\treturn \"insert\"\n\t\t}\n\t\tif (!isEqual(local, remoteItem)) {\n\t\t\treturn \"update\"\n\t\t}\n\n\t\treturn\n\t}\n\n\t/** Create items only if they have changed compared to their remote status */\n\tprivate async upsertIfChanged(\n\t\titemType: ItemTypePath,\n\t\tlocalItems: ItemType[] = [],\n\t): Promise<void> {\n\t\tconst remoteItems = await this.getRemoteItems(itemType)\n\t\tawait Promise.all(\n\t\t\tlocalItems.map(async (localItem) => {\n\t\t\t\tconst operation = await this.getDifference(remoteItems, localItem)\n\n\t\t\t\treturn operation && this.upsert(itemType, operation, localItem)\n\t\t\t}),\n\t\t)\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.upsertIfChanged(\"customtypes\", customTypes)\n\t}\n\n\tasync deleteCustomType(customTypeId: string): Promise<void> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.delete(`customtypes/${customTypeId}`)\n\n\t\tif (!result.ok()) {\n\t\t\tlogPlaywrightApiResponse(result)\n\t\t\tthrow new Error(`Could not delete ${customTypeId} from the Custom Type api.`)\n\t\t}\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.upsertIfChanged(\"slices\", slices)\n\t}\n\n\t/**\n\t * Get a custom type by its id.\n\t *\n\t * @param customTypeId - The id of the custom type to get.\n\t */\n\tasync getTypeById(customTypeId: string): Promise<DynamicCustomTypeModel> {\n\t\tconst context = await this.getContext()\n\t\tconst result = await context.get(`customtypes/${customTypeId}`)\n\n\t\tif (!result.ok()) {\n\t\t\tlogPlaywrightApiResponse(result)\n\t\t\tthrow new Error(`Could not get ${customTypeId} type from the Custom Type api.`)\n\t\t}\n\n\t\treturn result.json()\n\t}\n}\n"],"mappings":";;;;;AAYA,IAAa,uBAAb,cAA0C,uBAAuB;CAChE,YAAY,SAAiB,QAA4D;EACxF,MAAM,SAAS,OAAO,WAAW,EAAE,YAAY,OAAO,WAAW,CAAC;CACnE;;;;;;;;;CAUA,MAAc,OAAO,UAAwB,WAA0B,MAAgB;EACtF,MAAM,WAAW,OAAO,WAAW;EACnC,MAAM,OAAO,GAAG,SAAS,GAAG;EAG5B,MAAM,SAAS,OAAM,MADC,KAAK,WAAW,EAAA,CACT,KAAK,MAAM,EAAE,KAAK,CAAC;EAChD,IAAI,CAAC,OAAO,GAAG,GAAG;GACjB,yBAAyB,MAAM;GAC/B,MAAM,IAAI,MAAM,aAAa,UAAU,MAAM;EAC9C;EACA,SAAS,KAAK,EACb,SAAS,2BAA2B,KAAK,qBAAqB,KAAK,GAAG,GACvE,CAAC;CACF;CAEA,MAAc,eACb,UACyD;EAEzD,MAAM,SAAS,OAAM,MADC,KAAK,WAAW,EAAA,CACT,IAAI,QAAQ;EAEzC,IAAI,CAAC,OAAO,GAAG,GAAG;GACjB,yBAAyB,MAAM;GAC/B,MAAM,IAAI,MAAM,sDAAsD;EACvE;EAEA,OAAO,OAAO,KAAK;CACpB;CAEA,MAAc,cACb,aACA,OACqC;EACrC,MAAM,aAAa,YAAY,MAC7B,WAAsD,OAAO,OAAO,MAAM,EAC5E;EACA,IAAI,CAAC,YACJ,OAAO;EAER,IAAI,CAAC,QAAQ,OAAO,UAAU,GAC7B,OAAO;CAIT;;CAGA,MAAc,gBACb,UACA,aAAyB,CAAC,GACV;EAChB,MAAM,cAAc,MAAM,KAAK,eAAe,QAAQ;EACtD,MAAM,QAAQ,IACb,WAAW,IAAI,OAAO,cAAc;GACnC,MAAM,YAAY,MAAM,KAAK,cAAc,aAAa,SAAS;GAEjE,OAAO,aAAa,KAAK,OAAO,UAAU,WAAW,SAAS;EAC/D,CAAC,CACF;CACD;;;;;;CAOA,MAAM,kBAAkB,cAAwC,CAAC,GAAkB;EAClF,MAAM,KAAK,gBAAgB,eAAe,WAAW;CACtD;CAEA,MAAM,iBAAiB,cAAqC;EAE3D,MAAM,SAAS,OAAM,MADC,KAAK,WAAW,EAAA,CACT,OAAO,eAAe,cAAc;EAEjE,IAAI,CAAC,OAAO,GAAG,GAAG;GACjB,yBAAyB,MAAM;GAC/B,MAAM,IAAI,MAAM,oBAAoB,aAAa,2BAA2B;EAC7E;CACD;;;;;;CAOA,MAAM,aAAa,SAA6B,CAAC,GAAkB;EAClE,MAAM,KAAK,gBAAgB,UAAU,MAAM;CAC5C;;;;;;CAOA,MAAM,YAAY,cAAuD;EAExE,MAAM,SAAS,OAAM,MADC,KAAK,WAAW,EAAA,CACT,IAAI,eAAe,cAAc;EAE9D,IAAI,CAAC,OAAO,GAAG,GAAG;GACjB,yBAAyB,MAAM;GAC/B,MAAM,IAAI,MAAM,iBAAiB,aAAa,gCAAgC;EAC/E;EAEA,OAAO,OAAO,KAAK;CACpB;AACD"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AuthConfig, IntegrationFieldConfig, IntegrationFieldData, ManageV2Config, SetupConfiguration, UrlConfig } from "./types.cjs";
|
|
2
2
|
import { AssetApiClient, AssetApiCreatePayload, AssetApiCreateResponse, AssetApiResponse } from "./clients/assetApi.cjs";
|
|
3
3
|
import { ContentApiClient, ContentApiDocument, ContentApiError, ContentApiGraphQLResponse, ContentApiRef, ContentApiSearchResponse } from "./clients/contentApi.cjs";
|
|
4
|
-
import { CoreApiClient, CoreApiDocumentCreationPayload, CoreApiDocumentCreationResponse, CoreApiDocumentData, CoreApiDocumentsPayload, CoreApiDocumentsResponse, CoreApiRepository, Release } from "./clients/coreApi.cjs";
|
|
4
|
+
import { CoreApiClient, CoreApiDocumentCreationPayload, CoreApiDocumentCreationResponse, CoreApiDocumentData, CoreApiDocumentUpdatePayload, CoreApiDocumentsPayload, CoreApiDocumentsResponse, CoreApiRepository, Release } from "./clients/coreApi.cjs";
|
|
5
5
|
import { MigrationApiClient, MigrationApiDocumentPayload, MigrationApiDocumentResponse } from "./clients/migrationApi.cjs";
|
|
6
6
|
import { CustomLocale, Preview, RepositoryConfig, RepositoryManager } from "./managers/repository.cjs";
|
|
7
7
|
import { RepositoriesManager, createRepositoriesManager } from "./managers/repositories.cjs";
|
|
8
|
-
export { AssetApiClient, AssetApiCreatePayload, AssetApiCreateResponse, AssetApiResponse, AuthConfig, ContentApiClient, ContentApiDocument, ContentApiError, ContentApiGraphQLResponse, ContentApiRef, ContentApiSearchResponse, CoreApiClient, CoreApiDocumentCreationPayload, CoreApiDocumentCreationResponse, CoreApiDocumentData, CoreApiDocumentsPayload, CoreApiDocumentsResponse, CoreApiRepository, CustomLocale, IntegrationFieldConfig, IntegrationFieldData, ManageV2Config, MigrationApiClient, MigrationApiDocumentPayload, MigrationApiDocumentResponse, Preview, Release, RepositoriesManager, RepositoryConfig, RepositoryManager, SetupConfiguration, UrlConfig, createRepositoriesManager };
|
|
8
|
+
export { AssetApiClient, AssetApiCreatePayload, AssetApiCreateResponse, AssetApiResponse, AuthConfig, ContentApiClient, ContentApiDocument, ContentApiError, ContentApiGraphQLResponse, ContentApiRef, ContentApiSearchResponse, CoreApiClient, CoreApiDocumentCreationPayload, CoreApiDocumentCreationResponse, CoreApiDocumentData, CoreApiDocumentUpdatePayload, CoreApiDocumentsPayload, CoreApiDocumentsResponse, CoreApiRepository, CustomLocale, IntegrationFieldConfig, IntegrationFieldData, ManageV2Config, MigrationApiClient, MigrationApiDocumentPayload, MigrationApiDocumentResponse, Preview, Release, RepositoriesManager, RepositoryConfig, RepositoryManager, SetupConfiguration, UrlConfig, createRepositoriesManager };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AuthConfig, IntegrationFieldConfig, IntegrationFieldData, ManageV2Config, SetupConfiguration, UrlConfig } from "./types.js";
|
|
2
2
|
import { AssetApiClient, AssetApiCreatePayload, AssetApiCreateResponse, AssetApiResponse } from "./clients/assetApi.js";
|
|
3
3
|
import { ContentApiClient, ContentApiDocument, ContentApiError, ContentApiGraphQLResponse, ContentApiRef, ContentApiSearchResponse } from "./clients/contentApi.js";
|
|
4
|
-
import { CoreApiClient, CoreApiDocumentCreationPayload, CoreApiDocumentCreationResponse, CoreApiDocumentData, CoreApiDocumentsPayload, CoreApiDocumentsResponse, CoreApiRepository, Release } from "./clients/coreApi.js";
|
|
4
|
+
import { CoreApiClient, CoreApiDocumentCreationPayload, CoreApiDocumentCreationResponse, CoreApiDocumentData, CoreApiDocumentUpdatePayload, CoreApiDocumentsPayload, CoreApiDocumentsResponse, CoreApiRepository, Release } from "./clients/coreApi.js";
|
|
5
5
|
import { MigrationApiClient, MigrationApiDocumentPayload, MigrationApiDocumentResponse } from "./clients/migrationApi.js";
|
|
6
6
|
import { CustomLocale, Preview, RepositoryConfig, RepositoryManager } from "./managers/repository.js";
|
|
7
7
|
import { RepositoriesManager, createRepositoriesManager } from "./managers/repositories.js";
|
|
8
|
-
export { AssetApiClient, AssetApiCreatePayload, AssetApiCreateResponse, AssetApiResponse, AuthConfig, ContentApiClient, ContentApiDocument, ContentApiError, ContentApiGraphQLResponse, ContentApiRef, ContentApiSearchResponse, CoreApiClient, CoreApiDocumentCreationPayload, CoreApiDocumentCreationResponse, CoreApiDocumentData, CoreApiDocumentsPayload, CoreApiDocumentsResponse, CoreApiRepository, CustomLocale, IntegrationFieldConfig, IntegrationFieldData, ManageV2Config, MigrationApiClient, MigrationApiDocumentPayload, MigrationApiDocumentResponse, Preview, Release, RepositoriesManager, RepositoryConfig, RepositoryManager, SetupConfiguration, UrlConfig, createRepositoriesManager };
|
|
8
|
+
export { AssetApiClient, AssetApiCreatePayload, AssetApiCreateResponse, AssetApiResponse, AuthConfig, ContentApiClient, ContentApiDocument, ContentApiError, ContentApiGraphQLResponse, ContentApiRef, ContentApiSearchResponse, CoreApiClient, CoreApiDocumentCreationPayload, CoreApiDocumentCreationResponse, CoreApiDocumentData, CoreApiDocumentUpdatePayload, CoreApiDocumentsPayload, CoreApiDocumentsResponse, CoreApiRepository, CustomLocale, IntegrationFieldConfig, IntegrationFieldData, ManageV2Config, MigrationApiClient, MigrationApiDocumentPayload, MigrationApiDocumentResponse, Preview, Release, RepositoriesManager, RepositoryConfig, RepositoryManager, SetupConfiguration, UrlConfig, createRepositoriesManager };
|