@uniformdev/canvas 20.63.1-alpha.12 → 20.63.1-alpha.17
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 +191 -6
- package/dist/index.d.ts +191 -6
- package/dist/index.esm.js +799 -26
- package/dist/index.js +783 -27
- package/dist/index.mjs +799 -26
- package/package.json +9 -9
package/dist/index.mjs
CHANGED
|
@@ -1,25 +1,560 @@
|
|
|
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;
|
|
1
7
|
var __typeError = (msg) => {
|
|
2
8
|
throw TypeError(msg);
|
|
3
9
|
};
|
|
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
|
+
));
|
|
4
29
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
5
30
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
6
31
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
7
32
|
|
|
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
|
+
|
|
8
382
|
// src/CanvasClient.ts
|
|
9
383
|
import { ApiClient, rewriteFiltersForApi } from "@uniformdev/context/api";
|
|
10
384
|
|
|
11
385
|
// src/enhancement/createLimitPolicy.ts
|
|
386
|
+
var import_p_limit = __toESM(require_p_limit());
|
|
12
387
|
import { ApiClientError } from "@uniformdev/context/api";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
16
551
|
function createLimitPolicy({
|
|
17
552
|
throttle = { interval: 1e3, limit: 10 },
|
|
18
|
-
retry = { retries: 1, factor: 1.66 },
|
|
553
|
+
retry: retry2 = { retries: 1, factor: 1.66 },
|
|
19
554
|
limit = 10
|
|
20
555
|
}) {
|
|
21
556
|
const throttler = throttle ? pThrottle(throttle) : null;
|
|
22
|
-
const limiter = limit ?
|
|
557
|
+
const limiter = limit ? (0, import_p_limit.default)(limit) : null;
|
|
23
558
|
return function limitPolicy(func) {
|
|
24
559
|
let currentFunc = async () => await func();
|
|
25
560
|
if (throttler) {
|
|
@@ -30,13 +565,13 @@ function createLimitPolicy({
|
|
|
30
565
|
const limitFunc = currentFunc;
|
|
31
566
|
currentFunc = () => limiter(limitFunc);
|
|
32
567
|
}
|
|
33
|
-
if (
|
|
568
|
+
if (retry2) {
|
|
34
569
|
const retryFunc = currentFunc;
|
|
35
570
|
currentFunc = () => pRetry(retryFunc, {
|
|
36
|
-
...
|
|
571
|
+
...retry2,
|
|
37
572
|
onFailedAttempt: async (error) => {
|
|
38
|
-
if (
|
|
39
|
-
await
|
|
573
|
+
if (retry2.onFailedAttempt) {
|
|
574
|
+
await retry2.onFailedAttempt(error);
|
|
40
575
|
}
|
|
41
576
|
if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
|
|
42
577
|
throw error;
|
|
@@ -49,6 +584,51 @@ function createLimitPolicy({
|
|
|
49
584
|
}
|
|
50
585
|
var nullLimitPolicy = async (func) => await func();
|
|
51
586
|
|
|
587
|
+
// src/projection/types.ts
|
|
588
|
+
var SELECT_QUERY_PREFIX = "select.";
|
|
589
|
+
|
|
590
|
+
// src/projection/projectionToQuery.ts
|
|
591
|
+
function appendCsv(out, key, values) {
|
|
592
|
+
if (values === void 0) {
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
out[key] = values.join(",");
|
|
596
|
+
}
|
|
597
|
+
function projectionToQuery(spec) {
|
|
598
|
+
const out = {};
|
|
599
|
+
if (!spec) {
|
|
600
|
+
return out;
|
|
601
|
+
}
|
|
602
|
+
const { fields, fieldTypes, slots } = spec;
|
|
603
|
+
const p = SELECT_QUERY_PREFIX;
|
|
604
|
+
if (fields) {
|
|
605
|
+
appendCsv(out, `${p}fields[only]`, fields.only);
|
|
606
|
+
appendCsv(out, `${p}fields[except]`, fields.except);
|
|
607
|
+
appendCsv(out, `${p}fields[locales]`, fields.locales);
|
|
608
|
+
}
|
|
609
|
+
if (fieldTypes) {
|
|
610
|
+
appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
|
|
611
|
+
appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
|
|
612
|
+
}
|
|
613
|
+
if (slots) {
|
|
614
|
+
appendCsv(out, `${p}slots[only]`, slots.only);
|
|
615
|
+
appendCsv(out, `${p}slots[except]`, slots.except);
|
|
616
|
+
if (typeof slots.depth === "number") {
|
|
617
|
+
out[`${p}slots[depth]`] = String(slots.depth);
|
|
618
|
+
}
|
|
619
|
+
if (slots.named) {
|
|
620
|
+
const slotNames = Object.keys(slots.named).sort();
|
|
621
|
+
for (const slotName of slotNames) {
|
|
622
|
+
const named = slots.named[slotName];
|
|
623
|
+
if (named && typeof named.depth === "number") {
|
|
624
|
+
out[`${p}slots.${slotName}[depth]`] = String(named.depth);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
return out;
|
|
630
|
+
}
|
|
631
|
+
|
|
52
632
|
// src/CanvasClient.ts
|
|
53
633
|
var CANVAS_URL = "/api/v1/canvas";
|
|
54
634
|
var CanvasClient = class extends ApiClient {
|
|
@@ -64,17 +644,24 @@ var CanvasClient = class extends ApiClient {
|
|
|
64
644
|
/** Fetches lists of Canvas compositions, optionally by type */
|
|
65
645
|
async getCompositionList(params = {}) {
|
|
66
646
|
const { projectId } = this.options;
|
|
67
|
-
const { resolveData, filters, ...originParams } = params;
|
|
647
|
+
const { resolveData, filters, select, ...originParams } = params;
|
|
68
648
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
649
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
69
650
|
if (!resolveData) {
|
|
70
|
-
const fetchUri = this.createUrl(CANVAS_URL, {
|
|
651
|
+
const fetchUri = this.createUrl(CANVAS_URL, {
|
|
652
|
+
...originParams,
|
|
653
|
+
projectId,
|
|
654
|
+
...rewrittenFilters,
|
|
655
|
+
...rewrittenSelect
|
|
656
|
+
});
|
|
71
657
|
return this.apiClient(fetchUri);
|
|
72
658
|
}
|
|
73
659
|
const edgeParams = {
|
|
74
660
|
...originParams,
|
|
75
661
|
projectId,
|
|
76
662
|
diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
|
|
77
|
-
...rewrittenFilters
|
|
663
|
+
...rewrittenFilters,
|
|
664
|
+
...rewrittenSelect
|
|
78
665
|
};
|
|
79
666
|
const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
|
|
80
667
|
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
@@ -234,15 +821,21 @@ var _ContentClient = class _ContentClient extends ApiClient3 {
|
|
|
234
821
|
}
|
|
235
822
|
getEntries(options) {
|
|
236
823
|
const { projectId } = this.options;
|
|
237
|
-
const { skipDataResolution, filters, ...params } = options;
|
|
824
|
+
const { skipDataResolution, filters, select, ...params } = options;
|
|
238
825
|
const rewrittenFilters = rewriteFiltersForApi2(filters);
|
|
826
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
239
827
|
if (skipDataResolution) {
|
|
240
|
-
const url = this.createUrl(__privateGet(_ContentClient, _entriesUrl), {
|
|
828
|
+
const url = this.createUrl(__privateGet(_ContentClient, _entriesUrl), {
|
|
829
|
+
...params,
|
|
830
|
+
...rewrittenFilters,
|
|
831
|
+
...rewrittenSelect,
|
|
832
|
+
projectId
|
|
833
|
+
});
|
|
241
834
|
return this.apiClient(url);
|
|
242
835
|
}
|
|
243
836
|
const edgeUrl = this.createUrl(
|
|
244
837
|
__privateGet(_ContentClient, _entriesUrl),
|
|
245
|
-
{ ...this.getEdgeOptions(params), ...rewrittenFilters },
|
|
838
|
+
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
246
839
|
this.edgeApiHost
|
|
247
840
|
);
|
|
248
841
|
return this.apiClient(
|
|
@@ -571,6 +1164,7 @@ var EDGE_CACHE_DISABLED = -1;
|
|
|
571
1164
|
var ASSET_PARAMETER_TYPE = "asset";
|
|
572
1165
|
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
|
573
1166
|
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
|
1167
|
+
var REFERENCE_DATA_TYPE_ID = "uniformContentInternalReference";
|
|
574
1168
|
|
|
575
1169
|
// src/utils/guards.ts
|
|
576
1170
|
function isRootEntryReference(root) {
|
|
@@ -1870,8 +2464,7 @@ function extractLocales({ component }) {
|
|
|
1870
2464
|
return variations;
|
|
1871
2465
|
}
|
|
1872
2466
|
function localize(options) {
|
|
1873
|
-
const nodes = options
|
|
1874
|
-
const locale = options.locale;
|
|
2467
|
+
const { nodes, locale, keepLocalesFor } = options;
|
|
1875
2468
|
if (!locale) {
|
|
1876
2469
|
return;
|
|
1877
2470
|
}
|
|
@@ -1879,7 +2472,7 @@ function localize(options) {
|
|
|
1879
2472
|
walkNodeTree(nodes, (context) => {
|
|
1880
2473
|
const { type, node, actions } = context;
|
|
1881
2474
|
if (type !== "component") {
|
|
1882
|
-
localizeProperties(node, locale, vizControlLocaleRule);
|
|
2475
|
+
localizeProperties(node, locale, vizControlLocaleRule, keepLocalesFor);
|
|
1883
2476
|
return;
|
|
1884
2477
|
}
|
|
1885
2478
|
const result = evaluateWalkTreeNodeVisibility({
|
|
@@ -1900,7 +2493,7 @@ function localize(options) {
|
|
|
1900
2493
|
if (replaceComponent == null ? void 0 : replaceComponent.length) {
|
|
1901
2494
|
replaceComponent.forEach((component) => {
|
|
1902
2495
|
removeLocaleProperty(component);
|
|
1903
|
-
localizeProperties(component, locale, vizControlLocaleRule);
|
|
2496
|
+
localizeProperties(component, locale, vizControlLocaleRule, keepLocalesFor);
|
|
1904
2497
|
});
|
|
1905
2498
|
const [first, ...rest] = replaceComponent;
|
|
1906
2499
|
actions.replace(first);
|
|
@@ -1911,7 +2504,7 @@ function localize(options) {
|
|
|
1911
2504
|
actions.remove();
|
|
1912
2505
|
}
|
|
1913
2506
|
} else {
|
|
1914
|
-
localizeProperties(node, locale, vizControlLocaleRule);
|
|
2507
|
+
localizeProperties(node, locale, vizControlLocaleRule, keepLocalesFor);
|
|
1915
2508
|
}
|
|
1916
2509
|
});
|
|
1917
2510
|
}
|
|
@@ -1930,7 +2523,7 @@ function removeLocaleProperty(component) {
|
|
|
1930
2523
|
}
|
|
1931
2524
|
}
|
|
1932
2525
|
}
|
|
1933
|
-
function localizeProperties(node, locale, rules) {
|
|
2526
|
+
function localizeProperties(node, locale, rules, keepLocalesFor) {
|
|
1934
2527
|
const properties = getPropertiesValue(node);
|
|
1935
2528
|
if (!properties) {
|
|
1936
2529
|
return void 0;
|
|
@@ -1949,10 +2542,16 @@ function localizeProperties(node, locale, rules) {
|
|
|
1949
2542
|
if (currentLocaleConditionalValues !== void 0) {
|
|
1950
2543
|
propertyValue.conditions = currentLocaleConditionalValues;
|
|
1951
2544
|
}
|
|
1952
|
-
|
|
1953
|
-
|
|
2545
|
+
const preserveLocales = (keepLocalesFor == null ? void 0 : keepLocalesFor(propertyId)) === true;
|
|
2546
|
+
if (!preserveLocales) {
|
|
2547
|
+
delete propertyValue.locales;
|
|
2548
|
+
delete propertyValue.localesConditions;
|
|
2549
|
+
}
|
|
1954
2550
|
if (propertyValue.value === void 0 && propertyValue.conditions === void 0) {
|
|
1955
|
-
|
|
2551
|
+
const hasLocales = preserveLocales && (propertyValue.locales || propertyValue.localesConditions);
|
|
2552
|
+
if (!hasLocales) {
|
|
2553
|
+
delete properties[propertyId];
|
|
2554
|
+
}
|
|
1956
2555
|
}
|
|
1957
2556
|
});
|
|
1958
2557
|
evaluateWalkTreePropertyCriteria({
|
|
@@ -2631,6 +3230,173 @@ __privateAdd(_ProjectClient, _url2, "/api/v1/project");
|
|
|
2631
3230
|
__privateAdd(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
2632
3231
|
var ProjectClient = _ProjectClient;
|
|
2633
3232
|
|
|
3233
|
+
// src/projection/matchesProjectionPattern.ts
|
|
3234
|
+
var DISALLOWED_PATTERN_CHARS = /[,&=?#[\]\s]/;
|
|
3235
|
+
var REGEX_METACHAR = /[\\^$.|?*+()[\]{}]/g;
|
|
3236
|
+
function isValidProjectionPattern(pattern) {
|
|
3237
|
+
if (typeof pattern !== "string" || pattern.length === 0) {
|
|
3238
|
+
return false;
|
|
3239
|
+
}
|
|
3240
|
+
if (DISALLOWED_PATTERN_CHARS.test(pattern)) {
|
|
3241
|
+
return false;
|
|
3242
|
+
}
|
|
3243
|
+
return true;
|
|
3244
|
+
}
|
|
3245
|
+
function compilePattern(pattern) {
|
|
3246
|
+
let regexSource = "^";
|
|
3247
|
+
for (const ch of pattern) {
|
|
3248
|
+
if (ch === "*") {
|
|
3249
|
+
regexSource += ".*";
|
|
3250
|
+
} else {
|
|
3251
|
+
regexSource += ch.replace(REGEX_METACHAR, "\\$&");
|
|
3252
|
+
}
|
|
3253
|
+
}
|
|
3254
|
+
regexSource += "$";
|
|
3255
|
+
return new RegExp(regexSource);
|
|
3256
|
+
}
|
|
3257
|
+
var PATTERN_CACHE_MAX = 1024;
|
|
3258
|
+
var patternRegexCache = /* @__PURE__ */ new Map();
|
|
3259
|
+
function matchesProjectionPattern(pattern, value) {
|
|
3260
|
+
let re = patternRegexCache.get(pattern);
|
|
3261
|
+
if (re === void 0) {
|
|
3262
|
+
if (!isValidProjectionPattern(pattern)) {
|
|
3263
|
+
throw new Error(`Invalid projection pattern: ${JSON.stringify(pattern)}`);
|
|
3264
|
+
}
|
|
3265
|
+
re = compilePattern(pattern);
|
|
3266
|
+
if (patternRegexCache.size >= PATTERN_CACHE_MAX) {
|
|
3267
|
+
const oldest = patternRegexCache.keys().next().value;
|
|
3268
|
+
if (oldest !== void 0) patternRegexCache.delete(oldest);
|
|
3269
|
+
}
|
|
3270
|
+
patternRegexCache.set(pattern, re);
|
|
3271
|
+
}
|
|
3272
|
+
return re.test(value);
|
|
3273
|
+
}
|
|
3274
|
+
|
|
3275
|
+
// src/projection/queryToProjection.ts
|
|
3276
|
+
var TOP_LEVEL_OPERATOR_KEY = /^(fields|fieldTypes|slots)\[([A-Za-z]+)\]$/;
|
|
3277
|
+
var SLOTS_NAMED_KEY = /^slots\.([A-Za-z0-9_-]+)\[([A-Za-z]+)\]$/;
|
|
3278
|
+
function toStringValue2(value) {
|
|
3279
|
+
if (Array.isArray(value)) {
|
|
3280
|
+
return value.join(",");
|
|
3281
|
+
}
|
|
3282
|
+
return value;
|
|
3283
|
+
}
|
|
3284
|
+
function parseCsv(value) {
|
|
3285
|
+
const str = toStringValue2(value);
|
|
3286
|
+
if (!str) {
|
|
3287
|
+
return [];
|
|
3288
|
+
}
|
|
3289
|
+
return str.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
3290
|
+
}
|
|
3291
|
+
function parseDepth(value, key) {
|
|
3292
|
+
const str = toStringValue2(value);
|
|
3293
|
+
if (str === void 0 || str === "") {
|
|
3294
|
+
throw new Error(`Invalid select projection: '${key}' requires a non-negative integer value`);
|
|
3295
|
+
}
|
|
3296
|
+
if (!/^\d+$/.test(str)) {
|
|
3297
|
+
throw new Error(
|
|
3298
|
+
`Invalid select projection: '${key}' must be a non-negative integer (got ${JSON.stringify(str)})`
|
|
3299
|
+
);
|
|
3300
|
+
}
|
|
3301
|
+
return Number(str);
|
|
3302
|
+
}
|
|
3303
|
+
function extractSelectKeys(source) {
|
|
3304
|
+
if (source instanceof URLSearchParams) {
|
|
3305
|
+
let out2;
|
|
3306
|
+
for (const [key, value] of source.entries()) {
|
|
3307
|
+
if (!key.startsWith(SELECT_QUERY_PREFIX)) continue;
|
|
3308
|
+
out2 != null ? out2 : out2 = {};
|
|
3309
|
+
out2[key] = out2[key] === void 0 ? value : `${out2[key]},${value}`;
|
|
3310
|
+
}
|
|
3311
|
+
return out2;
|
|
3312
|
+
}
|
|
3313
|
+
let out;
|
|
3314
|
+
for (const key in source) {
|
|
3315
|
+
if (!key.startsWith(SELECT_QUERY_PREFIX)) continue;
|
|
3316
|
+
out != null ? out : out = {};
|
|
3317
|
+
out[key] = source[key];
|
|
3318
|
+
}
|
|
3319
|
+
return out;
|
|
3320
|
+
}
|
|
3321
|
+
function queryToProjection(source) {
|
|
3322
|
+
var _a, _b, _c, _d, _e;
|
|
3323
|
+
if (!source) {
|
|
3324
|
+
return void 0;
|
|
3325
|
+
}
|
|
3326
|
+
const query = extractSelectKeys(source);
|
|
3327
|
+
if (!query) {
|
|
3328
|
+
return void 0;
|
|
3329
|
+
}
|
|
3330
|
+
const spec = {};
|
|
3331
|
+
for (const [rawKey, value] of Object.entries(query)) {
|
|
3332
|
+
const key = rawKey.slice(SELECT_QUERY_PREFIX.length);
|
|
3333
|
+
const namedMatch = SLOTS_NAMED_KEY.exec(key);
|
|
3334
|
+
if (namedMatch) {
|
|
3335
|
+
const [, slotName, operator2] = namedMatch;
|
|
3336
|
+
if (operator2 !== "depth") {
|
|
3337
|
+
throw new Error(
|
|
3338
|
+
`Invalid select projection: unsupported operator '${operator2}' for slots.${slotName}`
|
|
3339
|
+
);
|
|
3340
|
+
}
|
|
3341
|
+
const slots = (_a = spec.slots) != null ? _a : spec.slots = {};
|
|
3342
|
+
const named = (_b = slots.named) != null ? _b : slots.named = {};
|
|
3343
|
+
named[slotName] = { ...named[slotName], depth: parseDepth(value, rawKey) };
|
|
3344
|
+
continue;
|
|
3345
|
+
}
|
|
3346
|
+
const topMatch = TOP_LEVEL_OPERATOR_KEY.exec(key);
|
|
3347
|
+
if (!topMatch) {
|
|
3348
|
+
throw new Error(`Invalid select projection key: ${JSON.stringify(rawKey)}`);
|
|
3349
|
+
}
|
|
3350
|
+
const [, bucket, operator] = topMatch;
|
|
3351
|
+
if (bucket === "fields") {
|
|
3352
|
+
const fields = (_c = spec.fields) != null ? _c : spec.fields = {};
|
|
3353
|
+
switch (operator) {
|
|
3354
|
+
case "only":
|
|
3355
|
+
fields.only = parseCsv(value);
|
|
3356
|
+
break;
|
|
3357
|
+
case "except":
|
|
3358
|
+
fields.except = parseCsv(value);
|
|
3359
|
+
break;
|
|
3360
|
+
case "locales":
|
|
3361
|
+
fields.locales = parseCsv(value);
|
|
3362
|
+
break;
|
|
3363
|
+
default:
|
|
3364
|
+
throw new Error(`Invalid select projection: unsupported operator 'fields[${operator}]'`);
|
|
3365
|
+
}
|
|
3366
|
+
} else if (bucket === "fieldTypes") {
|
|
3367
|
+
const fieldTypes = (_d = spec.fieldTypes) != null ? _d : spec.fieldTypes = {};
|
|
3368
|
+
switch (operator) {
|
|
3369
|
+
case "only":
|
|
3370
|
+
fieldTypes.only = parseCsv(value);
|
|
3371
|
+
break;
|
|
3372
|
+
case "except":
|
|
3373
|
+
fieldTypes.except = parseCsv(value);
|
|
3374
|
+
break;
|
|
3375
|
+
default:
|
|
3376
|
+
throw new Error(`Invalid select projection: unsupported operator 'fieldTypes[${operator}]'`);
|
|
3377
|
+
}
|
|
3378
|
+
} else if (bucket === "slots") {
|
|
3379
|
+
const slots = (_e = spec.slots) != null ? _e : spec.slots = {};
|
|
3380
|
+
switch (operator) {
|
|
3381
|
+
case "only":
|
|
3382
|
+
slots.only = parseCsv(value);
|
|
3383
|
+
break;
|
|
3384
|
+
case "except":
|
|
3385
|
+
slots.except = parseCsv(value);
|
|
3386
|
+
break;
|
|
3387
|
+
case "depth":
|
|
3388
|
+
slots.depth = parseDepth(value, rawKey);
|
|
3389
|
+
break;
|
|
3390
|
+
default:
|
|
3391
|
+
throw new Error(`Invalid select projection: unsupported operator 'slots[${operator}]'`);
|
|
3392
|
+
}
|
|
3393
|
+
} else {
|
|
3394
|
+
throw new Error(`Invalid select projection key: ${JSON.stringify(rawKey)}`);
|
|
3395
|
+
}
|
|
3396
|
+
}
|
|
3397
|
+
return spec;
|
|
3398
|
+
}
|
|
3399
|
+
|
|
2634
3400
|
// src/PromptClient.ts
|
|
2635
3401
|
import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
|
|
2636
3402
|
var PromptsUrl = "/api/v1/prompts";
|
|
@@ -2759,7 +3525,9 @@ var RouteClient = class extends ApiClient16 {
|
|
|
2759
3525
|
/** Fetches lists of Canvas compositions, optionally by type */
|
|
2760
3526
|
async getRoute(options) {
|
|
2761
3527
|
const { projectId } = this.options;
|
|
2762
|
-
const
|
|
3528
|
+
const { select, ...rest } = options != null ? options : {};
|
|
3529
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
3530
|
+
const fetchUri = this.createUrl(ROUTE_URL, { ...rest, projectId, ...rewrittenSelect }, this.edgeApiHost);
|
|
2763
3531
|
return await this.apiClient(
|
|
2764
3532
|
fetchUri,
|
|
2765
3533
|
this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
|
|
@@ -3122,7 +3890,7 @@ function handleRichTextNodeBinding(object, options) {
|
|
|
3122
3890
|
import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
|
|
3123
3891
|
|
|
3124
3892
|
// src/.version.ts
|
|
3125
|
-
var version = "20.
|
|
3893
|
+
var version = "20.66.0";
|
|
3126
3894
|
|
|
3127
3895
|
// src/WorkflowClient.ts
|
|
3128
3896
|
import { ApiClient as ApiClient17 } from "@uniformdev/context/api";
|
|
@@ -3237,11 +4005,13 @@ export {
|
|
|
3237
4005
|
PreviewClient,
|
|
3238
4006
|
ProjectClient,
|
|
3239
4007
|
PromptClient,
|
|
4008
|
+
REFERENCE_DATA_TYPE_ID,
|
|
3240
4009
|
RelationshipClient,
|
|
3241
4010
|
ReleaseClient,
|
|
3242
4011
|
ReleaseContentsClient,
|
|
3243
4012
|
RouteClient,
|
|
3244
4013
|
SECRET_QUERY_STRING_PARAM,
|
|
4014
|
+
SELECT_QUERY_PREFIX,
|
|
3245
4015
|
UncachedCanvasClient,
|
|
3246
4016
|
UncachedCategoryClient,
|
|
3247
4017
|
UncachedContentClient,
|
|
@@ -3323,10 +4093,13 @@ export {
|
|
|
3323
4093
|
localize,
|
|
3324
4094
|
mapSlotToPersonalizedVariations,
|
|
3325
4095
|
mapSlotToTestVariations,
|
|
4096
|
+
matchesProjectionPattern,
|
|
3326
4097
|
mergeAssetConfigWithDefaults,
|
|
3327
4098
|
nullLimitPolicy,
|
|
3328
4099
|
parseComponentPlaceholderId,
|
|
3329
4100
|
parseVariableExpression,
|
|
4101
|
+
projectionToQuery,
|
|
4102
|
+
queryToProjection,
|
|
3330
4103
|
version,
|
|
3331
4104
|
walkNodeTree,
|
|
3332
4105
|
walkPropertyValues
|