contentful-management 12.6.0-dev.1 → 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.
@@ -1 +1 @@
1
- {"version":3,"file":"common-types.mjs","sources":["../../lib/common-types.ts"],"sourcesContent":[null],"names":[],"mappings":"AA6wGA;IACY;AAAZ,CAAA,UAAY,+BAA+B,EAAA;AACzC,IAAA,+BAAA,CAAA,4BAAA,CAAA,GAAA,uDAAoF;AACtF,CAAC,EAFW,+BAA+B,KAA/B,+BAA+B,GAAA,EAAA,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"common-types.mjs","sources":["../../lib/common-types.ts"],"sourcesContent":[null],"names":[],"mappings":"AA80GA;IACY;AAAZ,CAAA,UAAY,+BAA+B,EAAA;AACzC,IAAA,+BAAA,CAAA,4BAAA,CAAA,GAAA,uDAAoF;AACtF,CAAC,EAFW,+BAA+B,KAA/B,+BAA+B,GAAA,EAAA,CAAA,CAAA;;;;"}
@@ -104,6 +104,48 @@ export interface ResourceLink<T extends string> {
104
104
  urn: string;
105
105
  };
106
106
  }
107
+ export type PrimitiveDataTypeName = 'String' | 'Number' | 'Integer' | 'Boolean';
108
+ export type BaseDataTypeDefinition = {
109
+ name?: string;
110
+ required?: boolean;
111
+ };
112
+ export type PrimitiveDataTypeDefinition = BaseDataTypeDefinition & {
113
+ type: PrimitiveDataTypeName;
114
+ };
115
+ export type RichTextDataTypeDefinition = BaseDataTypeDefinition & {
116
+ type: 'RichText';
117
+ };
118
+ export type ArrayDataTypeDefinition = BaseDataTypeDefinition & {
119
+ type: 'Array';
120
+ items: DataTypeDefinition;
121
+ };
122
+ export type RecordDataTypeDefinition = BaseDataTypeDefinition & {
123
+ type: 'Record';
124
+ fields: Record<string, DataTypeDefinition>;
125
+ };
126
+ export type TypeRefDataTypeDefinition = BaseDataTypeDefinition & {
127
+ type: 'TypeRef';
128
+ ref: ResourceLink<string>;
129
+ };
130
+ export type JsonValue = string | number | boolean | null | JsonValue[] | {
131
+ [key: string]: JsonValue;
132
+ };
133
+ export type LiteralDataTypeDefinition = BaseDataTypeDefinition & {
134
+ type: 'Literal';
135
+ value: JsonValue;
136
+ valueType: DataTypeDefinition;
137
+ };
138
+ export type DiscriminatedUnionDataTypeDefinition = BaseDataTypeDefinition & {
139
+ type: 'DiscriminatedUnion';
140
+ discriminator: string;
141
+ members: DataTypeDefinition[];
142
+ };
143
+ export type DataTypeDefinition = PrimitiveDataTypeDefinition | RichTextDataTypeDefinition | ArrayDataTypeDefinition | RecordDataTypeDefinition | TypeRefDataTypeDefinition | LiteralDataTypeDefinition | DiscriminatedUnionDataTypeDefinition;
144
+ export type PointerExpressionValue = string | {
145
+ $literal: JsonValue;
146
+ } | {
147
+ [key: string]: PointerExpressionValue;
148
+ };
107
149
  export interface VersionedLink<T extends string> {
108
150
  sys: {
109
151
  type: 'Link';
@@ -1 +1 @@
1
- {"version":3,"file":"common-types.js","sources":["../../lib/common-types.ts"],"sourcesContent":[null],"names":[],"mappings":"AA6wGA;IACY;AAAZ,CAAA,UAAY,+BAA+B,EAAA;AACzC,IAAA,+BAAA,CAAA,4BAAA,CAAA,GAAA,uDAAoF;AACtF,CAAC,EAFW,+BAA+B,KAA/B,+BAA+B,GAAA,EAAA,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"common-types.js","sources":["../../lib/common-types.ts"],"sourcesContent":[null],"names":[],"mappings":"AA80GA;IACY;AAAZ,CAAA,UAAY,+BAA+B,EAAA;AACzC,IAAA,+BAAA,CAAA,4BAAA,CAAA,GAAA,uDAAoF;AACtF,CAAC,EAFW,+BAA+B,KAA/B,+BAA+B,GAAA,EAAA,CAAA,CAAA;;;;"}
@@ -1,5 +1,5 @@
1
1
  import type { Except } from 'type-fest';
2
- import type { CursorPaginationParams, ExoCursorPaginatedCollectionProp, ExoMetadataProps, ExoQueryFilters, Link, ResourceLink } from '../common-types';
2
+ import type { CursorPaginationParams, DataTypeDefinition, ExoCursorPaginatedCollectionProp, ExoMetadataProps, ExoQueryFilters, Link, ResourceLink } from '../common-types';
3
3
  export type ComponentTypeQueryOptions = CursorPaginationParams & ExoQueryFilters & {
4
4
  order?: string;
5
5
  };
@@ -9,30 +9,12 @@ export type ComponentTypeViewport = {
9
9
  displayName: string;
10
10
  previewSize: string;
11
11
  };
12
- export type ComponentTypePrimitiveContentProperty = {
12
+ export type ComponentTypeContentProperty = DataTypeDefinition & {
13
13
  id: string;
14
14
  name: string;
15
- type: 'String' | 'Number' | 'Boolean';
16
15
  required: boolean;
17
16
  defaultValue?: unknown;
18
17
  };
19
- export type ComponentTypeTypeRefContentProperty = {
20
- id: string;
21
- name: string;
22
- type: 'TypeRef';
23
- ref: ResourceLink<'Contentful:DataAssembly'> | ResourceLink<'Contentful:ComponentType'>;
24
- required: boolean;
25
- };
26
- export type ComponentTypeContentProperty = ComponentTypePrimitiveContentProperty | ComponentTypeTypeRefContentProperty;
27
- export type ComponentTypeDesignPropertyValidation = {
28
- type: 'ManualDesignValue';
29
- value: string | number | boolean;
30
- name?: string;
31
- } | {
32
- type: 'DesignToken';
33
- value: string;
34
- name?: string;
35
- };
36
18
  export type StringDesignPropertyRegexpValidation = {
37
19
  regexp: {
38
20
  pattern: string;
@@ -47,30 +29,29 @@ export type DTCGDesignPropertyType = 'DTCG.Color' | 'DTCG.Dimension' | 'DTCG.Fon
47
29
  type DesignPropertyCommonFields = {
48
30
  id: string;
49
31
  name: string;
50
- required: boolean;
51
32
  description?: string;
52
33
  };
53
- export type LegacyDesignProperty = DesignPropertyCommonFields & {
54
- type: 'Symbol' | 'Number' | 'Boolean';
55
- defaultValue?: DesignPropertyDefinitionValue;
56
- validations?: {
57
- in?: ComponentTypeDesignPropertyValidation[];
58
- };
59
- };
60
34
  export type StringDesignProperty = DesignPropertyCommonFields & {
61
35
  type: 'String';
62
- defaultValue?: {
36
+ fallbackValue?: {
63
37
  type: 'ManualDesignValue';
64
38
  value: string;
65
39
  };
66
40
  validations?: StringDesignPropertyRegexpValidation[];
67
41
  };
42
+ export type BooleanDesignProperty = DesignPropertyCommonFields & {
43
+ type: 'Boolean';
44
+ fallbackValue?: {
45
+ type: 'ManualDesignValue';
46
+ value: boolean;
47
+ };
48
+ };
68
49
  export type TokenBackedDesignProperty = DesignPropertyCommonFields & {
69
50
  type: DTCGDesignPropertyType;
70
- defaultValue?: DesignTokenValue;
51
+ fallbackValue?: DesignTokenValue;
71
52
  allowedResources?: DesignTokenAllowedResource[];
72
53
  };
73
- export type ComponentTypeDesignProperty = LegacyDesignProperty | StringDesignProperty | TokenBackedDesignProperty;
54
+ export type ComponentTypeDesignProperty = StringDesignProperty | BooleanDesignProperty | TokenBackedDesignProperty;
74
55
  export type ComponentTypeDimensionKeyMap = {
75
56
  designProperties: Record<string, Record<string, string>>;
76
57
  };
@@ -85,7 +66,6 @@ export type DesignTokenValue = {
85
66
  /** Must be non-empty (min length 1) */
86
67
  value: string;
87
68
  };
88
- export type DesignPropertyDefinitionValue = ManualDesignValue | DesignTokenValue;
89
69
  export type DesignPropertyValue = ManualDesignValue | DesignTokenValue;
90
70
  export type DimensionedDesignPropertyValue = Record<string, DesignPropertyValue>;
91
71
  export type ComponentTreeDesignPropertyValue = DesignPropertyValue | DesignPropertyPointerValue | DimensionedDesignPropertyValue;
@@ -93,17 +73,16 @@ export type ComponentNode = {
93
73
  id: string;
94
74
  name?: string;
95
75
  nodeType: 'Component';
96
- componentTypeId: string;
76
+ componentType: ResourceLink<'Contentful:ComponentType'>;
97
77
  contentProperties: Record<string, ContentPropertyPointerValue | unknown> | string;
98
78
  designProperties: Record<string, ComponentTreeDesignPropertyValue>;
99
79
  slots: Record<string, TreeNode[]>;
100
- contentBindings?: string;
101
80
  };
102
81
  export type FragmentNode = {
103
82
  id: string;
104
83
  name?: string;
105
84
  nodeType: 'Fragment';
106
- fragmentId: string;
85
+ fragment: ResourceLink<'Contentful:Fragment'>;
107
86
  };
108
87
  export type SlotNode = {
109
88
  id: string;
@@ -111,13 +90,22 @@ export type SlotNode = {
111
90
  slotId: string;
112
91
  };
113
92
  export type TreeNode = ComponentNode | FragmentNode | SlotNode;
114
- export type DataAssemblyLink = Link<'DataAssembly'>;
93
+ export type DataAssemblyLink = ResourceLink<'Contentful:DataAssembly'>;
115
94
  export type ComponentTypeSlotDefinition = {
116
95
  id: string;
117
96
  name: string;
118
- componentTypeId: string[];
119
97
  required: boolean;
120
- 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
+ }>;
121
109
  };
122
110
  export type ComponentTypeSys = {
123
111
  id: string;
@@ -153,13 +141,16 @@ export type ComponentTypeProps = {
153
141
  dataAssemblies?: DataAssemblyLink[];
154
142
  source?: ResourceLink<'Contentful:DesignSystemSource'>;
155
143
  };
156
- export type CreateComponentTypeProps = Except<ComponentTypeProps, 'sys'>;
157
- export type UpsertComponentTypeProps = Except<ComponentTypeProps, 'sys'> & {
144
+ export type CreateComponentTypeProps = Except<ComponentTypeProps, 'sys' | 'source'> & {
145
+ source?: ResourceLink<'Contentful:DesignSystemSource'> | null;
146
+ };
147
+ export type UpsertComponentTypeProps = Except<ComponentTypeProps, 'sys' | 'source'> & {
158
148
  sys: {
159
149
  id: string;
160
150
  type: 'ComponentType';
161
151
  version?: number;
162
152
  };
153
+ source?: ResourceLink<'Contentful:DesignSystemSource'> | null;
163
154
  };
164
155
  export type ComponentTypeCollection = ExoCursorPaginatedCollectionProp<ComponentTypeProps>;
165
156
  export {};
@@ -1,19 +1,9 @@
1
- import type { CursorPaginationParams, ExoCursorPaginatedCollectionProp, Link, MetadataProps, ResourceLink } from '../common-types';
2
- export type DataAssemblyPrimitiveDataTypeField = {
1
+ import type { CursorPaginationParams, DataTypeDefinition, ExoCursorPaginatedCollectionProp, Link, MetadataProps, PointerExpressionValue, ResourceLink } from '../common-types';
2
+ export type DataAssemblyDataTypeField = DataTypeDefinition & {
3
3
  id: string;
4
4
  name: string;
5
- type: string;
6
- required: boolean;
7
5
  source?: string;
8
6
  };
9
- export type DataAssemblyTypeRefDataTypeField = {
10
- id: string;
11
- name: string;
12
- type: 'TypeRef';
13
- ref: ResourceLink<'Contentful:DataAssembly'>;
14
- required: boolean;
15
- };
16
- export type DataAssemblyDataTypeField = DataAssemblyPrimitiveDataTypeField | DataAssemblyTypeRefDataTypeField;
17
7
  export type DataAssemblyLinkParameter = {
18
8
  name?: string;
19
9
  description?: string;
@@ -36,33 +26,16 @@ export type DataAssemblyParameterConfig = Record<string, DataAssemblyLinkParamet
36
26
  export type DataAssemblyGraphQLResolver = {
37
27
  source: 'Contentful:GraphQL';
38
28
  query: string;
39
- parameters?: Record<string, unknown>;
29
+ parameters?: PointerExpressionValue;
40
30
  };
41
31
  export type DataAssemblyNestedResolver = {
42
32
  source: 'Contentful:DataAssembly';
43
33
  dataAssembly: ResourceLink<'Contentful:DataAssembly'>;
44
- parameters?: Record<string, unknown>;
34
+ parameters?: PointerExpressionValue;
45
35
  };
46
36
  export type DataAssemblyResolverDefinition = DataAssemblyGraphQLResolver | DataAssemblyNestedResolver;
47
37
  export type DataAssemblyResolverConfig = Record<string, DataAssemblyResolverDefinition>;
48
- export type DataAssemblyReturnMappingSelectValue = string | {
49
- $on: {
50
- type: Record<string, DataAssemblyReturnMappingSelectValue>;
51
- default?: DataAssemblyReturnMappingSelectValue;
52
- };
53
- } | {
54
- [key: string]: DataAssemblyReturnMappingSelectValue;
55
- };
56
- export type DataAssemblyReturnMappingFromObject = {
57
- $from: {
58
- source: string;
59
- select?: DataAssemblyReturnMappingSelectValue;
60
- };
61
- };
62
- export type DataAssemblyReturnMappingValue = string | DataAssemblyReturnMappingFromObject | {
63
- [key: string]: DataAssemblyReturnMappingValue;
64
- };
65
- export type DataAssemblyReturnMappingConfig = Record<string, DataAssemblyReturnMappingValue>;
38
+ export type DataAssemblyReturnMappingConfig = Record<string, PointerExpressionValue>;
66
39
  export type DataAssemblySys = {
67
40
  id: string;
68
41
  type: 'DataAssembly';
@@ -1,4 +1,4 @@
1
- import type { CursorPaginationParams, ExoCursorPaginatedCollectionProp, ExperienceMetadataProps, ExoQueryFilters, Link } from '../common-types';
1
+ import type { CursorPaginationParams, ExoCursorPaginatedCollectionProp, ExperienceMetadataProps, ExoQueryFilters, Link, ResourceLink } from '../common-types';
2
2
  import type { ComponentTypeViewport, DimensionedDesignPropertyValue, FragmentNode } from './component-type';
3
3
  export type ExperienceDimensionKeyMap = {
4
4
  designProperties: Record<string, {
@@ -6,12 +6,8 @@ export type ExperienceDimensionKeyMap = {
6
6
  }>;
7
7
  };
8
8
  export type ExperienceContentBindings = {
9
- sys: {
10
- type: 'Link';
11
- id: string;
12
- linkType: 'DataAssembly';
13
- };
14
- parameters: Record<string, Link<string>>;
9
+ sys: ResourceLink<'Contentful:DataAssembly'>['sys'];
10
+ parameters: Record<string, ResourceLink<string>>;
15
11
  };
16
12
  export type ExperienceSys = {
17
13
  id: string;
@@ -19,7 +15,7 @@ export type ExperienceSys = {
19
15
  version: number;
20
16
  space: Link<'Space'>;
21
17
  environment: Link<'Environment'>;
22
- template?: Link<'Template'>;
18
+ template: ResourceLink<'Contentful:Template'>;
23
19
  createdAt: string;
24
20
  updatedAt: string;
25
21
  createdBy: Link<'User'>;
@@ -41,7 +37,6 @@ type ExperienceCommonProps = {
41
37
  name: string;
42
38
  description: string;
43
39
  viewports: ComponentTypeViewport[];
44
- contentProperties: Record<string, unknown>;
45
40
  designProperties: Record<string, DimensionedDesignPropertyValue>;
46
41
  dimensionKeyMap: ExperienceDimensionKeyMap;
47
42
  contentBindings?: ExperienceContentBindings;
@@ -60,7 +55,7 @@ export type ExperienceLocalePublishPayload = {
60
55
  remove: string[];
61
56
  };
62
57
  export type CreateExperienceProps = ExperienceCommonProps & {
63
- template: Link<'Template'>;
58
+ template: ResourceLink<'Contentful:Template'>;
64
59
  };
65
60
  export type UpsertExperienceProps = ExperienceCommonProps & {
66
61
  sys: {
@@ -68,12 +63,12 @@ export type UpsertExperienceProps = ExperienceCommonProps & {
68
63
  type: 'Experience';
69
64
  version?: number;
70
65
  };
71
- template?: Link<'Template'>;
66
+ template?: ResourceLink<'Contentful:Template'>;
72
67
  };
73
68
  export type InlineFragmentNode = {
74
69
  id: string;
75
70
  nodeType: 'InlineFragment';
76
- componentTypeId: string;
71
+ componentType: ResourceLink<'Contentful:ComponentType'>;
77
72
  designProperties: Record<string, DimensionedDesignPropertyValue>;
78
73
  contentBindings?: ExperienceContentBindings;
79
74
  slots?: Record<string, Array<FragmentNode | InlineFragmentNode>>;
@@ -1,5 +1,5 @@
1
1
  import type { Except } from 'type-fest';
2
- import type { CursorPaginationParams, ExoCursorPaginatedCollectionProp, ExoQueryFilters, ExperienceMetadataProps, Link } from '../common-types';
2
+ import type { CursorPaginationParams, ExoCursorPaginatedCollectionProp, ExoQueryFilters, ExperienceMetadataProps, Link, ResourceLink } from '../common-types';
3
3
  import type { ComponentTypeViewport, DimensionedDesignPropertyValue, FragmentNode } from './component-type';
4
4
  import type { ExperienceContentBindings, ExperienceDimensionKeyMap, InlineFragmentNode } from './experience';
5
5
  export type FragmentSys = {
@@ -8,7 +8,7 @@ export type FragmentSys = {
8
8
  version: number;
9
9
  space: Link<'Space'>;
10
10
  environment: Link<'Environment'>;
11
- componentType: Link<'ComponentType'>;
11
+ componentType: ResourceLink<'Contentful:ComponentType'>;
12
12
  archivedAt?: string;
13
13
  archivedBy?: Link<'User'>;
14
14
  archivedVersion?: number;
@@ -37,7 +37,7 @@ export type FragmentProps = {
37
37
  slots?: Record<string, Array<FragmentNode | InlineFragmentNode>>;
38
38
  };
39
39
  export type CreateFragmentProps = Except<FragmentProps, 'sys'> & {
40
- componentType: Link<'ComponentType'>;
40
+ componentType: ResourceLink<'Contentful:ComponentType'>;
41
41
  };
42
42
  export type UpdateFragmentProps = Omit<FragmentProps, 'sys'> & {
43
43
  sys: {
@@ -45,6 +45,7 @@ export type UpdateFragmentProps = Omit<FragmentProps, 'sys'> & {
45
45
  type: 'Fragment';
46
46
  version: number;
47
47
  };
48
+ componentType?: ResourceLink<'Contentful:ComponentType'>;
48
49
  };
49
50
  export type FragmentQueryOptions = CursorPaginationParams & ExoQueryFilters & {
50
51
  order?: string;
@@ -89,4 +89,4 @@ export type { ComponentTypeCollection } from './entities/component-type';
89
89
  export type { TemplateCollection } from './entities/template';
90
90
  export type { ExperienceCollection, ReleaseExperience, ReleaseExperienceCollection, ReleaseExperienceSys, } from './entities/experience';
91
91
  export type { FragmentCollection } from './entities/fragment';
92
- export type { DataAssemblyCollection, DataAssemblyResourceLinkParameter, DataAssemblyReturnMappingFromObject, DataAssemblyReturnMappingSelectValue, } from './entities/data-assembly';
92
+ export type { DataAssemblyCollection, DataAssemblyResourceLinkParameter, } from './entities/data-assembly';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentful-management",
3
- "version": "12.6.0-dev.1",
3
+ "version": "12.6.0-dev.2",
4
4
  "description": "Client for Contentful's Content Management API",
5
5
  "homepage": "https://www.contentful.com/developers/documentation/content-management-api/",
6
6
  "exports": {