@uniformdev/canvas 20.72.2 → 20.72.3-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +3280 -2154
- package/dist/index.d.ts +3280 -2154
- package/dist/index.esm.js +874 -190
- package/dist/index.js +880 -189
- package/dist/index.mjs +874 -190
- package/package.json +5 -5
package/dist/index.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_api28.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,
|
|
@@ -109,6 +115,7 @@ __export(index_exports, {
|
|
|
109
115
|
LOCALE_DYNAMIC_INPUT_NAME: () => LOCALE_DYNAMIC_INPUT_NAME,
|
|
110
116
|
LabelClient: () => LabelClient,
|
|
111
117
|
LocaleClient: () => LocaleClient,
|
|
118
|
+
NotificationsClient: () => NotificationsClient,
|
|
112
119
|
PLACEHOLDER_ID: () => PLACEHOLDER_ID,
|
|
113
120
|
PreviewClient: () => PreviewClient,
|
|
114
121
|
ProjectClient: () => ProjectClient,
|
|
@@ -214,7 +221,7 @@ __export(index_exports, {
|
|
|
214
221
|
});
|
|
215
222
|
module.exports = __toCommonJS(index_exports);
|
|
216
223
|
|
|
217
|
-
// src/
|
|
224
|
+
// src/CategoryClient.ts
|
|
218
225
|
var import_api2 = require("@uniformdev/context/api");
|
|
219
226
|
|
|
220
227
|
// src/enhancement/createLimitPolicy.ts
|
|
@@ -258,6 +265,129 @@ function createLimitPolicy({
|
|
|
258
265
|
}
|
|
259
266
|
var nullLimitPolicy = async (func) => await func();
|
|
260
267
|
|
|
268
|
+
// src/CategoryClient.ts
|
|
269
|
+
var CATEGORIES_URL = "/api/v1/categories";
|
|
270
|
+
var CategoryClient = class extends import_api2.ApiClient {
|
|
271
|
+
constructor(options) {
|
|
272
|
+
if (!options.limitPolicy) {
|
|
273
|
+
options.limitPolicy = createLimitPolicy({});
|
|
274
|
+
}
|
|
275
|
+
super(options);
|
|
276
|
+
}
|
|
277
|
+
/** Fetches a list of categories created in given project */
|
|
278
|
+
async list(options) {
|
|
279
|
+
const { projectId } = this.options;
|
|
280
|
+
const fetchUri = this.createUrl("/api/v1/categories", { ...options, projectId });
|
|
281
|
+
return await this.apiClient(fetchUri);
|
|
282
|
+
}
|
|
283
|
+
/** @deprecated Use {@link list} instead. */
|
|
284
|
+
async getCategories(options) {
|
|
285
|
+
return this.list(options);
|
|
286
|
+
}
|
|
287
|
+
/** Updates or creates a category, also used to re-order them */
|
|
288
|
+
async save(categories) {
|
|
289
|
+
const { projectId } = this.options;
|
|
290
|
+
const fetchUri = this.createUrl(CATEGORIES_URL);
|
|
291
|
+
return await this.apiClient(fetchUri, {
|
|
292
|
+
method: "PUT",
|
|
293
|
+
body: JSON.stringify({ categories, projectId }),
|
|
294
|
+
expectNoContent: true
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
/** @deprecated Use {@link save} instead. */
|
|
298
|
+
async upsertCategories(categories) {
|
|
299
|
+
return this.save(categories);
|
|
300
|
+
}
|
|
301
|
+
/** Deletes a category */
|
|
302
|
+
async remove(options) {
|
|
303
|
+
const { projectId } = this.options;
|
|
304
|
+
const fetchUri = this.createUrl(CATEGORIES_URL);
|
|
305
|
+
return await this.apiClient(fetchUri, {
|
|
306
|
+
method: "DELETE",
|
|
307
|
+
body: JSON.stringify({ projectId, categoryId: options.categoryId }),
|
|
308
|
+
expectNoContent: true
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
/** @deprecated Use {@link remove} instead. */
|
|
312
|
+
async removeCategory(options) {
|
|
313
|
+
return this.remove(options);
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
var UncachedCategoryClient = class extends CategoryClient {
|
|
317
|
+
constructor(options) {
|
|
318
|
+
super({ ...options, bypassCache: true });
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
// src/clients/ComponentDefinitionClient.ts
|
|
323
|
+
var import_api4 = require("@uniformdev/context/api");
|
|
324
|
+
|
|
325
|
+
// src/clients/ContentClientBase.ts
|
|
326
|
+
var import_api3 = require("@uniformdev/context/api");
|
|
327
|
+
var CANONICAL_FORMAT = "canonical";
|
|
328
|
+
var ContentClientBase = class extends import_api3.ApiClient {
|
|
329
|
+
constructor(options, defaultBypassCache) {
|
|
330
|
+
var _a, _b;
|
|
331
|
+
super({
|
|
332
|
+
...options,
|
|
333
|
+
limitPolicy: (_a = options.limitPolicy) != null ? _a : createLimitPolicy({}),
|
|
334
|
+
bypassCache: (_b = options.bypassCache) != null ? _b : defaultBypassCache
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
// src/clients/ComponentDefinitionClient.ts
|
|
340
|
+
var DEFINITIONS_URL = "/api/v1/canvas-definitions";
|
|
341
|
+
var ComponentDefinitionClient = class extends ContentClientBase {
|
|
342
|
+
constructor(options) {
|
|
343
|
+
super(
|
|
344
|
+
options,
|
|
345
|
+
/* defaultBypassCache */
|
|
346
|
+
true
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
/** Fetches one component definition by id (throws `ApiClientError(404)` if absent). */
|
|
350
|
+
async get(args) {
|
|
351
|
+
var _a;
|
|
352
|
+
const url = this.createUrl(DEFINITIONS_URL, {
|
|
353
|
+
componentId: args.componentId,
|
|
354
|
+
projectId: this.options.projectId
|
|
355
|
+
});
|
|
356
|
+
const res = await this.apiClient(url);
|
|
357
|
+
const definition = (_a = res.componentDefinitions) == null ? void 0 : _a[0];
|
|
358
|
+
if (!definition) {
|
|
359
|
+
throw new import_api4.ApiClientError("Component definition not found", "GET", url.toString(), 404, "Not Found");
|
|
360
|
+
}
|
|
361
|
+
return definition;
|
|
362
|
+
}
|
|
363
|
+
/** Fetches a list of component definitions. */
|
|
364
|
+
list(args) {
|
|
365
|
+
const url = this.createUrl(DEFINITIONS_URL, { ...args, projectId: this.options.projectId });
|
|
366
|
+
return this.apiClient(url);
|
|
367
|
+
}
|
|
368
|
+
/** Creates or updates a component definition. */
|
|
369
|
+
async save(def) {
|
|
370
|
+
const url = this.createUrl(DEFINITIONS_URL);
|
|
371
|
+
await this.apiClient(url, {
|
|
372
|
+
method: "PUT",
|
|
373
|
+
body: JSON.stringify({ ...def, projectId: this.options.projectId }),
|
|
374
|
+
expectNoContent: true
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
/** Deletes a component definition. */
|
|
378
|
+
async remove(args) {
|
|
379
|
+
const url = this.createUrl(DEFINITIONS_URL);
|
|
380
|
+
await this.apiClient(url, {
|
|
381
|
+
method: "DELETE",
|
|
382
|
+
body: JSON.stringify({ ...args, projectId: this.options.projectId }),
|
|
383
|
+
expectNoContent: true
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
// src/clients/CompositionDeliveryClient.ts
|
|
389
|
+
var import_api5 = require("@uniformdev/context/api");
|
|
390
|
+
|
|
261
391
|
// src/projection/types.ts
|
|
262
392
|
var SELECT_QUERY_PREFIX = "select.";
|
|
263
393
|
|
|
@@ -306,9 +436,529 @@ function projectionToQuery(spec) {
|
|
|
306
436
|
return out;
|
|
307
437
|
}
|
|
308
438
|
|
|
309
|
-
// src/
|
|
439
|
+
// src/utils/constants.ts
|
|
440
|
+
var CANVAS_PERSONALIZE_TYPE = "$personalization";
|
|
441
|
+
var CANVAS_TEST_TYPE = "$test";
|
|
442
|
+
var CANVAS_LOCALIZATION_TYPE = "$localization";
|
|
443
|
+
var CANVAS_SLOT_SECTION_TYPE = "$slotSection";
|
|
444
|
+
var CANVAS_INTENT_TAG_PARAM = "intentTag";
|
|
445
|
+
var CANVAS_LOCALE_TAG_PARAM = "locale";
|
|
446
|
+
var CANVAS_BLOCK_PARAM_TYPE = "$block";
|
|
447
|
+
var CANVAS_PERSONALIZE_SLOT = "pz";
|
|
448
|
+
var CANVAS_TEST_SLOT = "test";
|
|
449
|
+
var CANVAS_LOCALIZATION_SLOT = "localized";
|
|
450
|
+
var CANVAS_SLOT_SECTION_SLOT = "$slotSectionItems";
|
|
451
|
+
var CANVAS_SLOT_SECTION_NAME_PARAM = "name";
|
|
452
|
+
var CANVAS_SLOT_SECTION_MIN_PARAM = "min";
|
|
453
|
+
var CANVAS_SLOT_SECTION_MAX_PARAM = "max";
|
|
454
|
+
var CANVAS_SLOT_SECTION_GROUP_TYPE_PARAM = "groupType";
|
|
455
|
+
var CANVAS_SLOT_SECTION_SPECIFIC_PARAM = "specific";
|
|
456
|
+
var CANVAS_DRAFT_STATE = 0;
|
|
457
|
+
var CANVAS_PUBLISHED_STATE = 64;
|
|
458
|
+
var CANVAS_EDITOR_STATE = 63;
|
|
459
|
+
var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
|
|
460
|
+
var CANVAS_PERSONALIZATION_EVENT_NAME_PARAM = "trackingEventName";
|
|
461
|
+
var CANVAS_PERSONALIZATION_ALGORITHM_PARAM = "algorithm";
|
|
462
|
+
var CANVAS_PERSONALIZATION_ALGORITHM_TYPE = "pzAlgorithm";
|
|
463
|
+
var CANVAS_PERSONALIZATION_TAKE_PARAM = "count";
|
|
464
|
+
var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
|
|
465
|
+
var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
|
|
466
|
+
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
467
|
+
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
468
|
+
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
469
|
+
var CANVAS_CONTEXTUAL_EDITING_PARAM = "$contextualEditing";
|
|
470
|
+
var SECRET_QUERY_STRING_PARAM = "secret";
|
|
471
|
+
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
472
|
+
var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
|
|
473
|
+
var IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM = "is_incontext_editing_forced_settings";
|
|
474
|
+
var IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM = "is_config_check";
|
|
475
|
+
var IN_CONTEXT_EDITOR_COMPONENT_START_ROLE = "uniform-component-start";
|
|
476
|
+
var IN_CONTEXT_EDITOR_COMPONENT_END_ROLE = "uniform-component-end";
|
|
477
|
+
var IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID = "uniform-canvas-preview-script";
|
|
478
|
+
var IS_RENDERED_BY_UNIFORM_ATTRIBUTE = "data-is-rendered-by-uniform";
|
|
479
|
+
var PLACEHOLDER_ID = "placeholder";
|
|
480
|
+
var EMPTY_COMPOSITION = {
|
|
481
|
+
_id: "_empty_composition_id",
|
|
482
|
+
_name: "An empty composition used for contextual editing",
|
|
483
|
+
type: "_empty_composition_type"
|
|
484
|
+
};
|
|
485
|
+
var EDGE_MIN_CACHE_TTL = 10;
|
|
486
|
+
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
487
|
+
var EDGE_DEFAULT_CACHE_TTL = 30;
|
|
488
|
+
var EDGE_CACHE_DISABLED = -1;
|
|
489
|
+
var ASSET_PARAMETER_TYPE = "asset";
|
|
490
|
+
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
|
491
|
+
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
|
492
|
+
var REFERENCE_DATA_TYPE_ID = "uniformContentInternalReference";
|
|
493
|
+
|
|
494
|
+
// src/clients/compositionHelpers.ts
|
|
495
|
+
function resolveCompositionSelector(args) {
|
|
496
|
+
if ("compositionId" in args) {
|
|
497
|
+
const { compositionId, editionId, versionId, ...readOptions } = args;
|
|
498
|
+
return {
|
|
499
|
+
readOptions,
|
|
500
|
+
// raw mode matches on composition OR edition id via the compositionId param
|
|
501
|
+
compositionId: editionId != null ? editionId : compositionId,
|
|
502
|
+
versionId,
|
|
503
|
+
hasCompositionId: true,
|
|
504
|
+
pinnedEdition: editionId !== void 0
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
return { readOptions: args, hasCompositionId: false, pinnedEdition: false };
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
// src/clients/DeliveryClientBase.ts
|
|
511
|
+
var DEFAULT_EDGE_API_HOST = "https://uniform.global";
|
|
512
|
+
var DeliveryClientBase = class extends ContentClientBase {
|
|
513
|
+
constructor(options) {
|
|
514
|
+
var _a;
|
|
515
|
+
super(
|
|
516
|
+
options,
|
|
517
|
+
/* defaultBypassCache */
|
|
518
|
+
false
|
|
519
|
+
);
|
|
520
|
+
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : DEFAULT_EDGE_API_HOST;
|
|
521
|
+
this.edgeRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
|
|
522
|
+
}
|
|
523
|
+
/** Coerces the `diagnostics` option into the shape the edge endpoints accept. */
|
|
524
|
+
coerceDiagnostics(diagnostics) {
|
|
525
|
+
return typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0;
|
|
526
|
+
}
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
// src/clients/CompositionDeliveryClient.ts
|
|
530
|
+
var EDGE_SINGLE_URL = "/api/v1/composition";
|
|
531
|
+
var EDGE_LIST_URL = "/api/v1/compositions";
|
|
532
|
+
var CompositionDeliveryClient = class extends DeliveryClientBase {
|
|
533
|
+
constructor(options) {
|
|
534
|
+
super(options);
|
|
535
|
+
}
|
|
536
|
+
/** Fetches exactly one composition (throws `ApiClientError(404)` if absent). */
|
|
537
|
+
get(args) {
|
|
538
|
+
var _a;
|
|
539
|
+
const { diagnostics, select, ...rest } = args;
|
|
540
|
+
const { readOptions, compositionId, versionId, pinnedEdition } = resolveCompositionSelector(rest);
|
|
541
|
+
const url = this.createUrl(
|
|
542
|
+
EDGE_SINGLE_URL,
|
|
543
|
+
{
|
|
544
|
+
...readOptions,
|
|
545
|
+
...projectionToQuery(select),
|
|
546
|
+
// A pinned edition is folded into compositionId (raw matches edition or
|
|
547
|
+
// composition id); there is no editionId query param on this endpoint.
|
|
548
|
+
compositionId,
|
|
549
|
+
versionId,
|
|
550
|
+
projectId: this.options.projectId,
|
|
551
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
552
|
+
// editionId pins a specific edition for preview; otherwise locale-best.
|
|
553
|
+
editions: pinnedEdition ? "raw" : "auto",
|
|
554
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
555
|
+
},
|
|
556
|
+
this.edgeApiHost
|
|
557
|
+
);
|
|
558
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
559
|
+
}
|
|
560
|
+
/** Fetches a list of compositions, optionally filtered. */
|
|
561
|
+
list(args = {}) {
|
|
562
|
+
var _a;
|
|
563
|
+
const { diagnostics, filters, select, ...rest } = args;
|
|
564
|
+
const url = this.createUrl(
|
|
565
|
+
EDGE_LIST_URL,
|
|
566
|
+
{
|
|
567
|
+
...rest,
|
|
568
|
+
...(0, import_api5.rewriteFiltersForApi)(filters),
|
|
569
|
+
...projectionToQuery(select),
|
|
570
|
+
projectId: this.options.projectId,
|
|
571
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
572
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
573
|
+
},
|
|
574
|
+
this.edgeApiHost
|
|
575
|
+
);
|
|
576
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
// src/clients/CompositionManagementClient.ts
|
|
581
|
+
var import_api6 = require("@uniformdev/context/api");
|
|
582
|
+
|
|
583
|
+
// src/clients/resolveManagementEditions.ts
|
|
584
|
+
function resolveManagementEditions({
|
|
585
|
+
explicit,
|
|
586
|
+
pinnedEdition,
|
|
587
|
+
hasId,
|
|
588
|
+
hasLocale
|
|
589
|
+
}) {
|
|
590
|
+
if (explicit) {
|
|
591
|
+
return explicit;
|
|
592
|
+
}
|
|
593
|
+
if (pinnedEdition) {
|
|
594
|
+
return "raw";
|
|
595
|
+
}
|
|
596
|
+
if (!hasId) {
|
|
597
|
+
return void 0;
|
|
598
|
+
}
|
|
599
|
+
return hasLocale ? "auto" : "raw";
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
// src/clients/CompositionManagementClient.ts
|
|
310
603
|
var CANVAS_URL = "/api/v1/canvas";
|
|
311
|
-
var
|
|
604
|
+
var CANVAS_HISTORY_URL = "/api/v1/canvas-history";
|
|
605
|
+
var CompositionManagementClient = class extends ContentClientBase {
|
|
606
|
+
constructor(options) {
|
|
607
|
+
super(
|
|
608
|
+
options,
|
|
609
|
+
/* defaultBypassCache */
|
|
610
|
+
true
|
|
611
|
+
);
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* Fetches one composition in canonical shape (throws `ApiClientError(404)` if
|
|
615
|
+
* absent).
|
|
616
|
+
*/
|
|
617
|
+
get(args) {
|
|
618
|
+
var _a;
|
|
619
|
+
const { select, ...selectorArgs } = args;
|
|
620
|
+
const { readOptions, compositionId, versionId, hasCompositionId, pinnedEdition } = resolveCompositionSelector(selectorArgs);
|
|
621
|
+
const url = this.createUrl(CANVAS_URL, {
|
|
622
|
+
format: CANONICAL_FORMAT,
|
|
623
|
+
// Caller-supplied shaping flags and non-id selector keys ride along and
|
|
624
|
+
// override the format alias server-side.
|
|
625
|
+
...readOptions,
|
|
626
|
+
...projectionToQuery(select),
|
|
627
|
+
// A pinned edition is folded into compositionId; there is no editionId
|
|
628
|
+
// query param on this endpoint.
|
|
629
|
+
compositionId,
|
|
630
|
+
versionId,
|
|
631
|
+
projectId: this.options.projectId,
|
|
632
|
+
state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE,
|
|
633
|
+
editions: resolveManagementEditions({
|
|
634
|
+
explicit: readOptions.editions,
|
|
635
|
+
pinnedEdition,
|
|
636
|
+
hasId: hasCompositionId,
|
|
637
|
+
hasLocale: readOptions.locale != null
|
|
638
|
+
})
|
|
639
|
+
});
|
|
640
|
+
return this.apiClient(url);
|
|
641
|
+
}
|
|
642
|
+
/** Fetches a list of compositions in canonical shape. */
|
|
643
|
+
list(args = {}) {
|
|
644
|
+
var _a;
|
|
645
|
+
const { filters, select, ...rest } = args;
|
|
646
|
+
const url = this.createUrl(CANVAS_URL, {
|
|
647
|
+
format: CANONICAL_FORMAT,
|
|
648
|
+
...rest,
|
|
649
|
+
...(0, import_api6.rewriteFiltersForApi)(filters),
|
|
650
|
+
...projectionToQuery(select),
|
|
651
|
+
projectId: this.options.projectId,
|
|
652
|
+
state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE
|
|
653
|
+
});
|
|
654
|
+
return this.apiClient(url);
|
|
655
|
+
}
|
|
656
|
+
/** Creates or updates a composition. Returns the new `x-modified-at` timestamp. */
|
|
657
|
+
async save(body, opts) {
|
|
658
|
+
const url = this.createUrl(CANVAS_URL);
|
|
659
|
+
const headers = {};
|
|
660
|
+
if (opts == null ? void 0 : opts.ifUnmodifiedSince) {
|
|
661
|
+
headers["x-if-unmodified-since"] = opts.ifUnmodifiedSince;
|
|
662
|
+
}
|
|
663
|
+
const { response } = await this.apiClientWithResponse(url, {
|
|
664
|
+
method: "PUT",
|
|
665
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
666
|
+
expectNoContent: true,
|
|
667
|
+
headers
|
|
668
|
+
});
|
|
669
|
+
return { modified: response.headers.get("x-modified-at") };
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* Saves the draft and publishes in one call (two PUTs). The optimistic
|
|
673
|
+
* concurrency guard, if any, applies to the draft write.
|
|
674
|
+
*/
|
|
675
|
+
async saveAndPublish(body, opts) {
|
|
676
|
+
await this.save({ ...body, state: CANVAS_DRAFT_STATE }, opts);
|
|
677
|
+
return this.save({ ...body, state: CANVAS_PUBLISHED_STATE });
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Removes only the published state, leaving the draft intact. Scoped to a
|
|
681
|
+
* single edition when `editionId` is supplied; otherwise unpublishes all editions.
|
|
682
|
+
* To unpublish only the base edition, pass editionId and compositionId as the same value.
|
|
683
|
+
*/
|
|
684
|
+
async unpublish(selector) {
|
|
685
|
+
await this.deleteComposition({ ...selector, state: CANVAS_PUBLISHED_STATE });
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Deletes across all states. Scoped to a single edition when `editionId` is
|
|
689
|
+
* supplied; otherwise deletes all states and editions.
|
|
690
|
+
* Use `unpublish` to drop only the published state.
|
|
691
|
+
*/
|
|
692
|
+
async remove(selector) {
|
|
693
|
+
await this.deleteComposition(selector);
|
|
694
|
+
}
|
|
695
|
+
/** Fetches historical versions of a composition or pattern. */
|
|
696
|
+
history(args) {
|
|
697
|
+
const url = this.createUrl(CANVAS_HISTORY_URL, { ...args, projectId: this.options.projectId });
|
|
698
|
+
return this.apiClient(url);
|
|
699
|
+
}
|
|
700
|
+
async deleteComposition(body) {
|
|
701
|
+
const url = this.createUrl(CANVAS_URL);
|
|
702
|
+
await this.apiClient(url, {
|
|
703
|
+
method: "DELETE",
|
|
704
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
705
|
+
expectNoContent: true
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
};
|
|
709
|
+
|
|
710
|
+
// src/clients/ContentTypeClient.ts
|
|
711
|
+
var import_api7 = require("@uniformdev/context/api");
|
|
712
|
+
var CONTENT_TYPES_URL = "/api/v1/content-types";
|
|
713
|
+
var ContentTypeClient = class extends ContentClientBase {
|
|
714
|
+
constructor(options) {
|
|
715
|
+
super(
|
|
716
|
+
options,
|
|
717
|
+
/* defaultBypassCache */
|
|
718
|
+
true
|
|
719
|
+
);
|
|
720
|
+
}
|
|
721
|
+
/** Fetches one content type by id (throws `ApiClientError(404)` if absent). */
|
|
722
|
+
async get(args) {
|
|
723
|
+
var _a;
|
|
724
|
+
const url = this.createUrl(CONTENT_TYPES_URL, {
|
|
725
|
+
contentTypeIDs: [args.contentTypeId],
|
|
726
|
+
limit: 1,
|
|
727
|
+
projectId: this.options.projectId
|
|
728
|
+
});
|
|
729
|
+
const res = await this.apiClient(url);
|
|
730
|
+
const contentType = (_a = res.contentTypes) == null ? void 0 : _a[0];
|
|
731
|
+
if (!contentType) {
|
|
732
|
+
throw new import_api7.ApiClientError("Content type not found", "GET", url.toString(), 404, "Not Found");
|
|
733
|
+
}
|
|
734
|
+
return contentType;
|
|
735
|
+
}
|
|
736
|
+
/** Fetches a list of content types. */
|
|
737
|
+
list(args) {
|
|
738
|
+
const url = this.createUrl(CONTENT_TYPES_URL, { ...args, projectId: this.options.projectId });
|
|
739
|
+
return this.apiClient(url);
|
|
740
|
+
}
|
|
741
|
+
/** Creates or updates a content type. */
|
|
742
|
+
async save(body, opts = {}) {
|
|
743
|
+
const url = this.createUrl(CONTENT_TYPES_URL);
|
|
744
|
+
let contentType = body.contentType;
|
|
745
|
+
if (typeof contentType.slugSettings === "object" && contentType.slugSettings !== null && Object.keys(contentType.slugSettings).length === 0) {
|
|
746
|
+
const { slugSettings: _omitEmptySlugSettings, ...rest } = contentType;
|
|
747
|
+
contentType = rest;
|
|
748
|
+
}
|
|
749
|
+
await this.apiClient(url, {
|
|
750
|
+
method: "PUT",
|
|
751
|
+
body: JSON.stringify({ ...body, contentType, projectId: this.options.projectId }),
|
|
752
|
+
expectNoContent: true,
|
|
753
|
+
headers: opts.autogenerateDataTypes ? { "x-uniform-autogenerate-data-types": "true" } : {}
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
/** Deletes a content type. */
|
|
757
|
+
async remove(args) {
|
|
758
|
+
const url = this.createUrl(CONTENT_TYPES_URL);
|
|
759
|
+
await this.apiClient(url, {
|
|
760
|
+
method: "DELETE",
|
|
761
|
+
body: JSON.stringify({ ...args, projectId: this.options.projectId }),
|
|
762
|
+
expectNoContent: true
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
};
|
|
766
|
+
|
|
767
|
+
// src/clients/EntryDeliveryClient.ts
|
|
768
|
+
var import_api9 = require("@uniformdev/context/api");
|
|
769
|
+
|
|
770
|
+
// src/clients/entryHelpers.ts
|
|
771
|
+
var import_api8 = require("@uniformdev/context/api");
|
|
772
|
+
function resolveEntrySelector(args) {
|
|
773
|
+
if ("entryId" in args) {
|
|
774
|
+
const { entryId, editionId, versionId, ...readOptions2 } = args;
|
|
775
|
+
return {
|
|
776
|
+
readOptions: readOptions2,
|
|
777
|
+
entryIDs: [editionId != null ? editionId : entryId],
|
|
778
|
+
versionId,
|
|
779
|
+
pinnedEdition: editionId !== void 0
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
const { slug, ...readOptions } = args;
|
|
783
|
+
return { readOptions, slug, pinnedEdition: false };
|
|
784
|
+
}
|
|
785
|
+
function unwrapSingleEntry(res, url) {
|
|
786
|
+
var _a;
|
|
787
|
+
const entry = (_a = res.entries) == null ? void 0 : _a[0];
|
|
788
|
+
if (!entry) {
|
|
789
|
+
throw new import_api8.ApiClientError("Entry not found", "GET", url.toString(), 404, "Not Found");
|
|
790
|
+
}
|
|
791
|
+
return entry;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
// src/clients/EntryDeliveryClient.ts
|
|
795
|
+
var ENTRIES_URL = "/api/v1/entries";
|
|
796
|
+
var EntryDeliveryClient = class extends DeliveryClientBase {
|
|
797
|
+
constructor(options) {
|
|
798
|
+
super(options);
|
|
799
|
+
}
|
|
800
|
+
/** Fetches exactly one entry by id or slug (throws `ApiClientError(404)` if absent). */
|
|
801
|
+
async get(args) {
|
|
802
|
+
var _a, _b;
|
|
803
|
+
const { diagnostics, select, ...rest } = args;
|
|
804
|
+
const { entryIDs, slug, versionId, pinnedEdition, readOptions } = resolveEntrySelector(rest);
|
|
805
|
+
const url = this.createUrl(
|
|
806
|
+
ENTRIES_URL,
|
|
807
|
+
{
|
|
808
|
+
...readOptions,
|
|
809
|
+
...projectionToQuery(select),
|
|
810
|
+
projectId: this.options.projectId,
|
|
811
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
812
|
+
entryIDs,
|
|
813
|
+
slug,
|
|
814
|
+
versionId,
|
|
815
|
+
// A pinned edition is fetched exactly; otherwise locale-best.
|
|
816
|
+
editions: pinnedEdition ? "raw" : "auto",
|
|
817
|
+
// An id lookup wants that exact entity regardless of type, so default the
|
|
818
|
+
// pattern filter to 'any' (origin default `false` would 404 a pattern id).
|
|
819
|
+
// Scoped to id lookups; slug reads keep the origin default. Explicit
|
|
820
|
+
// `pattern` overrides via the `...readOptions` spread above.
|
|
821
|
+
pattern: (_b = args.pattern) != null ? _b : entryIDs ? "any" : void 0,
|
|
822
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
823
|
+
},
|
|
824
|
+
this.edgeApiHost
|
|
825
|
+
);
|
|
826
|
+
const res = await this.apiClient(url, this.edgeRequestInit);
|
|
827
|
+
return unwrapSingleEntry(res, url);
|
|
828
|
+
}
|
|
829
|
+
/** Fetches a list of entries, optionally filtered. */
|
|
830
|
+
list(args = {}) {
|
|
831
|
+
var _a;
|
|
832
|
+
const { diagnostics, filters, select, ...rest } = args;
|
|
833
|
+
const url = this.createUrl(
|
|
834
|
+
ENTRIES_URL,
|
|
835
|
+
{
|
|
836
|
+
...rest,
|
|
837
|
+
...(0, import_api9.rewriteFiltersForApi)(filters),
|
|
838
|
+
...projectionToQuery(select),
|
|
839
|
+
projectId: this.options.projectId,
|
|
840
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
841
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
842
|
+
},
|
|
843
|
+
this.edgeApiHost
|
|
844
|
+
);
|
|
845
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
846
|
+
}
|
|
847
|
+
};
|
|
848
|
+
|
|
849
|
+
// src/clients/EntryManagementClient.ts
|
|
850
|
+
var import_api10 = require("@uniformdev/context/api");
|
|
851
|
+
var ENTRIES_URL2 = "/api/v1/entries";
|
|
852
|
+
var ENTRIES_HISTORY_URL = "/api/v1/entries-history";
|
|
853
|
+
var EntryManagementClient = class extends ContentClientBase {
|
|
854
|
+
constructor(options) {
|
|
855
|
+
super(
|
|
856
|
+
options,
|
|
857
|
+
/* defaultBypassCache */
|
|
858
|
+
true
|
|
859
|
+
);
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* Fetches one entry by id or slug in canonical shape (throws
|
|
863
|
+
* `ApiClientError(404)` if absent).
|
|
864
|
+
*/
|
|
865
|
+
async get(args) {
|
|
866
|
+
var _a, _b;
|
|
867
|
+
const { select, ...selectorArgs } = args;
|
|
868
|
+
const { entryIDs, slug, versionId, readOptions, pinnedEdition } = resolveEntrySelector(selectorArgs);
|
|
869
|
+
const url = this.createUrl(ENTRIES_URL2, {
|
|
870
|
+
format: CANONICAL_FORMAT,
|
|
871
|
+
...readOptions,
|
|
872
|
+
...projectionToQuery(select),
|
|
873
|
+
projectId: this.options.projectId,
|
|
874
|
+
state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE,
|
|
875
|
+
editions: resolveManagementEditions({
|
|
876
|
+
explicit: readOptions.editions,
|
|
877
|
+
pinnedEdition,
|
|
878
|
+
hasId: entryIDs != null,
|
|
879
|
+
hasLocale: readOptions.locale != null
|
|
880
|
+
}),
|
|
881
|
+
// An id lookup wants that exact entity regardless of type, so default the
|
|
882
|
+
// pattern filter to 'any' (origin default `false` would 404 a pattern id).
|
|
883
|
+
// Scoped to id lookups; slug reads keep the origin default. Explicit
|
|
884
|
+
// `pattern` overrides via the `...readOptions` spread above.
|
|
885
|
+
pattern: (_b = args.pattern) != null ? _b : entryIDs ? "any" : void 0,
|
|
886
|
+
entryIDs,
|
|
887
|
+
slug,
|
|
888
|
+
versionId
|
|
889
|
+
});
|
|
890
|
+
const res = await this.apiClient(url);
|
|
891
|
+
return unwrapSingleEntry(res, url);
|
|
892
|
+
}
|
|
893
|
+
/** Fetches a list of entries in canonical shape. */
|
|
894
|
+
list(args = {}) {
|
|
895
|
+
var _a;
|
|
896
|
+
const { filters, select, ...rest } = args;
|
|
897
|
+
const url = this.createUrl(ENTRIES_URL2, {
|
|
898
|
+
format: CANONICAL_FORMAT,
|
|
899
|
+
...rest,
|
|
900
|
+
...(0, import_api10.rewriteFiltersForApi)(filters),
|
|
901
|
+
...projectionToQuery(select),
|
|
902
|
+
projectId: this.options.projectId,
|
|
903
|
+
state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE
|
|
904
|
+
});
|
|
905
|
+
return this.apiClient(url);
|
|
906
|
+
}
|
|
907
|
+
/** Creates or updates an entry. Returns the new `x-modified-at` timestamp. */
|
|
908
|
+
async save(body, opts) {
|
|
909
|
+
const url = this.createUrl(ENTRIES_URL2);
|
|
910
|
+
const headers = {};
|
|
911
|
+
if (opts == null ? void 0 : opts.ifUnmodifiedSince) {
|
|
912
|
+
headers["x-if-unmodified-since"] = opts.ifUnmodifiedSince;
|
|
913
|
+
}
|
|
914
|
+
const { response } = await this.apiClientWithResponse(url, {
|
|
915
|
+
method: "PUT",
|
|
916
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
917
|
+
expectNoContent: true,
|
|
918
|
+
headers
|
|
919
|
+
});
|
|
920
|
+
return { modified: response.headers.get("x-modified-at") };
|
|
921
|
+
}
|
|
922
|
+
/** Saves the draft and publishes in one call (two PUTs). */
|
|
923
|
+
async saveAndPublish(body, opts) {
|
|
924
|
+
await this.save({ ...body, state: CANVAS_DRAFT_STATE }, opts);
|
|
925
|
+
return this.save({ ...body, state: CANVAS_PUBLISHED_STATE });
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* Removes only the published state, leaving the draft intact. Scoped to a
|
|
929
|
+
* single edition when `editionId` is supplied; otherwise unpublishes all editions.
|
|
930
|
+
* To unpublish only the base edition, pass editionId and entryId as the same value.
|
|
931
|
+
*/
|
|
932
|
+
async unpublish(selector) {
|
|
933
|
+
await this.deleteEntry({ ...selector, state: CANVAS_PUBLISHED_STATE });
|
|
934
|
+
}
|
|
935
|
+
/**
|
|
936
|
+
* Deletes across all states. Scoped to a single edition when `editionId` is
|
|
937
|
+
* supplied; otherwise deletes all states and editions.
|
|
938
|
+
* Use `unpublish` to drop only the published state.
|
|
939
|
+
*/
|
|
940
|
+
async remove(selector) {
|
|
941
|
+
await this.deleteEntry(selector);
|
|
942
|
+
}
|
|
943
|
+
/** Fetches historical versions of an entry. */
|
|
944
|
+
history(args) {
|
|
945
|
+
const url = this.createUrl(ENTRIES_HISTORY_URL, { ...args, projectId: this.options.projectId });
|
|
946
|
+
return this.apiClient(url);
|
|
947
|
+
}
|
|
948
|
+
async deleteEntry(body) {
|
|
949
|
+
const url = this.createUrl(ENTRIES_URL2);
|
|
950
|
+
await this.apiClient(url, {
|
|
951
|
+
method: "DELETE",
|
|
952
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
953
|
+
expectNoContent: true
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
};
|
|
957
|
+
|
|
958
|
+
// src/clients/deprecated/CanvasClient.ts
|
|
959
|
+
var import_api11 = require("@uniformdev/context/api");
|
|
960
|
+
var CANVAS_URL2 = "/api/v1/canvas";
|
|
961
|
+
var CanvasClient = class extends import_api11.ApiClient {
|
|
312
962
|
constructor(options) {
|
|
313
963
|
var _a;
|
|
314
964
|
if (!options.limitPolicy) {
|
|
@@ -322,10 +972,10 @@ var CanvasClient = class extends import_api2.ApiClient {
|
|
|
322
972
|
async getCompositionList(params = {}) {
|
|
323
973
|
const { projectId } = this.options;
|
|
324
974
|
const { resolveData, filters, select, ...originParams } = params;
|
|
325
|
-
const rewrittenFilters = (0,
|
|
975
|
+
const rewrittenFilters = (0, import_api11.rewriteFiltersForApi)(filters);
|
|
326
976
|
const rewrittenSelect = projectionToQuery(select);
|
|
327
977
|
if (!resolveData) {
|
|
328
|
-
const fetchUri = this.createUrl(
|
|
978
|
+
const fetchUri = this.createUrl(CANVAS_URL2, {
|
|
329
979
|
...originParams,
|
|
330
980
|
projectId,
|
|
331
981
|
...rewrittenFilters,
|
|
@@ -373,7 +1023,7 @@ var CanvasClient = class extends import_api2.ApiClient {
|
|
|
373
1023
|
}) {
|
|
374
1024
|
const { projectId } = this.options;
|
|
375
1025
|
if (skipDataResolution) {
|
|
376
|
-
return this.apiClient(this.createUrl(
|
|
1026
|
+
return this.apiClient(this.createUrl(CANVAS_URL2, { ...params, projectId }));
|
|
377
1027
|
}
|
|
378
1028
|
const edgeParams = {
|
|
379
1029
|
...params,
|
|
@@ -385,7 +1035,7 @@ var CanvasClient = class extends import_api2.ApiClient {
|
|
|
385
1035
|
}
|
|
386
1036
|
/** Updates or creates a Canvas component definition */
|
|
387
1037
|
async updateComposition(body, options) {
|
|
388
|
-
const fetchUri = this.createUrl(
|
|
1038
|
+
const fetchUri = this.createUrl(CANVAS_URL2);
|
|
389
1039
|
const headers = {};
|
|
390
1040
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
391
1041
|
headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
@@ -400,7 +1050,7 @@ var CanvasClient = class extends import_api2.ApiClient {
|
|
|
400
1050
|
}
|
|
401
1051
|
/** Deletes a Canvas component definition */
|
|
402
1052
|
async removeComposition(body) {
|
|
403
|
-
const fetchUri = this.createUrl(
|
|
1053
|
+
const fetchUri = this.createUrl(CANVAS_URL2);
|
|
404
1054
|
const { projectId } = this.options;
|
|
405
1055
|
await this.apiClient(fetchUri, {
|
|
406
1056
|
method: "DELETE",
|
|
@@ -439,53 +1089,10 @@ var UncachedCanvasClient = class extends CanvasClient {
|
|
|
439
1089
|
}
|
|
440
1090
|
};
|
|
441
1091
|
|
|
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");
|
|
1092
|
+
// src/clients/deprecated/ContentClient.ts
|
|
1093
|
+
var import_api12 = require("@uniformdev/context/api");
|
|
487
1094
|
var _contentTypesUrl, _entriesUrl;
|
|
488
|
-
var _ContentClient = class _ContentClient extends
|
|
1095
|
+
var _ContentClient = class _ContentClient extends import_api12.ApiClient {
|
|
489
1096
|
constructor(options) {
|
|
490
1097
|
var _a;
|
|
491
1098
|
super(options);
|
|
@@ -499,7 +1106,7 @@ var _ContentClient = class _ContentClient extends import_api4.ApiClient {
|
|
|
499
1106
|
getEntries(options) {
|
|
500
1107
|
const { projectId } = this.options;
|
|
501
1108
|
const { skipDataResolution, filters, select, ...params } = options;
|
|
502
|
-
const rewrittenFilters = (0,
|
|
1109
|
+
const rewrittenFilters = (0, import_api12.rewriteFiltersForApi)(filters);
|
|
503
1110
|
const rewrittenSelect = projectionToQuery(select);
|
|
504
1111
|
if (skipDataResolution) {
|
|
505
1112
|
const url = this.createUrl(__privateGet(_ContentClient, _entriesUrl), {
|
|
@@ -592,27 +1199,31 @@ var UncachedContentClient = class extends ContentClient {
|
|
|
592
1199
|
};
|
|
593
1200
|
|
|
594
1201
|
// src/DataSourceClient.ts
|
|
595
|
-
var
|
|
1202
|
+
var import_api13 = require("@uniformdev/context/api");
|
|
596
1203
|
var dataSourceUrl = "/api/v1/data-source";
|
|
597
1204
|
var dataSourcesUrl = "/api/v1/data-sources";
|
|
598
|
-
var DataSourceClient = class extends
|
|
1205
|
+
var DataSourceClient = class extends import_api13.ApiClient {
|
|
599
1206
|
constructor(options) {
|
|
600
1207
|
super(options);
|
|
601
1208
|
}
|
|
602
|
-
/** Fetches
|
|
1209
|
+
/** Fetches a single DataSource by id (with decrypted secrets). */
|
|
603
1210
|
async get(options) {
|
|
604
1211
|
const { projectId } = this.options;
|
|
605
1212
|
const fetchUri = this.createUrl(dataSourceUrl, { ...options, projectId });
|
|
606
1213
|
return await this.apiClient(fetchUri);
|
|
607
1214
|
}
|
|
608
|
-
/** Fetches
|
|
609
|
-
async
|
|
1215
|
+
/** Fetches the list of DataSources for a project (secrets masked). */
|
|
1216
|
+
async list(options) {
|
|
610
1217
|
const { projectId } = this.options;
|
|
611
1218
|
const fetchUri = this.createUrl(dataSourcesUrl, { ...options, projectId });
|
|
612
1219
|
return await this.apiClient(fetchUri);
|
|
613
1220
|
}
|
|
1221
|
+
/** @deprecated Use {@link list} instead. */
|
|
1222
|
+
async getList(options) {
|
|
1223
|
+
return this.list(options);
|
|
1224
|
+
}
|
|
614
1225
|
/** Updates or creates (based on id) a DataSource */
|
|
615
|
-
async
|
|
1226
|
+
async save(body) {
|
|
616
1227
|
const fetchUri = this.createUrl(dataSourceUrl);
|
|
617
1228
|
await this.apiClient(fetchUri, {
|
|
618
1229
|
method: "PUT",
|
|
@@ -620,6 +1231,10 @@ var DataSourceClient = class extends import_api5.ApiClient {
|
|
|
620
1231
|
expectNoContent: true
|
|
621
1232
|
});
|
|
622
1233
|
}
|
|
1234
|
+
/** @deprecated Use {@link save} instead. */
|
|
1235
|
+
async upsert(body) {
|
|
1236
|
+
return this.save(body);
|
|
1237
|
+
}
|
|
623
1238
|
/** Deletes a DataSource */
|
|
624
1239
|
async remove(body) {
|
|
625
1240
|
const fetchUri = this.createUrl(dataSourceUrl);
|
|
@@ -632,20 +1247,24 @@ var DataSourceClient = class extends import_api5.ApiClient {
|
|
|
632
1247
|
};
|
|
633
1248
|
|
|
634
1249
|
// src/DataTypeClient.ts
|
|
635
|
-
var
|
|
1250
|
+
var import_api14 = require("@uniformdev/context/api");
|
|
636
1251
|
var _url;
|
|
637
|
-
var _DataTypeClient = class _DataTypeClient extends
|
|
1252
|
+
var _DataTypeClient = class _DataTypeClient extends import_api14.ApiClient {
|
|
638
1253
|
constructor(options) {
|
|
639
1254
|
super(options);
|
|
640
1255
|
}
|
|
641
|
-
/** Fetches
|
|
642
|
-
async
|
|
1256
|
+
/** Fetches a list of DataTypes for a project */
|
|
1257
|
+
async list(options) {
|
|
643
1258
|
const { projectId } = this.options;
|
|
644
1259
|
const fetchUri = this.createUrl(__privateGet(_DataTypeClient, _url), { ...options, projectId });
|
|
645
1260
|
return await this.apiClient(fetchUri);
|
|
646
1261
|
}
|
|
1262
|
+
/** @deprecated Use {@link list} instead. */
|
|
1263
|
+
async get(options) {
|
|
1264
|
+
return this.list(options);
|
|
1265
|
+
}
|
|
647
1266
|
/** Updates or creates (based on id) a DataType */
|
|
648
|
-
async
|
|
1267
|
+
async save(body) {
|
|
649
1268
|
const fetchUri = this.createUrl(__privateGet(_DataTypeClient, _url));
|
|
650
1269
|
await this.apiClient(fetchUri, {
|
|
651
1270
|
method: "PUT",
|
|
@@ -653,6 +1272,10 @@ var _DataTypeClient = class _DataTypeClient extends import_api6.ApiClient {
|
|
|
653
1272
|
expectNoContent: true
|
|
654
1273
|
});
|
|
655
1274
|
}
|
|
1275
|
+
/** @deprecated Use {@link save} instead. */
|
|
1276
|
+
async upsert(body) {
|
|
1277
|
+
return this.save(body);
|
|
1278
|
+
}
|
|
656
1279
|
/** Deletes a DataType */
|
|
657
1280
|
async remove(body) {
|
|
658
1281
|
const fetchUri = this.createUrl(__privateGet(_DataTypeClient, _url));
|
|
@@ -788,61 +1411,6 @@ function getComponentPath(ancestorsAndSelf) {
|
|
|
788
1411
|
return `.${path.join(".")}`;
|
|
789
1412
|
}
|
|
790
1413
|
|
|
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
1414
|
// src/utils/guards.ts
|
|
847
1415
|
function isRootEntryReference(root) {
|
|
848
1416
|
return root.type === "root" && isEntryData(root.node);
|
|
@@ -920,9 +1488,9 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
920
1488
|
let bufferStartIndex = 0;
|
|
921
1489
|
let bufferEndIndex = 0;
|
|
922
1490
|
let tokenCount = 0;
|
|
923
|
-
const handleToken = (token, type) => {
|
|
1491
|
+
const handleToken = (token, type, offset) => {
|
|
924
1492
|
tokenCount++;
|
|
925
|
-
return onToken == null ? void 0 : onToken(token, type);
|
|
1493
|
+
return onToken == null ? void 0 : onToken(token, type, offset);
|
|
926
1494
|
};
|
|
927
1495
|
let state = "text";
|
|
928
1496
|
for (let index = 0; index < serialized.length; index++) {
|
|
@@ -933,7 +1501,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
933
1501
|
if (char === variablePrefix[0] && serialized[index + 1] === variablePrefix[1]) {
|
|
934
1502
|
if (serialized[index - 1] === escapeCharacter) {
|
|
935
1503
|
bufferEndIndex -= escapeCharacter.length;
|
|
936
|
-
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
|
1504
|
+
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text", bufferStartIndex) === false) {
|
|
937
1505
|
return tokenCount;
|
|
938
1506
|
}
|
|
939
1507
|
bufferStartIndex = index;
|
|
@@ -942,12 +1510,12 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
942
1510
|
}
|
|
943
1511
|
if (state === "variable") {
|
|
944
1512
|
const textStart = bufferStartIndex - variablePrefix.length;
|
|
945
|
-
if (handleToken(serialized.substring(textStart, bufferEndIndex), "text") === false) {
|
|
1513
|
+
if (handleToken(serialized.substring(textStart, bufferEndIndex), "text", textStart) === false) {
|
|
946
1514
|
return tokenCount;
|
|
947
1515
|
}
|
|
948
1516
|
bufferStartIndex = bufferEndIndex;
|
|
949
1517
|
} else if (bufferEndIndex > bufferStartIndex) {
|
|
950
|
-
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
|
1518
|
+
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text", bufferStartIndex) === false) {
|
|
951
1519
|
return tokenCount;
|
|
952
1520
|
}
|
|
953
1521
|
bufferStartIndex = bufferEndIndex;
|
|
@@ -965,7 +1533,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
965
1533
|
state = "text";
|
|
966
1534
|
if (bufferEndIndex > bufferStartIndex) {
|
|
967
1535
|
const unescapedVariableName = serialized.substring(bufferStartIndex, bufferEndIndex).replace(/\\([${}])/g, "$1");
|
|
968
|
-
if (handleToken(unescapedVariableName, "variable") === false) {
|
|
1536
|
+
if (handleToken(unescapedVariableName, "variable", bufferStartIndex) === false) {
|
|
969
1537
|
return tokenCount;
|
|
970
1538
|
}
|
|
971
1539
|
bufferStartIndex = bufferEndIndex + variableSuffix.length;
|
|
@@ -979,7 +1547,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
979
1547
|
bufferStartIndex -= variablePrefix.length;
|
|
980
1548
|
}
|
|
981
1549
|
if (bufferStartIndex < serialized.length) {
|
|
982
|
-
handleToken(serialized.substring(bufferStartIndex), state);
|
|
1550
|
+
handleToken(serialized.substring(bufferStartIndex), state, bufferStartIndex);
|
|
983
1551
|
}
|
|
984
1552
|
return tokenCount;
|
|
985
1553
|
}
|
|
@@ -2296,24 +2864,28 @@ function walkPropertyValues(property, visitor) {
|
|
|
2296
2864
|
}
|
|
2297
2865
|
|
|
2298
2866
|
// src/EntityReleasesClient.ts
|
|
2299
|
-
var
|
|
2300
|
-
var
|
|
2301
|
-
var EntityReleasesClient = class extends
|
|
2867
|
+
var import_api15 = require("@uniformdev/context/api");
|
|
2868
|
+
var entityReleasesUrl = "/api/v1/entity-releases";
|
|
2869
|
+
var EntityReleasesClient = class extends import_api15.ApiClient {
|
|
2302
2870
|
constructor(options) {
|
|
2303
2871
|
super(options);
|
|
2304
2872
|
}
|
|
2305
2873
|
/** Fetches entity across all releases (and base) */
|
|
2306
|
-
async
|
|
2874
|
+
async list(options) {
|
|
2307
2875
|
const { projectId } = this.options;
|
|
2308
|
-
const fetchUri = this.createUrl(
|
|
2876
|
+
const fetchUri = this.createUrl(entityReleasesUrl, { ...options, projectId });
|
|
2309
2877
|
return await this.apiClient(fetchUri);
|
|
2310
2878
|
}
|
|
2879
|
+
/** @deprecated Use {@link list} instead. */
|
|
2880
|
+
async get(options) {
|
|
2881
|
+
return this.list(options);
|
|
2882
|
+
}
|
|
2311
2883
|
};
|
|
2312
2884
|
|
|
2313
2885
|
// src/IntegrationPropertyEditorsClient.ts
|
|
2314
|
-
var
|
|
2886
|
+
var import_api16 = require("@uniformdev/context/api");
|
|
2315
2887
|
var _baseUrl;
|
|
2316
|
-
var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient extends
|
|
2888
|
+
var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient extends import_api16.ApiClient {
|
|
2317
2889
|
constructor(options) {
|
|
2318
2890
|
super(options);
|
|
2319
2891
|
this.teamId = options.teamId;
|
|
@@ -2356,17 +2928,21 @@ __privateAdd(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-p
|
|
|
2356
2928
|
var IntegrationPropertyEditorsClient = _IntegrationPropertyEditorsClient;
|
|
2357
2929
|
|
|
2358
2930
|
// src/LabelClient.ts
|
|
2359
|
-
var
|
|
2931
|
+
var import_api17 = require("@uniformdev/context/api");
|
|
2360
2932
|
var LABELS_URL = "/api/v1/labels";
|
|
2361
|
-
var LabelClient = class extends
|
|
2362
|
-
/** Fetches labels for the current project. */
|
|
2363
|
-
async
|
|
2933
|
+
var LabelClient = class extends import_api17.ApiClient {
|
|
2934
|
+
/** Fetches a list of labels for the current project. */
|
|
2935
|
+
async list(options) {
|
|
2364
2936
|
const { projectId } = this.options;
|
|
2365
2937
|
const fetchUri = this.createUrl(LABELS_URL, { ...options, projectId });
|
|
2366
2938
|
return await this.apiClient(fetchUri);
|
|
2367
2939
|
}
|
|
2940
|
+
/** @deprecated Use {@link list} instead. */
|
|
2941
|
+
async getLabels(options) {
|
|
2942
|
+
return this.list(options);
|
|
2943
|
+
}
|
|
2368
2944
|
/** Updates or creates a label. */
|
|
2369
|
-
async
|
|
2945
|
+
async save(body) {
|
|
2370
2946
|
const { projectId } = this.options;
|
|
2371
2947
|
const fetchUri = this.createUrl(LABELS_URL);
|
|
2372
2948
|
await this.apiClient(fetchUri, {
|
|
@@ -2375,8 +2951,12 @@ var LabelClient = class extends import_api9.ApiClient {
|
|
|
2375
2951
|
expectNoContent: true
|
|
2376
2952
|
});
|
|
2377
2953
|
}
|
|
2954
|
+
/** @deprecated Use {@link save} instead. */
|
|
2955
|
+
async upsertLabel(body) {
|
|
2956
|
+
return this.save(body);
|
|
2957
|
+
}
|
|
2378
2958
|
/** Deletes a label by id. */
|
|
2379
|
-
async
|
|
2959
|
+
async remove(options) {
|
|
2380
2960
|
const { projectId } = this.options;
|
|
2381
2961
|
const fetchUri = this.createUrl(LABELS_URL);
|
|
2382
2962
|
await this.apiClient(fetchUri, {
|
|
@@ -2385,6 +2965,10 @@ var LabelClient = class extends import_api9.ApiClient {
|
|
|
2385
2965
|
expectNoContent: true
|
|
2386
2966
|
});
|
|
2387
2967
|
}
|
|
2968
|
+
/** @deprecated Use {@link remove} instead. */
|
|
2969
|
+
async removeLabel(options) {
|
|
2970
|
+
return this.remove(options);
|
|
2971
|
+
}
|
|
2388
2972
|
};
|
|
2389
2973
|
var UncachedLabelClient = class extends LabelClient {
|
|
2390
2974
|
constructor(options) {
|
|
@@ -2393,20 +2977,24 @@ var UncachedLabelClient = class extends LabelClient {
|
|
|
2393
2977
|
};
|
|
2394
2978
|
|
|
2395
2979
|
// src/LocaleClient.ts
|
|
2396
|
-
var
|
|
2980
|
+
var import_api18 = require("@uniformdev/context/api");
|
|
2397
2981
|
var localesUrl = "/api/v1/locales";
|
|
2398
|
-
var LocaleClient = class extends
|
|
2982
|
+
var LocaleClient = class extends import_api18.ApiClient {
|
|
2399
2983
|
constructor(options) {
|
|
2400
2984
|
super(options);
|
|
2401
2985
|
}
|
|
2402
|
-
/** Fetches
|
|
2403
|
-
async
|
|
2986
|
+
/** Fetches a list of locales for a project */
|
|
2987
|
+
async list(options) {
|
|
2404
2988
|
const { projectId } = this.options;
|
|
2405
2989
|
const fetchUri = this.createUrl(localesUrl, { ...options, projectId });
|
|
2406
2990
|
return await this.apiClient(fetchUri);
|
|
2407
2991
|
}
|
|
2992
|
+
/** @deprecated Use {@link list} instead. */
|
|
2993
|
+
async get(options) {
|
|
2994
|
+
return this.list(options);
|
|
2995
|
+
}
|
|
2408
2996
|
/** Updates or creates (based on id) a locale */
|
|
2409
|
-
async
|
|
2997
|
+
async save(body) {
|
|
2410
2998
|
const fetchUri = this.createUrl(localesUrl);
|
|
2411
2999
|
await this.apiClient(fetchUri, {
|
|
2412
3000
|
method: "PUT",
|
|
@@ -2414,6 +3002,10 @@ var LocaleClient = class extends import_api10.ApiClient {
|
|
|
2414
3002
|
expectNoContent: true
|
|
2415
3003
|
});
|
|
2416
3004
|
}
|
|
3005
|
+
/** @deprecated Use {@link save} instead. */
|
|
3006
|
+
async upsert(body) {
|
|
3007
|
+
return this.save(body);
|
|
3008
|
+
}
|
|
2417
3009
|
/** Deletes a locale */
|
|
2418
3010
|
async remove(body) {
|
|
2419
3011
|
const fetchUri = this.createUrl(localesUrl);
|
|
@@ -2796,11 +3388,57 @@ var createCanvasChannel = ({
|
|
|
2796
3388
|
};
|
|
2797
3389
|
};
|
|
2798
3390
|
|
|
3391
|
+
// src/NotificationsClient.ts
|
|
3392
|
+
var import_api19 = require("@uniformdev/context/api");
|
|
3393
|
+
var _url2;
|
|
3394
|
+
var _NotificationsClient = class _NotificationsClient extends import_api19.ApiClient {
|
|
3395
|
+
constructor(options) {
|
|
3396
|
+
super(options);
|
|
3397
|
+
}
|
|
3398
|
+
/**
|
|
3399
|
+
* Lists notifications for the current user.
|
|
3400
|
+
*
|
|
3401
|
+
* @deprecated This API is experimental and may change without notice.
|
|
3402
|
+
*/
|
|
3403
|
+
async list(options) {
|
|
3404
|
+
const fetchUri = this.createUrl(__privateGet(_NotificationsClient, _url2), options);
|
|
3405
|
+
return await this.apiClient(fetchUri);
|
|
3406
|
+
}
|
|
3407
|
+
/**
|
|
3408
|
+
* Creates a notification for one or more recipients.
|
|
3409
|
+
*
|
|
3410
|
+
* @deprecated This API is experimental and may change without notice.
|
|
3411
|
+
*/
|
|
3412
|
+
async create(body) {
|
|
3413
|
+
const fetchUri = this.createUrl(__privateGet(_NotificationsClient, _url2));
|
|
3414
|
+
return await this.apiClient(fetchUri, {
|
|
3415
|
+
method: "POST",
|
|
3416
|
+
body: JSON.stringify(body)
|
|
3417
|
+
});
|
|
3418
|
+
}
|
|
3419
|
+
/**
|
|
3420
|
+
* Updates the read state of the current user's notifications.
|
|
3421
|
+
*
|
|
3422
|
+
* @deprecated This API is experimental and may change without notice.
|
|
3423
|
+
*/
|
|
3424
|
+
async setReadState(body) {
|
|
3425
|
+
const fetchUri = this.createUrl(__privateGet(_NotificationsClient, _url2));
|
|
3426
|
+
await this.apiClient(fetchUri, {
|
|
3427
|
+
method: "PATCH",
|
|
3428
|
+
body: JSON.stringify(body),
|
|
3429
|
+
expectNoContent: true
|
|
3430
|
+
});
|
|
3431
|
+
}
|
|
3432
|
+
};
|
|
3433
|
+
_url2 = new WeakMap();
|
|
3434
|
+
__privateAdd(_NotificationsClient, _url2, "/api/v1/notifications");
|
|
3435
|
+
var NotificationsClient = _NotificationsClient;
|
|
3436
|
+
|
|
2799
3437
|
// src/PreviewClient.ts
|
|
2800
|
-
var
|
|
3438
|
+
var import_api20 = require("@uniformdev/context/api");
|
|
2801
3439
|
var previewUrlsUrl = "/api/v1/preview-urls";
|
|
2802
3440
|
var previewViewportsUrl = "/api/v1/preview-viewports";
|
|
2803
|
-
var PreviewClient = class extends
|
|
3441
|
+
var PreviewClient = class extends import_api20.ApiClient {
|
|
2804
3442
|
constructor(options) {
|
|
2805
3443
|
super(options);
|
|
2806
3444
|
}
|
|
@@ -2863,15 +3501,15 @@ var PreviewClient = class extends import_api11.ApiClient {
|
|
|
2863
3501
|
};
|
|
2864
3502
|
|
|
2865
3503
|
// src/ProjectClient.ts
|
|
2866
|
-
var
|
|
2867
|
-
var
|
|
2868
|
-
var _ProjectClient = class _ProjectClient extends
|
|
3504
|
+
var import_api21 = require("@uniformdev/context/api");
|
|
3505
|
+
var _url3, _projectsUrl;
|
|
3506
|
+
var _ProjectClient = class _ProjectClient extends import_api21.ApiClient {
|
|
2869
3507
|
constructor(options) {
|
|
2870
3508
|
super({ ...options, bypassCache: true });
|
|
2871
3509
|
}
|
|
2872
3510
|
/** Fetches single Project */
|
|
2873
3511
|
async get(options) {
|
|
2874
|
-
const fetchUri = this.createUrl(__privateGet(_ProjectClient,
|
|
3512
|
+
const fetchUri = this.createUrl(__privateGet(_ProjectClient, _url3), { ...options });
|
|
2875
3513
|
return await this.apiClient(fetchUri);
|
|
2876
3514
|
}
|
|
2877
3515
|
/**
|
|
@@ -2879,31 +3517,43 @@ var _ProjectClient = class _ProjectClient extends import_api12.ApiClient {
|
|
|
2879
3517
|
* When teamId is provided, returns a single team with its projects.
|
|
2880
3518
|
* When omitted, returns all accessible teams and their projects.
|
|
2881
3519
|
*/
|
|
2882
|
-
async
|
|
3520
|
+
async list(options) {
|
|
2883
3521
|
const fetchUri = this.createUrl(__privateGet(_ProjectClient, _projectsUrl), options ? { ...options } : {});
|
|
2884
3522
|
return await this.apiClient(fetchUri);
|
|
2885
3523
|
}
|
|
3524
|
+
/** @deprecated Use {@link list} instead. */
|
|
3525
|
+
async getProjects(options) {
|
|
3526
|
+
return this.list(options);
|
|
3527
|
+
}
|
|
2886
3528
|
/** Updates or creates (based on id) a Project */
|
|
2887
|
-
async
|
|
2888
|
-
const fetchUri = this.createUrl(__privateGet(_ProjectClient,
|
|
3529
|
+
async save(body) {
|
|
3530
|
+
const fetchUri = this.createUrl(__privateGet(_ProjectClient, _url3));
|
|
2889
3531
|
return await this.apiClient(fetchUri, {
|
|
2890
3532
|
method: "PUT",
|
|
2891
3533
|
body: JSON.stringify({ ...body })
|
|
2892
3534
|
});
|
|
2893
3535
|
}
|
|
3536
|
+
/** @deprecated Use {@link save} instead. */
|
|
3537
|
+
async upsert(body) {
|
|
3538
|
+
return this.save(body);
|
|
3539
|
+
}
|
|
2894
3540
|
/** Deletes a Project */
|
|
2895
|
-
async
|
|
2896
|
-
const fetchUri = this.createUrl(__privateGet(_ProjectClient,
|
|
3541
|
+
async remove(body) {
|
|
3542
|
+
const fetchUri = this.createUrl(__privateGet(_ProjectClient, _url3));
|
|
2897
3543
|
await this.apiClient(fetchUri, {
|
|
2898
3544
|
method: "DELETE",
|
|
2899
3545
|
body: JSON.stringify({ ...body }),
|
|
2900
3546
|
expectNoContent: true
|
|
2901
3547
|
});
|
|
2902
3548
|
}
|
|
3549
|
+
/** @deprecated Use {@link remove} instead. */
|
|
3550
|
+
async delete(body) {
|
|
3551
|
+
return this.remove(body);
|
|
3552
|
+
}
|
|
2903
3553
|
};
|
|
2904
|
-
|
|
3554
|
+
_url3 = new WeakMap();
|
|
2905
3555
|
_projectsUrl = new WeakMap();
|
|
2906
|
-
__privateAdd(_ProjectClient,
|
|
3556
|
+
__privateAdd(_ProjectClient, _url3, "/api/v1/project");
|
|
2907
3557
|
__privateAdd(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
2908
3558
|
var ProjectClient = _ProjectClient;
|
|
2909
3559
|
|
|
@@ -3090,9 +3740,9 @@ function queryToProjection(source) {
|
|
|
3090
3740
|
}
|
|
3091
3741
|
|
|
3092
3742
|
// src/PromptClient.ts
|
|
3093
|
-
var
|
|
3743
|
+
var import_api22 = require("@uniformdev/context/api");
|
|
3094
3744
|
var PromptsUrl = "/api/v1/prompts";
|
|
3095
|
-
var PromptClient = class extends
|
|
3745
|
+
var PromptClient = class extends import_api22.ApiClient {
|
|
3096
3746
|
constructor(options) {
|
|
3097
3747
|
super(options);
|
|
3098
3748
|
}
|
|
@@ -3123,34 +3773,42 @@ var PromptClient = class extends import_api13.ApiClient {
|
|
|
3123
3773
|
};
|
|
3124
3774
|
|
|
3125
3775
|
// src/RelationshipClient.ts
|
|
3126
|
-
var
|
|
3776
|
+
var import_api23 = require("@uniformdev/context/api");
|
|
3127
3777
|
var RELATIONSHIPS_URL = "/api/v1/relationships";
|
|
3128
|
-
var RelationshipClient = class extends
|
|
3778
|
+
var RelationshipClient = class extends import_api23.ApiClient {
|
|
3129
3779
|
constructor(options) {
|
|
3130
3780
|
super(options);
|
|
3131
|
-
this.
|
|
3781
|
+
this.list = async (options) => {
|
|
3132
3782
|
const { projectId } = this.options;
|
|
3133
3783
|
const url = this.createUrl(RELATIONSHIPS_URL, { ...options, projectId });
|
|
3134
3784
|
return this.apiClient(url);
|
|
3135
3785
|
};
|
|
3786
|
+
/** @deprecated Use {@link list} instead. */
|
|
3787
|
+
this.get = async (options) => {
|
|
3788
|
+
return this.list(options);
|
|
3789
|
+
};
|
|
3136
3790
|
}
|
|
3137
3791
|
};
|
|
3138
3792
|
|
|
3139
3793
|
// src/ReleaseClient.ts
|
|
3140
|
-
var
|
|
3794
|
+
var import_api24 = require("@uniformdev/context/api");
|
|
3141
3795
|
var releasesUrl = "/api/v1/releases";
|
|
3142
|
-
var ReleaseClient = class extends
|
|
3796
|
+
var ReleaseClient = class extends import_api24.ApiClient {
|
|
3143
3797
|
constructor(options) {
|
|
3144
3798
|
super(options);
|
|
3145
3799
|
}
|
|
3146
|
-
/** Fetches
|
|
3147
|
-
async
|
|
3800
|
+
/** Fetches a list of releases for a project */
|
|
3801
|
+
async list(options) {
|
|
3148
3802
|
const { projectId } = this.options;
|
|
3149
3803
|
const fetchUri = this.createUrl(releasesUrl, { ...options, projectId });
|
|
3150
3804
|
return await this.apiClient(fetchUri);
|
|
3151
3805
|
}
|
|
3806
|
+
/** @deprecated Use {@link list} instead. */
|
|
3807
|
+
async get(options) {
|
|
3808
|
+
return this.list(options);
|
|
3809
|
+
}
|
|
3152
3810
|
/** Updates or creates (based on id) a release */
|
|
3153
|
-
async
|
|
3811
|
+
async save(body) {
|
|
3154
3812
|
const fetchUri = this.createUrl(releasesUrl);
|
|
3155
3813
|
await this.apiClient(fetchUri, {
|
|
3156
3814
|
method: "PUT",
|
|
@@ -3158,6 +3816,10 @@ var ReleaseClient = class extends import_api15.ApiClient {
|
|
|
3158
3816
|
expectNoContent: true
|
|
3159
3817
|
});
|
|
3160
3818
|
}
|
|
3819
|
+
/** @deprecated Use {@link save} instead. */
|
|
3820
|
+
async upsert(body) {
|
|
3821
|
+
return this.save(body);
|
|
3822
|
+
}
|
|
3161
3823
|
/** Deletes a release */
|
|
3162
3824
|
async remove(body) {
|
|
3163
3825
|
const fetchUri = this.createUrl(releasesUrl);
|
|
@@ -3179,21 +3841,25 @@ var ReleaseClient = class extends import_api15.ApiClient {
|
|
|
3179
3841
|
};
|
|
3180
3842
|
|
|
3181
3843
|
// src/ReleaseContentsClient.ts
|
|
3182
|
-
var
|
|
3183
|
-
var
|
|
3184
|
-
var ReleaseContentsClient = class extends
|
|
3844
|
+
var import_api25 = require("@uniformdev/context/api");
|
|
3845
|
+
var releaseContentsUrl = "/api/v1/release-contents";
|
|
3846
|
+
var ReleaseContentsClient = class extends import_api25.ApiClient {
|
|
3185
3847
|
constructor(options) {
|
|
3186
3848
|
super(options);
|
|
3187
3849
|
}
|
|
3188
|
-
/** Fetches
|
|
3189
|
-
async
|
|
3850
|
+
/** Fetches a list of entities added to a release */
|
|
3851
|
+
async list(options) {
|
|
3190
3852
|
const { projectId } = this.options;
|
|
3191
|
-
const fetchUri = this.createUrl(
|
|
3853
|
+
const fetchUri = this.createUrl(releaseContentsUrl, { ...options, projectId });
|
|
3192
3854
|
return await this.apiClient(fetchUri);
|
|
3193
3855
|
}
|
|
3856
|
+
/** @deprecated Use {@link list} instead. */
|
|
3857
|
+
async get(options) {
|
|
3858
|
+
return this.list(options);
|
|
3859
|
+
}
|
|
3194
3860
|
/** Removes a release content from a release */
|
|
3195
3861
|
async remove(body) {
|
|
3196
|
-
const fetchUri = this.createUrl(
|
|
3862
|
+
const fetchUri = this.createUrl(releaseContentsUrl);
|
|
3197
3863
|
await this.apiClient(fetchUri, {
|
|
3198
3864
|
method: "DELETE",
|
|
3199
3865
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -3203,9 +3869,9 @@ var ReleaseContentsClient = class extends import_api16.ApiClient {
|
|
|
3203
3869
|
};
|
|
3204
3870
|
|
|
3205
3871
|
// src/RouteClient.ts
|
|
3206
|
-
var
|
|
3872
|
+
var import_api26 = require("@uniformdev/context/api");
|
|
3207
3873
|
var ROUTE_URL = "/api/v1/route";
|
|
3208
|
-
var RouteClient = class extends
|
|
3874
|
+
var RouteClient = class extends import_api26.ApiClient {
|
|
3209
3875
|
constructor(options) {
|
|
3210
3876
|
var _a;
|
|
3211
3877
|
if (!options.limitPolicy) {
|
|
@@ -3214,8 +3880,14 @@ var RouteClient = class extends import_api17.ApiClient {
|
|
|
3214
3880
|
super(options);
|
|
3215
3881
|
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
|
|
3216
3882
|
}
|
|
3217
|
-
/**
|
|
3218
|
-
|
|
3883
|
+
/**
|
|
3884
|
+
* Resolves a route to a composition, redirect, or not-found result.
|
|
3885
|
+
*
|
|
3886
|
+
* An optional `select` projection applies to the resolved composition when
|
|
3887
|
+
* the route matches one; redirect / notFound responses pass through
|
|
3888
|
+
* untouched.
|
|
3889
|
+
*/
|
|
3890
|
+
async get(options) {
|
|
3219
3891
|
const { projectId } = this.options;
|
|
3220
3892
|
const { select, ...rest } = options != null ? options : {};
|
|
3221
3893
|
const rewrittenSelect = projectionToQuery(select);
|
|
@@ -3225,6 +3897,10 @@ var RouteClient = class extends import_api17.ApiClient {
|
|
|
3225
3897
|
this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
|
|
3226
3898
|
);
|
|
3227
3899
|
}
|
|
3900
|
+
/** @deprecated use {@link RouteClient.get} instead (renamed). */
|
|
3901
|
+
async getRoute(options) {
|
|
3902
|
+
return this.get(options);
|
|
3903
|
+
}
|
|
3228
3904
|
};
|
|
3229
3905
|
|
|
3230
3906
|
// src/types/locales.ts
|
|
@@ -3579,26 +4255,30 @@ function handleRichTextNodeBinding(object, options) {
|
|
|
3579
4255
|
}
|
|
3580
4256
|
|
|
3581
4257
|
// src/index.ts
|
|
3582
|
-
var
|
|
4258
|
+
var import_api28 = require("@uniformdev/context/api");
|
|
3583
4259
|
|
|
3584
4260
|
// src/.version.ts
|
|
3585
|
-
var version = "20.72.
|
|
4261
|
+
var version = "20.72.3";
|
|
3586
4262
|
|
|
3587
4263
|
// src/WorkflowClient.ts
|
|
3588
|
-
var
|
|
4264
|
+
var import_api27 = require("@uniformdev/context/api");
|
|
3589
4265
|
var workflowsUrl = "/api/v1/workflows";
|
|
3590
|
-
var WorkflowClient = class extends
|
|
4266
|
+
var WorkflowClient = class extends import_api27.ApiClient {
|
|
3591
4267
|
constructor(options) {
|
|
3592
4268
|
super(options);
|
|
3593
4269
|
}
|
|
3594
|
-
/** Fetches workflows for a project */
|
|
3595
|
-
async
|
|
4270
|
+
/** Fetches a list of workflows for a project */
|
|
4271
|
+
async list(options) {
|
|
3596
4272
|
const { projectId } = this.options;
|
|
3597
4273
|
const fetchUri = this.createUrl(workflowsUrl, { ...options, projectId });
|
|
3598
4274
|
return await this.apiClient(fetchUri);
|
|
3599
4275
|
}
|
|
4276
|
+
/** @deprecated Use {@link list} instead. */
|
|
4277
|
+
async get(options) {
|
|
4278
|
+
return this.list(options);
|
|
4279
|
+
}
|
|
3600
4280
|
/** Updates or creates a workflow definition */
|
|
3601
|
-
async
|
|
4281
|
+
async save(body) {
|
|
3602
4282
|
const fetchUri = this.createUrl(workflowsUrl);
|
|
3603
4283
|
await this.apiClient(fetchUri, {
|
|
3604
4284
|
method: "PUT",
|
|
@@ -3606,6 +4286,10 @@ var WorkflowClient = class extends import_api18.ApiClient {
|
|
|
3606
4286
|
expectNoContent: true
|
|
3607
4287
|
});
|
|
3608
4288
|
}
|
|
4289
|
+
/** @deprecated Use {@link save} instead. */
|
|
4290
|
+
async upsert(body) {
|
|
4291
|
+
return this.save(body);
|
|
4292
|
+
}
|
|
3609
4293
|
/** Deletes a workflow definition */
|
|
3610
4294
|
async remove(body) {
|
|
3611
4295
|
const fetchUri = this.createUrl(workflowsUrl);
|
|
@@ -3618,7 +4302,7 @@ var WorkflowClient = class extends import_api18.ApiClient {
|
|
|
3618
4302
|
};
|
|
3619
4303
|
|
|
3620
4304
|
// src/index.ts
|
|
3621
|
-
var CanvasClientError =
|
|
4305
|
+
var CanvasClientError = import_api28.ApiClientError;
|
|
3622
4306
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3623
4307
|
0 && (module.exports = {
|
|
3624
4308
|
ASSETS_SOURCE_CUSTOM_URL,
|
|
@@ -3672,7 +4356,11 @@ var CanvasClientError = import_api19.ApiClientError;
|
|
|
3672
4356
|
CanvasClientError,
|
|
3673
4357
|
CategoryClient,
|
|
3674
4358
|
ChildEnhancerBuilder,
|
|
4359
|
+
ComponentDefinitionClient,
|
|
4360
|
+
CompositionDeliveryClient,
|
|
4361
|
+
CompositionManagementClient,
|
|
3675
4362
|
ContentClient,
|
|
4363
|
+
ContentTypeClient,
|
|
3676
4364
|
DataSourceClient,
|
|
3677
4365
|
DataTypeClient,
|
|
3678
4366
|
EDGE_CACHE_DISABLED,
|
|
@@ -3682,6 +4370,8 @@ var CanvasClientError = import_api19.ApiClientError;
|
|
|
3682
4370
|
EMPTY_COMPOSITION,
|
|
3683
4371
|
EnhancerBuilder,
|
|
3684
4372
|
EntityReleasesClient,
|
|
4373
|
+
EntryDeliveryClient,
|
|
4374
|
+
EntryManagementClient,
|
|
3685
4375
|
IN_CONTEXT_EDITOR_COMPONENT_END_ROLE,
|
|
3686
4376
|
IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
|
|
3687
4377
|
IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM,
|
|
@@ -3694,6 +4384,7 @@ var CanvasClientError = import_api19.ApiClientError;
|
|
|
3694
4384
|
LOCALE_DYNAMIC_INPUT_NAME,
|
|
3695
4385
|
LabelClient,
|
|
3696
4386
|
LocaleClient,
|
|
4387
|
+
NotificationsClient,
|
|
3697
4388
|
PLACEHOLDER_ID,
|
|
3698
4389
|
PreviewClient,
|
|
3699
4390
|
ProjectClient,
|