@uniformdev/canvas 20.51.0 → 20.53.1-alpha.7

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.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);
@@ -1122,6 +1106,7 @@ var EDGE_CACHE_DISABLED = -1;
1122
1106
  var ASSET_PARAMETER_TYPE = "asset";
1123
1107
  var ASSETS_SOURCE_UNIFORM = "uniform-assets";
1124
1108
  var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
1109
+ var REFERENCE_DATA_TYPE_ID = "uniformContentInternalReference";
1125
1110
 
1126
1111
  // src/utils/guards.ts
1127
1112
  function isRootEntryReference(root) {
@@ -2627,10 +2612,47 @@ _baseUrl = new WeakMap();
2627
2612
  __privateAdd(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
2628
2613
  var IntegrationPropertyEditorsClient = _IntegrationPropertyEditorsClient;
2629
2614
 
2630
- // src/LocaleClient.ts
2615
+ // src/LabelClient.ts
2631
2616
  import { ApiClient as ApiClient8 } from "@uniformdev/context/api";
2617
+ var LABELS_URL = "/api/v1/labels";
2618
+ var LabelClient = class extends ApiClient8 {
2619
+ /** Fetches labels for the current project. */
2620
+ async getLabels(options) {
2621
+ const { projectId } = this.options;
2622
+ const fetchUri = this.createUrl(LABELS_URL, { ...options, projectId });
2623
+ return await this.apiClient(fetchUri);
2624
+ }
2625
+ /** Updates or creates a label. */
2626
+ async upsertLabel(body) {
2627
+ const { projectId } = this.options;
2628
+ const fetchUri = this.createUrl(LABELS_URL);
2629
+ await this.apiClient(fetchUri, {
2630
+ method: "PUT",
2631
+ body: JSON.stringify({ ...body, projectId }),
2632
+ expectNoContent: true
2633
+ });
2634
+ }
2635
+ /** Deletes a label by id. */
2636
+ async removeLabel(options) {
2637
+ const { projectId } = this.options;
2638
+ const fetchUri = this.createUrl(LABELS_URL);
2639
+ await this.apiClient(fetchUri, {
2640
+ method: "DELETE",
2641
+ body: JSON.stringify({ ...options, projectId }),
2642
+ expectNoContent: true
2643
+ });
2644
+ }
2645
+ };
2646
+ var UncachedLabelClient = class extends LabelClient {
2647
+ constructor(options) {
2648
+ super({ ...options, bypassCache: true });
2649
+ }
2650
+ };
2651
+
2652
+ // src/LocaleClient.ts
2653
+ import { ApiClient as ApiClient9 } from "@uniformdev/context/api";
2632
2654
  var localesUrl = "/api/v1/locales";
2633
- var LocaleClient = class extends ApiClient8 {
2655
+ var LocaleClient = class extends ApiClient9 {
2634
2656
  constructor(options) {
2635
2657
  super(options);
2636
2658
  }
@@ -3016,10 +3038,10 @@ var createCanvasChannel = ({
3016
3038
  };
3017
3039
 
3018
3040
  // src/PreviewClient.ts
3019
- import { ApiClient as ApiClient9 } from "@uniformdev/context/api";
3041
+ import { ApiClient as ApiClient10 } from "@uniformdev/context/api";
3020
3042
  var previewUrlsUrl = "/api/v1/preview-urls";
3021
3043
  var previewViewportsUrl = "/api/v1/preview-viewports";
3022
- var PreviewClient = class extends ApiClient9 {
3044
+ var PreviewClient = class extends ApiClient10 {
3023
3045
  constructor(options) {
3024
3046
  super(options);
3025
3047
  }
@@ -3082,9 +3104,9 @@ var PreviewClient = class extends ApiClient9 {
3082
3104
  };
3083
3105
 
3084
3106
  // src/ProjectClient.ts
3085
- import { ApiClient as ApiClient10 } from "@uniformdev/context/api";
3107
+ import { ApiClient as ApiClient11 } from "@uniformdev/context/api";
3086
3108
  var _url2, _projectsUrl;
3087
- var _ProjectClient = class _ProjectClient extends ApiClient10 {
3109
+ var _ProjectClient = class _ProjectClient extends ApiClient11 {
3088
3110
  constructor(options) {
3089
3111
  super({ ...options, bypassCache: true });
3090
3112
  }
@@ -3127,9 +3149,9 @@ __privateAdd(_ProjectClient, _projectsUrl, "/api/v1/projects");
3127
3149
  var ProjectClient = _ProjectClient;
3128
3150
 
3129
3151
  // src/PromptClient.ts
3130
- import { ApiClient as ApiClient11 } from "@uniformdev/context/api";
3152
+ import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
3131
3153
  var PromptsUrl = "/api/v1/prompts";
3132
- var PromptClient = class extends ApiClient11 {
3154
+ var PromptClient = class extends ApiClient12 {
3133
3155
  constructor(options) {
3134
3156
  super(options);
3135
3157
  }
@@ -3160,9 +3182,9 @@ var PromptClient = class extends ApiClient11 {
3160
3182
  };
3161
3183
 
3162
3184
  // src/RelationshipClient.ts
3163
- import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
3185
+ import { ApiClient as ApiClient13 } from "@uniformdev/context/api";
3164
3186
  var RELATIONSHIPS_URL = "/api/v1/relationships";
3165
- var RelationshipClient = class extends ApiClient12 {
3187
+ var RelationshipClient = class extends ApiClient13 {
3166
3188
  constructor(options) {
3167
3189
  super(options);
3168
3190
  this.get = async (options) => {
@@ -3174,9 +3196,9 @@ var RelationshipClient = class extends ApiClient12 {
3174
3196
  };
3175
3197
 
3176
3198
  // src/ReleaseClient.ts
3177
- import { ApiClient as ApiClient13 } from "@uniformdev/context/api";
3199
+ import { ApiClient as ApiClient14 } from "@uniformdev/context/api";
3178
3200
  var releasesUrl = "/api/v1/releases";
3179
- var ReleaseClient = class extends ApiClient13 {
3201
+ var ReleaseClient = class extends ApiClient14 {
3180
3202
  constructor(options) {
3181
3203
  super(options);
3182
3204
  }
@@ -3216,9 +3238,9 @@ var ReleaseClient = class extends ApiClient13 {
3216
3238
  };
3217
3239
 
3218
3240
  // src/ReleaseContentsClient.ts
3219
- import { ApiClient as ApiClient14 } from "@uniformdev/context/api";
3241
+ import { ApiClient as ApiClient15 } from "@uniformdev/context/api";
3220
3242
  var releaseContentsUrl2 = "/api/v1/release-contents";
3221
- var ReleaseContentsClient = class extends ApiClient14 {
3243
+ var ReleaseContentsClient = class extends ApiClient15 {
3222
3244
  constructor(options) {
3223
3245
  super(options);
3224
3246
  }
@@ -3240,9 +3262,9 @@ var ReleaseContentsClient = class extends ApiClient14 {
3240
3262
  };
3241
3263
 
3242
3264
  // src/RouteClient.ts
3243
- import { ApiClient as ApiClient15 } from "@uniformdev/context/api";
3265
+ import { ApiClient as ApiClient16 } from "@uniformdev/context/api";
3244
3266
  var ROUTE_URL = "/api/v1/route";
3245
- var RouteClient = class extends ApiClient15 {
3267
+ var RouteClient = class extends ApiClient16 {
3246
3268
  constructor(options) {
3247
3269
  var _a;
3248
3270
  if (!options.limitPolicy) {
@@ -3617,12 +3639,12 @@ function handleRichTextNodeBinding(object, options) {
3617
3639
  import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
3618
3640
 
3619
3641
  // src/.version.ts
3620
- var version = "20.51.0";
3642
+ var version = "20.53.0";
3621
3643
 
3622
3644
  // src/WorkflowClient.ts
3623
- import { ApiClient as ApiClient16 } from "@uniformdev/context/api";
3645
+ import { ApiClient as ApiClient17 } from "@uniformdev/context/api";
3624
3646
  var workflowsUrl = "/api/v1/workflows";
3625
- var WorkflowClient = class extends ApiClient16 {
3647
+ var WorkflowClient = class extends ApiClient17 {
3626
3648
  constructor(options) {
3627
3649
  super(options);
3628
3650
  }
@@ -3726,11 +3748,13 @@ export {
3726
3748
  IS_RENDERED_BY_UNIFORM_ATTRIBUTE,
3727
3749
  IntegrationPropertyEditorsClient,
3728
3750
  LOCALE_DYNAMIC_INPUT_NAME,
3751
+ LabelClient,
3729
3752
  LocaleClient,
3730
3753
  PLACEHOLDER_ID,
3731
3754
  PreviewClient,
3732
3755
  ProjectClient,
3733
3756
  PromptClient,
3757
+ REFERENCE_DATA_TYPE_ID,
3734
3758
  RelationshipClient,
3735
3759
  ReleaseClient,
3736
3760
  ReleaseContentsClient,
@@ -3739,6 +3763,7 @@ export {
3739
3763
  UncachedCanvasClient,
3740
3764
  UncachedCategoryClient,
3741
3765
  UncachedContentClient,
3766
+ UncachedLabelClient,
3742
3767
  UniqueBatchEntries,
3743
3768
  WorkflowClient,
3744
3769
  autoFixParameterGroups,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas",
3
- "version": "20.51.0",
3
+ "version": "20.53.1-alpha.7+1c3bd56284",
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.51.0",
45
- "@uniformdev/context": "20.51.0",
46
- "@uniformdev/richtext": "20.51.0",
44
+ "@uniformdev/assets": "20.53.1-alpha.7+1c3bd56284",
45
+ "@uniformdev/context": "20.53.1-alpha.7+1c3bd56284",
46
+ "@uniformdev/richtext": "20.53.1-alpha.7+1c3bd56284",
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": "4e1041ff207d9098efcdca31686c5d58615315b3"
55
+ "gitHead": "1c3bd56284db96f16318a18e62b3b6e83cb09f9b"
56
56
  }