@strapi/core 5.38.1 → 5.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var name = "@strapi/core";
6
- var version = "5.38.1";
6
+ var version = "5.40.0";
7
7
  var description = "Core of Strapi";
8
8
  var homepage = "https://strapi.io";
9
9
  var bugs = {
@@ -11,7 +11,7 @@ var bugs = {
11
11
  };
12
12
  var repository = {
13
13
  type: "git",
14
- url: "git://github.com/strapi/strapi.git",
14
+ url: "https://github.com/strapi/strapi.git",
15
15
  directory: "packages/core/core"
16
16
  };
17
17
  var license = "SEE LICENSE IN LICENSE";
@@ -62,14 +62,14 @@ var dependencies = {
62
62
  "@koa/cors": "5.0.0",
63
63
  "@koa/router": "12.0.2",
64
64
  "@paralleldrive/cuid2": "2.2.2",
65
- "@strapi/admin": "5.38.1",
66
- "@strapi/database": "5.38.1",
67
- "@strapi/generators": "5.38.1",
68
- "@strapi/logger": "5.38.1",
69
- "@strapi/permissions": "5.38.1",
70
- "@strapi/types": "5.38.1",
71
- "@strapi/typescript-utils": "5.38.1",
72
- "@strapi/utils": "5.38.1",
65
+ "@strapi/admin": "5.40.0",
66
+ "@strapi/database": "5.40.0",
67
+ "@strapi/generators": "5.40.0",
68
+ "@strapi/logger": "5.40.0",
69
+ "@strapi/permissions": "5.40.0",
70
+ "@strapi/types": "5.40.0",
71
+ "@strapi/typescript-utils": "5.40.0",
72
+ "@strapi/utils": "5.40.0",
73
73
  "@vercel/stega": "0.1.2",
74
74
  bcryptjs: "2.4.3",
75
75
  boxen: "5.1.2",
@@ -137,11 +137,11 @@ var devDependencies = {
137
137
  "@types/node": "24.10.0",
138
138
  "@types/node-schedule": "2.1.7",
139
139
  "@types/statuses": "2.0.1",
140
- "eslint-config-custom": "5.38.1",
140
+ "eslint-config-custom": "5.40.0",
141
141
  supertest: "6.3.3",
142
- tsconfig: "5.38.1",
142
+ tsconfig: "5.40.0",
143
143
  vitest: "catalog:",
144
- "vitest-config": "5.38.1"
144
+ "vitest-config": "5.40.0"
145
145
  };
146
146
  var engines = {
147
147
  node: ">=20.0.0 <=24.x.x",
@@ -1,5 +1,5 @@
1
1
  var name = "@strapi/core";
2
- var version = "5.38.1";
2
+ var version = "5.40.0";
3
3
  var description = "Core of Strapi";
4
4
  var homepage = "https://strapi.io";
5
5
  var bugs = {
@@ -7,7 +7,7 @@ var bugs = {
7
7
  };
8
8
  var repository = {
9
9
  type: "git",
10
- url: "git://github.com/strapi/strapi.git",
10
+ url: "https://github.com/strapi/strapi.git",
11
11
  directory: "packages/core/core"
12
12
  };
13
13
  var license = "SEE LICENSE IN LICENSE";
@@ -58,14 +58,14 @@ var dependencies = {
58
58
  "@koa/cors": "5.0.0",
59
59
  "@koa/router": "12.0.2",
60
60
  "@paralleldrive/cuid2": "2.2.2",
61
- "@strapi/admin": "5.38.1",
62
- "@strapi/database": "5.38.1",
63
- "@strapi/generators": "5.38.1",
64
- "@strapi/logger": "5.38.1",
65
- "@strapi/permissions": "5.38.1",
66
- "@strapi/types": "5.38.1",
67
- "@strapi/typescript-utils": "5.38.1",
68
- "@strapi/utils": "5.38.1",
61
+ "@strapi/admin": "5.40.0",
62
+ "@strapi/database": "5.40.0",
63
+ "@strapi/generators": "5.40.0",
64
+ "@strapi/logger": "5.40.0",
65
+ "@strapi/permissions": "5.40.0",
66
+ "@strapi/types": "5.40.0",
67
+ "@strapi/typescript-utils": "5.40.0",
68
+ "@strapi/utils": "5.40.0",
69
69
  "@vercel/stega": "0.1.2",
70
70
  bcryptjs: "2.4.3",
71
71
  boxen: "5.1.2",
@@ -133,11 +133,11 @@ var devDependencies = {
133
133
  "@types/node": "24.10.0",
134
134
  "@types/node-schedule": "2.1.7",
135
135
  "@types/statuses": "2.0.1",
136
- "eslint-config-custom": "5.38.1",
136
+ "eslint-config-custom": "5.40.0",
137
137
  supertest: "6.3.3",
138
- tsconfig: "5.38.1",
138
+ tsconfig: "5.40.0",
139
139
  vitest: "catalog:",
140
- "vitest-config": "5.38.1"
140
+ "vitest-config": "5.40.0"
141
141
  };
142
142
  var engines = {
143
143
  node: ">=20.0.0 <=24.x.x",
@@ -1 +1 @@
1
- {"version":3,"file":"populate.d.ts","sourceRoot":"","sources":["../../../../src/services/document-service/utils/populate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC,UAAU,OAAO;IACf;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAKD,eAAO,MAAM,eAAe,QAAS,IAAI,MAAM,SAAQ,OAAO,QAwD7D,CAAC"}
1
+ {"version":3,"file":"populate.d.ts","sourceRoot":"","sources":["../../../../src/services/document-service/utils/populate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC,UAAU,OAAO;IACf;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAOD,eAAO,MAAM,eAAe,QAAS,IAAI,MAAM,SAAQ,OAAO,QAiE7D,CAAC"}
@@ -3,11 +3,17 @@
3
3
  var strapiUtils = require('@strapi/utils');
4
4
 
5
5
  const { CREATED_BY_ATTRIBUTE, UPDATED_BY_ATTRIBUTE } = strapiUtils.contentTypes.constants;
6
+ const deepPopulateCache = new Map();
6
7
  // We want to build a populate object based on the schema
7
8
  const getDeepPopulate = (uid, opts = {})=>{
9
+ const cacheKey = `${uid}::${JSON.stringify(opts)}`;
10
+ const cached = deepPopulateCache.get(cacheKey);
11
+ if (cached) {
12
+ return cached;
13
+ }
8
14
  const model = strapi.getModel(uid);
9
15
  const attributes = Object.entries(model.attributes);
10
- return attributes.reduce((acc, [attributeName, attribute])=>{
16
+ const result = attributes.reduce((acc, [attributeName, attribute])=>{
11
17
  switch(attribute.type){
12
18
  case 'relation':
13
19
  {
@@ -65,6 +71,8 @@ const getDeepPopulate = (uid, opts = {})=>{
65
71
  }
66
72
  return acc;
67
73
  }, {});
74
+ deepPopulateCache.set(cacheKey, result);
75
+ return result;
68
76
  };
69
77
 
70
78
  exports.getDeepPopulate = getDeepPopulate;
@@ -1 +1 @@
1
- {"version":3,"file":"populate.js","sources":["../../../../src/services/document-service/utils/populate.ts"],"sourcesContent":["import type { UID } from '@strapi/types';\nimport { contentTypes } from '@strapi/utils';\n\ninterface Options {\n /**\n * Fields to select when populating relations\n */\n relationalFields?: string[];\n}\n\nconst { CREATED_BY_ATTRIBUTE, UPDATED_BY_ATTRIBUTE } = contentTypes.constants;\n\n// We want to build a populate object based on the schema\nexport const getDeepPopulate = (uid: UID.Schema, opts: Options = {}) => {\n const model = strapi.getModel(uid);\n const attributes = Object.entries(model.attributes);\n\n return attributes.reduce((acc: any, [attributeName, attribute]) => {\n switch (attribute.type) {\n case 'relation': {\n // TODO: Support polymorphic relations\n const isMorphRelation = attribute.relation.toLowerCase().startsWith('morph');\n if (isMorphRelation) {\n break;\n }\n\n // Ignore not visible fields other than createdBy and updatedBy\n const isVisible = contentTypes.isVisibleAttribute(model, attributeName);\n const isCreatorField = [CREATED_BY_ATTRIBUTE, UPDATED_BY_ATTRIBUTE].includes(attributeName);\n\n if (isVisible || isCreatorField) {\n acc[attributeName] = { select: opts.relationalFields };\n }\n\n break;\n }\n\n case 'media': {\n // We populate all media fields for completeness of webhook responses\n // see https://github.com/strapi/strapi/issues/21546\n acc[attributeName] = { select: ['*'] };\n break;\n }\n\n case 'component': {\n const populate = getDeepPopulate(attribute.component, opts);\n acc[attributeName] = { populate };\n break;\n }\n\n case 'dynamiczone': {\n // Use fragments to populate the dynamic zone components\n const populatedComponents = (attribute.components || []).reduce(\n (acc: any, componentUID: UID.Component) => {\n acc[componentUID] = { populate: getDeepPopulate(componentUID, opts) };\n return acc;\n },\n {}\n );\n\n acc[attributeName] = { on: populatedComponents };\n break;\n }\n default:\n break;\n }\n\n return acc;\n }, {});\n};\n"],"names":["CREATED_BY_ATTRIBUTE","UPDATED_BY_ATTRIBUTE","contentTypes","constants","getDeepPopulate","uid","opts","model","strapi","getModel","attributes","Object","entries","reduce","acc","attributeName","attribute","type","isMorphRelation","relation","toLowerCase","startsWith","isVisible","isVisibleAttribute","isCreatorField","includes","select","relationalFields","populate","component","populatedComponents","components","componentUID","on"],"mappings":";;;;AAUA,MAAM,EAAEA,oBAAoB,EAAEC,oBAAoB,EAAE,GAAGC,yBAAaC,SAAS;AAE7E;MACaC,eAAAA,GAAkB,CAACC,GAAAA,EAAiBC,IAAAA,GAAgB,EAAE,GAAA;IACjE,MAAMC,KAAAA,GAAQC,MAAAA,CAAOC,QAAQ,CAACJ,GAAAA,CAAAA;AAC9B,IAAA,MAAMK,UAAAA,GAAaC,MAAAA,CAAOC,OAAO,CAACL,MAAMG,UAAU,CAAA;AAElD,IAAA,OAAOA,WAAWG,MAAM,CAAC,CAACC,GAAAA,EAAU,CAACC,eAAeC,SAAAA,CAAU,GAAA;AAC5D,QAAA,OAAQA,UAAUC,IAAI;YACpB,KAAK,UAAA;AAAY,gBAAA;;AAEf,oBAAA,MAAMC,kBAAkBF,SAAAA,CAAUG,QAAQ,CAACC,WAAW,EAAA,CAAGC,UAAU,CAAC,OAAA,CAAA;AACpE,oBAAA,IAAIH,eAAAA,EAAiB;AACnB,wBAAA;AACF,oBAAA;;AAGA,oBAAA,MAAMI,SAAAA,GAAYpB,wBAAAA,CAAaqB,kBAAkB,CAAChB,KAAAA,EAAOQ,aAAAA,CAAAA;AACzD,oBAAA,MAAMS,cAAAA,GAAiB;AAACxB,wBAAAA,oBAAAA;AAAsBC,wBAAAA;AAAqB,qBAAA,CAACwB,QAAQ,CAACV,aAAAA,CAAAA;AAE7E,oBAAA,IAAIO,aAAaE,cAAAA,EAAgB;wBAC/BV,GAAG,CAACC,cAAc,GAAG;AAAEW,4BAAAA,MAAAA,EAAQpB,KAAKqB;AAAiB,yBAAA;AACvD,oBAAA;AAEA,oBAAA;AACF,gBAAA;YAEA,KAAK,OAAA;AAAS,gBAAA;;;oBAGZb,GAAG,CAACC,cAAc,GAAG;wBAAEW,MAAAA,EAAQ;AAAC,4BAAA;AAAI;AAAC,qBAAA;AACrC,oBAAA;AACF,gBAAA;YAEA,KAAK,WAAA;AAAa,gBAAA;AAChB,oBAAA,MAAME,QAAAA,GAAWxB,eAAAA,CAAgBY,SAAAA,CAAUa,SAAS,EAAEvB,IAAAA,CAAAA;oBACtDQ,GAAG,CAACC,cAAc,GAAG;AAAEa,wBAAAA;AAAS,qBAAA;AAChC,oBAAA;AACF,gBAAA;YAEA,KAAK,aAAA;AAAe,gBAAA;;AAElB,oBAAA,MAAME,mBAAAA,GAAuBd,CAAAA,SAAAA,CAAUe,UAAU,IAAI,EAAC,EAAGlB,MAAM,CAC7D,CAACC,GAAAA,EAAUkB,YAAAA,GAAAA;wBACTlB,GAAG,CAACkB,aAAa,GAAG;AAAEJ,4BAAAA,QAAAA,EAAUxB,gBAAgB4B,YAAAA,EAAc1B,IAAAA;AAAM,yBAAA;wBACpE,OAAOQ,GAAAA;AACT,oBAAA,CAAA,EACA,EAAC,CAAA;oBAGHA,GAAG,CAACC,cAAc,GAAG;wBAAEkB,EAAAA,EAAIH;AAAoB,qBAAA;AAC/C,oBAAA;AACF,gBAAA;AAGF;QAEA,OAAOhB,GAAAA;AACT,IAAA,CAAA,EAAG,EAAC,CAAA;AACN;;;;"}
1
+ {"version":3,"file":"populate.js","sources":["../../../../src/services/document-service/utils/populate.ts"],"sourcesContent":["import type { UID } from '@strapi/types';\nimport { contentTypes } from '@strapi/utils';\n\ninterface Options {\n /**\n * Fields to select when populating relations\n */\n relationalFields?: string[];\n}\n\nconst { CREATED_BY_ATTRIBUTE, UPDATED_BY_ATTRIBUTE } = contentTypes.constants;\n\nconst deepPopulateCache = new Map<string, any>();\n\n// We want to build a populate object based on the schema\nexport const getDeepPopulate = (uid: UID.Schema, opts: Options = {}) => {\n const cacheKey = `${uid}::${JSON.stringify(opts)}`;\n const cached = deepPopulateCache.get(cacheKey);\n if (cached) {\n return cached;\n }\n\n const model = strapi.getModel(uid);\n const attributes = Object.entries(model.attributes);\n\n const result = attributes.reduce((acc: any, [attributeName, attribute]) => {\n switch (attribute.type) {\n case 'relation': {\n // TODO: Support polymorphic relations\n const isMorphRelation = attribute.relation.toLowerCase().startsWith('morph');\n if (isMorphRelation) {\n break;\n }\n\n // Ignore not visible fields other than createdBy and updatedBy\n const isVisible = contentTypes.isVisibleAttribute(model, attributeName);\n const isCreatorField = [CREATED_BY_ATTRIBUTE, UPDATED_BY_ATTRIBUTE].includes(attributeName);\n\n if (isVisible || isCreatorField) {\n acc[attributeName] = { select: opts.relationalFields };\n }\n\n break;\n }\n\n case 'media': {\n // We populate all media fields for completeness of webhook responses\n // see https://github.com/strapi/strapi/issues/21546\n acc[attributeName] = { select: ['*'] };\n break;\n }\n\n case 'component': {\n const populate = getDeepPopulate(attribute.component, opts);\n acc[attributeName] = { populate };\n break;\n }\n\n case 'dynamiczone': {\n // Use fragments to populate the dynamic zone components\n const populatedComponents = (attribute.components || []).reduce(\n (acc: any, componentUID: UID.Component) => {\n acc[componentUID] = { populate: getDeepPopulate(componentUID, opts) };\n return acc;\n },\n {}\n );\n\n acc[attributeName] = { on: populatedComponents };\n break;\n }\n default:\n break;\n }\n\n return acc;\n }, {});\n\n deepPopulateCache.set(cacheKey, result);\n return result;\n};\n"],"names":["CREATED_BY_ATTRIBUTE","UPDATED_BY_ATTRIBUTE","contentTypes","constants","deepPopulateCache","Map","getDeepPopulate","uid","opts","cacheKey","JSON","stringify","cached","get","model","strapi","getModel","attributes","Object","entries","result","reduce","acc","attributeName","attribute","type","isMorphRelation","relation","toLowerCase","startsWith","isVisible","isVisibleAttribute","isCreatorField","includes","select","relationalFields","populate","component","populatedComponents","components","componentUID","on","set"],"mappings":";;;;AAUA,MAAM,EAAEA,oBAAoB,EAAEC,oBAAoB,EAAE,GAAGC,yBAAaC,SAAS;AAE7E,MAA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KAAK,OAAA;AAAS,gBAAA;;;oBAGZb,GAAG,CAACC,cAAc,GAAG;wBAAEW,MAAAA,EAAQ;AAAC,4BAAA;AAAI;AAAC,qBAAA;AACrC,oBAAA;AACF,gBAAA;YAEA,KAAK,WAAA;AAAa,gBAAA;AAChB,oBAAA,MAAME,QAAAA,GAAW9B,eAAAA,CAAgBkB,SAAAA,CAAUa,SAAS,EAAE7B,IAAAA,CAAAA;oBACtDc,GAAG,CAACC,cAAc,GAAG;AAAEa,wBAAAA;AAAS,qBAAA;AAChC,oBAAA;AACF,gBAAA;YAEA,KAAK,aAAA;AAAe,gBAAA;;AAElB,oBAAA,MAAME,mBAAAA,GAAuBd,CAAAA,SAAAA,CAAUe,UAAU,IAAI,EAAC,EAAGlB,MAAM,CAC7D,CAACC,GAAAA,EAAUkB,YAAAA,GAAAA;wBACTlB,GAAG,CAACkB,aAAa,GAAG;AAAEJ,4BAAAA,QAAAA,EAAU9B,gBAAgBkC,YAAAA,EAAchC,IAAAA;AAAM,yBAAA;wBACpE,OAAOc,GAAAA;AACT,oBAAA,CAAA,EACA,EAAC,CAAA;oBAGHA,GAAG,CAACC,cAAc,GAAG;wBAAEkB,EAAAA,EAAIH;AAAoB,qBAAA;AAC/C,oBAAA;AACF,gBAAA;AAGF;QAEA,OAAOhB,GAAAA;AACT,IAAA,CAAA,EAAG,EAAC,CAAA;IAEJlB,iBAAAA,CAAkBsC,GAAG,CAACjC,QAAAA,EAAUW,MAAAA,CAAAA;IAChC,OAAOA,MAAAA;AACT;;;;"}
@@ -1,11 +1,17 @@
1
1
  import { contentTypes } from '@strapi/utils';
2
2
 
3
3
  const { CREATED_BY_ATTRIBUTE, UPDATED_BY_ATTRIBUTE } = contentTypes.constants;
4
+ const deepPopulateCache = new Map();
4
5
  // We want to build a populate object based on the schema
5
6
  const getDeepPopulate = (uid, opts = {})=>{
7
+ const cacheKey = `${uid}::${JSON.stringify(opts)}`;
8
+ const cached = deepPopulateCache.get(cacheKey);
9
+ if (cached) {
10
+ return cached;
11
+ }
6
12
  const model = strapi.getModel(uid);
7
13
  const attributes = Object.entries(model.attributes);
8
- return attributes.reduce((acc, [attributeName, attribute])=>{
14
+ const result = attributes.reduce((acc, [attributeName, attribute])=>{
9
15
  switch(attribute.type){
10
16
  case 'relation':
11
17
  {
@@ -63,6 +69,8 @@ const getDeepPopulate = (uid, opts = {})=>{
63
69
  }
64
70
  return acc;
65
71
  }, {});
72
+ deepPopulateCache.set(cacheKey, result);
73
+ return result;
66
74
  };
67
75
 
68
76
  export { getDeepPopulate };
@@ -1 +1 @@
1
- {"version":3,"file":"populate.mjs","sources":["../../../../src/services/document-service/utils/populate.ts"],"sourcesContent":["import type { UID } from '@strapi/types';\nimport { contentTypes } from '@strapi/utils';\n\ninterface Options {\n /**\n * Fields to select when populating relations\n */\n relationalFields?: string[];\n}\n\nconst { CREATED_BY_ATTRIBUTE, UPDATED_BY_ATTRIBUTE } = contentTypes.constants;\n\n// We want to build a populate object based on the schema\nexport const getDeepPopulate = (uid: UID.Schema, opts: Options = {}) => {\n const model = strapi.getModel(uid);\n const attributes = Object.entries(model.attributes);\n\n return attributes.reduce((acc: any, [attributeName, attribute]) => {\n switch (attribute.type) {\n case 'relation': {\n // TODO: Support polymorphic relations\n const isMorphRelation = attribute.relation.toLowerCase().startsWith('morph');\n if (isMorphRelation) {\n break;\n }\n\n // Ignore not visible fields other than createdBy and updatedBy\n const isVisible = contentTypes.isVisibleAttribute(model, attributeName);\n const isCreatorField = [CREATED_BY_ATTRIBUTE, UPDATED_BY_ATTRIBUTE].includes(attributeName);\n\n if (isVisible || isCreatorField) {\n acc[attributeName] = { select: opts.relationalFields };\n }\n\n break;\n }\n\n case 'media': {\n // We populate all media fields for completeness of webhook responses\n // see https://github.com/strapi/strapi/issues/21546\n acc[attributeName] = { select: ['*'] };\n break;\n }\n\n case 'component': {\n const populate = getDeepPopulate(attribute.component, opts);\n acc[attributeName] = { populate };\n break;\n }\n\n case 'dynamiczone': {\n // Use fragments to populate the dynamic zone components\n const populatedComponents = (attribute.components || []).reduce(\n (acc: any, componentUID: UID.Component) => {\n acc[componentUID] = { populate: getDeepPopulate(componentUID, opts) };\n return acc;\n },\n {}\n );\n\n acc[attributeName] = { on: populatedComponents };\n break;\n }\n default:\n break;\n }\n\n return acc;\n }, {});\n};\n"],"names":["CREATED_BY_ATTRIBUTE","UPDATED_BY_ATTRIBUTE","contentTypes","constants","getDeepPopulate","uid","opts","model","strapi","getModel","attributes","Object","entries","reduce","acc","attributeName","attribute","type","isMorphRelation","relation","toLowerCase","startsWith","isVisible","isVisibleAttribute","isCreatorField","includes","select","relationalFields","populate","component","populatedComponents","components","componentUID","on"],"mappings":";;AAUA,MAAM,EAAEA,oBAAoB,EAAEC,oBAAoB,EAAE,GAAGC,aAAaC,SAAS;AAE7E;MACaC,eAAAA,GAAkB,CAACC,GAAAA,EAAiBC,IAAAA,GAAgB,EAAE,GAAA;IACjE,MAAMC,KAAAA,GAAQC,MAAAA,CAAOC,QAAQ,CAACJ,GAAAA,CAAAA;AAC9B,IAAA,MAAMK,UAAAA,GAAaC,MAAAA,CAAOC,OAAO,CAACL,MAAMG,UAAU,CAAA;AAElD,IAAA,OAAOA,WAAWG,MAAM,CAAC,CAACC,GAAAA,EAAU,CAACC,eAAeC,SAAAA,CAAU,GAAA;AAC5D,QAAA,OAAQA,UAAUC,IAAI;YACpB,KAAK,UAAA;AAAY,gBAAA;;AAEf,oBAAA,MAAMC,kBAAkBF,SAAAA,CAAUG,QAAQ,CAACC,WAAW,EAAA,CAAGC,UAAU,CAAC,OAAA,CAAA;AACpE,oBAAA,IAAIH,eAAAA,EAAiB;AACnB,wBAAA;AACF,oBAAA;;AAGA,oBAAA,MAAMI,SAAAA,GAAYpB,YAAAA,CAAaqB,kBAAkB,CAAChB,KAAAA,EAAOQ,aAAAA,CAAAA;AACzD,oBAAA,MAAMS,cAAAA,GAAiB;AAACxB,wBAAAA,oBAAAA;AAAsBC,wBAAAA;AAAqB,qBAAA,CAACwB,QAAQ,CAACV,aAAAA,CAAAA;AAE7E,oBAAA,IAAIO,aAAaE,cAAAA,EAAgB;wBAC/BV,GAAG,CAACC,cAAc,GAAG;AAAEW,4BAAAA,MAAAA,EAAQpB,KAAKqB;AAAiB,yBAAA;AACvD,oBAAA;AAEA,oBAAA;AACF,gBAAA;YAEA,KAAK,OAAA;AAAS,gBAAA;;;oBAGZb,GAAG,CAACC,cAAc,GAAG;wBAAEW,MAAAA,EAAQ;AAAC,4BAAA;AAAI;AAAC,qBAAA;AACrC,oBAAA;AACF,gBAAA;YAEA,KAAK,WAAA;AAAa,gBAAA;AAChB,oBAAA,MAAME,QAAAA,GAAWxB,eAAAA,CAAgBY,SAAAA,CAAUa,SAAS,EAAEvB,IAAAA,CAAAA;oBACtDQ,GAAG,CAACC,cAAc,GAAG;AAAEa,wBAAAA;AAAS,qBAAA;AAChC,oBAAA;AACF,gBAAA;YAEA,KAAK,aAAA;AAAe,gBAAA;;AAElB,oBAAA,MAAME,mBAAAA,GAAuBd,CAAAA,SAAAA,CAAUe,UAAU,IAAI,EAAC,EAAGlB,MAAM,CAC7D,CAACC,GAAAA,EAAUkB,YAAAA,GAAAA;wBACTlB,GAAG,CAACkB,aAAa,GAAG;AAAEJ,4BAAAA,QAAAA,EAAUxB,gBAAgB4B,YAAAA,EAAc1B,IAAAA;AAAM,yBAAA;wBACpE,OAAOQ,GAAAA;AACT,oBAAA,CAAA,EACA,EAAC,CAAA;oBAGHA,GAAG,CAACC,cAAc,GAAG;wBAAEkB,EAAAA,EAAIH;AAAoB,qBAAA;AAC/C,oBAAA;AACF,gBAAA;AAGF;QAEA,OAAOhB,GAAAA;AACT,IAAA,CAAA,EAAG,EAAC,CAAA;AACN;;;;"}
1
+ {"version":3,"file":"populate.mjs","sources":["../../../../src/services/document-service/utils/populate.ts"],"sourcesContent":["import type { UID } from '@strapi/types';\nimport { contentTypes } from '@strapi/utils';\n\ninterface Options {\n /**\n * Fields to select when populating relations\n */\n relationalFields?: string[];\n}\n\nconst { CREATED_BY_ATTRIBUTE, UPDATED_BY_ATTRIBUTE } = contentTypes.constants;\n\nconst deepPopulateCache = new Map<string, any>();\n\n// We want to build a populate object based on the schema\nexport const getDeepPopulate = (uid: UID.Schema, opts: Options = {}) => {\n const cacheKey = `${uid}::${JSON.stringify(opts)}`;\n const cached = deepPopulateCache.get(cacheKey);\n if (cached) {\n return cached;\n }\n\n const model = strapi.getModel(uid);\n const attributes = Object.entries(model.attributes);\n\n const result = attributes.reduce((acc: any, [attributeName, attribute]) => {\n switch (attribute.type) {\n case 'relation': {\n // TODO: Support polymorphic relations\n const isMorphRelation = attribute.relation.toLowerCase().startsWith('morph');\n if (isMorphRelation) {\n break;\n }\n\n // Ignore not visible fields other than createdBy and updatedBy\n const isVisible = contentTypes.isVisibleAttribute(model, attributeName);\n const isCreatorField = [CREATED_BY_ATTRIBUTE, UPDATED_BY_ATTRIBUTE].includes(attributeName);\n\n if (isVisible || isCreatorField) {\n acc[attributeName] = { select: opts.relationalFields };\n }\n\n break;\n }\n\n case 'media': {\n // We populate all media fields for completeness of webhook responses\n // see https://github.com/strapi/strapi/issues/21546\n acc[attributeName] = { select: ['*'] };\n break;\n }\n\n case 'component': {\n const populate = getDeepPopulate(attribute.component, opts);\n acc[attributeName] = { populate };\n break;\n }\n\n case 'dynamiczone': {\n // Use fragments to populate the dynamic zone components\n const populatedComponents = (attribute.components || []).reduce(\n (acc: any, componentUID: UID.Component) => {\n acc[componentUID] = { populate: getDeepPopulate(componentUID, opts) };\n return acc;\n },\n {}\n );\n\n acc[attributeName] = { on: populatedComponents };\n break;\n }\n default:\n break;\n }\n\n return acc;\n }, {});\n\n deepPopulateCache.set(cacheKey, result);\n return result;\n};\n"],"names":["CREATED_BY_ATTRIBUTE","UPDATED_BY_ATTRIBUTE","contentTypes","constants","deepPopulateCache","Map","getDeepPopulate","uid","opts","cacheKey","JSON","stringify","cached","get","model","strapi","getModel","attributes","Object","entries","result","reduce","acc","attributeName","attribute","type","isMorphRelation","relation","toLowerCase","startsWith","isVisible","isVisibleAttribute","isCreatorField","includes","select","relationalFields","populate","component","populatedComponents","components","componentUID","on","set"],"mappings":";;AAUA,MAAM,EAAEA,oBAAoB,EAAEC,oBAAoB,EAAE,GAAGC,aAAaC,SAAS;AAE7E,MAAMC,oBAAoB,IAAIC,GAAAA,EAAAA;AAE9B;MACaC,eAAAA,GAAkB,CAACC,GAAAA,EAAiBC,IAAAA,GAAgB,EAAE,GAAA;IACjE,MAAMC,QAAAA,GAAW,GAAGF,GAAAA,CAAI,EAAE,EAAEG,IAAAA,CAAKC,SAAS,CAACH,IAAAA,CAAAA,CAAAA,CAAO;IAClD,MAAMI,MAAAA,GAASR,iBAAAA,CAAkBS,GAAG,CAACJ,QAAAA,CAAAA;AACrC,IAAA,IAAIG,MAAAA,EAAQ;QACV,OAAOA,MAAAA;AACT,IAAA;IAEA,MAAME,KAAAA,GAAQC,MAAAA,CAAOC,QAAQ,CAACT,GAAAA,CAAAA;AAC9B,IAAA,MAAMU,UAAAA,GAAaC,MAAAA,CAAOC,OAAO,CAACL,MAAMG,UAAU,CAAA;IAElD,MAAMG,MAAAA,GAASH,WAAWI,MAAM,CAAC,CAACC,GAAAA,EAAU,CAACC,eAAeC,SAAAA,CAAU,GAAA;AACpE,QAAA,OAAQA,UAAUC,IAAI;YACpB,KAAK,UAAA;AAAY,gBAAA;;AAEf,oBAAA,MAAMC,kBAAkBF,SAAAA,CAAUG,QAAQ,CAACC,WAAW,EAAA,CAAGC,UAAU,CAAC,OAAA,CAAA;AACpE,oBAAA,IAAIH,eAAAA,EAAiB;AACnB,wBAAA;AACF,oBAAA;;AAGA,oBAAA,MAAMI,SAAAA,GAAY5B,YAAAA,CAAa6B,kBAAkB,CAACjB,KAAAA,EAAOS,aAAAA,CAAAA;AACzD,oBAAA,MAAMS,cAAAA,GAAiB;AAAChC,wBAAAA,oBAAAA;AAAsBC,wBAAAA;AAAqB,qBAAA,CAACgC,QAAQ,CAACV,aAAAA,CAAAA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": "Core of Strapi",
5
5
  "homepage": "https://strapi.io",
6
6
  "bugs": {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "git://github.com/strapi/strapi.git",
11
+ "url": "https://github.com/strapi/strapi.git",
12
12
  "directory": "packages/core/core"
13
13
  },
14
14
  "license": "SEE LICENSE IN LICENSE",
@@ -59,14 +59,14 @@
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.38.1",
63
- "@strapi/database": "5.38.1",
64
- "@strapi/generators": "5.38.1",
65
- "@strapi/logger": "5.38.1",
66
- "@strapi/permissions": "5.38.1",
67
- "@strapi/types": "5.38.1",
68
- "@strapi/typescript-utils": "5.38.1",
69
- "@strapi/utils": "5.38.1",
62
+ "@strapi/admin": "5.40.0",
63
+ "@strapi/database": "5.40.0",
64
+ "@strapi/generators": "5.40.0",
65
+ "@strapi/logger": "5.40.0",
66
+ "@strapi/permissions": "5.40.0",
67
+ "@strapi/types": "5.40.0",
68
+ "@strapi/typescript-utils": "5.40.0",
69
+ "@strapi/utils": "5.40.0",
70
70
  "@vercel/stega": "0.1.2",
71
71
  "bcryptjs": "2.4.3",
72
72
  "boxen": "5.1.2",
@@ -134,11 +134,11 @@
134
134
  "@types/node": "24.10.0",
135
135
  "@types/node-schedule": "2.1.7",
136
136
  "@types/statuses": "2.0.1",
137
- "eslint-config-custom": "5.38.1",
137
+ "eslint-config-custom": "5.40.0",
138
138
  "supertest": "6.3.3",
139
- "tsconfig": "5.38.1",
139
+ "tsconfig": "5.40.0",
140
140
  "vitest": "catalog:",
141
- "vitest-config": "5.38.1"
141
+ "vitest-config": "5.40.0"
142
142
  },
143
143
  "engines": {
144
144
  "node": ">=20.0.0 <=24.x.x",