@webiny/api-headless-cms 0.0.0-unstable.40876133bb → 0.0.0-unstable.60e968001a

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 (146) hide show
  1. package/context.d.ts +5 -2
  2. package/context.js +63 -4
  3. package/context.js.map +1 -1
  4. package/crud/contentEntry/markLockedFields.js +5 -2
  5. package/crud/contentEntry/markLockedFields.js.map +1 -1
  6. package/crud/contentEntry/referenceFieldsMapping.js +9 -5
  7. package/crud/contentEntry/referenceFieldsMapping.js.map +1 -1
  8. package/crud/contentEntry/searchableFields.d.ts +9 -0
  9. package/crud/contentEntry/searchableFields.js +83 -0
  10. package/crud/contentEntry/searchableFields.js.map +1 -0
  11. package/crud/contentEntry.crud.js +65 -40
  12. package/crud/contentEntry.crud.js.map +1 -1
  13. package/crud/contentModel/createFieldStorageId.js +5 -1
  14. package/crud/contentModel/createFieldStorageId.js.map +1 -1
  15. package/crud/contentModel/models.js +12 -0
  16. package/crud/contentModel/models.js.map +1 -1
  17. package/crud/contentModel/validateModelFields.js +46 -37
  18. package/crud/contentModel/validateModelFields.js.map +1 -1
  19. package/crud/contentModel/validation.d.ts +477 -0
  20. package/crud/contentModel/validation.js +109 -0
  21. package/crud/contentModel/validation.js.map +1 -0
  22. package/crud/contentModel.crud.js +227 -175
  23. package/crud/contentModel.crud.js.map +1 -1
  24. package/crud/contentModelGroup/validation.d.ts +30 -0
  25. package/crud/contentModelGroup/validation.js +43 -0
  26. package/crud/contentModelGroup/validation.js.map +1 -0
  27. package/crud/contentModelGroup.crud.js +54 -54
  28. package/crud/contentModelGroup.crud.js.map +1 -1
  29. package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.d.ts +11 -0
  30. package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js +239 -0
  31. package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js.map +1 -0
  32. package/fieldConverters/index.d.ts +2 -1
  33. package/fieldConverters/index.js +3 -1
  34. package/fieldConverters/index.js.map +1 -1
  35. package/graphql/buildSchemaPlugins.d.ts +2 -2
  36. package/graphql/buildSchemaPlugins.js.map +1 -1
  37. package/graphql/graphQLHandlerFactory.js +58 -28
  38. package/graphql/graphQLHandlerFactory.js.map +1 -1
  39. package/graphql/index.d.ts +2 -2
  40. package/graphql/index.js +49 -38
  41. package/graphql/index.js.map +1 -1
  42. package/graphql/schema/baseContentSchema.d.ts +2 -2
  43. package/graphql/schema/baseContentSchema.js +3 -3
  44. package/graphql/schema/baseContentSchema.js.map +1 -1
  45. package/graphql/schema/contentEntries.d.ts +2 -2
  46. package/graphql/schema/contentEntries.js +5 -5
  47. package/graphql/schema/contentEntries.js.map +1 -1
  48. package/graphql/schema/contentModelGroups.d.ts +2 -2
  49. package/graphql/schema/contentModelGroups.js +3 -3
  50. package/graphql/schema/contentModelGroups.js.map +1 -1
  51. package/graphql/schema/contentModels.d.ts +2 -2
  52. package/graphql/schema/contentModels.js +26 -7
  53. package/graphql/schema/contentModels.js.map +1 -1
  54. package/graphql/schema/createFieldResolvers.d.ts +1 -1
  55. package/graphql/schema/createFieldResolvers.js +23 -7
  56. package/graphql/schema/createFieldResolvers.js.map +1 -1
  57. package/graphql/schema/createManageSDL.d.ts +2 -0
  58. package/graphql/schema/createManageSDL.js +9 -6
  59. package/graphql/schema/createManageSDL.js.map +1 -1
  60. package/graphql/schema/createReadResolvers.js +5 -0
  61. package/graphql/schema/createReadResolvers.js.map +1 -1
  62. package/graphql/schema/createReadSDL.d.ts +2 -0
  63. package/graphql/schema/createReadSDL.js +11 -5
  64. package/graphql/schema/createReadSDL.js.map +1 -1
  65. package/graphql/schema/schemaPlugins.d.ts +2 -2
  66. package/graphql/schema/schemaPlugins.js +11 -8
  67. package/graphql/schema/schemaPlugins.js.map +1 -1
  68. package/graphql/system.js +79 -82
  69. package/graphql/system.js.map +1 -1
  70. package/graphqlFields/dynamicZone/dynamicZoneField.d.ts +2 -0
  71. package/graphqlFields/dynamicZone/dynamicZoneField.js +234 -0
  72. package/graphqlFields/dynamicZone/dynamicZoneField.js.map +1 -0
  73. package/graphqlFields/dynamicZone/dynamicZoneStorage.d.ts +3 -0
  74. package/graphqlFields/dynamicZone/dynamicZoneStorage.js +79 -0
  75. package/graphqlFields/dynamicZone/dynamicZoneStorage.js.map +1 -0
  76. package/graphqlFields/dynamicZone/index.d.ts +2 -0
  77. package/graphqlFields/dynamicZone/index.js +21 -0
  78. package/graphqlFields/dynamicZone/index.js.map +1 -0
  79. package/graphqlFields/index.d.ts +1 -1
  80. package/graphqlFields/index.js +3 -1
  81. package/graphqlFields/index.js.map +1 -1
  82. package/graphqlFields/number.js +4 -0
  83. package/graphqlFields/number.js.map +1 -1
  84. package/graphqlFields/object.js +122 -72
  85. package/graphqlFields/object.js.map +1 -1
  86. package/graphqlFields/ref.js +34 -48
  87. package/graphqlFields/ref.js.map +1 -1
  88. package/index.d.ts +3 -3
  89. package/index.js +4 -8
  90. package/index.js.map +1 -1
  91. package/package.json +26 -26
  92. package/plugins/CmsGraphQLSchemaPlugin.d.ts +5 -0
  93. package/plugins/CmsGraphQLSchemaPlugin.js +17 -0
  94. package/plugins/CmsGraphQLSchemaPlugin.js.map +1 -0
  95. package/plugins/CmsGraphQLSchemaSorterPlugin.d.ts +20 -0
  96. package/plugins/CmsGraphQLSchemaSorterPlugin.js +38 -0
  97. package/plugins/CmsGraphQLSchemaSorterPlugin.js.map +1 -0
  98. package/plugins/CmsModelFieldConverterPlugin.d.ts +2 -2
  99. package/plugins/CmsModelFieldConverterPlugin.js.map +1 -1
  100. package/plugins/StorageTransformPlugin.d.ts +11 -11
  101. package/plugins/StorageTransformPlugin.js.map +1 -1
  102. package/plugins/index.d.ts +2 -0
  103. package/plugins/index.js +26 -0
  104. package/plugins/index.js.map +1 -1
  105. package/storage/object.js +5 -2
  106. package/storage/object.js.map +1 -1
  107. package/types.d.ts +203 -55
  108. package/types.js +55 -7
  109. package/types.js.map +1 -1
  110. package/utils/converters/ConverterCollection.js +6 -2
  111. package/utils/converters/ConverterCollection.js.map +1 -1
  112. package/utils/createTypeFromFields.d.ts +15 -0
  113. package/utils/createTypeFromFields.js +75 -0
  114. package/utils/createTypeFromFields.js.map +1 -0
  115. package/utils/createTypeName.js +3 -1
  116. package/utils/createTypeName.js.map +1 -1
  117. package/utils/entryStorage.js +15 -12
  118. package/utils/entryStorage.js.map +1 -1
  119. package/utils/getBaseFieldType.d.ts +4 -0
  120. package/utils/getBaseFieldType.js +12 -0
  121. package/utils/getBaseFieldType.js.map +1 -0
  122. package/utils/renderFields.js +3 -1
  123. package/utils/renderFields.js.map +1 -1
  124. package/utils/renderGetFilterFields.js +8 -3
  125. package/utils/renderGetFilterFields.js.map +1 -1
  126. package/utils/renderInputFields.js +3 -1
  127. package/utils/renderInputFields.js.map +1 -1
  128. package/utils/renderListFilterFields.js +5 -2
  129. package/utils/renderListFilterFields.js.map +1 -1
  130. package/utils/renderSortEnum.d.ts +7 -4
  131. package/utils/renderSortEnum.js +23 -4
  132. package/utils/renderSortEnum.js.map +1 -1
  133. package/validators/dynamicZone.d.ts +2 -0
  134. package/validators/dynamicZone.js +24 -0
  135. package/validators/dynamicZone.js.map +1 -0
  136. package/validators/index.js +3 -1
  137. package/validators/index.js.map +1 -1
  138. package/crud/index.d.ts +0 -6
  139. package/crud/index.js +0 -85
  140. package/crud/index.js.map +0 -1
  141. package/graphql/schema/resolvers/manage/resolveRequestChanges.d.ts +0 -7
  142. package/graphql/schema/resolvers/manage/resolveRequestChanges.js +0 -21
  143. package/graphql/schema/resolvers/manage/resolveRequestChanges.js.map +0 -1
  144. package/graphql/schema/resolvers/manage/resolveRequestReview.d.ts +0 -7
  145. package/graphql/schema/resolvers/manage/resolveRequestReview.js +0 -21
  146. package/graphql/schema/resolvers/manage/resolveRequestReview.js.map +0 -1
package/types.d.ts CHANGED
@@ -135,7 +135,7 @@ export interface CmsModelField {
135
135
  * A type of the field.
136
136
  * We are defining our built-in fields, so people know which are available by the default.
137
137
  */
138
- type: "boolean" | "datetime" | "file" | "long-text" | "number" | "object" | "ref" | "rich-text" | "text" | string;
138
+ type: "boolean" | "datetime" | "file" | "long-text" | "number" | "object" | "ref" | "rich-text" | "text" | "dynamicZone" | string;
139
139
  /**
140
140
  * A unique storage ID for storing actual values.
141
141
  * Must in form of a-zA-Z0-9@a-zA-Z0-9@a-zA-Z0-9.
@@ -195,6 +195,10 @@ export interface CmsModelField {
195
195
  *
196
196
  */
197
197
  multipleValues?: boolean;
198
+ /**
199
+ * Fields can be tagged to give them contextual meaning.
200
+ */
201
+ tags?: string[];
198
202
  /**
199
203
  * Any user defined settings.
200
204
  *
@@ -202,18 +206,42 @@ export interface CmsModelField {
202
206
  */
203
207
  settings?: CmsModelFieldSettings;
204
208
  }
209
+ export interface CmsDynamicZoneTemplate {
210
+ id: string;
211
+ name: string;
212
+ gqlTypeName: string;
213
+ description: string;
214
+ icon: string;
215
+ fields: CmsModelField[];
216
+ layout: string[][];
217
+ validation: CmsModelFieldValidation[];
218
+ }
219
+ /**
220
+ * A definition for dynamic-zone field to show possible type of the field in settings.
221
+ */
222
+ export interface CmsModelDynamicZoneField extends CmsModelField {
223
+ /**
224
+ * Settings object for the field. Contains `templates` property.
225
+ */
226
+ settings: {
227
+ templates: CmsDynamicZoneTemplate[];
228
+ };
229
+ }
205
230
  /**
206
231
  * Used for our internal functionality.
207
232
  */
208
233
  export interface CmsModelFieldWithParent extends CmsModelField {
209
234
  parent?: CmsModelFieldWithParent | null;
210
235
  }
236
+ export interface CmsModelDynamicZoneFieldWithParent extends CmsModelDynamicZoneField {
237
+ parent?: CmsModelDynamicZoneFieldWithParent | null;
238
+ }
211
239
  /**
212
240
  * A definition for dateTime field to show possible type of the field in settings.
213
241
  */
214
242
  export interface CmsModelDateTimeField extends CmsModelField {
215
243
  /**
216
- * Settings object for the field. Contains type property.
244
+ * Settings object for the field. Contains `type` property.
217
245
  */
218
246
  settings: {
219
247
  type: "time" | "date" | "dateTimeWithoutTimezone" | "dateTimeWithTimezone";
@@ -334,6 +362,20 @@ export interface LockedField {
334
362
  type: string;
335
363
  [key: string]: any;
336
364
  }
365
+ /**
366
+ * @category Database model
367
+ * @category CmsModel
368
+ */
369
+ export interface CmsModelGroup {
370
+ /**
371
+ * Generated ID of the group
372
+ */
373
+ id: string;
374
+ /**
375
+ * Name of the group
376
+ */
377
+ name: string;
378
+ }
337
379
  /**
338
380
  * Cms Model defining an entry.
339
381
  *
@@ -360,16 +402,7 @@ export interface CmsModel {
360
402
  /**
361
403
  * Cms Group reference object.
362
404
  */
363
- group: {
364
- /**
365
- * Generated ID of the group
366
- */
367
- id: string;
368
- /**
369
- * Name of the group
370
- */
371
- name: string;
372
- };
405
+ group: CmsModelGroup;
373
406
  /**
374
407
  * Description for the content model.
375
408
  */
@@ -401,6 +434,10 @@ export interface CmsModel {
401
434
  * ```
402
435
  */
403
436
  layout: string[][];
437
+ /**
438
+ * Models can be tagged to give them contextual meaning.
439
+ */
440
+ tags?: string[];
404
441
  /**
405
442
  * List of locked fields. Updated when entry is saved and a field has been used.
406
443
  */
@@ -437,25 +474,40 @@ export interface CmsModelFieldDefinition {
437
474
  fields: string;
438
475
  typeDefs?: string;
439
476
  }
440
- interface CmsModelFieldToGraphQLCreateResolverParams {
477
+ interface CmsModelFieldToGraphQLCreateResolverParams<TField> {
441
478
  models: CmsModel[];
442
479
  model: CmsModel;
443
480
  graphQLType: string;
444
- field: CmsModelField;
481
+ field: TField;
445
482
  createFieldResolvers: any;
446
483
  }
447
- export interface CmsModelFieldToGraphQLCreateResolver {
448
- (params: CmsModelFieldToGraphQLCreateResolverParams): GraphQLFieldResolver | {
484
+ export interface CmsModelFieldToGraphQLCreateResolver<TField = CmsModelField> {
485
+ (params: CmsModelFieldToGraphQLCreateResolverParams<TField>): GraphQLFieldResolver | {
449
486
  resolver: GraphQLFieldResolver | null;
450
487
  typeResolvers: Resolvers<CmsContext>;
451
488
  } | false;
452
489
  }
490
+ export interface CmsModelFieldToGraphQLPluginValidateChildFieldsValidateParams<TField extends CmsModelField = CmsModelField> {
491
+ fields: TField[];
492
+ originalFields: TField[];
493
+ }
494
+ export interface CmsModelFieldToGraphQLPluginValidateChildFieldsValidate {
495
+ (params: CmsModelFieldToGraphQLPluginValidateChildFieldsValidateParams): void;
496
+ }
497
+ export interface CmsModelFieldToGraphQLPluginValidateChildFieldsParams<TField extends CmsModelField = CmsModelField> {
498
+ field: TField;
499
+ originalField?: TField;
500
+ validate: CmsModelFieldToGraphQLPluginValidateChildFieldsValidate;
501
+ }
502
+ export interface CmsModelFieldToGraphQLPluginValidateChildFields<TField extends CmsModelField = CmsModelField> {
503
+ (params: CmsModelFieldToGraphQLPluginValidateChildFieldsParams<TField>): void;
504
+ }
453
505
  /**
454
506
  * @category Plugin
455
507
  * @category ModelField
456
508
  * @category GraphQL
457
509
  */
458
- export interface CmsModelFieldToGraphQLPlugin extends Plugin {
510
+ export interface CmsModelFieldToGraphQLPlugin<TField extends CmsModelField = CmsModelField> extends Plugin {
459
511
  /**
460
512
  * A plugin type
461
513
  */
@@ -509,7 +561,7 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
509
561
  */
510
562
  createStorageId?: (params: {
511
563
  model: CmsModel;
512
- field: CmsModelField;
564
+ field: TField;
513
565
  }) => string | null | undefined;
514
566
  /**
515
567
  * Read API methods.
@@ -528,7 +580,7 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
528
580
  */
529
581
  createGetFilters?(params: {
530
582
  model: CmsModel;
531
- field: CmsModelField;
583
+ field: TField;
532
584
  }): string;
533
585
  /**
534
586
  * Definition for list filtering for GraphQL.
@@ -548,7 +600,8 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
548
600
  */
549
601
  createListFilters?(params: {
550
602
  model: CmsModel;
551
- field: CmsModelField;
603
+ field: TField;
604
+ plugins: CmsFieldTypePlugins;
552
605
  }): string;
553
606
  /**
554
607
  * Definition of the field type for GraphQL - be aware if multiple values is selected.
@@ -567,12 +620,12 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
567
620
  */
568
621
  createTypeField(params: {
569
622
  model: CmsModel;
570
- field: CmsModelField;
623
+ field: TField;
571
624
  fieldTypePlugins: CmsFieldTypePlugins;
572
625
  }): CmsModelFieldDefinition | string | null;
573
626
  /**
574
627
  * Definition for field resolver.
575
- * By default it is simple return of the `instance.values[storageId]` but if required, users can define their own.
628
+ * By default, it is simple return of the `instance.values[storageId]` but if required, users can define their own.
576
629
  *
577
630
  * ```ts
578
631
  * read: {
@@ -584,7 +637,7 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
584
637
  * }
585
638
  * ```
586
639
  */
587
- createResolver?: CmsModelFieldToGraphQLCreateResolver;
640
+ createResolver?: CmsModelFieldToGraphQLCreateResolver<TField>;
588
641
  /**
589
642
  * Read API schema definitions for the field and resolvers for them.
590
643
  *
@@ -627,7 +680,8 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
627
680
  */
628
681
  createListFilters?: (params: {
629
682
  model: CmsModel;
630
- field: CmsModelField;
683
+ field: TField;
684
+ plugins: CmsFieldTypePlugins;
631
685
  }) => string;
632
686
  /**
633
687
  * Manage API schema definitions for the field and resolvers for them. Probably similar to `read.createSchema`.
@@ -666,7 +720,7 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
666
720
  */
667
721
  createTypeField: (params: {
668
722
  model: CmsModel;
669
- field: CmsModelField;
723
+ field: TField;
670
724
  fieldTypePlugins: CmsFieldTypePlugins;
671
725
  }) => CmsModelFieldDefinition | string | null;
672
726
  /**
@@ -686,12 +740,12 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
686
740
  */
687
741
  createInputField: (params: {
688
742
  model: CmsModel;
689
- field: CmsModelField;
743
+ field: TField;
690
744
  fieldTypePlugins: CmsFieldTypePlugins;
691
745
  }) => CmsModelFieldDefinition | string | null;
692
746
  /**
693
747
  * Definition for field resolver.
694
- * By default it is simple return of the `instance.values[storageId]` but if required, users can define their own.
748
+ * By default, it is simple return of the `instance.values[storageId]` but if required, users can define their own.
695
749
  *
696
750
  * ```ts
697
751
  * manage: {
@@ -703,8 +757,13 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
703
757
  * }
704
758
  * ```
705
759
  */
706
- createResolver?: CmsModelFieldToGraphQLCreateResolver;
760
+ createResolver?: CmsModelFieldToGraphQLCreateResolver<TField>;
707
761
  };
762
+ /**
763
+ *
764
+ * @param field
765
+ */
766
+ validateChildFields?: CmsModelFieldToGraphQLPluginValidateChildFields<TField>;
708
767
  }
709
768
  /**
710
769
  * Check for content model locked field.
@@ -743,7 +802,7 @@ export interface CmsFieldTypePlugins {
743
802
  [key: string]: CmsModelFieldToGraphQLPlugin;
744
803
  }
745
804
  /**
746
- * A interface describing the reference to a user that created some data in the database.
805
+ * An interface describing the reference to a user that created some data in the database.
747
806
  *
748
807
  * @category General
749
808
  */
@@ -837,7 +896,7 @@ export declare type CmsSystemContext = {
837
896
  onSystemInstallError: Topic<OnSystemInstallErrorTopicParams>;
838
897
  };
839
898
  /**
840
- * A GraphQL params.data parameter received when creating content model group.
899
+ * A GraphQL `params.data` parameter received when creating content model group.
841
900
  *
842
901
  * @category CmsGroup
843
902
  * @category GraphQL params
@@ -849,7 +908,7 @@ export interface CmsGroupCreateInput {
849
908
  icon: string;
850
909
  }
851
910
  /**
852
- * A GraphQL params.data parameter received when updating content model group.
911
+ * A GraphQL `params.data` parameter received when updating content model group.
853
912
  *
854
913
  * @category CmsGroup
855
914
  * @category GraphQL params
@@ -919,7 +978,7 @@ export interface CmsGroup {
919
978
  isPrivate?: boolean;
920
979
  }
921
980
  /**
922
- * A data.where parameter received when listing content model groups.
981
+ * A `data.where` parameter received when listing content model groups.
923
982
  *
924
983
  * @category CmsGroup
925
984
  * @category GraphQL params
@@ -945,6 +1004,15 @@ export interface OnGroupBeforeCreateTopicParams {
945
1004
  export interface OnGroupAfterCreateTopicParams {
946
1005
  group: CmsGroup;
947
1006
  }
1007
+ /**
1008
+ * @category CmsGroup
1009
+ * @category Topic
1010
+ */
1011
+ export interface OnGroupCreateErrorTopicParams {
1012
+ input: CmsGroupCreateInput;
1013
+ group: CmsGroup;
1014
+ error: Error;
1015
+ }
948
1016
  /**
949
1017
  * @category CmsGroup
950
1018
  * @category Topic
@@ -961,6 +1029,16 @@ export interface OnGroupAfterUpdateTopicParams {
961
1029
  original: CmsGroup;
962
1030
  group: CmsGroup;
963
1031
  }
1032
+ /**
1033
+ * @category CmsGroup
1034
+ * @category Topic
1035
+ */
1036
+ export interface OnGroupUpdateErrorTopicParams {
1037
+ input: CmsGroupUpdateInput;
1038
+ original: CmsGroup;
1039
+ group: CmsGroup;
1040
+ error: Error;
1041
+ }
964
1042
  /**
965
1043
  * @category CmsGroup
966
1044
  * @category Topic
@@ -975,6 +1053,14 @@ export interface OnGroupBeforeDeleteTopicParams {
975
1053
  export interface OnGroupAfterDeleteTopicParams {
976
1054
  group: CmsGroup;
977
1055
  }
1056
+ /**
1057
+ * @category CmsGroup
1058
+ * @category Topic
1059
+ */
1060
+ export interface OnGroupDeleteErrorTopicParams {
1061
+ group: CmsGroup;
1062
+ error: Error;
1063
+ }
978
1064
  /**
979
1065
  * Cms Group in context.
980
1066
  *
@@ -1038,10 +1124,13 @@ export interface CmsGroupContext {
1038
1124
  */
1039
1125
  onGroupBeforeCreate: Topic<OnGroupBeforeCreateTopicParams>;
1040
1126
  onGroupAfterCreate: Topic<OnGroupAfterCreateTopicParams>;
1127
+ onGroupCreateError: Topic<OnGroupCreateErrorTopicParams>;
1041
1128
  onGroupBeforeUpdate: Topic<OnGroupBeforeUpdateTopicParams>;
1042
1129
  onGroupAfterUpdate: Topic<OnGroupAfterUpdateTopicParams>;
1130
+ onGroupUpdateError: Topic<OnGroupUpdateErrorTopicParams>;
1043
1131
  onGroupBeforeDelete: Topic<OnGroupBeforeDeleteTopicParams>;
1044
1132
  onGroupAfterDelete: Topic<OnGroupAfterDeleteTopicParams>;
1133
+ onGroupDeleteError: Topic<OnGroupDeleteErrorTopicParams>;
1045
1134
  }
1046
1135
  /**
1047
1136
  * Definition for content model field validator.
@@ -1060,7 +1149,7 @@ export interface CmsModelFieldValidation {
1060
1149
  };
1061
1150
  }
1062
1151
  /**
1063
- * A GraphQL params.data parameter received when creating content model.
1152
+ * A GraphQL `params.data` parameter received when creating content model.
1064
1153
  *
1065
1154
  * @category GraphQL params
1066
1155
  * @category CmsModel
@@ -1097,6 +1186,10 @@ export interface CmsModelCreateInput {
1097
1186
  * ```
1098
1187
  */
1099
1188
  layout?: string[][];
1189
+ /**
1190
+ * Models can be tagged to give them contextual meaning.
1191
+ */
1192
+ tags?: string[];
1100
1193
  /**
1101
1194
  * The field that is being displayed as entry title.
1102
1195
  * It is picked as first available text field. Or user can select own field.
@@ -1104,7 +1197,7 @@ export interface CmsModelCreateInput {
1104
1197
  titleFieldId?: string;
1105
1198
  }
1106
1199
  /**
1107
- * A GraphQL params.data parameter received when creating content model from existing model.
1200
+ * A GraphQL `params.data` parameter received when creating content model from existing model.
1108
1201
  *
1109
1202
  * @category GraphQL params
1110
1203
  * @category CmsModel
@@ -1145,11 +1238,15 @@ export interface CmsModelFieldInput {
1145
1238
  /**
1146
1239
  * Text to display below the field to help user what to write in the field.
1147
1240
  */
1148
- helpText?: string;
1241
+ helpText?: string | null;
1149
1242
  /**
1150
1243
  * Text to display in the field.
1151
1244
  */
1152
- placeholderText?: string;
1245
+ placeholderText?: string | null;
1246
+ /**
1247
+ * Fields can be tagged to give them contextual meaning.
1248
+ */
1249
+ tags?: string[];
1153
1250
  /**
1154
1251
  * Are multiple values allowed?
1155
1252
  */
@@ -1176,7 +1273,7 @@ export interface CmsModelFieldInput {
1176
1273
  settings?: Record<string, any>;
1177
1274
  }
1178
1275
  /**
1179
- * A GraphQL params.data parameter received when updating content model.
1276
+ * A GraphQL `params.data` parameter received when updating content model.
1180
1277
  *
1181
1278
  * @category GraphQL params
1182
1279
  * @category CmsModel
@@ -1258,7 +1355,7 @@ export interface CmsEntryValues {
1258
1355
  export interface CmsEntry<T = CmsEntryValues> {
1259
1356
  /**
1260
1357
  * 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.
1358
+ * This can be used when upgrading the system, so we know which entries to update.
1262
1359
  */
1263
1360
  webinyVersion: string;
1264
1361
  /**
@@ -1328,10 +1425,10 @@ export interface CmsEntry<T = CmsEntryValues> {
1328
1425
  /**
1329
1426
  * Settings for the given entry.
1330
1427
  *
1331
- * Introduced with Advanced Publishing Workflow - will be always inserted after this PR is merged.
1332
- * Be aware that when accessing properties in it on old systems - it will break if not checked first.
1428
+ * Introduced with Advanced Publishing Workflow. Will always be inserted once this PR is merged.
1429
+ * Be aware that when accessing properties in it on old systems, it will break if not checked first.
1333
1430
  *
1334
- * Available only on the Manage API in entry GraphQL type meta.data property.
1431
+ * Available only on the Manage API in entry GraphQL type `meta.data` property.
1335
1432
  */
1336
1433
  meta?: {
1337
1434
  [key: string]: any;
@@ -1364,7 +1461,7 @@ export interface CmsModelManager {
1364
1461
  */
1365
1462
  getPublishedByIds: (ids: string[]) => Promise<CmsEntry[]>;
1366
1463
  /**
1367
- * Get a list of latest entries by the ID list.
1464
+ * Get a list of the latest entries by the ID list.
1368
1465
  */
1369
1466
  getLatestByIds: (ids: string[]) => Promise<CmsEntry[]>;
1370
1467
  /**
@@ -1372,18 +1469,21 @@ export interface CmsModelManager {
1372
1469
  */
1373
1470
  get: (id: string) => Promise<CmsEntry>;
1374
1471
  /**
1375
- * Create a entry.
1472
+ * Create an entry.
1376
1473
  */
1377
1474
  create: (data: CreateCmsEntryInput) => Promise<CmsEntry>;
1378
1475
  /**
1379
- * Update a entry.
1476
+ * Update an entry.
1380
1477
  */
1381
1478
  update: (id: string, data: UpdateCmsEntryInput) => Promise<CmsEntry>;
1382
1479
  /**
1383
- * Delete a entry.
1480
+ * Delete an entry.
1384
1481
  */
1385
1482
  delete: (id: string) => Promise<void>;
1386
1483
  }
1484
+ /**
1485
+ * Create
1486
+ */
1387
1487
  export interface OnModelBeforeCreateTopicParams {
1388
1488
  input: CmsModelCreateInput;
1389
1489
  model: CmsModel;
@@ -1392,6 +1492,14 @@ export interface OnModelAfterCreateTopicParams {
1392
1492
  input: CmsModelCreateInput;
1393
1493
  model: CmsModel;
1394
1494
  }
1495
+ export interface OnModelCreateErrorTopicParams {
1496
+ input: CmsModelCreateInput;
1497
+ model: CmsModel;
1498
+ error: Error;
1499
+ }
1500
+ /**
1501
+ * Create From / Clone
1502
+ */
1395
1503
  export interface OnModelBeforeCreateFromTopicParams {
1396
1504
  input: CmsModelCreateInput;
1397
1505
  original: CmsModel;
@@ -1402,6 +1510,15 @@ export interface OnModelAfterCreateFromTopicParams {
1402
1510
  original: CmsModel;
1403
1511
  model: CmsModel;
1404
1512
  }
1513
+ export interface OnModelCreateFromErrorParams {
1514
+ input: CmsModelCreateInput;
1515
+ original: CmsModel;
1516
+ model: CmsModel;
1517
+ error: Error;
1518
+ }
1519
+ /**
1520
+ * Update
1521
+ */
1405
1522
  export interface OnModelBeforeUpdateTopicParams {
1406
1523
  input: CmsModelUpdateInput;
1407
1524
  original: CmsModel;
@@ -1412,15 +1529,35 @@ export interface OnModelAfterUpdateTopicParams {
1412
1529
  original: CmsModel;
1413
1530
  model: CmsModel;
1414
1531
  }
1532
+ export interface OnModelUpdateErrorTopicParams {
1533
+ input: CmsModelUpdateInput;
1534
+ original: CmsModel;
1535
+ model: CmsModel;
1536
+ error: Error;
1537
+ }
1538
+ /**
1539
+ * Delete
1540
+ */
1415
1541
  export interface OnModelBeforeDeleteTopicParams {
1416
1542
  model: CmsModel;
1417
1543
  }
1418
1544
  export interface OnModelAfterDeleteTopicParams {
1419
1545
  model: CmsModel;
1420
1546
  }
1547
+ export interface OnModelDeleteErrorTopicParams {
1548
+ model: CmsModel;
1549
+ error: Error;
1550
+ }
1551
+ /**
1552
+ * Initialize
1553
+ */
1421
1554
  export interface OnModelInitializeParams {
1422
1555
  model: CmsModel;
1556
+ data: Record<string, any>;
1423
1557
  }
1558
+ /**
1559
+ *
1560
+ */
1424
1561
  export interface CmsModelUpdateDirectParams {
1425
1562
  model: CmsModel;
1426
1563
  original: CmsModel;
@@ -1467,9 +1604,9 @@ export interface CmsModelContext {
1467
1604
  *
1468
1605
  * Primary idea behind this is creating the index, for the code models, in the ES.
1469
1606
  */
1470
- initializeModel: (modelId: string) => Promise<boolean>;
1607
+ initializeModel: (modelId: string, data: Record<string, any>) => Promise<boolean>;
1471
1608
  /**
1472
- * Get a instance of CmsModelManager for given content modelId.
1609
+ * Get an instance of CmsModelManager for given content modelId.
1473
1610
  *
1474
1611
  * @see CmsModelManager
1475
1612
  *
@@ -1528,12 +1665,16 @@ export interface CmsModelContext {
1528
1665
  */
1529
1666
  onModelBeforeCreate: Topic<OnModelBeforeCreateTopicParams>;
1530
1667
  onModelAfterCreate: Topic<OnModelAfterCreateTopicParams>;
1668
+ onModelCreateError: Topic<OnModelCreateErrorTopicParams>;
1531
1669
  onModelBeforeCreateFrom: Topic<OnModelBeforeCreateFromTopicParams>;
1532
1670
  onModelAfterCreateFrom: Topic<OnModelAfterCreateFromTopicParams>;
1671
+ onModelCreateFromError: Topic<OnModelCreateFromErrorParams>;
1533
1672
  onModelBeforeUpdate: Topic<OnModelBeforeUpdateTopicParams>;
1534
1673
  onModelAfterUpdate: Topic<OnModelAfterUpdateTopicParams>;
1674
+ onModelUpdateError: Topic<OnModelUpdateErrorTopicParams>;
1535
1675
  onModelBeforeDelete: Topic<OnModelBeforeDeleteTopicParams>;
1536
1676
  onModelAfterDelete: Topic<OnModelAfterDeleteTopicParams>;
1677
+ onModelDeleteError: Topic<OnModelDeleteErrorTopicParams>;
1537
1678
  onModelInitialize: Topic<OnModelInitializeParams>;
1538
1679
  }
1539
1680
  /**
@@ -1619,7 +1760,12 @@ export interface CmsEntryListWhere {
1619
1760
  /**
1620
1761
  * This is to allow querying by any content model field defined by the user.
1621
1762
  */
1622
- [key: string]: any | CmsEntryListWhereRef;
1763
+ [key: string]: string | number | boolean | undefined | string[] | number[] | null | CmsEntryListWhere[] | CmsEntryListWhere | CmsEntryListWhereRef;
1764
+ /**
1765
+ * To allow querying via nested queries, we added the AND / OR properties.
1766
+ */
1767
+ AND?: CmsEntryListWhere[];
1768
+ OR?: CmsEntryListWhere[];
1623
1769
  }
1624
1770
  /**
1625
1771
  * Entry listing sort.
@@ -1705,6 +1851,7 @@ export interface OnEntryRevisionAfterCreateTopicParams {
1705
1851
  export interface OnEntryCreateRevisionErrorTopicParams {
1706
1852
  error: Error;
1707
1853
  input: CreateFromCmsEntryInput;
1854
+ original: CmsEntry;
1708
1855
  entry: CmsEntry;
1709
1856
  model: CmsModel;
1710
1857
  }
@@ -1834,7 +1981,7 @@ export interface CmsEntryContext {
1834
1981
  */
1835
1982
  listEntries: (model: CmsModel, params: CmsEntryListParams) => Promise<[CmsEntry[], CmsEntryMeta]>;
1836
1983
  /**
1837
- * Lists latest entries. Used for manage API.
1984
+ * Lists the latest entries. Used for manage API.
1838
1985
  */
1839
1986
  listLatestEntries: (model: CmsModel, params?: CmsEntryListParams) => Promise<[CmsEntry[], CmsEntryMeta]>;
1840
1987
  /**
@@ -2022,13 +2169,13 @@ export interface BaseCmsSecurityPermission extends SecurityPermission {
2022
2169
  */
2023
2170
  export interface CmsModelPermission extends BaseCmsSecurityPermission {
2024
2171
  /**
2025
- * A object representing `key: model.modelId` values where key is locale code.
2172
+ * An object representing `key: model.modelId` values where key is locale code.
2026
2173
  */
2027
2174
  models?: {
2028
2175
  [key: string]: string[];
2029
2176
  };
2030
2177
  /**
2031
- * A object representing `key: group.id` values where key is locale code.
2178
+ * {locale: groupId[]} map, where key is a locale code.
2032
2179
  */
2033
2180
  groups?: {
2034
2181
  [key: string]: string[];
@@ -2042,7 +2189,7 @@ export interface CmsModelPermission extends BaseCmsSecurityPermission {
2042
2189
  */
2043
2190
  export interface CmsGroupPermission extends BaseCmsSecurityPermission {
2044
2191
  /**
2045
- * A object representing `key: group.id` values where key is locale code.
2192
+ * {locale: groupId[]} map, where key is a locale code.
2046
2193
  */
2047
2194
  groups?: {
2048
2195
  [key: string]: string[];
@@ -2057,13 +2204,13 @@ export interface CmsGroupPermission extends BaseCmsSecurityPermission {
2057
2204
  export interface CmsEntryPermission extends BaseCmsSecurityPermission {
2058
2205
  pw?: string;
2059
2206
  /**
2060
- * A object representing `key: model.modelId` values where key is locale code.
2207
+ * An object representing `key: model.modelId` values where key is locale code.
2061
2208
  */
2062
2209
  models?: {
2063
2210
  [key: string]: string[];
2064
2211
  };
2065
2212
  /**
2066
- * A object representing `key: group.id` values where key is locale code.
2213
+ * {locale: groupId[]} map, where key is a locale code.
2067
2214
  */
2068
2215
  groups?: {
2069
2216
  [key: string]: string[];
@@ -2178,7 +2325,7 @@ export interface CmsEntryStorageOperationsListParams {
2178
2325
  sort?: CmsEntryListSort;
2179
2326
  search?: string;
2180
2327
  fields?: string[];
2181
- limit?: number;
2328
+ limit: number;
2182
2329
  after?: string | null;
2183
2330
  }
2184
2331
  export interface CmsEntryStorageOperationsCreateParams<T extends CmsStorageEntry = CmsStorageEntry> {
@@ -2439,6 +2586,7 @@ export interface CmsSystemStorageOperations {
2439
2586
  update: (params: CmsSystemStorageOperationsUpdateParams) => Promise<CmsSystem>;
2440
2587
  }
2441
2588
  export interface HeadlessCmsStorageOperations<C = CmsContext> {
2589
+ name: string;
2442
2590
  system: CmsSystemStorageOperations;
2443
2591
  settings: CmsSettingsStorageOperations;
2444
2592
  groups: CmsGroupStorageOperations;