@uniformdev/canvas 20.72.3-alpha.2 → 20.72.3-alpha.23

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.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/CanvasClient.ts
9
- import { ApiClient, rewriteFiltersForApi } from "@uniformdev/context/api";
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/CanvasClient.ts
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 CanvasClient = class extends ApiClient {
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 = rewriteFiltersForApi(filters);
759
+ const rewrittenFilters = rewriteFiltersForApi5(filters);
117
760
  const rewrittenSelect = projectionToQuery(select);
118
761
  if (!resolveData) {
119
- const fetchUri = this.createUrl(CANVAS_URL, {
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(CANVAS_URL, { ...params, projectId }));
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(CANVAS_URL);
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(CANVAS_URL);
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/CategoryClient.ts
234
- import { ApiClient as ApiClient2 } from "@uniformdev/context/api";
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 ApiClient3 {
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 = rewriteFiltersForApi2(filters);
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 ApiClient4 } from "@uniformdev/context/api";
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 ApiClient4 {
989
+ var DataSourceClient = class extends ApiClient5 {
390
990
  constructor(options) {
391
991
  super(options);
392
992
  }
393
- /** Fetches all DataSources for a project */
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 all DataSources for a project */
400
- async getList(options) {
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 upsert(body) {
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 ApiClient5 } from "@uniformdev/context/api";
1034
+ import { ApiClient as ApiClient6 } from "@uniformdev/context/api";
427
1035
  var _url;
428
- var _DataTypeClient = class _DataTypeClient extends ApiClient5 {
1036
+ var _DataTypeClient = class _DataTypeClient extends ApiClient6 {
429
1037
  constructor(options) {
430
1038
  super(options);
431
1039
  }
432
- /** Fetches all DataTypes for a project */
433
- async get(options) {
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 upsert(body) {
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
  }
@@ -1492,7 +2053,7 @@ function getLocaleMatch(index, locale, greedy) {
1492
2053
  }
1493
2054
  const match = index[locale];
1494
2055
  if (match === void 0 && greedy) {
1495
- return Object.values(index)[0];
2056
+ return Object.values(index).find((value) => value !== void 0);
1496
2057
  }
1497
2058
  return match;
1498
2059
  }
@@ -2087,24 +2648,28 @@ function walkPropertyValues(property, visitor) {
2087
2648
  }
2088
2649
 
2089
2650
  // src/EntityReleasesClient.ts
2090
- import { ApiClient as ApiClient6 } from "@uniformdev/context/api";
2091
- var releaseContentsUrl = "/api/v1/entity-releases";
2092
- var EntityReleasesClient = class extends ApiClient6 {
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 get(options) {
2658
+ async list(options) {
2098
2659
  const { projectId } = this.options;
2099
- const fetchUri = this.createUrl(releaseContentsUrl, { ...options, projectId });
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 ApiClient7 } from "@uniformdev/context/api";
2670
+ import { ApiClient as ApiClient8 } from "@uniformdev/context/api";
2106
2671
  var _baseUrl;
2107
- var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient extends ApiClient7 {
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 ApiClient8 } from "@uniformdev/context/api";
2715
+ import { ApiClient as ApiClient9 } from "@uniformdev/context/api";
2151
2716
  var LABELS_URL = "/api/v1/labels";
2152
- var LabelClient = class extends ApiClient8 {
2153
- /** Fetches labels for the current project. */
2154
- async getLabels(options) {
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 upsertLabel(body) {
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 removeLabel(options) {
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 ApiClient9 } from "@uniformdev/context/api";
2764
+ import { ApiClient as ApiClient10 } from "@uniformdev/context/api";
2188
2765
  var localesUrl = "/api/v1/locales";
2189
- var LocaleClient = class extends ApiClient9 {
2766
+ var LocaleClient = class extends ApiClient10 {
2190
2767
  constructor(options) {
2191
2768
  super(options);
2192
2769
  }
2193
- /** Fetches all locales for a project */
2194
- async get(options) {
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 upsert(body) {
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);
@@ -2588,10 +3173,10 @@ var createCanvasChannel = ({
2588
3173
  };
2589
3174
 
2590
3175
  // src/PreviewClient.ts
2591
- import { ApiClient as ApiClient10 } from "@uniformdev/context/api";
3176
+ import { ApiClient as ApiClient11 } from "@uniformdev/context/api";
2592
3177
  var previewUrlsUrl = "/api/v1/preview-urls";
2593
3178
  var previewViewportsUrl = "/api/v1/preview-viewports";
2594
- var PreviewClient = class extends ApiClient10 {
3179
+ var PreviewClient = class extends ApiClient11 {
2595
3180
  constructor(options) {
2596
3181
  super(options);
2597
3182
  }
@@ -2654,9 +3239,9 @@ var PreviewClient = class extends ApiClient10 {
2654
3239
  };
2655
3240
 
2656
3241
  // src/ProjectClient.ts
2657
- import { ApiClient as ApiClient11 } from "@uniformdev/context/api";
3242
+ import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
2658
3243
  var _url2, _projectsUrl;
2659
- var _ProjectClient = class _ProjectClient extends ApiClient11 {
3244
+ var _ProjectClient = class _ProjectClient extends ApiClient12 {
2660
3245
  constructor(options) {
2661
3246
  super({ ...options, bypassCache: true });
2662
3247
  }
@@ -2670,20 +3255,28 @@ var _ProjectClient = class _ProjectClient extends ApiClient11 {
2670
3255
  * When teamId is provided, returns a single team with its projects.
2671
3256
  * When omitted, returns all accessible teams and their projects.
2672
3257
  */
2673
- async getProjects(options) {
3258
+ async list(options) {
2674
3259
  const fetchUri = this.createUrl(__privateGet(_ProjectClient, _projectsUrl), options ? { ...options } : {});
2675
3260
  return await this.apiClient(fetchUri);
2676
3261
  }
3262
+ /** @deprecated Use {@link list} instead. */
3263
+ async getProjects(options) {
3264
+ return this.list(options);
3265
+ }
2677
3266
  /** Updates or creates (based on id) a Project */
2678
- async upsert(body) {
3267
+ async save(body) {
2679
3268
  const fetchUri = this.createUrl(__privateGet(_ProjectClient, _url2));
2680
3269
  return await this.apiClient(fetchUri, {
2681
3270
  method: "PUT",
2682
3271
  body: JSON.stringify({ ...body })
2683
3272
  });
2684
3273
  }
3274
+ /** @deprecated Use {@link save} instead. */
3275
+ async upsert(body) {
3276
+ return this.save(body);
3277
+ }
2685
3278
  /** Deletes a Project */
2686
- async delete(body) {
3279
+ async remove(body) {
2687
3280
  const fetchUri = this.createUrl(__privateGet(_ProjectClient, _url2));
2688
3281
  await this.apiClient(fetchUri, {
2689
3282
  method: "DELETE",
@@ -2691,6 +3284,10 @@ var _ProjectClient = class _ProjectClient extends ApiClient11 {
2691
3284
  expectNoContent: true
2692
3285
  });
2693
3286
  }
3287
+ /** @deprecated Use {@link remove} instead. */
3288
+ async delete(body) {
3289
+ return this.remove(body);
3290
+ }
2694
3291
  };
2695
3292
  _url2 = new WeakMap();
2696
3293
  _projectsUrl = new WeakMap();
@@ -2881,9 +3478,9 @@ function queryToProjection(source) {
2881
3478
  }
2882
3479
 
2883
3480
  // src/PromptClient.ts
2884
- import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
3481
+ import { ApiClient as ApiClient13 } from "@uniformdev/context/api";
2885
3482
  var PromptsUrl = "/api/v1/prompts";
2886
- var PromptClient = class extends ApiClient12 {
3483
+ var PromptClient = class extends ApiClient13 {
2887
3484
  constructor(options) {
2888
3485
  super(options);
2889
3486
  }
@@ -2914,34 +3511,42 @@ var PromptClient = class extends ApiClient12 {
2914
3511
  };
2915
3512
 
2916
3513
  // src/RelationshipClient.ts
2917
- import { ApiClient as ApiClient13 } from "@uniformdev/context/api";
3514
+ import { ApiClient as ApiClient14 } from "@uniformdev/context/api";
2918
3515
  var RELATIONSHIPS_URL = "/api/v1/relationships";
2919
- var RelationshipClient = class extends ApiClient13 {
3516
+ var RelationshipClient = class extends ApiClient14 {
2920
3517
  constructor(options) {
2921
3518
  super(options);
2922
- this.get = async (options) => {
3519
+ this.list = async (options) => {
2923
3520
  const { projectId } = this.options;
2924
3521
  const url = this.createUrl(RELATIONSHIPS_URL, { ...options, projectId });
2925
3522
  return this.apiClient(url);
2926
3523
  };
3524
+ /** @deprecated Use {@link list} instead. */
3525
+ this.get = async (options) => {
3526
+ return this.list(options);
3527
+ };
2927
3528
  }
2928
3529
  };
2929
3530
 
2930
3531
  // src/ReleaseClient.ts
2931
- import { ApiClient as ApiClient14 } from "@uniformdev/context/api";
3532
+ import { ApiClient as ApiClient15 } from "@uniformdev/context/api";
2932
3533
  var releasesUrl = "/api/v1/releases";
2933
- var ReleaseClient = class extends ApiClient14 {
3534
+ var ReleaseClient = class extends ApiClient15 {
2934
3535
  constructor(options) {
2935
3536
  super(options);
2936
3537
  }
2937
- /** Fetches all releases for a project */
2938
- async get(options) {
3538
+ /** Fetches a list of releases for a project */
3539
+ async list(options) {
2939
3540
  const { projectId } = this.options;
2940
3541
  const fetchUri = this.createUrl(releasesUrl, { ...options, projectId });
2941
3542
  return await this.apiClient(fetchUri);
2942
3543
  }
3544
+ /** @deprecated Use {@link list} instead. */
3545
+ async get(options) {
3546
+ return this.list(options);
3547
+ }
2943
3548
  /** Updates or creates (based on id) a release */
2944
- async upsert(body) {
3549
+ async save(body) {
2945
3550
  const fetchUri = this.createUrl(releasesUrl);
2946
3551
  await this.apiClient(fetchUri, {
2947
3552
  method: "PUT",
@@ -2949,6 +3554,10 @@ var ReleaseClient = class extends ApiClient14 {
2949
3554
  expectNoContent: true
2950
3555
  });
2951
3556
  }
3557
+ /** @deprecated Use {@link save} instead. */
3558
+ async upsert(body) {
3559
+ return this.save(body);
3560
+ }
2952
3561
  /** Deletes a release */
2953
3562
  async remove(body) {
2954
3563
  const fetchUri = this.createUrl(releasesUrl);
@@ -2970,21 +3579,25 @@ var ReleaseClient = class extends ApiClient14 {
2970
3579
  };
2971
3580
 
2972
3581
  // src/ReleaseContentsClient.ts
2973
- import { ApiClient as ApiClient15 } from "@uniformdev/context/api";
2974
- var releaseContentsUrl2 = "/api/v1/release-contents";
2975
- var ReleaseContentsClient = class extends ApiClient15 {
3582
+ import { ApiClient as ApiClient16 } from "@uniformdev/context/api";
3583
+ var releaseContentsUrl = "/api/v1/release-contents";
3584
+ var ReleaseContentsClient = class extends ApiClient16 {
2976
3585
  constructor(options) {
2977
3586
  super(options);
2978
3587
  }
2979
- /** Fetches all entities added to a release */
2980
- async get(options) {
3588
+ /** Fetches a list of entities added to a release */
3589
+ async list(options) {
2981
3590
  const { projectId } = this.options;
2982
- const fetchUri = this.createUrl(releaseContentsUrl2, { ...options, projectId });
3591
+ const fetchUri = this.createUrl(releaseContentsUrl, { ...options, projectId });
2983
3592
  return await this.apiClient(fetchUri);
2984
3593
  }
3594
+ /** @deprecated Use {@link list} instead. */
3595
+ async get(options) {
3596
+ return this.list(options);
3597
+ }
2985
3598
  /** Removes a release content from a release */
2986
3599
  async remove(body) {
2987
- const fetchUri = this.createUrl(releaseContentsUrl2);
3600
+ const fetchUri = this.createUrl(releaseContentsUrl);
2988
3601
  await this.apiClient(fetchUri, {
2989
3602
  method: "DELETE",
2990
3603
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -2994,9 +3607,9 @@ var ReleaseContentsClient = class extends ApiClient15 {
2994
3607
  };
2995
3608
 
2996
3609
  // src/RouteClient.ts
2997
- import { ApiClient as ApiClient16 } from "@uniformdev/context/api";
3610
+ import { ApiClient as ApiClient17 } from "@uniformdev/context/api";
2998
3611
  var ROUTE_URL = "/api/v1/route";
2999
- var RouteClient = class extends ApiClient16 {
3612
+ var RouteClient = class extends ApiClient17 {
3000
3613
  constructor(options) {
3001
3614
  var _a;
3002
3615
  if (!options.limitPolicy) {
@@ -3005,8 +3618,14 @@ var RouteClient = class extends ApiClient16 {
3005
3618
  super(options);
3006
3619
  this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
3007
3620
  }
3008
- /** Fetches lists of Canvas compositions, optionally by type */
3009
- async getRoute(options) {
3621
+ /**
3622
+ * Resolves a route to a composition, redirect, or not-found result.
3623
+ *
3624
+ * An optional `select` projection applies to the resolved composition when
3625
+ * the route matches one; redirect / notFound responses pass through
3626
+ * untouched.
3627
+ */
3628
+ async get(options) {
3010
3629
  const { projectId } = this.options;
3011
3630
  const { select, ...rest } = options != null ? options : {};
3012
3631
  const rewrittenSelect = projectionToQuery(select);
@@ -3016,6 +3635,10 @@ var RouteClient = class extends ApiClient16 {
3016
3635
  this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
3017
3636
  );
3018
3637
  }
3638
+ /** @deprecated use {@link RouteClient.get} instead (renamed). */
3639
+ async getRoute(options) {
3640
+ return this.get(options);
3641
+ }
3019
3642
  };
3020
3643
 
3021
3644
  // src/types/locales.ts
@@ -3174,7 +3797,9 @@ var getParameterAttributes = ({
3174
3797
 
3175
3798
  // src/utils/isAllowedReferrer.ts
3176
3799
  var isAllowedReferrer = (referrer) => {
3177
- return Boolean(referrer == null ? void 0 : referrer.match(/(^https:\/\/|\.)(uniform.app|uniform.wtf|localhost:\d{4})\//));
3800
+ return Boolean(
3801
+ referrer == null ? void 0 : referrer.match(/(^https:\/\/|\.)(uniform.app|uniform.wtf|uniformcode.ai|localhost:\d{4})\//)
3802
+ );
3178
3803
  };
3179
3804
 
3180
3805
  // src/utils/isSystemComponentDefinition.ts
@@ -3370,26 +3995,30 @@ function handleRichTextNodeBinding(object, options) {
3370
3995
  }
3371
3996
 
3372
3997
  // src/index.ts
3373
- import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
3998
+ import { ApiClientError as ApiClientError5 } from "@uniformdev/context/api";
3374
3999
 
3375
4000
  // src/.version.ts
3376
- var version = "20.72.2";
4001
+ var version = "20.73.0";
3377
4002
 
3378
4003
  // src/WorkflowClient.ts
3379
- import { ApiClient as ApiClient17 } from "@uniformdev/context/api";
4004
+ import { ApiClient as ApiClient18 } from "@uniformdev/context/api";
3380
4005
  var workflowsUrl = "/api/v1/workflows";
3381
- var WorkflowClient = class extends ApiClient17 {
4006
+ var WorkflowClient = class extends ApiClient18 {
3382
4007
  constructor(options) {
3383
4008
  super(options);
3384
4009
  }
3385
- /** Fetches workflows for a project */
3386
- async get(options) {
4010
+ /** Fetches a list of workflows for a project */
4011
+ async list(options) {
3387
4012
  const { projectId } = this.options;
3388
4013
  const fetchUri = this.createUrl(workflowsUrl, { ...options, projectId });
3389
4014
  return await this.apiClient(fetchUri);
3390
4015
  }
4016
+ /** @deprecated Use {@link list} instead. */
4017
+ async get(options) {
4018
+ return this.list(options);
4019
+ }
3391
4020
  /** Updates or creates a workflow definition */
3392
- async upsert(body) {
4021
+ async save(body) {
3393
4022
  const fetchUri = this.createUrl(workflowsUrl);
3394
4023
  await this.apiClient(fetchUri, {
3395
4024
  method: "PUT",
@@ -3397,6 +4026,10 @@ var WorkflowClient = class extends ApiClient17 {
3397
4026
  expectNoContent: true
3398
4027
  });
3399
4028
  }
4029
+ /** @deprecated Use {@link save} instead. */
4030
+ async upsert(body) {
4031
+ return this.save(body);
4032
+ }
3400
4033
  /** Deletes a workflow definition */
3401
4034
  async remove(body) {
3402
4035
  const fetchUri = this.createUrl(workflowsUrl);
@@ -3409,7 +4042,7 @@ var WorkflowClient = class extends ApiClient17 {
3409
4042
  };
3410
4043
 
3411
4044
  // src/index.ts
3412
- var CanvasClientError = ApiClientError2;
4045
+ var CanvasClientError = ApiClientError5;
3413
4046
  export {
3414
4047
  ASSETS_SOURCE_CUSTOM_URL,
3415
4048
  ASSETS_SOURCE_UNIFORM,
@@ -3420,7 +4053,7 @@ export {
3420
4053
  ATTRIBUTE_PARAMETER_TYPE,
3421
4054
  ATTRIBUTE_PARAMETER_VALUE,
3422
4055
  ATTRIBUTE_PLACEHOLDER,
3423
- ApiClientError2 as ApiClientError,
4056
+ ApiClientError5 as ApiClientError,
3424
4057
  BatchEntry,
3425
4058
  BlockFormatError,
3426
4059
  CANVAS_BLOCK_PARAM_TYPE,
@@ -3462,7 +4095,11 @@ export {
3462
4095
  CanvasClientError,
3463
4096
  CategoryClient,
3464
4097
  ChildEnhancerBuilder,
4098
+ ComponentDefinitionClient,
4099
+ CompositionDeliveryClient,
4100
+ CompositionManagementClient,
3465
4101
  ContentClient,
4102
+ ContentTypeClient,
3466
4103
  DataSourceClient,
3467
4104
  DataTypeClient,
3468
4105
  EDGE_CACHE_DISABLED,
@@ -3472,6 +4109,8 @@ export {
3472
4109
  EMPTY_COMPOSITION,
3473
4110
  EnhancerBuilder,
3474
4111
  EntityReleasesClient,
4112
+ EntryDeliveryClient,
4113
+ EntryManagementClient,
3475
4114
  IN_CONTEXT_EDITOR_COMPONENT_END_ROLE,
3476
4115
  IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
3477
4116
  IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM,