@uniformdev/canvas 20.50.2-alpha.149 → 20.50.2-alpha.167

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,560 +1,25 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
1
  var __typeError = (msg) => {
8
2
  throw TypeError(msg);
9
3
  };
10
- var __commonJS = (cb, mod) => function __require() {
11
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
4
  var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
30
5
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
31
6
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
32
7
 
33
- // ../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js
34
- var require_yocto_queue = __commonJS({
35
- "../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports, module) {
36
- "use strict";
37
- var Node = class {
38
- /// value;
39
- /// next;
40
- constructor(value) {
41
- this.value = value;
42
- this.next = void 0;
43
- }
44
- };
45
- var Queue = class {
46
- // TODO: Use private class fields when targeting Node.js 12.
47
- // #_head;
48
- // #_tail;
49
- // #_size;
50
- constructor() {
51
- this.clear();
52
- }
53
- enqueue(value) {
54
- const node = new Node(value);
55
- if (this._head) {
56
- this._tail.next = node;
57
- this._tail = node;
58
- } else {
59
- this._head = node;
60
- this._tail = node;
61
- }
62
- this._size++;
63
- }
64
- dequeue() {
65
- const current = this._head;
66
- if (!current) {
67
- return;
68
- }
69
- this._head = this._head.next;
70
- this._size--;
71
- return current.value;
72
- }
73
- clear() {
74
- this._head = void 0;
75
- this._tail = void 0;
76
- this._size = 0;
77
- }
78
- get size() {
79
- return this._size;
80
- }
81
- *[Symbol.iterator]() {
82
- let current = this._head;
83
- while (current) {
84
- yield current.value;
85
- current = current.next;
86
- }
87
- }
88
- };
89
- module.exports = Queue;
90
- }
91
- });
92
-
93
- // ../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js
94
- var require_p_limit = __commonJS({
95
- "../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports, module) {
96
- "use strict";
97
- var Queue = require_yocto_queue();
98
- var pLimit2 = (concurrency) => {
99
- if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
100
- throw new TypeError("Expected `concurrency` to be a number from 1 and up");
101
- }
102
- const queue = new Queue();
103
- let activeCount = 0;
104
- const next = () => {
105
- activeCount--;
106
- if (queue.size > 0) {
107
- queue.dequeue()();
108
- }
109
- };
110
- const run = async (fn, resolve, ...args) => {
111
- activeCount++;
112
- const result = (async () => fn(...args))();
113
- resolve(result);
114
- try {
115
- await result;
116
- } catch (e) {
117
- }
118
- next();
119
- };
120
- const enqueue = (fn, resolve, ...args) => {
121
- queue.enqueue(run.bind(null, fn, resolve, ...args));
122
- (async () => {
123
- await Promise.resolve();
124
- if (activeCount < concurrency && queue.size > 0) {
125
- queue.dequeue()();
126
- }
127
- })();
128
- };
129
- const generator = (fn, ...args) => new Promise((resolve) => {
130
- enqueue(fn, resolve, ...args);
131
- });
132
- Object.defineProperties(generator, {
133
- activeCount: {
134
- get: () => activeCount
135
- },
136
- pendingCount: {
137
- get: () => queue.size
138
- },
139
- clearQueue: {
140
- value: () => {
141
- queue.clear();
142
- }
143
- }
144
- });
145
- return generator;
146
- };
147
- module.exports = pLimit2;
148
- }
149
- });
150
-
151
- // ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js
152
- var require_retry_operation = __commonJS({
153
- "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports, module) {
154
- "use strict";
155
- function RetryOperation(timeouts, options) {
156
- if (typeof options === "boolean") {
157
- options = { forever: options };
158
- }
159
- this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
160
- this._timeouts = timeouts;
161
- this._options = options || {};
162
- this._maxRetryTime = options && options.maxRetryTime || Infinity;
163
- this._fn = null;
164
- this._errors = [];
165
- this._attempts = 1;
166
- this._operationTimeout = null;
167
- this._operationTimeoutCb = null;
168
- this._timeout = null;
169
- this._operationStart = null;
170
- this._timer = null;
171
- if (this._options.forever) {
172
- this._cachedTimeouts = this._timeouts.slice(0);
173
- }
174
- }
175
- module.exports = RetryOperation;
176
- RetryOperation.prototype.reset = function() {
177
- this._attempts = 1;
178
- this._timeouts = this._originalTimeouts.slice(0);
179
- };
180
- RetryOperation.prototype.stop = function() {
181
- if (this._timeout) {
182
- clearTimeout(this._timeout);
183
- }
184
- if (this._timer) {
185
- clearTimeout(this._timer);
186
- }
187
- this._timeouts = [];
188
- this._cachedTimeouts = null;
189
- };
190
- RetryOperation.prototype.retry = function(err) {
191
- if (this._timeout) {
192
- clearTimeout(this._timeout);
193
- }
194
- if (!err) {
195
- return false;
196
- }
197
- var currentTime = (/* @__PURE__ */ new Date()).getTime();
198
- if (err && currentTime - this._operationStart >= this._maxRetryTime) {
199
- this._errors.push(err);
200
- this._errors.unshift(new Error("RetryOperation timeout occurred"));
201
- return false;
202
- }
203
- this._errors.push(err);
204
- var timeout = this._timeouts.shift();
205
- if (timeout === void 0) {
206
- if (this._cachedTimeouts) {
207
- this._errors.splice(0, this._errors.length - 1);
208
- timeout = this._cachedTimeouts.slice(-1);
209
- } else {
210
- return false;
211
- }
212
- }
213
- var self = this;
214
- this._timer = setTimeout(function() {
215
- self._attempts++;
216
- if (self._operationTimeoutCb) {
217
- self._timeout = setTimeout(function() {
218
- self._operationTimeoutCb(self._attempts);
219
- }, self._operationTimeout);
220
- if (self._options.unref) {
221
- self._timeout.unref();
222
- }
223
- }
224
- self._fn(self._attempts);
225
- }, timeout);
226
- if (this._options.unref) {
227
- this._timer.unref();
228
- }
229
- return true;
230
- };
231
- RetryOperation.prototype.attempt = function(fn, timeoutOps) {
232
- this._fn = fn;
233
- if (timeoutOps) {
234
- if (timeoutOps.timeout) {
235
- this._operationTimeout = timeoutOps.timeout;
236
- }
237
- if (timeoutOps.cb) {
238
- this._operationTimeoutCb = timeoutOps.cb;
239
- }
240
- }
241
- var self = this;
242
- if (this._operationTimeoutCb) {
243
- this._timeout = setTimeout(function() {
244
- self._operationTimeoutCb();
245
- }, self._operationTimeout);
246
- }
247
- this._operationStart = (/* @__PURE__ */ new Date()).getTime();
248
- this._fn(this._attempts);
249
- };
250
- RetryOperation.prototype.try = function(fn) {
251
- console.log("Using RetryOperation.try() is deprecated");
252
- this.attempt(fn);
253
- };
254
- RetryOperation.prototype.start = function(fn) {
255
- console.log("Using RetryOperation.start() is deprecated");
256
- this.attempt(fn);
257
- };
258
- RetryOperation.prototype.start = RetryOperation.prototype.try;
259
- RetryOperation.prototype.errors = function() {
260
- return this._errors;
261
- };
262
- RetryOperation.prototype.attempts = function() {
263
- return this._attempts;
264
- };
265
- RetryOperation.prototype.mainError = function() {
266
- if (this._errors.length === 0) {
267
- return null;
268
- }
269
- var counts = {};
270
- var mainError = null;
271
- var mainErrorCount = 0;
272
- for (var i = 0; i < this._errors.length; i++) {
273
- var error = this._errors[i];
274
- var message = error.message;
275
- var count = (counts[message] || 0) + 1;
276
- counts[message] = count;
277
- if (count >= mainErrorCount) {
278
- mainError = error;
279
- mainErrorCount = count;
280
- }
281
- }
282
- return mainError;
283
- };
284
- }
285
- });
286
-
287
- // ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js
288
- var require_retry = __commonJS({
289
- "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports) {
290
- "use strict";
291
- var RetryOperation = require_retry_operation();
292
- exports.operation = function(options) {
293
- var timeouts = exports.timeouts(options);
294
- return new RetryOperation(timeouts, {
295
- forever: options && (options.forever || options.retries === Infinity),
296
- unref: options && options.unref,
297
- maxRetryTime: options && options.maxRetryTime
298
- });
299
- };
300
- exports.timeouts = function(options) {
301
- if (options instanceof Array) {
302
- return [].concat(options);
303
- }
304
- var opts = {
305
- retries: 10,
306
- factor: 2,
307
- minTimeout: 1 * 1e3,
308
- maxTimeout: Infinity,
309
- randomize: false
310
- };
311
- for (var key in options) {
312
- opts[key] = options[key];
313
- }
314
- if (opts.minTimeout > opts.maxTimeout) {
315
- throw new Error("minTimeout is greater than maxTimeout");
316
- }
317
- var timeouts = [];
318
- for (var i = 0; i < opts.retries; i++) {
319
- timeouts.push(this.createTimeout(i, opts));
320
- }
321
- if (options && options.forever && !timeouts.length) {
322
- timeouts.push(this.createTimeout(i, opts));
323
- }
324
- timeouts.sort(function(a, b) {
325
- return a - b;
326
- });
327
- return timeouts;
328
- };
329
- exports.createTimeout = function(attempt, opts) {
330
- var random = opts.randomize ? Math.random() + 1 : 1;
331
- var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
332
- timeout = Math.min(timeout, opts.maxTimeout);
333
- return timeout;
334
- };
335
- exports.wrap = function(obj, options, methods) {
336
- if (options instanceof Array) {
337
- methods = options;
338
- options = null;
339
- }
340
- if (!methods) {
341
- methods = [];
342
- for (var key in obj) {
343
- if (typeof obj[key] === "function") {
344
- methods.push(key);
345
- }
346
- }
347
- }
348
- for (var i = 0; i < methods.length; i++) {
349
- var method = methods[i];
350
- var original = obj[method];
351
- obj[method] = function retryWrapper(original2) {
352
- var op = exports.operation(options);
353
- var args = Array.prototype.slice.call(arguments, 1);
354
- var callback = args.pop();
355
- args.push(function(err) {
356
- if (op.retry(err)) {
357
- return;
358
- }
359
- if (err) {
360
- arguments[0] = op.mainError();
361
- }
362
- callback.apply(this, arguments);
363
- });
364
- op.attempt(function() {
365
- original2.apply(obj, args);
366
- });
367
- }.bind(obj, original);
368
- obj[method].options = options;
369
- }
370
- };
371
- }
372
- });
373
-
374
- // ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js
375
- var require_retry2 = __commonJS({
376
- "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js"(exports, module) {
377
- "use strict";
378
- module.exports = require_retry();
379
- }
380
- });
381
-
382
- // src/CanvasClient.ts
383
- import { ApiClient, rewriteFiltersForApi } from "@uniformdev/context/api";
8
+ // src/CategoryClient.ts
9
+ import { ApiClient } from "@uniformdev/context/api";
384
10
 
385
11
  // src/enhancement/createLimitPolicy.ts
386
- var import_p_limit = __toESM(require_p_limit());
387
12
  import { ApiClientError } from "@uniformdev/context/api";
388
-
389
- // ../../node_modules/.pnpm/p-retry@5.1.2/node_modules/p-retry/index.js
390
- var import_retry = __toESM(require_retry2(), 1);
391
- var networkErrorMsgs = /* @__PURE__ */ new Set([
392
- "Failed to fetch",
393
- // Chrome
394
- "NetworkError when attempting to fetch resource.",
395
- // Firefox
396
- "The Internet connection appears to be offline.",
397
- // Safari
398
- "Network request failed",
399
- // `cross-fetch`
400
- "fetch failed"
401
- // Undici (Node.js)
402
- ]);
403
- var AbortError = class extends Error {
404
- constructor(message) {
405
- super();
406
- if (message instanceof Error) {
407
- this.originalError = message;
408
- ({ message } = message);
409
- } else {
410
- this.originalError = new Error(message);
411
- this.originalError.stack = this.stack;
412
- }
413
- this.name = "AbortError";
414
- this.message = message;
415
- }
416
- };
417
- var decorateErrorWithCounts = (error, attemptNumber, options) => {
418
- const retriesLeft = options.retries - (attemptNumber - 1);
419
- error.attemptNumber = attemptNumber;
420
- error.retriesLeft = retriesLeft;
421
- return error;
422
- };
423
- var isNetworkError = (errorMessage) => networkErrorMsgs.has(errorMessage);
424
- var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new Error(errorMessage) : new DOMException(errorMessage);
425
- async function pRetry(input, options) {
426
- return new Promise((resolve, reject) => {
427
- options = {
428
- onFailedAttempt() {
429
- },
430
- retries: 10,
431
- ...options
432
- };
433
- const operation = import_retry.default.operation(options);
434
- operation.attempt(async (attemptNumber) => {
435
- try {
436
- resolve(await input(attemptNumber));
437
- } catch (error) {
438
- if (!(error instanceof Error)) {
439
- reject(new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`));
440
- return;
441
- }
442
- if (error instanceof AbortError) {
443
- operation.stop();
444
- reject(error.originalError);
445
- } else if (error instanceof TypeError && !isNetworkError(error.message)) {
446
- operation.stop();
447
- reject(error);
448
- } else {
449
- decorateErrorWithCounts(error, attemptNumber, options);
450
- try {
451
- await options.onFailedAttempt(error);
452
- } catch (error2) {
453
- reject(error2);
454
- return;
455
- }
456
- if (!operation.retry(error)) {
457
- reject(operation.mainError());
458
- }
459
- }
460
- }
461
- });
462
- if (options.signal && !options.signal.aborted) {
463
- options.signal.addEventListener("abort", () => {
464
- operation.stop();
465
- const reason = options.signal.reason === void 0 ? getDOMException("The operation was aborted.") : options.signal.reason;
466
- reject(reason instanceof Error ? reason : getDOMException(reason));
467
- }, {
468
- once: true
469
- });
470
- }
471
- });
472
- }
473
-
474
- // ../../node_modules/.pnpm/p-throttle@5.0.0/node_modules/p-throttle/index.js
475
- var AbortError2 = class extends Error {
476
- constructor() {
477
- super("Throttled function aborted");
478
- this.name = "AbortError";
479
- }
480
- };
481
- function pThrottle({ limit, interval, strict }) {
482
- if (!Number.isFinite(limit)) {
483
- throw new TypeError("Expected `limit` to be a finite number");
484
- }
485
- if (!Number.isFinite(interval)) {
486
- throw new TypeError("Expected `interval` to be a finite number");
487
- }
488
- const queue = /* @__PURE__ */ new Map();
489
- let currentTick = 0;
490
- let activeCount = 0;
491
- function windowedDelay() {
492
- const now = Date.now();
493
- if (now - currentTick > interval) {
494
- activeCount = 1;
495
- currentTick = now;
496
- return 0;
497
- }
498
- if (activeCount < limit) {
499
- activeCount++;
500
- } else {
501
- currentTick += interval;
502
- activeCount = 1;
503
- }
504
- return currentTick - now;
505
- }
506
- const strictTicks = [];
507
- function strictDelay() {
508
- const now = Date.now();
509
- if (strictTicks.length < limit) {
510
- strictTicks.push(now);
511
- return 0;
512
- }
513
- const earliestTime = strictTicks.shift() + interval;
514
- if (now >= earliestTime) {
515
- strictTicks.push(now);
516
- return 0;
517
- }
518
- strictTicks.push(earliestTime);
519
- return earliestTime - now;
520
- }
521
- const getDelay = strict ? strictDelay : windowedDelay;
522
- return (function_) => {
523
- const throttled = function(...args) {
524
- if (!throttled.isEnabled) {
525
- return (async () => function_.apply(this, args))();
526
- }
527
- let timeout;
528
- return new Promise((resolve, reject) => {
529
- const execute = () => {
530
- resolve(function_.apply(this, args));
531
- queue.delete(timeout);
532
- };
533
- timeout = setTimeout(execute, getDelay());
534
- queue.set(timeout, reject);
535
- });
536
- };
537
- throttled.abort = () => {
538
- for (const timeout of queue.keys()) {
539
- clearTimeout(timeout);
540
- queue.get(timeout)(new AbortError2());
541
- }
542
- queue.clear();
543
- strictTicks.splice(0, strictTicks.length);
544
- };
545
- throttled.isEnabled = true;
546
- return throttled;
547
- };
548
- }
549
-
550
- // src/enhancement/createLimitPolicy.ts
13
+ import pLimit from "p-limit";
14
+ import pRetry from "p-retry";
15
+ import pThrottle from "p-throttle";
551
16
  function createLimitPolicy({
552
17
  throttle = { interval: 1e3, limit: 10 },
553
- retry: retry2 = { retries: 1, factor: 1.66 },
18
+ retry = { retries: 1, factor: 1.66 },
554
19
  limit = 10
555
20
  }) {
556
21
  const throttler = throttle ? pThrottle(throttle) : null;
557
- const limiter = limit ? (0, import_p_limit.default)(limit) : null;
22
+ const limiter = limit ? pLimit(limit) : null;
558
23
  return function limitPolicy(func) {
559
24
  let currentFunc = async () => await func();
560
25
  if (throttler) {
@@ -565,13 +30,13 @@ function createLimitPolicy({
565
30
  const limitFunc = currentFunc;
566
31
  currentFunc = () => limiter(limitFunc);
567
32
  }
568
- if (retry2) {
33
+ if (retry) {
569
34
  const retryFunc = currentFunc;
570
35
  currentFunc = () => pRetry(retryFunc, {
571
- ...retry2,
36
+ ...retry,
572
37
  onFailedAttempt: async (error) => {
573
- if (retry2.onFailedAttempt) {
574
- await retry2.onFailedAttempt(error);
38
+ if (retry.onFailedAttempt) {
39
+ await retry.onFailedAttempt(error);
575
40
  }
576
41
  if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
577
42
  throw error;
@@ -584,9 +49,697 @@ function createLimitPolicy({
584
49
  }
585
50
  var nullLimitPolicy = async (func) => await func();
586
51
 
587
- // src/CanvasClient.ts
588
- var CANVAS_URL = "/api/v1/canvas";
589
- var CanvasClient = class extends ApiClient {
52
+ // src/CategoryClient.ts
53
+ var CATEGORIES_URL = "/api/v1/categories";
54
+ var CategoryClient = class extends ApiClient {
55
+ constructor(options) {
56
+ if (!options.limitPolicy) {
57
+ options.limitPolicy = createLimitPolicy({});
58
+ }
59
+ super(options);
60
+ }
61
+ /** Fetches a list of categories created in given project */
62
+ async list(options) {
63
+ const { projectId } = this.options;
64
+ const fetchUri = this.createUrl("/api/v1/categories", { ...options, projectId });
65
+ return await this.apiClient(fetchUri);
66
+ }
67
+ /** @deprecated Use {@link list} instead. */
68
+ async getCategories(options) {
69
+ return this.list(options);
70
+ }
71
+ /** Updates or creates a category, also used to re-order them */
72
+ async save(categories) {
73
+ const { projectId } = this.options;
74
+ const fetchUri = this.createUrl(CATEGORIES_URL);
75
+ return await this.apiClient(fetchUri, {
76
+ method: "PUT",
77
+ body: JSON.stringify({ categories, projectId }),
78
+ expectNoContent: true
79
+ });
80
+ }
81
+ /** @deprecated Use {@link save} instead. */
82
+ async upsertCategories(categories) {
83
+ return this.save(categories);
84
+ }
85
+ /** Deletes a category */
86
+ async remove(options) {
87
+ const { projectId } = this.options;
88
+ const fetchUri = this.createUrl(CATEGORIES_URL);
89
+ return await this.apiClient(fetchUri, {
90
+ method: "DELETE",
91
+ body: JSON.stringify({ projectId, categoryId: options.categoryId }),
92
+ expectNoContent: true
93
+ });
94
+ }
95
+ /** @deprecated Use {@link remove} instead. */
96
+ async removeCategory(options) {
97
+ return this.remove(options);
98
+ }
99
+ };
100
+ var UncachedCategoryClient = class extends CategoryClient {
101
+ constructor(options) {
102
+ super({ ...options, bypassCache: true });
103
+ }
104
+ };
105
+
106
+ // src/clients/ComponentDefinitionClient.ts
107
+ import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
108
+
109
+ // src/clients/ContentClientBase.ts
110
+ import { ApiClient as ApiClient2 } from "@uniformdev/context/api";
111
+ var CANONICAL_FORMAT = "canonical";
112
+ var ContentClientBase = class extends ApiClient2 {
113
+ constructor(options, defaultBypassCache) {
114
+ var _a, _b;
115
+ super({
116
+ ...options,
117
+ limitPolicy: (_a = options.limitPolicy) != null ? _a : createLimitPolicy({}),
118
+ bypassCache: (_b = options.bypassCache) != null ? _b : defaultBypassCache
119
+ });
120
+ }
121
+ };
122
+
123
+ // src/clients/ComponentDefinitionClient.ts
124
+ var DEFINITIONS_URL = "/api/v1/canvas-definitions";
125
+ var ComponentDefinitionClient = class extends ContentClientBase {
126
+ constructor(options) {
127
+ super(
128
+ options,
129
+ /* defaultBypassCache */
130
+ true
131
+ );
132
+ }
133
+ /** Fetches one component definition by id (throws `ApiClientError(404)` if absent). */
134
+ async get(args) {
135
+ var _a;
136
+ const url = this.createUrl(DEFINITIONS_URL, {
137
+ componentId: args.componentId,
138
+ projectId: this.options.projectId
139
+ });
140
+ const res = await this.apiClient(url);
141
+ const definition = (_a = res.componentDefinitions) == null ? void 0 : _a[0];
142
+ if (!definition) {
143
+ throw new ApiClientError2("Component definition not found", "GET", url.toString(), 404, "Not Found");
144
+ }
145
+ return definition;
146
+ }
147
+ /** Fetches a list of component definitions. */
148
+ list(args) {
149
+ const url = this.createUrl(DEFINITIONS_URL, { ...args, projectId: this.options.projectId });
150
+ return this.apiClient(url);
151
+ }
152
+ /** Creates or updates a component definition. */
153
+ async save(def) {
154
+ const url = this.createUrl(DEFINITIONS_URL);
155
+ await this.apiClient(url, {
156
+ method: "PUT",
157
+ body: JSON.stringify({ ...def, projectId: this.options.projectId }),
158
+ expectNoContent: true
159
+ });
160
+ }
161
+ /** Deletes a component definition. */
162
+ async remove(args) {
163
+ const url = this.createUrl(DEFINITIONS_URL);
164
+ await this.apiClient(url, {
165
+ method: "DELETE",
166
+ body: JSON.stringify({ ...args, projectId: this.options.projectId }),
167
+ expectNoContent: true
168
+ });
169
+ }
170
+ };
171
+
172
+ // src/clients/CompositionDeliveryClient.ts
173
+ import { rewriteFiltersForApi } from "@uniformdev/context/api";
174
+
175
+ // src/projection/types.ts
176
+ var SELECT_QUERY_PREFIX = "select.";
177
+
178
+ // src/projection/projectionToQuery.ts
179
+ function appendCsv(out, key, values) {
180
+ if (values === void 0) {
181
+ return;
182
+ }
183
+ out[key] = values.join(",");
184
+ }
185
+ function projectionToQuery(spec) {
186
+ const out = {};
187
+ if (!spec) {
188
+ return out;
189
+ }
190
+ const { fields, fieldTypes, slots } = spec;
191
+ const p = SELECT_QUERY_PREFIX;
192
+ if (fields) {
193
+ appendCsv(out, `${p}fields[only]`, fields.only);
194
+ appendCsv(out, `${p}fields[except]`, fields.except);
195
+ appendCsv(out, `${p}fields[locales]`, fields.locales);
196
+ }
197
+ if (fieldTypes) {
198
+ appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
199
+ appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
200
+ }
201
+ if (slots) {
202
+ appendCsv(out, `${p}slots[only]`, slots.only);
203
+ appendCsv(out, `${p}slots[except]`, slots.except);
204
+ if (typeof slots.depth === "number") {
205
+ out[`${p}slots[depth]`] = String(slots.depth);
206
+ }
207
+ if (slots.named) {
208
+ const slotNames = Object.keys(slots.named).sort();
209
+ for (const slotName of slotNames) {
210
+ const named = slots.named[slotName];
211
+ if (named && typeof named.depth === "number") {
212
+ out[`${p}slots.${slotName}[depth]`] = String(named.depth);
213
+ }
214
+ }
215
+ }
216
+ }
217
+ return out;
218
+ }
219
+
220
+ // src/utils/constants.ts
221
+ var CANVAS_PERSONALIZE_TYPE = "$personalization";
222
+ var CANVAS_TEST_TYPE = "$test";
223
+ var CANVAS_LOCALIZATION_TYPE = "$localization";
224
+ var CANVAS_SLOT_SECTION_TYPE = "$slotSection";
225
+ var CANVAS_INTENT_TAG_PARAM = "intentTag";
226
+ var CANVAS_LOCALE_TAG_PARAM = "locale";
227
+ var CANVAS_BLOCK_PARAM_TYPE = "$block";
228
+ var CANVAS_PERSONALIZE_SLOT = "pz";
229
+ var CANVAS_TEST_SLOT = "test";
230
+ var CANVAS_LOCALIZATION_SLOT = "localized";
231
+ var CANVAS_SLOT_SECTION_SLOT = "$slotSectionItems";
232
+ var CANVAS_SLOT_SECTION_NAME_PARAM = "name";
233
+ var CANVAS_SLOT_SECTION_MIN_PARAM = "min";
234
+ var CANVAS_SLOT_SECTION_MAX_PARAM = "max";
235
+ var CANVAS_SLOT_SECTION_GROUP_TYPE_PARAM = "groupType";
236
+ var CANVAS_SLOT_SECTION_SPECIFIC_PARAM = "specific";
237
+ var CANVAS_DRAFT_STATE = 0;
238
+ var CANVAS_PUBLISHED_STATE = 64;
239
+ var CANVAS_EDITOR_STATE = 63;
240
+ var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
241
+ var CANVAS_PERSONALIZATION_EVENT_NAME_PARAM = "trackingEventName";
242
+ var CANVAS_PERSONALIZATION_ALGORITHM_PARAM = "algorithm";
243
+ var CANVAS_PERSONALIZATION_ALGORITHM_TYPE = "pzAlgorithm";
244
+ var CANVAS_PERSONALIZATION_TAKE_PARAM = "count";
245
+ var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
246
+ var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
247
+ var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
248
+ var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
249
+ var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
250
+ var CANVAS_CONTEXTUAL_EDITING_PARAM = "$contextualEditing";
251
+ var SECRET_QUERY_STRING_PARAM = "secret";
252
+ var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
253
+ var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
254
+ var IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM = "is_incontext_editing_forced_settings";
255
+ var IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM = "is_config_check";
256
+ var IN_CONTEXT_EDITOR_COMPONENT_START_ROLE = "uniform-component-start";
257
+ var IN_CONTEXT_EDITOR_COMPONENT_END_ROLE = "uniform-component-end";
258
+ var IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID = "uniform-canvas-preview-script";
259
+ var IS_RENDERED_BY_UNIFORM_ATTRIBUTE = "data-is-rendered-by-uniform";
260
+ var PLACEHOLDER_ID = "placeholder";
261
+ var EMPTY_COMPOSITION = {
262
+ _id: "_empty_composition_id",
263
+ _name: "An empty composition used for contextual editing",
264
+ type: "_empty_composition_type"
265
+ };
266
+ var EDGE_MIN_CACHE_TTL = 10;
267
+ var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
268
+ var EDGE_DEFAULT_CACHE_TTL = 30;
269
+ var EDGE_CACHE_DISABLED = -1;
270
+ var ASSET_PARAMETER_TYPE = "asset";
271
+ var ASSETS_SOURCE_UNIFORM = "uniform-assets";
272
+ var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
273
+ var REFERENCE_DATA_TYPE_ID = "uniformContentInternalReference";
274
+
275
+ // src/clients/compositionHelpers.ts
276
+ function resolveCompositionSelector(args) {
277
+ if ("compositionId" in args) {
278
+ const { compositionId, editionId, versionId, ...readOptions } = args;
279
+ return {
280
+ readOptions,
281
+ // raw mode matches on composition OR edition id via the compositionId param
282
+ compositionId: editionId != null ? editionId : compositionId,
283
+ versionId,
284
+ hasCompositionId: true,
285
+ pinnedEdition: editionId !== void 0
286
+ };
287
+ }
288
+ return { readOptions: args, hasCompositionId: false, pinnedEdition: false };
289
+ }
290
+
291
+ // src/clients/DeliveryClientBase.ts
292
+ var DEFAULT_EDGE_API_HOST = "https://uniform.global";
293
+ var DeliveryClientBase = class extends ContentClientBase {
294
+ constructor(options) {
295
+ var _a;
296
+ super(
297
+ options,
298
+ /* defaultBypassCache */
299
+ false
300
+ );
301
+ this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : DEFAULT_EDGE_API_HOST;
302
+ this.edgeRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
303
+ }
304
+ /** Coerces the `diagnostics` option into the shape the edge endpoints accept. */
305
+ coerceDiagnostics(diagnostics) {
306
+ return typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0;
307
+ }
308
+ };
309
+
310
+ // src/clients/CompositionDeliveryClient.ts
311
+ var EDGE_SINGLE_URL = "/api/v1/composition";
312
+ var EDGE_LIST_URL = "/api/v1/compositions";
313
+ var CompositionDeliveryClient = class extends DeliveryClientBase {
314
+ constructor(options) {
315
+ super(options);
316
+ }
317
+ /** Fetches exactly one composition (throws `ApiClientError(404)` if absent). */
318
+ get(args) {
319
+ var _a;
320
+ const { diagnostics, select, ...rest } = args;
321
+ const { readOptions, compositionId, versionId, pinnedEdition } = resolveCompositionSelector(rest);
322
+ const url = this.createUrl(
323
+ EDGE_SINGLE_URL,
324
+ {
325
+ ...readOptions,
326
+ ...projectionToQuery(select),
327
+ // A pinned edition is folded into compositionId (raw matches edition or
328
+ // composition id); there is no editionId query param on this endpoint.
329
+ compositionId,
330
+ versionId,
331
+ projectId: this.options.projectId,
332
+ state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
333
+ // editionId pins a specific edition for preview; otherwise locale-best.
334
+ editions: pinnedEdition ? "raw" : "auto",
335
+ diagnostics: this.coerceDiagnostics(diagnostics)
336
+ },
337
+ this.edgeApiHost
338
+ );
339
+ return this.apiClient(url, this.edgeRequestInit);
340
+ }
341
+ /** Fetches a list of compositions, optionally filtered. */
342
+ list(args = {}) {
343
+ var _a;
344
+ const { diagnostics, filters, select, ...rest } = args;
345
+ const url = this.createUrl(
346
+ EDGE_LIST_URL,
347
+ {
348
+ ...rest,
349
+ ...rewriteFiltersForApi(filters),
350
+ ...projectionToQuery(select),
351
+ projectId: this.options.projectId,
352
+ state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
353
+ diagnostics: this.coerceDiagnostics(diagnostics)
354
+ },
355
+ this.edgeApiHost
356
+ );
357
+ return this.apiClient(url, this.edgeRequestInit);
358
+ }
359
+ };
360
+
361
+ // src/clients/CompositionManagementClient.ts
362
+ import { rewriteFiltersForApi as rewriteFiltersForApi2 } from "@uniformdev/context/api";
363
+
364
+ // src/clients/resolveManagementEditions.ts
365
+ function resolveManagementEditions({
366
+ explicit,
367
+ pinnedEdition,
368
+ hasId,
369
+ hasLocale
370
+ }) {
371
+ if (explicit) {
372
+ return explicit;
373
+ }
374
+ if (pinnedEdition) {
375
+ return "raw";
376
+ }
377
+ if (!hasId) {
378
+ return void 0;
379
+ }
380
+ return hasLocale ? "auto" : "raw";
381
+ }
382
+
383
+ // src/clients/CompositionManagementClient.ts
384
+ var CANVAS_URL = "/api/v1/canvas";
385
+ var CANVAS_HISTORY_URL = "/api/v1/canvas-history";
386
+ var CompositionManagementClient = class extends ContentClientBase {
387
+ constructor(options) {
388
+ super(
389
+ options,
390
+ /* defaultBypassCache */
391
+ true
392
+ );
393
+ }
394
+ /**
395
+ * Fetches one composition in canonical shape (throws `ApiClientError(404)` if
396
+ * absent).
397
+ */
398
+ get(args) {
399
+ var _a;
400
+ const { select, ...selectorArgs } = args;
401
+ const { readOptions, compositionId, versionId, hasCompositionId, pinnedEdition } = resolveCompositionSelector(selectorArgs);
402
+ const url = this.createUrl(CANVAS_URL, {
403
+ format: CANONICAL_FORMAT,
404
+ // Caller-supplied shaping flags and non-id selector keys ride along and
405
+ // override the format alias server-side.
406
+ ...readOptions,
407
+ ...projectionToQuery(select),
408
+ // A pinned edition is folded into compositionId; there is no editionId
409
+ // query param on this endpoint.
410
+ compositionId,
411
+ versionId,
412
+ projectId: this.options.projectId,
413
+ state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE,
414
+ editions: resolveManagementEditions({
415
+ explicit: readOptions.editions,
416
+ pinnedEdition,
417
+ hasId: hasCompositionId,
418
+ hasLocale: readOptions.locale != null
419
+ })
420
+ });
421
+ return this.apiClient(url);
422
+ }
423
+ /** Fetches a list of compositions in canonical shape. */
424
+ list(args = {}) {
425
+ var _a;
426
+ const { filters, select, ...rest } = args;
427
+ const url = this.createUrl(CANVAS_URL, {
428
+ format: CANONICAL_FORMAT,
429
+ ...rest,
430
+ ...rewriteFiltersForApi2(filters),
431
+ ...projectionToQuery(select),
432
+ projectId: this.options.projectId,
433
+ state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE
434
+ });
435
+ return this.apiClient(url);
436
+ }
437
+ /** Creates or updates a composition. Returns the new `x-modified-at` timestamp. */
438
+ async save(body, opts) {
439
+ const url = this.createUrl(CANVAS_URL);
440
+ const headers = {};
441
+ if (opts == null ? void 0 : opts.ifUnmodifiedSince) {
442
+ headers["x-if-unmodified-since"] = opts.ifUnmodifiedSince;
443
+ }
444
+ const { response } = await this.apiClientWithResponse(url, {
445
+ method: "PUT",
446
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
447
+ expectNoContent: true,
448
+ headers
449
+ });
450
+ return { modified: response.headers.get("x-modified-at") };
451
+ }
452
+ /**
453
+ * Saves the draft and publishes in one call (two PUTs). The optimistic
454
+ * concurrency guard, if any, applies to the draft write.
455
+ */
456
+ async saveAndPublish(body, opts) {
457
+ await this.save({ ...body, state: CANVAS_DRAFT_STATE }, opts);
458
+ return this.save({ ...body, state: CANVAS_PUBLISHED_STATE });
459
+ }
460
+ /**
461
+ * Removes only the published state, leaving the draft intact. Scoped to a
462
+ * single edition when `editionId` is supplied; otherwise unpublishes all editions.
463
+ * To unpublish only the base edition, pass editionId and compositionId as the same value.
464
+ */
465
+ async unpublish(selector) {
466
+ await this.deleteComposition({ ...selector, state: CANVAS_PUBLISHED_STATE });
467
+ }
468
+ /**
469
+ * Deletes across all states. Scoped to a single edition when `editionId` is
470
+ * supplied; otherwise deletes all states and editions.
471
+ * Use `unpublish` to drop only the published state.
472
+ */
473
+ async remove(selector) {
474
+ await this.deleteComposition(selector);
475
+ }
476
+ /** Fetches historical versions of a composition or pattern. */
477
+ history(args) {
478
+ const url = this.createUrl(CANVAS_HISTORY_URL, { ...args, projectId: this.options.projectId });
479
+ return this.apiClient(url);
480
+ }
481
+ async deleteComposition(body) {
482
+ const url = this.createUrl(CANVAS_URL);
483
+ await this.apiClient(url, {
484
+ method: "DELETE",
485
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
486
+ expectNoContent: true
487
+ });
488
+ }
489
+ };
490
+
491
+ // src/clients/ContentTypeClient.ts
492
+ import { ApiClientError as ApiClientError3 } from "@uniformdev/context/api";
493
+ var CONTENT_TYPES_URL = "/api/v1/content-types";
494
+ var ContentTypeClient = class extends ContentClientBase {
495
+ constructor(options) {
496
+ super(
497
+ options,
498
+ /* defaultBypassCache */
499
+ true
500
+ );
501
+ }
502
+ /** Fetches one content type by id (throws `ApiClientError(404)` if absent). */
503
+ async get(args) {
504
+ var _a;
505
+ const url = this.createUrl(CONTENT_TYPES_URL, {
506
+ contentTypeIDs: [args.contentTypeId],
507
+ limit: 1,
508
+ projectId: this.options.projectId
509
+ });
510
+ const res = await this.apiClient(url);
511
+ const contentType = (_a = res.contentTypes) == null ? void 0 : _a[0];
512
+ if (!contentType) {
513
+ throw new ApiClientError3("Content type not found", "GET", url.toString(), 404, "Not Found");
514
+ }
515
+ return contentType;
516
+ }
517
+ /** Fetches a list of content types. */
518
+ list(args) {
519
+ const url = this.createUrl(CONTENT_TYPES_URL, { ...args, projectId: this.options.projectId });
520
+ return this.apiClient(url);
521
+ }
522
+ /** Creates or updates a content type. */
523
+ async save(body, opts = {}) {
524
+ const url = this.createUrl(CONTENT_TYPES_URL);
525
+ let contentType = body.contentType;
526
+ if (typeof contentType.slugSettings === "object" && contentType.slugSettings !== null && Object.keys(contentType.slugSettings).length === 0) {
527
+ const { slugSettings: _omitEmptySlugSettings, ...rest } = contentType;
528
+ contentType = rest;
529
+ }
530
+ await this.apiClient(url, {
531
+ method: "PUT",
532
+ body: JSON.stringify({ ...body, contentType, projectId: this.options.projectId }),
533
+ expectNoContent: true,
534
+ headers: opts.autogenerateDataTypes ? { "x-uniform-autogenerate-data-types": "true" } : {}
535
+ });
536
+ }
537
+ /** Deletes a content type. */
538
+ async remove(args) {
539
+ const url = this.createUrl(CONTENT_TYPES_URL);
540
+ await this.apiClient(url, {
541
+ method: "DELETE",
542
+ body: JSON.stringify({ ...args, projectId: this.options.projectId }),
543
+ expectNoContent: true
544
+ });
545
+ }
546
+ };
547
+
548
+ // src/clients/EntryDeliveryClient.ts
549
+ import { rewriteFiltersForApi as rewriteFiltersForApi3 } from "@uniformdev/context/api";
550
+
551
+ // src/clients/entryHelpers.ts
552
+ import { ApiClientError as ApiClientError4 } from "@uniformdev/context/api";
553
+ function resolveEntrySelector(args) {
554
+ if ("entryId" in args) {
555
+ const { entryId, editionId, versionId, ...readOptions2 } = args;
556
+ return {
557
+ readOptions: readOptions2,
558
+ entryIDs: [editionId != null ? editionId : entryId],
559
+ versionId,
560
+ pinnedEdition: editionId !== void 0
561
+ };
562
+ }
563
+ const { slug, ...readOptions } = args;
564
+ return { readOptions, slug, pinnedEdition: false };
565
+ }
566
+ function unwrapSingleEntry(res, url) {
567
+ var _a;
568
+ const entry = (_a = res.entries) == null ? void 0 : _a[0];
569
+ if (!entry) {
570
+ throw new ApiClientError4("Entry not found", "GET", url.toString(), 404, "Not Found");
571
+ }
572
+ return entry;
573
+ }
574
+
575
+ // src/clients/EntryDeliveryClient.ts
576
+ var ENTRIES_URL = "/api/v1/entries";
577
+ var EntryDeliveryClient = class extends DeliveryClientBase {
578
+ constructor(options) {
579
+ super(options);
580
+ }
581
+ /** Fetches exactly one entry by id or slug (throws `ApiClientError(404)` if absent). */
582
+ async get(args) {
583
+ var _a, _b;
584
+ const { diagnostics, select, ...rest } = args;
585
+ const { entryIDs, slug, versionId, pinnedEdition, readOptions } = resolveEntrySelector(rest);
586
+ const url = this.createUrl(
587
+ ENTRIES_URL,
588
+ {
589
+ ...readOptions,
590
+ ...projectionToQuery(select),
591
+ projectId: this.options.projectId,
592
+ state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
593
+ entryIDs,
594
+ slug,
595
+ versionId,
596
+ // A pinned edition is fetched exactly; otherwise locale-best.
597
+ editions: pinnedEdition ? "raw" : "auto",
598
+ // An id lookup wants that exact entity regardless of type, so default the
599
+ // pattern filter to 'any' (origin default `false` would 404 a pattern id).
600
+ // Scoped to id lookups; slug reads keep the origin default. Explicit
601
+ // `pattern` overrides via the `...readOptions` spread above.
602
+ pattern: (_b = args.pattern) != null ? _b : entryIDs ? "any" : void 0,
603
+ diagnostics: this.coerceDiagnostics(diagnostics)
604
+ },
605
+ this.edgeApiHost
606
+ );
607
+ const res = await this.apiClient(url, this.edgeRequestInit);
608
+ return unwrapSingleEntry(res, url);
609
+ }
610
+ /** Fetches a list of entries, optionally filtered. */
611
+ list(args = {}) {
612
+ var _a;
613
+ const { diagnostics, filters, select, ...rest } = args;
614
+ const url = this.createUrl(
615
+ ENTRIES_URL,
616
+ {
617
+ ...rest,
618
+ ...rewriteFiltersForApi3(filters),
619
+ ...projectionToQuery(select),
620
+ projectId: this.options.projectId,
621
+ state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
622
+ diagnostics: this.coerceDiagnostics(diagnostics)
623
+ },
624
+ this.edgeApiHost
625
+ );
626
+ return this.apiClient(url, this.edgeRequestInit);
627
+ }
628
+ };
629
+
630
+ // src/clients/EntryManagementClient.ts
631
+ import { rewriteFiltersForApi as rewriteFiltersForApi4 } from "@uniformdev/context/api";
632
+ var ENTRIES_URL2 = "/api/v1/entries";
633
+ var ENTRIES_HISTORY_URL = "/api/v1/entries-history";
634
+ var EntryManagementClient = class extends ContentClientBase {
635
+ constructor(options) {
636
+ super(
637
+ options,
638
+ /* defaultBypassCache */
639
+ true
640
+ );
641
+ }
642
+ /**
643
+ * Fetches one entry by id or slug in canonical shape (throws
644
+ * `ApiClientError(404)` if absent).
645
+ */
646
+ async get(args) {
647
+ var _a, _b;
648
+ const { select, ...selectorArgs } = args;
649
+ const { entryIDs, slug, versionId, readOptions, pinnedEdition } = resolveEntrySelector(selectorArgs);
650
+ const url = this.createUrl(ENTRIES_URL2, {
651
+ format: CANONICAL_FORMAT,
652
+ ...readOptions,
653
+ ...projectionToQuery(select),
654
+ projectId: this.options.projectId,
655
+ state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE,
656
+ editions: resolveManagementEditions({
657
+ explicit: readOptions.editions,
658
+ pinnedEdition,
659
+ hasId: entryIDs != null,
660
+ hasLocale: readOptions.locale != null
661
+ }),
662
+ // An id lookup wants that exact entity regardless of type, so default the
663
+ // pattern filter to 'any' (origin default `false` would 404 a pattern id).
664
+ // Scoped to id lookups; slug reads keep the origin default. Explicit
665
+ // `pattern` overrides via the `...readOptions` spread above.
666
+ pattern: (_b = args.pattern) != null ? _b : entryIDs ? "any" : void 0,
667
+ entryIDs,
668
+ slug,
669
+ versionId
670
+ });
671
+ const res = await this.apiClient(url);
672
+ return unwrapSingleEntry(res, url);
673
+ }
674
+ /** Fetches a list of entries in canonical shape. */
675
+ list(args = {}) {
676
+ var _a;
677
+ const { filters, select, ...rest } = args;
678
+ const url = this.createUrl(ENTRIES_URL2, {
679
+ format: CANONICAL_FORMAT,
680
+ ...rest,
681
+ ...rewriteFiltersForApi4(filters),
682
+ ...projectionToQuery(select),
683
+ projectId: this.options.projectId,
684
+ state: (_a = args.state) != null ? _a : CANVAS_DRAFT_STATE
685
+ });
686
+ return this.apiClient(url);
687
+ }
688
+ /** Creates or updates an entry. Returns the new `x-modified-at` timestamp. */
689
+ async save(body, opts) {
690
+ const url = this.createUrl(ENTRIES_URL2);
691
+ const headers = {};
692
+ if (opts == null ? void 0 : opts.ifUnmodifiedSince) {
693
+ headers["x-if-unmodified-since"] = opts.ifUnmodifiedSince;
694
+ }
695
+ const { response } = await this.apiClientWithResponse(url, {
696
+ method: "PUT",
697
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
698
+ expectNoContent: true,
699
+ headers
700
+ });
701
+ return { modified: response.headers.get("x-modified-at") };
702
+ }
703
+ /** Saves the draft and publishes in one call (two PUTs). */
704
+ async saveAndPublish(body, opts) {
705
+ await this.save({ ...body, state: CANVAS_DRAFT_STATE }, opts);
706
+ return this.save({ ...body, state: CANVAS_PUBLISHED_STATE });
707
+ }
708
+ /**
709
+ * Removes only the published state, leaving the draft intact. Scoped to a
710
+ * single edition when `editionId` is supplied; otherwise unpublishes all editions.
711
+ * To unpublish only the base edition, pass editionId and entryId as the same value.
712
+ */
713
+ async unpublish(selector) {
714
+ await this.deleteEntry({ ...selector, state: CANVAS_PUBLISHED_STATE });
715
+ }
716
+ /**
717
+ * Deletes across all states. Scoped to a single edition when `editionId` is
718
+ * supplied; otherwise deletes all states and editions.
719
+ * Use `unpublish` to drop only the published state.
720
+ */
721
+ async remove(selector) {
722
+ await this.deleteEntry(selector);
723
+ }
724
+ /** Fetches historical versions of an entry. */
725
+ history(args) {
726
+ const url = this.createUrl(ENTRIES_HISTORY_URL, { ...args, projectId: this.options.projectId });
727
+ return this.apiClient(url);
728
+ }
729
+ async deleteEntry(body) {
730
+ const url = this.createUrl(ENTRIES_URL2);
731
+ await this.apiClient(url, {
732
+ method: "DELETE",
733
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
734
+ expectNoContent: true
735
+ });
736
+ }
737
+ };
738
+
739
+ // src/clients/deprecated/CanvasClient.ts
740
+ import { ApiClient as ApiClient3, rewriteFiltersForApi as rewriteFiltersForApi5 } from "@uniformdev/context/api";
741
+ var CANVAS_URL2 = "/api/v1/canvas";
742
+ var CanvasClient = class extends ApiClient3 {
590
743
  constructor(options) {
591
744
  var _a;
592
745
  if (!options.limitPolicy) {
@@ -599,17 +752,24 @@ var CanvasClient = class extends ApiClient {
599
752
  /** Fetches lists of Canvas compositions, optionally by type */
600
753
  async getCompositionList(params = {}) {
601
754
  const { projectId } = this.options;
602
- const { resolveData, filters, ...originParams } = params;
603
- const rewrittenFilters = rewriteFiltersForApi(filters);
755
+ const { resolveData, filters, select, ...originParams } = params;
756
+ const rewrittenFilters = rewriteFiltersForApi5(filters);
757
+ const rewrittenSelect = projectionToQuery(select);
604
758
  if (!resolveData) {
605
- const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
759
+ const fetchUri = this.createUrl(CANVAS_URL2, {
760
+ ...originParams,
761
+ projectId,
762
+ ...rewrittenFilters,
763
+ ...rewrittenSelect
764
+ });
606
765
  return this.apiClient(fetchUri);
607
766
  }
608
767
  const edgeParams = {
609
768
  ...originParams,
610
769
  projectId,
611
770
  diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
612
- ...rewrittenFilters
771
+ ...rewrittenFilters,
772
+ ...rewrittenSelect
613
773
  };
614
774
  const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
615
775
  return this.apiClient(edgeUrl, this.edgeApiRequestInit);
@@ -644,7 +804,7 @@ var CanvasClient = class extends ApiClient {
644
804
  }) {
645
805
  const { projectId } = this.options;
646
806
  if (skipDataResolution) {
647
- return this.apiClient(this.createUrl(CANVAS_URL, { ...params, projectId }));
807
+ return this.apiClient(this.createUrl(CANVAS_URL2, { ...params, projectId }));
648
808
  }
649
809
  const edgeParams = {
650
810
  ...params,
@@ -656,7 +816,7 @@ var CanvasClient = class extends ApiClient {
656
816
  }
657
817
  /** Updates or creates a Canvas component definition */
658
818
  async updateComposition(body, options) {
659
- const fetchUri = this.createUrl(CANVAS_URL);
819
+ const fetchUri = this.createUrl(CANVAS_URL2);
660
820
  const headers = {};
661
821
  if (options == null ? void 0 : options.ifUnmodifiedSince) {
662
822
  headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
@@ -671,7 +831,7 @@ var CanvasClient = class extends ApiClient {
671
831
  }
672
832
  /** Deletes a Canvas component definition */
673
833
  async removeComposition(body) {
674
- const fetchUri = this.createUrl(CANVAS_URL);
834
+ const fetchUri = this.createUrl(CANVAS_URL2);
675
835
  const { projectId } = this.options;
676
836
  await this.apiClient(fetchUri, {
677
837
  method: "DELETE",
@@ -710,53 +870,10 @@ var UncachedCanvasClient = class extends CanvasClient {
710
870
  }
711
871
  };
712
872
 
713
- // src/CategoryClient.ts
714
- import { ApiClient as ApiClient2 } from "@uniformdev/context/api";
715
- var CATEGORIES_URL = "/api/v1/categories";
716
- var CategoryClient = class extends ApiClient2 {
717
- constructor(options) {
718
- if (!options.limitPolicy) {
719
- options.limitPolicy = createLimitPolicy({});
720
- }
721
- super(options);
722
- }
723
- /** Fetches all categories created in given project */
724
- async getCategories(options) {
725
- const { projectId } = this.options;
726
- const fetchUri = this.createUrl("/api/v1/categories", { ...options, projectId });
727
- return await this.apiClient(fetchUri);
728
- }
729
- /** Updates or creates a category, also used to re-order them */
730
- async upsertCategories(categories) {
731
- const { projectId } = this.options;
732
- const fetchUri = this.createUrl(CATEGORIES_URL);
733
- return await this.apiClient(fetchUri, {
734
- method: "PUT",
735
- body: JSON.stringify({ categories, projectId }),
736
- expectNoContent: true
737
- });
738
- }
739
- /** Deletes a category */
740
- async removeCategory(options) {
741
- const { projectId } = this.options;
742
- const fetchUri = this.createUrl(CATEGORIES_URL);
743
- return await this.apiClient(fetchUri, {
744
- method: "DELETE",
745
- body: JSON.stringify({ projectId, categoryId: options.categoryId }),
746
- expectNoContent: true
747
- });
748
- }
749
- };
750
- var UncachedCategoryClient = class extends CategoryClient {
751
- constructor(options) {
752
- super({ ...options, bypassCache: true });
753
- }
754
- };
755
-
756
- // src/ContentClient.ts
757
- import { ApiClient as ApiClient3, rewriteFiltersForApi as rewriteFiltersForApi2 } from "@uniformdev/context/api";
873
+ // src/clients/deprecated/ContentClient.ts
874
+ import { ApiClient as ApiClient4, rewriteFiltersForApi as rewriteFiltersForApi6 } from "@uniformdev/context/api";
758
875
  var _contentTypesUrl, _entriesUrl;
759
- var _ContentClient = class _ContentClient extends ApiClient3 {
876
+ var _ContentClient = class _ContentClient extends ApiClient4 {
760
877
  constructor(options) {
761
878
  var _a;
762
879
  super(options);
@@ -769,15 +886,21 @@ var _ContentClient = class _ContentClient extends ApiClient3 {
769
886
  }
770
887
  getEntries(options) {
771
888
  const { projectId } = this.options;
772
- const { skipDataResolution, filters, ...params } = options;
773
- const rewrittenFilters = rewriteFiltersForApi2(filters);
889
+ const { skipDataResolution, filters, select, ...params } = options;
890
+ const rewrittenFilters = rewriteFiltersForApi6(filters);
891
+ const rewrittenSelect = projectionToQuery(select);
774
892
  if (skipDataResolution) {
775
- const url = this.createUrl(__privateGet(_ContentClient, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
893
+ const url = this.createUrl(__privateGet(_ContentClient, _entriesUrl), {
894
+ ...params,
895
+ ...rewrittenFilters,
896
+ ...rewrittenSelect,
897
+ projectId
898
+ });
776
899
  return this.apiClient(url);
777
900
  }
778
901
  const edgeUrl = this.createUrl(
779
902
  __privateGet(_ContentClient, _entriesUrl),
780
- { ...this.getEdgeOptions(params), ...rewrittenFilters },
903
+ { ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
781
904
  this.edgeApiHost
782
905
  );
783
906
  return this.apiClient(
@@ -857,27 +980,31 @@ var UncachedContentClient = class extends ContentClient {
857
980
  };
858
981
 
859
982
  // src/DataSourceClient.ts
860
- import { ApiClient as ApiClient4 } from "@uniformdev/context/api";
983
+ import { ApiClient as ApiClient5 } from "@uniformdev/context/api";
861
984
  var dataSourceUrl = "/api/v1/data-source";
862
985
  var dataSourcesUrl = "/api/v1/data-sources";
863
- var DataSourceClient = class extends ApiClient4 {
986
+ var DataSourceClient = class extends ApiClient5 {
864
987
  constructor(options) {
865
988
  super(options);
866
989
  }
867
- /** Fetches all DataSources for a project */
990
+ /** Fetches a single DataSource by id (with decrypted secrets). */
868
991
  async get(options) {
869
992
  const { projectId } = this.options;
870
993
  const fetchUri = this.createUrl(dataSourceUrl, { ...options, projectId });
871
994
  return await this.apiClient(fetchUri);
872
995
  }
873
- /** Fetches all DataSources for a project */
874
- async getList(options) {
996
+ /** Fetches the list of DataSources for a project (secrets masked). */
997
+ async list(options) {
875
998
  const { projectId } = this.options;
876
999
  const fetchUri = this.createUrl(dataSourcesUrl, { ...options, projectId });
877
1000
  return await this.apiClient(fetchUri);
878
1001
  }
1002
+ /** @deprecated Use {@link list} instead. */
1003
+ async getList(options) {
1004
+ return this.list(options);
1005
+ }
879
1006
  /** Updates or creates (based on id) a DataSource */
880
- async upsert(body) {
1007
+ async save(body) {
881
1008
  const fetchUri = this.createUrl(dataSourceUrl);
882
1009
  await this.apiClient(fetchUri, {
883
1010
  method: "PUT",
@@ -885,6 +1012,10 @@ var DataSourceClient = class extends ApiClient4 {
885
1012
  expectNoContent: true
886
1013
  });
887
1014
  }
1015
+ /** @deprecated Use {@link save} instead. */
1016
+ async upsert(body) {
1017
+ return this.save(body);
1018
+ }
888
1019
  /** Deletes a DataSource */
889
1020
  async remove(body) {
890
1021
  const fetchUri = this.createUrl(dataSourceUrl);
@@ -897,20 +1028,24 @@ var DataSourceClient = class extends ApiClient4 {
897
1028
  };
898
1029
 
899
1030
  // src/DataTypeClient.ts
900
- import { ApiClient as ApiClient5 } from "@uniformdev/context/api";
1031
+ import { ApiClient as ApiClient6 } from "@uniformdev/context/api";
901
1032
  var _url;
902
- var _DataTypeClient = class _DataTypeClient extends ApiClient5 {
1033
+ var _DataTypeClient = class _DataTypeClient extends ApiClient6 {
903
1034
  constructor(options) {
904
1035
  super(options);
905
1036
  }
906
- /** Fetches all DataTypes for a project */
907
- async get(options) {
1037
+ /** Fetches a list of DataTypes for a project */
1038
+ async list(options) {
908
1039
  const { projectId } = this.options;
909
1040
  const fetchUri = this.createUrl(__privateGet(_DataTypeClient, _url), { ...options, projectId });
910
1041
  return await this.apiClient(fetchUri);
911
1042
  }
1043
+ /** @deprecated Use {@link list} instead. */
1044
+ async get(options) {
1045
+ return this.list(options);
1046
+ }
912
1047
  /** Updates or creates (based on id) a DataType */
913
- async upsert(body) {
1048
+ async save(body) {
914
1049
  const fetchUri = this.createUrl(__privateGet(_DataTypeClient, _url));
915
1050
  await this.apiClient(fetchUri, {
916
1051
  method: "PUT",
@@ -918,6 +1053,10 @@ var _DataTypeClient = class _DataTypeClient extends ApiClient5 {
918
1053
  expectNoContent: true
919
1054
  });
920
1055
  }
1056
+ /** @deprecated Use {@link save} instead. */
1057
+ async upsert(body) {
1058
+ return this.save(body);
1059
+ }
921
1060
  /** Deletes a DataType */
922
1061
  async remove(body) {
923
1062
  const fetchUri = this.createUrl(__privateGet(_DataTypeClient, _url));
@@ -1053,61 +1192,6 @@ function getComponentPath(ancestorsAndSelf) {
1053
1192
  return `.${path.join(".")}`;
1054
1193
  }
1055
1194
 
1056
- // src/utils/constants.ts
1057
- var CANVAS_PERSONALIZE_TYPE = "$personalization";
1058
- var CANVAS_TEST_TYPE = "$test";
1059
- var CANVAS_LOCALIZATION_TYPE = "$localization";
1060
- var CANVAS_SLOT_SECTION_TYPE = "$slotSection";
1061
- var CANVAS_INTENT_TAG_PARAM = "intentTag";
1062
- var CANVAS_LOCALE_TAG_PARAM = "locale";
1063
- var CANVAS_BLOCK_PARAM_TYPE = "$block";
1064
- var CANVAS_PERSONALIZE_SLOT = "pz";
1065
- var CANVAS_TEST_SLOT = "test";
1066
- var CANVAS_LOCALIZATION_SLOT = "localized";
1067
- var CANVAS_SLOT_SECTION_SLOT = "$slotSectionItems";
1068
- var CANVAS_SLOT_SECTION_NAME_PARAM = "name";
1069
- var CANVAS_SLOT_SECTION_MIN_PARAM = "min";
1070
- var CANVAS_SLOT_SECTION_MAX_PARAM = "max";
1071
- var CANVAS_SLOT_SECTION_GROUP_TYPE_PARAM = "groupType";
1072
- var CANVAS_SLOT_SECTION_SPECIFIC_PARAM = "specific";
1073
- var CANVAS_DRAFT_STATE = 0;
1074
- var CANVAS_PUBLISHED_STATE = 64;
1075
- var CANVAS_EDITOR_STATE = 63;
1076
- var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
1077
- var CANVAS_PERSONALIZATION_EVENT_NAME_PARAM = "trackingEventName";
1078
- var CANVAS_PERSONALIZATION_ALGORITHM_PARAM = "algorithm";
1079
- var CANVAS_PERSONALIZATION_ALGORITHM_TYPE = "pzAlgorithm";
1080
- var CANVAS_PERSONALIZATION_TAKE_PARAM = "count";
1081
- var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
1082
- var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
1083
- var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
1084
- var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
1085
- var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
1086
- var CANVAS_CONTEXTUAL_EDITING_PARAM = "$contextualEditing";
1087
- var SECRET_QUERY_STRING_PARAM = "secret";
1088
- var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
1089
- var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
1090
- var IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM = "is_incontext_editing_forced_settings";
1091
- var IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM = "is_config_check";
1092
- var IN_CONTEXT_EDITOR_COMPONENT_START_ROLE = "uniform-component-start";
1093
- var IN_CONTEXT_EDITOR_COMPONENT_END_ROLE = "uniform-component-end";
1094
- var IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID = "uniform-canvas-preview-script";
1095
- var IS_RENDERED_BY_UNIFORM_ATTRIBUTE = "data-is-rendered-by-uniform";
1096
- var PLACEHOLDER_ID = "placeholder";
1097
- var EMPTY_COMPOSITION = {
1098
- _id: "_empty_composition_id",
1099
- _name: "An empty composition used for contextual editing",
1100
- type: "_empty_composition_type"
1101
- };
1102
- var EDGE_MIN_CACHE_TTL = 10;
1103
- var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
1104
- var EDGE_DEFAULT_CACHE_TTL = 30;
1105
- var EDGE_CACHE_DISABLED = -1;
1106
- var ASSET_PARAMETER_TYPE = "asset";
1107
- var ASSETS_SOURCE_UNIFORM = "uniform-assets";
1108
- var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
1109
- var REFERENCE_DATA_TYPE_ID = "uniformContentInternalReference";
1110
-
1111
1195
  // src/utils/guards.ts
1112
1196
  function isRootEntryReference(root) {
1113
1197
  return root.type === "root" && isEntryData(root.node);
@@ -2406,8 +2490,7 @@ function extractLocales({ component }) {
2406
2490
  return variations;
2407
2491
  }
2408
2492
  function localize(options) {
2409
- const nodes = options.nodes;
2410
- const locale = options.locale;
2493
+ const { nodes, locale, keepLocalesFor } = options;
2411
2494
  if (!locale) {
2412
2495
  return;
2413
2496
  }
@@ -2415,7 +2498,7 @@ function localize(options) {
2415
2498
  walkNodeTree(nodes, (context) => {
2416
2499
  const { type, node, actions } = context;
2417
2500
  if (type !== "component") {
2418
- localizeProperties(node, locale, vizControlLocaleRule);
2501
+ localizeProperties(node, locale, vizControlLocaleRule, keepLocalesFor);
2419
2502
  return;
2420
2503
  }
2421
2504
  const result = evaluateWalkTreeNodeVisibility({
@@ -2436,7 +2519,7 @@ function localize(options) {
2436
2519
  if (replaceComponent == null ? void 0 : replaceComponent.length) {
2437
2520
  replaceComponent.forEach((component) => {
2438
2521
  removeLocaleProperty(component);
2439
- localizeProperties(component, locale, vizControlLocaleRule);
2522
+ localizeProperties(component, locale, vizControlLocaleRule, keepLocalesFor);
2440
2523
  });
2441
2524
  const [first, ...rest] = replaceComponent;
2442
2525
  actions.replace(first);
@@ -2447,7 +2530,7 @@ function localize(options) {
2447
2530
  actions.remove();
2448
2531
  }
2449
2532
  } else {
2450
- localizeProperties(node, locale, vizControlLocaleRule);
2533
+ localizeProperties(node, locale, vizControlLocaleRule, keepLocalesFor);
2451
2534
  }
2452
2535
  });
2453
2536
  }
@@ -2466,7 +2549,7 @@ function removeLocaleProperty(component) {
2466
2549
  }
2467
2550
  }
2468
2551
  }
2469
- function localizeProperties(node, locale, rules) {
2552
+ function localizeProperties(node, locale, rules, keepLocalesFor) {
2470
2553
  const properties = getPropertiesValue(node);
2471
2554
  if (!properties) {
2472
2555
  return void 0;
@@ -2485,10 +2568,16 @@ function localizeProperties(node, locale, rules) {
2485
2568
  if (currentLocaleConditionalValues !== void 0) {
2486
2569
  propertyValue.conditions = currentLocaleConditionalValues;
2487
2570
  }
2488
- delete propertyValue.locales;
2489
- delete propertyValue.localesConditions;
2571
+ const preserveLocales = (keepLocalesFor == null ? void 0 : keepLocalesFor(propertyId)) === true;
2572
+ if (!preserveLocales) {
2573
+ delete propertyValue.locales;
2574
+ delete propertyValue.localesConditions;
2575
+ }
2490
2576
  if (propertyValue.value === void 0 && propertyValue.conditions === void 0) {
2491
- delete properties[propertyId];
2577
+ const hasLocales = preserveLocales && (propertyValue.locales || propertyValue.localesConditions);
2578
+ if (!hasLocales) {
2579
+ delete properties[propertyId];
2580
+ }
2492
2581
  }
2493
2582
  });
2494
2583
  evaluateWalkTreePropertyCriteria({
@@ -2556,24 +2645,28 @@ function walkPropertyValues(property, visitor) {
2556
2645
  }
2557
2646
 
2558
2647
  // src/EntityReleasesClient.ts
2559
- import { ApiClient as ApiClient6 } from "@uniformdev/context/api";
2560
- var releaseContentsUrl = "/api/v1/entity-releases";
2561
- var EntityReleasesClient = class extends ApiClient6 {
2648
+ import { ApiClient as ApiClient7 } from "@uniformdev/context/api";
2649
+ var entityReleasesUrl = "/api/v1/entity-releases";
2650
+ var EntityReleasesClient = class extends ApiClient7 {
2562
2651
  constructor(options) {
2563
2652
  super(options);
2564
2653
  }
2565
2654
  /** Fetches entity across all releases (and base) */
2566
- async get(options) {
2655
+ async list(options) {
2567
2656
  const { projectId } = this.options;
2568
- const fetchUri = this.createUrl(releaseContentsUrl, { ...options, projectId });
2657
+ const fetchUri = this.createUrl(entityReleasesUrl, { ...options, projectId });
2569
2658
  return await this.apiClient(fetchUri);
2570
2659
  }
2660
+ /** @deprecated Use {@link list} instead. */
2661
+ async get(options) {
2662
+ return this.list(options);
2663
+ }
2571
2664
  };
2572
2665
 
2573
2666
  // src/IntegrationPropertyEditorsClient.ts
2574
- import { ApiClient as ApiClient7 } from "@uniformdev/context/api";
2667
+ import { ApiClient as ApiClient8 } from "@uniformdev/context/api";
2575
2668
  var _baseUrl;
2576
- var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient extends ApiClient7 {
2669
+ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient extends ApiClient8 {
2577
2670
  constructor(options) {
2578
2671
  super(options);
2579
2672
  this.teamId = options.teamId;
@@ -2616,17 +2709,21 @@ __privateAdd(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-p
2616
2709
  var IntegrationPropertyEditorsClient = _IntegrationPropertyEditorsClient;
2617
2710
 
2618
2711
  // src/LabelClient.ts
2619
- import { ApiClient as ApiClient8 } from "@uniformdev/context/api";
2712
+ import { ApiClient as ApiClient9 } from "@uniformdev/context/api";
2620
2713
  var LABELS_URL = "/api/v1/labels";
2621
- var LabelClient = class extends ApiClient8 {
2622
- /** Fetches labels for the current project. */
2623
- async getLabels(options) {
2714
+ var LabelClient = class extends ApiClient9 {
2715
+ /** Fetches a list of labels for the current project. */
2716
+ async list(options) {
2624
2717
  const { projectId } = this.options;
2625
2718
  const fetchUri = this.createUrl(LABELS_URL, { ...options, projectId });
2626
2719
  return await this.apiClient(fetchUri);
2627
2720
  }
2721
+ /** @deprecated Use {@link list} instead. */
2722
+ async getLabels(options) {
2723
+ return this.list(options);
2724
+ }
2628
2725
  /** Updates or creates a label. */
2629
- async upsertLabel(body) {
2726
+ async save(body) {
2630
2727
  const { projectId } = this.options;
2631
2728
  const fetchUri = this.createUrl(LABELS_URL);
2632
2729
  await this.apiClient(fetchUri, {
@@ -2635,8 +2732,12 @@ var LabelClient = class extends ApiClient8 {
2635
2732
  expectNoContent: true
2636
2733
  });
2637
2734
  }
2735
+ /** @deprecated Use {@link save} instead. */
2736
+ async upsertLabel(body) {
2737
+ return this.save(body);
2738
+ }
2638
2739
  /** Deletes a label by id. */
2639
- async removeLabel(options) {
2740
+ async remove(options) {
2640
2741
  const { projectId } = this.options;
2641
2742
  const fetchUri = this.createUrl(LABELS_URL);
2642
2743
  await this.apiClient(fetchUri, {
@@ -2645,6 +2746,10 @@ var LabelClient = class extends ApiClient8 {
2645
2746
  expectNoContent: true
2646
2747
  });
2647
2748
  }
2749
+ /** @deprecated Use {@link remove} instead. */
2750
+ async removeLabel(options) {
2751
+ return this.remove(options);
2752
+ }
2648
2753
  };
2649
2754
  var UncachedLabelClient = class extends LabelClient {
2650
2755
  constructor(options) {
@@ -2653,20 +2758,24 @@ var UncachedLabelClient = class extends LabelClient {
2653
2758
  };
2654
2759
 
2655
2760
  // src/LocaleClient.ts
2656
- import { ApiClient as ApiClient9 } from "@uniformdev/context/api";
2761
+ import { ApiClient as ApiClient10 } from "@uniformdev/context/api";
2657
2762
  var localesUrl = "/api/v1/locales";
2658
- var LocaleClient = class extends ApiClient9 {
2763
+ var LocaleClient = class extends ApiClient10 {
2659
2764
  constructor(options) {
2660
2765
  super(options);
2661
2766
  }
2662
- /** Fetches all locales for a project */
2663
- async get(options) {
2767
+ /** Fetches a list of locales for a project */
2768
+ async list(options) {
2664
2769
  const { projectId } = this.options;
2665
2770
  const fetchUri = this.createUrl(localesUrl, { ...options, projectId });
2666
2771
  return await this.apiClient(fetchUri);
2667
2772
  }
2773
+ /** @deprecated Use {@link list} instead. */
2774
+ async get(options) {
2775
+ return this.list(options);
2776
+ }
2668
2777
  /** Updates or creates (based on id) a locale */
2669
- async upsert(body) {
2778
+ async save(body) {
2670
2779
  const fetchUri = this.createUrl(localesUrl);
2671
2780
  await this.apiClient(fetchUri, {
2672
2781
  method: "PUT",
@@ -2674,6 +2783,10 @@ var LocaleClient = class extends ApiClient9 {
2674
2783
  expectNoContent: true
2675
2784
  });
2676
2785
  }
2786
+ /** @deprecated Use {@link save} instead. */
2787
+ async upsert(body) {
2788
+ return this.save(body);
2789
+ }
2677
2790
  /** Deletes a locale */
2678
2791
  async remove(body) {
2679
2792
  const fetchUri = this.createUrl(localesUrl);
@@ -3057,10 +3170,10 @@ var createCanvasChannel = ({
3057
3170
  };
3058
3171
 
3059
3172
  // src/PreviewClient.ts
3060
- import { ApiClient as ApiClient10 } from "@uniformdev/context/api";
3173
+ import { ApiClient as ApiClient11 } from "@uniformdev/context/api";
3061
3174
  var previewUrlsUrl = "/api/v1/preview-urls";
3062
3175
  var previewViewportsUrl = "/api/v1/preview-viewports";
3063
- var PreviewClient = class extends ApiClient10 {
3176
+ var PreviewClient = class extends ApiClient11 {
3064
3177
  constructor(options) {
3065
3178
  super(options);
3066
3179
  }
@@ -3123,9 +3236,9 @@ var PreviewClient = class extends ApiClient10 {
3123
3236
  };
3124
3237
 
3125
3238
  // src/ProjectClient.ts
3126
- import { ApiClient as ApiClient11 } from "@uniformdev/context/api";
3239
+ import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
3127
3240
  var _url2, _projectsUrl;
3128
- var _ProjectClient = class _ProjectClient extends ApiClient11 {
3241
+ var _ProjectClient = class _ProjectClient extends ApiClient12 {
3129
3242
  constructor(options) {
3130
3243
  super({ ...options, bypassCache: true });
3131
3244
  }
@@ -3139,20 +3252,28 @@ var _ProjectClient = class _ProjectClient extends ApiClient11 {
3139
3252
  * When teamId is provided, returns a single team with its projects.
3140
3253
  * When omitted, returns all accessible teams and their projects.
3141
3254
  */
3142
- async getProjects(options) {
3255
+ async list(options) {
3143
3256
  const fetchUri = this.createUrl(__privateGet(_ProjectClient, _projectsUrl), options ? { ...options } : {});
3144
3257
  return await this.apiClient(fetchUri);
3145
3258
  }
3259
+ /** @deprecated Use {@link list} instead. */
3260
+ async getProjects(options) {
3261
+ return this.list(options);
3262
+ }
3146
3263
  /** Updates or creates (based on id) a Project */
3147
- async upsert(body) {
3264
+ async save(body) {
3148
3265
  const fetchUri = this.createUrl(__privateGet(_ProjectClient, _url2));
3149
3266
  return await this.apiClient(fetchUri, {
3150
3267
  method: "PUT",
3151
3268
  body: JSON.stringify({ ...body })
3152
3269
  });
3153
3270
  }
3271
+ /** @deprecated Use {@link save} instead. */
3272
+ async upsert(body) {
3273
+ return this.save(body);
3274
+ }
3154
3275
  /** Deletes a Project */
3155
- async delete(body) {
3276
+ async remove(body) {
3156
3277
  const fetchUri = this.createUrl(__privateGet(_ProjectClient, _url2));
3157
3278
  await this.apiClient(fetchUri, {
3158
3279
  method: "DELETE",
@@ -3160,6 +3281,10 @@ var _ProjectClient = class _ProjectClient extends ApiClient11 {
3160
3281
  expectNoContent: true
3161
3282
  });
3162
3283
  }
3284
+ /** @deprecated Use {@link remove} instead. */
3285
+ async delete(body) {
3286
+ return this.remove(body);
3287
+ }
3163
3288
  };
3164
3289
  _url2 = new WeakMap();
3165
3290
  _projectsUrl = new WeakMap();
@@ -3167,10 +3292,177 @@ __privateAdd(_ProjectClient, _url2, "/api/v1/project");
3167
3292
  __privateAdd(_ProjectClient, _projectsUrl, "/api/v1/projects");
3168
3293
  var ProjectClient = _ProjectClient;
3169
3294
 
3295
+ // src/projection/matchesProjectionPattern.ts
3296
+ var DISALLOWED_PATTERN_CHARS = /[,&=?#[\]\s]/;
3297
+ var REGEX_METACHAR = /[\\^$.|?*+()[\]{}]/g;
3298
+ function isValidProjectionPattern(pattern) {
3299
+ if (typeof pattern !== "string" || pattern.length === 0) {
3300
+ return false;
3301
+ }
3302
+ if (DISALLOWED_PATTERN_CHARS.test(pattern)) {
3303
+ return false;
3304
+ }
3305
+ return true;
3306
+ }
3307
+ function compilePattern(pattern) {
3308
+ let regexSource = "^";
3309
+ for (const ch of pattern) {
3310
+ if (ch === "*") {
3311
+ regexSource += ".*";
3312
+ } else {
3313
+ regexSource += ch.replace(REGEX_METACHAR, "\\$&");
3314
+ }
3315
+ }
3316
+ regexSource += "$";
3317
+ return new RegExp(regexSource);
3318
+ }
3319
+ var PATTERN_CACHE_MAX = 1024;
3320
+ var patternRegexCache = /* @__PURE__ */ new Map();
3321
+ function matchesProjectionPattern(pattern, value) {
3322
+ let re = patternRegexCache.get(pattern);
3323
+ if (re === void 0) {
3324
+ if (!isValidProjectionPattern(pattern)) {
3325
+ throw new Error(`Invalid projection pattern: ${JSON.stringify(pattern)}`);
3326
+ }
3327
+ re = compilePattern(pattern);
3328
+ if (patternRegexCache.size >= PATTERN_CACHE_MAX) {
3329
+ const oldest = patternRegexCache.keys().next().value;
3330
+ if (oldest !== void 0) patternRegexCache.delete(oldest);
3331
+ }
3332
+ patternRegexCache.set(pattern, re);
3333
+ }
3334
+ return re.test(value);
3335
+ }
3336
+
3337
+ // src/projection/queryToProjection.ts
3338
+ var TOP_LEVEL_OPERATOR_KEY = /^(fields|fieldTypes|slots)\[([A-Za-z]+)\]$/;
3339
+ var SLOTS_NAMED_KEY = /^slots\.([A-Za-z0-9_-]+)\[([A-Za-z]+)\]$/;
3340
+ function toStringValue2(value) {
3341
+ if (Array.isArray(value)) {
3342
+ return value.join(",");
3343
+ }
3344
+ return value;
3345
+ }
3346
+ function parseCsv(value) {
3347
+ const str = toStringValue2(value);
3348
+ if (!str) {
3349
+ return [];
3350
+ }
3351
+ return str.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
3352
+ }
3353
+ function parseDepth(value, key) {
3354
+ const str = toStringValue2(value);
3355
+ if (str === void 0 || str === "") {
3356
+ throw new Error(`Invalid select projection: '${key}' requires a non-negative integer value`);
3357
+ }
3358
+ if (!/^\d+$/.test(str)) {
3359
+ throw new Error(
3360
+ `Invalid select projection: '${key}' must be a non-negative integer (got ${JSON.stringify(str)})`
3361
+ );
3362
+ }
3363
+ return Number(str);
3364
+ }
3365
+ function extractSelectKeys(source) {
3366
+ if (source instanceof URLSearchParams) {
3367
+ let out2;
3368
+ for (const [key, value] of source.entries()) {
3369
+ if (!key.startsWith(SELECT_QUERY_PREFIX)) continue;
3370
+ out2 != null ? out2 : out2 = {};
3371
+ out2[key] = out2[key] === void 0 ? value : `${out2[key]},${value}`;
3372
+ }
3373
+ return out2;
3374
+ }
3375
+ let out;
3376
+ for (const key in source) {
3377
+ if (!key.startsWith(SELECT_QUERY_PREFIX)) continue;
3378
+ out != null ? out : out = {};
3379
+ out[key] = source[key];
3380
+ }
3381
+ return out;
3382
+ }
3383
+ function queryToProjection(source) {
3384
+ var _a, _b, _c, _d, _e;
3385
+ if (!source) {
3386
+ return void 0;
3387
+ }
3388
+ const query = extractSelectKeys(source);
3389
+ if (!query) {
3390
+ return void 0;
3391
+ }
3392
+ const spec = {};
3393
+ for (const [rawKey, value] of Object.entries(query)) {
3394
+ const key = rawKey.slice(SELECT_QUERY_PREFIX.length);
3395
+ const namedMatch = SLOTS_NAMED_KEY.exec(key);
3396
+ if (namedMatch) {
3397
+ const [, slotName, operator2] = namedMatch;
3398
+ if (operator2 !== "depth") {
3399
+ throw new Error(
3400
+ `Invalid select projection: unsupported operator '${operator2}' for slots.${slotName}`
3401
+ );
3402
+ }
3403
+ const slots = (_a = spec.slots) != null ? _a : spec.slots = {};
3404
+ const named = (_b = slots.named) != null ? _b : slots.named = {};
3405
+ named[slotName] = { ...named[slotName], depth: parseDepth(value, rawKey) };
3406
+ continue;
3407
+ }
3408
+ const topMatch = TOP_LEVEL_OPERATOR_KEY.exec(key);
3409
+ if (!topMatch) {
3410
+ throw new Error(`Invalid select projection key: ${JSON.stringify(rawKey)}`);
3411
+ }
3412
+ const [, bucket, operator] = topMatch;
3413
+ if (bucket === "fields") {
3414
+ const fields = (_c = spec.fields) != null ? _c : spec.fields = {};
3415
+ switch (operator) {
3416
+ case "only":
3417
+ fields.only = parseCsv(value);
3418
+ break;
3419
+ case "except":
3420
+ fields.except = parseCsv(value);
3421
+ break;
3422
+ case "locales":
3423
+ fields.locales = parseCsv(value);
3424
+ break;
3425
+ default:
3426
+ throw new Error(`Invalid select projection: unsupported operator 'fields[${operator}]'`);
3427
+ }
3428
+ } else if (bucket === "fieldTypes") {
3429
+ const fieldTypes = (_d = spec.fieldTypes) != null ? _d : spec.fieldTypes = {};
3430
+ switch (operator) {
3431
+ case "only":
3432
+ fieldTypes.only = parseCsv(value);
3433
+ break;
3434
+ case "except":
3435
+ fieldTypes.except = parseCsv(value);
3436
+ break;
3437
+ default:
3438
+ throw new Error(`Invalid select projection: unsupported operator 'fieldTypes[${operator}]'`);
3439
+ }
3440
+ } else if (bucket === "slots") {
3441
+ const slots = (_e = spec.slots) != null ? _e : spec.slots = {};
3442
+ switch (operator) {
3443
+ case "only":
3444
+ slots.only = parseCsv(value);
3445
+ break;
3446
+ case "except":
3447
+ slots.except = parseCsv(value);
3448
+ break;
3449
+ case "depth":
3450
+ slots.depth = parseDepth(value, rawKey);
3451
+ break;
3452
+ default:
3453
+ throw new Error(`Invalid select projection: unsupported operator 'slots[${operator}]'`);
3454
+ }
3455
+ } else {
3456
+ throw new Error(`Invalid select projection key: ${JSON.stringify(rawKey)}`);
3457
+ }
3458
+ }
3459
+ return spec;
3460
+ }
3461
+
3170
3462
  // src/PromptClient.ts
3171
- import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
3463
+ import { ApiClient as ApiClient13 } from "@uniformdev/context/api";
3172
3464
  var PromptsUrl = "/api/v1/prompts";
3173
- var PromptClient = class extends ApiClient12 {
3465
+ var PromptClient = class extends ApiClient13 {
3174
3466
  constructor(options) {
3175
3467
  super(options);
3176
3468
  }
@@ -3201,34 +3493,42 @@ var PromptClient = class extends ApiClient12 {
3201
3493
  };
3202
3494
 
3203
3495
  // src/RelationshipClient.ts
3204
- import { ApiClient as ApiClient13 } from "@uniformdev/context/api";
3496
+ import { ApiClient as ApiClient14 } from "@uniformdev/context/api";
3205
3497
  var RELATIONSHIPS_URL = "/api/v1/relationships";
3206
- var RelationshipClient = class extends ApiClient13 {
3498
+ var RelationshipClient = class extends ApiClient14 {
3207
3499
  constructor(options) {
3208
3500
  super(options);
3209
- this.get = async (options) => {
3501
+ this.list = async (options) => {
3210
3502
  const { projectId } = this.options;
3211
3503
  const url = this.createUrl(RELATIONSHIPS_URL, { ...options, projectId });
3212
3504
  return this.apiClient(url);
3213
3505
  };
3506
+ /** @deprecated Use {@link list} instead. */
3507
+ this.get = async (options) => {
3508
+ return this.list(options);
3509
+ };
3214
3510
  }
3215
3511
  };
3216
3512
 
3217
3513
  // src/ReleaseClient.ts
3218
- import { ApiClient as ApiClient14 } from "@uniformdev/context/api";
3514
+ import { ApiClient as ApiClient15 } from "@uniformdev/context/api";
3219
3515
  var releasesUrl = "/api/v1/releases";
3220
- var ReleaseClient = class extends ApiClient14 {
3516
+ var ReleaseClient = class extends ApiClient15 {
3221
3517
  constructor(options) {
3222
3518
  super(options);
3223
3519
  }
3224
- /** Fetches all releases for a project */
3225
- async get(options) {
3520
+ /** Fetches a list of releases for a project */
3521
+ async list(options) {
3226
3522
  const { projectId } = this.options;
3227
3523
  const fetchUri = this.createUrl(releasesUrl, { ...options, projectId });
3228
3524
  return await this.apiClient(fetchUri);
3229
3525
  }
3526
+ /** @deprecated Use {@link list} instead. */
3527
+ async get(options) {
3528
+ return this.list(options);
3529
+ }
3230
3530
  /** Updates or creates (based on id) a release */
3231
- async upsert(body) {
3531
+ async save(body) {
3232
3532
  const fetchUri = this.createUrl(releasesUrl);
3233
3533
  await this.apiClient(fetchUri, {
3234
3534
  method: "PUT",
@@ -3236,6 +3536,10 @@ var ReleaseClient = class extends ApiClient14 {
3236
3536
  expectNoContent: true
3237
3537
  });
3238
3538
  }
3539
+ /** @deprecated Use {@link save} instead. */
3540
+ async upsert(body) {
3541
+ return this.save(body);
3542
+ }
3239
3543
  /** Deletes a release */
3240
3544
  async remove(body) {
3241
3545
  const fetchUri = this.createUrl(releasesUrl);
@@ -3257,21 +3561,25 @@ var ReleaseClient = class extends ApiClient14 {
3257
3561
  };
3258
3562
 
3259
3563
  // src/ReleaseContentsClient.ts
3260
- import { ApiClient as ApiClient15 } from "@uniformdev/context/api";
3261
- var releaseContentsUrl2 = "/api/v1/release-contents";
3262
- var ReleaseContentsClient = class extends ApiClient15 {
3564
+ import { ApiClient as ApiClient16 } from "@uniformdev/context/api";
3565
+ var releaseContentsUrl = "/api/v1/release-contents";
3566
+ var ReleaseContentsClient = class extends ApiClient16 {
3263
3567
  constructor(options) {
3264
3568
  super(options);
3265
3569
  }
3266
- /** Fetches all entities added to a release */
3267
- async get(options) {
3570
+ /** Fetches a list of entities added to a release */
3571
+ async list(options) {
3268
3572
  const { projectId } = this.options;
3269
- const fetchUri = this.createUrl(releaseContentsUrl2, { ...options, projectId });
3573
+ const fetchUri = this.createUrl(releaseContentsUrl, { ...options, projectId });
3270
3574
  return await this.apiClient(fetchUri);
3271
3575
  }
3576
+ /** @deprecated Use {@link list} instead. */
3577
+ async get(options) {
3578
+ return this.list(options);
3579
+ }
3272
3580
  /** Removes a release content from a release */
3273
3581
  async remove(body) {
3274
- const fetchUri = this.createUrl(releaseContentsUrl2);
3582
+ const fetchUri = this.createUrl(releaseContentsUrl);
3275
3583
  await this.apiClient(fetchUri, {
3276
3584
  method: "DELETE",
3277
3585
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -3281,9 +3589,9 @@ var ReleaseContentsClient = class extends ApiClient15 {
3281
3589
  };
3282
3590
 
3283
3591
  // src/RouteClient.ts
3284
- import { ApiClient as ApiClient16 } from "@uniformdev/context/api";
3592
+ import { ApiClient as ApiClient17 } from "@uniformdev/context/api";
3285
3593
  var ROUTE_URL = "/api/v1/route";
3286
- var RouteClient = class extends ApiClient16 {
3594
+ var RouteClient = class extends ApiClient17 {
3287
3595
  constructor(options) {
3288
3596
  var _a;
3289
3597
  if (!options.limitPolicy) {
@@ -3292,15 +3600,27 @@ var RouteClient = class extends ApiClient16 {
3292
3600
  super(options);
3293
3601
  this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
3294
3602
  }
3295
- /** Fetches lists of Canvas compositions, optionally by type */
3296
- async getRoute(options) {
3603
+ /**
3604
+ * Resolves a route to a composition, redirect, or not-found result.
3605
+ *
3606
+ * An optional `select` projection applies to the resolved composition when
3607
+ * the route matches one; redirect / notFound responses pass through
3608
+ * untouched.
3609
+ */
3610
+ async get(options) {
3297
3611
  const { projectId } = this.options;
3298
- const fetchUri = this.createUrl(ROUTE_URL, { ...options, projectId }, this.edgeApiHost);
3612
+ const { select, ...rest } = options != null ? options : {};
3613
+ const rewrittenSelect = projectionToQuery(select);
3614
+ const fetchUri = this.createUrl(ROUTE_URL, { ...rest, projectId, ...rewrittenSelect }, this.edgeApiHost);
3299
3615
  return await this.apiClient(
3300
3616
  fetchUri,
3301
3617
  this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
3302
3618
  );
3303
3619
  }
3620
+ /** @deprecated use {@link RouteClient.get} instead (renamed). */
3621
+ async getRoute(options) {
3622
+ return this.get(options);
3623
+ }
3304
3624
  };
3305
3625
 
3306
3626
  // src/types/locales.ts
@@ -3655,26 +3975,30 @@ function handleRichTextNodeBinding(object, options) {
3655
3975
  }
3656
3976
 
3657
3977
  // src/index.ts
3658
- import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
3978
+ import { ApiClientError as ApiClientError5 } from "@uniformdev/context/api";
3659
3979
 
3660
3980
  // src/.version.ts
3661
- var version = "20.68.0";
3981
+ var version = "20.71.0";
3662
3982
 
3663
3983
  // src/WorkflowClient.ts
3664
- import { ApiClient as ApiClient17 } from "@uniformdev/context/api";
3984
+ import { ApiClient as ApiClient18 } from "@uniformdev/context/api";
3665
3985
  var workflowsUrl = "/api/v1/workflows";
3666
- var WorkflowClient = class extends ApiClient17 {
3986
+ var WorkflowClient = class extends ApiClient18 {
3667
3987
  constructor(options) {
3668
3988
  super(options);
3669
3989
  }
3670
- /** Fetches workflows for a project */
3671
- async get(options) {
3990
+ /** Fetches a list of workflows for a project */
3991
+ async list(options) {
3672
3992
  const { projectId } = this.options;
3673
3993
  const fetchUri = this.createUrl(workflowsUrl, { ...options, projectId });
3674
3994
  return await this.apiClient(fetchUri);
3675
3995
  }
3996
+ /** @deprecated Use {@link list} instead. */
3997
+ async get(options) {
3998
+ return this.list(options);
3999
+ }
3676
4000
  /** Updates or creates a workflow definition */
3677
- async upsert(body) {
4001
+ async save(body) {
3678
4002
  const fetchUri = this.createUrl(workflowsUrl);
3679
4003
  await this.apiClient(fetchUri, {
3680
4004
  method: "PUT",
@@ -3682,6 +4006,10 @@ var WorkflowClient = class extends ApiClient17 {
3682
4006
  expectNoContent: true
3683
4007
  });
3684
4008
  }
4009
+ /** @deprecated Use {@link save} instead. */
4010
+ async upsert(body) {
4011
+ return this.save(body);
4012
+ }
3685
4013
  /** Deletes a workflow definition */
3686
4014
  async remove(body) {
3687
4015
  const fetchUri = this.createUrl(workflowsUrl);
@@ -3694,7 +4022,7 @@ var WorkflowClient = class extends ApiClient17 {
3694
4022
  };
3695
4023
 
3696
4024
  // src/index.ts
3697
- var CanvasClientError = ApiClientError2;
4025
+ var CanvasClientError = ApiClientError5;
3698
4026
  export {
3699
4027
  ASSETS_SOURCE_CUSTOM_URL,
3700
4028
  ASSETS_SOURCE_UNIFORM,
@@ -3705,7 +4033,7 @@ export {
3705
4033
  ATTRIBUTE_PARAMETER_TYPE,
3706
4034
  ATTRIBUTE_PARAMETER_VALUE,
3707
4035
  ATTRIBUTE_PLACEHOLDER,
3708
- ApiClientError2 as ApiClientError,
4036
+ ApiClientError5 as ApiClientError,
3709
4037
  BatchEntry,
3710
4038
  BlockFormatError,
3711
4039
  CANVAS_BLOCK_PARAM_TYPE,
@@ -3747,7 +4075,11 @@ export {
3747
4075
  CanvasClientError,
3748
4076
  CategoryClient,
3749
4077
  ChildEnhancerBuilder,
4078
+ ComponentDefinitionClient,
4079
+ CompositionDeliveryClient,
4080
+ CompositionManagementClient,
3750
4081
  ContentClient,
4082
+ ContentTypeClient,
3751
4083
  DataSourceClient,
3752
4084
  DataTypeClient,
3753
4085
  EDGE_CACHE_DISABLED,
@@ -3757,6 +4089,8 @@ export {
3757
4089
  EMPTY_COMPOSITION,
3758
4090
  EnhancerBuilder,
3759
4091
  EntityReleasesClient,
4092
+ EntryDeliveryClient,
4093
+ EntryManagementClient,
3760
4094
  IN_CONTEXT_EDITOR_COMPONENT_END_ROLE,
3761
4095
  IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
3762
4096
  IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM,
@@ -3779,6 +4113,7 @@ export {
3779
4113
  ReleaseContentsClient,
3780
4114
  RouteClient,
3781
4115
  SECRET_QUERY_STRING_PARAM,
4116
+ SELECT_QUERY_PREFIX,
3782
4117
  UncachedCanvasClient,
3783
4118
  UncachedCategoryClient,
3784
4119
  UncachedContentClient,
@@ -3860,10 +4195,13 @@ export {
3860
4195
  localize,
3861
4196
  mapSlotToPersonalizedVariations,
3862
4197
  mapSlotToTestVariations,
4198
+ matchesProjectionPattern,
3863
4199
  mergeAssetConfigWithDefaults,
3864
4200
  nullLimitPolicy,
3865
4201
  parseComponentPlaceholderId,
3866
4202
  parseVariableExpression,
4203
+ projectionToQuery,
4204
+ queryToProjection,
3867
4205
  version,
3868
4206
  walkNodeTree,
3869
4207
  walkPropertyValues