@webiny/api-headless-cms 0.0.0-unstable.990c3ab1b6 → 0.0.0-unstable.aa00eecd97
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/context.d.ts +5 -2
- package/context.js +61 -8
- package/context.js.map +1 -1
- package/crud/contentEntry/markLockedFields.d.ts +1 -1
- package/crud/contentEntry/markLockedFields.js +17 -4
- package/crud/contentEntry/markLockedFields.js.map +1 -1
- package/crud/contentEntry/referenceFieldsMapping.js +40 -9
- package/crud/contentEntry/referenceFieldsMapping.js.map +1 -1
- package/crud/contentEntry/searchableFields.d.ts +9 -0
- package/crud/contentEntry/searchableFields.js +72 -0
- package/crud/contentEntry/searchableFields.js.map +1 -0
- package/crud/contentEntry.crud.d.ts +8 -5
- package/crud/contentEntry.crud.js +1081 -841
- package/crud/contentEntry.crud.js.map +1 -1
- package/crud/contentModel/beforeCreate.d.ts +2 -3
- package/crud/contentModel/beforeCreate.js +43 -81
- package/crud/contentModel/beforeCreate.js.map +1 -1
- package/crud/contentModel/beforeDelete.d.ts +1 -1
- package/crud/contentModel/beforeDelete.js +1 -5
- package/crud/contentModel/beforeDelete.js.map +1 -1
- package/crud/contentModel/beforeUpdate.d.ts +2 -4
- package/crud/contentModel/beforeUpdate.js +33 -5
- package/crud/contentModel/beforeUpdate.js.map +1 -1
- package/crud/contentModel/compatibility/modelApiName.d.ts +3 -0
- package/crud/contentModel/compatibility/modelApiName.js +24 -0
- package/crud/contentModel/compatibility/modelApiName.js.map +1 -0
- package/crud/contentModel/createFieldStorageId.js +4 -1
- package/crud/contentModel/createFieldStorageId.js.map +1 -1
- package/crud/contentModel/defaultFields.d.ts +5 -0
- package/crud/contentModel/defaultFields.js +58 -0
- package/crud/contentModel/defaultFields.js.map +1 -0
- package/crud/contentModel/fields/descriptionField.d.ts +2 -0
- package/crud/contentModel/fields/descriptionField.js +42 -0
- package/crud/contentModel/fields/descriptionField.js.map +1 -0
- package/crud/contentModel/fields/imageField.d.ts +2 -0
- package/crud/contentModel/fields/imageField.js +46 -0
- package/crud/contentModel/fields/imageField.js.map +1 -0
- package/crud/contentModel/fields/titleField.d.ts +2 -0
- package/crud/contentModel/fields/titleField.js +58 -0
- package/crud/contentModel/fields/titleField.js.map +1 -0
- package/crud/contentModel/validate/endingAllowed.d.ts +6 -0
- package/crud/contentModel/validate/endingAllowed.js +26 -0
- package/crud/contentModel/validate/endingAllowed.js.map +1 -0
- package/crud/contentModel/validate/isModelEndingAllowed.d.ts +6 -0
- package/crud/contentModel/validate/isModelEndingAllowed.js +24 -0
- package/crud/contentModel/validate/isModelEndingAllowed.js.map +1 -0
- package/crud/contentModel/validate/modelId.d.ts +11 -0
- package/crud/contentModel/validate/modelId.js +36 -0
- package/crud/contentModel/validate/modelId.js.map +1 -0
- package/crud/contentModel/validate/pluralApiName.d.ts +7 -0
- package/crud/contentModel/validate/pluralApiName.js +24 -0
- package/crud/contentModel/validate/pluralApiName.js.map +1 -0
- package/crud/contentModel/validate/singularApiName.d.ts +7 -0
- package/crud/contentModel/validate/singularApiName.js +24 -0
- package/crud/contentModel/validate/singularApiName.js.map +1 -0
- package/crud/contentModel/validateModel.d.ts +4 -4
- package/crud/contentModel/validateModel.js +6 -3
- package/crud/contentModel/validateModel.js.map +1 -1
- package/crud/contentModel/validateModelFields.d.ts +4 -4
- package/crud/contentModel/validateModelFields.js +123 -88
- package/crud/contentModel/validateModelFields.js.map +1 -1
- package/crud/contentModel/validation.d.ts +551 -0
- package/crud/contentModel/validation.js +145 -0
- package/crud/contentModel/validation.js.map +1 -0
- package/crud/contentModel.crud.js +369 -273
- package/crud/contentModel.crud.js.map +1 -1
- package/crud/contentModelGroup/validation.d.ts +30 -0
- package/crud/contentModelGroup/validation.js +34 -0
- package/crud/contentModelGroup/validation.js.map +1 -0
- package/crud/contentModelGroup.crud.js +189 -172
- package/crud/contentModelGroup.crud.js.map +1 -1
- package/crud/settings.crud.d.ts +1 -1
- package/crud/settings.crud.js +5 -10
- package/crud/settings.crud.js.map +1 -1
- package/crud/system.crud.js +0 -60
- package/crud/system.crud.js.map +1 -1
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.d.ts +11 -0
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js +203 -0
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js.map +1 -0
- package/fieldConverters/index.d.ts +2 -1
- package/fieldConverters/index.js +2 -1
- package/fieldConverters/index.js.map +1 -1
- package/graphql/buildSchemaPlugins.d.ts +8 -3
- package/graphql/buildSchemaPlugins.js +3 -7
- package/graphql/buildSchemaPlugins.js.map +1 -1
- package/graphql/checkEndpointAccess.d.ts +2 -0
- package/graphql/checkEndpointAccess.js +18 -0
- package/graphql/checkEndpointAccess.js.map +1 -0
- package/graphql/createExecutableSchema.d.ts +6 -0
- package/graphql/createExecutableSchema.js +29 -0
- package/graphql/createExecutableSchema.js.map +1 -0
- package/graphql/createRequestBody.d.ts +2 -0
- package/graphql/createRequestBody.js +14 -0
- package/graphql/createRequestBody.js.map +1 -0
- package/graphql/formatErrorPayload.d.ts +1 -0
- package/graphql/formatErrorPayload.js +25 -0
- package/graphql/formatErrorPayload.js.map +1 -0
- package/graphql/generateSchema.d.ts +8 -0
- package/graphql/generateSchema.js +31 -0
- package/graphql/generateSchema.js.map +1 -0
- package/graphql/getSchema.d.ts +17 -0
- package/graphql/getSchema.js +102 -0
- package/graphql/getSchema.js.map +1 -0
- package/graphql/graphQLHandlerFactory.js +6 -104
- package/graphql/graphQLHandlerFactory.js.map +1 -1
- package/graphql/handleRequest.d.ts +11 -0
- package/graphql/handleRequest.js +81 -0
- package/graphql/handleRequest.js.map +1 -0
- package/graphql/index.d.ts +1 -3
- package/graphql/index.js +2 -39
- package/graphql/index.js.map +1 -1
- package/graphql/schema/baseContentSchema.d.ts +6 -2
- package/graphql/schema/baseContentSchema.js +9 -11
- package/graphql/schema/baseContentSchema.js.map +1 -1
- package/graphql/schema/baseSchema.d.ts +3 -0
- package/graphql/schema/baseSchema.js +68 -0
- package/graphql/schema/baseSchema.js.map +1 -0
- package/graphql/schema/contentEntries.d.ts +6 -2
- package/graphql/schema/contentEntries.js +116 -65
- package/graphql/schema/contentEntries.js.map +1 -1
- package/graphql/schema/contentModelGroups.d.ts +6 -2
- package/graphql/schema/contentModelGroups.js +14 -10
- package/graphql/schema/contentModelGroups.js.map +1 -1
- package/graphql/schema/contentModels.d.ts +6 -2
- package/graphql/schema/contentModels.js +60 -8
- package/graphql/schema/contentModels.js.map +1 -1
- package/graphql/schema/createFieldResolvers.d.ts +2 -2
- package/graphql/schema/createFieldResolvers.js +18 -13
- package/graphql/schema/createFieldResolvers.js.map +1 -1
- package/graphql/schema/createFieldTypePluginRecords.d.ts +3 -0
- package/graphql/schema/createFieldTypePluginRecords.js +13 -0
- package/graphql/schema/createFieldTypePluginRecords.js.map +1 -0
- package/graphql/schema/createManageResolvers.d.ts +1 -1
- package/graphql/schema/createManageResolvers.js +37 -17
- package/graphql/schema/createManageResolvers.js.map +1 -1
- package/graphql/schema/createManageSDL.d.ts +3 -0
- package/graphql/schema/createManageSDL.js +81 -63
- package/graphql/schema/createManageSDL.js.map +1 -1
- package/graphql/schema/createPreviewResolvers.js +3 -7
- package/graphql/schema/createPreviewResolvers.js.map +1 -1
- package/graphql/schema/createReadResolvers.js +8 -7
- package/graphql/schema/createReadResolvers.js.map +1 -1
- package/graphql/schema/createReadSDL.d.ts +3 -0
- package/graphql/schema/createReadSDL.js +47 -36
- package/graphql/schema/createReadSDL.js.map +1 -1
- package/graphql/schema/resolvers/commonFieldResolvers.d.ts +3 -2
- package/graphql/schema/resolvers/commonFieldResolvers.js +2 -1
- package/graphql/schema/resolvers/commonFieldResolvers.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveDelete.d.ts +2 -1
- package/graphql/schema/resolvers/manage/resolveDelete.js +13 -3
- package/graphql/schema/resolvers/manage/resolveDelete.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveDeleteMultiple.d.ts +7 -0
- package/graphql/schema/resolvers/manage/resolveDeleteMultiple.js +20 -0
- package/graphql/schema/resolvers/manage/resolveDeleteMultiple.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.d.ts +4 -0
- package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.js +18 -0
- package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.js.map +1 -0
- package/graphql/schema/schemaPlugins.d.ts +8 -3
- package/graphql/schema/schemaPlugins.js +55 -52
- package/graphql/schema/schemaPlugins.js.map +1 -1
- package/graphql/system.js +55 -74
- package/graphql/system.js.map +1 -1
- package/graphqlFields/dynamicZone/dynamicZoneField.d.ts +2 -0
- package/graphqlFields/dynamicZone/dynamicZoneField.js +243 -0
- package/graphqlFields/dynamicZone/dynamicZoneField.js.map +1 -0
- package/graphqlFields/dynamicZone/dynamicZoneStorage.d.ts +3 -0
- package/graphqlFields/dynamicZone/dynamicZoneStorage.js +63 -0
- package/graphqlFields/dynamicZone/dynamicZoneStorage.js.map +1 -0
- package/graphqlFields/dynamicZone/index.d.ts +2 -0
- package/graphqlFields/dynamicZone/index.js +19 -0
- package/graphqlFields/dynamicZone/index.js.map +1 -0
- package/graphqlFields/index.d.ts +1 -1
- package/graphqlFields/index.js +2 -1
- package/graphqlFields/index.js.map +1 -1
- package/graphqlFields/number.js +4 -0
- package/graphqlFields/number.js.map +1 -1
- package/graphqlFields/object.js +131 -68
- package/graphqlFields/object.js.map +1 -1
- package/graphqlFields/ref.js +70 -56
- package/graphqlFields/ref.js.map +1 -1
- package/index.d.ts +5 -3
- package/index.js +27 -8
- package/index.js.map +1 -1
- package/package.json +40 -41
- package/plugins/CmsGraphQLSchemaPlugin.d.ts +5 -0
- package/plugins/CmsGraphQLSchemaPlugin.js +12 -0
- package/plugins/CmsGraphQLSchemaPlugin.js.map +1 -0
- package/plugins/CmsGraphQLSchemaSorterPlugin.d.ts +20 -0
- package/plugins/CmsGraphQLSchemaSorterPlugin.js +28 -0
- package/plugins/CmsGraphQLSchemaSorterPlugin.js.map +1 -0
- package/plugins/CmsModelFieldConverterPlugin.d.ts +2 -2
- package/plugins/CmsModelFieldConverterPlugin.js.map +1 -1
- package/plugins/CmsModelPlugin.d.ts +21 -3
- package/plugins/CmsModelPlugin.js +28 -2
- package/plugins/CmsModelPlugin.js.map +1 -1
- package/plugins/StorageOperationsCmsModelPlugin.d.ts +23 -0
- package/plugins/StorageOperationsCmsModelPlugin.js +42 -0
- package/plugins/StorageOperationsCmsModelPlugin.js.map +1 -0
- package/plugins/StorageTransformPlugin.d.ts +11 -11
- package/plugins/StorageTransformPlugin.js.map +1 -1
- package/plugins/index.d.ts +3 -0
- package/plugins/index.js +33 -0
- package/plugins/index.js.map +1 -1
- package/storage/object.js +4 -2
- package/storage/object.js.map +1 -1
- package/types.d.ts +436 -149
- package/types.js +74 -8
- package/types.js.map +1 -1
- package/utils/converters/ConverterCollection.js +5 -2
- package/utils/converters/ConverterCollection.js.map +1 -1
- package/utils/converters/valueKeyStorageConverter.d.ts +1 -5
- package/utils/converters/valueKeyStorageConverter.js +26 -20
- package/utils/converters/valueKeyStorageConverter.js.map +1 -1
- package/utils/createTypeFromFields.d.ts +16 -0
- package/utils/createTypeFromFields.js +66 -0
- package/utils/createTypeFromFields.js.map +1 -0
- package/utils/createTypeName.d.ts +0 -2
- package/utils/createTypeName.js +4 -11
- package/utils/createTypeName.js.map +1 -1
- package/utils/entryStorage.js +14 -11
- package/utils/entryStorage.js.map +1 -1
- package/utils/getBaseFieldType.d.ts +2 -0
- package/utils/getBaseFieldType.js +10 -0
- package/utils/getBaseFieldType.js.map +1 -0
- package/utils/getEntryDescription.d.ts +2 -0
- package/utils/getEntryDescription.js +17 -0
- package/utils/getEntryDescription.js.map +1 -0
- package/utils/getEntryImage.d.ts +2 -0
- package/utils/getEntryImage.js +17 -0
- package/utils/getEntryImage.js.map +1 -0
- package/utils/getEntryTitle.d.ts +1 -1
- package/utils/getEntryTitle.js.map +1 -1
- package/utils/getSchemaFromFieldPlugins.d.ts +4 -7
- package/utils/getSchemaFromFieldPlugins.js +22 -14
- package/utils/getSchemaFromFieldPlugins.js.map +1 -1
- package/utils/incrementEntryIdVersion.d.ts +5 -0
- package/utils/incrementEntryIdVersion.js +29 -0
- package/utils/incrementEntryIdVersion.js.map +1 -0
- package/utils/ownership.d.ts +3 -3
- package/utils/ownership.js.map +1 -1
- package/utils/renderFields.d.ts +4 -2
- package/utils/renderFields.js +12 -3
- package/utils/renderFields.js.map +1 -1
- package/utils/renderGetFilterFields.d.ts +2 -2
- package/utils/renderGetFilterFields.js +9 -19
- package/utils/renderGetFilterFields.js.map +1 -1
- package/utils/renderInputFields.d.ts +4 -2
- package/utils/renderInputFields.js +19 -6
- package/utils/renderInputFields.js.map +1 -1
- package/utils/renderListFilterFields.d.ts +2 -1
- package/utils/renderListFilterFields.js +12 -21
- package/utils/renderListFilterFields.js.map +1 -1
- package/utils/renderSortEnum.d.ts +9 -5
- package/utils/renderSortEnum.js +23 -5
- package/utils/renderSortEnum.js.map +1 -1
- package/validators/dynamicZone.d.ts +2 -0
- package/validators/dynamicZone.js +20 -0
- package/validators/dynamicZone.js.map +1 -0
- package/validators/index.js +2 -1
- package/validators/index.js.map +1 -1
- package/crud/contentModel/createFieldModels.d.ts +0 -2
- package/crud/contentModel/createFieldModels.js +0 -20
- package/crud/contentModel/createFieldModels.js.map +0 -1
- package/crud/contentModel/fieldIdValidation.d.ts +0 -1
- package/crud/contentModel/fieldIdValidation.js +0 -20
- package/crud/contentModel/fieldIdValidation.js.map +0 -1
- package/crud/contentModel/idValidation.d.ts +0 -1
- package/crud/contentModel/idValidation.js +0 -17
- package/crud/contentModel/idValidation.js.map +0 -1
- package/crud/contentModel/models.d.ts +0 -4
- package/crud/contentModel/models.js +0 -173
- package/crud/contentModel/models.js.map +0 -1
- package/crud/contentModel/systemFields.d.ts +0 -1
- package/crud/contentModel/systemFields.js +0 -8
- package/crud/contentModel/systemFields.js.map +0 -1
- package/crud/index.d.ts +0 -6
- package/crud/index.js +0 -69
- package/crud/index.js.map +0 -1
- package/graphql/schema/resolvers/manage/resolveRequestChanges.d.ts +0 -7
- package/graphql/schema/resolvers/manage/resolveRequestChanges.js +0 -21
- package/graphql/schema/resolvers/manage/resolveRequestChanges.js.map +0 -1
- package/graphql/schema/resolvers/manage/resolveRequestReview.d.ts +0 -7
- package/graphql/schema/resolvers/manage/resolveRequestReview.js +0 -21
- package/graphql/schema/resolvers/manage/resolveRequestReview.js.map +0 -1
- package/upgrades/5.33.0/index.d.ts +0 -3
- package/upgrades/5.33.0/index.js +0 -159
- package/upgrades/5.33.0/index.js.map +0 -1
- package/upgrades/index.d.ts +0 -1
- package/upgrades/index.js +0 -9
- package/upgrades/index.js.map +0 -1
- package/utils/filterModelFields.d.ts +0 -16
- package/utils/filterModelFields.js +0 -71
- package/utils/filterModelFields.js.map +0 -1
- package/utils/pluralizedTypeName.d.ts +0 -1
- package/utils/pluralizedTypeName.js +0 -20
- package/utils/pluralizedTypeName.js.map +0 -1
package/types.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { GraphQLFieldResolver, GraphQLSchemaDefinition, Resolvers } from "@webin
|
|
|
5
5
|
import { SecurityPermission } from "@webiny/api-security/types";
|
|
6
6
|
import { DbContext } from "@webiny/handler-db/types";
|
|
7
7
|
import { FileManagerContext } from "@webiny/api-file-manager/types";
|
|
8
|
-
import { UpgradePlugin } from "@webiny/api-upgrade/types";
|
|
9
8
|
import { Topic } from "@webiny/pubsub/types";
|
|
10
9
|
import { CmsModelConverterCallable } from "./utils/converters/ConverterCollection";
|
|
11
10
|
export declare type ApiEndpoint = "manage" | "preview" | "read";
|
|
@@ -98,6 +97,10 @@ export interface CmsModelFieldSettings {
|
|
|
98
97
|
* Object field has child fields.
|
|
99
98
|
*/
|
|
100
99
|
fields?: CmsModelField[];
|
|
100
|
+
/**
|
|
101
|
+
* Is the file field images only one?
|
|
102
|
+
*/
|
|
103
|
+
imagesOnly?: boolean;
|
|
101
104
|
/**
|
|
102
105
|
* Object field has child fields - so it needs to have a layout.
|
|
103
106
|
*/
|
|
@@ -115,6 +118,7 @@ export interface CmsModelFieldSettings {
|
|
|
115
118
|
*/
|
|
116
119
|
[key: string]: any;
|
|
117
120
|
}
|
|
121
|
+
export declare type CmsModelFieldType = "boolean" | "datetime" | "file" | "long-text" | "number" | "object" | "ref" | "rich-text" | "text" | "dynamicZone" | string;
|
|
118
122
|
/**
|
|
119
123
|
* A definition for content model field. This type exists on the app side as well.
|
|
120
124
|
*
|
|
@@ -135,18 +139,16 @@ export interface CmsModelField {
|
|
|
135
139
|
* A type of the field.
|
|
136
140
|
* We are defining our built-in fields, so people know which are available by the default.
|
|
137
141
|
*/
|
|
138
|
-
type:
|
|
142
|
+
type: CmsModelFieldType;
|
|
139
143
|
/**
|
|
140
144
|
* A unique storage ID for storing actual values.
|
|
141
|
-
* Must in form of a-zA-Z0-9@a-zA-Z0-9
|
|
145
|
+
* Must in form of a-zA-Z0-9@a-zA-Z0-9
|
|
142
146
|
*
|
|
143
147
|
* This is an auto-generated value: uses `id` and `type`
|
|
144
148
|
*
|
|
145
149
|
* This is used as path for the entry value.
|
|
146
|
-
*
|
|
147
|
-
* @internal
|
|
148
150
|
*/
|
|
149
|
-
storageId: string;
|
|
151
|
+
storageId: `${string}@${string}` | string;
|
|
150
152
|
/**
|
|
151
153
|
* Field identifier for the model field that will be available to the outside world.
|
|
152
154
|
* `storageId` is used as path (or column) to store the data.
|
|
@@ -195,6 +197,10 @@ export interface CmsModelField {
|
|
|
195
197
|
*
|
|
196
198
|
*/
|
|
197
199
|
multipleValues?: boolean;
|
|
200
|
+
/**
|
|
201
|
+
* Fields can be tagged to give them contextual meaning.
|
|
202
|
+
*/
|
|
203
|
+
tags?: string[];
|
|
198
204
|
/**
|
|
199
205
|
* Any user defined settings.
|
|
200
206
|
*
|
|
@@ -202,18 +208,42 @@ export interface CmsModelField {
|
|
|
202
208
|
*/
|
|
203
209
|
settings?: CmsModelFieldSettings;
|
|
204
210
|
}
|
|
211
|
+
export interface CmsDynamicZoneTemplate {
|
|
212
|
+
id: string;
|
|
213
|
+
name: string;
|
|
214
|
+
gqlTypeName: string;
|
|
215
|
+
description: string;
|
|
216
|
+
icon: string;
|
|
217
|
+
fields: CmsModelField[];
|
|
218
|
+
layout: string[][];
|
|
219
|
+
validation: CmsModelFieldValidation[];
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* A definition for dynamic-zone field to show possible type of the field in settings.
|
|
223
|
+
*/
|
|
224
|
+
export interface CmsModelDynamicZoneField extends CmsModelField {
|
|
225
|
+
/**
|
|
226
|
+
* Settings object for the field. Contains `templates` property.
|
|
227
|
+
*/
|
|
228
|
+
settings: {
|
|
229
|
+
templates: CmsDynamicZoneTemplate[];
|
|
230
|
+
};
|
|
231
|
+
}
|
|
205
232
|
/**
|
|
206
233
|
* Used for our internal functionality.
|
|
207
234
|
*/
|
|
208
235
|
export interface CmsModelFieldWithParent extends CmsModelField {
|
|
209
236
|
parent?: CmsModelFieldWithParent | null;
|
|
210
237
|
}
|
|
238
|
+
export interface CmsModelDynamicZoneFieldWithParent extends CmsModelDynamicZoneField {
|
|
239
|
+
parent?: CmsModelDynamicZoneFieldWithParent | null;
|
|
240
|
+
}
|
|
211
241
|
/**
|
|
212
242
|
* A definition for dateTime field to show possible type of the field in settings.
|
|
213
243
|
*/
|
|
214
244
|
export interface CmsModelDateTimeField extends CmsModelField {
|
|
215
245
|
/**
|
|
216
|
-
* Settings object for the field. Contains type property.
|
|
246
|
+
* Settings object for the field. Contains `type` property.
|
|
217
247
|
*/
|
|
218
248
|
settings: {
|
|
219
249
|
type: "time" | "date" | "dateTimeWithoutTimezone" | "dateTimeWithTimezone";
|
|
@@ -335,7 +365,21 @@ export interface LockedField {
|
|
|
335
365
|
[key: string]: any;
|
|
336
366
|
}
|
|
337
367
|
/**
|
|
338
|
-
*
|
|
368
|
+
* @category Database model
|
|
369
|
+
* @category CmsModel
|
|
370
|
+
*/
|
|
371
|
+
export interface CmsModelGroup {
|
|
372
|
+
/**
|
|
373
|
+
* Generated ID of the group
|
|
374
|
+
*/
|
|
375
|
+
id: string;
|
|
376
|
+
/**
|
|
377
|
+
* Name of the group
|
|
378
|
+
*/
|
|
379
|
+
name: string;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Base CMS Model. Should not be exported and used outside of this package.
|
|
339
383
|
*
|
|
340
384
|
* @category Database model
|
|
341
385
|
* @category CmsModel
|
|
@@ -349,6 +393,24 @@ export interface CmsModel {
|
|
|
349
393
|
* Unique ID for the content model. Created from name if not defined by user.
|
|
350
394
|
*/
|
|
351
395
|
modelId: string;
|
|
396
|
+
/**
|
|
397
|
+
* Name of the content model in singular form to be used in the API.
|
|
398
|
+
* example:
|
|
399
|
+
* - Article
|
|
400
|
+
* - Fruit
|
|
401
|
+
* - Vegetable
|
|
402
|
+
* - Car
|
|
403
|
+
*/
|
|
404
|
+
singularApiName: string;
|
|
405
|
+
/**
|
|
406
|
+
* Name of the content model in plural form to be used in the API.
|
|
407
|
+
* example:
|
|
408
|
+
* - Articles
|
|
409
|
+
* - Fruits
|
|
410
|
+
* - Vegetables
|
|
411
|
+
* - Cars
|
|
412
|
+
*/
|
|
413
|
+
pluralApiName: string;
|
|
352
414
|
/**
|
|
353
415
|
* Model tenant.
|
|
354
416
|
*/
|
|
@@ -360,20 +422,15 @@ export interface CmsModel {
|
|
|
360
422
|
/**
|
|
361
423
|
* Cms Group reference object.
|
|
362
424
|
*/
|
|
363
|
-
group:
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
* Name of the group
|
|
370
|
-
*/
|
|
371
|
-
name: string;
|
|
372
|
-
};
|
|
425
|
+
group: CmsModelGroup;
|
|
426
|
+
/**
|
|
427
|
+
* Icon for the content model.
|
|
428
|
+
*/
|
|
429
|
+
icon?: string | null;
|
|
373
430
|
/**
|
|
374
431
|
* Description for the content model.
|
|
375
432
|
*/
|
|
376
|
-
description: string;
|
|
433
|
+
description: string | null;
|
|
377
434
|
/**
|
|
378
435
|
* Date created
|
|
379
436
|
*/
|
|
@@ -385,7 +442,7 @@ export interface CmsModel {
|
|
|
385
442
|
/**
|
|
386
443
|
* CreatedBy object wrapper. Contains id, name and type of the user.
|
|
387
444
|
*/
|
|
388
|
-
createdBy?:
|
|
445
|
+
createdBy?: CmsIdentity;
|
|
389
446
|
/**
|
|
390
447
|
* List of fields defining entry values.
|
|
391
448
|
*/
|
|
@@ -401,6 +458,10 @@ export interface CmsModel {
|
|
|
401
458
|
* ```
|
|
402
459
|
*/
|
|
403
460
|
layout: string[][];
|
|
461
|
+
/**
|
|
462
|
+
* Models can be tagged to give them contextual meaning.
|
|
463
|
+
*/
|
|
464
|
+
tags?: string[];
|
|
404
465
|
/**
|
|
405
466
|
* List of locked fields. Updated when entry is saved and a field has been used.
|
|
406
467
|
*/
|
|
@@ -410,6 +471,16 @@ export interface CmsModel {
|
|
|
410
471
|
* It is picked as first available text field. Or user can select own field.
|
|
411
472
|
*/
|
|
412
473
|
titleFieldId: string;
|
|
474
|
+
/**
|
|
475
|
+
* The field which is displayed as the description one.
|
|
476
|
+
* Only way this is null or undefined is that there are no long-text fields to be set as description.
|
|
477
|
+
*/
|
|
478
|
+
descriptionFieldId?: string | null;
|
|
479
|
+
/**
|
|
480
|
+
* The field which is displayed as the image.
|
|
481
|
+
* Only way this is null or undefined is that there are no file fields, with images only set, to be set as image.
|
|
482
|
+
*/
|
|
483
|
+
imageFieldId?: string | null;
|
|
413
484
|
/**
|
|
414
485
|
* The version of Webiny which this record was stored with.
|
|
415
486
|
*/
|
|
@@ -437,25 +508,41 @@ export interface CmsModelFieldDefinition {
|
|
|
437
508
|
fields: string;
|
|
438
509
|
typeDefs?: string;
|
|
439
510
|
}
|
|
440
|
-
interface CmsModelFieldToGraphQLCreateResolverParams {
|
|
511
|
+
interface CmsModelFieldToGraphQLCreateResolverParams<TField> {
|
|
441
512
|
models: CmsModel[];
|
|
442
513
|
model: CmsModel;
|
|
443
514
|
graphQLType: string;
|
|
444
|
-
field:
|
|
515
|
+
field: TField;
|
|
445
516
|
createFieldResolvers: any;
|
|
517
|
+
fieldTypePlugins: CmsFieldTypePlugins;
|
|
446
518
|
}
|
|
447
|
-
export interface CmsModelFieldToGraphQLCreateResolver {
|
|
448
|
-
(params: CmsModelFieldToGraphQLCreateResolverParams): GraphQLFieldResolver | {
|
|
519
|
+
export interface CmsModelFieldToGraphQLCreateResolver<TField = CmsModelField> {
|
|
520
|
+
(params: CmsModelFieldToGraphQLCreateResolverParams<TField>): GraphQLFieldResolver | {
|
|
449
521
|
resolver: GraphQLFieldResolver | null;
|
|
450
522
|
typeResolvers: Resolvers<CmsContext>;
|
|
451
523
|
} | false;
|
|
452
524
|
}
|
|
525
|
+
export interface CmsModelFieldToGraphQLPluginValidateChildFieldsValidateParams<TField extends CmsModelField = CmsModelField> {
|
|
526
|
+
fields: TField[];
|
|
527
|
+
originalFields: TField[];
|
|
528
|
+
}
|
|
529
|
+
export interface CmsModelFieldToGraphQLPluginValidateChildFieldsValidate {
|
|
530
|
+
(params: CmsModelFieldToGraphQLPluginValidateChildFieldsValidateParams): void;
|
|
531
|
+
}
|
|
532
|
+
export interface CmsModelFieldToGraphQLPluginValidateChildFieldsParams<TField extends CmsModelField = CmsModelField> {
|
|
533
|
+
field: TField;
|
|
534
|
+
originalField?: TField;
|
|
535
|
+
validate: CmsModelFieldToGraphQLPluginValidateChildFieldsValidate;
|
|
536
|
+
}
|
|
537
|
+
export interface CmsModelFieldToGraphQLPluginValidateChildFields<TField extends CmsModelField = CmsModelField> {
|
|
538
|
+
(params: CmsModelFieldToGraphQLPluginValidateChildFieldsParams<TField>): void;
|
|
539
|
+
}
|
|
453
540
|
/**
|
|
454
541
|
* @category Plugin
|
|
455
542
|
* @category ModelField
|
|
456
543
|
* @category GraphQL
|
|
457
544
|
*/
|
|
458
|
-
export interface CmsModelFieldToGraphQLPlugin extends Plugin {
|
|
545
|
+
export interface CmsModelFieldToGraphQLPlugin<TField extends CmsModelField = CmsModelField> extends Plugin {
|
|
459
546
|
/**
|
|
460
547
|
* A plugin type
|
|
461
548
|
*/
|
|
@@ -493,24 +580,6 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
|
|
|
493
580
|
* ```
|
|
494
581
|
*/
|
|
495
582
|
isSortable: boolean;
|
|
496
|
-
/**
|
|
497
|
-
* Optional method which creates the storageId.
|
|
498
|
-
* Primary use is for the datetime field, but if users has some specific fields, they can customize the storageId to their needs.
|
|
499
|
-
*
|
|
500
|
-
* ```ts
|
|
501
|
-
* createStorageId: ({field}) => {
|
|
502
|
-
* if (field.settings.type === "time) {
|
|
503
|
-
* return `${field.type}_time@${field.id}`
|
|
504
|
-
* }
|
|
505
|
-
* // use default method
|
|
506
|
-
* return undefined;
|
|
507
|
-
* }
|
|
508
|
-
* ```
|
|
509
|
-
*/
|
|
510
|
-
createStorageId?: (params: {
|
|
511
|
-
model: CmsModel;
|
|
512
|
-
field: CmsModelField;
|
|
513
|
-
}) => string | null | undefined;
|
|
514
583
|
/**
|
|
515
584
|
* Read API methods.
|
|
516
585
|
*/
|
|
@@ -527,8 +596,7 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
|
|
|
527
596
|
* ```
|
|
528
597
|
*/
|
|
529
598
|
createGetFilters?(params: {
|
|
530
|
-
|
|
531
|
-
field: CmsModelField;
|
|
599
|
+
field: TField;
|
|
532
600
|
}): string;
|
|
533
601
|
/**
|
|
534
602
|
* Definition for list filtering for GraphQL.
|
|
@@ -547,8 +615,9 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
|
|
|
547
615
|
* ```
|
|
548
616
|
*/
|
|
549
617
|
createListFilters?(params: {
|
|
550
|
-
model: CmsModel
|
|
551
|
-
field:
|
|
618
|
+
model: Pick<CmsModel, "singularApiName">;
|
|
619
|
+
field: TField;
|
|
620
|
+
plugins: CmsFieldTypePlugins;
|
|
552
621
|
}): string;
|
|
553
622
|
/**
|
|
554
623
|
* Definition of the field type for GraphQL - be aware if multiple values is selected.
|
|
@@ -566,13 +635,14 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
|
|
|
566
635
|
* ```
|
|
567
636
|
*/
|
|
568
637
|
createTypeField(params: {
|
|
638
|
+
models: CmsModel[];
|
|
569
639
|
model: CmsModel;
|
|
570
|
-
field:
|
|
640
|
+
field: TField;
|
|
571
641
|
fieldTypePlugins: CmsFieldTypePlugins;
|
|
572
642
|
}): CmsModelFieldDefinition | string | null;
|
|
573
643
|
/**
|
|
574
644
|
* Definition for field resolver.
|
|
575
|
-
* By default it is simple return of the `instance.values[storageId]` but if required, users can define their own.
|
|
645
|
+
* By default, it is simple return of the `instance.values[storageId]` but if required, users can define their own.
|
|
576
646
|
*
|
|
577
647
|
* ```ts
|
|
578
648
|
* read: {
|
|
@@ -584,7 +654,7 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
|
|
|
584
654
|
* }
|
|
585
655
|
* ```
|
|
586
656
|
*/
|
|
587
|
-
createResolver?: CmsModelFieldToGraphQLCreateResolver
|
|
657
|
+
createResolver?: CmsModelFieldToGraphQLCreateResolver<TField>;
|
|
588
658
|
/**
|
|
589
659
|
* Read API schema definitions for the field and resolvers for them.
|
|
590
660
|
*
|
|
@@ -626,8 +696,9 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
|
|
|
626
696
|
* ```
|
|
627
697
|
*/
|
|
628
698
|
createListFilters?: (params: {
|
|
629
|
-
model: CmsModel
|
|
630
|
-
field:
|
|
699
|
+
model: Pick<CmsModel, "singularApiName">;
|
|
700
|
+
field: TField;
|
|
701
|
+
plugins: CmsFieldTypePlugins;
|
|
631
702
|
}) => string;
|
|
632
703
|
/**
|
|
633
704
|
* Manage API schema definitions for the field and resolvers for them. Probably similar to `read.createSchema`.
|
|
@@ -665,8 +736,9 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
|
|
|
665
736
|
* ```
|
|
666
737
|
*/
|
|
667
738
|
createTypeField: (params: {
|
|
739
|
+
models: CmsModel[];
|
|
668
740
|
model: CmsModel;
|
|
669
|
-
field:
|
|
741
|
+
field: TField;
|
|
670
742
|
fieldTypePlugins: CmsFieldTypePlugins;
|
|
671
743
|
}) => CmsModelFieldDefinition | string | null;
|
|
672
744
|
/**
|
|
@@ -685,13 +757,14 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
|
|
|
685
757
|
* ```
|
|
686
758
|
*/
|
|
687
759
|
createInputField: (params: {
|
|
760
|
+
models: CmsModel[];
|
|
688
761
|
model: CmsModel;
|
|
689
|
-
field:
|
|
762
|
+
field: TField;
|
|
690
763
|
fieldTypePlugins: CmsFieldTypePlugins;
|
|
691
764
|
}) => CmsModelFieldDefinition | string | null;
|
|
692
765
|
/**
|
|
693
766
|
* Definition for field resolver.
|
|
694
|
-
* By default it is simple return of the `instance.values[storageId]` but if required, users can define their own.
|
|
767
|
+
* By default, it is simple return of the `instance.values[storageId]` but if required, users can define their own.
|
|
695
768
|
*
|
|
696
769
|
* ```ts
|
|
697
770
|
* manage: {
|
|
@@ -703,8 +776,13 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
|
|
|
703
776
|
* }
|
|
704
777
|
* ```
|
|
705
778
|
*/
|
|
706
|
-
createResolver?: CmsModelFieldToGraphQLCreateResolver
|
|
779
|
+
createResolver?: CmsModelFieldToGraphQLCreateResolver<TField>;
|
|
707
780
|
};
|
|
781
|
+
/**
|
|
782
|
+
*
|
|
783
|
+
* @param field
|
|
784
|
+
*/
|
|
785
|
+
validateChildFields?: CmsModelFieldToGraphQLPluginValidateChildFields<TField>;
|
|
708
786
|
}
|
|
709
787
|
/**
|
|
710
788
|
* Check for content model locked field.
|
|
@@ -743,11 +821,11 @@ export interface CmsFieldTypePlugins {
|
|
|
743
821
|
[key: string]: CmsModelFieldToGraphQLPlugin;
|
|
744
822
|
}
|
|
745
823
|
/**
|
|
746
|
-
*
|
|
824
|
+
* An interface describing the reference to a user that created some data in the database.
|
|
747
825
|
*
|
|
748
826
|
* @category General
|
|
749
827
|
*/
|
|
750
|
-
export interface
|
|
828
|
+
export interface CmsIdentity {
|
|
751
829
|
/**
|
|
752
830
|
* ID if the user.
|
|
753
831
|
*/
|
|
@@ -797,7 +875,7 @@ export interface CmsSettingsContext {
|
|
|
797
875
|
/**
|
|
798
876
|
* Get the datetime when content model last changed.
|
|
799
877
|
*/
|
|
800
|
-
getModelLastChange: () => Promise<Date>;
|
|
878
|
+
getModelLastChange: () => Promise<Date | null>;
|
|
801
879
|
}
|
|
802
880
|
export interface OnSystemBeforeInstallTopicParams {
|
|
803
881
|
tenant: string;
|
|
@@ -815,9 +893,7 @@ export interface OnSystemInstallErrorTopicParams {
|
|
|
815
893
|
export declare type CmsSystemContext = {
|
|
816
894
|
getSystemVersion: () => Promise<string | null>;
|
|
817
895
|
setSystemVersion: (version: string) => Promise<void>;
|
|
818
|
-
getReadAPIKey(): Promise<string | null>;
|
|
819
896
|
installSystem: () => Promise<void>;
|
|
820
|
-
upgradeSystem: (version: string) => Promise<boolean>;
|
|
821
897
|
/**
|
|
822
898
|
* Lifecycle events - deprecated
|
|
823
899
|
*/
|
|
@@ -837,7 +913,7 @@ export declare type CmsSystemContext = {
|
|
|
837
913
|
onSystemInstallError: Topic<OnSystemInstallErrorTopicParams>;
|
|
838
914
|
};
|
|
839
915
|
/**
|
|
840
|
-
* A GraphQL params.data parameter received when creating content model group.
|
|
916
|
+
* A GraphQL `params.data` parameter received when creating content model group.
|
|
841
917
|
*
|
|
842
918
|
* @category CmsGroup
|
|
843
919
|
* @category GraphQL params
|
|
@@ -849,7 +925,7 @@ export interface CmsGroupCreateInput {
|
|
|
849
925
|
icon: string;
|
|
850
926
|
}
|
|
851
927
|
/**
|
|
852
|
-
* A GraphQL params.data parameter received when updating content model group.
|
|
928
|
+
* A GraphQL `params.data` parameter received when updating content model group.
|
|
853
929
|
*
|
|
854
930
|
* @category CmsGroup
|
|
855
931
|
* @category GraphQL params
|
|
@@ -898,7 +974,7 @@ export interface CmsGroup {
|
|
|
898
974
|
/**
|
|
899
975
|
* CreatedBy reference object.
|
|
900
976
|
*/
|
|
901
|
-
createdBy?:
|
|
977
|
+
createdBy?: CmsIdentity;
|
|
902
978
|
/**
|
|
903
979
|
* Date group was created on.
|
|
904
980
|
*/
|
|
@@ -919,7 +995,7 @@ export interface CmsGroup {
|
|
|
919
995
|
isPrivate?: boolean;
|
|
920
996
|
}
|
|
921
997
|
/**
|
|
922
|
-
* A data.where parameter received when listing content model groups.
|
|
998
|
+
* A `data.where` parameter received when listing content model groups.
|
|
923
999
|
*
|
|
924
1000
|
* @category CmsGroup
|
|
925
1001
|
* @category GraphQL params
|
|
@@ -945,6 +1021,15 @@ export interface OnGroupBeforeCreateTopicParams {
|
|
|
945
1021
|
export interface OnGroupAfterCreateTopicParams {
|
|
946
1022
|
group: CmsGroup;
|
|
947
1023
|
}
|
|
1024
|
+
/**
|
|
1025
|
+
* @category CmsGroup
|
|
1026
|
+
* @category Topic
|
|
1027
|
+
*/
|
|
1028
|
+
export interface OnGroupCreateErrorTopicParams {
|
|
1029
|
+
input: CmsGroupCreateInput;
|
|
1030
|
+
group: CmsGroup;
|
|
1031
|
+
error: Error;
|
|
1032
|
+
}
|
|
948
1033
|
/**
|
|
949
1034
|
* @category CmsGroup
|
|
950
1035
|
* @category Topic
|
|
@@ -961,6 +1046,16 @@ export interface OnGroupAfterUpdateTopicParams {
|
|
|
961
1046
|
original: CmsGroup;
|
|
962
1047
|
group: CmsGroup;
|
|
963
1048
|
}
|
|
1049
|
+
/**
|
|
1050
|
+
* @category CmsGroup
|
|
1051
|
+
* @category Topic
|
|
1052
|
+
*/
|
|
1053
|
+
export interface OnGroupUpdateErrorTopicParams {
|
|
1054
|
+
input: CmsGroupUpdateInput;
|
|
1055
|
+
original: CmsGroup;
|
|
1056
|
+
group: CmsGroup;
|
|
1057
|
+
error: Error;
|
|
1058
|
+
}
|
|
964
1059
|
/**
|
|
965
1060
|
* @category CmsGroup
|
|
966
1061
|
* @category Topic
|
|
@@ -975,6 +1070,14 @@ export interface OnGroupBeforeDeleteTopicParams {
|
|
|
975
1070
|
export interface OnGroupAfterDeleteTopicParams {
|
|
976
1071
|
group: CmsGroup;
|
|
977
1072
|
}
|
|
1073
|
+
/**
|
|
1074
|
+
* @category CmsGroup
|
|
1075
|
+
* @category Topic
|
|
1076
|
+
*/
|
|
1077
|
+
export interface OnGroupDeleteErrorTopicParams {
|
|
1078
|
+
group: CmsGroup;
|
|
1079
|
+
error: Error;
|
|
1080
|
+
}
|
|
978
1081
|
/**
|
|
979
1082
|
* Cms Group in context.
|
|
980
1083
|
*
|
|
@@ -1038,10 +1141,13 @@ export interface CmsGroupContext {
|
|
|
1038
1141
|
*/
|
|
1039
1142
|
onGroupBeforeCreate: Topic<OnGroupBeforeCreateTopicParams>;
|
|
1040
1143
|
onGroupAfterCreate: Topic<OnGroupAfterCreateTopicParams>;
|
|
1144
|
+
onGroupCreateError: Topic<OnGroupCreateErrorTopicParams>;
|
|
1041
1145
|
onGroupBeforeUpdate: Topic<OnGroupBeforeUpdateTopicParams>;
|
|
1042
1146
|
onGroupAfterUpdate: Topic<OnGroupAfterUpdateTopicParams>;
|
|
1147
|
+
onGroupUpdateError: Topic<OnGroupUpdateErrorTopicParams>;
|
|
1043
1148
|
onGroupBeforeDelete: Topic<OnGroupBeforeDeleteTopicParams>;
|
|
1044
1149
|
onGroupAfterDelete: Topic<OnGroupAfterDeleteTopicParams>;
|
|
1150
|
+
onGroupDeleteError: Topic<OnGroupDeleteErrorTopicParams>;
|
|
1045
1151
|
}
|
|
1046
1152
|
/**
|
|
1047
1153
|
* Definition for content model field validator.
|
|
@@ -1060,7 +1166,7 @@ export interface CmsModelFieldValidation {
|
|
|
1060
1166
|
};
|
|
1061
1167
|
}
|
|
1062
1168
|
/**
|
|
1063
|
-
* A GraphQL params.data parameter received when creating content model.
|
|
1169
|
+
* A GraphQL `params.data` parameter received when creating content model.
|
|
1064
1170
|
*
|
|
1065
1171
|
* @category GraphQL params
|
|
1066
1172
|
* @category CmsModel
|
|
@@ -1070,6 +1176,14 @@ export interface CmsModelCreateInput {
|
|
|
1070
1176
|
* Name of the content model.
|
|
1071
1177
|
*/
|
|
1072
1178
|
name: string;
|
|
1179
|
+
/**
|
|
1180
|
+
* Singular name of the content model to be used in the API.
|
|
1181
|
+
*/
|
|
1182
|
+
singularApiName: string;
|
|
1183
|
+
/**
|
|
1184
|
+
* Plural name of the content model to be used in the API.
|
|
1185
|
+
*/
|
|
1186
|
+
pluralApiName: string;
|
|
1073
1187
|
/**
|
|
1074
1188
|
* Unique ID of the content model. Created from name if not sent by the user. Cannot be changed.
|
|
1075
1189
|
*/
|
|
@@ -1077,7 +1191,7 @@ export interface CmsModelCreateInput {
|
|
|
1077
1191
|
/**
|
|
1078
1192
|
* Description of the content model.
|
|
1079
1193
|
*/
|
|
1080
|
-
description?: string;
|
|
1194
|
+
description?: string | null;
|
|
1081
1195
|
/**
|
|
1082
1196
|
* Group where to put the content model in.
|
|
1083
1197
|
*/
|
|
@@ -1098,13 +1212,18 @@ export interface CmsModelCreateInput {
|
|
|
1098
1212
|
*/
|
|
1099
1213
|
layout?: string[][];
|
|
1100
1214
|
/**
|
|
1101
|
-
*
|
|
1102
|
-
|
|
1215
|
+
* Models can be tagged to give them contextual meaning.
|
|
1216
|
+
*/
|
|
1217
|
+
tags?: string[];
|
|
1218
|
+
/**
|
|
1219
|
+
* Fields fieldId which are picked to represent the CMS entry.
|
|
1103
1220
|
*/
|
|
1104
|
-
titleFieldId?: string;
|
|
1221
|
+
titleFieldId?: string | null;
|
|
1222
|
+
descriptionFieldId?: string | null;
|
|
1223
|
+
imageFieldId?: string | null;
|
|
1105
1224
|
}
|
|
1106
1225
|
/**
|
|
1107
|
-
* A GraphQL params.data parameter received when creating content model from existing model.
|
|
1226
|
+
* A GraphQL `params.data` parameter received when creating content model from existing model.
|
|
1108
1227
|
*
|
|
1109
1228
|
* @category GraphQL params
|
|
1110
1229
|
* @category CmsModel
|
|
@@ -1145,11 +1264,15 @@ export interface CmsModelFieldInput {
|
|
|
1145
1264
|
/**
|
|
1146
1265
|
* Text to display below the field to help user what to write in the field.
|
|
1147
1266
|
*/
|
|
1148
|
-
helpText?: string;
|
|
1267
|
+
helpText?: string | null;
|
|
1149
1268
|
/**
|
|
1150
1269
|
* Text to display in the field.
|
|
1151
1270
|
*/
|
|
1152
|
-
placeholderText?: string;
|
|
1271
|
+
placeholderText?: string | null;
|
|
1272
|
+
/**
|
|
1273
|
+
* Fields can be tagged to give them contextual meaning.
|
|
1274
|
+
*/
|
|
1275
|
+
tags?: string[];
|
|
1153
1276
|
/**
|
|
1154
1277
|
* Are multiple values allowed?
|
|
1155
1278
|
*/
|
|
@@ -1169,14 +1292,14 @@ export interface CmsModelFieldInput {
|
|
|
1169
1292
|
/**
|
|
1170
1293
|
* @see CmsModelField.listValidation
|
|
1171
1294
|
*/
|
|
1172
|
-
listValidation
|
|
1295
|
+
listValidation?: CmsModelFieldValidation[];
|
|
1173
1296
|
/**
|
|
1174
1297
|
* User defined settings.
|
|
1175
1298
|
*/
|
|
1176
1299
|
settings?: Record<string, any>;
|
|
1177
1300
|
}
|
|
1178
1301
|
/**
|
|
1179
|
-
* A GraphQL params.data parameter received when updating content model.
|
|
1302
|
+
* A GraphQL `params.data` parameter received when updating content model.
|
|
1180
1303
|
*
|
|
1181
1304
|
* @category GraphQL params
|
|
1182
1305
|
* @category CmsModel
|
|
@@ -1186,6 +1309,14 @@ export interface CmsModelUpdateInput {
|
|
|
1186
1309
|
* A new content model name.
|
|
1187
1310
|
*/
|
|
1188
1311
|
name?: string;
|
|
1312
|
+
/**
|
|
1313
|
+
* A new singular name of the content model to be used in the API.
|
|
1314
|
+
*/
|
|
1315
|
+
singularApiName?: string;
|
|
1316
|
+
/**
|
|
1317
|
+
* A new plural name of the content model to be used in the API.
|
|
1318
|
+
*/
|
|
1319
|
+
pluralApiName?: string;
|
|
1189
1320
|
/**
|
|
1190
1321
|
* A group we want to move the model to.
|
|
1191
1322
|
*/
|
|
@@ -1193,7 +1324,7 @@ export interface CmsModelUpdateInput {
|
|
|
1193
1324
|
/**
|
|
1194
1325
|
* A new description of the content model.
|
|
1195
1326
|
*/
|
|
1196
|
-
description?: string;
|
|
1327
|
+
description?: string | null;
|
|
1197
1328
|
/**
|
|
1198
1329
|
* A list of content model fields to define the entry values.
|
|
1199
1330
|
*/
|
|
@@ -1210,10 +1341,11 @@ export interface CmsModelUpdateInput {
|
|
|
1210
1341
|
*/
|
|
1211
1342
|
layout: string[][];
|
|
1212
1343
|
/**
|
|
1213
|
-
*
|
|
1214
|
-
* It is picked as first available text field. Or user can select own field.
|
|
1344
|
+
* Fields fieldId which are picked to represent the CMS entry.
|
|
1215
1345
|
*/
|
|
1216
|
-
titleFieldId?: string;
|
|
1346
|
+
titleFieldId?: string | null;
|
|
1347
|
+
descriptionFieldId?: string | null;
|
|
1348
|
+
imageFieldId?: string | null;
|
|
1217
1349
|
}
|
|
1218
1350
|
/**
|
|
1219
1351
|
* A plugin to load a CmsModelManager.
|
|
@@ -1258,7 +1390,7 @@ export interface CmsEntryValues {
|
|
|
1258
1390
|
export interface CmsEntry<T = CmsEntryValues> {
|
|
1259
1391
|
/**
|
|
1260
1392
|
* A version of the webiny this entry was created with.
|
|
1261
|
-
* This can be used when upgrading the system so we know which entries to update.
|
|
1393
|
+
* This can be used when upgrading the system, so we know which entries to update.
|
|
1262
1394
|
*/
|
|
1263
1395
|
webinyVersion: string;
|
|
1264
1396
|
/**
|
|
@@ -1277,11 +1409,15 @@ export interface CmsEntry<T = CmsEntryValues> {
|
|
|
1277
1409
|
/**
|
|
1278
1410
|
* CreatedBy object reference.
|
|
1279
1411
|
*/
|
|
1280
|
-
createdBy:
|
|
1412
|
+
createdBy: CmsIdentity;
|
|
1281
1413
|
/**
|
|
1282
1414
|
* OwnedBy object reference. Can be different from CreatedBy.
|
|
1283
1415
|
*/
|
|
1284
|
-
ownedBy:
|
|
1416
|
+
ownedBy: CmsIdentity;
|
|
1417
|
+
/**
|
|
1418
|
+
* ModifiedBy object reference. Last person who modified the entry.
|
|
1419
|
+
*/
|
|
1420
|
+
modifiedBy?: CmsIdentity | null;
|
|
1285
1421
|
/**
|
|
1286
1422
|
* A string of Date.toISOString() type.
|
|
1287
1423
|
* Populated on creation.
|
|
@@ -1328,10 +1464,10 @@ export interface CmsEntry<T = CmsEntryValues> {
|
|
|
1328
1464
|
/**
|
|
1329
1465
|
* Settings for the given entry.
|
|
1330
1466
|
*
|
|
1331
|
-
* Introduced with Advanced Publishing Workflow
|
|
1332
|
-
* Be aware that when accessing properties in it on old systems
|
|
1467
|
+
* Introduced with Advanced Publishing Workflow. Will always be inserted once this PR is merged.
|
|
1468
|
+
* Be aware that when accessing properties in it on old systems, it will break if not checked first.
|
|
1333
1469
|
*
|
|
1334
|
-
* Available only on the Manage API in entry GraphQL type meta.data property.
|
|
1470
|
+
* Available only on the Manage API in entry GraphQL type `meta.data` property.
|
|
1335
1471
|
*/
|
|
1336
1472
|
meta?: {
|
|
1337
1473
|
[key: string]: any;
|
|
@@ -1364,7 +1500,7 @@ export interface CmsModelManager {
|
|
|
1364
1500
|
*/
|
|
1365
1501
|
getPublishedByIds: (ids: string[]) => Promise<CmsEntry[]>;
|
|
1366
1502
|
/**
|
|
1367
|
-
* Get a list of latest entries by the ID list.
|
|
1503
|
+
* Get a list of the latest entries by the ID list.
|
|
1368
1504
|
*/
|
|
1369
1505
|
getLatestByIds: (ids: string[]) => Promise<CmsEntry[]>;
|
|
1370
1506
|
/**
|
|
@@ -1372,18 +1508,21 @@ export interface CmsModelManager {
|
|
|
1372
1508
|
*/
|
|
1373
1509
|
get: (id: string) => Promise<CmsEntry>;
|
|
1374
1510
|
/**
|
|
1375
|
-
* Create
|
|
1511
|
+
* Create an entry.
|
|
1376
1512
|
*/
|
|
1377
1513
|
create: (data: CreateCmsEntryInput) => Promise<CmsEntry>;
|
|
1378
1514
|
/**
|
|
1379
|
-
* Update
|
|
1515
|
+
* Update an entry.
|
|
1380
1516
|
*/
|
|
1381
1517
|
update: (id: string, data: UpdateCmsEntryInput) => Promise<CmsEntry>;
|
|
1382
1518
|
/**
|
|
1383
|
-
* Delete
|
|
1519
|
+
* Delete an entry.
|
|
1384
1520
|
*/
|
|
1385
1521
|
delete: (id: string) => Promise<void>;
|
|
1386
1522
|
}
|
|
1523
|
+
/**
|
|
1524
|
+
* Create
|
|
1525
|
+
*/
|
|
1387
1526
|
export interface OnModelBeforeCreateTopicParams {
|
|
1388
1527
|
input: CmsModelCreateInput;
|
|
1389
1528
|
model: CmsModel;
|
|
@@ -1392,6 +1531,14 @@ export interface OnModelAfterCreateTopicParams {
|
|
|
1392
1531
|
input: CmsModelCreateInput;
|
|
1393
1532
|
model: CmsModel;
|
|
1394
1533
|
}
|
|
1534
|
+
export interface OnModelCreateErrorTopicParams {
|
|
1535
|
+
input: CmsModelCreateInput;
|
|
1536
|
+
model: CmsModel;
|
|
1537
|
+
error: Error;
|
|
1538
|
+
}
|
|
1539
|
+
/**
|
|
1540
|
+
* Create From / Clone
|
|
1541
|
+
*/
|
|
1395
1542
|
export interface OnModelBeforeCreateFromTopicParams {
|
|
1396
1543
|
input: CmsModelCreateInput;
|
|
1397
1544
|
original: CmsModel;
|
|
@@ -1402,6 +1549,15 @@ export interface OnModelAfterCreateFromTopicParams {
|
|
|
1402
1549
|
original: CmsModel;
|
|
1403
1550
|
model: CmsModel;
|
|
1404
1551
|
}
|
|
1552
|
+
export interface OnModelCreateFromErrorParams {
|
|
1553
|
+
input: CmsModelCreateInput;
|
|
1554
|
+
original: CmsModel;
|
|
1555
|
+
model: CmsModel;
|
|
1556
|
+
error: Error;
|
|
1557
|
+
}
|
|
1558
|
+
/**
|
|
1559
|
+
* Update
|
|
1560
|
+
*/
|
|
1405
1561
|
export interface OnModelBeforeUpdateTopicParams {
|
|
1406
1562
|
input: CmsModelUpdateInput;
|
|
1407
1563
|
original: CmsModel;
|
|
@@ -1412,15 +1568,35 @@ export interface OnModelAfterUpdateTopicParams {
|
|
|
1412
1568
|
original: CmsModel;
|
|
1413
1569
|
model: CmsModel;
|
|
1414
1570
|
}
|
|
1571
|
+
export interface OnModelUpdateErrorTopicParams {
|
|
1572
|
+
input: CmsModelUpdateInput;
|
|
1573
|
+
original: CmsModel;
|
|
1574
|
+
model: CmsModel;
|
|
1575
|
+
error: Error;
|
|
1576
|
+
}
|
|
1577
|
+
/**
|
|
1578
|
+
* Delete
|
|
1579
|
+
*/
|
|
1415
1580
|
export interface OnModelBeforeDeleteTopicParams {
|
|
1416
1581
|
model: CmsModel;
|
|
1417
1582
|
}
|
|
1418
1583
|
export interface OnModelAfterDeleteTopicParams {
|
|
1419
1584
|
model: CmsModel;
|
|
1420
1585
|
}
|
|
1586
|
+
export interface OnModelDeleteErrorTopicParams {
|
|
1587
|
+
model: CmsModel;
|
|
1588
|
+
error: Error;
|
|
1589
|
+
}
|
|
1590
|
+
/**
|
|
1591
|
+
* Initialize
|
|
1592
|
+
*/
|
|
1421
1593
|
export interface OnModelInitializeParams {
|
|
1422
1594
|
model: CmsModel;
|
|
1595
|
+
data: Record<string, any>;
|
|
1423
1596
|
}
|
|
1597
|
+
/**
|
|
1598
|
+
*
|
|
1599
|
+
*/
|
|
1424
1600
|
export interface CmsModelUpdateDirectParams {
|
|
1425
1601
|
model: CmsModel;
|
|
1426
1602
|
original: CmsModel;
|
|
@@ -1467,9 +1643,9 @@ export interface CmsModelContext {
|
|
|
1467
1643
|
*
|
|
1468
1644
|
* Primary idea behind this is creating the index, for the code models, in the ES.
|
|
1469
1645
|
*/
|
|
1470
|
-
initializeModel: (modelId: string) => Promise<boolean>;
|
|
1646
|
+
initializeModel: (modelId: string, data: Record<string, any>) => Promise<boolean>;
|
|
1471
1647
|
/**
|
|
1472
|
-
* Get
|
|
1648
|
+
* Get an instance of CmsModelManager for given content modelId.
|
|
1473
1649
|
*
|
|
1474
1650
|
* @see CmsModelManager
|
|
1475
1651
|
*
|
|
@@ -1528,12 +1704,16 @@ export interface CmsModelContext {
|
|
|
1528
1704
|
*/
|
|
1529
1705
|
onModelBeforeCreate: Topic<OnModelBeforeCreateTopicParams>;
|
|
1530
1706
|
onModelAfterCreate: Topic<OnModelAfterCreateTopicParams>;
|
|
1707
|
+
onModelCreateError: Topic<OnModelCreateErrorTopicParams>;
|
|
1531
1708
|
onModelBeforeCreateFrom: Topic<OnModelBeforeCreateFromTopicParams>;
|
|
1532
1709
|
onModelAfterCreateFrom: Topic<OnModelAfterCreateFromTopicParams>;
|
|
1710
|
+
onModelCreateFromError: Topic<OnModelCreateFromErrorParams>;
|
|
1533
1711
|
onModelBeforeUpdate: Topic<OnModelBeforeUpdateTopicParams>;
|
|
1534
1712
|
onModelAfterUpdate: Topic<OnModelAfterUpdateTopicParams>;
|
|
1713
|
+
onModelUpdateError: Topic<OnModelUpdateErrorTopicParams>;
|
|
1535
1714
|
onModelBeforeDelete: Topic<OnModelBeforeDeleteTopicParams>;
|
|
1536
1715
|
onModelAfterDelete: Topic<OnModelAfterDeleteTopicParams>;
|
|
1716
|
+
onModelDeleteError: Topic<OnModelDeleteErrorTopicParams>;
|
|
1537
1717
|
onModelInitialize: Topic<OnModelInitializeParams>;
|
|
1538
1718
|
}
|
|
1539
1719
|
/**
|
|
@@ -1619,7 +1799,12 @@ export interface CmsEntryListWhere {
|
|
|
1619
1799
|
/**
|
|
1620
1800
|
* This is to allow querying by any content model field defined by the user.
|
|
1621
1801
|
*/
|
|
1622
|
-
[key: string]:
|
|
1802
|
+
[key: string]: string | number | boolean | undefined | string[] | number[] | null | CmsEntryListWhere[] | CmsEntryListWhere | CmsEntryListWhereRef;
|
|
1803
|
+
/**
|
|
1804
|
+
* To allow querying via nested queries, we added the AND / OR properties.
|
|
1805
|
+
*/
|
|
1806
|
+
AND?: CmsEntryListWhere[];
|
|
1807
|
+
OR?: CmsEntryListWhere[];
|
|
1623
1808
|
}
|
|
1624
1809
|
/**
|
|
1625
1810
|
* Entry listing sort.
|
|
@@ -1672,15 +1857,18 @@ export interface CmsEntryMeta {
|
|
|
1672
1857
|
*/
|
|
1673
1858
|
totalCount: number;
|
|
1674
1859
|
}
|
|
1860
|
+
/**
|
|
1861
|
+
* Create
|
|
1862
|
+
*/
|
|
1675
1863
|
export interface OnEntryBeforeCreateTopicParams {
|
|
1676
1864
|
input: CreateCmsEntryInput;
|
|
1677
1865
|
entry: CmsEntry;
|
|
1678
|
-
model:
|
|
1866
|
+
model: CmsModel;
|
|
1679
1867
|
}
|
|
1680
1868
|
export interface OnEntryAfterCreateTopicParams {
|
|
1681
1869
|
input: CreateCmsEntryInput;
|
|
1682
1870
|
entry: CmsEntry;
|
|
1683
|
-
model:
|
|
1871
|
+
model: CmsModel;
|
|
1684
1872
|
storageEntry: CmsEntry;
|
|
1685
1873
|
}
|
|
1686
1874
|
export interface OnEntryCreateErrorTopicParams {
|
|
@@ -1689,36 +1877,43 @@ export interface OnEntryCreateErrorTopicParams {
|
|
|
1689
1877
|
entry: CmsEntry;
|
|
1690
1878
|
model: CmsModel;
|
|
1691
1879
|
}
|
|
1880
|
+
/**
|
|
1881
|
+
* Revision Create
|
|
1882
|
+
*/
|
|
1692
1883
|
export interface OnEntryRevisionBeforeCreateTopicParams {
|
|
1693
1884
|
input: CreateFromCmsEntryInput;
|
|
1694
1885
|
entry: CmsEntry;
|
|
1695
1886
|
original: CmsEntry;
|
|
1696
|
-
model:
|
|
1887
|
+
model: CmsModel;
|
|
1697
1888
|
}
|
|
1698
1889
|
export interface OnEntryRevisionAfterCreateTopicParams {
|
|
1699
1890
|
input: CreateFromCmsEntryInput;
|
|
1700
1891
|
entry: CmsEntry;
|
|
1701
1892
|
original: CmsEntry;
|
|
1702
|
-
model:
|
|
1893
|
+
model: CmsModel;
|
|
1703
1894
|
storageEntry: CmsEntry;
|
|
1704
1895
|
}
|
|
1705
1896
|
export interface OnEntryCreateRevisionErrorTopicParams {
|
|
1706
1897
|
error: Error;
|
|
1707
1898
|
input: CreateFromCmsEntryInput;
|
|
1899
|
+
original: CmsEntry;
|
|
1708
1900
|
entry: CmsEntry;
|
|
1709
1901
|
model: CmsModel;
|
|
1710
1902
|
}
|
|
1903
|
+
/**
|
|
1904
|
+
* Update
|
|
1905
|
+
*/
|
|
1711
1906
|
export interface OnEntryBeforeUpdateTopicParams {
|
|
1712
1907
|
input: UpdateCmsEntryInput;
|
|
1713
1908
|
original: CmsEntry;
|
|
1714
1909
|
entry: CmsEntry;
|
|
1715
|
-
model:
|
|
1910
|
+
model: CmsModel;
|
|
1716
1911
|
}
|
|
1717
1912
|
export interface OnEntryAfterUpdateTopicParams {
|
|
1718
1913
|
input: UpdateCmsEntryInput;
|
|
1719
1914
|
original: CmsEntry;
|
|
1720
1915
|
entry: CmsEntry;
|
|
1721
|
-
model:
|
|
1916
|
+
model: CmsModel;
|
|
1722
1917
|
storageEntry: CmsEntry;
|
|
1723
1918
|
}
|
|
1724
1919
|
export interface OnEntryUpdateErrorTopicParams {
|
|
@@ -1727,27 +1922,50 @@ export interface OnEntryUpdateErrorTopicParams {
|
|
|
1727
1922
|
entry: CmsEntry;
|
|
1728
1923
|
model: CmsModel;
|
|
1729
1924
|
}
|
|
1925
|
+
/**
|
|
1926
|
+
* Publish
|
|
1927
|
+
*/
|
|
1730
1928
|
export interface OnEntryBeforePublishTopicParams {
|
|
1731
1929
|
entry: CmsEntry;
|
|
1732
|
-
model:
|
|
1930
|
+
model: CmsModel;
|
|
1733
1931
|
}
|
|
1734
1932
|
export interface OnEntryAfterPublishTopicParams {
|
|
1735
1933
|
entry: CmsEntry;
|
|
1736
|
-
model:
|
|
1934
|
+
model: CmsModel;
|
|
1737
1935
|
storageEntry: CmsEntry;
|
|
1738
1936
|
}
|
|
1739
1937
|
export interface OnEntryPublishErrorTopicParams {
|
|
1740
1938
|
error: Error;
|
|
1741
1939
|
entry: CmsEntry;
|
|
1742
|
-
model:
|
|
1940
|
+
model: CmsModel;
|
|
1941
|
+
}
|
|
1942
|
+
/**
|
|
1943
|
+
* Republish
|
|
1944
|
+
*/
|
|
1945
|
+
export interface OnEntryBeforeRepublishTopicParams {
|
|
1946
|
+
entry: CmsEntry;
|
|
1947
|
+
model: CmsModel;
|
|
1743
1948
|
}
|
|
1949
|
+
export interface OnEntryAfterRepublishTopicParams {
|
|
1950
|
+
entry: CmsEntry;
|
|
1951
|
+
model: CmsModel;
|
|
1952
|
+
storageEntry: CmsEntry;
|
|
1953
|
+
}
|
|
1954
|
+
export interface OnEntryRepublishErrorTopicParams {
|
|
1955
|
+
error: Error;
|
|
1956
|
+
entry: CmsEntry;
|
|
1957
|
+
model: CmsModel;
|
|
1958
|
+
}
|
|
1959
|
+
/**
|
|
1960
|
+
* Unpublish
|
|
1961
|
+
*/
|
|
1744
1962
|
export interface OnEntryBeforeUnpublishTopicParams {
|
|
1745
1963
|
entry: CmsEntry;
|
|
1746
|
-
model:
|
|
1964
|
+
model: CmsModel;
|
|
1747
1965
|
}
|
|
1748
1966
|
export interface OnEntryAfterUnpublishTopicParams {
|
|
1749
1967
|
entry: CmsEntry;
|
|
1750
|
-
model:
|
|
1968
|
+
model: CmsModel;
|
|
1751
1969
|
storageEntry: CmsEntry;
|
|
1752
1970
|
}
|
|
1753
1971
|
export interface OnEntryUnpublishErrorTopicParams {
|
|
@@ -1757,43 +1975,60 @@ export interface OnEntryUnpublishErrorTopicParams {
|
|
|
1757
1975
|
}
|
|
1758
1976
|
export interface OnEntryBeforeDeleteTopicParams {
|
|
1759
1977
|
entry: CmsEntry;
|
|
1760
|
-
model:
|
|
1978
|
+
model: CmsModel;
|
|
1761
1979
|
}
|
|
1762
1980
|
export interface OnEntryAfterDeleteTopicParams {
|
|
1763
1981
|
entry: CmsEntry;
|
|
1764
|
-
model:
|
|
1982
|
+
model: CmsModel;
|
|
1765
1983
|
}
|
|
1766
1984
|
export interface OnEntryDeleteErrorTopicParams {
|
|
1767
1985
|
error: Error;
|
|
1768
1986
|
entry: CmsEntry;
|
|
1769
|
-
model:
|
|
1987
|
+
model: CmsModel;
|
|
1770
1988
|
}
|
|
1771
1989
|
export interface OnEntryRevisionBeforeDeleteTopicParams {
|
|
1772
1990
|
entry: CmsEntry;
|
|
1773
|
-
model:
|
|
1991
|
+
model: CmsModel;
|
|
1774
1992
|
}
|
|
1775
1993
|
export interface OnEntryRevisionAfterDeleteTopicParams {
|
|
1776
1994
|
entry: CmsEntry;
|
|
1777
|
-
model:
|
|
1995
|
+
model: CmsModel;
|
|
1778
1996
|
}
|
|
1779
1997
|
export interface OnEntryRevisionDeleteErrorTopicParams {
|
|
1780
1998
|
error: Error;
|
|
1781
1999
|
entry: CmsEntry;
|
|
1782
|
-
model:
|
|
2000
|
+
model: CmsModel;
|
|
2001
|
+
}
|
|
2002
|
+
export interface OnEntryBeforeDeleteMultipleTopicParams {
|
|
2003
|
+
model: CmsModel;
|
|
2004
|
+
entries: CmsEntry[];
|
|
2005
|
+
ids: string[];
|
|
2006
|
+
}
|
|
2007
|
+
export interface OnEntryAfterDeleteMultipleTopicParams {
|
|
2008
|
+
model: CmsModel;
|
|
2009
|
+
entries: CmsEntry[];
|
|
2010
|
+
ids: string[];
|
|
2011
|
+
}
|
|
2012
|
+
export interface OnEntryDeleteMultipleErrorTopicParams {
|
|
2013
|
+
model: CmsModel;
|
|
2014
|
+
entries: CmsEntry[];
|
|
2015
|
+
ids: string[];
|
|
2016
|
+
error: Error;
|
|
1783
2017
|
}
|
|
1784
2018
|
export interface OnEntryBeforeGetTopicParams {
|
|
1785
|
-
model:
|
|
2019
|
+
model: CmsModel;
|
|
1786
2020
|
where: CmsEntryListWhere;
|
|
1787
2021
|
}
|
|
1788
2022
|
export interface EntryBeforeListTopicParams {
|
|
1789
2023
|
where: CmsEntryListWhere;
|
|
1790
|
-
model:
|
|
2024
|
+
model: CmsModel;
|
|
1791
2025
|
}
|
|
1792
2026
|
/**
|
|
1793
2027
|
* @category Context
|
|
1794
2028
|
* @category CmsEntry
|
|
1795
2029
|
*/
|
|
1796
2030
|
export interface CreateCmsEntryInput {
|
|
2031
|
+
id?: string;
|
|
1797
2032
|
[key: string]: any;
|
|
1798
2033
|
}
|
|
1799
2034
|
/**
|
|
@@ -1810,6 +2045,34 @@ export interface CreateFromCmsEntryInput {
|
|
|
1810
2045
|
export interface UpdateCmsEntryInput {
|
|
1811
2046
|
[key: string]: any;
|
|
1812
2047
|
}
|
|
2048
|
+
/**
|
|
2049
|
+
* @category Context
|
|
2050
|
+
* @category CmsEntry
|
|
2051
|
+
*/
|
|
2052
|
+
export interface GetUniqueFieldValuesParams {
|
|
2053
|
+
where: CmsEntryListWhere;
|
|
2054
|
+
fieldId: string;
|
|
2055
|
+
}
|
|
2056
|
+
/**
|
|
2057
|
+
* @category CmsEntry
|
|
2058
|
+
*/
|
|
2059
|
+
export interface CmsDeleteEntryOptions {
|
|
2060
|
+
/**
|
|
2061
|
+
* Runs the delete commands even if the entry is not found in the DynamoDB.
|
|
2062
|
+
* This is to force clean the entry records that might have been left behind a failed delete.
|
|
2063
|
+
*/
|
|
2064
|
+
force?: boolean;
|
|
2065
|
+
}
|
|
2066
|
+
/**
|
|
2067
|
+
* @category Context
|
|
2068
|
+
* @category CmsEntry
|
|
2069
|
+
*/
|
|
2070
|
+
export interface DeleteMultipleEntriesParams {
|
|
2071
|
+
entries: string[];
|
|
2072
|
+
}
|
|
2073
|
+
export declare type DeleteMultipleEntriesResponse = {
|
|
2074
|
+
id: string;
|
|
2075
|
+
}[];
|
|
1813
2076
|
/**
|
|
1814
2077
|
* Cms Entry CRUD methods in the context.
|
|
1815
2078
|
*
|
|
@@ -1820,7 +2083,7 @@ export interface CmsEntryContext {
|
|
|
1820
2083
|
/**
|
|
1821
2084
|
* Get a single content entry for a model.
|
|
1822
2085
|
*/
|
|
1823
|
-
getEntry: (model: CmsModel, params: CmsEntryGetParams) => Promise<CmsEntry
|
|
2086
|
+
getEntry: (model: CmsModel, params: CmsEntryGetParams) => Promise<CmsEntry>;
|
|
1824
2087
|
/**
|
|
1825
2088
|
* Get a list of entries for a model by a given ID (revision).
|
|
1826
2089
|
*/
|
|
@@ -1832,15 +2095,15 @@ export interface CmsEntryContext {
|
|
|
1832
2095
|
/**
|
|
1833
2096
|
* List entries for a model. Internal method used by get, listLatest and listPublished.
|
|
1834
2097
|
*/
|
|
1835
|
-
listEntries: (model: CmsModel, params: CmsEntryListParams) => Promise<[CmsEntry[], CmsEntryMeta]>;
|
|
2098
|
+
listEntries: <T = CmsEntryValues>(model: CmsModel, params: CmsEntryListParams) => Promise<[CmsEntry<T>[], CmsEntryMeta]>;
|
|
1836
2099
|
/**
|
|
1837
|
-
* Lists latest entries. Used for manage API.
|
|
2100
|
+
* Lists the latest entries. Used for manage API.
|
|
1838
2101
|
*/
|
|
1839
|
-
listLatestEntries: (model: CmsModel, params?: CmsEntryListParams) => Promise<[CmsEntry[], CmsEntryMeta]>;
|
|
2102
|
+
listLatestEntries: <T = CmsEntryValues>(model: CmsModel, params?: CmsEntryListParams) => Promise<[CmsEntry<T>[], CmsEntryMeta]>;
|
|
1840
2103
|
/**
|
|
1841
2104
|
* List published entries. Used for read API.
|
|
1842
2105
|
*/
|
|
1843
|
-
listPublishedEntries: (model: CmsModel, params?: CmsEntryListParams) => Promise<[CmsEntry[], CmsEntryMeta]>;
|
|
2106
|
+
listPublishedEntries: <T = CmsEntryValues>(model: CmsModel, params?: CmsEntryListParams) => Promise<[CmsEntry<T>[], CmsEntryMeta]>;
|
|
1844
2107
|
/**
|
|
1845
2108
|
* List published entries by IDs.
|
|
1846
2109
|
*/
|
|
@@ -1873,7 +2136,11 @@ export interface CmsEntryContext {
|
|
|
1873
2136
|
/**
|
|
1874
2137
|
* Delete entry with all its revisions.
|
|
1875
2138
|
*/
|
|
1876
|
-
deleteEntry: (model: CmsModel, id: string) => Promise<void>;
|
|
2139
|
+
deleteEntry: (model: CmsModel, id: string, options?: CmsDeleteEntryOptions) => Promise<void>;
|
|
2140
|
+
/**
|
|
2141
|
+
* Delete multiple entries
|
|
2142
|
+
*/
|
|
2143
|
+
deleteMultipleEntries: (model: CmsModel, params: DeleteMultipleEntriesParams) => Promise<DeleteMultipleEntriesResponse>;
|
|
1877
2144
|
/**
|
|
1878
2145
|
* Publish entry.
|
|
1879
2146
|
*/
|
|
@@ -1887,7 +2154,13 @@ export interface CmsEntryContext {
|
|
|
1887
2154
|
*/
|
|
1888
2155
|
getEntryRevisions: (model: CmsModel, id: string) => Promise<CmsEntry[]>;
|
|
1889
2156
|
/**
|
|
1890
|
-
*
|
|
2157
|
+
* List all unique values for a given field.
|
|
2158
|
+
*
|
|
2159
|
+
* @internal
|
|
2160
|
+
*/
|
|
2161
|
+
getUniqueFieldValues: (model: CmsModel, params: GetUniqueFieldValuesParams) => Promise<string[]>;
|
|
2162
|
+
/**
|
|
2163
|
+
* Lifecycle events - deprecated.
|
|
1891
2164
|
*/
|
|
1892
2165
|
/**
|
|
1893
2166
|
* @deprecated
|
|
@@ -1974,6 +2247,9 @@ export interface CmsEntryContext {
|
|
|
1974
2247
|
onEntryBeforePublish: Topic<OnEntryBeforePublishTopicParams>;
|
|
1975
2248
|
onEntryAfterPublish: Topic<OnEntryAfterPublishTopicParams>;
|
|
1976
2249
|
onEntryPublishError: Topic<OnEntryPublishErrorTopicParams>;
|
|
2250
|
+
onEntryBeforeRepublish: Topic<OnEntryBeforeRepublishTopicParams>;
|
|
2251
|
+
onEntryAfterRepublish: Topic<OnEntryAfterRepublishTopicParams>;
|
|
2252
|
+
onEntryRepublishError: Topic<OnEntryRepublishErrorTopicParams>;
|
|
1977
2253
|
onEntryBeforeUnpublish: Topic<OnEntryBeforeUnpublishTopicParams>;
|
|
1978
2254
|
onEntryAfterUnpublish: Topic<OnEntryAfterUnpublishTopicParams>;
|
|
1979
2255
|
onEntryUnpublishError: Topic<OnEntryUnpublishErrorTopicParams>;
|
|
@@ -2022,13 +2298,13 @@ export interface BaseCmsSecurityPermission extends SecurityPermission {
|
|
|
2022
2298
|
*/
|
|
2023
2299
|
export interface CmsModelPermission extends BaseCmsSecurityPermission {
|
|
2024
2300
|
/**
|
|
2025
|
-
*
|
|
2301
|
+
* An object representing `key: model.modelId` values where key is locale code.
|
|
2026
2302
|
*/
|
|
2027
2303
|
models?: {
|
|
2028
2304
|
[key: string]: string[];
|
|
2029
2305
|
};
|
|
2030
2306
|
/**
|
|
2031
|
-
*
|
|
2307
|
+
* {locale: groupId[]} map, where key is a locale code.
|
|
2032
2308
|
*/
|
|
2033
2309
|
groups?: {
|
|
2034
2310
|
[key: string]: string[];
|
|
@@ -2042,7 +2318,7 @@ export interface CmsModelPermission extends BaseCmsSecurityPermission {
|
|
|
2042
2318
|
*/
|
|
2043
2319
|
export interface CmsGroupPermission extends BaseCmsSecurityPermission {
|
|
2044
2320
|
/**
|
|
2045
|
-
*
|
|
2321
|
+
* {locale: groupId[]} map, where key is a locale code.
|
|
2046
2322
|
*/
|
|
2047
2323
|
groups?: {
|
|
2048
2324
|
[key: string]: string[];
|
|
@@ -2057,13 +2333,13 @@ export interface CmsGroupPermission extends BaseCmsSecurityPermission {
|
|
|
2057
2333
|
export interface CmsEntryPermission extends BaseCmsSecurityPermission {
|
|
2058
2334
|
pw?: string;
|
|
2059
2335
|
/**
|
|
2060
|
-
*
|
|
2336
|
+
* An object representing `key: model.modelId` values where key is locale code.
|
|
2061
2337
|
*/
|
|
2062
2338
|
models?: {
|
|
2063
2339
|
[key: string]: string[];
|
|
2064
2340
|
};
|
|
2065
2341
|
/**
|
|
2066
|
-
*
|
|
2342
|
+
* {locale: groupId[]} map, where key is a locale code.
|
|
2067
2343
|
*/
|
|
2068
2344
|
groups?: {
|
|
2069
2345
|
[key: string]: string[];
|
|
@@ -2178,7 +2454,7 @@ export interface CmsEntryStorageOperationsListParams {
|
|
|
2178
2454
|
sort?: CmsEntryListSort;
|
|
2179
2455
|
search?: string;
|
|
2180
2456
|
fields?: string[];
|
|
2181
|
-
limit
|
|
2457
|
+
limit: number;
|
|
2182
2458
|
after?: string | null;
|
|
2183
2459
|
}
|
|
2184
2460
|
export interface CmsEntryStorageOperationsCreateParams<T extends CmsStorageEntry = CmsStorageEntry> {
|
|
@@ -2230,11 +2506,11 @@ export interface CmsEntryStorageOperationsDeleteRevisionParams<T extends CmsStor
|
|
|
2230
2506
|
latestStorageEntry: T | null;
|
|
2231
2507
|
}
|
|
2232
2508
|
export interface CmsEntryStorageOperationsDeleteParams {
|
|
2233
|
-
/**
|
|
2234
|
-
* Entry that is going to be deleted.
|
|
2235
|
-
*/
|
|
2236
2509
|
entry: CmsEntry;
|
|
2237
2510
|
}
|
|
2511
|
+
export interface CmsEntryStorageOperationsDeleteEntriesParams {
|
|
2512
|
+
entries: string[];
|
|
2513
|
+
}
|
|
2238
2514
|
export interface CmsEntryStorageOperationsPublishParams<T extends CmsStorageEntry = CmsStorageEntry> {
|
|
2239
2515
|
/**
|
|
2240
2516
|
* The modified entry that is going to be saved as published.
|
|
@@ -2256,6 +2532,10 @@ export interface CmsEntryStorageOperationsUnpublishParams<T extends CmsStorageEn
|
|
|
2256
2532
|
*/
|
|
2257
2533
|
storageEntry: T;
|
|
2258
2534
|
}
|
|
2535
|
+
export interface CmsEntryStorageOperationsGetUniqueFieldValuesParams {
|
|
2536
|
+
where: CmsEntryListWhere;
|
|
2537
|
+
fieldId: string;
|
|
2538
|
+
}
|
|
2259
2539
|
export interface CmsEntryStorageOperationsGetByIdsParams {
|
|
2260
2540
|
ids: readonly string[];
|
|
2261
2541
|
}
|
|
@@ -2312,71 +2592,81 @@ export interface CmsEntryStorageOperations<T extends CmsStorageEntry = CmsStorag
|
|
|
2312
2592
|
/**
|
|
2313
2593
|
* Get all the entries of the ids.
|
|
2314
2594
|
*/
|
|
2315
|
-
getByIds: (model:
|
|
2595
|
+
getByIds: (model: CmsModel, params: CmsEntryStorageOperationsGetByIdsParams) => Promise<T[]>;
|
|
2316
2596
|
/**
|
|
2317
2597
|
* Get all the published entries of the ids.
|
|
2318
2598
|
*/
|
|
2319
|
-
getPublishedByIds: (model:
|
|
2599
|
+
getPublishedByIds: (model: CmsModel, params: CmsEntryStorageOperationsGetPublishedByIdsParams) => Promise<T[]>;
|
|
2320
2600
|
/**
|
|
2321
2601
|
* Get all the latest entries of the ids.
|
|
2322
2602
|
*/
|
|
2323
|
-
getLatestByIds: (model:
|
|
2603
|
+
getLatestByIds: (model: CmsModel, params: CmsEntryStorageOperationsGetLatestByIdsParams) => Promise<T[]>;
|
|
2324
2604
|
/**
|
|
2325
2605
|
* Get all revisions of the given entry id.
|
|
2326
2606
|
*/
|
|
2327
|
-
getRevisions: (model:
|
|
2607
|
+
getRevisions: (model: CmsModel, params: CmsEntryStorageOperationsGetRevisionsParams) => Promise<T[]>;
|
|
2328
2608
|
/**
|
|
2329
2609
|
* Get the entry by the given revision id.
|
|
2330
2610
|
*/
|
|
2331
|
-
getRevisionById: (model:
|
|
2611
|
+
getRevisionById: (model: CmsModel, params: CmsEntryStorageOperationsGetRevisionParams) => Promise<T | null>;
|
|
2332
2612
|
/**
|
|
2333
2613
|
* Get the published entry by given entryId.
|
|
2334
2614
|
*/
|
|
2335
|
-
getPublishedRevisionByEntryId: (model:
|
|
2615
|
+
getPublishedRevisionByEntryId: (model: CmsModel, params: CmsEntryStorageOperationsGetPublishedRevisionParams) => Promise<T | null>;
|
|
2336
2616
|
/**
|
|
2337
2617
|
* Get the latest entry by given entryId.
|
|
2338
2618
|
*/
|
|
2339
|
-
getLatestRevisionByEntryId: (model:
|
|
2619
|
+
getLatestRevisionByEntryId: (model: CmsModel, params: CmsEntryStorageOperationsGetLatestRevisionParams) => Promise<T | null>;
|
|
2340
2620
|
/**
|
|
2341
2621
|
* Get the revision of the entry before given one.
|
|
2342
2622
|
*/
|
|
2343
|
-
getPreviousRevision: (model:
|
|
2623
|
+
getPreviousRevision: (model: CmsModel, params: CmsEntryStorageOperationsGetPreviousRevisionParams) => Promise<T | null>;
|
|
2344
2624
|
/**
|
|
2345
2625
|
* Gets entry by given params.
|
|
2346
2626
|
*/
|
|
2347
|
-
get: (model:
|
|
2627
|
+
get: (model: CmsModel, params: CmsEntryStorageOperationsGetParams) => Promise<T | null>;
|
|
2348
2628
|
/**
|
|
2349
2629
|
* List all entries. Filterable via params.
|
|
2350
2630
|
*/
|
|
2351
|
-
list: (model:
|
|
2631
|
+
list: (model: CmsModel, params: CmsEntryStorageOperationsListParams) => Promise<CmsEntryStorageOperationsListResponse<T>>;
|
|
2352
2632
|
/**
|
|
2353
2633
|
* Create a new entry.
|
|
2354
2634
|
*/
|
|
2355
|
-
create: (model:
|
|
2635
|
+
create: (model: CmsModel, params: CmsEntryStorageOperationsCreateParams<T>) => Promise<T>;
|
|
2356
2636
|
/**
|
|
2357
2637
|
* Create a new entry from existing one.
|
|
2358
2638
|
*/
|
|
2359
|
-
createRevisionFrom: (model:
|
|
2639
|
+
createRevisionFrom: (model: CmsModel, params: CmsEntryStorageOperationsCreateRevisionFromParams<T>) => Promise<T>;
|
|
2360
2640
|
/**
|
|
2361
2641
|
* Update existing entry.
|
|
2362
2642
|
*/
|
|
2363
|
-
update: (model:
|
|
2643
|
+
update: (model: CmsModel, params: CmsEntryStorageOperationsUpdateParams<T>) => Promise<T>;
|
|
2364
2644
|
/**
|
|
2365
2645
|
* Delete the entry revision.
|
|
2366
2646
|
*/
|
|
2367
|
-
deleteRevision: (model:
|
|
2647
|
+
deleteRevision: (model: CmsModel, params: CmsEntryStorageOperationsDeleteRevisionParams<T>) => Promise<void>;
|
|
2368
2648
|
/**
|
|
2369
2649
|
* Delete the entry.
|
|
2370
2650
|
*/
|
|
2371
|
-
delete: (model:
|
|
2651
|
+
delete: (model: CmsModel, params: CmsEntryStorageOperationsDeleteParams) => Promise<void>;
|
|
2652
|
+
/**
|
|
2653
|
+
* Delete multiple entries, with a limit on how much can be deleted in one call.
|
|
2654
|
+
*/
|
|
2655
|
+
deleteMultipleEntries: (model: CmsModel, params: CmsEntryStorageOperationsDeleteEntriesParams) => Promise<void>;
|
|
2372
2656
|
/**
|
|
2373
2657
|
* Publish the entry.
|
|
2374
2658
|
*/
|
|
2375
|
-
publish: (model:
|
|
2659
|
+
publish: (model: CmsModel, params: CmsEntryStorageOperationsPublishParams<T>) => Promise<T>;
|
|
2376
2660
|
/**
|
|
2377
2661
|
* Unpublish the entry.
|
|
2378
2662
|
*/
|
|
2379
|
-
unpublish: (model:
|
|
2663
|
+
unpublish: (model: CmsModel, params: CmsEntryStorageOperationsUnpublishParams<T>) => Promise<T>;
|
|
2664
|
+
/**
|
|
2665
|
+
* Method to list all the unique values for the given field id.
|
|
2666
|
+
* Simplest use case would be to aggregate tags for some content.
|
|
2667
|
+
* @internal
|
|
2668
|
+
*/
|
|
2669
|
+
getUniqueFieldValues: (model: CmsModel, params: CmsEntryStorageOperationsGetUniqueFieldValuesParams) => Promise<string[]>;
|
|
2380
2670
|
}
|
|
2381
2671
|
export declare enum CONTENT_ENTRY_STATUS {
|
|
2382
2672
|
DRAFT = "draft",
|
|
@@ -2439,6 +2729,7 @@ export interface CmsSystemStorageOperations {
|
|
|
2439
2729
|
update: (params: CmsSystemStorageOperationsUpdateParams) => Promise<CmsSystem>;
|
|
2440
2730
|
}
|
|
2441
2731
|
export interface HeadlessCmsStorageOperations<C = CmsContext> {
|
|
2732
|
+
name: string;
|
|
2442
2733
|
system: CmsSystemStorageOperations;
|
|
2443
2734
|
settings: CmsSettingsStorageOperations;
|
|
2444
2735
|
groups: CmsGroupStorageOperations;
|
|
@@ -2447,11 +2738,7 @@ export interface HeadlessCmsStorageOperations<C = CmsContext> {
|
|
|
2447
2738
|
/**
|
|
2448
2739
|
* Either attach something from the storage operations or run something in it.
|
|
2449
2740
|
*/
|
|
2450
|
-
beforeInit
|
|
2741
|
+
beforeInit: (context: C) => Promise<void>;
|
|
2451
2742
|
init?: (context: C) => Promise<void>;
|
|
2452
|
-
/**
|
|
2453
|
-
* An upgrade to run if necessary.
|
|
2454
|
-
*/
|
|
2455
|
-
upgrade?: UpgradePlugin | null;
|
|
2456
2743
|
}
|
|
2457
2744
|
export {};
|