@uniformdev/canvas 20.50.2-alpha.1 → 20.50.2-alpha.39
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 +1510 -1034
- package/dist/index.d.ts +1510 -1034
- package/dist/index.esm.js +92 -40
- package/dist/index.js +97 -41
- package/dist/index.mjs +92 -40
- package/package.json +5 -5
package/dist/index.mjs
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);
|
|
@@ -2627,10 +2611,47 @@ _baseUrl = new WeakMap();
|
|
|
2627
2611
|
__privateAdd(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
2628
2612
|
var IntegrationPropertyEditorsClient = _IntegrationPropertyEditorsClient;
|
|
2629
2613
|
|
|
2630
|
-
// src/
|
|
2614
|
+
// src/LabelClient.ts
|
|
2631
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";
|
|
2632
2653
|
var localesUrl = "/api/v1/locales";
|
|
2633
|
-
var LocaleClient = class extends
|
|
2654
|
+
var LocaleClient = class extends ApiClient9 {
|
|
2634
2655
|
constructor(options) {
|
|
2635
2656
|
super(options);
|
|
2636
2657
|
}
|
|
@@ -2685,6 +2706,12 @@ var isSelectComponentMessage = (message) => {
|
|
|
2685
2706
|
var isReadyMessage = (message) => {
|
|
2686
2707
|
return message.type === "ready";
|
|
2687
2708
|
};
|
|
2709
|
+
var isSessionPendingMessage = (message) => {
|
|
2710
|
+
return message.type === "session-pending";
|
|
2711
|
+
};
|
|
2712
|
+
var isAwaitingReadyMessage = (message) => {
|
|
2713
|
+
return message.type === "awaiting-ready";
|
|
2714
|
+
};
|
|
2688
2715
|
var isComponentActionMessage = (message) => {
|
|
2689
2716
|
return message.type === "trigger-component-action";
|
|
2690
2717
|
};
|
|
@@ -2787,6 +2814,14 @@ var createCanvasChannel = ({
|
|
|
2787
2814
|
};
|
|
2788
2815
|
postMessage(message);
|
|
2789
2816
|
};
|
|
2817
|
+
const sessionPending = () => {
|
|
2818
|
+
const message = { type: "session-pending" };
|
|
2819
|
+
postMessage(message);
|
|
2820
|
+
};
|
|
2821
|
+
const awaitingReady = () => {
|
|
2822
|
+
const message = { type: "awaiting-ready" };
|
|
2823
|
+
postMessage(message);
|
|
2824
|
+
};
|
|
2790
2825
|
const on = (types, handler) => {
|
|
2791
2826
|
const handlerId = ++handlerCounter;
|
|
2792
2827
|
handlers[handlerId] = {
|
|
@@ -2986,6 +3021,8 @@ var createCanvasChannel = ({
|
|
|
2986
3021
|
return {
|
|
2987
3022
|
broadcastTo: broadcastToItems,
|
|
2988
3023
|
ready,
|
|
3024
|
+
sessionPending,
|
|
3025
|
+
awaitingReady,
|
|
2989
3026
|
destroy,
|
|
2990
3027
|
addBroadcastTarget,
|
|
2991
3028
|
triggerComponentAction,
|
|
@@ -3016,10 +3053,10 @@ var createCanvasChannel = ({
|
|
|
3016
3053
|
};
|
|
3017
3054
|
|
|
3018
3055
|
// src/PreviewClient.ts
|
|
3019
|
-
import { ApiClient as
|
|
3056
|
+
import { ApiClient as ApiClient10 } from "@uniformdev/context/api";
|
|
3020
3057
|
var previewUrlsUrl = "/api/v1/preview-urls";
|
|
3021
3058
|
var previewViewportsUrl = "/api/v1/preview-viewports";
|
|
3022
|
-
var PreviewClient = class extends
|
|
3059
|
+
var PreviewClient = class extends ApiClient10 {
|
|
3023
3060
|
constructor(options) {
|
|
3024
3061
|
super(options);
|
|
3025
3062
|
}
|
|
@@ -3082,9 +3119,9 @@ var PreviewClient = class extends ApiClient9 {
|
|
|
3082
3119
|
};
|
|
3083
3120
|
|
|
3084
3121
|
// src/ProjectClient.ts
|
|
3085
|
-
import { ApiClient as
|
|
3086
|
-
var _url2;
|
|
3087
|
-
var _ProjectClient = class _ProjectClient extends
|
|
3122
|
+
import { ApiClient as ApiClient11 } from "@uniformdev/context/api";
|
|
3123
|
+
var _url2, _projectsUrl;
|
|
3124
|
+
var _ProjectClient = class _ProjectClient extends ApiClient11 {
|
|
3088
3125
|
constructor(options) {
|
|
3089
3126
|
super({ ...options, bypassCache: true });
|
|
3090
3127
|
}
|
|
@@ -3093,6 +3130,15 @@ var _ProjectClient = class _ProjectClient extends ApiClient10 {
|
|
|
3093
3130
|
const fetchUri = this.createUrl(__privateGet(_ProjectClient, _url2), { ...options });
|
|
3094
3131
|
return await this.apiClient(fetchUri);
|
|
3095
3132
|
}
|
|
3133
|
+
/**
|
|
3134
|
+
* Fetches projects grouped by team.
|
|
3135
|
+
* When teamId is provided, returns a single team with its projects.
|
|
3136
|
+
* When omitted, returns all accessible teams and their projects.
|
|
3137
|
+
*/
|
|
3138
|
+
async getProjects(options) {
|
|
3139
|
+
const fetchUri = this.createUrl(__privateGet(_ProjectClient, _projectsUrl), options ? { ...options } : {});
|
|
3140
|
+
return await this.apiClient(fetchUri);
|
|
3141
|
+
}
|
|
3096
3142
|
/** Updates or creates (based on id) a Project */
|
|
3097
3143
|
async upsert(body) {
|
|
3098
3144
|
const fetchUri = this.createUrl(__privateGet(_ProjectClient, _url2));
|
|
@@ -3112,13 +3158,15 @@ var _ProjectClient = class _ProjectClient extends ApiClient10 {
|
|
|
3112
3158
|
}
|
|
3113
3159
|
};
|
|
3114
3160
|
_url2 = new WeakMap();
|
|
3161
|
+
_projectsUrl = new WeakMap();
|
|
3115
3162
|
__privateAdd(_ProjectClient, _url2, "/api/v1/project");
|
|
3163
|
+
__privateAdd(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
3116
3164
|
var ProjectClient = _ProjectClient;
|
|
3117
3165
|
|
|
3118
3166
|
// src/PromptClient.ts
|
|
3119
|
-
import { ApiClient as
|
|
3167
|
+
import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
|
|
3120
3168
|
var PromptsUrl = "/api/v1/prompts";
|
|
3121
|
-
var PromptClient = class extends
|
|
3169
|
+
var PromptClient = class extends ApiClient12 {
|
|
3122
3170
|
constructor(options) {
|
|
3123
3171
|
super(options);
|
|
3124
3172
|
}
|
|
@@ -3149,9 +3197,9 @@ var PromptClient = class extends ApiClient11 {
|
|
|
3149
3197
|
};
|
|
3150
3198
|
|
|
3151
3199
|
// src/RelationshipClient.ts
|
|
3152
|
-
import { ApiClient as
|
|
3200
|
+
import { ApiClient as ApiClient13 } from "@uniformdev/context/api";
|
|
3153
3201
|
var RELATIONSHIPS_URL = "/api/v1/relationships";
|
|
3154
|
-
var RelationshipClient = class extends
|
|
3202
|
+
var RelationshipClient = class extends ApiClient13 {
|
|
3155
3203
|
constructor(options) {
|
|
3156
3204
|
super(options);
|
|
3157
3205
|
this.get = async (options) => {
|
|
@@ -3163,9 +3211,9 @@ var RelationshipClient = class extends ApiClient12 {
|
|
|
3163
3211
|
};
|
|
3164
3212
|
|
|
3165
3213
|
// src/ReleaseClient.ts
|
|
3166
|
-
import { ApiClient as
|
|
3214
|
+
import { ApiClient as ApiClient14 } from "@uniformdev/context/api";
|
|
3167
3215
|
var releasesUrl = "/api/v1/releases";
|
|
3168
|
-
var ReleaseClient = class extends
|
|
3216
|
+
var ReleaseClient = class extends ApiClient14 {
|
|
3169
3217
|
constructor(options) {
|
|
3170
3218
|
super(options);
|
|
3171
3219
|
}
|
|
@@ -3205,9 +3253,9 @@ var ReleaseClient = class extends ApiClient13 {
|
|
|
3205
3253
|
};
|
|
3206
3254
|
|
|
3207
3255
|
// src/ReleaseContentsClient.ts
|
|
3208
|
-
import { ApiClient as
|
|
3256
|
+
import { ApiClient as ApiClient15 } from "@uniformdev/context/api";
|
|
3209
3257
|
var releaseContentsUrl2 = "/api/v1/release-contents";
|
|
3210
|
-
var ReleaseContentsClient = class extends
|
|
3258
|
+
var ReleaseContentsClient = class extends ApiClient15 {
|
|
3211
3259
|
constructor(options) {
|
|
3212
3260
|
super(options);
|
|
3213
3261
|
}
|
|
@@ -3229,9 +3277,9 @@ var ReleaseContentsClient = class extends ApiClient14 {
|
|
|
3229
3277
|
};
|
|
3230
3278
|
|
|
3231
3279
|
// src/RouteClient.ts
|
|
3232
|
-
import { ApiClient as
|
|
3280
|
+
import { ApiClient as ApiClient16 } from "@uniformdev/context/api";
|
|
3233
3281
|
var ROUTE_URL = "/api/v1/route";
|
|
3234
|
-
var RouteClient = class extends
|
|
3282
|
+
var RouteClient = class extends ApiClient16 {
|
|
3235
3283
|
constructor(options) {
|
|
3236
3284
|
var _a;
|
|
3237
3285
|
if (!options.limitPolicy) {
|
|
@@ -3606,12 +3654,12 @@ function handleRichTextNodeBinding(object, options) {
|
|
|
3606
3654
|
import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
|
|
3607
3655
|
|
|
3608
3656
|
// src/.version.ts
|
|
3609
|
-
var version = "20.
|
|
3657
|
+
var version = "20.60.0";
|
|
3610
3658
|
|
|
3611
3659
|
// src/WorkflowClient.ts
|
|
3612
|
-
import { ApiClient as
|
|
3660
|
+
import { ApiClient as ApiClient17 } from "@uniformdev/context/api";
|
|
3613
3661
|
var workflowsUrl = "/api/v1/workflows";
|
|
3614
|
-
var WorkflowClient = class extends
|
|
3662
|
+
var WorkflowClient = class extends ApiClient17 {
|
|
3615
3663
|
constructor(options) {
|
|
3616
3664
|
super(options);
|
|
3617
3665
|
}
|
|
@@ -3715,6 +3763,7 @@ export {
|
|
|
3715
3763
|
IS_RENDERED_BY_UNIFORM_ATTRIBUTE,
|
|
3716
3764
|
IntegrationPropertyEditorsClient,
|
|
3717
3765
|
LOCALE_DYNAMIC_INPUT_NAME,
|
|
3766
|
+
LabelClient,
|
|
3718
3767
|
LocaleClient,
|
|
3719
3768
|
PLACEHOLDER_ID,
|
|
3720
3769
|
PreviewClient,
|
|
@@ -3728,6 +3777,7 @@ export {
|
|
|
3728
3777
|
UncachedCanvasClient,
|
|
3729
3778
|
UncachedCategoryClient,
|
|
3730
3779
|
UncachedContentClient,
|
|
3780
|
+
UncachedLabelClient,
|
|
3731
3781
|
UniqueBatchEntries,
|
|
3732
3782
|
WorkflowClient,
|
|
3733
3783
|
autoFixParameterGroups,
|
|
@@ -3774,6 +3824,7 @@ export {
|
|
|
3774
3824
|
isAllowedReferrer,
|
|
3775
3825
|
isAssetParamValue,
|
|
3776
3826
|
isAssetParamValueItem,
|
|
3827
|
+
isAwaitingReadyMessage,
|
|
3777
3828
|
isComponentActionMessage,
|
|
3778
3829
|
isComponentPlaceholderId,
|
|
3779
3830
|
isContextStorageUpdatedMessage,
|
|
@@ -3789,6 +3840,7 @@ export {
|
|
|
3789
3840
|
isRootEntryReference,
|
|
3790
3841
|
isSelectComponentMessage,
|
|
3791
3842
|
isSelectParameterMessage,
|
|
3843
|
+
isSessionPendingMessage,
|
|
3792
3844
|
isSuggestComponentMessage,
|
|
3793
3845
|
isSystemComponentDefinition,
|
|
3794
3846
|
isTriggerCompositionActionMessage,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas",
|
|
3
|
-
"version": "20.50.2-alpha.
|
|
3
|
+
"version": "20.50.2-alpha.39+83d081969c",
|
|
4
4
|
"description": "Common functionality and types for Uniform Canvas",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"svix": "1.71.0"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@uniformdev/assets": "20.50.2-alpha.
|
|
45
|
-
"@uniformdev/context": "20.50.2-alpha.
|
|
46
|
-
"@uniformdev/richtext": "20.50.2-alpha.
|
|
44
|
+
"@uniformdev/assets": "20.50.2-alpha.39+83d081969c",
|
|
45
|
+
"@uniformdev/context": "20.50.2-alpha.39+83d081969c",
|
|
46
|
+
"@uniformdev/richtext": "20.50.2-alpha.39+83d081969c",
|
|
47
47
|
"immer": "10.1.3"
|
|
48
48
|
},
|
|
49
49
|
"files": [
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "83d081969cac03a901e60d5c78bad66eef78de80"
|
|
56
56
|
}
|