@strapi/plugin-graphql 5.56.0 → 5.57.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 (138) hide show
  1. package/dist/server/bootstrap.js +10 -10
  2. package/dist/server/bootstrap.js.map +1 -1
  3. package/dist/server/bootstrap.mjs +8 -8
  4. package/dist/server/bootstrap.mjs.map +1 -1
  5. package/dist/server/format-graphql-error.js +5 -5
  6. package/dist/server/format-graphql-error.js.map +1 -1
  7. package/dist/server/format-graphql-error.mjs +4 -4
  8. package/dist/server/format-graphql-error.mjs.map +1 -1
  9. package/dist/server/services/builders/dynamic-zones.js +3 -3
  10. package/dist/server/services/builders/dynamic-zones.js.map +1 -1
  11. package/dist/server/services/builders/dynamic-zones.mjs +3 -3
  12. package/dist/server/services/builders/dynamic-zones.mjs.map +1 -1
  13. package/dist/server/services/builders/entity.js +4 -4
  14. package/dist/server/services/builders/entity.js.map +1 -1
  15. package/dist/server/services/builders/entity.mjs +2 -2
  16. package/dist/server/services/builders/entity.mjs.map +1 -1
  17. package/dist/server/services/builders/enums.js +2 -2
  18. package/dist/server/services/builders/enums.js.map +1 -1
  19. package/dist/server/services/builders/enums.mjs +2 -2
  20. package/dist/server/services/builders/enums.mjs.map +1 -1
  21. package/dist/server/services/builders/filters/operators/index.js +3 -3
  22. package/dist/server/services/builders/filters/operators/index.js.map +1 -1
  23. package/dist/server/services/builders/filters/operators/index.mjs +3 -3
  24. package/dist/server/services/builders/filters/operators/index.mjs.map +1 -1
  25. package/dist/server/services/builders/generic-morph.js +1 -2
  26. package/dist/server/services/builders/generic-morph.js.map +1 -1
  27. package/dist/server/services/builders/generic-morph.mjs +1 -2
  28. package/dist/server/services/builders/generic-morph.mjs.map +1 -1
  29. package/dist/server/services/builders/index.js +2 -4
  30. package/dist/server/services/builders/index.js.map +1 -1
  31. package/dist/server/services/builders/index.mjs +2 -4
  32. package/dist/server/services/builders/index.mjs.map +1 -1
  33. package/dist/server/services/builders/relation-response-collection.js +3 -3
  34. package/dist/server/services/builders/relation-response-collection.js.map +1 -1
  35. package/dist/server/services/builders/relation-response-collection.mjs +3 -3
  36. package/dist/server/services/builders/relation-response-collection.mjs.map +1 -1
  37. package/dist/server/services/builders/resolvers/association.js +3 -3
  38. package/dist/server/services/builders/resolvers/association.js.map +1 -1
  39. package/dist/server/services/builders/resolvers/association.mjs +3 -3
  40. package/dist/server/services/builders/resolvers/association.mjs.map +1 -1
  41. package/dist/server/services/builders/resolvers/query.js +3 -3
  42. package/dist/server/services/builders/resolvers/query.js.map +1 -1
  43. package/dist/server/services/builders/resolvers/query.mjs +3 -3
  44. package/dist/server/services/builders/resolvers/query.mjs.map +1 -1
  45. package/dist/server/services/builders/response-collection.js +4 -4
  46. package/dist/server/services/builders/response-collection.js.map +1 -1
  47. package/dist/server/services/builders/response-collection.mjs +3 -3
  48. package/dist/server/services/builders/response-collection.mjs.map +1 -1
  49. package/dist/server/services/builders/response.js +1 -2
  50. package/dist/server/services/builders/response.js.map +1 -1
  51. package/dist/server/services/builders/response.mjs +1 -2
  52. package/dist/server/services/builders/response.mjs.map +1 -1
  53. package/dist/server/services/builders/type.js +4 -4
  54. package/dist/server/services/builders/type.js.map +1 -1
  55. package/dist/server/services/builders/type.mjs +3 -3
  56. package/dist/server/services/builders/type.mjs.map +1 -1
  57. package/dist/server/services/builders/utils.js +6 -6
  58. package/dist/server/services/builders/utils.js.map +1 -1
  59. package/dist/server/services/builders/utils.mjs +6 -6
  60. package/dist/server/services/builders/utils.mjs.map +1 -1
  61. package/dist/server/services/content-api/index.js +1 -2
  62. package/dist/server/services/content-api/index.js.map +1 -1
  63. package/dist/server/services/content-api/index.mjs +1 -2
  64. package/dist/server/services/content-api/index.mjs.map +1 -1
  65. package/dist/server/services/content-api/policy.js +2 -3
  66. package/dist/server/services/content-api/policy.js.map +1 -1
  67. package/dist/server/services/content-api/policy.mjs +2 -3
  68. package/dist/server/services/content-api/policy.mjs.map +1 -1
  69. package/dist/server/services/content-api/wrap-resolvers.js +9 -9
  70. package/dist/server/services/content-api/wrap-resolvers.js.map +1 -1
  71. package/dist/server/services/content-api/wrap-resolvers.mjs +9 -9
  72. package/dist/server/services/content-api/wrap-resolvers.mjs.map +1 -1
  73. package/dist/server/services/extension/extension.js +3 -3
  74. package/dist/server/services/extension/extension.js.map +1 -1
  75. package/dist/server/services/extension/extension.mjs +3 -3
  76. package/dist/server/services/extension/extension.mjs.map +1 -1
  77. package/dist/server/services/internals/helpers/get-enabled-scalars.js +2 -2
  78. package/dist/server/services/internals/helpers/get-enabled-scalars.js.map +1 -1
  79. package/dist/server/services/internals/helpers/get-enabled-scalars.mjs +1 -1
  80. package/dist/server/services/internals/helpers/get-enabled-scalars.mjs.map +1 -1
  81. package/dist/server/services/internals/types/error.js +1 -2
  82. package/dist/server/services/internals/types/error.js.map +1 -1
  83. package/dist/server/services/internals/types/error.mjs +1 -2
  84. package/dist/server/services/internals/types/error.mjs.map +1 -1
  85. package/dist/server/services/type-registry.js +1 -2
  86. package/dist/server/services/type-registry.js.map +1 -1
  87. package/dist/server/services/type-registry.mjs +1 -2
  88. package/dist/server/services/type-registry.mjs.map +1 -1
  89. package/dist/server/services/utils/attributes.js +6 -6
  90. package/dist/server/services/utils/attributes.js.map +1 -1
  91. package/dist/server/services/utils/attributes.mjs +6 -6
  92. package/dist/server/services/utils/attributes.mjs.map +1 -1
  93. package/dist/server/services/utils/mappers/entity-to-response-entity.js +2 -2
  94. package/dist/server/services/utils/mappers/entity-to-response-entity.js.map +1 -1
  95. package/dist/server/services/utils/mappers/entity-to-response-entity.mjs +2 -2
  96. package/dist/server/services/utils/mappers/entity-to-response-entity.mjs.map +1 -1
  97. package/dist/server/services/utils/mappers/graphql-filters-to-strapi-query.js +5 -5
  98. package/dist/server/services/utils/mappers/graphql-filters-to-strapi-query.js.map +1 -1
  99. package/dist/server/services/utils/mappers/graphql-filters-to-strapi-query.mjs +4 -4
  100. package/dist/server/services/utils/mappers/graphql-filters-to-strapi-query.mjs.map +1 -1
  101. package/dist/server/services/utils/mappers/graphql-scalar-to-operators.js +3 -3
  102. package/dist/server/services/utils/mappers/graphql-scalar-to-operators.js.map +1 -1
  103. package/dist/server/services/utils/mappers/graphql-scalar-to-operators.mjs +3 -3
  104. package/dist/server/services/utils/mappers/graphql-scalar-to-operators.mjs.map +1 -1
  105. package/dist/server/services/utils/mappers/strapi-scalar-to-graphql-scalar.js +3 -3
  106. package/dist/server/services/utils/mappers/strapi-scalar-to-graphql-scalar.js.map +1 -1
  107. package/dist/server/services/utils/mappers/strapi-scalar-to-graphql-scalar.mjs +2 -2
  108. package/dist/server/services/utils/mappers/strapi-scalar-to-graphql-scalar.mjs.map +1 -1
  109. package/dist/server/services/utils/naming.js +13 -10
  110. package/dist/server/services/utils/naming.js.map +1 -1
  111. package/dist/server/services/utils/naming.mjs +9 -6
  112. package/dist/server/services/utils/naming.mjs.map +1 -1
  113. package/dist/server/src/bootstrap.d.ts.map +1 -1
  114. package/dist/server/src/index.d.ts +128 -13
  115. package/dist/server/src/index.d.ts.map +1 -1
  116. package/dist/server/src/services/builders/filters/operators/index.d.ts +112 -5
  117. package/dist/server/src/services/builders/filters/operators/index.d.ts.map +1 -1
  118. package/dist/server/src/services/builders/generic-morph.d.ts.map +1 -1
  119. package/dist/server/src/services/builders/index.d.ts +116 -7
  120. package/dist/server/src/services/builders/index.d.ts.map +1 -1
  121. package/dist/server/src/services/builders/resolvers/index.d.ts.map +1 -1
  122. package/dist/server/src/services/builders/response.d.ts.map +1 -1
  123. package/dist/server/src/services/builders/utils.d.ts +3 -1
  124. package/dist/server/src/services/builders/utils.d.ts.map +1 -1
  125. package/dist/server/src/services/content-api/index.d.ts.map +1 -1
  126. package/dist/server/src/services/content-api/policy.d.ts.map +1 -1
  127. package/dist/server/src/services/index.d.ts +128 -13
  128. package/dist/server/src/services/index.d.ts.map +1 -1
  129. package/dist/server/src/services/internals/types/error.d.ts.map +1 -1
  130. package/dist/server/src/services/type-registry.d.ts.map +1 -1
  131. package/dist/server/src/services/utils/index.d.ts +12 -6
  132. package/dist/server/src/services/utils/index.d.ts.map +1 -1
  133. package/dist/server/src/services/utils/mappers/entity-to-response-entity.d.ts +14 -7
  134. package/dist/server/src/services/utils/mappers/entity-to-response-entity.d.ts.map +1 -1
  135. package/dist/server/src/services/utils/mappers/graphql-scalar-to-operators.d.ts.map +1 -1
  136. package/dist/server/src/services/utils/mappers/index.d.ts +12 -6
  137. package/dist/server/src/services/utils/mappers/index.d.ts.map +1 -1
  138. package/package.json +13 -13
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var fp = require('lodash/fp');
3
+ var lodash = require('lodash');
4
4
 
5
5
  // todo[v4]: Find a way to get that dynamically
6
6
  const virtualScalarAttributes = [
@@ -16,7 +16,7 @@ var graphQLFiltersToStrapiQuery = (({ strapi })=>{
16
16
  }
17
17
  // Note: We need to make an exception for date since GraphQL
18
18
  // automatically cast date strings to date instances in args
19
- if (fp.isDate(data) || !fp.isObject(data)) {
19
+ if (lodash.isDate(data) || !lodash.isObject(data)) {
20
20
  return data;
21
21
  }
22
22
  const result = {};
@@ -42,7 +42,7 @@ var graphQLFiltersToStrapiQuery = (({ strapi })=>{
42
42
  operators.not
43
43
  ];
44
44
  // Handle unwanted scenario where there is no filters defined
45
- if (fp.isNil(filters)) {
45
+ if (filters == null) {
46
46
  return {};
47
47
  }
48
48
  // If filters is a collection, then apply the transformation to every item of the list
@@ -52,7 +52,7 @@ var graphQLFiltersToStrapiQuery = (({ strapi })=>{
52
52
  const resultMap = {};
53
53
  const { attributes } = contentType;
54
54
  const isAttribute = (attributeName)=>{
55
- return virtualScalarAttributes.includes(attributeName) || fp.has(attributeName, attributes);
55
+ return virtualScalarAttributes.includes(attributeName) || lodash.has(attributes, attributeName);
56
56
  };
57
57
  for (const [key, value] of Object.entries(filters)){
58
58
  // If the key is an attribute, update the value
@@ -76,7 +76,7 @@ var graphQLFiltersToStrapiQuery = (({ strapi })=>{
76
76
  resultMap[key] = this.graphQLFiltersToStrapiQuery(value, componentModel);
77
77
  }
78
78
  } else {
79
- const rootLevelOperator = ROOT_LEVEL_OPERATORS.find(fp.propEq('fieldName', key));
79
+ const rootLevelOperator = ROOT_LEVEL_OPERATORS.find(lodash.matchesProperty('fieldName', key));
80
80
  // If it's a root level operator (AND, NOT, OR, ...)
81
81
  if (rootLevelOperator) {
82
82
  const { strapiOperator } = rootLevelOperator;
@@ -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,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,GAAAA;YAE5DD,MAAM,CAACM,MAAAA,CAAO,GAAGf,iCAAAA,CAAkCW,KAAAA,CAAAA;AACrD,QAAA;QAEA,OAAOF,MAAAA;AACT,IAAA,CAAA;IAEA,OAAO;AACL;;;;;QAMAQ,2BAAAA,CAAAA,CAA4Bd,OAAY,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BAEtEL,SAAS,CAACpB,GAAAA,CAAI,GAAGV,iCAAAA,CAAkCW,KAAAA,CAAAA;AACrD,oBAAA,CAAA,MAGK,IAAIU,UAAAA,CAAWc,SAAAA,CAAAA,IAAcf,OAAAA,CAAQe,SAAAA,CAAAA,EAAY;;AAEpD,wBAAA,MAAMC,QAAAA,GAAWxC,MAAAA,CAAOyC,QAAQ,CAACF,UAAUG,MAAM,CAAA;;;AAIjDR,wBAAAA,SAAS,CAACpB,GAAAA,CAAI,GAAG,IAAI,CAACO,2BAA2B,CAACN,KAAAA,EAAOyB,QAAAA,CAAAA;oBAC3D,CAAA,MAGK,IAAId,YAAYa,SAAAA,CAAAA,EAAY;;AAE/B,wBAAA,MAAMI,cAAAA,GAAiB3C,MAAAA,CAAOyC,QAAQ,CAACF,UAAUK,SAAS,CAAA;;;AAI1DV,wBAAAA,SAAS,CAACpB,GAAAA,CAAI,GAAG,IAAI,CAACO,2BAA2B,CAACN,KAAAA,EAAO4B,cAAAA,CAAAA;AAC3D,oBAAA;gBACF,CAAA,MAGK;AACH,oBAAA,MAAME,iBAAAA,GAAoBjB,oBAAAA,CAAqBkB,IAAI,CAACC,UAAO,WAAA,EAAajC,GAAAA,CAAAA,CAAAA;;AAGxE,oBAAA,IAAI+B,iBAAAA,EAAmB;wBACrB,MAAM,EAAEzB,cAAc,EAAE,GAAGyB,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
+ {"version":3,"file":"graphql-filters-to-strapi-query.js","sources":["../../../../../server/src/services/utils/mappers/graphql-filters-to-strapi-query.ts"],"sourcesContent":["import { isDate, isObject, has, matchesProperty } from 'lodash';\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 (filters == null) {\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(attributes, attributeName);\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(matchesProperty('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","filtersItem","resultMap","isAttribute","attributeName","includes","has","attribute","relModel","getModel","target","componentModel","component","rootLevelOperator","find","matchesProperty"],"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,UAA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,CAAOwC,QAAQ,CAACF,UAAUK,SAAS,CAAA;;;AAI1DV,wBAAAA,SAAS,CAACnB,GAAAA,CAAI,GAAG,IAAI,CAACO,2BAA2B,CAACN,KAAAA,EAAO2B,cAAAA,CAAAA;AAC3D,oBAAA;gBACF,CAAA,MAGK;AACH,oBAAA,MAAME,iBAAAA,GAAoBhB,oBAAAA,CAAqBiB,IAAI,CAACC,uBAAgB,WAAA,EAAahC,GAAAA,CAAAA,CAAAA;;AAGjF,oBAAA,IAAI8B,iBAAAA,EAAmB;wBACrB,MAAM,EAAExB,cAAc,EAAE,GAAGwB,iBAAAA;;;AAI3BX,wBAAAA,SAAS,CAACb,cAAAA,CAAe,GAAG,IAAI,CAACC,2BAA2B,CAACN,KAAAA,EAAOO,WAAAA,CAAAA;AACtE,oBAAA;AACF,gBAAA;AACF,YAAA;YAEA,OAAOW,SAAAA;AACT,QAAA;AACF,KAAA;AACF,CAAA;;;;"}
@@ -1,4 +1,4 @@
1
- import { isNil, propEq, isDate, isObject, has } from 'lodash/fp';
1
+ import { matchesProperty, isDate, isObject, has } from 'lodash';
2
2
 
3
3
  // todo[v4]: Find a way to get that dynamically
4
4
  const virtualScalarAttributes = [
@@ -40,7 +40,7 @@ var graphQLFiltersToStrapiQuery = (({ strapi })=>{
40
40
  operators.not
41
41
  ];
42
42
  // Handle unwanted scenario where there is no filters defined
43
- if (isNil(filters)) {
43
+ if (filters == null) {
44
44
  return {};
45
45
  }
46
46
  // If filters is a collection, then apply the transformation to every item of the list
@@ -50,7 +50,7 @@ var graphQLFiltersToStrapiQuery = (({ strapi })=>{
50
50
  const resultMap = {};
51
51
  const { attributes } = contentType;
52
52
  const isAttribute = (attributeName)=>{
53
- return virtualScalarAttributes.includes(attributeName) || has(attributeName, attributes);
53
+ return virtualScalarAttributes.includes(attributeName) || has(attributes, attributeName);
54
54
  };
55
55
  for (const [key, value] of Object.entries(filters)){
56
56
  // If the key is an attribute, update the value
@@ -74,7 +74,7 @@ var graphQLFiltersToStrapiQuery = (({ strapi })=>{
74
74
  resultMap[key] = this.graphQLFiltersToStrapiQuery(value, componentModel);
75
75
  }
76
76
  } else {
77
- const rootLevelOperator = ROOT_LEVEL_OPERATORS.find(propEq('fieldName', key));
77
+ const rootLevelOperator = ROOT_LEVEL_OPERATORS.find(matchesProperty('fieldName', key));
78
78
  // If it's a root level operator (AND, NOT, OR, ...)
79
79
  if (rootLevelOperator) {
80
80
  const { strapiOperator } = rootLevelOperator;
@@ -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,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,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,GAAAA;YAE5DD,MAAM,CAACM,MAAAA,CAAO,GAAGf,iCAAAA,CAAkCW,KAAAA,CAAAA;AACrD,QAAA;QAEA,OAAOF,MAAAA;AACT,IAAA,CAAA;IAEA,OAAO;AACL;;;;;QAMAQ,2BAAA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B,SAAAA,CAAAA,EAAY;;wBAEtEL,SAAS,CAACpB,GAAAA,CAAI,GAAGV,iCAAAA,CAAkCW,KAAAA,CAAAA;AACrD,oBAAA,CAAA,MAGK,IAAIU,UAAAA,CAAWc,SAAAA,CAAAA,IAAcf,OAAAA,CAAQe,SAAAA,CAAAA,EAAY;;AAEpD,wBAAA,MAAMC,QAAAA,GAAWxC,MAAAA,CAAOyC,QAAQ,CAACF,UAAUG,MAAM,CAAA;;;AAIjDR,wBAAAA,SAAS,CAACpB,GAAAA,CAAI,GAAG,IAAI,CAACO,2BAA2B,CAACN,KAAAA,EAAOyB,QAAAA,CAAAA;oBAC3D,CAAA,MAGK,IAAId,YAAYa,SAAAA,CAAAA,EAAY;;AAE/B,wBAAA,MAAMI,cAAAA,GAAiB3C,MAAAA,CAAOyC,QAAQ,CAACF,UAAUK,SAAS,CAAA;;;AAI1DV,wBAAAA,SAAS,CAACpB,GAAAA,CAAI,GAAG,IAAI,CAACO,2BAA2B,CAACN,KAAAA,EAAO4B,cAAAA,CAAAA;AAC3D,oBAAA;gBACF,CAAA,MAGK;AACH,oBAAA,MAAME,iBAAAA,GAAoBjB,oBAAAA,CAAqBkB,IAAI,CAACC,OAAO,WAAA,EAAajC,GAAAA,CAAAA,CAAAA;;AAGxE,oBAAA,IAAI+B,iBAAAA,EAAmB;wBACrB,MAAM,EAAEzB,cAAc,EAAE,GAAGyB,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
+ {"version":3,"file":"graphql-filters-to-strapi-query.mjs","sources":["../../../../../server/src/services/utils/mappers/graphql-filters-to-strapi-query.ts"],"sourcesContent":["import { isDate, isObject, has, matchesProperty } from 'lodash';\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 (filters == null) {\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(attributes, attributeName);\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(matchesProperty('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","filtersItem","resultMap","isAttribute","attributeName","includes","has","attribute","relModel","getModel","target","componentModel","component","rootLevelOperator","find","matchesProperty"],"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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I,cAAAA,GAAiB1C,MAAAA,CAAOwC,QAAQ,CAACF,UAAUK,SAAS,CAAA;;;AAI1DV,wBAAAA,SAAS,CAACnB,GAAAA,CAAI,GAAG,IAAI,CAACO,2BAA2B,CAACN,KAAAA,EAAO2B,cAAAA,CAAAA;AAC3D,oBAAA;gBACF,CAAA,MAGK;AACH,oBAAA,MAAME,iBAAAA,GAAoBhB,oBAAAA,CAAqBiB,IAAI,CAACC,gBAAgB,WAAA,EAAahC,GAAAA,CAAAA,CAAAA;;AAGjF,oBAAA,IAAI8B,iBAAAA,EAAmB;wBACrB,MAAM,EAAExB,cAAc,EAAE,GAAGwB,iBAAAA;;;AAI3BX,wBAAAA,SAAS,CAACb,cAAAA,CAAe,GAAG,IAAI,CAACC,2BAA2B,CAACN,KAAAA,EAAOO,WAAAA,CAAAA;AACtE,oBAAA;AACF,gBAAA;AACF,YAAA;YAEA,OAAOW,SAAAA;AACT,QAAA;AACF,KAAA;AACF,CAAA;;;;"}
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var fp = require('lodash/fp');
3
+ var lodash = require('lodash');
4
4
 
5
5
  var graphqlScalarToOperators = (({ strapi })=>({
6
6
  graphqlScalarToOperators (graphqlScalar) {
7
7
  const { GRAPHQL_SCALAR_OPERATORS } = strapi.plugin('graphql').service('constants');
8
8
  const { operators } = strapi.plugin('graphql').service('builders').filters;
9
- const associations = fp.mapValues(fp.map((operatorName)=>operators[operatorName]), GRAPHQL_SCALAR_OPERATORS);
10
- return fp.get(graphqlScalar, associations);
9
+ const associations = lodash.mapValues(GRAPHQL_SCALAR_OPERATORS, (operatorNames)=>operatorNames.map((operatorName)=>operators[operatorName]));
10
+ return lodash.get(associations, graphqlScalar);
11
11
  }
12
12
  }));
13
13
 
@@ -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,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
+ {"version":3,"file":"graphql-scalar-to-operators.js","sources":["../../../../../server/src/services/utils/mappers/graphql-scalar-to-operators.ts"],"sourcesContent":["import { mapValues, get } from 'lodash';\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(GRAPHQL_SCALAR_OPERATORS, (operatorNames: string[]) =>\n operatorNames.map((operatorName) => operators[operatorName])\n );\n\n return get(associations, graphqlScalar);\n },\n});\n"],"names":["strapi","graphqlScalarToOperators","graphqlScalar","GRAPHQL_SCALAR_OPERATORS","plugin","service","operators","filters","associations","mapValues","operatorNames","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;AAE1E,YAAA,MAAMC,YAAAA,GAAeC,gBAAAA,CAAUN,wBAAAA,EAA0B,CAACO,aAAAA,GACxDA,aAAAA,CAAcC,GAAG,CAAC,CAACC,YAAAA,GAAiBN,SAAS,CAACM,YAAAA,CAAa,CAAA,CAAA;AAG7D,YAAA,OAAOC,WAAIL,YAAAA,EAAcN,aAAAA,CAAAA;AAC3B,QAAA;AACF,KAAA,CAAC;;;;"}
@@ -1,11 +1,11 @@
1
- import { mapValues, map, get } from 'lodash/fp';
1
+ import { mapValues, get } from 'lodash';
2
2
 
3
3
  var graphqlScalarToOperators = (({ strapi })=>({
4
4
  graphqlScalarToOperators (graphqlScalar) {
5
5
  const { GRAPHQL_SCALAR_OPERATORS } = strapi.plugin('graphql').service('constants');
6
6
  const { operators } = strapi.plugin('graphql').service('builders').filters;
7
- const associations = mapValues(map((operatorName)=>operators[operatorName]), GRAPHQL_SCALAR_OPERATORS);
8
- return get(graphqlScalar, associations);
7
+ const associations = mapValues(GRAPHQL_SCALAR_OPERATORS, (operatorNames)=>operatorNames.map((operatorName)=>operators[operatorName]));
8
+ return get(associations, graphqlScalar);
9
9
  }
10
10
  }));
11
11
 
@@ -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,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
+ {"version":3,"file":"graphql-scalar-to-operators.mjs","sources":["../../../../../server/src/services/utils/mappers/graphql-scalar-to-operators.ts"],"sourcesContent":["import { mapValues, get } from 'lodash';\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(GRAPHQL_SCALAR_OPERATORS, (operatorNames: string[]) =>\n operatorNames.map((operatorName) => operators[operatorName])\n );\n\n return get(associations, graphqlScalar);\n },\n});\n"],"names":["strapi","graphqlScalarToOperators","graphqlScalar","GRAPHQL_SCALAR_OPERATORS","plugin","service","operators","filters","associations","mapValues","operatorNames","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;AAE1E,YAAA,MAAMC,YAAAA,GAAeC,SAAAA,CAAUN,wBAAAA,EAA0B,CAACO,aAAAA,GACxDA,aAAAA,CAAcC,GAAG,CAAC,CAACC,YAAAA,GAAiBN,SAAS,CAACM,YAAAA,CAAa,CAAA,CAAA;AAG7D,YAAA,OAAOC,IAAIL,YAAAA,EAAcN,aAAAA,CAAAA;AAC3B,QAAA;AACF,KAAA,CAAC;;;;"}
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var fp = require('lodash/fp');
3
+ var lodash = require('lodash');
4
4
  var utils = require('@strapi/utils');
5
5
 
6
6
  const { ApplicationError } = utils.errors;
7
7
  var strapiScalarToGraphQLScalar = (({ strapi })=>{
8
8
  const { STRAPI_SCALARS, SCALARS_ASSOCIATIONS } = strapi.plugin('graphql').service('constants');
9
- const missingStrapiScalars = fp.difference(STRAPI_SCALARS, Object.keys(SCALARS_ASSOCIATIONS));
9
+ const missingStrapiScalars = lodash.difference(STRAPI_SCALARS, Object.keys(SCALARS_ASSOCIATIONS));
10
10
  if (missingStrapiScalars.length > 0) {
11
11
  throw new ApplicationError('Some Strapi scalars are not handled in the GraphQL scalars mapper');
12
12
  }
@@ -14,7 +14,7 @@ var strapiScalarToGraphQLScalar = (({ strapi })=>{
14
14
  /**
15
15
  * Used to transform a Strapi scalar type into its GraphQL equivalent
16
16
  */ strapiScalarToGraphQLScalar (strapiScalar) {
17
- return fp.get(strapiScalar, SCALARS_ASSOCIATIONS);
17
+ return lodash.get(SCALARS_ASSOCIATIONS, strapiScalar);
18
18
  }
19
19
  };
20
20
  });
@@ -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,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
+ {"version":3,"file":"strapi-scalar-to-graphql-scalar.js","sources":["../../../../../server/src/services/utils/mappers/strapi-scalar-to-graphql-scalar.ts"],"sourcesContent":["import { difference, get } from 'lodash';\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(SCALARS_ASSOCIATIONS, strapiScalar);\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,iBAAAA,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,WAAIV,oBAAAA,EAAsBS,YAAAA,CAAAA;AACnC,QAAA;AACF,KAAA;AACF,CAAA;;;;"}
@@ -1,4 +1,4 @@
1
- import { difference, get } from 'lodash/fp';
1
+ import { difference, get } from 'lodash';
2
2
  import { errors } from '@strapi/utils';
3
3
 
4
4
  const { ApplicationError } = errors;
@@ -12,7 +12,7 @@ var strapiScalarToGraphQLScalar = (({ strapi })=>{
12
12
  /**
13
13
  * Used to transform a Strapi scalar type into its GraphQL equivalent
14
14
  */ strapiScalarToGraphQLScalar (strapiScalar) {
15
- return get(strapiScalar, SCALARS_ASSOCIATIONS);
15
+ return get(SCALARS_ASSOCIATIONS, strapiScalar);
16
16
  }
17
17
  };
18
18
  });
@@ -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,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
+ {"version":3,"file":"strapi-scalar-to-graphql-scalar.mjs","sources":["../../../../../server/src/services/utils/mappers/strapi-scalar-to-graphql-scalar.ts"],"sourcesContent":["import { difference, get } from 'lodash';\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(SCALARS_ASSOCIATIONS, strapiScalar);\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,IAAIV,oBAAAA,EAAsBS,YAAAA,CAAAA;AACnC,QAAA;AACF,KAAA;AACF,CAAA;;;;"}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var fp = require('lodash/fp');
3
+ var lodash = require('lodash');
4
4
  var pluralize = require('pluralize');
5
5
  var utils = require('@strapi/utils');
6
6
 
@@ -19,11 +19,11 @@ var naming = (({ strapi })=>{
19
19
  /**
20
20
  * Build the base type name for a given content type
21
21
  */ const getTypeName = (contentType, { plurality = 'singular' } = {})=>{
22
- const plugin = fp.get('plugin', contentType);
23
- const modelName = fp.get('modelName', contentType);
24
- const name = plurality === 'singular' ? fp.get('info.singularName', contentType) : fp.get('info.pluralName', contentType);
25
- const transformedPlugin = plugin ? fp.upperFirst(fp.camelCase(plugin)) : '';
26
- const transformedModelName = fp.upperFirst(fp.camelCase(name || pluralize.singular(modelName)));
22
+ const plugin = contentType?.plugin;
23
+ const modelName = contentType?.modelName;
24
+ const name = plurality === 'singular' ? lodash.get(contentType, 'info.singularName') : lodash.get(contentType, 'info.pluralName');
25
+ const transformedPlugin = plugin ? lodash.upperFirst(lodash.camelCase(plugin)) : '';
26
+ const transformedModelName = lodash.upperFirst(lodash.camelCase(name || pluralize.singular(modelName)));
27
27
  return `${transformedPlugin}${transformedModelName}`;
28
28
  };
29
29
  /**
@@ -65,7 +65,7 @@ var naming = (({ strapi })=>{
65
65
  * Build a dynamic zone type name based on a content type and an attribute name
66
66
  */ const getDynamicZoneName = (contentType, attributeName)=>{
67
67
  const typeName = getTypeName(contentType);
68
- const dzName = fp.upperFirst(fp.camelCase(attributeName));
68
+ const dzName = lodash.upperFirst(lodash.camelCase(attributeName));
69
69
  const suffix = 'DynamicZone';
70
70
  return `${typeName}${dzName}${suffix}`;
71
71
  };
@@ -113,7 +113,7 @@ var naming = (({ strapi })=>{
113
113
  * Build a type name for a given content type & polymorphic attribute
114
114
  */ const getMorphRelationTypeName = (contentType, attributeName)=>{
115
115
  const typeName = getTypeName(contentType);
116
- const formattedAttr = fp.upperFirst(fp.camelCase(attributeName));
116
+ const formattedAttr = lodash.upperFirst(lodash.camelCase(attributeName));
117
117
  return `${typeName}${formattedAttr}Morph`;
118
118
  };
119
119
  /**
@@ -127,9 +127,12 @@ var naming = (({ strapi })=>{
127
127
  ].includes(plurality)) {
128
128
  throw new ApplicationError(`"plurality" param must be either "plural" or "singular", but got: "${plurality}"`);
129
129
  }
130
- const getCustomTypeName = fp.pipe((ct)=>getTypeName(ct, {
130
+ const getCustomTypeName = (contentType)=>{
131
+ const typeName = getTypeName(contentType, {
131
132
  plurality
132
- }), firstLetterCase === 'upper' ? fp.upperFirst : fp.lowerFirst);
133
+ });
134
+ return firstLetterCase === 'upper' ? lodash.upperFirst(typeName) : lodash.lowerFirst(typeName);
135
+ };
133
136
  return (contentType)=>`${prefix}${getCustomTypeName(contentType)}${suffix}`;
134
137
  };
135
138
  const getFindQueryName = buildCustomTypeNameGenerator({
@@ -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,WAAAA,GAAc,CAACC,WAAAA,EA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utils/naming.ts"],"sourcesContent":["import { get, camelCase, upperFirst, lowerFirst } from 'lodash';\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 = contentType?.plugin;\n const modelName = contentType?.modelName;\n const name =\n plurality === 'singular'\n ? get(contentType, 'info.singularName')\n : get(contentType, 'info.pluralName');\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 = (contentType: Struct.Schema) => {\n const typeName = getTypeName(contentType, { plurality });\n return firstLetterCase === 'upper' ? upperFirst(typeName) : lowerFirst(typeName);\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","modelName","name","get","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","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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AAAQ,KAAA,CAAA;AAEpF,IAAA,MAAMO,4BAA4BV,4BAAAA,CAA6B;QAC7DE,MAAAA,EAAQ,QAAA;QACRC,eAAAA,EAAiB;AACnB,KAAA,CAAA;AAEA,IAAA,MAAMQ,4BAA4BX,4BAAAA,CAA6B;QAC7DE,MAAAA,EAAQ,QAAA;QACRC,eAAAA,EAAiB;AACnB,KAAA,CAAA;AAEA,IAAA,MAAMS,4BAA4BZ,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;AACAO,QAAAA,gBAAAA;AACAE,QAAAA,mBAAAA;AACAC,QAAAA,yBAAAA;AACAC,QAAAA,yBAAAA;AACAC,QAAAA,yBAAAA;AACAJ,QAAAA;AACF,KAAA;AACF,CAAA;;;;"}
@@ -1,4 +1,4 @@
1
- import { get, upperFirst, camelCase, pipe, lowerFirst } from 'lodash/fp';
1
+ import { get, upperFirst, camelCase, lowerFirst } from 'lodash';
2
2
  import { singular } from 'pluralize';
3
3
  import { errors } from '@strapi/utils';
4
4
 
@@ -17,9 +17,9 @@ var naming = (({ strapi })=>{
17
17
  /**
18
18
  * Build the base type name for a given content type
19
19
  */ const getTypeName = (contentType, { plurality = 'singular' } = {})=>{
20
- const plugin = get('plugin', contentType);
21
- const modelName = get('modelName', contentType);
22
- const name = plurality === 'singular' ? get('info.singularName', contentType) : get('info.pluralName', contentType);
20
+ const plugin = contentType?.plugin;
21
+ const modelName = contentType?.modelName;
22
+ const name = plurality === 'singular' ? get(contentType, 'info.singularName') : get(contentType, 'info.pluralName');
23
23
  const transformedPlugin = plugin ? upperFirst(camelCase(plugin)) : '';
24
24
  const transformedModelName = upperFirst(camelCase(name || singular(modelName)));
25
25
  return `${transformedPlugin}${transformedModelName}`;
@@ -125,9 +125,12 @@ var naming = (({ strapi })=>{
125
125
  ].includes(plurality)) {
126
126
  throw new ApplicationError(`"plurality" param must be either "plural" or "singular", but got: "${plurality}"`);
127
127
  }
128
- const getCustomTypeName = pipe((ct)=>getTypeName(ct, {
128
+ const getCustomTypeName = (contentType)=>{
129
+ const typeName = getTypeName(contentType, {
129
130
  plurality
130
- }), firstLetterCase === 'upper' ? upperFirst : lowerFirst);
131
+ });
132
+ return firstLetterCase === 'upper' ? upperFirst(typeName) : lowerFirst(typeName);
133
+ };
131
134
  return (contentType)=>`${prefix}${getCustomTypeName(contentType)}${suffix}`;
132
135
  };
133
136
  const getFindQueryName = buildCustomTypeNameGenerator({
@@ -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,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,IAAI,QAAA,EAAUZ,WAAAA,CAAAA;QAC7B,MAAMa,SAAAA,GAAYD,IAAI,WAAA,EAAaZ,WAAAA,CAAAA;AACnC,QAAA,MAAMc,OACJJ,SAAAA,KAAc,UAAA,GACVE,IAAI,mB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AAA;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 { get, camelCase, upperFirst, lowerFirst } from 'lodash';\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 = contentType?.plugin;\n const modelName = contentType?.modelName;\n const name =\n plurality === 'singular'\n ? get(contentType, 'info.singularName')\n : get(contentType, 'info.pluralName');\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 = (contentType: Struct.Schema) => {\n const typeName = getTypeName(contentType, { plurality });\n return firstLetterCase === 'upper' ? upperFirst(typeName) : lowerFirst(typeName);\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","modelName","name","get","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","lowerFirst","getFindQueryName","getFindConnectionQueryName","getFindOneQueryName","getCreateMutationTypeName","getUpdateMutationTypeName","getDeleteMutationTypeName"],"mappings":";;;;AAM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O,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":"bootstrap.d.ts","sourceRoot":"","sources":["../../../server/src/bootstrap.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,kBAAkB,EAA4B,MAAM,gBAAgB,CAAC;AAUjG,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,KAAK,EAAE,WAAW,EAA8C,MAAM,KAAK,CAAC;AAUnF,KAAK,oBAAoB,GAAG,WAAW,GAAG;IACxC,mBAAmB,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACrE,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,iDAGvC,oBAAoB,KAAG,MAAM,GAAG,SAoBlC,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,IAAI,CAAC,MAAM,KAClB,kBAAkB,CAAC,oBAAoB,CA8EzC,CAAC;AAEF,wBAAsB,SAAS,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE,iBAoLlE"}
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../server/src/bootstrap.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,kBAAkB,EAA4B,MAAM,gBAAgB,CAAC;AAUjG,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,KAAK,EAAE,WAAW,EAA8C,MAAM,KAAK,CAA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