@uniformdev/canvas 20.72.2 → 20.72.3-alpha.14
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 +3280 -2154
- package/dist/index.d.ts +3280 -2154
- package/dist/index.esm.js +874 -190
- package/dist/index.js +880 -189
- package/dist/index.mjs +874 -190
- package/package.json +5 -5
package/dist/index.esm.js
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
|
|
8
|
+
// src/CategoryClient.ts
|
|
9
|
+
import { ApiClient } from "@uniformdev/context/api";
|
|
10
10
|
|
|
11
11
|
// src/enhancement/createLimitPolicy.ts
|
|
12
12
|
import { ApiClientError } from "@uniformdev/context/api";
|
|
@@ -49,6 +49,129 @@ 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
|
+
|
|
52
175
|
// src/projection/types.ts
|
|
53
176
|
var SELECT_QUERY_PREFIX = "select.";
|
|
54
177
|
|
|
@@ -97,9 +220,529 @@ function projectionToQuery(spec) {
|
|
|
97
220
|
return out;
|
|
98
221
|
}
|
|
99
222
|
|
|
100
|
-
// src/
|
|
223
|
+
// src/utils/constants.ts
|
|
224
|
+
var CANVAS_PERSONALIZE_TYPE = "$personalization";
|
|
225
|
+
var CANVAS_TEST_TYPE = "$test";
|
|
226
|
+
var CANVAS_LOCALIZATION_TYPE = "$localization";
|
|
227
|
+
var CANVAS_SLOT_SECTION_TYPE = "$slotSection";
|
|
228
|
+
var CANVAS_INTENT_TAG_PARAM = "intentTag";
|
|
229
|
+
var CANVAS_LOCALE_TAG_PARAM = "locale";
|
|
230
|
+
var CANVAS_BLOCK_PARAM_TYPE = "$block";
|
|
231
|
+
var CANVAS_PERSONALIZE_SLOT = "pz";
|
|
232
|
+
var CANVAS_TEST_SLOT = "test";
|
|
233
|
+
var CANVAS_LOCALIZATION_SLOT = "localized";
|
|
234
|
+
var CANVAS_SLOT_SECTION_SLOT = "$slotSectionItems";
|
|
235
|
+
var CANVAS_SLOT_SECTION_NAME_PARAM = "name";
|
|
236
|
+
var CANVAS_SLOT_SECTION_MIN_PARAM = "min";
|
|
237
|
+
var CANVAS_SLOT_SECTION_MAX_PARAM = "max";
|
|
238
|
+
var CANVAS_SLOT_SECTION_GROUP_TYPE_PARAM = "groupType";
|
|
239
|
+
var CANVAS_SLOT_SECTION_SPECIFIC_PARAM = "specific";
|
|
240
|
+
var CANVAS_DRAFT_STATE = 0;
|
|
241
|
+
var CANVAS_PUBLISHED_STATE = 64;
|
|
242
|
+
var CANVAS_EDITOR_STATE = 63;
|
|
243
|
+
var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
|
|
244
|
+
var CANVAS_PERSONALIZATION_EVENT_NAME_PARAM = "trackingEventName";
|
|
245
|
+
var CANVAS_PERSONALIZATION_ALGORITHM_PARAM = "algorithm";
|
|
246
|
+
var CANVAS_PERSONALIZATION_ALGORITHM_TYPE = "pzAlgorithm";
|
|
247
|
+
var CANVAS_PERSONALIZATION_TAKE_PARAM = "count";
|
|
248
|
+
var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
|
|
249
|
+
var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
|
|
250
|
+
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
251
|
+
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
252
|
+
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
253
|
+
var CANVAS_CONTEXTUAL_EDITING_PARAM = "$contextualEditing";
|
|
254
|
+
var SECRET_QUERY_STRING_PARAM = "secret";
|
|
255
|
+
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
256
|
+
var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
|
|
257
|
+
var IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM = "is_incontext_editing_forced_settings";
|
|
258
|
+
var IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM = "is_config_check";
|
|
259
|
+
var IN_CONTEXT_EDITOR_COMPONENT_START_ROLE = "uniform-component-start";
|
|
260
|
+
var IN_CONTEXT_EDITOR_COMPONENT_END_ROLE = "uniform-component-end";
|
|
261
|
+
var IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID = "uniform-canvas-preview-script";
|
|
262
|
+
var IS_RENDERED_BY_UNIFORM_ATTRIBUTE = "data-is-rendered-by-uniform";
|
|
263
|
+
var PLACEHOLDER_ID = "placeholder";
|
|
264
|
+
var EMPTY_COMPOSITION = {
|
|
265
|
+
_id: "_empty_composition_id",
|
|
266
|
+
_name: "An empty composition used for contextual editing",
|
|
267
|
+
type: "_empty_composition_type"
|
|
268
|
+
};
|
|
269
|
+
var EDGE_MIN_CACHE_TTL = 10;
|
|
270
|
+
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
271
|
+
var EDGE_DEFAULT_CACHE_TTL = 30;
|
|
272
|
+
var EDGE_CACHE_DISABLED = -1;
|
|
273
|
+
var ASSET_PARAMETER_TYPE = "asset";
|
|
274
|
+
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
|
275
|
+
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
|
276
|
+
var REFERENCE_DATA_TYPE_ID = "uniformContentInternalReference";
|
|
277
|
+
|
|
278
|
+
// src/clients/compositionHelpers.ts
|
|
279
|
+
function resolveCompositionSelector(args) {
|
|
280
|
+
if ("compositionId" in args) {
|
|
281
|
+
const { compositionId, editionId, versionId, ...readOptions } = args;
|
|
282
|
+
return {
|
|
283
|
+
readOptions,
|
|
284
|
+
// raw mode matches on composition OR edition id via the compositionId param
|
|
285
|
+
compositionId: editionId != null ? editionId : compositionId,
|
|
286
|
+
versionId,
|
|
287
|
+
hasCompositionId: true,
|
|
288
|
+
pinnedEdition: editionId !== void 0
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
return { readOptions: args, hasCompositionId: false, pinnedEdition: false };
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// src/clients/DeliveryClientBase.ts
|
|
295
|
+
var DEFAULT_EDGE_API_HOST = "https://uniform.global";
|
|
296
|
+
var DeliveryClientBase = class extends ContentClientBase {
|
|
297
|
+
constructor(options) {
|
|
298
|
+
var _a;
|
|
299
|
+
super(
|
|
300
|
+
options,
|
|
301
|
+
/* defaultBypassCache */
|
|
302
|
+
false
|
|
303
|
+
);
|
|
304
|
+
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : DEFAULT_EDGE_API_HOST;
|
|
305
|
+
this.edgeRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
|
|
306
|
+
}
|
|
307
|
+
/** Coerces the `diagnostics` option into the shape the edge endpoints accept. */
|
|
308
|
+
coerceDiagnostics(diagnostics) {
|
|
309
|
+
return typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0;
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
// src/clients/CompositionDeliveryClient.ts
|
|
314
|
+
var EDGE_SINGLE_URL = "/api/v1/composition";
|
|
315
|
+
var EDGE_LIST_URL = "/api/v1/compositions";
|
|
316
|
+
var CompositionDeliveryClient = class extends DeliveryClientBase {
|
|
317
|
+
constructor(options) {
|
|
318
|
+
super(options);
|
|
319
|
+
}
|
|
320
|
+
/** Fetches exactly one composition (throws `ApiClientError(404)` if absent). */
|
|
321
|
+
get(args) {
|
|
322
|
+
var _a;
|
|
323
|
+
const { diagnostics, select, ...rest } = args;
|
|
324
|
+
const { readOptions, compositionId, versionId, pinnedEdition } = resolveCompositionSelector(rest);
|
|
325
|
+
const url = this.createUrl(
|
|
326
|
+
EDGE_SINGLE_URL,
|
|
327
|
+
{
|
|
328
|
+
...readOptions,
|
|
329
|
+
...projectionToQuery(select),
|
|
330
|
+
// A pinned edition is folded into compositionId (raw matches edition or
|
|
331
|
+
// composition id); there is no editionId query param on this endpoint.
|
|
332
|
+
compositionId,
|
|
333
|
+
versionId,
|
|
334
|
+
projectId: this.options.projectId,
|
|
335
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
336
|
+
// editionId pins a specific edition for preview; otherwise locale-best.
|
|
337
|
+
editions: pinnedEdition ? "raw" : "auto",
|
|
338
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
339
|
+
},
|
|
340
|
+
this.edgeApiHost
|
|
341
|
+
);
|
|
342
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
343
|
+
}
|
|
344
|
+
/** Fetches a list of compositions, optionally filtered. */
|
|
345
|
+
list(args = {}) {
|
|
346
|
+
var _a;
|
|
347
|
+
const { diagnostics, filters, select, ...rest } = args;
|
|
348
|
+
const url = this.createUrl(
|
|
349
|
+
EDGE_LIST_URL,
|
|
350
|
+
{
|
|
351
|
+
...rest,
|
|
352
|
+
...rewriteFiltersForApi(filters),
|
|
353
|
+
...projectionToQuery(select),
|
|
354
|
+
projectId: this.options.projectId,
|
|
355
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
356
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
357
|
+
},
|
|
358
|
+
this.edgeApiHost
|
|
359
|
+
);
|
|
360
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
// src/clients/CompositionManagementClient.ts
|
|
365
|
+
import { rewriteFiltersForApi as rewriteFiltersForApi2 } from "@uniformdev/context/api";
|
|
366
|
+
|
|
367
|
+
// src/clients/resolveManagementEditions.ts
|
|
368
|
+
function resolveManagementEditions({
|
|
369
|
+
explicit,
|
|
370
|
+
pinnedEdition,
|
|
371
|
+
hasId,
|
|
372
|
+
hasLocale
|
|
373
|
+
}) {
|
|
374
|
+
if (explicit) {
|
|
375
|
+
return explicit;
|
|
376
|
+
}
|
|
377
|
+
if (pinnedEdition) {
|
|
378
|
+
return "raw";
|
|
379
|
+
}
|
|
380
|
+
if (!hasId) {
|
|
381
|
+
return void 0;
|
|
382
|
+
}
|
|
383
|
+
return hasLocale ? "auto" : "raw";
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// src/clients/CompositionManagementClient.ts
|
|
101
387
|
var CANVAS_URL = "/api/v1/canvas";
|
|
102
|
-
var
|
|
388
|
+
var CANVAS_HISTORY_URL = "/api/v1/canvas-history";
|
|
389
|
+
var CompositionManagementClient = class extends ContentClientBase {
|
|
390
|
+
constructor(options) {
|
|
391
|
+
super(
|
|
392
|
+
options,
|
|
393
|
+
/* defaultBypassCache */
|
|
394
|
+
true
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Fetches one composition in canonical shape (throws `ApiClientError(404)` if
|
|
399
|
+
* absent).
|
|
400
|
+
*/
|
|
401
|
+
get(args) {
|
|
402
|
+
var _a;
|
|
403
|
+
const { select, ...selectorArgs } = args;
|
|
404
|
+
const { readOptions, compositionId, versionId, hasCompositionId, pinnedEdition } = resolveCompositionSelector(selectorArgs);
|
|
405
|
+
const url = this.createUrl(CANVAS_URL, {
|
|
406
|
+
format: CANONICAL_FORMAT,
|
|
407
|
+
// Caller-supplied shaping flags and non-id selector keys ride along and
|
|
408
|
+
// override the format alias server-side.
|
|
409
|
+
...readOptions,
|
|
410
|
+
...projectionToQuery(select),
|
|
411
|
+
// A pinned edition is folded into compositionId; there is no editionId
|
|
412
|
+
// query param on this endpoint.
|
|
413
|
+
compositionId,
|
|
414
|
+
versionId,
|
|
415
|
+
projectId: this.options.projectId,
|
|
416
|
+
state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE,
|
|
417
|
+
editions: resolveManagementEditions({
|
|
418
|
+
explicit: readOptions.editions,
|
|
419
|
+
pinnedEdition,
|
|
420
|
+
hasId: hasCompositionId,
|
|
421
|
+
hasLocale: readOptions.locale != null
|
|
422
|
+
})
|
|
423
|
+
});
|
|
424
|
+
return this.apiClient(url);
|
|
425
|
+
}
|
|
426
|
+
/** Fetches a list of compositions in canonical shape. */
|
|
427
|
+
list(args = {}) {
|
|
428
|
+
var _a;
|
|
429
|
+
const { filters, select, ...rest } = args;
|
|
430
|
+
const url = this.createUrl(CANVAS_URL, {
|
|
431
|
+
format: CANONICAL_FORMAT,
|
|
432
|
+
...rest,
|
|
433
|
+
...rewriteFiltersForApi2(filters),
|
|
434
|
+
...projectionToQuery(select),
|
|
435
|
+
projectId: this.options.projectId,
|
|
436
|
+
state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE
|
|
437
|
+
});
|
|
438
|
+
return this.apiClient(url);
|
|
439
|
+
}
|
|
440
|
+
/** Creates or updates a composition. Returns the new `x-modified-at` timestamp. */
|
|
441
|
+
async save(body, opts) {
|
|
442
|
+
const url = this.createUrl(CANVAS_URL);
|
|
443
|
+
const headers = {};
|
|
444
|
+
if (opts == null ? void 0 : opts.ifUnmodifiedSince) {
|
|
445
|
+
headers["x-if-unmodified-since"] = opts.ifUnmodifiedSince;
|
|
446
|
+
}
|
|
447
|
+
const { response } = await this.apiClientWithResponse(url, {
|
|
448
|
+
method: "PUT",
|
|
449
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
450
|
+
expectNoContent: true,
|
|
451
|
+
headers
|
|
452
|
+
});
|
|
453
|
+
return { modified: response.headers.get("x-modified-at") };
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Saves the draft and publishes in one call (two PUTs). The optimistic
|
|
457
|
+
* concurrency guard, if any, applies to the draft write.
|
|
458
|
+
*/
|
|
459
|
+
async saveAndPublish(body, opts) {
|
|
460
|
+
await this.save({ ...body, state: CANVAS_DRAFT_STATE }, opts);
|
|
461
|
+
return this.save({ ...body, state: CANVAS_PUBLISHED_STATE });
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Removes only the published state, leaving the draft intact. Scoped to a
|
|
465
|
+
* single edition when `editionId` is supplied; otherwise unpublishes all editions.
|
|
466
|
+
* To unpublish only the base edition, pass editionId and compositionId as the same value.
|
|
467
|
+
*/
|
|
468
|
+
async unpublish(selector) {
|
|
469
|
+
await this.deleteComposition({ ...selector, state: CANVAS_PUBLISHED_STATE });
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Deletes across all states. Scoped to a single edition when `editionId` is
|
|
473
|
+
* supplied; otherwise deletes all states and editions.
|
|
474
|
+
* Use `unpublish` to drop only the published state.
|
|
475
|
+
*/
|
|
476
|
+
async remove(selector) {
|
|
477
|
+
await this.deleteComposition(selector);
|
|
478
|
+
}
|
|
479
|
+
/** Fetches historical versions of a composition or pattern. */
|
|
480
|
+
history(args) {
|
|
481
|
+
const url = this.createUrl(CANVAS_HISTORY_URL, { ...args, projectId: this.options.projectId });
|
|
482
|
+
return this.apiClient(url);
|
|
483
|
+
}
|
|
484
|
+
async deleteComposition(body) {
|
|
485
|
+
const url = this.createUrl(CANVAS_URL);
|
|
486
|
+
await this.apiClient(url, {
|
|
487
|
+
method: "DELETE",
|
|
488
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
489
|
+
expectNoContent: true
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
// src/clients/ContentTypeClient.ts
|
|
495
|
+
import { ApiClientError as ApiClientError3 } from "@uniformdev/context/api";
|
|
496
|
+
var CONTENT_TYPES_URL = "/api/v1/content-types";
|
|
497
|
+
var ContentTypeClient = class extends ContentClientBase {
|
|
498
|
+
constructor(options) {
|
|
499
|
+
super(
|
|
500
|
+
options,
|
|
501
|
+
/* defaultBypassCache */
|
|
502
|
+
true
|
|
503
|
+
);
|
|
504
|
+
}
|
|
505
|
+
/** Fetches one content type by id (throws `ApiClientError(404)` if absent). */
|
|
506
|
+
async get(args) {
|
|
507
|
+
var _a;
|
|
508
|
+
const url = this.createUrl(CONTENT_TYPES_URL, {
|
|
509
|
+
contentTypeIDs: [args.contentTypeId],
|
|
510
|
+
limit: 1,
|
|
511
|
+
projectId: this.options.projectId
|
|
512
|
+
});
|
|
513
|
+
const res = await this.apiClient(url);
|
|
514
|
+
const contentType = (_a = res.contentTypes) == null ? void 0 : _a[0];
|
|
515
|
+
if (!contentType) {
|
|
516
|
+
throw new ApiClientError3("Content type not found", "GET", url.toString(), 404, "Not Found");
|
|
517
|
+
}
|
|
518
|
+
return contentType;
|
|
519
|
+
}
|
|
520
|
+
/** Fetches a list of content types. */
|
|
521
|
+
list(args) {
|
|
522
|
+
const url = this.createUrl(CONTENT_TYPES_URL, { ...args, projectId: this.options.projectId });
|
|
523
|
+
return this.apiClient(url);
|
|
524
|
+
}
|
|
525
|
+
/** Creates or updates a content type. */
|
|
526
|
+
async save(body, opts = {}) {
|
|
527
|
+
const url = this.createUrl(CONTENT_TYPES_URL);
|
|
528
|
+
let contentType = body.contentType;
|
|
529
|
+
if (typeof contentType.slugSettings === "object" && contentType.slugSettings !== null && Object.keys(contentType.slugSettings).length === 0) {
|
|
530
|
+
const { slugSettings: _omitEmptySlugSettings, ...rest } = contentType;
|
|
531
|
+
contentType = rest;
|
|
532
|
+
}
|
|
533
|
+
await this.apiClient(url, {
|
|
534
|
+
method: "PUT",
|
|
535
|
+
body: JSON.stringify({ ...body, contentType, projectId: this.options.projectId }),
|
|
536
|
+
expectNoContent: true,
|
|
537
|
+
headers: opts.autogenerateDataTypes ? { "x-uniform-autogenerate-data-types": "true" } : {}
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
/** Deletes a content type. */
|
|
541
|
+
async remove(args) {
|
|
542
|
+
const url = this.createUrl(CONTENT_TYPES_URL);
|
|
543
|
+
await this.apiClient(url, {
|
|
544
|
+
method: "DELETE",
|
|
545
|
+
body: JSON.stringify({ ...args, projectId: this.options.projectId }),
|
|
546
|
+
expectNoContent: true
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
// src/clients/EntryDeliveryClient.ts
|
|
552
|
+
import { rewriteFiltersForApi as rewriteFiltersForApi3 } from "@uniformdev/context/api";
|
|
553
|
+
|
|
554
|
+
// src/clients/entryHelpers.ts
|
|
555
|
+
import { ApiClientError as ApiClientError4 } from "@uniformdev/context/api";
|
|
556
|
+
function resolveEntrySelector(args) {
|
|
557
|
+
if ("entryId" in args) {
|
|
558
|
+
const { entryId, editionId, versionId, ...readOptions2 } = args;
|
|
559
|
+
return {
|
|
560
|
+
readOptions: readOptions2,
|
|
561
|
+
entryIDs: [editionId != null ? editionId : entryId],
|
|
562
|
+
versionId,
|
|
563
|
+
pinnedEdition: editionId !== void 0
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
const { slug, ...readOptions } = args;
|
|
567
|
+
return { readOptions, slug, pinnedEdition: false };
|
|
568
|
+
}
|
|
569
|
+
function unwrapSingleEntry(res, url) {
|
|
570
|
+
var _a;
|
|
571
|
+
const entry = (_a = res.entries) == null ? void 0 : _a[0];
|
|
572
|
+
if (!entry) {
|
|
573
|
+
throw new ApiClientError4("Entry not found", "GET", url.toString(), 404, "Not Found");
|
|
574
|
+
}
|
|
575
|
+
return entry;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
// src/clients/EntryDeliveryClient.ts
|
|
579
|
+
var ENTRIES_URL = "/api/v1/entries";
|
|
580
|
+
var EntryDeliveryClient = class extends DeliveryClientBase {
|
|
581
|
+
constructor(options) {
|
|
582
|
+
super(options);
|
|
583
|
+
}
|
|
584
|
+
/** Fetches exactly one entry by id or slug (throws `ApiClientError(404)` if absent). */
|
|
585
|
+
async get(args) {
|
|
586
|
+
var _a, _b;
|
|
587
|
+
const { diagnostics, select, ...rest } = args;
|
|
588
|
+
const { entryIDs, slug, versionId, pinnedEdition, readOptions } = resolveEntrySelector(rest);
|
|
589
|
+
const url = this.createUrl(
|
|
590
|
+
ENTRIES_URL,
|
|
591
|
+
{
|
|
592
|
+
...readOptions,
|
|
593
|
+
...projectionToQuery(select),
|
|
594
|
+
projectId: this.options.projectId,
|
|
595
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
596
|
+
entryIDs,
|
|
597
|
+
slug,
|
|
598
|
+
versionId,
|
|
599
|
+
// A pinned edition is fetched exactly; otherwise locale-best.
|
|
600
|
+
editions: pinnedEdition ? "raw" : "auto",
|
|
601
|
+
// An id lookup wants that exact entity regardless of type, so default the
|
|
602
|
+
// pattern filter to 'any' (origin default `false` would 404 a pattern id).
|
|
603
|
+
// Scoped to id lookups; slug reads keep the origin default. Explicit
|
|
604
|
+
// `pattern` overrides via the `...readOptions` spread above.
|
|
605
|
+
pattern: (_b = args.pattern) != null ? _b : entryIDs ? "any" : void 0,
|
|
606
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
607
|
+
},
|
|
608
|
+
this.edgeApiHost
|
|
609
|
+
);
|
|
610
|
+
const res = await this.apiClient(url, this.edgeRequestInit);
|
|
611
|
+
return unwrapSingleEntry(res, url);
|
|
612
|
+
}
|
|
613
|
+
/** Fetches a list of entries, optionally filtered. */
|
|
614
|
+
list(args = {}) {
|
|
615
|
+
var _a;
|
|
616
|
+
const { diagnostics, filters, select, ...rest } = args;
|
|
617
|
+
const url = this.createUrl(
|
|
618
|
+
ENTRIES_URL,
|
|
619
|
+
{
|
|
620
|
+
...rest,
|
|
621
|
+
...rewriteFiltersForApi3(filters),
|
|
622
|
+
...projectionToQuery(select),
|
|
623
|
+
projectId: this.options.projectId,
|
|
624
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
625
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
626
|
+
},
|
|
627
|
+
this.edgeApiHost
|
|
628
|
+
);
|
|
629
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
// src/clients/EntryManagementClient.ts
|
|
634
|
+
import { rewriteFiltersForApi as rewriteFiltersForApi4 } from "@uniformdev/context/api";
|
|
635
|
+
var ENTRIES_URL2 = "/api/v1/entries";
|
|
636
|
+
var ENTRIES_HISTORY_URL = "/api/v1/entries-history";
|
|
637
|
+
var EntryManagementClient = class extends ContentClientBase {
|
|
638
|
+
constructor(options) {
|
|
639
|
+
super(
|
|
640
|
+
options,
|
|
641
|
+
/* defaultBypassCache */
|
|
642
|
+
true
|
|
643
|
+
);
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Fetches one entry by id or slug in canonical shape (throws
|
|
647
|
+
* `ApiClientError(404)` if absent).
|
|
648
|
+
*/
|
|
649
|
+
async get(args) {
|
|
650
|
+
var _a, _b;
|
|
651
|
+
const { select, ...selectorArgs } = args;
|
|
652
|
+
const { entryIDs, slug, versionId, readOptions, pinnedEdition } = resolveEntrySelector(selectorArgs);
|
|
653
|
+
const url = this.createUrl(ENTRIES_URL2, {
|
|
654
|
+
format: CANONICAL_FORMAT,
|
|
655
|
+
...readOptions,
|
|
656
|
+
...projectionToQuery(select),
|
|
657
|
+
projectId: this.options.projectId,
|
|
658
|
+
state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE,
|
|
659
|
+
editions: resolveManagementEditions({
|
|
660
|
+
explicit: readOptions.editions,
|
|
661
|
+
pinnedEdition,
|
|
662
|
+
hasId: entryIDs != null,
|
|
663
|
+
hasLocale: readOptions.locale != null
|
|
664
|
+
}),
|
|
665
|
+
// An id lookup wants that exact entity regardless of type, so default the
|
|
666
|
+
// pattern filter to 'any' (origin default `false` would 404 a pattern id).
|
|
667
|
+
// Scoped to id lookups; slug reads keep the origin default. Explicit
|
|
668
|
+
// `pattern` overrides via the `...readOptions` spread above.
|
|
669
|
+
pattern: (_b = args.pattern) != null ? _b : entryIDs ? "any" : void 0,
|
|
670
|
+
entryIDs,
|
|
671
|
+
slug,
|
|
672
|
+
versionId
|
|
673
|
+
});
|
|
674
|
+
const res = await this.apiClient(url);
|
|
675
|
+
return unwrapSingleEntry(res, url);
|
|
676
|
+
}
|
|
677
|
+
/** Fetches a list of entries in canonical shape. */
|
|
678
|
+
list(args = {}) {
|
|
679
|
+
var _a;
|
|
680
|
+
const { filters, select, ...rest } = args;
|
|
681
|
+
const url = this.createUrl(ENTRIES_URL2, {
|
|
682
|
+
format: CANONICAL_FORMAT,
|
|
683
|
+
...rest,
|
|
684
|
+
...rewriteFiltersForApi4(filters),
|
|
685
|
+
...projectionToQuery(select),
|
|
686
|
+
projectId: this.options.projectId,
|
|
687
|
+
state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE
|
|
688
|
+
});
|
|
689
|
+
return this.apiClient(url);
|
|
690
|
+
}
|
|
691
|
+
/** Creates or updates an entry. Returns the new `x-modified-at` timestamp. */
|
|
692
|
+
async save(body, opts) {
|
|
693
|
+
const url = this.createUrl(ENTRIES_URL2);
|
|
694
|
+
const headers = {};
|
|
695
|
+
if (opts == null ? void 0 : opts.ifUnmodifiedSince) {
|
|
696
|
+
headers["x-if-unmodified-since"] = opts.ifUnmodifiedSince;
|
|
697
|
+
}
|
|
698
|
+
const { response } = await this.apiClientWithResponse(url, {
|
|
699
|
+
method: "PUT",
|
|
700
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
701
|
+
expectNoContent: true,
|
|
702
|
+
headers
|
|
703
|
+
});
|
|
704
|
+
return { modified: response.headers.get("x-modified-at") };
|
|
705
|
+
}
|
|
706
|
+
/** Saves the draft and publishes in one call (two PUTs). */
|
|
707
|
+
async saveAndPublish(body, opts) {
|
|
708
|
+
await this.save({ ...body, state: CANVAS_DRAFT_STATE }, opts);
|
|
709
|
+
return this.save({ ...body, state: CANVAS_PUBLISHED_STATE });
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* Removes only the published state, leaving the draft intact. Scoped to a
|
|
713
|
+
* single edition when `editionId` is supplied; otherwise unpublishes all editions.
|
|
714
|
+
* To unpublish only the base edition, pass editionId and entryId as the same value.
|
|
715
|
+
*/
|
|
716
|
+
async unpublish(selector) {
|
|
717
|
+
await this.deleteEntry({ ...selector, state: CANVAS_PUBLISHED_STATE });
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* Deletes across all states. Scoped to a single edition when `editionId` is
|
|
721
|
+
* supplied; otherwise deletes all states and editions.
|
|
722
|
+
* Use `unpublish` to drop only the published state.
|
|
723
|
+
*/
|
|
724
|
+
async remove(selector) {
|
|
725
|
+
await this.deleteEntry(selector);
|
|
726
|
+
}
|
|
727
|
+
/** Fetches historical versions of an entry. */
|
|
728
|
+
history(args) {
|
|
729
|
+
const url = this.createUrl(ENTRIES_HISTORY_URL, { ...args, projectId: this.options.projectId });
|
|
730
|
+
return this.apiClient(url);
|
|
731
|
+
}
|
|
732
|
+
async deleteEntry(body) {
|
|
733
|
+
const url = this.createUrl(ENTRIES_URL2);
|
|
734
|
+
await this.apiClient(url, {
|
|
735
|
+
method: "DELETE",
|
|
736
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
737
|
+
expectNoContent: true
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
};
|
|
741
|
+
|
|
742
|
+
// src/clients/deprecated/CanvasClient.ts
|
|
743
|
+
import { ApiClient as ApiClient3, rewriteFiltersForApi as rewriteFiltersForApi5 } from "@uniformdev/context/api";
|
|
744
|
+
var CANVAS_URL2 = "/api/v1/canvas";
|
|
745
|
+
var CanvasClient = class extends ApiClient3 {
|
|
103
746
|
constructor(options) {
|
|
104
747
|
var _a;
|
|
105
748
|
if (!options.limitPolicy) {
|
|
@@ -113,10 +756,10 @@ var CanvasClient = class extends ApiClient {
|
|
|
113
756
|
async getCompositionList(params = {}) {
|
|
114
757
|
const { projectId } = this.options;
|
|
115
758
|
const { resolveData, filters, select, ...originParams } = params;
|
|
116
|
-
const rewrittenFilters =
|
|
759
|
+
const rewrittenFilters = rewriteFiltersForApi5(filters);
|
|
117
760
|
const rewrittenSelect = projectionToQuery(select);
|
|
118
761
|
if (!resolveData) {
|
|
119
|
-
const fetchUri = this.createUrl(
|
|
762
|
+
const fetchUri = this.createUrl(CANVAS_URL2, {
|
|
120
763
|
...originParams,
|
|
121
764
|
projectId,
|
|
122
765
|
...rewrittenFilters,
|
|
@@ -164,7 +807,7 @@ var CanvasClient = class extends ApiClient {
|
|
|
164
807
|
}) {
|
|
165
808
|
const { projectId } = this.options;
|
|
166
809
|
if (skipDataResolution) {
|
|
167
|
-
return this.apiClient(this.createUrl(
|
|
810
|
+
return this.apiClient(this.createUrl(CANVAS_URL2, { ...params, projectId }));
|
|
168
811
|
}
|
|
169
812
|
const edgeParams = {
|
|
170
813
|
...params,
|
|
@@ -176,7 +819,7 @@ var CanvasClient = class extends ApiClient {
|
|
|
176
819
|
}
|
|
177
820
|
/** Updates or creates a Canvas component definition */
|
|
178
821
|
async updateComposition(body, options) {
|
|
179
|
-
const fetchUri = this.createUrl(
|
|
822
|
+
const fetchUri = this.createUrl(CANVAS_URL2);
|
|
180
823
|
const headers = {};
|
|
181
824
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
182
825
|
headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
@@ -191,7 +834,7 @@ var CanvasClient = class extends ApiClient {
|
|
|
191
834
|
}
|
|
192
835
|
/** Deletes a Canvas component definition */
|
|
193
836
|
async removeComposition(body) {
|
|
194
|
-
const fetchUri = this.createUrl(
|
|
837
|
+
const fetchUri = this.createUrl(CANVAS_URL2);
|
|
195
838
|
const { projectId } = this.options;
|
|
196
839
|
await this.apiClient(fetchUri, {
|
|
197
840
|
method: "DELETE",
|
|
@@ -230,53 +873,10 @@ var UncachedCanvasClient = class extends CanvasClient {
|
|
|
230
873
|
}
|
|
231
874
|
};
|
|
232
875
|
|
|
233
|
-
// src/
|
|
234
|
-
import { ApiClient as
|
|
235
|
-
var CATEGORIES_URL = "/api/v1/categories";
|
|
236
|
-
var CategoryClient = class extends ApiClient2 {
|
|
237
|
-
constructor(options) {
|
|
238
|
-
if (!options.limitPolicy) {
|
|
239
|
-
options.limitPolicy = createLimitPolicy({});
|
|
240
|
-
}
|
|
241
|
-
super(options);
|
|
242
|
-
}
|
|
243
|
-
/** Fetches all categories created in given project */
|
|
244
|
-
async getCategories(options) {
|
|
245
|
-
const { projectId } = this.options;
|
|
246
|
-
const fetchUri = this.createUrl("/api/v1/categories", { ...options, projectId });
|
|
247
|
-
return await this.apiClient(fetchUri);
|
|
248
|
-
}
|
|
249
|
-
/** Updates or creates a category, also used to re-order them */
|
|
250
|
-
async upsertCategories(categories) {
|
|
251
|
-
const { projectId } = this.options;
|
|
252
|
-
const fetchUri = this.createUrl(CATEGORIES_URL);
|
|
253
|
-
return await this.apiClient(fetchUri, {
|
|
254
|
-
method: "PUT",
|
|
255
|
-
body: JSON.stringify({ categories, projectId }),
|
|
256
|
-
expectNoContent: true
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
/** Deletes a category */
|
|
260
|
-
async removeCategory(options) {
|
|
261
|
-
const { projectId } = this.options;
|
|
262
|
-
const fetchUri = this.createUrl(CATEGORIES_URL);
|
|
263
|
-
return await this.apiClient(fetchUri, {
|
|
264
|
-
method: "DELETE",
|
|
265
|
-
body: JSON.stringify({ projectId, categoryId: options.categoryId }),
|
|
266
|
-
expectNoContent: true
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
var UncachedCategoryClient = class extends CategoryClient {
|
|
271
|
-
constructor(options) {
|
|
272
|
-
super({ ...options, bypassCache: true });
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
// src/ContentClient.ts
|
|
277
|
-
import { ApiClient as ApiClient3, rewriteFiltersForApi as rewriteFiltersForApi2 } from "@uniformdev/context/api";
|
|
876
|
+
// src/clients/deprecated/ContentClient.ts
|
|
877
|
+
import { ApiClient as ApiClient4, rewriteFiltersForApi as rewriteFiltersForApi6 } from "@uniformdev/context/api";
|
|
278
878
|
var _contentTypesUrl, _entriesUrl;
|
|
279
|
-
var _ContentClient = class _ContentClient extends
|
|
879
|
+
var _ContentClient = class _ContentClient extends ApiClient4 {
|
|
280
880
|
constructor(options) {
|
|
281
881
|
var _a;
|
|
282
882
|
super(options);
|
|
@@ -290,7 +890,7 @@ var _ContentClient = class _ContentClient extends ApiClient3 {
|
|
|
290
890
|
getEntries(options) {
|
|
291
891
|
const { projectId } = this.options;
|
|
292
892
|
const { skipDataResolution, filters, select, ...params } = options;
|
|
293
|
-
const rewrittenFilters =
|
|
893
|
+
const rewrittenFilters = rewriteFiltersForApi6(filters);
|
|
294
894
|
const rewrittenSelect = projectionToQuery(select);
|
|
295
895
|
if (skipDataResolution) {
|
|
296
896
|
const url = this.createUrl(__privateGet(_ContentClient, _entriesUrl), {
|
|
@@ -383,27 +983,31 @@ var UncachedContentClient = class extends ContentClient {
|
|
|
383
983
|
};
|
|
384
984
|
|
|
385
985
|
// src/DataSourceClient.ts
|
|
386
|
-
import { ApiClient as
|
|
986
|
+
import { ApiClient as ApiClient5 } from "@uniformdev/context/api";
|
|
387
987
|
var dataSourceUrl = "/api/v1/data-source";
|
|
388
988
|
var dataSourcesUrl = "/api/v1/data-sources";
|
|
389
|
-
var DataSourceClient = class extends
|
|
989
|
+
var DataSourceClient = class extends ApiClient5 {
|
|
390
990
|
constructor(options) {
|
|
391
991
|
super(options);
|
|
392
992
|
}
|
|
393
|
-
/** Fetches
|
|
993
|
+
/** Fetches a single DataSource by id (with decrypted secrets). */
|
|
394
994
|
async get(options) {
|
|
395
995
|
const { projectId } = this.options;
|
|
396
996
|
const fetchUri = this.createUrl(dataSourceUrl, { ...options, projectId });
|
|
397
997
|
return await this.apiClient(fetchUri);
|
|
398
998
|
}
|
|
399
|
-
/** Fetches
|
|
400
|
-
async
|
|
999
|
+
/** Fetches the list of DataSources for a project (secrets masked). */
|
|
1000
|
+
async list(options) {
|
|
401
1001
|
const { projectId } = this.options;
|
|
402
1002
|
const fetchUri = this.createUrl(dataSourcesUrl, { ...options, projectId });
|
|
403
1003
|
return await this.apiClient(fetchUri);
|
|
404
1004
|
}
|
|
1005
|
+
/** @deprecated Use {@link list} instead. */
|
|
1006
|
+
async getList(options) {
|
|
1007
|
+
return this.list(options);
|
|
1008
|
+
}
|
|
405
1009
|
/** Updates or creates (based on id) a DataSource */
|
|
406
|
-
async
|
|
1010
|
+
async save(body) {
|
|
407
1011
|
const fetchUri = this.createUrl(dataSourceUrl);
|
|
408
1012
|
await this.apiClient(fetchUri, {
|
|
409
1013
|
method: "PUT",
|
|
@@ -411,6 +1015,10 @@ var DataSourceClient = class extends ApiClient4 {
|
|
|
411
1015
|
expectNoContent: true
|
|
412
1016
|
});
|
|
413
1017
|
}
|
|
1018
|
+
/** @deprecated Use {@link save} instead. */
|
|
1019
|
+
async upsert(body) {
|
|
1020
|
+
return this.save(body);
|
|
1021
|
+
}
|
|
414
1022
|
/** Deletes a DataSource */
|
|
415
1023
|
async remove(body) {
|
|
416
1024
|
const fetchUri = this.createUrl(dataSourceUrl);
|
|
@@ -423,20 +1031,24 @@ var DataSourceClient = class extends ApiClient4 {
|
|
|
423
1031
|
};
|
|
424
1032
|
|
|
425
1033
|
// src/DataTypeClient.ts
|
|
426
|
-
import { ApiClient as
|
|
1034
|
+
import { ApiClient as ApiClient6 } from "@uniformdev/context/api";
|
|
427
1035
|
var _url;
|
|
428
|
-
var _DataTypeClient = class _DataTypeClient extends
|
|
1036
|
+
var _DataTypeClient = class _DataTypeClient extends ApiClient6 {
|
|
429
1037
|
constructor(options) {
|
|
430
1038
|
super(options);
|
|
431
1039
|
}
|
|
432
|
-
/** Fetches
|
|
433
|
-
async
|
|
1040
|
+
/** Fetches a list of DataTypes for a project */
|
|
1041
|
+
async list(options) {
|
|
434
1042
|
const { projectId } = this.options;
|
|
435
1043
|
const fetchUri = this.createUrl(__privateGet(_DataTypeClient, _url), { ...options, projectId });
|
|
436
1044
|
return await this.apiClient(fetchUri);
|
|
437
1045
|
}
|
|
1046
|
+
/** @deprecated Use {@link list} instead. */
|
|
1047
|
+
async get(options) {
|
|
1048
|
+
return this.list(options);
|
|
1049
|
+
}
|
|
438
1050
|
/** Updates or creates (based on id) a DataType */
|
|
439
|
-
async
|
|
1051
|
+
async save(body) {
|
|
440
1052
|
const fetchUri = this.createUrl(__privateGet(_DataTypeClient, _url));
|
|
441
1053
|
await this.apiClient(fetchUri, {
|
|
442
1054
|
method: "PUT",
|
|
@@ -444,6 +1056,10 @@ var _DataTypeClient = class _DataTypeClient extends ApiClient5 {
|
|
|
444
1056
|
expectNoContent: true
|
|
445
1057
|
});
|
|
446
1058
|
}
|
|
1059
|
+
/** @deprecated Use {@link save} instead. */
|
|
1060
|
+
async upsert(body) {
|
|
1061
|
+
return this.save(body);
|
|
1062
|
+
}
|
|
447
1063
|
/** Deletes a DataType */
|
|
448
1064
|
async remove(body) {
|
|
449
1065
|
const fetchUri = this.createUrl(__privateGet(_DataTypeClient, _url));
|
|
@@ -579,61 +1195,6 @@ function getComponentPath(ancestorsAndSelf) {
|
|
|
579
1195
|
return `.${path.join(".")}`;
|
|
580
1196
|
}
|
|
581
1197
|
|
|
582
|
-
// src/utils/constants.ts
|
|
583
|
-
var CANVAS_PERSONALIZE_TYPE = "$personalization";
|
|
584
|
-
var CANVAS_TEST_TYPE = "$test";
|
|
585
|
-
var CANVAS_LOCALIZATION_TYPE = "$localization";
|
|
586
|
-
var CANVAS_SLOT_SECTION_TYPE = "$slotSection";
|
|
587
|
-
var CANVAS_INTENT_TAG_PARAM = "intentTag";
|
|
588
|
-
var CANVAS_LOCALE_TAG_PARAM = "locale";
|
|
589
|
-
var CANVAS_BLOCK_PARAM_TYPE = "$block";
|
|
590
|
-
var CANVAS_PERSONALIZE_SLOT = "pz";
|
|
591
|
-
var CANVAS_TEST_SLOT = "test";
|
|
592
|
-
var CANVAS_LOCALIZATION_SLOT = "localized";
|
|
593
|
-
var CANVAS_SLOT_SECTION_SLOT = "$slotSectionItems";
|
|
594
|
-
var CANVAS_SLOT_SECTION_NAME_PARAM = "name";
|
|
595
|
-
var CANVAS_SLOT_SECTION_MIN_PARAM = "min";
|
|
596
|
-
var CANVAS_SLOT_SECTION_MAX_PARAM = "max";
|
|
597
|
-
var CANVAS_SLOT_SECTION_GROUP_TYPE_PARAM = "groupType";
|
|
598
|
-
var CANVAS_SLOT_SECTION_SPECIFIC_PARAM = "specific";
|
|
599
|
-
var CANVAS_DRAFT_STATE = 0;
|
|
600
|
-
var CANVAS_PUBLISHED_STATE = 64;
|
|
601
|
-
var CANVAS_EDITOR_STATE = 63;
|
|
602
|
-
var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
|
|
603
|
-
var CANVAS_PERSONALIZATION_EVENT_NAME_PARAM = "trackingEventName";
|
|
604
|
-
var CANVAS_PERSONALIZATION_ALGORITHM_PARAM = "algorithm";
|
|
605
|
-
var CANVAS_PERSONALIZATION_ALGORITHM_TYPE = "pzAlgorithm";
|
|
606
|
-
var CANVAS_PERSONALIZATION_TAKE_PARAM = "count";
|
|
607
|
-
var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
|
|
608
|
-
var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
|
|
609
|
-
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
610
|
-
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
611
|
-
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
612
|
-
var CANVAS_CONTEXTUAL_EDITING_PARAM = "$contextualEditing";
|
|
613
|
-
var SECRET_QUERY_STRING_PARAM = "secret";
|
|
614
|
-
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
615
|
-
var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
|
|
616
|
-
var IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM = "is_incontext_editing_forced_settings";
|
|
617
|
-
var IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM = "is_config_check";
|
|
618
|
-
var IN_CONTEXT_EDITOR_COMPONENT_START_ROLE = "uniform-component-start";
|
|
619
|
-
var IN_CONTEXT_EDITOR_COMPONENT_END_ROLE = "uniform-component-end";
|
|
620
|
-
var IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID = "uniform-canvas-preview-script";
|
|
621
|
-
var IS_RENDERED_BY_UNIFORM_ATTRIBUTE = "data-is-rendered-by-uniform";
|
|
622
|
-
var PLACEHOLDER_ID = "placeholder";
|
|
623
|
-
var EMPTY_COMPOSITION = {
|
|
624
|
-
_id: "_empty_composition_id",
|
|
625
|
-
_name: "An empty composition used for contextual editing",
|
|
626
|
-
type: "_empty_composition_type"
|
|
627
|
-
};
|
|
628
|
-
var EDGE_MIN_CACHE_TTL = 10;
|
|
629
|
-
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
630
|
-
var EDGE_DEFAULT_CACHE_TTL = 30;
|
|
631
|
-
var EDGE_CACHE_DISABLED = -1;
|
|
632
|
-
var ASSET_PARAMETER_TYPE = "asset";
|
|
633
|
-
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
|
634
|
-
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
|
635
|
-
var REFERENCE_DATA_TYPE_ID = "uniformContentInternalReference";
|
|
636
|
-
|
|
637
1198
|
// src/utils/guards.ts
|
|
638
1199
|
function isRootEntryReference(root) {
|
|
639
1200
|
return root.type === "root" && isEntryData(root.node);
|
|
@@ -711,9 +1272,9 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
711
1272
|
let bufferStartIndex = 0;
|
|
712
1273
|
let bufferEndIndex = 0;
|
|
713
1274
|
let tokenCount = 0;
|
|
714
|
-
const handleToken = (token, type) => {
|
|
1275
|
+
const handleToken = (token, type, offset) => {
|
|
715
1276
|
tokenCount++;
|
|
716
|
-
return onToken == null ? void 0 : onToken(token, type);
|
|
1277
|
+
return onToken == null ? void 0 : onToken(token, type, offset);
|
|
717
1278
|
};
|
|
718
1279
|
let state = "text";
|
|
719
1280
|
for (let index = 0; index < serialized.length; index++) {
|
|
@@ -724,7 +1285,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
724
1285
|
if (char === variablePrefix[0] && serialized[index + 1] === variablePrefix[1]) {
|
|
725
1286
|
if (serialized[index - 1] === escapeCharacter) {
|
|
726
1287
|
bufferEndIndex -= escapeCharacter.length;
|
|
727
|
-
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
|
1288
|
+
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text", bufferStartIndex) === false) {
|
|
728
1289
|
return tokenCount;
|
|
729
1290
|
}
|
|
730
1291
|
bufferStartIndex = index;
|
|
@@ -733,12 +1294,12 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
733
1294
|
}
|
|
734
1295
|
if (state === "variable") {
|
|
735
1296
|
const textStart = bufferStartIndex - variablePrefix.length;
|
|
736
|
-
if (handleToken(serialized.substring(textStart, bufferEndIndex), "text") === false) {
|
|
1297
|
+
if (handleToken(serialized.substring(textStart, bufferEndIndex), "text", textStart) === false) {
|
|
737
1298
|
return tokenCount;
|
|
738
1299
|
}
|
|
739
1300
|
bufferStartIndex = bufferEndIndex;
|
|
740
1301
|
} else if (bufferEndIndex > bufferStartIndex) {
|
|
741
|
-
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
|
1302
|
+
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text", bufferStartIndex) === false) {
|
|
742
1303
|
return tokenCount;
|
|
743
1304
|
}
|
|
744
1305
|
bufferStartIndex = bufferEndIndex;
|
|
@@ -756,7 +1317,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
756
1317
|
state = "text";
|
|
757
1318
|
if (bufferEndIndex > bufferStartIndex) {
|
|
758
1319
|
const unescapedVariableName = serialized.substring(bufferStartIndex, bufferEndIndex).replace(/\\([${}])/g, "$1");
|
|
759
|
-
if (handleToken(unescapedVariableName, "variable") === false) {
|
|
1320
|
+
if (handleToken(unescapedVariableName, "variable", bufferStartIndex) === false) {
|
|
760
1321
|
return tokenCount;
|
|
761
1322
|
}
|
|
762
1323
|
bufferStartIndex = bufferEndIndex + variableSuffix.length;
|
|
@@ -770,7 +1331,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
770
1331
|
bufferStartIndex -= variablePrefix.length;
|
|
771
1332
|
}
|
|
772
1333
|
if (bufferStartIndex < serialized.length) {
|
|
773
|
-
handleToken(serialized.substring(bufferStartIndex), state);
|
|
1334
|
+
handleToken(serialized.substring(bufferStartIndex), state, bufferStartIndex);
|
|
774
1335
|
}
|
|
775
1336
|
return tokenCount;
|
|
776
1337
|
}
|
|
@@ -2087,24 +2648,28 @@ function walkPropertyValues(property, visitor) {
|
|
|
2087
2648
|
}
|
|
2088
2649
|
|
|
2089
2650
|
// src/EntityReleasesClient.ts
|
|
2090
|
-
import { ApiClient as
|
|
2091
|
-
var
|
|
2092
|
-
var EntityReleasesClient = class extends
|
|
2651
|
+
import { ApiClient as ApiClient7 } from "@uniformdev/context/api";
|
|
2652
|
+
var entityReleasesUrl = "/api/v1/entity-releases";
|
|
2653
|
+
var EntityReleasesClient = class extends ApiClient7 {
|
|
2093
2654
|
constructor(options) {
|
|
2094
2655
|
super(options);
|
|
2095
2656
|
}
|
|
2096
2657
|
/** Fetches entity across all releases (and base) */
|
|
2097
|
-
async
|
|
2658
|
+
async list(options) {
|
|
2098
2659
|
const { projectId } = this.options;
|
|
2099
|
-
const fetchUri = this.createUrl(
|
|
2660
|
+
const fetchUri = this.createUrl(entityReleasesUrl, { ...options, projectId });
|
|
2100
2661
|
return await this.apiClient(fetchUri);
|
|
2101
2662
|
}
|
|
2663
|
+
/** @deprecated Use {@link list} instead. */
|
|
2664
|
+
async get(options) {
|
|
2665
|
+
return this.list(options);
|
|
2666
|
+
}
|
|
2102
2667
|
};
|
|
2103
2668
|
|
|
2104
2669
|
// src/IntegrationPropertyEditorsClient.ts
|
|
2105
|
-
import { ApiClient as
|
|
2670
|
+
import { ApiClient as ApiClient8 } from "@uniformdev/context/api";
|
|
2106
2671
|
var _baseUrl;
|
|
2107
|
-
var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient extends
|
|
2672
|
+
var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient extends ApiClient8 {
|
|
2108
2673
|
constructor(options) {
|
|
2109
2674
|
super(options);
|
|
2110
2675
|
this.teamId = options.teamId;
|
|
@@ -2147,17 +2712,21 @@ __privateAdd(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-p
|
|
|
2147
2712
|
var IntegrationPropertyEditorsClient = _IntegrationPropertyEditorsClient;
|
|
2148
2713
|
|
|
2149
2714
|
// src/LabelClient.ts
|
|
2150
|
-
import { ApiClient as
|
|
2715
|
+
import { ApiClient as ApiClient9 } from "@uniformdev/context/api";
|
|
2151
2716
|
var LABELS_URL = "/api/v1/labels";
|
|
2152
|
-
var LabelClient = class extends
|
|
2153
|
-
/** Fetches labels for the current project. */
|
|
2154
|
-
async
|
|
2717
|
+
var LabelClient = class extends ApiClient9 {
|
|
2718
|
+
/** Fetches a list of labels for the current project. */
|
|
2719
|
+
async list(options) {
|
|
2155
2720
|
const { projectId } = this.options;
|
|
2156
2721
|
const fetchUri = this.createUrl(LABELS_URL, { ...options, projectId });
|
|
2157
2722
|
return await this.apiClient(fetchUri);
|
|
2158
2723
|
}
|
|
2724
|
+
/** @deprecated Use {@link list} instead. */
|
|
2725
|
+
async getLabels(options) {
|
|
2726
|
+
return this.list(options);
|
|
2727
|
+
}
|
|
2159
2728
|
/** Updates or creates a label. */
|
|
2160
|
-
async
|
|
2729
|
+
async save(body) {
|
|
2161
2730
|
const { projectId } = this.options;
|
|
2162
2731
|
const fetchUri = this.createUrl(LABELS_URL);
|
|
2163
2732
|
await this.apiClient(fetchUri, {
|
|
@@ -2166,8 +2735,12 @@ var LabelClient = class extends ApiClient8 {
|
|
|
2166
2735
|
expectNoContent: true
|
|
2167
2736
|
});
|
|
2168
2737
|
}
|
|
2738
|
+
/** @deprecated Use {@link save} instead. */
|
|
2739
|
+
async upsertLabel(body) {
|
|
2740
|
+
return this.save(body);
|
|
2741
|
+
}
|
|
2169
2742
|
/** Deletes a label by id. */
|
|
2170
|
-
async
|
|
2743
|
+
async remove(options) {
|
|
2171
2744
|
const { projectId } = this.options;
|
|
2172
2745
|
const fetchUri = this.createUrl(LABELS_URL);
|
|
2173
2746
|
await this.apiClient(fetchUri, {
|
|
@@ -2176,6 +2749,10 @@ var LabelClient = class extends ApiClient8 {
|
|
|
2176
2749
|
expectNoContent: true
|
|
2177
2750
|
});
|
|
2178
2751
|
}
|
|
2752
|
+
/** @deprecated Use {@link remove} instead. */
|
|
2753
|
+
async removeLabel(options) {
|
|
2754
|
+
return this.remove(options);
|
|
2755
|
+
}
|
|
2179
2756
|
};
|
|
2180
2757
|
var UncachedLabelClient = class extends LabelClient {
|
|
2181
2758
|
constructor(options) {
|
|
@@ -2184,20 +2761,24 @@ var UncachedLabelClient = class extends LabelClient {
|
|
|
2184
2761
|
};
|
|
2185
2762
|
|
|
2186
2763
|
// src/LocaleClient.ts
|
|
2187
|
-
import { ApiClient as
|
|
2764
|
+
import { ApiClient as ApiClient10 } from "@uniformdev/context/api";
|
|
2188
2765
|
var localesUrl = "/api/v1/locales";
|
|
2189
|
-
var LocaleClient = class extends
|
|
2766
|
+
var LocaleClient = class extends ApiClient10 {
|
|
2190
2767
|
constructor(options) {
|
|
2191
2768
|
super(options);
|
|
2192
2769
|
}
|
|
2193
|
-
/** Fetches
|
|
2194
|
-
async
|
|
2770
|
+
/** Fetches a list of locales for a project */
|
|
2771
|
+
async list(options) {
|
|
2195
2772
|
const { projectId } = this.options;
|
|
2196
2773
|
const fetchUri = this.createUrl(localesUrl, { ...options, projectId });
|
|
2197
2774
|
return await this.apiClient(fetchUri);
|
|
2198
2775
|
}
|
|
2776
|
+
/** @deprecated Use {@link list} instead. */
|
|
2777
|
+
async get(options) {
|
|
2778
|
+
return this.list(options);
|
|
2779
|
+
}
|
|
2199
2780
|
/** Updates or creates (based on id) a locale */
|
|
2200
|
-
async
|
|
2781
|
+
async save(body) {
|
|
2201
2782
|
const fetchUri = this.createUrl(localesUrl);
|
|
2202
2783
|
await this.apiClient(fetchUri, {
|
|
2203
2784
|
method: "PUT",
|
|
@@ -2205,6 +2786,10 @@ var LocaleClient = class extends ApiClient9 {
|
|
|
2205
2786
|
expectNoContent: true
|
|
2206
2787
|
});
|
|
2207
2788
|
}
|
|
2789
|
+
/** @deprecated Use {@link save} instead. */
|
|
2790
|
+
async upsert(body) {
|
|
2791
|
+
return this.save(body);
|
|
2792
|
+
}
|
|
2208
2793
|
/** Deletes a locale */
|
|
2209
2794
|
async remove(body) {
|
|
2210
2795
|
const fetchUri = this.createUrl(localesUrl);
|
|
@@ -2587,11 +3172,57 @@ var createCanvasChannel = ({
|
|
|
2587
3172
|
};
|
|
2588
3173
|
};
|
|
2589
3174
|
|
|
3175
|
+
// src/NotificationsClient.ts
|
|
3176
|
+
import { ApiClient as ApiClient11 } from "@uniformdev/context/api";
|
|
3177
|
+
var _url2;
|
|
3178
|
+
var _NotificationsClient = class _NotificationsClient extends ApiClient11 {
|
|
3179
|
+
constructor(options) {
|
|
3180
|
+
super(options);
|
|
3181
|
+
}
|
|
3182
|
+
/**
|
|
3183
|
+
* Lists notifications for the current user.
|
|
3184
|
+
*
|
|
3185
|
+
* @deprecated This API is experimental and may change without notice.
|
|
3186
|
+
*/
|
|
3187
|
+
async list(options) {
|
|
3188
|
+
const fetchUri = this.createUrl(__privateGet(_NotificationsClient, _url2), options);
|
|
3189
|
+
return await this.apiClient(fetchUri);
|
|
3190
|
+
}
|
|
3191
|
+
/**
|
|
3192
|
+
* Creates a notification for one or more recipients.
|
|
3193
|
+
*
|
|
3194
|
+
* @deprecated This API is experimental and may change without notice.
|
|
3195
|
+
*/
|
|
3196
|
+
async create(body) {
|
|
3197
|
+
const fetchUri = this.createUrl(__privateGet(_NotificationsClient, _url2));
|
|
3198
|
+
return await this.apiClient(fetchUri, {
|
|
3199
|
+
method: "POST",
|
|
3200
|
+
body: JSON.stringify(body)
|
|
3201
|
+
});
|
|
3202
|
+
}
|
|
3203
|
+
/**
|
|
3204
|
+
* Updates the read state of the current user's notifications.
|
|
3205
|
+
*
|
|
3206
|
+
* @deprecated This API is experimental and may change without notice.
|
|
3207
|
+
*/
|
|
3208
|
+
async setReadState(body) {
|
|
3209
|
+
const fetchUri = this.createUrl(__privateGet(_NotificationsClient, _url2));
|
|
3210
|
+
await this.apiClient(fetchUri, {
|
|
3211
|
+
method: "PATCH",
|
|
3212
|
+
body: JSON.stringify(body),
|
|
3213
|
+
expectNoContent: true
|
|
3214
|
+
});
|
|
3215
|
+
}
|
|
3216
|
+
};
|
|
3217
|
+
_url2 = new WeakMap();
|
|
3218
|
+
__privateAdd(_NotificationsClient, _url2, "/api/v1/notifications");
|
|
3219
|
+
var NotificationsClient = _NotificationsClient;
|
|
3220
|
+
|
|
2590
3221
|
// src/PreviewClient.ts
|
|
2591
|
-
import { ApiClient as
|
|
3222
|
+
import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
|
|
2592
3223
|
var previewUrlsUrl = "/api/v1/preview-urls";
|
|
2593
3224
|
var previewViewportsUrl = "/api/v1/preview-viewports";
|
|
2594
|
-
var PreviewClient = class extends
|
|
3225
|
+
var PreviewClient = class extends ApiClient12 {
|
|
2595
3226
|
constructor(options) {
|
|
2596
3227
|
super(options);
|
|
2597
3228
|
}
|
|
@@ -2654,15 +3285,15 @@ var PreviewClient = class extends ApiClient10 {
|
|
|
2654
3285
|
};
|
|
2655
3286
|
|
|
2656
3287
|
// src/ProjectClient.ts
|
|
2657
|
-
import { ApiClient as
|
|
2658
|
-
var
|
|
2659
|
-
var _ProjectClient = class _ProjectClient extends
|
|
3288
|
+
import { ApiClient as ApiClient13 } from "@uniformdev/context/api";
|
|
3289
|
+
var _url3, _projectsUrl;
|
|
3290
|
+
var _ProjectClient = class _ProjectClient extends ApiClient13 {
|
|
2660
3291
|
constructor(options) {
|
|
2661
3292
|
super({ ...options, bypassCache: true });
|
|
2662
3293
|
}
|
|
2663
3294
|
/** Fetches single Project */
|
|
2664
3295
|
async get(options) {
|
|
2665
|
-
const fetchUri = this.createUrl(__privateGet(_ProjectClient,
|
|
3296
|
+
const fetchUri = this.createUrl(__privateGet(_ProjectClient, _url3), { ...options });
|
|
2666
3297
|
return await this.apiClient(fetchUri);
|
|
2667
3298
|
}
|
|
2668
3299
|
/**
|
|
@@ -2670,31 +3301,43 @@ var _ProjectClient = class _ProjectClient extends ApiClient11 {
|
|
|
2670
3301
|
* When teamId is provided, returns a single team with its projects.
|
|
2671
3302
|
* When omitted, returns all accessible teams and their projects.
|
|
2672
3303
|
*/
|
|
2673
|
-
async
|
|
3304
|
+
async list(options) {
|
|
2674
3305
|
const fetchUri = this.createUrl(__privateGet(_ProjectClient, _projectsUrl), options ? { ...options } : {});
|
|
2675
3306
|
return await this.apiClient(fetchUri);
|
|
2676
3307
|
}
|
|
3308
|
+
/** @deprecated Use {@link list} instead. */
|
|
3309
|
+
async getProjects(options) {
|
|
3310
|
+
return this.list(options);
|
|
3311
|
+
}
|
|
2677
3312
|
/** Updates or creates (based on id) a Project */
|
|
2678
|
-
async
|
|
2679
|
-
const fetchUri = this.createUrl(__privateGet(_ProjectClient,
|
|
3313
|
+
async save(body) {
|
|
3314
|
+
const fetchUri = this.createUrl(__privateGet(_ProjectClient, _url3));
|
|
2680
3315
|
return await this.apiClient(fetchUri, {
|
|
2681
3316
|
method: "PUT",
|
|
2682
3317
|
body: JSON.stringify({ ...body })
|
|
2683
3318
|
});
|
|
2684
3319
|
}
|
|
3320
|
+
/** @deprecated Use {@link save} instead. */
|
|
3321
|
+
async upsert(body) {
|
|
3322
|
+
return this.save(body);
|
|
3323
|
+
}
|
|
2685
3324
|
/** Deletes a Project */
|
|
2686
|
-
async
|
|
2687
|
-
const fetchUri = this.createUrl(__privateGet(_ProjectClient,
|
|
3325
|
+
async remove(body) {
|
|
3326
|
+
const fetchUri = this.createUrl(__privateGet(_ProjectClient, _url3));
|
|
2688
3327
|
await this.apiClient(fetchUri, {
|
|
2689
3328
|
method: "DELETE",
|
|
2690
3329
|
body: JSON.stringify({ ...body }),
|
|
2691
3330
|
expectNoContent: true
|
|
2692
3331
|
});
|
|
2693
3332
|
}
|
|
3333
|
+
/** @deprecated Use {@link remove} instead. */
|
|
3334
|
+
async delete(body) {
|
|
3335
|
+
return this.remove(body);
|
|
3336
|
+
}
|
|
2694
3337
|
};
|
|
2695
|
-
|
|
3338
|
+
_url3 = new WeakMap();
|
|
2696
3339
|
_projectsUrl = new WeakMap();
|
|
2697
|
-
__privateAdd(_ProjectClient,
|
|
3340
|
+
__privateAdd(_ProjectClient, _url3, "/api/v1/project");
|
|
2698
3341
|
__privateAdd(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
2699
3342
|
var ProjectClient = _ProjectClient;
|
|
2700
3343
|
|
|
@@ -2881,9 +3524,9 @@ function queryToProjection(source) {
|
|
|
2881
3524
|
}
|
|
2882
3525
|
|
|
2883
3526
|
// src/PromptClient.ts
|
|
2884
|
-
import { ApiClient as
|
|
3527
|
+
import { ApiClient as ApiClient14 } from "@uniformdev/context/api";
|
|
2885
3528
|
var PromptsUrl = "/api/v1/prompts";
|
|
2886
|
-
var PromptClient = class extends
|
|
3529
|
+
var PromptClient = class extends ApiClient14 {
|
|
2887
3530
|
constructor(options) {
|
|
2888
3531
|
super(options);
|
|
2889
3532
|
}
|
|
@@ -2914,34 +3557,42 @@ var PromptClient = class extends ApiClient12 {
|
|
|
2914
3557
|
};
|
|
2915
3558
|
|
|
2916
3559
|
// src/RelationshipClient.ts
|
|
2917
|
-
import { ApiClient as
|
|
3560
|
+
import { ApiClient as ApiClient15 } from "@uniformdev/context/api";
|
|
2918
3561
|
var RELATIONSHIPS_URL = "/api/v1/relationships";
|
|
2919
|
-
var RelationshipClient = class extends
|
|
3562
|
+
var RelationshipClient = class extends ApiClient15 {
|
|
2920
3563
|
constructor(options) {
|
|
2921
3564
|
super(options);
|
|
2922
|
-
this.
|
|
3565
|
+
this.list = async (options) => {
|
|
2923
3566
|
const { projectId } = this.options;
|
|
2924
3567
|
const url = this.createUrl(RELATIONSHIPS_URL, { ...options, projectId });
|
|
2925
3568
|
return this.apiClient(url);
|
|
2926
3569
|
};
|
|
3570
|
+
/** @deprecated Use {@link list} instead. */
|
|
3571
|
+
this.get = async (options) => {
|
|
3572
|
+
return this.list(options);
|
|
3573
|
+
};
|
|
2927
3574
|
}
|
|
2928
3575
|
};
|
|
2929
3576
|
|
|
2930
3577
|
// src/ReleaseClient.ts
|
|
2931
|
-
import { ApiClient as
|
|
3578
|
+
import { ApiClient as ApiClient16 } from "@uniformdev/context/api";
|
|
2932
3579
|
var releasesUrl = "/api/v1/releases";
|
|
2933
|
-
var ReleaseClient = class extends
|
|
3580
|
+
var ReleaseClient = class extends ApiClient16 {
|
|
2934
3581
|
constructor(options) {
|
|
2935
3582
|
super(options);
|
|
2936
3583
|
}
|
|
2937
|
-
/** Fetches
|
|
2938
|
-
async
|
|
3584
|
+
/** Fetches a list of releases for a project */
|
|
3585
|
+
async list(options) {
|
|
2939
3586
|
const { projectId } = this.options;
|
|
2940
3587
|
const fetchUri = this.createUrl(releasesUrl, { ...options, projectId });
|
|
2941
3588
|
return await this.apiClient(fetchUri);
|
|
2942
3589
|
}
|
|
3590
|
+
/** @deprecated Use {@link list} instead. */
|
|
3591
|
+
async get(options) {
|
|
3592
|
+
return this.list(options);
|
|
3593
|
+
}
|
|
2943
3594
|
/** Updates or creates (based on id) a release */
|
|
2944
|
-
async
|
|
3595
|
+
async save(body) {
|
|
2945
3596
|
const fetchUri = this.createUrl(releasesUrl);
|
|
2946
3597
|
await this.apiClient(fetchUri, {
|
|
2947
3598
|
method: "PUT",
|
|
@@ -2949,6 +3600,10 @@ var ReleaseClient = class extends ApiClient14 {
|
|
|
2949
3600
|
expectNoContent: true
|
|
2950
3601
|
});
|
|
2951
3602
|
}
|
|
3603
|
+
/** @deprecated Use {@link save} instead. */
|
|
3604
|
+
async upsert(body) {
|
|
3605
|
+
return this.save(body);
|
|
3606
|
+
}
|
|
2952
3607
|
/** Deletes a release */
|
|
2953
3608
|
async remove(body) {
|
|
2954
3609
|
const fetchUri = this.createUrl(releasesUrl);
|
|
@@ -2970,21 +3625,25 @@ var ReleaseClient = class extends ApiClient14 {
|
|
|
2970
3625
|
};
|
|
2971
3626
|
|
|
2972
3627
|
// src/ReleaseContentsClient.ts
|
|
2973
|
-
import { ApiClient as
|
|
2974
|
-
var
|
|
2975
|
-
var ReleaseContentsClient = class extends
|
|
3628
|
+
import { ApiClient as ApiClient17 } from "@uniformdev/context/api";
|
|
3629
|
+
var releaseContentsUrl = "/api/v1/release-contents";
|
|
3630
|
+
var ReleaseContentsClient = class extends ApiClient17 {
|
|
2976
3631
|
constructor(options) {
|
|
2977
3632
|
super(options);
|
|
2978
3633
|
}
|
|
2979
|
-
/** Fetches
|
|
2980
|
-
async
|
|
3634
|
+
/** Fetches a list of entities added to a release */
|
|
3635
|
+
async list(options) {
|
|
2981
3636
|
const { projectId } = this.options;
|
|
2982
|
-
const fetchUri = this.createUrl(
|
|
3637
|
+
const fetchUri = this.createUrl(releaseContentsUrl, { ...options, projectId });
|
|
2983
3638
|
return await this.apiClient(fetchUri);
|
|
2984
3639
|
}
|
|
3640
|
+
/** @deprecated Use {@link list} instead. */
|
|
3641
|
+
async get(options) {
|
|
3642
|
+
return this.list(options);
|
|
3643
|
+
}
|
|
2985
3644
|
/** Removes a release content from a release */
|
|
2986
3645
|
async remove(body) {
|
|
2987
|
-
const fetchUri = this.createUrl(
|
|
3646
|
+
const fetchUri = this.createUrl(releaseContentsUrl);
|
|
2988
3647
|
await this.apiClient(fetchUri, {
|
|
2989
3648
|
method: "DELETE",
|
|
2990
3649
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -2994,9 +3653,9 @@ var ReleaseContentsClient = class extends ApiClient15 {
|
|
|
2994
3653
|
};
|
|
2995
3654
|
|
|
2996
3655
|
// src/RouteClient.ts
|
|
2997
|
-
import { ApiClient as
|
|
3656
|
+
import { ApiClient as ApiClient18 } from "@uniformdev/context/api";
|
|
2998
3657
|
var ROUTE_URL = "/api/v1/route";
|
|
2999
|
-
var RouteClient = class extends
|
|
3658
|
+
var RouteClient = class extends ApiClient18 {
|
|
3000
3659
|
constructor(options) {
|
|
3001
3660
|
var _a;
|
|
3002
3661
|
if (!options.limitPolicy) {
|
|
@@ -3005,8 +3664,14 @@ var RouteClient = class extends ApiClient16 {
|
|
|
3005
3664
|
super(options);
|
|
3006
3665
|
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
|
|
3007
3666
|
}
|
|
3008
|
-
/**
|
|
3009
|
-
|
|
3667
|
+
/**
|
|
3668
|
+
* Resolves a route to a composition, redirect, or not-found result.
|
|
3669
|
+
*
|
|
3670
|
+
* An optional `select` projection applies to the resolved composition when
|
|
3671
|
+
* the route matches one; redirect / notFound responses pass through
|
|
3672
|
+
* untouched.
|
|
3673
|
+
*/
|
|
3674
|
+
async get(options) {
|
|
3010
3675
|
const { projectId } = this.options;
|
|
3011
3676
|
const { select, ...rest } = options != null ? options : {};
|
|
3012
3677
|
const rewrittenSelect = projectionToQuery(select);
|
|
@@ -3016,6 +3681,10 @@ var RouteClient = class extends ApiClient16 {
|
|
|
3016
3681
|
this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
|
|
3017
3682
|
);
|
|
3018
3683
|
}
|
|
3684
|
+
/** @deprecated use {@link RouteClient.get} instead (renamed). */
|
|
3685
|
+
async getRoute(options) {
|
|
3686
|
+
return this.get(options);
|
|
3687
|
+
}
|
|
3019
3688
|
};
|
|
3020
3689
|
|
|
3021
3690
|
// src/types/locales.ts
|
|
@@ -3370,26 +4039,30 @@ function handleRichTextNodeBinding(object, options) {
|
|
|
3370
4039
|
}
|
|
3371
4040
|
|
|
3372
4041
|
// src/index.ts
|
|
3373
|
-
import { ApiClientError as
|
|
4042
|
+
import { ApiClientError as ApiClientError5 } from "@uniformdev/context/api";
|
|
3374
4043
|
|
|
3375
4044
|
// src/.version.ts
|
|
3376
|
-
var version = "20.72.
|
|
4045
|
+
var version = "20.72.3";
|
|
3377
4046
|
|
|
3378
4047
|
// src/WorkflowClient.ts
|
|
3379
|
-
import { ApiClient as
|
|
4048
|
+
import { ApiClient as ApiClient19 } from "@uniformdev/context/api";
|
|
3380
4049
|
var workflowsUrl = "/api/v1/workflows";
|
|
3381
|
-
var WorkflowClient = class extends
|
|
4050
|
+
var WorkflowClient = class extends ApiClient19 {
|
|
3382
4051
|
constructor(options) {
|
|
3383
4052
|
super(options);
|
|
3384
4053
|
}
|
|
3385
|
-
/** Fetches workflows for a project */
|
|
3386
|
-
async
|
|
4054
|
+
/** Fetches a list of workflows for a project */
|
|
4055
|
+
async list(options) {
|
|
3387
4056
|
const { projectId } = this.options;
|
|
3388
4057
|
const fetchUri = this.createUrl(workflowsUrl, { ...options, projectId });
|
|
3389
4058
|
return await this.apiClient(fetchUri);
|
|
3390
4059
|
}
|
|
4060
|
+
/** @deprecated Use {@link list} instead. */
|
|
4061
|
+
async get(options) {
|
|
4062
|
+
return this.list(options);
|
|
4063
|
+
}
|
|
3391
4064
|
/** Updates or creates a workflow definition */
|
|
3392
|
-
async
|
|
4065
|
+
async save(body) {
|
|
3393
4066
|
const fetchUri = this.createUrl(workflowsUrl);
|
|
3394
4067
|
await this.apiClient(fetchUri, {
|
|
3395
4068
|
method: "PUT",
|
|
@@ -3397,6 +4070,10 @@ var WorkflowClient = class extends ApiClient17 {
|
|
|
3397
4070
|
expectNoContent: true
|
|
3398
4071
|
});
|
|
3399
4072
|
}
|
|
4073
|
+
/** @deprecated Use {@link save} instead. */
|
|
4074
|
+
async upsert(body) {
|
|
4075
|
+
return this.save(body);
|
|
4076
|
+
}
|
|
3400
4077
|
/** Deletes a workflow definition */
|
|
3401
4078
|
async remove(body) {
|
|
3402
4079
|
const fetchUri = this.createUrl(workflowsUrl);
|
|
@@ -3409,7 +4086,7 @@ var WorkflowClient = class extends ApiClient17 {
|
|
|
3409
4086
|
};
|
|
3410
4087
|
|
|
3411
4088
|
// src/index.ts
|
|
3412
|
-
var CanvasClientError =
|
|
4089
|
+
var CanvasClientError = ApiClientError5;
|
|
3413
4090
|
export {
|
|
3414
4091
|
ASSETS_SOURCE_CUSTOM_URL,
|
|
3415
4092
|
ASSETS_SOURCE_UNIFORM,
|
|
@@ -3420,7 +4097,7 @@ export {
|
|
|
3420
4097
|
ATTRIBUTE_PARAMETER_TYPE,
|
|
3421
4098
|
ATTRIBUTE_PARAMETER_VALUE,
|
|
3422
4099
|
ATTRIBUTE_PLACEHOLDER,
|
|
3423
|
-
|
|
4100
|
+
ApiClientError5 as ApiClientError,
|
|
3424
4101
|
BatchEntry,
|
|
3425
4102
|
BlockFormatError,
|
|
3426
4103
|
CANVAS_BLOCK_PARAM_TYPE,
|
|
@@ -3462,7 +4139,11 @@ export {
|
|
|
3462
4139
|
CanvasClientError,
|
|
3463
4140
|
CategoryClient,
|
|
3464
4141
|
ChildEnhancerBuilder,
|
|
4142
|
+
ComponentDefinitionClient,
|
|
4143
|
+
CompositionDeliveryClient,
|
|
4144
|
+
CompositionManagementClient,
|
|
3465
4145
|
ContentClient,
|
|
4146
|
+
ContentTypeClient,
|
|
3466
4147
|
DataSourceClient,
|
|
3467
4148
|
DataTypeClient,
|
|
3468
4149
|
EDGE_CACHE_DISABLED,
|
|
@@ -3472,6 +4153,8 @@ export {
|
|
|
3472
4153
|
EMPTY_COMPOSITION,
|
|
3473
4154
|
EnhancerBuilder,
|
|
3474
4155
|
EntityReleasesClient,
|
|
4156
|
+
EntryDeliveryClient,
|
|
4157
|
+
EntryManagementClient,
|
|
3475
4158
|
IN_CONTEXT_EDITOR_COMPONENT_END_ROLE,
|
|
3476
4159
|
IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
|
|
3477
4160
|
IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM,
|
|
@@ -3484,6 +4167,7 @@ export {
|
|
|
3484
4167
|
LOCALE_DYNAMIC_INPUT_NAME,
|
|
3485
4168
|
LabelClient,
|
|
3486
4169
|
LocaleClient,
|
|
4170
|
+
NotificationsClient,
|
|
3487
4171
|
PLACEHOLDER_ID,
|
|
3488
4172
|
PreviewClient,
|
|
3489
4173
|
ProjectClient,
|