@uniformdev/canvas 20.50.2-alpha.167 → 20.50.2-alpha.180
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/index.d.mts +1439 -1952
- package/dist/index.d.ts +1439 -1952
- package/dist/index.esm.js +177 -814
- package/dist/index.js +176 -819
- package/dist/index.mjs +177 -814
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -5,8 +5,8 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
|
|
|
5
5
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
6
6
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
7
7
|
|
|
8
|
-
// src/
|
|
9
|
-
import { ApiClient } from "@uniformdev/context/api";
|
|
8
|
+
// src/CanvasClient.ts
|
|
9
|
+
import { ApiClient, rewriteFiltersForApi } from "@uniformdev/context/api";
|
|
10
10
|
|
|
11
11
|
// src/enhancement/createLimitPolicy.ts
|
|
12
12
|
import { ApiClientError } from "@uniformdev/context/api";
|
|
@@ -49,129 +49,6 @@ function createLimitPolicy({
|
|
|
49
49
|
}
|
|
50
50
|
var nullLimitPolicy = async (func) => await func();
|
|
51
51
|
|
|
52
|
-
// src/CategoryClient.ts
|
|
53
|
-
var CATEGORIES_URL = "/api/v1/categories";
|
|
54
|
-
var CategoryClient = class extends ApiClient {
|
|
55
|
-
constructor(options) {
|
|
56
|
-
if (!options.limitPolicy) {
|
|
57
|
-
options.limitPolicy = createLimitPolicy({});
|
|
58
|
-
}
|
|
59
|
-
super(options);
|
|
60
|
-
}
|
|
61
|
-
/** Fetches a list of categories created in given project */
|
|
62
|
-
async list(options) {
|
|
63
|
-
const { projectId } = this.options;
|
|
64
|
-
const fetchUri = this.createUrl("/api/v1/categories", { ...options, projectId });
|
|
65
|
-
return await this.apiClient(fetchUri);
|
|
66
|
-
}
|
|
67
|
-
/** @deprecated Use {@link list} instead. */
|
|
68
|
-
async getCategories(options) {
|
|
69
|
-
return this.list(options);
|
|
70
|
-
}
|
|
71
|
-
/** Updates or creates a category, also used to re-order them */
|
|
72
|
-
async save(categories) {
|
|
73
|
-
const { projectId } = this.options;
|
|
74
|
-
const fetchUri = this.createUrl(CATEGORIES_URL);
|
|
75
|
-
return await this.apiClient(fetchUri, {
|
|
76
|
-
method: "PUT",
|
|
77
|
-
body: JSON.stringify({ categories, projectId }),
|
|
78
|
-
expectNoContent: true
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
/** @deprecated Use {@link save} instead. */
|
|
82
|
-
async upsertCategories(categories) {
|
|
83
|
-
return this.save(categories);
|
|
84
|
-
}
|
|
85
|
-
/** Deletes a category */
|
|
86
|
-
async remove(options) {
|
|
87
|
-
const { projectId } = this.options;
|
|
88
|
-
const fetchUri = this.createUrl(CATEGORIES_URL);
|
|
89
|
-
return await this.apiClient(fetchUri, {
|
|
90
|
-
method: "DELETE",
|
|
91
|
-
body: JSON.stringify({ projectId, categoryId: options.categoryId }),
|
|
92
|
-
expectNoContent: true
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
/** @deprecated Use {@link remove} instead. */
|
|
96
|
-
async removeCategory(options) {
|
|
97
|
-
return this.remove(options);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
var UncachedCategoryClient = class extends CategoryClient {
|
|
101
|
-
constructor(options) {
|
|
102
|
-
super({ ...options, bypassCache: true });
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
// src/clients/ComponentDefinitionClient.ts
|
|
107
|
-
import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
|
|
108
|
-
|
|
109
|
-
// src/clients/ContentClientBase.ts
|
|
110
|
-
import { ApiClient as ApiClient2 } from "@uniformdev/context/api";
|
|
111
|
-
var CANONICAL_FORMAT = "canonical";
|
|
112
|
-
var ContentClientBase = class extends ApiClient2 {
|
|
113
|
-
constructor(options, defaultBypassCache) {
|
|
114
|
-
var _a, _b;
|
|
115
|
-
super({
|
|
116
|
-
...options,
|
|
117
|
-
limitPolicy: (_a = options.limitPolicy) != null ? _a : createLimitPolicy({}),
|
|
118
|
-
bypassCache: (_b = options.bypassCache) != null ? _b : defaultBypassCache
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
// src/clients/ComponentDefinitionClient.ts
|
|
124
|
-
var DEFINITIONS_URL = "/api/v1/canvas-definitions";
|
|
125
|
-
var ComponentDefinitionClient = class extends ContentClientBase {
|
|
126
|
-
constructor(options) {
|
|
127
|
-
super(
|
|
128
|
-
options,
|
|
129
|
-
/* defaultBypassCache */
|
|
130
|
-
true
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
/** Fetches one component definition by id (throws `ApiClientError(404)` if absent). */
|
|
134
|
-
async get(args) {
|
|
135
|
-
var _a;
|
|
136
|
-
const url = this.createUrl(DEFINITIONS_URL, {
|
|
137
|
-
componentId: args.componentId,
|
|
138
|
-
projectId: this.options.projectId
|
|
139
|
-
});
|
|
140
|
-
const res = await this.apiClient(url);
|
|
141
|
-
const definition = (_a = res.componentDefinitions) == null ? void 0 : _a[0];
|
|
142
|
-
if (!definition) {
|
|
143
|
-
throw new ApiClientError2("Component definition not found", "GET", url.toString(), 404, "Not Found");
|
|
144
|
-
}
|
|
145
|
-
return definition;
|
|
146
|
-
}
|
|
147
|
-
/** Fetches a list of component definitions. */
|
|
148
|
-
list(args) {
|
|
149
|
-
const url = this.createUrl(DEFINITIONS_URL, { ...args, projectId: this.options.projectId });
|
|
150
|
-
return this.apiClient(url);
|
|
151
|
-
}
|
|
152
|
-
/** Creates or updates a component definition. */
|
|
153
|
-
async save(def) {
|
|
154
|
-
const url = this.createUrl(DEFINITIONS_URL);
|
|
155
|
-
await this.apiClient(url, {
|
|
156
|
-
method: "PUT",
|
|
157
|
-
body: JSON.stringify({ ...def, projectId: this.options.projectId }),
|
|
158
|
-
expectNoContent: true
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
/** Deletes a component definition. */
|
|
162
|
-
async remove(args) {
|
|
163
|
-
const url = this.createUrl(DEFINITIONS_URL);
|
|
164
|
-
await this.apiClient(url, {
|
|
165
|
-
method: "DELETE",
|
|
166
|
-
body: JSON.stringify({ ...args, projectId: this.options.projectId }),
|
|
167
|
-
expectNoContent: true
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
// src/clients/CompositionDeliveryClient.ts
|
|
173
|
-
import { rewriteFiltersForApi } from "@uniformdev/context/api";
|
|
174
|
-
|
|
175
52
|
// src/projection/types.ts
|
|
176
53
|
var SELECT_QUERY_PREFIX = "select.";
|
|
177
54
|
|
|
@@ -217,529 +94,9 @@ function projectionToQuery(spec) {
|
|
|
217
94
|
return out;
|
|
218
95
|
}
|
|
219
96
|
|
|
220
|
-
// src/
|
|
221
|
-
var CANVAS_PERSONALIZE_TYPE = "$personalization";
|
|
222
|
-
var CANVAS_TEST_TYPE = "$test";
|
|
223
|
-
var CANVAS_LOCALIZATION_TYPE = "$localization";
|
|
224
|
-
var CANVAS_SLOT_SECTION_TYPE = "$slotSection";
|
|
225
|
-
var CANVAS_INTENT_TAG_PARAM = "intentTag";
|
|
226
|
-
var CANVAS_LOCALE_TAG_PARAM = "locale";
|
|
227
|
-
var CANVAS_BLOCK_PARAM_TYPE = "$block";
|
|
228
|
-
var CANVAS_PERSONALIZE_SLOT = "pz";
|
|
229
|
-
var CANVAS_TEST_SLOT = "test";
|
|
230
|
-
var CANVAS_LOCALIZATION_SLOT = "localized";
|
|
231
|
-
var CANVAS_SLOT_SECTION_SLOT = "$slotSectionItems";
|
|
232
|
-
var CANVAS_SLOT_SECTION_NAME_PARAM = "name";
|
|
233
|
-
var CANVAS_SLOT_SECTION_MIN_PARAM = "min";
|
|
234
|
-
var CANVAS_SLOT_SECTION_MAX_PARAM = "max";
|
|
235
|
-
var CANVAS_SLOT_SECTION_GROUP_TYPE_PARAM = "groupType";
|
|
236
|
-
var CANVAS_SLOT_SECTION_SPECIFIC_PARAM = "specific";
|
|
237
|
-
var CANVAS_DRAFT_STATE = 0;
|
|
238
|
-
var CANVAS_PUBLISHED_STATE = 64;
|
|
239
|
-
var CANVAS_EDITOR_STATE = 63;
|
|
240
|
-
var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
|
|
241
|
-
var CANVAS_PERSONALIZATION_EVENT_NAME_PARAM = "trackingEventName";
|
|
242
|
-
var CANVAS_PERSONALIZATION_ALGORITHM_PARAM = "algorithm";
|
|
243
|
-
var CANVAS_PERSONALIZATION_ALGORITHM_TYPE = "pzAlgorithm";
|
|
244
|
-
var CANVAS_PERSONALIZATION_TAKE_PARAM = "count";
|
|
245
|
-
var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
|
|
246
|
-
var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
|
|
247
|
-
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
248
|
-
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
249
|
-
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
250
|
-
var CANVAS_CONTEXTUAL_EDITING_PARAM = "$contextualEditing";
|
|
251
|
-
var SECRET_QUERY_STRING_PARAM = "secret";
|
|
252
|
-
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
253
|
-
var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
|
|
254
|
-
var IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM = "is_incontext_editing_forced_settings";
|
|
255
|
-
var IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM = "is_config_check";
|
|
256
|
-
var IN_CONTEXT_EDITOR_COMPONENT_START_ROLE = "uniform-component-start";
|
|
257
|
-
var IN_CONTEXT_EDITOR_COMPONENT_END_ROLE = "uniform-component-end";
|
|
258
|
-
var IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID = "uniform-canvas-preview-script";
|
|
259
|
-
var IS_RENDERED_BY_UNIFORM_ATTRIBUTE = "data-is-rendered-by-uniform";
|
|
260
|
-
var PLACEHOLDER_ID = "placeholder";
|
|
261
|
-
var EMPTY_COMPOSITION = {
|
|
262
|
-
_id: "_empty_composition_id",
|
|
263
|
-
_name: "An empty composition used for contextual editing",
|
|
264
|
-
type: "_empty_composition_type"
|
|
265
|
-
};
|
|
266
|
-
var EDGE_MIN_CACHE_TTL = 10;
|
|
267
|
-
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
268
|
-
var EDGE_DEFAULT_CACHE_TTL = 30;
|
|
269
|
-
var EDGE_CACHE_DISABLED = -1;
|
|
270
|
-
var ASSET_PARAMETER_TYPE = "asset";
|
|
271
|
-
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
|
272
|
-
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
|
273
|
-
var REFERENCE_DATA_TYPE_ID = "uniformContentInternalReference";
|
|
274
|
-
|
|
275
|
-
// src/clients/compositionHelpers.ts
|
|
276
|
-
function resolveCompositionSelector(args) {
|
|
277
|
-
if ("compositionId" in args) {
|
|
278
|
-
const { compositionId, editionId, versionId, ...readOptions } = args;
|
|
279
|
-
return {
|
|
280
|
-
readOptions,
|
|
281
|
-
// raw mode matches on composition OR edition id via the compositionId param
|
|
282
|
-
compositionId: editionId != null ? editionId : compositionId,
|
|
283
|
-
versionId,
|
|
284
|
-
hasCompositionId: true,
|
|
285
|
-
pinnedEdition: editionId !== void 0
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
return { readOptions: args, hasCompositionId: false, pinnedEdition: false };
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
// src/clients/DeliveryClientBase.ts
|
|
292
|
-
var DEFAULT_EDGE_API_HOST = "https://uniform.global";
|
|
293
|
-
var DeliveryClientBase = class extends ContentClientBase {
|
|
294
|
-
constructor(options) {
|
|
295
|
-
var _a;
|
|
296
|
-
super(
|
|
297
|
-
options,
|
|
298
|
-
/* defaultBypassCache */
|
|
299
|
-
false
|
|
300
|
-
);
|
|
301
|
-
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : DEFAULT_EDGE_API_HOST;
|
|
302
|
-
this.edgeRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
|
|
303
|
-
}
|
|
304
|
-
/** Coerces the `diagnostics` option into the shape the edge endpoints accept. */
|
|
305
|
-
coerceDiagnostics(diagnostics) {
|
|
306
|
-
return typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0;
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
|
|
310
|
-
// src/clients/CompositionDeliveryClient.ts
|
|
311
|
-
var EDGE_SINGLE_URL = "/api/v1/composition";
|
|
312
|
-
var EDGE_LIST_URL = "/api/v1/compositions";
|
|
313
|
-
var CompositionDeliveryClient = class extends DeliveryClientBase {
|
|
314
|
-
constructor(options) {
|
|
315
|
-
super(options);
|
|
316
|
-
}
|
|
317
|
-
/** Fetches exactly one composition (throws `ApiClientError(404)` if absent). */
|
|
318
|
-
get(args) {
|
|
319
|
-
var _a;
|
|
320
|
-
const { diagnostics, select, ...rest } = args;
|
|
321
|
-
const { readOptions, compositionId, versionId, pinnedEdition } = resolveCompositionSelector(rest);
|
|
322
|
-
const url = this.createUrl(
|
|
323
|
-
EDGE_SINGLE_URL,
|
|
324
|
-
{
|
|
325
|
-
...readOptions,
|
|
326
|
-
...projectionToQuery(select),
|
|
327
|
-
// A pinned edition is folded into compositionId (raw matches edition or
|
|
328
|
-
// composition id); there is no editionId query param on this endpoint.
|
|
329
|
-
compositionId,
|
|
330
|
-
versionId,
|
|
331
|
-
projectId: this.options.projectId,
|
|
332
|
-
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
333
|
-
// editionId pins a specific edition for preview; otherwise locale-best.
|
|
334
|
-
editions: pinnedEdition ? "raw" : "auto",
|
|
335
|
-
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
336
|
-
},
|
|
337
|
-
this.edgeApiHost
|
|
338
|
-
);
|
|
339
|
-
return this.apiClient(url, this.edgeRequestInit);
|
|
340
|
-
}
|
|
341
|
-
/** Fetches a list of compositions, optionally filtered. */
|
|
342
|
-
list(args = {}) {
|
|
343
|
-
var _a;
|
|
344
|
-
const { diagnostics, filters, select, ...rest } = args;
|
|
345
|
-
const url = this.createUrl(
|
|
346
|
-
EDGE_LIST_URL,
|
|
347
|
-
{
|
|
348
|
-
...rest,
|
|
349
|
-
...rewriteFiltersForApi(filters),
|
|
350
|
-
...projectionToQuery(select),
|
|
351
|
-
projectId: this.options.projectId,
|
|
352
|
-
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
353
|
-
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
354
|
-
},
|
|
355
|
-
this.edgeApiHost
|
|
356
|
-
);
|
|
357
|
-
return this.apiClient(url, this.edgeRequestInit);
|
|
358
|
-
}
|
|
359
|
-
};
|
|
360
|
-
|
|
361
|
-
// src/clients/CompositionManagementClient.ts
|
|
362
|
-
import { rewriteFiltersForApi as rewriteFiltersForApi2 } from "@uniformdev/context/api";
|
|
363
|
-
|
|
364
|
-
// src/clients/resolveManagementEditions.ts
|
|
365
|
-
function resolveManagementEditions({
|
|
366
|
-
explicit,
|
|
367
|
-
pinnedEdition,
|
|
368
|
-
hasId,
|
|
369
|
-
hasLocale
|
|
370
|
-
}) {
|
|
371
|
-
if (explicit) {
|
|
372
|
-
return explicit;
|
|
373
|
-
}
|
|
374
|
-
if (pinnedEdition) {
|
|
375
|
-
return "raw";
|
|
376
|
-
}
|
|
377
|
-
if (!hasId) {
|
|
378
|
-
return void 0;
|
|
379
|
-
}
|
|
380
|
-
return hasLocale ? "auto" : "raw";
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
// src/clients/CompositionManagementClient.ts
|
|
97
|
+
// src/CanvasClient.ts
|
|
384
98
|
var CANVAS_URL = "/api/v1/canvas";
|
|
385
|
-
var
|
|
386
|
-
var CompositionManagementClient = class extends ContentClientBase {
|
|
387
|
-
constructor(options) {
|
|
388
|
-
super(
|
|
389
|
-
options,
|
|
390
|
-
/* defaultBypassCache */
|
|
391
|
-
true
|
|
392
|
-
);
|
|
393
|
-
}
|
|
394
|
-
/**
|
|
395
|
-
* Fetches one composition in canonical shape (throws `ApiClientError(404)` if
|
|
396
|
-
* absent).
|
|
397
|
-
*/
|
|
398
|
-
get(args) {
|
|
399
|
-
var _a;
|
|
400
|
-
const { select, ...selectorArgs } = args;
|
|
401
|
-
const { readOptions, compositionId, versionId, hasCompositionId, pinnedEdition } = resolveCompositionSelector(selectorArgs);
|
|
402
|
-
const url = this.createUrl(CANVAS_URL, {
|
|
403
|
-
format: CANONICAL_FORMAT,
|
|
404
|
-
// Caller-supplied shaping flags and non-id selector keys ride along and
|
|
405
|
-
// override the format alias server-side.
|
|
406
|
-
...readOptions,
|
|
407
|
-
...projectionToQuery(select),
|
|
408
|
-
// A pinned edition is folded into compositionId; there is no editionId
|
|
409
|
-
// query param on this endpoint.
|
|
410
|
-
compositionId,
|
|
411
|
-
versionId,
|
|
412
|
-
projectId: this.options.projectId,
|
|
413
|
-
state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE,
|
|
414
|
-
editions: resolveManagementEditions({
|
|
415
|
-
explicit: readOptions.editions,
|
|
416
|
-
pinnedEdition,
|
|
417
|
-
hasId: hasCompositionId,
|
|
418
|
-
hasLocale: readOptions.locale != null
|
|
419
|
-
})
|
|
420
|
-
});
|
|
421
|
-
return this.apiClient(url);
|
|
422
|
-
}
|
|
423
|
-
/** Fetches a list of compositions in canonical shape. */
|
|
424
|
-
list(args = {}) {
|
|
425
|
-
var _a;
|
|
426
|
-
const { filters, select, ...rest } = args;
|
|
427
|
-
const url = this.createUrl(CANVAS_URL, {
|
|
428
|
-
format: CANONICAL_FORMAT,
|
|
429
|
-
...rest,
|
|
430
|
-
...rewriteFiltersForApi2(filters),
|
|
431
|
-
...projectionToQuery(select),
|
|
432
|
-
projectId: this.options.projectId,
|
|
433
|
-
state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE
|
|
434
|
-
});
|
|
435
|
-
return this.apiClient(url);
|
|
436
|
-
}
|
|
437
|
-
/** Creates or updates a composition. Returns the new `x-modified-at` timestamp. */
|
|
438
|
-
async save(body, opts) {
|
|
439
|
-
const url = this.createUrl(CANVAS_URL);
|
|
440
|
-
const headers = {};
|
|
441
|
-
if (opts == null ? void 0 : opts.ifUnmodifiedSince) {
|
|
442
|
-
headers["x-if-unmodified-since"] = opts.ifUnmodifiedSince;
|
|
443
|
-
}
|
|
444
|
-
const { response } = await this.apiClientWithResponse(url, {
|
|
445
|
-
method: "PUT",
|
|
446
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
447
|
-
expectNoContent: true,
|
|
448
|
-
headers
|
|
449
|
-
});
|
|
450
|
-
return { modified: response.headers.get("x-modified-at") };
|
|
451
|
-
}
|
|
452
|
-
/**
|
|
453
|
-
* Saves the draft and publishes in one call (two PUTs). The optimistic
|
|
454
|
-
* concurrency guard, if any, applies to the draft write.
|
|
455
|
-
*/
|
|
456
|
-
async saveAndPublish(body, opts) {
|
|
457
|
-
await this.save({ ...body, state: CANVAS_DRAFT_STATE }, opts);
|
|
458
|
-
return this.save({ ...body, state: CANVAS_PUBLISHED_STATE });
|
|
459
|
-
}
|
|
460
|
-
/**
|
|
461
|
-
* Removes only the published state, leaving the draft intact. Scoped to a
|
|
462
|
-
* single edition when `editionId` is supplied; otherwise unpublishes all editions.
|
|
463
|
-
* To unpublish only the base edition, pass editionId and compositionId as the same value.
|
|
464
|
-
*/
|
|
465
|
-
async unpublish(selector) {
|
|
466
|
-
await this.deleteComposition({ ...selector, state: CANVAS_PUBLISHED_STATE });
|
|
467
|
-
}
|
|
468
|
-
/**
|
|
469
|
-
* Deletes across all states. Scoped to a single edition when `editionId` is
|
|
470
|
-
* supplied; otherwise deletes all states and editions.
|
|
471
|
-
* Use `unpublish` to drop only the published state.
|
|
472
|
-
*/
|
|
473
|
-
async remove(selector) {
|
|
474
|
-
await this.deleteComposition(selector);
|
|
475
|
-
}
|
|
476
|
-
/** Fetches historical versions of a composition or pattern. */
|
|
477
|
-
history(args) {
|
|
478
|
-
const url = this.createUrl(CANVAS_HISTORY_URL, { ...args, projectId: this.options.projectId });
|
|
479
|
-
return this.apiClient(url);
|
|
480
|
-
}
|
|
481
|
-
async deleteComposition(body) {
|
|
482
|
-
const url = this.createUrl(CANVAS_URL);
|
|
483
|
-
await this.apiClient(url, {
|
|
484
|
-
method: "DELETE",
|
|
485
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
486
|
-
expectNoContent: true
|
|
487
|
-
});
|
|
488
|
-
}
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
// src/clients/ContentTypeClient.ts
|
|
492
|
-
import { ApiClientError as ApiClientError3 } from "@uniformdev/context/api";
|
|
493
|
-
var CONTENT_TYPES_URL = "/api/v1/content-types";
|
|
494
|
-
var ContentTypeClient = class extends ContentClientBase {
|
|
495
|
-
constructor(options) {
|
|
496
|
-
super(
|
|
497
|
-
options,
|
|
498
|
-
/* defaultBypassCache */
|
|
499
|
-
true
|
|
500
|
-
);
|
|
501
|
-
}
|
|
502
|
-
/** Fetches one content type by id (throws `ApiClientError(404)` if absent). */
|
|
503
|
-
async get(args) {
|
|
504
|
-
var _a;
|
|
505
|
-
const url = this.createUrl(CONTENT_TYPES_URL, {
|
|
506
|
-
contentTypeIDs: [args.contentTypeId],
|
|
507
|
-
limit: 1,
|
|
508
|
-
projectId: this.options.projectId
|
|
509
|
-
});
|
|
510
|
-
const res = await this.apiClient(url);
|
|
511
|
-
const contentType = (_a = res.contentTypes) == null ? void 0 : _a[0];
|
|
512
|
-
if (!contentType) {
|
|
513
|
-
throw new ApiClientError3("Content type not found", "GET", url.toString(), 404, "Not Found");
|
|
514
|
-
}
|
|
515
|
-
return contentType;
|
|
516
|
-
}
|
|
517
|
-
/** Fetches a list of content types. */
|
|
518
|
-
list(args) {
|
|
519
|
-
const url = this.createUrl(CONTENT_TYPES_URL, { ...args, projectId: this.options.projectId });
|
|
520
|
-
return this.apiClient(url);
|
|
521
|
-
}
|
|
522
|
-
/** Creates or updates a content type. */
|
|
523
|
-
async save(body, opts = {}) {
|
|
524
|
-
const url = this.createUrl(CONTENT_TYPES_URL);
|
|
525
|
-
let contentType = body.contentType;
|
|
526
|
-
if (typeof contentType.slugSettings === "object" && contentType.slugSettings !== null && Object.keys(contentType.slugSettings).length === 0) {
|
|
527
|
-
const { slugSettings: _omitEmptySlugSettings, ...rest } = contentType;
|
|
528
|
-
contentType = rest;
|
|
529
|
-
}
|
|
530
|
-
await this.apiClient(url, {
|
|
531
|
-
method: "PUT",
|
|
532
|
-
body: JSON.stringify({ ...body, contentType, projectId: this.options.projectId }),
|
|
533
|
-
expectNoContent: true,
|
|
534
|
-
headers: opts.autogenerateDataTypes ? { "x-uniform-autogenerate-data-types": "true" } : {}
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
/** Deletes a content type. */
|
|
538
|
-
async remove(args) {
|
|
539
|
-
const url = this.createUrl(CONTENT_TYPES_URL);
|
|
540
|
-
await this.apiClient(url, {
|
|
541
|
-
method: "DELETE",
|
|
542
|
-
body: JSON.stringify({ ...args, projectId: this.options.projectId }),
|
|
543
|
-
expectNoContent: true
|
|
544
|
-
});
|
|
545
|
-
}
|
|
546
|
-
};
|
|
547
|
-
|
|
548
|
-
// src/clients/EntryDeliveryClient.ts
|
|
549
|
-
import { rewriteFiltersForApi as rewriteFiltersForApi3 } from "@uniformdev/context/api";
|
|
550
|
-
|
|
551
|
-
// src/clients/entryHelpers.ts
|
|
552
|
-
import { ApiClientError as ApiClientError4 } from "@uniformdev/context/api";
|
|
553
|
-
function resolveEntrySelector(args) {
|
|
554
|
-
if ("entryId" in args) {
|
|
555
|
-
const { entryId, editionId, versionId, ...readOptions2 } = args;
|
|
556
|
-
return {
|
|
557
|
-
readOptions: readOptions2,
|
|
558
|
-
entryIDs: [editionId != null ? editionId : entryId],
|
|
559
|
-
versionId,
|
|
560
|
-
pinnedEdition: editionId !== void 0
|
|
561
|
-
};
|
|
562
|
-
}
|
|
563
|
-
const { slug, ...readOptions } = args;
|
|
564
|
-
return { readOptions, slug, pinnedEdition: false };
|
|
565
|
-
}
|
|
566
|
-
function unwrapSingleEntry(res, url) {
|
|
567
|
-
var _a;
|
|
568
|
-
const entry = (_a = res.entries) == null ? void 0 : _a[0];
|
|
569
|
-
if (!entry) {
|
|
570
|
-
throw new ApiClientError4("Entry not found", "GET", url.toString(), 404, "Not Found");
|
|
571
|
-
}
|
|
572
|
-
return entry;
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
// src/clients/EntryDeliveryClient.ts
|
|
576
|
-
var ENTRIES_URL = "/api/v1/entries";
|
|
577
|
-
var EntryDeliveryClient = class extends DeliveryClientBase {
|
|
578
|
-
constructor(options) {
|
|
579
|
-
super(options);
|
|
580
|
-
}
|
|
581
|
-
/** Fetches exactly one entry by id or slug (throws `ApiClientError(404)` if absent). */
|
|
582
|
-
async get(args) {
|
|
583
|
-
var _a, _b;
|
|
584
|
-
const { diagnostics, select, ...rest } = args;
|
|
585
|
-
const { entryIDs, slug, versionId, pinnedEdition, readOptions } = resolveEntrySelector(rest);
|
|
586
|
-
const url = this.createUrl(
|
|
587
|
-
ENTRIES_URL,
|
|
588
|
-
{
|
|
589
|
-
...readOptions,
|
|
590
|
-
...projectionToQuery(select),
|
|
591
|
-
projectId: this.options.projectId,
|
|
592
|
-
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
593
|
-
entryIDs,
|
|
594
|
-
slug,
|
|
595
|
-
versionId,
|
|
596
|
-
// A pinned edition is fetched exactly; otherwise locale-best.
|
|
597
|
-
editions: pinnedEdition ? "raw" : "auto",
|
|
598
|
-
// An id lookup wants that exact entity regardless of type, so default the
|
|
599
|
-
// pattern filter to 'any' (origin default `false` would 404 a pattern id).
|
|
600
|
-
// Scoped to id lookups; slug reads keep the origin default. Explicit
|
|
601
|
-
// `pattern` overrides via the `...readOptions` spread above.
|
|
602
|
-
pattern: (_b = args.pattern) != null ? _b : entryIDs ? "any" : void 0,
|
|
603
|
-
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
604
|
-
},
|
|
605
|
-
this.edgeApiHost
|
|
606
|
-
);
|
|
607
|
-
const res = await this.apiClient(url, this.edgeRequestInit);
|
|
608
|
-
return unwrapSingleEntry(res, url);
|
|
609
|
-
}
|
|
610
|
-
/** Fetches a list of entries, optionally filtered. */
|
|
611
|
-
list(args = {}) {
|
|
612
|
-
var _a;
|
|
613
|
-
const { diagnostics, filters, select, ...rest } = args;
|
|
614
|
-
const url = this.createUrl(
|
|
615
|
-
ENTRIES_URL,
|
|
616
|
-
{
|
|
617
|
-
...rest,
|
|
618
|
-
...rewriteFiltersForApi3(filters),
|
|
619
|
-
...projectionToQuery(select),
|
|
620
|
-
projectId: this.options.projectId,
|
|
621
|
-
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
622
|
-
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
623
|
-
},
|
|
624
|
-
this.edgeApiHost
|
|
625
|
-
);
|
|
626
|
-
return this.apiClient(url, this.edgeRequestInit);
|
|
627
|
-
}
|
|
628
|
-
};
|
|
629
|
-
|
|
630
|
-
// src/clients/EntryManagementClient.ts
|
|
631
|
-
import { rewriteFiltersForApi as rewriteFiltersForApi4 } from "@uniformdev/context/api";
|
|
632
|
-
var ENTRIES_URL2 = "/api/v1/entries";
|
|
633
|
-
var ENTRIES_HISTORY_URL = "/api/v1/entries-history";
|
|
634
|
-
var EntryManagementClient = class extends ContentClientBase {
|
|
635
|
-
constructor(options) {
|
|
636
|
-
super(
|
|
637
|
-
options,
|
|
638
|
-
/* defaultBypassCache */
|
|
639
|
-
true
|
|
640
|
-
);
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* Fetches one entry by id or slug in canonical shape (throws
|
|
644
|
-
* `ApiClientError(404)` if absent).
|
|
645
|
-
*/
|
|
646
|
-
async get(args) {
|
|
647
|
-
var _a, _b;
|
|
648
|
-
const { select, ...selectorArgs } = args;
|
|
649
|
-
const { entryIDs, slug, versionId, readOptions, pinnedEdition } = resolveEntrySelector(selectorArgs);
|
|
650
|
-
const url = this.createUrl(ENTRIES_URL2, {
|
|
651
|
-
format: CANONICAL_FORMAT,
|
|
652
|
-
...readOptions,
|
|
653
|
-
...projectionToQuery(select),
|
|
654
|
-
projectId: this.options.projectId,
|
|
655
|
-
state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE,
|
|
656
|
-
editions: resolveManagementEditions({
|
|
657
|
-
explicit: readOptions.editions,
|
|
658
|
-
pinnedEdition,
|
|
659
|
-
hasId: entryIDs != null,
|
|
660
|
-
hasLocale: readOptions.locale != null
|
|
661
|
-
}),
|
|
662
|
-
// An id lookup wants that exact entity regardless of type, so default the
|
|
663
|
-
// pattern filter to 'any' (origin default `false` would 404 a pattern id).
|
|
664
|
-
// Scoped to id lookups; slug reads keep the origin default. Explicit
|
|
665
|
-
// `pattern` overrides via the `...readOptions` spread above.
|
|
666
|
-
pattern: (_b = args.pattern) != null ? _b : entryIDs ? "any" : void 0,
|
|
667
|
-
entryIDs,
|
|
668
|
-
slug,
|
|
669
|
-
versionId
|
|
670
|
-
});
|
|
671
|
-
const res = await this.apiClient(url);
|
|
672
|
-
return unwrapSingleEntry(res, url);
|
|
673
|
-
}
|
|
674
|
-
/** Fetches a list of entries in canonical shape. */
|
|
675
|
-
list(args = {}) {
|
|
676
|
-
var _a;
|
|
677
|
-
const { filters, select, ...rest } = args;
|
|
678
|
-
const url = this.createUrl(ENTRIES_URL2, {
|
|
679
|
-
format: CANONICAL_FORMAT,
|
|
680
|
-
...rest,
|
|
681
|
-
...rewriteFiltersForApi4(filters),
|
|
682
|
-
...projectionToQuery(select),
|
|
683
|
-
projectId: this.options.projectId,
|
|
684
|
-
state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE
|
|
685
|
-
});
|
|
686
|
-
return this.apiClient(url);
|
|
687
|
-
}
|
|
688
|
-
/** Creates or updates an entry. Returns the new `x-modified-at` timestamp. */
|
|
689
|
-
async save(body, opts) {
|
|
690
|
-
const url = this.createUrl(ENTRIES_URL2);
|
|
691
|
-
const headers = {};
|
|
692
|
-
if (opts == null ? void 0 : opts.ifUnmodifiedSince) {
|
|
693
|
-
headers["x-if-unmodified-since"] = opts.ifUnmodifiedSince;
|
|
694
|
-
}
|
|
695
|
-
const { response } = await this.apiClientWithResponse(url, {
|
|
696
|
-
method: "PUT",
|
|
697
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
698
|
-
expectNoContent: true,
|
|
699
|
-
headers
|
|
700
|
-
});
|
|
701
|
-
return { modified: response.headers.get("x-modified-at") };
|
|
702
|
-
}
|
|
703
|
-
/** Saves the draft and publishes in one call (two PUTs). */
|
|
704
|
-
async saveAndPublish(body, opts) {
|
|
705
|
-
await this.save({ ...body, state: CANVAS_DRAFT_STATE }, opts);
|
|
706
|
-
return this.save({ ...body, state: CANVAS_PUBLISHED_STATE });
|
|
707
|
-
}
|
|
708
|
-
/**
|
|
709
|
-
* Removes only the published state, leaving the draft intact. Scoped to a
|
|
710
|
-
* single edition when `editionId` is supplied; otherwise unpublishes all editions.
|
|
711
|
-
* To unpublish only the base edition, pass editionId and entryId as the same value.
|
|
712
|
-
*/
|
|
713
|
-
async unpublish(selector) {
|
|
714
|
-
await this.deleteEntry({ ...selector, state: CANVAS_PUBLISHED_STATE });
|
|
715
|
-
}
|
|
716
|
-
/**
|
|
717
|
-
* Deletes across all states. Scoped to a single edition when `editionId` is
|
|
718
|
-
* supplied; otherwise deletes all states and editions.
|
|
719
|
-
* Use `unpublish` to drop only the published state.
|
|
720
|
-
*/
|
|
721
|
-
async remove(selector) {
|
|
722
|
-
await this.deleteEntry(selector);
|
|
723
|
-
}
|
|
724
|
-
/** Fetches historical versions of an entry. */
|
|
725
|
-
history(args) {
|
|
726
|
-
const url = this.createUrl(ENTRIES_HISTORY_URL, { ...args, projectId: this.options.projectId });
|
|
727
|
-
return this.apiClient(url);
|
|
728
|
-
}
|
|
729
|
-
async deleteEntry(body) {
|
|
730
|
-
const url = this.createUrl(ENTRIES_URL2);
|
|
731
|
-
await this.apiClient(url, {
|
|
732
|
-
method: "DELETE",
|
|
733
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
734
|
-
expectNoContent: true
|
|
735
|
-
});
|
|
736
|
-
}
|
|
737
|
-
};
|
|
738
|
-
|
|
739
|
-
// src/clients/deprecated/CanvasClient.ts
|
|
740
|
-
import { ApiClient as ApiClient3, rewriteFiltersForApi as rewriteFiltersForApi5 } from "@uniformdev/context/api";
|
|
741
|
-
var CANVAS_URL2 = "/api/v1/canvas";
|
|
742
|
-
var CanvasClient = class extends ApiClient3 {
|
|
99
|
+
var CanvasClient = class extends ApiClient {
|
|
743
100
|
constructor(options) {
|
|
744
101
|
var _a;
|
|
745
102
|
if (!options.limitPolicy) {
|
|
@@ -753,10 +110,10 @@ var CanvasClient = class extends ApiClient3 {
|
|
|
753
110
|
async getCompositionList(params = {}) {
|
|
754
111
|
const { projectId } = this.options;
|
|
755
112
|
const { resolveData, filters, select, ...originParams } = params;
|
|
756
|
-
const rewrittenFilters =
|
|
113
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
757
114
|
const rewrittenSelect = projectionToQuery(select);
|
|
758
115
|
if (!resolveData) {
|
|
759
|
-
const fetchUri = this.createUrl(
|
|
116
|
+
const fetchUri = this.createUrl(CANVAS_URL, {
|
|
760
117
|
...originParams,
|
|
761
118
|
projectId,
|
|
762
119
|
...rewrittenFilters,
|
|
@@ -804,7 +161,7 @@ var CanvasClient = class extends ApiClient3 {
|
|
|
804
161
|
}) {
|
|
805
162
|
const { projectId } = this.options;
|
|
806
163
|
if (skipDataResolution) {
|
|
807
|
-
return this.apiClient(this.createUrl(
|
|
164
|
+
return this.apiClient(this.createUrl(CANVAS_URL, { ...params, projectId }));
|
|
808
165
|
}
|
|
809
166
|
const edgeParams = {
|
|
810
167
|
...params,
|
|
@@ -816,7 +173,7 @@ var CanvasClient = class extends ApiClient3 {
|
|
|
816
173
|
}
|
|
817
174
|
/** Updates or creates a Canvas component definition */
|
|
818
175
|
async updateComposition(body, options) {
|
|
819
|
-
const fetchUri = this.createUrl(
|
|
176
|
+
const fetchUri = this.createUrl(CANVAS_URL);
|
|
820
177
|
const headers = {};
|
|
821
178
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
822
179
|
headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
@@ -831,7 +188,7 @@ var CanvasClient = class extends ApiClient3 {
|
|
|
831
188
|
}
|
|
832
189
|
/** Deletes a Canvas component definition */
|
|
833
190
|
async removeComposition(body) {
|
|
834
|
-
const fetchUri = this.createUrl(
|
|
191
|
+
const fetchUri = this.createUrl(CANVAS_URL);
|
|
835
192
|
const { projectId } = this.options;
|
|
836
193
|
await this.apiClient(fetchUri, {
|
|
837
194
|
method: "DELETE",
|
|
@@ -870,10 +227,53 @@ var UncachedCanvasClient = class extends CanvasClient {
|
|
|
870
227
|
}
|
|
871
228
|
};
|
|
872
229
|
|
|
873
|
-
// src/
|
|
874
|
-
import { ApiClient as
|
|
230
|
+
// src/CategoryClient.ts
|
|
231
|
+
import { ApiClient as ApiClient2 } from "@uniformdev/context/api";
|
|
232
|
+
var CATEGORIES_URL = "/api/v1/categories";
|
|
233
|
+
var CategoryClient = class extends ApiClient2 {
|
|
234
|
+
constructor(options) {
|
|
235
|
+
if (!options.limitPolicy) {
|
|
236
|
+
options.limitPolicy = createLimitPolicy({});
|
|
237
|
+
}
|
|
238
|
+
super(options);
|
|
239
|
+
}
|
|
240
|
+
/** Fetches all categories created in given project */
|
|
241
|
+
async getCategories(options) {
|
|
242
|
+
const { projectId } = this.options;
|
|
243
|
+
const fetchUri = this.createUrl("/api/v1/categories", { ...options, projectId });
|
|
244
|
+
return await this.apiClient(fetchUri);
|
|
245
|
+
}
|
|
246
|
+
/** Updates or creates a category, also used to re-order them */
|
|
247
|
+
async upsertCategories(categories) {
|
|
248
|
+
const { projectId } = this.options;
|
|
249
|
+
const fetchUri = this.createUrl(CATEGORIES_URL);
|
|
250
|
+
return await this.apiClient(fetchUri, {
|
|
251
|
+
method: "PUT",
|
|
252
|
+
body: JSON.stringify({ categories, projectId }),
|
|
253
|
+
expectNoContent: true
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
/** Deletes a category */
|
|
257
|
+
async removeCategory(options) {
|
|
258
|
+
const { projectId } = this.options;
|
|
259
|
+
const fetchUri = this.createUrl(CATEGORIES_URL);
|
|
260
|
+
return await this.apiClient(fetchUri, {
|
|
261
|
+
method: "DELETE",
|
|
262
|
+
body: JSON.stringify({ projectId, categoryId: options.categoryId }),
|
|
263
|
+
expectNoContent: true
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
var UncachedCategoryClient = class extends CategoryClient {
|
|
268
|
+
constructor(options) {
|
|
269
|
+
super({ ...options, bypassCache: true });
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
// src/ContentClient.ts
|
|
274
|
+
import { ApiClient as ApiClient3, rewriteFiltersForApi as rewriteFiltersForApi2 } from "@uniformdev/context/api";
|
|
875
275
|
var _contentTypesUrl, _entriesUrl;
|
|
876
|
-
var _ContentClient = class _ContentClient extends
|
|
276
|
+
var _ContentClient = class _ContentClient extends ApiClient3 {
|
|
877
277
|
constructor(options) {
|
|
878
278
|
var _a;
|
|
879
279
|
super(options);
|
|
@@ -887,7 +287,7 @@ var _ContentClient = class _ContentClient extends ApiClient4 {
|
|
|
887
287
|
getEntries(options) {
|
|
888
288
|
const { projectId } = this.options;
|
|
889
289
|
const { skipDataResolution, filters, select, ...params } = options;
|
|
890
|
-
const rewrittenFilters =
|
|
290
|
+
const rewrittenFilters = rewriteFiltersForApi2(filters);
|
|
891
291
|
const rewrittenSelect = projectionToQuery(select);
|
|
892
292
|
if (skipDataResolution) {
|
|
893
293
|
const url = this.createUrl(__privateGet(_ContentClient, _entriesUrl), {
|
|
@@ -980,31 +380,27 @@ var UncachedContentClient = class extends ContentClient {
|
|
|
980
380
|
};
|
|
981
381
|
|
|
982
382
|
// src/DataSourceClient.ts
|
|
983
|
-
import { ApiClient as
|
|
383
|
+
import { ApiClient as ApiClient4 } from "@uniformdev/context/api";
|
|
984
384
|
var dataSourceUrl = "/api/v1/data-source";
|
|
985
385
|
var dataSourcesUrl = "/api/v1/data-sources";
|
|
986
|
-
var DataSourceClient = class extends
|
|
386
|
+
var DataSourceClient = class extends ApiClient4 {
|
|
987
387
|
constructor(options) {
|
|
988
388
|
super(options);
|
|
989
389
|
}
|
|
990
|
-
/** Fetches
|
|
390
|
+
/** Fetches all DataSources for a project */
|
|
991
391
|
async get(options) {
|
|
992
392
|
const { projectId } = this.options;
|
|
993
393
|
const fetchUri = this.createUrl(dataSourceUrl, { ...options, projectId });
|
|
994
394
|
return await this.apiClient(fetchUri);
|
|
995
395
|
}
|
|
996
|
-
/** Fetches
|
|
997
|
-
async
|
|
396
|
+
/** Fetches all DataSources for a project */
|
|
397
|
+
async getList(options) {
|
|
998
398
|
const { projectId } = this.options;
|
|
999
399
|
const fetchUri = this.createUrl(dataSourcesUrl, { ...options, projectId });
|
|
1000
400
|
return await this.apiClient(fetchUri);
|
|
1001
401
|
}
|
|
1002
|
-
/** @deprecated Use {@link list} instead. */
|
|
1003
|
-
async getList(options) {
|
|
1004
|
-
return this.list(options);
|
|
1005
|
-
}
|
|
1006
402
|
/** Updates or creates (based on id) a DataSource */
|
|
1007
|
-
async
|
|
403
|
+
async upsert(body) {
|
|
1008
404
|
const fetchUri = this.createUrl(dataSourceUrl);
|
|
1009
405
|
await this.apiClient(fetchUri, {
|
|
1010
406
|
method: "PUT",
|
|
@@ -1012,10 +408,6 @@ var DataSourceClient = class extends ApiClient5 {
|
|
|
1012
408
|
expectNoContent: true
|
|
1013
409
|
});
|
|
1014
410
|
}
|
|
1015
|
-
/** @deprecated Use {@link save} instead. */
|
|
1016
|
-
async upsert(body) {
|
|
1017
|
-
return this.save(body);
|
|
1018
|
-
}
|
|
1019
411
|
/** Deletes a DataSource */
|
|
1020
412
|
async remove(body) {
|
|
1021
413
|
const fetchUri = this.createUrl(dataSourceUrl);
|
|
@@ -1028,24 +420,20 @@ var DataSourceClient = class extends ApiClient5 {
|
|
|
1028
420
|
};
|
|
1029
421
|
|
|
1030
422
|
// src/DataTypeClient.ts
|
|
1031
|
-
import { ApiClient as
|
|
423
|
+
import { ApiClient as ApiClient5 } from "@uniformdev/context/api";
|
|
1032
424
|
var _url;
|
|
1033
|
-
var _DataTypeClient = class _DataTypeClient extends
|
|
425
|
+
var _DataTypeClient = class _DataTypeClient extends ApiClient5 {
|
|
1034
426
|
constructor(options) {
|
|
1035
427
|
super(options);
|
|
1036
428
|
}
|
|
1037
|
-
/** Fetches
|
|
1038
|
-
async
|
|
429
|
+
/** Fetches all DataTypes for a project */
|
|
430
|
+
async get(options) {
|
|
1039
431
|
const { projectId } = this.options;
|
|
1040
432
|
const fetchUri = this.createUrl(__privateGet(_DataTypeClient, _url), { ...options, projectId });
|
|
1041
433
|
return await this.apiClient(fetchUri);
|
|
1042
434
|
}
|
|
1043
|
-
/** @deprecated Use {@link list} instead. */
|
|
1044
|
-
async get(options) {
|
|
1045
|
-
return this.list(options);
|
|
1046
|
-
}
|
|
1047
435
|
/** Updates or creates (based on id) a DataType */
|
|
1048
|
-
async
|
|
436
|
+
async upsert(body) {
|
|
1049
437
|
const fetchUri = this.createUrl(__privateGet(_DataTypeClient, _url));
|
|
1050
438
|
await this.apiClient(fetchUri, {
|
|
1051
439
|
method: "PUT",
|
|
@@ -1053,10 +441,6 @@ var _DataTypeClient = class _DataTypeClient extends ApiClient6 {
|
|
|
1053
441
|
expectNoContent: true
|
|
1054
442
|
});
|
|
1055
443
|
}
|
|
1056
|
-
/** @deprecated Use {@link save} instead. */
|
|
1057
|
-
async upsert(body) {
|
|
1058
|
-
return this.save(body);
|
|
1059
|
-
}
|
|
1060
444
|
/** Deletes a DataType */
|
|
1061
445
|
async remove(body) {
|
|
1062
446
|
const fetchUri = this.createUrl(__privateGet(_DataTypeClient, _url));
|
|
@@ -1192,6 +576,61 @@ function getComponentPath(ancestorsAndSelf) {
|
|
|
1192
576
|
return `.${path.join(".")}`;
|
|
1193
577
|
}
|
|
1194
578
|
|
|
579
|
+
// src/utils/constants.ts
|
|
580
|
+
var CANVAS_PERSONALIZE_TYPE = "$personalization";
|
|
581
|
+
var CANVAS_TEST_TYPE = "$test";
|
|
582
|
+
var CANVAS_LOCALIZATION_TYPE = "$localization";
|
|
583
|
+
var CANVAS_SLOT_SECTION_TYPE = "$slotSection";
|
|
584
|
+
var CANVAS_INTENT_TAG_PARAM = "intentTag";
|
|
585
|
+
var CANVAS_LOCALE_TAG_PARAM = "locale";
|
|
586
|
+
var CANVAS_BLOCK_PARAM_TYPE = "$block";
|
|
587
|
+
var CANVAS_PERSONALIZE_SLOT = "pz";
|
|
588
|
+
var CANVAS_TEST_SLOT = "test";
|
|
589
|
+
var CANVAS_LOCALIZATION_SLOT = "localized";
|
|
590
|
+
var CANVAS_SLOT_SECTION_SLOT = "$slotSectionItems";
|
|
591
|
+
var CANVAS_SLOT_SECTION_NAME_PARAM = "name";
|
|
592
|
+
var CANVAS_SLOT_SECTION_MIN_PARAM = "min";
|
|
593
|
+
var CANVAS_SLOT_SECTION_MAX_PARAM = "max";
|
|
594
|
+
var CANVAS_SLOT_SECTION_GROUP_TYPE_PARAM = "groupType";
|
|
595
|
+
var CANVAS_SLOT_SECTION_SPECIFIC_PARAM = "specific";
|
|
596
|
+
var CANVAS_DRAFT_STATE = 0;
|
|
597
|
+
var CANVAS_PUBLISHED_STATE = 64;
|
|
598
|
+
var CANVAS_EDITOR_STATE = 63;
|
|
599
|
+
var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
|
|
600
|
+
var CANVAS_PERSONALIZATION_EVENT_NAME_PARAM = "trackingEventName";
|
|
601
|
+
var CANVAS_PERSONALIZATION_ALGORITHM_PARAM = "algorithm";
|
|
602
|
+
var CANVAS_PERSONALIZATION_ALGORITHM_TYPE = "pzAlgorithm";
|
|
603
|
+
var CANVAS_PERSONALIZATION_TAKE_PARAM = "count";
|
|
604
|
+
var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
|
|
605
|
+
var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
|
|
606
|
+
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
607
|
+
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
608
|
+
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
609
|
+
var CANVAS_CONTEXTUAL_EDITING_PARAM = "$contextualEditing";
|
|
610
|
+
var SECRET_QUERY_STRING_PARAM = "secret";
|
|
611
|
+
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
612
|
+
var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
|
|
613
|
+
var IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM = "is_incontext_editing_forced_settings";
|
|
614
|
+
var IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM = "is_config_check";
|
|
615
|
+
var IN_CONTEXT_EDITOR_COMPONENT_START_ROLE = "uniform-component-start";
|
|
616
|
+
var IN_CONTEXT_EDITOR_COMPONENT_END_ROLE = "uniform-component-end";
|
|
617
|
+
var IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID = "uniform-canvas-preview-script";
|
|
618
|
+
var IS_RENDERED_BY_UNIFORM_ATTRIBUTE = "data-is-rendered-by-uniform";
|
|
619
|
+
var PLACEHOLDER_ID = "placeholder";
|
|
620
|
+
var EMPTY_COMPOSITION = {
|
|
621
|
+
_id: "_empty_composition_id",
|
|
622
|
+
_name: "An empty composition used for contextual editing",
|
|
623
|
+
type: "_empty_composition_type"
|
|
624
|
+
};
|
|
625
|
+
var EDGE_MIN_CACHE_TTL = 10;
|
|
626
|
+
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
627
|
+
var EDGE_DEFAULT_CACHE_TTL = 30;
|
|
628
|
+
var EDGE_CACHE_DISABLED = -1;
|
|
629
|
+
var ASSET_PARAMETER_TYPE = "asset";
|
|
630
|
+
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
|
631
|
+
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
|
632
|
+
var REFERENCE_DATA_TYPE_ID = "uniformContentInternalReference";
|
|
633
|
+
|
|
1195
634
|
// src/utils/guards.ts
|
|
1196
635
|
function isRootEntryReference(root) {
|
|
1197
636
|
return root.type === "root" && isEntryData(root.node);
|
|
@@ -2645,28 +2084,24 @@ function walkPropertyValues(property, visitor) {
|
|
|
2645
2084
|
}
|
|
2646
2085
|
|
|
2647
2086
|
// src/EntityReleasesClient.ts
|
|
2648
|
-
import { ApiClient as
|
|
2649
|
-
var
|
|
2650
|
-
var EntityReleasesClient = class extends
|
|
2087
|
+
import { ApiClient as ApiClient6 } from "@uniformdev/context/api";
|
|
2088
|
+
var releaseContentsUrl = "/api/v1/entity-releases";
|
|
2089
|
+
var EntityReleasesClient = class extends ApiClient6 {
|
|
2651
2090
|
constructor(options) {
|
|
2652
2091
|
super(options);
|
|
2653
2092
|
}
|
|
2654
2093
|
/** Fetches entity across all releases (and base) */
|
|
2655
|
-
async
|
|
2094
|
+
async get(options) {
|
|
2656
2095
|
const { projectId } = this.options;
|
|
2657
|
-
const fetchUri = this.createUrl(
|
|
2096
|
+
const fetchUri = this.createUrl(releaseContentsUrl, { ...options, projectId });
|
|
2658
2097
|
return await this.apiClient(fetchUri);
|
|
2659
2098
|
}
|
|
2660
|
-
/** @deprecated Use {@link list} instead. */
|
|
2661
|
-
async get(options) {
|
|
2662
|
-
return this.list(options);
|
|
2663
|
-
}
|
|
2664
2099
|
};
|
|
2665
2100
|
|
|
2666
2101
|
// src/IntegrationPropertyEditorsClient.ts
|
|
2667
|
-
import { ApiClient as
|
|
2102
|
+
import { ApiClient as ApiClient7 } from "@uniformdev/context/api";
|
|
2668
2103
|
var _baseUrl;
|
|
2669
|
-
var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient extends
|
|
2104
|
+
var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient extends ApiClient7 {
|
|
2670
2105
|
constructor(options) {
|
|
2671
2106
|
super(options);
|
|
2672
2107
|
this.teamId = options.teamId;
|
|
@@ -2709,21 +2144,17 @@ __privateAdd(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-p
|
|
|
2709
2144
|
var IntegrationPropertyEditorsClient = _IntegrationPropertyEditorsClient;
|
|
2710
2145
|
|
|
2711
2146
|
// src/LabelClient.ts
|
|
2712
|
-
import { ApiClient as
|
|
2147
|
+
import { ApiClient as ApiClient8 } from "@uniformdev/context/api";
|
|
2713
2148
|
var LABELS_URL = "/api/v1/labels";
|
|
2714
|
-
var LabelClient = class extends
|
|
2715
|
-
/** Fetches
|
|
2716
|
-
async
|
|
2149
|
+
var LabelClient = class extends ApiClient8 {
|
|
2150
|
+
/** Fetches labels for the current project. */
|
|
2151
|
+
async getLabels(options) {
|
|
2717
2152
|
const { projectId } = this.options;
|
|
2718
2153
|
const fetchUri = this.createUrl(LABELS_URL, { ...options, projectId });
|
|
2719
2154
|
return await this.apiClient(fetchUri);
|
|
2720
2155
|
}
|
|
2721
|
-
/** @deprecated Use {@link list} instead. */
|
|
2722
|
-
async getLabels(options) {
|
|
2723
|
-
return this.list(options);
|
|
2724
|
-
}
|
|
2725
2156
|
/** Updates or creates a label. */
|
|
2726
|
-
async
|
|
2157
|
+
async upsertLabel(body) {
|
|
2727
2158
|
const { projectId } = this.options;
|
|
2728
2159
|
const fetchUri = this.createUrl(LABELS_URL);
|
|
2729
2160
|
await this.apiClient(fetchUri, {
|
|
@@ -2732,12 +2163,8 @@ var LabelClient = class extends ApiClient9 {
|
|
|
2732
2163
|
expectNoContent: true
|
|
2733
2164
|
});
|
|
2734
2165
|
}
|
|
2735
|
-
/** @deprecated Use {@link save} instead. */
|
|
2736
|
-
async upsertLabel(body) {
|
|
2737
|
-
return this.save(body);
|
|
2738
|
-
}
|
|
2739
2166
|
/** Deletes a label by id. */
|
|
2740
|
-
async
|
|
2167
|
+
async removeLabel(options) {
|
|
2741
2168
|
const { projectId } = this.options;
|
|
2742
2169
|
const fetchUri = this.createUrl(LABELS_URL);
|
|
2743
2170
|
await this.apiClient(fetchUri, {
|
|
@@ -2746,10 +2173,6 @@ var LabelClient = class extends ApiClient9 {
|
|
|
2746
2173
|
expectNoContent: true
|
|
2747
2174
|
});
|
|
2748
2175
|
}
|
|
2749
|
-
/** @deprecated Use {@link remove} instead. */
|
|
2750
|
-
async removeLabel(options) {
|
|
2751
|
-
return this.remove(options);
|
|
2752
|
-
}
|
|
2753
2176
|
};
|
|
2754
2177
|
var UncachedLabelClient = class extends LabelClient {
|
|
2755
2178
|
constructor(options) {
|
|
@@ -2758,24 +2181,20 @@ var UncachedLabelClient = class extends LabelClient {
|
|
|
2758
2181
|
};
|
|
2759
2182
|
|
|
2760
2183
|
// src/LocaleClient.ts
|
|
2761
|
-
import { ApiClient as
|
|
2184
|
+
import { ApiClient as ApiClient9 } from "@uniformdev/context/api";
|
|
2762
2185
|
var localesUrl = "/api/v1/locales";
|
|
2763
|
-
var LocaleClient = class extends
|
|
2186
|
+
var LocaleClient = class extends ApiClient9 {
|
|
2764
2187
|
constructor(options) {
|
|
2765
2188
|
super(options);
|
|
2766
2189
|
}
|
|
2767
|
-
/** Fetches
|
|
2768
|
-
async
|
|
2190
|
+
/** Fetches all locales for a project */
|
|
2191
|
+
async get(options) {
|
|
2769
2192
|
const { projectId } = this.options;
|
|
2770
2193
|
const fetchUri = this.createUrl(localesUrl, { ...options, projectId });
|
|
2771
2194
|
return await this.apiClient(fetchUri);
|
|
2772
2195
|
}
|
|
2773
|
-
/** @deprecated Use {@link list} instead. */
|
|
2774
|
-
async get(options) {
|
|
2775
|
-
return this.list(options);
|
|
2776
|
-
}
|
|
2777
2196
|
/** Updates or creates (based on id) a locale */
|
|
2778
|
-
async
|
|
2197
|
+
async upsert(body) {
|
|
2779
2198
|
const fetchUri = this.createUrl(localesUrl);
|
|
2780
2199
|
await this.apiClient(fetchUri, {
|
|
2781
2200
|
method: "PUT",
|
|
@@ -2783,10 +2202,6 @@ var LocaleClient = class extends ApiClient10 {
|
|
|
2783
2202
|
expectNoContent: true
|
|
2784
2203
|
});
|
|
2785
2204
|
}
|
|
2786
|
-
/** @deprecated Use {@link save} instead. */
|
|
2787
|
-
async upsert(body) {
|
|
2788
|
-
return this.save(body);
|
|
2789
|
-
}
|
|
2790
2205
|
/** Deletes a locale */
|
|
2791
2206
|
async remove(body) {
|
|
2792
2207
|
const fetchUri = this.createUrl(localesUrl);
|
|
@@ -3170,10 +2585,10 @@ var createCanvasChannel = ({
|
|
|
3170
2585
|
};
|
|
3171
2586
|
|
|
3172
2587
|
// src/PreviewClient.ts
|
|
3173
|
-
import { ApiClient as
|
|
2588
|
+
import { ApiClient as ApiClient10 } from "@uniformdev/context/api";
|
|
3174
2589
|
var previewUrlsUrl = "/api/v1/preview-urls";
|
|
3175
2590
|
var previewViewportsUrl = "/api/v1/preview-viewports";
|
|
3176
|
-
var PreviewClient = class extends
|
|
2591
|
+
var PreviewClient = class extends ApiClient10 {
|
|
3177
2592
|
constructor(options) {
|
|
3178
2593
|
super(options);
|
|
3179
2594
|
}
|
|
@@ -3236,9 +2651,9 @@ var PreviewClient = class extends ApiClient11 {
|
|
|
3236
2651
|
};
|
|
3237
2652
|
|
|
3238
2653
|
// src/ProjectClient.ts
|
|
3239
|
-
import { ApiClient as
|
|
2654
|
+
import { ApiClient as ApiClient11 } from "@uniformdev/context/api";
|
|
3240
2655
|
var _url2, _projectsUrl;
|
|
3241
|
-
var _ProjectClient = class _ProjectClient extends
|
|
2656
|
+
var _ProjectClient = class _ProjectClient extends ApiClient11 {
|
|
3242
2657
|
constructor(options) {
|
|
3243
2658
|
super({ ...options, bypassCache: true });
|
|
3244
2659
|
}
|
|
@@ -3252,28 +2667,20 @@ var _ProjectClient = class _ProjectClient extends ApiClient12 {
|
|
|
3252
2667
|
* When teamId is provided, returns a single team with its projects.
|
|
3253
2668
|
* When omitted, returns all accessible teams and their projects.
|
|
3254
2669
|
*/
|
|
3255
|
-
async
|
|
2670
|
+
async getProjects(options) {
|
|
3256
2671
|
const fetchUri = this.createUrl(__privateGet(_ProjectClient, _projectsUrl), options ? { ...options } : {});
|
|
3257
2672
|
return await this.apiClient(fetchUri);
|
|
3258
2673
|
}
|
|
3259
|
-
/** @deprecated Use {@link list} instead. */
|
|
3260
|
-
async getProjects(options) {
|
|
3261
|
-
return this.list(options);
|
|
3262
|
-
}
|
|
3263
2674
|
/** Updates or creates (based on id) a Project */
|
|
3264
|
-
async
|
|
2675
|
+
async upsert(body) {
|
|
3265
2676
|
const fetchUri = this.createUrl(__privateGet(_ProjectClient, _url2));
|
|
3266
2677
|
return await this.apiClient(fetchUri, {
|
|
3267
2678
|
method: "PUT",
|
|
3268
2679
|
body: JSON.stringify({ ...body })
|
|
3269
2680
|
});
|
|
3270
2681
|
}
|
|
3271
|
-
/** @deprecated Use {@link save} instead. */
|
|
3272
|
-
async upsert(body) {
|
|
3273
|
-
return this.save(body);
|
|
3274
|
-
}
|
|
3275
2682
|
/** Deletes a Project */
|
|
3276
|
-
async
|
|
2683
|
+
async delete(body) {
|
|
3277
2684
|
const fetchUri = this.createUrl(__privateGet(_ProjectClient, _url2));
|
|
3278
2685
|
await this.apiClient(fetchUri, {
|
|
3279
2686
|
method: "DELETE",
|
|
@@ -3281,10 +2688,6 @@ var _ProjectClient = class _ProjectClient extends ApiClient12 {
|
|
|
3281
2688
|
expectNoContent: true
|
|
3282
2689
|
});
|
|
3283
2690
|
}
|
|
3284
|
-
/** @deprecated Use {@link remove} instead. */
|
|
3285
|
-
async delete(body) {
|
|
3286
|
-
return this.remove(body);
|
|
3287
|
-
}
|
|
3288
2691
|
};
|
|
3289
2692
|
_url2 = new WeakMap();
|
|
3290
2693
|
_projectsUrl = new WeakMap();
|
|
@@ -3460,9 +2863,9 @@ function queryToProjection(source) {
|
|
|
3460
2863
|
}
|
|
3461
2864
|
|
|
3462
2865
|
// src/PromptClient.ts
|
|
3463
|
-
import { ApiClient as
|
|
2866
|
+
import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
|
|
3464
2867
|
var PromptsUrl = "/api/v1/prompts";
|
|
3465
|
-
var PromptClient = class extends
|
|
2868
|
+
var PromptClient = class extends ApiClient12 {
|
|
3466
2869
|
constructor(options) {
|
|
3467
2870
|
super(options);
|
|
3468
2871
|
}
|
|
@@ -3493,42 +2896,34 @@ var PromptClient = class extends ApiClient13 {
|
|
|
3493
2896
|
};
|
|
3494
2897
|
|
|
3495
2898
|
// src/RelationshipClient.ts
|
|
3496
|
-
import { ApiClient as
|
|
2899
|
+
import { ApiClient as ApiClient13 } from "@uniformdev/context/api";
|
|
3497
2900
|
var RELATIONSHIPS_URL = "/api/v1/relationships";
|
|
3498
|
-
var RelationshipClient = class extends
|
|
2901
|
+
var RelationshipClient = class extends ApiClient13 {
|
|
3499
2902
|
constructor(options) {
|
|
3500
2903
|
super(options);
|
|
3501
|
-
this.
|
|
2904
|
+
this.get = async (options) => {
|
|
3502
2905
|
const { projectId } = this.options;
|
|
3503
2906
|
const url = this.createUrl(RELATIONSHIPS_URL, { ...options, projectId });
|
|
3504
2907
|
return this.apiClient(url);
|
|
3505
2908
|
};
|
|
3506
|
-
/** @deprecated Use {@link list} instead. */
|
|
3507
|
-
this.get = async (options) => {
|
|
3508
|
-
return this.list(options);
|
|
3509
|
-
};
|
|
3510
2909
|
}
|
|
3511
2910
|
};
|
|
3512
2911
|
|
|
3513
2912
|
// src/ReleaseClient.ts
|
|
3514
|
-
import { ApiClient as
|
|
2913
|
+
import { ApiClient as ApiClient14 } from "@uniformdev/context/api";
|
|
3515
2914
|
var releasesUrl = "/api/v1/releases";
|
|
3516
|
-
var ReleaseClient = class extends
|
|
2915
|
+
var ReleaseClient = class extends ApiClient14 {
|
|
3517
2916
|
constructor(options) {
|
|
3518
2917
|
super(options);
|
|
3519
2918
|
}
|
|
3520
|
-
/** Fetches
|
|
3521
|
-
async
|
|
2919
|
+
/** Fetches all releases for a project */
|
|
2920
|
+
async get(options) {
|
|
3522
2921
|
const { projectId } = this.options;
|
|
3523
2922
|
const fetchUri = this.createUrl(releasesUrl, { ...options, projectId });
|
|
3524
2923
|
return await this.apiClient(fetchUri);
|
|
3525
2924
|
}
|
|
3526
|
-
/** @deprecated Use {@link list} instead. */
|
|
3527
|
-
async get(options) {
|
|
3528
|
-
return this.list(options);
|
|
3529
|
-
}
|
|
3530
2925
|
/** Updates or creates (based on id) a release */
|
|
3531
|
-
async
|
|
2926
|
+
async upsert(body) {
|
|
3532
2927
|
const fetchUri = this.createUrl(releasesUrl);
|
|
3533
2928
|
await this.apiClient(fetchUri, {
|
|
3534
2929
|
method: "PUT",
|
|
@@ -3536,10 +2931,6 @@ var ReleaseClient = class extends ApiClient15 {
|
|
|
3536
2931
|
expectNoContent: true
|
|
3537
2932
|
});
|
|
3538
2933
|
}
|
|
3539
|
-
/** @deprecated Use {@link save} instead. */
|
|
3540
|
-
async upsert(body) {
|
|
3541
|
-
return this.save(body);
|
|
3542
|
-
}
|
|
3543
2934
|
/** Deletes a release */
|
|
3544
2935
|
async remove(body) {
|
|
3545
2936
|
const fetchUri = this.createUrl(releasesUrl);
|
|
@@ -3561,25 +2952,21 @@ var ReleaseClient = class extends ApiClient15 {
|
|
|
3561
2952
|
};
|
|
3562
2953
|
|
|
3563
2954
|
// src/ReleaseContentsClient.ts
|
|
3564
|
-
import { ApiClient as
|
|
3565
|
-
var
|
|
3566
|
-
var ReleaseContentsClient = class extends
|
|
2955
|
+
import { ApiClient as ApiClient15 } from "@uniformdev/context/api";
|
|
2956
|
+
var releaseContentsUrl2 = "/api/v1/release-contents";
|
|
2957
|
+
var ReleaseContentsClient = class extends ApiClient15 {
|
|
3567
2958
|
constructor(options) {
|
|
3568
2959
|
super(options);
|
|
3569
2960
|
}
|
|
3570
|
-
/** Fetches
|
|
3571
|
-
async
|
|
2961
|
+
/** Fetches all entities added to a release */
|
|
2962
|
+
async get(options) {
|
|
3572
2963
|
const { projectId } = this.options;
|
|
3573
|
-
const fetchUri = this.createUrl(
|
|
2964
|
+
const fetchUri = this.createUrl(releaseContentsUrl2, { ...options, projectId });
|
|
3574
2965
|
return await this.apiClient(fetchUri);
|
|
3575
2966
|
}
|
|
3576
|
-
/** @deprecated Use {@link list} instead. */
|
|
3577
|
-
async get(options) {
|
|
3578
|
-
return this.list(options);
|
|
3579
|
-
}
|
|
3580
2967
|
/** Removes a release content from a release */
|
|
3581
2968
|
async remove(body) {
|
|
3582
|
-
const fetchUri = this.createUrl(
|
|
2969
|
+
const fetchUri = this.createUrl(releaseContentsUrl2);
|
|
3583
2970
|
await this.apiClient(fetchUri, {
|
|
3584
2971
|
method: "DELETE",
|
|
3585
2972
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -3589,9 +2976,9 @@ var ReleaseContentsClient = class extends ApiClient16 {
|
|
|
3589
2976
|
};
|
|
3590
2977
|
|
|
3591
2978
|
// src/RouteClient.ts
|
|
3592
|
-
import { ApiClient as
|
|
2979
|
+
import { ApiClient as ApiClient16 } from "@uniformdev/context/api";
|
|
3593
2980
|
var ROUTE_URL = "/api/v1/route";
|
|
3594
|
-
var RouteClient = class extends
|
|
2981
|
+
var RouteClient = class extends ApiClient16 {
|
|
3595
2982
|
constructor(options) {
|
|
3596
2983
|
var _a;
|
|
3597
2984
|
if (!options.limitPolicy) {
|
|
@@ -3600,14 +2987,8 @@ var RouteClient = class extends ApiClient17 {
|
|
|
3600
2987
|
super(options);
|
|
3601
2988
|
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
|
|
3602
2989
|
}
|
|
3603
|
-
/**
|
|
3604
|
-
|
|
3605
|
-
*
|
|
3606
|
-
* An optional `select` projection applies to the resolved composition when
|
|
3607
|
-
* the route matches one; redirect / notFound responses pass through
|
|
3608
|
-
* untouched.
|
|
3609
|
-
*/
|
|
3610
|
-
async get(options) {
|
|
2990
|
+
/** Fetches lists of Canvas compositions, optionally by type */
|
|
2991
|
+
async getRoute(options) {
|
|
3611
2992
|
const { projectId } = this.options;
|
|
3612
2993
|
const { select, ...rest } = options != null ? options : {};
|
|
3613
2994
|
const rewrittenSelect = projectionToQuery(select);
|
|
@@ -3617,10 +2998,6 @@ var RouteClient = class extends ApiClient17 {
|
|
|
3617
2998
|
this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
|
|
3618
2999
|
);
|
|
3619
3000
|
}
|
|
3620
|
-
/** @deprecated use {@link RouteClient.get} instead (renamed). */
|
|
3621
|
-
async getRoute(options) {
|
|
3622
|
-
return this.get(options);
|
|
3623
|
-
}
|
|
3624
3001
|
};
|
|
3625
3002
|
|
|
3626
3003
|
// src/types/locales.ts
|
|
@@ -3975,30 +3352,26 @@ function handleRichTextNodeBinding(object, options) {
|
|
|
3975
3352
|
}
|
|
3976
3353
|
|
|
3977
3354
|
// src/index.ts
|
|
3978
|
-
import { ApiClientError as
|
|
3355
|
+
import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
|
|
3979
3356
|
|
|
3980
3357
|
// src/.version.ts
|
|
3981
|
-
var version = "20.71.
|
|
3358
|
+
var version = "20.71.1";
|
|
3982
3359
|
|
|
3983
3360
|
// src/WorkflowClient.ts
|
|
3984
|
-
import { ApiClient as
|
|
3361
|
+
import { ApiClient as ApiClient17 } from "@uniformdev/context/api";
|
|
3985
3362
|
var workflowsUrl = "/api/v1/workflows";
|
|
3986
|
-
var WorkflowClient = class extends
|
|
3363
|
+
var WorkflowClient = class extends ApiClient17 {
|
|
3987
3364
|
constructor(options) {
|
|
3988
3365
|
super(options);
|
|
3989
3366
|
}
|
|
3990
|
-
/** Fetches
|
|
3991
|
-
async
|
|
3367
|
+
/** Fetches workflows for a project */
|
|
3368
|
+
async get(options) {
|
|
3992
3369
|
const { projectId } = this.options;
|
|
3993
3370
|
const fetchUri = this.createUrl(workflowsUrl, { ...options, projectId });
|
|
3994
3371
|
return await this.apiClient(fetchUri);
|
|
3995
3372
|
}
|
|
3996
|
-
/** @deprecated Use {@link list} instead. */
|
|
3997
|
-
async get(options) {
|
|
3998
|
-
return this.list(options);
|
|
3999
|
-
}
|
|
4000
3373
|
/** Updates or creates a workflow definition */
|
|
4001
|
-
async
|
|
3374
|
+
async upsert(body) {
|
|
4002
3375
|
const fetchUri = this.createUrl(workflowsUrl);
|
|
4003
3376
|
await this.apiClient(fetchUri, {
|
|
4004
3377
|
method: "PUT",
|
|
@@ -4006,10 +3379,6 @@ var WorkflowClient = class extends ApiClient18 {
|
|
|
4006
3379
|
expectNoContent: true
|
|
4007
3380
|
});
|
|
4008
3381
|
}
|
|
4009
|
-
/** @deprecated Use {@link save} instead. */
|
|
4010
|
-
async upsert(body) {
|
|
4011
|
-
return this.save(body);
|
|
4012
|
-
}
|
|
4013
3382
|
/** Deletes a workflow definition */
|
|
4014
3383
|
async remove(body) {
|
|
4015
3384
|
const fetchUri = this.createUrl(workflowsUrl);
|
|
@@ -4022,7 +3391,7 @@ var WorkflowClient = class extends ApiClient18 {
|
|
|
4022
3391
|
};
|
|
4023
3392
|
|
|
4024
3393
|
// src/index.ts
|
|
4025
|
-
var CanvasClientError =
|
|
3394
|
+
var CanvasClientError = ApiClientError2;
|
|
4026
3395
|
export {
|
|
4027
3396
|
ASSETS_SOURCE_CUSTOM_URL,
|
|
4028
3397
|
ASSETS_SOURCE_UNIFORM,
|
|
@@ -4033,7 +3402,7 @@ export {
|
|
|
4033
3402
|
ATTRIBUTE_PARAMETER_TYPE,
|
|
4034
3403
|
ATTRIBUTE_PARAMETER_VALUE,
|
|
4035
3404
|
ATTRIBUTE_PLACEHOLDER,
|
|
4036
|
-
|
|
3405
|
+
ApiClientError2 as ApiClientError,
|
|
4037
3406
|
BatchEntry,
|
|
4038
3407
|
BlockFormatError,
|
|
4039
3408
|
CANVAS_BLOCK_PARAM_TYPE,
|
|
@@ -4075,11 +3444,7 @@ export {
|
|
|
4075
3444
|
CanvasClientError,
|
|
4076
3445
|
CategoryClient,
|
|
4077
3446
|
ChildEnhancerBuilder,
|
|
4078
|
-
ComponentDefinitionClient,
|
|
4079
|
-
CompositionDeliveryClient,
|
|
4080
|
-
CompositionManagementClient,
|
|
4081
3447
|
ContentClient,
|
|
4082
|
-
ContentTypeClient,
|
|
4083
3448
|
DataSourceClient,
|
|
4084
3449
|
DataTypeClient,
|
|
4085
3450
|
EDGE_CACHE_DISABLED,
|
|
@@ -4089,8 +3454,6 @@ export {
|
|
|
4089
3454
|
EMPTY_COMPOSITION,
|
|
4090
3455
|
EnhancerBuilder,
|
|
4091
3456
|
EntityReleasesClient,
|
|
4092
|
-
EntryDeliveryClient,
|
|
4093
|
-
EntryManagementClient,
|
|
4094
3457
|
IN_CONTEXT_EDITOR_COMPONENT_END_ROLE,
|
|
4095
3458
|
IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
|
|
4096
3459
|
IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM,
|