@strapi/core 5.42.0 → 5.42.1
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.
- package/dist/package.json.js +13 -13
- package/dist/package.json.mjs +13 -13
- package/dist/services/document-service/first-published-at.d.ts.map +1 -1
- package/dist/services/document-service/first-published-at.js +12 -2
- package/dist/services/document-service/first-published-at.js.map +1 -1
- package/dist/services/document-service/first-published-at.mjs +12 -2
- package/dist/services/document-service/first-published-at.mjs.map +1 -1
- package/dist/services/document-service/utils/populate.d.ts.map +1 -1
- package/dist/services/document-service/utils/populate.js +7 -13
- package/dist/services/document-service/utils/populate.js.map +1 -1
- package/dist/services/document-service/utils/populate.mjs +7 -13
- package/dist/services/document-service/utils/populate.mjs.map +1 -1
- package/package.json +13 -13
package/dist/package.json.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var name = "@strapi/core";
|
|
6
|
-
var version = "5.42.
|
|
6
|
+
var version = "5.42.1";
|
|
7
7
|
var description = "Core of Strapi";
|
|
8
8
|
var homepage = "https://strapi.io";
|
|
9
9
|
var bugs = {
|
|
@@ -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.42.
|
|
66
|
-
"@strapi/database": "5.42.
|
|
67
|
-
"@strapi/generators": "5.42.
|
|
68
|
-
"@strapi/logger": "5.42.
|
|
69
|
-
"@strapi/permissions": "5.42.
|
|
70
|
-
"@strapi/types": "5.42.
|
|
71
|
-
"@strapi/typescript-utils": "5.42.
|
|
72
|
-
"@strapi/utils": "5.42.
|
|
65
|
+
"@strapi/admin": "5.42.1",
|
|
66
|
+
"@strapi/database": "5.42.1",
|
|
67
|
+
"@strapi/generators": "5.42.1",
|
|
68
|
+
"@strapi/logger": "5.42.1",
|
|
69
|
+
"@strapi/permissions": "5.42.1",
|
|
70
|
+
"@strapi/types": "5.42.1",
|
|
71
|
+
"@strapi/typescript-utils": "5.42.1",
|
|
72
|
+
"@strapi/utils": "5.42.1",
|
|
73
73
|
"@vercel/stega": "0.1.2",
|
|
74
74
|
bcryptjs: "2.4.3",
|
|
75
75
|
boxen: "5.1.2",
|
|
@@ -99,7 +99,7 @@ var dependencies = {
|
|
|
99
99
|
"koa-ip": "^2.1.3",
|
|
100
100
|
"koa-session": "6.4.0",
|
|
101
101
|
"koa-static": "5.0.0",
|
|
102
|
-
lodash: "4.
|
|
102
|
+
lodash: "4.18.1",
|
|
103
103
|
"mime-types": "2.1.35",
|
|
104
104
|
"node-schedule": "2.1.1",
|
|
105
105
|
open: "8.4.0",
|
|
@@ -136,11 +136,11 @@ var devDependencies = {
|
|
|
136
136
|
"@types/node": "24.10.0",
|
|
137
137
|
"@types/node-schedule": "2.1.7",
|
|
138
138
|
"@types/statuses": "2.0.1",
|
|
139
|
-
"eslint-config-custom": "5.42.
|
|
139
|
+
"eslint-config-custom": "5.42.1",
|
|
140
140
|
supertest: "7.2.2",
|
|
141
|
-
tsconfig: "5.42.
|
|
141
|
+
tsconfig: "5.42.1",
|
|
142
142
|
vitest: "catalog:",
|
|
143
|
-
"vitest-config": "5.42.
|
|
143
|
+
"vitest-config": "5.42.1"
|
|
144
144
|
};
|
|
145
145
|
var engines = {
|
|
146
146
|
node: ">=20.0.0 <=24.x.x",
|
package/dist/package.json.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var name = "@strapi/core";
|
|
2
|
-
var version = "5.42.
|
|
2
|
+
var version = "5.42.1";
|
|
3
3
|
var description = "Core of Strapi";
|
|
4
4
|
var homepage = "https://strapi.io";
|
|
5
5
|
var bugs = {
|
|
@@ -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.42.
|
|
62
|
-
"@strapi/database": "5.42.
|
|
63
|
-
"@strapi/generators": "5.42.
|
|
64
|
-
"@strapi/logger": "5.42.
|
|
65
|
-
"@strapi/permissions": "5.42.
|
|
66
|
-
"@strapi/types": "5.42.
|
|
67
|
-
"@strapi/typescript-utils": "5.42.
|
|
68
|
-
"@strapi/utils": "5.42.
|
|
61
|
+
"@strapi/admin": "5.42.1",
|
|
62
|
+
"@strapi/database": "5.42.1",
|
|
63
|
+
"@strapi/generators": "5.42.1",
|
|
64
|
+
"@strapi/logger": "5.42.1",
|
|
65
|
+
"@strapi/permissions": "5.42.1",
|
|
66
|
+
"@strapi/types": "5.42.1",
|
|
67
|
+
"@strapi/typescript-utils": "5.42.1",
|
|
68
|
+
"@strapi/utils": "5.42.1",
|
|
69
69
|
"@vercel/stega": "0.1.2",
|
|
70
70
|
bcryptjs: "2.4.3",
|
|
71
71
|
boxen: "5.1.2",
|
|
@@ -95,7 +95,7 @@ var dependencies = {
|
|
|
95
95
|
"koa-ip": "^2.1.3",
|
|
96
96
|
"koa-session": "6.4.0",
|
|
97
97
|
"koa-static": "5.0.0",
|
|
98
|
-
lodash: "4.
|
|
98
|
+
lodash: "4.18.1",
|
|
99
99
|
"mime-types": "2.1.35",
|
|
100
100
|
"node-schedule": "2.1.1",
|
|
101
101
|
open: "8.4.0",
|
|
@@ -132,11 +132,11 @@ var devDependencies = {
|
|
|
132
132
|
"@types/node": "24.10.0",
|
|
133
133
|
"@types/node-schedule": "2.1.7",
|
|
134
134
|
"@types/statuses": "2.0.1",
|
|
135
|
-
"eslint-config-custom": "5.42.
|
|
135
|
+
"eslint-config-custom": "5.42.1",
|
|
136
136
|
supertest: "7.2.2",
|
|
137
|
-
tsconfig: "5.42.
|
|
137
|
+
tsconfig: "5.42.1",
|
|
138
138
|
vitest: "catalog:",
|
|
139
|
-
"vitest-config": "5.42.
|
|
139
|
+
"vitest-config": "5.42.1"
|
|
140
140
|
};
|
|
141
141
|
var engines = {
|
|
142
142
|
node: ">=20.0.0 <=24.x.x",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-published-at.d.ts","sourceRoot":"","sources":["../../../src/services/document-service/first-published-at.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAErD,KAAK,aAAa,GAAG,CAAC,aAAa,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AACvE,KAAK,eAAe,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,KAAK,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC;AAE9F,QAAA,MAAM,0BAA0B,UACvB,GAAG,UACF,aAAa,eACR,OAAO,WAAW,
|
|
1
|
+
{"version":3,"file":"first-published-at.d.ts","sourceRoot":"","sources":["../../../src/services/document-service/first-published-at.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAErD,KAAK,aAAa,GAAG,CAAC,aAAa,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AACvE,KAAK,eAAe,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,KAAK,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC;AAE9F,QAAA,MAAM,0BAA0B,UACvB,GAAG,UACF,aAAa,eACR,OAAO,WAAW,iBAsBhC,CAAC;AAEF,QAAA,MAAM,0BAA0B,EAAE,eAMjC,CAAC;AAEF,OAAO,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,CAAC"}
|
|
@@ -10,11 +10,21 @@ const addFirstPublishedAtToDraft = async (draft, update, contentType)=>{
|
|
|
10
10
|
if (draft.firstPublishedAt) {
|
|
11
11
|
return draft;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
const now = new Date();
|
|
14
|
+
// Persist to the draft DB row, but discard the return value: entries.update
|
|
15
|
+
// returns an unpopulated findOne (no populate is passed through), which would
|
|
16
|
+
// strip media, components, dynamic zones and relations from the draft that
|
|
17
|
+
// downstream publishEntry relies on. Instead we carry forward the already
|
|
18
|
+
// populated draft from repository.publish's findMany with the field merged in.
|
|
19
|
+
await update(draft, {
|
|
14
20
|
data: {
|
|
15
|
-
firstPublishedAt:
|
|
21
|
+
firstPublishedAt: now
|
|
16
22
|
}
|
|
17
23
|
});
|
|
24
|
+
return {
|
|
25
|
+
...draft,
|
|
26
|
+
firstPublishedAt: now
|
|
27
|
+
};
|
|
18
28
|
};
|
|
19
29
|
const filterDataFirstPublishedAt = (params)=>{
|
|
20
30
|
if (params?.data?.firstPublishedAt) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-published-at.js","sources":["../../../src/services/document-service/first-published-at.ts"],"sourcesContent":["import { contentTypes } from '@strapi/utils';\nimport { assoc } from 'lodash/fp';\nimport type { Modules, Schema } from '@strapi/types';\n\ntype EntriesUpdate = (entryToUpdate: any, param?: any) => Promise<any>;\ntype ParamsTransform = (params: Modules.Documents.Params.All) => Modules.Documents.Params.All;\n\nconst addFirstPublishedAtToDraft = async (\n draft: any,\n update: EntriesUpdate,\n contentType: Schema.ContentType\n) => {\n if (!contentTypes.hasFirstPublishedAtField(contentType)) {\n return draft;\n }\n\n if (draft.firstPublishedAt) {\n return draft;\n }\n\n return update(draft, {\n data: {
|
|
1
|
+
{"version":3,"file":"first-published-at.js","sources":["../../../src/services/document-service/first-published-at.ts"],"sourcesContent":["import { contentTypes } from '@strapi/utils';\nimport { assoc } from 'lodash/fp';\nimport type { Modules, Schema } from '@strapi/types';\n\ntype EntriesUpdate = (entryToUpdate: any, param?: any) => Promise<any>;\ntype ParamsTransform = (params: Modules.Documents.Params.All) => Modules.Documents.Params.All;\n\nconst addFirstPublishedAtToDraft = async (\n draft: any,\n update: EntriesUpdate,\n contentType: Schema.ContentType\n) => {\n if (!contentTypes.hasFirstPublishedAtField(contentType)) {\n return draft;\n }\n\n if (draft.firstPublishedAt) {\n return draft;\n }\n\n const now = new Date();\n\n // Persist to the draft DB row, but discard the return value: entries.update\n // returns an unpopulated findOne (no populate is passed through), which would\n // strip media, components, dynamic zones and relations from the draft that\n // downstream publishEntry relies on. Instead we carry forward the already\n // populated draft from repository.publish's findMany with the field merged in.\n await update(draft, {\n data: { firstPublishedAt: now },\n });\n\n return { ...draft, firstPublishedAt: now };\n};\n\nconst filterDataFirstPublishedAt: ParamsTransform = (params) => {\n if (params?.data?.firstPublishedAt) {\n return assoc(['data', 'firstPublishedAt'], null, params);\n }\n\n return params;\n};\n\nexport { addFirstPublishedAtToDraft, filterDataFirstPublishedAt };\n"],"names":["addFirstPublishedAtToDraft","draft","update","contentType","contentTypes","hasFirstPublishedAtField","firstPublishedAt","now","Date","data","filterDataFirstPublishedAt","params","assoc"],"mappings":";;;;;AAOA,MAAMA,0BAAAA,GAA6B,OACjCC,KAAAA,EACAC,MAAAA,EACAC,WAAAA,GAAAA;AAEA,IAAA,IAAI,CAACC,wBAAAA,CAAaC,wBAAwB,CAACF,WAAAA,CAAAA,EAAc;QACvD,OAAOF,KAAAA;AACT,IAAA;IAEA,IAAIA,KAAAA,CAAMK,gBAAgB,EAAE;QAC1B,OAAOL,KAAAA;AACT,IAAA;AAEA,IAAA,MAAMM,MAAM,IAAIC,IAAAA,EAAAA;;;;;;AAOhB,IAAA,MAAMN,OAAOD,KAAAA,EAAO;QAClBQ,IAAAA,EAAM;YAAEH,gBAAAA,EAAkBC;AAAI;AAChC,KAAA,CAAA;IAEA,OAAO;AAAE,QAAA,GAAGN,KAAK;QAAEK,gBAAAA,EAAkBC;AAAI,KAAA;AAC3C;AAEA,MAAMG,6BAA8C,CAACC,MAAAA,GAAAA;IACnD,IAAIA,MAAAA,EAAQF,MAAMH,gBAAAA,EAAkB;AAClC,QAAA,OAAOM,QAAAA,CAAM;AAAC,YAAA,MAAA;AAAQ,YAAA;AAAmB,SAAA,EAAE,IAAA,EAAMD,MAAAA,CAAAA;AACnD,IAAA;IAEA,OAAOA,MAAAA;AACT;;;;;"}
|
|
@@ -8,11 +8,21 @@ const addFirstPublishedAtToDraft = async (draft, update, contentType)=>{
|
|
|
8
8
|
if (draft.firstPublishedAt) {
|
|
9
9
|
return draft;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
const now = new Date();
|
|
12
|
+
// Persist to the draft DB row, but discard the return value: entries.update
|
|
13
|
+
// returns an unpopulated findOne (no populate is passed through), which would
|
|
14
|
+
// strip media, components, dynamic zones and relations from the draft that
|
|
15
|
+
// downstream publishEntry relies on. Instead we carry forward the already
|
|
16
|
+
// populated draft from repository.publish's findMany with the field merged in.
|
|
17
|
+
await update(draft, {
|
|
12
18
|
data: {
|
|
13
|
-
firstPublishedAt:
|
|
19
|
+
firstPublishedAt: now
|
|
14
20
|
}
|
|
15
21
|
});
|
|
22
|
+
return {
|
|
23
|
+
...draft,
|
|
24
|
+
firstPublishedAt: now
|
|
25
|
+
};
|
|
16
26
|
};
|
|
17
27
|
const filterDataFirstPublishedAt = (params)=>{
|
|
18
28
|
if (params?.data?.firstPublishedAt) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-published-at.mjs","sources":["../../../src/services/document-service/first-published-at.ts"],"sourcesContent":["import { contentTypes } from '@strapi/utils';\nimport { assoc } from 'lodash/fp';\nimport type { Modules, Schema } from '@strapi/types';\n\ntype EntriesUpdate = (entryToUpdate: any, param?: any) => Promise<any>;\ntype ParamsTransform = (params: Modules.Documents.Params.All) => Modules.Documents.Params.All;\n\nconst addFirstPublishedAtToDraft = async (\n draft: any,\n update: EntriesUpdate,\n contentType: Schema.ContentType\n) => {\n if (!contentTypes.hasFirstPublishedAtField(contentType)) {\n return draft;\n }\n\n if (draft.firstPublishedAt) {\n return draft;\n }\n\n return update(draft, {\n data: {
|
|
1
|
+
{"version":3,"file":"first-published-at.mjs","sources":["../../../src/services/document-service/first-published-at.ts"],"sourcesContent":["import { contentTypes } from '@strapi/utils';\nimport { assoc } from 'lodash/fp';\nimport type { Modules, Schema } from '@strapi/types';\n\ntype EntriesUpdate = (entryToUpdate: any, param?: any) => Promise<any>;\ntype ParamsTransform = (params: Modules.Documents.Params.All) => Modules.Documents.Params.All;\n\nconst addFirstPublishedAtToDraft = async (\n draft: any,\n update: EntriesUpdate,\n contentType: Schema.ContentType\n) => {\n if (!contentTypes.hasFirstPublishedAtField(contentType)) {\n return draft;\n }\n\n if (draft.firstPublishedAt) {\n return draft;\n }\n\n const now = new Date();\n\n // Persist to the draft DB row, but discard the return value: entries.update\n // returns an unpopulated findOne (no populate is passed through), which would\n // strip media, components, dynamic zones and relations from the draft that\n // downstream publishEntry relies on. Instead we carry forward the already\n // populated draft from repository.publish's findMany with the field merged in.\n await update(draft, {\n data: { firstPublishedAt: now },\n });\n\n return { ...draft, firstPublishedAt: now };\n};\n\nconst filterDataFirstPublishedAt: ParamsTransform = (params) => {\n if (params?.data?.firstPublishedAt) {\n return assoc(['data', 'firstPublishedAt'], null, params);\n }\n\n return params;\n};\n\nexport { addFirstPublishedAtToDraft, filterDataFirstPublishedAt };\n"],"names":["addFirstPublishedAtToDraft","draft","update","contentType","contentTypes","hasFirstPublishedAtField","firstPublishedAt","now","Date","data","filterDataFirstPublishedAt","params","assoc"],"mappings":";;;AAOA,MAAMA,0BAAAA,GAA6B,OACjCC,KAAAA,EACAC,MAAAA,EACAC,WAAAA,GAAAA;AAEA,IAAA,IAAI,CAACC,YAAAA,CAAaC,wBAAwB,CAACF,WAAAA,CAAAA,EAAc;QACvD,OAAOF,KAAAA;AACT,IAAA;IAEA,IAAIA,KAAAA,CAAMK,gBAAgB,EAAE;QAC1B,OAAOL,KAAAA;AACT,IAAA;AAEA,IAAA,MAAMM,MAAM,IAAIC,IAAAA,EAAAA;;;;;;AAOhB,IAAA,MAAMN,OAAOD,KAAAA,EAAO;QAClBQ,IAAAA,EAAM;YAAEH,gBAAAA,EAAkBC;AAAI;AAChC,KAAA,CAAA;IAEA,OAAO;AAAE,QAAA,GAAGN,KAAK;QAAEK,gBAAAA,EAAkBC;AAAI,KAAA;AAC3C;AAEA,MAAMG,6BAA8C,CAACC,MAAAA,GAAAA;IACnD,IAAIA,MAAAA,EAAQF,MAAMH,gBAAAA,EAAkB;AAClC,QAAA,OAAOM,KAAAA,CAAM;AAAC,YAAA,MAAA;AAAQ,YAAA;AAAmB,SAAA,EAAE,IAAA,EAAMD,MAAAA,CAAAA;AACnD,IAAA;IAEA,OAAOA,MAAAA;AACT;;;;"}
|
|
@@ -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;
|
|
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;AAEzC,UAAU,OAAO;IACf;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAKD,eAAO,MAAM,eAAe,QAAS,IAAI,MAAM,SAAQ,OAAO,QAkE7D,CAAC"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var strapiUtils = require('@strapi/utils');
|
|
4
|
-
|
|
5
|
-
const { CREATED_BY_ATTRIBUTE, UPDATED_BY_ATTRIBUTE } = strapiUtils.contentTypes.constants;
|
|
6
3
|
const deepPopulateCache = new Map();
|
|
7
4
|
// We want to build a populate object based on the schema
|
|
8
5
|
const getDeepPopulate = (uid, opts = {})=>{
|
|
@@ -22,17 +19,14 @@ const getDeepPopulate = (uid, opts = {})=>{
|
|
|
22
19
|
if (isMorphRelation) {
|
|
23
20
|
break;
|
|
24
21
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const isCreatorField = [
|
|
28
|
-
CREATED_BY_ATTRIBUTE,
|
|
29
|
-
UPDATED_BY_ATTRIBUTE
|
|
30
|
-
].includes(attributeName);
|
|
31
|
-
if (isVisible || isCreatorField) {
|
|
32
|
-
acc[attributeName] = {
|
|
33
|
-
select: opts.relationalFields
|
|
34
|
-
};
|
|
22
|
+
if ('unstable_virtual' in attribute && attribute.unstable_virtual) {
|
|
23
|
+
break;
|
|
35
24
|
}
|
|
25
|
+
// Include all non-morph relations (including visible: false) so publish / discardDraft /
|
|
26
|
+
// clone preserve links—same idea as content-manager getPopulateForRelation for invisible attrs.
|
|
27
|
+
acc[attributeName] = {
|
|
28
|
+
select: opts.relationalFields
|
|
29
|
+
};
|
|
36
30
|
break;
|
|
37
31
|
}
|
|
38
32
|
case 'media':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"populate.js","sources":["../../../../src/services/document-service/utils/populate.ts"],"sourcesContent":["import type { UID } from '@strapi/types';\
|
|
1
|
+
{"version":3,"file":"populate.js","sources":["../../../../src/services/document-service/utils/populate.ts"],"sourcesContent":["import type { UID } from '@strapi/types';\n\ninterface Options {\n /**\n * Fields to select when populating relations\n */\n relationalFields?: string[];\n}\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 if ('unstable_virtual' in attribute && attribute.unstable_virtual) {\n // skip relations not managed by the DB layer\n break;\n }\n\n // Include all non-morph relations (including visible: false) so publish / discardDraft /\n // clone preserve links—same idea as content-manager getPopulateForRelation for invisible attrs.\n acc[attributeName] = { select: opts.relationalFields };\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":["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","unstable_virtual","select","relationalFields","populate","component","populatedComponents","components","componentUID","on","set"],"mappings":";;AASA,MAAMA,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;AAEA,oBAAA,IAAI,kBAAA,IAAsBF,SAAAA,IAAaA,SAAAA,CAAUM,gBAAgB,EAAE;AAEjE,wBAAA;AACF,oBAAA;;;oBAIAR,GAAG,CAACC,cAAc,GAAG;AAAEQ,wBAAAA,MAAAA,EAAQvB,KAAKwB;AAAiB,qBAAA;AAErD,oBAAA;AACF,gBAAA;YAEA,KAAK,OAAA;AAAS,gBAAA;;;oBAGZV,GAAG,CAACC,cAAc,GAAG;wBAAEQ,MAAAA,EAAQ;AAAC,4BAAA;AAAI;AAAC,qBAAA;AACrC,oBAAA;AACF,gBAAA;YAEA,KAAK,WAAA;AAAa,gBAAA;AAChB,oBAAA,MAAME,QAAAA,GAAW3B,eAAAA,CAAgBkB,SAAAA,CAAUU,SAAS,EAAE1B,IAAAA,CAAAA;oBACtDc,GAAG,CAACC,cAAc,GAAG;AAAEU,wBAAAA;AAAS,qBAAA;AAChC,oBAAA;AACF,gBAAA;YAEA,KAAK,aAAA;AAAe,gBAAA;;AAElB,oBAAA,MAAME,mBAAAA,GAAuBX,CAAAA,SAAAA,CAAUY,UAAU,IAAI,EAAC,EAAGf,MAAM,CAC7D,CAACC,GAAAA,EAAUe,YAAAA,GAAAA;wBACTf,GAAG,CAACe,aAAa,GAAG;AAAEJ,4BAAAA,QAAAA,EAAU3B,gBAAgB+B,YAAAA,EAAc7B,IAAAA;AAAM,yBAAA;wBACpE,OAAOc,GAAAA;AACT,oBAAA,CAAA,EACA,EAAC,CAAA;oBAGHA,GAAG,CAACC,cAAc,GAAG;wBAAEe,EAAAA,EAAIH;AAAoB,qBAAA;AAC/C,oBAAA;AACF,gBAAA;AAGF;QAEA,OAAOb,GAAAA;AACT,IAAA,CAAA,EAAG,EAAC,CAAA;IAEJlB,iBAAAA,CAAkBmC,GAAG,CAAC9B,QAAAA,EAAUW,MAAAA,CAAAA;IAChC,OAAOA,MAAAA;AACT;;;;"}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { contentTypes } from '@strapi/utils';
|
|
2
|
-
|
|
3
|
-
const { CREATED_BY_ATTRIBUTE, UPDATED_BY_ATTRIBUTE } = contentTypes.constants;
|
|
4
1
|
const deepPopulateCache = new Map();
|
|
5
2
|
// We want to build a populate object based on the schema
|
|
6
3
|
const getDeepPopulate = (uid, opts = {})=>{
|
|
@@ -20,17 +17,14 @@ const getDeepPopulate = (uid, opts = {})=>{
|
|
|
20
17
|
if (isMorphRelation) {
|
|
21
18
|
break;
|
|
22
19
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const isCreatorField = [
|
|
26
|
-
CREATED_BY_ATTRIBUTE,
|
|
27
|
-
UPDATED_BY_ATTRIBUTE
|
|
28
|
-
].includes(attributeName);
|
|
29
|
-
if (isVisible || isCreatorField) {
|
|
30
|
-
acc[attributeName] = {
|
|
31
|
-
select: opts.relationalFields
|
|
32
|
-
};
|
|
20
|
+
if ('unstable_virtual' in attribute && attribute.unstable_virtual) {
|
|
21
|
+
break;
|
|
33
22
|
}
|
|
23
|
+
// Include all non-morph relations (including visible: false) so publish / discardDraft /
|
|
24
|
+
// clone preserve links—same idea as content-manager getPopulateForRelation for invisible attrs.
|
|
25
|
+
acc[attributeName] = {
|
|
26
|
+
select: opts.relationalFields
|
|
27
|
+
};
|
|
34
28
|
break;
|
|
35
29
|
}
|
|
36
30
|
case 'media':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"populate.mjs","sources":["../../../../src/services/document-service/utils/populate.ts"],"sourcesContent":["import type { UID } from '@strapi/types';\
|
|
1
|
+
{"version":3,"file":"populate.mjs","sources":["../../../../src/services/document-service/utils/populate.ts"],"sourcesContent":["import type { UID } from '@strapi/types';\n\ninterface Options {\n /**\n * Fields to select when populating relations\n */\n relationalFields?: string[];\n}\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 if ('unstable_virtual' in attribute && attribute.unstable_virtual) {\n // skip relations not managed by the DB layer\n break;\n }\n\n // Include all non-morph relations (including visible: false) so publish / discardDraft /\n // clone preserve links—same idea as content-manager getPopulateForRelation for invisible attrs.\n acc[attributeName] = { select: opts.relationalFields };\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":["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","unstable_virtual","select","relationalFields","populate","component","populatedComponents","components","componentUID","on","set"],"mappings":"AASA,MAAMA,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;AAEA,oBAAA,IAAI,kBAAA,IAAsBF,SAAAA,IAAaA,SAAAA,CAAUM,gBAAgB,EAAE;AAEjE,wBAAA;AACF,oBAAA;;;oBAIAR,GAAG,CAACC,cAAc,GAAG;AAAEQ,wBAAAA,MAAAA,EAAQvB,KAAKwB;AAAiB,qBAAA;AAErD,oBAAA;AACF,gBAAA;YAEA,KAAK,OAAA;AAAS,gBAAA;;;oBAGZV,GAAG,CAACC,cAAc,GAAG;wBAAEQ,MAAAA,EAAQ;AAAC,4BAAA;AAAI;AAAC,qBAAA;AACrC,oBAAA;AACF,gBAAA;YAEA,KAAK,WAAA;AAAa,gBAAA;AAChB,oBAAA,MAAME,QAAAA,GAAW3B,eAAAA,CAAgBkB,SAAAA,CAAUU,SAAS,EAAE1B,IAAAA,CAAAA;oBACtDc,GAAG,CAACC,cAAc,GAAG;AAAEU,wBAAAA;AAAS,qBAAA;AAChC,oBAAA;AACF,gBAAA;YAEA,KAAK,aAAA;AAAe,gBAAA;;AAElB,oBAAA,MAAME,mBAAAA,GAAuBX,CAAAA,SAAAA,CAAUY,UAAU,IAAI,EAAC,EAAGf,MAAM,CAC7D,CAACC,GAAAA,EAAUe,YAAAA,GAAAA;wBACTf,GAAG,CAACe,aAAa,GAAG;AAAEJ,4BAAAA,QAAAA,EAAU3B,gBAAgB+B,YAAAA,EAAc7B,IAAAA;AAAM,yBAAA;wBACpE,OAAOc,GAAAA;AACT,oBAAA,CAAA,EACA,EAAC,CAAA;oBAGHA,GAAG,CAACC,cAAc,GAAG;wBAAEe,EAAAA,EAAIH;AAAoB,qBAAA;AAC/C,oBAAA;AACF,gBAAA;AAGF;QAEA,OAAOb,GAAAA;AACT,IAAA,CAAA,EAAG,EAAC,CAAA;IAEJlB,iBAAAA,CAAkBmC,GAAG,CAAC9B,QAAAA,EAAUW,MAAAA,CAAAA;IAChC,OAAOA,MAAAA;AACT;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/core",
|
|
3
|
-
"version": "5.42.
|
|
3
|
+
"version": "5.42.1",
|
|
4
4
|
"description": "Core of Strapi",
|
|
5
5
|
"homepage": "https://strapi.io",
|
|
6
6
|
"bugs": {
|
|
@@ -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.42.
|
|
63
|
-
"@strapi/database": "5.42.
|
|
64
|
-
"@strapi/generators": "5.42.
|
|
65
|
-
"@strapi/logger": "5.42.
|
|
66
|
-
"@strapi/permissions": "5.42.
|
|
67
|
-
"@strapi/types": "5.42.
|
|
68
|
-
"@strapi/typescript-utils": "5.42.
|
|
69
|
-
"@strapi/utils": "5.42.
|
|
62
|
+
"@strapi/admin": "5.42.1",
|
|
63
|
+
"@strapi/database": "5.42.1",
|
|
64
|
+
"@strapi/generators": "5.42.1",
|
|
65
|
+
"@strapi/logger": "5.42.1",
|
|
66
|
+
"@strapi/permissions": "5.42.1",
|
|
67
|
+
"@strapi/types": "5.42.1",
|
|
68
|
+
"@strapi/typescript-utils": "5.42.1",
|
|
69
|
+
"@strapi/utils": "5.42.1",
|
|
70
70
|
"@vercel/stega": "0.1.2",
|
|
71
71
|
"bcryptjs": "2.4.3",
|
|
72
72
|
"boxen": "5.1.2",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"koa-ip": "^2.1.3",
|
|
97
97
|
"koa-session": "6.4.0",
|
|
98
98
|
"koa-static": "5.0.0",
|
|
99
|
-
"lodash": "4.
|
|
99
|
+
"lodash": "4.18.1",
|
|
100
100
|
"mime-types": "2.1.35",
|
|
101
101
|
"node-schedule": "2.1.1",
|
|
102
102
|
"open": "8.4.0",
|
|
@@ -133,11 +133,11 @@
|
|
|
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.42.
|
|
136
|
+
"eslint-config-custom": "5.42.1",
|
|
137
137
|
"supertest": "7.2.2",
|
|
138
|
-
"tsconfig": "5.42.
|
|
138
|
+
"tsconfig": "5.42.1",
|
|
139
139
|
"vitest": "catalog:",
|
|
140
|
-
"vitest-config": "5.42.
|
|
140
|
+
"vitest-config": "5.42.1"
|
|
141
141
|
},
|
|
142
142
|
"engines": {
|
|
143
143
|
"node": ">=20.0.0 <=24.x.x",
|