@webiny/api-headless-cms 0.0.0-unstable.df7a8bb475 → 0.0.0-unstable.e2758ee1cf

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 (204) hide show
  1. package/constants.d.ts +2 -1
  2. package/constants.js +4 -0
  3. package/constants.js.map +1 -1
  4. package/crud/contentEntry/entryDataFactories/createEntryData.js +4 -3
  5. package/crud/contentEntry/entryDataFactories/createEntryData.js.map +1 -1
  6. package/crud/contentEntry/entryDataFactories/createEntryRevisionFromData.js +4 -3
  7. package/crud/contentEntry/entryDataFactories/createEntryRevisionFromData.js.map +1 -1
  8. package/crud/contentEntry/entryDataFactories/createPublishEntryData.js +4 -1
  9. package/crud/contentEntry/entryDataFactories/createPublishEntryData.js.map +1 -1
  10. package/crud/contentEntry/entryDataFactories/createRepublishEntryData.js +4 -1
  11. package/crud/contentEntry/entryDataFactories/createRepublishEntryData.js.map +1 -1
  12. package/crud/contentEntry/entryDataFactories/createUnpublishEntryData.js +2 -1
  13. package/crud/contentEntry/entryDataFactories/createUnpublishEntryData.js.map +1 -1
  14. package/crud/contentEntry/entryDataFactories/createUpdateEntryData.js +4 -3
  15. package/crud/contentEntry/entryDataFactories/createUpdateEntryData.js.map +1 -1
  16. package/crud/contentEntry/entryDataFactories/system.d.ts +10 -0
  17. package/crud/contentEntry/entryDataFactories/system.js +14 -0
  18. package/crud/contentEntry/entryDataFactories/system.js.map +1 -0
  19. package/crud/contentEntry/searchableFields.js +6 -2
  20. package/crud/contentEntry/searchableFields.js.map +1 -1
  21. package/crud/contentModel/validation.d.ts +9 -9
  22. package/crud/contentModel/validation.js +3 -3
  23. package/crud/contentModel/validation.js.map +1 -1
  24. package/domain/contentModel/errors.d.ts +1 -1
  25. package/domain/contentModel/errors.js.map +1 -1
  26. package/domain/contentModel/schemas.d.ts +126 -8
  27. package/domain/contentModel/schemas.js +12 -13
  28. package/domain/contentModel/schemas.js.map +1 -1
  29. package/export/graphql/index.js +1 -1
  30. package/export/graphql/index.js.map +1 -1
  31. package/exports/api/cms/model.d.ts +1 -0
  32. package/exports/api/cms/model.js.map +1 -1
  33. package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesUseCase.d.ts +2 -2
  34. package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesUseCase.js +3 -4
  35. package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesUseCase.js.map +1 -1
  36. package/features/contentModel/CreateModel/CreateModelRepository.js +4 -1
  37. package/features/contentModel/CreateModel/CreateModelRepository.js.map +1 -1
  38. package/features/contentModel/CreateModelFrom/CreateModelFromRepository.js +12 -3
  39. package/features/contentModel/CreateModelFrom/CreateModelFromRepository.js.map +1 -1
  40. package/features/contentModel/UpdateModel/UpdateModelRepository.js +8 -2
  41. package/features/contentModel/UpdateModel/UpdateModelRepository.js.map +1 -1
  42. package/features/contentModel/UpdateModel/UpdateModelUseCase.js +4 -1
  43. package/features/contentModel/UpdateModel/UpdateModelUseCase.js.map +1 -1
  44. package/features/modelBuilder/feature.js +6 -0
  45. package/features/modelBuilder/feature.js.map +1 -1
  46. package/features/modelBuilder/fields/BaseFieldBuilder.d.ts +36 -0
  47. package/features/modelBuilder/fields/BaseFieldBuilder.js +41 -0
  48. package/features/modelBuilder/fields/BaseFieldBuilder.js.map +1 -0
  49. package/features/modelBuilder/fields/DataFieldBuilder.d.ts +228 -0
  50. package/features/modelBuilder/fields/DataFieldBuilder.js +219 -0
  51. package/features/modelBuilder/fields/DataFieldBuilder.js.map +1 -0
  52. package/features/modelBuilder/fields/DynamicZoneFieldType.d.ts +2 -2
  53. package/features/modelBuilder/fields/DynamicZoneFieldType.js +10 -3
  54. package/features/modelBuilder/fields/DynamicZoneFieldType.js.map +1 -1
  55. package/features/modelBuilder/fields/FieldBuilder.d.ts +5 -50
  56. package/features/modelBuilder/fields/FieldBuilder.js +3 -165
  57. package/features/modelBuilder/fields/FieldBuilder.js.map +1 -1
  58. package/features/modelBuilder/fields/FieldBuilderRegistry.js +11 -1
  59. package/features/modelBuilder/fields/FieldBuilderRegistry.js.map +1 -1
  60. package/features/modelBuilder/fields/LayoutFieldBuilder.d.ts +7 -0
  61. package/features/modelBuilder/fields/LayoutFieldBuilder.js +9 -0
  62. package/features/modelBuilder/fields/LayoutFieldBuilder.js.map +1 -0
  63. package/features/modelBuilder/fields/ObjectFieldType.d.ts +4 -3
  64. package/features/modelBuilder/fields/ObjectFieldType.js +19 -4
  65. package/features/modelBuilder/fields/ObjectFieldType.js.map +1 -1
  66. package/features/modelBuilder/fields/UiAlertFieldType.d.ts +19 -0
  67. package/features/modelBuilder/fields/UiAlertFieldType.js +36 -0
  68. package/features/modelBuilder/fields/UiAlertFieldType.js.map +1 -0
  69. package/features/modelBuilder/fields/UiSeparatorFieldType.d.ts +17 -0
  70. package/features/modelBuilder/fields/UiSeparatorFieldType.js +31 -0
  71. package/features/modelBuilder/fields/UiSeparatorFieldType.js.map +1 -0
  72. package/features/modelBuilder/fields/UiTabsFieldType.d.ts +28 -0
  73. package/features/modelBuilder/fields/UiTabsFieldType.js +75 -0
  74. package/features/modelBuilder/fields/UiTabsFieldType.js.map +1 -0
  75. package/features/modelBuilder/fields/abstractions.d.ts +2 -2
  76. package/features/modelBuilder/fields/abstractions.js.map +1 -1
  77. package/features/modelBuilder/index.d.ts +3 -0
  78. package/features/modelBuilder/index.js +3 -0
  79. package/features/modelBuilder/index.js.map +1 -1
  80. package/features/modelBuilder/models/BaseModelBuilder.d.ts +9 -4
  81. package/features/modelBuilder/models/BaseModelBuilder.js +19 -0
  82. package/features/modelBuilder/models/BaseModelBuilder.js.map +1 -1
  83. package/features/modelBuilder/models/PrivateModelBuilder.js +4 -2
  84. package/features/modelBuilder/models/PrivateModelBuilder.js.map +1 -1
  85. package/features/modelBuilder/models/PublicModelBuilder.js +16 -4
  86. package/features/modelBuilder/models/PublicModelBuilder.js.map +1 -1
  87. package/graphql/index.js +2 -1
  88. package/graphql/index.js.map +1 -1
  89. package/graphql/schema/baseSchema.js +17 -15
  90. package/graphql/schema/baseSchema.js.map +1 -1
  91. package/graphql/schema/cms/createEntryResolver.d.ts +10 -0
  92. package/graphql/schema/cms/createEntryResolver.js +56 -0
  93. package/graphql/schema/cms/createEntryResolver.js.map +1 -0
  94. package/graphql/schema/cms/deleteEntryResolver.d.ts +10 -0
  95. package/graphql/schema/cms/deleteEntryResolver.js +56 -0
  96. package/graphql/schema/cms/deleteEntryResolver.js.map +1 -0
  97. package/graphql/schema/cms/getEntryResolver.d.ts +11 -0
  98. package/graphql/schema/cms/getEntryResolver.js +58 -0
  99. package/graphql/schema/cms/getEntryResolver.js.map +1 -0
  100. package/graphql/schema/cms/helpers/buildFieldsSelection.d.ts +23 -0
  101. package/graphql/schema/cms/helpers/buildFieldsSelection.js +79 -0
  102. package/graphql/schema/cms/helpers/buildFieldsSelection.js.map +1 -0
  103. package/graphql/schema/cms/helpers/getErrorMessage.d.ts +4 -0
  104. package/graphql/schema/cms/helpers/getErrorMessage.js +14 -0
  105. package/graphql/schema/cms/helpers/getErrorMessage.js.map +1 -0
  106. package/graphql/schema/cms/helpers/getModel.d.ts +6 -0
  107. package/graphql/schema/cms/helpers/getModel.js +12 -0
  108. package/graphql/schema/cms/helpers/getModel.js.map +1 -0
  109. package/graphql/schema/cms/helpers/index.d.ts +5 -0
  110. package/graphql/schema/cms/helpers/index.js +7 -0
  111. package/graphql/schema/cms/helpers/index.js.map +1 -0
  112. package/graphql/schema/cms/helpers/transformSortToArray.d.ts +18 -0
  113. package/graphql/schema/cms/helpers/transformSortToArray.js +38 -0
  114. package/graphql/schema/cms/helpers/transformSortToArray.js.map +1 -0
  115. package/graphql/schema/cms/helpers/transformWhereToNested.d.ts +17 -0
  116. package/graphql/schema/cms/helpers/transformWhereToNested.js +54 -0
  117. package/graphql/schema/cms/helpers/transformWhereToNested.js.map +1 -0
  118. package/graphql/schema/cms/helpers.d.ts +5 -0
  119. package/graphql/schema/cms/helpers.js +7 -0
  120. package/graphql/schema/cms/helpers.js.map +1 -0
  121. package/graphql/schema/cms/index.d.ts +2 -0
  122. package/graphql/schema/cms/index.js +26 -0
  123. package/graphql/schema/cms/index.js.map +1 -0
  124. package/graphql/schema/cms/listEntriesResolver.d.ts +14 -0
  125. package/graphql/schema/cms/listEntriesResolver.js +97 -0
  126. package/graphql/schema/cms/listEntriesResolver.js.map +1 -0
  127. package/graphql/schema/cms/publishEntryResolver.d.ts +10 -0
  128. package/graphql/schema/cms/publishEntryResolver.js +56 -0
  129. package/graphql/schema/cms/publishEntryResolver.js.map +1 -0
  130. package/graphql/schema/cms/resolvers/createEntry.d.ts +8 -0
  131. package/graphql/schema/cms/resolvers/createEntry.js +17 -0
  132. package/graphql/schema/cms/resolvers/createEntry.js.map +1 -0
  133. package/graphql/schema/cms/resolvers/deleteEntryRevision.d.ts +8 -0
  134. package/graphql/schema/cms/resolvers/deleteEntryRevision.js +17 -0
  135. package/graphql/schema/cms/resolvers/deleteEntryRevision.js.map +1 -0
  136. package/graphql/schema/cms/resolvers/getEntry.d.ts +8 -0
  137. package/graphql/schema/cms/resolvers/getEntry.js +17 -0
  138. package/graphql/schema/cms/resolvers/getEntry.js.map +1 -0
  139. package/graphql/schema/cms/resolvers/index.d.ts +9 -0
  140. package/graphql/schema/cms/resolvers/index.js +11 -0
  141. package/graphql/schema/cms/resolvers/index.js.map +1 -0
  142. package/graphql/schema/cms/resolvers/listEntries.d.ts +8 -0
  143. package/graphql/schema/cms/resolvers/listEntries.js +17 -0
  144. package/graphql/schema/cms/resolvers/listEntries.js.map +1 -0
  145. package/graphql/schema/cms/resolvers/mutationCms.d.ts +8 -0
  146. package/graphql/schema/cms/resolvers/mutationCms.js +24 -0
  147. package/graphql/schema/cms/resolvers/mutationCms.js.map +1 -0
  148. package/graphql/schema/cms/resolvers/publishEntryRevision.d.ts +8 -0
  149. package/graphql/schema/cms/resolvers/publishEntryRevision.js +17 -0
  150. package/graphql/schema/cms/resolvers/publishEntryRevision.js.map +1 -0
  151. package/graphql/schema/cms/resolvers/queryCms.d.ts +8 -0
  152. package/graphql/schema/cms/resolvers/queryCms.js +23 -0
  153. package/graphql/schema/cms/resolvers/queryCms.js.map +1 -0
  154. package/graphql/schema/cms/resolvers/unpublishEntryRevision.d.ts +8 -0
  155. package/graphql/schema/cms/resolvers/unpublishEntryRevision.js +17 -0
  156. package/graphql/schema/cms/resolvers/unpublishEntryRevision.js.map +1 -0
  157. package/graphql/schema/cms/resolvers/updateEntryRevision.d.ts +8 -0
  158. package/graphql/schema/cms/resolvers/updateEntryRevision.js +17 -0
  159. package/graphql/schema/cms/resolvers/updateEntryRevision.js.map +1 -0
  160. package/graphql/schema/cms/typeDefs/index.d.ts +3 -0
  161. package/graphql/schema/cms/typeDefs/index.js +5 -0
  162. package/graphql/schema/cms/typeDefs/index.js.map +1 -0
  163. package/graphql/schema/cms/typeDefs/mutation.d.ts +8 -0
  164. package/graphql/schema/cms/typeDefs/mutation.js +42 -0
  165. package/graphql/schema/cms/typeDefs/mutation.js.map +1 -0
  166. package/graphql/schema/cms/typeDefs/query.d.ts +8 -0
  167. package/graphql/schema/cms/typeDefs/query.js +35 -0
  168. package/graphql/schema/cms/typeDefs/query.js.map +1 -0
  169. package/graphql/schema/cms/typeDefs/responses.d.ts +8 -0
  170. package/graphql/schema/cms/typeDefs/responses.js +35 -0
  171. package/graphql/schema/cms/typeDefs/responses.js.map +1 -0
  172. package/graphql/schema/cms/unpublishEntryResolver.d.ts +10 -0
  173. package/graphql/schema/cms/unpublishEntryResolver.js +56 -0
  174. package/graphql/schema/cms/unpublishEntryResolver.js.map +1 -0
  175. package/graphql/schema/cms/updateEntryResolver.d.ts +11 -0
  176. package/graphql/schema/cms/updateEntryResolver.js +58 -0
  177. package/graphql/schema/cms/updateEntryResolver.js.map +1 -0
  178. package/graphql/schema/contentModels.js +21 -3
  179. package/graphql/schema/contentModels.js.map +1 -1
  180. package/graphql/schema/createManageSDL.js +4 -2
  181. package/graphql/schema/createManageSDL.js.map +1 -1
  182. package/graphqlFields/index.js.map +1 -1
  183. package/package.json +24 -23
  184. package/plugins/CmsModelPlugin.js +19 -4
  185. package/plugins/CmsModelPlugin.js.map +1 -1
  186. package/types/fields/objectField.d.ts +2 -0
  187. package/types/fields/objectField.js.map +1 -1
  188. package/types/model.d.ts +32 -3
  189. package/types/model.js.map +1 -1
  190. package/types/modelField.d.ts +19 -3
  191. package/types/modelField.js.map +1 -1
  192. package/types/types.d.ts +12 -9
  193. package/types/types.js.map +1 -1
  194. package/utils/createModelField.js +4 -2
  195. package/utils/createModelField.js.map +1 -1
  196. package/crud/contentEntry/entryDataFactories/state.d.ts +0 -10
  197. package/crud/contentEntry/entryDataFactories/state.js +0 -16
  198. package/crud/contentEntry/entryDataFactories/state.js.map +0 -1
  199. package/crud/contentModel/validateModel.d.ts +0 -9
  200. package/crud/contentModel/validateModel.js +0 -21
  201. package/crud/contentModel/validateModel.js.map +0 -1
  202. package/crud/contentModel/validateModelFields.d.ts +0 -9
  203. package/crud/contentModel/validateModelFields.js +0 -267
  204. package/crud/contentModel/validateModelFields.js.map +0 -1
@@ -1,10 +0,0 @@
1
- import type { CmsEntry, IEntryState } from "../../../types/index.js";
2
- interface IInputWithPossibleState {
3
- state: Partial<IEntryState> | null;
4
- }
5
- interface IParams {
6
- input: Partial<IInputWithPossibleState>;
7
- original?: CmsEntry | null;
8
- }
9
- export declare const getState: ({ input, original }: IParams) => IEntryState | undefined;
10
- export {};
@@ -1,16 +0,0 @@
1
- export const getState = ({
2
- input,
3
- original
4
- }) => {
5
- if (!input?.state?.stepId || !input.state.state || !input.state.stepName || !input.state.workflowId) {
6
- return original?.state;
7
- }
8
- return {
9
- workflowId: input.state.workflowId,
10
- stepId: input.state.stepId,
11
- stepName: input.state.stepName,
12
- state: input.state.state
13
- };
14
- };
15
-
16
- //# sourceMappingURL=state.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["getState","input","original","state","stepId","stepName","workflowId"],"sources":["state.ts"],"sourcesContent":["import type { CmsEntry, IEntryState } from \"~/types/index.js\";\n\ninterface IInputWithPossibleState {\n state: Partial<IEntryState> | null;\n}\ninterface IParams {\n input: Partial<IInputWithPossibleState>;\n original?: CmsEntry | null;\n}\n\nexport const getState = ({ input, original }: IParams): IEntryState | undefined => {\n if (\n !input?.state?.stepId ||\n !input.state.state ||\n !input.state.stepName ||\n !input.state.workflowId\n ) {\n return original?.state;\n }\n return {\n workflowId: input.state.workflowId,\n stepId: input.state.stepId,\n stepName: input.state.stepName,\n state: input.state.state\n };\n};\n"],"mappings":"AAUA,OAAO,MAAMA,QAAQ,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAkB,CAAC,KAA8B;EAC/E,IACI,CAACD,KAAK,EAAEE,KAAK,EAAEC,MAAM,IACrB,CAACH,KAAK,CAACE,KAAK,CAACA,KAAK,IAClB,CAACF,KAAK,CAACE,KAAK,CAACE,QAAQ,IACrB,CAACJ,KAAK,CAACE,KAAK,CAACG,UAAU,EACzB;IACE,OAAOJ,QAAQ,EAAEC,KAAK;EAC1B;EACA,OAAO;IACHG,UAAU,EAAEL,KAAK,CAACE,KAAK,CAACG,UAAU;IAClCF,MAAM,EAAEH,KAAK,CAACE,KAAK,CAACC,MAAM;IAC1BC,QAAQ,EAAEJ,KAAK,CAACE,KAAK,CAACE,QAAQ;IAC9BF,KAAK,EAAEF,KAAK,CAACE,KAAK,CAACA;EACvB,CAAC;AACL,CAAC","ignoreList":[]}
@@ -1,9 +0,0 @@
1
- import type { CmsContext, CmsModel } from "../../types/index.js";
2
- interface ValidateModelParams {
3
- models: CmsModel[];
4
- model: CmsModel;
5
- original?: CmsModel;
6
- context: CmsContext;
7
- }
8
- export declare const validateModel: (params: ValidateModelParams) => Promise<void>;
9
- export {};
@@ -1,21 +0,0 @@
1
- import WebinyError from "@webiny/error";
2
- import { CmsModelPlugin } from "../../plugins/CmsModelPlugin.js";
3
- import { validateModelFields } from "./validateModelFields.js";
4
- export const validateModel = async params => {
5
- const {
6
- model,
7
- context
8
- } = params;
9
- const {
10
- plugins
11
- } = context;
12
- const modelPlugin = plugins.byType(CmsModelPlugin.type).find(item => item.contentModel.modelId === model.modelId);
13
- if (modelPlugin) {
14
- throw new WebinyError("Content models defined via plugins cannot be updated.", "CONTENT_MODEL_UPDATE_ERROR", {
15
- modelId: model.modelId
16
- });
17
- }
18
- await validateModelFields(params);
19
- };
20
-
21
- //# sourceMappingURL=validateModel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["WebinyError","CmsModelPlugin","validateModelFields","validateModel","params","model","context","plugins","modelPlugin","byType","type","find","item","contentModel","modelId"],"sources":["validateModel.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsModelPlugin } from \"~/plugins/CmsModelPlugin.js\";\nimport type { CmsContext, CmsModel } from \"~/types/index.js\";\nimport { validateModelFields } from \"./validateModelFields.js\";\n\ninterface ValidateModelParams {\n models: CmsModel[];\n model: CmsModel;\n original?: CmsModel;\n context: CmsContext;\n}\n\nexport const validateModel = async (params: ValidateModelParams): Promise<void> => {\n const { model, context } = params;\n\n const { plugins } = context;\n\n const modelPlugin = plugins\n .byType<CmsModelPlugin>(CmsModelPlugin.type)\n .find(item => item.contentModel.modelId === model.modelId);\n\n if (modelPlugin) {\n throw new WebinyError(\n \"Content models defined via plugins cannot be updated.\",\n \"CONTENT_MODEL_UPDATE_ERROR\",\n {\n modelId: model.modelId\n }\n );\n }\n\n await validateModelFields(params);\n};\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,cAAc;AAEvB,SAASC,mBAAmB;AAS5B,OAAO,MAAMC,aAAa,GAAG,MAAOC,MAA2B,IAAoB;EAC/E,MAAM;IAAEC,KAAK;IAAEC;EAAQ,CAAC,GAAGF,MAAM;EAEjC,MAAM;IAAEG;EAAQ,CAAC,GAAGD,OAAO;EAE3B,MAAME,WAAW,GAAGD,OAAO,CACtBE,MAAM,CAAiBR,cAAc,CAACS,IAAI,CAAC,CAC3CC,IAAI,CAACC,IAAI,IAAIA,IAAI,CAACC,YAAY,CAACC,OAAO,KAAKT,KAAK,CAACS,OAAO,CAAC;EAE9D,IAAIN,WAAW,EAAE;IACb,MAAM,IAAIR,WAAW,CACjB,uDAAuD,EACvD,4BAA4B,EAC5B;MACIc,OAAO,EAAET,KAAK,CAACS;IACnB,CACJ,CAAC;EACL;EAEA,MAAMZ,mBAAmB,CAACE,MAAM,CAAC;AACrC,CAAC","ignoreList":[]}
@@ -1,9 +0,0 @@
1
- import type { CmsContext, CmsModel } from "../../types/index.js";
2
- interface ValidateModelFieldsParams {
3
- models: CmsModel[];
4
- model: CmsModel;
5
- original?: CmsModel;
6
- context: CmsContext;
7
- }
8
- export declare const validateModelFields: (params: ValidateModelFieldsParams) => Promise<void>;
9
- export {};
@@ -1,267 +0,0 @@
1
- import gql from "graphql-tag";
2
- import WebinyError from "@webiny/error";
3
- import { createManageSDL } from "../../graphql/schema/createManageSDL.js";
4
- import { createFieldStorageId } from "./createFieldStorageId.js";
5
- import { getBaseFieldType } from "../../utils/getBaseFieldType.js";
6
- import { getContentModelTitleFieldId } from "./fields/titleField.js";
7
- import { getContentModelDescriptionFieldId } from "./fields/descriptionField.js";
8
- import { getContentModelImageFieldId } from "./fields/imageField.js";
9
- import { CmsGraphQLSchemaPlugin, CmsGraphQLSchemaSorterPlugin } from "../../plugins/index.js";
10
- import { buildSchemaPlugins } from "../../graphql/buildSchemaPlugins.js";
11
- import { createExecutableSchema } from "../../graphql/createExecutableSchema.js";
12
- import { generateAlphaNumericId } from "@webiny/utils";
13
- const extractInvalidField = (model, err) => {
14
- const sdl = err.source?.body || "";
15
-
16
- /**
17
- * Find the invalid type
18
- */
19
- const {
20
- line: lineNumber
21
- } = err.locations ? err.locations[0] : {
22
- line: 0
23
- };
24
- const sdlLines = sdl.split("\n");
25
- let sdlLine;
26
- let gqlType;
27
- for (let i = lineNumber; i > 0; i--) {
28
- if (sdlLine && sdlLine.includes("type ")) {
29
- gqlType = sdlLine.match(/type\s+(.*?)\s+{/);
30
- break;
31
- }
32
- sdlLine = sdlLines[i];
33
- }
34
- let invalidField = undefined;
35
- if (Array.isArray(gqlType)) {
36
- const fieldRegex = new RegExp(`([^\\s+].*?):\\s+\\[?${gqlType[1]}!?\\]?`);
37
- const matched = sdl.match(fieldRegex);
38
- if (matched) {
39
- invalidField = matched[1];
40
- }
41
- }
42
- let message = `See more details in the browser console.`;
43
- if (invalidField) {
44
- message = `Please review the definition of "${invalidField}" field.`;
45
- }
46
- return {
47
- data: {
48
- modelId: model.modelId,
49
- sdl,
50
- invalidField
51
- },
52
- code: "INVALID_MODEL_DEFINITION",
53
- message: [`Model "${model.modelId}" was not saved!`, message].join("\n")
54
- };
55
- };
56
- const createValidateChildFields = plugins => {
57
- return ({
58
- fields,
59
- originalFields
60
- }) => {
61
- if (fields.length === 0 && originalFields.length === 0) {
62
- return;
63
- }
64
- validateFields({
65
- fields,
66
- originalFields,
67
- plugins
68
- });
69
- };
70
- };
71
- const validateFields = params => {
72
- const {
73
- plugins,
74
- fields,
75
- originalFields
76
- } = params;
77
- const idList = [];
78
- const fieldIdList = [];
79
- const storageIdList = [];
80
- for (const field of fields) {
81
- const baseType = getBaseFieldType(field);
82
- const plugin = plugins.find(plugin => plugin.fieldType === baseType);
83
- if (!plugin) {
84
- throw new Error(`Cannot update content model because of the unknown "${baseType}" field.`);
85
- }
86
- /**
87
- * Check the field's id against existing ones.
88
- * There cannot be two fields with the same id.
89
- */
90
- if (idList.includes(field.id)) {
91
- throw new WebinyError(`Cannot update content model because field "${field.storageId || field.fieldId}" has id "${field.id}", which is already used.`);
92
- }
93
- idList.push(field.id);
94
- const originalField = originalFields.find(f => f.id === field.id);
95
- /**
96
- * Field MUST have an fieldId defined.
97
- */
98
- if (!field.fieldId) {
99
- throw new WebinyError(`Field does not have an "fieldId" defined.`, "MISSING_FIELD_ID", {
100
- field
101
- });
102
- }
103
- /**
104
- * If storageId does not match a certain pattern, add that pattern, but only if field is not locked (used) already.
105
- * This is to avoid errors in the already installed systems.
106
- *
107
- * Why are we using the @?
108
- *
109
- * It is not part of special characters for the query syntax in the Lucene.
110
- *
111
- * Relevant links:
112
- * https://lucene.apache.org/core/3_4_0/queryparsersyntax.html
113
- * https://discuss.elastic.co/t/special-characters-in-field-names/10658/3
114
- * https://discuss.elastic.co/t/illegal-characters-in-elasticsearch-field-names/17196/2
115
- */
116
- if (!field.storageId) {
117
- /**
118
- * When having original field, just set the storageId to value from the originalField
119
- */
120
- //
121
- if (originalField) {
122
- field.storageId = originalField.storageId;
123
- } else {
124
- field.storageId = createFieldStorageId(field);
125
- }
126
- }
127
- /**
128
- * Check the field's fieldId against existing ones.
129
- * There cannot be two fields with the same fieldId - outside world identifier.
130
- */
131
- if (fieldIdList.includes(field.fieldId)) {
132
- throw new WebinyError(`Cannot update content model because field "${field.storageId}" has fieldId "${field.fieldId}", which is already used.`);
133
- }
134
- fieldIdList.push(field.fieldId);
135
- /**
136
- * Check the field's storageId against the existing ones.
137
- * There cannot be two fields with the same storageId.
138
- */
139
- if (storageIdList.includes(field.storageId)) {
140
- throw new WebinyError(`Cannot update content model because field "${field.label}" has storageId "${field.storageId}", which is already used.`);
141
- }
142
- storageIdList.push(field.storageId);
143
- /**
144
- * There might be some plugins which allow child fields.
145
- * We use this method to validate them as well.
146
- */
147
- if (!plugin.validateChildFields) {
148
- continue;
149
- }
150
- const validateChildFields = createValidateChildFields(plugins);
151
- plugin.validateChildFields({
152
- field,
153
- originalField,
154
- validate: validateChildFields
155
- });
156
- }
157
- };
158
- const createGraphQLSchema = async params => {
159
- const {
160
- context,
161
- model
162
- } = params;
163
- const models = await context.security.withoutAuthorization(async () => {
164
- return (await context.cms.listModels()).filter(model => {
165
- return model.isPrivate !== true;
166
- });
167
- });
168
- const modelPlugins = await buildSchemaPlugins({
169
- context,
170
- models: models.concat([model])
171
- });
172
- const plugins = context.plugins.byType(CmsGraphQLSchemaPlugin.type).filter(plugin => plugin.isApplicable(context)).reduce((collection, plugin) => {
173
- const name = plugin.name || `${CmsGraphQLSchemaPlugin.type}-${generateAlphaNumericId(16)}`;
174
- collection[name] = plugin;
175
- return collection;
176
- }, {});
177
- for (const plugin of modelPlugins) {
178
- const name = plugin.name || `${plugin.type}-${generateAlphaNumericId(16)}`;
179
- plugins[name] = plugin;
180
- }
181
- return createExecutableSchema({
182
- plugins: Object.values(plugins)
183
- });
184
- };
185
- const extractErrorObject = error => {
186
- return ["message", "code", "data", "stack"].reduce((output, key) => {
187
- if (!error[key]) {
188
- return output;
189
- }
190
- output[key] = error[key];
191
- return output;
192
- }, {});
193
- };
194
- export const validateModelFields = async params => {
195
- const {
196
- models,
197
- model,
198
- original,
199
- context
200
- } = params;
201
- const {
202
- titleFieldId,
203
- descriptionFieldId,
204
- imageFieldId
205
- } = model;
206
- const {
207
- plugins
208
- } = context;
209
-
210
- /**
211
- * There should be fields/locked fields in either model or data to be updated.
212
- */
213
- const {
214
- fields = []
215
- } = model;
216
-
217
- /**
218
- * Let's inspect the fields of the received content model. We prevent saving of a content model if it
219
- * contains a field for which a "cms-model-field-to-graphql" plugin does not exist on the backend.
220
- */
221
- const fieldTypePlugins = plugins.byType("cms-model-field-to-graphql");
222
- validateFields({
223
- fields,
224
- originalFields: original?.fields || [],
225
- plugins: fieldTypePlugins
226
- });
227
- if (fields.length) {
228
- const sorterPlugins = plugins.byType(CmsGraphQLSchemaSorterPlugin.type);
229
- /**
230
- * Make sure that this model can be safely converted to a GraphQL SDL
231
- */
232
- const schema = createManageSDL({
233
- models,
234
- model,
235
- fieldTypePlugins: fieldTypePlugins.reduce((acc, pl) => ({
236
- ...acc,
237
- [pl.fieldType]: pl
238
- }), {}),
239
- sorterPlugins
240
- });
241
- try {
242
- gql(schema);
243
- } catch (err) {
244
- throw new WebinyError(extractInvalidField(model, err));
245
- }
246
- try {
247
- await createGraphQLSchema({
248
- context,
249
- model
250
- });
251
- } catch (err) {
252
- throw new WebinyError({
253
- message: "Cannot generate GraphQL schema when testing with the given model. Please check the response for more details.",
254
- code: "GRAPHQL_SCHEMA_ERROR",
255
- data: {
256
- modelId: model.modelId,
257
- error: extractErrorObject(err)
258
- }
259
- });
260
- }
261
- }
262
- model.titleFieldId = getContentModelTitleFieldId(fields, titleFieldId);
263
- model.descriptionFieldId = getContentModelDescriptionFieldId(fields, descriptionFieldId);
264
- model.imageFieldId = getContentModelImageFieldId(fields, imageFieldId);
265
- };
266
-
267
- //# sourceMappingURL=validateModelFields.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["gql","WebinyError","createManageSDL","createFieldStorageId","getBaseFieldType","getContentModelTitleFieldId","getContentModelDescriptionFieldId","getContentModelImageFieldId","CmsGraphQLSchemaPlugin","CmsGraphQLSchemaSorterPlugin","buildSchemaPlugins","createExecutableSchema","generateAlphaNumericId","extractInvalidField","model","err","sdl","source","body","line","lineNumber","locations","sdlLines","split","sdlLine","gqlType","i","includes","match","invalidField","undefined","Array","isArray","fieldRegex","RegExp","matched","message","data","modelId","code","join","createValidateChildFields","plugins","fields","originalFields","length","validateFields","params","idList","fieldIdList","storageIdList","field","baseType","plugin","find","fieldType","Error","id","storageId","fieldId","push","originalField","f","label","validateChildFields","validate","createGraphQLSchema","context","models","security","withoutAuthorization","cms","listModels","filter","isPrivate","modelPlugins","concat","byType","type","isApplicable","reduce","collection","name","Object","values","extractErrorObject","error","output","key","validateModelFields","original","titleFieldId","descriptionFieldId","imageFieldId","fieldTypePlugins","sorterPlugins","schema","acc","pl"],"sources":["validateModelFields.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport WebinyError from \"@webiny/error\";\nimport type {\n CmsContext,\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin,\n CmsModelFieldToGraphQLPluginValidateChildFieldsValidate\n} from \"~/types/index.js\";\nimport { createManageSDL } from \"~/graphql/schema/createManageSDL.js\";\nimport { createFieldStorageId } from \"./createFieldStorageId.js\";\nimport type { GraphQLError } from \"graphql\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType.js\";\nimport { getContentModelTitleFieldId } from \"./fields/titleField.js\";\nimport { getContentModelDescriptionFieldId } from \"./fields/descriptionField.js\";\nimport { getContentModelImageFieldId } from \"./fields/imageField.js\";\nimport type { ICmsGraphQLSchemaPlugin } from \"~/plugins/index.js\";\nimport { CmsGraphQLSchemaPlugin, CmsGraphQLSchemaSorterPlugin } from \"~/plugins/index.js\";\nimport { buildSchemaPlugins } from \"~/graphql/buildSchemaPlugins.js\";\nimport { createExecutableSchema } from \"~/graphql/createExecutableSchema.js\";\nimport { generateAlphaNumericId } from \"@webiny/utils\";\n\nconst extractInvalidField = (model: CmsModel, err: GraphQLError) => {\n const sdl = err.source?.body || \"\";\n\n /**\n * Find the invalid type\n */\n const { line: lineNumber } = err.locations\n ? err.locations[0]\n : {\n line: 0\n };\n const sdlLines = sdl.split(\"\\n\");\n let sdlLine;\n let gqlType;\n for (let i = lineNumber; i > 0; i--) {\n if (sdlLine && sdlLine.includes(\"type \")) {\n gqlType = sdlLine.match(/type\\s+(.*?)\\s+{/);\n break;\n }\n\n sdlLine = sdlLines[i];\n }\n\n let invalidField: string | undefined = undefined;\n if (Array.isArray(gqlType)) {\n const fieldRegex = new RegExp(`([^\\\\s+].*?):\\\\s+\\\\[?${gqlType[1]}!?\\\\]?`);\n\n const matched = sdl.match(fieldRegex);\n if (matched) {\n invalidField = matched[1];\n }\n }\n\n let message = `See more details in the browser console.`;\n if (invalidField) {\n message = `Please review the definition of \"${invalidField}\" field.`;\n }\n\n return {\n data: {\n modelId: model.modelId,\n sdl,\n invalidField\n },\n code: \"INVALID_MODEL_DEFINITION\",\n message: [`Model \"${model.modelId}\" was not saved!`, message].join(\"\\n\")\n };\n};\n\nconst createValidateChildFields = (\n plugins: CmsModelFieldToGraphQLPlugin[]\n): CmsModelFieldToGraphQLPluginValidateChildFieldsValidate => {\n return ({ fields, originalFields }) => {\n if (fields.length === 0 && originalFields.length === 0) {\n return;\n }\n validateFields({\n fields,\n originalFields,\n plugins\n });\n };\n};\n\ninterface ValidateFieldsParams {\n plugins: CmsModelFieldToGraphQLPlugin[];\n fields: CmsModelField[];\n originalFields: CmsModelField[];\n}\n\nconst validateFields = (params: ValidateFieldsParams) => {\n const { plugins, fields, originalFields } = params;\n\n const idList: string[] = [];\n const fieldIdList: string[] = [];\n const storageIdList: string[] = [];\n\n for (const field of fields) {\n const baseType = getBaseFieldType(field);\n const plugin = plugins.find(plugin => plugin.fieldType === baseType);\n\n if (!plugin) {\n throw new Error(\n `Cannot update content model because of the unknown \"${baseType}\" field.`\n );\n }\n /**\n * Check the field's id against existing ones.\n * There cannot be two fields with the same id.\n */\n if (idList.includes(field.id)) {\n throw new WebinyError(\n `Cannot update content model because field \"${\n field.storageId || field.fieldId\n }\" has id \"${field.id}\", which is already used.`\n );\n }\n idList.push(field.id);\n\n const originalField = originalFields.find(f => f.id === field.id);\n /**\n * Field MUST have an fieldId defined.\n */\n if (!field.fieldId) {\n throw new WebinyError(`Field does not have an \"fieldId\" defined.`, \"MISSING_FIELD_ID\", {\n field\n });\n }\n /**\n * If storageId does not match a certain pattern, add that pattern, but only if field is not locked (used) already.\n * This is to avoid errors in the already installed systems.\n *\n * Why are we using the @?\n *\n * It is not part of special characters for the query syntax in the Lucene.\n *\n * Relevant links:\n * https://lucene.apache.org/core/3_4_0/queryparsersyntax.html\n * https://discuss.elastic.co/t/special-characters-in-field-names/10658/3\n * https://discuss.elastic.co/t/illegal-characters-in-elasticsearch-field-names/17196/2\n */\n if (!field.storageId) {\n /**\n * When having original field, just set the storageId to value from the originalField\n */\n //\n if (originalField) {\n field.storageId = originalField.storageId;\n } else {\n field.storageId = createFieldStorageId(field);\n }\n }\n /**\n * Check the field's fieldId against existing ones.\n * There cannot be two fields with the same fieldId - outside world identifier.\n */\n if (fieldIdList.includes(field.fieldId)) {\n throw new WebinyError(\n `Cannot update content model because field \"${field.storageId}\" has fieldId \"${field.fieldId}\", which is already used.`\n );\n }\n fieldIdList.push(field.fieldId);\n /**\n * Check the field's storageId against the existing ones.\n * There cannot be two fields with the same storageId.\n */\n if (storageIdList.includes(field.storageId)) {\n throw new WebinyError(\n `Cannot update content model because field \"${field.label}\" has storageId \"${field.storageId}\", which is already used.`\n );\n }\n storageIdList.push(field.storageId);\n /**\n * There might be some plugins which allow child fields.\n * We use this method to validate them as well.\n */\n if (!plugin.validateChildFields) {\n continue;\n }\n const validateChildFields = createValidateChildFields(plugins);\n plugin.validateChildFields({\n field,\n originalField,\n validate: validateChildFields\n });\n }\n};\n\ninterface CreateGraphQLSchemaParams {\n context: CmsContext;\n model: CmsModel;\n}\n\nconst createGraphQLSchema = async (params: CreateGraphQLSchemaParams): Promise<any> => {\n const { context, model } = params;\n\n const models = await context.security.withoutAuthorization(async () => {\n return (await context.cms.listModels()).filter((model): model is CmsModel => {\n return model.isPrivate !== true;\n });\n });\n\n const modelPlugins = await buildSchemaPlugins({\n context,\n models: models.concat([model])\n });\n\n const plugins = context.plugins\n .byType<ICmsGraphQLSchemaPlugin>(CmsGraphQLSchemaPlugin.type)\n .filter(plugin => plugin.isApplicable(context))\n .reduce<Record<string, ICmsGraphQLSchemaPlugin>>((collection, plugin) => {\n const name =\n plugin.name || `${CmsGraphQLSchemaPlugin.type}-${generateAlphaNumericId(16)}`;\n collection[name] = plugin;\n return collection;\n }, {});\n for (const plugin of modelPlugins) {\n const name = plugin.name || `${plugin.type}-${generateAlphaNumericId(16)}`;\n plugins[name] = plugin;\n }\n\n return createExecutableSchema({\n plugins: Object.values(plugins)\n });\n};\n\nconst extractErrorObject = (error: any) => {\n return [\"message\", \"code\", \"data\", \"stack\"].reduce<Record<string, any>>((output, key) => {\n if (!error[key]) {\n return output;\n }\n output[key] = error[key];\n return output;\n }, {});\n};\n\ninterface ValidateModelFieldsParams {\n models: CmsModel[];\n model: CmsModel;\n original?: CmsModel;\n context: CmsContext;\n}\n\nexport const validateModelFields = async (params: ValidateModelFieldsParams): Promise<void> => {\n const { models, model, original, context } = params;\n const { titleFieldId, descriptionFieldId, imageFieldId } = model;\n const { plugins } = context;\n\n /**\n * There should be fields/locked fields in either model or data to be updated.\n */\n const { fields = [] } = model;\n\n /**\n * Let's inspect the fields of the received content model. We prevent saving of a content model if it\n * contains a field for which a \"cms-model-field-to-graphql\" plugin does not exist on the backend.\n */\n const fieldTypePlugins = plugins.byType<CmsModelFieldToGraphQLPlugin>(\n \"cms-model-field-to-graphql\"\n );\n\n validateFields({\n fields,\n originalFields: original?.fields || [],\n plugins: fieldTypePlugins\n });\n\n if (fields.length) {\n const sorterPlugins = plugins.byType<CmsGraphQLSchemaSorterPlugin>(\n CmsGraphQLSchemaSorterPlugin.type\n );\n /**\n * Make sure that this model can be safely converted to a GraphQL SDL\n */\n const schema = createManageSDL({\n models,\n model,\n fieldTypePlugins: fieldTypePlugins.reduce(\n (acc, pl) => ({ ...acc, [pl.fieldType]: pl }),\n {}\n ),\n sorterPlugins\n });\n\n try {\n gql(schema);\n } catch (err) {\n throw new WebinyError(extractInvalidField(model, err));\n }\n\n try {\n await createGraphQLSchema({\n context,\n model\n });\n } catch (err) {\n throw new WebinyError({\n message:\n \"Cannot generate GraphQL schema when testing with the given model. Please check the response for more details.\",\n code: \"GRAPHQL_SCHEMA_ERROR\",\n data: {\n modelId: model.modelId,\n error: extractErrorObject(err)\n }\n });\n }\n }\n\n model.titleFieldId = getContentModelTitleFieldId(fields, titleFieldId);\n model.descriptionFieldId = getContentModelDescriptionFieldId(fields, descriptionFieldId);\n model.imageFieldId = getContentModelImageFieldId(fields, imageFieldId);\n};\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,aAAa;AAC7B,OAAOC,WAAW,MAAM,eAAe;AAQvC,SAASC,eAAe;AACxB,SAASC,oBAAoB;AAE7B,SAASC,gBAAgB;AACzB,SAASC,2BAA2B;AACpC,SAASC,iCAAiC;AAC1C,SAASC,2BAA2B;AAEpC,SAASC,sBAAsB,EAAEC,4BAA4B;AAC7D,SAASC,kBAAkB;AAC3B,SAASC,sBAAsB;AAC/B,SAASC,sBAAsB,QAAQ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