@uniformdev/canvas 19.35.2 → 19.36.0

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
@@ -557,10 +557,53 @@ var UncachedCanvasClient = class extends CanvasClient {
557
557
  }
558
558
  };
559
559
 
560
- // src/CompositionRelationshipClient.ts
560
+ // src/CategoryClient.ts
561
561
  import { ApiClient as ApiClient2 } from "@uniformdev/context/api";
562
+ var CATEGORIES_URL = "/api/v1/categories";
563
+ var CategoryClient = class extends ApiClient2 {
564
+ constructor(options) {
565
+ if (!options.limitPolicy) {
566
+ options.limitPolicy = createLimitPolicy({});
567
+ }
568
+ super(options);
569
+ }
570
+ /** Fetches all categories created in given project */
571
+ async getCategories(options) {
572
+ const { projectId } = this.options;
573
+ const fetchUri = this.createUrl("/api/v1/categories", { ...options, projectId });
574
+ return await this.apiClient(fetchUri);
575
+ }
576
+ /** Updates or creates a category, also used to re-order them */
577
+ async upsertCategories(categories) {
578
+ const { projectId } = this.options;
579
+ const fetchUri = this.createUrl(CATEGORIES_URL);
580
+ return await this.apiClient(fetchUri, {
581
+ method: "PUT",
582
+ body: JSON.stringify({ categories, projectId }),
583
+ expectNoContent: true
584
+ });
585
+ }
586
+ /** Deletes a category */
587
+ async removeCategory(options) {
588
+ const { projectId } = this.options;
589
+ const fetchUri = this.createUrl(CATEGORIES_URL);
590
+ return await this.apiClient(fetchUri, {
591
+ method: "DELETE",
592
+ body: JSON.stringify({ projectId, categoryId: options.categoryId }),
593
+ expectNoContent: true
594
+ });
595
+ }
596
+ };
597
+ var UncachedCategoryClient = class extends CategoryClient {
598
+ constructor(options) {
599
+ super({ ...options, bypassCache: true });
600
+ }
601
+ };
602
+
603
+ // src/CompositionRelationshipClient.ts
604
+ import { ApiClient as ApiClient3 } from "@uniformdev/context/api";
562
605
  var COMPOSITION_RELATIONSHIP_URL = "/api/v1/composition-relationships";
563
- var unstable_CompositionRelationshipClient = class extends ApiClient2 {
606
+ var unstable_CompositionRelationshipClient = class extends ApiClient3 {
564
607
  constructor(options) {
565
608
  super(options);
566
609
  this.getDefinitionsRelationships = async ({
@@ -621,10 +664,10 @@ var unstable_CompositionRelationshipClient = class extends ApiClient2 {
621
664
  };
622
665
 
623
666
  // src/DataSourceClient.ts
624
- import { ApiClient as ApiClient3 } from "@uniformdev/context/api";
667
+ import { ApiClient as ApiClient4 } from "@uniformdev/context/api";
625
668
  var dataSourceUrl = "/api/v1/data-source";
626
669
  var dataSourcesUrl = "/api/v1/data-sources";
627
- var DataSourceClient = class extends ApiClient3 {
670
+ var DataSourceClient = class extends ApiClient4 {
628
671
  constructor(options) {
629
672
  super(options);
630
673
  }
@@ -661,9 +704,9 @@ var DataSourceClient = class extends ApiClient3 {
661
704
  };
662
705
 
663
706
  // src/DataTypeClient.ts
664
- import { ApiClient as ApiClient4 } from "@uniformdev/context/api";
707
+ import { ApiClient as ApiClient5 } from "@uniformdev/context/api";
665
708
  var _url;
666
- var _DataTypeClient = class _DataTypeClient extends ApiClient4 {
709
+ var _DataTypeClient = class _DataTypeClient extends ApiClient5 {
667
710
  constructor(options) {
668
711
  super(options);
669
712
  }
@@ -1580,9 +1623,9 @@ function subscribeToComposition({
1580
1623
  }
1581
1624
 
1582
1625
  // src/RouteClient.ts
1583
- import { ApiClient as ApiClient5 } from "@uniformdev/context/api";
1626
+ import { ApiClient as ApiClient6 } from "@uniformdev/context/api";
1584
1627
  var ROUTE_URL = "/api/v1/route";
1585
- var RouteClient = class extends ApiClient5 {
1628
+ var RouteClient = class extends ApiClient6 {
1586
1629
  constructor(options) {
1587
1630
  var _a;
1588
1631
  if (!options.limitPolicy) {
@@ -1789,6 +1832,7 @@ export {
1789
1832
  CANVAS_TEST_VARIANT_PARAM,
1790
1833
  CanvasClient,
1791
1834
  CanvasClientError,
1835
+ CategoryClient,
1792
1836
  ChildEnhancerBuilder,
1793
1837
  DataSourceClient,
1794
1838
  DataTypeClient,
@@ -1809,6 +1853,7 @@ export {
1809
1853
  PLACEHOLDER_ID,
1810
1854
  RouteClient,
1811
1855
  UncachedCanvasClient,
1856
+ UncachedCategoryClient,
1812
1857
  UniqueBatchEntries,
1813
1858
  bindVariables,
1814
1859
  bindVariablesToObject,
package/dist/index.js CHANGED
@@ -283,7 +283,7 @@ __export(src_exports, {
283
283
  ATTRIBUTE_PARAMETER_TYPE: () => ATTRIBUTE_PARAMETER_TYPE,
284
284
  ATTRIBUTE_PARAMETER_VALUE: () => ATTRIBUTE_PARAMETER_VALUE,
285
285
  ATTRIBUTE_PLACEHOLDER: () => ATTRIBUTE_PLACEHOLDER,
286
- ApiClientError: () => import_api6.ApiClientError,
286
+ ApiClientError: () => import_api7.ApiClientError,
287
287
  BatchEntry: () => BatchEntry,
288
288
  CANVAS_DRAFT_STATE: () => CANVAS_DRAFT_STATE,
289
289
  CANVAS_ENRICHMENT_TAG_PARAM: () => CANVAS_ENRICHMENT_TAG_PARAM,
@@ -300,6 +300,7 @@ __export(src_exports, {
300
300
  CANVAS_TEST_VARIANT_PARAM: () => CANVAS_TEST_VARIANT_PARAM,
301
301
  CanvasClient: () => CanvasClient,
302
302
  CanvasClientError: () => CanvasClientError,
303
+ CategoryClient: () => CategoryClient,
303
304
  ChildEnhancerBuilder: () => ChildEnhancerBuilder,
304
305
  DataSourceClient: () => DataSourceClient,
305
306
  DataTypeClient: () => DataTypeClient,
@@ -320,6 +321,7 @@ __export(src_exports, {
320
321
  PLACEHOLDER_ID: () => PLACEHOLDER_ID,
321
322
  RouteClient: () => RouteClient,
322
323
  UncachedCanvasClient: () => UncachedCanvasClient,
324
+ UncachedCategoryClient: () => UncachedCategoryClient,
323
325
  UniqueBatchEntries: () => UniqueBatchEntries,
324
326
  bindVariables: () => bindVariables,
325
327
  bindVariablesToObject: () => bindVariablesToObject,
@@ -649,10 +651,53 @@ var UncachedCanvasClient = class extends CanvasClient {
649
651
  }
650
652
  };
651
653
 
652
- // src/CompositionRelationshipClient.ts
654
+ // src/CategoryClient.ts
653
655
  var import_api2 = require("@uniformdev/context/api");
656
+ var CATEGORIES_URL = "/api/v1/categories";
657
+ var CategoryClient = class extends import_api2.ApiClient {
658
+ constructor(options) {
659
+ if (!options.limitPolicy) {
660
+ options.limitPolicy = createLimitPolicy({});
661
+ }
662
+ super(options);
663
+ }
664
+ /** Fetches all categories created in given project */
665
+ async getCategories(options) {
666
+ const { projectId } = this.options;
667
+ const fetchUri = this.createUrl("/api/v1/categories", { ...options, projectId });
668
+ return await this.apiClient(fetchUri);
669
+ }
670
+ /** Updates or creates a category, also used to re-order them */
671
+ async upsertCategories(categories) {
672
+ const { projectId } = this.options;
673
+ const fetchUri = this.createUrl(CATEGORIES_URL);
674
+ return await this.apiClient(fetchUri, {
675
+ method: "PUT",
676
+ body: JSON.stringify({ categories, projectId }),
677
+ expectNoContent: true
678
+ });
679
+ }
680
+ /** Deletes a category */
681
+ async removeCategory(options) {
682
+ const { projectId } = this.options;
683
+ const fetchUri = this.createUrl(CATEGORIES_URL);
684
+ return await this.apiClient(fetchUri, {
685
+ method: "DELETE",
686
+ body: JSON.stringify({ projectId, categoryId: options.categoryId }),
687
+ expectNoContent: true
688
+ });
689
+ }
690
+ };
691
+ var UncachedCategoryClient = class extends CategoryClient {
692
+ constructor(options) {
693
+ super({ ...options, bypassCache: true });
694
+ }
695
+ };
696
+
697
+ // src/CompositionRelationshipClient.ts
698
+ var import_api3 = require("@uniformdev/context/api");
654
699
  var COMPOSITION_RELATIONSHIP_URL = "/api/v1/composition-relationships";
655
- var unstable_CompositionRelationshipClient = class extends import_api2.ApiClient {
700
+ var unstable_CompositionRelationshipClient = class extends import_api3.ApiClient {
656
701
  constructor(options) {
657
702
  super(options);
658
703
  this.getDefinitionsRelationships = async ({
@@ -713,10 +758,10 @@ var unstable_CompositionRelationshipClient = class extends import_api2.ApiClient
713
758
  };
714
759
 
715
760
  // src/DataSourceClient.ts
716
- var import_api3 = require("@uniformdev/context/api");
761
+ var import_api4 = require("@uniformdev/context/api");
717
762
  var dataSourceUrl = "/api/v1/data-source";
718
763
  var dataSourcesUrl = "/api/v1/data-sources";
719
- var DataSourceClient = class extends import_api3.ApiClient {
764
+ var DataSourceClient = class extends import_api4.ApiClient {
720
765
  constructor(options) {
721
766
  super(options);
722
767
  }
@@ -753,9 +798,9 @@ var DataSourceClient = class extends import_api3.ApiClient {
753
798
  };
754
799
 
755
800
  // src/DataTypeClient.ts
756
- var import_api4 = require("@uniformdev/context/api");
801
+ var import_api5 = require("@uniformdev/context/api");
757
802
  var _url;
758
- var _DataTypeClient = class _DataTypeClient extends import_api4.ApiClient {
803
+ var _DataTypeClient = class _DataTypeClient extends import_api5.ApiClient {
759
804
  constructor(options) {
760
805
  super(options);
761
806
  }
@@ -1672,9 +1717,9 @@ function subscribeToComposition({
1672
1717
  }
1673
1718
 
1674
1719
  // src/RouteClient.ts
1675
- var import_api5 = require("@uniformdev/context/api");
1720
+ var import_api6 = require("@uniformdev/context/api");
1676
1721
  var ROUTE_URL = "/api/v1/route";
1677
- var RouteClient = class extends import_api5.ApiClient {
1722
+ var RouteClient = class extends import_api6.ApiClient {
1678
1723
  constructor(options) {
1679
1724
  var _a;
1680
1725
  if (!options.limitPolicy) {
@@ -1855,8 +1900,8 @@ function mapSlotToTestVariations(slot) {
1855
1900
  }
1856
1901
 
1857
1902
  // src/index.ts
1858
- var import_api6 = require("@uniformdev/context/api");
1859
- var CanvasClientError = import_api6.ApiClientError;
1903
+ var import_api7 = require("@uniformdev/context/api");
1904
+ var CanvasClientError = import_api7.ApiClientError;
1860
1905
  // Annotate the CommonJS export names for ESM import in node:
1861
1906
  0 && (module.exports = {
1862
1907
  ATTRIBUTE_COMPONENT_ID,
@@ -1882,6 +1927,7 @@ var CanvasClientError = import_api6.ApiClientError;
1882
1927
  CANVAS_TEST_VARIANT_PARAM,
1883
1928
  CanvasClient,
1884
1929
  CanvasClientError,
1930
+ CategoryClient,
1885
1931
  ChildEnhancerBuilder,
1886
1932
  DataSourceClient,
1887
1933
  DataTypeClient,
@@ -1902,6 +1948,7 @@ var CanvasClientError = import_api6.ApiClientError;
1902
1948
  PLACEHOLDER_ID,
1903
1949
  RouteClient,
1904
1950
  UncachedCanvasClient,
1951
+ UncachedCategoryClient,
1905
1952
  UniqueBatchEntries,
1906
1953
  bindVariables,
1907
1954
  bindVariablesToObject,
package/dist/index.mjs CHANGED
@@ -557,10 +557,53 @@ var UncachedCanvasClient = class extends CanvasClient {
557
557
  }
558
558
  };
559
559
 
560
- // src/CompositionRelationshipClient.ts
560
+ // src/CategoryClient.ts
561
561
  import { ApiClient as ApiClient2 } from "@uniformdev/context/api";
562
+ var CATEGORIES_URL = "/api/v1/categories";
563
+ var CategoryClient = class extends ApiClient2 {
564
+ constructor(options) {
565
+ if (!options.limitPolicy) {
566
+ options.limitPolicy = createLimitPolicy({});
567
+ }
568
+ super(options);
569
+ }
570
+ /** Fetches all categories created in given project */
571
+ async getCategories(options) {
572
+ const { projectId } = this.options;
573
+ const fetchUri = this.createUrl("/api/v1/categories", { ...options, projectId });
574
+ return await this.apiClient(fetchUri);
575
+ }
576
+ /** Updates or creates a category, also used to re-order them */
577
+ async upsertCategories(categories) {
578
+ const { projectId } = this.options;
579
+ const fetchUri = this.createUrl(CATEGORIES_URL);
580
+ return await this.apiClient(fetchUri, {
581
+ method: "PUT",
582
+ body: JSON.stringify({ categories, projectId }),
583
+ expectNoContent: true
584
+ });
585
+ }
586
+ /** Deletes a category */
587
+ async removeCategory(options) {
588
+ const { projectId } = this.options;
589
+ const fetchUri = this.createUrl(CATEGORIES_URL);
590
+ return await this.apiClient(fetchUri, {
591
+ method: "DELETE",
592
+ body: JSON.stringify({ projectId, categoryId: options.categoryId }),
593
+ expectNoContent: true
594
+ });
595
+ }
596
+ };
597
+ var UncachedCategoryClient = class extends CategoryClient {
598
+ constructor(options) {
599
+ super({ ...options, bypassCache: true });
600
+ }
601
+ };
602
+
603
+ // src/CompositionRelationshipClient.ts
604
+ import { ApiClient as ApiClient3 } from "@uniformdev/context/api";
562
605
  var COMPOSITION_RELATIONSHIP_URL = "/api/v1/composition-relationships";
563
- var unstable_CompositionRelationshipClient = class extends ApiClient2 {
606
+ var unstable_CompositionRelationshipClient = class extends ApiClient3 {
564
607
  constructor(options) {
565
608
  super(options);
566
609
  this.getDefinitionsRelationships = async ({
@@ -621,10 +664,10 @@ var unstable_CompositionRelationshipClient = class extends ApiClient2 {
621
664
  };
622
665
 
623
666
  // src/DataSourceClient.ts
624
- import { ApiClient as ApiClient3 } from "@uniformdev/context/api";
667
+ import { ApiClient as ApiClient4 } from "@uniformdev/context/api";
625
668
  var dataSourceUrl = "/api/v1/data-source";
626
669
  var dataSourcesUrl = "/api/v1/data-sources";
627
- var DataSourceClient = class extends ApiClient3 {
670
+ var DataSourceClient = class extends ApiClient4 {
628
671
  constructor(options) {
629
672
  super(options);
630
673
  }
@@ -661,9 +704,9 @@ var DataSourceClient = class extends ApiClient3 {
661
704
  };
662
705
 
663
706
  // src/DataTypeClient.ts
664
- import { ApiClient as ApiClient4 } from "@uniformdev/context/api";
707
+ import { ApiClient as ApiClient5 } from "@uniformdev/context/api";
665
708
  var _url;
666
- var _DataTypeClient = class _DataTypeClient extends ApiClient4 {
709
+ var _DataTypeClient = class _DataTypeClient extends ApiClient5 {
667
710
  constructor(options) {
668
711
  super(options);
669
712
  }
@@ -1580,9 +1623,9 @@ function subscribeToComposition({
1580
1623
  }
1581
1624
 
1582
1625
  // src/RouteClient.ts
1583
- import { ApiClient as ApiClient5 } from "@uniformdev/context/api";
1626
+ import { ApiClient as ApiClient6 } from "@uniformdev/context/api";
1584
1627
  var ROUTE_URL = "/api/v1/route";
1585
- var RouteClient = class extends ApiClient5 {
1628
+ var RouteClient = class extends ApiClient6 {
1586
1629
  constructor(options) {
1587
1630
  var _a;
1588
1631
  if (!options.limitPolicy) {
@@ -1789,6 +1832,7 @@ export {
1789
1832
  CANVAS_TEST_VARIANT_PARAM,
1790
1833
  CanvasClient,
1791
1834
  CanvasClientError,
1835
+ CategoryClient,
1792
1836
  ChildEnhancerBuilder,
1793
1837
  DataSourceClient,
1794
1838
  DataTypeClient,
@@ -1809,6 +1853,7 @@ export {
1809
1853
  PLACEHOLDER_ID,
1810
1854
  RouteClient,
1811
1855
  UncachedCanvasClient,
1856
+ UncachedCategoryClient,
1812
1857
  UniqueBatchEntries,
1813
1858
  bindVariables,
1814
1859
  bindVariablesToObject,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas",
3
- "version": "19.35.2",
3
+ "version": "19.36.0",
4
4
  "description": "Common functionality and types for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -38,7 +38,7 @@
38
38
  "pusher-js": "8.2.0"
39
39
  },
40
40
  "dependencies": {
41
- "@uniformdev/context": "19.35.2",
41
+ "@uniformdev/context": "19.36.0",
42
42
  "immer": "9.0.21"
43
43
  },
44
44
  "files": [
@@ -47,5 +47,5 @@
47
47
  "publishConfig": {
48
48
  "access": "public"
49
49
  },
50
- "gitHead": "64d3270175087c87cfaa29a283aa4a7b0a98fd2c"
50
+ "gitHead": "3ae246a7f0f39adeaf04ecba4c7e48c478c019ad"
51
51
  }