@webiny/api-headless-cms 6.6.0-alpha.0 → 6.6.0-alpha.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 (139) hide show
  1. package/HeadlessCmsFeature.js +4 -1
  2. package/HeadlessCmsFeature.js.map +1 -1
  3. package/createCmsRoute.d.ts +13 -8
  4. package/createCmsRoute.js +14 -4
  5. package/createCmsRoute.js.map +1 -1
  6. package/crud/contentEntry/entryDataValidation.js +27 -0
  7. package/crud/contentEntry/entryDataValidation.js.map +1 -1
  8. package/crud/contentModel/defaultFields.js +3 -2
  9. package/crud/contentModel/defaultFields.js.map +1 -1
  10. package/domain/contentModel/schemas.d.ts +8 -6
  11. package/domain/contentModel/schemas.js +5 -3
  12. package/domain/contentModel/schemas.js.map +1 -1
  13. package/exports/api/cms/model.d.ts +4 -1
  14. package/exports/api/cms/model.js +2 -0
  15. package/features/ai/DescribeContentModelTool.d.ts +55 -0
  16. package/features/ai/DescribeContentModelTool.js +60 -0
  17. package/features/ai/DescribeContentModelTool.js.map +1 -0
  18. package/features/ai/ListContentModelsTool.d.ts +41 -0
  19. package/features/ai/ListContentModelsTool.js +44 -0
  20. package/features/ai/ListContentModelsTool.js.map +1 -0
  21. package/features/ai/QueryEntriesTool.d.ts +75 -0
  22. package/features/ai/QueryEntriesTool.js +90 -0
  23. package/features/ai/QueryEntriesTool.js.map +1 -0
  24. package/features/ai/feature.d.ts +8 -0
  25. package/features/ai/feature.js +15 -0
  26. package/features/ai/feature.js.map +1 -0
  27. package/features/ai/index.d.ts +4 -0
  28. package/features/ai/index.js +4 -0
  29. package/features/contentModel/ComponentMapGenerator/ComponentMapGenerator.d.ts +14 -0
  30. package/features/contentModel/ComponentMapGenerator/ComponentMapGenerator.js +32 -0
  31. package/features/contentModel/ComponentMapGenerator/ComponentMapGenerator.js.map +1 -0
  32. package/features/contentModel/ComponentMapGenerator/abstractions.d.ts +8 -0
  33. package/features/contentModel/ComponentMapGenerator/abstractions.js +5 -0
  34. package/features/contentModel/ComponentMapGenerator/abstractions.js.map +1 -0
  35. package/features/contentModel/ComponentMapGenerator/feature.d.ts +4 -0
  36. package/features/contentModel/ComponentMapGenerator/feature.js +11 -0
  37. package/features/contentModel/ComponentMapGenerator/feature.js.map +1 -0
  38. package/features/contentModel/ComponentMapGenerator/index.d.ts +2 -0
  39. package/features/contentModel/ComponentMapGenerator/index.js +2 -0
  40. package/features/contentModel/ContentModelFeature.js +4 -0
  41. package/features/contentModel/ContentModelFeature.js.map +1 -1
  42. package/features/contentModel/RefModelsGenerator/RefModelsGenerator.d.ts +19 -0
  43. package/features/contentModel/RefModelsGenerator/RefModelsGenerator.js +56 -0
  44. package/features/contentModel/RefModelsGenerator/RefModelsGenerator.js.map +1 -0
  45. package/features/contentModel/RefModelsGenerator/abstractions.d.ts +11 -0
  46. package/features/contentModel/RefModelsGenerator/abstractions.js +5 -0
  47. package/features/contentModel/RefModelsGenerator/abstractions.js.map +1 -0
  48. package/features/contentModel/RefModelsGenerator/feature.d.ts +4 -0
  49. package/features/contentModel/RefModelsGenerator/feature.js +11 -0
  50. package/features/contentModel/RefModelsGenerator/feature.js.map +1 -0
  51. package/features/contentModel/RefModelsGenerator/index.d.ts +2 -0
  52. package/features/contentModel/RefModelsGenerator/index.js +2 -0
  53. package/features/contentModel/ValuesSelectionGenerator/ValuesSelectionGenerator.js +2 -0
  54. package/features/contentModel/ValuesSelectionGenerator/ValuesSelectionGenerator.js.map +1 -1
  55. package/features/contentModelGroup/CreateGroup/CreateGroupRepository.d.ts +3 -1
  56. package/features/contentModelGroup/CreateGroup/CreateGroupRepository.js +6 -4
  57. package/features/contentModelGroup/CreateGroup/CreateGroupRepository.js.map +1 -1
  58. package/features/graphql/feature.js +2 -0
  59. package/features/graphql/feature.js.map +1 -1
  60. package/features/graphql/fields/base/AssetToGraphQL.d.ts +26 -0
  61. package/features/graphql/fields/base/AssetToGraphQL.js +148 -0
  62. package/features/graphql/fields/base/AssetToGraphQL.js.map +1 -0
  63. package/features/graphql/fields/base/DynamicZoneToGraphQL.js +5 -1
  64. package/features/graphql/fields/base/DynamicZoneToGraphQL.js.map +1 -1
  65. package/features/graphql/fields/base/ObjectToGraphQL.js +2 -2
  66. package/features/graphql/fields/base/ObjectToGraphQL.js.map +1 -1
  67. package/features/modelBuilder/abstractions.d.ts +10 -0
  68. package/features/modelBuilder/abstractions.js.map +1 -1
  69. package/features/modelBuilder/feature.js +2 -0
  70. package/features/modelBuilder/feature.js.map +1 -1
  71. package/features/modelBuilder/fields/AssetFieldType.d.ts +20 -0
  72. package/features/modelBuilder/fields/AssetFieldType.js +46 -0
  73. package/features/modelBuilder/fields/AssetFieldType.js.map +1 -0
  74. package/features/modelBuilder/fields/BaseFieldBuilder.d.ts +3 -1
  75. package/features/modelBuilder/fields/BaseFieldBuilder.js +4 -0
  76. package/features/modelBuilder/fields/BaseFieldBuilder.js.map +1 -1
  77. package/features/modelBuilder/fields/DataFieldBuilder.d.ts +42 -0
  78. package/features/modelBuilder/fields/DataFieldBuilder.js +5 -1
  79. package/features/modelBuilder/fields/DataFieldBuilder.js.map +1 -1
  80. package/features/modelBuilder/fields/DynamicZoneFieldType.d.ts +1 -0
  81. package/features/modelBuilder/fields/DynamicZoneFieldType.js +10 -9
  82. package/features/modelBuilder/fields/DynamicZoneFieldType.js.map +1 -1
  83. package/features/modelBuilder/fields/UiAlertFieldType.js +2 -1
  84. package/features/modelBuilder/fields/UiAlertFieldType.js.map +1 -1
  85. package/features/modelBuilder/fields/UiSeparatorFieldType.js +2 -1
  86. package/features/modelBuilder/fields/UiSeparatorFieldType.js.map +1 -1
  87. package/features/modelBuilder/fields/UiTabsFieldType.d.ts +2 -1
  88. package/features/modelBuilder/fields/UiTabsFieldType.js +6 -3
  89. package/features/modelBuilder/fields/UiTabsFieldType.js.map +1 -1
  90. package/features/modelBuilder/fields/resolveAssetUrl.d.ts +35 -0
  91. package/features/modelBuilder/fields/resolveAssetUrl.js +26 -0
  92. package/features/modelBuilder/fields/resolveAssetUrl.js.map +1 -0
  93. package/features/modelBuilder/index.d.ts +1 -1
  94. package/features/modelBuilder/models/BaseModelBuilder.d.ts +3 -1
  95. package/features/modelBuilder/models/BaseModelBuilder.js +7 -0
  96. package/features/modelBuilder/models/BaseModelBuilder.js.map +1 -1
  97. package/features/modelBuilder/models/PrivateModelBuilder.js +2 -1
  98. package/features/modelBuilder/models/PrivateModelBuilder.js.map +1 -1
  99. package/features/modelBuilder/models/PublicModelBuilder.js +2 -1
  100. package/features/modelBuilder/models/PublicModelBuilder.js.map +1 -1
  101. package/features/sortMapper/SortMapper.js +2 -5
  102. package/features/sortMapper/SortMapper.js.map +1 -1
  103. package/features/whereMapper/WhereMapper.js +7 -5
  104. package/features/whereMapper/WhereMapper.js.map +1 -1
  105. package/graphql/schema/cms/getEntryResolver.js +3 -2
  106. package/graphql/schema/cms/getEntryResolver.js.map +1 -1
  107. package/graphql/schema/cms/getModelResolver.d.ts +35 -0
  108. package/graphql/schema/cms/getModelResolver.js +49 -0
  109. package/graphql/schema/cms/getModelResolver.js.map +1 -0
  110. package/graphql/schema/cms/helpers/buildFieldsSelection.js +9 -2
  111. package/graphql/schema/cms/helpers/buildFieldsSelection.js.map +1 -1
  112. package/graphql/schema/cms/helpers/expandFieldWildcards.d.ts +2 -0
  113. package/graphql/schema/cms/helpers/expandFieldWildcards.js +13 -0
  114. package/graphql/schema/cms/helpers/expandFieldWildcards.js.map +1 -0
  115. package/graphql/schema/cms/helpers/index.d.ts +1 -0
  116. package/graphql/schema/cms/helpers/index.js +1 -0
  117. package/graphql/schema/cms/helpers/transformWhereToNested.js +39 -17
  118. package/graphql/schema/cms/helpers/transformWhereToNested.js.map +1 -1
  119. package/graphql/schema/cms/helpers.d.ts +1 -0
  120. package/graphql/schema/cms/helpers.js +1 -0
  121. package/graphql/schema/cms/listEntriesResolver.js +3 -2
  122. package/graphql/schema/cms/listEntriesResolver.js.map +1 -1
  123. package/graphql/schema/cms/resolvers/getModel.d.ts +8 -0
  124. package/graphql/schema/cms/resolvers/getModel.js +18 -0
  125. package/graphql/schema/cms/resolvers/getModel.js.map +1 -0
  126. package/graphql/schema/cms/resolvers/index.d.ts +1 -0
  127. package/graphql/schema/cms/resolvers/index.js +1 -0
  128. package/graphql/schema/cms/typeDefs/query.js +1 -0
  129. package/graphql/schema/cms/typeDefs/query.js.map +1 -1
  130. package/graphql/schema/cms/typeDefs/responses.js +5 -0
  131. package/graphql/schema/cms/typeDefs/responses.js.map +1 -1
  132. package/graphql/schema/contentModels.js +31 -0
  133. package/graphql/schema/contentModels.js.map +1 -1
  134. package/package.json +21 -22
  135. package/plugins/CmsModelPlugin.js +2 -1
  136. package/plugins/CmsModelPlugin.js.map +1 -1
  137. package/types/fields/dynamicZoneField.d.ts +3 -2
  138. package/types/model.d.ts +6 -0
  139. package/types/modelField.d.ts +3 -1
@@ -4,8 +4,12 @@ const buildFieldsSelection = (fields)=>{
4
4
  entryId
5
5
  values
6
6
  `;
7
+ const rawSelections = [];
8
+ const dotFields = [];
9
+ for (const field of fields)if (field.includes("{")) rawSelections.push(field);
10
+ else dotFields.push(field);
7
11
  const fieldTree = {};
8
- fields.forEach((field)=>{
12
+ dotFields.forEach((field)=>{
9
13
  const parts = field.split(".");
10
14
  let current = fieldTree;
11
15
  parts.forEach((part, index)=>{
@@ -27,7 +31,10 @@ const buildFieldsSelection = (fields)=>{
27
31
  });
28
32
  return lines.join("\n");
29
33
  };
30
- return buildSelection(fieldTree);
34
+ const parts = [];
35
+ if (dotFields.length > 0) parts.push(buildSelection(fieldTree));
36
+ for (const raw of rawSelections)parts.push(` ${raw}`);
37
+ return parts.join("\n");
31
38
  };
32
39
  export { buildFieldsSelection };
33
40
 
@@ -1 +1 @@
1
- {"version":3,"file":"graphql/schema/cms/helpers/buildFieldsSelection.js","sources":["../../../../../src/graphql/schema/cms/helpers/buildFieldsSelection.ts"],"sourcesContent":["/**\n * Helper to build GraphQL fields selection from fields array.\n * Supports both top-level fields (e.g., \"createdOn\", \"id\") and values fields (e.g., \"values.author.name\").\n * Properly merges nested fields that share common parent paths.\n *\n * @param fields - Optional array of field paths in dot notation\n * @returns GraphQL selection string with proper field nesting\n *\n * @example\n * buildFieldsSelection([\"id\", \"entryId\", \"createdOn\", \"values.name\", \"values.author.name\", \"values.author.email\"])\n * // Returns:\n * // id\n * // entryId\n * // createdOn\n * // values {\n * // name\n * // author {\n * // name\n * // email\n * // }\n * // }\n */\nexport const buildFieldsSelection = (fields?: string[]): string => {\n if (!fields || fields.length === 0) {\n return `\n id\n entryId\n values\n `;\n }\n\n interface FieldNode {\n [key: string]: FieldNode | null;\n }\n\n const fieldTree: FieldNode = {};\n\n fields.forEach(field => {\n const parts = field.split(\".\");\n let current = fieldTree;\n\n parts.forEach((part, index) => {\n if (current[part] === undefined) {\n // Leaf node (null) or new branch (empty object)\n current[part] = index === parts.length - 1 ? null : {};\n } else if (current[part] === null && index < parts.length - 1) {\n // Convert leaf to branch if we need to traverse deeper\n current[part] = {};\n }\n if (current[part] !== null) {\n current = current[part] as FieldNode;\n }\n });\n });\n\n /**\n * Recursively converts the field tree into a GraphQL selection string.\n *\n * @param node - The current field tree node to process\n * @param indent - Current indentation level for formatting\n * @returns GraphQL selection string for this node and its children\n *\n * Handles two cases:\n * - Leaf nodes (value === null): Simple field name\n * - Branch nodes (value === object): Field name with nested selection in braces\n */\n const buildSelection = (node: FieldNode, indent: string = \" \"): string => {\n const lines: string[] = [];\n\n Object.keys(node)\n .sort()\n .forEach(key => {\n const value = node[key];\n if (value === null) {\n // Leaf field - just the field name\n lines.push(`${indent}${key}`);\n } else {\n // Branch field - field name with nested selection\n lines.push(`${indent}${key} {`);\n lines.push(buildSelection(value, indent + \" \"));\n lines.push(`${indent}}`);\n }\n });\n\n return lines.join(\"\\n\");\n };\n\n return buildSelection(fieldTree);\n};\n"],"names":["buildFieldsSelection","fields","fieldTree","field","parts","current","part","index","undefined","buildSelection","node","indent","lines","Object","key","value"],"mappings":"AAsBO,MAAMA,uBAAuB,CAACC;IACjC,IAAI,CAACA,UAAUA,AAAkB,MAAlBA,OAAO,MAAM,EACxB,OAAO,CAAC;;;;QAIR,CAAC;IAOL,MAAMC,YAAuB,CAAC;IAE9BD,OAAO,OAAO,CAACE,CAAAA;QACX,MAAMC,QAAQD,MAAM,KAAK,CAAC;QAC1B,IAAIE,UAAUH;QAEdE,MAAM,OAAO,CAAC,CAACE,MAAMC;YACjB,IAAIF,AAAkBG,WAAlBH,OAAO,CAACC,KAAK,EAEbD,OAAO,CAACC,KAAK,GAAGC,UAAUH,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC;iBAClD,IAAIC,AAAkB,SAAlBA,OAAO,CAACC,KAAK,IAAaC,QAAQH,MAAM,MAAM,GAAG,GAExDC,OAAO,CAACC,KAAK,GAAG,CAAC;YAErB,IAAID,AAAkB,SAAlBA,OAAO,CAACC,KAAK,EACbD,UAAUA,OAAO,CAACC,KAAK;QAE/B;IACJ;IAaA,MAAMG,iBAAiB,CAACC,MAAiBC,SAAiB,UAAU;QAChE,MAAMC,QAAkB,EAAE;QAE1BC,OAAO,IAAI,CAACH,MACP,IAAI,GACJ,OAAO,CAACI,CAAAA;YACL,MAAMC,QAAQL,IAAI,CAACI,IAAI;YACvB,IAAIC,AAAU,SAAVA,OAEAH,MAAM,IAAI,CAAC,GAAGD,SAASG,KAAK;iBACzB;gBAEHF,MAAM,IAAI,CAAC,GAAGD,SAASG,IAAI,EAAE,CAAC;gBAC9BF,MAAM,IAAI,CAACH,eAAeM,OAAOJ,SAAS;gBAC1CC,MAAM,IAAI,CAAC,GAAGD,OAAO,CAAC,CAAC;YAC3B;QACJ;QAEJ,OAAOC,MAAM,IAAI,CAAC;IACtB;IAEA,OAAOH,eAAeP;AAC1B"}
1
+ {"version":3,"file":"graphql/schema/cms/helpers/buildFieldsSelection.js","sources":["../../../../../src/graphql/schema/cms/helpers/buildFieldsSelection.ts"],"sourcesContent":["/**\n * Helper to build GraphQL fields selection from fields array.\n * Supports both top-level fields (e.g., \"createdOn\", \"id\") and values fields (e.g., \"values.author.name\").\n * Properly merges nested fields that share common parent paths.\n *\n * @param fields - Optional array of field paths in dot notation\n * @returns GraphQL selection string with proper field nesting\n *\n * @example\n * buildFieldsSelection([\"id\", \"entryId\", \"createdOn\", \"values.name\", \"values.author.name\", \"values.author.email\"])\n * // Returns:\n * // id\n * // entryId\n * // createdOn\n * // values {\n * // name\n * // author {\n * // name\n * // email\n * // }\n * // }\n */\nexport const buildFieldsSelection = (fields?: string[]): string => {\n if (!fields || fields.length === 0) {\n return `\n id\n entryId\n values\n `;\n }\n\n const rawSelections: string[] = [];\n const dotFields: string[] = [];\n\n for (const field of fields) {\n if (field.includes(\"{\")) {\n rawSelections.push(field);\n } else {\n dotFields.push(field);\n }\n }\n\n interface FieldNode {\n [key: string]: FieldNode | null;\n }\n\n const fieldTree: FieldNode = {};\n\n dotFields.forEach(field => {\n const parts = field.split(\".\");\n let current = fieldTree;\n\n parts.forEach((part, index) => {\n if (current[part] === undefined) {\n current[part] = index === parts.length - 1 ? null : {};\n } else if (current[part] === null && index < parts.length - 1) {\n current[part] = {};\n }\n if (current[part] !== null) {\n current = current[part] as FieldNode;\n }\n });\n });\n\n const buildSelection = (node: FieldNode, indent: string = \" \"): string => {\n const lines: string[] = [];\n\n Object.keys(node)\n .sort()\n .forEach(key => {\n const value = node[key];\n if (value === null) {\n lines.push(`${indent}${key}`);\n } else {\n lines.push(`${indent}${key} {`);\n lines.push(buildSelection(value, indent + \" \"));\n lines.push(`${indent}}`);\n }\n });\n\n return lines.join(\"\\n\");\n };\n\n const parts: string[] = [];\n\n if (dotFields.length > 0) {\n parts.push(buildSelection(fieldTree));\n }\n\n for (const raw of rawSelections) {\n parts.push(` ${raw}`);\n }\n\n return parts.join(\"\\n\");\n};\n"],"names":["buildFieldsSelection","fields","rawSelections","dotFields","field","fieldTree","parts","current","part","index","undefined","buildSelection","node","indent","lines","Object","key","value","raw"],"mappings":"AAsBO,MAAMA,uBA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,EAAE;IAE1B,IAAIH,UAAU,MAAM,GAAG,GACnBG,MAAM,IAAI,CAACK,eAAeN;IAG9B,KAAK,MAAMa,OAAOhB,cACdI,MAAM,IAAI,CAAC,CAAC,QAAQ,EAAEY,KAAK;IAG/B,OAAOZ,MAAM,IAAI,CAAC;AACtB"}
@@ -0,0 +1,2 @@
1
+ import type { CmsContext, CmsModel } from "../../../../types/index.js";
2
+ export declare const expandFieldWildcards: (fields: string[], model: CmsModel, context: CmsContext) => string[];
@@ -0,0 +1,13 @@
1
+ import { ValuesSelectionGenerator } from "../../../../features/contentModel/ValuesSelectionGenerator/abstractions.js";
2
+ const expandFieldWildcards = (fields, model, context)=>{
3
+ if (!fields.includes("values.*")) return fields;
4
+ const generator = context.container.resolve(ValuesSelectionGenerator);
5
+ const valuesSelection = generator.generate(model);
6
+ if (!valuesSelection || "_empty" === valuesSelection) return fields.filter((f)=>"values.*" !== f);
7
+ const expanded = fields.filter((f)=>"values.*" !== f);
8
+ expanded.push(`values { ${valuesSelection} }`);
9
+ return expanded;
10
+ };
11
+ export { expandFieldWildcards };
12
+
13
+ //# sourceMappingURL=expandFieldWildcards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql/schema/cms/helpers/expandFieldWildcards.js","sources":["../../../../../src/graphql/schema/cms/helpers/expandFieldWildcards.ts"],"sourcesContent":["import type { CmsContext, CmsModel } from \"~/types/index.js\";\nimport { ValuesSelectionGenerator } from \"~/features/contentModel/ValuesSelectionGenerator/abstractions.js\";\n\nexport const expandFieldWildcards = (\n fields: string[],\n model: CmsModel,\n context: CmsContext\n): string[] => {\n if (!fields.includes(\"values.*\")) {\n return fields;\n }\n\n const generator = context.container.resolve(ValuesSelectionGenerator);\n const valuesSelection = generator.generate(model);\n\n if (!valuesSelection || valuesSelection === \"_empty\") {\n return fields.filter(f => f !== \"values.*\");\n }\n\n const expanded = fields.filter(f => f !== \"values.*\");\n expanded.push(`values { ${valuesSelection} }`);\n return expanded;\n};\n"],"names":["expandFieldWildcards","fields","model","context","generator","ValuesSelectionGenerator","valuesSelection","f","expanded"],"mappings":";AAGO,MAAMA,uBAAuB,CAChCC,QACAC,OACAC;IAEA,IAAI,CAACF,OAAO,QAAQ,CAAC,aACjB,OAAOA;IAGX,MAAMG,YAAYD,QAAQ,SAAS,CAAC,OAAO,CAACE;IAC5C,MAAMC,kBAAkBF,UAAU,QAAQ,CAACF;IAE3C,IAAI,CAACI,mBAAmBA,AAAoB,aAApBA,iBACpB,OAAOL,OAAO,MAAM,CAACM,CAAAA,IAAKA,AAAM,eAANA;IAG9B,MAAMC,WAAWP,OAAO,MAAM,CAACM,CAAAA,IAAKA,AAAM,eAANA;IACpCC,SAAS,IAAI,CAAC,CAAC,SAAS,EAAEF,gBAAgB,EAAE,CAAC;IAC7C,OAAOE;AACX"}
@@ -2,4 +2,5 @@ export { getErrorMessage } from "./getErrorMessage.js";
2
2
  export { getModel } from "./getModel.js";
3
3
  export { transformSortToArray } from "./transformSortToArray.js";
4
4
  export { buildFieldsSelection } from "./buildFieldsSelection.js";
5
+ export { expandFieldWildcards } from "./expandFieldWildcards.js";
5
6
  export { transformWhereToNested } from "./transformWhereToNested.js";
@@ -2,4 +2,5 @@ export { getErrorMessage } from "./getErrorMessage.js";
2
2
  export { getModel } from "./getModel.js";
3
3
  export { transformSortToArray } from "./transformSortToArray.js";
4
4
  export { buildFieldsSelection } from "./buildFieldsSelection.js";
5
+ export { expandFieldWildcards } from "./expandFieldWildcards.js";
5
6
  export { transformWhereToNested } from "./transformWhereToNested.js";
@@ -1,26 +1,48 @@
1
+ const FORBIDDEN_KEYS = new Set([
2
+ "__proto__",
3
+ "prototype",
4
+ "constructor"
5
+ ]);
1
6
  const transformWhereToNested = (where)=>{
2
7
  if (!where) return;
3
- const result = {};
4
- for (const [key, value] of Object.entries(where)){
8
+ return Object.entries(where).reduce((result, [key, value])=>{
5
9
  if ("AND" === key || "OR" === key) {
6
- if (Array.isArray(value)) result[key] = value.map((item)=>transformWhereToNested(item));
7
- else result[key] = value;
8
- continue;
10
+ if (!Array.isArray(value)) return {
11
+ ...result,
12
+ [key]: value
13
+ };
14
+ return {
15
+ ...result,
16
+ [key]: value.map((item)=>transformWhereToNested(item))
17
+ };
9
18
  }
10
19
  const dotIndex = key.indexOf(".");
11
- if (-1 === dotIndex) result[key] = value;
12
- else {
13
- const head = key.slice(0, dotIndex);
14
- const tail = key.slice(dotIndex + 1);
15
- if (void 0 === result[head]) result[head] = {};
16
- const nested = result[head];
17
- const expanded = transformWhereToNested({
18
- [tail]: value
19
- });
20
- Object.assign(nested, expanded);
20
+ if (-1 === dotIndex) {
21
+ if (FORBIDDEN_KEYS.has(key)) throw new Error(`Invalid where key: "${key}".`);
22
+ return {
23
+ ...result,
24
+ [key]: value
25
+ };
21
26
  }
22
- }
23
- return result;
27
+ const head = key.slice(0, dotIndex);
28
+ const tail = key.slice(dotIndex + 1);
29
+ if (FORBIDDEN_KEYS.has(head)) throw new Error(`Invalid where key: "${head}".`);
30
+ if (Object.hasOwn(result, head)) return {
31
+ ...result,
32
+ [head]: {
33
+ ...result[head],
34
+ ...transformWhereToNested({
35
+ [tail]: value
36
+ })
37
+ }
38
+ };
39
+ return {
40
+ ...result,
41
+ [head]: transformWhereToNested({
42
+ [tail]: value
43
+ })
44
+ };
45
+ }, {});
24
46
  };
25
47
  export { transformWhereToNested };
26
48
 
@@ -1 +1 @@
1
- {"version":3,"file":"graphql/schema/cms/helpers/transformWhereToNested.js","sources":["../../../../../src/graphql/schema/cms/helpers/transformWhereToNested.ts"],"sourcesContent":["/**\n * Transforms a flat where object with dot-notation keys into a nested object.\n * Keys without dots are passed through unchanged.\n * Handles logical operators (AND, OR) recursively.\n *\n * @param where - Where clause object potentially containing dot-notation keys\n * @returns Nested where object compatible with the GraphQL ListWhereInput type\n *\n * @example\n * transformWhereToNested({ \"values.name\": \"Keyboard\", id: \"abc\" })\n * // Returns: { values: { name: \"Keyboard\" }, id: \"abc\" }\n *\n * @example\n * transformWhereToNested({ \"values.price_gt\": 100, \"values.name_contains\": \"board\" })\n * // Returns: { values: { price_gt: 100, name_contains: \"board\" } }\n */\nexport const transformWhereToNested = (\n where?: Record<string, unknown>\n): Record<string, unknown> | undefined => {\n if (!where) {\n return undefined;\n }\n\n const result: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(where)) {\n // Handle logical operators recursively.\n if (key === \"AND\" || key === \"OR\") {\n if (Array.isArray(value)) {\n result[key] = value.map(item =>\n transformWhereToNested(item as Record<string, unknown>)\n );\n } else {\n result[key] = value;\n }\n continue;\n }\n\n const dotIndex = key.indexOf(\".\");\n if (dotIndex === -1) {\n // No dot pass through unchanged.\n result[key] = value;\n } else {\n // Dot-notation key — expand into nested object.\n const head = key.slice(0, dotIndex);\n const tail = key.slice(dotIndex + 1);\n\n if (result[head] === undefined) {\n result[head] = {};\n }\n\n const nested = result[head] as Record<string, unknown>;\n // Recursively expand in case of multiple levels of nesting.\n const expanded = transformWhereToNested({ [tail]: value }) as Record<string, unknown>;\n Object.assign(nested, expanded);\n }\n }\n\n return result;\n};\n"],"names":["transformWhereToNested","where","result","key","value","Object","Array","item","dotIndex","head","tail","undefined","nested","expanded"],"mappings":"AAgBO,MAAMA,yBAAyB,CAClCC;IAEA,IAAI,CAACA,OACD;IAGJ,MAAMC,SAAkC,CAAC;IAEzC,KAAK,MAAM,CAACC,KAAKC,MAAM,IAAIC,OAAO,OAAO,CAACJ,OAAQ;QAE9C,IAAIE,AAAQ,UAARA,OAAiBA,AAAQ,SAARA,KAAc;YAC/B,IAAIG,MAAM,OAAO,CAACF,QACdF,MAAM,CAACC,IAAI,GAAGC,MAAM,GAAG,CAACG,CAAAA,OACpBP,uBAAuBO;iBAG3BL,MAAM,CAACC,IAAI,GAAGC;YAElB;QACJ;QAEA,MAAMI,WAAWL,IAAI,OAAO,CAAC;QAC7B,IAAIK,AAAa,OAAbA,UAEAN,MAAM,CAACC,IAAI,GAAGC;aACX;YAEH,MAAMK,OAAON,IAAI,KAAK,CAAC,GAAGK;YAC1B,MAAME,OAAOP,IAAI,KAAK,CAACK,WAAW;YAElC,IAAIN,AAAiBS,WAAjBT,MAAM,CAACO,KAAK,EACZP,MAAM,CAACO,KAAK,GAAG,CAAC;YAGpB,MAAMG,SAASV,MAAM,CAACO,KAAK;YAE3B,MAAMI,WAAWb,uBAAuB;gBAAE,CAACU,KAAK,EAAEN;YAAM;YACxDC,OAAO,MAAM,CAACO,QAAQC;QAC1B;IACJ;IAEA,OAAOX;AACX"}
1
+ {"version":3,"file":"graphql/schema/cms/helpers/transformWhereToNested.js","sources":["../../../../../src/graphql/schema/cms/helpers/transformWhereToNested.ts"],"sourcesContent":["const FORBIDDEN_KEYS = new Set([\"__proto__\", \"prototype\", \"constructor\"]);\n\n/**\n * Transforms a flat where object with dot-notation keys into a nested object.\n * Keys without dots are passed through unchanged.\n * Handles logical operators (AND, OR) recursively.\n *\n * @param where - Where clause object potentially containing dot-notation keys\n * @returns Nested where object compatible with the GraphQL ListWhereInput type\n *\n * @example\n * transformWhereToNested({ \"values.name\": \"Keyboard\", id: \"abc\" })\n * // Returns: { values: { name: \"Keyboard\" }, id: \"abc\" }\n *\n * @example\n * transformWhereToNested({ \"values.price_gt\": 100, \"values.name_contains\": \"board\" })\n * // Returns: { values: { price_gt: 100, name_contains: \"board\" } }\n */\nexport const transformWhereToNested = (\n where?: Record<string, unknown>\n): Record<string, unknown> | undefined => {\n if (!where) {\n return undefined;\n }\n\n return Object.entries(where).reduce<Record<string, unknown>>((result, [key, value]) => {\n if (key === \"AND\" || key === \"OR\") {\n if (!Array.isArray(value)) {\n return {\n ...result,\n [key]: value\n };\n }\n return {\n ...result,\n [key]: value.map(item => transformWhereToNested(item))\n };\n }\n\n const dotIndex = key.indexOf(\".\");\n\n if (dotIndex === -1) {\n if (FORBIDDEN_KEYS.has(key)) {\n throw new Error(`Invalid where key: \"${key}\".`);\n }\n return {\n ...result,\n [key]: value\n };\n }\n\n const head = key.slice(0, dotIndex);\n const tail = key.slice(dotIndex + 1);\n\n if (FORBIDDEN_KEYS.has(head)) {\n throw new Error(`Invalid where key: \"${head}\".`);\n }\n\n if (Object.hasOwn(result, head)) {\n return {\n ...result,\n [head]: {\n ...(result[head] as Record<string, unknown>),\n ...transformWhereToNested({ [tail]: value })\n }\n };\n }\n\n return {\n ...result,\n [head]: transformWhereToNested({ [tail]: value })\n };\n }, {});\n};\n"],"names":["FORBIDDEN_KEYS","Set","transformWhereToNested","where","Object","result","key","value","Array","item","dotIndex","Error","head","tail"],"mappings":"AAAA,MAAMA,iBAAiB,IAAIC,IAAI;IAAC;IAAa;IAAa;CAAc;AAkBjE,MAAMC,yBAAyB,CAClCC;IAEA,IAAI,CAACA,OACD;IAGJ,OAAOC,OAAO,OAAO,CAACD,OAAO,MAAM,CAA0B,CAACE,QAAQ,CAACC,KAAKC,MAAM;QAC9E,IAAID,AAAQ,UAARA,OAAiBA,AAAQ,SAARA,KAAc;YAC/B,IAAI,CAACE,MAAM,OAAO,CAACD,QACf,OAAO;gBACH,GAAGF,MAAM;gBACT,CAACC,IAAI,EAAEC;YACX;YAEJ,OAAO;gBACH,GAAGF,MAAM;gBACT,CAACC,IAAI,EAAEC,MAAM,GAAG,CAACE,CAAAA,OAAQP,uBAAuBO;YACpD;QACJ;QAEA,MAAMC,WAAWJ,IAAI,OAAO,CAAC;QAE7B,IAAII,AAAa,OAAbA,UAAiB;YACjB,IAAIV,eAAe,GAAG,CAACM,MACnB,MAAM,IAAIK,MAAM,CAAC,oBAAoB,EAAEL,IAAI,EAAE,CAAC;YAElD,OAAO;gBACH,GAAGD,MAAM;gBACT,CAACC,IAAI,EAAEC;YACX;QACJ;QAEA,MAAMK,OAAON,IAAI,KAAK,CAAC,GAAGI;QAC1B,MAAMG,OAAOP,IAAI,KAAK,CAACI,WAAW;QAElC,IAAIV,eAAe,GAAG,CAACY,OACnB,MAAM,IAAID,MAAM,CAAC,oBAAoB,EAAEC,KAAK,EAAE,CAAC;QAGnD,IAAIR,OAAO,MAAM,CAACC,QAAQO,OACtB,OAAO;YACH,GAAGP,MAAM;YACT,CAACO,KAAK,EAAE;gBACJ,GAAIP,MAAM,CAACO,KAAK;gBAChB,GAAGV,uBAAuB;oBAAE,CAACW,KAAK,EAAEN;gBAAM,EAAE;YAChD;QACJ;QAGJ,OAAO;YACH,GAAGF,MAAM;YACT,CAACO,KAAK,EAAEV,uBAAuB;gBAAE,CAACW,KAAK,EAAEN;YAAM;QACnD;IACJ,GAAG,CAAC;AACR"}
@@ -2,4 +2,5 @@ export { getErrorMessage } from "./helpers/getErrorMessage.js";
2
2
  export { getModel } from "./helpers/getModel.js";
3
3
  export { transformSortToArray } from "./helpers/transformSortToArray.js";
4
4
  export { buildFieldsSelection } from "./helpers/buildFieldsSelection.js";
5
+ export { expandFieldWildcards } from "./helpers/expandFieldWildcards.js";
5
6
  export { transformWhereToNested } from "./helpers/transformWhereToNested.js";
@@ -2,4 +2,5 @@ export { getErrorMessage } from "./helpers/getErrorMessage.js";
2
2
  export { getModel } from "./helpers/getModel.js";
3
3
  export { transformSortToArray } from "./helpers/transformSortToArray.js";
4
4
  export { buildFieldsSelection } from "./helpers/buildFieldsSelection.js";
5
+ export { expandFieldWildcards } from "./helpers/expandFieldWildcards.js";
5
6
  export { transformWhereToNested } from "./helpers/transformWhereToNested.js";
@@ -1,11 +1,12 @@
1
- import { buildFieldsSelection, getErrorMessage, getModel, transformSortToArray, transformWhereToNested } from "./helpers.js";
1
+ import { buildFieldsSelection, expandFieldWildcards, getErrorMessage, getModel, transformSortToArray, transformWhereToNested } from "./helpers.js";
2
2
  import { CmsSchemaExecutor } from "../../CmsSchemaExecutor.js";
3
3
  const createListEntriesResolver = ()=>async ({ args, context })=>{
4
4
  const { modelId, where, sort, limit, after, search, fields, preview = false } = args;
5
5
  try {
6
6
  const model = await getModel(context, modelId);
7
7
  const apiType = preview ? "preview" : "read";
8
- const fieldsSelection = buildFieldsSelection(fields);
8
+ const expandedFields = expandFieldWildcards(fields, model, context);
9
+ const fieldsSelection = buildFieldsSelection(expandedFields);
9
10
  const transformedSort = transformSortToArray(sort);
10
11
  const transformedWhere = transformWhereToNested(where);
11
12
  const query = `
@@ -1 +1 @@
1
- {"version":3,"file":"graphql/schema/cms/listEntriesResolver.js","sources":["../../../../src/graphql/schema/cms/listEntriesResolver.ts"],"sourcesContent":["import type { CmsContext, ApiEndpoint } from \"~/types/index.js\";\nimport type { ExecutionResult } from \"graphql\";\nimport {\n getModel,\n getErrorMessage,\n buildFieldsSelection,\n transformSortToArray,\n transformWhereToNested\n} from \"./helpers.js\";\nimport { CmsSchemaExecutor } from \"~/graphql/CmsSchemaExecutor.js\";\n\nexport interface ListEntriesArgs {\n modelId: string;\n where?: Record<string, unknown>;\n sort?: Record<string, unknown> | string[];\n limit?: number;\n after?: string;\n search?: string;\n fields: string[];\n preview?: boolean;\n}\n\nexport const createListEntriesResolver = () => {\n return async ({ args, context }: { args: ListEntriesArgs; context: CmsContext }) => {\n const { modelId, where, sort, limit, after, search, fields, preview = false } = args;\n\n try {\n const model = await getModel(context, modelId);\n\n // Determine which API to use based on the preview flag.\n // preview=true -> preview API, preview=false -> read API\n const apiType: ApiEndpoint = preview ? \"preview\" : \"read\";\n\n const fieldsSelection = buildFieldsSelection(fields);\n\n // Transform sort to array format expected by the underlying GraphQL schema.\n // Handles both object format {createdOn: \"desc\"} and array format [\"createdOn_DESC\"].\n const transformedSort = transformSortToArray(sort);\n\n // Transform dot-notation where keys (e.g. \"values.name\") into nested objects\n // (e.g. { values: { name: ... } }) so they match the typed ListWhereInput.\n const transformedWhere = transformWhereToNested(where);\n\n const query = /* GraphQL */ `\n query List${model.pluralApiName}(\n $where: ${model.singularApiName}ListWhereInput\n $sort: [${model.singularApiName}ListSorter!]\n $limit: Int\n $after: String\n $search: String\n ) {\n list${model.pluralApiName}(\n where: $where\n sort: $sort\n limit: $limit\n after: $after\n search: $search\n ) {\n data {\n ${fieldsSelection}\n }\n meta {\n cursor\n hasMoreItems\n totalCount\n }\n error {\n message\n code\n data\n }\n }\n }\n `;\n\n const result = (await context.container.resolve(CmsSchemaExecutor).execute(apiType, {\n query,\n variables: { where: transformedWhere, sort: transformedSort, limit, after, search }\n })) as ExecutionResult;\n\n if (result.errors && result.errors.length > 0) {\n return {\n data: [],\n meta: { cursor: null, hasMoreItems: false, totalCount: 0 },\n error: {\n message: result.errors.map(e => e.message).join(\"; \"),\n code: \"LIST_ENTRIES_ERROR\"\n }\n };\n }\n\n const operationName = `list${model.pluralApiName}`;\n return (\n result.data?.[operationName] || {\n data: [],\n meta: { cursor: null, hasMoreItems: false, totalCount: 0 },\n error: null\n }\n );\n } catch (error) {\n return {\n data: [],\n meta: { cursor: null, hasMoreItems: false, totalCount: 0 },\n error: {\n message: getErrorMessage(error, \"Failed to list entries\"),\n code: \"LIST_ENTRIES_ERROR\"\n }\n };\n }\n };\n};\n"],"names":["createListEntriesResolver","args","context","modelId","where","sort","limit","after","search","fields","preview","model","getModel","apiType","fieldsSelection","buildFieldsSelection","transformedSort","transformSortToArray","transformedWhere","transformWhereToNested","query","result","CmsSchemaExecutor","e","operationName","error","getErrorMessage"],"mappings":";;AAsBO,MAAMA,4BAA4B,IAC9B,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAkD;QAC3E,MAAM,EAAEC,OAAO,EAAEC,KAAK,EAAEC,IAAI,EAAEC,KAAK,EAAEC,KAAK,EAAEC,MAAM,EAAEC,MAAM,EAAEC,UAAU,KAAK,EAAE,GAAGT;QAEhF,IAAI;YACA,MAAMU,QAAQ,MAAMC,SAASV,SAASC;YAItC,MAAMU,UAAuBH,UAAU,YAAY;YAEnD,MAAMI,kBAAkBC,qBAAqBN;YAI7C,MAAMO,kBAAkBC,qBAAqBZ;YAI7C,MAAMa,mBAAmBC,uBAAuBf;YAEhD,MAAMgB,QAAsB,CAAC;0BACf,EAAET,MAAM,aAAa,CAAC;4BACpB,EAAEA,MAAM,eAAe,CAAC;4BACxB,EAAEA,MAAM,eAAe,CAAC;;;;;wBAK5B,EAAEA,MAAM,aAAa,CAAC;;;;;;;;4BAQlB,EAAEG,gBAAgB;;;;;;;;;;;;;;YAclC,CAAC;YAED,MAAMO,SAAU,MAAMnB,QAAQ,SAAS,CAAC,OAAO,CAACoB,mBAAmB,OAAO,CAACT,SAAS;gBAChFO;gBACA,WAAW;oBAAE,OAAOF;oBAAkB,MAAMF;oBAAiBV;oBAAOC;oBAAOC;gBAAO;YACtF;YAEA,IAAIa,OAAO,MAAM,IAAIA,OAAO,MAAM,CAAC,MAAM,GAAG,GACxC,OAAO;gBACH,MAAM,EAAE;gBACR,MAAM;oBAAE,QAAQ;oBAAM,cAAc;oBAAO,YAAY;gBAAE;gBACzD,OAAO;oBACH,SAASA,OAAO,MAAM,CAAC,GAAG,CAACE,CAAAA,IAAKA,EAAE,OAAO,EAAE,IAAI,CAAC;oBAChD,MAAM;gBACV;YACJ;YAGJ,MAAMC,gBAAgB,CAAC,IAAI,EAAEb,MAAM,aAAa,EAAE;YAClD,OACIU,OAAO,IAAI,EAAE,CAACG,cAAc,IAAI;gBAC5B,MAAM,EAAE;gBACR,MAAM;oBAAE,QAAQ;oBAAM,cAAc;oBAAO,YAAY;gBAAE;gBACzD,OAAO;YACX;QAER,EAAE,OAAOC,OAAO;YACZ,OAAO;gBACH,MAAM,EAAE;gBACR,MAAM;oBAAE,QAAQ;oBAAM,cAAc;oBAAO,YAAY;gBAAE;gBACzD,OAAO;oBACH,SAASC,gBAAgBD,OAAO;oBAChC,MAAM;gBACV;YACJ;QACJ;IACJ"}
1
+ {"version":3,"file":"graphql/schema/cms/listEntriesResolver.js","sources":["../../../../src/graphql/schema/cms/listEntriesResolver.ts"],"sourcesContent":["import type { CmsContext, ApiEndpoint } from \"~/types/index.js\";\nimport type { ExecutionResult } from \"graphql\";\nimport {\n getModel,\n getErrorMessage,\n buildFieldsSelection,\n expandFieldWildcards,\n transformSortToArray,\n transformWhereToNested\n} from \"./helpers.js\";\nimport { CmsSchemaExecutor } from \"~/graphql/CmsSchemaExecutor.js\";\n\nexport interface ListEntriesArgs {\n modelId: string;\n where?: Record<string, unknown>;\n sort?: Record<string, unknown> | string[];\n limit?: number;\n after?: string;\n search?: string;\n fields: string[];\n preview?: boolean;\n}\n\nexport const createListEntriesResolver = () => {\n return async ({ args, context }: { args: ListEntriesArgs; context: CmsContext }) => {\n const { modelId, where, sort, limit, after, search, fields, preview = false } = args;\n\n try {\n const model = await getModel(context, modelId);\n\n // Determine which API to use based on the preview flag.\n // preview=true -> preview API, preview=false -> read API\n const apiType: ApiEndpoint = preview ? \"preview\" : \"read\";\n\n const expandedFields = expandFieldWildcards(fields, model, context);\n const fieldsSelection = buildFieldsSelection(expandedFields);\n\n // Transform sort to array format expected by the underlying GraphQL schema.\n // Handles both object format {createdOn: \"desc\"} and array format [\"createdOn_DESC\"].\n const transformedSort = transformSortToArray(sort);\n\n // Transform dot-notation where keys (e.g. \"values.name\") into nested objects\n // (e.g. { values: { name: ... } }) so they match the typed ListWhereInput.\n const transformedWhere = transformWhereToNested(where);\n\n const query = /* GraphQL */ `\n query List${model.pluralApiName}(\n $where: ${model.singularApiName}ListWhereInput\n $sort: [${model.singularApiName}ListSorter!]\n $limit: Int\n $after: String\n $search: String\n ) {\n list${model.pluralApiName}(\n where: $where\n sort: $sort\n limit: $limit\n after: $after\n search: $search\n ) {\n data {\n ${fieldsSelection}\n }\n meta {\n cursor\n hasMoreItems\n totalCount\n }\n error {\n message\n code\n data\n }\n }\n }\n `;\n\n const result = (await context.container.resolve(CmsSchemaExecutor).execute(apiType, {\n query,\n variables: { where: transformedWhere, sort: transformedSort, limit, after, search }\n })) as ExecutionResult;\n\n if (result.errors && result.errors.length > 0) {\n return {\n data: [],\n meta: { cursor: null, hasMoreItems: false, totalCount: 0 },\n error: {\n message: result.errors.map(e => e.message).join(\"; \"),\n code: \"LIST_ENTRIES_ERROR\"\n }\n };\n }\n\n const operationName = `list${model.pluralApiName}`;\n return (\n result.data?.[operationName] || {\n data: [],\n meta: { cursor: null, hasMoreItems: false, totalCount: 0 },\n error: null\n }\n );\n } catch (error) {\n return {\n data: [],\n meta: { cursor: null, hasMoreItems: false, totalCount: 0 },\n error: {\n message: getErrorMessage(error, \"Failed to list entries\"),\n code: \"LIST_ENTRIES_ERROR\"\n }\n };\n }\n };\n};\n"],"names":["createListEntriesResolver","args","context","modelId","where","sort","limit","after","search","fields","preview","model","getModel","apiType","expandedFields","expandFieldWildcards","fieldsSelection","buildFieldsSelection","transformedSort","transformSortToArray","transformedWhere","transformWhereToNested","query","result","CmsSchemaExecutor","e","operationName","error","getErrorMessage"],"mappings":";;AAuBO,MAAMA,4BAA4B,IAC9B,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAkD;QAC3E,MAAM,EAAEC,OAAO,EAAEC,KAAK,EAAEC,IAAI,EAAEC,KAAK,EAAEC,KAAK,EAAEC,MAAM,EAAEC,MAAM,EAAEC,UAAU,KAAK,EAAE,GAAGT;QAEhF,IAAI;YACA,MAAMU,QAAQ,MAAMC,SAASV,SAASC;YAItC,MAAMU,UAAuBH,UAAU,YAAY;YAEnD,MAAMI,iBAAiBC,qBAAqBN,QAAQE,OAAOT;YAC3D,MAAMc,kBAAkBC,qBAAqBH;YAI7C,MAAMI,kBAAkBC,qBAAqBd;YAI7C,MAAMe,mBAAmBC,uBAAuBjB;YAEhD,MAAMkB,QAAsB,CAAC;0BACf,EAAEX,MAAM,aAAa,CAAC;4BACpB,EAAEA,MAAM,eAAe,CAAC;4BACxB,EAAEA,MAAM,eAAe,CAAC;;;;;wBAK5B,EAAEA,MAAM,aAAa,CAAC;;;;;;;;4BAQlB,EAAEK,gBAAgB;;;;;;;;;;;;;;YAclC,CAAC;YAED,MAAMO,SAAU,MAAMrB,QAAQ,SAAS,CAAC,OAAO,CAACsB,mBAAmB,OAAO,CAACX,SAAS;gBAChFS;gBACA,WAAW;oBAAE,OAAOF;oBAAkB,MAAMF;oBAAiBZ;oBAAOC;oBAAOC;gBAAO;YACtF;YAEA,IAAIe,OAAO,MAAM,IAAIA,OAAO,MAAM,CAAC,MAAM,GAAG,GACxC,OAAO;gBACH,MAAM,EAAE;gBACR,MAAM;oBAAE,QAAQ;oBAAM,cAAc;oBAAO,YAAY;gBAAE;gBACzD,OAAO;oBACH,SAASA,OAAO,MAAM,CAAC,GAAG,CAACE,CAAAA,IAAKA,EAAE,OAAO,EAAE,IAAI,CAAC;oBAChD,MAAM;gBACV;YACJ;YAGJ,MAAMC,gBAAgB,CAAC,IAAI,EAAEf,MAAM,aAAa,EAAE;YAClD,OACIY,OAAO,IAAI,EAAE,CAACG,cAAc,IAAI;gBAC5B,MAAM,EAAE;gBACR,MAAM;oBAAE,QAAQ;oBAAM,cAAc;oBAAO,YAAY;gBAAE;gBACzD,OAAO;YACX;QAER,EAAE,OAAOC,OAAO;YACZ,OAAO;gBACH,MAAM,EAAE;gBACR,MAAM;oBAAE,QAAQ;oBAAM,cAAc;oBAAO,YAAY;gBAAE;gBACzD,OAAO;oBACH,SAASC,gBAAgBD,OAAO;oBAChC,MAAM;gBACV;YACJ;QACJ;IACJ"}
@@ -0,0 +1,8 @@
1
+ import { CoreGraphQLSchemaFactory } from "@webiny/api-graphql/graphql/abstractions.core.js";
2
+ declare class GetModelResolver implements CoreGraphQLSchemaFactory.Interface {
3
+ execute(builder: CoreGraphQLSchemaFactory.SchemaBuilder): CoreGraphQLSchemaFactory.Return;
4
+ }
5
+ export declare const GetModelResolverImpl: typeof GetModelResolver & {
6
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-graphql/graphql/abstractions.core.js").ICoreGraphQLSchemaFactory>;
7
+ };
8
+ export {};
@@ -0,0 +1,18 @@
1
+ import { CoreGraphQLSchemaFactory } from "@webiny/api-graphql/graphql/abstractions.core.js";
2
+ import { createGetModelResolver } from "../getModelResolver.js";
3
+ class GetModelResolver {
4
+ async execute(builder) {
5
+ builder.addResolver({
6
+ path: "CmsQuery.getModel",
7
+ resolver: createGetModelResolver
8
+ });
9
+ return builder;
10
+ }
11
+ }
12
+ const GetModelResolverImpl = CoreGraphQLSchemaFactory.createImplementation({
13
+ implementation: GetModelResolver,
14
+ dependencies: []
15
+ });
16
+ export { GetModelResolverImpl };
17
+
18
+ //# sourceMappingURL=getModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql/schema/cms/resolvers/getModel.js","sources":["../../../../../src/graphql/schema/cms/resolvers/getModel.ts"],"sourcesContent":["import { CoreGraphQLSchemaFactory } from \"@webiny/api-graphql/graphql/abstractions.core.js\";\nimport { createGetModelResolver } from \"../getModelResolver.js\";\n\nclass GetModelResolver implements CoreGraphQLSchemaFactory.Interface {\n async execute(\n builder: CoreGraphQLSchemaFactory.SchemaBuilder\n ): CoreGraphQLSchemaFactory.Return {\n builder.addResolver({\n path: \"CmsQuery.getModel\",\n resolver: createGetModelResolver\n });\n\n return builder;\n }\n}\n\nexport const GetModelResolverImpl = CoreGraphQLSchemaFactory.createImplementation({\n implementation: GetModelResolver,\n dependencies: []\n});\n"],"names":["GetModelResolver","builder","createGetModelResolver","GetModelResolverImpl","CoreGraphQLSchemaFactory"],"mappings":";;AAGA,MAAMA;IACF,MAAM,QACFC,OAA+C,EAChB;QAC/BA,QAAQ,WAAW,CAAC;YAChB,MAAM;YACN,UAAUC;QACd;QAEA,OAAOD;IACX;AACJ;AAEO,MAAME,uBAAuBC,yBAAyB,oBAAoB,CAAC;IAC9E,gBAAgBJ;IAChB,cAAc,EAAE;AACpB"}
@@ -7,3 +7,4 @@ export { UpdateEntryRevisionResolverImpl } from "./updateEntryRevision.js";
7
7
  export { DeleteEntryRevisionResolverImpl } from "./deleteEntryRevision.js";
8
8
  export { PublishEntryRevisionResolverImpl } from "./publishEntryRevision.js";
9
9
  export { UnpublishEntryRevisionResolverImpl } from "./unpublishEntryRevision.js";
10
+ export { GetModelResolverImpl } from "./getModel.js";
@@ -7,3 +7,4 @@ export { UpdateEntryRevisionResolverImpl } from "./updateEntryRevision.js";
7
7
  export { DeleteEntryRevisionResolverImpl } from "./deleteEntryRevision.js";
8
8
  export { PublishEntryRevisionResolverImpl } from "./publishEntryRevision.js";
9
9
  export { UnpublishEntryRevisionResolverImpl } from "./unpublishEntryRevision.js";
10
+ export { GetModelResolverImpl } from "./getModel.js";
@@ -19,6 +19,7 @@ class CmsQueryTypeDefs {
19
19
  fields: [String!]!
20
20
  preview: Boolean
21
21
  ): CmsListResponse!
22
+ getModel(modelId: ID!): CmsModelResponse!
22
23
  }
23
24
 
24
25
  extend type Query {
@@ -1 +1 @@
1
- {"version":3,"file":"graphql/schema/cms/typeDefs/query.js","sources":["../../../../../src/graphql/schema/cms/typeDefs/query.ts"],"sourcesContent":["import { CoreGraphQLSchemaFactory } from \"@webiny/api-graphql/graphql/abstractions.core.js\";\n\nclass CmsQueryTypeDefs implements CoreGraphQLSchemaFactory.Interface {\n async execute(\n builder: CoreGraphQLSchemaFactory.SchemaBuilder\n ): CoreGraphQLSchemaFactory.Return {\n builder.addTypeDefs(/* GraphQL */ `\n type CmsQuery {\n getEntry(\n modelId: ID!\n where: JSON!\n fields: [String!]!\n preview: Boolean\n ): CmsEntryResponse!\n listEntries(\n modelId: ID!\n where: JSON\n sort: JSON\n limit: Int\n after: String\n search: String\n fields: [String!]!\n preview: Boolean\n ): CmsListResponse!\n }\n\n extend type Query {\n cms: CmsQuery!\n }\n `);\n\n return builder;\n }\n}\n\nexport const CmsQueryTypeDefsImpl = CoreGraphQLSchemaFactory.createImplementation({\n implementation: CmsQueryTypeDefs,\n dependencies: []\n});\n"],"names":["CmsQueryTypeDefs","builder","CmsQueryTypeDefsImpl","CoreGraphQLSchemaFactory"],"mappings":";AAEA,MAAMA;IACF,MAAM,QACFC,OAA+C,EAChB;QAC/BA,QAAQ,WAAW,CAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;QAuBnC,CAAC;QAED,OAAOA;IACX;AACJ;AAEO,MAAMC,uBAAuBC,yBAAyB,oBAAoB,CAAC;IAC9E,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
1
+ {"version":3,"file":"graphql/schema/cms/typeDefs/query.js","sources":["../../../../../src/graphql/schema/cms/typeDefs/query.ts"],"sourcesContent":["import { CoreGraphQLSchemaFactory } from \"@webiny/api-graphql/graphql/abstractions.core.js\";\n\nclass CmsQueryTypeDefs implements CoreGraphQLSchemaFactory.Interface {\n async execute(\n builder: CoreGraphQLSchemaFactory.SchemaBuilder\n ): CoreGraphQLSchemaFactory.Return {\n builder.addTypeDefs(/* GraphQL */ `\n type CmsQuery {\n getEntry(\n modelId: ID!\n where: JSON!\n fields: [String!]!\n preview: Boolean\n ): CmsEntryResponse!\n listEntries(\n modelId: ID!\n where: JSON\n sort: JSON\n limit: Int\n after: String\n search: String\n fields: [String!]!\n preview: Boolean\n ): CmsListResponse!\n getModel(modelId: ID!): CmsModelResponse!\n }\n\n extend type Query {\n cms: CmsQuery!\n }\n `);\n\n return builder;\n }\n}\n\nexport const CmsQueryTypeDefsImpl = CoreGraphQLSchemaFactory.createImplementation({\n implementation: CmsQueryTypeDefs,\n dependencies: []\n});\n"],"names":["CmsQueryTypeDefs","builder","CmsQueryTypeDefsImpl","CoreGraphQLSchemaFactory"],"mappings":";AAEA,MAAMA;IACF,MAAM,QACFC,OAA+C,EAChB;QAC/BA,QAAQ,WAAW,CAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;QAwBnC,CAAC;QAED,OAAOA;IACX;AACJ;AAEO,MAAMC,uBAAuBC,yBAAyB,oBAAoB,CAAC;IAC9E,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
@@ -23,6 +23,11 @@ class CmsResponseTypeDefs {
23
23
  data: Boolean
24
24
  error: CmsError
25
25
  }
26
+
27
+ type CmsModelResponse {
28
+ data: JSON
29
+ error: CmsError
30
+ }
26
31
  `);
27
32
  return builder;
28
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"graphql/schema/cms/typeDefs/responses.js","sources":["../../../../../src/graphql/schema/cms/typeDefs/responses.ts"],"sourcesContent":["import { CoreGraphQLSchemaFactory } from \"@webiny/api-graphql/graphql/abstractions.core.js\";\n\nclass CmsResponseTypeDefs implements CoreGraphQLSchemaFactory.Interface {\n async execute(\n builder: CoreGraphQLSchemaFactory.SchemaBuilder\n ): CoreGraphQLSchemaFactory.Return {\n builder.addTypeDefs(/* GraphQL */ `\n type CmsEntryResponse {\n data: JSON\n error: CmsError\n }\n\n type CmsListMeta {\n cursor: String\n hasMoreItems: Boolean\n totalCount: Int\n }\n\n type CmsListResponse {\n data: [JSON!]\n meta: CmsListMeta\n error: CmsError\n }\n\n type CmsDeleteResponse {\n data: Boolean\n error: CmsError\n }\n `);\n\n return builder;\n }\n}\n\nexport const CmsResponseTypeDefsImpl = CoreGraphQLSchemaFactory.createImplementation({\n implementation: CmsResponseTypeDefs,\n dependencies: []\n});\n"],"names":["CmsResponseTypeDefs","builder","CmsResponseTypeDefsImpl","CoreGraphQLSchemaFactory"],"mappings":";AAEA,MAAMA;IACF,MAAM,QACFC,OAA+C,EAChB;QAC/BA,QAAQ,WAAW,CAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;QAsBnC,CAAC;QAED,OAAOA;IACX;AACJ;AAEO,MAAMC,0BAA0BC,yBAAyB,oBAAoB,CAAC;IACjF,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
1
+ {"version":3,"file":"graphql/schema/cms/typeDefs/responses.js","sources":["../../../../../src/graphql/schema/cms/typeDefs/responses.ts"],"sourcesContent":["import { CoreGraphQLSchemaFactory } from \"@webiny/api-graphql/graphql/abstractions.core.js\";\n\nclass CmsResponseTypeDefs implements CoreGraphQLSchemaFactory.Interface {\n async execute(\n builder: CoreGraphQLSchemaFactory.SchemaBuilder\n ): CoreGraphQLSchemaFactory.Return {\n builder.addTypeDefs(/* GraphQL */ `\n type CmsEntryResponse {\n data: JSON\n error: CmsError\n }\n\n type CmsListMeta {\n cursor: String\n hasMoreItems: Boolean\n totalCount: Int\n }\n\n type CmsListResponse {\n data: [JSON!]\n meta: CmsListMeta\n error: CmsError\n }\n\n type CmsDeleteResponse {\n data: Boolean\n error: CmsError\n }\n\n type CmsModelResponse {\n data: JSON\n error: CmsError\n }\n `);\n\n return builder;\n }\n}\n\nexport const CmsResponseTypeDefsImpl = CoreGraphQLSchemaFactory.createImplementation({\n implementation: CmsResponseTypeDefs,\n dependencies: []\n});\n"],"names":["CmsResponseTypeDefs","builder","CmsResponseTypeDefsImpl","CoreGraphQLSchemaFactory"],"mappings":";AAEA,MAAMA;IACF,MAAM,QACFC,OAA+C,EAChB;QAC/BA,QAAQ,WAAW,CAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;QA2BnC,CAAC;QAED,OAAOA;IACX;AACJ;AAEO,MAAMC,0BAA0BC,yBAAyB,oBAAoB,CAAC;IACjF,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
@@ -8,6 +8,8 @@ import { UpdateModelUseCase } from "../../features/contentModel/UpdateModel/inde
8
8
  import { DeleteModelUseCase } from "../../features/contentModel/DeleteModel/index.js";
9
9
  import { HeadlessCmsEndpointConfig } from "../../HeadlessCmsEndpointConfig.js";
10
10
  import { ValuesSelectionGenerator } from "../../features/contentModel/ValuesSelectionGenerator/abstractions.js";
11
+ import { ComponentMapGenerator } from "../../features/contentModel/ComponentMapGenerator/abstractions.js";
12
+ import { RefModelsGenerator } from "../../features/contentModel/RefModelsGenerator/abstractions.js";
11
13
  const createModelsSchema = ({ context })=>{
12
14
  const isManage = "manage" === context.container.resolve(HeadlessCmsEndpointConfig).type;
13
15
  const resolvers = {
@@ -47,7 +49,22 @@ const createModelsSchema = ({ context })=>{
47
49
  return Array.isArray(field.tags) ? field.tags : [];
48
50
  }
49
51
  },
52
+ CmsContentModelMetadata: {
53
+ valuesSelection: (model, _, ctx)=>{
54
+ const generator = ctx.container.resolve(ValuesSelectionGenerator);
55
+ return generator.generate(model);
56
+ },
57
+ componentMap: (model, _, ctx)=>{
58
+ const generator = ctx.container.resolve(ComponentMapGenerator);
59
+ return generator.generate(model);
60
+ },
61
+ refModels: async (model, _, ctx)=>{
62
+ const generator = ctx.container.resolve(RefModelsGenerator);
63
+ return generator.generate(model);
64
+ }
65
+ },
50
66
  CmsContentModel: {
67
+ metadata: (model)=>model,
51
68
  tags (model) {
52
69
  const hasType = (model.tags || []).find((tag)=>tag.startsWith("type:"));
53
70
  return hasType ? model.tags : [
@@ -172,6 +189,7 @@ const createModelsSchema = ({ context })=>{
172
189
  imageFieldId: String
173
190
  tags: [String!]
174
191
  defaultFields: Boolean
192
+ settings: JSON
175
193
  }
176
194
 
177
195
  input CmsContentModelCreateFromInput {
@@ -197,6 +215,7 @@ const createModelsSchema = ({ context })=>{
197
215
  descriptionFieldId: String
198
216
  imageFieldId: String
199
217
  tags: [String!]
218
+ settings: JSON
200
219
  }
201
220
 
202
221
  extend type Mutation {
@@ -270,6 +289,16 @@ const createModelsSchema = ({ context })=>{
270
289
  rules: [CmsFieldRule!]
271
290
  }
272
291
 
292
+ type CmsContentModelRefModel {
293
+ valuesSelection: String
294
+ }
295
+
296
+ type CmsContentModelMetadata {
297
+ valuesSelection: String
298
+ componentMap: JSON
299
+ refModels: JSON
300
+ }
301
+
273
302
  type CmsContentModel {
274
303
  name: String!
275
304
  singularApiName: String!
@@ -288,9 +317,11 @@ const createModelsSchema = ({ context })=>{
288
317
  imageFieldId: String
289
318
  tags: [String!]!
290
319
  tenant: String!
320
+ settings: JSON
291
321
  # Returns true if the content model is registered via a plugin.
292
322
  plugin: Boolean!
293
323
  valuesSelection: String
324
+ metadata: CmsContentModelMetadata
294
325
  }
295
326
 
296
327
  type CmsContentModelResponse {
@@ -1 +1 @@
1
- {"version":3,"file":"graphql/schema/contentModels.js","sources":["../../../src/graphql/schema/contentModels.ts"],"sourcesContent":["import { ErrorResponse, NotFoundError, Response } from \"@webiny/api-graphql\";\nimport type { CmsContext, CmsModel } from \"~/types/index.js\";\nimport type { Resolvers } from \"@webiny/api-graphql/types.js\";\nimport type { ICmsGraphQLSchemaPlugin } from \"~/plugins/index.js\";\nimport { createCmsGraphQLSchemaPlugin } from \"~/plugins/index.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport { GetModelUseCase } from \"~/features/contentModel/GetModel/index.js\";\nimport { ListModelsUseCase } from \"~/features/contentModel/ListModels/index.js\";\nimport { CreateModelUseCase } from \"~/features/contentModel/CreateModel/index.js\";\nimport { CreateModelFromUseCase } from \"~/features/contentModel/CreateModelFrom/index.js\";\nimport { UpdateModelUseCase } from \"~/features/contentModel/UpdateModel/index.js\";\nimport { DeleteModelUseCase } from \"~/features/contentModel/DeleteModel/index.js\";\nimport { HeadlessCmsEndpointConfig } from \"~/HeadlessCmsEndpointConfig.js\";\nimport { ValuesSelectionGenerator } from \"~/features/contentModel/ValuesSelectionGenerator/abstractions.js\";\n\nexport interface CreateModelsSchemaParams {\n context: CmsContext;\n}\n\nexport const createModelsSchema = ({\n context\n}: CreateModelsSchemaParams): ICmsGraphQLSchemaPlugin => {\n const isManage = context.container.resolve(HeadlessCmsEndpointConfig).type === \"manage\";\n\n const resolvers: Resolvers<CmsContext> = {\n Query: {\n getContentModel: async (_: unknown, args: GenericRecord, context) => {\n try {\n const result = await context.container\n .resolve(GetModelUseCase)\n .execute(args.modelId);\n if (result.isFail()) {\n throw result.error;\n }\n if (!result.value) {\n throw new NotFoundError(`Content model \"${args.modelId}\" was not found!`);\n }\n return new Response(result.value);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n listContentModels: async (_: unknown, args: GenericRecord, context: CmsContext) => {\n try {\n const result = await context.container.resolve(ListModelsUseCase).execute({\n includePrivate: false,\n includePlugins: args?.includePlugins === false ? false : true\n });\n if (result.isFail()) {\n throw result.error;\n }\n return new Response(result.value);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n },\n CmsContentModelField: {\n renderer: field => {\n // Make sure `settings` is an object.\n if (field.renderer) {\n // We're using `||` here, because we want to use the fallback value for both `undefined` and `null`.\n return { ...field.renderer, settings: field.renderer.settings || {} };\n }\n\n return field.renderer;\n },\n tags(field) {\n // Make sure `tags` are always returned as an array.\n return Array.isArray(field.tags) ? field.tags : [];\n }\n },\n CmsContentModel: {\n tags(model: CmsModel) {\n // Make sure `tags` always contain a `type` tag, to differentiate between models.\n const hasType = (model.tags || []).find(tag => tag.startsWith(\"type:\"));\n\n return hasType ? model.tags : [\"type:model\", ...(model.tags || [])];\n },\n plugin: (model: CmsModel) => {\n return model.isPlugin ?? false;\n },\n valuesSelection: (model: CmsModel, _: unknown, ctx: CmsContext) => {\n const generator = ctx.container.resolve(ValuesSelectionGenerator);\n return generator.generate(model);\n }\n }\n };\n\n let manageSchema = \"\";\n if (isManage) {\n resolvers[\"Mutation\"] = {\n createContentModel: async (_: unknown, args: any, context) => {\n try {\n const result = await context.container\n .resolve(CreateModelUseCase)\n .execute(args.data);\n if (result.isFail()) {\n throw result.error;\n }\n return new Response(result.value);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n createContentModelFrom: async (_: unknown, args: any, context) => {\n try {\n const result = await context.container\n .resolve(CreateModelFromUseCase)\n .execute(args.modelId, args.data);\n if (result.isFail()) {\n throw result.error;\n }\n return new Response(result.value);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n updateContentModel: async (_: unknown, args: any, context) => {\n const { modelId, data } = args;\n try {\n const result = await context.container\n .resolve(UpdateModelUseCase)\n .execute(modelId, data);\n if (result.isFail()) {\n throw result.error;\n }\n return new Response(result.value);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n deleteContentModel: async (_: unknown, args: any, context) => {\n const { modelId } = args;\n try {\n const result = await context.container\n .resolve(DeleteModelUseCase)\n .execute(modelId);\n if (result.isFail()) {\n throw result.error;\n }\n return new Response(true);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n };\n\n manageSchema = /* GraphQL */ `\n input CmsPredefinedValueInput {\n label: String!\n value: String!\n selected: Boolean\n }\n\n input CmsPredefinedValuesInput {\n enabled: Boolean\n values: [CmsPredefinedValueInput]\n }\n input CmsFieldRendererInput {\n name: String\n settings: JSON\n }\n\n input CmsFieldValidationInput {\n name: String!\n message: String\n settings: JSON\n }\n\n input CmsFieldRuleInput {\n type: String!\n target: String!\n operator: String!\n value: JSON\n action: String!\n }\n\n input CmsContentModelFieldInput {\n id: ID!\n label: String!\n help: String\n description: String\n note: String\n placeholder: String\n # we never use user input - this is here to the GraphQL does not break when posting from our UI\n # used for debugging purposes\n storageId: String\n fieldId: String!\n type: String!\n tags: [String!]\n list: Boolean\n predefinedValues: CmsPredefinedValuesInput\n renderer: CmsFieldRendererInput\n validation: [CmsFieldValidationInput]\n listValidation: [CmsFieldValidationInput]\n settings: JSON\n rules: [CmsFieldRuleInput!]\n }\n\n input CmsContentModelCreateInput {\n name: String!\n singularApiName: String!\n pluralApiName: String!\n modelId: String\n group: String!\n icon: Icon\n singleEntry: Boolean\n description: String\n layout: JSON\n fields: [CmsContentModelFieldInput!]\n titleFieldId: String\n descriptionFieldId: String\n imageFieldId: String\n tags: [String!]\n defaultFields: Boolean\n }\n\n input CmsContentModelCreateFromInput {\n name: String!\n singularApiName: String!\n pluralApiName: String!\n modelId: String\n group: String!\n icon: Icon\n description: String\n }\n\n input CmsContentModelUpdateInput {\n name: String\n singularApiName: String\n pluralApiName: String\n group: String\n icon: Icon\n description: String\n layout: JSON!\n fields: [CmsContentModelFieldInput!]!\n titleFieldId: String\n descriptionFieldId: String\n imageFieldId: String\n tags: [String!]\n }\n\n extend type Mutation {\n createContentModel(data: CmsContentModelCreateInput!): CmsContentModelResponse\n\n createContentModelFrom(\n modelId: ID!\n data: CmsContentModelCreateFromInput!\n ): CmsContentModelResponse\n\n updateContentModel(\n modelId: ID!\n data: CmsContentModelUpdateInput!\n ): CmsContentModelResponse\n\n deleteContentModel(modelId: ID!): CmsDeleteResponse\n }\n `;\n }\n\n const plugin = createCmsGraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n type CmsFieldValidation {\n name: String!\n message: String\n settings: JSON\n }\n\n type CmsFieldRenderer {\n name: String\n settings: JSON\n }\n\n type CmsPredefinedValue {\n label: String\n value: String\n selected: Boolean\n }\n\n type CmsPredefinedValues {\n enabled: Boolean\n values: [CmsPredefinedValue]\n }\n\n type CmsFieldRule {\n type: String!\n target: String!\n operator: String!\n value: JSON\n action: String!\n }\n\n type CmsContentModelField {\n id: ID!\n # auto-generated value\n # used for debugging purposes\n storageId: String\n fieldId: String!\n label: String!\n help: String\n description: String\n note: String\n placeholder: String\n type: String!\n tags: [String!]!\n list: Boolean\n predefinedValues: CmsPredefinedValues\n renderer: CmsFieldRenderer\n validation: [CmsFieldValidation!]\n listValidation: [CmsFieldValidation!]\n settings: JSON\n rules: [CmsFieldRule!]\n }\n\n type CmsContentModel {\n name: String!\n singularApiName: String!\n pluralApiName: String!\n modelId: String!\n description: String\n group: String!\n icon: Icon\n createdOn: DateTime\n savedOn: DateTime\n createdBy: CmsIdentity\n fields: [CmsContentModelField!]!\n layout: JSON!\n titleFieldId: String\n descriptionFieldId: String\n imageFieldId: String\n tags: [String!]!\n tenant: String!\n # Returns true if the content model is registered via a plugin.\n plugin: Boolean!\n valuesSelection: String\n }\n\n type CmsContentModelResponse {\n data: CmsContentModel\n error: CmsError\n }\n\n type CmsContentModelListResponse {\n data: [CmsContentModel]\n meta: CmsListMeta\n error: CmsError\n }\n\n extend type Query {\n getContentModel(modelId: ID!, where: JSON, sort: String): CmsContentModelResponse\n\n listContentModels(includePlugins: Boolean = true): CmsContentModelListResponse\n }\n\n ${manageSchema}\n `,\n resolvers\n });\n\n const endpointType = context.container.resolve(HeadlessCmsEndpointConfig).type;\n plugin.name = `headless-cms.graphql.schema.${endpointType}.content-models`;\n return plugin;\n};\n"],"names":["createModelsSchema","context","isManage","HeadlessCmsEndpointConfig","resolvers","_","args","result","GetModelUseCase","NotFoundError","Response","e","ErrorResponse","ListModelsUseCase","field","Array","model","hasType","tag","ctx","generator","ValuesSelectionGenerator","manageSchema","CreateModelUseCase","CreateModelFromUseCase","modelId","data","UpdateModelUseCase","DeleteModelUseCase","plugin","createCmsGraphQLSchemaPl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MC,SAAS,MAAMN,QAAQ,SAAS,CACjC,OAAO,CAAC0B,oBACR,OAAO,CAACF,SAASC;oBACtB,IAAInB,OAAO,MAAM,IACb,MAAMA,OAAO,KAAK;oBAEtB,OAAO,IAAIG,SAASH,OAAO,KAAK;gBACpC,EAAE,OAAOI,GAAG;oBACR,OAAO,IAAIC,cAAcD;gBAC7B;YACJ;YACA,oBAAoB,OAAON,GAAYC,MAAWL;gBAC9C,MAAM,EAAEwB,OAAO,EAAE,GAAGnB;gBACpB,IAAI;oBACA,MAAMC,SAAS,MAAMN,QAAQ,SAAS,CACjC,OAAO,CAAC2B,oBACR,OAAO,CAACH;oBACb,IAAIlB,OAAO,MAAM,IACb,MAAMA,OAAO,KAAK;oBAEtB,OAAO,IAAIG,SAAS;gBACxB,EAAE,OAAOC,GAAG;oBACR,OAAO,IAAIC,cAAcD;gBAC7B;YACJ;QACJ;QAEAW,eAA6B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA8G9B,CAAC;IACL;IAEA,MAAMO,SAASC,6BAA6B;QACxC,UAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA6FrB,EAAER,aAAa;QACnB,CAAC;QACDlB;IACJ;IAEA,MAAM2B,eAAe9B,QAAQ,SAAS,CAAC,OAAO,CAACE,2BAA2B,IAAI;IAC9E0B,OAAO,IAAI,GAAG,CAAC,4BAA4B,EAAEE,aAAa,eAAe,CAAC;IAC1E,OAAOF;AACX"}
1
+ {"version":3,"file":"graphql/schema/contentModels.js","sources":["../../../src/graphql/schema/contentModels.ts"],"sourcesContent":["import { ErrorResponse, NotFoundError, Response } from \"@webiny/api-graphql\";\nimport type { CmsContext, CmsModel } from \"~/types/index.js\";\nimport type { Resolvers } from \"@webiny/api-graphql/types.js\";\nimport type { ICmsGraphQLSchemaPlugin } from \"~/plugins/index.js\";\nimport { createCmsGraphQLSchemaPlugin } from \"~/plugins/index.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport { GetModelUseCase } from \"~/features/contentModel/GetModel/index.js\";\nimport { ListModelsUseCase } from \"~/features/contentModel/ListModels/index.js\";\nimport { CreateModelUseCase } from \"~/features/contentModel/CreateModel/index.js\";\nimport { CreateModelFromUseCase } from \"~/features/contentModel/CreateModelFrom/index.js\";\nimport { UpdateModelUseCase } from \"~/features/contentModel/UpdateModel/index.js\";\nimport { DeleteModelUseCase } from \"~/features/contentModel/DeleteModel/index.js\";\nimport { HeadlessCmsEndpointConfig } from \"~/HeadlessCmsEndpointConfig.js\";\nimport { ValuesSelectionGenerator } from \"~/features/contentModel/ValuesSelectionGenerator/abstractions.js\";\nimport { ComponentMapGenerator } from \"~/features/contentModel/ComponentMapGenerator/abstractions.js\";\nimport { RefModelsGenerator } from \"~/features/contentModel/RefModelsGenerator/abstractions.js\";\n\nexport interface CreateModelsSchemaParams {\n context: CmsContext;\n}\n\nexport const createModelsSchema = ({\n context\n}: CreateModelsSchemaParams): ICmsGraphQLSchemaPlugin => {\n const isManage = context.container.resolve(HeadlessCmsEndpointConfig).type === \"manage\";\n\n const resolvers: Resolvers<CmsContext> = {\n Query: {\n getContentModel: async (_: unknown, args: GenericRecord, context) => {\n try {\n const result = await context.container\n .resolve(GetModelUseCase)\n .execute(args.modelId);\n if (result.isFail()) {\n throw result.error;\n }\n if (!result.value) {\n throw new NotFoundError(`Content model \"${args.modelId}\" was not found!`);\n }\n return new Response(result.value);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n listContentModels: async (_: unknown, args: GenericRecord, context: CmsContext) => {\n try {\n const result = await context.container.resolve(ListModelsUseCase).execute({\n includePrivate: false,\n includePlugins: args?.includePlugins === false ? false : true\n });\n if (result.isFail()) {\n throw result.error;\n }\n return new Response(result.value);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n },\n CmsContentModelField: {\n renderer: field => {\n // Make sure `settings` is an object.\n if (field.renderer) {\n // We're using `||` here, because we want to use the fallback value for both `undefined` and `null`.\n return { ...field.renderer, settings: field.renderer.settings || {} };\n }\n\n return field.renderer;\n },\n tags(field) {\n // Make sure `tags` are always returned as an array.\n return Array.isArray(field.tags) ? field.tags : [];\n }\n },\n CmsContentModelMetadata: {\n valuesSelection: (model: CmsModel, _: unknown, ctx: CmsContext) => {\n const generator = ctx.container.resolve(ValuesSelectionGenerator);\n return generator.generate(model);\n },\n componentMap: (model: CmsModel, _: unknown, ctx: CmsContext) => {\n const generator = ctx.container.resolve(ComponentMapGenerator);\n return generator.generate(model);\n },\n refModels: async (model: CmsModel, _: unknown, ctx: CmsContext) => {\n const generator = ctx.container.resolve(RefModelsGenerator);\n return generator.generate(model);\n }\n },\n CmsContentModel: {\n metadata: (model: CmsModel) => model,\n tags(model: CmsModel) {\n // Make sure `tags` always contain a `type` tag, to differentiate between models.\n const hasType = (model.tags || []).find(tag => tag.startsWith(\"type:\"));\n\n return hasType ? model.tags : [\"type:model\", ...(model.tags || [])];\n },\n plugin: (model: CmsModel) => {\n return model.isPlugin ?? false;\n },\n valuesSelection: (model: CmsModel, _: unknown, ctx: CmsContext) => {\n const generator = ctx.container.resolve(ValuesSelectionGenerator);\n return generator.generate(model);\n }\n }\n };\n\n let manageSchema = \"\";\n if (isManage) {\n resolvers[\"Mutation\"] = {\n createContentModel: async (_: unknown, args: any, context) => {\n try {\n const result = await context.container\n .resolve(CreateModelUseCase)\n .execute(args.data);\n if (result.isFail()) {\n throw result.error;\n }\n return new Response(result.value);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n createContentModelFrom: async (_: unknown, args: any, context) => {\n try {\n const result = await context.container\n .resolve(CreateModelFromUseCase)\n .execute(args.modelId, args.data);\n if (result.isFail()) {\n throw result.error;\n }\n return new Response(result.value);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n updateContentModel: async (_: unknown, args: any, context) => {\n const { modelId, data } = args;\n try {\n const result = await context.container\n .resolve(UpdateModelUseCase)\n .execute(modelId, data);\n if (result.isFail()) {\n throw result.error;\n }\n return new Response(result.value);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n deleteContentModel: async (_: unknown, args: any, context) => {\n const { modelId } = args;\n try {\n const result = await context.container\n .resolve(DeleteModelUseCase)\n .execute(modelId);\n if (result.isFail()) {\n throw result.error;\n }\n return new Response(true);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n };\n\n manageSchema = /* GraphQL */ `\n input CmsPredefinedValueInput {\n label: String!\n value: String!\n selected: Boolean\n }\n\n input CmsPredefinedValuesInput {\n enabled: Boolean\n values: [CmsPredefinedValueInput]\n }\n input CmsFieldRendererInput {\n name: String\n settings: JSON\n }\n\n input CmsFieldValidationInput {\n name: String!\n message: String\n settings: JSON\n }\n\n input CmsFieldRuleInput {\n type: String!\n target: String!\n operator: String!\n value: JSON\n action: String!\n }\n\n input CmsContentModelFieldInput {\n id: ID!\n label: String!\n help: String\n description: String\n note: String\n placeholder: String\n # we never use user input - this is here to the GraphQL does not break when posting from our UI\n # used for debugging purposes\n storageId: String\n fieldId: String!\n type: String!\n tags: [String!]\n list: Boolean\n predefinedValues: CmsPredefinedValuesInput\n renderer: CmsFieldRendererInput\n validation: [CmsFieldValidationInput]\n listValidation: [CmsFieldValidationInput]\n settings: JSON\n rules: [CmsFieldRuleInput!]\n }\n\n input CmsContentModelCreateInput {\n name: String!\n singularApiName: String!\n pluralApiName: String!\n modelId: String\n group: String!\n icon: Icon\n singleEntry: Boolean\n description: String\n layout: JSON\n fields: [CmsContentModelFieldInput!]\n titleFieldId: String\n descriptionFieldId: String\n imageFieldId: String\n tags: [String!]\n defaultFields: Boolean\n settings: JSON\n }\n\n input CmsContentModelCreateFromInput {\n name: String!\n singularApiName: String!\n pluralApiName: String!\n modelId: String\n group: String!\n icon: Icon\n description: String\n }\n\n input CmsContentModelUpdateInput {\n name: String\n singularApiName: String\n pluralApiName: String\n group: String\n icon: Icon\n description: String\n layout: JSON!\n fields: [CmsContentModelFieldInput!]!\n titleFieldId: String\n descriptionFieldId: String\n imageFieldId: String\n tags: [String!]\n settings: JSON\n }\n\n extend type Mutation {\n createContentModel(data: CmsContentModelCreateInput!): CmsContentModelResponse\n\n createContentModelFrom(\n modelId: ID!\n data: CmsContentModelCreateFromInput!\n ): CmsContentModelResponse\n\n updateContentModel(\n modelId: ID!\n data: CmsContentModelUpdateInput!\n ): CmsContentModelResponse\n\n deleteContentModel(modelId: ID!): CmsDeleteResponse\n }\n `;\n }\n\n const plugin = createCmsGraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n type CmsFieldValidation {\n name: String!\n message: String\n settings: JSON\n }\n\n type CmsFieldRenderer {\n name: String\n settings: JSON\n }\n\n type CmsPredefinedValue {\n label: String\n value: String\n selected: Boolean\n }\n\n type CmsPredefinedValues {\n enabled: Boolean\n values: [CmsPredefinedValue]\n }\n\n type CmsFieldRule {\n type: String!\n target: String!\n operator: String!\n value: JSON\n action: String!\n }\n\n type CmsContentModelField {\n id: ID!\n # auto-generated value\n # used for debugging purposes\n storageId: String\n fieldId: String!\n label: String!\n help: String\n description: String\n note: String\n placeholder: String\n type: String!\n tags: [String!]!\n list: Boolean\n predefinedValues: CmsPredefinedValues\n renderer: CmsFieldRenderer\n validation: [CmsFieldValidation!]\n listValidation: [CmsFieldValidation!]\n settings: JSON\n rules: [CmsFieldRule!]\n }\n\n type CmsContentModelRefModel {\n valuesSelection: String\n }\n\n type CmsContentModelMetadata {\n valuesSelection: String\n componentMap: JSON\n refModels: JSON\n }\n\n type CmsContentModel {\n name: String!\n singularApiName: String!\n pluralApiName: String!\n modelId: String!\n description: String\n group: String!\n icon: Icon\n createdOn: DateTime\n savedOn: DateTime\n createdBy: CmsIdentity\n fields: [CmsContentModelField!]!\n layout: JSON!\n titleFieldId: String\n descriptionFieldId: String\n imageFieldId: String\n tags: [String!]!\n tenant: String!\n settings: JSON\n # Returns true if the content model is registered via a plugin.\n plugin: Boolean!\n valuesSelection: String\n metadata: CmsContentModelMetadata\n }\n\n type CmsContentModelResponse {\n data: CmsContentModel\n error: CmsError\n }\n\n type CmsContentModelListResponse {\n data: [CmsContentModel]\n meta: CmsListMeta\n error: CmsError\n }\n\n extend type Query {\n getContentModel(modelId: ID!, where: JSON, sort: String): CmsContentModelResponse\n\n listContentModels(includePlugins: Boolean = true): CmsContentModelListResponse\n }\n\n ${manageSchema}\n `,\n resolvers\n });\n\n const endpointType = context.container.resolve(HeadlessCmsEndpointConfig).type;\n plugin.name = `headless-cms.graphql.schema.${endpointType}.content-models`;\n return plugin;\n};\n"],"names":["createModelsSchema","context","isManage","HeadlessCmsEndpointConfig","resolvers","_","args","result","GetModelUseCase","NotFoundError","Response","e","ErrorResponse","ListModelsUseCase","field","Array","model","ctx","generator","ValuesSelectionGenerator","ComponentMapGenerator","RefModelsGenerator","hasType","tag","manageSchema","CreateModelUseCase","CreateModelFromUseCase","modelId","data","UpdateModelUseCase","DeleteModelUseCase","plugin","createCmsGraphQLSchemaPlugin","endpointType"],"mappings":";;;;;;;;;;;;AAqBO,MAAMA,qBAAqB,CAAC,EAC/BC,OAAO,EACgB;IACvB,MAAMC,WAAWD,AAA8D,aAA9DA,QAAQ,SAAS,CAAC,OAAO,CAACE,2BAA2B,IAAI;IAE1E,MAAMC,YAAmC;QACrC,OAAO;YACH,iBAAiB,OAAOC,GAAYC,MAAqBL;gBACrD,IAAI;oBACA,MAAMM,SAAS,MAAMN,QAAQ,SAAS,CACjC,OAAO,CAACO,iBACR,OAAO,CAACF,KAAK,OAAO;oBACzB,IAAIC,OAAO,MAAM,IACb,MAAMA,OAAO,KAAK;oBAEtB,IAAI,CAACA,OAAO,KAAK,EACb,MAAM,IAAIE,cAAc,CAAC,eAAe,EAAEH,KAAK,OAAO,CAAC,gBAAgB,CAAC;oBAE5E,OAAO,IAAII,SAASH,OAA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AAO,MAAM,IACb,MAAMA,OAAO,KAAK;oBAEtB,OAAO,IAAIG,SAASH,OAAO,KAAK;gBACpC,EAAE,OAAOI,GAAG;oBACR,OAAO,IAAIC,cAAcD;gBAC7B;YACJ;YACA,oBAAoB,OAAON,GAAYC,MAAWL;gBAC9C,MAAM,EAAE0B,OAAO,EAAE,GAAGrB;gBACpB,IAAI;oBACA,MAAMC,SAAS,MAAMN,QAAQ,SAAS,CACjC,OAAO,CAAC6B,oBACR,OAAO,CAACH;oBACb,IAAIpB,OAAO,MAAM,IACb,MAAMA,OAAO,KAAK;oBAEtB,OAAO,IAAIG,SAAS;gBACxB,EAAE,OAAOC,GAAG;oBACR,OAAO,IAAIC,cAAcD;gBAC7B;YACJ;QACJ;QAEAa,eAA6B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAgH9B,CAAC;IACL;IAEA,MAAMO,SAASC,6BAA6B;QACxC,UAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAyGrB,EAAER,aAAa;QACnB,CAAC;QACDpB;IACJ;IAEA,MAAM6B,eAAehC,QAAQ,SAAS,CAAC,OAAO,CAACE,2BAA2B,IAAI;IAC9E4B,OAAO,IAAI,GAAG,CAAC,4BAA4B,EAAEE,aAAa,eAAe,CAAC;IAC1E,OAAOF;AACX"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-headless-cms",
3
- "version": "6.6.0-alpha.0",
3
+ "version": "6.6.0-alpha.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -23,20 +23,20 @@
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
25
  "@babel/code-frame": "8.0.0",
26
- "@graphql-tools/merge": "9.2.2",
27
- "@graphql-tools/schema": "10.0.38",
28
- "@webiny/api": "6.6.0-alpha.0",
29
- "@webiny/api-core": "6.6.0-alpha.0",
30
- "@webiny/api-core-testing": "6.6.0-alpha.0",
31
- "@webiny/api-graphql": "6.6.0-alpha.0",
32
- "@webiny/di": "1.0.2",
33
- "@webiny/error": "6.6.0-alpha.0",
34
- "@webiny/event-handler-core": "6.6.0-alpha.0",
35
- "@webiny/feature": "6.6.0-alpha.0",
36
- "@webiny/handler": "6.6.0-alpha.0",
37
- "@webiny/plugins": "6.6.0-alpha.0",
38
- "@webiny/utils": "6.6.0-alpha.0",
39
- "@webiny/validation": "6.6.0-alpha.0",
26
+ "@graphql-tools/merge": "9.2.3",
27
+ "@graphql-tools/schema": "10.1.0",
28
+ "@webiny/api": "6.6.0-alpha.1",
29
+ "@webiny/api-core": "6.6.0-alpha.1",
30
+ "@webiny/api-core-testing": "6.6.0-alpha.1",
31
+ "@webiny/api-graphql": "6.6.0-alpha.1",
32
+ "@webiny/di": "1.1.0",
33
+ "@webiny/error": "6.6.0-alpha.1",
34
+ "@webiny/event-handler-core": "6.6.0-alpha.1",
35
+ "@webiny/feature": "6.6.0-alpha.1",
36
+ "@webiny/handler": "6.6.0-alpha.1",
37
+ "@webiny/plugins": "6.6.0-alpha.1",
38
+ "@webiny/utils": "6.6.0-alpha.1",
39
+ "@webiny/validation": "6.6.0-alpha.1",
40
40
  "dot-prop-immutable": "2.1.1",
41
41
  "graphql": "16.14.2",
42
42
  "graphql-tag": "2.12.7",
@@ -49,16 +49,15 @@
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/pluralize": "0.0.33",
52
- "@webiny/build-tools": "6.6.0-alpha.0",
53
- "@webiny/db-dynamodb": "6.6.0-alpha.0",
54
- "@webiny/project-utils": "6.6.0-alpha.0",
55
- "@webiny/sdk": "6.6.0-alpha.0",
56
- "@webiny/wcp": "6.6.0-alpha.0",
52
+ "@webiny/build-tools": "6.6.0-alpha.1",
53
+ "@webiny/db-dynamodb": "6.6.0-alpha.1",
54
+ "@webiny/sdk": "6.6.0-alpha.1",
55
+ "@webiny/wcp": "6.6.0-alpha.1",
57
56
  "graphql": "16.14.2",
58
- "oxfmt": "0.61.0",
57
+ "oxfmt": "0.64.0",
59
58
  "rimraf": "6.1.3",
60
59
  "typescript": "7.0.2",
61
- "vitest": "4.1.10",
60
+ "vitest": "4.1.11",
62
61
  "write-json-file": "7.0.0"
63
62
  },
64
63
  "publishConfig": {
@@ -32,7 +32,8 @@ class CmsModelPlugin extends Plugin {
32
32
  name: input.name,
33
33
  pluralApiName,
34
34
  singularApiName,
35
- titleFieldId: "id"
35
+ titleFieldId: "id",
36
+ settings: {}
36
37
  };
37
38
  if (input.noValidate) {
38
39
  delete input["noValidate"];