@uniformdev/canvas 19.66.1 → 19.67.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.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { ApiClient, ExceptProject, ClientOptions, ApiClientError } from '@uniformdev/context/api';
2
2
  export { ApiClientError } from '@uniformdev/context/api';
3
+ import { AssetGetResponseSingle } from '@uniformdev/assets';
3
4
  import Pusher from 'pusher-js';
4
5
  import { Options as Options$1 } from 'p-retry';
5
6
  import { Options } from 'p-throttle';
@@ -12758,6 +12759,7 @@ type CanvasDefinitions = {
12758
12759
  contentTypes?: Array<ContentType>;
12759
12760
  entries?: Array<Entry>;
12760
12761
  prompts?: Array<Prompt>;
12762
+ assets?: Array<AssetGetResponseSingle>;
12761
12763
  };
12762
12764
  /** Defines shared parameters for requests getting a single composition */
12763
12765
  type CompositionGetOneSharedParameters = Pick<CompositionGetParameters, 'state' | 'skipEnhance' | 'skipPatternResolution' | 'withComponentIDs' | 'withUIStatus' | 'withTotalCount' | 'skipOverridesResolution' | 'withContentSourceMap' | 'versionId'>;
@@ -12860,138 +12862,12 @@ declare class CanvasClient extends ApiClient<CanvasClientOptions> {
12860
12862
  private edgeApiHost;
12861
12863
  constructor(options: CanvasClientOptions);
12862
12864
  /** Fetches lists of Canvas compositions, optionally by type */
12863
- getCompositionList(options?: Omit<CompositionGetParameters, 'projectId' | 'componentId' | 'compositionId' | 'slug'>): Promise<{
12864
- compositions: {
12865
- state: number;
12866
- uiStatus?: "Draft" | "Modified" | "Published" | "Orphan" | "Previous" | "Unknown" | undefined;
12867
- projectId: string;
12868
- created: string;
12869
- modified: string;
12870
- creator?: string | undefined;
12871
- author?: string | undefined;
12872
- categoryId?: string | undefined;
12873
- description?: string | undefined;
12874
- previewImageUrl?: string | undefined;
12875
- pattern: boolean;
12876
- composition: {
12877
- type: string;
12878
- parameters?: {
12879
- [key: string]: {
12880
- value: unknown;
12881
- type: string;
12882
- connectedData?: {
12883
- pointer: string;
12884
- syntax: "jptr";
12885
- } | undefined;
12886
- };
12887
- } | undefined;
12888
- variant?: string | undefined;
12889
- projectMapNodes?: {
12890
- id: string;
12891
- path: string;
12892
- projectMapId: string;
12893
- }[] | undefined;
12894
- slots?: {
12895
- [key: string]: {
12896
- type: string;
12897
- parameters?: {
12898
- [key: string]: {
12899
- value: unknown;
12900
- type: string;
12901
- connectedData?: {
12902
- pointer: string;
12903
- syntax: "jptr";
12904
- } | undefined;
12905
- };
12906
- } | undefined;
12907
- variant?: string | undefined;
12908
- slots?: {
12909
- [key: string]: any[];
12910
- } | undefined;
12911
- _id?: string | undefined;
12912
- _pattern?: string | undefined;
12913
- _dataResources?: {
12914
- [key: string]: {
12915
- type: string;
12916
- isPatternParameter?: boolean | undefined;
12917
- ignorePatternParameterDefault?: boolean | undefined;
12918
- variables?: {
12919
- [key: string]: string;
12920
- } | undefined;
12921
- };
12922
- } | undefined;
12923
- _patternDataResources?: {
12924
- [key: string]: {
12925
- type: string;
12926
- isPatternParameter?: boolean | undefined;
12927
- ignorePatternParameterDefault?: boolean | undefined;
12928
- variables?: {
12929
- [key: string]: string;
12930
- } | undefined;
12931
- };
12932
- } | undefined;
12933
- _patternError?: "NOTFOUND" | "CYCLIC" | undefined;
12934
- _overrides?: {
12935
- [key: string]: {
12936
- parameters?: {
12937
- [key: string]: {
12938
- value: unknown;
12939
- type: string;
12940
- connectedData?: {
12941
- pointer: string;
12942
- syntax: "jptr";
12943
- } | undefined;
12944
- };
12945
- } | undefined;
12946
- variant?: string | undefined;
12947
- };
12948
- } | undefined;
12949
- _overridability?: {
12950
- parameters?: {
12951
- [key: string]: "no" | "yes";
12952
- } | undefined;
12953
- variants?: boolean | undefined;
12954
- } | undefined;
12955
- }[];
12956
- } | undefined;
12957
- _id: string;
12958
- _slug?: string | null | undefined;
12959
- _name: string;
12960
- _dataResources?: {
12961
- [key: string]: {
12962
- type: string;
12963
- isPatternParameter?: boolean | undefined;
12964
- ignorePatternParameterDefault?: boolean | undefined;
12965
- variables?: {
12966
- [key: string]: string;
12967
- } | undefined;
12968
- };
12969
- } | undefined;
12970
- _overrides?: {
12971
- [key: string]: {
12972
- parameters?: {
12973
- [key: string]: {
12974
- value: unknown;
12975
- type: string;
12976
- connectedData?: {
12977
- pointer: string;
12978
- syntax: "jptr";
12979
- } | undefined;
12980
- };
12981
- } | undefined;
12982
- variant?: string | undefined;
12983
- };
12984
- } | undefined;
12985
- _overridability?: {
12986
- parameters?: {
12987
- [key: string]: "no" | "yes";
12988
- } | undefined;
12989
- variants?: boolean | undefined;
12990
- } | undefined;
12991
- };
12992
- }[];
12993
- totalCount?: number | undefined;
12994
- }>;
12865
+ getCompositionList(params?: Omit<CompositionGetParameters, 'projectId' | 'componentId' | 'compositionId' | 'slug'> & ({
12866
+ resolveData: true;
12867
+ diagnostics?: boolean;
12868
+ } | {
12869
+ resolveData?: false;
12870
+ })): Promise<CompositionGetListResponse | CompositionResolvedListResponse>;
12995
12871
  /** Fetches one composition by its project map node path */
12996
12872
  getCompositionByNodePath(options: CompositionGetByNodePathParameters & DataResolutionOptionNegative): Promise<CompositionGetResponse>;
12997
12873
  getCompositionByNodePath(options: CompositionGetByNodePathParameters & DataResolutionOptionPositive & DataResolutionParameters): Promise<CompositionResolvedGetResponse>;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { ApiClient, ExceptProject, ClientOptions, ApiClientError } from '@uniformdev/context/api';
2
2
  export { ApiClientError } from '@uniformdev/context/api';
3
+ import { AssetGetResponseSingle } from '@uniformdev/assets';
3
4
  import Pusher from 'pusher-js';
4
5
  import { Options as Options$1 } from 'p-retry';
5
6
  import { Options } from 'p-throttle';
@@ -12758,6 +12759,7 @@ type CanvasDefinitions = {
12758
12759
  contentTypes?: Array<ContentType>;
12759
12760
  entries?: Array<Entry>;
12760
12761
  prompts?: Array<Prompt>;
12762
+ assets?: Array<AssetGetResponseSingle>;
12761
12763
  };
12762
12764
  /** Defines shared parameters for requests getting a single composition */
12763
12765
  type CompositionGetOneSharedParameters = Pick<CompositionGetParameters, 'state' | 'skipEnhance' | 'skipPatternResolution' | 'withComponentIDs' | 'withUIStatus' | 'withTotalCount' | 'skipOverridesResolution' | 'withContentSourceMap' | 'versionId'>;
@@ -12860,138 +12862,12 @@ declare class CanvasClient extends ApiClient<CanvasClientOptions> {
12860
12862
  private edgeApiHost;
12861
12863
  constructor(options: CanvasClientOptions);
12862
12864
  /** Fetches lists of Canvas compositions, optionally by type */
12863
- getCompositionList(options?: Omit<CompositionGetParameters, 'projectId' | 'componentId' | 'compositionId' | 'slug'>): Promise<{
12864
- compositions: {
12865
- state: number;
12866
- uiStatus?: "Draft" | "Modified" | "Published" | "Orphan" | "Previous" | "Unknown" | undefined;
12867
- projectId: string;
12868
- created: string;
12869
- modified: string;
12870
- creator?: string | undefined;
12871
- author?: string | undefined;
12872
- categoryId?: string | undefined;
12873
- description?: string | undefined;
12874
- previewImageUrl?: string | undefined;
12875
- pattern: boolean;
12876
- composition: {
12877
- type: string;
12878
- parameters?: {
12879
- [key: string]: {
12880
- value: unknown;
12881
- type: string;
12882
- connectedData?: {
12883
- pointer: string;
12884
- syntax: "jptr";
12885
- } | undefined;
12886
- };
12887
- } | undefined;
12888
- variant?: string | undefined;
12889
- projectMapNodes?: {
12890
- id: string;
12891
- path: string;
12892
- projectMapId: string;
12893
- }[] | undefined;
12894
- slots?: {
12895
- [key: string]: {
12896
- type: string;
12897
- parameters?: {
12898
- [key: string]: {
12899
- value: unknown;
12900
- type: string;
12901
- connectedData?: {
12902
- pointer: string;
12903
- syntax: "jptr";
12904
- } | undefined;
12905
- };
12906
- } | undefined;
12907
- variant?: string | undefined;
12908
- slots?: {
12909
- [key: string]: any[];
12910
- } | undefined;
12911
- _id?: string | undefined;
12912
- _pattern?: string | undefined;
12913
- _dataResources?: {
12914
- [key: string]: {
12915
- type: string;
12916
- isPatternParameter?: boolean | undefined;
12917
- ignorePatternParameterDefault?: boolean | undefined;
12918
- variables?: {
12919
- [key: string]: string;
12920
- } | undefined;
12921
- };
12922
- } | undefined;
12923
- _patternDataResources?: {
12924
- [key: string]: {
12925
- type: string;
12926
- isPatternParameter?: boolean | undefined;
12927
- ignorePatternParameterDefault?: boolean | undefined;
12928
- variables?: {
12929
- [key: string]: string;
12930
- } | undefined;
12931
- };
12932
- } | undefined;
12933
- _patternError?: "NOTFOUND" | "CYCLIC" | undefined;
12934
- _overrides?: {
12935
- [key: string]: {
12936
- parameters?: {
12937
- [key: string]: {
12938
- value: unknown;
12939
- type: string;
12940
- connectedData?: {
12941
- pointer: string;
12942
- syntax: "jptr";
12943
- } | undefined;
12944
- };
12945
- } | undefined;
12946
- variant?: string | undefined;
12947
- };
12948
- } | undefined;
12949
- _overridability?: {
12950
- parameters?: {
12951
- [key: string]: "no" | "yes";
12952
- } | undefined;
12953
- variants?: boolean | undefined;
12954
- } | undefined;
12955
- }[];
12956
- } | undefined;
12957
- _id: string;
12958
- _slug?: string | null | undefined;
12959
- _name: string;
12960
- _dataResources?: {
12961
- [key: string]: {
12962
- type: string;
12963
- isPatternParameter?: boolean | undefined;
12964
- ignorePatternParameterDefault?: boolean | undefined;
12965
- variables?: {
12966
- [key: string]: string;
12967
- } | undefined;
12968
- };
12969
- } | undefined;
12970
- _overrides?: {
12971
- [key: string]: {
12972
- parameters?: {
12973
- [key: string]: {
12974
- value: unknown;
12975
- type: string;
12976
- connectedData?: {
12977
- pointer: string;
12978
- syntax: "jptr";
12979
- } | undefined;
12980
- };
12981
- } | undefined;
12982
- variant?: string | undefined;
12983
- };
12984
- } | undefined;
12985
- _overridability?: {
12986
- parameters?: {
12987
- [key: string]: "no" | "yes";
12988
- } | undefined;
12989
- variants?: boolean | undefined;
12990
- } | undefined;
12991
- };
12992
- }[];
12993
- totalCount?: number | undefined;
12994
- }>;
12865
+ getCompositionList(params?: Omit<CompositionGetParameters, 'projectId' | 'componentId' | 'compositionId' | 'slug'> & ({
12866
+ resolveData: true;
12867
+ diagnostics?: boolean;
12868
+ } | {
12869
+ resolveData?: false;
12870
+ })): Promise<CompositionGetListResponse | CompositionResolvedListResponse>;
12995
12871
  /** Fetches one composition by its project map node path */
12996
12872
  getCompositionByNodePath(options: CompositionGetByNodePathParameters & DataResolutionOptionNegative): Promise<CompositionGetResponse>;
12997
12873
  getCompositionByNodePath(options: CompositionGetByNodePathParameters & DataResolutionOptionPositive & DataResolutionParameters): Promise<CompositionResolvedGetResponse>;
package/dist/index.esm.js CHANGED
@@ -478,10 +478,20 @@ var CanvasClient = class extends ApiClient {
478
478
  this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
479
479
  }
480
480
  /** Fetches lists of Canvas compositions, optionally by type */
481
- async getCompositionList(options) {
481
+ async getCompositionList(params = {}) {
482
482
  const { projectId } = this.options;
483
- const fetchUri = this.createUrl(CANVAS_URL, { ...options, projectId });
484
- return await this.apiClient(fetchUri);
483
+ const { resolveData, ...originParams } = params;
484
+ if (!resolveData) {
485
+ const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId });
486
+ return this.apiClient(fetchUri);
487
+ }
488
+ const edgeParams = {
489
+ ...originParams,
490
+ projectId,
491
+ ...params.diagnostics ? { diagnostics: "true" } : {}
492
+ };
493
+ const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
494
+ return this.apiClient(edgeUrl);
485
495
  }
486
496
  getCompositionByNodePath(options) {
487
497
  return this.getOneComposition(options);
@@ -546,7 +556,7 @@ var CanvasClient = class extends ApiClient {
546
556
  async getComponentDefinitions(options) {
547
557
  const { projectId } = this.options;
548
558
  const fetchUri = this.createUrl("/api/v1/canvas-definitions", { ...options, projectId });
549
- return await this.apiClient(fetchUri);
559
+ return this.apiClient(fetchUri);
550
560
  }
551
561
  /** Updates or creates a Canvas component definition */
552
562
  async updateComponentDefinition(body) {
package/dist/index.js CHANGED
@@ -590,10 +590,20 @@ var CanvasClient = class extends import_api2.ApiClient {
590
590
  this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
591
591
  }
592
592
  /** Fetches lists of Canvas compositions, optionally by type */
593
- async getCompositionList(options) {
593
+ async getCompositionList(params = {}) {
594
594
  const { projectId } = this.options;
595
- const fetchUri = this.createUrl(CANVAS_URL, { ...options, projectId });
596
- return await this.apiClient(fetchUri);
595
+ const { resolveData, ...originParams } = params;
596
+ if (!resolveData) {
597
+ const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId });
598
+ return this.apiClient(fetchUri);
599
+ }
600
+ const edgeParams = {
601
+ ...originParams,
602
+ projectId,
603
+ ...params.diagnostics ? { diagnostics: "true" } : {}
604
+ };
605
+ const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
606
+ return this.apiClient(edgeUrl);
597
607
  }
598
608
  getCompositionByNodePath(options) {
599
609
  return this.getOneComposition(options);
@@ -658,7 +668,7 @@ var CanvasClient = class extends import_api2.ApiClient {
658
668
  async getComponentDefinitions(options) {
659
669
  const { projectId } = this.options;
660
670
  const fetchUri = this.createUrl("/api/v1/canvas-definitions", { ...options, projectId });
661
- return await this.apiClient(fetchUri);
671
+ return this.apiClient(fetchUri);
662
672
  }
663
673
  /** Updates or creates a Canvas component definition */
664
674
  async updateComponentDefinition(body) {
package/dist/index.mjs CHANGED
@@ -478,10 +478,20 @@ var CanvasClient = class extends ApiClient {
478
478
  this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
479
479
  }
480
480
  /** Fetches lists of Canvas compositions, optionally by type */
481
- async getCompositionList(options) {
481
+ async getCompositionList(params = {}) {
482
482
  const { projectId } = this.options;
483
- const fetchUri = this.createUrl(CANVAS_URL, { ...options, projectId });
484
- return await this.apiClient(fetchUri);
483
+ const { resolveData, ...originParams } = params;
484
+ if (!resolveData) {
485
+ const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId });
486
+ return this.apiClient(fetchUri);
487
+ }
488
+ const edgeParams = {
489
+ ...originParams,
490
+ projectId,
491
+ ...params.diagnostics ? { diagnostics: "true" } : {}
492
+ };
493
+ const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
494
+ return this.apiClient(edgeUrl);
485
495
  }
486
496
  getCompositionByNodePath(options) {
487
497
  return this.getOneComposition(options);
@@ -546,7 +556,7 @@ var CanvasClient = class extends ApiClient {
546
556
  async getComponentDefinitions(options) {
547
557
  const { projectId } = this.options;
548
558
  const fetchUri = this.createUrl("/api/v1/canvas-definitions", { ...options, projectId });
549
- return await this.apiClient(fetchUri);
559
+ return this.apiClient(fetchUri);
550
560
  }
551
561
  /** Updates or creates a Canvas component definition */
552
562
  async updateComponentDefinition(body) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas",
3
- "version": "19.66.1",
3
+ "version": "19.67.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,8 @@
38
38
  "pusher-js": "8.2.0"
39
39
  },
40
40
  "dependencies": {
41
- "@uniformdev/context": "19.66.1",
41
+ "@uniformdev/assets": "19.67.0",
42
+ "@uniformdev/context": "19.67.0",
42
43
  "immer": "9.0.21"
43
44
  },
44
45
  "files": [
@@ -47,5 +48,5 @@
47
48
  "publishConfig": {
48
49
  "access": "public"
49
50
  },
50
- "gitHead": "80e9cf7f60f95245269938596f00813b48a304f3"
51
+ "gitHead": "9cd9a40e3d0743f52457ebab0dfafc048014c916"
51
52
  }