@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.js
CHANGED
|
@@ -45,7 +45,7 @@ __export(index_exports, {
|
|
|
45
45
|
ATTRIBUTE_PARAMETER_TYPE: () => ATTRIBUTE_PARAMETER_TYPE,
|
|
46
46
|
ATTRIBUTE_PARAMETER_VALUE: () => ATTRIBUTE_PARAMETER_VALUE,
|
|
47
47
|
ATTRIBUTE_PLACEHOLDER: () => ATTRIBUTE_PLACEHOLDER,
|
|
48
|
-
ApiClientError: () =>
|
|
48
|
+
ApiClientError: () => import_api19.ApiClientError,
|
|
49
49
|
BatchEntry: () => BatchEntry,
|
|
50
50
|
BlockFormatError: () => BlockFormatError,
|
|
51
51
|
CANVAS_BLOCK_PARAM_TYPE: () => CANVAS_BLOCK_PARAM_TYPE,
|
|
@@ -87,11 +87,7 @@ __export(index_exports, {
|
|
|
87
87
|
CanvasClientError: () => CanvasClientError,
|
|
88
88
|
CategoryClient: () => CategoryClient,
|
|
89
89
|
ChildEnhancerBuilder: () => ChildEnhancerBuilder,
|
|
90
|
-
ComponentDefinitionClient: () => ComponentDefinitionClient,
|
|
91
|
-
CompositionDeliveryClient: () => CompositionDeliveryClient,
|
|
92
|
-
CompositionManagementClient: () => CompositionManagementClient,
|
|
93
90
|
ContentClient: () => ContentClient,
|
|
94
|
-
ContentTypeClient: () => ContentTypeClient,
|
|
95
91
|
DataSourceClient: () => DataSourceClient,
|
|
96
92
|
DataTypeClient: () => DataTypeClient,
|
|
97
93
|
EDGE_CACHE_DISABLED: () => EDGE_CACHE_DISABLED,
|
|
@@ -101,8 +97,6 @@ __export(index_exports, {
|
|
|
101
97
|
EMPTY_COMPOSITION: () => EMPTY_COMPOSITION,
|
|
102
98
|
EnhancerBuilder: () => EnhancerBuilder,
|
|
103
99
|
EntityReleasesClient: () => EntityReleasesClient,
|
|
104
|
-
EntryDeliveryClient: () => EntryDeliveryClient,
|
|
105
|
-
EntryManagementClient: () => EntryManagementClient,
|
|
106
100
|
IN_CONTEXT_EDITOR_COMPONENT_END_ROLE: () => IN_CONTEXT_EDITOR_COMPONENT_END_ROLE,
|
|
107
101
|
IN_CONTEXT_EDITOR_COMPONENT_START_ROLE: () => IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
|
|
108
102
|
IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM: () => IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM,
|
|
@@ -220,7 +214,7 @@ __export(index_exports, {
|
|
|
220
214
|
});
|
|
221
215
|
module.exports = __toCommonJS(index_exports);
|
|
222
216
|
|
|
223
|
-
// src/
|
|
217
|
+
// src/CanvasClient.ts
|
|
224
218
|
var import_api2 = require("@uniformdev/context/api");
|
|
225
219
|
|
|
226
220
|
// src/enhancement/createLimitPolicy.ts
|
|
@@ -264,129 +258,6 @@ function createLimitPolicy({
|
|
|
264
258
|
}
|
|
265
259
|
var nullLimitPolicy = async (func) => await func();
|
|
266
260
|
|
|
267
|
-
// src/CategoryClient.ts
|
|
268
|
-
var CATEGORIES_URL = "/api/v1/categories";
|
|
269
|
-
var CategoryClient = class extends import_api2.ApiClient {
|
|
270
|
-
constructor(options) {
|
|
271
|
-
if (!options.limitPolicy) {
|
|
272
|
-
options.limitPolicy = createLimitPolicy({});
|
|
273
|
-
}
|
|
274
|
-
super(options);
|
|
275
|
-
}
|
|
276
|
-
/** Fetches a list of categories created in given project */
|
|
277
|
-
async list(options) {
|
|
278
|
-
const { projectId } = this.options;
|
|
279
|
-
const fetchUri = this.createUrl("/api/v1/categories", { ...options, projectId });
|
|
280
|
-
return await this.apiClient(fetchUri);
|
|
281
|
-
}
|
|
282
|
-
/** @deprecated Use {@link list} instead. */
|
|
283
|
-
async getCategories(options) {
|
|
284
|
-
return this.list(options);
|
|
285
|
-
}
|
|
286
|
-
/** Updates or creates a category, also used to re-order them */
|
|
287
|
-
async save(categories) {
|
|
288
|
-
const { projectId } = this.options;
|
|
289
|
-
const fetchUri = this.createUrl(CATEGORIES_URL);
|
|
290
|
-
return await this.apiClient(fetchUri, {
|
|
291
|
-
method: "PUT",
|
|
292
|
-
body: JSON.stringify({ categories, projectId }),
|
|
293
|
-
expectNoContent: true
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
/** @deprecated Use {@link save} instead. */
|
|
297
|
-
async upsertCategories(categories) {
|
|
298
|
-
return this.save(categories);
|
|
299
|
-
}
|
|
300
|
-
/** Deletes a category */
|
|
301
|
-
async remove(options) {
|
|
302
|
-
const { projectId } = this.options;
|
|
303
|
-
const fetchUri = this.createUrl(CATEGORIES_URL);
|
|
304
|
-
return await this.apiClient(fetchUri, {
|
|
305
|
-
method: "DELETE",
|
|
306
|
-
body: JSON.stringify({ projectId, categoryId: options.categoryId }),
|
|
307
|
-
expectNoContent: true
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
/** @deprecated Use {@link remove} instead. */
|
|
311
|
-
async removeCategory(options) {
|
|
312
|
-
return this.remove(options);
|
|
313
|
-
}
|
|
314
|
-
};
|
|
315
|
-
var UncachedCategoryClient = class extends CategoryClient {
|
|
316
|
-
constructor(options) {
|
|
317
|
-
super({ ...options, bypassCache: true });
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
|
|
321
|
-
// src/clients/ComponentDefinitionClient.ts
|
|
322
|
-
var import_api4 = require("@uniformdev/context/api");
|
|
323
|
-
|
|
324
|
-
// src/clients/ContentClientBase.ts
|
|
325
|
-
var import_api3 = require("@uniformdev/context/api");
|
|
326
|
-
var CANONICAL_FORMAT = "canonical";
|
|
327
|
-
var ContentClientBase = class extends import_api3.ApiClient {
|
|
328
|
-
constructor(options, defaultBypassCache) {
|
|
329
|
-
var _a, _b;
|
|
330
|
-
super({
|
|
331
|
-
...options,
|
|
332
|
-
limitPolicy: (_a = options.limitPolicy) != null ? _a : createLimitPolicy({}),
|
|
333
|
-
bypassCache: (_b = options.bypassCache) != null ? _b : defaultBypassCache
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
// src/clients/ComponentDefinitionClient.ts
|
|
339
|
-
var DEFINITIONS_URL = "/api/v1/canvas-definitions";
|
|
340
|
-
var ComponentDefinitionClient = class extends ContentClientBase {
|
|
341
|
-
constructor(options) {
|
|
342
|
-
super(
|
|
343
|
-
options,
|
|
344
|
-
/* defaultBypassCache */
|
|
345
|
-
true
|
|
346
|
-
);
|
|
347
|
-
}
|
|
348
|
-
/** Fetches one component definition by id (throws `ApiClientError(404)` if absent). */
|
|
349
|
-
async get(args) {
|
|
350
|
-
var _a;
|
|
351
|
-
const url = this.createUrl(DEFINITIONS_URL, {
|
|
352
|
-
componentId: args.componentId,
|
|
353
|
-
projectId: this.options.projectId
|
|
354
|
-
});
|
|
355
|
-
const res = await this.apiClient(url);
|
|
356
|
-
const definition = (_a = res.componentDefinitions) == null ? void 0 : _a[0];
|
|
357
|
-
if (!definition) {
|
|
358
|
-
throw new import_api4.ApiClientError("Component definition not found", "GET", url.toString(), 404, "Not Found");
|
|
359
|
-
}
|
|
360
|
-
return definition;
|
|
361
|
-
}
|
|
362
|
-
/** Fetches a list of component definitions. */
|
|
363
|
-
list(args) {
|
|
364
|
-
const url = this.createUrl(DEFINITIONS_URL, { ...args, projectId: this.options.projectId });
|
|
365
|
-
return this.apiClient(url);
|
|
366
|
-
}
|
|
367
|
-
/** Creates or updates a component definition. */
|
|
368
|
-
async save(def) {
|
|
369
|
-
const url = this.createUrl(DEFINITIONS_URL);
|
|
370
|
-
await this.apiClient(url, {
|
|
371
|
-
method: "PUT",
|
|
372
|
-
body: JSON.stringify({ ...def, projectId: this.options.projectId }),
|
|
373
|
-
expectNoContent: true
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
/** Deletes a component definition. */
|
|
377
|
-
async remove(args) {
|
|
378
|
-
const url = this.createUrl(DEFINITIONS_URL);
|
|
379
|
-
await this.apiClient(url, {
|
|
380
|
-
method: "DELETE",
|
|
381
|
-
body: JSON.stringify({ ...args, projectId: this.options.projectId }),
|
|
382
|
-
expectNoContent: true
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
};
|
|
386
|
-
|
|
387
|
-
// src/clients/CompositionDeliveryClient.ts
|
|
388
|
-
var import_api5 = require("@uniformdev/context/api");
|
|
389
|
-
|
|
390
261
|
// src/projection/types.ts
|
|
391
262
|
var SELECT_QUERY_PREFIX = "select.";
|
|
392
263
|
|
|
@@ -432,529 +303,9 @@ function projectionToQuery(spec) {
|
|
|
432
303
|
return out;
|
|
433
304
|
}
|
|
434
305
|
|
|
435
|
-
// src/
|
|
436
|
-
var CANVAS_PERSONALIZE_TYPE = "$personalization";
|
|
437
|
-
var CANVAS_TEST_TYPE = "$test";
|
|
438
|
-
var CANVAS_LOCALIZATION_TYPE = "$localization";
|
|
439
|
-
var CANVAS_SLOT_SECTION_TYPE = "$slotSection";
|
|
440
|
-
var CANVAS_INTENT_TAG_PARAM = "intentTag";
|
|
441
|
-
var CANVAS_LOCALE_TAG_PARAM = "locale";
|
|
442
|
-
var CANVAS_BLOCK_PARAM_TYPE = "$block";
|
|
443
|
-
var CANVAS_PERSONALIZE_SLOT = "pz";
|
|
444
|
-
var CANVAS_TEST_SLOT = "test";
|
|
445
|
-
var CANVAS_LOCALIZATION_SLOT = "localized";
|
|
446
|
-
var CANVAS_SLOT_SECTION_SLOT = "$slotSectionItems";
|
|
447
|
-
var CANVAS_SLOT_SECTION_NAME_PARAM = "name";
|
|
448
|
-
var CANVAS_SLOT_SECTION_MIN_PARAM = "min";
|
|
449
|
-
var CANVAS_SLOT_SECTION_MAX_PARAM = "max";
|
|
450
|
-
var CANVAS_SLOT_SECTION_GROUP_TYPE_PARAM = "groupType";
|
|
451
|
-
var CANVAS_SLOT_SECTION_SPECIFIC_PARAM = "specific";
|
|
452
|
-
var CANVAS_DRAFT_STATE = 0;
|
|
453
|
-
var CANVAS_PUBLISHED_STATE = 64;
|
|
454
|
-
var CANVAS_EDITOR_STATE = 63;
|
|
455
|
-
var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
|
|
456
|
-
var CANVAS_PERSONALIZATION_EVENT_NAME_PARAM = "trackingEventName";
|
|
457
|
-
var CANVAS_PERSONALIZATION_ALGORITHM_PARAM = "algorithm";
|
|
458
|
-
var CANVAS_PERSONALIZATION_ALGORITHM_TYPE = "pzAlgorithm";
|
|
459
|
-
var CANVAS_PERSONALIZATION_TAKE_PARAM = "count";
|
|
460
|
-
var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
|
|
461
|
-
var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
|
|
462
|
-
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
463
|
-
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
464
|
-
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
465
|
-
var CANVAS_CONTEXTUAL_EDITING_PARAM = "$contextualEditing";
|
|
466
|
-
var SECRET_QUERY_STRING_PARAM = "secret";
|
|
467
|
-
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
468
|
-
var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
|
|
469
|
-
var IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM = "is_incontext_editing_forced_settings";
|
|
470
|
-
var IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM = "is_config_check";
|
|
471
|
-
var IN_CONTEXT_EDITOR_COMPONENT_START_ROLE = "uniform-component-start";
|
|
472
|
-
var IN_CONTEXT_EDITOR_COMPONENT_END_ROLE = "uniform-component-end";
|
|
473
|
-
var IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID = "uniform-canvas-preview-script";
|
|
474
|
-
var IS_RENDERED_BY_UNIFORM_ATTRIBUTE = "data-is-rendered-by-uniform";
|
|
475
|
-
var PLACEHOLDER_ID = "placeholder";
|
|
476
|
-
var EMPTY_COMPOSITION = {
|
|
477
|
-
_id: "_empty_composition_id",
|
|
478
|
-
_name: "An empty composition used for contextual editing",
|
|
479
|
-
type: "_empty_composition_type"
|
|
480
|
-
};
|
|
481
|
-
var EDGE_MIN_CACHE_TTL = 10;
|
|
482
|
-
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
483
|
-
var EDGE_DEFAULT_CACHE_TTL = 30;
|
|
484
|
-
var EDGE_CACHE_DISABLED = -1;
|
|
485
|
-
var ASSET_PARAMETER_TYPE = "asset";
|
|
486
|
-
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
|
487
|
-
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
|
488
|
-
var REFERENCE_DATA_TYPE_ID = "uniformContentInternalReference";
|
|
489
|
-
|
|
490
|
-
// src/clients/compositionHelpers.ts
|
|
491
|
-
function resolveCompositionSelector(args) {
|
|
492
|
-
if ("compositionId" in args) {
|
|
493
|
-
const { compositionId, editionId, versionId, ...readOptions } = args;
|
|
494
|
-
return {
|
|
495
|
-
readOptions,
|
|
496
|
-
// raw mode matches on composition OR edition id via the compositionId param
|
|
497
|
-
compositionId: editionId != null ? editionId : compositionId,
|
|
498
|
-
versionId,
|
|
499
|
-
hasCompositionId: true,
|
|
500
|
-
pinnedEdition: editionId !== void 0
|
|
501
|
-
};
|
|
502
|
-
}
|
|
503
|
-
return { readOptions: args, hasCompositionId: false, pinnedEdition: false };
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
// src/clients/DeliveryClientBase.ts
|
|
507
|
-
var DEFAULT_EDGE_API_HOST = "https://uniform.global";
|
|
508
|
-
var DeliveryClientBase = class extends ContentClientBase {
|
|
509
|
-
constructor(options) {
|
|
510
|
-
var _a;
|
|
511
|
-
super(
|
|
512
|
-
options,
|
|
513
|
-
/* defaultBypassCache */
|
|
514
|
-
false
|
|
515
|
-
);
|
|
516
|
-
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : DEFAULT_EDGE_API_HOST;
|
|
517
|
-
this.edgeRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
|
|
518
|
-
}
|
|
519
|
-
/** Coerces the `diagnostics` option into the shape the edge endpoints accept. */
|
|
520
|
-
coerceDiagnostics(diagnostics) {
|
|
521
|
-
return typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0;
|
|
522
|
-
}
|
|
523
|
-
};
|
|
524
|
-
|
|
525
|
-
// src/clients/CompositionDeliveryClient.ts
|
|
526
|
-
var EDGE_SINGLE_URL = "/api/v1/composition";
|
|
527
|
-
var EDGE_LIST_URL = "/api/v1/compositions";
|
|
528
|
-
var CompositionDeliveryClient = class extends DeliveryClientBase {
|
|
529
|
-
constructor(options) {
|
|
530
|
-
super(options);
|
|
531
|
-
}
|
|
532
|
-
/** Fetches exactly one composition (throws `ApiClientError(404)` if absent). */
|
|
533
|
-
get(args) {
|
|
534
|
-
var _a;
|
|
535
|
-
const { diagnostics, select, ...rest } = args;
|
|
536
|
-
const { readOptions, compositionId, versionId, pinnedEdition } = resolveCompositionSelector(rest);
|
|
537
|
-
const url = this.createUrl(
|
|
538
|
-
EDGE_SINGLE_URL,
|
|
539
|
-
{
|
|
540
|
-
...readOptions,
|
|
541
|
-
...projectionToQuery(select),
|
|
542
|
-
// A pinned edition is folded into compositionId (raw matches edition or
|
|
543
|
-
// composition id); there is no editionId query param on this endpoint.
|
|
544
|
-
compositionId,
|
|
545
|
-
versionId,
|
|
546
|
-
projectId: this.options.projectId,
|
|
547
|
-
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
548
|
-
// editionId pins a specific edition for preview; otherwise locale-best.
|
|
549
|
-
editions: pinnedEdition ? "raw" : "auto",
|
|
550
|
-
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
551
|
-
},
|
|
552
|
-
this.edgeApiHost
|
|
553
|
-
);
|
|
554
|
-
return this.apiClient(url, this.edgeRequestInit);
|
|
555
|
-
}
|
|
556
|
-
/** Fetches a list of compositions, optionally filtered. */
|
|
557
|
-
list(args = {}) {
|
|
558
|
-
var _a;
|
|
559
|
-
const { diagnostics, filters, select, ...rest } = args;
|
|
560
|
-
const url = this.createUrl(
|
|
561
|
-
EDGE_LIST_URL,
|
|
562
|
-
{
|
|
563
|
-
...rest,
|
|
564
|
-
...(0, import_api5.rewriteFiltersForApi)(filters),
|
|
565
|
-
...projectionToQuery(select),
|
|
566
|
-
projectId: this.options.projectId,
|
|
567
|
-
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
568
|
-
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
569
|
-
},
|
|
570
|
-
this.edgeApiHost
|
|
571
|
-
);
|
|
572
|
-
return this.apiClient(url, this.edgeRequestInit);
|
|
573
|
-
}
|
|
574
|
-
};
|
|
575
|
-
|
|
576
|
-
// src/clients/CompositionManagementClient.ts
|
|
577
|
-
var import_api6 = require("@uniformdev/context/api");
|
|
578
|
-
|
|
579
|
-
// src/clients/resolveManagementEditions.ts
|
|
580
|
-
function resolveManagementEditions({
|
|
581
|
-
explicit,
|
|
582
|
-
pinnedEdition,
|
|
583
|
-
hasId,
|
|
584
|
-
hasLocale
|
|
585
|
-
}) {
|
|
586
|
-
if (explicit) {
|
|
587
|
-
return explicit;
|
|
588
|
-
}
|
|
589
|
-
if (pinnedEdition) {
|
|
590
|
-
return "raw";
|
|
591
|
-
}
|
|
592
|
-
if (!hasId) {
|
|
593
|
-
return void 0;
|
|
594
|
-
}
|
|
595
|
-
return hasLocale ? "auto" : "raw";
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
// src/clients/CompositionManagementClient.ts
|
|
306
|
+
// src/CanvasClient.ts
|
|
599
307
|
var CANVAS_URL = "/api/v1/canvas";
|
|
600
|
-
var
|
|
601
|
-
var CompositionManagementClient = class extends ContentClientBase {
|
|
602
|
-
constructor(options) {
|
|
603
|
-
super(
|
|
604
|
-
options,
|
|
605
|
-
/* defaultBypassCache */
|
|
606
|
-
true
|
|
607
|
-
);
|
|
608
|
-
}
|
|
609
|
-
/**
|
|
610
|
-
* Fetches one composition in canonical shape (throws `ApiClientError(404)` if
|
|
611
|
-
* absent).
|
|
612
|
-
*/
|
|
613
|
-
get(args) {
|
|
614
|
-
var _a;
|
|
615
|
-
const { select, ...selectorArgs } = args;
|
|
616
|
-
const { readOptions, compositionId, versionId, hasCompositionId, pinnedEdition } = resolveCompositionSelector(selectorArgs);
|
|
617
|
-
const url = this.createUrl(CANVAS_URL, {
|
|
618
|
-
format: CANONICAL_FORMAT,
|
|
619
|
-
// Caller-supplied shaping flags and non-id selector keys ride along and
|
|
620
|
-
// override the format alias server-side.
|
|
621
|
-
...readOptions,
|
|
622
|
-
...projectionToQuery(select),
|
|
623
|
-
// A pinned edition is folded into compositionId; there is no editionId
|
|
624
|
-
// query param on this endpoint.
|
|
625
|
-
compositionId,
|
|
626
|
-
versionId,
|
|
627
|
-
projectId: this.options.projectId,
|
|
628
|
-
state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE,
|
|
629
|
-
editions: resolveManagementEditions({
|
|
630
|
-
explicit: readOptions.editions,
|
|
631
|
-
pinnedEdition,
|
|
632
|
-
hasId: hasCompositionId,
|
|
633
|
-
hasLocale: readOptions.locale != null
|
|
634
|
-
})
|
|
635
|
-
});
|
|
636
|
-
return this.apiClient(url);
|
|
637
|
-
}
|
|
638
|
-
/** Fetches a list of compositions in canonical shape. */
|
|
639
|
-
list(args = {}) {
|
|
640
|
-
var _a;
|
|
641
|
-
const { filters, select, ...rest } = args;
|
|
642
|
-
const url = this.createUrl(CANVAS_URL, {
|
|
643
|
-
format: CANONICAL_FORMAT,
|
|
644
|
-
...rest,
|
|
645
|
-
...(0, import_api6.rewriteFiltersForApi)(filters),
|
|
646
|
-
...projectionToQuery(select),
|
|
647
|
-
projectId: this.options.projectId,
|
|
648
|
-
state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE
|
|
649
|
-
});
|
|
650
|
-
return this.apiClient(url);
|
|
651
|
-
}
|
|
652
|
-
/** Creates or updates a composition. Returns the new `x-modified-at` timestamp. */
|
|
653
|
-
async save(body, opts) {
|
|
654
|
-
const url = this.createUrl(CANVAS_URL);
|
|
655
|
-
const headers = {};
|
|
656
|
-
if (opts == null ? void 0 : opts.ifUnmodifiedSince) {
|
|
657
|
-
headers["x-if-unmodified-since"] = opts.ifUnmodifiedSince;
|
|
658
|
-
}
|
|
659
|
-
const { response } = await this.apiClientWithResponse(url, {
|
|
660
|
-
method: "PUT",
|
|
661
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
662
|
-
expectNoContent: true,
|
|
663
|
-
headers
|
|
664
|
-
});
|
|
665
|
-
return { modified: response.headers.get("x-modified-at") };
|
|
666
|
-
}
|
|
667
|
-
/**
|
|
668
|
-
* Saves the draft and publishes in one call (two PUTs). The optimistic
|
|
669
|
-
* concurrency guard, if any, applies to the draft write.
|
|
670
|
-
*/
|
|
671
|
-
async saveAndPublish(body, opts) {
|
|
672
|
-
await this.save({ ...body, state: CANVAS_DRAFT_STATE }, opts);
|
|
673
|
-
return this.save({ ...body, state: CANVAS_PUBLISHED_STATE });
|
|
674
|
-
}
|
|
675
|
-
/**
|
|
676
|
-
* Removes only the published state, leaving the draft intact. Scoped to a
|
|
677
|
-
* single edition when `editionId` is supplied; otherwise unpublishes all editions.
|
|
678
|
-
* To unpublish only the base edition, pass editionId and compositionId as the same value.
|
|
679
|
-
*/
|
|
680
|
-
async unpublish(selector) {
|
|
681
|
-
await this.deleteComposition({ ...selector, state: CANVAS_PUBLISHED_STATE });
|
|
682
|
-
}
|
|
683
|
-
/**
|
|
684
|
-
* Deletes across all states. Scoped to a single edition when `editionId` is
|
|
685
|
-
* supplied; otherwise deletes all states and editions.
|
|
686
|
-
* Use `unpublish` to drop only the published state.
|
|
687
|
-
*/
|
|
688
|
-
async remove(selector) {
|
|
689
|
-
await this.deleteComposition(selector);
|
|
690
|
-
}
|
|
691
|
-
/** Fetches historical versions of a composition or pattern. */
|
|
692
|
-
history(args) {
|
|
693
|
-
const url = this.createUrl(CANVAS_HISTORY_URL, { ...args, projectId: this.options.projectId });
|
|
694
|
-
return this.apiClient(url);
|
|
695
|
-
}
|
|
696
|
-
async deleteComposition(body) {
|
|
697
|
-
const url = this.createUrl(CANVAS_URL);
|
|
698
|
-
await this.apiClient(url, {
|
|
699
|
-
method: "DELETE",
|
|
700
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
701
|
-
expectNoContent: true
|
|
702
|
-
});
|
|
703
|
-
}
|
|
704
|
-
};
|
|
705
|
-
|
|
706
|
-
// src/clients/ContentTypeClient.ts
|
|
707
|
-
var import_api7 = require("@uniformdev/context/api");
|
|
708
|
-
var CONTENT_TYPES_URL = "/api/v1/content-types";
|
|
709
|
-
var ContentTypeClient = class extends ContentClientBase {
|
|
710
|
-
constructor(options) {
|
|
711
|
-
super(
|
|
712
|
-
options,
|
|
713
|
-
/* defaultBypassCache */
|
|
714
|
-
true
|
|
715
|
-
);
|
|
716
|
-
}
|
|
717
|
-
/** Fetches one content type by id (throws `ApiClientError(404)` if absent). */
|
|
718
|
-
async get(args) {
|
|
719
|
-
var _a;
|
|
720
|
-
const url = this.createUrl(CONTENT_TYPES_URL, {
|
|
721
|
-
contentTypeIDs: [args.contentTypeId],
|
|
722
|
-
limit: 1,
|
|
723
|
-
projectId: this.options.projectId
|
|
724
|
-
});
|
|
725
|
-
const res = await this.apiClient(url);
|
|
726
|
-
const contentType = (_a = res.contentTypes) == null ? void 0 : _a[0];
|
|
727
|
-
if (!contentType) {
|
|
728
|
-
throw new import_api7.ApiClientError("Content type not found", "GET", url.toString(), 404, "Not Found");
|
|
729
|
-
}
|
|
730
|
-
return contentType;
|
|
731
|
-
}
|
|
732
|
-
/** Fetches a list of content types. */
|
|
733
|
-
list(args) {
|
|
734
|
-
const url = this.createUrl(CONTENT_TYPES_URL, { ...args, projectId: this.options.projectId });
|
|
735
|
-
return this.apiClient(url);
|
|
736
|
-
}
|
|
737
|
-
/** Creates or updates a content type. */
|
|
738
|
-
async save(body, opts = {}) {
|
|
739
|
-
const url = this.createUrl(CONTENT_TYPES_URL);
|
|
740
|
-
let contentType = body.contentType;
|
|
741
|
-
if (typeof contentType.slugSettings === "object" && contentType.slugSettings !== null && Object.keys(contentType.slugSettings).length === 0) {
|
|
742
|
-
const { slugSettings: _omitEmptySlugSettings, ...rest } = contentType;
|
|
743
|
-
contentType = rest;
|
|
744
|
-
}
|
|
745
|
-
await this.apiClient(url, {
|
|
746
|
-
method: "PUT",
|
|
747
|
-
body: JSON.stringify({ ...body, contentType, projectId: this.options.projectId }),
|
|
748
|
-
expectNoContent: true,
|
|
749
|
-
headers: opts.autogenerateDataTypes ? { "x-uniform-autogenerate-data-types": "true" } : {}
|
|
750
|
-
});
|
|
751
|
-
}
|
|
752
|
-
/** Deletes a content type. */
|
|
753
|
-
async remove(args) {
|
|
754
|
-
const url = this.createUrl(CONTENT_TYPES_URL);
|
|
755
|
-
await this.apiClient(url, {
|
|
756
|
-
method: "DELETE",
|
|
757
|
-
body: JSON.stringify({ ...args, projectId: this.options.projectId }),
|
|
758
|
-
expectNoContent: true
|
|
759
|
-
});
|
|
760
|
-
}
|
|
761
|
-
};
|
|
762
|
-
|
|
763
|
-
// src/clients/EntryDeliveryClient.ts
|
|
764
|
-
var import_api9 = require("@uniformdev/context/api");
|
|
765
|
-
|
|
766
|
-
// src/clients/entryHelpers.ts
|
|
767
|
-
var import_api8 = require("@uniformdev/context/api");
|
|
768
|
-
function resolveEntrySelector(args) {
|
|
769
|
-
if ("entryId" in args) {
|
|
770
|
-
const { entryId, editionId, versionId, ...readOptions2 } = args;
|
|
771
|
-
return {
|
|
772
|
-
readOptions: readOptions2,
|
|
773
|
-
entryIDs: [editionId != null ? editionId : entryId],
|
|
774
|
-
versionId,
|
|
775
|
-
pinnedEdition: editionId !== void 0
|
|
776
|
-
};
|
|
777
|
-
}
|
|
778
|
-
const { slug, ...readOptions } = args;
|
|
779
|
-
return { readOptions, slug, pinnedEdition: false };
|
|
780
|
-
}
|
|
781
|
-
function unwrapSingleEntry(res, url) {
|
|
782
|
-
var _a;
|
|
783
|
-
const entry = (_a = res.entries) == null ? void 0 : _a[0];
|
|
784
|
-
if (!entry) {
|
|
785
|
-
throw new import_api8.ApiClientError("Entry not found", "GET", url.toString(), 404, "Not Found");
|
|
786
|
-
}
|
|
787
|
-
return entry;
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
// src/clients/EntryDeliveryClient.ts
|
|
791
|
-
var ENTRIES_URL = "/api/v1/entries";
|
|
792
|
-
var EntryDeliveryClient = class extends DeliveryClientBase {
|
|
793
|
-
constructor(options) {
|
|
794
|
-
super(options);
|
|
795
|
-
}
|
|
796
|
-
/** Fetches exactly one entry by id or slug (throws `ApiClientError(404)` if absent). */
|
|
797
|
-
async get(args) {
|
|
798
|
-
var _a, _b;
|
|
799
|
-
const { diagnostics, select, ...rest } = args;
|
|
800
|
-
const { entryIDs, slug, versionId, pinnedEdition, readOptions } = resolveEntrySelector(rest);
|
|
801
|
-
const url = this.createUrl(
|
|
802
|
-
ENTRIES_URL,
|
|
803
|
-
{
|
|
804
|
-
...readOptions,
|
|
805
|
-
...projectionToQuery(select),
|
|
806
|
-
projectId: this.options.projectId,
|
|
807
|
-
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
808
|
-
entryIDs,
|
|
809
|
-
slug,
|
|
810
|
-
versionId,
|
|
811
|
-
// A pinned edition is fetched exactly; otherwise locale-best.
|
|
812
|
-
editions: pinnedEdition ? "raw" : "auto",
|
|
813
|
-
// An id lookup wants that exact entity regardless of type, so default the
|
|
814
|
-
// pattern filter to 'any' (origin default `false` would 404 a pattern id).
|
|
815
|
-
// Scoped to id lookups; slug reads keep the origin default. Explicit
|
|
816
|
-
// `pattern` overrides via the `...readOptions` spread above.
|
|
817
|
-
pattern: (_b = args.pattern) != null ? _b : entryIDs ? "any" : void 0,
|
|
818
|
-
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
819
|
-
},
|
|
820
|
-
this.edgeApiHost
|
|
821
|
-
);
|
|
822
|
-
const res = await this.apiClient(url, this.edgeRequestInit);
|
|
823
|
-
return unwrapSingleEntry(res, url);
|
|
824
|
-
}
|
|
825
|
-
/** Fetches a list of entries, optionally filtered. */
|
|
826
|
-
list(args = {}) {
|
|
827
|
-
var _a;
|
|
828
|
-
const { diagnostics, filters, select, ...rest } = args;
|
|
829
|
-
const url = this.createUrl(
|
|
830
|
-
ENTRIES_URL,
|
|
831
|
-
{
|
|
832
|
-
...rest,
|
|
833
|
-
...(0, import_api9.rewriteFiltersForApi)(filters),
|
|
834
|
-
...projectionToQuery(select),
|
|
835
|
-
projectId: this.options.projectId,
|
|
836
|
-
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
837
|
-
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
838
|
-
},
|
|
839
|
-
this.edgeApiHost
|
|
840
|
-
);
|
|
841
|
-
return this.apiClient(url, this.edgeRequestInit);
|
|
842
|
-
}
|
|
843
|
-
};
|
|
844
|
-
|
|
845
|
-
// src/clients/EntryManagementClient.ts
|
|
846
|
-
var import_api10 = require("@uniformdev/context/api");
|
|
847
|
-
var ENTRIES_URL2 = "/api/v1/entries";
|
|
848
|
-
var ENTRIES_HISTORY_URL = "/api/v1/entries-history";
|
|
849
|
-
var EntryManagementClient = class extends ContentClientBase {
|
|
850
|
-
constructor(options) {
|
|
851
|
-
super(
|
|
852
|
-
options,
|
|
853
|
-
/* defaultBypassCache */
|
|
854
|
-
true
|
|
855
|
-
);
|
|
856
|
-
}
|
|
857
|
-
/**
|
|
858
|
-
* Fetches one entry by id or slug in canonical shape (throws
|
|
859
|
-
* `ApiClientError(404)` if absent).
|
|
860
|
-
*/
|
|
861
|
-
async get(args) {
|
|
862
|
-
var _a, _b;
|
|
863
|
-
const { select, ...selectorArgs } = args;
|
|
864
|
-
const { entryIDs, slug, versionId, readOptions, pinnedEdition } = resolveEntrySelector(selectorArgs);
|
|
865
|
-
const url = this.createUrl(ENTRIES_URL2, {
|
|
866
|
-
format: CANONICAL_FORMAT,
|
|
867
|
-
...readOptions,
|
|
868
|
-
...projectionToQuery(select),
|
|
869
|
-
projectId: this.options.projectId,
|
|
870
|
-
state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE,
|
|
871
|
-
editions: resolveManagementEditions({
|
|
872
|
-
explicit: readOptions.editions,
|
|
873
|
-
pinnedEdition,
|
|
874
|
-
hasId: entryIDs != null,
|
|
875
|
-
hasLocale: readOptions.locale != null
|
|
876
|
-
}),
|
|
877
|
-
// An id lookup wants that exact entity regardless of type, so default the
|
|
878
|
-
// pattern filter to 'any' (origin default `false` would 404 a pattern id).
|
|
879
|
-
// Scoped to id lookups; slug reads keep the origin default. Explicit
|
|
880
|
-
// `pattern` overrides via the `...readOptions` spread above.
|
|
881
|
-
pattern: (_b = args.pattern) != null ? _b : entryIDs ? "any" : void 0,
|
|
882
|
-
entryIDs,
|
|
883
|
-
slug,
|
|
884
|
-
versionId
|
|
885
|
-
});
|
|
886
|
-
const res = await this.apiClient(url);
|
|
887
|
-
return unwrapSingleEntry(res, url);
|
|
888
|
-
}
|
|
889
|
-
/** Fetches a list of entries in canonical shape. */
|
|
890
|
-
list(args = {}) {
|
|
891
|
-
var _a;
|
|
892
|
-
const { filters, select, ...rest } = args;
|
|
893
|
-
const url = this.createUrl(ENTRIES_URL2, {
|
|
894
|
-
format: CANONICAL_FORMAT,
|
|
895
|
-
...rest,
|
|
896
|
-
...(0, import_api10.rewriteFiltersForApi)(filters),
|
|
897
|
-
...projectionToQuery(select),
|
|
898
|
-
projectId: this.options.projectId,
|
|
899
|
-
state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE
|
|
900
|
-
});
|
|
901
|
-
return this.apiClient(url);
|
|
902
|
-
}
|
|
903
|
-
/** Creates or updates an entry. Returns the new `x-modified-at` timestamp. */
|
|
904
|
-
async save(body, opts) {
|
|
905
|
-
const url = this.createUrl(ENTRIES_URL2);
|
|
906
|
-
const headers = {};
|
|
907
|
-
if (opts == null ? void 0 : opts.ifUnmodifiedSince) {
|
|
908
|
-
headers["x-if-unmodified-since"] = opts.ifUnmodifiedSince;
|
|
909
|
-
}
|
|
910
|
-
const { response } = await this.apiClientWithResponse(url, {
|
|
911
|
-
method: "PUT",
|
|
912
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
913
|
-
expectNoContent: true,
|
|
914
|
-
headers
|
|
915
|
-
});
|
|
916
|
-
return { modified: response.headers.get("x-modified-at") };
|
|
917
|
-
}
|
|
918
|
-
/** Saves the draft and publishes in one call (two PUTs). */
|
|
919
|
-
async saveAndPublish(body, opts) {
|
|
920
|
-
await this.save({ ...body, state: CANVAS_DRAFT_STATE }, opts);
|
|
921
|
-
return this.save({ ...body, state: CANVAS_PUBLISHED_STATE });
|
|
922
|
-
}
|
|
923
|
-
/**
|
|
924
|
-
* Removes only the published state, leaving the draft intact. Scoped to a
|
|
925
|
-
* single edition when `editionId` is supplied; otherwise unpublishes all editions.
|
|
926
|
-
* To unpublish only the base edition, pass editionId and entryId as the same value.
|
|
927
|
-
*/
|
|
928
|
-
async unpublish(selector) {
|
|
929
|
-
await this.deleteEntry({ ...selector, state: CANVAS_PUBLISHED_STATE });
|
|
930
|
-
}
|
|
931
|
-
/**
|
|
932
|
-
* Deletes across all states. Scoped to a single edition when `editionId` is
|
|
933
|
-
* supplied; otherwise deletes all states and editions.
|
|
934
|
-
* Use `unpublish` to drop only the published state.
|
|
935
|
-
*/
|
|
936
|
-
async remove(selector) {
|
|
937
|
-
await this.deleteEntry(selector);
|
|
938
|
-
}
|
|
939
|
-
/** Fetches historical versions of an entry. */
|
|
940
|
-
history(args) {
|
|
941
|
-
const url = this.createUrl(ENTRIES_HISTORY_URL, { ...args, projectId: this.options.projectId });
|
|
942
|
-
return this.apiClient(url);
|
|
943
|
-
}
|
|
944
|
-
async deleteEntry(body) {
|
|
945
|
-
const url = this.createUrl(ENTRIES_URL2);
|
|
946
|
-
await this.apiClient(url, {
|
|
947
|
-
method: "DELETE",
|
|
948
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
949
|
-
expectNoContent: true
|
|
950
|
-
});
|
|
951
|
-
}
|
|
952
|
-
};
|
|
953
|
-
|
|
954
|
-
// src/clients/deprecated/CanvasClient.ts
|
|
955
|
-
var import_api11 = require("@uniformdev/context/api");
|
|
956
|
-
var CANVAS_URL2 = "/api/v1/canvas";
|
|
957
|
-
var CanvasClient = class extends import_api11.ApiClient {
|
|
308
|
+
var CanvasClient = class extends import_api2.ApiClient {
|
|
958
309
|
constructor(options) {
|
|
959
310
|
var _a;
|
|
960
311
|
if (!options.limitPolicy) {
|
|
@@ -968,10 +319,10 @@ var CanvasClient = class extends import_api11.ApiClient {
|
|
|
968
319
|
async getCompositionList(params = {}) {
|
|
969
320
|
const { projectId } = this.options;
|
|
970
321
|
const { resolveData, filters, select, ...originParams } = params;
|
|
971
|
-
const rewrittenFilters = (0,
|
|
322
|
+
const rewrittenFilters = (0, import_api2.rewriteFiltersForApi)(filters);
|
|
972
323
|
const rewrittenSelect = projectionToQuery(select);
|
|
973
324
|
if (!resolveData) {
|
|
974
|
-
const fetchUri = this.createUrl(
|
|
325
|
+
const fetchUri = this.createUrl(CANVAS_URL, {
|
|
975
326
|
...originParams,
|
|
976
327
|
projectId,
|
|
977
328
|
...rewrittenFilters,
|
|
@@ -1019,7 +370,7 @@ var CanvasClient = class extends import_api11.ApiClient {
|
|
|
1019
370
|
}) {
|
|
1020
371
|
const { projectId } = this.options;
|
|
1021
372
|
if (skipDataResolution) {
|
|
1022
|
-
return this.apiClient(this.createUrl(
|
|
373
|
+
return this.apiClient(this.createUrl(CANVAS_URL, { ...params, projectId }));
|
|
1023
374
|
}
|
|
1024
375
|
const edgeParams = {
|
|
1025
376
|
...params,
|
|
@@ -1031,7 +382,7 @@ var CanvasClient = class extends import_api11.ApiClient {
|
|
|
1031
382
|
}
|
|
1032
383
|
/** Updates or creates a Canvas component definition */
|
|
1033
384
|
async updateComposition(body, options) {
|
|
1034
|
-
const fetchUri = this.createUrl(
|
|
385
|
+
const fetchUri = this.createUrl(CANVAS_URL);
|
|
1035
386
|
const headers = {};
|
|
1036
387
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
1037
388
|
headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
@@ -1046,7 +397,7 @@ var CanvasClient = class extends import_api11.ApiClient {
|
|
|
1046
397
|
}
|
|
1047
398
|
/** Deletes a Canvas component definition */
|
|
1048
399
|
async removeComposition(body) {
|
|
1049
|
-
const fetchUri = this.createUrl(
|
|
400
|
+
const fetchUri = this.createUrl(CANVAS_URL);
|
|
1050
401
|
const { projectId } = this.options;
|
|
1051
402
|
await this.apiClient(fetchUri, {
|
|
1052
403
|
method: "DELETE",
|
|
@@ -1085,10 +436,53 @@ var UncachedCanvasClient = class extends CanvasClient {
|
|
|
1085
436
|
}
|
|
1086
437
|
};
|
|
1087
438
|
|
|
1088
|
-
// src/
|
|
1089
|
-
var
|
|
439
|
+
// src/CategoryClient.ts
|
|
440
|
+
var import_api3 = require("@uniformdev/context/api");
|
|
441
|
+
var CATEGORIES_URL = "/api/v1/categories";
|
|
442
|
+
var CategoryClient = class extends import_api3.ApiClient {
|
|
443
|
+
constructor(options) {
|
|
444
|
+
if (!options.limitPolicy) {
|
|
445
|
+
options.limitPolicy = createLimitPolicy({});
|
|
446
|
+
}
|
|
447
|
+
super(options);
|
|
448
|
+
}
|
|
449
|
+
/** Fetches all categories created in given project */
|
|
450
|
+
async getCategories(options) {
|
|
451
|
+
const { projectId } = this.options;
|
|
452
|
+
const fetchUri = this.createUrl("/api/v1/categories", { ...options, projectId });
|
|
453
|
+
return await this.apiClient(fetchUri);
|
|
454
|
+
}
|
|
455
|
+
/** Updates or creates a category, also used to re-order them */
|
|
456
|
+
async upsertCategories(categories) {
|
|
457
|
+
const { projectId } = this.options;
|
|
458
|
+
const fetchUri = this.createUrl(CATEGORIES_URL);
|
|
459
|
+
return await this.apiClient(fetchUri, {
|
|
460
|
+
method: "PUT",
|
|
461
|
+
body: JSON.stringify({ categories, projectId }),
|
|
462
|
+
expectNoContent: true
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
/** Deletes a category */
|
|
466
|
+
async removeCategory(options) {
|
|
467
|
+
const { projectId } = this.options;
|
|
468
|
+
const fetchUri = this.createUrl(CATEGORIES_URL);
|
|
469
|
+
return await this.apiClient(fetchUri, {
|
|
470
|
+
method: "DELETE",
|
|
471
|
+
body: JSON.stringify({ projectId, categoryId: options.categoryId }),
|
|
472
|
+
expectNoContent: true
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
};
|
|
476
|
+
var UncachedCategoryClient = class extends CategoryClient {
|
|
477
|
+
constructor(options) {
|
|
478
|
+
super({ ...options, bypassCache: true });
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
// src/ContentClient.ts
|
|
483
|
+
var import_api4 = require("@uniformdev/context/api");
|
|
1090
484
|
var _contentTypesUrl, _entriesUrl;
|
|
1091
|
-
var _ContentClient = class _ContentClient extends
|
|
485
|
+
var _ContentClient = class _ContentClient extends import_api4.ApiClient {
|
|
1092
486
|
constructor(options) {
|
|
1093
487
|
var _a;
|
|
1094
488
|
super(options);
|
|
@@ -1102,7 +496,7 @@ var _ContentClient = class _ContentClient extends import_api12.ApiClient {
|
|
|
1102
496
|
getEntries(options) {
|
|
1103
497
|
const { projectId } = this.options;
|
|
1104
498
|
const { skipDataResolution, filters, select, ...params } = options;
|
|
1105
|
-
const rewrittenFilters = (0,
|
|
499
|
+
const rewrittenFilters = (0, import_api4.rewriteFiltersForApi)(filters);
|
|
1106
500
|
const rewrittenSelect = projectionToQuery(select);
|
|
1107
501
|
if (skipDataResolution) {
|
|
1108
502
|
const url = this.createUrl(__privateGet(_ContentClient, _entriesUrl), {
|
|
@@ -1195,31 +589,27 @@ var UncachedContentClient = class extends ContentClient {
|
|
|
1195
589
|
};
|
|
1196
590
|
|
|
1197
591
|
// src/DataSourceClient.ts
|
|
1198
|
-
var
|
|
592
|
+
var import_api5 = require("@uniformdev/context/api");
|
|
1199
593
|
var dataSourceUrl = "/api/v1/data-source";
|
|
1200
594
|
var dataSourcesUrl = "/api/v1/data-sources";
|
|
1201
|
-
var DataSourceClient = class extends
|
|
595
|
+
var DataSourceClient = class extends import_api5.ApiClient {
|
|
1202
596
|
constructor(options) {
|
|
1203
597
|
super(options);
|
|
1204
598
|
}
|
|
1205
|
-
/** Fetches
|
|
599
|
+
/** Fetches all DataSources for a project */
|
|
1206
600
|
async get(options) {
|
|
1207
601
|
const { projectId } = this.options;
|
|
1208
602
|
const fetchUri = this.createUrl(dataSourceUrl, { ...options, projectId });
|
|
1209
603
|
return await this.apiClient(fetchUri);
|
|
1210
604
|
}
|
|
1211
|
-
/** Fetches
|
|
1212
|
-
async
|
|
605
|
+
/** Fetches all DataSources for a project */
|
|
606
|
+
async getList(options) {
|
|
1213
607
|
const { projectId } = this.options;
|
|
1214
608
|
const fetchUri = this.createUrl(dataSourcesUrl, { ...options, projectId });
|
|
1215
609
|
return await this.apiClient(fetchUri);
|
|
1216
610
|
}
|
|
1217
|
-
/** @deprecated Use {@link list} instead. */
|
|
1218
|
-
async getList(options) {
|
|
1219
|
-
return this.list(options);
|
|
1220
|
-
}
|
|
1221
611
|
/** Updates or creates (based on id) a DataSource */
|
|
1222
|
-
async
|
|
612
|
+
async upsert(body) {
|
|
1223
613
|
const fetchUri = this.createUrl(dataSourceUrl);
|
|
1224
614
|
await this.apiClient(fetchUri, {
|
|
1225
615
|
method: "PUT",
|
|
@@ -1227,10 +617,6 @@ var DataSourceClient = class extends import_api13.ApiClient {
|
|
|
1227
617
|
expectNoContent: true
|
|
1228
618
|
});
|
|
1229
619
|
}
|
|
1230
|
-
/** @deprecated Use {@link save} instead. */
|
|
1231
|
-
async upsert(body) {
|
|
1232
|
-
return this.save(body);
|
|
1233
|
-
}
|
|
1234
620
|
/** Deletes a DataSource */
|
|
1235
621
|
async remove(body) {
|
|
1236
622
|
const fetchUri = this.createUrl(dataSourceUrl);
|
|
@@ -1243,24 +629,20 @@ var DataSourceClient = class extends import_api13.ApiClient {
|
|
|
1243
629
|
};
|
|
1244
630
|
|
|
1245
631
|
// src/DataTypeClient.ts
|
|
1246
|
-
var
|
|
632
|
+
var import_api6 = require("@uniformdev/context/api");
|
|
1247
633
|
var _url;
|
|
1248
|
-
var _DataTypeClient = class _DataTypeClient extends
|
|
634
|
+
var _DataTypeClient = class _DataTypeClient extends import_api6.ApiClient {
|
|
1249
635
|
constructor(options) {
|
|
1250
636
|
super(options);
|
|
1251
637
|
}
|
|
1252
|
-
/** Fetches
|
|
1253
|
-
async
|
|
638
|
+
/** Fetches all DataTypes for a project */
|
|
639
|
+
async get(options) {
|
|
1254
640
|
const { projectId } = this.options;
|
|
1255
641
|
const fetchUri = this.createUrl(__privateGet(_DataTypeClient, _url), { ...options, projectId });
|
|
1256
642
|
return await this.apiClient(fetchUri);
|
|
1257
643
|
}
|
|
1258
|
-
/** @deprecated Use {@link list} instead. */
|
|
1259
|
-
async get(options) {
|
|
1260
|
-
return this.list(options);
|
|
1261
|
-
}
|
|
1262
644
|
/** Updates or creates (based on id) a DataType */
|
|
1263
|
-
async
|
|
645
|
+
async upsert(body) {
|
|
1264
646
|
const fetchUri = this.createUrl(__privateGet(_DataTypeClient, _url));
|
|
1265
647
|
await this.apiClient(fetchUri, {
|
|
1266
648
|
method: "PUT",
|
|
@@ -1268,10 +650,6 @@ var _DataTypeClient = class _DataTypeClient extends import_api14.ApiClient {
|
|
|
1268
650
|
expectNoContent: true
|
|
1269
651
|
});
|
|
1270
652
|
}
|
|
1271
|
-
/** @deprecated Use {@link save} instead. */
|
|
1272
|
-
async upsert(body) {
|
|
1273
|
-
return this.save(body);
|
|
1274
|
-
}
|
|
1275
653
|
/** Deletes a DataType */
|
|
1276
654
|
async remove(body) {
|
|
1277
655
|
const fetchUri = this.createUrl(__privateGet(_DataTypeClient, _url));
|
|
@@ -1407,6 +785,61 @@ function getComponentPath(ancestorsAndSelf) {
|
|
|
1407
785
|
return `.${path.join(".")}`;
|
|
1408
786
|
}
|
|
1409
787
|
|
|
788
|
+
// src/utils/constants.ts
|
|
789
|
+
var CANVAS_PERSONALIZE_TYPE = "$personalization";
|
|
790
|
+
var CANVAS_TEST_TYPE = "$test";
|
|
791
|
+
var CANVAS_LOCALIZATION_TYPE = "$localization";
|
|
792
|
+
var CANVAS_SLOT_SECTION_TYPE = "$slotSection";
|
|
793
|
+
var CANVAS_INTENT_TAG_PARAM = "intentTag";
|
|
794
|
+
var CANVAS_LOCALE_TAG_PARAM = "locale";
|
|
795
|
+
var CANVAS_BLOCK_PARAM_TYPE = "$block";
|
|
796
|
+
var CANVAS_PERSONALIZE_SLOT = "pz";
|
|
797
|
+
var CANVAS_TEST_SLOT = "test";
|
|
798
|
+
var CANVAS_LOCALIZATION_SLOT = "localized";
|
|
799
|
+
var CANVAS_SLOT_SECTION_SLOT = "$slotSectionItems";
|
|
800
|
+
var CANVAS_SLOT_SECTION_NAME_PARAM = "name";
|
|
801
|
+
var CANVAS_SLOT_SECTION_MIN_PARAM = "min";
|
|
802
|
+
var CANVAS_SLOT_SECTION_MAX_PARAM = "max";
|
|
803
|
+
var CANVAS_SLOT_SECTION_GROUP_TYPE_PARAM = "groupType";
|
|
804
|
+
var CANVAS_SLOT_SECTION_SPECIFIC_PARAM = "specific";
|
|
805
|
+
var CANVAS_DRAFT_STATE = 0;
|
|
806
|
+
var CANVAS_PUBLISHED_STATE = 64;
|
|
807
|
+
var CANVAS_EDITOR_STATE = 63;
|
|
808
|
+
var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
|
|
809
|
+
var CANVAS_PERSONALIZATION_EVENT_NAME_PARAM = "trackingEventName";
|
|
810
|
+
var CANVAS_PERSONALIZATION_ALGORITHM_PARAM = "algorithm";
|
|
811
|
+
var CANVAS_PERSONALIZATION_ALGORITHM_TYPE = "pzAlgorithm";
|
|
812
|
+
var CANVAS_PERSONALIZATION_TAKE_PARAM = "count";
|
|
813
|
+
var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
|
|
814
|
+
var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
|
|
815
|
+
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
816
|
+
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
817
|
+
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
818
|
+
var CANVAS_CONTEXTUAL_EDITING_PARAM = "$contextualEditing";
|
|
819
|
+
var SECRET_QUERY_STRING_PARAM = "secret";
|
|
820
|
+
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
821
|
+
var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
|
|
822
|
+
var IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM = "is_incontext_editing_forced_settings";
|
|
823
|
+
var IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM = "is_config_check";
|
|
824
|
+
var IN_CONTEXT_EDITOR_COMPONENT_START_ROLE = "uniform-component-start";
|
|
825
|
+
var IN_CONTEXT_EDITOR_COMPONENT_END_ROLE = "uniform-component-end";
|
|
826
|
+
var IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID = "uniform-canvas-preview-script";
|
|
827
|
+
var IS_RENDERED_BY_UNIFORM_ATTRIBUTE = "data-is-rendered-by-uniform";
|
|
828
|
+
var PLACEHOLDER_ID = "placeholder";
|
|
829
|
+
var EMPTY_COMPOSITION = {
|
|
830
|
+
_id: "_empty_composition_id",
|
|
831
|
+
_name: "An empty composition used for contextual editing",
|
|
832
|
+
type: "_empty_composition_type"
|
|
833
|
+
};
|
|
834
|
+
var EDGE_MIN_CACHE_TTL = 10;
|
|
835
|
+
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
836
|
+
var EDGE_DEFAULT_CACHE_TTL = 30;
|
|
837
|
+
var EDGE_CACHE_DISABLED = -1;
|
|
838
|
+
var ASSET_PARAMETER_TYPE = "asset";
|
|
839
|
+
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
|
840
|
+
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
|
841
|
+
var REFERENCE_DATA_TYPE_ID = "uniformContentInternalReference";
|
|
842
|
+
|
|
1410
843
|
// src/utils/guards.ts
|
|
1411
844
|
function isRootEntryReference(root) {
|
|
1412
845
|
return root.type === "root" && isEntryData(root.node);
|
|
@@ -2860,28 +2293,24 @@ function walkPropertyValues(property, visitor) {
|
|
|
2860
2293
|
}
|
|
2861
2294
|
|
|
2862
2295
|
// src/EntityReleasesClient.ts
|
|
2863
|
-
var
|
|
2864
|
-
var
|
|
2865
|
-
var EntityReleasesClient = class extends
|
|
2296
|
+
var import_api7 = require("@uniformdev/context/api");
|
|
2297
|
+
var releaseContentsUrl = "/api/v1/entity-releases";
|
|
2298
|
+
var EntityReleasesClient = class extends import_api7.ApiClient {
|
|
2866
2299
|
constructor(options) {
|
|
2867
2300
|
super(options);
|
|
2868
2301
|
}
|
|
2869
2302
|
/** Fetches entity across all releases (and base) */
|
|
2870
|
-
async
|
|
2303
|
+
async get(options) {
|
|
2871
2304
|
const { projectId } = this.options;
|
|
2872
|
-
const fetchUri = this.createUrl(
|
|
2305
|
+
const fetchUri = this.createUrl(releaseContentsUrl, { ...options, projectId });
|
|
2873
2306
|
return await this.apiClient(fetchUri);
|
|
2874
2307
|
}
|
|
2875
|
-
/** @deprecated Use {@link list} instead. */
|
|
2876
|
-
async get(options) {
|
|
2877
|
-
return this.list(options);
|
|
2878
|
-
}
|
|
2879
2308
|
};
|
|
2880
2309
|
|
|
2881
2310
|
// src/IntegrationPropertyEditorsClient.ts
|
|
2882
|
-
var
|
|
2311
|
+
var import_api8 = require("@uniformdev/context/api");
|
|
2883
2312
|
var _baseUrl;
|
|
2884
|
-
var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient extends
|
|
2313
|
+
var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient extends import_api8.ApiClient {
|
|
2885
2314
|
constructor(options) {
|
|
2886
2315
|
super(options);
|
|
2887
2316
|
this.teamId = options.teamId;
|
|
@@ -2924,21 +2353,17 @@ __privateAdd(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-p
|
|
|
2924
2353
|
var IntegrationPropertyEditorsClient = _IntegrationPropertyEditorsClient;
|
|
2925
2354
|
|
|
2926
2355
|
// src/LabelClient.ts
|
|
2927
|
-
var
|
|
2356
|
+
var import_api9 = require("@uniformdev/context/api");
|
|
2928
2357
|
var LABELS_URL = "/api/v1/labels";
|
|
2929
|
-
var LabelClient = class extends
|
|
2930
|
-
/** Fetches
|
|
2931
|
-
async
|
|
2358
|
+
var LabelClient = class extends import_api9.ApiClient {
|
|
2359
|
+
/** Fetches labels for the current project. */
|
|
2360
|
+
async getLabels(options) {
|
|
2932
2361
|
const { projectId } = this.options;
|
|
2933
2362
|
const fetchUri = this.createUrl(LABELS_URL, { ...options, projectId });
|
|
2934
2363
|
return await this.apiClient(fetchUri);
|
|
2935
2364
|
}
|
|
2936
|
-
/** @deprecated Use {@link list} instead. */
|
|
2937
|
-
async getLabels(options) {
|
|
2938
|
-
return this.list(options);
|
|
2939
|
-
}
|
|
2940
2365
|
/** Updates or creates a label. */
|
|
2941
|
-
async
|
|
2366
|
+
async upsertLabel(body) {
|
|
2942
2367
|
const { projectId } = this.options;
|
|
2943
2368
|
const fetchUri = this.createUrl(LABELS_URL);
|
|
2944
2369
|
await this.apiClient(fetchUri, {
|
|
@@ -2947,12 +2372,8 @@ var LabelClient = class extends import_api17.ApiClient {
|
|
|
2947
2372
|
expectNoContent: true
|
|
2948
2373
|
});
|
|
2949
2374
|
}
|
|
2950
|
-
/** @deprecated Use {@link save} instead. */
|
|
2951
|
-
async upsertLabel(body) {
|
|
2952
|
-
return this.save(body);
|
|
2953
|
-
}
|
|
2954
2375
|
/** Deletes a label by id. */
|
|
2955
|
-
async
|
|
2376
|
+
async removeLabel(options) {
|
|
2956
2377
|
const { projectId } = this.options;
|
|
2957
2378
|
const fetchUri = this.createUrl(LABELS_URL);
|
|
2958
2379
|
await this.apiClient(fetchUri, {
|
|
@@ -2961,10 +2382,6 @@ var LabelClient = class extends import_api17.ApiClient {
|
|
|
2961
2382
|
expectNoContent: true
|
|
2962
2383
|
});
|
|
2963
2384
|
}
|
|
2964
|
-
/** @deprecated Use {@link remove} instead. */
|
|
2965
|
-
async removeLabel(options) {
|
|
2966
|
-
return this.remove(options);
|
|
2967
|
-
}
|
|
2968
2385
|
};
|
|
2969
2386
|
var UncachedLabelClient = class extends LabelClient {
|
|
2970
2387
|
constructor(options) {
|
|
@@ -2973,24 +2390,20 @@ var UncachedLabelClient = class extends LabelClient {
|
|
|
2973
2390
|
};
|
|
2974
2391
|
|
|
2975
2392
|
// src/LocaleClient.ts
|
|
2976
|
-
var
|
|
2393
|
+
var import_api10 = require("@uniformdev/context/api");
|
|
2977
2394
|
var localesUrl = "/api/v1/locales";
|
|
2978
|
-
var LocaleClient = class extends
|
|
2395
|
+
var LocaleClient = class extends import_api10.ApiClient {
|
|
2979
2396
|
constructor(options) {
|
|
2980
2397
|
super(options);
|
|
2981
2398
|
}
|
|
2982
|
-
/** Fetches
|
|
2983
|
-
async
|
|
2399
|
+
/** Fetches all locales for a project */
|
|
2400
|
+
async get(options) {
|
|
2984
2401
|
const { projectId } = this.options;
|
|
2985
2402
|
const fetchUri = this.createUrl(localesUrl, { ...options, projectId });
|
|
2986
2403
|
return await this.apiClient(fetchUri);
|
|
2987
2404
|
}
|
|
2988
|
-
/** @deprecated Use {@link list} instead. */
|
|
2989
|
-
async get(options) {
|
|
2990
|
-
return this.list(options);
|
|
2991
|
-
}
|
|
2992
2405
|
/** Updates or creates (based on id) a locale */
|
|
2993
|
-
async
|
|
2406
|
+
async upsert(body) {
|
|
2994
2407
|
const fetchUri = this.createUrl(localesUrl);
|
|
2995
2408
|
await this.apiClient(fetchUri, {
|
|
2996
2409
|
method: "PUT",
|
|
@@ -2998,10 +2411,6 @@ var LocaleClient = class extends import_api18.ApiClient {
|
|
|
2998
2411
|
expectNoContent: true
|
|
2999
2412
|
});
|
|
3000
2413
|
}
|
|
3001
|
-
/** @deprecated Use {@link save} instead. */
|
|
3002
|
-
async upsert(body) {
|
|
3003
|
-
return this.save(body);
|
|
3004
|
-
}
|
|
3005
2414
|
/** Deletes a locale */
|
|
3006
2415
|
async remove(body) {
|
|
3007
2416
|
const fetchUri = this.createUrl(localesUrl);
|
|
@@ -3385,10 +2794,10 @@ var createCanvasChannel = ({
|
|
|
3385
2794
|
};
|
|
3386
2795
|
|
|
3387
2796
|
// src/PreviewClient.ts
|
|
3388
|
-
var
|
|
2797
|
+
var import_api11 = require("@uniformdev/context/api");
|
|
3389
2798
|
var previewUrlsUrl = "/api/v1/preview-urls";
|
|
3390
2799
|
var previewViewportsUrl = "/api/v1/preview-viewports";
|
|
3391
|
-
var PreviewClient = class extends
|
|
2800
|
+
var PreviewClient = class extends import_api11.ApiClient {
|
|
3392
2801
|
constructor(options) {
|
|
3393
2802
|
super(options);
|
|
3394
2803
|
}
|
|
@@ -3451,9 +2860,9 @@ var PreviewClient = class extends import_api19.ApiClient {
|
|
|
3451
2860
|
};
|
|
3452
2861
|
|
|
3453
2862
|
// src/ProjectClient.ts
|
|
3454
|
-
var
|
|
2863
|
+
var import_api12 = require("@uniformdev/context/api");
|
|
3455
2864
|
var _url2, _projectsUrl;
|
|
3456
|
-
var _ProjectClient = class _ProjectClient extends
|
|
2865
|
+
var _ProjectClient = class _ProjectClient extends import_api12.ApiClient {
|
|
3457
2866
|
constructor(options) {
|
|
3458
2867
|
super({ ...options, bypassCache: true });
|
|
3459
2868
|
}
|
|
@@ -3467,28 +2876,20 @@ var _ProjectClient = class _ProjectClient extends import_api20.ApiClient {
|
|
|
3467
2876
|
* When teamId is provided, returns a single team with its projects.
|
|
3468
2877
|
* When omitted, returns all accessible teams and their projects.
|
|
3469
2878
|
*/
|
|
3470
|
-
async
|
|
2879
|
+
async getProjects(options) {
|
|
3471
2880
|
const fetchUri = this.createUrl(__privateGet(_ProjectClient, _projectsUrl), options ? { ...options } : {});
|
|
3472
2881
|
return await this.apiClient(fetchUri);
|
|
3473
2882
|
}
|
|
3474
|
-
/** @deprecated Use {@link list} instead. */
|
|
3475
|
-
async getProjects(options) {
|
|
3476
|
-
return this.list(options);
|
|
3477
|
-
}
|
|
3478
2883
|
/** Updates or creates (based on id) a Project */
|
|
3479
|
-
async
|
|
2884
|
+
async upsert(body) {
|
|
3480
2885
|
const fetchUri = this.createUrl(__privateGet(_ProjectClient, _url2));
|
|
3481
2886
|
return await this.apiClient(fetchUri, {
|
|
3482
2887
|
method: "PUT",
|
|
3483
2888
|
body: JSON.stringify({ ...body })
|
|
3484
2889
|
});
|
|
3485
2890
|
}
|
|
3486
|
-
/** @deprecated Use {@link save} instead. */
|
|
3487
|
-
async upsert(body) {
|
|
3488
|
-
return this.save(body);
|
|
3489
|
-
}
|
|
3490
2891
|
/** Deletes a Project */
|
|
3491
|
-
async
|
|
2892
|
+
async delete(body) {
|
|
3492
2893
|
const fetchUri = this.createUrl(__privateGet(_ProjectClient, _url2));
|
|
3493
2894
|
await this.apiClient(fetchUri, {
|
|
3494
2895
|
method: "DELETE",
|
|
@@ -3496,10 +2897,6 @@ var _ProjectClient = class _ProjectClient extends import_api20.ApiClient {
|
|
|
3496
2897
|
expectNoContent: true
|
|
3497
2898
|
});
|
|
3498
2899
|
}
|
|
3499
|
-
/** @deprecated Use {@link remove} instead. */
|
|
3500
|
-
async delete(body) {
|
|
3501
|
-
return this.remove(body);
|
|
3502
|
-
}
|
|
3503
2900
|
};
|
|
3504
2901
|
_url2 = new WeakMap();
|
|
3505
2902
|
_projectsUrl = new WeakMap();
|
|
@@ -3675,9 +3072,9 @@ function queryToProjection(source) {
|
|
|
3675
3072
|
}
|
|
3676
3073
|
|
|
3677
3074
|
// src/PromptClient.ts
|
|
3678
|
-
var
|
|
3075
|
+
var import_api13 = require("@uniformdev/context/api");
|
|
3679
3076
|
var PromptsUrl = "/api/v1/prompts";
|
|
3680
|
-
var PromptClient = class extends
|
|
3077
|
+
var PromptClient = class extends import_api13.ApiClient {
|
|
3681
3078
|
constructor(options) {
|
|
3682
3079
|
super(options);
|
|
3683
3080
|
}
|
|
@@ -3708,42 +3105,34 @@ var PromptClient = class extends import_api21.ApiClient {
|
|
|
3708
3105
|
};
|
|
3709
3106
|
|
|
3710
3107
|
// src/RelationshipClient.ts
|
|
3711
|
-
var
|
|
3108
|
+
var import_api14 = require("@uniformdev/context/api");
|
|
3712
3109
|
var RELATIONSHIPS_URL = "/api/v1/relationships";
|
|
3713
|
-
var RelationshipClient = class extends
|
|
3110
|
+
var RelationshipClient = class extends import_api14.ApiClient {
|
|
3714
3111
|
constructor(options) {
|
|
3715
3112
|
super(options);
|
|
3716
|
-
this.
|
|
3113
|
+
this.get = async (options) => {
|
|
3717
3114
|
const { projectId } = this.options;
|
|
3718
3115
|
const url = this.createUrl(RELATIONSHIPS_URL, { ...options, projectId });
|
|
3719
3116
|
return this.apiClient(url);
|
|
3720
3117
|
};
|
|
3721
|
-
/** @deprecated Use {@link list} instead. */
|
|
3722
|
-
this.get = async (options) => {
|
|
3723
|
-
return this.list(options);
|
|
3724
|
-
};
|
|
3725
3118
|
}
|
|
3726
3119
|
};
|
|
3727
3120
|
|
|
3728
3121
|
// src/ReleaseClient.ts
|
|
3729
|
-
var
|
|
3122
|
+
var import_api15 = require("@uniformdev/context/api");
|
|
3730
3123
|
var releasesUrl = "/api/v1/releases";
|
|
3731
|
-
var ReleaseClient = class extends
|
|
3124
|
+
var ReleaseClient = class extends import_api15.ApiClient {
|
|
3732
3125
|
constructor(options) {
|
|
3733
3126
|
super(options);
|
|
3734
3127
|
}
|
|
3735
|
-
/** Fetches
|
|
3736
|
-
async
|
|
3128
|
+
/** Fetches all releases for a project */
|
|
3129
|
+
async get(options) {
|
|
3737
3130
|
const { projectId } = this.options;
|
|
3738
3131
|
const fetchUri = this.createUrl(releasesUrl, { ...options, projectId });
|
|
3739
3132
|
return await this.apiClient(fetchUri);
|
|
3740
3133
|
}
|
|
3741
|
-
/** @deprecated Use {@link list} instead. */
|
|
3742
|
-
async get(options) {
|
|
3743
|
-
return this.list(options);
|
|
3744
|
-
}
|
|
3745
3134
|
/** Updates or creates (based on id) a release */
|
|
3746
|
-
async
|
|
3135
|
+
async upsert(body) {
|
|
3747
3136
|
const fetchUri = this.createUrl(releasesUrl);
|
|
3748
3137
|
await this.apiClient(fetchUri, {
|
|
3749
3138
|
method: "PUT",
|
|
@@ -3751,10 +3140,6 @@ var ReleaseClient = class extends import_api23.ApiClient {
|
|
|
3751
3140
|
expectNoContent: true
|
|
3752
3141
|
});
|
|
3753
3142
|
}
|
|
3754
|
-
/** @deprecated Use {@link save} instead. */
|
|
3755
|
-
async upsert(body) {
|
|
3756
|
-
return this.save(body);
|
|
3757
|
-
}
|
|
3758
3143
|
/** Deletes a release */
|
|
3759
3144
|
async remove(body) {
|
|
3760
3145
|
const fetchUri = this.createUrl(releasesUrl);
|
|
@@ -3776,25 +3161,21 @@ var ReleaseClient = class extends import_api23.ApiClient {
|
|
|
3776
3161
|
};
|
|
3777
3162
|
|
|
3778
3163
|
// src/ReleaseContentsClient.ts
|
|
3779
|
-
var
|
|
3780
|
-
var
|
|
3781
|
-
var ReleaseContentsClient = class extends
|
|
3164
|
+
var import_api16 = require("@uniformdev/context/api");
|
|
3165
|
+
var releaseContentsUrl2 = "/api/v1/release-contents";
|
|
3166
|
+
var ReleaseContentsClient = class extends import_api16.ApiClient {
|
|
3782
3167
|
constructor(options) {
|
|
3783
3168
|
super(options);
|
|
3784
3169
|
}
|
|
3785
|
-
/** Fetches
|
|
3786
|
-
async
|
|
3170
|
+
/** Fetches all entities added to a release */
|
|
3171
|
+
async get(options) {
|
|
3787
3172
|
const { projectId } = this.options;
|
|
3788
|
-
const fetchUri = this.createUrl(
|
|
3173
|
+
const fetchUri = this.createUrl(releaseContentsUrl2, { ...options, projectId });
|
|
3789
3174
|
return await this.apiClient(fetchUri);
|
|
3790
3175
|
}
|
|
3791
|
-
/** @deprecated Use {@link list} instead. */
|
|
3792
|
-
async get(options) {
|
|
3793
|
-
return this.list(options);
|
|
3794
|
-
}
|
|
3795
3176
|
/** Removes a release content from a release */
|
|
3796
3177
|
async remove(body) {
|
|
3797
|
-
const fetchUri = this.createUrl(
|
|
3178
|
+
const fetchUri = this.createUrl(releaseContentsUrl2);
|
|
3798
3179
|
await this.apiClient(fetchUri, {
|
|
3799
3180
|
method: "DELETE",
|
|
3800
3181
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -3804,9 +3185,9 @@ var ReleaseContentsClient = class extends import_api24.ApiClient {
|
|
|
3804
3185
|
};
|
|
3805
3186
|
|
|
3806
3187
|
// src/RouteClient.ts
|
|
3807
|
-
var
|
|
3188
|
+
var import_api17 = require("@uniformdev/context/api");
|
|
3808
3189
|
var ROUTE_URL = "/api/v1/route";
|
|
3809
|
-
var RouteClient = class extends
|
|
3190
|
+
var RouteClient = class extends import_api17.ApiClient {
|
|
3810
3191
|
constructor(options) {
|
|
3811
3192
|
var _a;
|
|
3812
3193
|
if (!options.limitPolicy) {
|
|
@@ -3815,14 +3196,8 @@ var RouteClient = class extends import_api25.ApiClient {
|
|
|
3815
3196
|
super(options);
|
|
3816
3197
|
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
|
|
3817
3198
|
}
|
|
3818
|
-
/**
|
|
3819
|
-
|
|
3820
|
-
*
|
|
3821
|
-
* An optional `select` projection applies to the resolved composition when
|
|
3822
|
-
* the route matches one; redirect / notFound responses pass through
|
|
3823
|
-
* untouched.
|
|
3824
|
-
*/
|
|
3825
|
-
async get(options) {
|
|
3199
|
+
/** Fetches lists of Canvas compositions, optionally by type */
|
|
3200
|
+
async getRoute(options) {
|
|
3826
3201
|
const { projectId } = this.options;
|
|
3827
3202
|
const { select, ...rest } = options != null ? options : {};
|
|
3828
3203
|
const rewrittenSelect = projectionToQuery(select);
|
|
@@ -3832,10 +3207,6 @@ var RouteClient = class extends import_api25.ApiClient {
|
|
|
3832
3207
|
this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
|
|
3833
3208
|
);
|
|
3834
3209
|
}
|
|
3835
|
-
/** @deprecated use {@link RouteClient.get} instead (renamed). */
|
|
3836
|
-
async getRoute(options) {
|
|
3837
|
-
return this.get(options);
|
|
3838
|
-
}
|
|
3839
3210
|
};
|
|
3840
3211
|
|
|
3841
3212
|
// src/types/locales.ts
|
|
@@ -4190,30 +3561,26 @@ function handleRichTextNodeBinding(object, options) {
|
|
|
4190
3561
|
}
|
|
4191
3562
|
|
|
4192
3563
|
// src/index.ts
|
|
4193
|
-
var
|
|
3564
|
+
var import_api19 = require("@uniformdev/context/api");
|
|
4194
3565
|
|
|
4195
3566
|
// src/.version.ts
|
|
4196
|
-
var version = "20.71.
|
|
3567
|
+
var version = "20.71.1";
|
|
4197
3568
|
|
|
4198
3569
|
// src/WorkflowClient.ts
|
|
4199
|
-
var
|
|
3570
|
+
var import_api18 = require("@uniformdev/context/api");
|
|
4200
3571
|
var workflowsUrl = "/api/v1/workflows";
|
|
4201
|
-
var WorkflowClient = class extends
|
|
3572
|
+
var WorkflowClient = class extends import_api18.ApiClient {
|
|
4202
3573
|
constructor(options) {
|
|
4203
3574
|
super(options);
|
|
4204
3575
|
}
|
|
4205
|
-
/** Fetches
|
|
4206
|
-
async
|
|
3576
|
+
/** Fetches workflows for a project */
|
|
3577
|
+
async get(options) {
|
|
4207
3578
|
const { projectId } = this.options;
|
|
4208
3579
|
const fetchUri = this.createUrl(workflowsUrl, { ...options, projectId });
|
|
4209
3580
|
return await this.apiClient(fetchUri);
|
|
4210
3581
|
}
|
|
4211
|
-
/** @deprecated Use {@link list} instead. */
|
|
4212
|
-
async get(options) {
|
|
4213
|
-
return this.list(options);
|
|
4214
|
-
}
|
|
4215
3582
|
/** Updates or creates a workflow definition */
|
|
4216
|
-
async
|
|
3583
|
+
async upsert(body) {
|
|
4217
3584
|
const fetchUri = this.createUrl(workflowsUrl);
|
|
4218
3585
|
await this.apiClient(fetchUri, {
|
|
4219
3586
|
method: "PUT",
|
|
@@ -4221,10 +3588,6 @@ var WorkflowClient = class extends import_api26.ApiClient {
|
|
|
4221
3588
|
expectNoContent: true
|
|
4222
3589
|
});
|
|
4223
3590
|
}
|
|
4224
|
-
/** @deprecated Use {@link save} instead. */
|
|
4225
|
-
async upsert(body) {
|
|
4226
|
-
return this.save(body);
|
|
4227
|
-
}
|
|
4228
3591
|
/** Deletes a workflow definition */
|
|
4229
3592
|
async remove(body) {
|
|
4230
3593
|
const fetchUri = this.createUrl(workflowsUrl);
|
|
@@ -4237,7 +3600,7 @@ var WorkflowClient = class extends import_api26.ApiClient {
|
|
|
4237
3600
|
};
|
|
4238
3601
|
|
|
4239
3602
|
// src/index.ts
|
|
4240
|
-
var CanvasClientError =
|
|
3603
|
+
var CanvasClientError = import_api19.ApiClientError;
|
|
4241
3604
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4242
3605
|
0 && (module.exports = {
|
|
4243
3606
|
ASSETS_SOURCE_CUSTOM_URL,
|
|
@@ -4291,11 +3654,7 @@ var CanvasClientError = import_api27.ApiClientError;
|
|
|
4291
3654
|
CanvasClientError,
|
|
4292
3655
|
CategoryClient,
|
|
4293
3656
|
ChildEnhancerBuilder,
|
|
4294
|
-
ComponentDefinitionClient,
|
|
4295
|
-
CompositionDeliveryClient,
|
|
4296
|
-
CompositionManagementClient,
|
|
4297
3657
|
ContentClient,
|
|
4298
|
-
ContentTypeClient,
|
|
4299
3658
|
DataSourceClient,
|
|
4300
3659
|
DataTypeClient,
|
|
4301
3660
|
EDGE_CACHE_DISABLED,
|
|
@@ -4305,8 +3664,6 @@ var CanvasClientError = import_api27.ApiClientError;
|
|
|
4305
3664
|
EMPTY_COMPOSITION,
|
|
4306
3665
|
EnhancerBuilder,
|
|
4307
3666
|
EntityReleasesClient,
|
|
4308
|
-
EntryDeliveryClient,
|
|
4309
|
-
EntryManagementClient,
|
|
4310
3667
|
IN_CONTEXT_EDITOR_COMPONENT_END_ROLE,
|
|
4311
3668
|
IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
|
|
4312
3669
|
IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM,
|