@uniformdev/canvas 20.47.2-alpha.4 → 20.48.1-alpha.11
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 +1511 -1043
- package/dist/index.d.ts +1511 -1043
- package/dist/index.esm.js +146 -51
- package/dist/index.js +149 -52
- package/dist/index.mjs +146 -51
- package/package.json +5 -5
package/dist/index.esm.js
CHANGED
|
@@ -380,7 +380,7 @@ var require_retry2 = __commonJS({
|
|
|
380
380
|
});
|
|
381
381
|
|
|
382
382
|
// src/CanvasClient.ts
|
|
383
|
-
import { ApiClient } from "@uniformdev/context/api";
|
|
383
|
+
import { ApiClient, rewriteFiltersForApi } from "@uniformdev/context/api";
|
|
384
384
|
|
|
385
385
|
// src/enhancement/createLimitPolicy.ts
|
|
386
386
|
var import_p_limit = __toESM(require_p_limit());
|
|
@@ -584,22 +584,6 @@ function createLimitPolicy({
|
|
|
584
584
|
}
|
|
585
585
|
var nullLimitPolicy = async (func) => await func();
|
|
586
586
|
|
|
587
|
-
// src/utils/rewriteFilters.ts
|
|
588
|
-
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
589
|
-
function rewriteFilters(filters) {
|
|
590
|
-
return Object.entries(filters != null ? filters : {}).reduce(
|
|
591
|
-
(acc, [key, value]) => {
|
|
592
|
-
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
593
|
-
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
594
|
-
return {
|
|
595
|
-
...acc,
|
|
596
|
-
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
597
|
-
};
|
|
598
|
-
},
|
|
599
|
-
{}
|
|
600
|
-
);
|
|
601
|
-
}
|
|
602
|
-
|
|
603
587
|
// src/CanvasClient.ts
|
|
604
588
|
var CANVAS_URL = "/api/v1/canvas";
|
|
605
589
|
var CanvasClient = class extends ApiClient {
|
|
@@ -616,7 +600,7 @@ var CanvasClient = class extends ApiClient {
|
|
|
616
600
|
async getCompositionList(params = {}) {
|
|
617
601
|
const { projectId } = this.options;
|
|
618
602
|
const { resolveData, filters, ...originParams } = params;
|
|
619
|
-
const rewrittenFilters =
|
|
603
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
620
604
|
if (!resolveData) {
|
|
621
605
|
const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
|
|
622
606
|
return this.apiClient(fetchUri);
|
|
@@ -770,7 +754,7 @@ var UncachedCategoryClient = class extends CategoryClient {
|
|
|
770
754
|
};
|
|
771
755
|
|
|
772
756
|
// src/ContentClient.ts
|
|
773
|
-
import { ApiClient as ApiClient3 } from "@uniformdev/context/api";
|
|
757
|
+
import { ApiClient as ApiClient3, rewriteFiltersForApi as rewriteFiltersForApi2 } from "@uniformdev/context/api";
|
|
774
758
|
var _contentTypesUrl, _entriesUrl;
|
|
775
759
|
var _ContentClient = class _ContentClient extends ApiClient3 {
|
|
776
760
|
constructor(options) {
|
|
@@ -786,7 +770,7 @@ var _ContentClient = class _ContentClient extends ApiClient3 {
|
|
|
786
770
|
getEntries(options) {
|
|
787
771
|
const { projectId } = this.options;
|
|
788
772
|
const { skipDataResolution, filters, ...params } = options;
|
|
789
|
-
const rewrittenFilters =
|
|
773
|
+
const rewrittenFilters = rewriteFiltersForApi2(filters);
|
|
790
774
|
if (skipDataResolution) {
|
|
791
775
|
const url = this.createUrl(__privateGet(_ContentClient, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
|
|
792
776
|
return this.apiClient(url);
|
|
@@ -1220,13 +1204,19 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1220
1204
|
bufferEndIndex = index + 1;
|
|
1221
1205
|
continue;
|
|
1222
1206
|
}
|
|
1223
|
-
state
|
|
1224
|
-
|
|
1207
|
+
if (state === "variable") {
|
|
1208
|
+
const textStart = bufferStartIndex - variablePrefix.length;
|
|
1209
|
+
if (handleToken(serialized.substring(textStart, bufferEndIndex), "text") === false) {
|
|
1210
|
+
return tokenCount;
|
|
1211
|
+
}
|
|
1212
|
+
bufferStartIndex = bufferEndIndex;
|
|
1213
|
+
} else if (bufferEndIndex > bufferStartIndex) {
|
|
1225
1214
|
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
|
1226
1215
|
return tokenCount;
|
|
1227
1216
|
}
|
|
1228
1217
|
bufferStartIndex = bufferEndIndex;
|
|
1229
1218
|
}
|
|
1219
|
+
state = "variable";
|
|
1230
1220
|
index += variablePrefix.length - 1;
|
|
1231
1221
|
bufferStartIndex += variablePrefix.length;
|
|
1232
1222
|
continue;
|
|
@@ -1248,11 +1238,11 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1248
1238
|
}
|
|
1249
1239
|
bufferEndIndex++;
|
|
1250
1240
|
}
|
|
1251
|
-
if (
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1241
|
+
if (state === "variable") {
|
|
1242
|
+
state = "text";
|
|
1243
|
+
bufferStartIndex -= variablePrefix.length;
|
|
1244
|
+
}
|
|
1245
|
+
if (bufferStartIndex < serialized.length) {
|
|
1256
1246
|
handleToken(serialized.substring(bufferStartIndex), state);
|
|
1257
1247
|
}
|
|
1258
1248
|
return tokenCount;
|
|
@@ -2235,11 +2225,34 @@ var stringOperatorEvaluators = {
|
|
|
2235
2225
|
endswith: endsWithEvaluator,
|
|
2236
2226
|
empty: emptyEvaluator
|
|
2237
2227
|
};
|
|
2228
|
+
var numericOperatorEvaluators = {
|
|
2229
|
+
gt: (left, right) => left > right,
|
|
2230
|
+
lt: (left, right) => left < right
|
|
2231
|
+
};
|
|
2232
|
+
function evaluateNumericOperator(criteria, matchValue) {
|
|
2233
|
+
const { op, value } = criteria;
|
|
2234
|
+
const evaluator = numericOperatorEvaluators[op];
|
|
2235
|
+
if (!evaluator) {
|
|
2236
|
+
return null;
|
|
2237
|
+
}
|
|
2238
|
+
if (typeof matchValue === "string" && matchValue.trim() === "" || typeof value === "string" && value.trim() === "") {
|
|
2239
|
+
return false;
|
|
2240
|
+
}
|
|
2241
|
+
const leftNum = Number(matchValue);
|
|
2242
|
+
const rightNum = Number(value);
|
|
2243
|
+
if (isNaN(leftNum) || isNaN(rightNum)) {
|
|
2244
|
+
return false;
|
|
2245
|
+
}
|
|
2246
|
+
return evaluator(leftNum, rightNum);
|
|
2247
|
+
}
|
|
2238
2248
|
function evaluateStringMatch(criteria, matchValue, allow) {
|
|
2239
2249
|
const { op, value } = criteria;
|
|
2240
2250
|
if (allow && !allow.has(op)) {
|
|
2241
2251
|
return null;
|
|
2242
2252
|
}
|
|
2253
|
+
if (op in numericOperatorEvaluators) {
|
|
2254
|
+
return evaluateNumericOperator(criteria, matchValue);
|
|
2255
|
+
}
|
|
2243
2256
|
let opMatch = op;
|
|
2244
2257
|
const negation = op.startsWith("!");
|
|
2245
2258
|
if (negation) {
|
|
@@ -2288,17 +2301,49 @@ var dynamicTokenVisibilityOperators = /* @__PURE__ */ new Set([
|
|
|
2288
2301
|
"endswith",
|
|
2289
2302
|
"!endswith",
|
|
2290
2303
|
"empty",
|
|
2291
|
-
"!empty"
|
|
2304
|
+
"!empty",
|
|
2305
|
+
"gt",
|
|
2306
|
+
"lt"
|
|
2292
2307
|
]);
|
|
2293
2308
|
var CANVAS_VIZ_DYNAMIC_TOKEN_RULE = "$dt";
|
|
2309
|
+
function toStringValue(value) {
|
|
2310
|
+
if (typeof value === "string") {
|
|
2311
|
+
return value;
|
|
2312
|
+
}
|
|
2313
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
2314
|
+
return String(value);
|
|
2315
|
+
}
|
|
2316
|
+
return "";
|
|
2317
|
+
}
|
|
2318
|
+
function toStringCriteriaValue(value) {
|
|
2319
|
+
if (Array.isArray(value)) {
|
|
2320
|
+
return value.map((v) => toStringValue(v));
|
|
2321
|
+
}
|
|
2322
|
+
return toStringValue(value);
|
|
2323
|
+
}
|
|
2324
|
+
function isUnbound(value) {
|
|
2325
|
+
if (value === void 0 || value === null) {
|
|
2326
|
+
return true;
|
|
2327
|
+
}
|
|
2328
|
+
if (typeof value === "string") {
|
|
2329
|
+
return hasReferencedVariables(value) > 0;
|
|
2330
|
+
}
|
|
2331
|
+
return false;
|
|
2332
|
+
}
|
|
2294
2333
|
function createDynamicTokenVisibilityRule() {
|
|
2295
2334
|
return {
|
|
2296
2335
|
[CANVAS_VIZ_DYNAMIC_TOKEN_RULE]: (criterion) => {
|
|
2297
|
-
|
|
2298
|
-
if (
|
|
2336
|
+
const { source, value } = criterion;
|
|
2337
|
+
if (isUnbound(source)) {
|
|
2299
2338
|
return null;
|
|
2300
2339
|
}
|
|
2301
|
-
|
|
2340
|
+
const stringSource = toStringValue(source);
|
|
2341
|
+
const stringValue = toStringCriteriaValue(value);
|
|
2342
|
+
const stringCriterion = {
|
|
2343
|
+
...criterion,
|
|
2344
|
+
value: stringValue
|
|
2345
|
+
};
|
|
2346
|
+
return evaluateStringMatch(stringCriterion, stringSource, dynamicTokenVisibilityOperators);
|
|
2302
2347
|
}
|
|
2303
2348
|
};
|
|
2304
2349
|
}
|
|
@@ -2566,10 +2611,47 @@ _baseUrl = new WeakMap();
|
|
|
2566
2611
|
__privateAdd(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
2567
2612
|
var IntegrationPropertyEditorsClient = _IntegrationPropertyEditorsClient;
|
|
2568
2613
|
|
|
2569
|
-
// src/
|
|
2614
|
+
// src/LabelClient.ts
|
|
2570
2615
|
import { ApiClient as ApiClient8 } from "@uniformdev/context/api";
|
|
2616
|
+
var LABELS_URL = "/api/v1/labels";
|
|
2617
|
+
var LabelClient = class extends ApiClient8 {
|
|
2618
|
+
/** Fetches labels for the current project. */
|
|
2619
|
+
async getLabels(options) {
|
|
2620
|
+
const { projectId } = this.options;
|
|
2621
|
+
const fetchUri = this.createUrl(LABELS_URL, { ...options, projectId });
|
|
2622
|
+
return await this.apiClient(fetchUri);
|
|
2623
|
+
}
|
|
2624
|
+
/** Updates or creates a label. */
|
|
2625
|
+
async upsertLabel(body) {
|
|
2626
|
+
const { projectId } = this.options;
|
|
2627
|
+
const fetchUri = this.createUrl(LABELS_URL);
|
|
2628
|
+
await this.apiClient(fetchUri, {
|
|
2629
|
+
method: "PUT",
|
|
2630
|
+
body: JSON.stringify({ ...body, projectId }),
|
|
2631
|
+
expectNoContent: true
|
|
2632
|
+
});
|
|
2633
|
+
}
|
|
2634
|
+
/** Deletes a label by id. */
|
|
2635
|
+
async removeLabel(options) {
|
|
2636
|
+
const { projectId } = this.options;
|
|
2637
|
+
const fetchUri = this.createUrl(LABELS_URL);
|
|
2638
|
+
await this.apiClient(fetchUri, {
|
|
2639
|
+
method: "DELETE",
|
|
2640
|
+
body: JSON.stringify({ ...options, projectId }),
|
|
2641
|
+
expectNoContent: true
|
|
2642
|
+
});
|
|
2643
|
+
}
|
|
2644
|
+
};
|
|
2645
|
+
var UncachedLabelClient = class extends LabelClient {
|
|
2646
|
+
constructor(options) {
|
|
2647
|
+
super({ ...options, bypassCache: true });
|
|
2648
|
+
}
|
|
2649
|
+
};
|
|
2650
|
+
|
|
2651
|
+
// src/LocaleClient.ts
|
|
2652
|
+
import { ApiClient as ApiClient9 } from "@uniformdev/context/api";
|
|
2571
2653
|
var localesUrl = "/api/v1/locales";
|
|
2572
|
-
var LocaleClient = class extends
|
|
2654
|
+
var LocaleClient = class extends ApiClient9 {
|
|
2573
2655
|
constructor(options) {
|
|
2574
2656
|
super(options);
|
|
2575
2657
|
}
|
|
@@ -2955,10 +3037,10 @@ var createCanvasChannel = ({
|
|
|
2955
3037
|
};
|
|
2956
3038
|
|
|
2957
3039
|
// src/PreviewClient.ts
|
|
2958
|
-
import { ApiClient as
|
|
3040
|
+
import { ApiClient as ApiClient10 } from "@uniformdev/context/api";
|
|
2959
3041
|
var previewUrlsUrl = "/api/v1/preview-urls";
|
|
2960
3042
|
var previewViewportsUrl = "/api/v1/preview-viewports";
|
|
2961
|
-
var PreviewClient = class extends
|
|
3043
|
+
var PreviewClient = class extends ApiClient10 {
|
|
2962
3044
|
constructor(options) {
|
|
2963
3045
|
super(options);
|
|
2964
3046
|
}
|
|
@@ -3021,9 +3103,9 @@ var PreviewClient = class extends ApiClient9 {
|
|
|
3021
3103
|
};
|
|
3022
3104
|
|
|
3023
3105
|
// src/ProjectClient.ts
|
|
3024
|
-
import { ApiClient as
|
|
3025
|
-
var _url2;
|
|
3026
|
-
var _ProjectClient = class _ProjectClient extends
|
|
3106
|
+
import { ApiClient as ApiClient11 } from "@uniformdev/context/api";
|
|
3107
|
+
var _url2, _projectsUrl;
|
|
3108
|
+
var _ProjectClient = class _ProjectClient extends ApiClient11 {
|
|
3027
3109
|
constructor(options) {
|
|
3028
3110
|
super({ ...options, bypassCache: true });
|
|
3029
3111
|
}
|
|
@@ -3032,6 +3114,15 @@ var _ProjectClient = class _ProjectClient extends ApiClient10 {
|
|
|
3032
3114
|
const fetchUri = this.createUrl(__privateGet(_ProjectClient, _url2), { ...options });
|
|
3033
3115
|
return await this.apiClient(fetchUri);
|
|
3034
3116
|
}
|
|
3117
|
+
/**
|
|
3118
|
+
* Fetches projects grouped by team.
|
|
3119
|
+
* When teamId is provided, returns a single team with its projects.
|
|
3120
|
+
* When omitted, returns all accessible teams and their projects.
|
|
3121
|
+
*/
|
|
3122
|
+
async getProjects(options) {
|
|
3123
|
+
const fetchUri = this.createUrl(__privateGet(_ProjectClient, _projectsUrl), options ? { ...options } : {});
|
|
3124
|
+
return await this.apiClient(fetchUri);
|
|
3125
|
+
}
|
|
3035
3126
|
/** Updates or creates (based on id) a Project */
|
|
3036
3127
|
async upsert(body) {
|
|
3037
3128
|
const fetchUri = this.createUrl(__privateGet(_ProjectClient, _url2));
|
|
@@ -3051,13 +3142,15 @@ var _ProjectClient = class _ProjectClient extends ApiClient10 {
|
|
|
3051
3142
|
}
|
|
3052
3143
|
};
|
|
3053
3144
|
_url2 = new WeakMap();
|
|
3145
|
+
_projectsUrl = new WeakMap();
|
|
3054
3146
|
__privateAdd(_ProjectClient, _url2, "/api/v1/project");
|
|
3147
|
+
__privateAdd(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
3055
3148
|
var ProjectClient = _ProjectClient;
|
|
3056
3149
|
|
|
3057
3150
|
// src/PromptClient.ts
|
|
3058
|
-
import { ApiClient as
|
|
3151
|
+
import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
|
|
3059
3152
|
var PromptsUrl = "/api/v1/prompts";
|
|
3060
|
-
var PromptClient = class extends
|
|
3153
|
+
var PromptClient = class extends ApiClient12 {
|
|
3061
3154
|
constructor(options) {
|
|
3062
3155
|
super(options);
|
|
3063
3156
|
}
|
|
@@ -3088,9 +3181,9 @@ var PromptClient = class extends ApiClient11 {
|
|
|
3088
3181
|
};
|
|
3089
3182
|
|
|
3090
3183
|
// src/RelationshipClient.ts
|
|
3091
|
-
import { ApiClient as
|
|
3184
|
+
import { ApiClient as ApiClient13 } from "@uniformdev/context/api";
|
|
3092
3185
|
var RELATIONSHIPS_URL = "/api/v1/relationships";
|
|
3093
|
-
var RelationshipClient = class extends
|
|
3186
|
+
var RelationshipClient = class extends ApiClient13 {
|
|
3094
3187
|
constructor(options) {
|
|
3095
3188
|
super(options);
|
|
3096
3189
|
this.get = async (options) => {
|
|
@@ -3102,9 +3195,9 @@ var RelationshipClient = class extends ApiClient12 {
|
|
|
3102
3195
|
};
|
|
3103
3196
|
|
|
3104
3197
|
// src/ReleaseClient.ts
|
|
3105
|
-
import { ApiClient as
|
|
3198
|
+
import { ApiClient as ApiClient14 } from "@uniformdev/context/api";
|
|
3106
3199
|
var releasesUrl = "/api/v1/releases";
|
|
3107
|
-
var ReleaseClient = class extends
|
|
3200
|
+
var ReleaseClient = class extends ApiClient14 {
|
|
3108
3201
|
constructor(options) {
|
|
3109
3202
|
super(options);
|
|
3110
3203
|
}
|
|
@@ -3144,9 +3237,9 @@ var ReleaseClient = class extends ApiClient13 {
|
|
|
3144
3237
|
};
|
|
3145
3238
|
|
|
3146
3239
|
// src/ReleaseContentsClient.ts
|
|
3147
|
-
import { ApiClient as
|
|
3240
|
+
import { ApiClient as ApiClient15 } from "@uniformdev/context/api";
|
|
3148
3241
|
var releaseContentsUrl2 = "/api/v1/release-contents";
|
|
3149
|
-
var ReleaseContentsClient = class extends
|
|
3242
|
+
var ReleaseContentsClient = class extends ApiClient15 {
|
|
3150
3243
|
constructor(options) {
|
|
3151
3244
|
super(options);
|
|
3152
3245
|
}
|
|
@@ -3168,9 +3261,9 @@ var ReleaseContentsClient = class extends ApiClient14 {
|
|
|
3168
3261
|
};
|
|
3169
3262
|
|
|
3170
3263
|
// src/RouteClient.ts
|
|
3171
|
-
import { ApiClient as
|
|
3264
|
+
import { ApiClient as ApiClient16 } from "@uniformdev/context/api";
|
|
3172
3265
|
var ROUTE_URL = "/api/v1/route";
|
|
3173
|
-
var RouteClient = class extends
|
|
3266
|
+
var RouteClient = class extends ApiClient16 {
|
|
3174
3267
|
constructor(options) {
|
|
3175
3268
|
var _a;
|
|
3176
3269
|
if (!options.limitPolicy) {
|
|
@@ -3545,12 +3638,12 @@ function handleRichTextNodeBinding(object, options) {
|
|
|
3545
3638
|
import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
|
|
3546
3639
|
|
|
3547
3640
|
// src/.version.ts
|
|
3548
|
-
var version = "20.
|
|
3641
|
+
var version = "20.56.0";
|
|
3549
3642
|
|
|
3550
3643
|
// src/WorkflowClient.ts
|
|
3551
|
-
import { ApiClient as
|
|
3644
|
+
import { ApiClient as ApiClient17 } from "@uniformdev/context/api";
|
|
3552
3645
|
var workflowsUrl = "/api/v1/workflows";
|
|
3553
|
-
var WorkflowClient = class extends
|
|
3646
|
+
var WorkflowClient = class extends ApiClient17 {
|
|
3554
3647
|
constructor(options) {
|
|
3555
3648
|
super(options);
|
|
3556
3649
|
}
|
|
@@ -3654,6 +3747,7 @@ export {
|
|
|
3654
3747
|
IS_RENDERED_BY_UNIFORM_ATTRIBUTE,
|
|
3655
3748
|
IntegrationPropertyEditorsClient,
|
|
3656
3749
|
LOCALE_DYNAMIC_INPUT_NAME,
|
|
3750
|
+
LabelClient,
|
|
3657
3751
|
LocaleClient,
|
|
3658
3752
|
PLACEHOLDER_ID,
|
|
3659
3753
|
PreviewClient,
|
|
@@ -3667,6 +3761,7 @@ export {
|
|
|
3667
3761
|
UncachedCanvasClient,
|
|
3668
3762
|
UncachedCategoryClient,
|
|
3669
3763
|
UncachedContentClient,
|
|
3764
|
+
UncachedLabelClient,
|
|
3670
3765
|
UniqueBatchEntries,
|
|
3671
3766
|
WorkflowClient,
|
|
3672
3767
|
autoFixParameterGroups,
|