@prismicio/e2e-tests-utils 1.4.0-alpha.2 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -9
- package/dist/clients/apiClient.cjs +39 -0
- package/dist/clients/apiClient.cjs.map +1 -0
- package/dist/clients/apiClient.d.ts +30 -0
- package/dist/clients/apiClient.js +39 -0
- package/dist/clients/apiClient.js.map +1 -0
- package/dist/clients/authenticationApi.cjs +54 -34
- package/dist/clients/authenticationApi.cjs.map +1 -1
- package/dist/clients/authenticationApi.d.ts +13 -5
- package/dist/clients/authenticationApi.js +55 -35
- package/dist/clients/authenticationApi.js.map +1 -1
- package/dist/clients/contentApi.cjs +20 -50
- package/dist/clients/contentApi.cjs.map +1 -1
- package/dist/clients/contentApi.d.ts +27 -37
- package/dist/clients/contentApi.js +20 -50
- package/dist/clients/contentApi.js.map +1 -1
- package/dist/clients/coreApi.cjs +36 -31
- package/dist/clients/coreApi.cjs.map +1 -1
- package/dist/clients/coreApi.d.ts +21 -3
- package/dist/clients/coreApi.js +37 -32
- package/dist/clients/coreApi.js.map +1 -1
- package/dist/clients/customTypesApi.cjs +48 -42
- package/dist/clients/customTypesApi.cjs.map +1 -1
- package/dist/clients/customTypesApi.d.ts +34 -6
- package/dist/clients/customTypesApi.js +49 -43
- package/dist/clients/customTypesApi.js.map +1 -1
- package/dist/clients/migrationApi.cjs +30 -29
- package/dist/clients/migrationApi.cjs.map +1 -1
- package/dist/clients/migrationApi.d.ts +27 -5
- package/dist/clients/migrationApi.js +31 -30
- package/dist/clients/migrationApi.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/managers/repositories.cjs +19 -9
- package/dist/managers/repositories.cjs.map +1 -1
- package/dist/managers/repositories.d.ts +2 -2
- package/dist/managers/repositories.js +23 -13
- package/dist/managers/repositories.js.map +1 -1
- package/dist/managers/repository.cjs +9 -1
- package/dist/managers/repository.cjs.map +1 -1
- package/dist/managers/repository.d.ts +6 -4
- package/dist/managers/repository.js +9 -1
- package/dist/managers/repository.js.map +1 -1
- package/dist/utils/log.cjs +4 -0
- package/dist/utils/log.cjs.map +1 -1
- package/dist/utils/log.d.ts +2 -0
- package/dist/utils/log.js +4 -0
- package/dist/utils/log.js.map +1 -1
- package/package.json +3 -1
- package/src/clients/apiClient.ts +48 -0
- package/src/clients/authenticationApi.ts +52 -50
- package/src/clients/contentApi.ts +54 -45
- package/src/clients/coreApi.ts +36 -42
- package/src/clients/customTypesApi.ts +34 -59
- package/src/clients/migrationApi.ts +36 -45
- package/src/managers/repositories.ts +26 -20
- package/src/managers/repository.ts +21 -8
- package/src/utils/log.ts +11 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { APIResponse } from "@playwright/test";
|
|
2
|
-
|
|
2
|
+
import { AuthenticatedApiClient } from "./apiClient";
|
|
3
|
+
export interface ContentApiError {
|
|
3
4
|
type: string;
|
|
4
5
|
message: string;
|
|
5
6
|
}
|
|
6
|
-
export interface
|
|
7
|
+
export interface ContentApiSearchResponse {
|
|
7
8
|
page: number;
|
|
8
9
|
results_per_page: number;
|
|
9
10
|
results_size: number;
|
|
@@ -11,9 +12,9 @@ export interface SearchResponse {
|
|
|
11
12
|
total_pages: number;
|
|
12
13
|
next_page: string | null;
|
|
13
14
|
prev_page: string | null;
|
|
14
|
-
results:
|
|
15
|
+
results: ContentApiDocument[];
|
|
15
16
|
}
|
|
16
|
-
export interface
|
|
17
|
+
export interface ContentApiDocument {
|
|
17
18
|
id: string;
|
|
18
19
|
uid: string | null;
|
|
19
20
|
url: string | null;
|
|
@@ -28,35 +29,20 @@ export interface Document {
|
|
|
28
29
|
alternate_languages: string[];
|
|
29
30
|
data: Record<string, any>;
|
|
30
31
|
}
|
|
31
|
-
export interface
|
|
32
|
+
export interface ContentApiGraphQLResponse {
|
|
32
33
|
data: Record<string, any>;
|
|
33
34
|
errors?: {
|
|
34
35
|
message: string;
|
|
35
36
|
locations: any;
|
|
36
37
|
}[];
|
|
37
38
|
}
|
|
38
|
-
export interface
|
|
39
|
+
export interface ContentApiRef {
|
|
39
40
|
id: string;
|
|
40
41
|
ref: string;
|
|
41
42
|
label: string;
|
|
42
43
|
isMasterRef?: boolean;
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
-
refs: Ref[];
|
|
46
|
-
bookmarks: Record<string, unknown>;
|
|
47
|
-
types: Record<string, string>;
|
|
48
|
-
languages: {
|
|
49
|
-
id: string;
|
|
50
|
-
name: string;
|
|
51
|
-
is_master: boolean;
|
|
52
|
-
}[];
|
|
53
|
-
oauth_initiate: string;
|
|
54
|
-
oauth_token: string;
|
|
55
|
-
tags: string[];
|
|
56
|
-
license: string;
|
|
57
|
-
version: string;
|
|
58
|
-
}
|
|
59
|
-
export type QueryParams = {
|
|
45
|
+
type SearchQueryParams = {
|
|
60
46
|
ref?: string;
|
|
61
47
|
query?: string;
|
|
62
48
|
q?: string;
|
|
@@ -72,17 +58,21 @@ export type QueryParams = {
|
|
|
72
58
|
type ApiVersions = "v1" | "v2";
|
|
73
59
|
/**
|
|
74
60
|
* Client to query the Prismic content api. Uses Playwright to benefit from
|
|
75
|
-
* network request traces in your reports.
|
|
76
|
-
* used but had too many abstractions (caching, error handling) that we didn't
|
|
77
|
-
* want for test execution. See api docs:
|
|
61
|
+
* network request traces in your reports. See api docs:
|
|
78
62
|
* https://prismic.io/docs/rest-api-technical-reference
|
|
79
63
|
*/
|
|
80
|
-
export declare class ContentApiClient {
|
|
81
|
-
|
|
82
|
-
private
|
|
64
|
+
export declare class ContentApiClient extends AuthenticatedApiClient {
|
|
65
|
+
private version;
|
|
66
|
+
private accessToken;
|
|
83
67
|
/**
|
|
84
|
-
* @example
|
|
85
|
-
*
|
|
68
|
+
* @example To instantiate the class:
|
|
69
|
+
*
|
|
70
|
+
* ```js
|
|
71
|
+
* new ContentApiClient("https://my-repo.cdn.prismic.io", {
|
|
72
|
+
* version: "v2",
|
|
73
|
+
* accessToken: "my-secret-token",
|
|
74
|
+
* });
|
|
75
|
+
* ```
|
|
86
76
|
*
|
|
87
77
|
* @param baseURL - the api base URL like https://my-repo.cdn.prismic.io
|
|
88
78
|
* @param config - Optional configuration
|
|
@@ -95,21 +85,21 @@ export declare class ContentApiClient {
|
|
|
95
85
|
version?: ApiVersions;
|
|
96
86
|
accessToken?: string;
|
|
97
87
|
});
|
|
98
|
-
get(path: string, params?:
|
|
99
|
-
getAsJson<T>(url: string, params?:
|
|
88
|
+
get(path: string, params?: SearchQueryParams, headers?: Record<string, string>): Promise<APIResponse>;
|
|
89
|
+
getAsJson<T>(url: string, params?: SearchQueryParams, headers?: Record<string, string>): Promise<T>;
|
|
100
90
|
/** Query the graphql api - https://prismic.io/docs/graphql-technical-reference */
|
|
101
|
-
graphql(ref: string, query: string): Promise<
|
|
102
|
-
getRefs(): Promise<
|
|
91
|
+
graphql(ref: string, query: string): Promise<ContentApiGraphQLResponse>;
|
|
92
|
+
getRefs(): Promise<ContentApiRef[]>;
|
|
103
93
|
getMasterRef(): Promise<string>;
|
|
104
94
|
getRefByReleaseID(releaseID: string): Promise<string>;
|
|
105
95
|
/** Search documents from the `/api/v<version>/documents/search` endpoint. */
|
|
106
|
-
search(filters?:
|
|
96
|
+
search(filters?: SearchQueryParams): Promise<ContentApiSearchResponse>;
|
|
107
97
|
/**
|
|
108
98
|
* Search for a single document by its it, using the
|
|
109
99
|
* `/api/v<version>/documents/search` endpoint and a default filter.
|
|
110
100
|
*/
|
|
111
|
-
searchByID(id: string, filters?:
|
|
101
|
+
searchByID(id: string, filters?: SearchQueryParams): Promise<ContentApiSearchResponse>;
|
|
112
102
|
/** Retrieve a single document or undefined if not found. */
|
|
113
|
-
getDocumentByID(id: string, filters?:
|
|
103
|
+
getDocumentByID(id: string, filters?: SearchQueryParams): Promise<ContentApiDocument | undefined>;
|
|
114
104
|
}
|
|
115
105
|
export {};
|
|
@@ -4,34 +4,17 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
throw TypeError("Cannot " + msg);
|
|
10
|
-
};
|
|
11
|
-
var __privateGet = (obj, member, getter) => {
|
|
12
|
-
__accessCheck(obj, member, "read from private field");
|
|
13
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
14
|
-
};
|
|
15
|
-
var __privateAdd = (obj, member, value) => {
|
|
16
|
-
if (member.has(obj))
|
|
17
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
18
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
19
|
-
};
|
|
20
|
-
var __privateSet = (obj, member, value, setter) => {
|
|
21
|
-
__accessCheck(obj, member, "write to private field");
|
|
22
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
23
|
-
return value;
|
|
24
|
-
};
|
|
25
|
-
var __privateMethod = (obj, member, method) => {
|
|
26
|
-
__accessCheck(obj, member, "access private method");
|
|
27
|
-
return method;
|
|
28
|
-
};
|
|
29
|
-
var _version, _accessToken, _context, context_fn;
|
|
30
|
-
import { request } from "@playwright/test";
|
|
31
|
-
class ContentApiClient {
|
|
7
|
+
import { AuthenticatedApiClient } from "./apiClient.js";
|
|
8
|
+
class ContentApiClient extends AuthenticatedApiClient {
|
|
32
9
|
/**
|
|
33
|
-
* @example
|
|
34
|
-
*
|
|
10
|
+
* @example To instantiate the class:
|
|
11
|
+
*
|
|
12
|
+
* ```js
|
|
13
|
+
* new ContentApiClient("https://my-repo.cdn.prismic.io", {
|
|
14
|
+
* version: "v2",
|
|
15
|
+
* accessToken: "my-secret-token",
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
35
18
|
*
|
|
36
19
|
* @param baseURL - the api base URL like https://my-repo.cdn.prismic.io
|
|
37
20
|
* @param config - Optional configuration
|
|
@@ -41,18 +24,16 @@ class ContentApiClient {
|
|
|
41
24
|
* https://prismic.io/docs/access-token
|
|
42
25
|
*/
|
|
43
26
|
constructor(baseURL, config = {}) {
|
|
44
|
-
|
|
45
|
-
__publicField(this, "
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
this.
|
|
49
|
-
__privateSet(this, _version, config.version || "v2");
|
|
50
|
-
__privateSet(this, _accessToken, config.accessToken);
|
|
27
|
+
super(baseURL, config.accessToken || "");
|
|
28
|
+
__publicField(this, "version");
|
|
29
|
+
__publicField(this, "accessToken");
|
|
30
|
+
this.version = config.version || "v2";
|
|
31
|
+
this.accessToken = config.accessToken;
|
|
51
32
|
}
|
|
52
33
|
async get(path, params, headers) {
|
|
53
|
-
const context = await
|
|
34
|
+
const context = await this.getContext();
|
|
54
35
|
const securityParams = {
|
|
55
|
-
...
|
|
36
|
+
...this.accessToken ? { access_token: this.accessToken } : {}
|
|
56
37
|
};
|
|
57
38
|
return context.get(path, {
|
|
58
39
|
params: { ...securityParams, ...params },
|
|
@@ -65,10 +46,10 @@ class ContentApiClient {
|
|
|
65
46
|
}
|
|
66
47
|
/** Query the graphql api - https://prismic.io/docs/graphql-technical-reference */
|
|
67
48
|
async graphql(ref, query) {
|
|
68
|
-
return this.getAsJson("
|
|
49
|
+
return this.getAsJson("graphql", { query }, { "Prismic-ref": ref });
|
|
69
50
|
}
|
|
70
51
|
async getRefs() {
|
|
71
|
-
const data = await this.getAsJson(
|
|
52
|
+
const data = await this.getAsJson(`api/${this.version}`);
|
|
72
53
|
return data.refs;
|
|
73
54
|
}
|
|
74
55
|
async getMasterRef() {
|
|
@@ -93,7 +74,7 @@ class ContentApiClient {
|
|
|
93
74
|
if (!ref) {
|
|
94
75
|
ref = await this.getMasterRef();
|
|
95
76
|
}
|
|
96
|
-
return this.getAsJson(
|
|
77
|
+
return this.getAsJson(`api/${this.version}/documents/search`, {
|
|
97
78
|
...filters,
|
|
98
79
|
ref
|
|
99
80
|
});
|
|
@@ -118,17 +99,6 @@ class ContentApiClient {
|
|
|
118
99
|
}
|
|
119
100
|
}
|
|
120
101
|
}
|
|
121
|
-
_version = new WeakMap();
|
|
122
|
-
_accessToken = new WeakMap();
|
|
123
|
-
_context = new WeakSet();
|
|
124
|
-
context_fn = function() {
|
|
125
|
-
return request.newContext({
|
|
126
|
-
baseURL: this.baseURL,
|
|
127
|
-
// reset any Authorization header set globally with Playwright
|
|
128
|
-
// didn't find a way to delete it
|
|
129
|
-
extraHTTPHeaders: { Authorization: "" }
|
|
130
|
-
});
|
|
131
|
-
};
|
|
132
102
|
export {
|
|
133
103
|
ContentApiClient
|
|
134
104
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contentApi.js","sources":["../../../src/clients/contentApi.ts"],"sourcesContent":["import { APIResponse
|
|
1
|
+
{"version":3,"file":"contentApi.js","sources":["../../../src/clients/contentApi.ts"],"sourcesContent":["import { 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: string[];\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}\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\n * network request traces in your reports. See api docs:\n * 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 To instantiate the class:\n\t *\n\t * ```js\n\t * new ContentApiClient(\"https://my-repo.cdn.prismic.io\", {\n\t * \tversion: \"v2\",\n\t * \taccessToken: \"my-secret-token\",\n\t * });\n\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(\n\t\tbaseURL: string,\n\t\tconfig: { version?: ApiVersions; accessToken?: string } = {},\n\t) {\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 = {\n\t\t\t...(this.accessToken ? { access_token: this.accessToken } : {}),\n\t\t};\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(\n\t\tref: string,\n\t\tquery: string,\n\t): Promise<ContentApiGraphQLResponse> {\n\t\treturn this.getAsJson<ContentApiGraphQLResponse>(\n\t\t\t\"graphql\",\n\t\t\t{ query },\n\t\t\t{ \"Prismic-ref\": ref },\n\t\t);\n\t}\n\n\tasync getRefs(): Promise<ContentApiRef[]> {\n\t\tconst data = await this.getAsJson<ContentApiRepoConfigResponse>(\n\t\t\t`api/${this.version}`,\n\t\t);\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>(\n\t\t\t`api/${this.version}/documents/search`,\n\t\t\t{\n\t\t\t\t...filters,\n\t\t\t\tref,\n\t\t\t},\n\t\t);\n\t}\n\n\t/**\n\t * Search for a single document by its it, using the\n\t * `/api/v<version>/documents/search` endpoint and a default filter.\n\t */\n\tasync searchByID(\n\t\tid: string,\n\t\tfilters?: SearchQueryParams,\n\t): 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"],"names":[],"mappings":";;;;;;;AAuFM,MAAO,yBAAyB,uBAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqB3D,YACC,SACA,SAA0D,IAAE;AAKtD,UAAA,SAAS,OAAO,eAAe,EAAE;AA3BhC;AACA;AA2BF,SAAA,UAAU,OAAO,WAAW;AACjC,SAAK,cAAc,OAAO;AAAA,EAC3B;AAAA,EAEA,MAAM,IACL,MACA,QACA,SAAgC;AAE1B,UAAA,UAAU,MAAM,KAAK;AAC3B,UAAM,iBAAiB;AAAA,MACtB,GAAI,KAAK,cAAc,EAAE,cAAc,KAAK,YAAA,IAAgB;;AAGtD,WAAA,QAAQ,IAAI,MAAM;AAAA,MACxB,QAAQ,EAAE,GAAG,gBAAgB,GAAG,OAAQ;AAAA,MACxC;AAAA,IAAA,CACA;AAAA,EACF;AAAA,EAEA,MAAM,UACL,KACA,QACA,SAAgC;AAEhC,UAAM,WAAW,MAAM,KAAK,IAAI,KAAK,QAAQ,OAAO;AAEpD,WAAO,SAAS;EACjB;AAAA;AAAA,EAGA,MAAM,QACL,KACA,OAAa;AAEN,WAAA,KAAK,UACX,WACA,EAAE,SACF,EAAE,eAAe,IAAA,CAAK;AAAA,EAExB;AAAA,EAEA,MAAM,UAAO;AACZ,UAAM,OAAO,MAAM,KAAK,UACvB,OAAO,KAAK,OAAO,EAAE;AAGtB,WAAO,KAAK;AAAA,EACb;AAAA,EAEA,MAAM,eAAY;AACX,UAAA,OAAO,MAAM,KAAK;AAElB,UAAA,YAAY,KAAK,KAAK,CAAC,EAAE,kBAAkB,gBAAgB,IAAI;AACrE,QAAI,CAAC,WAAW;AACT,YAAA;AAAA,IACP;AAEA,WAAO,UAAU;AAAA,EAClB;AAAA,EAEA,MAAM,kBAAkB,WAAiB;AAClC,UAAA,OAAO,MAAM,KAAK;AAClB,UAAA,UAAU,KAAK,KAAK,CAAC,EAAE,SAAS,OAAO,SAAS;AACtD,QAAI,CAAC,SAAS;AACb,YAAM,4BAA4B,SAAS;AAAA,IAC5C;AAEA,WAAO,QAAQ;AAAA,EAChB;AAAA;AAAA,EAGA,MAAM,OAAO,SAA2B;AACvC,QAAI,MAAM,mCAAS;AACnB,QAAI,CAAC,KAAK;AACH,YAAA,MAAM,KAAK;IAClB;AAEA,WAAO,KAAK,UACX,OAAO,KAAK,OAAO,qBACnB;AAAA,MACC,GAAG;AAAA,MACH;AAAA,IAAA,CACA;AAAA,EAEH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,WACL,IACA,SAA2B;AAEpB,WAAA,KAAK,OAAO,EAAE,GAAG,SAAS,GAAG,sBAAsB,EAAE,OAAA,CAAQ;AAAA,EACrE;AAAA;AAAA,EAGA,MAAM,gBACL,IACA,SAA2B;AAE3B,UAAM,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO;AAC9C,YAAQ,KAAK,cAAc;AAAA,MAC1B,KAAK;AACJ;AAAA,MACD,KAAK;AACG,eAAA,KAAK,QAAQ,CAAC;AAAA,MACtB;AACC,cAAM,IAAI,MAAM,gDAAgD,EAAE,EAAE;AAAA,IACtE;AAAA,EACD;AACA;"}
|
package/dist/clients/coreApi.cjs
CHANGED
|
@@ -1,44 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const axios = require("axios");
|
|
4
3
|
const log = require("../utils/log.cjs");
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
4
|
+
const apiClient = require("./apiClient.cjs");
|
|
5
|
+
class CoreApiClient extends apiClient.AuthenticatedApiClient {
|
|
6
|
+
/**
|
|
7
|
+
* @example To instantiate the class:
|
|
8
|
+
*
|
|
9
|
+
* ```js
|
|
10
|
+
* new CoreApiClient("https://my-repo.prismic.io", {
|
|
11
|
+
* authToken: "my-secret-token",
|
|
12
|
+
* });
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @param baseURL - the api base URL like https://my-repo.prismic.io
|
|
16
|
+
* @param config - Optional configuration
|
|
17
|
+
*
|
|
18
|
+
* - {@link config.authToken}: Api token generated from the auth service or a
|
|
19
|
+
* function to fetch it when it's needed.
|
|
20
|
+
*/
|
|
21
|
+
constructor(baseURL, config) {
|
|
22
|
+
super(baseURL, config);
|
|
23
|
+
}
|
|
24
|
+
async getLanguages() {
|
|
20
25
|
const profiler = log.logger.startTimer();
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
const context = await this.getContext();
|
|
27
|
+
const result = await context.get("core/repository");
|
|
28
|
+
if (200 !== result.status() || !(await result.json()).languages) {
|
|
29
|
+
await log.logPlaywrightApiResponse(result);
|
|
24
30
|
throw new Error("Could not get languages from the core api.");
|
|
25
31
|
}
|
|
26
32
|
profiler.done({ message: "retrieved languages configuration" });
|
|
27
|
-
return result.
|
|
33
|
+
return (await result.json()).languages;
|
|
28
34
|
}
|
|
29
|
-
async
|
|
30
|
-
const
|
|
31
|
-
|
|
35
|
+
async publishDraft(documentId) {
|
|
36
|
+
const context = await this.getContext();
|
|
37
|
+
const result = await context.patch(`core/documents/${documentId}/draft`, {
|
|
38
|
+
data: {
|
|
39
|
+
status: "published"
|
|
40
|
+
}
|
|
32
41
|
});
|
|
33
|
-
if (204 !== result.status) {
|
|
34
|
-
log.
|
|
42
|
+
if (204 !== result.status()) {
|
|
43
|
+
await log.logPlaywrightApiResponse(result);
|
|
35
44
|
throw new Error(`Could not publish document with id ${documentId}`);
|
|
36
45
|
}
|
|
37
46
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
publishDraft
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
exports.createCoreApiClient = createCoreApiClient;
|
|
47
|
+
}
|
|
48
|
+
exports.CoreApiClient = CoreApiClient;
|
|
44
49
|
//# sourceMappingURL=coreApi.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreApi.cjs","sources":["../../../src/clients/coreApi.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"coreApi.cjs","sources":["../../../src/clients/coreApi.ts"],"sourcesContent":["import { logPlaywrightApiResponse, logger } from \"../utils/log\";\n\nimport { AuthServerToken, AuthenticatedApiClient } from \"./apiClient\";\n\ntype Language = {\n\tid: string;\n\tname: string;\n\tis_master: boolean;\n};\n\nexport type CoreClient = {\n\tgetLanguages(): Promise<Language[]>;\n\tpublishDraft(documentId: string): Promise<void>;\n};\n\nexport class CoreApiClient extends AuthenticatedApiClient {\n\t/**\n\t * @example To instantiate the class:\n\t *\n\t * ```js\n\t * new CoreApiClient(\"https://my-repo.prismic.io\", {\n\t * \tauthToken: \"my-secret-token\",\n\t * });\n\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\n\t * function to fetch it 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\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"],"names":["AuthenticatedApiClient","logger","logPlaywrightApiResponse"],"mappings":";;;;AAeM,MAAO,sBAAsBA,UAAAA,uBAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBxD,YAAY,SAAiB,QAAuB;AACnD,UAAM,SAAS,MAAM;AAAA,EACtB;AAAA,EAEA,MAAM,eAAY;AACX,UAAA,WAAWC,WAAO;AAClB,UAAA,UAAU,MAAM,KAAK;AAC3B,UAAM,SAAS,MAAM,QAAQ,IAAI,iBAAiB;AAE9C,QAAA,QAAQ,OAAO,OAAM,KAAM,EAAE,MAAM,OAAO,KAAI,GAAI,WAAW;AAChE,YAAMC,IAAAA,yBAAyB,MAAM;AAC/B,YAAA,IAAI,MAAM,4CAA4C;AAAA,IAC7D;AAEA,aAAS,KAAK,EAAE,SAAS,oCAAqC,CAAA;AAEtD,YAAA,MAAM,OAAO,KAAA,GAAQ;AAAA,EAC9B;AAAA,EAEA,MAAM,aAAa,YAAkB;AAC9B,UAAA,UAAU,MAAM,KAAK;AAC3B,UAAM,SAAS,MAAM,QAAQ,MAAM,kBAAkB,UAAU,UAAU;AAAA,MACxE,MAAM;AAAA,QACL,QAAQ;AAAA,MACR;AAAA,IAAA,CACD;AAEG,QAAA,QAAQ,OAAO,UAAU;AAC5B,YAAMA,IAAAA,yBAAyB,MAAM;AACrC,YAAM,IAAI,MAAM,sCAAsC,UAAU,EAAE;AAAA,IACnE;AAAA,EACD;AACA;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AuthServerToken, AuthenticatedApiClient } from "./apiClient";
|
|
2
2
|
type Language = {
|
|
3
3
|
id: string;
|
|
4
4
|
name: string;
|
|
@@ -8,6 +8,24 @@ export type CoreClient = {
|
|
|
8
8
|
getLanguages(): Promise<Language[]>;
|
|
9
9
|
publishDraft(documentId: string): Promise<void>;
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
export declare class CoreApiClient extends AuthenticatedApiClient {
|
|
12
|
+
/**
|
|
13
|
+
* @example To instantiate the class:
|
|
14
|
+
*
|
|
15
|
+
* ```js
|
|
16
|
+
* new CoreApiClient("https://my-repo.prismic.io", {
|
|
17
|
+
* authToken: "my-secret-token",
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @param baseURL - the api base URL like https://my-repo.prismic.io
|
|
22
|
+
* @param config - Optional configuration
|
|
23
|
+
*
|
|
24
|
+
* - {@link config.authToken}: Api token generated from the auth service or a
|
|
25
|
+
* function to fetch it when it's needed.
|
|
26
|
+
*/
|
|
27
|
+
constructor(baseURL: string, config: AuthServerToken);
|
|
28
|
+
getLanguages(): Promise<Language[]>;
|
|
29
|
+
publishDraft(documentId: string): Promise<void>;
|
|
30
|
+
}
|
|
13
31
|
export {};
|
package/dist/clients/coreApi.js
CHANGED
|
@@ -1,44 +1,49 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { logger, logPlaywrightApiResponse } from "../utils/log.js";
|
|
2
|
+
import { AuthenticatedApiClient } from "./apiClient.js";
|
|
3
|
+
class CoreApiClient extends AuthenticatedApiClient {
|
|
4
|
+
/**
|
|
5
|
+
* @example To instantiate the class:
|
|
6
|
+
*
|
|
7
|
+
* ```js
|
|
8
|
+
* new CoreApiClient("https://my-repo.prismic.io", {
|
|
9
|
+
* authToken: "my-secret-token",
|
|
10
|
+
* });
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @param baseURL - the api base URL like https://my-repo.prismic.io
|
|
14
|
+
* @param config - Optional configuration
|
|
15
|
+
*
|
|
16
|
+
* - {@link config.authToken}: Api token generated from the auth service or a
|
|
17
|
+
* function to fetch it when it's needed.
|
|
18
|
+
*/
|
|
19
|
+
constructor(baseURL, config) {
|
|
20
|
+
super(baseURL, config);
|
|
21
|
+
}
|
|
22
|
+
async getLanguages() {
|
|
18
23
|
const profiler = logger.startTimer();
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
const context = await this.getContext();
|
|
25
|
+
const result = await context.get("core/repository");
|
|
26
|
+
if (200 !== result.status() || !(await result.json()).languages) {
|
|
27
|
+
await logPlaywrightApiResponse(result);
|
|
22
28
|
throw new Error("Could not get languages from the core api.");
|
|
23
29
|
}
|
|
24
30
|
profiler.done({ message: "retrieved languages configuration" });
|
|
25
|
-
return result.
|
|
31
|
+
return (await result.json()).languages;
|
|
26
32
|
}
|
|
27
|
-
async
|
|
28
|
-
const
|
|
29
|
-
|
|
33
|
+
async publishDraft(documentId) {
|
|
34
|
+
const context = await this.getContext();
|
|
35
|
+
const result = await context.patch(`core/documents/${documentId}/draft`, {
|
|
36
|
+
data: {
|
|
37
|
+
status: "published"
|
|
38
|
+
}
|
|
30
39
|
});
|
|
31
|
-
if (204 !== result.status) {
|
|
32
|
-
|
|
40
|
+
if (204 !== result.status()) {
|
|
41
|
+
await logPlaywrightApiResponse(result);
|
|
33
42
|
throw new Error(`Could not publish document with id ${documentId}`);
|
|
34
43
|
}
|
|
35
44
|
}
|
|
36
|
-
|
|
37
|
-
getLanguages,
|
|
38
|
-
publishDraft
|
|
39
|
-
};
|
|
40
|
-
};
|
|
45
|
+
}
|
|
41
46
|
export {
|
|
42
|
-
|
|
47
|
+
CoreApiClient
|
|
43
48
|
};
|
|
44
49
|
//# sourceMappingURL=coreApi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreApi.js","sources":["../../../src/clients/coreApi.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"coreApi.js","sources":["../../../src/clients/coreApi.ts"],"sourcesContent":["import { logPlaywrightApiResponse, logger } from \"../utils/log\";\n\nimport { AuthServerToken, AuthenticatedApiClient } from \"./apiClient\";\n\ntype Language = {\n\tid: string;\n\tname: string;\n\tis_master: boolean;\n};\n\nexport type CoreClient = {\n\tgetLanguages(): Promise<Language[]>;\n\tpublishDraft(documentId: string): Promise<void>;\n};\n\nexport class CoreApiClient extends AuthenticatedApiClient {\n\t/**\n\t * @example To instantiate the class:\n\t *\n\t * ```js\n\t * new CoreApiClient(\"https://my-repo.prismic.io\", {\n\t * \tauthToken: \"my-secret-token\",\n\t * });\n\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\n\t * function to fetch it 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\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"],"names":[],"mappings":";;AAeM,MAAO,sBAAsB,uBAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBxD,YAAY,SAAiB,QAAuB;AACnD,UAAM,SAAS,MAAM;AAAA,EACtB;AAAA,EAEA,MAAM,eAAY;AACX,UAAA,WAAW,OAAO;AAClB,UAAA,UAAU,MAAM,KAAK;AAC3B,UAAM,SAAS,MAAM,QAAQ,IAAI,iBAAiB;AAE9C,QAAA,QAAQ,OAAO,OAAM,KAAM,EAAE,MAAM,OAAO,KAAI,GAAI,WAAW;AAChE,YAAM,yBAAyB,MAAM;AAC/B,YAAA,IAAI,MAAM,4CAA4C;AAAA,IAC7D;AAEA,aAAS,KAAK,EAAE,SAAS,oCAAqC,CAAA;AAEtD,YAAA,MAAM,OAAO,KAAA,GAAQ;AAAA,EAC9B;AAAA,EAEA,MAAM,aAAa,YAAkB;AAC9B,UAAA,UAAU,MAAM,KAAK;AAC3B,UAAM,SAAS,MAAM,QAAQ,MAAM,kBAAkB,UAAU,UAAU;AAAA,MACxE,MAAM;AAAA,QACL,QAAQ;AAAA,MACR;AAAA,IAAA,CACD;AAEG,QAAA,QAAQ,OAAO,UAAU;AAC5B,YAAM,yBAAyB,MAAM;AACrC,YAAM,IAAI,MAAM,sCAAsC,UAAU,EAAE;AAAA,IACnE;AAAA,EACD;AACA;"}
|
|
@@ -1,46 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const axios = require("axios");
|
|
4
3
|
const isEqual = require("lodash.isequal");
|
|
5
4
|
const log = require("../utils/log.cjs");
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
async function upsert(endpoint, operation, data) {
|
|
5
|
+
const apiClient = require("./apiClient.cjs");
|
|
6
|
+
class CustomTypesApiClient extends apiClient.AuthenticatedApiClient {
|
|
7
|
+
constructor(baseURL, config) {
|
|
8
|
+
super(baseURL, config.authToken, { repository: config.repository });
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Create or update a custom type or slice.
|
|
12
|
+
*
|
|
13
|
+
* @param endpoint - - The API endpoint for custom types or slices
|
|
14
|
+
* ('customtypes' or 'slices').
|
|
15
|
+
* @param data - - The data representing the custom type or slice.
|
|
16
|
+
*
|
|
17
|
+
* @throws Error if the item status cannot be retrieved or the item cannot be
|
|
18
|
+
* created/updated.
|
|
19
|
+
*/
|
|
20
|
+
async upsert(endpoint, operation, data) {
|
|
24
21
|
const profiler = log.logger.startTimer();
|
|
25
22
|
const path = `${endpoint}/${operation}`;
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
const context = await this.getContext();
|
|
24
|
+
const result = await context.post(path, { data });
|
|
25
|
+
if (!result.ok()) {
|
|
26
|
+
log.logPlaywrightApiResponse(result);
|
|
29
27
|
throw new Error(`Could not ${operation} item`);
|
|
30
28
|
}
|
|
31
29
|
profiler.done({
|
|
32
30
|
message: `called customtypes api /${path} for item with id '${data.id}'`
|
|
33
31
|
});
|
|
34
32
|
}
|
|
35
|
-
async
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
async getRemoteItems(endpoint) {
|
|
34
|
+
const context = await this.getContext();
|
|
35
|
+
const result = await context.get(endpoint);
|
|
36
|
+
if (!result.ok()) {
|
|
37
|
+
log.logPlaywrightApiResponse(result);
|
|
39
38
|
throw new Error("Could not get items status from the Custom Type api.");
|
|
40
39
|
}
|
|
41
|
-
return result.
|
|
40
|
+
return result.json();
|
|
42
41
|
}
|
|
43
|
-
async
|
|
42
|
+
async getDifference(remoteItems, local) {
|
|
44
43
|
const remoteItem = remoteItems.find((remote) => remote.id === local.id);
|
|
45
44
|
if (!remoteItem) {
|
|
46
45
|
return "insert";
|
|
@@ -50,23 +49,30 @@ const createCustomTypesApiClient = (baseURL, repository, authClient) => {
|
|
|
50
49
|
}
|
|
51
50
|
return;
|
|
52
51
|
}
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
/** Create items only if they have changed compared to their remote status */
|
|
53
|
+
async upsertIfChanged(itemType, localItems = []) {
|
|
54
|
+
const remoteItems = await this.getRemoteItems(itemType);
|
|
55
55
|
await Promise.all(localItems.map(async (localItem) => {
|
|
56
|
-
const operation = await getDifference(remoteItems, localItem);
|
|
57
|
-
return operation && upsert(itemType, operation, localItem);
|
|
56
|
+
const operation = await this.getDifference(remoteItems, localItem);
|
|
57
|
+
return operation && this.upsert(itemType, operation, localItem);
|
|
58
58
|
}));
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Create Custom Types using the Custom types api.
|
|
62
|
+
*
|
|
63
|
+
* @param customTypes -
|
|
64
|
+
*/
|
|
65
|
+
async createCustomTypes(customTypes = []) {
|
|
66
|
+
await this.upsertIfChanged("customtypes", customTypes);
|
|
62
67
|
}
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Create slices using the Custom types api.
|
|
70
|
+
*
|
|
71
|
+
* @param slices -
|
|
72
|
+
*/
|
|
73
|
+
async createSlices(slices = []) {
|
|
74
|
+
await this.upsertIfChanged("slices", slices);
|
|
65
75
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
createSlices
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
exports.createCustomTypesApiClient = createCustomTypesApiClient;
|
|
76
|
+
}
|
|
77
|
+
exports.CustomTypesApiClient = CustomTypesApiClient;
|
|
72
78
|
//# sourceMappingURL=customTypesApi.cjs.map
|