@strapi/core 5.23.1 → 5.23.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) 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/package.json.js +12 -11
  19. package/dist/package.json.js.map +1 -1
  20. package/dist/package.json.mjs +12 -11
  21. package/dist/package.json.mjs.map +1 -1
  22. package/dist/services/content-api/index.d.ts +1 -1
  23. package/dist/services/content-api/index.d.ts.map +1 -1
  24. package/dist/services/content-api/index.js +1 -1
  25. package/dist/services/content-api/index.js.map +1 -1
  26. package/dist/services/content-api/index.mjs +2 -2
  27. package/dist/services/content-api/index.mjs.map +1 -1
  28. package/dist/services/content-source-maps.d.ts +12 -0
  29. package/dist/services/content-source-maps.d.ts.map +1 -0
  30. package/dist/services/content-source-maps.js +86 -0
  31. package/dist/services/content-source-maps.js.map +1 -0
  32. package/dist/services/content-source-maps.mjs +84 -0
  33. package/dist/services/content-source-maps.mjs.map +1 -0
  34. package/dist/services/document-service/components.d.ts +6 -1
  35. package/dist/services/document-service/components.d.ts.map +1 -1
  36. package/dist/services/document-service/components.js +97 -0
  37. package/dist/services/document-service/components.js.map +1 -1
  38. package/dist/services/document-service/components.mjs +97 -1
  39. package/dist/services/document-service/components.mjs.map +1 -1
  40. package/dist/services/document-service/repository.d.ts.map +1 -1
  41. package/dist/services/document-service/repository.js +4 -0
  42. package/dist/services/document-service/repository.js.map +1 -1
  43. package/dist/services/document-service/repository.mjs +5 -1
  44. package/dist/services/document-service/repository.mjs.map +1 -1
  45. package/dist/services/document-service/utils/unidirectional-relations.d.ts +19 -2
  46. package/dist/services/document-service/utils/unidirectional-relations.d.ts.map +1 -1
  47. package/dist/services/document-service/utils/unidirectional-relations.js +21 -6
  48. package/dist/services/document-service/utils/unidirectional-relations.js.map +1 -1
  49. package/dist/services/document-service/utils/unidirectional-relations.mjs +21 -6
  50. package/dist/services/document-service/utils/unidirectional-relations.mjs.map +1 -1
  51. 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,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AS,CAAC,CAAA;AAC5F,SAAA,MAAO,IAAIe,SAAaA,IAAAA,SAAAA,CAAUR,IAAI,KAAK,aAAA,IAAiBnB,YAAYJ,QAAW,CAAA,EAAA;AACjF,YAAA,IAAIU,MAAMV,QAAW,CAAA,EAAA;gBACnB2B,eAAe,CAACC,IAAI,GAAG5B,QAAAA;AACzB;AAEA2B,YAAAA,eAAe,CAACC,GAAI,CAAA,GAAG5B,QAASiB,CAAAA,GAAG,CAAC,CAACkB,WAAAA,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,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CAACC,IAAI,GAAG;AAAEtB,gBAAAA;AAAK,aAAA;AAChC,SAAA,MAAO,IAAIyB,SAAaA,IAAAA,SAAAA,CAAUR,IAAI,KAAK,WAAA,IAAehC,QAAQC,QAAW,CAAA,EAAA;YAC3EmC,eAAe,CAACC,GAAI,CAAA,GAAGb,kBAAmBvB,CAAAA,QAAAA,EAAUkB,OAAOuB,UAAU,CAACF,SAAUf,CAAAA,SAAS,CAAC,CAAA;AAC5F,SAAA,MAAO,IAAIe,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
  }>;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var name = "@strapi/core";
6
- var version = "5.23.1";
6
+ var version = "5.23.3";
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": "5.23.1",
63
- "@strapi/database": "5.23.1",
64
- "@strapi/generators": "5.23.1",
65
- "@strapi/logger": "5.23.1",
66
- "@strapi/permissions": "5.23.1",
67
- "@strapi/types": "5.23.1",
68
- "@strapi/typescript-utils": "5.23.1",
69
- "@strapi/utils": "5.23.1",
62
+ "@strapi/admin": "5.23.3",
63
+ "@strapi/database": "5.23.3",
64
+ "@strapi/generators": "5.23.3",
65
+ "@strapi/logger": "5.23.3",
66
+ "@strapi/permissions": "5.23.3",
67
+ "@strapi/types": "5.23.3",
68
+ "@strapi/typescript-utils": "5.23.3",
69
+ "@strapi/utils": "5.23.3",
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": "5.23.1",
136
+ "eslint-config-custom": "5.23.3",
136
137
  supertest: "6.3.3",
137
- tsconfig: "5.23.1"
138
+ tsconfig: "5.23.3"
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 = "5.23.1";
2
+ var version = "5.23.3";
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": "5.23.1",
59
- "@strapi/database": "5.23.1",
60
- "@strapi/generators": "5.23.1",
61
- "@strapi/logger": "5.23.1",
62
- "@strapi/permissions": "5.23.1",
63
- "@strapi/types": "5.23.1",
64
- "@strapi/typescript-utils": "5.23.1",
65
- "@strapi/utils": "5.23.1",
58
+ "@strapi/admin": "5.23.3",
59
+ "@strapi/database": "5.23.3",
60
+ "@strapi/generators": "5.23.3",
61
+ "@strapi/logger": "5.23.3",
62
+ "@strapi/permissions": "5.23.3",
63
+ "@strapi/types": "5.23.3",
64
+ "@strapi/typescript-utils": "5.23.3",
65
+ "@strapi/utils": "5.23.3",
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": "5.23.1",
132
+ "eslint-config-custom": "5.23.3",
132
133
  supertest: "6.3.3",
133
- tsconfig: "5.23.1"
134
+ tsconfig: "5.23.3"
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,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;AACvB,gBAAA;AACF;AAEA,YAAA,MAAMC,SAA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,EAAEkB,SAAAA,CAAU,EAAErB,KAAMG,CAAAA,IAAI,CAAC;iBAClC,CAAA,CAAA;AACF,SAAA,CAAA;QAEA,OAAOQ,SAAAA;AACT,KAAA;IAEA,MAAMkB,SAAAA,GAAYC,oBAASC,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,oBAASC,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,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,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AAA,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,MAA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Aa,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,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;AACvB,gBAAA;AACF;AAEA,YAAA,MAAMC,SAAYZ,GAAAA,MAAAA,CAAOP,MAAM,CAACoB,GAAG,CAAC,iBAAA,CA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C,CAAA,CAAA;AACF,SAAA,CAAA;AAEA,QAAA,OAAO0B,iCAAkClB,CAAAA,SAAAA,CAAAA;AAC3C,KAAA;IAEA,MAAMmB,SAAAA,GAAYC,QAASC,CAAAA,mBAAmB,CAAC;AAC7CC,QAAAA,QAAAA,CAAAA,CAASC,GAAW,EAAA;YAClB,OAAOzB,MAAAA,CAAOwB,QAAQ,CAACC,GAAAA,CAAAA;AACzB,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,QAASC,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,+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;AAMD,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"}
@@ -0,0 +1,86 @@
1
+ 'use strict';
2
+
3
+ var stega = require('@vercel/stega');
4
+ var strapiUtils = require('@strapi/utils');
5
+
6
+ const ENCODABLE_TYPES = [
7
+ 'string',
8
+ 'text',
9
+ 'richtext',
10
+ 'biginteger',
11
+ 'date',
12
+ 'time',
13
+ 'datetime',
14
+ 'timestamp',
15
+ 'boolean',
16
+ 'enumeration',
17
+ 'json',
18
+ 'media',
19
+ 'email',
20
+ 'password'
21
+ ];
22
+ // TODO: use a centralized store for these fields that would be shared with the CM and CTB
23
+ const EXCLUDED_FIELDS = [
24
+ 'id',
25
+ 'documentId',
26
+ 'locale',
27
+ 'localizations',
28
+ 'created_by',
29
+ 'updated_by',
30
+ 'created_at',
31
+ 'updated_at',
32
+ 'publishedAt'
33
+ ];
34
+ const isObject = (value)=>{
35
+ return typeof value === 'object' && value !== null;
36
+ };
37
+ const createContentSourceMapsService = (strapi)=>{
38
+ return {
39
+ encodeField (text, key) {
40
+ const res = stega.vercelStegaCombine(text, {
41
+ // TODO: smarter metadata than just the key
42
+ key
43
+ });
44
+ return res;
45
+ },
46
+ async encodeEntry ({ data, schema }) {
47
+ if (!isObject(data) || data === undefined) {
48
+ return data;
49
+ }
50
+ return strapiUtils.traverseEntity(({ key, value, attribute }, { set })=>{
51
+ if (!attribute || EXCLUDED_FIELDS.includes(key)) {
52
+ return;
53
+ }
54
+ if (ENCODABLE_TYPES.includes(attribute.type) && typeof value === 'string') {
55
+ set(key, this.encodeField(value, key));
56
+ }
57
+ }, {
58
+ schema,
59
+ getModel: (uid)=>strapi.getModel(uid)
60
+ }, data);
61
+ },
62
+ async encodeSourceMaps ({ data, schema }) {
63
+ try {
64
+ if (Array.isArray(data)) {
65
+ return await Promise.all(data.map((item)=>this.encodeSourceMaps({
66
+ data: item,
67
+ schema
68
+ })));
69
+ }
70
+ if (!isObject(data)) {
71
+ return data;
72
+ }
73
+ return await this.encodeEntry({
74
+ data,
75
+ schema
76
+ });
77
+ } catch (error) {
78
+ strapi.log.error('Error encoding source maps:', error);
79
+ return data;
80
+ }
81
+ }
82
+ };
83
+ };
84
+
85
+ exports.createContentSourceMapsService = createContentSourceMapsService;
86
+ //# sourceMappingURL=content-source-maps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-source-maps.js","sources":["../../src/services/content-source-maps.ts"],"sourcesContent":["import { vercelStegaCombine } from '@vercel/stega';\nimport type { Core, Struct, UID } from '@strapi/types';\nimport { traverseEntity } from '@strapi/utils';\n\nconst ENCODABLE_TYPES = [\n 'string',\n 'text',\n 'richtext',\n 'biginteger',\n 'date',\n 'time',\n 'datetime',\n 'timestamp',\n 'boolean',\n 'enumeration',\n 'json',\n 'media',\n 'email',\n 'password',\n /**\n * We cannot modify the response shape, so types that aren't based on string cannot be encoded:\n * - json: object\n * - blocks: object, will require a custom implementation in a dedicated PR\n * - integer, float and decimal: number\n * - boolean: boolean (believe it or not)\n * - uid: can be stringified but would mess up URLs\n */\n];\n\n// TODO: use a centralized store for these fields that would be shared with the CM and CTB\nconst EXCLUDED_FIELDS = [\n 'id',\n 'documentId',\n 'locale',\n 'localizations',\n 'created_by',\n 'updated_by',\n 'created_at',\n 'updated_at',\n 'publishedAt',\n];\n\ninterface EncodingInfo {\n data: any;\n schema: Struct.Schema;\n}\n\nconst isObject = (value: unknown): value is Record<string, any> => {\n return typeof value === 'object' && value !== null;\n};\n\nconst createContentSourceMapsService = (strapi: Core.Strapi) => {\n return {\n encodeField(text: string, key: string): string {\n const res = vercelStegaCombine(text, {\n // TODO: smarter metadata than just the key\n key,\n });\n return res;\n },\n\n async encodeEntry({ data, schema }: EncodingInfo): Promise<any> {\n if (!isObject(data) || data === undefined) {\n return data;\n }\n\n return traverseEntity(\n ({ key, value, attribute }, { set }) => {\n if (!attribute || EXCLUDED_FIELDS.includes(key)) {\n return;\n }\n\n if (ENCODABLE_TYPES.includes(attribute.type) && typeof value === 'string') {\n set(key, this.encodeField(value, key) as any);\n }\n },\n {\n schema,\n getModel: (uid) => strapi.getModel(uid as UID.Schema),\n },\n data\n );\n },\n\n async encodeSourceMaps({ data, schema }: EncodingInfo): Promise<any> {\n try {\n if (Array.isArray(data)) {\n return await Promise.all(\n data.map((item) => this.encodeSourceMaps({ data: item, schema }))\n );\n }\n\n if (!isObject(data)) {\n return data;\n }\n\n return await this.encodeEntry({ data, schema });\n } catch (error) {\n strapi.log.error('Error encoding source maps:', error);\n return data;\n }\n },\n };\n};\n\nexport { createContentSourceMapsService };\n"],"names":["ENCODABLE_TYPES","EXCLUDED_FIELDS","isObject","value","createContentSourceMapsService","strapi","encodeField","text","key","res","vercelStegaCombine","encodeEntry","data","schema","undefined","traverseEntity","attribute","set","includes","type","getModel","uid","encodeSourceMaps","Array","isArray","Promise","all","map","item","error","log"],"mappings":";;;;;AAIA,MAAMA,eAAkB,GAAA;AACtB,IAAA,QAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,YAAA;AACA,IAAA,MAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,WAAA;A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A,CAAAA;AACnC;aAEF,EAAA;AACEK,gBAAAA,MAAAA;AACAO,gBAAAA,QAAAA,EAAU,CAACC,GAAAA,GAAQhB,MAAOe,CAAAA,QAAQ,CAACC,GAAAA;aAErCT,EAAAA,IAAAA,CAAAA;AAEJ,SAAA;AAEA,QAAA,MAAMU,gBAAiB,CAAA,CAAA,EAAEV,IAAI,EAAEC,MAAM,EAAgB,EAAA;YACnD,IAAI;gBACF,IAAIU,KAAAA,CAAMC,OAAO,CAACZ,IAAO,CAAA,EAAA;AACvB,oBAAA,OAAO,MAAMa,OAAAA,CAAQC,GAAG,CACtBd,IAAKe,CAAAA,GAAG,CAAC,CAACC,IAAS,GAAA,IAAI,CAACN,gBAAgB,CAAC;4BAAEV,IAAMgB,EAAAA,IAAAA;AAAMf,4BAAAA;AAAO,yBAAA,CAAA,CAAA,CAAA;AAElE;gBAEA,IAAI,CAACX,SAASU,IAAO,CAAA,EAAA;oBACnB,OAAOA,IAAAA;AACT;AAEA,gBAAA,OAAO,MAAM,IAAI,CAACD,WAAW,CAAC;AAAEC,oBAAAA,IAAAA;AAAMC,oBAAAA;AAAO,iBAAA,CAAA;AAC/C,aAAA,CAAE,OAAOgB,KAAO,EAAA;AACdxB,gBAAAA,MAAAA,CAAOyB,GAAG,CAACD,KAAK,CAAC,6BAA+BA,EAAAA,KAAAA,CAAAA;gBAChD,OAAOjB,IAAAA;AACT;AACF;AACF,KAAA;AACF;;;;"}
@@ -0,0 +1,84 @@
1
+ import { vercelStegaCombine } from '@vercel/stega';
2
+ import { traverseEntity } from '@strapi/utils';
3
+
4
+ const ENCODABLE_TYPES = [
5
+ 'string',
6
+ 'text',
7
+ 'richtext',
8
+ 'biginteger',
9
+ 'date',
10
+ 'time',
11
+ 'datetime',
12
+ 'timestamp',
13
+ 'boolean',
14
+ 'enumeration',
15
+ 'json',
16
+ 'media',
17
+ 'email',
18
+ 'password'
19
+ ];
20
+ // TODO: use a centralized store for these fields that would be shared with the CM and CTB
21
+ const EXCLUDED_FIELDS = [
22
+ 'id',
23
+ 'documentId',
24
+ 'locale',
25
+ 'localizations',
26
+ 'created_by',
27
+ 'updated_by',
28
+ 'created_at',
29
+ 'updated_at',
30
+ 'publishedAt'
31
+ ];
32
+ const isObject = (value)=>{
33
+ return typeof value === 'object' && value !== null;
34
+ };
35
+ const createContentSourceMapsService = (strapi)=>{
36
+ return {
37
+ encodeField (text, key) {
38
+ const res = vercelStegaCombine(text, {
39
+ // TODO: smarter metadata than just the key
40
+ key
41
+ });
42
+ return res;
43
+ },
44
+ async encodeEntry ({ data, schema }) {
45
+ if (!isObject(data) || data === undefined) {
46
+ return data;
47
+ }
48
+ return traverseEntity(({ key, value, attribute }, { set })=>{
49
+ if (!attribute || EXCLUDED_FIELDS.includes(key)) {
50
+ return;
51
+ }
52
+ if (ENCODABLE_TYPES.includes(attribute.type) && typeof value === 'string') {
53
+ set(key, this.encodeField(value, key));
54
+ }
55
+ }, {
56
+ schema,
57
+ getModel: (uid)=>strapi.getModel(uid)
58
+ }, data);
59
+ },
60
+ async encodeSourceMaps ({ data, schema }) {
61
+ try {
62
+ if (Array.isArray(data)) {
63
+ return await Promise.all(data.map((item)=>this.encodeSourceMaps({
64
+ data: item,
65
+ schema
66
+ })));
67
+ }
68
+ if (!isObject(data)) {
69
+ return data;
70
+ }
71
+ return await this.encodeEntry({
72
+ data,
73
+ schema
74
+ });
75
+ } catch (error) {
76
+ strapi.log.error('Error encoding source maps:', error);
77
+ return data;
78
+ }
79
+ }
80
+ };
81
+ };
82
+
83
+ export { createContentSourceMapsService };
84
+ //# sourceMappingURL=content-source-maps.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-source-maps.mjs","sources":["../../src/services/content-source-maps.ts"],"sourcesContent":["import { vercelStegaCombine } from '@vercel/stega';\nimport type { Core, Struct, UID } from '@strapi/types';\nimport { traverseEntity } from '@strapi/utils';\n\nconst ENCODABLE_TYPES = [\n 'string',\n 'text',\n 'richtext',\n 'biginteger',\n 'date',\n 'time',\n 'datetime',\n 'timestamp',\n 'boolean',\n 'enumeration',\n 'json',\n 'media',\n 'email',\n 'password',\n /**\n * We cannot modify the response shape, so types that aren't based on string cannot be encoded:\n * - json: object\n * - blocks: object, will require a custom implementation in a dedicated PR\n * - integer, float and decimal: number\n * - boolean: boolean (believe it or not)\n * - uid: can be stringified but would mess up URLs\n */\n];\n\n// TODO: use a centralized store for these fields that would be shared with the CM and CTB\nconst EXCLUDED_FIELDS = [\n 'id',\n 'documentId',\n 'locale',\n 'localizations',\n 'created_by',\n 'updated_by',\n 'created_at',\n 'updated_at',\n 'publishedAt',\n];\n\ninterface EncodingInfo {\n data: any;\n schema: Struct.Schema;\n}\n\nconst isObject = (value: unknown): value is Record<string, any> => {\n return typeof value === 'object' && value !== null;\n};\n\nconst createContentSourceMapsService = (strapi: Core.Strapi) => {\n return {\n encodeField(text: string, key: string): string {\n const res = vercelStegaCombine(text, {\n // TODO: smarter metadata than just the key\n key,\n });\n return res;\n },\n\n async encodeEntry({ data, schema }: EncodingInfo): Promise<any> {\n if (!isObject(data) || data === undefined) {\n return data;\n }\n\n return traverseEntity(\n ({ key, value, attribute }, { set }) => {\n if (!attribute || EXCLUDED_FIELDS.includes(key)) {\n return;\n }\n\n if (ENCODABLE_TYPES.includes(attribute.type) && typeof value === 'string') {\n set(key, this.encodeField(value, key) as any);\n }\n },\n {\n schema,\n getModel: (uid) => strapi.getModel(uid as UID.Schema),\n },\n data\n );\n },\n\n async encodeSourceMaps({ data, schema }: EncodingInfo): Promise<any> {\n try {\n if (Array.isArray(data)) {\n return await Promise.all(\n data.map((item) => this.encodeSourceMaps({ data: item, schema }))\n );\n }\n\n if (!isObject(data)) {\n return data;\n }\n\n return await this.encodeEntry({ data, schema });\n } catch (error) {\n strapi.log.error('Error encoding source maps:', error);\n return data;\n }\n },\n };\n};\n\nexport { createContentSourceMapsService };\n"],"names":["ENCODABLE_TYPES","EXCLUDED_FIELDS","isObject","value","createContentSourceMapsService","strapi","encodeField","text","key","res","vercelStegaCombine","encodeEntry","data","schema","undefined","traverseEntity","attribute","set","includes","type","getModel","uid","encodeSourceMaps","Array","isArray","Promise","all","map","item","error","log"],"mappings":";;;AAIA,MAAMA,eAAkB,GAAA;AACtB,IAAA,QAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,YAAA;AACA,IAAA,MAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,WAAA;AACA,IAAA,SAAA;AACA,IAAA,aAAA;AACA,IAAA,MAAA;AACA,IAAA,OAAA;AACA,IAAA,OAAA;AACA,IAAA;AASD,CAAA;AAED;AACA,MAAMC,eAAkB,GAAA;AACtB,IAAA,IAAA;AACA,IAAA,YAAA;AACA,IAAA,QAAA;AACA,IAAA,eAAA;AACA,IAAA,YAAA;AACA,IAAA,YAAA;AACA,IAAA,YAAA;AACA,IAAA,YAAA;AACA,IAAA;AACD,CAAA;AAOD,MAAMC,WAAW,CAACC,KAAAA,GAAAA;IAChB,OAAO,OAAOA,KAAU,KAAA,QAAA,IAAYA,KAAU,KAAA,IAAA;AAChD,CAAA;AAEA,MAAMC,iCAAiC,CAACC,MAAAA,GAAAA;IACtC,OAAO;QACLC,WAAYC,CAAAA,CAAAA,IAAY,EAAEC,GAAW,EAAA;YACnC,MAAMC,GAAAA,GAAMC,mBAAmBH,IAAM,EAAA;;AAEnCC,gBAAAA;AACF,aAAA,CAAA;YACA,OAAOC,GAAAA;AACT,SAAA;AAEA,QAAA,MAAME,WAAY,CAAA,CAAA,EAAEC,IAAI,EAAEC,MAAM,EAAgB,EAAA;AAC9C,YAAA,IAAI,CAACX,QAAAA,CAASU,IAASA,CAAAA,IAAAA,IAAAA,KAASE,SAAW,EAAA;gBACzC,OAAOF,IAAAA;AACT;AAEA,YAAA,OAAOG,cACL,CAAA,CAAC,EAAEP,GAAG,EAAEL,KAAK,EAAEa,SAAS,EAAE,EAAE,EAAEC,GAAG,EAAE,GAAA;AACjC,gBAAA,IAAI,CAACD,S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
22
  }) => Promise<void>;
23
23
  declare const deleteComponent: <TUID extends `${string}.${string}`>(uid: TUID, componentToDelete: Data.Component<TUID>) => Promise<void>;
24
24
  declare const assignComponentData: _.CurriedFunction3<import("@strapi/types/dist/struct").ComponentSchema | import("@strapi/types/dist/struct").ContentTypeSchema, ComponentBody, Input<UID.Schema>, ComponentBody & Partial<Input<UID.Schema>>>;
25
- export { omitComponentData, assignComponentData, getComponents, createComponents, updateComponents, deleteComponents, deleteComponent, };
25
+ /**
26
+ * Creates a filter function for component relations that can be passed to the generic
27
+ * unidirectional relations utility
28
+ */
29
+ declare const createComponentRelationFilter: () => (relation: Record<string, any>, model: Schema.Component | Schema.ContentType, trx: any) => Promise<boolean>;
30
+ export { omitComponentData, assignComponentData, getComponents, createComponents, updateComponents, deleteComponents, deleteComponent, createComponentRelationFilter, };
26
31
  //# sourceMappingURL=components.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/services/document-service/components.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,OAAO,KAAK,EAAS,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAIvE,KAAK,KAAK,CAAC,CAAC,SAAS,GAAG,CAAC,MAAM,IAAI,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAE1E,KAAK,gBAAgB,CAAC,IAAI,SAAS,GAAG,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAC1D,IAAI,EACJ,MAAM,CAAC,oBAAoB,CAAC,IAAI,EAAE,WAAW,GAAG,aAAa,CAAC,CAC/D,CAAC;AAEF,KAAK,oBAAoB,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAClF,KAAK,wBAAwB,GAAG,MAAM,CAAC,SAAS,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