@strapi/core 0.0.0-experimental.fa3ec797cdee7109d96b9f1616c32accf946e251 → 0.0.0-experimental.fabc1d11d851a17662804b9cfcc3e1e8c89252ac

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.

Potentially problematic release.


This version of @strapi/core might be problematic. Click here for more details.

Files changed (192) hide show
  1. package/dist/Strapi.d.ts.map +1 -1
  2. package/dist/Strapi.js +4 -1
  3. package/dist/Strapi.js.map +1 -1
  4. package/dist/Strapi.mjs +4 -1
  5. package/dist/Strapi.mjs.map +1 -1
  6. package/dist/core-api/controller/index.d.ts.map +1 -1
  7. package/dist/core-api/controller/index.js +2 -1
  8. package/dist/core-api/controller/index.js.map +1 -1
  9. package/dist/core-api/controller/index.mjs +2 -1
  10. package/dist/core-api/controller/index.mjs.map +1 -1
  11. package/dist/core-api/controller/transform.d.ts +3 -2
  12. package/dist/core-api/controller/transform.d.ts.map +1 -1
  13. package/dist/core-api/controller/transform.js +13 -3
  14. package/dist/core-api/controller/transform.js.map +1 -1
  15. package/dist/core-api/controller/transform.mjs +13 -3
  16. package/dist/core-api/controller/transform.mjs.map +1 -1
  17. package/dist/core-api/routes/index.d.ts +4 -22
  18. package/dist/core-api/routes/index.d.ts.map +1 -1
  19. package/dist/core-api/routes/index.js +150 -8
  20. package/dist/core-api/routes/index.js.map +1 -1
  21. package/dist/core-api/routes/index.mjs +131 -8
  22. package/dist/core-api/routes/index.mjs.map +1 -1
  23. package/dist/core-api/routes/validation/attributes.d.ts +244 -0
  24. package/dist/core-api/routes/validation/attributes.d.ts.map +1 -0
  25. package/dist/core-api/routes/validation/attributes.js +560 -0
  26. package/dist/core-api/routes/validation/attributes.js.map +1 -0
  27. package/dist/core-api/routes/validation/attributes.mjs +521 -0
  28. package/dist/core-api/routes/validation/attributes.mjs.map +1 -0
  29. package/dist/core-api/routes/validation/common.d.ts +105 -0
  30. package/dist/core-api/routes/validation/common.d.ts.map +1 -0
  31. package/dist/core-api/routes/validation/common.js +116 -0
  32. package/dist/core-api/routes/validation/common.js.map +1 -0
  33. package/dist/core-api/routes/validation/common.mjs +95 -0
  34. package/dist/core-api/routes/validation/common.mjs.map +1 -0
  35. package/dist/core-api/routes/validation/component.d.ts +34 -0
  36. package/dist/core-api/routes/validation/component.d.ts.map +1 -0
  37. package/dist/core-api/routes/validation/component.js +45 -0
  38. package/dist/core-api/routes/validation/component.js.map +1 -0
  39. package/dist/core-api/routes/validation/component.mjs +43 -0
  40. package/dist/core-api/routes/validation/component.mjs.map +1 -0
  41. package/dist/core-api/routes/validation/constants.d.ts +8 -0
  42. package/dist/core-api/routes/validation/constants.d.ts.map +1 -0
  43. package/dist/core-api/routes/validation/constants.js +18 -0
  44. package/dist/core-api/routes/validation/constants.js.map +1 -0
  45. package/dist/core-api/routes/validation/constants.mjs +16 -0
  46. package/dist/core-api/routes/validation/constants.mjs.map +1 -0
  47. package/dist/core-api/routes/validation/content-type.d.ts +128 -0
  48. package/dist/core-api/routes/validation/content-type.d.ts.map +1 -0
  49. package/dist/core-api/routes/validation/content-type.js +201 -0
  50. package/dist/core-api/routes/validation/content-type.js.map +1 -0
  51. package/dist/core-api/routes/validation/content-type.mjs +180 -0
  52. package/dist/core-api/routes/validation/content-type.mjs.map +1 -0
  53. package/dist/core-api/routes/validation/index.d.ts +5 -0
  54. package/dist/core-api/routes/validation/index.d.ts.map +1 -0
  55. package/dist/core-api/routes/validation/mappers.d.ts +105 -0
  56. package/dist/core-api/routes/validation/mappers.d.ts.map +1 -0
  57. package/dist/core-api/routes/validation/mappers.js +273 -0
  58. package/dist/core-api/routes/validation/mappers.js.map +1 -0
  59. package/dist/core-api/routes/validation/mappers.mjs +249 -0
  60. package/dist/core-api/routes/validation/mappers.mjs.map +1 -0
  61. package/dist/core-api/routes/validation/utils.d.ts +47 -0
  62. package/dist/core-api/routes/validation/utils.d.ts.map +1 -0
  63. package/dist/core-api/routes/validation/utils.js +128 -0
  64. package/dist/core-api/routes/validation/utils.js.map +1 -0
  65. package/dist/core-api/routes/validation/utils.mjs +106 -0
  66. package/dist/core-api/routes/validation/utils.mjs.map +1 -0
  67. package/dist/domain/content-type/index.d.ts.map +1 -1
  68. package/dist/domain/content-type/index.js +17 -1
  69. package/dist/domain/content-type/index.js.map +1 -1
  70. package/dist/domain/content-type/index.mjs +17 -1
  71. package/dist/domain/content-type/index.mjs.map +1 -1
  72. package/dist/domain/module/index.d.ts.map +1 -1
  73. package/dist/domain/module/index.js +3 -0
  74. package/dist/domain/module/index.js.map +1 -1
  75. package/dist/domain/module/index.mjs +3 -0
  76. package/dist/domain/module/index.mjs.map +1 -1
  77. package/dist/factories.d.ts +3 -1
  78. package/dist/factories.d.ts.map +1 -1
  79. package/dist/factories.js +10 -2
  80. package/dist/factories.js.map +1 -1
  81. package/dist/factories.mjs +10 -3
  82. package/dist/factories.mjs.map +1 -1
  83. package/dist/loaders/plugins/index.js +1 -1
  84. package/dist/loaders/plugins/index.js.map +1 -1
  85. package/dist/loaders/plugins/index.mjs +1 -1
  86. package/dist/loaders/plugins/index.mjs.map +1 -1
  87. package/dist/middlewares/cors.d.ts +9 -1
  88. package/dist/middlewares/cors.d.ts.map +1 -1
  89. package/dist/middlewares/cors.js +39 -17
  90. package/dist/middlewares/cors.js.map +1 -1
  91. package/dist/middlewares/cors.mjs +39 -18
  92. package/dist/middlewares/cors.mjs.map +1 -1
  93. package/dist/migrations/first-published-at.d.ts +4 -0
  94. package/dist/migrations/first-published-at.d.ts.map +1 -0
  95. package/dist/migrations/first-published-at.js +51 -0
  96. package/dist/migrations/first-published-at.js.map +1 -0
  97. package/dist/migrations/first-published-at.mjs +49 -0
  98. package/dist/migrations/first-published-at.mjs.map +1 -0
  99. package/dist/migrations/index.d.ts.map +1 -1
  100. package/dist/migrations/index.js +5 -0
  101. package/dist/migrations/index.js.map +1 -1
  102. package/dist/migrations/index.mjs +5 -0
  103. package/dist/migrations/index.mjs.map +1 -1
  104. package/dist/package.json.js +16 -12
  105. package/dist/package.json.js.map +1 -1
  106. package/dist/package.json.mjs +16 -12
  107. package/dist/package.json.mjs.map +1 -1
  108. package/dist/services/content-api/index.d.ts +1 -1
  109. package/dist/services/content-api/index.d.ts.map +1 -1
  110. package/dist/services/content-api/index.js +1 -1
  111. package/dist/services/content-api/index.js.map +1 -1
  112. package/dist/services/content-api/index.mjs +2 -2
  113. package/dist/services/content-api/index.mjs.map +1 -1
  114. package/dist/services/content-source-maps.d.ts +13 -0
  115. package/dist/services/content-source-maps.d.ts.map +1 -0
  116. package/dist/services/content-source-maps.js +108 -0
  117. package/dist/services/content-source-maps.js.map +1 -0
  118. package/dist/services/content-source-maps.mjs +106 -0
  119. package/dist/services/content-source-maps.mjs.map +1 -0
  120. package/dist/services/document-service/components.d.ts +6 -1
  121. package/dist/services/document-service/components.d.ts.map +1 -1
  122. package/dist/services/document-service/components.js +97 -0
  123. package/dist/services/document-service/components.js.map +1 -1
  124. package/dist/services/document-service/components.mjs +97 -1
  125. package/dist/services/document-service/components.mjs.map +1 -1
  126. package/dist/services/document-service/entries.d.ts.map +1 -1
  127. package/dist/services/document-service/entries.js.map +1 -1
  128. package/dist/services/document-service/entries.mjs.map +1 -1
  129. package/dist/services/document-service/first-published-at.d.ts +7 -0
  130. package/dist/services/document-service/first-published-at.d.ts.map +1 -0
  131. package/dist/services/document-service/first-published-at.js +31 -0
  132. package/dist/services/document-service/first-published-at.js.map +1 -0
  133. package/dist/services/document-service/first-published-at.mjs +28 -0
  134. package/dist/services/document-service/first-published-at.mjs.map +1 -0
  135. package/dist/services/document-service/internationalization.d.ts +6 -1
  136. package/dist/services/document-service/internationalization.d.ts.map +1 -1
  137. package/dist/services/document-service/internationalization.js +32 -0
  138. package/dist/services/document-service/internationalization.js.map +1 -1
  139. package/dist/services/document-service/internationalization.mjs +32 -1
  140. package/dist/services/document-service/internationalization.mjs.map +1 -1
  141. package/dist/services/document-service/repository.d.ts.map +1 -1
  142. package/dist/services/document-service/repository.js +16 -8
  143. package/dist/services/document-service/repository.js.map +1 -1
  144. package/dist/services/document-service/repository.mjs +18 -10
  145. package/dist/services/document-service/repository.mjs.map +1 -1
  146. package/dist/services/document-service/utils/unidirectional-relations.d.ts +19 -2
  147. package/dist/services/document-service/utils/unidirectional-relations.d.ts.map +1 -1
  148. package/dist/services/document-service/utils/unidirectional-relations.js +21 -6
  149. package/dist/services/document-service/utils/unidirectional-relations.js.map +1 -1
  150. package/dist/services/document-service/utils/unidirectional-relations.mjs +21 -6
  151. package/dist/services/document-service/utils/unidirectional-relations.mjs.map +1 -1
  152. package/dist/services/entity-validator/index.d.ts.map +1 -1
  153. package/dist/services/entity-validator/index.js +9 -0
  154. package/dist/services/entity-validator/index.js.map +1 -1
  155. package/dist/services/entity-validator/index.mjs +9 -0
  156. package/dist/services/entity-validator/index.mjs.map +1 -1
  157. package/dist/services/entity-validator/validators.d.ts +1 -0
  158. package/dist/services/entity-validator/validators.d.ts.map +1 -1
  159. package/dist/services/entity-validator/validators.js +3 -0
  160. package/dist/services/entity-validator/validators.js.map +1 -1
  161. package/dist/services/entity-validator/validators.mjs +3 -0
  162. package/dist/services/entity-validator/validators.mjs.map +1 -1
  163. package/dist/services/metrics/index.d.ts +1 -1
  164. package/dist/services/metrics/index.d.ts.map +1 -1
  165. package/dist/services/metrics/index.js +9 -8
  166. package/dist/services/metrics/index.js.map +1 -1
  167. package/dist/services/metrics/index.mjs +9 -8
  168. package/dist/services/metrics/index.mjs.map +1 -1
  169. package/dist/services/metrics/sender.d.ts.map +1 -1
  170. package/dist/services/metrics/sender.js +4 -3
  171. package/dist/services/metrics/sender.js.map +1 -1
  172. package/dist/services/metrics/sender.mjs +4 -3
  173. package/dist/services/metrics/sender.mjs.map +1 -1
  174. package/dist/services/server/register-routes.js +22 -2
  175. package/dist/services/server/register-routes.js.map +1 -1
  176. package/dist/services/server/register-routes.mjs +22 -2
  177. package/dist/services/server/register-routes.mjs.map +1 -1
  178. package/dist/services/server/routing.d.ts +10 -0
  179. package/dist/services/server/routing.d.ts.map +1 -1
  180. package/dist/services/server/routing.js +7 -1
  181. package/dist/services/server/routing.js.map +1 -1
  182. package/dist/services/server/routing.mjs +7 -1
  183. package/dist/services/server/routing.mjs.map +1 -1
  184. package/dist/services/utils/conditional-fields.d.ts +3 -0
  185. package/dist/services/utils/conditional-fields.d.ts.map +1 -0
  186. package/dist/services/utils/conditional-fields.js +22 -0
  187. package/dist/services/utils/conditional-fields.js.map +1 -0
  188. package/dist/services/utils/conditional-fields.mjs +20 -0
  189. package/dist/services/utils/conditional-fields.mjs.map +1 -0
  190. package/dist/utils/transform-content-types-to-models.d.ts +197 -0
  191. package/dist/utils/transform-content-types-to-models.d.ts.map +1 -1
  192. package/package.json +16 -12
@@ -1 +1 @@
1
- {"version":3,"file":"cors.mjs","sources":["../../src/middlewares/cors.ts"],"sourcesContent":["import koaCors from '@koa/cors';\n\nimport type { Core } from '@strapi/types';\n\nexport type Config = {\n enabled?: boolean;\n origin: string | string[] | ((ctx: any) => string | string[]);\n expose?: string | string[];\n maxAge?: number;\n credentials?: boolean;\n methods?: string | string[];\n headers?: string | string[];\n keepHeadersOnError?: boolean;\n};\n\nconst defaults: Config = {\n origin: '*',\n maxAge: 31536000,\n credentials: true,\n methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'],\n headers: ['Content-Type', 'Authorization', 'Origin', 'Accept'],\n keepHeadersOnError: false,\n};\n\nexport const cors: Core.MiddlewareFactory<Config> = (config) => {\n const { origin, expose, maxAge, credentials, methods, headers, keepHeadersOnError } = {\n ...defaults,\n ...config,\n };\n\n if (config.enabled !== undefined) {\n strapi.log.warn(\n 'The strapi::cors middleware no longer supports the `enabled` option. Using it' +\n ' to conditionally enable CORS might cause an insecure default. To disable strapi::cors, remove it from' +\n ' the exported array in config/middleware.js'\n );\n }\n\n return koaCors({\n async origin(ctx) {\n if (!ctx.get('Origin')) {\n return '*';\n }\n\n let originList: string | string[];\n\n if (typeof origin === 'function') {\n originList = await origin(ctx);\n } else {\n originList = origin;\n }\n\n if (Array.isArray(originList)) {\n return originList.includes(ctx.get('Origin')) ? ctx.get('Origin') : '';\n }\n\n const parsedOrigin = originList.split(',').map((origin) => origin.trim());\n if (parsedOrigin.length > 1) {\n return parsedOrigin.includes(ctx.get('Origin')) ? ctx.get('Origin') : '';\n }\n\n return originList;\n },\n exposeHeaders: expose,\n maxAge,\n credentials,\n allowMethods: methods,\n allowHeaders: headers,\n keepHeadersOnError,\n });\n};\n"],"names":["defaults","origin","maxAge","credentials","methods","headers","keepHeadersOnError","cors","config","expose","enabled","undefined","strapi","log","warn","koaCors","ctx","get","originList","Array","isArray","includes","parsedOrigin","split","map","trim","length","exposeHeaders","allowMethods","allowHeaders"],"mappings":";;AAeA,MAAMA,QAAmB,GAAA;IACvBC,MAAQ,EAAA,GAAA;IACRC,MAAQ,EAAA,QAAA;IACRC,WAAa,EAAA,IAAA;IACbC,OAAS,EAAA;AAAC,QAAA,KAAA;AAAO,QAAA,MAAA;AAAQ,QAAA,KAAA;AAAO,QAAA,OAAA;AAAS,QAAA,QAAA;AAAU,QAAA,MAAA;AAAQ,QAAA;AAAU,KAAA;IACrEC,OAAS,EAAA;AAAC,QAAA,cAAA;AAAgB,QAAA,eAAA;AAAiB,QAAA,QAAA;AAAU,QAAA;AAAS,KAAA;IAC9DC,kBAAoB,EAAA;AACtB,CAAA;AAEO,MAAMC,OAAuC,CAACC,MAAAA,GAAAA;AACnD,IAAA,MAAM,EAAEP,MAAM,EAAEQ,MAAM,EAAEP,MAAM,EAAEC,WAAW,EAAEC,OAAO,EAAEC,OAAO,EAAEC,kBAAkB,EAAE,GAAG;AACpF,QAAA,GAAGN,QAAQ;AACX,QAAA,GAAGQ;AACL,KAAA;IAEA,IAAIA,MAAAA,CAAOE,OAAO,KAAKC,SAAW,EAAA;AAChCC,QAAAA,MAAAA,CAAOC,GAAG,CAACC,IAAI,CACb,kFACE,wGACA,GAAA,6CAAA,CAAA;AAEN;AAEA,IAAA,OAAOC,OAAQ,CAAA;AACb,QAAA,MAAMd,QAAOe,GAAG,EAAA;AACd,YAAA,IAAI,CAACA,GAAAA,CAAIC,GAAG,CAAC,QAAW,CAAA,EAAA;gBACtB,OAAO,GAAA;AACT;YAEA,IAAIC,UAAAA;YAEJ,IAAI,OAAOjB,WAAW,UAAY,EAAA;AAChCiB,gBAAAA,UAAAA,GAAa,MAAMjB,MAAOe,CAAAA,GAAAA,CAAAA;aACrB,MAAA;gBACLE,UAAajB,GAAAA,MAAAA;AACf;YAEA,IAAIkB,KAAAA,CAAMC,OAAO,CAACF,UAAa,CAAA,EAAA;gBAC7B,OAAOA,UAAAA,CAAWG,QAAQ,CAACL,GAAIC,CAAAA,GAAG,CAAC,QAAaD,CAAAA,CAAAA,GAAAA,GAAAA,CAAIC,GAAG,CAAC,QAAY,CAAA,GAAA,EAAA;AACtE;YAEA,MAAMK,YAAAA,GAAeJ,UAAWK,CAAAA,KAAK,CAAC,GAAA,CAAA,CAAKC,GAAG,CAAC,CAACvB,MAAWA,GAAAA,MAAAA,CAAOwB,IAAI,EAAA,CAAA;YACtE,IAAIH,YAAAA,CAAaI,MAAM,GAAG,CAAG,EAAA;gBAC3B,OAAOJ,YAAAA,CAAaD,QAAQ,CAACL,GAAIC,CAAAA,GAAG,CAAC,QAAaD,CAAAA,CAAAA,GAAAA,GAAAA,CAAIC,GAAG,CAAC,QAAY,CAAA,GAAA,EAAA;AACxE;YAEA,OAAOC,UAAAA;AACT,SAAA;QACAS,aAAelB,EAAAA,MAAAA;AACfP,QAAAA,MAAAA;AACAC,QAAAA,WAAAA;QACAyB,YAAcxB,EAAAA,OAAAA;QACdyB,YAAcxB,EAAAA,OAAAA;AACdC,QAAAA;AACF,KAAA,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"cors.mjs","sources":["../../src/middlewares/cors.ts"],"sourcesContent":["import koaCors from '@koa/cors';\n\nimport type { Core } from '@strapi/types';\n\nexport type Config = {\n enabled?: boolean;\n origin: string | string[] | ((ctx: any) => string | string[] | Promise<string | string[]>);\n expose?: string | string[];\n maxAge?: number;\n credentials?: boolean;\n methods?: string | string[];\n headers?: string | string[];\n keepHeadersOnError?: boolean;\n};\n\nconst defaults: Config = {\n origin: '*',\n maxAge: 31536000,\n credentials: true,\n methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'],\n headers: ['Content-Type', 'Authorization', 'Origin', 'Accept'],\n keepHeadersOnError: false,\n};\n\n/**\n * Determines if a request origin is allowed based on the configured origin list\n * @param requestOrigin - The origin from the request header\n * @param configuredOrigin - The origin configuration (string, array, or function)\n * @param ctx - The Koa context (for function-based origin)\n * @returns The allowed origin string or empty string if blocked\n */\nexport const matchOrigin = async (\n requestOrigin: string | undefined,\n configuredOrigin:\n | string\n | string[]\n | ((ctx: any) => string | string[] | Promise<string | string[]>),\n ctx?: any\n): Promise<string> => {\n if (!requestOrigin) {\n return '*';\n }\n\n let originList: string | string[];\n\n if (typeof configuredOrigin === 'function') {\n originList = await configuredOrigin(ctx);\n } else {\n originList = configuredOrigin;\n }\n\n // Normalize originList into an array\n let normalizedOrigins: string[];\n if (Array.isArray(originList)) {\n normalizedOrigins = originList;\n } else if (originList === undefined || originList === null) {\n // Handle undefined/null - treat as wildcard\n normalizedOrigins = ['*'];\n } else {\n // Handle comma-separated string of origins\n normalizedOrigins = originList.split(',').map((origin) => origin.trim());\n }\n\n // Check if wildcard is in the normalized origins\n if (normalizedOrigins.includes('*')) {\n return requestOrigin;\n }\n\n // Check if request origin is in the normalized origins\n return normalizedOrigins.includes(requestOrigin) ? requestOrigin : '';\n};\n\nexport const cors: Core.MiddlewareFactory<Config> = (config) => {\n const { origin, expose, maxAge, credentials, methods, headers, keepHeadersOnError } = {\n ...defaults,\n ...config,\n };\n\n if (config.enabled !== undefined) {\n strapi.log.warn(\n 'The strapi::cors middleware no longer supports the `enabled` option. Using it' +\n ' to conditionally enable CORS might cause an insecure default. To disable strapi::cors, remove it from' +\n ' the exported array in config/middleware.js'\n );\n }\n\n return koaCors({\n async origin(ctx) {\n const requestOrigin = ctx.get('Origin');\n return matchOrigin(requestOrigin, origin, ctx);\n },\n exposeHeaders: expose,\n maxAge,\n credentials,\n allowMethods: methods,\n allowHeaders: headers,\n keepHeadersOnError,\n });\n};\n"],"names":["defaults","origin","maxAge","credentials","methods","headers","keepHeadersOnError","matchOrigin","requestOrigin","configuredOrigin","ctx","originList","normalizedOrigins","Array","isArray","undefined","split","map","trim","includes","cors","config","expose","enabled","strapi","log","warn","koaCors","get","exposeHeaders","allowMethods","allowHeaders"],"mappings":";;AAeA,MAAMA,QAAmB,GAAA;IACvBC,MAAQ,EAAA,GAAA;IACRC,MAAQ,EAAA,QAAA;IACRC,WAAa,EAAA,IAAA;IACbC,OAAS,EAAA;AAAC,QAAA,KAAA;AAAO,QAAA,MAAA;AAAQ,QAAA,KAAA;AAAO,QAAA,OAAA;AAAS,QAAA,QAAA;AAAU,QAAA,MAAA;AAAQ,QAAA;AAAU,KAAA;IACrEC,OAAS,EAAA;AAAC,QAAA,cAAA;AAAgB,QAAA,eAAA;AAAiB,QAAA,QAAA;AAAU,QAAA;AAAS,KAAA;IAC9DC,kBAAoB,EAAA;AACtB,CAAA;AAEA;;;;;;AAMC,IACM,MAAMC,WAAc,GAAA,OACzBC,eACAC,gBAIAC,EAAAA,GAAAA,GAAAA;AAEA,IAAA,IAAI,CAACF,aAAe,EAAA;QAClB,OAAO,GAAA;AACT;IAEA,IAAIG,UAAAA;IAEJ,IAAI,OAAOF,qBAAqB,UAAY,EAAA;AAC1CE,QAAAA,UAAAA,GAAa,MAAMF,gBAAiBC,CAAAA,GAAAA,CAAAA;KAC/B,MAAA;QACLC,UAAaF,GAAAA,gBAAAA;AACf;;IAGA,IAAIG,iBAAAA;IACJ,IAAIC,KAAAA,CAAMC,OAAO,CAACH,UAAa,CAAA,EAAA;QAC7BC,iBAAoBD,GAAAA,UAAAA;AACtB,KAAA,MAAO,IAAIA,UAAAA,KAAeI,SAA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declare const enableFirstPublishedAt: ({ oldContentTypes, contentTypes }: Input) => Promise<void>;
3
+ export { enableFirstPublishedAt as enable };
4
+ //# sourceMappingURL=first-published-at.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"first-published-at.d.ts","sourceRoot":"","sources":["../../src/migrations/first-published-at.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAUxC,QAAA,MAAM,sBAAsB,sCAA6C,KAAK,kBA6D7E,CAAC;AAEF,OAAO,EAAE,sBAAsB,IAAI,MAAM,EAAE,CAAC"}
@@ -0,0 +1,51 @@
1
+ 'use strict';
2
+
3
+ var strapiUtils = require('@strapi/utils');
4
+ var _ = require('lodash');
5
+
6
+ const enableFirstPublishedAt = async ({ oldContentTypes, contentTypes })=>{
7
+ if (!oldContentTypes) {
8
+ return;
9
+ }
10
+ return strapi.db.transaction(async (trx)=>{
11
+ for(const uid in contentTypes){
12
+ if (!oldContentTypes[uid]) {
13
+ continue;
14
+ }
15
+ const contentType = contentTypes[uid];
16
+ if (!strapiUtils.contentTypes.hasFirstPublishedAtField(contentType)) {
17
+ continue;
18
+ }
19
+ if (!contentType.attributes?.firstPublishedAt) {
20
+ continue;
21
+ }
22
+ const content = await strapi.db.queryBuilder(uid).select('*').transacting(trx).execute();
23
+ // Process content types in pairs: draft and published.
24
+ // If only one exist, which means the value is not published yet and we can ignore it
25
+ const groupedContent = _.groupBy(content, (item)=>`${item.documentId}-${item.locale}`);
26
+ for (const items of Object.values(groupedContent)){
27
+ // If there is only one item, which means nothing is published yet for this locale
28
+ if (items.length <= 1) {
29
+ continue;
30
+ }
31
+ // If firstPublishedAt is already present, do not do anything
32
+ if (items[0].firstPublishedAt != null && items[1].firstPublishedAt != null) {
33
+ continue;
34
+ }
35
+ const publishedContent = items.filter((item)=>item.publishedAt != null).at(0);
36
+ if (!publishedContent) {
37
+ continue;
38
+ }
39
+ await strapi.db.queryBuilder(uid).update({
40
+ firstPublishedAt: new Date(publishedContent.publishedAt)
41
+ }).where({
42
+ documentId: publishedContent.documentId,
43
+ locale: publishedContent.locale
44
+ }).transacting(trx).execute();
45
+ }
46
+ }
47
+ });
48
+ };
49
+
50
+ exports.enable = enableFirstPublishedAt;
51
+ //# sourceMappingURL=first-published-at.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"first-published-at.js","sources":["../../src/migrations/first-published-at.ts"],"sourcesContent":["import { contentTypes as contentTypesUtils } from '@strapi/utils';\nimport _ from 'lodash';\nimport { Input } from './draft-publish';\n\ninterface ContentTypeData {\n id: number;\n documentId: string;\n publishedAt: Date;\n firstPublishedAt: Date;\n locale: string;\n}\n\nconst enableFirstPublishedAt = async ({ oldContentTypes, contentTypes }: Input) => {\n if (!oldContentTypes) {\n return;\n }\n\n return strapi.db.transaction(async (trx) => {\n for (const uid in contentTypes) {\n if (!oldContentTypes[uid]) {\n continue;\n }\n\n const contentType = contentTypes[uid];\n\n if (!contentTypesUtils.hasFirstPublishedAtField(contentType)) {\n continue;\n }\n\n if (!contentType.attributes?.firstPublishedAt) {\n continue;\n }\n\n const content: ContentTypeData[] = await strapi.db\n .queryBuilder(uid)\n .select('*')\n .transacting(trx)\n .execute();\n\n // Process content types in pairs: draft and published.\n // If only one exist, which means the value is not published yet and we can ignore it\n const groupedContent = _.groupBy(content, (item) => `${item.documentId}-${item.locale}`);\n\n for (const items of Object.values(groupedContent)) {\n // If there is only one item, which means nothing is published yet for this locale\n if (items.length <= 1) {\n continue;\n }\n\n // If firstPublishedAt is already present, do not do anything\n if (items[0].firstPublishedAt != null && items[1].firstPublishedAt != null) {\n continue;\n }\n\n const publishedContent = items.filter((item) => item.publishedAt != null).at(0);\n if (!publishedContent) {\n continue;\n }\n\n await strapi.db\n .queryBuilder(uid)\n .update({\n firstPublishedAt: new Date(publishedContent.publishedAt),\n })\n .where({\n documentId: publishedContent.documentId,\n locale: publishedContent.locale,\n })\n .transacting(trx)\n .execute();\n }\n }\n });\n};\n\nexport { enableFirstPublishedAt as enable };\n"],"names":["enableFirstPublishedAt","oldContentTypes","contentTypes","strapi","db","transaction","trx","uid","contentType","contentTypesUtils","hasFirstPublishedAtField","attributes","firstPublishedAt","content","queryBuilder","select","transacting","execute","groupedContent","_","groupBy","item","documentId","locale","items","Object","values","length","publishedContent","filter","publishedAt","at","update","Date","where"],"mappings":";;;;;AAYA,MAAMA,yBAAyB,OAAO,EAAEC,eAAe,EAAEC,YAAY,EAAS,GAAA;AAC5E,IAAA,IAAI,CAACD,eAAiB,EAAA;AACpB,QAAA;AACF;AAEA,IAAA,OAAOE,MAAOC,CAAAA,EAAE,CAACC,WAAW,CAAC,OAAOC,GAAAA,GAAAA;QAClC,IAAK,MAAMC,OAAOL,YAAc,CAAA;AAC9B,YAAA,IAAI,CAACD,eAAe,CAACM,GAAAA,CAAI,EAAE;AACzB,gBAAA;AACF;YAEA,MAAMC,WAAAA,GAAcN,YAAY,CAACK,GAAI,CAAA;AAErC,YAAA,IAAI,CAACE,wBAAAA,CAAkBC,wBAAwB,CAACF,WAAc,CAAA,EAAA;AAC5D,gBAAA;AACF;AAEA,YAAA,IAAI,CAACA,WAAAA,CAAYG,UAAU,EAAEC,gBAAkB,EAAA;AAC7C,gBAAA;AACF;AAEA,YAAA,MAAMC,OAA6B,GAAA,MAAMV,MAAOC,CAAAA,EAAE,CAC/CU,YAAY,CAACP,GACbQ,CAAAA,CAAAA,MAAM,CAAC,GAAA,CAAA,CACPC,WAAW,CAACV,KACZW,OAAO,EAAA;;;AAIV,YAAA,MAAMC,iBAAiBC,CAAEC,CAAAA,OAAO,CAACP,OAAAA,EAAS,CAACQ,IAAS,GAAA,CAAC,EAAEA,IAAAA,CAAKC,UAAU,CAAC,CAAC,EAAED,IAAKE,CAAAA,MAAM,CAAC,CAAC,CAAA;AAEvF,YAAA,KAAK,MAAMC,KAAAA,IAASC,MAAOC,CAAAA,MAAM,CAACR,cAAiB,CAAA,CAAA;;gBAEjD,IAAIM,KAAAA,CAAMG,MAAM,IAAI,CAAG,EAAA;AACrB,oBAAA;AACF;;AAGA,gBAAA,IAAIH,KAAK,CAAC,CAAE,CAAA,CAACZ,gBAAgB,IAAI,IAAQY,IAAAA,KAAK,CAAC,CAAA,CAAE,CAACZ,gBAAgB,IAAI,IAAM,EAAA;AAC1E,oBAAA;AACF;gBAEA,MAAMgB,gBAAAA,GAAmBJ,KAAMK,CAAAA,MAAM,CAAC,CAACR,IAASA,GAAAA,IAAAA,CAAKS,WAAW,IAAI,IAAMC,CAAAA,CAAAA,EAAE,CAAC,CAAA,CAAA;AAC7E,gBAAA,IAAI,CAACH,gBAAkB,EAAA;AACrB,oBAAA;AACF;AAEA,gBAAA,MAAMzB,OAAOC,EAAE,CACZU,YAAY,CAACP,GAAAA,CAAAA,CACbyB,MAAM,CAAC;oBACNpB,gBAAkB,EAAA,IAAIqB,IAAKL,CAAAA,gBAAAA,CAAiBE,WAAW;AACzD,iBAAA,CAAA,CACCI,KAAK,CAAC;AACLZ,oBAAAA,UAAAA,EAAYM,iBAAiBN,UAAU;AACvCC,oBAAAA,MAAAA,EAAQK,iBAAiBL;iBAE1BP,CAAAA,CAAAA,WAAW,CAACV,GAAAA,CAAAA,CACZW,OAAO,EAAA;AACZ;AACF;AACF,KAAA,CAAA;AACF;;;;"}
@@ -0,0 +1,49 @@
1
+ import { contentTypes } from '@strapi/utils';
2
+ import _ from 'lodash';
3
+
4
+ const enableFirstPublishedAt = async ({ oldContentTypes, contentTypes: contentTypes$1 })=>{
5
+ if (!oldContentTypes) {
6
+ return;
7
+ }
8
+ return strapi.db.transaction(async (trx)=>{
9
+ for(const uid in contentTypes$1){
10
+ if (!oldContentTypes[uid]) {
11
+ continue;
12
+ }
13
+ const contentType = contentTypes$1[uid];
14
+ if (!contentTypes.hasFirstPublishedAtField(contentType)) {
15
+ continue;
16
+ }
17
+ if (!contentType.attributes?.firstPublishedAt) {
18
+ continue;
19
+ }
20
+ const content = await strapi.db.queryBuilder(uid).select('*').transacting(trx).execute();
21
+ // Process content types in pairs: draft and published.
22
+ // If only one exist, which means the value is not published yet and we can ignore it
23
+ const groupedContent = _.groupBy(content, (item)=>`${item.documentId}-${item.locale}`);
24
+ for (const items of Object.values(groupedContent)){
25
+ // If there is only one item, which means nothing is published yet for this locale
26
+ if (items.length <= 1) {
27
+ continue;
28
+ }
29
+ // If firstPublishedAt is already present, do not do anything
30
+ if (items[0].firstPublishedAt != null && items[1].firstPublishedAt != null) {
31
+ continue;
32
+ }
33
+ const publishedContent = items.filter((item)=>item.publishedAt != null).at(0);
34
+ if (!publishedContent) {
35
+ continue;
36
+ }
37
+ await strapi.db.queryBuilder(uid).update({
38
+ firstPublishedAt: new Date(publishedContent.publishedAt)
39
+ }).where({
40
+ documentId: publishedContent.documentId,
41
+ locale: publishedContent.locale
42
+ }).transacting(trx).execute();
43
+ }
44
+ }
45
+ });
46
+ };
47
+
48
+ export { enableFirstPublishedAt as enable };
49
+ //# sourceMappingURL=first-published-at.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"first-published-at.mjs","sources":["../../src/migrations/first-published-at.ts"],"sourcesContent":["import { contentTypes as contentTypesUtils } from '@strapi/utils';\nimport _ from 'lodash';\nimport { Input } from './draft-publish';\n\ninterface ContentTypeData {\n id: number;\n documentId: string;\n publishedAt: Date;\n firstPublishedAt: Date;\n locale: string;\n}\n\nconst enableFirstPublishedAt = async ({ oldContentTypes, contentTypes }: Input) => {\n if (!oldContentTypes) {\n return;\n }\n\n return strapi.db.transaction(async (trx) => {\n for (const uid in contentTypes) {\n if (!oldContentTypes[uid]) {\n continue;\n }\n\n const contentType = contentTypes[uid];\n\n if (!contentTypesUtils.hasFirstPublishedAtField(contentType)) {\n continue;\n }\n\n if (!contentType.attributes?.firstPublishedAt) {\n continue;\n }\n\n const content: ContentTypeData[] = await strapi.db\n .queryBuilder(uid)\n .select('*')\n .transacting(trx)\n .execute();\n\n // Process content types in pairs: draft and published.\n // If only one exist, which means the value is not published yet and we can ignore it\n const groupedContent = _.groupBy(content, (item) => `${item.documentId}-${item.locale}`);\n\n for (const items of Object.values(groupedContent)) {\n // If there is only one item, which means nothing is published yet for this locale\n if (items.length <= 1) {\n continue;\n }\n\n // If firstPublishedAt is already present, do not do anything\n if (items[0].firstPublishedAt != null && items[1].firstPublishedAt != null) {\n continue;\n }\n\n const publishedContent = items.filter((item) => item.publishedAt != null).at(0);\n if (!publishedContent) {\n continue;\n }\n\n await strapi.db\n .queryBuilder(uid)\n .update({\n firstPublishedAt: new Date(publishedContent.publishedAt),\n })\n .where({\n documentId: publishedContent.documentId,\n locale: publishedContent.locale,\n })\n .transacting(trx)\n .execute();\n }\n }\n });\n};\n\nexport { enableFirstPublishedAt as enable };\n"],"names":["enableFirstPublishedAt","oldContentTypes","contentTypes","strapi","db","transaction","trx","uid","contentType","contentTypesUtils","hasFirstPublishedAtField","attributes","firstPublishedAt","content","queryBuilder","select","transacting","execute","groupedContent","_","groupBy","item","documentId","locale","items","Object","values","length","publishedContent","filter","publishedAt","at","update","Date","where"],"mappings":";;;AAYA,MAAMA,yBAAyB,OAAO,EAAEC,eAAe,gBAAEC,cAAY,EAAS,GAAA;AAC5E,IAAA,IAAI,CAACD,eAAiB,EAAA;AACpB,QAAA;AACF;AAEA,IAAA,OAAOE,MAAOC,CAAAA,EAAE,CAACC,WAAW,CAAC,OAAOC,GAAAA,GAAAA;QAClC,IAAK,MAAMC,OAAOL,cAAc,CAAA;AAC9B,YAAA,IAAI,CAACD,eAAe,CAACM,GAAAA,CAAI,EAAE;AACzB,gBAAA;AACF;YAEA,MAAMC,WAAAA,GAAcN,cAAY,CAACK,GAAI,CAAA;AAErC,YAAA,IAAI,CAACE,YAAAA,CAAkBC,wBAAwB,CAACF,WAAc,CAAA,EAAA;AAC5D,gBAAA;AACF;AAEA,YAAA,IAAI,CAACA,WAAAA,CAAYG,UAAU,EAAEC,gBAAkB,EAAA;AAC7C,gBAAA;AACF;AAEA,YAAA,MAAMC,OAA6B,GAAA,MAAMV,MAAOC,CAAA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file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE7C,QAAA,MAAM,MAAM,sCAA6C,KAAK,kBAG7D,CAAC;AAEF,QAAA,MAAM,OAAO,sCAA6C,KAAK,kBAG9D,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE7C,QAAA,MAAM,MAAM,sCAA6C,KAAK,kBAI7D,CAAC;AAEF,QAAA,MAAM,OAAO,sCAA6C,KAAK,kBAG9D,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC"}
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var draftPublish = require('./draft-publish.js');
4
+ var firstPublishedAt = require('./first-published-at.js');
4
5
  var i18n = require('./i18n.js');
5
6
 
6
7
  const enable = async ({ oldContentTypes, contentTypes })=>{
@@ -12,6 +13,10 @@ const enable = async ({ oldContentTypes, contentTypes })=>{
12
13
  oldContentTypes,
13
14
  contentTypes
14
15
  });
16
+ await firstPublishedAt.enable({
17
+ oldContentTypes,
18
+ contentTypes
19
+ });
15
20
  };
16
21
  const disable = async ({ oldContentTypes, contentTypes })=>{
17
22
  await i18n.disable({
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/migrations/index.ts"],"sourcesContent":["import * as draftPublishMigrations from './draft-publish';\nimport * as i18nMigrations from './i18n';\nimport type { Input } from './draft-publish';\n\nconst enable = async ({ oldContentTypes, contentTypes }: Input) => {\n await i18nMigrations.enable({ oldContentTypes, contentTypes });\n await draftPublishMigrations.enable({ oldContentTypes, contentTypes });\n};\n\nconst disable = async ({ oldContentTypes, contentTypes }: Input) => {\n await i18nMigrations.disable({ oldContentTypes, contentTypes });\n await draftPublishMigrations.disable({ oldContentTypes, contentTypes });\n};\n\nexport { enable, disable };\n"],"names":["enable","oldContentTypes","contentTypes","i18nMigrations","draftPublishMigrations","disable"],"mappings":";;;;;AAIA,MAAMA,SAAS,OAAO,EAAEC,eAAe,EAAEC,YAAY,EAAS,GAAA;IAC5D,MAAMC,WAAqB,CAAC;AAAEF,QAAAA,eAAAA;AAAiBC,QAAAA;AAAa,KAAA,CAAA;IAC5D,MAAME,mBAA6B,CAAC;AAAEH,QAAAA,eAAAA;AAAiBC,QAAAA;AAAa,KAAA,CAAA;AACtE;AAEA,MAAMG,UAAU,OAAO,EAAEJ,eAAe,EAAEC,YAAY,EAAS,GAAA;IAC7D,MAAMC,YAAsB,CAAC;AAAEF,QAAAA,eAAAA;AAAiBC,QAAAA;AAAa,KAAA,CAAA;IAC7D,MAAME,oBAA8B,CAAC;AAAEH,QAAAA,eAAAA;AAAiBC,QAAAA;AAAa,KAAA,CAAA;AACvE;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/migrations/index.ts"],"sourcesContent":["import * as draftPublishMigrations from './draft-publish';\nimport * as firstPublishedAt from './first-published-at';\nimport * as i18nMigrations from './i18n';\nimport type { Input } from './draft-publish';\n\nconst enable = async ({ oldContentTypes, contentTypes }: Input) => {\n await i18nMigrations.enable({ oldContentTypes, contentTypes });\n await draftPublishMigrations.enable({ oldContentTypes, contentTypes });\n await firstPublishedAt.enable({ oldContentTypes, contentTypes });\n};\n\nconst disable = async ({ oldContentTypes, contentTypes }: Input) => {\n await i18nMigrations.disable({ oldContentTypes, contentTypes });\n await draftPublishMigrations.disable({ oldContentTypes, contentTypes });\n};\n\nexport { enable, disable };\n"],"names":["enable","oldContentTypes","contentTypes","i18nMigrations","draftPublishMigrations","firstPublishedAt","disable"],"mappings":";;;;;;AAKA,MAAMA,SAAS,OAAO,EAAEC,eAAe,EAAEC,YAAY,EAAS,GAAA;IAC5D,MAAMC,WAAqB,CAAC;AAAEF,QAAAA,eAAAA;AAAiBC,QAAAA;AAAa,KAAA,CAAA;IAC5D,MAAME,mBAA6B,CAAC;AAAEH,QAAAA,eAAAA;AAAiBC,QAAAA;AAAa,KAAA,CAAA;IACpE,MAAMG,uBAAuB,CAAC;AAAEJ,QAAAA,eAAAA;AAAiBC,QAAAA;AAAa,KAAA,CAAA;AAChE;AAEA,MAAMI,UAAU,OAAO,EAAEL,eAAe,EAAEC,YAAY,EAAS,GAAA;IAC7D,MAAMC,YAAsB,CAAC;AAAEF,QAAAA,eAAAA;AAAiBC,QAAAA;AAAa,KAAA,CAAA;IAC7D,MAAME,oBAA8B,CAAC;AAAEH,QAAAA,eAAAA;AAAiBC,QAAAA;AAAa,KAAA,CAAA;AACvE;;;;;"}
@@ -1,4 +1,5 @@
1
1
  import { enable as enableDraftAndPublish, disable as disableDraftAndPublish } from './draft-publish.mjs';
2
+ import { enable as enableFirstPublishedAt } from './first-published-at.mjs';
2
3
  import { enable as enableI18n, disable as disableI18n } from './i18n.mjs';
3
4
 
4
5
  const enable = async ({ oldContentTypes, contentTypes })=>{
@@ -10,6 +11,10 @@ const enable = async ({ oldContentTypes, contentTypes })=>{
10
11
  oldContentTypes,
11
12
  contentTypes
12
13
  });
14
+ await enableFirstPublishedAt({
15
+ oldContentTypes,
16
+ contentTypes
17
+ });
13
18
  };
14
19
  const disable = async ({ oldContentTypes, contentTypes })=>{
15
20
  await disableI18n({
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/migrations/index.ts"],"sourcesContent":["import * as draftPublishMigrations from './draft-publish';\nimport * as i18nMigrations from './i18n';\nimport type { Input } from './draft-publish';\n\nconst enable = async ({ oldContentTypes, contentTypes }: Input) => {\n await i18nMigrations.enable({ oldContentTypes, contentTypes });\n await draftPublishMigrations.enable({ oldContentTypes, contentTypes });\n};\n\nconst disable = async ({ oldContentTypes, contentTypes }: Input) => {\n await i18nMigrations.disable({ oldContentTypes, contentTypes });\n await draftPublishMigrations.disable({ oldContentTypes, contentTypes });\n};\n\nexport { enable, disable };\n"],"names":["enable","oldContentTypes","contentTypes","i18nMigrations","draftPublishMigrations","disable"],"mappings":";;;AAIA,MAAMA,SAAS,OAAO,EAAEC,eAAe,EAAEC,YAAY,EAAS,GAAA;IAC5D,MAAMC,UAAqB,CAAC;AAAEF,QAAAA,eAAAA;AAAiBC,QAAAA;AAAa,KAAA,CAAA;IAC5D,MAAME,qBAA6B,CAAC;AAAEH,QAAAA,eAAAA;AAAiBC,QAAAA;AAAa,KAAA,CAAA;AACtE;AAEA,MAAMG,UAAU,OAAO,EAAEJ,eAAe,EAAEC,YAAY,EAAS,GAAA;IAC7D,MAAMC,WAAsB,CAAC;AAAEF,QAAAA,eAAAA;AAAiBC,QAAAA;AAAa,KAAA,CAAA;IAC7D,MAAME,sBAA8B,CAAC;AAAEH,QAAAA,eAAAA;AAAiBC,QAAAA;AAAa,KAAA,CAAA;AACvE;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/migrations/index.ts"],"sourcesContent":["import * as draftPublishMigrations from './draft-publish';\nimport * as firstPublishedAt from './first-published-at';\nimport * as i18nMigrations from './i18n';\nimport type { Input } from './draft-publish';\n\nconst enable = async ({ oldContentTypes, contentTypes }: Input) => {\n await i18nMigrations.enable({ oldContentTypes, contentTypes });\n await draftPublishMigrations.enable({ oldContentTypes, contentTypes });\n await firstPublishedAt.enable({ oldContentTypes, contentTypes });\n};\n\nconst disable = async ({ oldContentTypes, contentTypes }: Input) => {\n await i18nMigrations.disable({ oldContentTypes, contentTypes });\n await draftPublishMigrations.disable({ oldContentTypes, contentTypes });\n};\n\nexport { enable, disable };\n"],"names":["enable","oldContentTypes","contentTypes","i18nMigrations","draftPublishMigrations","firstPublishedAt","disable"],"mappings":";;;;AAKA,MAAMA,SAAS,OAAO,EAAEC,eAAe,EAAEC,YAAY,EAAS,GAAA;IAC5D,MAAMC,UAAqB,CAAC;AAAEF,QAAAA,eAAAA;AAAiBC,QAAAA;AAAa,KAAA,CAAA;IAC5D,MAAME,qBAA6B,CAAC;AAAEH,QAAAA,eAAAA;AAAiBC,QAAAA;AAAa,KAAA,CAAA;IACpE,MAAMG,sBAAuB,CAAC;AAAEJ,QAAAA,eAAAA;AAAiBC,QAAAA;AAAa,KAAA,CAAA;AAChE;AAEA,MAAMI,UAAU,OAAO,EAAEL,eAAe,EAAEC,YAAY,EAAS,GAAA;IAC7D,MAAMC,WAAsB,CAAC;AAAEF,QAAAA,eAAAA;AAAiBC,QAAAA;AAAa,KAAA,CAAA;IAC7D,MAAME,sBAA8B,CAAC;AAAEH,QAAAA,eAAAA;AAAiBC,QAAAA;AAAa,KAAA,CAAA;AACvE;;;;"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var name = "@strapi/core";
6
- var version = "0.0.0-experimental.fa3ec797cdee7109d96b9f1616c32accf946e251";
6
+ var version = "0.0.0-experimental.fabc1d11d851a17662804b9cfcc3e1e8c89252ac";
7
7
  var description = "Core of Strapi";
8
8
  var homepage = "https://strapi.io";
9
9
  var bugs = {
@@ -59,14 +59,15 @@ var dependencies = {
59
59
  "@koa/cors": "5.0.0",
60
60
  "@koa/router": "12.0.2",
61
61
  "@paralleldrive/cuid2": "2.2.2",
62
- "@strapi/admin": "0.0.0-experimental.fa3ec797cdee7109d96b9f1616c32accf946e251",
63
- "@strapi/database": "0.0.0-experimental.fa3ec797cdee7109d96b9f1616c32accf946e251",
64
- "@strapi/generators": "0.0.0-experimental.fa3ec797cdee7109d96b9f1616c32accf946e251",
65
- "@strapi/logger": "0.0.0-experimental.fa3ec797cdee7109d96b9f1616c32accf946e251",
66
- "@strapi/permissions": "0.0.0-experimental.fa3ec797cdee7109d96b9f1616c32accf946e251",
67
- "@strapi/types": "0.0.0-experimental.fa3ec797cdee7109d96b9f1616c32accf946e251",
68
- "@strapi/typescript-utils": "0.0.0-experimental.fa3ec797cdee7109d96b9f1616c32accf946e251",
69
- "@strapi/utils": "0.0.0-experimental.fa3ec797cdee7109d96b9f1616c32accf946e251",
62
+ "@strapi/admin": "0.0.0-experimental.fabc1d11d851a17662804b9cfcc3e1e8c89252ac",
63
+ "@strapi/database": "0.0.0-experimental.fabc1d11d851a17662804b9cfcc3e1e8c89252ac",
64
+ "@strapi/generators": "0.0.0-experimental.fabc1d11d851a17662804b9cfcc3e1e8c89252ac",
65
+ "@strapi/logger": "0.0.0-experimental.fabc1d11d851a17662804b9cfcc3e1e8c89252ac",
66
+ "@strapi/permissions": "0.0.0-experimental.fabc1d11d851a17662804b9cfcc3e1e8c89252ac",
67
+ "@strapi/types": "0.0.0-experimental.fabc1d11d851a17662804b9cfcc3e1e8c89252ac",
68
+ "@strapi/typescript-utils": "0.0.0-experimental.fabc1d11d851a17662804b9cfcc3e1e8c89252ac",
69
+ "@strapi/utils": "0.0.0-experimental.fabc1d11d851a17662804b9cfcc3e1e8c89252ac",
70
+ "@vercel/stega": "0.1.2",
70
71
  bcryptjs: "2.4.3",
71
72
  boxen: "5.1.2",
72
73
  chalk: "4.1.2",
@@ -85,6 +86,7 @@ var dependencies = {
85
86
  "http-errors": "2.0.0",
86
87
  inquirer: "8.2.5",
87
88
  "is-docker": "2.2.1",
89
+ "json-logic-js": "2.0.5",
88
90
  koa: "2.16.1",
89
91
  "koa-body": "6.0.1",
90
92
  "koa-compose": "4.1.0",
@@ -107,7 +109,8 @@ var dependencies = {
107
109
  statuses: "2.0.1",
108
110
  typescript: "5.4.4",
109
111
  undici: "6.21.2",
110
- yup: "0.32.9"
112
+ yup: "0.32.9",
113
+ zod: "3.25.67"
111
114
  };
112
115
  var devDependencies = {
113
116
  "@strapi/ts-zen": "^0.2.0",
@@ -119,6 +122,7 @@ var devDependencies = {
119
122
  "@types/global-agent": "2.1.3",
120
123
  "@types/http-errors": "2.0.4",
121
124
  "@types/jest": "29.5.2",
125
+ "@types/json-logic-js": "2.0.8",
122
126
  "@types/koa": "2.13.4",
123
127
  "@types/koa-compress": "4.0.3",
124
128
  "@types/koa-session": "6.4.1",
@@ -129,9 +133,9 @@ var devDependencies = {
129
133
  "@types/node": "18.19.24",
130
134
  "@types/node-schedule": "2.1.7",
131
135
  "@types/statuses": "2.0.1",
132
- "eslint-config-custom": "0.0.0-experimental.fa3ec797cdee7109d96b9f1616c32accf946e251",
136
+ "eslint-config-custom": "0.0.0-experimental.fabc1d11d851a17662804b9cfcc3e1e8c89252ac",
133
137
  supertest: "6.3.3",
134
- tsconfig: "0.0.0-experimental.fa3ec797cdee7109d96b9f1616c32accf946e251"
138
+ tsconfig: "0.0.0-experimental.fabc1d11d851a17662804b9cfcc3e1e8c89252ac"
135
139
  };
136
140
  var engines = {
137
141
  node: ">=18.0.0 <=22.x.x",
@@ -1 +1 @@
1
- {"version":3,"file":"package.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"package.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
1
  var name = "@strapi/core";
2
- var version = "0.0.0-experimental.fa3ec797cdee7109d96b9f1616c32accf946e251";
2
+ var version = "0.0.0-experimental.fabc1d11d851a17662804b9cfcc3e1e8c89252ac";
3
3
  var description = "Core of Strapi";
4
4
  var homepage = "https://strapi.io";
5
5
  var bugs = {
@@ -55,14 +55,15 @@ var dependencies = {
55
55
  "@koa/cors": "5.0.0",
56
56
  "@koa/router": "12.0.2",
57
57
  "@paralleldrive/cuid2": "2.2.2",
58
- "@strapi/admin": "0.0.0-experimental.fa3ec797cdee7109d96b9f1616c32accf946e251",
59
- "@strapi/database": "0.0.0-experimental.fa3ec797cdee7109d96b9f1616c32accf946e251",
60
- "@strapi/generators": "0.0.0-experimental.fa3ec797cdee7109d96b9f1616c32accf946e251",
61
- "@strapi/logger": "0.0.0-experimental.fa3ec797cdee7109d96b9f1616c32accf946e251",
62
- "@strapi/permissions": "0.0.0-experimental.fa3ec797cdee7109d96b9f1616c32accf946e251",
63
- "@strapi/types": "0.0.0-experimental.fa3ec797cdee7109d96b9f1616c32accf946e251",
64
- "@strapi/typescript-utils": "0.0.0-experimental.fa3ec797cdee7109d96b9f1616c32accf946e251",
65
- "@strapi/utils": "0.0.0-experimental.fa3ec797cdee7109d96b9f1616c32accf946e251",
58
+ "@strapi/admin": "0.0.0-experimental.fabc1d11d851a17662804b9cfcc3e1e8c89252ac",
59
+ "@strapi/database": "0.0.0-experimental.fabc1d11d851a17662804b9cfcc3e1e8c89252ac",
60
+ "@strapi/generators": "0.0.0-experimental.fabc1d11d851a17662804b9cfcc3e1e8c89252ac",
61
+ "@strapi/logger": "0.0.0-experimental.fabc1d11d851a17662804b9cfcc3e1e8c89252ac",
62
+ "@strapi/permissions": "0.0.0-experimental.fabc1d11d851a17662804b9cfcc3e1e8c89252ac",
63
+ "@strapi/types": "0.0.0-experimental.fabc1d11d851a17662804b9cfcc3e1e8c89252ac",
64
+ "@strapi/typescript-utils": "0.0.0-experimental.fabc1d11d851a17662804b9cfcc3e1e8c89252ac",
65
+ "@strapi/utils": "0.0.0-experimental.fabc1d11d851a17662804b9cfcc3e1e8c89252ac",
66
+ "@vercel/stega": "0.1.2",
66
67
  bcryptjs: "2.4.3",
67
68
  boxen: "5.1.2",
68
69
  chalk: "4.1.2",
@@ -81,6 +82,7 @@ var dependencies = {
81
82
  "http-errors": "2.0.0",
82
83
  inquirer: "8.2.5",
83
84
  "is-docker": "2.2.1",
85
+ "json-logic-js": "2.0.5",
84
86
  koa: "2.16.1",
85
87
  "koa-body": "6.0.1",
86
88
  "koa-compose": "4.1.0",
@@ -103,7 +105,8 @@ var dependencies = {
103
105
  statuses: "2.0.1",
104
106
  typescript: "5.4.4",
105
107
  undici: "6.21.2",
106
- yup: "0.32.9"
108
+ yup: "0.32.9",
109
+ zod: "3.25.67"
107
110
  };
108
111
  var devDependencies = {
109
112
  "@strapi/ts-zen": "^0.2.0",
@@ -115,6 +118,7 @@ var devDependencies = {
115
118
  "@types/global-agent": "2.1.3",
116
119
  "@types/http-errors": "2.0.4",
117
120
  "@types/jest": "29.5.2",
121
+ "@types/json-logic-js": "2.0.8",
118
122
  "@types/koa": "2.13.4",
119
123
  "@types/koa-compress": "4.0.3",
120
124
  "@types/koa-session": "6.4.1",
@@ -125,9 +129,9 @@ var devDependencies = {
125
129
  "@types/node": "18.19.24",
126
130
  "@types/node-schedule": "2.1.7",
127
131
  "@types/statuses": "2.0.1",
128
- "eslint-config-custom": "0.0.0-experimental.fa3ec797cdee7109d96b9f1616c32accf946e251",
132
+ "eslint-config-custom": "0.0.0-experimental.fabc1d11d851a17662804b9cfcc3e1e8c89252ac",
129
133
  supertest: "6.3.3",
130
- tsconfig: "0.0.0-experimental.fa3ec797cdee7109d96b9f1616c32accf946e251"
134
+ tsconfig: "0.0.0-experimental.fabc1d11d851a17662804b9cfcc3e1e8c89252ac"
131
135
  };
132
136
  var engines = {
133
137
  node: ">=18.0.0 <=22.x.x",
@@ -1 +1 @@
1
- {"version":3,"file":"package.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"package.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -47,7 +47,7 @@ declare const createContentAPI: (strapi: Core.Strapi) => {
47
47
  controllers: Record<string, string[]>;
48
48
  }>;
49
49
  };
50
- getRoutesMap: () => Promise<Record<string, Core.Route[]>>;
50
+ getRoutesMap: () => Promise<Record<string, unknown>>;
51
51
  sanitize: {
52
52
  input: sanitize.SanitizeFunc;
53
53
  output: sanitize.SanitizeFunc;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/content-api/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,IAAI,EAAO,MAAM,eAAe,CAAC;AAgB/C;;GAEG;AACH,QAAA,MAAM,gBAAgB,WAAY,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgF5C,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/content-api/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAqC,MAAM,eAAe,CAAC;AAEtF,OAAO,KAAK,EAAE,IAAI,EAAO,MAAM,eAAe,CAAC;AAgB/C;;GAEG;AACH,QAAA,MAAM,gBAAgB,WAAY,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgF5C,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -49,7 +49,7 @@ const filterContentAPI = (route)=>route.info.type === 'content-api';
49
49
  path: `${apiPrefix}${route.path}`
50
50
  }));
51
51
  });
52
- return routesMap;
52
+ return strapiUtils.sanitizeRoutesMapForSerialization(routesMap);
53
53
  };
54
54
  const sanitizer = strapiUtils.sanitize.createAPISanitizers({
55
55
  getModel (uid) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/services/content-api/index.ts"],"sourcesContent":["import _ from 'lodash';\nimport { sanitize, validate } from '@strapi/utils';\n\nimport type { Core, UID } from '@strapi/types';\n\nimport instantiatePermissionsUtilities from './permissions';\n\nconst transformRoutePrefixFor = (pluginName: string) => (route: Core.Route) => {\n const prefix = route.config && route.config.prefix;\n const path = prefix !== undefined ? `${prefix}${route.path}` : `/${pluginName}${route.path}`;\n\n return {\n ...route,\n path,\n };\n};\n\nconst filterContentAPI = (route: Core.Route) => route.info.type === 'content-api';\n\n/**\n * Create a content API container that holds logic, tools and utils. (eg: permissions, ...)\n */\nconst createContentAPI = (strapi: Core.Strapi) => {\n const getRoutesMap = async () => {\n const routesMap: Record<string, Core.Route[]> = {};\n\n _.forEach(strapi.apis, (api, apiName) => {\n const routes = _.flatMap(api.routes, (route) => {\n if ('routes' in route) {\n return route.routes;\n }\n\n return route;\n }).filter(filterContentAPI);\n\n if (routes.length === 0) {\n return;\n }\n\n const apiPrefix = strapi.config.get('api.rest.prefix');\n routesMap[`api::${apiName}`] = routes.map((route) => ({\n ...route,\n path: `${apiPrefix}${route.path}`,\n }));\n });\n\n _.forEach(strapi.plugins, (plugin, pluginName) => {\n const transformPrefix = transformRoutePrefixFor(pluginName);\n\n if (Array.isArray(plugin.routes)) {\n return plugin.routes.map(transformPrefix).filter(filterContentAPI);\n }\n\n const routes = _.flatMap(plugin.routes, (route) => route.routes.map(transformPrefix)).filter(\n filterContentAPI\n );\n\n if (routes.length === 0) {\n return;\n }\n\n const apiPrefix = strapi.config.get('api.rest.prefix');\n routesMap[`plugin::${pluginName}`] = routes.map((route) => ({\n ...route,\n path: `${apiPrefix}${route.path}`,\n }));\n });\n\n return routesMap;\n };\n\n const sanitizer = sanitize.createAPISanitizers({\n getModel(uid: string) {\n return strapi.getModel(uid as UID.Schema);\n },\n // NOTE: use lazy access to allow registration of sanitizers after the creation of the container\n get sanitizers() {\n return {\n input: strapi.sanitizers.get('content-api.input'),\n output: strapi.sanitizers.get('content-api.output'),\n };\n },\n });\n\n const validator = validate.createAPIValidators({\n getModel(uid: string) {\n return strapi.getModel(uid as UID.Schema);\n },\n // NOTE: use lazy access to allow registration of validators after the creation of the container\n get validators() {\n return {\n input: strapi.validators.get('content-api.input'),\n };\n },\n });\n\n return {\n permissions: instantiatePermissionsUtilities(strapi),\n getRoutesMap,\n sanitize: sanitizer,\n validate: validator,\n };\n};\n\nexport default createContentAPI;\n"],"names":["transformRoutePrefixFor","pluginName","route","prefix","config","path","undefined","filterContentAPI","info","type","createContentAPI","strapi","getRoutesMap","routesMap","_","forEach","apis","api","apiName","routes","flatMap","filter","length","apiPrefix","get","map","plugins","plugin","transformPrefix","Array","isArray","sanitizer","sanitize","createAPISanitizers","getModel","uid","sanitizers","input","output","validator","validate","createAPIValidators","validators","permissions","instantiatePermissionsUtilities"],"mappings":";;;;;;AAOA,MAAMA,uBAAAA,GAA0B,CAACC,UAAAA,GAAuB,CAACC,KAAAA,GAAAA;AACvD,QAAA,MAAMC,SAASD,KAAME,CAAAA,MAAM,IAAIF,KAAME,CAAAA,MAAM,CAACD,MAAM;QAClD,MAAME,IAAAA,GAAOF,WAAWG,SAAY,GAAA,CAAC,EAAEH,MAAO,CAAA,EAAED,MAAMG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAEJ,UAAAA,CAAW,EAAEC,KAAMG,CAAAA,IAAI,CAAC,CAAC;QAE5F,OAAO;AACL,YAAA,GAAGH,KAAK;AACRG,YAAAA;AACF,SAAA;AACF,KAAA;AAEA,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,CAAAA,mBAAmB,CAAC;AAC7CP,QAAAA,QAAAA,CAAAA,CAASC,GAAW,EAAA;YAClB,OAAOxB,MAAAA,CAAOuB,QAAQ,CAACC,GAAAA,CAAAA;AACzB,SAAA;;AAEA,QAAA,IAAIO,UAAa,CAAA,GAAA;YACf,OAAO;AACLL,gBAAAA,KAAAA,EAAO1B,MAAO+B,CAAAA,UAAU,CAAClB,GAAG,CAAC,mBAAA;AAC/B,aAAA;AACF;AACF,KAAA,CAAA;IAEA,OAAO;AACLmB,QAAAA,WAAAA,EAAaC,KAAgCjC,CAAAA,MAAAA,CAAAA;AAC7CC,QAAAA,YAAAA;QACAoB,QAAUD,EAAAA,SAAAA;QACVS,QAAUD,EAAAA;AACZ,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/services/content-api/index.ts"],"sourcesContent":["import _ from 'lodash';\nimport { sanitize, validate, sanitizeRoutesMapForSerialization } from '@strapi/utils';\n\nimport type { Core, UID } from '@strapi/types';\n\nimport instantiatePermissionsUtilities from './permissions';\n\nconst transformRoutePrefixFor = (pluginName: string) => (route: Core.Route) => {\n const prefix = route.config && route.config.prefix;\n const path = prefix !== undefined ? `${prefix}${route.path}` : `/${pluginName}${route.path}`;\n\n return {\n ...route,\n path,\n };\n};\n\nconst filterContentAPI = (route: Core.Route) => route.info.type === 'content-api';\n\n/**\n * Create a content API container that holds logic, tools and utils. (eg: permissions, ...)\n */\nconst createContentAPI = (strapi: Core.Strapi) => {\n const getRoutesMap = async () => {\n const routesMap: Record<string, Core.Route[]> = {};\n\n _.forEach(strapi.apis, (api, apiName) => {\n const routes = _.flatMap(api.routes, (route) => {\n if ('routes' in route) {\n return route.routes;\n }\n\n return route;\n }).filter(filterContentAPI);\n\n if (routes.length === 0) {\n return;\n }\n\n const apiPrefix = strapi.config.get('api.rest.prefix');\n routesMap[`api::${apiName}`] = routes.map((route) => ({\n ...route,\n path: `${apiPrefix}${route.path}`,\n }));\n });\n\n _.forEach(strapi.plugins, (plugin, pluginName) => {\n const transformPrefix = transformRoutePrefixFor(pluginName);\n\n if (Array.isArray(plugin.routes)) {\n return plugin.routes.map(transformPrefix).filter(filterContentAPI);\n }\n\n const routes = _.flatMap(plugin.routes, (route) => route.routes.map(transformPrefix)).filter(\n filterContentAPI\n );\n\n if (routes.length === 0) {\n return;\n }\n\n const apiPrefix = strapi.config.get('api.rest.prefix');\n routesMap[`plugin::${pluginName}`] = routes.map((route) => ({\n ...route,\n path: `${apiPrefix}${route.path}`,\n }));\n });\n\n return sanitizeRoutesMapForSerialization(routesMap);\n };\n\n const sanitizer = sanitize.createAPISanitizers({\n getModel(uid: string) {\n return strapi.getModel(uid as UID.Schema);\n },\n // NOTE: use lazy access to allow registration of sanitizers after the creation of the container\n get sanitizers() {\n return {\n input: strapi.sanitizers.get('content-api.input'),\n output: strapi.sanitizers.get('content-api.output'),\n };\n },\n });\n\n const validator = validate.createAPIValidators({\n getModel(uid: string) {\n return strapi.getModel(uid as UID.Schema);\n },\n // NOTE: use lazy access to allow registration of validators after the creation of the container\n get validators() {\n return {\n input: strapi.validators.get('content-api.input'),\n };\n },\n });\n\n return {\n permissions: instantiatePermissionsUtilities(strapi),\n getRoutesMap,\n sanitize: sanitizer,\n validate: validator,\n };\n};\n\nexport default createContentAPI;\n"],"names":["transformRoutePrefixFor","pluginName","route","prefix","config","path","undefined","filterContentAPI","info","type","createContentAPI","strapi","getRoutesMap","routesMap","_","forEach","apis","api","apiName","routes","flatMap","filter","length","apiPrefix","get","map","plugins","plugin","transformPrefix","Array","isArray","sanitizeRoutesMapForSerialization","sanitizer","sanitize","createAPISanitizers","getModel","uid","sanitizers","input","output","validator","validate","createAPIValidators","validators","permissions","instantiatePermissionsUtilities"],"mappings":";;;;;;AAOA,MAAMA,uBAAAA,GAA0B,CAACC,UAAAA,GAAuB,CAACC,KAAAA,GAAAA;AACvD,QAAA,MAAMC,SAASD,KAAME,CAAAA,MAAM,IAAIF,KAAME,CAAAA,MAAM,CAACD,MAA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ACzB,SAAA;;AAEA,QAAA,IAAIC,UAAa,CAAA,GAAA;YACf,OAAO;AACLC,gBAAAA,KAAAA,EAAO3B,MAAO0B,CAAAA,UAAU,CAACb,GAAG,CAAC,mBAAA,CAAA;AAC7Be,gBAAAA,MAAAA,EAAQ5B,MAAO0B,CAAAA,UAAU,CAACb,GAAG,CAAC,oBAAA;AAChC,aAAA;AACF;AACF,KAAA,CAAA;IAEA,MAAMgB,SAAAA,GAAYC,oBAASC,CAAAA,mBAAmB,CAAC;AAC7CP,QAAAA,QAAAA,CAAAA,CAASC,GAAW,EAAA;YAClB,OAAOzB,MAAAA,CAAOwB,QAAQ,CAACC,GAAAA,CAAAA;AACzB,SAAA;;AAEA,QAAA,IAAIO,UAAa,CAAA,GAAA;YACf,OAAO;AACLL,gBAAAA,KAAAA,EAAO3B,MAAOgC,CAAAA,UAAU,CAACnB,GAAG,CAAC,mBAAA;AAC/B,aAAA;AACF;AACF,KAAA,CAAA;IAEA,OAAO;AACLoB,QAAAA,WAAAA,EAAaC,KAAgClC,CAAAA,MAAAA,CAAAA;AAC7CC,QAAAA,YAAAA;QACAqB,QAAUD,EAAAA,SAAAA;QACVS,QAAUD,EAAAA;AACZ,KAAA;AACF;;;;"}
@@ -1,5 +1,5 @@
1
1
  import _ from 'lodash';
2
- import { sanitize, validate } from '@strapi/utils';
2
+ import { sanitize, validate, sanitizeRoutesMapForSerialization } from '@strapi/utils';
3
3
  import instantiatePermissionsUtilities from './permissions/index.mjs';
4
4
 
5
5
  const transformRoutePrefixFor = (pluginName)=>(route)=>{
@@ -47,7 +47,7 @@ const filterContentAPI = (route)=>route.info.type === 'content-api';
47
47
  path: `${apiPrefix}${route.path}`
48
48
  }));
49
49
  });
50
- return routesMap;
50
+ return sanitizeRoutesMapForSerialization(routesMap);
51
51
  };
52
52
  const sanitizer = sanitize.createAPISanitizers({
53
53
  getModel (uid) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../src/services/content-api/index.ts"],"sourcesContent":["import _ from 'lodash';\nimport { sanitize, validate } from '@strapi/utils';\n\nimport type { Core, UID } from '@strapi/types';\n\nimport instantiatePermissionsUtilities from './permissions';\n\nconst transformRoutePrefixFor = (pluginName: string) => (route: Core.Route) => {\n const prefix = route.config && route.config.prefix;\n const path = prefix !== undefined ? `${prefix}${route.path}` : `/${pluginName}${route.path}`;\n\n return {\n ...route,\n path,\n };\n};\n\nconst filterContentAPI = (route: Core.Route) => route.info.type === 'content-api';\n\n/**\n * Create a content API container that holds logic, tools and utils. (eg: permissions, ...)\n */\nconst createContentAPI = (strapi: Core.Strapi) => {\n const getRoutesMap = async () => {\n const routesMap: Record<string, Core.Route[]> = {};\n\n _.forEach(strapi.apis, (api, apiName) => {\n const routes = _.flatMap(api.routes, (route) => {\n if ('routes' in route) {\n return route.routes;\n }\n\n return route;\n }).filter(filterContentAPI);\n\n if (routes.length === 0) {\n return;\n }\n\n const apiPrefix = strapi.config.get('api.rest.prefix');\n routesMap[`api::${apiName}`] = routes.map((route) => ({\n ...route,\n path: `${apiPrefix}${route.path}`,\n }));\n });\n\n _.forEach(strapi.plugins, (plugin, pluginName) => {\n const transformPrefix = transformRoutePrefixFor(pluginName);\n\n if (Array.isArray(plugin.routes)) {\n return plugin.routes.map(transformPrefix).filter(filterContentAPI);\n }\n\n const routes = _.flatMap(plugin.routes, (route) => route.routes.map(transformPrefix)).filter(\n filterContentAPI\n );\n\n if (routes.length === 0) {\n return;\n }\n\n const apiPrefix = strapi.config.get('api.rest.prefix');\n routesMap[`plugin::${pluginName}`] = routes.map((route) => ({\n ...route,\n path: `${apiPrefix}${route.path}`,\n }));\n });\n\n return routesMap;\n };\n\n const sanitizer = sanitize.createAPISanitizers({\n getModel(uid: string) {\n return strapi.getModel(uid as UID.Schema);\n },\n // NOTE: use lazy access to allow registration of sanitizers after the creation of the container\n get sanitizers() {\n return {\n input: strapi.sanitizers.get('content-api.input'),\n output: strapi.sanitizers.get('content-api.output'),\n };\n },\n });\n\n const validator = validate.createAPIValidators({\n getModel(uid: string) {\n return strapi.getModel(uid as UID.Schema);\n },\n // NOTE: use lazy access to allow registration of validators after the creation of the container\n get validators() {\n return {\n input: strapi.validators.get('content-api.input'),\n };\n },\n });\n\n return {\n permissions: instantiatePermissionsUtilities(strapi),\n getRoutesMap,\n sanitize: sanitizer,\n validate: validator,\n };\n};\n\nexport default createContentAPI;\n"],"names":["transformRoutePrefixFor","pluginName","route","prefix","config","path","undefined","filterContentAPI","info","type","createContentAPI","strapi","getRoutesMap","routesMap","_","forEach","apis","api","apiName","routes","flatMap","filter","length","apiPrefix","get","map","plugins","plugin","transformPrefix","Array","isArray","sanitizer","sanitize","createAPISanitizers","getModel","uid","sanitizers","input","output","validator","validate","createAPIValidators","validators","permissions","instantiatePermissionsUtilities"],"mappings":";;;;AAOA,MAAMA,uBAAAA,GAA0B,CAACC,UAAAA,GAAuB,CAACC,KAAAA,GAAAA;AACvD,QAAA,MAAMC,SAASD,KAAME,CAAAA,MAAM,IAAIF,KAAME,CAAAA,MAAM,CAACD,MAAM;QAClD,MAAME,IAAAA,GAAOF,WAAWG,SAAY,GAAA,CAAC,EAAEH,MAAO,CAAA,EAAED,MAAMG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAEJ,UAAAA,CAAW,EAAEC,KAAMG,CAAAA,IAAI,CAAC,CAAC;QAE5F,OAAO;AACL,YAAA,GAAGH,KAAK;AACRG,YAAAA;AACF,SAAA;AACF,KAAA;AAEA,MAAME,mBAAmB,CAACL,KAAAA,GAAsBA,MAAMM,IAAI,CAACC,IAAI,KAAK,aAAA;AAEpE;;IAGA,MAAMC,mBAAmB,CAACC,MAAAA,GAAAA;AACxB,IAAA,MAAMC,YAAe,GAAA,UAAA;AACnB,QAAA,MAAMC,YAA0C,EAAC;AAEjDC,QAAAA,CAAAA,CAAEC,OAAO,CAACJ,MAAAA,CAAOK,IAAI,EAAE,CAACC,GAAKC,EAAAA,OAAAA,GAAAA;AAC3B,YAAA,MAAMC,SAAS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AAA,WAAAA,EAAaC,+BAAgCjC,CAAAA,MAAAA,CAAAA;AAC7CC,QAAAA,YAAAA;QACAoB,QAAUD,EAAAA,SAAAA;QACVS,QAAUD,EAAAA;AACZ,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../src/services/content-api/index.ts"],"sourcesContent":["import _ from 'lodash';\nimport { sanitize, validate, sanitizeRoutesMapForSerialization } from '@strapi/utils';\n\nimport type { Core, UID } from '@strapi/types';\n\nimport instantiatePermissionsUtilities from './permissions';\n\nconst transformRoutePrefixFor = (pluginName: string) => (route: Core.Route) => {\n const prefix = route.config && route.config.prefix;\n const path = prefix !== undefined ? `${prefix}${route.path}` : `/${pluginName}${route.path}`;\n\n return {\n ...route,\n path,\n };\n};\n\nconst filterContentAPI = (route: Core.Route) => route.info.type === 'content-api';\n\n/**\n * Create a content API container that holds logic, tools and utils. (eg: permissions, ...)\n */\nconst createContentAPI = (strapi: Core.Strapi) => {\n const getRoutesMap = async () => {\n const routesMap: Record<string, Core.Route[]> = {};\n\n _.forEach(strapi.apis, (api, apiName) => {\n const routes = _.flatMap(api.routes, (route) => {\n if ('routes' in route) {\n return route.routes;\n }\n\n return route;\n }).filter(filterContentAPI);\n\n if (routes.length === 0) {\n return;\n }\n\n const apiPrefix = strapi.config.get('api.rest.prefix');\n routesMap[`api::${apiName}`] = routes.map((route) => ({\n ...route,\n path: `${apiPrefix}${route.path}`,\n }));\n });\n\n _.forEach(strapi.plugins, (plugin, pluginName) => {\n const transformPrefix = transformRoutePrefixFor(pluginName);\n\n if (Array.isArray(plugin.routes)) {\n return plugin.routes.map(transformPrefix).filter(filterContentAPI);\n }\n\n const routes = _.flatMap(plugin.routes, (route) => route.routes.map(transformPrefix)).filter(\n filterContentAPI\n );\n\n if (routes.length === 0) {\n return;\n }\n\n const apiPrefix = strapi.config.get('api.rest.prefix');\n routesMap[`plugin::${pluginName}`] = routes.map((route) => ({\n ...route,\n path: `${apiPrefix}${route.path}`,\n }));\n });\n\n return sanitizeRoutesMapForSerialization(routesMap);\n };\n\n const sanitizer = sanitize.createAPISanitizers({\n getModel(uid: string) {\n return strapi.getModel(uid as UID.Schema);\n },\n // NOTE: use lazy access to allow registration of sanitizers after the creation of the container\n get sanitizers() {\n return {\n input: strapi.sanitizers.get('content-api.input'),\n output: strapi.sanitizers.get('content-api.output'),\n };\n },\n });\n\n const validator = validate.createAPIValidators({\n getModel(uid: string) {\n return strapi.getModel(uid as UID.Schema);\n },\n // NOTE: use lazy access to allow registration of validators after the creation of the container\n get validators() {\n return {\n input: strapi.validators.get('content-api.input'),\n };\n },\n });\n\n return {\n permissions: instantiatePermissionsUtilities(strapi),\n getRoutesMap,\n sanitize: sanitizer,\n validate: validator,\n };\n};\n\nexport default createContentAPI;\n"],"names":["transformRoutePrefixFor","pluginName","route","prefix","config","path","undefined","filterContentAPI","info","type","createContentAPI","strapi","getRoutesMap","routesMap","_","forEach","apis","api","apiName","routes","flatMap","filter","length","apiPrefix","get","map","plugins","plugin","transformPrefix","Array","isArray","sanitizeRoutesMapForSerialization","sanitizer","sanitize","createAPISanitizers","getModel","uid","sanitizers","input","output","validator","validate","createAPIValidators","validators","permissions","instantiatePermissionsUtilities"],"mappings":";;;;AAOA,MAAMA,uBAAAA,GAA0B,CAACC,UAAAA,GAAuB,CAACC,KAAAA,GAAAA;AACvD,QAAA,MAAMC,SAASD,KAAME,CAAAA,MAAM,IAAIF,KAAME,CAAAA,MAAM,CAACD,MAAM;QAClD,MAAME,IAAAA,GAAOF,WAAWG,SAAY,GAAA,CAAC,EAAEH,MAAO,CAAA,EAAED,MAAMG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAEJ,UAAAA,CAAW,EAAEC,KAAMG,CAAAA,IAAI,CAAC,CAAC;QAE5F,OAAO;AACL,YAAA,GAAGH,KAAK;AACRG,YAAAA;AACF,SAAA;AACF,KAAA;AAEA,MAAME,mBAAmB,CAACL,KAAAA,GAAsBA,MAAMM,IAAI,CAACC,IAAI,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AAA,QAAAA,CAAAA,CAASC,GAAW,EAAA;YAClB,OAAOzB,MAAAA,CAAOwB,QAAQ,CAACC,GAAAA,CAAAA;AACzB,SAAA;;AAEA,QAAA,IAAIO,UAAa,CAAA,GAAA;YACf,OAAO;AACLL,gBAAAA,KAAAA,EAAO3B,MAAOgC,CAAAA,UAAU,CAACnB,GAAG,CAAC,mBAAA;AAC/B,aAAA;AACF;AACF,KAAA,CAAA;IAEA,OAAO;AACLoB,QAAAA,WAAAA,EAAaC,+BAAgClC,CAAAA,MAAAA,CAAAA;AAC7CC,QAAAA,YAAAA;QACAqB,QAAUD,EAAAA,SAAAA;QACVS,QAAUD,EAAAA;AACZ,KAAA;AACF;;;;"}
@@ -0,0 +1,13 @@
1
+ import type { Core, Struct } from '@strapi/types';
2
+ import type { FieldContentSourceMap } from '@strapi/admin/strapi-admin';
3
+ interface EncodingInfo {
4
+ data: any;
5
+ schema: Struct.Schema;
6
+ }
7
+ declare const createContentSourceMapsService: (strapi: Core.Strapi) => {
8
+ encodeField(text: string, { kind, model, documentId, type, path, locale }: FieldContentSourceMap): string;
9
+ encodeEntry({ data, schema }: EncodingInfo): Promise<any>;
10
+ encodeSourceMaps({ data, schema }: EncodingInfo): Promise<any>;
11
+ };
12
+ export { createContentSourceMapsService };
13
+ //# sourceMappingURL=content-source-maps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-source-maps.d.ts","sourceRoot":"","sources":["../../src/services/content-source-maps.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAO,MAAM,eAAe,CAAC;AAEvD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAwCxE,UAAU,YAAY;IACpB,IAAI,EAAE,GAAG,CAAC;IACV,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;CACvB;AAMD,QAAA,MAAM,8BAA8B,WAAY,KAAK,MAAM;sBAG/C,MAAM,mDACqC,qBAAqB;kCAyBpC,YAAY,GAAG,QAAQ,GAAG,CAAC;uCAiCtB,YAAY,GAAG,QAAQ,GAAG,CAAC;CAmBvE,CAAC;AAEF,OAAO,EAAE,8BAA8B,EAAE,CAAC"}