@uniformdev/canvas 18.38.2-alpha.6 → 19.1.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
@@ -470,17 +470,9 @@ var CanvasClient = class extends ApiClient {
470
470
  getCompositionByNodePath(options) {
471
471
  return this.getOneComposition(options);
472
472
  }
473
- /** @deprecated use getCompositionByNodePath instead */
474
- unstable_getCompositionByNodePath(options) {
475
- return this.getOneComposition(options);
476
- }
477
473
  getCompositionByNodeId(options) {
478
474
  return this.getOneComposition(options);
479
475
  }
480
- /** @deprecated Use getCompositionByNodeId instead */
481
- unstable_getCompositionByNodeId(options) {
482
- return this.getOneComposition(options);
483
- }
484
476
  getCompositionBySlug(options) {
485
477
  return this.getOneComposition(options);
486
478
  }
@@ -488,13 +480,13 @@ var CanvasClient = class extends ApiClient {
488
480
  return this.getOneComposition(options);
489
481
  }
490
482
  getOneComposition({
491
- unstable_resolveData: resolveData,
483
+ skipDataResolution,
492
484
  unstable_dynamicVariables: dynamicVariables,
493
- unstable_diagnostics: diagnostics,
485
+ diagnostics,
494
486
  ...params
495
487
  }) {
496
488
  const { projectId } = this.options;
497
- if (!resolveData) {
489
+ if (skipDataResolution) {
498
490
  return this.apiClient(this.createUrl(CANVAS_URL, { ...params, projectId }));
499
491
  }
500
492
  const edgeParams = {
@@ -556,11 +548,74 @@ var UncachedCanvasClient = class extends CanvasClient {
556
548
  }
557
549
  };
558
550
 
559
- // src/DataSourceClient.ts
551
+ // src/CompositionRelationshipClient.ts
560
552
  import { ApiClient as ApiClient2 } from "@uniformdev/context/api";
553
+ var COMPOSITION_RELATIONSHIP_URL = "/api/v1/composition-relationships";
554
+ var unstable_CompositionRelationshipClient = class extends ApiClient2 {
555
+ constructor(options) {
556
+ super(options);
557
+ this.getDefinitionsRelationships = async ({
558
+ definitionIds,
559
+ withCompositions
560
+ }) => {
561
+ const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL, {
562
+ type: "definition",
563
+ projectId: this._options.projectId,
564
+ definitionIds: definitionIds.join(","),
565
+ withCompositions
566
+ });
567
+ return this.apiClient(url);
568
+ };
569
+ this.clearAllRelationships = async () => {
570
+ const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL);
571
+ return this.apiClient(url, {
572
+ method: "POST",
573
+ body: JSON.stringify({
574
+ type: "clear",
575
+ projectId: this._options.projectId
576
+ })
577
+ });
578
+ };
579
+ this.indexCompositionRelationships = async ({
580
+ state,
581
+ compositionId
582
+ }) => {
583
+ const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL);
584
+ return this.apiClient(url, {
585
+ method: "POST",
586
+ body: JSON.stringify({
587
+ type: "index",
588
+ projectId: this._options.projectId,
589
+ state,
590
+ compositionId
591
+ })
592
+ });
593
+ };
594
+ this.getVersion = async () => {
595
+ const url = this.createUrl("/api/v1/usage-tracking", {
596
+ projectId: this._options.projectId
597
+ });
598
+ return this.apiClient(url).then((response) => response.version);
599
+ };
600
+ this.setVersion = async (version) => {
601
+ const url = this.createUrl("/api/v1/usage-tracking");
602
+ return this.apiClient(url, {
603
+ method: "POST",
604
+ body: JSON.stringify({
605
+ projectId: this._options.projectId,
606
+ version
607
+ })
608
+ });
609
+ };
610
+ this._options = options;
611
+ }
612
+ };
613
+
614
+ // src/DataSourceClient.ts
615
+ import { ApiClient as ApiClient3 } from "@uniformdev/context/api";
561
616
  var dataSourceUrl = "/api/v1/data-source";
562
617
  var dataSourcesUrl = "/api/v1/data-sources";
563
- var DataSourceClient = class extends ApiClient2 {
618
+ var DataSourceClient = class extends ApiClient3 {
564
619
  constructor(options) {
565
620
  super(options);
566
621
  }
@@ -597,9 +652,9 @@ var DataSourceClient = class extends ApiClient2 {
597
652
  };
598
653
 
599
654
  // src/DataTypeClient.ts
600
- import { ApiClient as ApiClient3 } from "@uniformdev/context/api";
655
+ import { ApiClient as ApiClient4 } from "@uniformdev/context/api";
601
656
  var _url;
602
- var _DataTypeClient = class extends ApiClient3 {
657
+ var _DataTypeClient = class extends ApiClient4 {
603
658
  constructor(options) {
604
659
  super(options);
605
660
  }
@@ -1583,5 +1638,6 @@ export {
1583
1638
  mapSlotToTestVariations,
1584
1639
  nullLimitPolicy,
1585
1640
  subscribeToComposition,
1641
+ unstable_CompositionRelationshipClient,
1586
1642
  walkComponentTree
1587
1643
  };
package/dist/index.js CHANGED
@@ -274,7 +274,7 @@ var require_retry2 = __commonJS({
274
274
  // src/index.ts
275
275
  var src_exports = {};
276
276
  __export(src_exports, {
277
- ApiClientError: () => import_api4.ApiClientError,
277
+ ApiClientError: () => import_api5.ApiClientError,
278
278
  BatchEntry: () => BatchEntry,
279
279
  CANVAS_DRAFT_STATE: () => CANVAS_DRAFT_STATE,
280
280
  CANVAS_ENRICHMENT_TAG_PARAM: () => CANVAS_ENRICHMENT_TAG_PARAM,
@@ -336,6 +336,7 @@ __export(src_exports, {
336
336
  mapSlotToTestVariations: () => mapSlotToTestVariations,
337
337
  nullLimitPolicy: () => nullLimitPolicy,
338
338
  subscribeToComposition: () => subscribeToComposition,
339
+ unstable_CompositionRelationshipClient: () => unstable_CompositionRelationshipClient,
339
340
  walkComponentTree: () => walkComponentTree
340
341
  });
341
342
  module.exports = __toCommonJS(src_exports);
@@ -545,17 +546,9 @@ var CanvasClient = class extends import_api.ApiClient {
545
546
  getCompositionByNodePath(options) {
546
547
  return this.getOneComposition(options);
547
548
  }
548
- /** @deprecated use getCompositionByNodePath instead */
549
- unstable_getCompositionByNodePath(options) {
550
- return this.getOneComposition(options);
551
- }
552
549
  getCompositionByNodeId(options) {
553
550
  return this.getOneComposition(options);
554
551
  }
555
- /** @deprecated Use getCompositionByNodeId instead */
556
- unstable_getCompositionByNodeId(options) {
557
- return this.getOneComposition(options);
558
- }
559
552
  getCompositionBySlug(options) {
560
553
  return this.getOneComposition(options);
561
554
  }
@@ -563,13 +556,13 @@ var CanvasClient = class extends import_api.ApiClient {
563
556
  return this.getOneComposition(options);
564
557
  }
565
558
  getOneComposition({
566
- unstable_resolveData: resolveData,
559
+ skipDataResolution,
567
560
  unstable_dynamicVariables: dynamicVariables,
568
- unstable_diagnostics: diagnostics,
561
+ diagnostics,
569
562
  ...params
570
563
  }) {
571
564
  const { projectId } = this.options;
572
- if (!resolveData) {
565
+ if (skipDataResolution) {
573
566
  return this.apiClient(this.createUrl(CANVAS_URL, { ...params, projectId }));
574
567
  }
575
568
  const edgeParams = {
@@ -631,11 +624,74 @@ var UncachedCanvasClient = class extends CanvasClient {
631
624
  }
632
625
  };
633
626
 
634
- // src/DataSourceClient.ts
627
+ // src/CompositionRelationshipClient.ts
635
628
  var import_api2 = require("@uniformdev/context/api");
629
+ var COMPOSITION_RELATIONSHIP_URL = "/api/v1/composition-relationships";
630
+ var unstable_CompositionRelationshipClient = class extends import_api2.ApiClient {
631
+ constructor(options) {
632
+ super(options);
633
+ this.getDefinitionsRelationships = async ({
634
+ definitionIds,
635
+ withCompositions
636
+ }) => {
637
+ const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL, {
638
+ type: "definition",
639
+ projectId: this._options.projectId,
640
+ definitionIds: definitionIds.join(","),
641
+ withCompositions
642
+ });
643
+ return this.apiClient(url);
644
+ };
645
+ this.clearAllRelationships = async () => {
646
+ const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL);
647
+ return this.apiClient(url, {
648
+ method: "POST",
649
+ body: JSON.stringify({
650
+ type: "clear",
651
+ projectId: this._options.projectId
652
+ })
653
+ });
654
+ };
655
+ this.indexCompositionRelationships = async ({
656
+ state,
657
+ compositionId
658
+ }) => {
659
+ const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL);
660
+ return this.apiClient(url, {
661
+ method: "POST",
662
+ body: JSON.stringify({
663
+ type: "index",
664
+ projectId: this._options.projectId,
665
+ state,
666
+ compositionId
667
+ })
668
+ });
669
+ };
670
+ this.getVersion = async () => {
671
+ const url = this.createUrl("/api/v1/usage-tracking", {
672
+ projectId: this._options.projectId
673
+ });
674
+ return this.apiClient(url).then((response) => response.version);
675
+ };
676
+ this.setVersion = async (version) => {
677
+ const url = this.createUrl("/api/v1/usage-tracking");
678
+ return this.apiClient(url, {
679
+ method: "POST",
680
+ body: JSON.stringify({
681
+ projectId: this._options.projectId,
682
+ version
683
+ })
684
+ });
685
+ };
686
+ this._options = options;
687
+ }
688
+ };
689
+
690
+ // src/DataSourceClient.ts
691
+ var import_api3 = require("@uniformdev/context/api");
636
692
  var dataSourceUrl = "/api/v1/data-source";
637
693
  var dataSourcesUrl = "/api/v1/data-sources";
638
- var DataSourceClient = class extends import_api2.ApiClient {
694
+ var DataSourceClient = class extends import_api3.ApiClient {
639
695
  constructor(options) {
640
696
  super(options);
641
697
  }
@@ -672,9 +728,9 @@ var DataSourceClient = class extends import_api2.ApiClient {
672
728
  };
673
729
 
674
730
  // src/DataTypeClient.ts
675
- var import_api3 = require("@uniformdev/context/api");
731
+ var import_api4 = require("@uniformdev/context/api");
676
732
  var _url;
677
- var _DataTypeClient = class extends import_api3.ApiClient {
733
+ var _DataTypeClient = class extends import_api4.ApiClient {
678
734
  constructor(options) {
679
735
  super(options);
680
736
  }
@@ -1593,8 +1649,8 @@ function mapSlotToTestVariations(slot) {
1593
1649
  }
1594
1650
 
1595
1651
  // src/index.ts
1596
- var import_api4 = require("@uniformdev/context/api");
1597
- var CanvasClientError = import_api4.ApiClientError;
1652
+ var import_api5 = require("@uniformdev/context/api");
1653
+ var CanvasClientError = import_api5.ApiClientError;
1598
1654
  // Annotate the CommonJS export names for ESM import in node:
1599
1655
  0 && (module.exports = {
1600
1656
  ApiClientError,
@@ -1659,5 +1715,6 @@ var CanvasClientError = import_api4.ApiClientError;
1659
1715
  mapSlotToTestVariations,
1660
1716
  nullLimitPolicy,
1661
1717
  subscribeToComposition,
1718
+ unstable_CompositionRelationshipClient,
1662
1719
  walkComponentTree
1663
1720
  });
package/dist/index.mjs CHANGED
@@ -470,17 +470,9 @@ var CanvasClient = class extends ApiClient {
470
470
  getCompositionByNodePath(options) {
471
471
  return this.getOneComposition(options);
472
472
  }
473
- /** @deprecated use getCompositionByNodePath instead */
474
- unstable_getCompositionByNodePath(options) {
475
- return this.getOneComposition(options);
476
- }
477
473
  getCompositionByNodeId(options) {
478
474
  return this.getOneComposition(options);
479
475
  }
480
- /** @deprecated Use getCompositionByNodeId instead */
481
- unstable_getCompositionByNodeId(options) {
482
- return this.getOneComposition(options);
483
- }
484
476
  getCompositionBySlug(options) {
485
477
  return this.getOneComposition(options);
486
478
  }
@@ -488,13 +480,13 @@ var CanvasClient = class extends ApiClient {
488
480
  return this.getOneComposition(options);
489
481
  }
490
482
  getOneComposition({
491
- unstable_resolveData: resolveData,
483
+ skipDataResolution,
492
484
  unstable_dynamicVariables: dynamicVariables,
493
- unstable_diagnostics: diagnostics,
485
+ diagnostics,
494
486
  ...params
495
487
  }) {
496
488
  const { projectId } = this.options;
497
- if (!resolveData) {
489
+ if (skipDataResolution) {
498
490
  return this.apiClient(this.createUrl(CANVAS_URL, { ...params, projectId }));
499
491
  }
500
492
  const edgeParams = {
@@ -556,11 +548,74 @@ var UncachedCanvasClient = class extends CanvasClient {
556
548
  }
557
549
  };
558
550
 
559
- // src/DataSourceClient.ts
551
+ // src/CompositionRelationshipClient.ts
560
552
  import { ApiClient as ApiClient2 } from "@uniformdev/context/api";
553
+ var COMPOSITION_RELATIONSHIP_URL = "/api/v1/composition-relationships";
554
+ var unstable_CompositionRelationshipClient = class extends ApiClient2 {
555
+ constructor(options) {
556
+ super(options);
557
+ this.getDefinitionsRelationships = async ({
558
+ definitionIds,
559
+ withCompositions
560
+ }) => {
561
+ const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL, {
562
+ type: "definition",
563
+ projectId: this._options.projectId,
564
+ definitionIds: definitionIds.join(","),
565
+ withCompositions
566
+ });
567
+ return this.apiClient(url);
568
+ };
569
+ this.clearAllRelationships = async () => {
570
+ const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL);
571
+ return this.apiClient(url, {
572
+ method: "POST",
573
+ body: JSON.stringify({
574
+ type: "clear",
575
+ projectId: this._options.projectId
576
+ })
577
+ });
578
+ };
579
+ this.indexCompositionRelationships = async ({
580
+ state,
581
+ compositionId
582
+ }) => {
583
+ const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL);
584
+ return this.apiClient(url, {
585
+ method: "POST",
586
+ body: JSON.stringify({
587
+ type: "index",
588
+ projectId: this._options.projectId,
589
+ state,
590
+ compositionId
591
+ })
592
+ });
593
+ };
594
+ this.getVersion = async () => {
595
+ const url = this.createUrl("/api/v1/usage-tracking", {
596
+ projectId: this._options.projectId
597
+ });
598
+ return this.apiClient(url).then((response) => response.version);
599
+ };
600
+ this.setVersion = async (version) => {
601
+ const url = this.createUrl("/api/v1/usage-tracking");
602
+ return this.apiClient(url, {
603
+ method: "POST",
604
+ body: JSON.stringify({
605
+ projectId: this._options.projectId,
606
+ version
607
+ })
608
+ });
609
+ };
610
+ this._options = options;
611
+ }
612
+ };
613
+
614
+ // src/DataSourceClient.ts
615
+ import { ApiClient as ApiClient3 } from "@uniformdev/context/api";
561
616
  var dataSourceUrl = "/api/v1/data-source";
562
617
  var dataSourcesUrl = "/api/v1/data-sources";
563
- var DataSourceClient = class extends ApiClient2 {
618
+ var DataSourceClient = class extends ApiClient3 {
564
619
  constructor(options) {
565
620
  super(options);
566
621
  }
@@ -597,9 +652,9 @@ var DataSourceClient = class extends ApiClient2 {
597
652
  };
598
653
 
599
654
  // src/DataTypeClient.ts
600
- import { ApiClient as ApiClient3 } from "@uniformdev/context/api";
655
+ import { ApiClient as ApiClient4 } from "@uniformdev/context/api";
601
656
  var _url;
602
- var _DataTypeClient = class extends ApiClient3 {
657
+ var _DataTypeClient = class extends ApiClient4 {
603
658
  constructor(options) {
604
659
  super(options);
605
660
  }
@@ -1583,5 +1638,6 @@ export {
1583
1638
  mapSlotToTestVariations,
1584
1639
  nullLimitPolicy,
1585
1640
  subscribeToComposition,
1641
+ unstable_CompositionRelationshipClient,
1586
1642
  walkComponentTree
1587
1643
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas",
3
- "version": "18.38.2-alpha.6+d4938f167",
3
+ "version": "19.1.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",
@@ -47,7 +47,7 @@
47
47
  "pusher-js": "8.0.1"
48
48
  },
49
49
  "dependencies": {
50
- "@uniformdev/context": "18.38.2-alpha.6+d4938f167"
50
+ "@uniformdev/context": "19.1.0"
51
51
  },
52
52
  "files": [
53
53
  "/dist"
@@ -55,5 +55,5 @@
55
55
  "publishConfig": {
56
56
  "access": "public"
57
57
  },
58
- "gitHead": "d4938f167d196bbd523e6cdd031f56fab4ceebf6"
58
+ "gitHead": "0a06bc3cbf5a3ef7eb72b7ba237e76df645a4a88"
59
59
  }