@webiny/api-headless-cms 5.18.2 → 5.19.0-beta.1

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 (27) hide show
  1. package/content/plugins/crud/contentEntry/afterDelete.d.ts +7 -0
  2. package/content/plugins/crud/contentEntry/afterDelete.js +41 -0
  3. package/content/plugins/crud/contentEntry/markLockedFields.d.ts +7 -3
  4. package/content/plugins/crud/contentEntry/markLockedFields.js +41 -7
  5. package/content/plugins/crud/contentEntry/referenceFieldsMapping.d.ts +12 -0
  6. package/content/plugins/crud/contentEntry/referenceFieldsMapping.js +251 -0
  7. package/content/plugins/crud/contentEntry.crud.d.ts +0 -4
  8. package/content/plugins/crud/contentEntry.crud.js +50 -51
  9. package/content/plugins/crud/contentModel/beforeCreate.js +1 -1
  10. package/content/plugins/crud/index.js +6 -4
  11. package/content/plugins/graphqlFields/ref.js +70 -34
  12. package/content/plugins/modelManager/DefaultCmsModelManager.js +7 -1
  13. package/content/plugins/schema/contentEntries.js +39 -28
  14. package/content/plugins/schema/createManageResolvers.js +1 -2
  15. package/content/plugins/schema/resolvers/manage/resolveDelete.js +7 -1
  16. package/content/plugins/utils/renderSortEnum.js +12 -12
  17. package/content/plugins/validators/patternPlugins/index.js +5 -1
  18. package/content/plugins/validators/patternPlugins/lowerCaseSpace.d.ts +3 -0
  19. package/content/plugins/validators/patternPlugins/lowerCaseSpace.js +17 -0
  20. package/content/plugins/validators/patternPlugins/upperCaseSpace.d.ts +3 -0
  21. package/content/plugins/validators/patternPlugins/upperCaseSpace.js +17 -0
  22. package/index.d.ts +1 -1
  23. package/package.json +24 -23
  24. package/plugins/crud/index.js +20 -2
  25. package/plugins/crud/system.crud.js +2 -1
  26. package/types.d.ts +20 -36
  27. package/types.js +0 -6
package/types.d.ts CHANGED
@@ -10,7 +10,7 @@ import { DbContext } from "@webiny/handler-db/types";
10
10
  import { FileManagerContext } from "@webiny/api-file-manager/types";
11
11
  import { UpgradePlugin } from "@webiny/api-upgrade/types";
12
12
  import { Topic } from "@webiny/pubsub/types";
13
- interface BaseCmsValuesObject {
13
+ export interface HeadlessCms extends CmsSettingsContext, CmsSystemContext, CmsGroupContext, CmsModelContext, CmsEntryContext {
14
14
  /**
15
15
  * API type
16
16
  */
@@ -35,8 +35,9 @@ interface BaseCmsValuesObject {
35
35
  * Means this request is a PREVIEW API
36
36
  */
37
37
  PREVIEW: boolean;
38
- }
39
- export interface HeadlessCms extends BaseCmsValuesObject, CmsCrudContextObject {
38
+ /**
39
+ * The storage operations loaded for current context.
40
+ */
40
41
  storageOperations: HeadlessCmsStorageOperations;
41
42
  }
42
43
  /**
@@ -162,11 +163,11 @@ export interface CmsModelDateTimeField extends CmsModelField {
162
163
  * @category ModelField
163
164
  * @category FieldValidation
164
165
  */
165
- export interface CmsModelFieldValidatorValidateParams {
166
+ export interface CmsModelFieldValidatorValidateParams<T = any> {
166
167
  /**
167
168
  * A value to be validated.
168
169
  */
169
- value: any;
170
+ value: T;
170
171
  /**
171
172
  * Options from the CmsModelField validations.
172
173
  *
@@ -1254,6 +1255,16 @@ export interface CmsModelContext {
1254
1255
  * @category CmsEntry
1255
1256
  */
1256
1257
  declare type CmsEntryStatus = "published" | "unpublished" | "reviewRequested" | "changesRequested" | "draft";
1258
+ export interface CmsEntryListWhereRef {
1259
+ id?: string;
1260
+ id_in?: string[];
1261
+ id_not?: string;
1262
+ id_not_in?: string[];
1263
+ entryId?: string;
1264
+ entryId_not?: string;
1265
+ entryId_in?: string[];
1266
+ entryId_not_in?: string[];
1267
+ }
1257
1268
  /**
1258
1269
  * Entry listing where params.
1259
1270
  *
@@ -1316,7 +1327,10 @@ export interface CmsEntryListWhere {
1316
1327
  * @internal
1317
1328
  */
1318
1329
  latest?: boolean;
1319
- [key: string]: any;
1330
+ /**
1331
+ * Can be reference field or, actually, anything else.
1332
+ */
1333
+ [key: string]: any | CmsEntryListWhereRef;
1320
1334
  }
1321
1335
  /**
1322
1336
  * Entry listing sort.
@@ -1563,14 +1577,6 @@ export interface CmsEntryContext {
1563
1577
  onBeforeEntryGet: Topic<BeforeEntryGetTopicParams>;
1564
1578
  onBeforeEntryList: Topic<BeforeEntryListTopicParams>;
1565
1579
  }
1566
- /**
1567
- * A cms part of the context that has all the CRUD operations.
1568
- *
1569
- * @category Context
1570
- */
1571
- interface CmsCrudContextObject extends CmsSettingsContext, CmsSystemContext, CmsGroupContext, CmsModelContext, CmsEntryContext {
1572
- storageOperations: HeadlessCmsStorageOperations;
1573
- }
1574
1580
  /**
1575
1581
  * Parameters for CmsEntryResolverFactory.
1576
1582
  *
@@ -1936,51 +1942,30 @@ export interface CmsEntryStorageOperationsRequestReviewParams<T extends CmsStora
1936
1942
  */
1937
1943
  originalStorageEntry: T;
1938
1944
  }
1939
- export interface CmsEntryStorageOperationsGetAllRevisionsParams {
1940
- ids: readonly string[];
1941
- tenant: string;
1942
- locale: string;
1943
- }
1944
1945
  export interface CmsEntryStorageOperationsGetByIdsParams {
1945
1946
  ids: readonly string[];
1946
- tenant: string;
1947
- locale: string;
1948
1947
  }
1949
1948
  export interface CmsEntryStorageOperationsGetLatestByIdsParams {
1950
1949
  ids: readonly string[];
1951
- tenant: string;
1952
- locale: string;
1953
1950
  }
1954
1951
  export interface CmsEntryStorageOperationsGetPublishedByIdsParams {
1955
1952
  ids: readonly string[];
1956
- tenant: string;
1957
- locale: string;
1958
1953
  }
1959
1954
  export interface CmsEntryStorageOperationsGetRevisionsParams {
1960
1955
  id: string;
1961
- tenant: string;
1962
- locale: string;
1963
1956
  }
1964
1957
  export interface CmsEntryStorageOperationsGetRevisionParams {
1965
1958
  id: string;
1966
- tenant: string;
1967
- locale: string;
1968
1959
  }
1969
1960
  export interface CmsEntryStorageOperationsGetPublishedRevisionParams {
1970
1961
  id: string;
1971
- tenant: string;
1972
- locale: string;
1973
1962
  }
1974
1963
  export interface CmsEntryStorageOperationsGetLatestRevisionParams {
1975
1964
  id: string;
1976
- tenant: string;
1977
- locale: string;
1978
1965
  }
1979
1966
  export interface CmsEntryStorageOperationsGetPreviousRevisionParams {
1980
1967
  entryId: string;
1981
1968
  version: number;
1982
- tenant: string;
1983
- locale: string;
1984
1969
  }
1985
1970
  export interface CmsEntryStorageOperationsListResponse<T extends CmsStorageEntry = CmsStorageEntry> {
1986
1971
  /**
@@ -2029,7 +2014,6 @@ export interface CmsEntryStorageOperations<T extends CmsStorageEntry = CmsStorag
2029
2014
  /**
2030
2015
  * Get all revisions of all of the given IDs.
2031
2016
  */
2032
- getAllRevisionsByIds: (model: CmsModel, params: CmsEntryStorageOperationsGetAllRevisionsParams) => Promise<T[]>;
2033
2017
  /**
2034
2018
  * Get the entry by the given revision id.
2035
2019
  */
package/types.js CHANGED
@@ -291,12 +291,6 @@ exports.CONTENT_ENTRY_STATUS = void 0;
291
291
  * @category CmsEntry
292
292
  */
293
293
 
294
- /**
295
- * A cms part of the context that has all the CRUD operations.
296
- *
297
- * @category Context
298
- */
299
-
300
294
  /**
301
295
  * Parameters for CmsEntryResolverFactory.
302
296
  *