@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.d.mts +2212 -1460
- package/dist/index.d.ts +2212 -1460
- package/dist/index.esm.js +825 -186
- package/dist/index.js +830 -185
- package/dist/index.mjs +825 -186
- package/package.json +6 -6
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_api27.ApiClientError,
|
|
49
49
|
BatchEntry: () => BatchEntry,
|
|
50
50
|
BlockFormatError: () => BlockFormatError,
|
|
51
51
|
CANVAS_BLOCK_PARAM_TYPE: () => CANVAS_BLOCK_PARAM_TYPE,
|
|
@@ -87,7 +87,11 @@ __export(index_exports, {
|
|
|
87
87
|
CanvasClientError: () => CanvasClientError,
|
|
88
88
|
CategoryClient: () => CategoryClient,
|
|
89
89
|
ChildEnhancerBuilder: () => ChildEnhancerBuilder,
|
|
90
|
+
ComponentDefinitionClient: () => ComponentDefinitionClient,
|
|
91
|
+
CompositionDeliveryClient: () => CompositionDeliveryClient,
|
|
92
|
+
CompositionManagementClient: () => CompositionManagementClient,
|
|
90
93
|
ContentClient: () => ContentClient,
|
|
94
|
+
ContentTypeClient: () => ContentTypeClient,
|
|
91
95
|
DataSourceClient: () => DataSourceClient,
|
|
92
96
|
DataTypeClient: () => DataTypeClient,
|
|
93
97
|
EDGE_CACHE_DISABLED: () => EDGE_CACHE_DISABLED,
|
|
@@ -97,6 +101,8 @@ __export(index_exports, {
|
|
|
97
101
|
EMPTY_COMPOSITION: () => EMPTY_COMPOSITION,
|
|
98
102
|
EnhancerBuilder: () => EnhancerBuilder,
|
|
99
103
|
EntityReleasesClient: () => EntityReleasesClient,
|
|
104
|
+
EntryDeliveryClient: () => EntryDeliveryClient,
|
|
105
|
+
EntryManagementClient: () => EntryManagementClient,
|
|
100
106
|
IN_CONTEXT_EDITOR_COMPONENT_END_ROLE: () => IN_CONTEXT_EDITOR_COMPONENT_END_ROLE,
|
|
101
107
|
IN_CONTEXT_EDITOR_COMPONENT_START_ROLE: () => IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
|
|
102
108
|
IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM: () => IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM,
|
|
@@ -214,7 +220,7 @@ __export(index_exports, {
|
|
|
214
220
|
});
|
|
215
221
|
module.exports = __toCommonJS(index_exports);
|
|
216
222
|
|
|
217
|
-
// src/
|
|
223
|
+
// src/CategoryClient.ts
|
|
218
224
|
var import_api2 = require("@uniformdev/context/api");
|
|
219
225
|
|
|
220
226
|
// src/enhancement/createLimitPolicy.ts
|
|
@@ -258,6 +264,129 @@ function createLimitPolicy({
|
|
|
258
264
|
}
|
|
259
265
|
var nullLimitPolicy = async (func) => await func();
|
|
260
266
|
|
|
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
|
+
|
|
261
390
|
// src/projection/types.ts
|
|
262
391
|
var SELECT_QUERY_PREFIX = "select.";
|
|
263
392
|
|
|
@@ -306,9 +435,529 @@ function projectionToQuery(spec) {
|
|
|
306
435
|
return out;
|
|
307
436
|
}
|
|
308
437
|
|
|
309
|
-
// src/
|
|
438
|
+
// src/utils/constants.ts
|
|
439
|
+
var CANVAS_PERSONALIZE_TYPE = "$personalization";
|
|
440
|
+
var CANVAS_TEST_TYPE = "$test";
|
|
441
|
+
var CANVAS_LOCALIZATION_TYPE = "$localization";
|
|
442
|
+
var CANVAS_SLOT_SECTION_TYPE = "$slotSection";
|
|
443
|
+
var CANVAS_INTENT_TAG_PARAM = "intentTag";
|
|
444
|
+
var CANVAS_LOCALE_TAG_PARAM = "locale";
|
|
445
|
+
var CANVAS_BLOCK_PARAM_TYPE = "$block";
|
|
446
|
+
var CANVAS_PERSONALIZE_SLOT = "pz";
|
|
447
|
+
var CANVAS_TEST_SLOT = "test";
|
|
448
|
+
var CANVAS_LOCALIZATION_SLOT = "localized";
|
|
449
|
+
var CANVAS_SLOT_SECTION_SLOT = "$slotSectionItems";
|
|
450
|
+
var CANVAS_SLOT_SECTION_NAME_PARAM = "name";
|
|
451
|
+
var CANVAS_SLOT_SECTION_MIN_PARAM = "min";
|
|
452
|
+
var CANVAS_SLOT_SECTION_MAX_PARAM = "max";
|
|
453
|
+
var CANVAS_SLOT_SECTION_GROUP_TYPE_PARAM = "groupType";
|
|
454
|
+
var CANVAS_SLOT_SECTION_SPECIFIC_PARAM = "specific";
|
|
455
|
+
var CANVAS_DRAFT_STATE = 0;
|
|
456
|
+
var CANVAS_PUBLISHED_STATE = 64;
|
|
457
|
+
var CANVAS_EDITOR_STATE = 63;
|
|
458
|
+
var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
|
|
459
|
+
var CANVAS_PERSONALIZATION_EVENT_NAME_PARAM = "trackingEventName";
|
|
460
|
+
var CANVAS_PERSONALIZATION_ALGORITHM_PARAM = "algorithm";
|
|
461
|
+
var CANVAS_PERSONALIZATION_ALGORITHM_TYPE = "pzAlgorithm";
|
|
462
|
+
var CANVAS_PERSONALIZATION_TAKE_PARAM = "count";
|
|
463
|
+
var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
|
|
464
|
+
var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
|
|
465
|
+
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
466
|
+
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
467
|
+
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
468
|
+
var CANVAS_CONTEXTUAL_EDITING_PARAM = "$contextualEditing";
|
|
469
|
+
var SECRET_QUERY_STRING_PARAM = "secret";
|
|
470
|
+
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
471
|
+
var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
|
|
472
|
+
var IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM = "is_incontext_editing_forced_settings";
|
|
473
|
+
var IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM = "is_config_check";
|
|
474
|
+
var IN_CONTEXT_EDITOR_COMPONENT_START_ROLE = "uniform-component-start";
|
|
475
|
+
var IN_CONTEXT_EDITOR_COMPONENT_END_ROLE = "uniform-component-end";
|
|
476
|
+
var IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID = "uniform-canvas-preview-script";
|
|
477
|
+
var IS_RENDERED_BY_UNIFORM_ATTRIBUTE = "data-is-rendered-by-uniform";
|
|
478
|
+
var PLACEHOLDER_ID = "placeholder";
|
|
479
|
+
var EMPTY_COMPOSITION = {
|
|
480
|
+
_id: "_empty_composition_id",
|
|
481
|
+
_name: "An empty composition used for contextual editing",
|
|
482
|
+
type: "_empty_composition_type"
|
|
483
|
+
};
|
|
484
|
+
var EDGE_MIN_CACHE_TTL = 10;
|
|
485
|
+
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
486
|
+
var EDGE_DEFAULT_CACHE_TTL = 30;
|
|
487
|
+
var EDGE_CACHE_DISABLED = -1;
|
|
488
|
+
var ASSET_PARAMETER_TYPE = "asset";
|
|
489
|
+
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
|
490
|
+
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
|
491
|
+
var REFERENCE_DATA_TYPE_ID = "uniformContentInternalReference";
|
|
492
|
+
|
|
493
|
+
// src/clients/compositionHelpers.ts
|
|
494
|
+
function resolveCompositionSelector(args) {
|
|
495
|
+
if ("compositionId" in args) {
|
|
496
|
+
const { compositionId, editionId, versionId, ...readOptions } = args;
|
|
497
|
+
return {
|
|
498
|
+
readOptions,
|
|
499
|
+
// raw mode matches on composition OR edition id via the compositionId param
|
|
500
|
+
compositionId: editionId != null ? editionId : compositionId,
|
|
501
|
+
versionId,
|
|
502
|
+
hasCompositionId: true,
|
|
503
|
+
pinnedEdition: editionId !== void 0
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
return { readOptions: args, hasCompositionId: false, pinnedEdition: false };
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
// src/clients/DeliveryClientBase.ts
|
|
510
|
+
var DEFAULT_EDGE_API_HOST = "https://uniform.global";
|
|
511
|
+
var DeliveryClientBase = class extends ContentClientBase {
|
|
512
|
+
constructor(options) {
|
|
513
|
+
var _a;
|
|
514
|
+
super(
|
|
515
|
+
options,
|
|
516
|
+
/* defaultBypassCache */
|
|
517
|
+
false
|
|
518
|
+
);
|
|
519
|
+
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : DEFAULT_EDGE_API_HOST;
|
|
520
|
+
this.edgeRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
|
|
521
|
+
}
|
|
522
|
+
/** Coerces the `diagnostics` option into the shape the edge endpoints accept. */
|
|
523
|
+
coerceDiagnostics(diagnostics) {
|
|
524
|
+
return typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0;
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
// src/clients/CompositionDeliveryClient.ts
|
|
529
|
+
var EDGE_SINGLE_URL = "/api/v1/composition";
|
|
530
|
+
var EDGE_LIST_URL = "/api/v1/compositions";
|
|
531
|
+
var CompositionDeliveryClient = class extends DeliveryClientBase {
|
|
532
|
+
constructor(options) {
|
|
533
|
+
super(options);
|
|
534
|
+
}
|
|
535
|
+
/** Fetches exactly one composition (throws `ApiClientError(404)` if absent). */
|
|
536
|
+
get(args) {
|
|
537
|
+
var _a;
|
|
538
|
+
const { diagnostics, select, ...rest } = args;
|
|
539
|
+
const { readOptions, compositionId, versionId, pinnedEdition } = resolveCompositionSelector(rest);
|
|
540
|
+
const url = this.createUrl(
|
|
541
|
+
EDGE_SINGLE_URL,
|
|
542
|
+
{
|
|
543
|
+
...readOptions,
|
|
544
|
+
...projectionToQuery(select),
|
|
545
|
+
// A pinned edition is folded into compositionId (raw matches edition or
|
|
546
|
+
// composition id); there is no editionId query param on this endpoint.
|
|
547
|
+
compositionId,
|
|
548
|
+
versionId,
|
|
549
|
+
projectId: this.options.projectId,
|
|
550
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
551
|
+
// editionId pins a specific edition for preview; otherwise locale-best.
|
|
552
|
+
editions: pinnedEdition ? "raw" : "auto",
|
|
553
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
554
|
+
},
|
|
555
|
+
this.edgeApiHost
|
|
556
|
+
);
|
|
557
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
558
|
+
}
|
|
559
|
+
/** Fetches a list of compositions, optionally filtered. */
|
|
560
|
+
list(args = {}) {
|
|
561
|
+
var _a;
|
|
562
|
+
const { diagnostics, filters, select, ...rest } = args;
|
|
563
|
+
const url = this.createUrl(
|
|
564
|
+
EDGE_LIST_URL,
|
|
565
|
+
{
|
|
566
|
+
...rest,
|
|
567
|
+
...(0, import_api5.rewriteFiltersForApi)(filters),
|
|
568
|
+
...projectionToQuery(select),
|
|
569
|
+
projectId: this.options.projectId,
|
|
570
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
571
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
572
|
+
},
|
|
573
|
+
this.edgeApiHost
|
|
574
|
+
);
|
|
575
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
576
|
+
}
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
// src/clients/CompositionManagementClient.ts
|
|
580
|
+
var import_api6 = require("@uniformdev/context/api");
|
|
581
|
+
|
|
582
|
+
// src/clients/resolveManagementEditions.ts
|
|
583
|
+
function resolveManagementEditions({
|
|
584
|
+
explicit,
|
|
585
|
+
pinnedEdition,
|
|
586
|
+
hasId,
|
|
587
|
+
hasLocale
|
|
588
|
+
}) {
|
|
589
|
+
if (explicit) {
|
|
590
|
+
return explicit;
|
|
591
|
+
}
|
|
592
|
+
if (pinnedEdition) {
|
|
593
|
+
return "raw";
|
|
594
|
+
}
|
|
595
|
+
if (!hasId) {
|
|
596
|
+
return void 0;
|
|
597
|
+
}
|
|
598
|
+
return hasLocale ? "auto" : "raw";
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
// src/clients/CompositionManagementClient.ts
|
|
310
602
|
var CANVAS_URL = "/api/v1/canvas";
|
|
311
|
-
var
|
|
603
|
+
var CANVAS_HISTORY_URL = "/api/v1/canvas-history";
|
|
604
|
+
var CompositionManagementClient = class extends ContentClientBase {
|
|
605
|
+
constructor(options) {
|
|
606
|
+
super(
|
|
607
|
+
options,
|
|
608
|
+
/* defaultBypassCache */
|
|
609
|
+
true
|
|
610
|
+
);
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Fetches one composition in canonical shape (throws `ApiClientError(404)` if
|
|
614
|
+
* absent).
|
|
615
|
+
*/
|
|
616
|
+
get(args) {
|
|
617
|
+
var _a;
|
|
618
|
+
const { select, ...selectorArgs } = args;
|
|
619
|
+
const { readOptions, compositionId, versionId, hasCompositionId, pinnedEdition } = resolveCompositionSelector(selectorArgs);
|
|
620
|
+
const url = this.createUrl(CANVAS_URL, {
|
|
621
|
+
format: CANONICAL_FORMAT,
|
|
622
|
+
// Caller-supplied shaping flags and non-id selector keys ride along and
|
|
623
|
+
// override the format alias server-side.
|
|
624
|
+
...readOptions,
|
|
625
|
+
...projectionToQuery(select),
|
|
626
|
+
// A pinned edition is folded into compositionId; there is no editionId
|
|
627
|
+
// query param on this endpoint.
|
|
628
|
+
compositionId,
|
|
629
|
+
versionId,
|
|
630
|
+
projectId: this.options.projectId,
|
|
631
|
+
state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE,
|
|
632
|
+
editions: resolveManagementEditions({
|
|
633
|
+
explicit: readOptions.editions,
|
|
634
|
+
pinnedEdition,
|
|
635
|
+
hasId: hasCompositionId,
|
|
636
|
+
hasLocale: readOptions.locale != null
|
|
637
|
+
})
|
|
638
|
+
});
|
|
639
|
+
return this.apiClient(url);
|
|
640
|
+
}
|
|
641
|
+
/** Fetches a list of compositions in canonical shape. */
|
|
642
|
+
list(args = {}) {
|
|
643
|
+
var _a;
|
|
644
|
+
const { filters, select, ...rest } = args;
|
|
645
|
+
const url = this.createUrl(CANVAS_URL, {
|
|
646
|
+
format: CANONICAL_FORMAT,
|
|
647
|
+
...rest,
|
|
648
|
+
...(0, import_api6.rewriteFiltersForApi)(filters),
|
|
649
|
+
...projectionToQuery(select),
|
|
650
|
+
projectId: this.options.projectId,
|
|
651
|
+
state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE
|
|
652
|
+
});
|
|
653
|
+
return this.apiClient(url);
|
|
654
|
+
}
|
|
655
|
+
/** Creates or updates a composition. Returns the new `x-modified-at` timestamp. */
|
|
656
|
+
async save(body, opts) {
|
|
657
|
+
const url = this.createUrl(CANVAS_URL);
|
|
658
|
+
const headers = {};
|
|
659
|
+
if (opts == null ? void 0 : opts.ifUnmodifiedSince) {
|
|
660
|
+
headers["x-if-unmodified-since"] = opts.ifUnmodifiedSince;
|
|
661
|
+
}
|
|
662
|
+
const { response } = await this.apiClientWithResponse(url, {
|
|
663
|
+
method: "PUT",
|
|
664
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
665
|
+
expectNoContent: true,
|
|
666
|
+
headers
|
|
667
|
+
});
|
|
668
|
+
return { modified: response.headers.get("x-modified-at") };
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* Saves the draft and publishes in one call (two PUTs). The optimistic
|
|
672
|
+
* concurrency guard, if any, applies to the draft write.
|
|
673
|
+
*/
|
|
674
|
+
async saveAndPublish(body, opts) {
|
|
675
|
+
await this.save({ ...body, state: CANVAS_DRAFT_STATE }, opts);
|
|
676
|
+
return this.save({ ...body, state: CANVAS_PUBLISHED_STATE });
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Removes only the published state, leaving the draft intact. Scoped to a
|
|
680
|
+
* single edition when `editionId` is supplied; otherwise unpublishes all editions.
|
|
681
|
+
* To unpublish only the base edition, pass editionId and compositionId as the same value.
|
|
682
|
+
*/
|
|
683
|
+
async unpublish(selector) {
|
|
684
|
+
await this.deleteComposition({ ...selector, state: CANVAS_PUBLISHED_STATE });
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Deletes across all states. Scoped to a single edition when `editionId` is
|
|
688
|
+
* supplied; otherwise deletes all states and editions.
|
|
689
|
+
* Use `unpublish` to drop only the published state.
|
|
690
|
+
*/
|
|
691
|
+
async remove(selector) {
|
|
692
|
+
await this.deleteComposition(selector);
|
|
693
|
+
}
|
|
694
|
+
/** Fetches historical versions of a composition or pattern. */
|
|
695
|
+
history(args) {
|
|
696
|
+
const url = this.createUrl(CANVAS_HISTORY_URL, { ...args, projectId: this.options.projectId });
|
|
697
|
+
return this.apiClient(url);
|
|
698
|
+
}
|
|
699
|
+
async deleteComposition(body) {
|
|
700
|
+
const url = this.createUrl(CANVAS_URL);
|
|
701
|
+
await this.apiClient(url, {
|
|
702
|
+
method: "DELETE",
|
|
703
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
704
|
+
expectNoContent: true
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
};
|
|
708
|
+
|
|
709
|
+
// src/clients/ContentTypeClient.ts
|
|
710
|
+
var import_api7 = require("@uniformdev/context/api");
|
|
711
|
+
var CONTENT_TYPES_URL = "/api/v1/content-types";
|
|
712
|
+
var ContentTypeClient = class extends ContentClientBase {
|
|
713
|
+
constructor(options) {
|
|
714
|
+
super(
|
|
715
|
+
options,
|
|
716
|
+
/* defaultBypassCache */
|
|
717
|
+
true
|
|
718
|
+
);
|
|
719
|
+
}
|
|
720
|
+
/** Fetches one content type by id (throws `ApiClientError(404)` if absent). */
|
|
721
|
+
async get(args) {
|
|
722
|
+
var _a;
|
|
723
|
+
const url = this.createUrl(CONTENT_TYPES_URL, {
|
|
724
|
+
contentTypeIDs: [args.contentTypeId],
|
|
725
|
+
limit: 1,
|
|
726
|
+
projectId: this.options.projectId
|
|
727
|
+
});
|
|
728
|
+
const res = await this.apiClient(url);
|
|
729
|
+
const contentType = (_a = res.contentTypes) == null ? void 0 : _a[0];
|
|
730
|
+
if (!contentType) {
|
|
731
|
+
throw new import_api7.ApiClientError("Content type not found", "GET", url.toString(), 404, "Not Found");
|
|
732
|
+
}
|
|
733
|
+
return contentType;
|
|
734
|
+
}
|
|
735
|
+
/** Fetches a list of content types. */
|
|
736
|
+
list(args) {
|
|
737
|
+
const url = this.createUrl(CONTENT_TYPES_URL, { ...args, projectId: this.options.projectId });
|
|
738
|
+
return this.apiClient(url);
|
|
739
|
+
}
|
|
740
|
+
/** Creates or updates a content type. */
|
|
741
|
+
async save(body, opts = {}) {
|
|
742
|
+
const url = this.createUrl(CONTENT_TYPES_URL);
|
|
743
|
+
let contentType = body.contentType;
|
|
744
|
+
if (typeof contentType.slugSettings === "object" && contentType.slugSettings !== null && Object.keys(contentType.slugSettings).length === 0) {
|
|
745
|
+
const { slugSettings: _omitEmptySlugSettings, ...rest } = contentType;
|
|
746
|
+
contentType = rest;
|
|
747
|
+
}
|
|
748
|
+
await this.apiClient(url, {
|
|
749
|
+
method: "PUT",
|
|
750
|
+
body: JSON.stringify({ ...body, contentType, projectId: this.options.projectId }),
|
|
751
|
+
expectNoContent: true,
|
|
752
|
+
headers: opts.autogenerateDataTypes ? { "x-uniform-autogenerate-data-types": "true" } : {}
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
/** Deletes a content type. */
|
|
756
|
+
async remove(args) {
|
|
757
|
+
const url = this.createUrl(CONTENT_TYPES_URL);
|
|
758
|
+
await this.apiClient(url, {
|
|
759
|
+
method: "DELETE",
|
|
760
|
+
body: JSON.stringify({ ...args, projectId: this.options.projectId }),
|
|
761
|
+
expectNoContent: true
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
};
|
|
765
|
+
|
|
766
|
+
// src/clients/EntryDeliveryClient.ts
|
|
767
|
+
var import_api9 = require("@uniformdev/context/api");
|
|
768
|
+
|
|
769
|
+
// src/clients/entryHelpers.ts
|
|
770
|
+
var import_api8 = require("@uniformdev/context/api");
|
|
771
|
+
function resolveEntrySelector(args) {
|
|
772
|
+
if ("entryId" in args) {
|
|
773
|
+
const { entryId, editionId, versionId, ...readOptions2 } = args;
|
|
774
|
+
return {
|
|
775
|
+
readOptions: readOptions2,
|
|
776
|
+
entryIDs: [editionId != null ? editionId : entryId],
|
|
777
|
+
versionId,
|
|
778
|
+
pinnedEdition: editionId !== void 0
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
const { slug, ...readOptions } = args;
|
|
782
|
+
return { readOptions, slug, pinnedEdition: false };
|
|
783
|
+
}
|
|
784
|
+
function unwrapSingleEntry(res, url) {
|
|
785
|
+
var _a;
|
|
786
|
+
const entry = (_a = res.entries) == null ? void 0 : _a[0];
|
|
787
|
+
if (!entry) {
|
|
788
|
+
throw new import_api8.ApiClientError("Entry not found", "GET", url.toString(), 404, "Not Found");
|
|
789
|
+
}
|
|
790
|
+
return entry;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
// src/clients/EntryDeliveryClient.ts
|
|
794
|
+
var ENTRIES_URL = "/api/v1/entries";
|
|
795
|
+
var EntryDeliveryClient = class extends DeliveryClientBase {
|
|
796
|
+
constructor(options) {
|
|
797
|
+
super(options);
|
|
798
|
+
}
|
|
799
|
+
/** Fetches exactly one entry by id or slug (throws `ApiClientError(404)` if absent). */
|
|
800
|
+
async get(args) {
|
|
801
|
+
var _a, _b;
|
|
802
|
+
const { diagnostics, select, ...rest } = args;
|
|
803
|
+
const { entryIDs, slug, versionId, pinnedEdition, readOptions } = resolveEntrySelector(rest);
|
|
804
|
+
const url = this.createUrl(
|
|
805
|
+
ENTRIES_URL,
|
|
806
|
+
{
|
|
807
|
+
...readOptions,
|
|
808
|
+
...projectionToQuery(select),
|
|
809
|
+
projectId: this.options.projectId,
|
|
810
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
811
|
+
entryIDs,
|
|
812
|
+
slug,
|
|
813
|
+
versionId,
|
|
814
|
+
// A pinned edition is fetched exactly; otherwise locale-best.
|
|
815
|
+
editions: pinnedEdition ? "raw" : "auto",
|
|
816
|
+
// An id lookup wants that exact entity regardless of type, so default the
|
|
817
|
+
// pattern filter to 'any' (origin default `false` would 404 a pattern id).
|
|
818
|
+
// Scoped to id lookups; slug reads keep the origin default. Explicit
|
|
819
|
+
// `pattern` overrides via the `...readOptions` spread above.
|
|
820
|
+
pattern: (_b = args.pattern) != null ? _b : entryIDs ? "any" : void 0,
|
|
821
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
822
|
+
},
|
|
823
|
+
this.edgeApiHost
|
|
824
|
+
);
|
|
825
|
+
const res = await this.apiClient(url, this.edgeRequestInit);
|
|
826
|
+
return unwrapSingleEntry(res, url);
|
|
827
|
+
}
|
|
828
|
+
/** Fetches a list of entries, optionally filtered. */
|
|
829
|
+
list(args = {}) {
|
|
830
|
+
var _a;
|
|
831
|
+
const { diagnostics, filters, select, ...rest } = args;
|
|
832
|
+
const url = this.createUrl(
|
|
833
|
+
ENTRIES_URL,
|
|
834
|
+
{
|
|
835
|
+
...rest,
|
|
836
|
+
...(0, import_api9.rewriteFiltersForApi)(filters),
|
|
837
|
+
...projectionToQuery(select),
|
|
838
|
+
projectId: this.options.projectId,
|
|
839
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
840
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
841
|
+
},
|
|
842
|
+
this.edgeApiHost
|
|
843
|
+
);
|
|
844
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
845
|
+
}
|
|
846
|
+
};
|
|
847
|
+
|
|
848
|
+
// src/clients/EntryManagementClient.ts
|
|
849
|
+
var import_api10 = require("@uniformdev/context/api");
|
|
850
|
+
var ENTRIES_URL2 = "/api/v1/entries";
|
|
851
|
+
var ENTRIES_HISTORY_URL = "/api/v1/entries-history";
|
|
852
|
+
var EntryManagementClient = class extends ContentClientBase {
|
|
853
|
+
constructor(options) {
|
|
854
|
+
super(
|
|
855
|
+
options,
|
|
856
|
+
/* defaultBypassCache */
|
|
857
|
+
true
|
|
858
|
+
);
|
|
859
|
+
}
|
|
860
|
+
/**
|
|
861
|
+
* Fetches one entry by id or slug in canonical shape (throws
|
|
862
|
+
* `ApiClientError(404)` if absent).
|
|
863
|
+
*/
|
|
864
|
+
async get(args) {
|
|
865
|
+
var _a, _b;
|
|
866
|
+
const { select, ...selectorArgs } = args;
|
|
867
|
+
const { entryIDs, slug, versionId, readOptions, pinnedEdition } = resolveEntrySelector(selectorArgs);
|
|
868
|
+
const url = this.createUrl(ENTRIES_URL2, {
|
|
869
|
+
format: CANONICAL_FORMAT,
|
|
870
|
+
...readOptions,
|
|
871
|
+
...projectionToQuery(select),
|
|
872
|
+
projectId: this.options.projectId,
|
|
873
|
+
state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE,
|
|
874
|
+
editions: resolveManagementEditions({
|
|
875
|
+
explicit: readOptions.editions,
|
|
876
|
+
pinnedEdition,
|
|
877
|
+
hasId: entryIDs != null,
|
|
878
|
+
hasLocale: readOptions.locale != null
|
|
879
|
+
}),
|
|
880
|
+
// An id lookup wants that exact entity regardless of type, so default the
|
|
881
|
+
// pattern filter to 'any' (origin default `false` would 404 a pattern id).
|
|
882
|
+
// Scoped to id lookups; slug reads keep the origin default. Explicit
|
|
883
|
+
// `pattern` overrides via the `...readOptions` spread above.
|
|
884
|
+
pattern: (_b = args.pattern) != null ? _b : entryIDs ? "any" : void 0,
|
|
885
|
+
entryIDs,
|
|
886
|
+
slug,
|
|
887
|
+
versionId
|
|
888
|
+
});
|
|
889
|
+
const res = await this.apiClient(url);
|
|
890
|
+
return unwrapSingleEntry(res, url);
|
|
891
|
+
}
|
|
892
|
+
/** Fetches a list of entries in canonical shape. */
|
|
893
|
+
list(args = {}) {
|
|
894
|
+
var _a;
|
|
895
|
+
const { filters, select, ...rest } = args;
|
|
896
|
+
const url = this.createUrl(ENTRIES_URL2, {
|
|
897
|
+
format: CANONICAL_FORMAT,
|
|
898
|
+
...rest,
|
|
899
|
+
...(0, import_api10.rewriteFiltersForApi)(filters),
|
|
900
|
+
...projectionToQuery(select),
|
|
901
|
+
projectId: this.options.projectId,
|
|
902
|
+
state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE
|
|
903
|
+
});
|
|
904
|
+
return this.apiClient(url);
|
|
905
|
+
}
|
|
906
|
+
/** Creates or updates an entry. Returns the new `x-modified-at` timestamp. */
|
|
907
|
+
async save(body, opts) {
|
|
908
|
+
const url = this.createUrl(ENTRIES_URL2);
|
|
909
|
+
const headers = {};
|
|
910
|
+
if (opts == null ? void 0 : opts.ifUnmodifiedSince) {
|
|
911
|
+
headers["x-if-unmodified-since"] = opts.ifUnmodifiedSince;
|
|
912
|
+
}
|
|
913
|
+
const { response } = await this.apiClientWithResponse(url, {
|
|
914
|
+
method: "PUT",
|
|
915
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
916
|
+
expectNoContent: true,
|
|
917
|
+
headers
|
|
918
|
+
});
|
|
919
|
+
return { modified: response.headers.get("x-modified-at") };
|
|
920
|
+
}
|
|
921
|
+
/** Saves the draft and publishes in one call (two PUTs). */
|
|
922
|
+
async saveAndPublish(body, opts) {
|
|
923
|
+
await this.save({ ...body, state: CANVAS_DRAFT_STATE }, opts);
|
|
924
|
+
return this.save({ ...body, state: CANVAS_PUBLISHED_STATE });
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Removes only the published state, leaving the draft intact. Scoped to a
|
|
928
|
+
* single edition when `editionId` is supplied; otherwise unpublishes all editions.
|
|
929
|
+
* To unpublish only the base edition, pass editionId and entryId as the same value.
|
|
930
|
+
*/
|
|
931
|
+
async unpublish(selector) {
|
|
932
|
+
await this.deleteEntry({ ...selector, state: CANVAS_PUBLISHED_STATE });
|
|
933
|
+
}
|
|
934
|
+
/**
|
|
935
|
+
* Deletes across all states. Scoped to a single edition when `editionId` is
|
|
936
|
+
* supplied; otherwise deletes all states and editions.
|
|
937
|
+
* Use `unpublish` to drop only the published state.
|
|
938
|
+
*/
|
|
939
|
+
async remove(selector) {
|
|
940
|
+
await this.deleteEntry(selector);
|
|
941
|
+
}
|
|
942
|
+
/** Fetches historical versions of an entry. */
|
|
943
|
+
history(args) {
|
|
944
|
+
const url = this.createUrl(ENTRIES_HISTORY_URL, { ...args, projectId: this.options.projectId });
|
|
945
|
+
return this.apiClient(url);
|
|
946
|
+
}
|
|
947
|
+
async deleteEntry(body) {
|
|
948
|
+
const url = this.createUrl(ENTRIES_URL2);
|
|
949
|
+
await this.apiClient(url, {
|
|
950
|
+
method: "DELETE",
|
|
951
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
952
|
+
expectNoContent: true
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
};
|
|
956
|
+
|
|
957
|
+
// src/clients/deprecated/CanvasClient.ts
|
|
958
|
+
var import_api11 = require("@uniformdev/context/api");
|
|
959
|
+
var CANVAS_URL2 = "/api/v1/canvas";
|
|
960
|
+
var CanvasClient = class extends import_api11.ApiClient {
|
|
312
961
|
constructor(options) {
|
|
313
962
|
var _a;
|
|
314
963
|
if (!options.limitPolicy) {
|
|
@@ -322,10 +971,10 @@ var CanvasClient = class extends import_api2.ApiClient {
|
|
|
322
971
|
async getCompositionList(params = {}) {
|
|
323
972
|
const { projectId } = this.options;
|
|
324
973
|
const { resolveData, filters, select, ...originParams } = params;
|
|
325
|
-
const rewrittenFilters = (0,
|
|
974
|
+
const rewrittenFilters = (0, import_api11.rewriteFiltersForApi)(filters);
|
|
326
975
|
const rewrittenSelect = projectionToQuery(select);
|
|
327
976
|
if (!resolveData) {
|
|
328
|
-
const fetchUri = this.createUrl(
|
|
977
|
+
const fetchUri = this.createUrl(CANVAS_URL2, {
|
|
329
978
|
...originParams,
|
|
330
979
|
projectId,
|
|
331
980
|
...rewrittenFilters,
|
|
@@ -373,7 +1022,7 @@ var CanvasClient = class extends import_api2.ApiClient {
|
|
|
373
1022
|
}) {
|
|
374
1023
|
const { projectId } = this.options;
|
|
375
1024
|
if (skipDataResolution) {
|
|
376
|
-
return this.apiClient(this.createUrl(
|
|
1025
|
+
return this.apiClient(this.createUrl(CANVAS_URL2, { ...params, projectId }));
|
|
377
1026
|
}
|
|
378
1027
|
const edgeParams = {
|
|
379
1028
|
...params,
|
|
@@ -385,7 +1034,7 @@ var CanvasClient = class extends import_api2.ApiClient {
|
|
|
385
1034
|
}
|
|
386
1035
|
/** Updates or creates a Canvas component definition */
|
|
387
1036
|
async updateComposition(body, options) {
|
|
388
|
-
const fetchUri = this.createUrl(
|
|
1037
|
+
const fetchUri = this.createUrl(CANVAS_URL2);
|
|
389
1038
|
const headers = {};
|
|
390
1039
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
391
1040
|
headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
@@ -400,7 +1049,7 @@ var CanvasClient = class extends import_api2.ApiClient {
|
|
|
400
1049
|
}
|
|
401
1050
|
/** Deletes a Canvas component definition */
|
|
402
1051
|
async removeComposition(body) {
|
|
403
|
-
const fetchUri = this.createUrl(
|
|
1052
|
+
const fetchUri = this.createUrl(CANVAS_URL2);
|
|
404
1053
|
const { projectId } = this.options;
|
|
405
1054
|
await this.apiClient(fetchUri, {
|
|
406
1055
|
method: "DELETE",
|
|
@@ -439,53 +1088,10 @@ var UncachedCanvasClient = class extends CanvasClient {
|
|
|
439
1088
|
}
|
|
440
1089
|
};
|
|
441
1090
|
|
|
442
|
-
// src/
|
|
443
|
-
var
|
|
444
|
-
var CATEGORIES_URL = "/api/v1/categories";
|
|
445
|
-
var CategoryClient = class extends import_api3.ApiClient {
|
|
446
|
-
constructor(options) {
|
|
447
|
-
if (!options.limitPolicy) {
|
|
448
|
-
options.limitPolicy = createLimitPolicy({});
|
|
449
|
-
}
|
|
450
|
-
super(options);
|
|
451
|
-
}
|
|
452
|
-
/** Fetches all categories created in given project */
|
|
453
|
-
async getCategories(options) {
|
|
454
|
-
const { projectId } = this.options;
|
|
455
|
-
const fetchUri = this.createUrl("/api/v1/categories", { ...options, projectId });
|
|
456
|
-
return await this.apiClient(fetchUri);
|
|
457
|
-
}
|
|
458
|
-
/** Updates or creates a category, also used to re-order them */
|
|
459
|
-
async upsertCategories(categories) {
|
|
460
|
-
const { projectId } = this.options;
|
|
461
|
-
const fetchUri = this.createUrl(CATEGORIES_URL);
|
|
462
|
-
return await this.apiClient(fetchUri, {
|
|
463
|
-
method: "PUT",
|
|
464
|
-
body: JSON.stringify({ categories, projectId }),
|
|
465
|
-
expectNoContent: true
|
|
466
|
-
});
|
|
467
|
-
}
|
|
468
|
-
/** Deletes a category */
|
|
469
|
-
async removeCategory(options) {
|
|
470
|
-
const { projectId } = this.options;
|
|
471
|
-
const fetchUri = this.createUrl(CATEGORIES_URL);
|
|
472
|
-
return await this.apiClient(fetchUri, {
|
|
473
|
-
method: "DELETE",
|
|
474
|
-
body: JSON.stringify({ projectId, categoryId: options.categoryId }),
|
|
475
|
-
expectNoContent: true
|
|
476
|
-
});
|
|
477
|
-
}
|
|
478
|
-
};
|
|
479
|
-
var UncachedCategoryClient = class extends CategoryClient {
|
|
480
|
-
constructor(options) {
|
|
481
|
-
super({ ...options, bypassCache: true });
|
|
482
|
-
}
|
|
483
|
-
};
|
|
484
|
-
|
|
485
|
-
// src/ContentClient.ts
|
|
486
|
-
var import_api4 = require("@uniformdev/context/api");
|
|
1091
|
+
// src/clients/deprecated/ContentClient.ts
|
|
1092
|
+
var import_api12 = require("@uniformdev/context/api");
|
|
487
1093
|
var _contentTypesUrl, _entriesUrl;
|
|
488
|
-
var _ContentClient = class _ContentClient extends
|
|
1094
|
+
var _ContentClient = class _ContentClient extends import_api12.ApiClient {
|
|
489
1095
|
constructor(options) {
|
|
490
1096
|
var _a;
|
|
491
1097
|
super(options);
|
|
@@ -499,7 +1105,7 @@ var _ContentClient = class _ContentClient extends import_api4.ApiClient {
|
|
|
499
1105
|
getEntries(options) {
|
|
500
1106
|
const { projectId } = this.options;
|
|
501
1107
|
const { skipDataResolution, filters, select, ...params } = options;
|
|
502
|
-
const rewrittenFilters = (0,
|
|
1108
|
+
const rewrittenFilters = (0, import_api12.rewriteFiltersForApi)(filters);
|
|
503
1109
|
const rewrittenSelect = projectionToQuery(select);
|
|
504
1110
|
if (skipDataResolution) {
|
|
505
1111
|
const url = this.createUrl(__privateGet(_ContentClient, _entriesUrl), {
|
|
@@ -592,27 +1198,31 @@ var UncachedContentClient = class extends ContentClient {
|
|
|
592
1198
|
};
|
|
593
1199
|
|
|
594
1200
|
// src/DataSourceClient.ts
|
|
595
|
-
var
|
|
1201
|
+
var import_api13 = require("@uniformdev/context/api");
|
|
596
1202
|
var dataSourceUrl = "/api/v1/data-source";
|
|
597
1203
|
var dataSourcesUrl = "/api/v1/data-sources";
|
|
598
|
-
var DataSourceClient = class extends
|
|
1204
|
+
var DataSourceClient = class extends import_api13.ApiClient {
|
|
599
1205
|
constructor(options) {
|
|
600
1206
|
super(options);
|
|
601
1207
|
}
|
|
602
|
-
/** Fetches
|
|
1208
|
+
/** Fetches a single DataSource by id (with decrypted secrets). */
|
|
603
1209
|
async get(options) {
|
|
604
1210
|
const { projectId } = this.options;
|
|
605
1211
|
const fetchUri = this.createUrl(dataSourceUrl, { ...options, projectId });
|
|
606
1212
|
return await this.apiClient(fetchUri);
|
|
607
1213
|
}
|
|
608
|
-
/** Fetches
|
|
609
|
-
async
|
|
1214
|
+
/** Fetches the list of DataSources for a project (secrets masked). */
|
|
1215
|
+
async list(options) {
|
|
610
1216
|
const { projectId } = this.options;
|
|
611
1217
|
const fetchUri = this.createUrl(dataSourcesUrl, { ...options, projectId });
|
|
612
1218
|
return await this.apiClient(fetchUri);
|
|
613
1219
|
}
|
|
1220
|
+
/** @deprecated Use {@link list} instead. */
|
|
1221
|
+
async getList(options) {
|
|
1222
|
+
return this.list(options);
|
|
1223
|
+
}
|
|
614
1224
|
/** Updates or creates (based on id) a DataSource */
|
|
615
|
-
async
|
|
1225
|
+
async save(body) {
|
|
616
1226
|
const fetchUri = this.createUrl(dataSourceUrl);
|
|
617
1227
|
await this.apiClient(fetchUri, {
|
|
618
1228
|
method: "PUT",
|
|
@@ -620,6 +1230,10 @@ var DataSourceClient = class extends import_api5.ApiClient {
|
|
|
620
1230
|
expectNoContent: true
|
|
621
1231
|
});
|
|
622
1232
|
}
|
|
1233
|
+
/** @deprecated Use {@link save} instead. */
|
|
1234
|
+
async upsert(body) {
|
|
1235
|
+
return this.save(body);
|
|
1236
|
+
}
|
|
623
1237
|
/** Deletes a DataSource */
|
|
624
1238
|
async remove(body) {
|
|
625
1239
|
const fetchUri = this.createUrl(dataSourceUrl);
|
|
@@ -632,20 +1246,24 @@ var DataSourceClient = class extends import_api5.ApiClient {
|
|
|
632
1246
|
};
|
|
633
1247
|
|
|
634
1248
|
// src/DataTypeClient.ts
|
|
635
|
-
var
|
|
1249
|
+
var import_api14 = require("@uniformdev/context/api");
|
|
636
1250
|
var _url;
|
|
637
|
-
var _DataTypeClient = class _DataTypeClient extends
|
|
1251
|
+
var _DataTypeClient = class _DataTypeClient extends import_api14.ApiClient {
|
|
638
1252
|
constructor(options) {
|
|
639
1253
|
super(options);
|
|
640
1254
|
}
|
|
641
|
-
/** Fetches
|
|
642
|
-
async
|
|
1255
|
+
/** Fetches a list of DataTypes for a project */
|
|
1256
|
+
async list(options) {
|
|
643
1257
|
const { projectId } = this.options;
|
|
644
1258
|
const fetchUri = this.createUrl(__privateGet(_DataTypeClient, _url), { ...options, projectId });
|
|
645
1259
|
return await this.apiClient(fetchUri);
|
|
646
1260
|
}
|
|
1261
|
+
/** @deprecated Use {@link list} instead. */
|
|
1262
|
+
async get(options) {
|
|
1263
|
+
return this.list(options);
|
|
1264
|
+
}
|
|
647
1265
|
/** Updates or creates (based on id) a DataType */
|
|
648
|
-
async
|
|
1266
|
+
async save(body) {
|
|
649
1267
|
const fetchUri = this.createUrl(__privateGet(_DataTypeClient, _url));
|
|
650
1268
|
await this.apiClient(fetchUri, {
|
|
651
1269
|
method: "PUT",
|
|
@@ -653,6 +1271,10 @@ var _DataTypeClient = class _DataTypeClient extends import_api6.ApiClient {
|
|
|
653
1271
|
expectNoContent: true
|
|
654
1272
|
});
|
|
655
1273
|
}
|
|
1274
|
+
/** @deprecated Use {@link save} instead. */
|
|
1275
|
+
async upsert(body) {
|
|
1276
|
+
return this.save(body);
|
|
1277
|
+
}
|
|
656
1278
|
/** Deletes a DataType */
|
|
657
1279
|
async remove(body) {
|
|
658
1280
|
const fetchUri = this.createUrl(__privateGet(_DataTypeClient, _url));
|
|
@@ -788,61 +1410,6 @@ function getComponentPath(ancestorsAndSelf) {
|
|
|
788
1410
|
return `.${path.join(".")}`;
|
|
789
1411
|
}
|
|
790
1412
|
|
|
791
|
-
// src/utils/constants.ts
|
|
792
|
-
var CANVAS_PERSONALIZE_TYPE = "$personalization";
|
|
793
|
-
var CANVAS_TEST_TYPE = "$test";
|
|
794
|
-
var CANVAS_LOCALIZATION_TYPE = "$localization";
|
|
795
|
-
var CANVAS_SLOT_SECTION_TYPE = "$slotSection";
|
|
796
|
-
var CANVAS_INTENT_TAG_PARAM = "intentTag";
|
|
797
|
-
var CANVAS_LOCALE_TAG_PARAM = "locale";
|
|
798
|
-
var CANVAS_BLOCK_PARAM_TYPE = "$block";
|
|
799
|
-
var CANVAS_PERSONALIZE_SLOT = "pz";
|
|
800
|
-
var CANVAS_TEST_SLOT = "test";
|
|
801
|
-
var CANVAS_LOCALIZATION_SLOT = "localized";
|
|
802
|
-
var CANVAS_SLOT_SECTION_SLOT = "$slotSectionItems";
|
|
803
|
-
var CANVAS_SLOT_SECTION_NAME_PARAM = "name";
|
|
804
|
-
var CANVAS_SLOT_SECTION_MIN_PARAM = "min";
|
|
805
|
-
var CANVAS_SLOT_SECTION_MAX_PARAM = "max";
|
|
806
|
-
var CANVAS_SLOT_SECTION_GROUP_TYPE_PARAM = "groupType";
|
|
807
|
-
var CANVAS_SLOT_SECTION_SPECIFIC_PARAM = "specific";
|
|
808
|
-
var CANVAS_DRAFT_STATE = 0;
|
|
809
|
-
var CANVAS_PUBLISHED_STATE = 64;
|
|
810
|
-
var CANVAS_EDITOR_STATE = 63;
|
|
811
|
-
var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
|
|
812
|
-
var CANVAS_PERSONALIZATION_EVENT_NAME_PARAM = "trackingEventName";
|
|
813
|
-
var CANVAS_PERSONALIZATION_ALGORITHM_PARAM = "algorithm";
|
|
814
|
-
var CANVAS_PERSONALIZATION_ALGORITHM_TYPE = "pzAlgorithm";
|
|
815
|
-
var CANVAS_PERSONALIZATION_TAKE_PARAM = "count";
|
|
816
|
-
var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
|
|
817
|
-
var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
|
|
818
|
-
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
819
|
-
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
820
|
-
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
821
|
-
var CANVAS_CONTEXTUAL_EDITING_PARAM = "$contextualEditing";
|
|
822
|
-
var SECRET_QUERY_STRING_PARAM = "secret";
|
|
823
|
-
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
824
|
-
var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
|
|
825
|
-
var IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM = "is_incontext_editing_forced_settings";
|
|
826
|
-
var IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM = "is_config_check";
|
|
827
|
-
var IN_CONTEXT_EDITOR_COMPONENT_START_ROLE = "uniform-component-start";
|
|
828
|
-
var IN_CONTEXT_EDITOR_COMPONENT_END_ROLE = "uniform-component-end";
|
|
829
|
-
var IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID = "uniform-canvas-preview-script";
|
|
830
|
-
var IS_RENDERED_BY_UNIFORM_ATTRIBUTE = "data-is-rendered-by-uniform";
|
|
831
|
-
var PLACEHOLDER_ID = "placeholder";
|
|
832
|
-
var EMPTY_COMPOSITION = {
|
|
833
|
-
_id: "_empty_composition_id",
|
|
834
|
-
_name: "An empty composition used for contextual editing",
|
|
835
|
-
type: "_empty_composition_type"
|
|
836
|
-
};
|
|
837
|
-
var EDGE_MIN_CACHE_TTL = 10;
|
|
838
|
-
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
839
|
-
var EDGE_DEFAULT_CACHE_TTL = 30;
|
|
840
|
-
var EDGE_CACHE_DISABLED = -1;
|
|
841
|
-
var ASSET_PARAMETER_TYPE = "asset";
|
|
842
|
-
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
|
843
|
-
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
|
844
|
-
var REFERENCE_DATA_TYPE_ID = "uniformContentInternalReference";
|
|
845
|
-
|
|
846
1413
|
// src/utils/guards.ts
|
|
847
1414
|
function isRootEntryReference(root) {
|
|
848
1415
|
return root.type === "root" && isEntryData(root.node);
|
|
@@ -920,9 +1487,9 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
920
1487
|
let bufferStartIndex = 0;
|
|
921
1488
|
let bufferEndIndex = 0;
|
|
922
1489
|
let tokenCount = 0;
|
|
923
|
-
const handleToken = (token, type) => {
|
|
1490
|
+
const handleToken = (token, type, offset) => {
|
|
924
1491
|
tokenCount++;
|
|
925
|
-
return onToken == null ? void 0 : onToken(token, type);
|
|
1492
|
+
return onToken == null ? void 0 : onToken(token, type, offset);
|
|
926
1493
|
};
|
|
927
1494
|
let state = "text";
|
|
928
1495
|
for (let index = 0; index < serialized.length; index++) {
|
|
@@ -933,7 +1500,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
933
1500
|
if (char === variablePrefix[0] && serialized[index + 1] === variablePrefix[1]) {
|
|
934
1501
|
if (serialized[index - 1] === escapeCharacter) {
|
|
935
1502
|
bufferEndIndex -= escapeCharacter.length;
|
|
936
|
-
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
|
1503
|
+
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text", bufferStartIndex) === false) {
|
|
937
1504
|
return tokenCount;
|
|
938
1505
|
}
|
|
939
1506
|
bufferStartIndex = index;
|
|
@@ -942,12 +1509,12 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
942
1509
|
}
|
|
943
1510
|
if (state === "variable") {
|
|
944
1511
|
const textStart = bufferStartIndex - variablePrefix.length;
|
|
945
|
-
if (handleToken(serialized.substring(textStart, bufferEndIndex), "text") === false) {
|
|
1512
|
+
if (handleToken(serialized.substring(textStart, bufferEndIndex), "text", textStart) === false) {
|
|
946
1513
|
return tokenCount;
|
|
947
1514
|
}
|
|
948
1515
|
bufferStartIndex = bufferEndIndex;
|
|
949
1516
|
} else if (bufferEndIndex > bufferStartIndex) {
|
|
950
|
-
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
|
1517
|
+
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text", bufferStartIndex) === false) {
|
|
951
1518
|
return tokenCount;
|
|
952
1519
|
}
|
|
953
1520
|
bufferStartIndex = bufferEndIndex;
|
|
@@ -965,7 +1532,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
965
1532
|
state = "text";
|
|
966
1533
|
if (bufferEndIndex > bufferStartIndex) {
|
|
967
1534
|
const unescapedVariableName = serialized.substring(bufferStartIndex, bufferEndIndex).replace(/\\([${}])/g, "$1");
|
|
968
|
-
if (handleToken(unescapedVariableName, "variable") === false) {
|
|
1535
|
+
if (handleToken(unescapedVariableName, "variable", bufferStartIndex) === false) {
|
|
969
1536
|
return tokenCount;
|
|
970
1537
|
}
|
|
971
1538
|
bufferStartIndex = bufferEndIndex + variableSuffix.length;
|
|
@@ -979,7 +1546,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
979
1546
|
bufferStartIndex -= variablePrefix.length;
|
|
980
1547
|
}
|
|
981
1548
|
if (bufferStartIndex < serialized.length) {
|
|
982
|
-
handleToken(serialized.substring(bufferStartIndex), state);
|
|
1549
|
+
handleToken(serialized.substring(bufferStartIndex), state, bufferStartIndex);
|
|
983
1550
|
}
|
|
984
1551
|
return tokenCount;
|
|
985
1552
|
}
|
|
@@ -1701,7 +2268,7 @@ function getLocaleMatch(index, locale, greedy) {
|
|
|
1701
2268
|
}
|
|
1702
2269
|
const match = index[locale];
|
|
1703
2270
|
if (match === void 0 && greedy) {
|
|
1704
|
-
return Object.values(index)
|
|
2271
|
+
return Object.values(index).find((value) => value !== void 0);
|
|
1705
2272
|
}
|
|
1706
2273
|
return match;
|
|
1707
2274
|
}
|
|
@@ -2296,24 +2863,28 @@ function walkPropertyValues(property, visitor) {
|
|
|
2296
2863
|
}
|
|
2297
2864
|
|
|
2298
2865
|
// src/EntityReleasesClient.ts
|
|
2299
|
-
var
|
|
2300
|
-
var
|
|
2301
|
-
var EntityReleasesClient = class extends
|
|
2866
|
+
var import_api15 = require("@uniformdev/context/api");
|
|
2867
|
+
var entityReleasesUrl = "/api/v1/entity-releases";
|
|
2868
|
+
var EntityReleasesClient = class extends import_api15.ApiClient {
|
|
2302
2869
|
constructor(options) {
|
|
2303
2870
|
super(options);
|
|
2304
2871
|
}
|
|
2305
2872
|
/** Fetches entity across all releases (and base) */
|
|
2306
|
-
async
|
|
2873
|
+
async list(options) {
|
|
2307
2874
|
const { projectId } = this.options;
|
|
2308
|
-
const fetchUri = this.createUrl(
|
|
2875
|
+
const fetchUri = this.createUrl(entityReleasesUrl, { ...options, projectId });
|
|
2309
2876
|
return await this.apiClient(fetchUri);
|
|
2310
2877
|
}
|
|
2878
|
+
/** @deprecated Use {@link list} instead. */
|
|
2879
|
+
async get(options) {
|
|
2880
|
+
return this.list(options);
|
|
2881
|
+
}
|
|
2311
2882
|
};
|
|
2312
2883
|
|
|
2313
2884
|
// src/IntegrationPropertyEditorsClient.ts
|
|
2314
|
-
var
|
|
2885
|
+
var import_api16 = require("@uniformdev/context/api");
|
|
2315
2886
|
var _baseUrl;
|
|
2316
|
-
var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient extends
|
|
2887
|
+
var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient extends import_api16.ApiClient {
|
|
2317
2888
|
constructor(options) {
|
|
2318
2889
|
super(options);
|
|
2319
2890
|
this.teamId = options.teamId;
|
|
@@ -2356,17 +2927,21 @@ __privateAdd(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-p
|
|
|
2356
2927
|
var IntegrationPropertyEditorsClient = _IntegrationPropertyEditorsClient;
|
|
2357
2928
|
|
|
2358
2929
|
// src/LabelClient.ts
|
|
2359
|
-
var
|
|
2930
|
+
var import_api17 = require("@uniformdev/context/api");
|
|
2360
2931
|
var LABELS_URL = "/api/v1/labels";
|
|
2361
|
-
var LabelClient = class extends
|
|
2362
|
-
/** Fetches labels for the current project. */
|
|
2363
|
-
async
|
|
2932
|
+
var LabelClient = class extends import_api17.ApiClient {
|
|
2933
|
+
/** Fetches a list of labels for the current project. */
|
|
2934
|
+
async list(options) {
|
|
2364
2935
|
const { projectId } = this.options;
|
|
2365
2936
|
const fetchUri = this.createUrl(LABELS_URL, { ...options, projectId });
|
|
2366
2937
|
return await this.apiClient(fetchUri);
|
|
2367
2938
|
}
|
|
2939
|
+
/** @deprecated Use {@link list} instead. */
|
|
2940
|
+
async getLabels(options) {
|
|
2941
|
+
return this.list(options);
|
|
2942
|
+
}
|
|
2368
2943
|
/** Updates or creates a label. */
|
|
2369
|
-
async
|
|
2944
|
+
async save(body) {
|
|
2370
2945
|
const { projectId } = this.options;
|
|
2371
2946
|
const fetchUri = this.createUrl(LABELS_URL);
|
|
2372
2947
|
await this.apiClient(fetchUri, {
|
|
@@ -2375,8 +2950,12 @@ var LabelClient = class extends import_api9.ApiClient {
|
|
|
2375
2950
|
expectNoContent: true
|
|
2376
2951
|
});
|
|
2377
2952
|
}
|
|
2953
|
+
/** @deprecated Use {@link save} instead. */
|
|
2954
|
+
async upsertLabel(body) {
|
|
2955
|
+
return this.save(body);
|
|
2956
|
+
}
|
|
2378
2957
|
/** Deletes a label by id. */
|
|
2379
|
-
async
|
|
2958
|
+
async remove(options) {
|
|
2380
2959
|
const { projectId } = this.options;
|
|
2381
2960
|
const fetchUri = this.createUrl(LABELS_URL);
|
|
2382
2961
|
await this.apiClient(fetchUri, {
|
|
@@ -2385,6 +2964,10 @@ var LabelClient = class extends import_api9.ApiClient {
|
|
|
2385
2964
|
expectNoContent: true
|
|
2386
2965
|
});
|
|
2387
2966
|
}
|
|
2967
|
+
/** @deprecated Use {@link remove} instead. */
|
|
2968
|
+
async removeLabel(options) {
|
|
2969
|
+
return this.remove(options);
|
|
2970
|
+
}
|
|
2388
2971
|
};
|
|
2389
2972
|
var UncachedLabelClient = class extends LabelClient {
|
|
2390
2973
|
constructor(options) {
|
|
@@ -2393,20 +2976,24 @@ var UncachedLabelClient = class extends LabelClient {
|
|
|
2393
2976
|
};
|
|
2394
2977
|
|
|
2395
2978
|
// src/LocaleClient.ts
|
|
2396
|
-
var
|
|
2979
|
+
var import_api18 = require("@uniformdev/context/api");
|
|
2397
2980
|
var localesUrl = "/api/v1/locales";
|
|
2398
|
-
var LocaleClient = class extends
|
|
2981
|
+
var LocaleClient = class extends import_api18.ApiClient {
|
|
2399
2982
|
constructor(options) {
|
|
2400
2983
|
super(options);
|
|
2401
2984
|
}
|
|
2402
|
-
/** Fetches
|
|
2403
|
-
async
|
|
2985
|
+
/** Fetches a list of locales for a project */
|
|
2986
|
+
async list(options) {
|
|
2404
2987
|
const { projectId } = this.options;
|
|
2405
2988
|
const fetchUri = this.createUrl(localesUrl, { ...options, projectId });
|
|
2406
2989
|
return await this.apiClient(fetchUri);
|
|
2407
2990
|
}
|
|
2991
|
+
/** @deprecated Use {@link list} instead. */
|
|
2992
|
+
async get(options) {
|
|
2993
|
+
return this.list(options);
|
|
2994
|
+
}
|
|
2408
2995
|
/** Updates or creates (based on id) a locale */
|
|
2409
|
-
async
|
|
2996
|
+
async save(body) {
|
|
2410
2997
|
const fetchUri = this.createUrl(localesUrl);
|
|
2411
2998
|
await this.apiClient(fetchUri, {
|
|
2412
2999
|
method: "PUT",
|
|
@@ -2414,6 +3001,10 @@ var LocaleClient = class extends import_api10.ApiClient {
|
|
|
2414
3001
|
expectNoContent: true
|
|
2415
3002
|
});
|
|
2416
3003
|
}
|
|
3004
|
+
/** @deprecated Use {@link save} instead. */
|
|
3005
|
+
async upsert(body) {
|
|
3006
|
+
return this.save(body);
|
|
3007
|
+
}
|
|
2417
3008
|
/** Deletes a locale */
|
|
2418
3009
|
async remove(body) {
|
|
2419
3010
|
const fetchUri = this.createUrl(localesUrl);
|
|
@@ -2797,10 +3388,10 @@ var createCanvasChannel = ({
|
|
|
2797
3388
|
};
|
|
2798
3389
|
|
|
2799
3390
|
// src/PreviewClient.ts
|
|
2800
|
-
var
|
|
3391
|
+
var import_api19 = require("@uniformdev/context/api");
|
|
2801
3392
|
var previewUrlsUrl = "/api/v1/preview-urls";
|
|
2802
3393
|
var previewViewportsUrl = "/api/v1/preview-viewports";
|
|
2803
|
-
var PreviewClient = class extends
|
|
3394
|
+
var PreviewClient = class extends import_api19.ApiClient {
|
|
2804
3395
|
constructor(options) {
|
|
2805
3396
|
super(options);
|
|
2806
3397
|
}
|
|
@@ -2863,9 +3454,9 @@ var PreviewClient = class extends import_api11.ApiClient {
|
|
|
2863
3454
|
};
|
|
2864
3455
|
|
|
2865
3456
|
// src/ProjectClient.ts
|
|
2866
|
-
var
|
|
3457
|
+
var import_api20 = require("@uniformdev/context/api");
|
|
2867
3458
|
var _url2, _projectsUrl;
|
|
2868
|
-
var _ProjectClient = class _ProjectClient extends
|
|
3459
|
+
var _ProjectClient = class _ProjectClient extends import_api20.ApiClient {
|
|
2869
3460
|
constructor(options) {
|
|
2870
3461
|
super({ ...options, bypassCache: true });
|
|
2871
3462
|
}
|
|
@@ -2879,20 +3470,28 @@ var _ProjectClient = class _ProjectClient extends import_api12.ApiClient {
|
|
|
2879
3470
|
* When teamId is provided, returns a single team with its projects.
|
|
2880
3471
|
* When omitted, returns all accessible teams and their projects.
|
|
2881
3472
|
*/
|
|
2882
|
-
async
|
|
3473
|
+
async list(options) {
|
|
2883
3474
|
const fetchUri = this.createUrl(__privateGet(_ProjectClient, _projectsUrl), options ? { ...options } : {});
|
|
2884
3475
|
return await this.apiClient(fetchUri);
|
|
2885
3476
|
}
|
|
3477
|
+
/** @deprecated Use {@link list} instead. */
|
|
3478
|
+
async getProjects(options) {
|
|
3479
|
+
return this.list(options);
|
|
3480
|
+
}
|
|
2886
3481
|
/** Updates or creates (based on id) a Project */
|
|
2887
|
-
async
|
|
3482
|
+
async save(body) {
|
|
2888
3483
|
const fetchUri = this.createUrl(__privateGet(_ProjectClient, _url2));
|
|
2889
3484
|
return await this.apiClient(fetchUri, {
|
|
2890
3485
|
method: "PUT",
|
|
2891
3486
|
body: JSON.stringify({ ...body })
|
|
2892
3487
|
});
|
|
2893
3488
|
}
|
|
3489
|
+
/** @deprecated Use {@link save} instead. */
|
|
3490
|
+
async upsert(body) {
|
|
3491
|
+
return this.save(body);
|
|
3492
|
+
}
|
|
2894
3493
|
/** Deletes a Project */
|
|
2895
|
-
async
|
|
3494
|
+
async remove(body) {
|
|
2896
3495
|
const fetchUri = this.createUrl(__privateGet(_ProjectClient, _url2));
|
|
2897
3496
|
await this.apiClient(fetchUri, {
|
|
2898
3497
|
method: "DELETE",
|
|
@@ -2900,6 +3499,10 @@ var _ProjectClient = class _ProjectClient extends import_api12.ApiClient {
|
|
|
2900
3499
|
expectNoContent: true
|
|
2901
3500
|
});
|
|
2902
3501
|
}
|
|
3502
|
+
/** @deprecated Use {@link remove} instead. */
|
|
3503
|
+
async delete(body) {
|
|
3504
|
+
return this.remove(body);
|
|
3505
|
+
}
|
|
2903
3506
|
};
|
|
2904
3507
|
_url2 = new WeakMap();
|
|
2905
3508
|
_projectsUrl = new WeakMap();
|
|
@@ -3090,9 +3693,9 @@ function queryToProjection(source) {
|
|
|
3090
3693
|
}
|
|
3091
3694
|
|
|
3092
3695
|
// src/PromptClient.ts
|
|
3093
|
-
var
|
|
3696
|
+
var import_api21 = require("@uniformdev/context/api");
|
|
3094
3697
|
var PromptsUrl = "/api/v1/prompts";
|
|
3095
|
-
var PromptClient = class extends
|
|
3698
|
+
var PromptClient = class extends import_api21.ApiClient {
|
|
3096
3699
|
constructor(options) {
|
|
3097
3700
|
super(options);
|
|
3098
3701
|
}
|
|
@@ -3123,34 +3726,42 @@ var PromptClient = class extends import_api13.ApiClient {
|
|
|
3123
3726
|
};
|
|
3124
3727
|
|
|
3125
3728
|
// src/RelationshipClient.ts
|
|
3126
|
-
var
|
|
3729
|
+
var import_api22 = require("@uniformdev/context/api");
|
|
3127
3730
|
var RELATIONSHIPS_URL = "/api/v1/relationships";
|
|
3128
|
-
var RelationshipClient = class extends
|
|
3731
|
+
var RelationshipClient = class extends import_api22.ApiClient {
|
|
3129
3732
|
constructor(options) {
|
|
3130
3733
|
super(options);
|
|
3131
|
-
this.
|
|
3734
|
+
this.list = async (options) => {
|
|
3132
3735
|
const { projectId } = this.options;
|
|
3133
3736
|
const url = this.createUrl(RELATIONSHIPS_URL, { ...options, projectId });
|
|
3134
3737
|
return this.apiClient(url);
|
|
3135
3738
|
};
|
|
3739
|
+
/** @deprecated Use {@link list} instead. */
|
|
3740
|
+
this.get = async (options) => {
|
|
3741
|
+
return this.list(options);
|
|
3742
|
+
};
|
|
3136
3743
|
}
|
|
3137
3744
|
};
|
|
3138
3745
|
|
|
3139
3746
|
// src/ReleaseClient.ts
|
|
3140
|
-
var
|
|
3747
|
+
var import_api23 = require("@uniformdev/context/api");
|
|
3141
3748
|
var releasesUrl = "/api/v1/releases";
|
|
3142
|
-
var ReleaseClient = class extends
|
|
3749
|
+
var ReleaseClient = class extends import_api23.ApiClient {
|
|
3143
3750
|
constructor(options) {
|
|
3144
3751
|
super(options);
|
|
3145
3752
|
}
|
|
3146
|
-
/** Fetches
|
|
3147
|
-
async
|
|
3753
|
+
/** Fetches a list of releases for a project */
|
|
3754
|
+
async list(options) {
|
|
3148
3755
|
const { projectId } = this.options;
|
|
3149
3756
|
const fetchUri = this.createUrl(releasesUrl, { ...options, projectId });
|
|
3150
3757
|
return await this.apiClient(fetchUri);
|
|
3151
3758
|
}
|
|
3759
|
+
/** @deprecated Use {@link list} instead. */
|
|
3760
|
+
async get(options) {
|
|
3761
|
+
return this.list(options);
|
|
3762
|
+
}
|
|
3152
3763
|
/** Updates or creates (based on id) a release */
|
|
3153
|
-
async
|
|
3764
|
+
async save(body) {
|
|
3154
3765
|
const fetchUri = this.createUrl(releasesUrl);
|
|
3155
3766
|
await this.apiClient(fetchUri, {
|
|
3156
3767
|
method: "PUT",
|
|
@@ -3158,6 +3769,10 @@ var ReleaseClient = class extends import_api15.ApiClient {
|
|
|
3158
3769
|
expectNoContent: true
|
|
3159
3770
|
});
|
|
3160
3771
|
}
|
|
3772
|
+
/** @deprecated Use {@link save} instead. */
|
|
3773
|
+
async upsert(body) {
|
|
3774
|
+
return this.save(body);
|
|
3775
|
+
}
|
|
3161
3776
|
/** Deletes a release */
|
|
3162
3777
|
async remove(body) {
|
|
3163
3778
|
const fetchUri = this.createUrl(releasesUrl);
|
|
@@ -3179,21 +3794,25 @@ var ReleaseClient = class extends import_api15.ApiClient {
|
|
|
3179
3794
|
};
|
|
3180
3795
|
|
|
3181
3796
|
// src/ReleaseContentsClient.ts
|
|
3182
|
-
var
|
|
3183
|
-
var
|
|
3184
|
-
var ReleaseContentsClient = class extends
|
|
3797
|
+
var import_api24 = require("@uniformdev/context/api");
|
|
3798
|
+
var releaseContentsUrl = "/api/v1/release-contents";
|
|
3799
|
+
var ReleaseContentsClient = class extends import_api24.ApiClient {
|
|
3185
3800
|
constructor(options) {
|
|
3186
3801
|
super(options);
|
|
3187
3802
|
}
|
|
3188
|
-
/** Fetches
|
|
3189
|
-
async
|
|
3803
|
+
/** Fetches a list of entities added to a release */
|
|
3804
|
+
async list(options) {
|
|
3190
3805
|
const { projectId } = this.options;
|
|
3191
|
-
const fetchUri = this.createUrl(
|
|
3806
|
+
const fetchUri = this.createUrl(releaseContentsUrl, { ...options, projectId });
|
|
3192
3807
|
return await this.apiClient(fetchUri);
|
|
3193
3808
|
}
|
|
3809
|
+
/** @deprecated Use {@link list} instead. */
|
|
3810
|
+
async get(options) {
|
|
3811
|
+
return this.list(options);
|
|
3812
|
+
}
|
|
3194
3813
|
/** Removes a release content from a release */
|
|
3195
3814
|
async remove(body) {
|
|
3196
|
-
const fetchUri = this.createUrl(
|
|
3815
|
+
const fetchUri = this.createUrl(releaseContentsUrl);
|
|
3197
3816
|
await this.apiClient(fetchUri, {
|
|
3198
3817
|
method: "DELETE",
|
|
3199
3818
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -3203,9 +3822,9 @@ var ReleaseContentsClient = class extends import_api16.ApiClient {
|
|
|
3203
3822
|
};
|
|
3204
3823
|
|
|
3205
3824
|
// src/RouteClient.ts
|
|
3206
|
-
var
|
|
3825
|
+
var import_api25 = require("@uniformdev/context/api");
|
|
3207
3826
|
var ROUTE_URL = "/api/v1/route";
|
|
3208
|
-
var RouteClient = class extends
|
|
3827
|
+
var RouteClient = class extends import_api25.ApiClient {
|
|
3209
3828
|
constructor(options) {
|
|
3210
3829
|
var _a;
|
|
3211
3830
|
if (!options.limitPolicy) {
|
|
@@ -3214,8 +3833,14 @@ var RouteClient = class extends import_api17.ApiClient {
|
|
|
3214
3833
|
super(options);
|
|
3215
3834
|
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
|
|
3216
3835
|
}
|
|
3217
|
-
/**
|
|
3218
|
-
|
|
3836
|
+
/**
|
|
3837
|
+
* Resolves a route to a composition, redirect, or not-found result.
|
|
3838
|
+
*
|
|
3839
|
+
* An optional `select` projection applies to the resolved composition when
|
|
3840
|
+
* the route matches one; redirect / notFound responses pass through
|
|
3841
|
+
* untouched.
|
|
3842
|
+
*/
|
|
3843
|
+
async get(options) {
|
|
3219
3844
|
const { projectId } = this.options;
|
|
3220
3845
|
const { select, ...rest } = options != null ? options : {};
|
|
3221
3846
|
const rewrittenSelect = projectionToQuery(select);
|
|
@@ -3225,6 +3850,10 @@ var RouteClient = class extends import_api17.ApiClient {
|
|
|
3225
3850
|
this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
|
|
3226
3851
|
);
|
|
3227
3852
|
}
|
|
3853
|
+
/** @deprecated use {@link RouteClient.get} instead (renamed). */
|
|
3854
|
+
async getRoute(options) {
|
|
3855
|
+
return this.get(options);
|
|
3856
|
+
}
|
|
3228
3857
|
};
|
|
3229
3858
|
|
|
3230
3859
|
// src/types/locales.ts
|
|
@@ -3383,7 +4012,9 @@ var getParameterAttributes = ({
|
|
|
3383
4012
|
|
|
3384
4013
|
// src/utils/isAllowedReferrer.ts
|
|
3385
4014
|
var isAllowedReferrer = (referrer) => {
|
|
3386
|
-
return Boolean(
|
|
4015
|
+
return Boolean(
|
|
4016
|
+
referrer == null ? void 0 : referrer.match(/(^https:\/\/|\.)(uniform.app|uniform.wtf|uniformcode.ai|localhost:\d{4})\//)
|
|
4017
|
+
);
|
|
3387
4018
|
};
|
|
3388
4019
|
|
|
3389
4020
|
// src/utils/isSystemComponentDefinition.ts
|
|
@@ -3579,26 +4210,30 @@ function handleRichTextNodeBinding(object, options) {
|
|
|
3579
4210
|
}
|
|
3580
4211
|
|
|
3581
4212
|
// src/index.ts
|
|
3582
|
-
var
|
|
4213
|
+
var import_api27 = require("@uniformdev/context/api");
|
|
3583
4214
|
|
|
3584
4215
|
// src/.version.ts
|
|
3585
|
-
var version = "20.
|
|
4216
|
+
var version = "20.73.0";
|
|
3586
4217
|
|
|
3587
4218
|
// src/WorkflowClient.ts
|
|
3588
|
-
var
|
|
4219
|
+
var import_api26 = require("@uniformdev/context/api");
|
|
3589
4220
|
var workflowsUrl = "/api/v1/workflows";
|
|
3590
|
-
var WorkflowClient = class extends
|
|
4221
|
+
var WorkflowClient = class extends import_api26.ApiClient {
|
|
3591
4222
|
constructor(options) {
|
|
3592
4223
|
super(options);
|
|
3593
4224
|
}
|
|
3594
|
-
/** Fetches workflows for a project */
|
|
3595
|
-
async
|
|
4225
|
+
/** Fetches a list of workflows for a project */
|
|
4226
|
+
async list(options) {
|
|
3596
4227
|
const { projectId } = this.options;
|
|
3597
4228
|
const fetchUri = this.createUrl(workflowsUrl, { ...options, projectId });
|
|
3598
4229
|
return await this.apiClient(fetchUri);
|
|
3599
4230
|
}
|
|
4231
|
+
/** @deprecated Use {@link list} instead. */
|
|
4232
|
+
async get(options) {
|
|
4233
|
+
return this.list(options);
|
|
4234
|
+
}
|
|
3600
4235
|
/** Updates or creates a workflow definition */
|
|
3601
|
-
async
|
|
4236
|
+
async save(body) {
|
|
3602
4237
|
const fetchUri = this.createUrl(workflowsUrl);
|
|
3603
4238
|
await this.apiClient(fetchUri, {
|
|
3604
4239
|
method: "PUT",
|
|
@@ -3606,6 +4241,10 @@ var WorkflowClient = class extends import_api18.ApiClient {
|
|
|
3606
4241
|
expectNoContent: true
|
|
3607
4242
|
});
|
|
3608
4243
|
}
|
|
4244
|
+
/** @deprecated Use {@link save} instead. */
|
|
4245
|
+
async upsert(body) {
|
|
4246
|
+
return this.save(body);
|
|
4247
|
+
}
|
|
3609
4248
|
/** Deletes a workflow definition */
|
|
3610
4249
|
async remove(body) {
|
|
3611
4250
|
const fetchUri = this.createUrl(workflowsUrl);
|
|
@@ -3618,7 +4257,7 @@ var WorkflowClient = class extends import_api18.ApiClient {
|
|
|
3618
4257
|
};
|
|
3619
4258
|
|
|
3620
4259
|
// src/index.ts
|
|
3621
|
-
var CanvasClientError =
|
|
4260
|
+
var CanvasClientError = import_api27.ApiClientError;
|
|
3622
4261
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3623
4262
|
0 && (module.exports = {
|
|
3624
4263
|
ASSETS_SOURCE_CUSTOM_URL,
|
|
@@ -3672,7 +4311,11 @@ var CanvasClientError = import_api19.ApiClientError;
|
|
|
3672
4311
|
CanvasClientError,
|
|
3673
4312
|
CategoryClient,
|
|
3674
4313
|
ChildEnhancerBuilder,
|
|
4314
|
+
ComponentDefinitionClient,
|
|
4315
|
+
CompositionDeliveryClient,
|
|
4316
|
+
CompositionManagementClient,
|
|
3675
4317
|
ContentClient,
|
|
4318
|
+
ContentTypeClient,
|
|
3676
4319
|
DataSourceClient,
|
|
3677
4320
|
DataTypeClient,
|
|
3678
4321
|
EDGE_CACHE_DISABLED,
|
|
@@ -3682,6 +4325,8 @@ var CanvasClientError = import_api19.ApiClientError;
|
|
|
3682
4325
|
EMPTY_COMPOSITION,
|
|
3683
4326
|
EnhancerBuilder,
|
|
3684
4327
|
EntityReleasesClient,
|
|
4328
|
+
EntryDeliveryClient,
|
|
4329
|
+
EntryManagementClient,
|
|
3685
4330
|
IN_CONTEXT_EDITOR_COMPONENT_END_ROLE,
|
|
3686
4331
|
IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
|
|
3687
4332
|
IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM,
|