@strapi/core 0.0.0-experimental.b72ed8ba7907bf9b8b6e3eec77452255be58332e → 0.0.0-experimental.b7cfb5022f2343257445f9e7feb75c7465742c85

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 (39) hide show
  1. package/dist/Strapi.d.ts.map +1 -1
  2. package/dist/Strapi.js +2 -1
  3. package/dist/Strapi.js.map +1 -1
  4. package/dist/Strapi.mjs +2 -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/validation/attributes.d.ts +1 -1
  18. package/dist/core-api/routes/validation/utils.d.ts.map +1 -1
  19. package/dist/core-api/routes/validation/utils.js +22 -6
  20. package/dist/core-api/routes/validation/utils.js.map +1 -1
  21. package/dist/core-api/routes/validation/utils.mjs +22 -6
  22. package/dist/core-api/routes/validation/utils.mjs.map +1 -1
  23. package/dist/package.json.js +12 -11
  24. package/dist/package.json.js.map +1 -1
  25. package/dist/package.json.mjs +12 -11
  26. package/dist/package.json.mjs.map +1 -1
  27. package/dist/services/content-api/index.d.ts +1 -1
  28. package/dist/services/content-api/index.d.ts.map +1 -1
  29. package/dist/services/content-api/index.js +1 -1
  30. package/dist/services/content-api/index.js.map +1 -1
  31. package/dist/services/content-api/index.mjs +2 -2
  32. package/dist/services/content-api/index.mjs.map +1 -1
  33. package/dist/services/content-source-maps.d.ts +12 -0
  34. package/dist/services/content-source-maps.d.ts.map +1 -0
  35. package/dist/services/content-source-maps.js +84 -0
  36. package/dist/services/content-source-maps.js.map +1 -0
  37. package/dist/services/content-source-maps.mjs +82 -0
  38. package/dist/services/content-source-maps.mjs.map +1 -0
  39. package/package.json +12 -11
@@ -1,4 +1,5 @@
1
1
  import { isNil, isPlainObject } from 'lodash/fp';
2
+ import { async } from '@strapi/utils';
2
3
 
3
4
  function isEntry(property) {
4
5
  return property === null || isPlainObject(property) || Array.isArray(property);
@@ -6,8 +7,9 @@ function isEntry(property) {
6
7
  function isDZEntries(property) {
7
8
  return Array.isArray(property);
8
9
  }
9
- const transformResponse = (resource, meta = {}, opts = {
10
- useJsonAPIFormat: false
10
+ const transformResponse = async (resource, meta = {}, opts = {
11
+ useJsonAPIFormat: false,
12
+ encodeSourceMaps: false
11
13
  })=>{
12
14
  if (isNil(resource)) {
13
15
  return resource;
@@ -15,8 +17,16 @@ const transformResponse = (resource, meta = {}, opts = {
15
17
  if (!isPlainObject(resource) && !Array.isArray(resource)) {
16
18
  throw new Error('Entry must be an object or an array of objects');
17
19
  }
20
+ // Transform pipeline functions
21
+ const applyJsonApiFormat = async (data)=>opts.useJsonAPIFormat ? transformEntry(data, opts?.contentType) : data;
22
+ const applySourceMapEncoding = async (data)=>opts.encodeSourceMaps && opts.contentType ? strapi.get('content-source-maps').encodeSourceMaps({
23
+ data,
24
+ schema: opts.contentType
25
+ }) : data;
26
+ // Process data through transformation pipeline
27
+ const data = await async.pipe(applyJsonApiFormat, applySourceMapEncoding)(resource);
18
28
  return {
19
- data: opts.useJsonAPIFormat ? transformEntry(resource, opts?.contentType) : resource,
29
+ data,
20
30
  meta
21
31
  };
22
32
  };
@@ -1 +1 @@
1
- {"version":3,"file":"transform.mjs","sources":["../../../src/core-api/controller/transform.ts"],"sourcesContent":["import { isNil, isPlainObject } from 'lodash/fp';\nimport type { UID, Struct, Data } from '@strapi/types';\n\ntype TransformedEntry = {\n id: string;\n documentId?: Data.DocumentID | null;\n attributes: Record<string, unknown>;\n};\n\ntype TransformedComponent = {\n id: string;\n [key: string]: unknown;\n};\n\ntype Entry = {\n id: string;\n documentId: Data.DocumentID | null;\n [key: string]: Entry | Entry[] | string | number | null | boolean | Date;\n};\n\nfunction isEntry(property: unknown): property is Entry | Entry[] {\n return property === null || isPlainObject(property) || Array.isArray(property);\n}\n\nfunction isDZEntries(property: unknown): property is (Entry & { __component: UID.Component })[] {\n return Array.isArray(property);\n}\n\ninterface TransformOptions {\n contentType?: Struct.ContentTypeSchema | Struct.ComponentSchema;\n /**\n * @deprecated this option is deprecated and will be removed in the next major version\n */\n useJsonAPIFormat?: boolean;\n}\n\nconst transformResponse = (\n resource: any,\n meta: unknown = {},\n opts: TransformOptions = {\n useJsonAPIFormat: false,\n }\n) => {\n if (isNil(resource)) {\n return resource;\n }\n\n if (!isPlainObject(resource) && !Array.isArray(resource)) {\n throw new Error('Entry must be an object or an array of objects');\n }\n\n return {\n data: opts.useJsonAPIFormat ? transformEntry(resource, opts?.contentType) : resource,\n meta,\n };\n};\n\nfunction transformComponent<T extends Entry | Entry[] | null>(\n data: T,\n component: Struct.ComponentSchema\n): T extends Entry[] ? TransformedComponent[] : T extends Entry ? TransformedComponent : null;\nfunction transformComponent(\n data: Entry | Entry[] | null,\n component: Struct.ComponentSchema\n): TransformedComponent | TransformedComponent[] | null {\n if (Array.isArray(data)) {\n return data.map((datum) => transformComponent(datum, component));\n }\n\n const res = transformEntry(data, component);\n\n if (isNil(res)) {\n return res;\n }\n\n const { id, attributes } = res;\n return { id, ...attributes };\n}\n\nfunction transformEntry<T extends Entry | Entry[] | null>(\n entry: T,\n type?: Struct.Schema\n): T extends Entry[] ? TransformedEntry[] : T extends Entry ? TransformedEntry : null;\nfunction transformEntry(\n entry: Entry | Entry[] | null,\n type?: Struct.Schema\n): TransformedEntry | TransformedEntry[] | null {\n if (isNil(entry)) {\n return entry;\n }\n\n if (Array.isArray(entry)) {\n return entry.map((singleEntry) => transformEntry(singleEntry, type));\n }\n\n if (!isPlainObject(entry)) {\n throw new Error('Entry must be an object');\n }\n\n const { id, documentId, ...properties } = entry;\n\n const attributeValues: Record<string, unknown> = {};\n\n for (const key of Object.keys(properties)) {\n const property = properties[key];\n const attribute = type && type.attributes[key];\n\n if (attribute && attribute.type === 'relation' && isEntry(property) && 'target' in attribute) {\n const data = transformEntry(property, strapi.contentType(attribute.target));\n\n attributeValues[key] = { data };\n } else if (attribute && attribute.type === 'component' && isEntry(property)) {\n attributeValues[key] = transformComponent(property, strapi.components[attribute.component]);\n } else if (attribute && attribute.type === 'dynamiczone' && isDZEntries(property)) {\n if (isNil(property)) {\n attributeValues[key] = property;\n }\n\n attributeValues[key] = property.map((subProperty) => {\n return transformComponent(subProperty, strapi.components[subProperty.__component]);\n });\n } else if (attribute && attribute.type === 'media' && isEntry(property)) {\n const data = transformEntry(property, strapi.contentType('plugin::upload.file'));\n\n attributeValues[key] = { data };\n } else {\n attributeValues[key] = property;\n }\n }\n\n return {\n id,\n documentId,\n attributes: attributeValues,\n };\n}\n\nexport { transformResponse };\n"],"names":["isEntry","property","isPlainObject","Array","isArray","isDZEntries","transformResponse","resource","meta","opts","useJsonAPIFormat","isNil","Error","data","transformEntry","contentType","transformComponent","component","map","datum","res","id","attributes","entry","type","singleEntry","documentId","properties","attributeValues","key","Object","keys","attribute","strapi","target","components","subProperty","__component"],"mappings":";;AAoBA,SAASA,QAAQC,QAAiB,EAAA;AAChC,IAAA,OAAOA,aAAa,IAAQC,IAAAA,aAAAA,CAAcD,QAAaE,CAAAA,IAAAA,KAAAA,CAAMC,OAAO,CAACH,QAAAA,CAAAA;AACvE;AAEA,SAASI,YAAYJ,QAAiB,EAAA;IACpC,OAAOE,KAAAA,CAAMC,OAAO,CAACH,QAAAA,CAAAA;AACvB;AAUA,MAAMK,oBAAoB,CACxBC,QAAAA,EACAC,OAAgB,EAAE,EAClBC,IAAyB,GAAA;IACvBC,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A,GAAAA;AACnC,gBAAA,OAAOpB,mBAAmBoB,WAAaH,EAAAA,MAAAA,CAAOE,UAAU,CAACC,WAAAA,CAAYC,WAAW,CAAC,CAAA;AACnF,aAAA,CAAA;AACF,SAAA,MAAO,IAAIL,SAAaA,IAAAA,SAAAA,CAAUR,IAAI,KAAK,OAAA,IAAWxB,QAAQC,QAAW,CAAA,EAAA;AACvE,YAAA,MAAMY,IAAOC,GAAAA,cAAAA,CAAeb,QAAUgC,EAAAA,MAAAA,CAAOlB,WAAW,CAAC,qBAAA,CAAA,CAAA;YAEzDa,eAAe,CAACC,IAAI,GAAG;AAAEhB,gBAAAA;AAAK,aAAA;SACzB,MAAA;YACLe,eAAe,CAACC,IAAI,GAAG5B,QAAAA;AACzB;AACF;IAEA,OAAO;AACLoB,QAAAA,EAAAA;AACAK,QAAAA,UAAAA;QACAJ,UAAYM,EAAAA;AACd,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"transform.mjs","sources":["../../../src/core-api/controller/transform.ts"],"sourcesContent":["import { isNil, isPlainObject } from 'lodash/fp';\nimport type { UID, Struct, Data } from '@strapi/types';\nimport { async } from '@strapi/utils';\n\ntype TransformedEntry = {\n id: string;\n documentId?: Data.DocumentID | null;\n attributes: Record<string, unknown>;\n};\n\ntype TransformedComponent = {\n id: string;\n [key: string]: unknown;\n};\n\ntype Entry = {\n id: string;\n documentId: Data.DocumentID | null;\n [key: string]: Entry | Entry[] | string | number | null | boolean | Date;\n};\n\nfunction isEntry(property: unknown): property is Entry | Entry[] {\n return property === null || isPlainObject(property) || Array.isArray(property);\n}\n\nfunction isDZEntries(property: unknown): property is (Entry & { __component: UID.Component })[] {\n return Array.isArray(property);\n}\n\ninterface TransformOptions {\n contentType?: Struct.ContentTypeSchema | Struct.ComponentSchema;\n /**\n * @deprecated this option is deprecated and will be removed in the next major version\n */\n useJsonAPIFormat?: boolean;\n encodeSourceMaps?: boolean;\n}\n\nconst transformResponse = async (\n resource: any,\n meta: unknown = {},\n opts: TransformOptions = {\n useJsonAPIFormat: false,\n encodeSourceMaps: false,\n }\n) => {\n if (isNil(resource)) {\n return resource;\n }\n\n if (!isPlainObject(resource) && !Array.isArray(resource)) {\n throw new Error('Entry must be an object or an array of objects');\n }\n\n // Transform pipeline functions\n const applyJsonApiFormat = async (data: any) =>\n opts.useJsonAPIFormat ? transformEntry(data, opts?.contentType) : data;\n\n const applySourceMapEncoding = async (data: any) =>\n opts.encodeSourceMaps && opts.contentType\n ? strapi.get('content-source-maps').encodeSourceMaps({ data, schema: opts.contentType })\n : data;\n\n // Process data through transformation pipeline\n const data = await async.pipe(applyJsonApiFormat, applySourceMapEncoding)(resource);\n\n return {\n data,\n meta,\n };\n};\n\nfunction transformComponent<T extends Entry | Entry[] | null>(\n data: T,\n component: Struct.ComponentSchema\n): T extends Entry[] ? TransformedComponent[] : T extends Entry ? TransformedComponent : null;\nfunction transformComponent(\n data: Entry | Entry[] | null,\n component: Struct.ComponentSchema\n): TransformedComponent | TransformedComponent[] | null {\n if (Array.isArray(data)) {\n return data.map((datum) => transformComponent(datum, component));\n }\n\n const res = transformEntry(data, component);\n\n if (isNil(res)) {\n return res;\n }\n\n const { id, attributes } = res;\n return { id, ...attributes };\n}\n\nfunction transformEntry<T extends Entry | Entry[] | null>(\n entry: T,\n type?: Struct.Schema\n): T extends Entry[] ? TransformedEntry[] : T extends Entry ? TransformedEntry : null;\nfunction transformEntry(\n entry: Entry | Entry[] | null,\n type?: Struct.Schema\n): TransformedEntry | TransformedEntry[] | null {\n if (isNil(entry)) {\n return entry;\n }\n\n if (Array.isArray(entry)) {\n return entry.map((singleEntry) => transformEntry(singleEntry, type));\n }\n\n if (!isPlainObject(entry)) {\n throw new Error('Entry must be an object');\n }\n\n const { id, documentId, ...properties } = entry;\n\n const attributeValues: Record<string, unknown> = {};\n\n for (const key of Object.keys(properties)) {\n const property = properties[key];\n const attribute = type && type.attributes[key];\n\n if (attribute && attribute.type === 'relation' && isEntry(property) && 'target' in attribute) {\n const data = transformEntry(property, strapi.contentType(attribute.target));\n\n attributeValues[key] = { data };\n } else if (attribute && attribute.type === 'component' && isEntry(property)) {\n attributeValues[key] = transformComponent(property, strapi.components[attribute.component]);\n } else if (attribute && attribute.type === 'dynamiczone' && isDZEntries(property)) {\n if (isNil(property)) {\n attributeValues[key] = property;\n }\n\n attributeValues[key] = property.map((subProperty) => {\n return transformComponent(subProperty, strapi.components[subProperty.__component]);\n });\n } else if (attribute && attribute.type === 'media' && isEntry(property)) {\n const data = transformEntry(property, strapi.contentType('plugin::upload.file'));\n\n attributeValues[key] = { data };\n } else {\n attributeValues[key] = property;\n }\n }\n\n return {\n id,\n documentId,\n attributes: attributeValues,\n };\n}\n\nexport { transformResponse };\n"],"names":["isEntry","property","isPlainObject","Array","isArray","isDZEntries","transformResponse","resource","meta","opts","useJsonAPIFormat","encodeSourceMaps","isNil","Error","applyJsonApiFormat","data","transformEntry","contentType","applySourceMapEncoding","strapi","get","schema","async","pipe","transformComponent","component","map","datum","res","id","attributes","entry","type","singleEntry","documentId","properties","attributeValues","key","Object","keys","attribute","target","components","subProperty","__component"],"mappings":";;;AAqBA,SAASA,QAAQC,QAAiB,EAAA;AAChC,IAAA,OAAOA,aAAa,IAAQC,IAAAA,aAAAA,CAAcD,QAAaE,CAAAA,IAAAA,KAAAA,CAAMC,OAAO,CAACH,QAAAA,CAAAA;AACvE;AAEA,SAASI,YAAYJ,QAAiB,EAAA;IACpC,OAAOE,KAAAA,CAAMC,OAAO,CAACH,QAAAA,CAAAA;AACvB;AAWA,MAAMK,oBAAoB,OACxBC,QAAAA,EACAC,OAAgB,EAAE,EAClBC,IAAyB,GAAA;IACvBC,gBAAkB,EAAA,KAAA;IAClBC,gBAAkB,EAAA;AACpB,CAAC,GAAA;AAED,IAAA,IAAIC,MAAML,QAAW,CAAA,EAAA;QACnB,OAAOA,QAAAA;AACT;AAEA,IAAA,IAAI,CAACL,aAAcK,CAAAA,QAAAA,CAAAA,IAAa,CAACJ,KAAMC,CAAAA,O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,SAAaA,IAAAA,SAAAA,CAAUR,IAAI,KAAK,aAAA,IAAiB3B,YAAYJ,QAAW,CAAA,EAAA;AACjF,YAAA,IAAIW,MAAMX,QAAW,CAAA,EAAA;gBACnBmC,eAAe,CAACC,IAAI,GAAGpC,QAAAA;AACzB;AAEAmC,YAAAA,eAAe,CAACC,GAAI,CAAA,GAAGpC,QAASyB,CAAAA,GAAG,CAAC,CAACiB,WAAAA,GAAAA;AACnC,gBAAA,OAAOnB,mBAAmBmB,WAAaxB,EAAAA,MAAAA,CAAOuB,UAAU,CAACC,WAAAA,CAAYC,WAAW,CAAC,CAAA;AACnF,aAAA,CAAA;AACF,SAAA,MAAO,IAAIJ,SAAaA,IAAAA,SAAAA,CAAUR,IAAI,KAAK,OAAA,IAAWhC,QAAQC,QAAW,CAAA,EAAA;AACvE,YAAA,MAAMc,IAAOC,GAAAA,cAAAA,CAAef,QAAUkB,EAAAA,MAAAA,CAAOF,WAAW,CAAC,qBAAA,CAAA,CAAA;YAEzDmB,eAAe,CAACC,IAAI,GAAG;AAAEtB,gBAAAA;AAAK,aAAA;SACzB,MAAA;YACLqB,eAAe,CAACC,IAAI,GAAGpC,QAAAA;AACzB;AACF;IAEA,OAAO;AACL4B,QAAAA,EAAAA;AACAK,QAAAA,UAAAA;QACAJ,UAAYM,EAAAA;AACd,KAAA;AACF;;;;"}
@@ -136,10 +136,10 @@ export declare const blocksToInputSchema: () => z.ZodArray<z.ZodAny>;
136
136
  * @returns A Zod schema for input validation of the boolean field.
137
137
  */
138
138
  export declare const booleanToInputSchema: (attribute: Schema.Attribute.Boolean) => z.ZodEnum<{
139
+ true: "true";
139
140
  0: "0";
140
141
  t: "t";
141
142
  1: "1";
142
- true: "true";
143
143
  f: "f";
144
144
  false: "false";
145
145
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/core-api/routes/validation/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,OAAQ,SAAS,GAAG,CAAC,MAAM,UAAU,EAAE,OAAO,SAsB/E,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,kBAAkB,OAAQ,SAAS,GAAG,CAAC,MAAM,YAAY,MAAM,EAAE,OAAO,kFAmCpF,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/core-api/routes/validation/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAI5B;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,OAAQ,SAAS,GAAG,CAAC,MAAM,UAAU,EAAE,OAAO,SAyB/E,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,kBAAkB,OAAQ,SAAS,GAAG,CAAC,MAAM,YAAY,MAAM,EAAE,OAAO,kFA0DpF,CAAC"}
@@ -22,6 +22,7 @@ function _interopNamespaceDefault(e) {
22
22
 
23
23
  var z__namespace = /*#__PURE__*/_interopNamespaceDefault(z);
24
24
 
25
+ // Schema generation happens on-demand when schemas don't exist in the registry
25
26
  /**
26
27
  * Safely adds or updates a schema in Zod's global registry.
27
28
  *
@@ -39,13 +40,13 @@ var z__namespace = /*#__PURE__*/_interopNamespaceDefault(z);
39
40
  try {
40
41
  const { _idmap: idMap } = z__namespace.globalRegistry;
41
42
  const transformedId = strapiUtils.transformUidToValidOpenApiName(id);
42
- if (idMap.has(transformedId)) {
43
+ const isReplacing = idMap.has(transformedId);
44
+ if (isReplacing) {
43
45
  // Remove existing schema to prevent conflicts
44
- strapi.log.debug(`Removing existing schema ${transformedId} from registry`);
45
46
  idMap.delete(transformedId);
46
47
  }
47
48
  // Register the new schema with the transformed ID
48
- strapi.log.debug(`Registering schema ${transformedId} in global registry`);
49
+ strapi.log.debug(`${isReplacing ? 'Replacing' : 'Registering'} schema ${transformedId} in global registry`);
49
50
  z__namespace.globalRegistry.add(schema, {
50
51
  id: transformedId
51
52
  });
@@ -88,10 +89,20 @@ var z__namespace = /*#__PURE__*/_interopNamespaceDefault(z);
88
89
  // Return existing schema if already registered
89
90
  const mapItem = idMap.get(transformedId);
90
91
  if (mapItem) {
91
- strapi.log.debug(`Schema ${transformedId} found in registry, returning existing schema`);
92
+ // Schema already exists, return it silently
92
93
  return mapItem;
93
94
  }
94
- strapi.log.warn(`Schema ${transformedId} not found in global registry, creating an any placeholder`);
95
+ strapi.log.debug(`Schema ${transformedId} not found in registry, generating new schema`);
96
+ // Determine if this is a built-in schema or user content
97
+ const isBuiltInSchema = id.startsWith('plugin::') || id.startsWith('admin');
98
+ if (isBuiltInSchema) {
99
+ // Built-in schemas keep at debug level to avoid clutter
100
+ strapi.log.debug(`Initializing validation schema for ${transformedId}`);
101
+ } else {
102
+ // User content
103
+ const schemaName = transformedId.replace('Document', '').replace('Entry', '').replace(/([A-Z])/g, ' $1').trim();
104
+ strapi.log.debug(`📝 Generating validation schema for "${schemaName}"`);
105
+ }
95
106
  // Temporary any placeholder before replacing with the actual schema type
96
107
  // Used to prevent infinite loops in cyclical data structures
97
108
  safeGlobalRegistrySet(id, z__namespace.any());
@@ -99,7 +110,12 @@ var z__namespace = /*#__PURE__*/_interopNamespaceDefault(z);
99
110
  const schema = callback();
100
111
  // Replace the placeholder with the real schema
101
112
  safeGlobalRegistrySet(id, schema);
102
- strapi.log.debug(`Schema ${transformedId} successfully created and registered`);
113
+ // Show completion for user content only
114
+ if (!isBuiltInSchema) {
115
+ const fieldCount = Object.keys(schema?._def?.shape || {}).length || 0;
116
+ const schemaName = transformedId.replace('Document', '').replace('Entry', '').replace(/([A-Z])/g, ' $1').trim();
117
+ strapi.log.debug(` ✅ "${schemaName}" schema created with ${fieldCount} fields`);
118
+ }
103
119
  return schema;
104
120
  } catch (error) {
105
121
  strapi.log.error(`Schema creation failed: Failed to create schema ${id}`);
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../src/core-api/routes/validation/utils.ts"],"sourcesContent":["import { transformUidToValidOpenApiName } from '@strapi/utils';\nimport type { Internal } from '@strapi/types';\nimport * as z from 'zod/v4';\n\n/**\n * Safely adds or updates a schema in Zod's global registry.\n *\n * If a schema with the given `id` already exists, it will be removed before adding the new one.\n *\n * This is useful for hot-reloading or preventing issues with cyclical dependencies.\n *\n * @param id - The unique identifier for the schema in the global registry.\n * @param schema - The Zod schema to register.\n * @example\n * ```typescript\n * safeGlobalRegistrySet(\"mySchema\", z.object({ name: z.string() }));\n * ```\n */\nexport const safeGlobalRegistrySet = (id: Internal.UID.Schema, schema: z.ZodType) => {\n try {\n const { _idmap: idMap } = z.globalRegistry;\n\n const transformedId = transformUidToValidOpenApiName(id);\n\n if (idMap.has(transformedId)) {\n // Remove existing schema to prevent conflicts\n strapi.log.debug(`Removing existing schema ${transformedId} from registry`);\n idMap.delete(transformedId);\n }\n\n // Register the new schema with the transformed ID\n strapi.log.debug(`Registering schema ${transformedId} in global registry`);\n z.globalRegistry.add(schema, { id: transformedId });\n } catch (error) {\n strapi.log.error(\n `Schema registration failed: Failed to register schema ${id} in global registry`\n );\n\n throw error;\n }\n};\n\n/**\n * Safely creates and registers a Zod schema in the global registry, particularly useful for handling cyclical data structures.\n *\n * If a schema with the given `id` already exists in the global registry, it returns the existing schema.\n *\n * Otherwise, it registers a temporary `z.any()` schema, calls the provided `callback` to create the actual schema,\n * and then replaces the temporary schema with the actual one in the registry.\n *\n * This prevents infinite loops in cases of cyclical dependencies.\n *\n * @param id - The unique identifier for the schema in the global registry.\n * @param callback - A function that returns the Zod schema to be created and registered.\n * @returns The created or retrieved Zod schema.\n * @example\n * ```typescript\n * const CategorySchema = safeSchemaCreation(\"Category\", () =>\n * z.object({\n * name: z.string(),\n * products: z.array(safeSchemaCreation(\"Product\", () =>\n * z.object({\n * name: z.string(),\n * category: z.lazy(() => CategorySchema) // Cyclical reference\n * })\n * ))\n * })\n * );\n * ```\n */\nexport const safeSchemaCreation = (id: Internal.UID.Schema, callback: () => z.ZodType) => {\n try {\n const { _idmap: idMap } = z.globalRegistry;\n\n const transformedId = transformUidToValidOpenApiName(id);\n\n // Return existing schema if already registered\n const mapItem = idMap.get(transformedId);\n if (mapItem) {\n strapi.log.debug(`Schema ${transformedId} found in registry, returning existing schema`);\n return mapItem;\n }\n\n strapi.log.warn(\n `Schema ${transformedId} not found in global registry, creating an any placeholder`\n );\n\n // Temporary any placeholder before replacing with the actual schema type\n // Used to prevent infinite loops in cyclical data structures\n safeGlobalRegistrySet(id, z.any());\n\n // Generate the actual schema using the callback\n const schema = callback();\n\n // Replace the placeholder with the real schema\n safeGlobalRegistrySet(id, schema);\n\n strapi.log.debug(`Schema ${transformedId} successfully created and registered`);\n\n return schema;\n } catch (error) {\n strapi.log.error(`Schema creation failed: Failed to create schema ${id}`);\n\n throw error;\n }\n};\n"],"names":["safeGlobalRegistrySet","id","schema","_idmap","idMap","z","globalRegistry","transformedId","transformUidToValidOpenApiName","has","strapi","log","debug","delete","add","error","safeSchemaCreation","callback","mapItem","get","warn","any"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAIA;;;;;;;;;;;;;AAaC,IACM,MAAMA,qBAAwB,GAAA,CAACC,EAAyBC,EAAAA,MAAAA,GAAAA;IAC7D,IAAI;AACF,QAAA,MAAM,EAAEC,MAAQC,EAAAA,KAAK,EAAE,GAAGC,aAAEC,cAAc;AAE1C,QAAA,MAAMC,gBAAgBC,0CAA+BP,CAAAA,EAAAA,CAAAA;QAErD,IAAIG,KAAAA,CAAMK,GAAG,CAACF,aAAgB,CAAA,EAAA;;YAE5BG,MAAOC,CAAAA,GAAG,CAACC,KAAK,CAAC,CAAC,yBAAyB,EAAEL,aAAc,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OC,CAAAA,GAAG,CAACC,KAAK,CAAC,CAAC,OAAO,EAAEL,aAAc,CAAA,oCAAoC,CAAC,CAAA;QAE9E,OAAOL,MAAAA;AACT,KAAA,CAAE,OAAOa,KAAO,EAAA;QACdL,MAAOC,CAAAA,GAAG,CAACI,KAAK,CAAC,CAAC,gDAAgD,EAAEd,GAAG,CAAC,CAAA;QAExE,MAAMc,KAAAA;AACR;AACF;;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../src/core-api/routes/validation/utils.ts"],"sourcesContent":["import { transformUidToValidOpenApiName } from '@strapi/utils';\nimport type { Internal } from '@strapi/types';\nimport * as z from 'zod/v4';\n\n// Schema generation happens on-demand when schemas don't exist in the registry\n\n/**\n * Safely adds or updates a schema in Zod's global registry.\n *\n * If a schema with the given `id` already exists, it will be removed before adding the new one.\n *\n * This is useful for hot-reloading or preventing issues with cyclical dependencies.\n *\n * @param id - The unique identifier for the schema in the global registry.\n * @param schema - The Zod schema to register.\n * @example\n * ```typescript\n * safeGlobalRegistrySet(\"mySchema\", z.object({ name: z.string() }));\n * ```\n */\nexport const safeGlobalRegistrySet = (id: Internal.UID.Schema, schema: z.ZodType) => {\n try {\n const { _idmap: idMap } = z.globalRegistry;\n\n const transformedId = transformUidToValidOpenApiName(id);\n\n const isReplacing = idMap.has(transformedId);\n\n if (isReplacing) {\n // Remove existing schema to prevent conflicts\n idMap.delete(transformedId);\n }\n\n // Register the new schema with the transformed ID\n strapi.log.debug(\n `${isReplacing ? 'Replacing' : 'Registering'} schema ${transformedId} in global registry`\n );\n z.globalRegistry.add(schema, { id: transformedId });\n } catch (error) {\n strapi.log.error(\n `Schema registration failed: Failed to register schema ${id} in global registry`\n );\n\n throw error;\n }\n};\n\n/**\n * Safely creates and registers a Zod schema in the global registry, particularly useful for handling cyclical data structures.\n *\n * If a schema with the given `id` already exists in the global registry, it returns the existing schema.\n *\n * Otherwise, it registers a temporary `z.any()` schema, calls the provided `callback` to create the actual schema,\n * and then replaces the temporary schema with the actual one in the registry.\n *\n * This prevents infinite loops in cases of cyclical dependencies.\n *\n * @param id - The unique identifier for the schema in the global registry.\n * @param callback - A function that returns the Zod schema to be created and registered.\n * @returns The created or retrieved Zod schema.\n * @example\n * ```typescript\n * const CategorySchema = safeSchemaCreation(\"Category\", () =>\n * z.object({\n * name: z.string(),\n * products: z.array(safeSchemaCreation(\"Product\", () =>\n * z.object({\n * name: z.string(),\n * category: z.lazy(() => CategorySchema) // Cyclical reference\n * })\n * ))\n * })\n * );\n * ```\n */\nexport const safeSchemaCreation = (id: Internal.UID.Schema, callback: () => z.ZodType) => {\n try {\n const { _idmap: idMap } = z.globalRegistry;\n\n const transformedId = transformUidToValidOpenApiName(id);\n\n // Return existing schema if already registered\n const mapItem = idMap.get(transformedId);\n if (mapItem) {\n // Schema already exists, return it silently\n return mapItem;\n }\n\n strapi.log.debug(`Schema ${transformedId} not found in registry, generating new schema`);\n\n // Determine if this is a built-in schema or user content\n const isBuiltInSchema = id.startsWith('plugin::') || id.startsWith('admin');\n\n if (isBuiltInSchema) {\n // Built-in schemas keep at debug level to avoid clutter\n strapi.log.debug(`Initializing validation schema for ${transformedId}`);\n } else {\n // User content\n const schemaName = transformedId\n .replace('Document', '')\n .replace('Entry', '')\n .replace(/([A-Z])/g, ' $1')\n .trim();\n strapi.log.debug(`📝 Generating validation schema for \"${schemaName}\"`);\n }\n\n // Temporary any placeholder before replacing with the actual schema type\n // Used to prevent infinite loops in cyclical data structures\n safeGlobalRegistrySet(id, z.any());\n\n // Generate the actual schema using the callback\n const schema = callback();\n\n // Replace the placeholder with the real schema\n safeGlobalRegistrySet(id, schema);\n\n // Show completion for user content only\n if (!isBuiltInSchema) {\n const fieldCount = Object.keys((schema as any)?._def?.shape || {}).length || 0;\n const schemaName = transformedId\n .replace('Document', '')\n .replace('Entry', '')\n .replace(/([A-Z])/g, ' $1')\n .trim();\n strapi.log.debug(` \"${schemaName}\" schema created with ${fieldCount} fields`);\n }\n\n return schema;\n } catch (error) {\n strapi.log.error(`Schema creation failed: Failed to create schema ${id}`);\n\n throw error;\n }\n};\n"],"names":["safeGlobalRegistrySet","id","schema","_idmap","idMap","z","globalRegistry","transformedId","transformUidToValidOpenApiName","isReplacing","has","delete","strapi","log","debug","add","error","safeSchemaCreation","callback","mapItem","get","isBuiltInSchema","startsWith","schemaName","replace","trim","any","fieldCount","Object","keys","_def","shape","length"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAIA;AAEA;;;;;;;;;;;;;AAaC,IACM,MAAMA,qBAAwB,GAAA,CAACC,EAAyBC,EAAAA,MAAAA,GAAAA;IAC7D,IAAI;AACF,QAAA,MAAM,EAAEC,MAAQC,EAAAA,KAAK,EAAE,GAAGC,aAAEC,cAAc;AAE1C,QAAA,MAAMC,gBAAgBC,0CAA+BP,CAAAA,EAAAA,CAAAA;QAErD,MAAMQ,WAAAA,GAAcL,KAAMM,CAAAA,GAAG,CAACH,aAAAA,CAAAA;AAE9B,QAAA,IAAIE,WAAa,EAAA;;AAEfL,YAAAA,KAAAA,CAAMO,MAAM,CAACJ,aAAAA,CAAAA;AACf;;AAGAK,QAAAA,MAAAA,CAAOC,GAAG,CAACC,KAAK,CACd,CAAC,EAAEL,WAAc,GAAA,WAAA,GAAc,aAAc,CAAA,QAAQ,EAAEF,aAAAA,CAAc,mBAAmB,CAAC,CAAA;AAE3FF,QAAAA,YAAAA,CAAEC,cAAc,CAACS,GAAG,CAACb,MAAQ,EAAA;YAAED,EAAIM,EAAAA;AAAc,SAAA,CAAA;AACnD,KAAA,CAAE,OAAOS,KAAO,EAAA;QACdJ,MAAOC,CAAAA,GAAG,CAACG,KAAK,CACd,CAAC,sDAAsD,EAAEf,EAAG,CAAA,mBAAmB,CAAC,CAAA;QAGlF,MAAMe,KAAAA;AACR;AACF;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BC,IACM,MAAMC,kBAAqB,GAAA,CAAChB,EAAyBiB,EAAAA,QAAAA,GAAAA;IAC1D,IAAI;AACF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AAA,MAAM,IAAI,CAAA;AAC7E,YAAA,MAAMT,UAAahB,GAAAA,aAAAA,CAChBiB,OAAO,CAAC,YAAY,EACpBA,CAAAA,CAAAA,OAAO,CAAC,OAAA,EAAS,EACjBA,CAAAA,CAAAA,OAAO,CAAC,UAAA,EAAY,OACpBC,IAAI,EAAA;AACPb,YAAAA,MAAAA,CAAOC,GAAG,CAACC,KAAK,CAAC,CAAC,MAAM,EAAES,UAAAA,CAAW,sBAAsB,EAAEI,UAAW,CAAA,OAAO,CAAC,CAAA;AAClF;QAEA,OAAOzB,MAAAA;AACT,KAAA,CAAE,OAAOc,KAAO,EAAA;QACdJ,MAAOC,CAAAA,GAAG,CAACG,KAAK,CAAC,CAAC,gDAAgD,EAAEf,GAAG,CAAC,CAAA;QAExE,MAAMe,KAAAA;AACR;AACF;;;;;"}
@@ -1,6 +1,7 @@
1
1
  import { transformUidToValidOpenApiName } from '@strapi/utils';
2
2
  import * as z from 'zod/v4';
3
3
 
4
+ // Schema generation happens on-demand when schemas don't exist in the registry
4
5
  /**
5
6
  * Safely adds or updates a schema in Zod's global registry.
6
7
  *
@@ -18,13 +19,13 @@ import * as z from 'zod/v4';
18
19
  try {
19
20
  const { _idmap: idMap } = z.globalRegistry;
20
21
  const transformedId = transformUidToValidOpenApiName(id);
21
- if (idMap.has(transformedId)) {
22
+ const isReplacing = idMap.has(transformedId);
23
+ if (isReplacing) {
22
24
  // Remove existing schema to prevent conflicts
23
- strapi.log.debug(`Removing existing schema ${transformedId} from registry`);
24
25
  idMap.delete(transformedId);
25
26
  }
26
27
  // Register the new schema with the transformed ID
27
- strapi.log.debug(`Registering schema ${transformedId} in global registry`);
28
+ strapi.log.debug(`${isReplacing ? 'Replacing' : 'Registering'} schema ${transformedId} in global registry`);
28
29
  z.globalRegistry.add(schema, {
29
30
  id: transformedId
30
31
  });
@@ -67,10 +68,20 @@ import * as z from 'zod/v4';
67
68
  // Return existing schema if already registered
68
69
  const mapItem = idMap.get(transformedId);
69
70
  if (mapItem) {
70
- strapi.log.debug(`Schema ${transformedId} found in registry, returning existing schema`);
71
+ // Schema already exists, return it silently
71
72
  return mapItem;
72
73
  }
73
- strapi.log.warn(`Schema ${transformedId} not found in global registry, creating an any placeholder`);
74
+ strapi.log.debug(`Schema ${transformedId} not found in registry, generating new schema`);
75
+ // Determine if this is a built-in schema or user content
76
+ const isBuiltInSchema = id.startsWith('plugin::') || id.startsWith('admin');
77
+ if (isBuiltInSchema) {
78
+ // Built-in schemas keep at debug level to avoid clutter
79
+ strapi.log.debug(`Initializing validation schema for ${transformedId}`);
80
+ } else {
81
+ // User content
82
+ const schemaName = transformedId.replace('Document', '').replace('Entry', '').replace(/([A-Z])/g, ' $1').trim();
83
+ strapi.log.debug(`📝 Generating validation schema for "${schemaName}"`);
84
+ }
74
85
  // Temporary any placeholder before replacing with the actual schema type
75
86
  // Used to prevent infinite loops in cyclical data structures
76
87
  safeGlobalRegistrySet(id, z.any());
@@ -78,7 +89,12 @@ import * as z from 'zod/v4';
78
89
  const schema = callback();
79
90
  // Replace the placeholder with the real schema
80
91
  safeGlobalRegistrySet(id, schema);
81
- strapi.log.debug(`Schema ${transformedId} successfully created and registered`);
92
+ // Show completion for user content only
93
+ if (!isBuiltInSchema) {
94
+ const fieldCount = Object.keys(schema?._def?.shape || {}).length || 0;
95
+ const schemaName = transformedId.replace('Document', '').replace('Entry', '').replace(/([A-Z])/g, ' $1').trim();
96
+ strapi.log.debug(` ✅ "${schemaName}" schema created with ${fieldCount} fields`);
97
+ }
82
98
  return schema;
83
99
  } catch (error) {
84
100
  strapi.log.error(`Schema creation failed: Failed to create schema ${id}`);
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","sources":["../../../../src/core-api/routes/validation/utils.ts"],"sourcesContent":["import { transformUidToValidOpenApiName } from '@strapi/utils';\nimport type { Internal } from '@strapi/types';\nimport * as z from 'zod/v4';\n\n/**\n * Safely adds or updates a schema in Zod's global registry.\n *\n * If a schema with the given `id` already exists, it will be removed before adding the new one.\n *\n * This is useful for hot-reloading or preventing issues with cyclical dependencies.\n *\n * @param id - The unique identifier for the schema in the global registry.\n * @param schema - The Zod schema to register.\n * @example\n * ```typescript\n * safeGlobalRegistrySet(\"mySchema\", z.object({ name: z.string() }));\n * ```\n */\nexport const safeGlobalRegistrySet = (id: Internal.UID.Schema, schema: z.ZodType) => {\n try {\n const { _idmap: idMap } = z.globalRegistry;\n\n const transformedId = transformUidToValidOpenApiName(id);\n\n if (idMap.has(transformedId)) {\n // Remove existing schema to prevent conflicts\n strapi.log.debug(`Removing existing schema ${transformedId} from registry`);\n idMap.delete(transformedId);\n }\n\n // Register the new schema with the transformed ID\n strapi.log.debug(`Registering schema ${transformedId} in global registry`);\n z.globalRegistry.add(schema, { id: transformedId });\n } catch (error) {\n strapi.log.error(\n `Schema registration failed: Failed to register schema ${id} in global registry`\n );\n\n throw error;\n }\n};\n\n/**\n * Safely creates and registers a Zod schema in the global registry, particularly useful for handling cyclical data structures.\n *\n * If a schema with the given `id` already exists in the global registry, it returns the existing schema.\n *\n * Otherwise, it registers a temporary `z.any()` schema, calls the provided `callback` to create the actual schema,\n * and then replaces the temporary schema with the actual one in the registry.\n *\n * This prevents infinite loops in cases of cyclical dependencies.\n *\n * @param id - The unique identifier for the schema in the global registry.\n * @param callback - A function that returns the Zod schema to be created and registered.\n * @returns The created or retrieved Zod schema.\n * @example\n * ```typescript\n * const CategorySchema = safeSchemaCreation(\"Category\", () =>\n * z.object({\n * name: z.string(),\n * products: z.array(safeSchemaCreation(\"Product\", () =>\n * z.object({\n * name: z.string(),\n * category: z.lazy(() => CategorySchema) // Cyclical reference\n * })\n * ))\n * })\n * );\n * ```\n */\nexport const safeSchemaCreation = (id: Internal.UID.Schema, callback: () => z.ZodType) => {\n try {\n const { _idmap: idMap } = z.globalRegistry;\n\n const transformedId = transformUidToValidOpenApiName(id);\n\n // Return existing schema if already registered\n const mapItem = idMap.get(transformedId);\n if (mapItem) {\n strapi.log.debug(`Schema ${transformedId} found in registry, returning existing schema`);\n return mapItem;\n }\n\n strapi.log.warn(\n `Schema ${transformedId} not found in global registry, creating an any placeholder`\n );\n\n // Temporary any placeholder before replacing with the actual schema type\n // Used to prevent infinite loops in cyclical data structures\n safeGlobalRegistrySet(id, z.any());\n\n // Generate the actual schema using the callback\n const schema = callback();\n\n // Replace the placeholder with the real schema\n safeGlobalRegistrySet(id, schema);\n\n strapi.log.debug(`Schema ${transformedId} successfully created and registered`);\n\n return schema;\n } catch (error) {\n strapi.log.error(`Schema creation failed: Failed to create schema ${id}`);\n\n throw error;\n }\n};\n"],"names":["safeGlobalRegistrySet","id","schema","_idmap","idMap","z","globalRegistry","transformedId","transformUidToValidOpenApiName","has","strapi","log","debug","delete","add","error","safeSchemaCreation","callback","mapItem","get","warn","any"],"mappings":";;;AAIA;;;;;;;;;;;;;AAaC,IACM,MAAMA,qBAAwB,GAAA,CAACC,EAAyBC,EAAAA,MAAAA,GAAAA;IAC7D,IAAI;AACF,QAAA,MAAM,EAAEC,MAAQC,EAAAA,KAAK,EAAE,GAAGC,EAAEC,cAAc;AAE1C,QAAA,MAAMC,gBAAgBC,8BAA+BP,CAAAA,EAAAA,CAAAA;QAErD,IAAIG,KAAAA,CAAMK,GAAG,CAACF,aAAgB,CAAA,EAAA;;YAE5BG,MAAOC,CAAAA,GAAG,CAACC,KAAK,CAAC,CAAC,yBAAyB,EAAEL,aAAc,CAAA,cAAc,CAAC,CAAA;AAC1EH,YAAAA,KAAAA,CAAMS,MAAM,CAACN,aAAAA,CAAAA;AACf;;QAGAG,MAAOC,CAAAA,GAAG,CAACC,KAAK,CAAC,CAAC,mBAAmB,EAAEL,aAAc,CAAA,mBAAmB,CAAC,CAAA;AACzEF,QAAAA,CAAAA,CAAEC,cAAc,CAACQ,GAAG,CAACZ,MAAQ,EAAA;YAAED,EAAIM,EAAAA;AAAc,SAAA,CAAA;AACnD,KAAA,CAAE,OAAOQ,KAAO,EAAA;QACdL,MAAOC,CAAAA,GAAG,CAACI,KAAK,CACd,CAAC,sDAAsD,EAAEd,EAAG,CAAA,mBAAmB,CAAC,CAAA;QAGlF,MAAMc,KAAAA;AACR;AACF;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BC,IACM,MAAMC,kBAAqB,GAAA,CAACf,EAAyBgB,EAAAA,QAAAA,GAAAA;IAC1D,IAAI;AACF,QAAA,MAAM,EAAEd,MAAQC,EAAAA,KAAK,EAAE,GAAGC,EAAEC,cAAc;AAE1C,QAAA,MAAMC,gBAAgBC,8BAA+BP,CAAAA,EAAAA,CAAAA;;QAGrD,MAAMiB,OAAAA,GAAUd,KAAMe,CAAAA,GAAG,CAACZ,aAAAA,CAAAA;AAC1B,QAAA,IAAIW,OAAS,EAAA;YACXR,MAAOC,CAAAA,GAAG,CAACC,KAAK,CAAC,CAAC,OAAO,EAAEL,aAAc,CAAA,6CAA6C,CAAC,CAAA;YACvF,OAAOW,OAAAA;AACT;QAEAR,MAAOC,CAAAA,GAAG,CAACS,IAAI,CACb,CAAC,OAAO,EAAEb,aAAc,CAAA,0DAA0D,CAAC,CAAA;;;QAKrFP,qBAAsBC,CAAAA,EAAAA,EAAII,EAAEgB,GAAG,EAAA,CAAA;;AAG/B,QAAA,MAAMnB,MAASe,GAAAA,QAAAA,EAAAA;;AAGfjB,QAAAA,qBAAAA,CAAsBC,EAAIC,EAAAA,MAAAA,CAAAA;QAE1BQ,MAAOC,CAAAA,GAAG,CAACC,KAAK,CAAC,CAAC,OAAO,EAAEL,aAAc,CAAA,oCAAoC,CAAC,CAAA;QAE9E,OAAOL,MAAAA;AACT,KAAA,CAAE,OAAOa,KAAO,EAAA;QACdL,MAAOC,CAAAA,GAAG,CAACI,KAAK,CAAC,CAAC,gDAAgD,EAAEd,GAAG,CAAC,CAAA;QAExE,MAAMc,KAAAA;AACR;AACF;;;;"}
1
+ {"version":3,"file":"utils.mjs","sources":["../../../../src/core-api/routes/validation/utils.ts"],"sourcesContent":["import { transformUidToValidOpenApiName } from '@strapi/utils';\nimport type { Internal } from '@strapi/types';\nimport * as z from 'zod/v4';\n\n// Schema generation happens on-demand when schemas don't exist in the registry\n\n/**\n * Safely adds or updates a schema in Zod's global registry.\n *\n * If a schema with the given `id` already exists, it will be removed before adding the new one.\n *\n * This is useful for hot-reloading or preventing issues with cyclical dependencies.\n *\n * @param id - The unique identifier for the schema in the global registry.\n * @param schema - The Zod schema to register.\n * @example\n * ```typescript\n * safeGlobalRegistrySet(\"mySchema\", z.object({ name: z.string() }));\n * ```\n */\nexport const safeGlobalRegistrySet = (id: Internal.UID.Schema, schema: z.ZodType) => {\n try {\n const { _idmap: idMap } = z.globalRegistry;\n\n const transformedId = transformUidToValidOpenApiName(id);\n\n const isReplacing = idMap.has(transformedId);\n\n if (isReplacing) {\n // Remove existing schema to prevent conflicts\n idMap.delete(transformedId);\n }\n\n // Register the new schema with the transformed ID\n strapi.log.debug(\n `${isReplacing ? 'Replacing' : 'Registering'} schema ${transformedId} in global registry`\n );\n z.globalRegistry.add(schema, { id: transformedId });\n } catch (error) {\n strapi.log.error(\n `Schema registration failed: Failed to register schema ${id} in global registry`\n );\n\n throw error;\n }\n};\n\n/**\n * Safely creates and registers a Zod schema in the global registry, particularly useful for handling cyclical data structures.\n *\n * If a schema with the given `id` already exists in the global registry, it returns the existing schema.\n *\n * Otherwise, it registers a temporary `z.any()` schema, calls the provided `callback` to create the actual schema,\n * and then replaces the temporary schema with the actual one in the registry.\n *\n * This prevents infinite loops in cases of cyclical dependencies.\n *\n * @param id - The unique identifier for the schema in the global registry.\n * @param callback - A function that returns the Zod schema to be created and registered.\n * @returns The created or retrieved Zod schema.\n * @example\n * ```typescript\n * const CategorySchema = safeSchemaCreation(\"Category\", () =>\n * z.object({\n * name: z.string(),\n * products: z.array(safeSchemaCreation(\"Product\", () =>\n * z.object({\n * name: z.string(),\n * category: z.lazy(() => CategorySchema) // Cyclical reference\n * })\n * ))\n * })\n * );\n * ```\n */\nexport const safeSchemaCreation = (id: Internal.UID.Schema, callback: () => z.ZodType) => {\n try {\n const { _idmap: idMap } = z.globalRegistry;\n\n const transformedId = transformUidToValidOpenApiName(id);\n\n // Return existing schema if already registered\n const mapItem = idMap.get(transformedId);\n if (mapItem) {\n // Schema already exists, return it silently\n return mapItem;\n }\n\n strapi.log.debug(`Schema ${transformedId} not found in registry, generating new schema`);\n\n // Determine if this is a built-in schema or user content\n const isBuiltInSchema = id.startsWith('plugin::') || id.startsWith('admin');\n\n if (isBuiltInSchema) {\n // Built-in schemas keep at debug level to avoid clutter\n strapi.log.debug(`Initializing validation schema for ${transformedId}`);\n } else {\n // User content\n const schemaName = transformedId\n .replace('Document', '')\n .replace('Entry', '')\n .replace(/([A-Z])/g, ' $1')\n .trim();\n strapi.log.debug(`📝 Generating validation schema for \"${schemaName}\"`);\n }\n\n // Temporary any placeholder before replacing with the actual schema type\n // Used to prevent infinite loops in cyclical data structures\n safeGlobalRegistrySet(id, z.any());\n\n // Generate the actual schema using the callback\n const schema = callback();\n\n // Replace the placeholder with the real schema\n safeGlobalRegistrySet(id, schema);\n\n // Show completion for user content only\n if (!isBuiltInSchema) {\n const fieldCount = Object.keys((schema as any)?._def?.shape || {}).length || 0;\n const schemaName = transformedId\n .replace('Document', '')\n .replace('Entry', '')\n .replace(/([A-Z])/g, ' $1')\n .trim();\n strapi.log.debug(` \"${schemaName}\" schema created with ${fieldCount} fields`);\n }\n\n return schema;\n } catch (error) {\n strapi.log.error(`Schema creation failed: Failed to create schema ${id}`);\n\n throw error;\n }\n};\n"],"names":["safeGlobalRegistrySet","id","schema","_idmap","idMap","z","globalRegistry","transformedId","transformUidToValidOpenApiName","isReplacing","has","delete","strapi","log","debug","add","error","safeSchemaCreation","callback","mapItem","get","isBuiltInSchema","startsWith","schemaName","replace","trim","any","fieldCount","Object","keys","_def","shape","length"],"mappings":";;;AAIA;AAEA;;;;;;;;;;;;;AAaC,IACM,MAAMA,qBAAwB,GAAA,CAACC,EAAyBC,EAAAA,MAAAA,GAAAA;IAC7D,IAAI;AACF,QA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A;QACdJ,MAAOC,CAAAA,GAAG,CAACG,KAAK,CAAC,CAAC,gDAAgD,EAAEf,GAAG,CAAC,CAAA;QAExE,MAAMe,KAAAA;AACR;AACF;;;;"}
@@ -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.b72ed8ba7907bf9b8b6e3eec77452255be58332e";
6
+ var version = "0.0.0-experimental.b7cfb5022f2343257445f9e7feb75c7465742c85";
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.b72ed8ba7907bf9b8b6e3eec77452255be58332e",
63
- "@strapi/database": "0.0.0-experimental.b72ed8ba7907bf9b8b6e3eec77452255be58332e",
64
- "@strapi/generators": "0.0.0-experimental.b72ed8ba7907bf9b8b6e3eec77452255be58332e",
65
- "@strapi/logger": "0.0.0-experimental.b72ed8ba7907bf9b8b6e3eec77452255be58332e",
66
- "@strapi/permissions": "0.0.0-experimental.b72ed8ba7907bf9b8b6e3eec77452255be58332e",
67
- "@strapi/types": "0.0.0-experimental.b72ed8ba7907bf9b8b6e3eec77452255be58332e",
68
- "@strapi/typescript-utils": "0.0.0-experimental.b72ed8ba7907bf9b8b6e3eec77452255be58332e",
69
- "@strapi/utils": "0.0.0-experimental.b72ed8ba7907bf9b8b6e3eec77452255be58332e",
62
+ "@strapi/admin": "0.0.0-experimental.b7cfb5022f2343257445f9e7feb75c7465742c85",
63
+ "@strapi/database": "0.0.0-experimental.b7cfb5022f2343257445f9e7feb75c7465742c85",
64
+ "@strapi/generators": "0.0.0-experimental.b7cfb5022f2343257445f9e7feb75c7465742c85",
65
+ "@strapi/logger": "0.0.0-experimental.b7cfb5022f2343257445f9e7feb75c7465742c85",
66
+ "@strapi/permissions": "0.0.0-experimental.b7cfb5022f2343257445f9e7feb75c7465742c85",
67
+ "@strapi/types": "0.0.0-experimental.b7cfb5022f2343257445f9e7feb75c7465742c85",
68
+ "@strapi/typescript-utils": "0.0.0-experimental.b7cfb5022f2343257445f9e7feb75c7465742c85",
69
+ "@strapi/utils": "0.0.0-experimental.b7cfb5022f2343257445f9e7feb75c7465742c85",
70
+ "@vercel/stega": "0.1.2",
70
71
  bcryptjs: "2.4.3",
71
72
  boxen: "5.1.2",
72
73
  chalk: "4.1.2",
@@ -132,9 +133,9 @@ var devDependencies = {
132
133
  "@types/node": "18.19.24",
133
134
  "@types/node-schedule": "2.1.7",
134
135
  "@types/statuses": "2.0.1",
135
- "eslint-config-custom": "0.0.0-experimental.b72ed8ba7907bf9b8b6e3eec77452255be58332e",
136
+ "eslint-config-custom": "0.0.0-experimental.b7cfb5022f2343257445f9e7feb75c7465742c85",
136
137
  supertest: "6.3.3",
137
- tsconfig: "0.0.0-experimental.b72ed8ba7907bf9b8b6e3eec77452255be58332e"
138
+ tsconfig: "0.0.0-experimental.b7cfb5022f2343257445f9e7feb75c7465742c85"
138
139
  };
139
140
  var engines = {
140
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.b72ed8ba7907bf9b8b6e3eec77452255be58332e";
2
+ var version = "0.0.0-experimental.b7cfb5022f2343257445f9e7feb75c7465742c85";
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.b72ed8ba7907bf9b8b6e3eec77452255be58332e",
59
- "@strapi/database": "0.0.0-experimental.b72ed8ba7907bf9b8b6e3eec77452255be58332e",
60
- "@strapi/generators": "0.0.0-experimental.b72ed8ba7907bf9b8b6e3eec77452255be58332e",
61
- "@strapi/logger": "0.0.0-experimental.b72ed8ba7907bf9b8b6e3eec77452255be58332e",
62
- "@strapi/permissions": "0.0.0-experimental.b72ed8ba7907bf9b8b6e3eec77452255be58332e",
63
- "@strapi/types": "0.0.0-experimental.b72ed8ba7907bf9b8b6e3eec77452255be58332e",
64
- "@strapi/typescript-utils": "0.0.0-experimental.b72ed8ba7907bf9b8b6e3eec77452255be58332e",
65
- "@strapi/utils": "0.0.0-experimental.b72ed8ba7907bf9b8b6e3eec77452255be58332e",
58
+ "@strapi/admin": "0.0.0-experimental.b7cfb5022f2343257445f9e7feb75c7465742c85",
59
+ "@strapi/database": "0.0.0-experimental.b7cfb5022f2343257445f9e7feb75c7465742c85",
60
+ "@strapi/generators": "0.0.0-experimental.b7cfb5022f2343257445f9e7feb75c7465742c85",
61
+ "@strapi/logger": "0.0.0-experimental.b7cfb5022f2343257445f9e7feb75c7465742c85",
62
+ "@strapi/permissions": "0.0.0-experimental.b7cfb5022f2343257445f9e7feb75c7465742c85",
63
+ "@strapi/types": "0.0.0-experimental.b7cfb5022f2343257445f9e7feb75c7465742c85",
64
+ "@strapi/typescript-utils": "0.0.0-experimental.b7cfb5022f2343257445f9e7feb75c7465742c85",
65
+ "@strapi/utils": "0.0.0-experimental.b7cfb5022f2343257445f9e7feb75c7465742c85",
66
+ "@vercel/stega": "0.1.2",
66
67
  bcryptjs: "2.4.3",
67
68
  boxen: "5.1.2",
68
69
  chalk: "4.1.2",
@@ -128,9 +129,9 @@ var devDependencies = {
128
129
  "@types/node": "18.19.24",
129
130
  "@types/node-schedule": "2.1.7",
130
131
  "@types/statuses": "2.0.1",
131
- "eslint-config-custom": "0.0.0-experimental.b72ed8ba7907bf9b8b6e3eec77452255be58332e",
132
+ "eslint-config-custom": "0.0.0-experimental.b7cfb5022f2343257445f9e7feb75c7465742c85",
132
133
  supertest: "6.3.3",
133
- tsconfig: "0.0.0-experimental.b72ed8ba7907bf9b8b6e3eec77452255be58332e"
134
+ tsconfig: "0.0.0-experimental.b7cfb5022f2343257445f9e7feb75c7465742c85"
134
135
  };
135
136
  var engines = {
136
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,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,OAA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ACF,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,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,KAAA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BAASC,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,SAASL,CAAEM,CAAAA,OAAO,CAACH,GAAIE,CAAAA,MAAM,EAAE,CAACjB,KAAAA,GAAAA;AACpC,gBAAA,IAAI,YAAYA,KAAO,EAAA;AACrB,oBAAA,OAAOA,MAAMiB,MAAM;AACrB;gBAEA,OAAOjB,KAAAA;AACT,aAAA,CAAA,CAAGmB,MAAM,CAACd,gBAAAA,CAAAA;YAEV,IAAIY,MAAAA,CAAOG,MAAM,KAAK,CAAG,EAAA;AACv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AAK;AACRG,oBAAAA,IAAAA,EAAM,CAAC,EAAEkB,SAAAA,CAAU,EAAErB,KAAMG,CAAAA,IAAI,CAAC;iBAClC,CAAA,CAAA;AACF,SAAA,CAAA;QAEA,OAAOQ,SAAAA;AACT,KAAA;IAEA,MAAMkB,SAAAA,GAAYC,QAASC,CAAAA,mBAAmB,CAAC;AAC7CC,QAAAA,QAAAA,CAAAA,CAASC,GAAW,EAAA;YAClB,OAAOxB,MAAAA,CAAOuB,QAAQ,CAACC,GAAAA,CAAAA;AACzB,SAAA;;AAEA,QAAA,IAAIC,UAAa,CAAA,GAAA;YACf,OAAO;AACLC,gBAAAA,KAAAA,EAAO1B,MAAOyB,CAAAA,UAAU,CAACZ,GAAG,CAAC,mBAAA,CAAA;AAC7Bc,gBAAAA,MAAAA,EAAQ3B,MAAOyB,CAAAA,UAAU,CAACZ,GAAG,CAAC,oBAAA;AAChC,aAAA;AACF;AACF,KAAA,CAAA;IAEA,MAAMe,SAAAA,GAAYC,QAASC,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,+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,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,SAASL,CAAEM,CAAAA,OAAO,CAAC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,QAAAA,WAAAA,EAAaC,+BAAgClC,CAAAA,MAAAA,CAAAA;AAC7CC,QAAAA,YAAAA;QACAqB,QAAUD,EAAAA,SAAAA;QACVS,QAAUD,EAAAA;AACZ,KAAA;AACF;;;;"}
@@ -0,0 +1,12 @@
1
+ import type { Core, Struct } from '@strapi/types';
2
+ interface EncodingInfo {
3
+ data: any;
4
+ schema: Struct.Schema;
5
+ }
6
+ declare const createContentSourceMapsService: (strapi: Core.Strapi) => {
7
+ encodeField(text: string, key: string): string;
8
+ encodeEntry({ data, schema }: EncodingInfo): Promise<any>;
9
+ encodeSourceMaps({ data, schema }: EncodingInfo): Promise<any>;
10
+ };
11
+ export { createContentSourceMapsService };
12
+ //# 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;AAyCvD,UAAU,YAAY;IACpB,IAAI,EAAE,GAAG,CAAC;IACV,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;CACvB;AAED,QAAA,MAAM,8BAA8B,WAAY,KAAK,MAAM;sBAErC,MAAM,OAAO,MAAM,GAAG,MAAM;kCAQV,YAAY,GAAG,QAAQ,GAAG,CAAC;uCAuBtB,YAAY,GAAG,QAAQ,GAAG,CAAC;CAmBvE,CAAC;AAEF,OAAO,EAAE,8BAA8B,EAAE,CAAC"}