contentful-management 12.5.0 → 12.6.0-dev.2

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.
Files changed (57) hide show
  1. package/README.md +3 -3
  2. package/dist/browser/index.js +1070 -737
  3. package/dist/browser/index.js.map +1 -1
  4. package/dist/browser/index.min.js +1 -1
  5. package/dist/browser/index.min.js.map +1 -1
  6. package/dist/cjs/index.cjs +1062 -729
  7. package/dist/cjs/index.cjs.map +1 -1
  8. package/dist/esm/adapters/REST/endpoints/component-type.mjs +43 -3
  9. package/dist/esm/adapters/REST/endpoints/component-type.mjs.map +1 -1
  10. package/dist/esm/adapters/REST/endpoints/data-assembly.mjs +62 -0
  11. package/dist/esm/adapters/REST/endpoints/data-assembly.mjs.map +1 -0
  12. package/dist/esm/adapters/REST/endpoints/experience.mjs +52 -0
  13. package/dist/esm/adapters/REST/endpoints/experience.mjs.map +1 -0
  14. package/dist/esm/adapters/REST/endpoints/fragment.mjs +50 -0
  15. package/dist/esm/adapters/REST/endpoints/fragment.mjs.map +1 -0
  16. package/dist/esm/adapters/REST/endpoints/index.mjs +8 -0
  17. package/dist/esm/adapters/REST/endpoints/index.mjs.map +1 -1
  18. package/dist/esm/adapters/REST/endpoints/template.mjs +50 -0
  19. package/dist/esm/adapters/REST/endpoints/template.mjs.map +1 -0
  20. package/dist/esm/common-types.mjs.map +1 -1
  21. package/dist/esm/plain/plain-client.mjs +44 -0
  22. package/dist/esm/plain/plain-client.mjs.map +1 -1
  23. package/dist/types/adapters/REST/endpoints/component-type.d.ts +6 -0
  24. package/dist/types/adapters/REST/endpoints/component-type.js +43 -3
  25. package/dist/types/adapters/REST/endpoints/component-type.js.map +1 -1
  26. package/dist/types/adapters/REST/endpoints/data-assembly.d.ts +10 -0
  27. package/dist/types/adapters/REST/endpoints/data-assembly.js +62 -0
  28. package/dist/types/adapters/REST/endpoints/data-assembly.js.map +1 -0
  29. package/dist/types/adapters/REST/endpoints/experience.d.ts +8 -0
  30. package/dist/types/adapters/REST/endpoints/experience.js +52 -0
  31. package/dist/types/adapters/REST/endpoints/experience.js.map +1 -0
  32. package/dist/types/adapters/REST/endpoints/fragment.d.ts +8 -0
  33. package/dist/types/adapters/REST/endpoints/fragment.js +50 -0
  34. package/dist/types/adapters/REST/endpoints/fragment.js.map +1 -0
  35. package/dist/types/adapters/REST/endpoints/index.d.ts +8 -0
  36. package/dist/types/adapters/REST/endpoints/index.js +8 -0
  37. package/dist/types/adapters/REST/endpoints/index.js.map +1 -1
  38. package/dist/types/adapters/REST/endpoints/template.d.ts +8 -0
  39. package/dist/types/adapters/REST/endpoints/template.js +50 -0
  40. package/dist/types/adapters/REST/endpoints/template.js.map +1 -0
  41. package/dist/types/common-types.d.ts +372 -5
  42. package/dist/types/common-types.js.map +1 -1
  43. package/dist/types/entities/component-type.d.ts +88 -53
  44. package/dist/types/entities/data-assembly.d.ts +92 -0
  45. package/dist/types/entities/experience.d.ts +84 -0
  46. package/dist/types/entities/fragment.d.ts +53 -0
  47. package/dist/types/entities/template.d.ts +48 -0
  48. package/dist/types/export-types.d.ts +5 -0
  49. package/dist/types/plain/entities/component-type.d.ts +119 -7
  50. package/dist/types/plain/entities/data-assembly.d.ts +178 -0
  51. package/dist/types/plain/entities/experience.d.ts +165 -0
  52. package/dist/types/plain/entities/fragment.d.ts +134 -0
  53. package/dist/types/plain/entities/template.d.ts +139 -0
  54. package/dist/types/plain/plain-client-types.d.ts +8 -0
  55. package/dist/types/plain/plain-client.js +44 -0
  56. package/dist/types/plain/plain-client.js.map +1 -1
  57. package/package.json +1 -1
@@ -1,8 +1,7 @@
1
- import type { Link, MetadataProps, SysLink } from '../common-types';
2
- export type ComponentTypeQueryOptions = {
3
- _experienceCtId: string;
4
- skip?: number;
5
- limit?: number;
1
+ import type { Except } from 'type-fest';
2
+ import type { CursorPaginationParams, DataTypeDefinition, ExoCursorPaginatedCollectionProp, ExoMetadataProps, ExoQueryFilters, Link, ResourceLink } from '../common-types';
3
+ export type ComponentTypeQueryOptions = CursorPaginationParams & ExoQueryFilters & {
4
+ order?: string;
6
5
  };
7
6
  export type ComponentTypeViewport = {
8
7
  id: string;
@@ -10,89 +9,110 @@ export type ComponentTypeViewport = {
10
9
  displayName: string;
11
10
  previewSize: string;
12
11
  };
13
- export type ComponentTypeContentProperty = {
12
+ export type ComponentTypeContentProperty = DataTypeDefinition & {
14
13
  id: string;
15
14
  name: string;
16
- type: string;
17
15
  required: boolean;
18
16
  defaultValue?: unknown;
19
17
  };
20
- export type ComponentTypeDesignPropertyValidation = {
21
- value: string | number | boolean;
22
- name: string;
23
- description?: string;
18
+ export type StringDesignPropertyRegexpValidation = {
19
+ regexp: {
20
+ pattern: string;
21
+ };
22
+ };
23
+ export type DesignTokenAllowedResource = {
24
+ type: 'DesignToken';
25
+ value: string;
26
+ name?: string;
24
27
  };
25
- export type ComponentTypeDesignProperty = {
28
+ export type DTCGDesignPropertyType = 'DTCG.Color' | 'DTCG.Dimension' | 'DTCG.FontFamily' | 'DTCG.FontWeight' | 'DTCG.Duration' | 'DTCG.CubicBezier' | 'DTCG.Number' | 'DTCG.StrokeStyle' | 'DTCG.Border' | 'DTCG.Transition' | 'DTCG.Shadow' | 'DTCG.Gradient' | 'DTCG.Typography';
29
+ type DesignPropertyCommonFields = {
26
30
  id: string;
27
31
  name: string;
28
- type: string;
29
- required: boolean;
30
32
  description?: string;
31
- defaultValue?: unknown;
32
- validations?: {
33
- in: ComponentTypeDesignPropertyValidation[];
33
+ };
34
+ export type StringDesignProperty = DesignPropertyCommonFields & {
35
+ type: 'String';
36
+ fallbackValue?: {
37
+ type: 'ManualDesignValue';
38
+ value: string;
34
39
  };
35
- designTokenSet?: string[];
40
+ validations?: StringDesignPropertyRegexpValidation[];
41
+ };
42
+ export type BooleanDesignProperty = DesignPropertyCommonFields & {
43
+ type: 'Boolean';
44
+ fallbackValue?: {
45
+ type: 'ManualDesignValue';
46
+ value: boolean;
47
+ };
48
+ };
49
+ export type TokenBackedDesignProperty = DesignPropertyCommonFields & {
50
+ type: DTCGDesignPropertyType;
51
+ fallbackValue?: DesignTokenValue;
52
+ allowedResources?: DesignTokenAllowedResource[];
36
53
  };
54
+ export type ComponentTypeDesignProperty = StringDesignProperty | BooleanDesignProperty | TokenBackedDesignProperty;
37
55
  export type ComponentTypeDimensionKeyMap = {
38
56
  designProperties: Record<string, Record<string, string>>;
39
57
  };
40
- export type ContentPropertyPointerValue = `$contentProperties/${string}` | `$contentBindings/${string}`;
58
+ export type ContentPropertyPointerValue = `$contentProperties/${string}`;
41
59
  export type DesignPropertyPointerValue = `$designProperties/${string}`;
42
60
  export type ManualDesignValue = {
43
61
  type: 'ManualDesignValue';
44
- value: string | number | boolean | Record<string, unknown>;
62
+ value: string | number | boolean;
45
63
  };
46
64
  export type DesignTokenValue = {
47
- type: 'DesignValue';
48
- token: string;
65
+ type: 'DesignToken';
66
+ /** Must be non-empty (min length 1) */
67
+ value: string;
49
68
  };
50
- export type DesignPropertyValue = ManualDesignValue | DesignTokenValue | DesignPropertyPointerValue | Record<string, ManualDesignValue | DesignTokenValue | DesignPropertyPointerValue>;
69
+ export type DesignPropertyValue = ManualDesignValue | DesignTokenValue;
70
+ export type DimensionedDesignPropertyValue = Record<string, DesignPropertyValue>;
71
+ export type ComponentTreeDesignPropertyValue = DesignPropertyValue | DesignPropertyPointerValue | DimensionedDesignPropertyValue;
51
72
  export type ComponentNode = {
52
73
  id: string;
74
+ name?: string;
53
75
  nodeType: 'Component';
54
- componentTypeId: string;
55
- contentProperties: Record<string, ContentPropertyPointerValue | unknown>;
56
- designProperties: Record<string, DesignPropertyValue>;
76
+ componentType: ResourceLink<'Contentful:ComponentType'>;
77
+ contentProperties: Record<string, ContentPropertyPointerValue | unknown> | string;
78
+ designProperties: Record<string, ComponentTreeDesignPropertyValue>;
57
79
  slots: Record<string, TreeNode[]>;
58
- contentBindings?: string;
59
80
  };
60
- export type ViewNode = {
81
+ export type FragmentNode = {
61
82
  id: string;
62
- nodeType: 'View';
63
- viewId: string;
83
+ name?: string;
84
+ nodeType: 'Fragment';
85
+ fragment: ResourceLink<'Contentful:Fragment'>;
64
86
  };
65
87
  export type SlotNode = {
66
88
  id: string;
67
89
  nodeType: 'Slot';
68
90
  slotId: string;
69
91
  };
70
- export type TreeNode = ComponentNode | ViewNode | SlotNode;
71
- export type ComponentTypeDataTypeField = {
72
- id: string;
73
- name: string;
74
- type: string;
75
- required: boolean;
76
- source?: string;
77
- };
78
- export type DataAssemblyLink = Link<'DataAssembly'>;
79
- export type ComponentTypeContentBindings = DataAssemblyLink['sys'] & {
80
- required: boolean;
81
- dataType: ComponentTypeDataTypeField[];
82
- };
92
+ export type TreeNode = ComponentNode | FragmentNode | SlotNode;
93
+ export type DataAssemblyLink = ResourceLink<'Contentful:DataAssembly'>;
83
94
  export type ComponentTypeSlotDefinition = {
84
95
  id: string;
85
96
  name: string;
86
- componentTypeId: string[];
87
97
  required: boolean;
88
- validations: unknown[];
98
+ validations: Array<{
99
+ size?: {
100
+ min?: number;
101
+ max?: number;
102
+ };
103
+ }>;
104
+ allowedResources?: Array<{
105
+ type: 'Contentful:ComponentType';
106
+ source: string;
107
+ allowedTypes: string[];
108
+ }>;
89
109
  };
90
110
  export type ComponentTypeSys = {
91
111
  id: string;
92
112
  type: 'ComponentType';
93
113
  version: number;
94
- space: SysLink;
95
- environment: SysLink;
114
+ space: Link<'Space'>;
115
+ environment: Link<'Environment'>;
96
116
  fieldStatus?: Record<string, Record<string, 'draft' | 'published' | 'changed'>>;
97
117
  publishedAt?: string;
98
118
  publishedVersion?: number;
@@ -100,10 +120,12 @@ export type ComponentTypeSys = {
100
120
  firstPublishedAt?: string;
101
121
  publishedBy?: Link<'User'> | Link<'AppDefinition'>;
102
122
  variant?: string;
103
- createdAt?: string;
104
- createdBy?: Link<'User'>;
105
- updatedAt?: string;
106
- updatedBy?: Link<'User'>;
123
+ variantType?: string;
124
+ variantDimension?: string;
125
+ createdAt: string;
126
+ createdBy: Link<'User'>;
127
+ updatedAt: string;
128
+ updatedBy: Link<'User'>;
107
129
  };
108
130
  export type ComponentTypeProps = {
109
131
  sys: ComponentTypeSys;
@@ -114,8 +136,21 @@ export type ComponentTypeProps = {
114
136
  designProperties: ComponentTypeDesignProperty[];
115
137
  dimensionKeyMap: ComponentTypeDimensionKeyMap;
116
138
  componentTree?: TreeNode[];
117
- contentBindings?: ComponentTypeContentBindings;
118
139
  slots?: ComponentTypeSlotDefinition[];
119
- metadata?: MetadataProps;
140
+ metadata?: ExoMetadataProps;
120
141
  dataAssemblies?: DataAssemblyLink[];
142
+ source?: ResourceLink<'Contentful:DesignSystemSource'>;
143
+ };
144
+ export type CreateComponentTypeProps = Except<ComponentTypeProps, 'sys' | 'source'> & {
145
+ source?: ResourceLink<'Contentful:DesignSystemSource'> | null;
146
+ };
147
+ export type UpsertComponentTypeProps = Except<ComponentTypeProps, 'sys' | 'source'> & {
148
+ sys: {
149
+ id: string;
150
+ type: 'ComponentType';
151
+ version?: number;
152
+ };
153
+ source?: ResourceLink<'Contentful:DesignSystemSource'> | null;
121
154
  };
155
+ export type ComponentTypeCollection = ExoCursorPaginatedCollectionProp<ComponentTypeProps>;
156
+ export {};
@@ -0,0 +1,92 @@
1
+ import type { CursorPaginationParams, DataTypeDefinition, ExoCursorPaginatedCollectionProp, Link, MetadataProps, PointerExpressionValue, ResourceLink } from '../common-types';
2
+ export type DataAssemblyDataTypeField = DataTypeDefinition & {
3
+ id: string;
4
+ name: string;
5
+ source?: string;
6
+ };
7
+ export type DataAssemblyLinkParameter = {
8
+ name?: string;
9
+ description?: string;
10
+ type: 'Link';
11
+ linkType: string;
12
+ allowedContentTypes: string[];
13
+ };
14
+ export type DataAssemblyResourceLinkParameter = {
15
+ name?: string;
16
+ description?: string;
17
+ type: 'ResourceLink';
18
+ linkType: string;
19
+ allowedResources: Array<{
20
+ type: string;
21
+ source: string;
22
+ allowedTypes: string[];
23
+ }>;
24
+ };
25
+ export type DataAssemblyParameterConfig = Record<string, DataAssemblyLinkParameter | DataAssemblyResourceLinkParameter>;
26
+ export type DataAssemblyGraphQLResolver = {
27
+ source: 'Contentful:GraphQL';
28
+ query: string;
29
+ parameters?: PointerExpressionValue;
30
+ };
31
+ export type DataAssemblyNestedResolver = {
32
+ source: 'Contentful:DataAssembly';
33
+ dataAssembly: ResourceLink<'Contentful:DataAssembly'>;
34
+ parameters?: PointerExpressionValue;
35
+ };
36
+ export type DataAssemblyResolverDefinition = DataAssemblyGraphQLResolver | DataAssemblyNestedResolver;
37
+ export type DataAssemblyResolverConfig = Record<string, DataAssemblyResolverDefinition>;
38
+ export type DataAssemblyReturnMappingConfig = Record<string, PointerExpressionValue>;
39
+ export type DataAssemblySys = {
40
+ id: string;
41
+ type: 'DataAssembly';
42
+ dataType: DataAssemblyDataTypeField[];
43
+ version: number;
44
+ space: Link<'Space'>;
45
+ environment: Link<'Environment'>;
46
+ createdBy: Link<'User'>;
47
+ createdAt: string | Date;
48
+ updatedAt: string | Date;
49
+ updatedBy?: Link<'User'>;
50
+ publishedAt?: string | Date;
51
+ publishedVersion?: number;
52
+ publishedCounter?: number;
53
+ firstPublishedAt?: string | Date;
54
+ publishedBy?: Link<'User'> | Link<'AppDefinition'>;
55
+ variant?: string;
56
+ };
57
+ type DataAssemblyCommonProps = {
58
+ metadata: Pick<MetadataProps, 'tags'>;
59
+ name: string;
60
+ description: string;
61
+ parameters: DataAssemblyParameterConfig;
62
+ resolvers: DataAssemblyResolverConfig;
63
+ return: DataAssemblyReturnMappingConfig;
64
+ };
65
+ export type DataAssemblyProps = DataAssemblyCommonProps & {
66
+ sys: DataAssemblySys;
67
+ };
68
+ export type CreateDataAssemblyProps = DataAssemblyCommonProps & {
69
+ sys: {
70
+ type: 'DataAssembly';
71
+ variant?: string;
72
+ dataType: DataAssemblyDataTypeField[];
73
+ };
74
+ };
75
+ export type UpdateDataAssemblyProps = DataAssemblyCommonProps & {
76
+ sys: {
77
+ id: string;
78
+ type: 'DataAssembly';
79
+ variant?: string;
80
+ version: number;
81
+ dataType: DataAssemblyDataTypeField[];
82
+ };
83
+ };
84
+ export type DataAssemblyQueryOptions = CursorPaginationParams & {
85
+ 'sys.id[in]'?: string;
86
+ };
87
+ export type DataAssemblyCollection = ExoCursorPaginatedCollectionProp<DataAssemblyProps> & {
88
+ errors?: {
89
+ notFoundIds: string[];
90
+ };
91
+ };
92
+ export {};
@@ -0,0 +1,84 @@
1
+ import type { CursorPaginationParams, ExoCursorPaginatedCollectionProp, ExperienceMetadataProps, ExoQueryFilters, Link, ResourceLink } from '../common-types';
2
+ import type { ComponentTypeViewport, DimensionedDesignPropertyValue, FragmentNode } from './component-type';
3
+ export type ExperienceDimensionKeyMap = {
4
+ designProperties: Record<string, {
5
+ breakpoint: string;
6
+ }>;
7
+ };
8
+ export type ExperienceContentBindings = {
9
+ sys: ResourceLink<'Contentful:DataAssembly'>['sys'];
10
+ parameters: Record<string, ResourceLink<string>>;
11
+ };
12
+ export type ExperienceSys = {
13
+ id: string;
14
+ type: 'Experience';
15
+ version: number;
16
+ space: Link<'Space'>;
17
+ environment: Link<'Environment'>;
18
+ template: ResourceLink<'Contentful:Template'>;
19
+ createdAt: string;
20
+ updatedAt: string;
21
+ createdBy: Link<'User'>;
22
+ updatedBy: Link<'User'>;
23
+ archivedAt?: string;
24
+ archivedBy?: Link<'User'>;
25
+ archivedVersion?: number;
26
+ variant?: string;
27
+ variantType?: string;
28
+ variantDimension?: string;
29
+ publishedAt?: string;
30
+ publishedVersion?: number;
31
+ publishedCounter?: number;
32
+ firstPublishedAt?: string;
33
+ publishedBy?: Link<'User'> | Link<'AppDefinition'>;
34
+ localeStatus?: Record<string, 'draft' | 'published' | 'changed'>;
35
+ };
36
+ type ExperienceCommonProps = {
37
+ name: string;
38
+ description: string;
39
+ viewports: ComponentTypeViewport[];
40
+ designProperties: Record<string, DimensionedDesignPropertyValue>;
41
+ dimensionKeyMap: ExperienceDimensionKeyMap;
42
+ contentBindings?: ExperienceContentBindings;
43
+ metadata?: ExperienceMetadataProps;
44
+ slots?: Record<string, Array<FragmentNode | InlineFragmentNode>>;
45
+ };
46
+ export type ExperienceProps = ExperienceCommonProps & {
47
+ sys: ExperienceSys;
48
+ };
49
+ export type ExperienceQueryOptions = CursorPaginationParams & ExoQueryFilters & {
50
+ order?: string;
51
+ };
52
+ export type ExperienceLocalePublishPayload = {
53
+ add: string[];
54
+ } | {
55
+ remove: string[];
56
+ };
57
+ export type CreateExperienceProps = ExperienceCommonProps & {
58
+ template: ResourceLink<'Contentful:Template'>;
59
+ };
60
+ export type UpsertExperienceProps = ExperienceCommonProps & {
61
+ sys: {
62
+ id: string;
63
+ type: 'Experience';
64
+ version?: number;
65
+ };
66
+ template?: ResourceLink<'Contentful:Template'>;
67
+ };
68
+ export type InlineFragmentNode = {
69
+ id: string;
70
+ nodeType: 'InlineFragment';
71
+ componentType: ResourceLink<'Contentful:ComponentType'>;
72
+ designProperties: Record<string, DimensionedDesignPropertyValue>;
73
+ contentBindings?: ExperienceContentBindings;
74
+ slots?: Record<string, Array<FragmentNode | InlineFragmentNode>>;
75
+ };
76
+ export type ExperienceCollection = ExoCursorPaginatedCollectionProp<ExperienceProps>;
77
+ export type ReleaseExperienceSys = Omit<ExperienceSys, 'variant' | 'variantType' | 'variantDimension'> & {
78
+ release: Link<'Release'>;
79
+ };
80
+ export type ReleaseExperience = Omit<ExperienceProps, 'sys'> & {
81
+ sys: ReleaseExperienceSys;
82
+ };
83
+ export type ReleaseExperienceCollection = ExoCursorPaginatedCollectionProp<ReleaseExperience>;
84
+ export {};
@@ -0,0 +1,53 @@
1
+ import type { Except } from 'type-fest';
2
+ import type { CursorPaginationParams, ExoCursorPaginatedCollectionProp, ExoQueryFilters, ExperienceMetadataProps, Link, ResourceLink } from '../common-types';
3
+ import type { ComponentTypeViewport, DimensionedDesignPropertyValue, FragmentNode } from './component-type';
4
+ import type { ExperienceContentBindings, ExperienceDimensionKeyMap, InlineFragmentNode } from './experience';
5
+ export type FragmentSys = {
6
+ id: string;
7
+ type: 'Fragment';
8
+ version: number;
9
+ space: Link<'Space'>;
10
+ environment: Link<'Environment'>;
11
+ componentType: ResourceLink<'Contentful:ComponentType'>;
12
+ archivedAt?: string;
13
+ archivedBy?: Link<'User'>;
14
+ archivedVersion?: number;
15
+ createdAt: string;
16
+ updatedAt: string;
17
+ createdBy: Link<'User'>;
18
+ updatedBy: Link<'User'>;
19
+ variant?: string;
20
+ variantType?: string;
21
+ variantDimension?: string;
22
+ publishedAt?: string;
23
+ publishedVersion?: number;
24
+ publishedCounter?: number;
25
+ firstPublishedAt?: string;
26
+ publishedBy?: Link<'User'> | Link<'AppDefinition'>;
27
+ };
28
+ export type FragmentProps = {
29
+ sys: FragmentSys;
30
+ name: string;
31
+ description: string;
32
+ viewports: ComponentTypeViewport[];
33
+ designProperties: Record<string, DimensionedDesignPropertyValue>;
34
+ dimensionKeyMap: ExperienceDimensionKeyMap;
35
+ contentBindings?: ExperienceContentBindings;
36
+ metadata?: ExperienceMetadataProps;
37
+ slots?: Record<string, Array<FragmentNode | InlineFragmentNode>>;
38
+ };
39
+ export type CreateFragmentProps = Except<FragmentProps, 'sys'> & {
40
+ componentType: ResourceLink<'Contentful:ComponentType'>;
41
+ };
42
+ export type UpdateFragmentProps = Omit<FragmentProps, 'sys'> & {
43
+ sys: {
44
+ id: string;
45
+ type: 'Fragment';
46
+ version: number;
47
+ };
48
+ componentType?: ResourceLink<'Contentful:ComponentType'>;
49
+ };
50
+ export type FragmentQueryOptions = CursorPaginationParams & ExoQueryFilters & {
51
+ order?: string;
52
+ };
53
+ export type FragmentCollection = ExoCursorPaginatedCollectionProp<FragmentProps>;
@@ -0,0 +1,48 @@
1
+ import type { Except } from 'type-fest';
2
+ import type { CursorPaginationParams, ExoCursorPaginatedCollectionProp, ExoMetadataProps, ExoQueryFilters, Link } from '../common-types';
3
+ import type { ComponentTypeContentProperty, ComponentTypeDesignProperty, ComponentTypeDimensionKeyMap, ComponentTypeSlotDefinition, ComponentTypeViewport, DataAssemblyLink, TreeNode } from './component-type';
4
+ export type TemplateSys = {
5
+ id: string;
6
+ type: 'Template';
7
+ version: number;
8
+ space: Link<'Space'>;
9
+ environment: Link<'Environment'>;
10
+ fieldStatus?: Record<string, Record<string, 'draft' | 'published' | 'changed'>>;
11
+ publishedAt?: string;
12
+ publishedVersion?: number;
13
+ publishedCounter?: number;
14
+ firstPublishedAt?: string;
15
+ publishedBy?: Link<'User'> | Link<'AppDefinition'>;
16
+ variant?: string;
17
+ variantType?: string;
18
+ variantDimension?: string;
19
+ createdAt: string;
20
+ createdBy: Link<'User'>;
21
+ updatedAt: string;
22
+ updatedBy: Link<'User'>;
23
+ };
24
+ export type TemplateProps = {
25
+ sys: TemplateSys;
26
+ name: string;
27
+ description: string;
28
+ viewports: ComponentTypeViewport[];
29
+ contentProperties: ComponentTypeContentProperty[];
30
+ designProperties: ComponentTypeDesignProperty[];
31
+ dimensionKeyMap: ComponentTypeDimensionKeyMap;
32
+ componentTree?: TreeNode[];
33
+ slots?: ComponentTypeSlotDefinition[];
34
+ metadata?: ExoMetadataProps;
35
+ dataAssemblies?: DataAssemblyLink[];
36
+ };
37
+ export type CreateTemplateProps = Except<TemplateProps, 'sys'>;
38
+ export type UpsertTemplateProps = Except<TemplateProps, 'sys'> & {
39
+ sys: {
40
+ id: string;
41
+ type: 'Template';
42
+ version?: number;
43
+ };
44
+ };
45
+ export type TemplateQueryOptions = CursorPaginationParams & ExoQueryFilters & {
46
+ order?: string;
47
+ };
48
+ export type TemplateCollection = ExoCursorPaginatedCollectionProp<TemplateProps>;
@@ -85,3 +85,8 @@ export type { SemanticSearchProps, SemanticSearch } from './entities/semantic-se
85
85
  export type { DefinedParameters, FreeFormParameters, InstallationParameterType, ParameterDefinition, ParameterOption, ParameterType, } from './entities/widget-parameters';
86
86
  export type { CreateWorkflowProps, DeleteWorkflowParams, UpdateWorkflowProps, Workflow, WorkflowProps, WorkflowQueryOptions, } from './entities/workflow';
87
87
  export type { WorkflowsChangelogEntry, WorkflowsChangelogEntryProps, WorkflowsChangelogQueryOptions, } from './entities/workflows-changelog-entry';
88
+ export type { ComponentTypeCollection } from './entities/component-type';
89
+ export type { TemplateCollection } from './entities/template';
90
+ export type { ExperienceCollection, ReleaseExperience, ReleaseExperienceCollection, ReleaseExperienceSys, } from './entities/experience';
91
+ export type { FragmentCollection } from './entities/fragment';
92
+ export type { DataAssemblyCollection, DataAssemblyResourceLinkParameter, } from './entities/data-assembly';
@@ -1,13 +1,13 @@
1
- import type { GetSpaceEnvironmentParams, CollectionProp } from '../../common-types';
2
- import type { ComponentTypeQueryOptions, ComponentTypeProps } from '../../entities/component-type';
1
+ import type { GetSpaceEnvironmentParams, GetComponentTypeParams, ExoCursorPaginatedCollectionProp } from '../../common-types';
2
+ import type { ComponentTypeQueryOptions, ComponentTypeProps, CreateComponentTypeProps, UpsertComponentTypeProps } from '../../entities/component-type';
3
3
  import type { OptionalDefaults } from '../wrappers/wrap';
4
4
  export type ComponentTypePlainClientAPI = {
5
5
  /**
6
6
  * Fetches all component types for a space and environment
7
7
  * @param params the space and environment IDs and query parameters
8
- * @param params.query.experienceCtId the experience component type ID
9
8
  * @param params.query.limit the maximum number of component types to return
10
- * @param params.query.skip the number of component types to skip
9
+ * @param params.query.pageNext cursor token for the next page
10
+ * @param params.query.pagePrev cursor token for the previous page
11
11
  * @returns a collection of component types
12
12
  * @throws if the request fails, or the space, environment, or experience component type is not found
13
13
  * @internal - Experimental endpoint, subject to breaking changes without notice
@@ -17,14 +17,126 @@ export type ComponentTypePlainClientAPI = {
17
17
  * spaceId: '<space_id>',
18
18
  * environmentId: '<environment_id>',
19
19
  * query: {
20
- * _experienceCtId: '<experience_ct_id>',
21
20
  * limit: 10,
22
- * skip: 0,
23
21
  * },
24
22
  * });
25
23
  * ```
26
24
  */
27
25
  getMany(params: OptionalDefaults<GetSpaceEnvironmentParams & {
28
26
  query: ComponentTypeQueryOptions;
29
- }>): Promise<CollectionProp<ComponentTypeProps>>;
27
+ }>): Promise<ExoCursorPaginatedCollectionProp<ComponentTypeProps>>;
28
+ /**
29
+ * Fetches a single component type by ID
30
+ * @param params the space, environment, and component type IDs
31
+ * @returns the component type
32
+ * @throws if the request fails, or the space, environment, or component type is not found
33
+ * @internal - Experimental endpoint, subject to breaking changes without notice
34
+ * @example
35
+ * ```javascript
36
+ * const componentType = await client.componentType.get({
37
+ * spaceId: '<space_id>',
38
+ * environmentId: '<environment_id>',
39
+ * componentTypeId: '<component_id>',
40
+ * });
41
+ * ```
42
+ */
43
+ get(params: OptionalDefaults<GetComponentTypeParams>): Promise<ComponentTypeProps>;
44
+ /**
45
+ * Creates a new component type
46
+ * @param params the space and environment IDs
47
+ * @param rawData the component type data to create
48
+ * @returns the created component type
49
+ * @throws if the request fails
50
+ * @internal - Experimental endpoint, subject to breaking changes without notice
51
+ * @example
52
+ * ```javascript
53
+ * const componentType = await client.componentType.create({
54
+ * spaceId: '<space_id>',
55
+ * environmentId: '<environment_id>',
56
+ * }, {
57
+ * name: 'My Component',
58
+ * description: 'A new component type',
59
+ * viewports: [],
60
+ * contentProperties: [],
61
+ * designProperties: [],
62
+ * dimensionKeyMap: { designProperties: {} },
63
+ * });
64
+ * ```
65
+ */
66
+ create(params: OptionalDefaults<GetSpaceEnvironmentParams>, rawData: CreateComponentTypeProps): Promise<ComponentTypeProps>;
67
+ /**
68
+ * Upserts a component type (creates or updates via PUT)
69
+ * @param params the space, environment, and component type IDs
70
+ * @param rawData the component type data to upsert (include sys.version for updates, omit for creates)
71
+ * @returns the upserted component type
72
+ * @throws if the request fails
73
+ * @internal - Experimental endpoint, subject to breaking changes without notice
74
+ * @example
75
+ * ```javascript
76
+ * const current = await client.componentType.get({ componentTypeId: '<component_id>' });
77
+ * const updated = await client.componentType.upsert({
78
+ * spaceId: '<space_id>',
79
+ * environmentId: '<environment_id>',
80
+ * componentTypeId: '<component_id>',
81
+ * }, {
82
+ * sys: { id: current.sys.id, type: 'ComponentType', version: current.sys.version },
83
+ * name: 'Updated Component',
84
+ * ...otherFields,
85
+ * });
86
+ * ```
87
+ */
88
+ upsert(params: OptionalDefaults<GetComponentTypeParams>, rawData: UpsertComponentTypeProps): Promise<ComponentTypeProps>;
89
+ /**
90
+ * Deletes a single component type
91
+ * @param params the space, environment, and component type IDs
92
+ * @throws if the request fails, or the component type is not found
93
+ * @internal - Experimental endpoint, subject to breaking changes without notice
94
+ * @example
95
+ * ```javascript
96
+ * await client.componentType.delete({
97
+ * spaceId: '<space_id>',
98
+ * environmentId: '<environment_id>',
99
+ * componentTypeId: '<component_id>',
100
+ * });
101
+ * ```
102
+ */
103
+ delete(params: OptionalDefaults<GetComponentTypeParams>): Promise<void>;
104
+ /**
105
+ * Publishes a component type
106
+ * @param params the space, environment, and component type IDs, and the version number
107
+ * @returns the published component type
108
+ * @throws if the request fails, or the component type is not found
109
+ * @internal - Experimental endpoint, subject to breaking changes without notice
110
+ * @example
111
+ * ```javascript
112
+ * const componentType = await client.componentType.publish({
113
+ * spaceId: '<space_id>',
114
+ * environmentId: '<environment_id>',
115
+ * componentTypeId: '<component_type_id>',
116
+ * version: <version>,
117
+ * });
118
+ * ```
119
+ */
120
+ publish(params: OptionalDefaults<GetComponentTypeParams & {
121
+ version: number;
122
+ }>): Promise<ComponentTypeProps>;
123
+ /**
124
+ * Unpublishes a component type
125
+ * @param params the space, environment, and component type IDs, and the version number
126
+ * @returns the unpublished component type
127
+ * @throws if the request fails, or the component type is not found
128
+ * @internal - Experimental endpoint, subject to breaking changes without notice
129
+ * @example
130
+ * ```javascript
131
+ * const componentType = await client.componentType.unpublish({
132
+ * spaceId: '<space_id>',
133
+ * environmentId: '<environment_id>',
134
+ * componentTypeId: '<component_type_id>',
135
+ * version: <version>,
136
+ * });
137
+ * ```
138
+ */
139
+ unpublish(params: OptionalDefaults<GetComponentTypeParams & {
140
+ version: number;
141
+ }>): Promise<ComponentTypeProps>;
30
142
  };