@webiny/api-headless-cms 0.0.0-unstable.d7f521b032 → 0.0.0-unstable.da99e0b846

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 (165) 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.crud.d.ts +5 -2
  7. package/crud/contentEntry.crud.js +848 -830
  8. package/crud/contentEntry.crud.js.map +1 -1
  9. package/crud/contentModel/beforeCreate.js +39 -76
  10. package/crud/contentModel/beforeCreate.js.map +1 -1
  11. package/crud/contentModel/beforeDelete.d.ts +1 -1
  12. package/crud/contentModel/beforeDelete.js +1 -5
  13. package/crud/contentModel/beforeDelete.js.map +1 -1
  14. package/crud/contentModel/beforeUpdate.js +31 -3
  15. package/crud/contentModel/beforeUpdate.js.map +1 -1
  16. package/crud/contentModel/compatibility/modelApiName.d.ts +3 -0
  17. package/crud/contentModel/compatibility/modelApiName.js +24 -0
  18. package/crud/contentModel/compatibility/modelApiName.js.map +1 -0
  19. package/crud/contentModel/defaultFields.d.ts +5 -0
  20. package/crud/contentModel/defaultFields.js +58 -0
  21. package/crud/contentModel/defaultFields.js.map +1 -0
  22. package/crud/contentModel/fields/descriptionField.d.ts +2 -0
  23. package/crud/contentModel/fields/descriptionField.js +42 -0
  24. package/crud/contentModel/fields/descriptionField.js.map +1 -0
  25. package/crud/contentModel/fields/imageField.d.ts +2 -0
  26. package/crud/contentModel/fields/imageField.js +46 -0
  27. package/crud/contentModel/fields/imageField.js.map +1 -0
  28. package/crud/contentModel/fields/titleField.d.ts +2 -0
  29. package/crud/contentModel/fields/titleField.js +58 -0
  30. package/crud/contentModel/fields/titleField.js.map +1 -0
  31. package/crud/contentModel/systemFields.js.map +1 -1
  32. package/crud/contentModel/validate/endingAllowed.d.ts +6 -0
  33. package/crud/contentModel/validate/endingAllowed.js +26 -0
  34. package/crud/contentModel/validate/endingAllowed.js.map +1 -0
  35. package/crud/contentModel/validate/isModelEndingAllowed.d.ts +6 -0
  36. package/crud/contentModel/validate/isModelEndingAllowed.js +24 -0
  37. package/crud/contentModel/validate/isModelEndingAllowed.js.map +1 -0
  38. package/crud/contentModel/validate/modelId.d.ts +11 -0
  39. package/crud/contentModel/validate/modelId.js +36 -0
  40. package/crud/contentModel/validate/modelId.js.map +1 -0
  41. package/crud/contentModel/validate/pluralApiName.d.ts +7 -0
  42. package/crud/contentModel/validate/pluralApiName.js +24 -0
  43. package/crud/contentModel/validate/pluralApiName.js.map +1 -0
  44. package/crud/contentModel/validate/singularApiName.d.ts +7 -0
  45. package/crud/contentModel/validate/singularApiName.js +24 -0
  46. package/crud/contentModel/validate/singularApiName.js.map +1 -0
  47. package/crud/contentModel/validateModel.d.ts +1 -0
  48. package/crud/contentModel/validateModel.js.map +1 -1
  49. package/crud/contentModel/validateModelFields.d.ts +2 -1
  50. package/crud/contentModel/validateModelFields.js +19 -57
  51. package/crud/contentModel/validateModelFields.js.map +1 -1
  52. package/crud/contentModel/validation.d.ts +136 -62
  53. package/crud/contentModel/validation.js +61 -13
  54. package/crud/contentModel/validation.js.map +1 -1
  55. package/crud/contentModel.crud.js +346 -285
  56. package/crud/contentModel.crud.js.map +1 -1
  57. package/crud/contentModelGroup.crud.js +170 -142
  58. package/crud/contentModelGroup.crud.js.map +1 -1
  59. package/crud/settings.crud.d.ts +1 -1
  60. package/crud/settings.crud.js +5 -10
  61. package/crud/settings.crud.js.map +1 -1
  62. package/crud/system.crud.js +0 -60
  63. package/crud/system.crud.js.map +1 -1
  64. package/graphql/checkEndpointAccess.d.ts +2 -0
  65. package/graphql/checkEndpointAccess.js +18 -0
  66. package/graphql/checkEndpointAccess.js.map +1 -0
  67. package/graphql/createExecutableSchema.d.ts +2 -3
  68. package/graphql/createExecutableSchema.js.map +1 -1
  69. package/graphql/createRequestBody.d.ts +2 -0
  70. package/graphql/createRequestBody.js +14 -0
  71. package/graphql/createRequestBody.js.map +1 -0
  72. package/graphql/formatErrorPayload.d.ts +1 -0
  73. package/graphql/formatErrorPayload.js +25 -0
  74. package/graphql/formatErrorPayload.js.map +1 -0
  75. package/graphql/generateSchema.js.map +1 -1
  76. package/graphql/getSchema.d.ts +17 -0
  77. package/graphql/getSchema.js +102 -0
  78. package/graphql/getSchema.js.map +1 -0
  79. package/graphql/graphQLHandlerFactory.js +6 -145
  80. package/graphql/graphQLHandlerFactory.js.map +1 -1
  81. package/graphql/handleRequest.d.ts +11 -0
  82. package/graphql/handleRequest.js +81 -0
  83. package/graphql/handleRequest.js.map +1 -0
  84. package/graphql/schema/baseContentSchema.js +1 -7
  85. package/graphql/schema/baseContentSchema.js.map +1 -1
  86. package/graphql/schema/contentEntries.js +90 -53
  87. package/graphql/schema/contentEntries.js.map +1 -1
  88. package/graphql/schema/contentModelGroups.js +7 -7
  89. package/graphql/schema/contentModelGroups.js.map +1 -1
  90. package/graphql/schema/contentModels.js +23 -4
  91. package/graphql/schema/contentModels.js.map +1 -1
  92. package/graphql/schema/createManageResolvers.d.ts +1 -1
  93. package/graphql/schema/createManageResolvers.js +33 -17
  94. package/graphql/schema/createManageResolvers.js.map +1 -1
  95. package/graphql/schema/createManageSDL.d.ts +1 -0
  96. package/graphql/schema/createManageSDL.js +55 -49
  97. package/graphql/schema/createManageSDL.js.map +1 -1
  98. package/graphql/schema/createPreviewResolvers.js +3 -7
  99. package/graphql/schema/createPreviewResolvers.js.map +1 -1
  100. package/graphql/schema/createReadResolvers.js +4 -8
  101. package/graphql/schema/createReadResolvers.js.map +1 -1
  102. package/graphql/schema/createReadSDL.d.ts +1 -0
  103. package/graphql/schema/createReadSDL.js +24 -22
  104. package/graphql/schema/createReadSDL.js.map +1 -1
  105. package/graphql/schema/resolvers/commonFieldResolvers.d.ts +3 -2
  106. package/graphql/schema/resolvers/commonFieldResolvers.js +2 -1
  107. package/graphql/schema/resolvers/commonFieldResolvers.js.map +1 -1
  108. package/graphql/schema/schemaPlugins.js +12 -12
  109. package/graphql/schema/schemaPlugins.js.map +1 -1
  110. package/graphql/system.js +0 -16
  111. package/graphql/system.js.map +1 -1
  112. package/graphqlFields/dynamicZone/dynamicZoneField.js +12 -4
  113. package/graphqlFields/dynamicZone/dynamicZoneField.js.map +1 -1
  114. package/graphqlFields/object.js +21 -2
  115. package/graphqlFields/object.js.map +1 -1
  116. package/graphqlFields/ref.js +42 -14
  117. package/graphqlFields/ref.js.map +1 -1
  118. package/index.d.ts +3 -1
  119. package/index.js +25 -2
  120. package/index.js.map +1 -1
  121. package/package.json +22 -23
  122. package/plugins/CmsModelPlugin.d.ts +19 -3
  123. package/plugins/CmsModelPlugin.js +28 -2
  124. package/plugins/CmsModelPlugin.js.map +1 -1
  125. package/plugins/StorageOperationsCmsModelPlugin.d.ts +23 -0
  126. package/plugins/StorageOperationsCmsModelPlugin.js +42 -0
  127. package/plugins/StorageOperationsCmsModelPlugin.js.map +1 -0
  128. package/plugins/index.d.ts +1 -0
  129. package/plugins/index.js +11 -0
  130. package/plugins/index.js.map +1 -1
  131. package/types.d.ts +118 -66
  132. package/types.js +1 -1
  133. package/types.js.map +1 -1
  134. package/upgrades/5.33.0/index.js +26 -3
  135. package/upgrades/5.33.0/index.js.map +1 -1
  136. package/upgrades/index.js +3 -0
  137. package/upgrades/index.js.map +1 -1
  138. package/utils/converters/valueKeyStorageConverter.d.ts +1 -5
  139. package/utils/converters/valueKeyStorageConverter.js +21 -18
  140. package/utils/converters/valueKeyStorageConverter.js.map +1 -1
  141. package/utils/createTypeFromFields.d.ts +1 -0
  142. package/utils/createTypeFromFields.js +7 -5
  143. package/utils/createTypeFromFields.js.map +1 -1
  144. package/utils/createTypeName.d.ts +0 -2
  145. package/utils/createTypeName.js +2 -10
  146. package/utils/createTypeName.js.map +1 -1
  147. package/utils/getEntryDescription.d.ts +2 -0
  148. package/utils/getEntryDescription.js +17 -0
  149. package/utils/getEntryDescription.js.map +1 -0
  150. package/utils/getEntryImage.d.ts +2 -0
  151. package/utils/getEntryImage.js +17 -0
  152. package/utils/getEntryImage.js.map +1 -0
  153. package/utils/incrementEntryIdVersion.d.ts +5 -0
  154. package/utils/incrementEntryIdVersion.js +29 -0
  155. package/utils/incrementEntryIdVersion.js.map +1 -0
  156. package/utils/ownership.d.ts +3 -3
  157. package/utils/ownership.js.map +1 -1
  158. package/utils/pluralizedTypeName.js +6 -0
  159. package/utils/pluralizedTypeName.js.map +1 -1
  160. package/utils/renderFields.d.ts +2 -1
  161. package/utils/renderFields.js +8 -1
  162. package/utils/renderFields.js.map +1 -1
  163. package/utils/renderInputFields.d.ts +2 -1
  164. package/utils/renderInputFields.js +4 -0
  165. package/utils/renderInputFields.js.map +1 -1
package/context.js CHANGED
@@ -14,6 +14,8 @@ var _settings = require("./crud/settings.crud");
14
14
  var _contentModelGroup = require("./crud/contentModelGroup.crud");
15
15
  var _contentModel = require("./crud/contentModel.crud");
16
16
  var _contentEntry = require("./crud/contentEntry.crud");
17
+ var _plugins = require("./plugins");
18
+ var _valueKeyStorageConverter = require("./utils/converters/valueKeyStorageConverter");
17
19
  const getParameters = async context => {
18
20
  const plugins = context.plugins.byType(_CmsParametersPlugin.CmsParametersPlugin.type);
19
21
  for (const plugin of plugins) {
@@ -45,50 +47,52 @@ const createContextPlugin = ({
45
47
  const getTenant = () => {
46
48
  return context.tenancy.getCurrentTenant();
47
49
  };
48
- if (storageOperations.beforeInit) {
50
+ context.plugins.register(new _plugins.StorageOperationsCmsModelPlugin((0, _valueKeyStorageConverter.createCmsModelFieldConvertersAttachFactory)(context.plugins)));
51
+ await context.benchmark.measure("headlessCms.createContext", async () => {
49
52
  await storageOperations.beforeInit(context);
50
- }
51
- context.cms = (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
52
- type,
53
- locale,
54
- getLocale,
55
- READ: type === "read",
56
- PREVIEW: type === "preview",
57
- MANAGE: type === "manage",
58
- storageOperations
59
- }, (0, _system.createSystemCrud)({
60
- context,
61
- getTenant,
62
- getLocale,
63
- getIdentity,
64
- storageOperations
65
- })), (0, _settings.createSettingsCrud)({
66
- context,
67
- getTenant,
68
- getLocale,
69
- storageOperations
70
- })), (0, _contentModelGroup.createModelGroupsCrud)({
71
- context,
72
- getTenant,
73
- getLocale,
74
- getIdentity,
75
- storageOperations
76
- })), (0, _contentModel.createModelsCrud)({
77
- context,
78
- getLocale,
79
- getTenant,
80
- getIdentity,
81
- storageOperations
82
- })), (0, _contentEntry.createContentEntryCrud)({
83
- context,
84
- getIdentity,
85
- getTenant,
86
- storageOperations
87
- }));
88
- if (!storageOperations.init) {
89
- return;
90
- }
91
- await storageOperations.init(context);
53
+ context.cms = (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
54
+ type,
55
+ locale,
56
+ getLocale,
57
+ READ: type === "read",
58
+ PREVIEW: type === "preview",
59
+ MANAGE: type === "manage",
60
+ storageOperations
61
+ }, (0, _system.createSystemCrud)({
62
+ context,
63
+ getTenant,
64
+ getLocale,
65
+ getIdentity,
66
+ storageOperations
67
+ })), (0, _settings.createSettingsCrud)({
68
+ context,
69
+ getTenant,
70
+ getLocale,
71
+ storageOperations
72
+ })), (0, _contentModelGroup.createModelGroupsCrud)({
73
+ context,
74
+ getTenant,
75
+ getLocale,
76
+ getIdentity,
77
+ storageOperations
78
+ })), (0, _contentModel.createModelsCrud)({
79
+ context,
80
+ getLocale,
81
+ getTenant,
82
+ getIdentity,
83
+ storageOperations
84
+ })), (0, _contentEntry.createContentEntryCrud)({
85
+ context,
86
+ getIdentity,
87
+ getTenant,
88
+ getLocale,
89
+ storageOperations
90
+ }));
91
+ if (!storageOperations.init) {
92
+ return;
93
+ }
94
+ await storageOperations.init(context);
95
+ });
92
96
  });
93
97
  };
94
98
  exports.createContextPlugin = createContextPlugin;
package/context.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["getParameters","context","plugins","byType","CmsParametersPlugin","type","plugin","result","WebinyError","createContextPlugin","storageOperations","ContextPlugin","locale","getLocale","systemLocale","i18n","getIdentity","security","getTenant","tenancy","getCurrentTenant","beforeInit","cms","READ","PREVIEW","MANAGE","createSystemCrud","createSettingsCrud","createModelGroupsCrud","createModelsCrud","createContentEntryCrud","init"],"sources":["context.ts"],"sourcesContent":["import { CmsContext, HeadlessCmsStorageOperations } from \"~/types\";\nimport WebinyError from \"@webiny/error\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { CmsParametersPlugin, CmsParametersPluginResponse } from \"~/plugins/CmsParametersPlugin\";\nimport { createSystemCrud } from \"~/crud/system.crud\";\nimport { createSettingsCrud } from \"~/crud/settings.crud\";\nimport { createModelGroupsCrud } from \"~/crud/contentModelGroup.crud\";\nimport { createModelsCrud } from \"~/crud/contentModel.crud\";\nimport { createContentEntryCrud } from \"~/crud/contentEntry.crud\";\n\nconst getParameters = async (context: CmsContext): Promise<CmsParametersPluginResponse> => {\n const plugins = context.plugins.byType<CmsParametersPlugin>(CmsParametersPlugin.type);\n\n for (const plugin of plugins) {\n const result = await plugin.getParameters(context);\n if (result !== null) {\n return result;\n }\n }\n throw new WebinyError(\n \"Could not determine locale and/or type of the CMS.\",\n \"CMS_LOCALE_AND_TYPE_ERROR\"\n );\n};\n\nexport interface CrudParams {\n storageOperations: HeadlessCmsStorageOperations;\n}\n\nexport const createContextPlugin = ({ storageOperations }: CrudParams) => {\n return new ContextPlugin<CmsContext>(async context => {\n const { type, locale } = await getParameters(context);\n\n const getLocale = () => {\n const systemLocale = context.i18n.getLocale(locale);\n if (!systemLocale) {\n throw new WebinyError(`There is no locale \"${locale}\" in the system.`);\n }\n return systemLocale;\n };\n\n const getIdentity = () => {\n return context.security.getIdentity();\n };\n\n const getTenant = () => {\n return context.tenancy.getCurrentTenant();\n };\n\n if (storageOperations.beforeInit) {\n await storageOperations.beforeInit(context);\n }\n\n context.cms = {\n type,\n locale,\n getLocale,\n READ: type === \"read\",\n PREVIEW: type === \"preview\",\n MANAGE: type === \"manage\",\n storageOperations,\n ...createSystemCrud({\n context,\n getTenant,\n getLocale,\n getIdentity,\n storageOperations\n }),\n ...createSettingsCrud({\n context,\n getTenant,\n getLocale,\n storageOperations\n }),\n ...createModelGroupsCrud({\n context,\n getTenant,\n getLocale,\n getIdentity,\n storageOperations\n }),\n ...createModelsCrud({\n context,\n getLocale,\n getTenant,\n getIdentity,\n storageOperations\n }),\n ...createContentEntryCrud({\n context,\n getIdentity,\n getTenant,\n storageOperations\n })\n };\n\n if (!storageOperations.init) {\n return;\n }\n await storageOperations.init(context);\n });\n};\n"],"mappings":";;;;;;;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAMA,aAAa,GAAG,MAAOC,OAAmB,IAA2C;EACvF,MAAMC,OAAO,GAAGD,OAAO,CAACC,OAAO,CAACC,MAAM,CAAsBC,wCAAmB,CAACC,IAAI,CAAC;EAErF,KAAK,MAAMC,MAAM,IAAIJ,OAAO,EAAE;IAC1B,MAAMK,MAAM,GAAG,MAAMD,MAAM,CAACN,aAAa,CAACC,OAAO,CAAC;IAClD,IAAIM,MAAM,KAAK,IAAI,EAAE;MACjB,OAAOA,MAAM;IACjB;EACJ;EACA,MAAM,IAAIC,cAAW,CACjB,oDAAoD,EACpD,2BAA2B,CAC9B;AACL,CAAC;AAMM,MAAMC,mBAAmB,GAAG,CAAC;EAAEC;AAA8B,CAAC,KAAK;EACtE,OAAO,IAAIC,kBAAa,CAAa,MAAMV,OAAO,IAAI;IAClD,MAAM;MAAEI,IAAI;MAAEO;IAAO,CAAC,GAAG,MAAMZ,aAAa,CAACC,OAAO,CAAC;IAErD,MAAMY,SAAS,GAAG,MAAM;MACpB,MAAMC,YAAY,GAAGb,OAAO,CAACc,IAAI,CAACF,SAAS,CAACD,MAAM,CAAC;MACnD,IAAI,CAACE,YAAY,EAAE;QACf,MAAM,I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names":["getParameters","context","plugins","byType","CmsParametersPlugin","type","plugin","result","WebinyError","createContextPlugin","storageOperations","ContextPlugin","locale","getLocale","systemLocale","i18n","getIdentity","security","getTenant","tenancy","getCurrentTenant","register","StorageOperationsCmsModelPlugin","createCmsModelFieldConvertersAttachFactory","benchmark","measure","beforeInit","cms","READ","PREVIEW","MANAGE","createSystemCrud","createSettingsCrud","createModelGroupsCrud","createModelsCrud","createContentEntryCrud","init"],"sources":["context.ts"],"sourcesContent":["import { CmsContext, HeadlessCmsStorageOperations } from \"~/types\";\nimport WebinyError from \"@webiny/error\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { CmsParametersPlugin, CmsParametersPluginResponse } from \"~/plugins/CmsParametersPlugin\";\nimport { createSystemCrud } from \"~/crud/system.crud\";\nimport { createSettingsCrud } from \"~/crud/settings.crud\";\nimport { createModelGroupsCrud } from \"~/crud/contentModelGroup.crud\";\nimport { createModelsCrud } from \"~/crud/contentModel.crud\";\nimport { createContentEntryCrud } from \"~/crud/contentEntry.crud\";\nimport { StorageOperationsCmsModelPlugin } from \"~/plugins\";\nimport { createCmsModelFieldConvertersAttachFactory } from \"~/utils/converters/valueKeyStorageConverter\";\n\nconst getParameters = async (context: CmsContext): Promise<CmsParametersPluginResponse> => {\n const plugins = context.plugins.byType<CmsParametersPlugin>(CmsParametersPlugin.type);\n\n for (const plugin of plugins) {\n const result = await plugin.getParameters(context);\n if (result !== null) {\n return result;\n }\n }\n throw new WebinyError(\n \"Could not determine locale and/or type of the CMS.\",\n \"CMS_LOCALE_AND_TYPE_ERROR\"\n );\n};\n\nexport interface CrudParams {\n storageOperations: HeadlessCmsStorageOperations;\n}\n\nexport const createContextPlugin = ({ storageOperations }: CrudParams) => {\n return new ContextPlugin<CmsContext>(async context => {\n const { type, locale } = await getParameters(context);\n\n const getLocale = () => {\n const systemLocale = context.i18n.getLocale(locale);\n if (!systemLocale) {\n throw new WebinyError(`There is no locale \"${locale}\" in the system.`);\n }\n return systemLocale;\n };\n\n const getIdentity = () => {\n return context.security.getIdentity();\n };\n\n const getTenant = () => {\n return context.tenancy.getCurrentTenant();\n };\n\n context.plugins.register(\n new StorageOperationsCmsModelPlugin(\n createCmsModelFieldConvertersAttachFactory(context.plugins)\n )\n );\n\n await context.benchmark.measure(\"headlessCms.createContext\", async () => {\n await storageOperations.beforeInit(context);\n\n context.cms = {\n type,\n locale,\n getLocale,\n READ: type === \"read\",\n PREVIEW: type === \"preview\",\n MANAGE: type === \"manage\",\n storageOperations,\n ...createSystemCrud({\n context,\n getTenant,\n getLocale,\n getIdentity,\n storageOperations\n }),\n ...createSettingsCrud({\n context,\n getTenant,\n getLocale,\n storageOperations\n }),\n ...createModelGroupsCrud({\n context,\n getTenant,\n getLocale,\n getIdentity,\n storageOperations\n }),\n ...createModelsCrud({\n context,\n getLocale,\n getTenant,\n getIdentity,\n storageOperations\n }),\n ...createContentEntryCrud({\n context,\n getIdentity,\n getTenant,\n getLocale,\n storageOperations\n })\n };\n\n if (!storageOperations.init) {\n return;\n }\n await storageOperations.init(context);\n });\n });\n};\n"],"mappings":";;;;;;;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAMA,aAAa,GAAG,MAAOC,OAAmB,IAA2C;EACvF,MAAMC,OAAO,GAAGD,OAAO,CAACC,OAAO,CAACC,MAAM,CAAsBC,wCAAmB,CAACC,IAAI,CAAC;EAErF,KAAK,MAAMC,MAAM,IAAIJ,OAAO,EAAE;IAC1B,MAAMK,MAAM,GAAG,MAAMD,MAAM,CAACN,aAAa,CAACC,OAAO,CAAC;IAClD,IAAIM,MAAM,KAAK,IAAI,EAAE;MACjB,OAAOA,MAAM;IACjB;EACJ;EACA,MAAM,IAAIC,cAAW,CACjB,oDAAoD,EACpD,2BAA2B,CAC9B;AACL,CAAC;AAMM,MAAMC,mBAAmB,GAAG,CAAC;EAAEC;AAA8B,CAAC,KAAK;EACtE,OAAO,IAAIC,kBAAa,CAAa,MAAMV,OAAO,IAAI;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AW;QACXN;MACJ,CAAC,CAAC,GACC,IAAAwB,8BAAgB,EAAC;QAChBjC,OAAO;QACPY,SAAS;QACTK,SAAS;QACTF,WAAW;QACXN;MACJ,CAAC,CAAC,GACC,IAAAyB,oCAAsB,EAAC;QACtBlC,OAAO;QACPe,WAAW;QACXE,SAAS;QACTL,SAAS;QACTH;MACJ,CAAC,CAAC,CACL;MAED,IAAI,CAACA,iBAAiB,CAAC0B,IAAI,EAAE;QACzB;MACJ;MACA,MAAM1B,iBAAiB,CAAC0B,IAAI,CAACnC,OAAO,CAAC;IACzC,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -1,4 +1,4 @@
1
- import { CmsEntry, CmsModel, CmsContext } from "../../types";
1
+ import { CmsEntry, CmsContext, CmsModel } from "../../types";
2
2
  interface MarkLockedFieldsParams {
3
3
  model: CmsModel;
4
4
  entry: CmsEntry;
@@ -54,6 +54,9 @@ const markLockedFields = async params => {
54
54
  const newLockedFields = existingLockedFields.concat(lockedFields);
55
55
  try {
56
56
  await context.cms.updateModelDirect({
57
+ /**
58
+ * At this point we know this is a CmsModel, so it is safe to cast.
59
+ */
57
60
  original: model,
58
61
  model: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, model), {}, {
59
62
  lockedFields: newLockedFields
@@ -1 +1 @@
1
- {"version":3,"names":["markLockedFields","params","model","context","plugins","byType","CmsModelPlugin","type","find","plugin","contentModel","modelId","cmsLockedFieldPlugins","existingLockedFields","lockedFields","field","fields","baseType","getBaseFieldType","alreadyLocked","some","lockedField","fieldId","storageId","lockedFieldData","lockedFieldPlugins","filter","pl","fieldType","getLockedFieldData","data","push","multipleValues","length","newLockedFields","concat","cms","updateModelDirect","original","ex","WebinyError","message","code","markUnlockedFields"],"sources":["markLockedFields.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsEntry, CmsModel, CmsContext, CmsModelLockedFieldPlugin, LockedField } from \"~/types\";\nimport { CmsModelPlugin } from \"~/plugins/CmsModelPlugin\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface MarkLockedFieldsParams {\n model: CmsModel;\n entry: CmsEntry;\n context: CmsContext;\n}\nexport const markLockedFields = async (params: MarkLockedFieldsParams): Promise<void> => {\n const { model, context } = params;\n /**\n * If the model is registered via a plugin, we don't need do process anything.\n */\n const plugins = context.plugins.byType<CmsModelPlugin>(CmsModelPlugin.type);\n if (plugins.find(plugin => plugin.contentModel.modelId === model.modelId)) {\n return;\n }\n\n const cmsLockedFieldPlugins =\n context.plugins.byType<CmsModelLockedFieldPlugin>(\"cms-model-locked-field\");\n\n const existingLockedFields = model.lockedFields || [];\n const lockedFields: LockedField[] = [];\n for (const field of model.fields) {\n const baseType = getBaseFieldType(field);\n const alreadyLocked = existingLockedFields.some(\n lockedField => lockedField.fieldId === field.storageId\n );\n if (alreadyLocked) {\n continue;\n }\n\n let lockedFieldData = {};\n\n const lockedFieldPlugins = cmsLockedFieldPlugins.filter(pl => pl.fieldType === baseType);\n for (const plugin of lockedFieldPlugins) {\n if (typeof plugin.getLockedFieldData !== \"function\") {\n continue;\n }\n const data = plugin.getLockedFieldData({\n field\n });\n lockedFieldData = { ...lockedFieldData, ...data };\n }\n\n lockedFields.push({\n fieldId: field.storageId,\n multipleValues: !!field.multipleValues,\n type: baseType,\n ...lockedFieldData\n });\n }\n // no need to update anything if no locked fields were added\n if (lockedFields.length === 0) {\n return;\n }\n\n const newLockedFields = existingLockedFields.concat(lockedFields);\n\n try {\n await context.cms.updateModelDirect({\n original: model,\n model: {\n ...model,\n lockedFields: newLockedFields\n }\n });\n model.lockedFields = newLockedFields;\n } catch (ex) {\n throw new WebinyError(\n `Could not update model \"${model.modelId}\" with new locked fields.`,\n \"MODEL_LOCKED_FIELDS_UPDATE_FAILED\",\n {\n message: ex.message,\n code: ex.code,\n data: ex.data\n }\n );\n }\n};\n\nexport interface MarkFieldsUnlockedParams {\n context: CmsContext;\n model: CmsModel;\n}\nexport const markUnlockedFields = async (params: MarkFieldsUnlockedParams) => {\n const { context, model } = params;\n /**\n * If the model is registered via a plugin, we don't need do process anything.\n */\n const plugins = context.plugins.byType<CmsModelPlugin>(CmsModelPlugin.type);\n if (plugins.find(plugin => plugin.contentModel.modelId === model.modelId)) {\n return;\n }\n\n try {\n await context.cms.updateModelDirect({\n original: model,\n model: {\n ...model,\n lockedFields: []\n }\n });\n model.lockedFields = [];\n } catch (ex) {\n throw new WebinyError(\n `Could not update model \"${model.modelId}\" with unlocked fields.`,\n \"MODEL_UNLOCKED_FIELDS_UPDATE_FAILED\",\n {\n message: ex.message,\n code: ex.code,\n data: ex.data\n }\n );\n }\n};\n"],"mappings":";;;;;;;;AAAA;AAEA;AACA;AAOO,MAAMA,gBAAgB,GAAG,MAAOC,MAA8B,IAAoB;EACrF,MAAM;IAAEC,KAAK;IAAEC;EAAQ,CAAC,GAAGF,MAAM;EACjC;AACJ;AACA;EACI,MAAMG,OAAO,GAAGD,OAAO,CAACC,OAAO,CAACC,MAAM,CAAiBC,8BAAc,CAACC,IAAI,CAAC;EAC3E,IAAIH,OAAO,CAACI,IAAI,CAACC,MAAM,IAAIA,MAAM,CAACC,YAAY,CAACC,OAAO,KAAKT,KAAK,CAACS,OAAO,CAAC,EAAE;IACvE;EACJ;EAEA,MAAMC,qBAAqB,GACvBT,OAAO,CAACC,OAAO,CAACC,MAAM,CAA4B,wBAAwB,CAAC;EAE/E,MAAMQ,oBAAoB,GAAGX,KAAK,CAACY,YAAY,IAAI,EAAE;EACrD,MAAMA,YAA2B,GAAG,EAAE;EACtC,KAAK,MAAMC,KAAK,IAAIb,KAAK,CAACc,MAAM,EAAE;IAC9B,MAAMC,QAAQ,GAAG,IAAAC,kCAAgB,EAACH,KAAK,CAAC;IACxC,MAAMI,aAAa,GAAGN,oBAAoB,CAACO,IAAI,CAC3CC,WAAW,IAAIA,WAAW,CAACC,OAAO,KAAKP,KAAK,CAACQ,SAAS,CACzD;IACD,IAAIJ,aAAa,EAAE;MACf;IAC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EAC1E,MAAM;IAAEE,OAAO;IAAED;EAAM,CAAC,GAAGD,MAAM;EACjC;AACJ;AACA;EACI,MAAMG,OAAO,GAAGD,OAAO,CAACC,OAAO,CAACC,MAAM,CAAiBC,8BAAc,CAACC,IAAI,CAAC;EAC3E,IAAIH,OAAO,CAACI,IAAI,CAACC,MAAM,IAAIA,MAAM,CAACC,YAAY,CAACC,OAAO,KAAKT,KAAK,CAACS,OAAO,CAAC,EAAE;IACvE;EACJ;EAEA,IAAI;IACA,MAAMR,OAAO,CAACiC,GAAG,CAACC,iBAAiB,CAAC;MAChCC,QAAQ,EAAEpC,KAAK;MACfA,KAAK,8DACEA,KAAK;QACRY,YAAY,EAAE;MAAE;IAExB,CAAC,CAAC;IACFZ,KAAK,CAACY,YAAY,GAAG,EAAE;EAC3B,CAAC,CAAC,OAAOyB,EAAE,EAAE;IACT,MAAM,IAAIC,cAAW,CAChB,2BAA0BtC,KAAK,CAACS,OAAQ,yBAAwB,EACjE,qCAAqC,EACrC;MACI8B,OAAO,EAAEF,EAAE,CAACE,OAAO;MACnBC,IAAI,EAAEH,EAAE,CAACG,IAAI;MACbZ,IAAI,EAAES,EAAE,CAACT;IACb,CAAC,CACJ;EACL;AACJ,CAAC;AAAC"}
1
+ {"version":3,"names":["markLockedFields","params","model","context","plugins","byType","CmsModelPlugin","type","find","plugin","contentModel","modelId","cmsLockedFieldPlugins","existingLockedFields","lockedFields","field","fields","baseType","getBaseFieldType","alreadyLocked","some","lockedField","fieldId","storageId","lockedFieldData","lockedFieldPlugins","filter","pl","fieldType","getLockedFieldData","data","push","multipleValues","length","newLockedFields","concat","cms","updateModelDirect","original","ex","WebinyError","message","code","markUnlockedFields"],"sources":["markLockedFields.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsEntry, CmsContext, CmsModelLockedFieldPlugin, LockedField, CmsModel } from \"~/types\";\nimport { CmsModelPlugin } from \"~/plugins/CmsModelPlugin\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface MarkLockedFieldsParams {\n model: CmsModel;\n entry: CmsEntry;\n context: CmsContext;\n}\n\nexport const markLockedFields = async (params: MarkLockedFieldsParams): Promise<void> => {\n const { model, context } = params;\n /**\n * If the model is registered via a plugin, we don't need do process anything.\n */\n const plugins = context.plugins.byType<CmsModelPlugin>(CmsModelPlugin.type);\n if (plugins.find(plugin => plugin.contentModel.modelId === model.modelId)) {\n return;\n }\n\n const cmsLockedFieldPlugins =\n context.plugins.byType<CmsModelLockedFieldPlugin>(\"cms-model-locked-field\");\n\n const existingLockedFields = model.lockedFields || [];\n const lockedFields: LockedField[] = [];\n for (const field of model.fields) {\n const baseType = getBaseFieldType(field);\n const alreadyLocked = existingLockedFields.some(\n lockedField => lockedField.fieldId === field.storageId\n );\n if (alreadyLocked) {\n continue;\n }\n\n let lockedFieldData = {};\n\n const lockedFieldPlugins = cmsLockedFieldPlugins.filter(pl => pl.fieldType === baseType);\n for (const plugin of lockedFieldPlugins) {\n if (typeof plugin.getLockedFieldData !== \"function\") {\n continue;\n }\n const data = plugin.getLockedFieldData({\n field\n });\n lockedFieldData = { ...lockedFieldData, ...data };\n }\n\n lockedFields.push({\n fieldId: field.storageId,\n multipleValues: !!field.multipleValues,\n type: baseType,\n ...lockedFieldData\n });\n }\n // no need to update anything if no locked fields were added\n if (lockedFields.length === 0) {\n return;\n }\n\n const newLockedFields = existingLockedFields.concat(lockedFields);\n\n try {\n await context.cms.updateModelDirect({\n /**\n * At this point we know this is a CmsModel, so it is safe to cast.\n */\n original: model as CmsModel,\n model: {\n ...model,\n lockedFields: newLockedFields\n } as CmsModel\n });\n model.lockedFields = newLockedFields;\n } catch (ex) {\n throw new WebinyError(\n `Could not update model \"${model.modelId}\" with new locked fields.`,\n \"MODEL_LOCKED_FIELDS_UPDATE_FAILED\",\n {\n message: ex.message,\n code: ex.code,\n data: ex.data\n }\n );\n }\n};\n\nexport interface MarkFieldsUnlockedParams {\n context: CmsContext;\n model: CmsModel;\n}\n\nexport const markUnlockedFields = async (params: MarkFieldsUnlockedParams) => {\n const { context, model } = params;\n /**\n * If the model is registered via a plugin, we don't need do process anything.\n */\n const plugins = context.plugins.byType<CmsModelPlugin>(CmsModelPlugin.type);\n if (plugins.find(plugin => plugin.contentModel.modelId === model.modelId)) {\n return;\n }\n\n try {\n await context.cms.updateModelDirect({\n original: model as CmsModel,\n model: {\n ...model,\n lockedFields: []\n } as CmsModel\n });\n model.lockedFields = [];\n } catch (ex) {\n throw new WebinyError(\n `Could not update model \"${model.modelId}\" with unlocked fields.`,\n \"MODEL_UNLOCKED_FIELDS_UPDATE_FAILED\",\n {\n message: ex.message,\n code: ex.code,\n data: ex.data\n }\n );\n }\n};\n"],"mappings":";;;;;;;;AAAA;AAEA;AACA;AAQO,MAAMA,gBAAgB,GAAG,MAAOC,MAA8B,IAAoB;EACrF,MAAM;IAAEC,KAAK;IAAEC;EAAQ,CAAC,GAAGF,MAAM;EACjC;AACJ;AACA;EACI,MAAMG,OAAO,GAAGD,OAAO,CAACC,OAAO,CAACC,MAAM,CAAiBC,8BAAc,CAACC,IAAI,CAAC;EAC3E,IAAIH,OAAO,CAACI,IAAI,CAACC,MAAM,IAAIA,MAAM,CAACC,YAAY,CAACC,OAAO,KAAKT,KAAK,CAACS,OAAO,CAAC,EAAE;IACvE;EACJ;EAEA,MAAMC,qBAAqB,GACvBT,OAAO,CAACC,OAAO,CAACC,MAAM,CAA4B,wBAAwB,CAAC;EAE/E,MAAMQ,oBAAoB,GAAGX,KAAK,CAACY,YAAY,IAAI,EAAE;EACrD,MAAMA,YAA2B,GAAG,EAAE;EACtC,KAAK,MAAMC,KAAK,IAAIb,KAAK,CAACc,MAAM,EAAE;IAC9B,MAAMC,QAAQ,GAAG,IAAAC,kCAAgB,EAACH,KAAK,CAAC;IACxC,MAAMI,aAAa,GAAGN,oBAAoB,CAACO,IAAI,CAC3CC,WAAW,IAAIA,WAAW,CAACC,OAAO,KAAKP,KAAK,CAACQ,SAAS,CACzD;IACD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AOK,MAAMa,kBAAkB,GAAG,MAAO1C,MAAgC,IAAK;EAC1E,MAAM;IAAEE,OAAO;IAAED;EAAM,CAAC,GAAGD,MAAM;EACjC;AACJ;AACA;EACI,MAAMG,OAAO,GAAGD,OAAO,CAACC,OAAO,CAACC,MAAM,CAAiBC,8BAAc,CAACC,IAAI,CAAC;EAC3E,IAAIH,OAAO,CAACI,IAAI,CAACC,MAAM,IAAIA,MAAM,CAACC,YAAY,CAACC,OAAO,KAAKT,KAAK,CAACS,OAAO,CAAC,EAAE;IACvE;EACJ;EAEA,IAAI;IACA,MAAMR,OAAO,CAACiC,GAAG,CAACC,iBAAiB,CAAC;MAChCC,QAAQ,EAAEpC,KAAiB;MAC3BA,KAAK,8DACEA,KAAK;QACRY,YAAY,EAAE;MAAE;IAExB,CAAC,CAAC;IACFZ,KAAK,CAACY,YAAY,GAAG,EAAE;EAC3B,CAAC,CAAC,OAAOyB,EAAE,EAAE;IACT,MAAM,IAAIC,cAAW,CAChB,2BAA0BtC,KAAK,CAACS,OAAQ,yBAAwB,EACjE,qCAAqC,EACrC;MACI8B,OAAO,EAAEF,EAAE,CAACE,OAAO;MACnBC,IAAI,EAAEH,EAAE,CAACG,IAAI;MACbZ,IAAI,EAAES,EAAE,CAACT;IACb,CAAC,CACJ;EACL;AACJ,CAAC;AAAC"}
@@ -1,13 +1,16 @@
1
- import { CmsEntryContext, CmsContext, HeadlessCmsStorageOperations } from "../types";
1
+ import { CmsContext, CmsEntryContext, HeadlessCmsStorageOperations } from "../types";
2
2
  import { SecurityIdentity } from "@webiny/api-security/types";
3
3
  import { Tenant } from "@webiny/api-tenancy/types";
4
+ import { I18NLocale } from "@webiny/api-i18n/types";
4
5
  export declare const STATUS_DRAFT = "draft";
5
6
  export declare const STATUS_PUBLISHED = "published";
6
7
  export declare const STATUS_UNPUBLISHED = "unpublished";
7
- export interface CreateContentEntryCrudParams {
8
+ interface CreateContentEntryCrudParams {
8
9
  storageOperations: HeadlessCmsStorageOperations;
9
10
  context: CmsContext;
10
11
  getIdentity: () => SecurityIdentity;
11
12
  getTenant: () => Tenant;
13
+ getLocale: () => I18NLocale;
12
14
  }
13
15
  export declare const createContentEntryCrud: (params: CreateContentEntryCrudParams) => CmsEntryContext;
16
+ export {};