contentful-management 12.6.0-dev.1 → 12.6.0-dev.3
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/browser/index.js +53 -53
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.min.js +1 -1
- package/dist/browser/index.min.js.map +1 -1
- package/dist/cjs/index.cjs +53 -53
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/adapters/REST/endpoints/fragment.mjs +2 -2
- package/dist/esm/common-types.mjs.map +1 -1
- package/dist/esm/plain/plain-client.mjs +1 -1
- package/dist/types/adapters/REST/endpoints/fragment.d.ts +1 -1
- package/dist/types/adapters/REST/endpoints/fragment.js +2 -2
- package/dist/types/common-types.d.ts +58 -4
- package/dist/types/common-types.js.map +1 -1
- package/dist/types/entities/component-type.d.ts +32 -44
- package/dist/types/entities/data-assembly.d.ts +16 -41
- package/dist/types/entities/experience.d.ts +7 -18
- package/dist/types/entities/fragment.d.ts +7 -7
- package/dist/types/entities/template.d.ts +1 -2
- package/dist/types/export-types.d.ts +1 -1
- package/dist/types/plain/entities/component-type.d.ts +0 -1
- package/dist/types/plain/entities/experience.d.ts +0 -1
- package/dist/types/plain/entities/fragment.d.ts +6 -7
- package/dist/types/plain/entities/template.d.ts +0 -1
- package/dist/types/plain/plain-client.js +1 -1
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ const create = (http, params, rawData, headers) => {
|
|
|
15
15
|
const data = copy(rawData);
|
|
16
16
|
return post(http, getBaseUrl(params), data, { headers });
|
|
17
17
|
};
|
|
18
|
-
const
|
|
18
|
+
const upsert = (http, params, rawData, headers) => {
|
|
19
19
|
const { sys, ...body } = copy(rawData);
|
|
20
20
|
return put(http, getBaseUrl(params) + `/${params.fragmentId}`, body, {
|
|
21
21
|
headers: {
|
|
@@ -46,5 +46,5 @@ const unpublish = (http, params, headers) => {
|
|
|
46
46
|
});
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
export { create, del, get, getMany, publish, unpublish,
|
|
49
|
+
export { create, del, get, getMany, publish, unpublish, upsert };
|
|
50
50
|
//# sourceMappingURL=fragment.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common-types.mjs","sources":["../../lib/common-types.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"common-types.mjs","sources":["../../lib/common-types.ts"],"sourcesContent":[null],"names":[],"mappings":"AAi1GA;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;;;;"}
|
|
@@ -602,7 +602,7 @@ const createPlainClient = (makeRequest, defaults) => {
|
|
|
602
602
|
getMany: wrap(wrapParams, 'Fragment', 'getMany'),
|
|
603
603
|
get: wrap(wrapParams, 'Fragment', 'get'),
|
|
604
604
|
create: wrap(wrapParams, 'Fragment', 'create'),
|
|
605
|
-
|
|
605
|
+
upsert: wrap(wrapParams, 'Fragment', 'upsert'),
|
|
606
606
|
delete: wrap(wrapParams, 'Fragment', 'delete'),
|
|
607
607
|
publish: wrap(wrapParams, 'Fragment', 'publish'),
|
|
608
608
|
unpublish: wrap(wrapParams, 'Fragment', 'unpublish'),
|
|
@@ -2,7 +2,7 @@ import type { RestEndpoint } from '../types';
|
|
|
2
2
|
export declare const getMany: RestEndpoint<'Fragment', 'getMany'>;
|
|
3
3
|
export declare const get: RestEndpoint<'Fragment', 'get'>;
|
|
4
4
|
export declare const create: RestEndpoint<'Fragment', 'create'>;
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const upsert: RestEndpoint<'Fragment', 'upsert'>;
|
|
6
6
|
export declare const del: RestEndpoint<'Fragment', 'delete'>;
|
|
7
7
|
export declare const publish: RestEndpoint<'Fragment', 'publish'>;
|
|
8
8
|
export declare const unpublish: RestEndpoint<'Fragment', 'unpublish'>;
|
|
@@ -15,7 +15,7 @@ const create = (http, params, rawData, headers) => {
|
|
|
15
15
|
const data = copy(rawData);
|
|
16
16
|
return post(http, getBaseUrl(params), data, { headers });
|
|
17
17
|
};
|
|
18
|
-
const
|
|
18
|
+
const upsert = (http, params, rawData, headers) => {
|
|
19
19
|
const { sys, ...body } = copy(rawData);
|
|
20
20
|
return put(http, getBaseUrl(params) + `/${params.fragmentId}`, body, {
|
|
21
21
|
headers: {
|
|
@@ -46,5 +46,5 @@ const unpublish = (http, params, headers) => {
|
|
|
46
46
|
});
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
export { create, del, get, getMany, publish, unpublish,
|
|
49
|
+
export { create, del, get, getMany, publish, unpublish, upsert };
|
|
50
50
|
//# sourceMappingURL=fragment.js.map
|
|
@@ -17,7 +17,7 @@ import type { AvailableLicenseProps } from './entities/available-license';
|
|
|
17
17
|
import type { BulkActionProps, BulkActionPublishPayload, BulkActionUnpublishPayload, BulkActionV2Payload, BulkActionValidatePayload, PublishBulkActionV2Payload, UnpublishBulkActionV2Payload, ValidateBulkActionV2Payload } from './entities/bulk-action';
|
|
18
18
|
import type { CommentProps, CreateCommentParams, CreateCommentProps, DeleteCommentParams, GetCommentParentEntityParams, GetManyCommentsParams, PlainTextBodyFormat, RichTextBodyFormat, RichTextCommentBodyPayload, RichTextCommentProps, UpdateCommentParams, UpdateCommentProps } from './entities/comment';
|
|
19
19
|
import type { ComponentTypeProps, ComponentTypeQueryOptions, CreateComponentTypeProps, UpsertComponentTypeProps } from './entities/component-type';
|
|
20
|
-
import type { CreateFragmentProps, FragmentProps, FragmentQueryOptions,
|
|
20
|
+
import type { CreateFragmentProps, FragmentProps, FragmentQueryOptions, UpsertFragmentProps } from './entities/fragment';
|
|
21
21
|
import type { CreateTemplateProps, TemplateProps, TemplateQueryOptions, UpsertTemplateProps } from './entities/template';
|
|
22
22
|
import type { CreateExperienceProps, UpsertExperienceProps, ExperienceLocalePublishPayload, ExperienceProps, ExperienceQueryOptions } from './entities/experience';
|
|
23
23
|
import type { ContentTypeProps, CreateContentTypeProps } from './entities/content-type';
|
|
@@ -104,6 +104,60 @@ 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
|
+
$from: string | {
|
|
146
|
+
source: string;
|
|
147
|
+
select?: PointerExpressionValue;
|
|
148
|
+
};
|
|
149
|
+
} | {
|
|
150
|
+
$literal: JsonValue;
|
|
151
|
+
} | {
|
|
152
|
+
$object: Record<string, PointerExpressionValue>;
|
|
153
|
+
} | {
|
|
154
|
+
$on: {
|
|
155
|
+
type: Record<string, PointerExpressionValue>;
|
|
156
|
+
default?: PointerExpressionValue;
|
|
157
|
+
};
|
|
158
|
+
} | {
|
|
159
|
+
[key: string]: PointerExpressionValue;
|
|
160
|
+
};
|
|
107
161
|
export interface VersionedLink<T extends string> {
|
|
108
162
|
sys: {
|
|
109
163
|
type: 'Link';
|
|
@@ -670,7 +724,7 @@ type MRInternal<UA extends boolean> = {
|
|
|
670
724
|
(opts: MROpts<'Fragment', 'getMany', UA>): MRReturn<'Fragment', 'getMany'>;
|
|
671
725
|
(opts: MROpts<'Fragment', 'get', UA>): MRReturn<'Fragment', 'get'>;
|
|
672
726
|
(opts: MROpts<'Fragment', 'create', UA>): MRReturn<'Fragment', 'create'>;
|
|
673
|
-
(opts: MROpts<'Fragment', '
|
|
727
|
+
(opts: MROpts<'Fragment', 'upsert', UA>): MRReturn<'Fragment', 'upsert'>;
|
|
674
728
|
(opts: MROpts<'Fragment', 'delete', UA>): MRReturn<'Fragment', 'delete'>;
|
|
675
729
|
(opts: MROpts<'Fragment', 'publish', UA>): MRReturn<'Fragment', 'publish'>;
|
|
676
730
|
(opts: MROpts<'Fragment', 'unpublish', UA>): MRReturn<'Fragment', 'unpublish'>;
|
|
@@ -2902,9 +2956,9 @@ export type MRActions = {
|
|
|
2902
2956
|
payload: CreateFragmentProps;
|
|
2903
2957
|
return: FragmentProps;
|
|
2904
2958
|
};
|
|
2905
|
-
|
|
2959
|
+
upsert: {
|
|
2906
2960
|
params: GetFragmentParams;
|
|
2907
|
-
payload:
|
|
2961
|
+
payload: UpsertFragmentProps;
|
|
2908
2962
|
return: FragmentProps;
|
|
2909
2963
|
};
|
|
2910
2964
|
delete: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common-types.js","sources":["../../lib/common-types.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"common-types.js","sources":["../../lib/common-types.ts"],"sourcesContent":[null],"names":[],"mappings":"AAi1GA;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
|
|
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,33 +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
|
-
|
|
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
|
-
|
|
51
|
+
fallbackValue?: DesignTokenValue;
|
|
71
52
|
allowedResources?: DesignTokenAllowedResource[];
|
|
72
53
|
};
|
|
73
|
-
export type ComponentTypeDesignProperty =
|
|
74
|
-
export type ComponentTypeDimensionKeyMap = {
|
|
75
|
-
designProperties: Record<string, Record<string, string>>;
|
|
76
|
-
};
|
|
54
|
+
export type ComponentTypeDesignProperty = StringDesignProperty | BooleanDesignProperty | TokenBackedDesignProperty;
|
|
77
55
|
export type ContentPropertyPointerValue = `$contentProperties/${string}`;
|
|
78
56
|
export type DesignPropertyPointerValue = `$designProperties/${string}`;
|
|
79
57
|
export type ManualDesignValue = {
|
|
@@ -85,7 +63,6 @@ export type DesignTokenValue = {
|
|
|
85
63
|
/** Must be non-empty (min length 1) */
|
|
86
64
|
value: string;
|
|
87
65
|
};
|
|
88
|
-
export type DesignPropertyDefinitionValue = ManualDesignValue | DesignTokenValue;
|
|
89
66
|
export type DesignPropertyValue = ManualDesignValue | DesignTokenValue;
|
|
90
67
|
export type DimensionedDesignPropertyValue = Record<string, DesignPropertyValue>;
|
|
91
68
|
export type ComponentTreeDesignPropertyValue = DesignPropertyValue | DesignPropertyPointerValue | DimensionedDesignPropertyValue;
|
|
@@ -93,17 +70,16 @@ export type ComponentNode = {
|
|
|
93
70
|
id: string;
|
|
94
71
|
name?: string;
|
|
95
72
|
nodeType: 'Component';
|
|
96
|
-
|
|
73
|
+
componentType: ResourceLink<'Contentful:ComponentType'>;
|
|
97
74
|
contentProperties: Record<string, ContentPropertyPointerValue | unknown> | string;
|
|
98
75
|
designProperties: Record<string, ComponentTreeDesignPropertyValue>;
|
|
99
76
|
slots: Record<string, TreeNode[]>;
|
|
100
|
-
contentBindings?: string;
|
|
101
77
|
};
|
|
102
78
|
export type FragmentNode = {
|
|
103
79
|
id: string;
|
|
104
80
|
name?: string;
|
|
105
81
|
nodeType: 'Fragment';
|
|
106
|
-
|
|
82
|
+
fragment: ResourceLink<'Contentful:Fragment'>;
|
|
107
83
|
};
|
|
108
84
|
export type SlotNode = {
|
|
109
85
|
id: string;
|
|
@@ -111,13 +87,23 @@ export type SlotNode = {
|
|
|
111
87
|
slotId: string;
|
|
112
88
|
};
|
|
113
89
|
export type TreeNode = ComponentNode | FragmentNode | SlotNode;
|
|
114
|
-
export type DataAssemblyLink =
|
|
90
|
+
export type DataAssemblyLink = ResourceLink<'Contentful:DataAssembly'>;
|
|
91
|
+
export declare const COMPONENT_TYPE_ALLOWED_RESOURCE_SOURCE: "crn:contentful:::experience:spaces/$self/environments/$self";
|
|
115
92
|
export type ComponentTypeSlotDefinition = {
|
|
116
93
|
id: string;
|
|
117
94
|
name: string;
|
|
118
|
-
componentTypeId: string[];
|
|
119
95
|
required: boolean;
|
|
120
|
-
validations:
|
|
96
|
+
validations: Array<{
|
|
97
|
+
size?: {
|
|
98
|
+
min?: number;
|
|
99
|
+
max?: number;
|
|
100
|
+
};
|
|
101
|
+
}>;
|
|
102
|
+
allowedResources?: Array<{
|
|
103
|
+
type: 'Contentful:ComponentType';
|
|
104
|
+
source: typeof COMPONENT_TYPE_ALLOWED_RESOURCE_SOURCE;
|
|
105
|
+
allowedTypes: string[];
|
|
106
|
+
}>;
|
|
121
107
|
};
|
|
122
108
|
export type ComponentTypeSys = {
|
|
123
109
|
id: string;
|
|
@@ -146,20 +132,22 @@ export type ComponentTypeProps = {
|
|
|
146
132
|
viewports: ComponentTypeViewport[];
|
|
147
133
|
contentProperties: ComponentTypeContentProperty[];
|
|
148
134
|
designProperties: ComponentTypeDesignProperty[];
|
|
149
|
-
dimensionKeyMap: ComponentTypeDimensionKeyMap;
|
|
150
135
|
componentTree?: TreeNode[];
|
|
151
136
|
slots?: ComponentTypeSlotDefinition[];
|
|
152
137
|
metadata?: ExoMetadataProps;
|
|
153
138
|
dataAssemblies?: DataAssemblyLink[];
|
|
154
139
|
source?: ResourceLink<'Contentful:DesignSystemSource'>;
|
|
155
140
|
};
|
|
156
|
-
export type CreateComponentTypeProps = Except<ComponentTypeProps, 'sys'
|
|
157
|
-
|
|
141
|
+
export type CreateComponentTypeProps = Except<ComponentTypeProps, 'sys' | 'source'> & {
|
|
142
|
+
source?: ResourceLink<'Contentful:DesignSystemSource'> | null;
|
|
143
|
+
};
|
|
144
|
+
export type UpsertComponentTypeProps = Except<ComponentTypeProps, 'sys' | 'source'> & {
|
|
158
145
|
sys: {
|
|
159
146
|
id: string;
|
|
160
147
|
type: 'ComponentType';
|
|
161
148
|
version?: number;
|
|
162
149
|
};
|
|
150
|
+
source?: ResourceLink<'Contentful:DesignSystemSource'> | null;
|
|
163
151
|
};
|
|
164
152
|
export type ComponentTypeCollection = ExoCursorPaginatedCollectionProp<ComponentTypeProps>;
|
|
165
153
|
export {};
|
|
@@ -1,68 +1,43 @@
|
|
|
1
|
-
import type { CursorPaginationParams, ExoCursorPaginatedCollectionProp, Link, MetadataProps, ResourceLink } from '../common-types';
|
|
2
|
-
export
|
|
1
|
+
import type { CursorPaginationParams, DataTypeDefinition, ExoCursorPaginatedCollectionProp, Link, MetadataProps, PointerExpressionValue, ResourceLink } from '../common-types';
|
|
2
|
+
export declare const SAME_SPACE_CONTENT_SOURCE: "crn:contentful:::content:spaces/$self/environments/$self";
|
|
3
|
+
export type CanonicalDataAssemblyDataTypeField = DataTypeDefinition & {
|
|
3
4
|
id: string;
|
|
4
5
|
name: string;
|
|
5
|
-
type: string;
|
|
6
|
-
required: boolean;
|
|
7
|
-
source?: string;
|
|
8
6
|
};
|
|
9
|
-
export type
|
|
7
|
+
export type LegacyDataAssemblyDataTypeField = {
|
|
10
8
|
id: string;
|
|
11
9
|
name: string;
|
|
12
|
-
type:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export type DataAssemblyDataTypeField = DataAssemblyPrimitiveDataTypeField | DataAssemblyTypeRefDataTypeField;
|
|
17
|
-
export type DataAssemblyLinkParameter = {
|
|
18
|
-
name?: string;
|
|
19
|
-
description?: string;
|
|
20
|
-
type: 'Link';
|
|
21
|
-
linkType: string;
|
|
22
|
-
allowedContentTypes: string[];
|
|
10
|
+
type: string;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
source?: string;
|
|
13
|
+
ref?: unknown;
|
|
23
14
|
};
|
|
15
|
+
export type DataAssemblyDataTypeField = CanonicalDataAssemblyDataTypeField | LegacyDataAssemblyDataTypeField;
|
|
24
16
|
export type DataAssemblyResourceLinkParameter = {
|
|
25
17
|
name?: string;
|
|
26
18
|
description?: string;
|
|
27
19
|
type: 'ResourceLink';
|
|
28
|
-
linkType:
|
|
20
|
+
linkType: 'Contentful:Entry';
|
|
29
21
|
allowedResources: Array<{
|
|
30
|
-
type:
|
|
31
|
-
source:
|
|
22
|
+
type: 'Contentful:Entry';
|
|
23
|
+
source: typeof SAME_SPACE_CONTENT_SOURCE;
|
|
32
24
|
allowedTypes: string[];
|
|
33
25
|
}>;
|
|
34
26
|
};
|
|
35
|
-
export type DataAssemblyParameterConfig = Record<string,
|
|
27
|
+
export type DataAssemblyParameterConfig = Record<string, DataAssemblyResourceLinkParameter>;
|
|
36
28
|
export type DataAssemblyGraphQLResolver = {
|
|
37
29
|
source: 'Contentful:GraphQL';
|
|
38
30
|
query: string;
|
|
39
|
-
parameters?:
|
|
31
|
+
parameters?: PointerExpressionValue;
|
|
40
32
|
};
|
|
41
33
|
export type DataAssemblyNestedResolver = {
|
|
42
34
|
source: 'Contentful:DataAssembly';
|
|
43
35
|
dataAssembly: ResourceLink<'Contentful:DataAssembly'>;
|
|
44
|
-
parameters?:
|
|
36
|
+
parameters?: PointerExpressionValue;
|
|
45
37
|
};
|
|
46
38
|
export type DataAssemblyResolverDefinition = DataAssemblyGraphQLResolver | DataAssemblyNestedResolver;
|
|
47
39
|
export type DataAssemblyResolverConfig = Record<string, DataAssemblyResolverDefinition>;
|
|
48
|
-
export type
|
|
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>;
|
|
40
|
+
export type DataAssemblyReturnMappingConfig = PointerExpressionValue;
|
|
66
41
|
export type DataAssemblySys = {
|
|
67
42
|
id: string;
|
|
68
43
|
type: 'DataAssembly';
|
|
@@ -1,17 +1,8 @@
|
|
|
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
|
-
export type ExperienceDimensionKeyMap = {
|
|
4
|
-
designProperties: Record<string, {
|
|
5
|
-
breakpoint: string;
|
|
6
|
-
}>;
|
|
7
|
-
};
|
|
8
3
|
export type ExperienceContentBindings = {
|
|
9
|
-
sys:
|
|
10
|
-
|
|
11
|
-
id: string;
|
|
12
|
-
linkType: 'DataAssembly';
|
|
13
|
-
};
|
|
14
|
-
parameters: Record<string, Link<string>>;
|
|
4
|
+
sys: ResourceLink<'Contentful:DataAssembly'>['sys'];
|
|
5
|
+
parameters: Record<string, ResourceLink<string>>;
|
|
15
6
|
};
|
|
16
7
|
export type ExperienceSys = {
|
|
17
8
|
id: string;
|
|
@@ -19,7 +10,7 @@ export type ExperienceSys = {
|
|
|
19
10
|
version: number;
|
|
20
11
|
space: Link<'Space'>;
|
|
21
12
|
environment: Link<'Environment'>;
|
|
22
|
-
template
|
|
13
|
+
template: ResourceLink<'Contentful:Template'>;
|
|
23
14
|
createdAt: string;
|
|
24
15
|
updatedAt: string;
|
|
25
16
|
createdBy: Link<'User'>;
|
|
@@ -41,9 +32,7 @@ type ExperienceCommonProps = {
|
|
|
41
32
|
name: string;
|
|
42
33
|
description: string;
|
|
43
34
|
viewports: ComponentTypeViewport[];
|
|
44
|
-
contentProperties: Record<string, unknown>;
|
|
45
35
|
designProperties: Record<string, DimensionedDesignPropertyValue>;
|
|
46
|
-
dimensionKeyMap: ExperienceDimensionKeyMap;
|
|
47
36
|
contentBindings?: ExperienceContentBindings;
|
|
48
37
|
metadata?: ExperienceMetadataProps;
|
|
49
38
|
slots?: Record<string, Array<FragmentNode | InlineFragmentNode>>;
|
|
@@ -60,7 +49,7 @@ export type ExperienceLocalePublishPayload = {
|
|
|
60
49
|
remove: string[];
|
|
61
50
|
};
|
|
62
51
|
export type CreateExperienceProps = ExperienceCommonProps & {
|
|
63
|
-
template:
|
|
52
|
+
template: ResourceLink<'Contentful:Template'>;
|
|
64
53
|
};
|
|
65
54
|
export type UpsertExperienceProps = ExperienceCommonProps & {
|
|
66
55
|
sys: {
|
|
@@ -68,12 +57,12 @@ export type UpsertExperienceProps = ExperienceCommonProps & {
|
|
|
68
57
|
type: 'Experience';
|
|
69
58
|
version?: number;
|
|
70
59
|
};
|
|
71
|
-
template?:
|
|
60
|
+
template?: ResourceLink<'Contentful:Template'>;
|
|
72
61
|
};
|
|
73
62
|
export type InlineFragmentNode = {
|
|
74
63
|
id: string;
|
|
75
64
|
nodeType: 'InlineFragment';
|
|
76
|
-
|
|
65
|
+
componentType: ResourceLink<'Contentful:ComponentType'>;
|
|
77
66
|
designProperties: Record<string, DimensionedDesignPropertyValue>;
|
|
78
67
|
contentBindings?: ExperienceContentBindings;
|
|
79
68
|
slots?: Record<string, Array<FragmentNode | InlineFragmentNode>>;
|
|
@@ -1,14 +1,14 @@
|
|
|
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
|
-
import type { ExperienceContentBindings,
|
|
4
|
+
import type { ExperienceContentBindings, InlineFragmentNode } from './experience';
|
|
5
5
|
export type FragmentSys = {
|
|
6
6
|
id: string;
|
|
7
7
|
type: 'Fragment';
|
|
8
8
|
version: number;
|
|
9
9
|
space: Link<'Space'>;
|
|
10
10
|
environment: Link<'Environment'>;
|
|
11
|
-
componentType:
|
|
11
|
+
componentType: ResourceLink<'Contentful:ComponentType'>;
|
|
12
12
|
archivedAt?: string;
|
|
13
13
|
archivedBy?: Link<'User'>;
|
|
14
14
|
archivedVersion?: number;
|
|
@@ -31,20 +31,20 @@ export type FragmentProps = {
|
|
|
31
31
|
description: string;
|
|
32
32
|
viewports: ComponentTypeViewport[];
|
|
33
33
|
designProperties: Record<string, DimensionedDesignPropertyValue>;
|
|
34
|
-
dimensionKeyMap: ExperienceDimensionKeyMap;
|
|
35
34
|
contentBindings?: ExperienceContentBindings;
|
|
36
35
|
metadata?: ExperienceMetadataProps;
|
|
37
36
|
slots?: Record<string, Array<FragmentNode | InlineFragmentNode>>;
|
|
38
37
|
};
|
|
39
38
|
export type CreateFragmentProps = Except<FragmentProps, 'sys'> & {
|
|
40
|
-
componentType:
|
|
39
|
+
componentType: ResourceLink<'Contentful:ComponentType'>;
|
|
41
40
|
};
|
|
42
|
-
export type
|
|
41
|
+
export type UpsertFragmentProps = Omit<FragmentProps, 'sys'> & {
|
|
43
42
|
sys: {
|
|
44
43
|
id: string;
|
|
45
44
|
type: 'Fragment';
|
|
46
|
-
version
|
|
45
|
+
version?: number;
|
|
47
46
|
};
|
|
47
|
+
componentType?: ResourceLink<'Contentful:ComponentType'>;
|
|
48
48
|
};
|
|
49
49
|
export type FragmentQueryOptions = CursorPaginationParams & ExoQueryFilters & {
|
|
50
50
|
order?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Except } from 'type-fest';
|
|
2
2
|
import type { CursorPaginationParams, ExoCursorPaginatedCollectionProp, ExoMetadataProps, ExoQueryFilters, Link } from '../common-types';
|
|
3
|
-
import type { ComponentTypeContentProperty, ComponentTypeDesignProperty,
|
|
3
|
+
import type { ComponentTypeContentProperty, ComponentTypeDesignProperty, ComponentTypeSlotDefinition, ComponentTypeViewport, DataAssemblyLink, TreeNode } from './component-type';
|
|
4
4
|
export type TemplateSys = {
|
|
5
5
|
id: string;
|
|
6
6
|
type: 'Template';
|
|
@@ -28,7 +28,6 @@ export type TemplateProps = {
|
|
|
28
28
|
viewports: ComponentTypeViewport[];
|
|
29
29
|
contentProperties: ComponentTypeContentProperty[];
|
|
30
30
|
designProperties: ComponentTypeDesignProperty[];
|
|
31
|
-
dimensionKeyMap: ComponentTypeDimensionKeyMap;
|
|
32
31
|
componentTree?: TreeNode[];
|
|
33
32
|
slots?: ComponentTypeSlotDefinition[];
|
|
34
33
|
metadata?: ExoMetadataProps;
|
|
@@ -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,
|
|
92
|
+
export type { DataAssemblyCollection, DataAssemblyResourceLinkParameter, } from './entities/data-assembly';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExoCursorPaginatedCollectionProp, GetFragmentParams, GetSpaceEnvironmentParams } from '../../common-types';
|
|
2
|
-
import type { CreateFragmentProps, FragmentProps, FragmentQueryOptions,
|
|
2
|
+
import type { CreateFragmentProps, FragmentProps, FragmentQueryOptions, UpsertFragmentProps } from '../../entities/fragment';
|
|
3
3
|
import type { OptionalDefaults } from '../wrappers/wrap';
|
|
4
4
|
export type FragmentPlainClientAPI = {
|
|
5
5
|
/**
|
|
@@ -56,28 +56,27 @@ export type FragmentPlainClientAPI = {
|
|
|
56
56
|
* componentType: { sys: { type: 'Link', linkType: 'ComponentType', id: '<component_type_id>' } },
|
|
57
57
|
* viewports: [],
|
|
58
58
|
* designProperties: {},
|
|
59
|
-
* dimensionKeyMap: { designProperties: {} },
|
|
60
59
|
* });
|
|
61
60
|
* ```
|
|
62
61
|
*/
|
|
63
62
|
create(params: OptionalDefaults<GetSpaceEnvironmentParams>, data: CreateFragmentProps): Promise<FragmentProps>;
|
|
64
63
|
/**
|
|
65
|
-
*
|
|
64
|
+
* Upserts a fragment (creates or updates via PUT)
|
|
66
65
|
* @param params the space, environment, and fragment IDs
|
|
67
|
-
* @param data the fragment data (
|
|
68
|
-
* @returns the
|
|
66
|
+
* @param data the fragment data to upsert (include sys.version for updates, omit for creates)
|
|
67
|
+
* @returns the upserted fragment
|
|
69
68
|
* @throws if the request fails, or the space, environment, or fragment is not found
|
|
70
69
|
* @internal - Experimental endpoint, subject to breaking changes without notice
|
|
71
70
|
* @example
|
|
72
71
|
* ```javascript
|
|
73
|
-
* const fragment = await client.fragment.
|
|
72
|
+
* const fragment = await client.fragment.upsert({
|
|
74
73
|
* spaceId: '<space_id>',
|
|
75
74
|
* environmentId: '<environment_id>',
|
|
76
75
|
* fragmentId: '<fragment_id>',
|
|
77
76
|
* }, fragmentData);
|
|
78
77
|
* ```
|
|
79
78
|
*/
|
|
80
|
-
|
|
79
|
+
upsert(params: OptionalDefaults<GetFragmentParams>, data: UpsertFragmentProps): Promise<FragmentProps>;
|
|
81
80
|
/**
|
|
82
81
|
* Deletes a fragment
|
|
83
82
|
* @param params the space, environment, and fragment IDs
|
|
@@ -602,7 +602,7 @@ const createPlainClient = (makeRequest, defaults) => {
|
|
|
602
602
|
getMany: wrap(wrapParams, 'Fragment', 'getMany'),
|
|
603
603
|
get: wrap(wrapParams, 'Fragment', 'get'),
|
|
604
604
|
create: wrap(wrapParams, 'Fragment', 'create'),
|
|
605
|
-
|
|
605
|
+
upsert: wrap(wrapParams, 'Fragment', 'upsert'),
|
|
606
606
|
delete: wrap(wrapParams, 'Fragment', 'delete'),
|
|
607
607
|
publish: wrap(wrapParams, 'Fragment', 'publish'),
|
|
608
608
|
unpublish: wrap(wrapParams, 'Fragment', 'unpublish'),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contentful-management",
|
|
3
|
-
"version": "12.6.0-dev.
|
|
3
|
+
"version": "12.6.0-dev.3",
|
|
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": {
|