@strapi/plugin-graphql 5.37.0 → 5.38.0

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 (219) hide show
  1. package/dist/admin/index.js.map +1 -1
  2. package/dist/admin/index.mjs.map +1 -1
  3. package/dist/admin/package.json.js +1 -133
  4. package/dist/admin/package.json.js.map +1 -1
  5. package/dist/admin/package.json.mjs +2 -120
  6. package/dist/admin/package.json.mjs.map +1 -1
  7. package/dist/admin/utils/prefixPluginTranslations.js.map +1 -1
  8. package/dist/admin/utils/prefixPluginTranslations.mjs.map +1 -1
  9. package/dist/server/bootstrap.js.map +1 -1
  10. package/dist/server/bootstrap.mjs.map +1 -1
  11. package/dist/server/config/default-config.js.map +1 -1
  12. package/dist/server/config/default-config.mjs.map +1 -1
  13. package/dist/server/config/index.js.map +1 -1
  14. package/dist/server/config/index.mjs.map +1 -1
  15. package/dist/server/format-graphql-error.js.map +1 -1
  16. package/dist/server/format-graphql-error.mjs.map +1 -1
  17. package/dist/server/index.js +4 -4
  18. package/dist/server/index.js.map +1 -1
  19. package/dist/server/index.mjs.map +1 -1
  20. package/dist/server/services/builders/dynamic-zones.js.map +1 -1
  21. package/dist/server/services/builders/dynamic-zones.mjs.map +1 -1
  22. package/dist/server/services/builders/entity.js.map +1 -1
  23. package/dist/server/services/builders/entity.mjs.map +1 -1
  24. package/dist/server/services/builders/enums.js.map +1 -1
  25. package/dist/server/services/builders/enums.mjs.map +1 -1
  26. package/dist/server/services/builders/filters/content-type.js.map +1 -1
  27. package/dist/server/services/builders/filters/content-type.mjs.map +1 -1
  28. package/dist/server/services/builders/filters/index.js.map +1 -1
  29. package/dist/server/services/builders/filters/index.mjs.map +1 -1
  30. package/dist/server/services/builders/filters/operators/and.js.map +1 -1
  31. package/dist/server/services/builders/filters/operators/and.mjs.map +1 -1
  32. package/dist/server/services/builders/filters/operators/between.js.map +1 -1
  33. package/dist/server/services/builders/filters/operators/between.mjs.map +1 -1
  34. package/dist/server/services/builders/filters/operators/contains.js.map +1 -1
  35. package/dist/server/services/builders/filters/operators/contains.mjs.map +1 -1
  36. package/dist/server/services/builders/filters/operators/containsi.js.map +1 -1
  37. package/dist/server/services/builders/filters/operators/containsi.mjs.map +1 -1
  38. package/dist/server/services/builders/filters/operators/ends-with.js.map +1 -1
  39. package/dist/server/services/builders/filters/operators/ends-with.mjs.map +1 -1
  40. package/dist/server/services/builders/filters/operators/eq.js.map +1 -1
  41. package/dist/server/services/builders/filters/operators/eq.mjs.map +1 -1
  42. package/dist/server/services/builders/filters/operators/eqi.js.map +1 -1
  43. package/dist/server/services/builders/filters/operators/eqi.mjs.map +1 -1
  44. package/dist/server/services/builders/filters/operators/gt.js.map +1 -1
  45. package/dist/server/services/builders/filters/operators/gt.mjs.map +1 -1
  46. package/dist/server/services/builders/filters/operators/gte.js.map +1 -1
  47. package/dist/server/services/builders/filters/operators/gte.mjs.map +1 -1
  48. package/dist/server/services/builders/filters/operators/in.js.map +1 -1
  49. package/dist/server/services/builders/filters/operators/in.mjs.map +1 -1
  50. package/dist/server/services/builders/filters/operators/index.js.map +1 -1
  51. package/dist/server/services/builders/filters/operators/index.mjs +4 -4
  52. package/dist/server/services/builders/filters/operators/index.mjs.map +1 -1
  53. package/dist/server/services/builders/filters/operators/lt.js.map +1 -1
  54. package/dist/server/services/builders/filters/operators/lt.mjs.map +1 -1
  55. package/dist/server/services/builders/filters/operators/lte.js.map +1 -1
  56. package/dist/server/services/builders/filters/operators/lte.mjs.map +1 -1
  57. package/dist/server/services/builders/filters/operators/ne.js.map +1 -1
  58. package/dist/server/services/builders/filters/operators/ne.mjs.map +1 -1
  59. package/dist/server/services/builders/filters/operators/nei.js.map +1 -1
  60. package/dist/server/services/builders/filters/operators/nei.mjs.map +1 -1
  61. package/dist/server/services/builders/filters/operators/not-contains.js.map +1 -1
  62. package/dist/server/services/builders/filters/operators/not-contains.mjs.map +1 -1
  63. package/dist/server/services/builders/filters/operators/not-containsi.js.map +1 -1
  64. package/dist/server/services/builders/filters/operators/not-containsi.mjs.map +1 -1
  65. package/dist/server/services/builders/filters/operators/not-in.js.map +1 -1
  66. package/dist/server/services/builders/filters/operators/not-in.mjs.map +1 -1
  67. package/dist/server/services/builders/filters/operators/not-null.js.map +1 -1
  68. package/dist/server/services/builders/filters/operators/not-null.mjs.map +1 -1
  69. package/dist/server/services/builders/filters/operators/not.js.map +1 -1
  70. package/dist/server/services/builders/filters/operators/not.mjs.map +1 -1
  71. package/dist/server/services/builders/filters/operators/null.js.map +1 -1
  72. package/dist/server/services/builders/filters/operators/null.mjs.map +1 -1
  73. package/dist/server/services/builders/filters/operators/or.js.map +1 -1
  74. package/dist/server/services/builders/filters/operators/or.mjs.map +1 -1
  75. package/dist/server/services/builders/filters/operators/starts-with.js.map +1 -1
  76. package/dist/server/services/builders/filters/operators/starts-with.mjs.map +1 -1
  77. package/dist/server/services/builders/generic-morph.js.map +1 -1
  78. package/dist/server/services/builders/generic-morph.mjs.map +1 -1
  79. package/dist/server/services/builders/index.js.map +1 -1
  80. package/dist/server/services/builders/index.mjs.map +1 -1
  81. package/dist/server/services/builders/input.js.map +1 -1
  82. package/dist/server/services/builders/input.mjs.map +1 -1
  83. package/dist/server/services/builders/mutations/collection-type.js.map +1 -1
  84. package/dist/server/services/builders/mutations/collection-type.mjs.map +1 -1
  85. package/dist/server/services/builders/mutations/index.js.map +1 -1
  86. package/dist/server/services/builders/mutations/index.mjs.map +1 -1
  87. package/dist/server/services/builders/mutations/single-type.js.map +1 -1
  88. package/dist/server/services/builders/mutations/single-type.mjs.map +1 -1
  89. package/dist/server/services/builders/queries/collection-type.js.map +1 -1
  90. package/dist/server/services/builders/queries/collection-type.mjs.map +1 -1
  91. package/dist/server/services/builders/queries/index.js.map +1 -1
  92. package/dist/server/services/builders/queries/index.mjs.map +1 -1
  93. package/dist/server/services/builders/queries/single-type.js.map +1 -1
  94. package/dist/server/services/builders/queries/single-type.mjs.map +1 -1
  95. package/dist/server/services/builders/relation-response-collection.js.map +1 -1
  96. package/dist/server/services/builders/relation-response-collection.mjs.map +1 -1
  97. package/dist/server/services/builders/resolvers/association.js.map +1 -1
  98. package/dist/server/services/builders/resolvers/association.mjs +1 -1
  99. package/dist/server/services/builders/resolvers/association.mjs.map +1 -1
  100. package/dist/server/services/builders/resolvers/component.js.map +1 -1
  101. package/dist/server/services/builders/resolvers/component.mjs.map +1 -1
  102. package/dist/server/services/builders/resolvers/dynamic-zone.js.map +1 -1
  103. package/dist/server/services/builders/resolvers/dynamic-zone.mjs.map +1 -1
  104. package/dist/server/services/builders/resolvers/index.js.map +1 -1
  105. package/dist/server/services/builders/resolvers/index.mjs.map +1 -1
  106. package/dist/server/services/builders/resolvers/pagination.js.map +1 -1
  107. package/dist/server/services/builders/resolvers/pagination.mjs.map +1 -1
  108. package/dist/server/services/builders/resolvers/query.js.map +1 -1
  109. package/dist/server/services/builders/resolvers/query.mjs.map +1 -1
  110. package/dist/server/services/builders/response-collection.js.map +1 -1
  111. package/dist/server/services/builders/response-collection.mjs.map +1 -1
  112. package/dist/server/services/builders/response.js.map +1 -1
  113. package/dist/server/services/builders/response.mjs.map +1 -1
  114. package/dist/server/services/builders/type.js +1 -3
  115. package/dist/server/services/builders/type.js.map +1 -1
  116. package/dist/server/services/builders/type.mjs +1 -3
  117. package/dist/server/services/builders/type.mjs.map +1 -1
  118. package/dist/server/services/builders/utils.js.map +1 -1
  119. package/dist/server/services/builders/utils.mjs +2 -2
  120. package/dist/server/services/builders/utils.mjs.map +1 -1
  121. package/dist/server/services/constants.js.map +1 -1
  122. package/dist/server/services/constants.mjs.map +1 -1
  123. package/dist/server/services/content-api/index.js.map +1 -1
  124. package/dist/server/services/content-api/index.mjs.map +1 -1
  125. package/dist/server/services/content-api/policy.js.map +1 -1
  126. package/dist/server/services/content-api/policy.mjs +1 -1
  127. package/dist/server/services/content-api/policy.mjs.map +1 -1
  128. package/dist/server/services/content-api/register-functions/collection-type.js.map +1 -1
  129. package/dist/server/services/content-api/register-functions/collection-type.mjs.map +1 -1
  130. package/dist/server/services/content-api/register-functions/component.js.map +1 -1
  131. package/dist/server/services/content-api/register-functions/component.mjs.map +1 -1
  132. package/dist/server/services/content-api/register-functions/dynamic-zones.js.map +1 -1
  133. package/dist/server/services/content-api/register-functions/dynamic-zones.mjs.map +1 -1
  134. package/dist/server/services/content-api/register-functions/enums.js.map +1 -1
  135. package/dist/server/services/content-api/register-functions/enums.mjs.map +1 -1
  136. package/dist/server/services/content-api/register-functions/filters.js.map +1 -1
  137. package/dist/server/services/content-api/register-functions/filters.mjs.map +1 -1
  138. package/dist/server/services/content-api/register-functions/inputs.js.map +1 -1
  139. package/dist/server/services/content-api/register-functions/inputs.mjs.map +1 -1
  140. package/dist/server/services/content-api/register-functions/internals.js.map +1 -1
  141. package/dist/server/services/content-api/register-functions/internals.mjs.map +1 -1
  142. package/dist/server/services/content-api/register-functions/polymorphic.js.map +1 -1
  143. package/dist/server/services/content-api/register-functions/polymorphic.mjs.map +1 -1
  144. package/dist/server/services/content-api/register-functions/scalars.js.map +1 -1
  145. package/dist/server/services/content-api/register-functions/scalars.mjs.map +1 -1
  146. package/dist/server/services/content-api/register-functions/single-type.js.map +1 -1
  147. package/dist/server/services/content-api/register-functions/single-type.mjs.map +1 -1
  148. package/dist/server/services/content-api/wrap-resolvers.js.map +1 -1
  149. package/dist/server/services/content-api/wrap-resolvers.mjs.map +1 -1
  150. package/dist/server/services/extension/extension.js.map +1 -1
  151. package/dist/server/services/extension/extension.mjs.map +1 -1
  152. package/dist/server/services/extension/shadow-crud-manager.js.map +1 -1
  153. package/dist/server/services/extension/shadow-crud-manager.mjs.map +1 -1
  154. package/dist/server/services/format/index.js.map +1 -1
  155. package/dist/server/services/format/index.mjs.map +1 -1
  156. package/dist/server/services/format/return-types.js.map +1 -1
  157. package/dist/server/services/format/return-types.mjs.map +1 -1
  158. package/dist/server/services/index.js +8 -8
  159. package/dist/server/services/index.js.map +1 -1
  160. package/dist/server/services/index.mjs.map +1 -1
  161. package/dist/server/services/internals/args/index.js.map +1 -1
  162. package/dist/server/services/internals/args/index.mjs.map +1 -1
  163. package/dist/server/services/internals/args/pagination.js.map +1 -1
  164. package/dist/server/services/internals/args/pagination.mjs.map +1 -1
  165. package/dist/server/services/internals/args/publication-status.js.map +1 -1
  166. package/dist/server/services/internals/args/publication-status.mjs.map +1 -1
  167. package/dist/server/services/internals/args/sort.js.map +1 -1
  168. package/dist/server/services/internals/args/sort.mjs.map +1 -1
  169. package/dist/server/services/internals/helpers/get-enabled-scalars.js.map +1 -1
  170. package/dist/server/services/internals/helpers/get-enabled-scalars.mjs.map +1 -1
  171. package/dist/server/services/internals/helpers/index.js.map +1 -1
  172. package/dist/server/services/internals/helpers/index.mjs.map +1 -1
  173. package/dist/server/services/internals/index.js +8 -8
  174. package/dist/server/services/internals/index.js.map +1 -1
  175. package/dist/server/services/internals/index.mjs.map +1 -1
  176. package/dist/server/services/internals/scalars/date.js.map +1 -1
  177. package/dist/server/services/internals/scalars/date.mjs.map +1 -1
  178. package/dist/server/services/internals/scalars/index.js.map +1 -1
  179. package/dist/server/services/internals/scalars/index.mjs +1 -1
  180. package/dist/server/services/internals/scalars/index.mjs.map +1 -1
  181. package/dist/server/services/internals/scalars/time.js.map +1 -1
  182. package/dist/server/services/internals/scalars/time.mjs +1 -1
  183. package/dist/server/services/internals/scalars/time.mjs.map +1 -1
  184. package/dist/server/services/internals/types/delete-mutation-response.js.map +1 -1
  185. package/dist/server/services/internals/types/delete-mutation-response.mjs.map +1 -1
  186. package/dist/server/services/internals/types/error.js.map +1 -1
  187. package/dist/server/services/internals/types/error.mjs.map +1 -1
  188. package/dist/server/services/internals/types/filters.js.map +1 -1
  189. package/dist/server/services/internals/types/filters.mjs.map +1 -1
  190. package/dist/server/services/internals/types/index.js.map +1 -1
  191. package/dist/server/services/internals/types/index.mjs.map +1 -1
  192. package/dist/server/services/internals/types/pagination.js.map +1 -1
  193. package/dist/server/services/internals/types/pagination.mjs.map +1 -1
  194. package/dist/server/services/internals/types/publication-status.js.map +1 -1
  195. package/dist/server/services/internals/types/publication-status.mjs.map +1 -1
  196. package/dist/server/services/internals/types/response-collection-meta.js.map +1 -1
  197. package/dist/server/services/internals/types/response-collection-meta.mjs.map +1 -1
  198. package/dist/server/services/type-registry.js.map +1 -1
  199. package/dist/server/services/type-registry.mjs.map +1 -1
  200. package/dist/server/services/utils/attributes.js.map +1 -1
  201. package/dist/server/services/utils/attributes.mjs.map +1 -1
  202. package/dist/server/services/utils/index.js.map +1 -1
  203. package/dist/server/services/utils/index.mjs.map +1 -1
  204. package/dist/server/services/utils/mappers/entity-to-response-entity.js.map +1 -1
  205. package/dist/server/services/utils/mappers/entity-to-response-entity.mjs +5 -5
  206. package/dist/server/services/utils/mappers/entity-to-response-entity.mjs.map +1 -1
  207. package/dist/server/services/utils/mappers/graphql-filters-to-strapi-query.js.map +1 -1
  208. package/dist/server/services/utils/mappers/graphql-filters-to-strapi-query.mjs.map +1 -1
  209. package/dist/server/services/utils/mappers/graphql-scalar-to-operators.js.map +1 -1
  210. package/dist/server/services/utils/mappers/graphql-scalar-to-operators.mjs.map +1 -1
  211. package/dist/server/services/utils/mappers/index.js.map +1 -1
  212. package/dist/server/services/utils/mappers/index.mjs.map +1 -1
  213. package/dist/server/services/utils/mappers/strapi-scalar-to-graphql-scalar.js.map +1 -1
  214. package/dist/server/services/utils/mappers/strapi-scalar-to-graphql-scalar.mjs.map +1 -1
  215. package/dist/server/services/utils/naming.js.map +1 -1
  216. package/dist/server/services/utils/naming.mjs.map +1 -1
  217. package/dist/server/services/utils/playground.js.map +1 -1
  218. package/dist/server/services/utils/playground.mjs.map +1 -1
  219. package/package.json +8 -8
@@ -1 +1 @@
1
- {"version":3,"file":"graphql-filters-to-strapi-query.js","sources":["../../../../../server/src/services/utils/mappers/graphql-filters-to-strapi-query.ts"],"sourcesContent":["import { has, propEq, isNil, isDate, isObject } from 'lodash/fp';\nimport type { Struct } from '@strapi/types';\nimport type { Context } from '../../types';\n\n// todo[v4]: Find a way to get that dynamically\nconst virtualScalarAttributes = ['id', 'documentId'];\n\nexport default ({ strapi }: Context) => {\n const { service: getService } = strapi.plugin('graphql');\n\n const recursivelyReplaceScalarOperators = (data: any): any => {\n const { operators } = getService('builders').filters;\n\n if (Array.isArray(data)) {\n return data.map(recursivelyReplaceScalarOperators);\n }\n\n // Note: We need to make an exception for date since GraphQL\n // automatically cast date strings to date instances in args\n if (isDate(data) || !isObject(data)) {\n return data;\n }\n\n const result: any = {};\n\n for (const [key, value] of Object.entries(data)) {\n const isOperator = !!operators[key];\n\n const newKey = isOperator ? operators[key].strapiOperator : key;\n\n result[newKey] = recursivelyReplaceScalarOperators(value);\n }\n\n return result;\n };\n\n return {\n /**\n * Transform one or many GraphQL filters object into a valid Strapi query\n * @param {object | object[]} filters\n * @param {object} contentType\n * @return {object | object[]}\n */\n graphQLFiltersToStrapiQuery(filters: any, contentType: Struct.Schema): any {\n const { isStrapiScalar, isMedia, isRelation, isComponent } = getService('utils').attributes;\n const { operators } = getService('builders').filters;\n\n const ROOT_LEVEL_OPERATORS = [operators.and, operators.or, operators.not];\n\n // Handle unwanted scenario where there is no filters defined\n if (isNil(filters)) {\n return {};\n }\n\n // If filters is a collection, then apply the transformation to every item of the list\n if (Array.isArray(filters)) {\n return filters.map((filtersItem) =>\n this.graphQLFiltersToStrapiQuery(filtersItem, contentType)\n );\n }\n\n const resultMap: any = {};\n const { attributes } = contentType;\n\n const isAttribute = (attributeName: string) => {\n return virtualScalarAttributes.includes(attributeName) || has(attributeName, attributes);\n };\n\n for (const [key, value] of Object.entries(filters)) {\n // If the key is an attribute, update the value\n if (isAttribute(key)) {\n const attribute: any = attributes[key];\n\n // If it's a scalar attribute\n if (virtualScalarAttributes.includes(key) || isStrapiScalar(attribute)) {\n // Replace (recursively) every GraphQL scalar operator with the associated Strapi operator\n resultMap[key] = recursivelyReplaceScalarOperators(value);\n }\n\n // If it's a deep filter on a relation\n else if (isRelation(attribute) || isMedia(attribute)) {\n // Fetch the model from the relation\n const relModel = strapi.getModel(attribute.target);\n\n // Recursively apply the mapping to the value using the fetched model,\n // and update the value within `resultMap`\n resultMap[key] = this.graphQLFiltersToStrapiQuery(value, relModel);\n }\n\n // If it's a deep filter on a component\n else if (isComponent(attribute)) {\n // Fetch the model from the component attribute\n const componentModel = strapi.getModel(attribute.component);\n\n // Recursively apply the mapping to the value using the fetched model,\n // and update the value within `resultMap`\n resultMap[key] = this.graphQLFiltersToStrapiQuery(value, componentModel);\n }\n }\n\n // Handle the case where the key is not an attribute (operator, ...)\n else {\n const rootLevelOperator = ROOT_LEVEL_OPERATORS.find(propEq('fieldName', key));\n\n // If it's a root level operator (AND, NOT, OR, ...)\n if (rootLevelOperator) {\n const { strapiOperator } = rootLevelOperator;\n\n // Transform the current value recursively and add it to the resultMap\n // object using the strapiOperator equivalent of the GraphQL key\n resultMap[strapiOperator] = this.graphQLFiltersToStrapiQuery(value, contentType);\n }\n }\n }\n\n return resultMap;\n },\n };\n};\n"],"names":["virtualScalarAttributes","strapi","service","getService","plugin","recursivelyReplaceScalarOperators","data","operators","filters","Array","isArray","map","isDate","isObject","result","key","value","Object","entries","isOperator","newKey","strapiOperator","graphQLFiltersToStrapiQuery","contentType","isStrapiScalar","isMedia","isRelation","isComponent","attributes","ROOT_LEVEL_OPERATORS","and","or","not","isNil","filtersItem","resultMap","isAttribute","attributeName","includes","has","attribute","relModel","getModel","target","componentModel","component","rootLevelOperator","find","propEq"],"mappings":";;;;AAIA;AACA,MAAMA,uBAA0B,GAAA;AAAC,IAAA,IAAA;AAAM,IAAA;AAAa,CAAA;AAEpD,kCAAe,CAAA,CAAC,EAAEC,MAAM,EAAW,GAAA;AACjC,IAAA,MAAM,EAAEC,OAASC,EAAAA,UAAU,EAAE,GAAGF,MAAAA,CAAOG,MAAM,CAAC,SAAA,CAAA;AAE9C,IAAA,MAAMC,oCAAoC,CAACC,IAAAA,GAAAA;AACzC,QAAA,MAAM,EAAEC,SAAS,EAAE,GAAG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,GAAI,CAAA,GAAG,IAAI,CAACO,2BAA2B,CAACN,KAAO4B,EAAAA,cAAAA,CAAAA;AAC3D;iBAIG,MAAA;AACH,oBAAA,MAAME,iBAAoBjB,GAAAA,oBAAAA,CAAqBkB,IAAI,CAACC,UAAO,WAAajC,EAAAA,GAAAA,CAAAA,CAAAA;;AAGxE,oBAAA,IAAI+B,iBAAmB,EAAA;wBACrB,MAAM,EAAEzB,cAAc,EAAE,GAAGyB,iBAAAA;;;AAI3BX,wBAAAA,SAAS,CAACd,cAAe,CAAA,GAAG,IAAI,CAACC,2BAA2B,CAACN,KAAOO,EAAAA,WAAAA,CAAAA;AACtE;AACF;AACF;YAEA,OAAOY,SAAAA;AACT;AACF,KAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"graphql-filters-to-strapi-query.js","sources":["../../../../../server/src/services/utils/mappers/graphql-filters-to-strapi-query.ts"],"sourcesContent":["import { has, propEq, isNil, isDate, isObject } from 'lodash/fp';\nimport type { Struct } from '@strapi/types';\nimport type { Context } from '../../types';\n\n// todo[v4]: Find a way to get that dynamically\nconst virtualScalarAttributes = ['id', 'documentId'];\n\nexport default ({ strapi }: Context) => {\n const { service: getService } = strapi.plugin('graphql');\n\n const recursivelyReplaceScalarOperators = (data: any): any => {\n const { operators } = getService('builders').filters;\n\n if (Array.isArray(data)) {\n return data.map(recursivelyReplaceScalarOperators);\n }\n\n // Note: We need to make an exception for date since GraphQL\n // automatically cast date strings to date instances in args\n if (isDate(data) || !isObject(data)) {\n return data;\n }\n\n const result: any = {};\n\n for (const [key, value] of Object.entries(data)) {\n const isOperator = !!operators[key];\n\n const newKey = isOperator ? operators[key].strapiOperator : key;\n\n result[newKey] = recursivelyReplaceScalarOperators(value);\n }\n\n return result;\n };\n\n return {\n /**\n * Transform one or many GraphQL filters object into a valid Strapi query\n * @param {object | object[]} filters\n * @param {object} contentType\n * @return {object | object[]}\n */\n graphQLFiltersToStrapiQuery(filters: any, contentType: Struct.Schema): any {\n const { isStrapiScalar, isMedia, isRelation, isComponent } = getService('utils').attributes;\n const { operators } = getService('builders').filters;\n\n const ROOT_LEVEL_OPERATORS = [operators.and, operators.or, operators.not];\n\n // Handle unwanted scenario where there is no filters defined\n if (isNil(filters)) {\n return {};\n }\n\n // If filters is a collection, then apply the transformation to every item of the list\n if (Array.isArray(filters)) {\n return filters.map((filtersItem) =>\n this.graphQLFiltersToStrapiQuery(filtersItem, contentType)\n );\n }\n\n const resultMap: any = {};\n const { attributes } = contentType;\n\n const isAttribute = (attributeName: string) => {\n return virtualScalarAttributes.includes(attributeName) || has(attributeName, attributes);\n };\n\n for (const [key, value] of Object.entries(filters)) {\n // If the key is an attribute, update the value\n if (isAttribute(key)) {\n const attribute: any = attributes[key];\n\n // If it's a scalar attribute\n if (virtualScalarAttributes.includes(key) || isStrapiScalar(attribute)) {\n // Replace (recursively) every GraphQL scalar operator with the associated Strapi operator\n resultMap[key] = recursivelyReplaceScalarOperators(value);\n }\n\n // If it's a deep filter on a relation\n else if (isRelation(attribute) || isMedia(attribute)) {\n // Fetch the model from the relation\n const relModel = strapi.getModel(attribute.target);\n\n // Recursively apply the mapping to the value using the fetched model,\n // and update the value within `resultMap`\n resultMap[key] = this.graphQLFiltersToStrapiQuery(value, relModel);\n }\n\n // If it's a deep filter on a component\n else if (isComponent(attribute)) {\n // Fetch the model from the component attribute\n const componentModel = strapi.getModel(attribute.component);\n\n // Recursively apply the mapping to the value using the fetched model,\n // and update the value within `resultMap`\n resultMap[key] = this.graphQLFiltersToStrapiQuery(value, componentModel);\n }\n }\n\n // Handle the case where the key is not an attribute (operator, ...)\n else {\n const rootLevelOperator = ROOT_LEVEL_OPERATORS.find(propEq('fieldName', key));\n\n // If it's a root level operator (AND, NOT, OR, ...)\n if (rootLevelOperator) {\n const { strapiOperator } = rootLevelOperator;\n\n // Transform the current value recursively and add it to the resultMap\n // object using the strapiOperator equivalent of the GraphQL key\n resultMap[strapiOperator] = this.graphQLFiltersToStrapiQuery(value, contentType);\n }\n }\n }\n\n return resultMap;\n },\n };\n};\n"],"names":["virtualScalarAttributes","strapi","service","getService","plugin","recursivelyReplaceScalarOperators","data","operators","filters","Array","isArray","map","isDate","isObject","result","key","value","Object","entries","isOperator","newKey","strapiOperator","graphQLFiltersToStrapiQuery","contentType","isStrapiScalar","isMedia","isRelation","isComponent","attributes","ROOT_LEVEL_OPERATORS","and","or","not","isNil","filtersItem","resultMap","isAttribute","attributeName","includes","has","attribute","relModel","getModel","target","componentModel","component","rootLevelOperator","find","propEq"],"mappings":";;;;AAIA;AACA,MAAMA,uBAAAA,GAA0B;AAAC,IAAA,IAAA;AAAM,IAAA;AAAa,CAAA;AAEpD,kCAAe,CAAA,CAAC,EAAEC,MAAM,EAAW,GAAA;AACjC,IAAA,MAAM,EAAEC,OAAAA,EAASC,UAAU,EAAE,GAAGF,MAAAA,CAAOG,MAAM,CAAC,SAAA,CAAA;AAE9C,IAAA,MAAMC,oCAAoC,CAACC,IAAAA,GAAAA;AACzC,QAAA,MAAM,EAAEC,SAAS,EAAE,GAAGJ,UAAAA,CAAW,YAAYK,OAAO;QAEpD,IAAIC,KAAAA,CAAMC,OAAO,CAACJ,IAAAA,CAAAA,EAAO;YACvB,OAAOA,IAAAA,CAAKK,GAAG,CAACN,iCAAAA,CAAAA;AAClB,QAAA;;;AAIA,QAAA,IAAIO,SAAAA,CAAON,IAAAA,CAAAA,IAAS,CAACO,WAAAA,CAASP,IAAAA,CAAAA,EAAO;YACnC,OAAOA,IAAAA;AACT,QAAA;AAEA,QAAA,MAAMQ,SAAc,EAAC;QAErB,KAAK,MAAM,CAACC,GAAAA,EAAKC,KAAAA,CAAM,IAAIC,MAAAA,CAAOC,OAAO,CAACZ,IAAAA,CAAAA,CAAO;AAC/C,YAAA,MAAMa,UAAAA,GAAa,CAAC,CAACZ,SAAS,CAACQ,GAAAA,CAAI;AAEnC,YAAA,MAAMK,SAASD,UAAAA,GAAaZ,SAAS,CAACQ,GAAAA,CAAI,CAACM,cAAc,GAAGN,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AAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"graphql-filters-to-strapi-query.mjs","sources":["../../../../../server/src/services/utils/mappers/graphql-filters-to-strapi-query.ts"],"sourcesContent":["import { has, propEq, isNil, isDate, isObject } from 'lodash/fp';\nimport type { Struct } from '@strapi/types';\nimport type { Context } from '../../types';\n\n// todo[v4]: Find a way to get that dynamically\nconst virtualScalarAttributes = ['id', 'documentId'];\n\nexport default ({ strapi }: Context) => {\n const { service: getService } = strapi.plugin('graphql');\n\n const recursivelyReplaceScalarOperators = (data: any): any => {\n const { operators } = getService('builders').filters;\n\n if (Array.isArray(data)) {\n return data.map(recursivelyReplaceScalarOperators);\n }\n\n // Note: We need to make an exception for date since GraphQL\n // automatically cast date strings to date instances in args\n if (isDate(data) || !isObject(data)) {\n return data;\n }\n\n const result: any = {};\n\n for (const [key, value] of Object.entries(data)) {\n const isOperator = !!operators[key];\n\n const newKey = isOperator ? operators[key].strapiOperator : key;\n\n result[newKey] = recursivelyReplaceScalarOperators(value);\n }\n\n return result;\n };\n\n return {\n /**\n * Transform one or many GraphQL filters object into a valid Strapi query\n * @param {object | object[]} filters\n * @param {object} contentType\n * @return {object | object[]}\n */\n graphQLFiltersToStrapiQuery(filters: any, contentType: Struct.Schema): any {\n const { isStrapiScalar, isMedia, isRelation, isComponent } = getService('utils').attributes;\n const { operators } = getService('builders').filters;\n\n const ROOT_LEVEL_OPERATORS = [operators.and, operators.or, operators.not];\n\n // Handle unwanted scenario where there is no filters defined\n if (isNil(filters)) {\n return {};\n }\n\n // If filters is a collection, then apply the transformation to every item of the list\n if (Array.isArray(filters)) {\n return filters.map((filtersItem) =>\n this.graphQLFiltersToStrapiQuery(filtersItem, contentType)\n );\n }\n\n const resultMap: any = {};\n const { attributes } = contentType;\n\n const isAttribute = (attributeName: string) => {\n return virtualScalarAttributes.includes(attributeName) || has(attributeName, attributes);\n };\n\n for (const [key, value] of Object.entries(filters)) {\n // If the key is an attribute, update the value\n if (isAttribute(key)) {\n const attribute: any = attributes[key];\n\n // If it's a scalar attribute\n if (virtualScalarAttributes.includes(key) || isStrapiScalar(attribute)) {\n // Replace (recursively) every GraphQL scalar operator with the associated Strapi operator\n resultMap[key] = recursivelyReplaceScalarOperators(value);\n }\n\n // If it's a deep filter on a relation\n else if (isRelation(attribute) || isMedia(attribute)) {\n // Fetch the model from the relation\n const relModel = strapi.getModel(attribute.target);\n\n // Recursively apply the mapping to the value using the fetched model,\n // and update the value within `resultMap`\n resultMap[key] = this.graphQLFiltersToStrapiQuery(value, relModel);\n }\n\n // If it's a deep filter on a component\n else if (isComponent(attribute)) {\n // Fetch the model from the component attribute\n const componentModel = strapi.getModel(attribute.component);\n\n // Recursively apply the mapping to the value using the fetched model,\n // and update the value within `resultMap`\n resultMap[key] = this.graphQLFiltersToStrapiQuery(value, componentModel);\n }\n }\n\n // Handle the case where the key is not an attribute (operator, ...)\n else {\n const rootLevelOperator = ROOT_LEVEL_OPERATORS.find(propEq('fieldName', key));\n\n // If it's a root level operator (AND, NOT, OR, ...)\n if (rootLevelOperator) {\n const { strapiOperator } = rootLevelOperator;\n\n // Transform the current value recursively and add it to the resultMap\n // object using the strapiOperator equivalent of the GraphQL key\n resultMap[strapiOperator] = this.graphQLFiltersToStrapiQuery(value, contentType);\n }\n }\n }\n\n return resultMap;\n },\n };\n};\n"],"names":["virtualScalarAttributes","strapi","service","getService","plugin","recursivelyReplaceScalarOperators","data","operators","filters","Array","isArray","map","isDate","isObject","result","key","value","Object","entries","isOperator","newKey","strapiOperator","graphQLFiltersToStrapiQuery","contentType","isStrapiScalar","isMedia","isRelation","isComponent","attributes","ROOT_LEVEL_OPERATORS","and","or","not","isNil","filtersItem","resultMap","isAttribute","attributeName","includes","has","attribute","relModel","getModel","target","componentModel","component","rootLevelOperator","find","propEq"],"mappings":";;AAIA;AACA,MAAMA,uBAA0B,GAAA;AAAC,IAAA,IAAA;AAAM,IAAA;AAAa,CAAA;AAEpD,kCAAe,CAAA,CAAC,EAAEC,MAAM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,CAACN,KAAOyB,EAAAA,QAAAA,CAAAA;qBAItD,MAAA,IAAId,YAAYa,SAAY,CAAA,EAAA;;AAE/B,wBAAA,MAAMI,cAAiB3C,GAAAA,MAAAA,CAAOyC,QAAQ,CAACF,UAAUK,SAAS,CAAA;;;AAI1DV,wBAAAA,SAAS,CAACpB,GAAI,CAAA,GAAG,IAAI,CAACO,2BAA2B,CAACN,KAAO4B,EAAAA,cAAAA,CAAAA;AAC3D;iBAIG,MAAA;AACH,oBAAA,MAAME,iBAAoBjB,GAAAA,oBAAAA,CAAqBkB,IAAI,CAACC,OAAO,WAAajC,EAAAA,GAAAA,CAAAA,CAAAA;;AAGxE,oBAAA,IAAI+B,iBAAmB,EAAA;wBACrB,MAAM,EAAEzB,cAAc,EAAE,GAAGyB,iBAAAA;;;AAI3BX,wBAAAA,SAAS,CAACd,cAAe,CAAA,GAAG,IAAI,CAACC,2BAA2B,CAACN,KAAOO,EAAAA,WAAAA,CAAAA;AACtE;AACF;AACF;YAEA,OAAOY,SAAAA;AACT;AACF,KAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"graphql-filters-to-strapi-query.mjs","sources":["../../../../../server/src/services/utils/mappers/graphql-filters-to-strapi-query.ts"],"sourcesContent":["import { has, propEq, isNil, isDate, isObject } from 'lodash/fp';\nimport type { Struct } from '@strapi/types';\nimport type { Context } from '../../types';\n\n// todo[v4]: Find a way to get that dynamically\nconst virtualScalarAttributes = ['id', 'documentId'];\n\nexport default ({ strapi }: Context) => {\n const { service: getService } = strapi.plugin('graphql');\n\n const recursivelyReplaceScalarOperators = (data: any): any => {\n const { operators } = getService('builders').filters;\n\n if (Array.isArray(data)) {\n return data.map(recursivelyReplaceScalarOperators);\n }\n\n // Note: We need to make an exception for date since GraphQL\n // automatically cast date strings to date instances in args\n if (isDate(data) || !isObject(data)) {\n return data;\n }\n\n const result: any = {};\n\n for (const [key, value] of Object.entries(data)) {\n const isOperator = !!operators[key];\n\n const newKey = isOperator ? operators[key].strapiOperator : key;\n\n result[newKey] = recursivelyReplaceScalarOperators(value);\n }\n\n return result;\n };\n\n return {\n /**\n * Transform one or many GraphQL filters object into a valid Strapi query\n * @param {object | object[]} filters\n * @param {object} contentType\n * @return {object | object[]}\n */\n graphQLFiltersToStrapiQuery(filters: any, contentType: Struct.Schema): any {\n const { isStrapiScalar, isMedia, isRelation, isComponent } = getService('utils').attributes;\n const { operators } = getService('builders').filters;\n\n const ROOT_LEVEL_OPERATORS = [operators.and, operators.or, operators.not];\n\n // Handle unwanted scenario where there is no filters defined\n if (isNil(filters)) {\n return {};\n }\n\n // If filters is a collection, then apply the transformation to every item of the list\n if (Array.isArray(filters)) {\n return filters.map((filtersItem) =>\n this.graphQLFiltersToStrapiQuery(filtersItem, contentType)\n );\n }\n\n const resultMap: any = {};\n const { attributes } = contentType;\n\n const isAttribute = (attributeName: string) => {\n return virtualScalarAttributes.includes(attributeName) || has(attributeName, attributes);\n };\n\n for (const [key, value] of Object.entries(filters)) {\n // If the key is an attribute, update the value\n if (isAttribute(key)) {\n const attribute: any = attributes[key];\n\n // If it's a scalar attribute\n if (virtualScalarAttributes.includes(key) || isStrapiScalar(attribute)) {\n // Replace (recursively) every GraphQL scalar operator with the associated Strapi operator\n resultMap[key] = recursivelyReplaceScalarOperators(value);\n }\n\n // If it's a deep filter on a relation\n else if (isRelation(attribute) || isMedia(attribute)) {\n // Fetch the model from the relation\n const relModel = strapi.getModel(attribute.target);\n\n // Recursively apply the mapping to the value using the fetched model,\n // and update the value within `resultMap`\n resultMap[key] = this.graphQLFiltersToStrapiQuery(value, relModel);\n }\n\n // If it's a deep filter on a component\n else if (isComponent(attribute)) {\n // Fetch the model from the component attribute\n const componentModel = strapi.getModel(attribute.component);\n\n // Recursively apply the mapping to the value using the fetched model,\n // and update the value within `resultMap`\n resultMap[key] = this.graphQLFiltersToStrapiQuery(value, componentModel);\n }\n }\n\n // Handle the case where the key is not an attribute (operator, ...)\n else {\n const rootLevelOperator = ROOT_LEVEL_OPERATORS.find(propEq('fieldName', key));\n\n // If it's a root level operator (AND, NOT, OR, ...)\n if (rootLevelOperator) {\n const { strapiOperator } = rootLevelOperator;\n\n // Transform the current value recursively and add it to the resultMap\n // object using the strapiOperator equivalent of the GraphQL key\n resultMap[strapiOperator] = this.graphQLFiltersToStrapiQuery(value, contentType);\n }\n }\n }\n\n return resultMap;\n },\n };\n};\n"],"names":["virtualScalarAttributes","strapi","service","getService","plugin","recursivelyReplaceScalarOperators","data","operators","filters","Array","isArray","map","isDate","isObject","result","key","value","Object","entries","isOperator","newKey","strapiOperator","graphQLFiltersToStrapiQuery","contentType","isStrapiScalar","isMedia","isRelation","isComponent","attributes","ROOT_LEVEL_OPERATORS","and","or","not","isNil","filtersItem","resultMap","isAttribute","attributeName","includes","has","attribute","relModel","getModel","target","componentModel","component","rootLevelOperator","find","propEq"],"mappings":";;AAIA;AACA,MAAMA,uBAAAA,GAA0B;AAAC,IAAA,IAAA;AAAM,IAAA;AAAa,CAAA;AAEpD,kCAAe,CAAA,CAAC,EAAEC,MAAM,EAAW,GAAA;AACjC,IAAA,MAAM,EAAEC,OAAAA,EAASC,UAAU,EAAE,GAAGF,MAAAA,CAAOG,MAAM,CAAC,SAAA,CAAA;AAE9C,IAAA,MAAMC,oCAAoC,CAACC,IAAAA,GAAAA;AACzC,QAAA,MAAM,EAAEC,SAAS,EAAE,GAAGJ,UAAAA,CAAW,YAAYK,OAAO;QAEpD,IAAIC,KAAAA,CAAMC,OAAO,CAACJ,IAAAA,CAAAA,EAAO;YACvB,OAAOA,IAAAA,CAAKK,GAAG,CAACN,iCAAAA,CAAAA;AAClB,QAAA;;;AAIA,QAAA,IAAIO,MAAAA,CAAON,IAAAA,CAAAA,IAAS,CAACO,QAAAA,CAASP,IAAAA,CAAAA,EAAO;YACnC,OAAOA,IAAAA;AACT,QAAA;AAEA,QAAA,MAAMQ,SAAc,EAAC;QAErB,KAAK,MAAM,CAACC,GAAAA,EAAKC,KAAAA,CAAM,IAAIC,MAAAA,C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B,iBAAAA;;;AAI3BX,wBAAAA,SAAS,CAACd,cAAAA,CAAe,GAAG,IAAI,CAACC,2BAA2B,CAACN,KAAAA,EAAOO,WAAAA,CAAAA;AACtE,oBAAA;AACF,gBAAA;AACF,YAAA;YAEA,OAAOY,SAAAA;AACT,QAAA;AACF,KAAA;AACF,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"graphql-scalar-to-operators.js","sources":["../../../../../server/src/services/utils/mappers/graphql-scalar-to-operators.ts"],"sourcesContent":["import { get, map, mapValues } from 'lodash/fp';\nimport type { Context } from '../../types';\n\nexport default ({ strapi }: Context) => ({\n graphqlScalarToOperators(graphqlScalar: string) {\n const { GRAPHQL_SCALAR_OPERATORS } = strapi.plugin('graphql').service('constants');\n const { operators } = strapi.plugin('graphql').service('builders').filters;\n\n const associations = mapValues(\n map((operatorName: string) => operators[operatorName]),\n GRAPHQL_SCALAR_OPERATORS\n );\n\n return get(graphqlScalar, associations);\n },\n});\n"],"names":["strapi","graphqlScalarToOperators","graphqlScalar","GRAPHQL_SCALAR_OPERATORS","plugin","service","operators","filters","associations","mapValues","map","operatorName","get"],"mappings":";;;;AAGA,+BAAe,CAAA,CAAC,EAAEA,MAAM,EAAW,IAAM;AACvCC,QAAAA,wBAAAA,CAAAA,CAAyBC,aAAqB,EAAA;YAC5C,MAAM,EAAEC,wBAAwB,EAAE,GAAGH,OAAOI,MAAM,CAAC,SAAWC,CAAAA,CAAAA,OAAO,CAAC,WAAA,CAAA;YACtE,MAAM,EAAEC,SAAS,EAAE,GAAGN,MAAAA,CAAOI,MAAM,CAAC,SAAWC,CAAAA,CAAAA,OAAO,CAAC,UAAA,CAAA,CAAYE,OAAO;YAE1E,MAAMC,YAAAA,GAAeC,aACnBC,MAAI,CAAA,CAACC,eAAyBL,SAAS,CAACK,aAAa,CACrDR,EAAAA,wBAAAA,CAAAA;AAGF,YAAA,OAAOS,OAAIV,aAAeM,EAAAA,YAAAA,CAAAA;AAC5B;AACF,KAAA,CAAC;;;;"}
1
+ {"version":3,"file":"graphql-scalar-to-operators.js","sources":["../../../../../server/src/services/utils/mappers/graphql-scalar-to-operators.ts"],"sourcesContent":["import { get, map, mapValues } from 'lodash/fp';\nimport type { Context } from '../../types';\n\nexport default ({ strapi }: Context) => ({\n graphqlScalarToOperators(graphqlScalar: string) {\n const { GRAPHQL_SCALAR_OPERATORS } = strapi.plugin('graphql').service('constants');\n const { operators } = strapi.plugin('graphql').service('builders').filters;\n\n const associations = mapValues(\n map((operatorName: string) => operators[operatorName]),\n GRAPHQL_SCALAR_OPERATORS\n );\n\n return get(graphqlScalar, associations);\n },\n});\n"],"names":["strapi","graphqlScalarToOperators","graphqlScalar","GRAPHQL_SCALAR_OPERATORS","plugin","service","operators","filters","associations","mapValues","map","operatorName","get"],"mappings":";;;;AAGA,+BAAe,CAAA,CAAC,EAAEA,MAAM,EAAW,IAAM;AACvCC,QAAAA,wBAAAA,CAAAA,CAAyBC,aAAqB,EAAA;YAC5C,MAAM,EAAEC,wBAAwB,EAAE,GAAGH,OAAOI,MAAM,CAAC,SAAA,CAAA,CAAWC,OAAO,CAAC,WAAA,CAAA;YACtE,MAAM,EAAEC,SAAS,EAAE,GAAGN,MAAAA,CAAOI,MAAM,CAAC,SAAA,CAAA,CAAWC,OAAO,CAAC,UAAA,CAAA,CAAYE,OAAO;YAE1E,MAAMC,YAAAA,GAAeC,aACnBC,MAAAA,CAAI,CAACC,eAAyBL,SAAS,CAACK,aAAa,CAAA,EACrDR,wBAAAA,CAAAA;AAGF,YAAA,OAAOS,OAAIV,aAAAA,EAAeM,YAAAA,CAAAA;AAC5B,QAAA;AACF,KAAA,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"graphql-scalar-to-operators.mjs","sources":["../../../../../server/src/services/utils/mappers/graphql-scalar-to-operators.ts"],"sourcesContent":["import { get, map, mapValues } from 'lodash/fp';\nimport type { Context } from '../../types';\n\nexport default ({ strapi }: Context) => ({\n graphqlScalarToOperators(graphqlScalar: string) {\n const { GRAPHQL_SCALAR_OPERATORS } = strapi.plugin('graphql').service('constants');\n const { operators } = strapi.plugin('graphql').service('builders').filters;\n\n const associations = mapValues(\n map((operatorName: string) => operators[operatorName]),\n GRAPHQL_SCALAR_OPERATORS\n );\n\n return get(graphqlScalar, associations);\n },\n});\n"],"names":["strapi","graphqlScalarToOperators","graphqlScalar","GRAPHQL_SCALAR_OPERATORS","plugin","service","operators","filters","associations","mapValues","map","operatorName","get"],"mappings":";;AAGA,+BAAe,CAAA,CAAC,EAAEA,MAAM,EAAW,IAAM;AACvCC,QAAAA,wBAAAA,CAAAA,CAAyBC,aAAqB,EAAA;YAC5C,MAAM,EAAEC,wBAAwB,EAAE,GAAGH,OAAOI,MAAM,CAAC,SAAWC,CAAAA,CAAAA,OAAO,CAAC,WAAA,CAAA;YACtE,MAAM,EAAEC,SAAS,EAAE,GAAGN,MAAAA,CAAOI,MAAM,CAAC,SAAWC,CAAAA,CAAAA,OAAO,CAAC,UAAA,CAAA,CAAYE,OAAO;YAE1E,MAAMC,YAAAA,GAAeC,UACnBC,GAAI,CAAA,CAACC,eAAyBL,SAAS,CAACK,aAAa,CACrDR,EAAAA,wBAAAA,CAAAA;AAGF,YAAA,OAAOS,IAAIV,aAAeM,EAAAA,YAAAA,CAAAA;AAC5B;AACF,KAAA,CAAC;;;;"}
1
+ {"version":3,"file":"graphql-scalar-to-operators.mjs","sources":["../../../../../server/src/services/utils/mappers/graphql-scalar-to-operators.ts"],"sourcesContent":["import { get, map, mapValues } from 'lodash/fp';\nimport type { Context } from '../../types';\n\nexport default ({ strapi }: Context) => ({\n graphqlScalarToOperators(graphqlScalar: string) {\n const { GRAPHQL_SCALAR_OPERATORS } = strapi.plugin('graphql').service('constants');\n const { operators } = strapi.plugin('graphql').service('builders').filters;\n\n const associations = mapValues(\n map((operatorName: string) => operators[operatorName]),\n GRAPHQL_SCALAR_OPERATORS\n );\n\n return get(graphqlScalar, associations);\n },\n});\n"],"names":["strapi","graphqlScalarToOperators","graphqlScalar","GRAPHQL_SCALAR_OPERATORS","plugin","service","operators","filters","associations","mapValues","map","operatorName","get"],"mappings":";;AAGA,+BAAe,CAAA,CAAC,EAAEA,MAAM,EAAW,IAAM;AACvCC,QAAAA,wBAAAA,CAAAA,CAAyBC,aAAqB,EAAA;YAC5C,MAAM,EAAEC,wBAAwB,EAAE,GAAGH,OAAOI,MAAM,CAAC,SAAA,CAAA,CAAWC,OAAO,CAAC,WAAA,CAAA;YACtE,MAAM,EAAEC,SAAS,EAAE,GAAGN,MAAAA,CAAOI,MAAM,CAAC,SAAA,CAAA,CAAWC,OAAO,CAAC,UAAA,CAAA,CAAYE,OAAO;YAE1E,MAAMC,YAAAA,GAAeC,UACnBC,GAAAA,CAAI,CAACC,eAAyBL,SAAS,CAACK,aAAa,CAAA,EACrDR,wBAAAA,CAAAA;AAGF,YAAA,OAAOS,IAAIV,aAAAA,EAAeM,YAAAA,CAAAA;AAC5B,QAAA;AACF,KAAA,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../server/src/services/utils/mappers/index.ts"],"sourcesContent":["import strapiScalarToGraphQLScalar from './strapi-scalar-to-graphql-scalar';\nimport graphQLFiltersToStrapiQuery from './graphql-filters-to-strapi-query';\nimport graphqlScalarToOperators from './graphql-scalar-to-operators';\nimport entityToResponseEntity from './entity-to-response-entity';\n\nimport type { Context } from '../../types';\n\nexport default (context: Context) => ({\n ...strapiScalarToGraphQLScalar(context),\n ...graphQLFiltersToStrapiQuery(context),\n ...graphqlScalarToOperators(context),\n ...entityToResponseEntity(),\n});\n"],"names":["context","strapiScalarToGraphQLScalar","graphQLFiltersToStrapiQuery","graphqlScalarToOperators","entityToResponseEntity"],"mappings":";;;;;;;AAOA,cAAe,CAAA,CAACA,OAAAA,IAAsB;AACpC,QAAA,GAAGC,4BAA4BD,OAAQ,CAAA;AACvC,QAAA,GAAGE,4BAA4BF,OAAQ,CAAA;AACvC,QAAA,GAAGG,yBAAyBH,OAAQ,CAAA;AACpC,QAAA,GAAGI,sBAAwB;AAC7B,KAAA,CAAC;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../server/src/services/utils/mappers/index.ts"],"sourcesContent":["import strapiScalarToGraphQLScalar from './strapi-scalar-to-graphql-scalar';\nimport graphQLFiltersToStrapiQuery from './graphql-filters-to-strapi-query';\nimport graphqlScalarToOperators from './graphql-scalar-to-operators';\nimport entityToResponseEntity from './entity-to-response-entity';\n\nimport type { Context } from '../../types';\n\nexport default (context: Context) => ({\n ...strapiScalarToGraphQLScalar(context),\n ...graphQLFiltersToStrapiQuery(context),\n ...graphqlScalarToOperators(context),\n ...entityToResponseEntity(),\n});\n"],"names":["context","strapiScalarToGraphQLScalar","graphQLFiltersToStrapiQuery","graphqlScalarToOperators","entityToResponseEntity"],"mappings":";;;;;;;AAOA,cAAe,CAAA,CAACA,OAAAA,IAAsB;AACpC,QAAA,GAAGC,4BAA4BD,OAAAA,CAAQ;AACvC,QAAA,GAAGE,4BAA4BF,OAAAA,CAAQ;AACvC,QAAA,GAAGG,yBAAyBH,OAAAA,CAAQ;AACpC,QAAA,GAAGI,sBAAAA;AACL,KAAA,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../../../server/src/services/utils/mappers/index.ts"],"sourcesContent":["import strapiScalarToGraphQLScalar from './strapi-scalar-to-graphql-scalar';\nimport graphQLFiltersToStrapiQuery from './graphql-filters-to-strapi-query';\nimport graphqlScalarToOperators from './graphql-scalar-to-operators';\nimport entityToResponseEntity from './entity-to-response-entity';\n\nimport type { Context } from '../../types';\n\nexport default (context: Context) => ({\n ...strapiScalarToGraphQLScalar(context),\n ...graphQLFiltersToStrapiQuery(context),\n ...graphqlScalarToOperators(context),\n ...entityToResponseEntity(),\n});\n"],"names":["context","strapiScalarToGraphQLScalar","graphQLFiltersToStrapiQuery","graphqlScalarToOperators","entityToResponseEntity"],"mappings":";;;;;AAOA,cAAe,CAAA,CAACA,OAAAA,IAAsB;AACpC,QAAA,GAAGC,4BAA4BD,OAAQ,CAAA;AACvC,QAAA,GAAGE,4BAA4BF,OAAQ,CAAA;AACvC,QAAA,GAAGG,yBAAyBH,OAAQ,CAAA;AACpC,QAAA,GAAGI,sBAAwB;AAC7B,KAAA,CAAC;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../../../server/src/services/utils/mappers/index.ts"],"sourcesContent":["import strapiScalarToGraphQLScalar from './strapi-scalar-to-graphql-scalar';\nimport graphQLFiltersToStrapiQuery from './graphql-filters-to-strapi-query';\nimport graphqlScalarToOperators from './graphql-scalar-to-operators';\nimport entityToResponseEntity from './entity-to-response-entity';\n\nimport type { Context } from '../../types';\n\nexport default (context: Context) => ({\n ...strapiScalarToGraphQLScalar(context),\n ...graphQLFiltersToStrapiQuery(context),\n ...graphqlScalarToOperators(context),\n ...entityToResponseEntity(),\n});\n"],"names":["context","strapiScalarToGraphQLScalar","graphQLFiltersToStrapiQuery","graphqlScalarToOperators","entityToResponseEntity"],"mappings":";;;;;AAOA,cAAe,CAAA,CAACA,OAAAA,IAAsB;AACpC,QAAA,GAAGC,4BAA4BD,OAAAA,CAAQ;AACvC,QAAA,GAAGE,4BAA4BF,OAAAA,CAAQ;AACvC,QAAA,GAAGG,yBAAyBH,OAAAA,CAAQ;AACpC,QAAA,GAAGI,sBAAAA;AACL,KAAA,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"strapi-scalar-to-graphql-scalar.js","sources":["../../../../../server/src/services/utils/mappers/strapi-scalar-to-graphql-scalar.ts"],"sourcesContent":["import { get, difference } from 'lodash/fp';\nimport { errors } from '@strapi/utils';\nimport type { Context } from '../../types';\n\nconst { ApplicationError } = errors;\n\nexport default ({ strapi }: Context) => {\n const { STRAPI_SCALARS, SCALARS_ASSOCIATIONS } = strapi.plugin('graphql').service('constants');\n\n const missingStrapiScalars = difference(STRAPI_SCALARS, Object.keys(SCALARS_ASSOCIATIONS));\n\n if (missingStrapiScalars.length > 0) {\n throw new ApplicationError('Some Strapi scalars are not handled in the GraphQL scalars mapper');\n }\n\n return {\n /**\n * Used to transform a Strapi scalar type into its GraphQL equivalent\n */\n strapiScalarToGraphQLScalar(strapiScalar: string) {\n return get(strapiScalar, SCALARS_ASSOCIATIONS);\n },\n };\n};\n"],"names":["ApplicationError","errors","strapi","STRAPI_SCALARS","SCALARS_ASSOCIATIONS","plugin","service","missingStrapiScalars","difference","Object","keys","length","strapiScalarToGraphQLScalar","strapiScalar","get"],"mappings":";;;;;AAIA,MAAM,EAAEA,gBAAgB,EAAE,GAAGC,YAAAA;AAE7B,kCAAe,CAAA,CAAC,EAAEC,MAAM,EAAW,GAAA;IACjC,MAAM,EAAEC,cAAc,EAAEC,oBAAoB,EAAE,GAAGF,MAAAA,CAAOG,MAAM,CAAC,SAAWC,CAAAA,CAAAA,OAAO,CAAC,WAAA,CAAA;AAElF,IAAA,MAAMC,oBAAuBC,GAAAA,aAAAA,CAAWL,cAAgBM,EAAAA,MAAAA,CAAOC,IAAI,CAACN,oBAAAA,CAAAA,CAAAA;IAEpE,IAAIG,oBAAAA,CAAqBI,MAAM,GAAG,CAAG,EAAA;AACnC,QAAA,MAAM,IAAIX,gBAAiB,CAAA,mEAAA,CAAA;AAC7B;IAEA,OAAO;AACL;;AAEC,QACDY,6BAA4BC,YAAoB,EAAA;AAC9C,YAAA,OAAOC,OAAID,YAAcT,EAAAA,oBAAAA,CAAAA;AAC3B;AACF,KAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"strapi-scalar-to-graphql-scalar.js","sources":["../../../../../server/src/services/utils/mappers/strapi-scalar-to-graphql-scalar.ts"],"sourcesContent":["import { get, difference } from 'lodash/fp';\nimport { errors } from '@strapi/utils';\nimport type { Context } from '../../types';\n\nconst { ApplicationError } = errors;\n\nexport default ({ strapi }: Context) => {\n const { STRAPI_SCALARS, SCALARS_ASSOCIATIONS } = strapi.plugin('graphql').service('constants');\n\n const missingStrapiScalars = difference(STRAPI_SCALARS, Object.keys(SCALARS_ASSOCIATIONS));\n\n if (missingStrapiScalars.length > 0) {\n throw new ApplicationError('Some Strapi scalars are not handled in the GraphQL scalars mapper');\n }\n\n return {\n /**\n * Used to transform a Strapi scalar type into its GraphQL equivalent\n */\n strapiScalarToGraphQLScalar(strapiScalar: string) {\n return get(strapiScalar, SCALARS_ASSOCIATIONS);\n },\n };\n};\n"],"names":["ApplicationError","errors","strapi","STRAPI_SCALARS","SCALARS_ASSOCIATIONS","plugin","service","missingStrapiScalars","difference","Object","keys","length","strapiScalarToGraphQLScalar","strapiScalar","get"],"mappings":";;;;;AAIA,MAAM,EAAEA,gBAAgB,EAAE,GAAGC,YAAAA;AAE7B,kCAAe,CAAA,CAAC,EAAEC,MAAM,EAAW,GAAA;IACjC,MAAM,EAAEC,cAAc,EAAEC,oBAAoB,EAAE,GAAGF,MAAAA,CAAOG,MAAM,CAAC,SAAA,CAAA,CAAWC,OAAO,CAAC,WAAA,CAAA;AAElF,IAAA,MAAMC,oBAAAA,GAAuBC,aAAAA,CAAWL,cAAAA,EAAgBM,MAAAA,CAAOC,IAAI,CAACN,oBAAAA,CAAAA,CAAAA;IAEpE,IAAIG,oBAAAA,CAAqBI,MAAM,GAAG,CAAA,EAAG;AACnC,QAAA,MAAM,IAAIX,gBAAAA,CAAiB,mEAAA,CAAA;AAC7B,IAAA;IAEA,OAAO;AACL;;AAEC,QACDY,6BAA4BC,YAAoB,EAAA;AAC9C,YAAA,OAAOC,OAAID,YAAAA,EAAcT,oBAAAA,CAAAA;AAC3B,QAAA;AACF,KAAA;AACF,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"strapi-scalar-to-graphql-scalar.mjs","sources":["../../../../../server/src/services/utils/mappers/strapi-scalar-to-graphql-scalar.ts"],"sourcesContent":["import { get, difference } from 'lodash/fp';\nimport { errors } from '@strapi/utils';\nimport type { Context } from '../../types';\n\nconst { ApplicationError } = errors;\n\nexport default ({ strapi }: Context) => {\n const { STRAPI_SCALARS, SCALARS_ASSOCIATIONS } = strapi.plugin('graphql').service('constants');\n\n const missingStrapiScalars = difference(STRAPI_SCALARS, Object.keys(SCALARS_ASSOCIATIONS));\n\n if (missingStrapiScalars.length > 0) {\n throw new ApplicationError('Some Strapi scalars are not handled in the GraphQL scalars mapper');\n }\n\n return {\n /**\n * Used to transform a Strapi scalar type into its GraphQL equivalent\n */\n strapiScalarToGraphQLScalar(strapiScalar: string) {\n return get(strapiScalar, SCALARS_ASSOCIATIONS);\n },\n };\n};\n"],"names":["ApplicationError","errors","strapi","STRAPI_SCALARS","SCALARS_ASSOCIATIONS","plugin","service","missingStrapiScalars","difference","Object","keys","length","strapiScalarToGraphQLScalar","strapiScalar","get"],"mappings":";;;AAIA,MAAM,EAAEA,gBAAgB,EAAE,GAAGC,MAAAA;AAE7B,kCAAe,CAAA,CAAC,EAAEC,MAAM,EAAW,GAAA;IACjC,MAAM,EAAEC,cAAc,EAAEC,oBAAoB,EAAE,GAAGF,MAAAA,CAAOG,MAAM,CAAC,SAAWC,CAAAA,CAAAA,OAAO,CAAC,WAAA,CAAA;AAElF,IAAA,MAAMC,oBAAuBC,GAAAA,UAAAA,CAAWL,cAAgBM,EAAAA,MAAAA,CAAOC,IAAI,CAACN,oBAAAA,CAAAA,CAAAA;IAEpE,IAAIG,oBAAAA,CAAqBI,MAAM,GAAG,CAAG,EAAA;AACnC,QAAA,MAAM,IAAIX,gBAAiB,CAAA,mEAAA,CAAA;AAC7B;IAEA,OAAO;AACL;;AAEC,QACDY,6BAA4BC,YAAoB,EAAA;AAC9C,YAAA,OAAOC,IAAID,YAAcT,EAAAA,oBAAAA,CAAAA;AAC3B;AACF,KAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"strapi-scalar-to-graphql-scalar.mjs","sources":["../../../../../server/src/services/utils/mappers/strapi-scalar-to-graphql-scalar.ts"],"sourcesContent":["import { get, difference } from 'lodash/fp';\nimport { errors } from '@strapi/utils';\nimport type { Context } from '../../types';\n\nconst { ApplicationError } = errors;\n\nexport default ({ strapi }: Context) => {\n const { STRAPI_SCALARS, SCALARS_ASSOCIATIONS } = strapi.plugin('graphql').service('constants');\n\n const missingStrapiScalars = difference(STRAPI_SCALARS, Object.keys(SCALARS_ASSOCIATIONS));\n\n if (missingStrapiScalars.length > 0) {\n throw new ApplicationError('Some Strapi scalars are not handled in the GraphQL scalars mapper');\n }\n\n return {\n /**\n * Used to transform a Strapi scalar type into its GraphQL equivalent\n */\n strapiScalarToGraphQLScalar(strapiScalar: string) {\n return get(strapiScalar, SCALARS_ASSOCIATIONS);\n },\n };\n};\n"],"names":["ApplicationError","errors","strapi","STRAPI_SCALARS","SCALARS_ASSOCIATIONS","plugin","service","missingStrapiScalars","difference","Object","keys","length","strapiScalarToGraphQLScalar","strapiScalar","get"],"mappings":";;;AAIA,MAAM,EAAEA,gBAAgB,EAAE,GAAGC,MAAAA;AAE7B,kCAAe,CAAA,CAAC,EAAEC,MAAM,EAAW,GAAA;IACjC,MAAM,EAAEC,cAAc,EAAEC,oBAAoB,EAAE,GAAGF,MAAAA,CAAOG,MAAM,CAAC,SAAA,CAAA,CAAWC,OAAO,CAAC,WAAA,CAAA;AAElF,IAAA,MAAMC,oBAAAA,GAAuBC,UAAAA,CAAWL,cAAAA,EAAgBM,MAAAA,CAAOC,IAAI,CAACN,oBAAAA,CAAAA,CAAAA;IAEpE,IAAIG,oBAAAA,CAAqBI,MAAM,GAAG,CAAA,EAAG;AACnC,QAAA,MAAM,IAAIX,gBAAAA,CAAiB,mEAAA,CAAA;AAC7B,IAAA;IAEA,OAAO;AACL;;AAEC,QACDY,6BAA4BC,YAAoB,EAAA;AAC9C,YAAA,OAAOC,IAAID,YAAAA,EAAcT,oBAAAA,CAAAA;AAC3B,QAAA;AACF,KAAA;AACF,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"naming.js","sources":["../../../../server/src/services/utils/naming.ts"],"sourcesContent":["import { camelCase, upperFirst, lowerFirst, pipe, get } from 'lodash/fp';\nimport { singular } from 'pluralize';\nimport { errors } from '@strapi/utils';\nimport type { Struct, Schema } from '@strapi/types';\nimport type { Context } from '../types';\n\nconst { ApplicationError } = errors;\n\nexport default ({ strapi }: Context) => {\n /**\n * Build a type name for a enum based on a content type & an attribute name\n */\n const getEnumName = (contentType: Struct.Schema, attributeName: string) => {\n const { attributes } = contentType;\n const { enumName } = attributes[attributeName] as Schema.Attribute.Enumeration;\n const { modelType } = contentType;\n\n const typeName =\n modelType === 'component' ? getComponentName(contentType) : getTypeName(contentType);\n\n const defaultEnumName = `ENUM_${typeName.toUpperCase()}_${attributeName.toUpperCase()}`;\n\n return enumName || defaultEnumName;\n };\n\n /**\n * Build the base type name for a given content type\n */\n const getTypeName = (\n contentType: Struct.Schema,\n {\n plurality = 'singular',\n }: {\n plurality?: 'singular' | 'plural';\n } = {}\n ) => {\n const plugin = get('plugin', contentType);\n const modelName = get('modelName', contentType);\n const name =\n plurality === 'singular'\n ? get('info.singularName', contentType)\n : get('info.pluralName', contentType);\n\n const transformedPlugin = plugin ? upperFirst(camelCase(plugin)) : '';\n const transformedModelName = upperFirst(camelCase(name || singular(modelName)));\n\n return `${transformedPlugin}${transformedModelName}`;\n };\n\n /**\n * Build the entity's type name for a given content type\n */\n const getEntityName = (contentType: Struct.Schema) => {\n return `${getTypeName(contentType)}Entity`;\n };\n\n /**\n * Build the entity meta type name for a given content type\n */\n const getEntityMetaName = (contentType: Struct.Schema) => {\n return `${getEntityName(contentType)}Meta`;\n };\n\n /**\n * Build the entity response's type name for a given content type\n */\n const getEntityResponseName = (contentType: Struct.Schema) => {\n return `${getEntityName(contentType)}Response`;\n };\n\n /**\n * Build the entity response collection's type name for a given content type\n */\n const getEntityResponseCollectionName = (contentType: Struct.Schema) => {\n return `${getEntityName(contentType)}ResponseCollection`;\n };\n\n /**\n * Build the relation response collection's type name for a given content type\n */\n const getRelationResponseCollectionName = (contentType: Struct.Schema) => {\n return `${getTypeName(contentType)}RelationResponseCollection`;\n };\n\n /**\n * Build a component type name based on its definition\n */\n const getComponentName = (contentType: Struct.Schema) => {\n return contentType.globalId;\n };\n\n /**\n * Build a component type name based on a content type's attribute\n */\n const getComponentNameFromAttribute = (attribute: Schema.Attribute.Component) => {\n return strapi.components[attribute.component].globalId;\n };\n\n /**\n * Build a dynamic zone type name based on a content type and an attribute name\n */\n const getDynamicZoneName = (contentType: Struct.Schema, attributeName: string) => {\n const typeName = getTypeName(contentType);\n const dzName = upperFirst(camelCase(attributeName));\n const suffix = 'DynamicZone';\n\n return `${typeName}${dzName}${suffix}`;\n };\n\n /**\n * Build a dynamic zone input type name based on a content type and an attribute name\n */\n const getDynamicZoneInputName = (contentType: Struct.Schema, attributeName: string) => {\n const dzName = getDynamicZoneName(contentType, attributeName);\n\n return `${dzName}Input`;\n };\n\n /**\n * Build a component input type name based on a content type and an attribute name\n */\n const getComponentInputName = (contentType: Struct.Schema) => {\n const componentName = getComponentName(contentType);\n\n return `${componentName}Input`;\n };\n\n /**\n * Build a content type input name based on a content type and an attribute name\n */\n const getContentTypeInputName = (contentType: Struct.Schema) => {\n const typeName = getTypeName(contentType);\n\n return `${typeName}Input`;\n };\n\n /**\n * Build the queries type name for a given content type\n */\n const getEntityQueriesTypeName = (contentType: Struct.Schema) => {\n return `${getEntityName(contentType)}Queries`;\n };\n\n /**\n * Build the mutations type name for a given content type\n */\n const getEntityMutationsTypeName = (contentType: Struct.Schema) => {\n return `${getEntityName(contentType)}Mutations`;\n };\n\n /**\n * Build the filters type name for a given content type\n */\n const getFiltersInputTypeName = (contentType: Struct.Schema) => {\n const isComponent = contentType.modelType === 'component';\n\n const baseName = isComponent ? getComponentName(contentType) : getTypeName(contentType);\n\n return `${baseName}FiltersInput`;\n };\n\n /**\n * Build a filters type name for a given GraphQL scalar type\n */\n const getScalarFilterInputTypeName = (scalarType: string) => {\n return `${scalarType}FilterInput`;\n };\n\n /**\n * Build a type name for a given content type & polymorphic attribute\n */\n const getMorphRelationTypeName = (contentType: Struct.Schema, attributeName: string) => {\n const typeName = getTypeName(contentType);\n const formattedAttr = upperFirst(camelCase(attributeName));\n\n return `${typeName}${formattedAttr}Morph`;\n };\n\n /**\n * Build a custom type name generator with different customization options\n */\n const buildCustomTypeNameGenerator = (options: {\n prefix?: string;\n suffix?: string;\n firstLetterCase?: 'upper' | 'lower';\n plurality?: 'plural' | 'singular';\n }) => {\n // todo[v4]: use singularName & pluralName is available\n const { prefix = '', suffix = '', plurality = 'singular', firstLetterCase = 'upper' } = options;\n\n if (!['plural', 'singular'].includes(plurality)) {\n throw new ApplicationError(\n `\"plurality\" param must be either \"plural\" or \"singular\", but got: \"${plurality}\"`\n );\n }\n\n const getCustomTypeName = pipe(\n (ct) => getTypeName(ct, { plurality }),\n firstLetterCase === 'upper' ? upperFirst : lowerFirst\n );\n\n return (contentType: Struct.Schema) => `${prefix}${getCustomTypeName(contentType)}${suffix}`;\n };\n\n const getFindQueryName = buildCustomTypeNameGenerator({\n plurality: 'plural',\n firstLetterCase: 'lower',\n });\n\n const getFindConnectionQueryName = (contentType: Struct.Schema) => {\n return `${getFindQueryName(contentType)}_connection`;\n };\n\n const getFindOneQueryName = buildCustomTypeNameGenerator({ firstLetterCase: 'lower' });\n\n const getCreateMutationTypeName = buildCustomTypeNameGenerator({\n prefix: 'create',\n firstLetterCase: 'upper',\n });\n\n const getUpdateMutationTypeName = buildCustomTypeNameGenerator({\n prefix: 'update',\n firstLetterCase: 'upper',\n });\n\n const getDeleteMutationTypeName = buildCustomTypeNameGenerator({\n prefix: 'delete',\n firstLetterCase: 'upper',\n });\n\n return {\n getEnumName,\n getTypeName,\n getEntityName,\n getEntityMetaName,\n getEntityResponseName,\n getEntityResponseCollectionName,\n getRelationResponseCollectionName,\n getComponentName,\n getComponentNameFromAttribute,\n getDynamicZoneName,\n getDynamicZoneInputName,\n getComponentInputName,\n getContentTypeInputName,\n getEntityQueriesTypeName,\n getEntityMutationsTypeName,\n getFiltersInputTypeName,\n getScalarFilterInputTypeName,\n getMorphRelationTypeName,\n buildCustomTypeNameGenerator,\n getFindQueryName,\n getFindOneQueryName,\n getCreateMutationTypeName,\n getUpdateMutationTypeName,\n getDeleteMutationTypeName,\n getFindConnectionQueryName,\n };\n};\n"],"names":["ApplicationError","errors","strapi","getEnumName","contentType","attributeName","attributes","enumName","modelType","typeName","getComponentName","getTypeName","defaultEnumName","toUpperCase","plurality","plugin","get","modelName","name","transformedPlugin","upperFirst","camelCase","transformedModelName","singular","getEntityName","getEntityMetaName","getEntityResponseName","getEntityResponseCollectionName","getRelationResponseCollectionName","globalId","getComponentNameFromAttribute","attribute","components","component","getDynamicZoneName","dzName","suffix","getDynamicZoneInputName","getComponentInputName","componentName","getContentTypeInputName","getEntityQueriesTypeName","getEntityMutationsTypeName","getFiltersInputTypeName","isComponent","baseName","getScalarFilterInputTypeName","scalarType","getMorphRelationTypeName","formattedAttr","buildCustomTypeNameGenerator","options","prefix","firstLetterCase","includes","getCustomTypeName","pipe","ct","lowerFirst","getFindQueryName","getFindConnectionQueryName","getFindOneQueryName","getCreateMutationTypeName","getUpdateMutationTypeName","getDeleteMutationTypeName"],"mappings":";;;;;;AAMA,MAAM,EAAEA,gBAAgB,EAAE,GAAGC,YAAAA;AAE7B,aAAe,CAAA,CAAC,EAAEC,MAAM,EAAW,GAAA;AACjC;;MAGA,MAAMC,WAAc,GAAA,CAACC,WAA4BC,EAAAA,aAAAA,GAAAA;QAC/C,MAAM,EAAEC,UAAU,EAAE,GAAGF,WAAAA;AACvB,QAAA,MAAM,EAAEG,QAAQ,EAAE,GAAGD,UAAU,CAACD,aAAc,CAAA;QAC9C,MAAM,EAAEG,SAAS,EAAE,GAAGJ,WAAAA;AAEtB,QAAA,MAAMK,QACJD,GAAAA,SAAAA,KAAc,WAAcE,GAAAA,gBAAAA,CAAiBN,eAAeO,WAAYP,CAAAA,WAAAA,CAAAA;QAE1E,MAAMQ,eAAAA,GAAkB,CAAC,KAAK,EAAEH,QAAAA,CAASI,WAAW,EAAA,CAAG,CAAC,EAAER,aAAcQ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A;QACRC,eAAiB,EAAA;AACnB,KAAA,CAAA;IAEA,OAAO;AACLlD,QAAAA,WAAAA;AACAQ,QAAAA,WAAAA;AACAa,QAAAA,aAAAA;AACAC,QAAAA,iBAAAA;AACAC,QAAAA,qBAAAA;AACAC,QAAAA,+BAAAA;AACAC,QAAAA,iCAAAA;AACAlB,QAAAA,gBAAAA;AACAoB,QAAAA,6BAAAA;AACAI,QAAAA,kBAAAA;AACAG,QAAAA,uBAAAA;AACAC,QAAAA,qBAAAA;AACAE,QAAAA,uBAAAA;AACAC,QAAAA,wBAAAA;AACAC,QAAAA,0BAAAA;AACAC,QAAAA,uBAAAA;AACAG,QAAAA,4BAAAA;AACAE,QAAAA,wBAAAA;AACAE,QAAAA,4BAAAA;AACAS,QAAAA,gBAAAA;AACAE,QAAAA,mBAAAA;AACAC,QAAAA,yBAAAA;AACAC,QAAAA,yBAAAA;AACAC,QAAAA,yBAAAA;AACAJ,QAAAA;AACF,KAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"naming.js","sources":["../../../../server/src/services/utils/naming.ts"],"sourcesContent":["import { camelCase, upperFirst, lowerFirst, pipe, get } from 'lodash/fp';\nimport { singular } from 'pluralize';\nimport { errors } from '@strapi/utils';\nimport type { Struct, Schema } from '@strapi/types';\nimport type { Context } from '../types';\n\nconst { ApplicationError } = errors;\n\nexport default ({ strapi }: Context) => {\n /**\n * Build a type name for a enum based on a content type & an attribute name\n */\n const getEnumName = (contentType: Struct.Schema, attributeName: string) => {\n const { attributes } = contentType;\n const { enumName } = attributes[attributeName] as Schema.Attribute.Enumeration;\n const { modelType } = contentType;\n\n const typeName =\n modelType === 'component' ? getComponentName(contentType) : getTypeName(contentType);\n\n const defaultEnumName = `ENUM_${typeName.toUpperCase()}_${attributeName.toUpperCase()}`;\n\n return enumName || defaultEnumName;\n };\n\n /**\n * Build the base type name for a given content type\n */\n const getTypeName = (\n contentType: Struct.Schema,\n {\n plurality = 'singular',\n }: {\n plurality?: 'singular' | 'plural';\n } = {}\n ) => {\n const plugin = get('plugin', contentType);\n const modelName = get('modelName', contentType);\n const name =\n plurality === 'singular'\n ? get('info.singularName', contentType)\n : get('info.pluralName', contentType);\n\n const transformedPlugin = plugin ? upperFirst(camelCase(plugin)) : '';\n const transformedModelName = upperFirst(camelCase(name || singular(modelName)));\n\n return `${transformedPlugin}${transformedModelName}`;\n };\n\n /**\n * Build the entity's type name for a given content type\n */\n const getEntityName = (contentType: Struct.Schema) => {\n return `${getTypeName(contentType)}Entity`;\n };\n\n /**\n * Build the entity meta type name for a given content type\n */\n const getEntityMetaName = (contentType: Struct.Schema) => {\n return `${getEntityName(contentType)}Meta`;\n };\n\n /**\n * Build the entity response's type name for a given content type\n */\n const getEntityResponseName = (contentType: Struct.Schema) => {\n return `${getEntityName(contentType)}Response`;\n };\n\n /**\n * Build the entity response collection's type name for a given content type\n */\n const getEntityResponseCollectionName = (contentType: Struct.Schema) => {\n return `${getEntityName(contentType)}ResponseCollection`;\n };\n\n /**\n * Build the relation response collection's type name for a given content type\n */\n const getRelationResponseCollectionName = (contentType: Struct.Schema) => {\n return `${getTypeName(contentType)}RelationResponseCollection`;\n };\n\n /**\n * Build a component type name based on its definition\n */\n const getComponentName = (contentType: Struct.Schema) => {\n return contentType.globalId;\n };\n\n /**\n * Build a component type name based on a content type's attribute\n */\n const getComponentNameFromAttribute = (attribute: Schema.Attribute.Component) => {\n return strapi.components[attribute.component].globalId;\n };\n\n /**\n * Build a dynamic zone type name based on a content type and an attribute name\n */\n const getDynamicZoneName = (contentType: Struct.Schema, attributeName: string) => {\n const typeName = getTypeName(contentType);\n const dzName = upperFirst(camelCase(attributeName));\n const suffix = 'DynamicZone';\n\n return `${typeName}${dzName}${suffix}`;\n };\n\n /**\n * Build a dynamic zone input type name based on a content type and an attribute name\n */\n const getDynamicZoneInputName = (contentType: Struct.Schema, attributeName: string) => {\n const dzName = getDynamicZoneName(contentType, attributeName);\n\n return `${dzName}Input`;\n };\n\n /**\n * Build a component input type name based on a content type and an attribute name\n */\n const getComponentInputName = (contentType: Struct.Schema) => {\n const componentName = getComponentName(contentType);\n\n return `${componentName}Input`;\n };\n\n /**\n * Build a content type input name based on a content type and an attribute name\n */\n const getContentTypeInputName = (contentType: Struct.Schema) => {\n const typeName = getTypeName(contentType);\n\n return `${typeName}Input`;\n };\n\n /**\n * Build the queries type name for a given content type\n */\n const getEntityQueriesTypeName = (contentType: Struct.Schema) => {\n return `${getEntityName(contentType)}Queries`;\n };\n\n /**\n * Build the mutations type name for a given content type\n */\n const getEntityMutationsTypeName = (contentType: Struct.Schema) => {\n return `${getEntityName(contentType)}Mutations`;\n };\n\n /**\n * Build the filters type name for a given content type\n */\n const getFiltersInputTypeName = (contentType: Struct.Schema) => {\n const isComponent = contentType.modelType === 'component';\n\n const baseName = isComponent ? getComponentName(contentType) : getTypeName(contentType);\n\n return `${baseName}FiltersInput`;\n };\n\n /**\n * Build a filters type name for a given GraphQL scalar type\n */\n const getScalarFilterInputTypeName = (scalarType: string) => {\n return `${scalarType}FilterInput`;\n };\n\n /**\n * Build a type name for a given content type & polymorphic attribute\n */\n const getMorphRelationTypeName = (contentType: Struct.Schema, attributeName: string) => {\n const typeName = getTypeName(contentType);\n const formattedAttr = upperFirst(camelCase(attributeName));\n\n return `${typeName}${formattedAttr}Morph`;\n };\n\n /**\n * Build a custom type name generator with different customization options\n */\n const buildCustomTypeNameGenerator = (options: {\n prefix?: string;\n suffix?: string;\n firstLetterCase?: 'upper' | 'lower';\n plurality?: 'plural' | 'singular';\n }) => {\n // todo[v4]: use singularName & pluralName is available\n const { prefix = '', suffix = '', plurality = 'singular', firstLetterCase = 'upper' } = options;\n\n if (!['plural', 'singular'].includes(plurality)) {\n throw new ApplicationError(\n `\"plurality\" param must be either \"plural\" or \"singular\", but got: \"${plurality}\"`\n );\n }\n\n const getCustomTypeName = pipe(\n (ct) => getTypeName(ct, { plurality }),\n firstLetterCase === 'upper' ? upperFirst : lowerFirst\n );\n\n return (contentType: Struct.Schema) => `${prefix}${getCustomTypeName(contentType)}${suffix}`;\n };\n\n const getFindQueryName = buildCustomTypeNameGenerator({\n plurality: 'plural',\n firstLetterCase: 'lower',\n });\n\n const getFindConnectionQueryName = (contentType: Struct.Schema) => {\n return `${getFindQueryName(contentType)}_connection`;\n };\n\n const getFindOneQueryName = buildCustomTypeNameGenerator({ firstLetterCase: 'lower' });\n\n const getCreateMutationTypeName = buildCustomTypeNameGenerator({\n prefix: 'create',\n firstLetterCase: 'upper',\n });\n\n const getUpdateMutationTypeName = buildCustomTypeNameGenerator({\n prefix: 'update',\n firstLetterCase: 'upper',\n });\n\n const getDeleteMutationTypeName = buildCustomTypeNameGenerator({\n prefix: 'delete',\n firstLetterCase: 'upper',\n });\n\n return {\n getEnumName,\n getTypeName,\n getEntityName,\n getEntityMetaName,\n getEntityResponseName,\n getEntityResponseCollectionName,\n getRelationResponseCollectionName,\n getComponentName,\n getComponentNameFromAttribute,\n getDynamicZoneName,\n getDynamicZoneInputName,\n getComponentInputName,\n getContentTypeInputName,\n getEntityQueriesTypeName,\n getEntityMutationsTypeName,\n getFiltersInputTypeName,\n getScalarFilterInputTypeName,\n getMorphRelationTypeName,\n buildCustomTypeNameGenerator,\n getFindQueryName,\n getFindOneQueryName,\n getCreateMutationTypeName,\n getUpdateMutationTypeName,\n getDeleteMutationTypeName,\n getFindConnectionQueryName,\n };\n};\n"],"names":["ApplicationError","errors","strapi","getEnumName","contentType","attributeName","attributes","enumName","modelType","typeName","getComponentName","getTypeName","defaultEnumName","toUpperCase","plurality","plugin","get","modelName","name","transformedPlugin","upperFirst","camelCase","transformedModelName","singular","getEntityName","getEntityMetaName","getEntityResponseName","getEntityResponseCollectionName","getRelationResponseCollectionName","globalId","getComponentNameFromAttribute","attribute","components","component","getDynamicZoneName","dzName","suffix","getDynamicZoneInputName","getComponentInputName","componentName","getContentTypeInputName","getEntityQueriesTypeName","getEntityMutationsTypeName","getFiltersInputTypeName","isComponent","baseName","getScalarFilterInputTypeName","scalarType","getMorphRelationTypeName","formattedAttr","buildCustomTypeNameGenerator","options","prefix","firstLetterCase","includes","getCustomTypeName","pipe","ct","lowerFirst","getFindQueryName","getFindConnectionQueryName","getFindOneQueryName","getCreateMutationTypeName","getUpdateMutationTypeName","getDeleteMutationTypeName"],"mappings":";;;;;;AAMA,MAAM,EAAEA,gBAAgB,EAAE,GAAGC,YAAAA;AAE7B,aAAe,CAAA,CAAC,EAAEC,MAAM,EAAW,GAAA;AACjC;;MAGA,MAAMC,WAAAA,GAAc,CAACC,WAAAA,EAA4BC,aAAAA,GAAAA;QAC/C,MAAM,EAAEC,UAAU,EAAE,GAAGF,WAAAA;AACvB,QAAA,MAAM,EAAEG,QAAQ,EAAE,GAAGD,UAAU,CAACD,aAAAA,CAAc;QAC9C,MAAM,EAAEG,SAAS,EAAE,GAAGJ,WAAAA;AAEtB,QAAA,MAAMK,QAAAA,GACJD,SAAAA,KAAc,WAAA,GAAcE,gBAAAA,CAAiBN,eAAeO,WAAAA,CAAYP,WAAAA,CAAAA;QAE1E,MAAMQ,eAAAA,GAAkB,CAAC,KAAK,EAAEH,QAAAA,CAASI,WAAW,EAAA,CAAG,CAAC,EAAER,aAAAA,CAAcQ,WAAW,EAAA,CAAA,CAAI;AAEvF,QAAA,OAAON,QAAAA,IAAYK,eAAAA;AACrB,IAAA,CAAA;AAEA;;MAGA,MAAMD,WAAAA,GAAc,CAClBP,WAAAA,EACA,EACEU,YAAY,UAAU,EAGvB,GAAG,EAAE,GAAA;QAEN,MAAMC,MAAAA,GAASC,OAAI,QAAA,EAAUZ,WAAAA,CAAAA;QAC7B,MAAMa,SAAAA,GAAYD,OAAI,WAAA,EAAaZ,WAAAA,CAAAA;AACnC,QAAA,MAAMc,OACJJ,SAAAA,KAAc,UAAA,GACVE,OAAI,mBAAA,EAAqBZ,WAAAA,CAAAA,GACzBY,OAAI,iBAAA,EAAmBZ,WAAAA,CAAAA;AAE7B,QAAA,MAAMe,iBAAAA,GAAoBJ,MAAAA,GAASK,aAAA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uBAAAA;AACAC,QAAAA,wBAAAA;AACAC,QAAAA,0BAAAA;AACAC,QAAAA,uBAAAA;AACAG,QAAAA,4BAAAA;AACAE,QAAAA,wBAAAA;AACAE,QAAAA,4BAAAA;AACAS,QAAAA,gBAAAA;AACAE,QAAAA,mBAAAA;AACAC,QAAAA,yBAAAA;AACAC,QAAAA,yBAAAA;AACAC,QAAAA,yBAAAA;AACAJ,QAAAA;AACF,KAAA;AACF,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"naming.mjs","sources":["../../../../server/src/services/utils/naming.ts"],"sourcesContent":["import { camelCase, upperFirst, lowerFirst, pipe, get } from 'lodash/fp';\nimport { singular } from 'pluralize';\nimport { errors } from '@strapi/utils';\nimport type { Struct, Schema } from '@strapi/types';\nimport type { Context } from '../types';\n\nconst { ApplicationError } = errors;\n\nexport default ({ strapi }: Context) => {\n /**\n * Build a type name for a enum based on a content type & an attribute name\n */\n const getEnumName = (contentType: Struct.Schema, attributeName: string) => {\n const { attributes } = contentType;\n const { enumName } = attributes[attributeName] as Schema.Attribute.Enumeration;\n const { modelType } = contentType;\n\n const typeName =\n modelType === 'component' ? getComponentName(contentType) : getTypeName(contentType);\n\n const defaultEnumName = `ENUM_${typeName.toUpperCase()}_${attributeName.toUpperCase()}`;\n\n return enumName || defaultEnumName;\n };\n\n /**\n * Build the base type name for a given content type\n */\n const getTypeName = (\n contentType: Struct.Schema,\n {\n plurality = 'singular',\n }: {\n plurality?: 'singular' | 'plural';\n } = {}\n ) => {\n const plugin = get('plugin', contentType);\n const modelName = get('modelName', contentType);\n const name =\n plurality === 'singular'\n ? get('info.singularName', contentType)\n : get('info.pluralName', contentType);\n\n const transformedPlugin = plugin ? upperFirst(camelCase(plugin)) : '';\n const transformedModelName = upperFirst(camelCase(name || singular(modelName)));\n\n return `${transformedPlugin}${transformedModelName}`;\n };\n\n /**\n * Build the entity's type name for a given content type\n */\n const getEntityName = (contentType: Struct.Schema) => {\n return `${getTypeName(contentType)}Entity`;\n };\n\n /**\n * Build the entity meta type name for a given content type\n */\n const getEntityMetaName = (contentType: Struct.Schema) => {\n return `${getEntityName(contentType)}Meta`;\n };\n\n /**\n * Build the entity response's type name for a given content type\n */\n const getEntityResponseName = (contentType: Struct.Schema) => {\n return `${getEntityName(contentType)}Response`;\n };\n\n /**\n * Build the entity response collection's type name for a given content type\n */\n const getEntityResponseCollectionName = (contentType: Struct.Schema) => {\n return `${getEntityName(contentType)}ResponseCollection`;\n };\n\n /**\n * Build the relation response collection's type name for a given content type\n */\n const getRelationResponseCollectionName = (contentType: Struct.Schema) => {\n return `${getTypeName(contentType)}RelationResponseCollection`;\n };\n\n /**\n * Build a component type name based on its definition\n */\n const getComponentName = (contentType: Struct.Schema) => {\n return contentType.globalId;\n };\n\n /**\n * Build a component type name based on a content type's attribute\n */\n const getComponentNameFromAttribute = (attribute: Schema.Attribute.Component) => {\n return strapi.components[attribute.component].globalId;\n };\n\n /**\n * Build a dynamic zone type name based on a content type and an attribute name\n */\n const getDynamicZoneName = (contentType: Struct.Schema, attributeName: string) => {\n const typeName = getTypeName(contentType);\n const dzName = upperFirst(camelCase(attributeName));\n const suffix = 'DynamicZone';\n\n return `${typeName}${dzName}${suffix}`;\n };\n\n /**\n * Build a dynamic zone input type name based on a content type and an attribute name\n */\n const getDynamicZoneInputName = (contentType: Struct.Schema, attributeName: string) => {\n const dzName = getDynamicZoneName(contentType, attributeName);\n\n return `${dzName}Input`;\n };\n\n /**\n * Build a component input type name based on a content type and an attribute name\n */\n const getComponentInputName = (contentType: Struct.Schema) => {\n const componentName = getComponentName(contentType);\n\n return `${componentName}Input`;\n };\n\n /**\n * Build a content type input name based on a content type and an attribute name\n */\n const getContentTypeInputName = (contentType: Struct.Schema) => {\n const typeName = getTypeName(contentType);\n\n return `${typeName}Input`;\n };\n\n /**\n * Build the queries type name for a given content type\n */\n const getEntityQueriesTypeName = (contentType: Struct.Schema) => {\n return `${getEntityName(contentType)}Queries`;\n };\n\n /**\n * Build the mutations type name for a given content type\n */\n const getEntityMutationsTypeName = (contentType: Struct.Schema) => {\n return `${getEntityName(contentType)}Mutations`;\n };\n\n /**\n * Build the filters type name for a given content type\n */\n const getFiltersInputTypeName = (contentType: Struct.Schema) => {\n const isComponent = contentType.modelType === 'component';\n\n const baseName = isComponent ? getComponentName(contentType) : getTypeName(contentType);\n\n return `${baseName}FiltersInput`;\n };\n\n /**\n * Build a filters type name for a given GraphQL scalar type\n */\n const getScalarFilterInputTypeName = (scalarType: string) => {\n return `${scalarType}FilterInput`;\n };\n\n /**\n * Build a type name for a given content type & polymorphic attribute\n */\n const getMorphRelationTypeName = (contentType: Struct.Schema, attributeName: string) => {\n const typeName = getTypeName(contentType);\n const formattedAttr = upperFirst(camelCase(attributeName));\n\n return `${typeName}${formattedAttr}Morph`;\n };\n\n /**\n * Build a custom type name generator with different customization options\n */\n const buildCustomTypeNameGenerator = (options: {\n prefix?: string;\n suffix?: string;\n firstLetterCase?: 'upper' | 'lower';\n plurality?: 'plural' | 'singular';\n }) => {\n // todo[v4]: use singularName & pluralName is available\n const { prefix = '', suffix = '', plurality = 'singular', firstLetterCase = 'upper' } = options;\n\n if (!['plural', 'singular'].includes(plurality)) {\n throw new ApplicationError(\n `\"plurality\" param must be either \"plural\" or \"singular\", but got: \"${plurality}\"`\n );\n }\n\n const getCustomTypeName = pipe(\n (ct) => getTypeName(ct, { plurality }),\n firstLetterCase === 'upper' ? upperFirst : lowerFirst\n );\n\n return (contentType: Struct.Schema) => `${prefix}${getCustomTypeName(contentType)}${suffix}`;\n };\n\n const getFindQueryName = buildCustomTypeNameGenerator({\n plurality: 'plural',\n firstLetterCase: 'lower',\n });\n\n const getFindConnectionQueryName = (contentType: Struct.Schema) => {\n return `${getFindQueryName(contentType)}_connection`;\n };\n\n const getFindOneQueryName = buildCustomTypeNameGenerator({ firstLetterCase: 'lower' });\n\n const getCreateMutationTypeName = buildCustomTypeNameGenerator({\n prefix: 'create',\n firstLetterCase: 'upper',\n });\n\n const getUpdateMutationTypeName = buildCustomTypeNameGenerator({\n prefix: 'update',\n firstLetterCase: 'upper',\n });\n\n const getDeleteMutationTypeName = buildCustomTypeNameGenerator({\n prefix: 'delete',\n firstLetterCase: 'upper',\n });\n\n return {\n getEnumName,\n getTypeName,\n getEntityName,\n getEntityMetaName,\n getEntityResponseName,\n getEntityResponseCollectionName,\n getRelationResponseCollectionName,\n getComponentName,\n getComponentNameFromAttribute,\n getDynamicZoneName,\n getDynamicZoneInputName,\n getComponentInputName,\n getContentTypeInputName,\n getEntityQueriesTypeName,\n getEntityMutationsTypeName,\n getFiltersInputTypeName,\n getScalarFilterInputTypeName,\n getMorphRelationTypeName,\n buildCustomTypeNameGenerator,\n getFindQueryName,\n getFindOneQueryName,\n getCreateMutationTypeName,\n getUpdateMutationTypeName,\n getDeleteMutationTypeName,\n getFindConnectionQueryName,\n };\n};\n"],"names":["ApplicationError","errors","strapi","getEnumName","contentType","attributeName","attributes","enumName","modelType","typeName","getComponentName","getTypeName","defaultEnumName","toUpperCase","plurality","plugin","get","modelName","name","transformedPlugin","upperFirst","camelCase","transformedModelName","singular","getEntityName","getEntityMetaName","getEntityResponseName","getEntityResponseCollectionName","getRelationResponseCollectionName","globalId","getComponentNameFromAttribute","attribute","components","component","getDynamicZoneName","dzName","suffix","getDynamicZoneInputName","getComponentInputName","componentName","getContentTypeInputName","getEntityQueriesTypeName","getEntityMutationsTypeName","getFiltersInputTypeName","isComponent","baseName","getScalarFilterInputTypeName","scalarType","getMorphRelationTypeName","formattedAttr","buildCustomTypeNameGenerator","options","prefix","firstLetterCase","includes","getCustomTypeName","pipe","ct","lowerFirst","getFindQueryName","getFindConnectionQueryName","getFindOneQueryName","getCreateMutationTypeName","getUpdateMutationTypeName","getDeleteMutationTypeName"],"mappings":";;;;AAMA,MAAM,EAAEA,gBAAgB,EAAE,GAAGC,MAAAA;AAE7B,aAAe,CAAA,CAAC,EAAEC,MAAM,EAAW,GAAA;AACjC;;MAGA,MAAMC,WAAc,GAAA,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a,CAAA,CAAA,WAAW,CAAC;AACtD,KAAA;AAEA,IAAA,MAAMyD,sBAAsBX,4BAA6B,CAAA;QAAEG,eAAiB,EAAA;AAAQ,KAAA,CAAA;AAEpF,IAAA,MAAMS,4BAA4BZ,4BAA6B,CAAA;QAC7DE,MAAQ,EAAA,QAAA;QACRC,eAAiB,EAAA;AACnB,KAAA,CAAA;AAEA,IAAA,MAAMU,4BAA4Bb,4BAA6B,CAAA;QAC7DE,MAAQ,EAAA,QAAA;QACRC,eAAiB,EAAA;AACnB,KAAA,CAAA;AAEA,IAAA,MAAMW,4BAA4Bd,4BAA6B,CAAA;QAC7DE,MAAQ,EAAA,QAAA;QACRC,eAAiB,EAAA;AACnB,KAAA,CAAA;IAEA,OAAO;AACLlD,QAAAA,WAAAA;AACAQ,QAAAA,WAAAA;AACAa,QAAAA,aAAAA;AACAC,QAAAA,iBAAAA;AACAC,QAAAA,qBAAAA;AACAC,QAAAA,+BAAAA;AACAC,QAAAA,iCAAAA;AACAlB,QAAAA,gBAAAA;AACAoB,QAAAA,6BAAAA;AACAI,QAAAA,kBAAAA;AACAG,QAAAA,uBAAAA;AACAC,QAAAA,qBAAAA;AACAE,QAAAA,uBAAAA;AACAC,QAAAA,wBAAAA;AACAC,QAAAA,0BAAAA;AACAC,QAAAA,uBAAAA;AACAG,QAAAA,4BAAAA;AACAE,QAAAA,wBAAAA;AACAE,QAAAA,4BAAAA;AACAS,QAAAA,gBAAAA;AACAE,QAAAA,mBAAAA;AACAC,QAAAA,yBAAAA;AACAC,QAAAA,yBAAAA;AACAC,QAAAA,yBAAAA;AACAJ,QAAAA;AACF,KAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"naming.mjs","sources":["../../../../server/src/services/utils/naming.ts"],"sourcesContent":["import { camelCase, upperFirst, lowerFirst, pipe, get } from 'lodash/fp';\nimport { singular } from 'pluralize';\nimport { errors } from '@strapi/utils';\nimport type { Struct, Schema } from '@strapi/types';\nimport type { Context } from '../types';\n\nconst { ApplicationError } = errors;\n\nexport default ({ strapi }: Context) => {\n /**\n * Build a type name for a enum based on a content type & an attribute name\n */\n const getEnumName = (contentType: Struct.Schema, attributeName: string) => {\n const { attributes } = contentType;\n const { enumName } = attributes[attributeName] as Schema.Attribute.Enumeration;\n const { modelType } = contentType;\n\n const typeName =\n modelType === 'component' ? getComponentName(contentType) : getTypeName(contentType);\n\n const defaultEnumName = `ENUM_${typeName.toUpperCase()}_${attributeName.toUpperCase()}`;\n\n return enumName || defaultEnumName;\n };\n\n /**\n * Build the base type name for a given content type\n */\n const getTypeName = (\n contentType: Struct.Schema,\n {\n plurality = 'singular',\n }: {\n plurality?: 'singular' | 'plural';\n } = {}\n ) => {\n const plugin = get('plugin', contentType);\n const modelName = get('modelName', contentType);\n const name =\n plurality === 'singular'\n ? get('info.singularName', contentType)\n : get('info.pluralName', contentType);\n\n const transformedPlugin = plugin ? upperFirst(camelCase(plugin)) : '';\n const transformedModelName = upperFirst(camelCase(name || singular(modelName)));\n\n return `${transformedPlugin}${transformedModelName}`;\n };\n\n /**\n * Build the entity's type name for a given content type\n */\n const getEntityName = (contentType: Struct.Schema) => {\n return `${getTypeName(contentType)}Entity`;\n };\n\n /**\n * Build the entity meta type name for a given content type\n */\n const getEntityMetaName = (contentType: Struct.Schema) => {\n return `${getEntityName(contentType)}Meta`;\n };\n\n /**\n * Build the entity response's type name for a given content type\n */\n const getEntityResponseName = (contentType: Struct.Schema) => {\n return `${getEntityName(contentType)}Response`;\n };\n\n /**\n * Build the entity response collection's type name for a given content type\n */\n const getEntityResponseCollectionName = (contentType: Struct.Schema) => {\n return `${getEntityName(contentType)}ResponseCollection`;\n };\n\n /**\n * Build the relation response collection's type name for a given content type\n */\n const getRelationResponseCollectionName = (contentType: Struct.Schema) => {\n return `${getTypeName(contentType)}RelationResponseCollection`;\n };\n\n /**\n * Build a component type name based on its definition\n */\n const getComponentName = (contentType: Struct.Schema) => {\n return contentType.globalId;\n };\n\n /**\n * Build a component type name based on a content type's attribute\n */\n const getComponentNameFromAttribute = (attribute: Schema.Attribute.Component) => {\n return strapi.components[attribute.component].globalId;\n };\n\n /**\n * Build a dynamic zone type name based on a content type and an attribute name\n */\n const getDynamicZoneName = (contentType: Struct.Schema, attributeName: string) => {\n const typeName = getTypeName(contentType);\n const dzName = upperFirst(camelCase(attributeName));\n const suffix = 'DynamicZone';\n\n return `${typeName}${dzName}${suffix}`;\n };\n\n /**\n * Build a dynamic zone input type name based on a content type and an attribute name\n */\n const getDynamicZoneInputName = (contentType: Struct.Schema, attributeName: string) => {\n const dzName = getDynamicZoneName(contentType, attributeName);\n\n return `${dzName}Input`;\n };\n\n /**\n * Build a component input type name based on a content type and an attribute name\n */\n const getComponentInputName = (contentType: Struct.Schema) => {\n const componentName = getComponentName(contentType);\n\n return `${componentName}Input`;\n };\n\n /**\n * Build a content type input name based on a content type and an attribute name\n */\n const getContentTypeInputName = (contentType: Struct.Schema) => {\n const typeName = getTypeName(contentType);\n\n return `${typeName}Input`;\n };\n\n /**\n * Build the queries type name for a given content type\n */\n const getEntityQueriesTypeName = (contentType: Struct.Schema) => {\n return `${getEntityName(contentType)}Queries`;\n };\n\n /**\n * Build the mutations type name for a given content type\n */\n const getEntityMutationsTypeName = (contentType: Struct.Schema) => {\n return `${getEntityName(contentType)}Mutations`;\n };\n\n /**\n * Build the filters type name for a given content type\n */\n const getFiltersInputTypeName = (contentType: Struct.Schema) => {\n const isComponent = contentType.modelType === 'component';\n\n const baseName = isComponent ? getComponentName(contentType) : getTypeName(contentType);\n\n return `${baseName}FiltersInput`;\n };\n\n /**\n * Build a filters type name for a given GraphQL scalar type\n */\n const getScalarFilterInputTypeName = (scalarType: string) => {\n return `${scalarType}FilterInput`;\n };\n\n /**\n * Build a type name for a given content type & polymorphic attribute\n */\n const getMorphRelationTypeName = (contentType: Struct.Schema, attributeName: string) => {\n const typeName = getTypeName(contentType);\n const formattedAttr = upperFirst(camelCase(attributeName));\n\n return `${typeName}${formattedAttr}Morph`;\n };\n\n /**\n * Build a custom type name generator with different customization options\n */\n const buildCustomTypeNameGenerator = (options: {\n prefix?: string;\n suffix?: string;\n firstLetterCase?: 'upper' | 'lower';\n plurality?: 'plural' | 'singular';\n }) => {\n // todo[v4]: use singularName & pluralName is available\n const { prefix = '', suffix = '', plurality = 'singular', firstLetterCase = 'upper' } = options;\n\n if (!['plural', 'singular'].includes(plurality)) {\n throw new ApplicationError(\n `\"plurality\" param must be either \"plural\" or \"singular\", but got: \"${plurality}\"`\n );\n }\n\n const getCustomTypeName = pipe(\n (ct) => getTypeName(ct, { plurality }),\n firstLetterCase === 'upper' ? upperFirst : lowerFirst\n );\n\n return (contentType: Struct.Schema) => `${prefix}${getCustomTypeName(contentType)}${suffix}`;\n };\n\n const getFindQueryName = buildCustomTypeNameGenerator({\n plurality: 'plural',\n firstLetterCase: 'lower',\n });\n\n const getFindConnectionQueryName = (contentType: Struct.Schema) => {\n return `${getFindQueryName(contentType)}_connection`;\n };\n\n const getFindOneQueryName = buildCustomTypeNameGenerator({ firstLetterCase: 'lower' });\n\n const getCreateMutationTypeName = buildCustomTypeNameGenerator({\n prefix: 'create',\n firstLetterCase: 'upper',\n });\n\n const getUpdateMutationTypeName = buildCustomTypeNameGenerator({\n prefix: 'update',\n firstLetterCase: 'upper',\n });\n\n const getDeleteMutationTypeName = buildCustomTypeNameGenerator({\n prefix: 'delete',\n firstLetterCase: 'upper',\n });\n\n return {\n getEnumName,\n getTypeName,\n getEntityName,\n getEntityMetaName,\n getEntityResponseName,\n getEntityResponseCollectionName,\n getRelationResponseCollectionName,\n getComponentName,\n getComponentNameFromAttribute,\n getDynamicZoneName,\n getDynamicZoneInputName,\n getComponentInputName,\n getContentTypeInputName,\n getEntityQueriesTypeName,\n getEntityMutationsTypeName,\n getFiltersInputTypeName,\n getScalarFilterInputTypeName,\n getMorphRelationTypeName,\n buildCustomTypeNameGenerator,\n getFindQueryName,\n getFindOneQueryName,\n getCreateMutationTypeName,\n getUpdateMutationTypeName,\n getDeleteMutationTypeName,\n getFindConnectionQueryName,\n };\n};\n"],"names":["ApplicationError","errors","strapi","getEnumName","contentType","attributeName","attributes","enumName","modelType","typeName","getComponentName","getTypeName","defaultEnumName","toUpperCase","plurality","plugin","get","modelName","name","transformedPlugin","upperFirst","camelCase","transformedModelName","singular","getEntityName","getEntityMetaName","getEntityResponseName","getEntityResponseCollectionName","getRelationResponseCollectionName","globalId","getComponentNameFromAttribute","attribute","components","component","getDynamicZoneName","dzName","suffix","getDynamicZoneInputName","getComponentInputName","componentName","getContentTypeInputName","getEntityQueriesTypeName","getEntityMutationsTypeName","getFiltersInputTypeName","isComponent","baseName","getScalarFilterInputTypeName","scalarType","getMorphRelationTypeName","formattedAttr","buildCustomTypeNameGenerator","options","prefix","firstLetterCase","includes","getCustomTypeName","pipe","ct","lowerFirst","getFindQueryName","getFindConnectionQueryName","getFindOneQueryName","getCreateMutationTypeName","getUpdateMutationTypeName","getDeleteMutationTypeName"],"mappings":";;;;AAMA,MAAM,EAAEA,gBAAgB,EAAE,GAAGC,MAAAA;AAE7B,aAAe,CAAA,CAAC,EAAEC,MAAM,EAAW,GAAA;AACjC;;MAGA,MAAMC,WAAAA,GAAc,CAACC,WAAAA,EAA4BC,aAAAA,GAAAA;QAC/C,MAAM,EAAEC,UAAU,EAAE,GAAGF,WAAAA;AACvB,QAAA,MAAM,EAAEG,QAAQ,EAAE,GAAGD,UAAU,CAACD,aAAAA,CAAc;QAC9C,MAAM,EAAEG,SAAS,EAAE,GAAGJ,WAAAA;AAEtB,QAAA,MAAMK,QAAAA,GACJD,SAAAA,KAAc,WAAA,GAAcE,gBAAAA,CAAiBN,eAAeO,WAAAA,CAAYP,WAAAA,CAAAA;QAE1E,MAAMQ,eAAAA,GAAkB,CAAC,KAAK,EAAEH,QAAAA,CAASI,WAAW,EAAA,CAAG,CAAC,EAAER,aAAAA,CAAcQ,WAAW,EAAA,CAAA,CAAI;AAEvF,QAAA,OAAON,QAAAA,IAAYK,eAAAA;AACrB,IAAA,CAAA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KAAA,CAAA;AAEA,IAAA,MAAMW,4BAA4Bd,4BAAAA,CAA6B;QAC7DE,MAAAA,EAAQ,QAAA;QACRC,eAAAA,EAAiB;AACnB,KAAA,CAAA;IAEA,OAAO;AACLlD,QAAAA,WAAAA;AACAQ,QAAAA,WAAAA;AACAa,QAAAA,aAAAA;AACAC,QAAAA,iBAAAA;AACAC,QAAAA,qBAAAA;AACAC,QAAAA,+BAAAA;AACAC,QAAAA,iCAAAA;AACAlB,QAAAA,gBAAAA;AACAoB,QAAAA,6BAAAA;AACAI,QAAAA,kBAAAA;AACAG,QAAAA,uBAAAA;AACAC,QAAAA,qBAAAA;AACAE,QAAAA,uBAAAA;AACAC,QAAAA,wBAAAA;AACAC,QAAAA,0BAAAA;AACAC,QAAAA,uBAAAA;AACAG,QAAAA,4BAAAA;AACAE,QAAAA,wBAAAA;AACAE,QAAAA,4BAAAA;AACAS,QAAAA,gBAAAA;AACAE,QAAAA,mBAAAA;AACAC,QAAAA,yBAAAA;AACAC,QAAAA,yBAAAA;AACAC,QAAAA,yBAAAA;AACAJ,QAAAA;AACF,KAAA;AACF,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"playground.js","sources":["../../../../server/src/services/utils/playground.ts"],"sourcesContent":["import { Context } from '../types';\n\n// TODO: deprecate and remove this because it is only used to determine if we need helmet security exceptions\n// stores the state of the Apollo landingPage (playground)\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport default (ctx: Context) => {\n let enabled = false;\n\n return {\n setEnabled(val: boolean) {\n enabled = val;\n },\n isEnabled() {\n return enabled;\n },\n };\n};\n"],"names":["ctx","enabled","setEnabled","val","isEnabled"],"mappings":";;AAEA;AACA;AACA;AACA,iBAAe,CAAA,CAACA,GAAAA,GAAAA;AACd,IAAA,IAAIC,OAAU,GAAA,KAAA;IAEd,OAAO;AACLC,QAAAA,UAAAA,CAAAA,CAAWC,GAAY,EAAA;YACrBF,OAAUE,GAAAA,GAAAA;AACZ,SAAA;AACAC,QAAAA,SAAAA,CAAAA,GAAAA;YACE,OAAOH,OAAAA;AACT;AACF,KAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"playground.js","sources":["../../../../server/src/services/utils/playground.ts"],"sourcesContent":["import { Context } from '../types';\n\n// TODO: deprecate and remove this because it is only used to determine if we need helmet security exceptions\n// stores the state of the Apollo landingPage (playground)\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport default (ctx: Context) => {\n let enabled = false;\n\n return {\n setEnabled(val: boolean) {\n enabled = val;\n },\n isEnabled() {\n return enabled;\n },\n };\n};\n"],"names":["ctx","enabled","setEnabled","val","isEnabled"],"mappings":";;AAEA;AACA;AACA;AACA,iBAAe,CAAA,CAACA,GAAAA,GAAAA;AACd,IAAA,IAAIC,OAAAA,GAAU,KAAA;IAEd,OAAO;AACLC,QAAAA,UAAAA,CAAAA,CAAWC,GAAY,EAAA;YACrBF,OAAAA,GAAUE,GAAAA;AACZ,QAAA,CAAA;AACAC,QAAAA,SAAAA,CAAAA,GAAAA;YACE,OAAOH,OAAAA;AACT,QAAA;AACF,KAAA;AACF,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"playground.mjs","sources":["../../../../server/src/services/utils/playground.ts"],"sourcesContent":["import { Context } from '../types';\n\n// TODO: deprecate and remove this because it is only used to determine if we need helmet security exceptions\n// stores the state of the Apollo landingPage (playground)\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport default (ctx: Context) => {\n let enabled = false;\n\n return {\n setEnabled(val: boolean) {\n enabled = val;\n },\n isEnabled() {\n return enabled;\n },\n };\n};\n"],"names":["ctx","enabled","setEnabled","val","isEnabled"],"mappings":"AAEA;AACA;AACA;AACA,iBAAe,CAAA,CAACA,GAAAA,GAAAA;AACd,IAAA,IAAIC,OAAU,GAAA,KAAA;IAEd,OAAO;AACLC,QAAAA,UAAAA,CAAAA,CAAWC,GAAY,EAAA;YACrBF,OAAUE,GAAAA,GAAAA;AACZ,SAAA;AACAC,QAAAA,SAAAA,CAAAA,GAAAA;YACE,OAAOH,OAAAA;AACT;AACF,KAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"playground.mjs","sources":["../../../../server/src/services/utils/playground.ts"],"sourcesContent":["import { Context } from '../types';\n\n// TODO: deprecate and remove this because it is only used to determine if we need helmet security exceptions\n// stores the state of the Apollo landingPage (playground)\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport default (ctx: Context) => {\n let enabled = false;\n\n return {\n setEnabled(val: boolean) {\n enabled = val;\n },\n isEnabled() {\n return enabled;\n },\n };\n};\n"],"names":["ctx","enabled","setEnabled","val","isEnabled"],"mappings":"AAEA;AACA;AACA;AACA,iBAAe,CAAA,CAACA,GAAAA,GAAAA;AACd,IAAA,IAAIC,OAAAA,GAAU,KAAA;IAEd,OAAO;AACLC,QAAAA,UAAAA,CAAAA,CAAWC,GAAY,EAAA;YACrBF,OAAAA,GAAUE,GAAAA;AACZ,QAAA,CAAA;AACAC,QAAAA,SAAAA,CAAAA,GAAAA;YACE,OAAOH,OAAAA;AACT,QAAA;AACF,KAAA;AACF,CAAA;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/plugin-graphql",
3
- "version": "5.37.0",
3
+ "version": "5.38.0",
4
4
  "description": "Adds GraphQL endpoint with default API methods.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -59,9 +59,9 @@
59
59
  "@graphql-tools/schema": "10.0.3",
60
60
  "@graphql-tools/utils": "^10.1.3",
61
61
  "@koa/cors": "5.0.0",
62
- "@strapi/design-system": "2.1.2",
63
- "@strapi/icons": "2.1.2",
64
- "@strapi/utils": "5.37.0",
62
+ "@strapi/design-system": "2.2.0",
63
+ "@strapi/icons": "2.2.0",
64
+ "@strapi/utils": "5.38.0",
65
65
  "graphql": "^16.8.1",
66
66
  "graphql-depth-limit": "^1.1.0",
67
67
  "graphql-playground-middleware-koa": "^1.6.21",
@@ -73,19 +73,19 @@
73
73
  "pluralize": "8.0.0"
74
74
  },
75
75
  "devDependencies": {
76
- "@strapi/strapi": "5.37.0",
77
- "@strapi/types": "5.37.0",
76
+ "@strapi/strapi": "5.38.0",
77
+ "@strapi/types": "5.38.0",
78
78
  "@types/graphql-depth-limit": "1.1.5",
79
79
  "@types/koa-bodyparser": "4.3.12",
80
80
  "@types/koa__cors": "5.0.0",
81
81
  "cross-env": "^7.0.3",
82
- "eslint-config-custom": "5.37.0",
82
+ "eslint-config-custom": "5.38.0",
83
83
  "koa": "2.16.3",
84
84
  "react": "18.3.1",
85
85
  "react-dom": "18.3.1",
86
86
  "react-router-dom": "6.30.3",
87
87
  "styled-components": "6.1.8",
88
- "tsconfig": "5.37.0",
88
+ "tsconfig": "5.38.0",
89
89
  "typescript": "5.4.4"
90
90
  },
91
91
  "peerDependencies": {