@webiny/api-headless-cms 0.0.0-unstable.bca7b3e350 → 0.0.0-unstable.c59b9cc5b9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/context.js +47 -43
  2. package/context.js.map +1 -1
  3. package/crud/contentEntry/markLockedFields.d.ts +1 -1
  4. package/crud/contentEntry/markLockedFields.js +3 -0
  5. package/crud/contentEntry/markLockedFields.js.map +1 -1
  6. package/crud/contentEntry/referenceFieldsMapping.js +34 -5
  7. package/crud/contentEntry/referenceFieldsMapping.js.map +1 -1
  8. package/crud/contentEntry.crud.d.ts +8 -5
  9. package/crud/contentEntry.crud.js +1023 -840
  10. package/crud/contentEntry.crud.js.map +1 -1
  11. package/crud/contentModel/beforeCreate.js +39 -76
  12. package/crud/contentModel/beforeCreate.js.map +1 -1
  13. package/crud/contentModel/beforeDelete.d.ts +1 -1
  14. package/crud/contentModel/beforeDelete.js +1 -5
  15. package/crud/contentModel/beforeDelete.js.map +1 -1
  16. package/crud/contentModel/beforeUpdate.js +31 -3
  17. package/crud/contentModel/beforeUpdate.js.map +1 -1
  18. package/crud/contentModel/compatibility/modelApiName.d.ts +3 -0
  19. package/crud/contentModel/compatibility/modelApiName.js +24 -0
  20. package/crud/contentModel/compatibility/modelApiName.js.map +1 -0
  21. package/crud/contentModel/defaultFields.d.ts +5 -0
  22. package/crud/contentModel/defaultFields.js +58 -0
  23. package/crud/contentModel/defaultFields.js.map +1 -0
  24. package/crud/contentModel/fields/descriptionField.d.ts +2 -0
  25. package/crud/contentModel/fields/descriptionField.js +42 -0
  26. package/crud/contentModel/fields/descriptionField.js.map +1 -0
  27. package/crud/contentModel/fields/imageField.d.ts +2 -0
  28. package/crud/contentModel/fields/imageField.js +46 -0
  29. package/crud/contentModel/fields/imageField.js.map +1 -0
  30. package/crud/contentModel/fields/titleField.d.ts +2 -0
  31. package/crud/contentModel/fields/titleField.js +58 -0
  32. package/crud/contentModel/fields/titleField.js.map +1 -0
  33. package/crud/contentModel/validate/endingAllowed.d.ts +6 -0
  34. package/crud/contentModel/validate/endingAllowed.js +26 -0
  35. package/crud/contentModel/validate/endingAllowed.js.map +1 -0
  36. package/crud/contentModel/validate/isModelEndingAllowed.d.ts +6 -0
  37. package/crud/contentModel/validate/isModelEndingAllowed.js +24 -0
  38. package/crud/contentModel/validate/isModelEndingAllowed.js.map +1 -0
  39. package/crud/contentModel/validate/modelId.d.ts +11 -0
  40. package/crud/contentModel/validate/modelId.js +36 -0
  41. package/crud/contentModel/validate/modelId.js.map +1 -0
  42. package/crud/contentModel/validate/pluralApiName.d.ts +7 -0
  43. package/crud/contentModel/validate/pluralApiName.js +24 -0
  44. package/crud/contentModel/validate/pluralApiName.js.map +1 -0
  45. package/crud/contentModel/validate/singularApiName.d.ts +7 -0
  46. package/crud/contentModel/validate/singularApiName.js +24 -0
  47. package/crud/contentModel/validate/singularApiName.js.map +1 -0
  48. package/crud/contentModel/validateModel.d.ts +1 -0
  49. package/crud/contentModel/validateModel.js.map +1 -1
  50. package/crud/contentModel/validateModelFields.d.ts +2 -1
  51. package/crud/contentModel/validateModelFields.js +19 -57
  52. package/crud/contentModel/validateModelFields.js.map +1 -1
  53. package/crud/contentModel/validation.d.ts +136 -62
  54. package/crud/contentModel/validation.js +61 -13
  55. package/crud/contentModel/validation.js.map +1 -1
  56. package/crud/contentModel.crud.js +346 -285
  57. package/crud/contentModel.crud.js.map +1 -1
  58. package/crud/contentModelGroup.crud.js +170 -148
  59. package/crud/contentModelGroup.crud.js.map +1 -1
  60. package/crud/settings.crud.d.ts +1 -1
  61. package/crud/settings.crud.js +5 -10
  62. package/crud/settings.crud.js.map +1 -1
  63. package/crud/system.crud.js +0 -60
  64. package/crud/system.crud.js.map +1 -1
  65. package/graphql/checkEndpointAccess.d.ts +2 -0
  66. package/graphql/checkEndpointAccess.js +18 -0
  67. package/graphql/checkEndpointAccess.js.map +1 -0
  68. package/graphql/createExecutableSchema.d.ts +2 -3
  69. package/graphql/createExecutableSchema.js.map +1 -1
  70. package/graphql/createRequestBody.d.ts +2 -0
  71. package/graphql/createRequestBody.js +14 -0
  72. package/graphql/createRequestBody.js.map +1 -0
  73. package/graphql/formatErrorPayload.d.ts +1 -0
  74. package/graphql/formatErrorPayload.js +25 -0
  75. package/graphql/formatErrorPayload.js.map +1 -0
  76. package/graphql/generateSchema.js.map +1 -1
  77. package/graphql/getSchema.d.ts +17 -0
  78. package/graphql/getSchema.js +102 -0
  79. package/graphql/getSchema.js.map +1 -0
  80. package/graphql/graphQLHandlerFactory.js +6 -145
  81. package/graphql/graphQLHandlerFactory.js.map +1 -1
  82. package/graphql/handleRequest.d.ts +11 -0
  83. package/graphql/handleRequest.js +81 -0
  84. package/graphql/handleRequest.js.map +1 -0
  85. package/graphql/schema/baseContentSchema.js +1 -7
  86. package/graphql/schema/baseContentSchema.js.map +1 -1
  87. package/graphql/schema/baseSchema.js +15 -0
  88. package/graphql/schema/baseSchema.js.map +1 -1
  89. package/graphql/schema/contentEntries.js +90 -53
  90. package/graphql/schema/contentEntries.js.map +1 -1
  91. package/graphql/schema/contentModelGroups.js +7 -7
  92. package/graphql/schema/contentModelGroups.js.map +1 -1
  93. package/graphql/schema/contentModels.js +23 -4
  94. package/graphql/schema/contentModels.js.map +1 -1
  95. package/graphql/schema/createFieldResolvers.d.ts +1 -1
  96. package/graphql/schema/createFieldResolvers.js +6 -12
  97. package/graphql/schema/createFieldResolvers.js.map +1 -1
  98. package/graphql/schema/createFieldTypePluginRecords.d.ts +3 -0
  99. package/graphql/schema/createFieldTypePluginRecords.js +13 -0
  100. package/graphql/schema/createFieldTypePluginRecords.js.map +1 -0
  101. package/graphql/schema/createManageResolvers.d.ts +1 -1
  102. package/graphql/schema/createManageResolvers.js +37 -17
  103. package/graphql/schema/createManageResolvers.js.map +1 -1
  104. package/graphql/schema/createManageSDL.d.ts +1 -0
  105. package/graphql/schema/createManageSDL.js +76 -62
  106. package/graphql/schema/createManageSDL.js.map +1 -1
  107. package/graphql/schema/createPreviewResolvers.js +3 -7
  108. package/graphql/schema/createPreviewResolvers.js.map +1 -1
  109. package/graphql/schema/createReadResolvers.js +4 -8
  110. package/graphql/schema/createReadResolvers.js.map +1 -1
  111. package/graphql/schema/createReadSDL.d.ts +1 -0
  112. package/graphql/schema/createReadSDL.js +40 -35
  113. package/graphql/schema/createReadSDL.js.map +1 -1
  114. package/graphql/schema/resolvers/commonFieldResolvers.d.ts +3 -2
  115. package/graphql/schema/resolvers/commonFieldResolvers.js +2 -1
  116. package/graphql/schema/resolvers/commonFieldResolvers.js.map +1 -1
  117. package/graphql/schema/resolvers/manage/resolveDelete.d.ts +2 -1
  118. package/graphql/schema/resolvers/manage/resolveDelete.js +13 -3
  119. package/graphql/schema/resolvers/manage/resolveDelete.js.map +1 -1
  120. package/graphql/schema/resolvers/manage/resolveDeleteMultiple.d.ts +7 -0
  121. package/graphql/schema/resolvers/manage/resolveDeleteMultiple.js +20 -0
  122. package/graphql/schema/resolvers/manage/resolveDeleteMultiple.js.map +1 -0
  123. package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.d.ts +4 -0
  124. package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.js +18 -0
  125. package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.js.map +1 -0
  126. package/graphql/schema/schemaPlugins.js +7 -16
  127. package/graphql/schema/schemaPlugins.js.map +1 -1
  128. package/graphql/system.js +0 -16
  129. package/graphql/system.js.map +1 -1
  130. package/graphqlFields/dynamicZone/dynamicZoneField.d.ts +1 -1
  131. package/graphqlFields/dynamicZone/dynamicZoneField.js +54 -19
  132. package/graphqlFields/dynamicZone/dynamicZoneField.js.map +1 -1
  133. package/graphqlFields/object.js +21 -2
  134. package/graphqlFields/object.js.map +1 -1
  135. package/graphqlFields/ref.js +42 -14
  136. package/graphqlFields/ref.js.map +1 -1
  137. package/index.d.ts +3 -1
  138. package/index.js +25 -2
  139. package/index.js.map +1 -1
  140. package/package.json +35 -36
  141. package/plugins/CmsModelPlugin.d.ts +21 -3
  142. package/plugins/CmsModelPlugin.js +28 -2
  143. package/plugins/CmsModelPlugin.js.map +1 -1
  144. package/plugins/StorageOperationsCmsModelPlugin.d.ts +23 -0
  145. package/plugins/StorageOperationsCmsModelPlugin.js +42 -0
  146. package/plugins/StorageOperationsCmsModelPlugin.js.map +1 -0
  147. package/plugins/index.d.ts +1 -0
  148. package/plugins/index.js +11 -0
  149. package/plugins/index.js.map +1 -1
  150. package/types.d.ts +200 -97
  151. package/types.js +12 -1
  152. package/types.js.map +1 -1
  153. package/utils/converters/valueKeyStorageConverter.d.ts +1 -5
  154. package/utils/converters/valueKeyStorageConverter.js +26 -20
  155. package/utils/converters/valueKeyStorageConverter.js.map +1 -1
  156. package/utils/createTypeFromFields.d.ts +1 -0
  157. package/utils/createTypeFromFields.js +7 -5
  158. package/utils/createTypeFromFields.js.map +1 -1
  159. package/utils/createTypeName.d.ts +0 -2
  160. package/utils/createTypeName.js +2 -10
  161. package/utils/createTypeName.js.map +1 -1
  162. package/utils/getBaseFieldType.d.ts +1 -3
  163. package/utils/getBaseFieldType.js.map +1 -1
  164. package/utils/getEntryDescription.d.ts +2 -0
  165. package/utils/getEntryDescription.js +17 -0
  166. package/utils/getEntryDescription.js.map +1 -0
  167. package/utils/getEntryImage.d.ts +2 -0
  168. package/utils/getEntryImage.js +17 -0
  169. package/utils/getEntryImage.js.map +1 -0
  170. package/utils/getEntryTitle.d.ts +1 -1
  171. package/utils/getEntryTitle.js.map +1 -1
  172. package/utils/incrementEntryIdVersion.d.ts +5 -0
  173. package/utils/incrementEntryIdVersion.js +29 -0
  174. package/utils/incrementEntryIdVersion.js.map +1 -0
  175. package/utils/ownership.d.ts +3 -3
  176. package/utils/ownership.js.map +1 -1
  177. package/utils/renderFields.d.ts +4 -2
  178. package/utils/renderFields.js +10 -2
  179. package/utils/renderFields.js.map +1 -1
  180. package/utils/renderGetFilterFields.d.ts +2 -2
  181. package/utils/renderGetFilterFields.js +7 -20
  182. package/utils/renderGetFilterFields.js.map +1 -1
  183. package/utils/renderInputFields.d.ts +4 -2
  184. package/utils/renderInputFields.js +17 -5
  185. package/utils/renderInputFields.js.map +1 -1
  186. package/utils/renderListFilterFields.d.ts +2 -1
  187. package/utils/renderListFilterFields.js +9 -20
  188. package/utils/renderListFilterFields.js.map +1 -1
  189. package/utils/renderSortEnum.d.ts +2 -1
  190. package/utils/renderSortEnum.js +2 -1
  191. package/utils/renderSortEnum.js.map +1 -1
  192. package/crud/contentModel/createFieldModels.d.ts +0 -2
  193. package/crud/contentModel/createFieldModels.js +0 -26
  194. package/crud/contentModel/createFieldModels.js.map +0 -1
  195. package/crud/contentModel/fieldIdValidation.d.ts +0 -1
  196. package/crud/contentModel/fieldIdValidation.js +0 -25
  197. package/crud/contentModel/fieldIdValidation.js.map +0 -1
  198. package/crud/contentModel/idValidation.d.ts +0 -1
  199. package/crud/contentModel/idValidation.js +0 -22
  200. package/crud/contentModel/idValidation.js.map +0 -1
  201. package/crud/contentModel/models.d.ts +0 -4
  202. package/crud/contentModel/models.js +0 -192
  203. package/crud/contentModel/models.js.map +0 -1
  204. package/crud/contentModel/systemFields.d.ts +0 -1
  205. package/crud/contentModel/systemFields.js +0 -8
  206. package/crud/contentModel/systemFields.js.map +0 -1
  207. package/upgrades/5.33.0/index.d.ts +0 -3
  208. package/upgrades/5.33.0/index.js +0 -159
  209. package/upgrades/5.33.0/index.js.map +0 -1
  210. package/upgrades/index.d.ts +0 -1
  211. package/upgrades/index.js +0 -9
  212. package/upgrades/index.js.map +0 -1
  213. package/utils/pluralizedTypeName.d.ts +0 -1
  214. package/utils/pluralizedTypeName.js +0 -20
  215. 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: "boolean" | "datetime" | "file" | "long-text" | "number" | "object" | "ref" | "rich-text" | "text" | "dynamicZone" | string;
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@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.
@@ -377,7 +379,7 @@ export interface CmsModelGroup {
377
379
  name: string;
378
380
  }
379
381
  /**
380
- * Cms Model defining an entry.
382
+ * Base CMS Model. Should not be exported and used outside of this package.
381
383
  *
382
384
  * @category Database model
383
385
  * @category CmsModel
@@ -391,6 +393,24 @@ export interface CmsModel {
391
393
  * Unique ID for the content model. Created from name if not defined by user.
392
394
  */
393
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;
394
414
  /**
395
415
  * Model tenant.
396
416
  */
@@ -403,10 +423,14 @@ export interface CmsModel {
403
423
  * Cms Group reference object.
404
424
  */
405
425
  group: CmsModelGroup;
426
+ /**
427
+ * Icon for the content model.
428
+ */
429
+ icon?: string | null;
406
430
  /**
407
431
  * Description for the content model.
408
432
  */
409
- description: string;
433
+ description: string | null;
410
434
  /**
411
435
  * Date created
412
436
  */
@@ -418,7 +442,7 @@ export interface CmsModel {
418
442
  /**
419
443
  * CreatedBy object wrapper. Contains id, name and type of the user.
420
444
  */
421
- createdBy?: CreatedBy;
445
+ createdBy?: CmsIdentity;
422
446
  /**
423
447
  * List of fields defining entry values.
424
448
  */
@@ -447,6 +471,16 @@ export interface CmsModel {
447
471
  * It is picked as first available text field. Or user can select own field.
448
472
  */
449
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;
450
484
  /**
451
485
  * The version of Webiny which this record was stored with.
452
486
  */
@@ -480,6 +514,7 @@ interface CmsModelFieldToGraphQLCreateResolverParams<TField> {
480
514
  graphQLType: string;
481
515
  field: TField;
482
516
  createFieldResolvers: any;
517
+ fieldTypePlugins: CmsFieldTypePlugins;
483
518
  }
484
519
  export interface CmsModelFieldToGraphQLCreateResolver<TField = CmsModelField> {
485
520
  (params: CmsModelFieldToGraphQLCreateResolverParams<TField>): GraphQLFieldResolver | {
@@ -545,24 +580,6 @@ export interface CmsModelFieldToGraphQLPlugin<TField extends CmsModelField = Cms
545
580
  * ```
546
581
  */
547
582
  isSortable: boolean;
548
- /**
549
- * Optional method which creates the storageId.
550
- * Primary use is for the datetime field, but if users has some specific fields, they can customize the storageId to their needs.
551
- *
552
- * ```ts
553
- * createStorageId: ({field}) => {
554
- * if (field.settings.type === "time) {
555
- * return `${field.type}_time@${field.id}`
556
- * }
557
- * // use default method
558
- * return undefined;
559
- * }
560
- * ```
561
- */
562
- createStorageId?: (params: {
563
- model: CmsModel;
564
- field: TField;
565
- }) => string | null | undefined;
566
583
  /**
567
584
  * Read API methods.
568
585
  */
@@ -579,7 +596,6 @@ export interface CmsModelFieldToGraphQLPlugin<TField extends CmsModelField = Cms
579
596
  * ```
580
597
  */
581
598
  createGetFilters?(params: {
582
- model: CmsModel;
583
599
  field: TField;
584
600
  }): string;
585
601
  /**
@@ -599,7 +615,7 @@ export interface CmsModelFieldToGraphQLPlugin<TField extends CmsModelField = Cms
599
615
  * ```
600
616
  */
601
617
  createListFilters?(params: {
602
- model: CmsModel;
618
+ model: Pick<CmsModel, "singularApiName">;
603
619
  field: TField;
604
620
  plugins: CmsFieldTypePlugins;
605
621
  }): string;
@@ -619,6 +635,7 @@ export interface CmsModelFieldToGraphQLPlugin<TField extends CmsModelField = Cms
619
635
  * ```
620
636
  */
621
637
  createTypeField(params: {
638
+ models: CmsModel[];
622
639
  model: CmsModel;
623
640
  field: TField;
624
641
  fieldTypePlugins: CmsFieldTypePlugins;
@@ -679,7 +696,7 @@ export interface CmsModelFieldToGraphQLPlugin<TField extends CmsModelField = Cms
679
696
  * ```
680
697
  */
681
698
  createListFilters?: (params: {
682
- model: CmsModel;
699
+ model: Pick<CmsModel, "singularApiName">;
683
700
  field: TField;
684
701
  plugins: CmsFieldTypePlugins;
685
702
  }) => string;
@@ -719,6 +736,7 @@ export interface CmsModelFieldToGraphQLPlugin<TField extends CmsModelField = Cms
719
736
  * ```
720
737
  */
721
738
  createTypeField: (params: {
739
+ models: CmsModel[];
722
740
  model: CmsModel;
723
741
  field: TField;
724
742
  fieldTypePlugins: CmsFieldTypePlugins;
@@ -739,6 +757,7 @@ export interface CmsModelFieldToGraphQLPlugin<TField extends CmsModelField = Cms
739
757
  * ```
740
758
  */
741
759
  createInputField: (params: {
760
+ models: CmsModel[];
742
761
  model: CmsModel;
743
762
  field: TField;
744
763
  fieldTypePlugins: CmsFieldTypePlugins;
@@ -806,7 +825,7 @@ export interface CmsFieldTypePlugins {
806
825
  *
807
826
  * @category General
808
827
  */
809
- export interface CreatedBy {
828
+ export interface CmsIdentity {
810
829
  /**
811
830
  * ID if the user.
812
831
  */
@@ -856,7 +875,7 @@ export interface CmsSettingsContext {
856
875
  /**
857
876
  * Get the datetime when content model last changed.
858
877
  */
859
- getModelLastChange: () => Promise<Date>;
878
+ getModelLastChange: () => Promise<Date | null>;
860
879
  }
861
880
  export interface OnSystemBeforeInstallTopicParams {
862
881
  tenant: string;
@@ -874,9 +893,7 @@ export interface OnSystemInstallErrorTopicParams {
874
893
  export declare type CmsSystemContext = {
875
894
  getSystemVersion: () => Promise<string | null>;
876
895
  setSystemVersion: (version: string) => Promise<void>;
877
- getReadAPIKey(): Promise<string | null>;
878
896
  installSystem: () => Promise<void>;
879
- upgradeSystem: (version: string) => Promise<boolean>;
880
897
  /**
881
898
  * Lifecycle events - deprecated
882
899
  */
@@ -957,7 +974,7 @@ export interface CmsGroup {
957
974
  /**
958
975
  * CreatedBy reference object.
959
976
  */
960
- createdBy?: CreatedBy;
977
+ createdBy?: CmsIdentity;
961
978
  /**
962
979
  * Date group was created on.
963
980
  */
@@ -1159,6 +1176,14 @@ export interface CmsModelCreateInput {
1159
1176
  * Name of the content model.
1160
1177
  */
1161
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;
1162
1187
  /**
1163
1188
  * Unique ID of the content model. Created from name if not sent by the user. Cannot be changed.
1164
1189
  */
@@ -1191,10 +1216,11 @@ export interface CmsModelCreateInput {
1191
1216
  */
1192
1217
  tags?: string[];
1193
1218
  /**
1194
- * The field that is being displayed as entry title.
1195
- * It is picked as first available text field. Or user can select own field.
1219
+ * Fields fieldId which are picked to represent the CMS entry.
1196
1220
  */
1197
- titleFieldId?: string;
1221
+ titleFieldId?: string | null;
1222
+ descriptionFieldId?: string | null;
1223
+ imageFieldId?: string | null;
1198
1224
  }
1199
1225
  /**
1200
1226
  * A GraphQL `params.data` parameter received when creating content model from existing model.
@@ -1266,7 +1292,7 @@ export interface CmsModelFieldInput {
1266
1292
  /**
1267
1293
  * @see CmsModelField.listValidation
1268
1294
  */
1269
- listValidation: CmsModelFieldValidation[];
1295
+ listValidation?: CmsModelFieldValidation[];
1270
1296
  /**
1271
1297
  * User defined settings.
1272
1298
  */
@@ -1283,6 +1309,14 @@ export interface CmsModelUpdateInput {
1283
1309
  * A new content model name.
1284
1310
  */
1285
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;
1286
1320
  /**
1287
1321
  * A group we want to move the model to.
1288
1322
  */
@@ -1307,10 +1341,11 @@ export interface CmsModelUpdateInput {
1307
1341
  */
1308
1342
  layout: string[][];
1309
1343
  /**
1310
- * The field that is being displayed as entry title.
1311
- * 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.
1312
1345
  */
1313
- titleFieldId?: string;
1346
+ titleFieldId?: string | null;
1347
+ descriptionFieldId?: string | null;
1348
+ imageFieldId?: string | null;
1314
1349
  }
1315
1350
  /**
1316
1351
  * A plugin to load a CmsModelManager.
@@ -1374,11 +1409,15 @@ export interface CmsEntry<T = CmsEntryValues> {
1374
1409
  /**
1375
1410
  * CreatedBy object reference.
1376
1411
  */
1377
- createdBy: CreatedBy;
1412
+ createdBy: CmsIdentity;
1378
1413
  /**
1379
1414
  * OwnedBy object reference. Can be different from CreatedBy.
1380
1415
  */
1381
- ownedBy: CreatedBy;
1416
+ ownedBy: CmsIdentity;
1417
+ /**
1418
+ * ModifiedBy object reference. Last person who modified the entry.
1419
+ */
1420
+ modifiedBy?: CmsIdentity | null;
1382
1421
  /**
1383
1422
  * A string of Date.toISOString() type.
1384
1423
  * Populated on creation.
@@ -1824,12 +1863,12 @@ export interface CmsEntryMeta {
1824
1863
  export interface OnEntryBeforeCreateTopicParams {
1825
1864
  input: CreateCmsEntryInput;
1826
1865
  entry: CmsEntry;
1827
- model: StorageOperationsCmsModel;
1866
+ model: CmsModel;
1828
1867
  }
1829
1868
  export interface OnEntryAfterCreateTopicParams {
1830
1869
  input: CreateCmsEntryInput;
1831
1870
  entry: CmsEntry;
1832
- model: StorageOperationsCmsModel;
1871
+ model: CmsModel;
1833
1872
  storageEntry: CmsEntry;
1834
1873
  }
1835
1874
  export interface OnEntryCreateErrorTopicParams {
@@ -1845,13 +1884,13 @@ export interface OnEntryRevisionBeforeCreateTopicParams {
1845
1884
  input: CreateFromCmsEntryInput;
1846
1885
  entry: CmsEntry;
1847
1886
  original: CmsEntry;
1848
- model: StorageOperationsCmsModel;
1887
+ model: CmsModel;
1849
1888
  }
1850
1889
  export interface OnEntryRevisionAfterCreateTopicParams {
1851
1890
  input: CreateFromCmsEntryInput;
1852
1891
  entry: CmsEntry;
1853
1892
  original: CmsEntry;
1854
- model: StorageOperationsCmsModel;
1893
+ model: CmsModel;
1855
1894
  storageEntry: CmsEntry;
1856
1895
  }
1857
1896
  export interface OnEntryCreateRevisionErrorTopicParams {
@@ -1868,13 +1907,13 @@ export interface OnEntryBeforeUpdateTopicParams {
1868
1907
  input: UpdateCmsEntryInput;
1869
1908
  original: CmsEntry;
1870
1909
  entry: CmsEntry;
1871
- model: StorageOperationsCmsModel;
1910
+ model: CmsModel;
1872
1911
  }
1873
1912
  export interface OnEntryAfterUpdateTopicParams {
1874
1913
  input: UpdateCmsEntryInput;
1875
1914
  original: CmsEntry;
1876
1915
  entry: CmsEntry;
1877
- model: StorageOperationsCmsModel;
1916
+ model: CmsModel;
1878
1917
  storageEntry: CmsEntry;
1879
1918
  }
1880
1919
  export interface OnEntryUpdateErrorTopicParams {
@@ -1888,45 +1927,45 @@ export interface OnEntryUpdateErrorTopicParams {
1888
1927
  */
1889
1928
  export interface OnEntryBeforePublishTopicParams {
1890
1929
  entry: CmsEntry;
1891
- model: StorageOperationsCmsModel;
1930
+ model: CmsModel;
1892
1931
  }
1893
1932
  export interface OnEntryAfterPublishTopicParams {
1894
1933
  entry: CmsEntry;
1895
- model: StorageOperationsCmsModel;
1934
+ model: CmsModel;
1896
1935
  storageEntry: CmsEntry;
1897
1936
  }
1898
1937
  export interface OnEntryPublishErrorTopicParams {
1899
1938
  error: Error;
1900
1939
  entry: CmsEntry;
1901
- model: StorageOperationsCmsModel;
1940
+ model: CmsModel;
1902
1941
  }
1903
1942
  /**
1904
1943
  * Republish
1905
1944
  */
1906
1945
  export interface OnEntryBeforeRepublishTopicParams {
1907
1946
  entry: CmsEntry;
1908
- model: StorageOperationsCmsModel;
1947
+ model: CmsModel;
1909
1948
  }
1910
1949
  export interface OnEntryAfterRepublishTopicParams {
1911
1950
  entry: CmsEntry;
1912
- model: StorageOperationsCmsModel;
1951
+ model: CmsModel;
1913
1952
  storageEntry: CmsEntry;
1914
1953
  }
1915
1954
  export interface OnEntryRepublishErrorTopicParams {
1916
1955
  error: Error;
1917
1956
  entry: CmsEntry;
1918
- model: StorageOperationsCmsModel;
1957
+ model: CmsModel;
1919
1958
  }
1920
1959
  /**
1921
1960
  * Unpublish
1922
1961
  */
1923
1962
  export interface OnEntryBeforeUnpublishTopicParams {
1924
1963
  entry: CmsEntry;
1925
- model: StorageOperationsCmsModel;
1964
+ model: CmsModel;
1926
1965
  }
1927
1966
  export interface OnEntryAfterUnpublishTopicParams {
1928
1967
  entry: CmsEntry;
1929
- model: StorageOperationsCmsModel;
1968
+ model: CmsModel;
1930
1969
  storageEntry: CmsEntry;
1931
1970
  }
1932
1971
  export interface OnEntryUnpublishErrorTopicParams {
@@ -1936,37 +1975,53 @@ export interface OnEntryUnpublishErrorTopicParams {
1936
1975
  }
1937
1976
  export interface OnEntryBeforeDeleteTopicParams {
1938
1977
  entry: CmsEntry;
1939
- model: StorageOperationsCmsModel;
1978
+ model: CmsModel;
1940
1979
  }
1941
1980
  export interface OnEntryAfterDeleteTopicParams {
1942
1981
  entry: CmsEntry;
1943
- model: StorageOperationsCmsModel;
1982
+ model: CmsModel;
1944
1983
  }
1945
1984
  export interface OnEntryDeleteErrorTopicParams {
1946
1985
  error: Error;
1947
1986
  entry: CmsEntry;
1948
- model: StorageOperationsCmsModel;
1987
+ model: CmsModel;
1949
1988
  }
1950
1989
  export interface OnEntryRevisionBeforeDeleteTopicParams {
1951
1990
  entry: CmsEntry;
1952
- model: StorageOperationsCmsModel;
1991
+ model: CmsModel;
1953
1992
  }
1954
1993
  export interface OnEntryRevisionAfterDeleteTopicParams {
1955
1994
  entry: CmsEntry;
1956
- model: StorageOperationsCmsModel;
1995
+ model: CmsModel;
1957
1996
  }
1958
1997
  export interface OnEntryRevisionDeleteErrorTopicParams {
1959
1998
  error: Error;
1960
1999
  entry: CmsEntry;
1961
- model: StorageOperationsCmsModel;
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;
1962
2017
  }
1963
2018
  export interface OnEntryBeforeGetTopicParams {
1964
- model: StorageOperationsCmsModel;
2019
+ model: CmsModel;
1965
2020
  where: CmsEntryListWhere;
1966
2021
  }
1967
2022
  export interface EntryBeforeListTopicParams {
1968
2023
  where: CmsEntryListWhere;
1969
- model: StorageOperationsCmsModel;
2024
+ model: CmsModel;
1970
2025
  }
1971
2026
  /**
1972
2027
  * @category Context
@@ -1990,6 +2045,34 @@ export interface CreateFromCmsEntryInput {
1990
2045
  export interface UpdateCmsEntryInput {
1991
2046
  [key: string]: any;
1992
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
+ }[];
1993
2076
  /**
1994
2077
  * Cms Entry CRUD methods in the context.
1995
2078
  *
@@ -2000,7 +2083,7 @@ export interface CmsEntryContext {
2000
2083
  /**
2001
2084
  * Get a single content entry for a model.
2002
2085
  */
2003
- getEntry: (model: CmsModel, params: CmsEntryGetParams) => Promise<CmsEntry | null>;
2086
+ getEntry: (model: CmsModel, params: CmsEntryGetParams) => Promise<CmsEntry>;
2004
2087
  /**
2005
2088
  * Get a list of entries for a model by a given ID (revision).
2006
2089
  */
@@ -2012,15 +2095,15 @@ export interface CmsEntryContext {
2012
2095
  /**
2013
2096
  * List entries for a model. Internal method used by get, listLatest and listPublished.
2014
2097
  */
2015
- listEntries: (model: CmsModel, params: CmsEntryListParams) => Promise<[CmsEntry[], CmsEntryMeta]>;
2098
+ listEntries: <T = CmsEntryValues>(model: CmsModel, params: CmsEntryListParams) => Promise<[CmsEntry<T>[], CmsEntryMeta]>;
2016
2099
  /**
2017
2100
  * Lists the latest entries. Used for manage API.
2018
2101
  */
2019
- listLatestEntries: (model: CmsModel, params?: CmsEntryListParams) => Promise<[CmsEntry[], CmsEntryMeta]>;
2102
+ listLatestEntries: <T = CmsEntryValues>(model: CmsModel, params?: CmsEntryListParams) => Promise<[CmsEntry<T>[], CmsEntryMeta]>;
2020
2103
  /**
2021
2104
  * List published entries. Used for read API.
2022
2105
  */
2023
- listPublishedEntries: (model: CmsModel, params?: CmsEntryListParams) => Promise<[CmsEntry[], CmsEntryMeta]>;
2106
+ listPublishedEntries: <T = CmsEntryValues>(model: CmsModel, params?: CmsEntryListParams) => Promise<[CmsEntry<T>[], CmsEntryMeta]>;
2024
2107
  /**
2025
2108
  * List published entries by IDs.
2026
2109
  */
@@ -2053,7 +2136,11 @@ export interface CmsEntryContext {
2053
2136
  /**
2054
2137
  * Delete entry with all its revisions.
2055
2138
  */
2056
- 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>;
2057
2144
  /**
2058
2145
  * Publish entry.
2059
2146
  */
@@ -2067,7 +2154,13 @@ export interface CmsEntryContext {
2067
2154
  */
2068
2155
  getEntryRevisions: (model: CmsModel, id: string) => Promise<CmsEntry[]>;
2069
2156
  /**
2070
- * Lifecyle events - deprecated.
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.
2071
2164
  */
2072
2165
  /**
2073
2166
  * @deprecated
@@ -2413,11 +2506,11 @@ export interface CmsEntryStorageOperationsDeleteRevisionParams<T extends CmsStor
2413
2506
  latestStorageEntry: T | null;
2414
2507
  }
2415
2508
  export interface CmsEntryStorageOperationsDeleteParams {
2416
- /**
2417
- * Entry that is going to be deleted.
2418
- */
2419
2509
  entry: CmsEntry;
2420
2510
  }
2511
+ export interface CmsEntryStorageOperationsDeleteEntriesParams {
2512
+ entries: string[];
2513
+ }
2421
2514
  export interface CmsEntryStorageOperationsPublishParams<T extends CmsStorageEntry = CmsStorageEntry> {
2422
2515
  /**
2423
2516
  * The modified entry that is going to be saved as published.
@@ -2439,6 +2532,10 @@ export interface CmsEntryStorageOperationsUnpublishParams<T extends CmsStorageEn
2439
2532
  */
2440
2533
  storageEntry: T;
2441
2534
  }
2535
+ export interface CmsEntryStorageOperationsGetUniqueFieldValuesParams {
2536
+ where: CmsEntryListWhere;
2537
+ fieldId: string;
2538
+ }
2442
2539
  export interface CmsEntryStorageOperationsGetByIdsParams {
2443
2540
  ids: readonly string[];
2444
2541
  }
@@ -2495,71 +2592,81 @@ export interface CmsEntryStorageOperations<T extends CmsStorageEntry = CmsStorag
2495
2592
  /**
2496
2593
  * Get all the entries of the ids.
2497
2594
  */
2498
- getByIds: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetByIdsParams) => Promise<T[]>;
2595
+ getByIds: (model: CmsModel, params: CmsEntryStorageOperationsGetByIdsParams) => Promise<T[]>;
2499
2596
  /**
2500
2597
  * Get all the published entries of the ids.
2501
2598
  */
2502
- getPublishedByIds: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetPublishedByIdsParams) => Promise<T[]>;
2599
+ getPublishedByIds: (model: CmsModel, params: CmsEntryStorageOperationsGetPublishedByIdsParams) => Promise<T[]>;
2503
2600
  /**
2504
2601
  * Get all the latest entries of the ids.
2505
2602
  */
2506
- getLatestByIds: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetLatestByIdsParams) => Promise<T[]>;
2603
+ getLatestByIds: (model: CmsModel, params: CmsEntryStorageOperationsGetLatestByIdsParams) => Promise<T[]>;
2507
2604
  /**
2508
2605
  * Get all revisions of the given entry id.
2509
2606
  */
2510
- getRevisions: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetRevisionsParams) => Promise<T[]>;
2607
+ getRevisions: (model: CmsModel, params: CmsEntryStorageOperationsGetRevisionsParams) => Promise<T[]>;
2511
2608
  /**
2512
2609
  * Get the entry by the given revision id.
2513
2610
  */
2514
- getRevisionById: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetRevisionParams) => Promise<T | null>;
2611
+ getRevisionById: (model: CmsModel, params: CmsEntryStorageOperationsGetRevisionParams) => Promise<T | null>;
2515
2612
  /**
2516
2613
  * Get the published entry by given entryId.
2517
2614
  */
2518
- getPublishedRevisionByEntryId: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetPublishedRevisionParams) => Promise<T | null>;
2615
+ getPublishedRevisionByEntryId: (model: CmsModel, params: CmsEntryStorageOperationsGetPublishedRevisionParams) => Promise<T | null>;
2519
2616
  /**
2520
2617
  * Get the latest entry by given entryId.
2521
2618
  */
2522
- getLatestRevisionByEntryId: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetLatestRevisionParams) => Promise<T | null>;
2619
+ getLatestRevisionByEntryId: (model: CmsModel, params: CmsEntryStorageOperationsGetLatestRevisionParams) => Promise<T | null>;
2523
2620
  /**
2524
2621
  * Get the revision of the entry before given one.
2525
2622
  */
2526
- getPreviousRevision: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetPreviousRevisionParams) => Promise<T | null>;
2623
+ getPreviousRevision: (model: CmsModel, params: CmsEntryStorageOperationsGetPreviousRevisionParams) => Promise<T | null>;
2527
2624
  /**
2528
2625
  * Gets entry by given params.
2529
2626
  */
2530
- get: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetParams) => Promise<T | null>;
2627
+ get: (model: CmsModel, params: CmsEntryStorageOperationsGetParams) => Promise<T | null>;
2531
2628
  /**
2532
2629
  * List all entries. Filterable via params.
2533
2630
  */
2534
- list: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsListParams) => Promise<CmsEntryStorageOperationsListResponse<T>>;
2631
+ list: (model: CmsModel, params: CmsEntryStorageOperationsListParams) => Promise<CmsEntryStorageOperationsListResponse<T>>;
2535
2632
  /**
2536
2633
  * Create a new entry.
2537
2634
  */
2538
- create: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsCreateParams<T>) => Promise<T>;
2635
+ create: (model: CmsModel, params: CmsEntryStorageOperationsCreateParams<T>) => Promise<T>;
2539
2636
  /**
2540
2637
  * Create a new entry from existing one.
2541
2638
  */
2542
- createRevisionFrom: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsCreateRevisionFromParams<T>) => Promise<T>;
2639
+ createRevisionFrom: (model: CmsModel, params: CmsEntryStorageOperationsCreateRevisionFromParams<T>) => Promise<T>;
2543
2640
  /**
2544
2641
  * Update existing entry.
2545
2642
  */
2546
- update: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsUpdateParams<T>) => Promise<T>;
2643
+ update: (model: CmsModel, params: CmsEntryStorageOperationsUpdateParams<T>) => Promise<T>;
2547
2644
  /**
2548
2645
  * Delete the entry revision.
2549
2646
  */
2550
- deleteRevision: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsDeleteRevisionParams<T>) => Promise<void>;
2647
+ deleteRevision: (model: CmsModel, params: CmsEntryStorageOperationsDeleteRevisionParams<T>) => Promise<void>;
2551
2648
  /**
2552
2649
  * Delete the entry.
2553
2650
  */
2554
- delete: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsDeleteParams) => Promise<void>;
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>;
2555
2656
  /**
2556
2657
  * Publish the entry.
2557
2658
  */
2558
- publish: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsPublishParams<T>) => Promise<T>;
2659
+ publish: (model: CmsModel, params: CmsEntryStorageOperationsPublishParams<T>) => Promise<T>;
2559
2660
  /**
2560
2661
  * Unpublish the entry.
2561
2662
  */
2562
- unpublish: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsUnpublishParams<T>) => Promise<T>;
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[]>;
2563
2670
  }
2564
2671
  export declare enum CONTENT_ENTRY_STATUS {
2565
2672
  DRAFT = "draft",
@@ -2631,11 +2738,7 @@ export interface HeadlessCmsStorageOperations<C = CmsContext> {
2631
2738
  /**
2632
2739
  * Either attach something from the storage operations or run something in it.
2633
2740
  */
2634
- beforeInit?: (context: C) => Promise<void>;
2741
+ beforeInit: (context: C) => Promise<void>;
2635
2742
  init?: (context: C) => Promise<void>;
2636
- /**
2637
- * An upgrade to run if necessary.
2638
- */
2639
- upgrade?: UpgradePlugin | null;
2640
2743
  }
2641
2744
  export {};