@webiny/api-headless-cms 0.0.0-unstable.b02d94bba0 → 0.0.0-unstable.b14eaecf38

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 (94) hide show
  1. package/context.js +47 -43
  2. package/context.js.map +1 -1
  3. package/crud/contentEntry.crud.d.ts +3 -1
  4. package/crud/contentEntry.crud.js +829 -817
  5. package/crud/contentEntry.crud.js.map +1 -1
  6. package/crud/contentModel/beforeCreate.js +38 -79
  7. package/crud/contentModel/beforeCreate.js.map +1 -1
  8. package/crud/contentModel/beforeDelete.d.ts +1 -1
  9. package/crud/contentModel/beforeDelete.js +1 -5
  10. package/crud/contentModel/beforeDelete.js.map +1 -1
  11. package/crud/contentModel/beforeUpdate.js +30 -6
  12. package/crud/contentModel/beforeUpdate.js.map +1 -1
  13. package/crud/contentModel/validate/endingAllowed.d.ts +6 -0
  14. package/crud/contentModel/validate/endingAllowed.js +26 -0
  15. package/crud/contentModel/validate/endingAllowed.js.map +1 -0
  16. package/crud/contentModel/validate/isModelEndingAllowed.d.ts +6 -0
  17. package/crud/contentModel/validate/isModelEndingAllowed.js +24 -0
  18. package/crud/contentModel/validate/isModelEndingAllowed.js.map +1 -0
  19. package/crud/contentModel/validate/modelId.d.ts +11 -0
  20. package/crud/contentModel/validate/modelId.js +36 -0
  21. package/crud/contentModel/validate/modelId.js.map +1 -0
  22. package/crud/contentModel/validate/pluralApiName.d.ts +7 -0
  23. package/crud/contentModel/validate/pluralApiName.js +24 -0
  24. package/crud/contentModel/validate/pluralApiName.js.map +1 -0
  25. package/crud/contentModel/validate/singularApiName.d.ts +7 -0
  26. package/crud/contentModel/validate/singularApiName.js +24 -0
  27. package/crud/contentModel/validate/singularApiName.js.map +1 -0
  28. package/crud/contentModel/validateModelFields.js +6 -7
  29. package/crud/contentModel/validateModelFields.js.map +1 -1
  30. package/crud/contentModel/validation.d.ts +48 -16
  31. package/crud/contentModel/validation.js +2 -2
  32. package/crud/contentModel/validation.js.map +1 -1
  33. package/crud/contentModel.crud.js +334 -295
  34. package/crud/contentModel.crud.js.map +1 -1
  35. package/crud/contentModelGroup.crud.js +170 -142
  36. package/crud/contentModelGroup.crud.js.map +1 -1
  37. package/crud/settings.crud.d.ts +1 -1
  38. package/crud/settings.crud.js +5 -10
  39. package/crud/settings.crud.js.map +1 -1
  40. package/graphql/checkEndpointAccess.d.ts +2 -0
  41. package/graphql/checkEndpointAccess.js +18 -0
  42. package/graphql/checkEndpointAccess.js.map +1 -0
  43. package/graphql/createExecutableSchema.d.ts +2 -3
  44. package/graphql/createExecutableSchema.js.map +1 -1
  45. package/graphql/createRequestBody.d.ts +2 -0
  46. package/graphql/createRequestBody.js +14 -0
  47. package/graphql/createRequestBody.js.map +1 -0
  48. package/graphql/formatErrorPayload.d.ts +1 -0
  49. package/graphql/formatErrorPayload.js +25 -0
  50. package/graphql/formatErrorPayload.js.map +1 -0
  51. package/graphql/generateSchema.js.map +1 -1
  52. package/graphql/getSchema.d.ts +17 -0
  53. package/graphql/getSchema.js +102 -0
  54. package/graphql/getSchema.js.map +1 -0
  55. package/graphql/graphQLHandlerFactory.js +6 -150
  56. package/graphql/graphQLHandlerFactory.js.map +1 -1
  57. package/graphql/handleRequest.d.ts +11 -0
  58. package/graphql/handleRequest.js +81 -0
  59. package/graphql/handleRequest.js.map +1 -0
  60. package/graphql/schema/contentModelGroups.js +6 -6
  61. package/graphql/schema/contentModelGroups.js.map +1 -1
  62. package/graphql/schema/contentModels.js +3 -3
  63. package/graphql/schema/contentModels.js.map +1 -1
  64. package/graphqlFields/dynamicZone/dynamicZoneField.d.ts +1 -1
  65. package/graphqlFields/dynamicZone/dynamicZoneField.js +13 -1
  66. package/graphqlFields/dynamicZone/dynamicZoneField.js.map +1 -1
  67. package/graphqlFields/ref.js +7 -7
  68. package/graphqlFields/ref.js.map +1 -1
  69. package/index.d.ts +2 -0
  70. package/index.js +24 -0
  71. package/index.js.map +1 -1
  72. package/package.json +22 -22
  73. package/plugins/CmsModelPlugin.d.ts +13 -7
  74. package/plugins/CmsModelPlugin.js +21 -6
  75. package/plugins/CmsModelPlugin.js.map +1 -1
  76. package/plugins/StorageOperationsCmsModelPlugin.d.ts +23 -0
  77. package/plugins/StorageOperationsCmsModelPlugin.js +42 -0
  78. package/plugins/StorageOperationsCmsModelPlugin.js.map +1 -0
  79. package/plugins/index.d.ts +1 -0
  80. package/plugins/index.js +11 -0
  81. package/plugins/index.js.map +1 -1
  82. package/types.d.ts +46 -47
  83. package/types.js.map +1 -1
  84. package/utils/converters/valueKeyStorageConverter.d.ts +1 -5
  85. package/utils/converters/valueKeyStorageConverter.js +19 -17
  86. package/utils/converters/valueKeyStorageConverter.js.map +1 -1
  87. package/utils/createTypeFromFields.js +1 -2
  88. package/utils/createTypeFromFields.js.map +1 -1
  89. package/utils/createTypeName.d.ts +0 -2
  90. package/utils/createTypeName.js +2 -10
  91. package/utils/createTypeName.js.map +1 -1
  92. package/utils/incrementEntryIdVersion.d.ts +5 -0
  93. package/utils/incrementEntryIdVersion.js +29 -0
  94. package/utils/incrementEntryIdVersion.js.map +1 -0
package/types.d.ts CHANGED
@@ -118,6 +118,7 @@ export interface CmsModelFieldSettings {
118
118
  */
119
119
  [key: string]: any;
120
120
  }
121
+ export declare type CmsModelFieldType = "boolean" | "datetime" | "file" | "long-text" | "number" | "object" | "ref" | "rich-text" | "text" | "dynamicZone" | string;
121
122
  /**
122
123
  * A definition for content model field. This type exists on the app side as well.
123
124
  *
@@ -138,18 +139,16 @@ export interface CmsModelField {
138
139
  * A type of the field.
139
140
  * We are defining our built-in fields, so people know which are available by the default.
140
141
  */
141
- type: "boolean" | "datetime" | "file" | "long-text" | "number" | "object" | "ref" | "rich-text" | "text" | "dynamicZone" | string;
142
+ type: CmsModelFieldType;
142
143
  /**
143
144
  * A unique storage ID for storing actual values.
144
- * 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
145
146
  *
146
147
  * This is an auto-generated value: uses `id` and `type`
147
148
  *
148
149
  * This is used as path for the entry value.
149
- *
150
- * @internal
151
150
  */
152
- storageId: string;
151
+ storageId: `${string}@${string}` | string;
153
152
  /**
154
153
  * Field identifier for the model field that will be available to the outside world.
155
154
  * `storageId` is used as path (or column) to store the data.
@@ -894,7 +893,7 @@ export interface CmsSettingsContext {
894
893
  /**
895
894
  * Get the datetime when content model last changed.
896
895
  */
897
- getModelLastChange: () => Promise<Date>;
896
+ getModelLastChange: () => Promise<Date | null>;
898
897
  }
899
898
  export interface OnSystemBeforeInstallTopicParams {
900
899
  tenant: string;
@@ -1311,7 +1310,7 @@ export interface CmsModelFieldInput {
1311
1310
  /**
1312
1311
  * @see CmsModelField.listValidation
1313
1312
  */
1314
- listValidation: CmsModelFieldValidation[];
1313
+ listValidation?: CmsModelFieldValidation[];
1315
1314
  /**
1316
1315
  * User defined settings.
1317
1316
  */
@@ -1882,12 +1881,12 @@ export interface CmsEntryMeta {
1882
1881
  export interface OnEntryBeforeCreateTopicParams {
1883
1882
  input: CreateCmsEntryInput;
1884
1883
  entry: CmsEntry;
1885
- model: StorageOperationsCmsModel;
1884
+ model: CmsModel;
1886
1885
  }
1887
1886
  export interface OnEntryAfterCreateTopicParams {
1888
1887
  input: CreateCmsEntryInput;
1889
1888
  entry: CmsEntry;
1890
- model: StorageOperationsCmsModel;
1889
+ model: CmsModel;
1891
1890
  storageEntry: CmsEntry;
1892
1891
  }
1893
1892
  export interface OnEntryCreateErrorTopicParams {
@@ -1903,13 +1902,13 @@ export interface OnEntryRevisionBeforeCreateTopicParams {
1903
1902
  input: CreateFromCmsEntryInput;
1904
1903
  entry: CmsEntry;
1905
1904
  original: CmsEntry;
1906
- model: StorageOperationsCmsModel;
1905
+ model: CmsModel;
1907
1906
  }
1908
1907
  export interface OnEntryRevisionAfterCreateTopicParams {
1909
1908
  input: CreateFromCmsEntryInput;
1910
1909
  entry: CmsEntry;
1911
1910
  original: CmsEntry;
1912
- model: StorageOperationsCmsModel;
1911
+ model: CmsModel;
1913
1912
  storageEntry: CmsEntry;
1914
1913
  }
1915
1914
  export interface OnEntryCreateRevisionErrorTopicParams {
@@ -1926,13 +1925,13 @@ export interface OnEntryBeforeUpdateTopicParams {
1926
1925
  input: UpdateCmsEntryInput;
1927
1926
  original: CmsEntry;
1928
1927
  entry: CmsEntry;
1929
- model: StorageOperationsCmsModel;
1928
+ model: CmsModel;
1930
1929
  }
1931
1930
  export interface OnEntryAfterUpdateTopicParams {
1932
1931
  input: UpdateCmsEntryInput;
1933
1932
  original: CmsEntry;
1934
1933
  entry: CmsEntry;
1935
- model: StorageOperationsCmsModel;
1934
+ model: CmsModel;
1936
1935
  storageEntry: CmsEntry;
1937
1936
  }
1938
1937
  export interface OnEntryUpdateErrorTopicParams {
@@ -1946,45 +1945,45 @@ export interface OnEntryUpdateErrorTopicParams {
1946
1945
  */
1947
1946
  export interface OnEntryBeforePublishTopicParams {
1948
1947
  entry: CmsEntry;
1949
- model: StorageOperationsCmsModel;
1948
+ model: CmsModel;
1950
1949
  }
1951
1950
  export interface OnEntryAfterPublishTopicParams {
1952
1951
  entry: CmsEntry;
1953
- model: StorageOperationsCmsModel;
1952
+ model: CmsModel;
1954
1953
  storageEntry: CmsEntry;
1955
1954
  }
1956
1955
  export interface OnEntryPublishErrorTopicParams {
1957
1956
  error: Error;
1958
1957
  entry: CmsEntry;
1959
- model: StorageOperationsCmsModel;
1958
+ model: CmsModel;
1960
1959
  }
1961
1960
  /**
1962
1961
  * Republish
1963
1962
  */
1964
1963
  export interface OnEntryBeforeRepublishTopicParams {
1965
1964
  entry: CmsEntry;
1966
- model: StorageOperationsCmsModel;
1965
+ model: CmsModel;
1967
1966
  }
1968
1967
  export interface OnEntryAfterRepublishTopicParams {
1969
1968
  entry: CmsEntry;
1970
- model: StorageOperationsCmsModel;
1969
+ model: CmsModel;
1971
1970
  storageEntry: CmsEntry;
1972
1971
  }
1973
1972
  export interface OnEntryRepublishErrorTopicParams {
1974
1973
  error: Error;
1975
1974
  entry: CmsEntry;
1976
- model: StorageOperationsCmsModel;
1975
+ model: CmsModel;
1977
1976
  }
1978
1977
  /**
1979
1978
  * Unpublish
1980
1979
  */
1981
1980
  export interface OnEntryBeforeUnpublishTopicParams {
1982
1981
  entry: CmsEntry;
1983
- model: StorageOperationsCmsModel;
1982
+ model: CmsModel;
1984
1983
  }
1985
1984
  export interface OnEntryAfterUnpublishTopicParams {
1986
1985
  entry: CmsEntry;
1987
- model: StorageOperationsCmsModel;
1986
+ model: CmsModel;
1988
1987
  storageEntry: CmsEntry;
1989
1988
  }
1990
1989
  export interface OnEntryUnpublishErrorTopicParams {
@@ -1994,37 +1993,37 @@ export interface OnEntryUnpublishErrorTopicParams {
1994
1993
  }
1995
1994
  export interface OnEntryBeforeDeleteTopicParams {
1996
1995
  entry: CmsEntry;
1997
- model: StorageOperationsCmsModel;
1996
+ model: CmsModel;
1998
1997
  }
1999
1998
  export interface OnEntryAfterDeleteTopicParams {
2000
1999
  entry: CmsEntry;
2001
- model: StorageOperationsCmsModel;
2000
+ model: CmsModel;
2002
2001
  }
2003
2002
  export interface OnEntryDeleteErrorTopicParams {
2004
2003
  error: Error;
2005
2004
  entry: CmsEntry;
2006
- model: StorageOperationsCmsModel;
2005
+ model: CmsModel;
2007
2006
  }
2008
2007
  export interface OnEntryRevisionBeforeDeleteTopicParams {
2009
2008
  entry: CmsEntry;
2010
- model: StorageOperationsCmsModel;
2009
+ model: CmsModel;
2011
2010
  }
2012
2011
  export interface OnEntryRevisionAfterDeleteTopicParams {
2013
2012
  entry: CmsEntry;
2014
- model: StorageOperationsCmsModel;
2013
+ model: CmsModel;
2015
2014
  }
2016
2015
  export interface OnEntryRevisionDeleteErrorTopicParams {
2017
2016
  error: Error;
2018
2017
  entry: CmsEntry;
2019
- model: StorageOperationsCmsModel;
2018
+ model: CmsModel;
2020
2019
  }
2021
2020
  export interface OnEntryBeforeGetTopicParams {
2022
- model: StorageOperationsCmsModel;
2021
+ model: CmsModel;
2023
2022
  where: CmsEntryListWhere;
2024
2023
  }
2025
2024
  export interface EntryBeforeListTopicParams {
2026
2025
  where: CmsEntryListWhere;
2027
- model: StorageOperationsCmsModel;
2026
+ model: CmsModel;
2028
2027
  }
2029
2028
  /**
2030
2029
  * @category Context
@@ -2553,71 +2552,71 @@ export interface CmsEntryStorageOperations<T extends CmsStorageEntry = CmsStorag
2553
2552
  /**
2554
2553
  * Get all the entries of the ids.
2555
2554
  */
2556
- getByIds: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetByIdsParams) => Promise<T[]>;
2555
+ getByIds: (model: CmsModel, params: CmsEntryStorageOperationsGetByIdsParams) => Promise<T[]>;
2557
2556
  /**
2558
2557
  * Get all the published entries of the ids.
2559
2558
  */
2560
- getPublishedByIds: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetPublishedByIdsParams) => Promise<T[]>;
2559
+ getPublishedByIds: (model: CmsModel, params: CmsEntryStorageOperationsGetPublishedByIdsParams) => Promise<T[]>;
2561
2560
  /**
2562
2561
  * Get all the latest entries of the ids.
2563
2562
  */
2564
- getLatestByIds: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetLatestByIdsParams) => Promise<T[]>;
2563
+ getLatestByIds: (model: CmsModel, params: CmsEntryStorageOperationsGetLatestByIdsParams) => Promise<T[]>;
2565
2564
  /**
2566
2565
  * Get all revisions of the given entry id.
2567
2566
  */
2568
- getRevisions: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetRevisionsParams) => Promise<T[]>;
2567
+ getRevisions: (model: CmsModel, params: CmsEntryStorageOperationsGetRevisionsParams) => Promise<T[]>;
2569
2568
  /**
2570
2569
  * Get the entry by the given revision id.
2571
2570
  */
2572
- getRevisionById: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetRevisionParams) => Promise<T | null>;
2571
+ getRevisionById: (model: CmsModel, params: CmsEntryStorageOperationsGetRevisionParams) => Promise<T | null>;
2573
2572
  /**
2574
2573
  * Get the published entry by given entryId.
2575
2574
  */
2576
- getPublishedRevisionByEntryId: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetPublishedRevisionParams) => Promise<T | null>;
2575
+ getPublishedRevisionByEntryId: (model: CmsModel, params: CmsEntryStorageOperationsGetPublishedRevisionParams) => Promise<T | null>;
2577
2576
  /**
2578
2577
  * Get the latest entry by given entryId.
2579
2578
  */
2580
- getLatestRevisionByEntryId: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetLatestRevisionParams) => Promise<T | null>;
2579
+ getLatestRevisionByEntryId: (model: CmsModel, params: CmsEntryStorageOperationsGetLatestRevisionParams) => Promise<T | null>;
2581
2580
  /**
2582
2581
  * Get the revision of the entry before given one.
2583
2582
  */
2584
- getPreviousRevision: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetPreviousRevisionParams) => Promise<T | null>;
2583
+ getPreviousRevision: (model: CmsModel, params: CmsEntryStorageOperationsGetPreviousRevisionParams) => Promise<T | null>;
2585
2584
  /**
2586
2585
  * Gets entry by given params.
2587
2586
  */
2588
- get: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetParams) => Promise<T | null>;
2587
+ get: (model: CmsModel, params: CmsEntryStorageOperationsGetParams) => Promise<T | null>;
2589
2588
  /**
2590
2589
  * List all entries. Filterable via params.
2591
2590
  */
2592
- list: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsListParams) => Promise<CmsEntryStorageOperationsListResponse<T>>;
2591
+ list: (model: CmsModel, params: CmsEntryStorageOperationsListParams) => Promise<CmsEntryStorageOperationsListResponse<T>>;
2593
2592
  /**
2594
2593
  * Create a new entry.
2595
2594
  */
2596
- create: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsCreateParams<T>) => Promise<T>;
2595
+ create: (model: CmsModel, params: CmsEntryStorageOperationsCreateParams<T>) => Promise<T>;
2597
2596
  /**
2598
2597
  * Create a new entry from existing one.
2599
2598
  */
2600
- createRevisionFrom: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsCreateRevisionFromParams<T>) => Promise<T>;
2599
+ createRevisionFrom: (model: CmsModel, params: CmsEntryStorageOperationsCreateRevisionFromParams<T>) => Promise<T>;
2601
2600
  /**
2602
2601
  * Update existing entry.
2603
2602
  */
2604
- update: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsUpdateParams<T>) => Promise<T>;
2603
+ update: (model: CmsModel, params: CmsEntryStorageOperationsUpdateParams<T>) => Promise<T>;
2605
2604
  /**
2606
2605
  * Delete the entry revision.
2607
2606
  */
2608
- deleteRevision: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsDeleteRevisionParams<T>) => Promise<void>;
2607
+ deleteRevision: (model: CmsModel, params: CmsEntryStorageOperationsDeleteRevisionParams<T>) => Promise<void>;
2609
2608
  /**
2610
2609
  * Delete the entry.
2611
2610
  */
2612
- delete: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsDeleteParams) => Promise<void>;
2611
+ delete: (model: CmsModel, params: CmsEntryStorageOperationsDeleteParams) => Promise<void>;
2613
2612
  /**
2614
2613
  * Publish the entry.
2615
2614
  */
2616
- publish: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsPublishParams<T>) => Promise<T>;
2615
+ publish: (model: CmsModel, params: CmsEntryStorageOperationsPublishParams<T>) => Promise<T>;
2617
2616
  /**
2618
2617
  * Unpublish the entry.
2619
2618
  */
2620
- unpublish: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsUnpublishParams<T>) => Promise<T>;
2619
+ unpublish: (model: CmsModel, params: CmsEntryStorageOperationsUnpublishParams<T>) => Promise<T>;
2621
2620
  }
2622
2621
  export declare enum CONTENT_ENTRY_STATUS {
2623
2622
  DRAFT = "draft",
@@ -2689,7 +2688,7 @@ export interface HeadlessCmsStorageOperations<C = CmsContext> {
2689
2688
  /**
2690
2689
  * Either attach something from the storage operations or run something in it.
2691
2690
  */
2692
- beforeInit?: (context: C) => Promise<void>;
2691
+ beforeInit: (context: C) => Promise<void>;
2693
2692
  init?: (context: C) => Promise<void>;
2694
2693
  }
2695
2694
  export {};