@uniformdev/canvas 20.49.3 → 20.49.4-alpha.124

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
@@ -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 = rewriteFilters(filters);
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 = rewriteFilters(filters);
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/LocaleClient.ts
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 ApiClient8 {
2654
+ var LocaleClient = class extends ApiClient9 {
2634
2655
  constructor(options) {
2635
2656
  super(options);
2636
2657
  }
@@ -3016,10 +3037,10 @@ var createCanvasChannel = ({
3016
3037
  };
3017
3038
 
3018
3039
  // src/PreviewClient.ts
3019
- import { ApiClient as ApiClient9 } from "@uniformdev/context/api";
3040
+ import { ApiClient as ApiClient10 } from "@uniformdev/context/api";
3020
3041
  var previewUrlsUrl = "/api/v1/preview-urls";
3021
3042
  var previewViewportsUrl = "/api/v1/preview-viewports";
3022
- var PreviewClient = class extends ApiClient9 {
3043
+ var PreviewClient = class extends ApiClient10 {
3023
3044
  constructor(options) {
3024
3045
  super(options);
3025
3046
  }
@@ -3082,9 +3103,9 @@ var PreviewClient = class extends ApiClient9 {
3082
3103
  };
3083
3104
 
3084
3105
  // src/ProjectClient.ts
3085
- import { ApiClient as ApiClient10 } from "@uniformdev/context/api";
3106
+ import { ApiClient as ApiClient11 } from "@uniformdev/context/api";
3086
3107
  var _url2;
3087
- var _ProjectClient = class _ProjectClient extends ApiClient10 {
3108
+ var _ProjectClient = class _ProjectClient extends ApiClient11 {
3088
3109
  constructor(options) {
3089
3110
  super({ ...options, bypassCache: true });
3090
3111
  }
@@ -3116,9 +3137,9 @@ __privateAdd(_ProjectClient, _url2, "/api/v1/project");
3116
3137
  var ProjectClient = _ProjectClient;
3117
3138
 
3118
3139
  // src/PromptClient.ts
3119
- import { ApiClient as ApiClient11 } from "@uniformdev/context/api";
3140
+ import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
3120
3141
  var PromptsUrl = "/api/v1/prompts";
3121
- var PromptClient = class extends ApiClient11 {
3142
+ var PromptClient = class extends ApiClient12 {
3122
3143
  constructor(options) {
3123
3144
  super(options);
3124
3145
  }
@@ -3149,9 +3170,9 @@ var PromptClient = class extends ApiClient11 {
3149
3170
  };
3150
3171
 
3151
3172
  // src/RelationshipClient.ts
3152
- import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
3173
+ import { ApiClient as ApiClient13 } from "@uniformdev/context/api";
3153
3174
  var RELATIONSHIPS_URL = "/api/v1/relationships";
3154
- var RelationshipClient = class extends ApiClient12 {
3175
+ var RelationshipClient = class extends ApiClient13 {
3155
3176
  constructor(options) {
3156
3177
  super(options);
3157
3178
  this.get = async (options) => {
@@ -3163,9 +3184,9 @@ var RelationshipClient = class extends ApiClient12 {
3163
3184
  };
3164
3185
 
3165
3186
  // src/ReleaseClient.ts
3166
- import { ApiClient as ApiClient13 } from "@uniformdev/context/api";
3187
+ import { ApiClient as ApiClient14 } from "@uniformdev/context/api";
3167
3188
  var releasesUrl = "/api/v1/releases";
3168
- var ReleaseClient = class extends ApiClient13 {
3189
+ var ReleaseClient = class extends ApiClient14 {
3169
3190
  constructor(options) {
3170
3191
  super(options);
3171
3192
  }
@@ -3205,9 +3226,9 @@ var ReleaseClient = class extends ApiClient13 {
3205
3226
  };
3206
3227
 
3207
3228
  // src/ReleaseContentsClient.ts
3208
- import { ApiClient as ApiClient14 } from "@uniformdev/context/api";
3229
+ import { ApiClient as ApiClient15 } from "@uniformdev/context/api";
3209
3230
  var releaseContentsUrl2 = "/api/v1/release-contents";
3210
- var ReleaseContentsClient = class extends ApiClient14 {
3231
+ var ReleaseContentsClient = class extends ApiClient15 {
3211
3232
  constructor(options) {
3212
3233
  super(options);
3213
3234
  }
@@ -3229,9 +3250,9 @@ var ReleaseContentsClient = class extends ApiClient14 {
3229
3250
  };
3230
3251
 
3231
3252
  // src/RouteClient.ts
3232
- import { ApiClient as ApiClient15 } from "@uniformdev/context/api";
3253
+ import { ApiClient as ApiClient16 } from "@uniformdev/context/api";
3233
3254
  var ROUTE_URL = "/api/v1/route";
3234
- var RouteClient = class extends ApiClient15 {
3255
+ var RouteClient = class extends ApiClient16 {
3235
3256
  constructor(options) {
3236
3257
  var _a;
3237
3258
  if (!options.limitPolicy) {
@@ -3606,12 +3627,12 @@ function handleRichTextNodeBinding(object, options) {
3606
3627
  import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
3607
3628
 
3608
3629
  // src/.version.ts
3609
- var version = "20.49.3";
3630
+ var version = "20.50.0";
3610
3631
 
3611
3632
  // src/WorkflowClient.ts
3612
- import { ApiClient as ApiClient16 } from "@uniformdev/context/api";
3633
+ import { ApiClient as ApiClient17 } from "@uniformdev/context/api";
3613
3634
  var workflowsUrl = "/api/v1/workflows";
3614
- var WorkflowClient = class extends ApiClient16 {
3635
+ var WorkflowClient = class extends ApiClient17 {
3615
3636
  constructor(options) {
3616
3637
  super(options);
3617
3638
  }
@@ -3715,6 +3736,7 @@ export {
3715
3736
  IS_RENDERED_BY_UNIFORM_ATTRIBUTE,
3716
3737
  IntegrationPropertyEditorsClient,
3717
3738
  LOCALE_DYNAMIC_INPUT_NAME,
3739
+ LabelClient,
3718
3740
  LocaleClient,
3719
3741
  PLACEHOLDER_ID,
3720
3742
  PreviewClient,
@@ -3728,6 +3750,7 @@ export {
3728
3750
  UncachedCanvasClient,
3729
3751
  UncachedCategoryClient,
3730
3752
  UncachedContentClient,
3753
+ UncachedLabelClient,
3731
3754
  UniqueBatchEntries,
3732
3755
  WorkflowClient,
3733
3756
  autoFixParameterGroups,
package/dist/index.js CHANGED
@@ -397,7 +397,7 @@ __export(src_exports, {
397
397
  ATTRIBUTE_PARAMETER_TYPE: () => ATTRIBUTE_PARAMETER_TYPE,
398
398
  ATTRIBUTE_PARAMETER_VALUE: () => ATTRIBUTE_PARAMETER_VALUE,
399
399
  ATTRIBUTE_PLACEHOLDER: () => ATTRIBUTE_PLACEHOLDER,
400
- ApiClientError: () => import_api18.ApiClientError,
400
+ ApiClientError: () => import_api19.ApiClientError,
401
401
  BatchEntry: () => BatchEntry,
402
402
  BlockFormatError: () => BlockFormatError,
403
403
  CANVAS_BLOCK_PARAM_TYPE: () => CANVAS_BLOCK_PARAM_TYPE,
@@ -459,6 +459,7 @@ __export(src_exports, {
459
459
  IS_RENDERED_BY_UNIFORM_ATTRIBUTE: () => IS_RENDERED_BY_UNIFORM_ATTRIBUTE,
460
460
  IntegrationPropertyEditorsClient: () => IntegrationPropertyEditorsClient,
461
461
  LOCALE_DYNAMIC_INPUT_NAME: () => LOCALE_DYNAMIC_INPUT_NAME,
462
+ LabelClient: () => LabelClient,
462
463
  LocaleClient: () => LocaleClient,
463
464
  PLACEHOLDER_ID: () => PLACEHOLDER_ID,
464
465
  PreviewClient: () => PreviewClient,
@@ -472,6 +473,7 @@ __export(src_exports, {
472
473
  UncachedCanvasClient: () => UncachedCanvasClient,
473
474
  UncachedCategoryClient: () => UncachedCategoryClient,
474
475
  UncachedContentClient: () => UncachedContentClient,
476
+ UncachedLabelClient: () => UncachedLabelClient,
475
477
  UniqueBatchEntries: () => UniqueBatchEntries,
476
478
  WorkflowClient: () => WorkflowClient,
477
479
  autoFixParameterGroups: () => autoFixParameterGroups,
@@ -762,22 +764,6 @@ function createLimitPolicy({
762
764
  }
763
765
  var nullLimitPolicy = async (func) => await func();
764
766
 
765
- // src/utils/rewriteFilters.ts
766
- var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
767
- function rewriteFilters(filters) {
768
- return Object.entries(filters != null ? filters : {}).reduce(
769
- (acc, [key, value]) => {
770
- const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
771
- const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
772
- return {
773
- ...acc,
774
- [lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
775
- };
776
- },
777
- {}
778
- );
779
- }
780
-
781
767
  // src/CanvasClient.ts
782
768
  var CANVAS_URL = "/api/v1/canvas";
783
769
  var CanvasClient = class extends import_api2.ApiClient {
@@ -794,7 +780,7 @@ var CanvasClient = class extends import_api2.ApiClient {
794
780
  async getCompositionList(params = {}) {
795
781
  const { projectId } = this.options;
796
782
  const { resolveData, filters, ...originParams } = params;
797
- const rewrittenFilters = rewriteFilters(filters);
783
+ const rewrittenFilters = (0, import_api2.rewriteFiltersForApi)(filters);
798
784
  if (!resolveData) {
799
785
  const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
800
786
  return this.apiClient(fetchUri);
@@ -964,7 +950,7 @@ var _ContentClient = class _ContentClient extends import_api4.ApiClient {
964
950
  getEntries(options) {
965
951
  const { projectId } = this.options;
966
952
  const { skipDataResolution, filters, ...params } = options;
967
- const rewrittenFilters = rewriteFilters(filters);
953
+ const rewrittenFilters = (0, import_api4.rewriteFiltersForApi)(filters);
968
954
  if (skipDataResolution) {
969
955
  const url = this.createUrl(__privateGet(_ContentClient, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
970
956
  return this.apiClient(url);
@@ -2805,10 +2791,47 @@ _baseUrl = new WeakMap();
2805
2791
  __privateAdd(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
2806
2792
  var IntegrationPropertyEditorsClient = _IntegrationPropertyEditorsClient;
2807
2793
 
2808
- // src/LocaleClient.ts
2794
+ // src/LabelClient.ts
2809
2795
  var import_api9 = require("@uniformdev/context/api");
2796
+ var LABELS_URL = "/api/v1/labels";
2797
+ var LabelClient = class extends import_api9.ApiClient {
2798
+ /** Fetches labels for the current project. */
2799
+ async getLabels(options) {
2800
+ const { projectId } = this.options;
2801
+ const fetchUri = this.createUrl(LABELS_URL, { ...options, projectId });
2802
+ return await this.apiClient(fetchUri);
2803
+ }
2804
+ /** Updates or creates a label. */
2805
+ async upsertLabel(body) {
2806
+ const { projectId } = this.options;
2807
+ const fetchUri = this.createUrl(LABELS_URL);
2808
+ await this.apiClient(fetchUri, {
2809
+ method: "PUT",
2810
+ body: JSON.stringify({ ...body, projectId }),
2811
+ expectNoContent: true
2812
+ });
2813
+ }
2814
+ /** Deletes a label by id. */
2815
+ async removeLabel(options) {
2816
+ const { projectId } = this.options;
2817
+ const fetchUri = this.createUrl(LABELS_URL);
2818
+ await this.apiClient(fetchUri, {
2819
+ method: "DELETE",
2820
+ body: JSON.stringify({ ...options, projectId }),
2821
+ expectNoContent: true
2822
+ });
2823
+ }
2824
+ };
2825
+ var UncachedLabelClient = class extends LabelClient {
2826
+ constructor(options) {
2827
+ super({ ...options, bypassCache: true });
2828
+ }
2829
+ };
2830
+
2831
+ // src/LocaleClient.ts
2832
+ var import_api10 = require("@uniformdev/context/api");
2810
2833
  var localesUrl = "/api/v1/locales";
2811
- var LocaleClient = class extends import_api9.ApiClient {
2834
+ var LocaleClient = class extends import_api10.ApiClient {
2812
2835
  constructor(options) {
2813
2836
  super(options);
2814
2837
  }
@@ -3194,10 +3217,10 @@ var createCanvasChannel = ({
3194
3217
  };
3195
3218
 
3196
3219
  // src/PreviewClient.ts
3197
- var import_api10 = require("@uniformdev/context/api");
3220
+ var import_api11 = require("@uniformdev/context/api");
3198
3221
  var previewUrlsUrl = "/api/v1/preview-urls";
3199
3222
  var previewViewportsUrl = "/api/v1/preview-viewports";
3200
- var PreviewClient = class extends import_api10.ApiClient {
3223
+ var PreviewClient = class extends import_api11.ApiClient {
3201
3224
  constructor(options) {
3202
3225
  super(options);
3203
3226
  }
@@ -3260,9 +3283,9 @@ var PreviewClient = class extends import_api10.ApiClient {
3260
3283
  };
3261
3284
 
3262
3285
  // src/ProjectClient.ts
3263
- var import_api11 = require("@uniformdev/context/api");
3286
+ var import_api12 = require("@uniformdev/context/api");
3264
3287
  var _url2;
3265
- var _ProjectClient = class _ProjectClient extends import_api11.ApiClient {
3288
+ var _ProjectClient = class _ProjectClient extends import_api12.ApiClient {
3266
3289
  constructor(options) {
3267
3290
  super({ ...options, bypassCache: true });
3268
3291
  }
@@ -3294,9 +3317,9 @@ __privateAdd(_ProjectClient, _url2, "/api/v1/project");
3294
3317
  var ProjectClient = _ProjectClient;
3295
3318
 
3296
3319
  // src/PromptClient.ts
3297
- var import_api12 = require("@uniformdev/context/api");
3320
+ var import_api13 = require("@uniformdev/context/api");
3298
3321
  var PromptsUrl = "/api/v1/prompts";
3299
- var PromptClient = class extends import_api12.ApiClient {
3322
+ var PromptClient = class extends import_api13.ApiClient {
3300
3323
  constructor(options) {
3301
3324
  super(options);
3302
3325
  }
@@ -3327,9 +3350,9 @@ var PromptClient = class extends import_api12.ApiClient {
3327
3350
  };
3328
3351
 
3329
3352
  // src/RelationshipClient.ts
3330
- var import_api13 = require("@uniformdev/context/api");
3353
+ var import_api14 = require("@uniformdev/context/api");
3331
3354
  var RELATIONSHIPS_URL = "/api/v1/relationships";
3332
- var RelationshipClient = class extends import_api13.ApiClient {
3355
+ var RelationshipClient = class extends import_api14.ApiClient {
3333
3356
  constructor(options) {
3334
3357
  super(options);
3335
3358
  this.get = async (options) => {
@@ -3341,9 +3364,9 @@ var RelationshipClient = class extends import_api13.ApiClient {
3341
3364
  };
3342
3365
 
3343
3366
  // src/ReleaseClient.ts
3344
- var import_api14 = require("@uniformdev/context/api");
3367
+ var import_api15 = require("@uniformdev/context/api");
3345
3368
  var releasesUrl = "/api/v1/releases";
3346
- var ReleaseClient = class extends import_api14.ApiClient {
3369
+ var ReleaseClient = class extends import_api15.ApiClient {
3347
3370
  constructor(options) {
3348
3371
  super(options);
3349
3372
  }
@@ -3383,9 +3406,9 @@ var ReleaseClient = class extends import_api14.ApiClient {
3383
3406
  };
3384
3407
 
3385
3408
  // src/ReleaseContentsClient.ts
3386
- var import_api15 = require("@uniformdev/context/api");
3409
+ var import_api16 = require("@uniformdev/context/api");
3387
3410
  var releaseContentsUrl2 = "/api/v1/release-contents";
3388
- var ReleaseContentsClient = class extends import_api15.ApiClient {
3411
+ var ReleaseContentsClient = class extends import_api16.ApiClient {
3389
3412
  constructor(options) {
3390
3413
  super(options);
3391
3414
  }
@@ -3407,9 +3430,9 @@ var ReleaseContentsClient = class extends import_api15.ApiClient {
3407
3430
  };
3408
3431
 
3409
3432
  // src/RouteClient.ts
3410
- var import_api16 = require("@uniformdev/context/api");
3433
+ var import_api17 = require("@uniformdev/context/api");
3411
3434
  var ROUTE_URL = "/api/v1/route";
3412
- var RouteClient = class extends import_api16.ApiClient {
3435
+ var RouteClient = class extends import_api17.ApiClient {
3413
3436
  constructor(options) {
3414
3437
  var _a;
3415
3438
  if (!options.limitPolicy) {
@@ -3781,15 +3804,15 @@ function handleRichTextNodeBinding(object, options) {
3781
3804
  }
3782
3805
 
3783
3806
  // src/index.ts
3784
- var import_api18 = require("@uniformdev/context/api");
3807
+ var import_api19 = require("@uniformdev/context/api");
3785
3808
 
3786
3809
  // src/.version.ts
3787
- var version = "20.49.3";
3810
+ var version = "20.50.0";
3788
3811
 
3789
3812
  // src/WorkflowClient.ts
3790
- var import_api17 = require("@uniformdev/context/api");
3813
+ var import_api18 = require("@uniformdev/context/api");
3791
3814
  var workflowsUrl = "/api/v1/workflows";
3792
- var WorkflowClient = class extends import_api17.ApiClient {
3815
+ var WorkflowClient = class extends import_api18.ApiClient {
3793
3816
  constructor(options) {
3794
3817
  super(options);
3795
3818
  }
@@ -3820,7 +3843,7 @@ var WorkflowClient = class extends import_api17.ApiClient {
3820
3843
  };
3821
3844
 
3822
3845
  // src/index.ts
3823
- var CanvasClientError = import_api18.ApiClientError;
3846
+ var CanvasClientError = import_api19.ApiClientError;
3824
3847
  // Annotate the CommonJS export names for ESM import in node:
3825
3848
  0 && (module.exports = {
3826
3849
  ASSETS_SOURCE_CUSTOM_URL,
@@ -3894,6 +3917,7 @@ var CanvasClientError = import_api18.ApiClientError;
3894
3917
  IS_RENDERED_BY_UNIFORM_ATTRIBUTE,
3895
3918
  IntegrationPropertyEditorsClient,
3896
3919
  LOCALE_DYNAMIC_INPUT_NAME,
3920
+ LabelClient,
3897
3921
  LocaleClient,
3898
3922
  PLACEHOLDER_ID,
3899
3923
  PreviewClient,
@@ -3907,6 +3931,7 @@ var CanvasClientError = import_api18.ApiClientError;
3907
3931
  UncachedCanvasClient,
3908
3932
  UncachedCategoryClient,
3909
3933
  UncachedContentClient,
3934
+ UncachedLabelClient,
3910
3935
  UniqueBatchEntries,
3911
3936
  WorkflowClient,
3912
3937
  autoFixParameterGroups,
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 = rewriteFilters(filters);
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 = rewriteFilters(filters);
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/LocaleClient.ts
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 ApiClient8 {
2654
+ var LocaleClient = class extends ApiClient9 {
2634
2655
  constructor(options) {
2635
2656
  super(options);
2636
2657
  }
@@ -3016,10 +3037,10 @@ var createCanvasChannel = ({
3016
3037
  };
3017
3038
 
3018
3039
  // src/PreviewClient.ts
3019
- import { ApiClient as ApiClient9 } from "@uniformdev/context/api";
3040
+ import { ApiClient as ApiClient10 } from "@uniformdev/context/api";
3020
3041
  var previewUrlsUrl = "/api/v1/preview-urls";
3021
3042
  var previewViewportsUrl = "/api/v1/preview-viewports";
3022
- var PreviewClient = class extends ApiClient9 {
3043
+ var PreviewClient = class extends ApiClient10 {
3023
3044
  constructor(options) {
3024
3045
  super(options);
3025
3046
  }
@@ -3082,9 +3103,9 @@ var PreviewClient = class extends ApiClient9 {
3082
3103
  };
3083
3104
 
3084
3105
  // src/ProjectClient.ts
3085
- import { ApiClient as ApiClient10 } from "@uniformdev/context/api";
3106
+ import { ApiClient as ApiClient11 } from "@uniformdev/context/api";
3086
3107
  var _url2;
3087
- var _ProjectClient = class _ProjectClient extends ApiClient10 {
3108
+ var _ProjectClient = class _ProjectClient extends ApiClient11 {
3088
3109
  constructor(options) {
3089
3110
  super({ ...options, bypassCache: true });
3090
3111
  }
@@ -3116,9 +3137,9 @@ __privateAdd(_ProjectClient, _url2, "/api/v1/project");
3116
3137
  var ProjectClient = _ProjectClient;
3117
3138
 
3118
3139
  // src/PromptClient.ts
3119
- import { ApiClient as ApiClient11 } from "@uniformdev/context/api";
3140
+ import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
3120
3141
  var PromptsUrl = "/api/v1/prompts";
3121
- var PromptClient = class extends ApiClient11 {
3142
+ var PromptClient = class extends ApiClient12 {
3122
3143
  constructor(options) {
3123
3144
  super(options);
3124
3145
  }
@@ -3149,9 +3170,9 @@ var PromptClient = class extends ApiClient11 {
3149
3170
  };
3150
3171
 
3151
3172
  // src/RelationshipClient.ts
3152
- import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
3173
+ import { ApiClient as ApiClient13 } from "@uniformdev/context/api";
3153
3174
  var RELATIONSHIPS_URL = "/api/v1/relationships";
3154
- var RelationshipClient = class extends ApiClient12 {
3175
+ var RelationshipClient = class extends ApiClient13 {
3155
3176
  constructor(options) {
3156
3177
  super(options);
3157
3178
  this.get = async (options) => {
@@ -3163,9 +3184,9 @@ var RelationshipClient = class extends ApiClient12 {
3163
3184
  };
3164
3185
 
3165
3186
  // src/ReleaseClient.ts
3166
- import { ApiClient as ApiClient13 } from "@uniformdev/context/api";
3187
+ import { ApiClient as ApiClient14 } from "@uniformdev/context/api";
3167
3188
  var releasesUrl = "/api/v1/releases";
3168
- var ReleaseClient = class extends ApiClient13 {
3189
+ var ReleaseClient = class extends ApiClient14 {
3169
3190
  constructor(options) {
3170
3191
  super(options);
3171
3192
  }
@@ -3205,9 +3226,9 @@ var ReleaseClient = class extends ApiClient13 {
3205
3226
  };
3206
3227
 
3207
3228
  // src/ReleaseContentsClient.ts
3208
- import { ApiClient as ApiClient14 } from "@uniformdev/context/api";
3229
+ import { ApiClient as ApiClient15 } from "@uniformdev/context/api";
3209
3230
  var releaseContentsUrl2 = "/api/v1/release-contents";
3210
- var ReleaseContentsClient = class extends ApiClient14 {
3231
+ var ReleaseContentsClient = class extends ApiClient15 {
3211
3232
  constructor(options) {
3212
3233
  super(options);
3213
3234
  }
@@ -3229,9 +3250,9 @@ var ReleaseContentsClient = class extends ApiClient14 {
3229
3250
  };
3230
3251
 
3231
3252
  // src/RouteClient.ts
3232
- import { ApiClient as ApiClient15 } from "@uniformdev/context/api";
3253
+ import { ApiClient as ApiClient16 } from "@uniformdev/context/api";
3233
3254
  var ROUTE_URL = "/api/v1/route";
3234
- var RouteClient = class extends ApiClient15 {
3255
+ var RouteClient = class extends ApiClient16 {
3235
3256
  constructor(options) {
3236
3257
  var _a;
3237
3258
  if (!options.limitPolicy) {
@@ -3606,12 +3627,12 @@ function handleRichTextNodeBinding(object, options) {
3606
3627
  import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
3607
3628
 
3608
3629
  // src/.version.ts
3609
- var version = "20.49.3";
3630
+ var version = "20.50.0";
3610
3631
 
3611
3632
  // src/WorkflowClient.ts
3612
- import { ApiClient as ApiClient16 } from "@uniformdev/context/api";
3633
+ import { ApiClient as ApiClient17 } from "@uniformdev/context/api";
3613
3634
  var workflowsUrl = "/api/v1/workflows";
3614
- var WorkflowClient = class extends ApiClient16 {
3635
+ var WorkflowClient = class extends ApiClient17 {
3615
3636
  constructor(options) {
3616
3637
  super(options);
3617
3638
  }
@@ -3715,6 +3736,7 @@ export {
3715
3736
  IS_RENDERED_BY_UNIFORM_ATTRIBUTE,
3716
3737
  IntegrationPropertyEditorsClient,
3717
3738
  LOCALE_DYNAMIC_INPUT_NAME,
3739
+ LabelClient,
3718
3740
  LocaleClient,
3719
3741
  PLACEHOLDER_ID,
3720
3742
  PreviewClient,
@@ -3728,6 +3750,7 @@ export {
3728
3750
  UncachedCanvasClient,
3729
3751
  UncachedCategoryClient,
3730
3752
  UncachedContentClient,
3753
+ UncachedLabelClient,
3731
3754
  UniqueBatchEntries,
3732
3755
  WorkflowClient,
3733
3756
  autoFixParameterGroups,