@strapi/core 5.42.0 → 5.43.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.
- package/dist/Strapi.d.ts +1 -0
- package/dist/Strapi.d.ts.map +1 -1
- package/dist/Strapi.js +3 -0
- package/dist/Strapi.js.map +1 -1
- package/dist/Strapi.mjs +3 -0
- package/dist/Strapi.mjs.map +1 -1
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +13 -8
- package/dist/compile.js.map +1 -1
- package/dist/compile.mjs +13 -8
- package/dist/compile.mjs.map +1 -1
- package/dist/package.json.js +14 -14
- package/dist/package.json.mjs +14 -14
- package/dist/providers/ai.d.ts +3 -0
- package/dist/providers/ai.d.ts.map +1 -0
- package/dist/providers/ai.js +13 -0
- package/dist/providers/ai.js.map +1 -0
- package/dist/providers/ai.mjs +11 -0
- package/dist/providers/ai.mjs.map +1 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +2 -0
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/index.mjs +2 -0
- package/dist/providers/index.mjs.map +1 -1
- package/dist/services/ai.d.ts +3 -0
- package/dist/services/ai.d.ts.map +1 -0
- package/dist/services/ai.js +10 -0
- package/dist/services/ai.js.map +1 -0
- package/dist/services/ai.mjs +8 -0
- package/dist/services/ai.mjs.map +1 -0
- 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/dist/services/entity-validator/blocks-validator.js +1 -1
- package/dist/services/entity-validator/blocks-validator.js.map +1 -1
- package/dist/services/entity-validator/blocks-validator.mjs +1 -1
- package/dist/services/entity-validator/blocks-validator.mjs.map +1 -1
- package/package.json +14 -14
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../src/providers/ai.ts"],"names":[],"mappings":";AAIA,wBAIG"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var provider = require('./provider.js');
|
|
4
|
+
var ai$1 = require('../services/ai.js');
|
|
5
|
+
|
|
6
|
+
var ai = provider.defineProvider({
|
|
7
|
+
init (strapi) {
|
|
8
|
+
strapi.add('ai', (s)=>ai$1.createAiNamespace(s));
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
module.exports = ai;
|
|
13
|
+
//# sourceMappingURL=ai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai.js","sources":["../../src/providers/ai.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport { defineProvider } from './provider';\nimport { createAiNamespace } from '../services/ai';\n\nexport default defineProvider({\n init(strapi) {\n strapi.add('ai', (s: Core.Strapi) => createAiNamespace(s));\n },\n});\n"],"names":["defineProvider","init","strapi","add","s","createAiNamespace"],"mappings":";;;;;AAIA,SAAeA,uBAAAA,CAAe;AAC5BC,IAAAA,IAAAA,CAAAA,CAAKC,MAAM,EAAA;AACTA,QAAAA,MAAAA,CAAOC,GAAG,CAAC,IAAA,EAAM,CAACC,IAAmBC,sBAAAA,CAAkBD,CAAAA,CAAAA,CAAAA;AACzD,IAAA;AACF,CAAA,CAAA;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { defineProvider } from './provider.mjs';
|
|
2
|
+
import { createAiNamespace } from '../services/ai.mjs';
|
|
3
|
+
|
|
4
|
+
var ai = defineProvider({
|
|
5
|
+
init (strapi) {
|
|
6
|
+
strapi.add('ai', (s)=>createAiNamespace(s));
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export { ai as default };
|
|
11
|
+
//# sourceMappingURL=ai.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai.mjs","sources":["../../src/providers/ai.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport { defineProvider } from './provider';\nimport { createAiNamespace } from '../services/ai';\n\nexport default defineProvider({\n init(strapi) {\n strapi.add('ai', (s: Core.Strapi) => createAiNamespace(s));\n },\n});\n"],"names":["defineProvider","init","strapi","add","s","createAiNamespace"],"mappings":";;;AAIA,SAAeA,cAAAA,CAAe;AAC5BC,IAAAA,IAAAA,CAAAA,CAAKC,MAAM,EAAA;AACTA,QAAAA,MAAAA,CAAOC,GAAG,CAAC,IAAA,EAAM,CAACC,IAAmBC,iBAAAA,CAAkBD,CAAAA,CAAAA,CAAAA;AACzD,IAAA;AACF,CAAA,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,eAAO,MAAM,SAAS,EAAE,QAAQ,EAS/B,CAAC"}
|
package/dist/providers/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var admin = require('./admin.js');
|
|
4
|
+
var ai = require('./ai.js');
|
|
4
5
|
var coreStore = require('./coreStore.js');
|
|
5
6
|
var cron = require('./cron.js');
|
|
6
7
|
var registries = require('./registries.js');
|
|
@@ -11,6 +12,7 @@ var webhooks = require('./webhooks.js');
|
|
|
11
12
|
const providers = [
|
|
12
13
|
registries,
|
|
13
14
|
admin,
|
|
15
|
+
ai,
|
|
14
16
|
coreStore,
|
|
15
17
|
sessionManager,
|
|
16
18
|
webhooks,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/providers/index.ts"],"sourcesContent":["import admin from './admin';\nimport coreStore from './coreStore';\nimport cron from './cron';\nimport registries from './registries';\nimport sessionManager from './session-manager';\nimport telemetry from './telemetry';\nimport webhooks from './webhooks';\n\nimport type { Provider } from './provider';\n\nexport const providers: Provider[] = [\n registries,\n admin,\n coreStore,\n sessionManager,\n webhooks,\n telemetry,\n cron,\n];\n"],"names":["providers","registries","admin","coreStore","sessionManager","webhooks","telemetry","cron"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/providers/index.ts"],"sourcesContent":["import admin from './admin';\nimport ai from './ai';\nimport coreStore from './coreStore';\nimport cron from './cron';\nimport registries from './registries';\nimport sessionManager from './session-manager';\nimport telemetry from './telemetry';\nimport webhooks from './webhooks';\n\nimport type { Provider } from './provider';\n\nexport const providers: Provider[] = [\n registries,\n admin,\n ai,\n coreStore,\n sessionManager,\n webhooks,\n telemetry,\n cron,\n];\n"],"names":["providers","registries","admin","ai","coreStore","sessionManager","webhooks","telemetry","cron"],"mappings":";;;;;;;;;;;MAWaA,SAAAA,GAAwB;AACnCC,IAAAA,UAAAA;AACAC,IAAAA,KAAAA;AACAC,IAAAA,EAAAA;AACAC,IAAAA,SAAAA;AACAC,IAAAA,cAAAA;AACAC,IAAAA,QAAAA;AACAC,IAAAA,SAAAA;AACAC,IAAAA;;;;;"}
|
package/dist/providers/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import admin from './admin.mjs';
|
|
2
|
+
import ai from './ai.mjs';
|
|
2
3
|
import coreStore from './coreStore.mjs';
|
|
3
4
|
import cron from './cron.mjs';
|
|
4
5
|
import registries from './registries.mjs';
|
|
@@ -9,6 +10,7 @@ import webhooks from './webhooks.mjs';
|
|
|
9
10
|
const providers = [
|
|
10
11
|
registries,
|
|
11
12
|
admin,
|
|
13
|
+
ai,
|
|
12
14
|
coreStore,
|
|
13
15
|
sessionManager,
|
|
14
16
|
webhooks,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/providers/index.ts"],"sourcesContent":["import admin from './admin';\nimport coreStore from './coreStore';\nimport cron from './cron';\nimport registries from './registries';\nimport sessionManager from './session-manager';\nimport telemetry from './telemetry';\nimport webhooks from './webhooks';\n\nimport type { Provider } from './provider';\n\nexport const providers: Provider[] = [\n registries,\n admin,\n coreStore,\n sessionManager,\n webhooks,\n telemetry,\n cron,\n];\n"],"names":["providers","registries","admin","coreStore","sessionManager","webhooks","telemetry","cron"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/providers/index.ts"],"sourcesContent":["import admin from './admin';\nimport ai from './ai';\nimport coreStore from './coreStore';\nimport cron from './cron';\nimport registries from './registries';\nimport sessionManager from './session-manager';\nimport telemetry from './telemetry';\nimport webhooks from './webhooks';\n\nimport type { Provider } from './provider';\n\nexport const providers: Provider[] = [\n registries,\n admin,\n ai,\n coreStore,\n sessionManager,\n webhooks,\n telemetry,\n cron,\n];\n"],"names":["providers","registries","admin","ai","coreStore","sessionManager","webhooks","telemetry","cron"],"mappings":";;;;;;;;;MAWaA,SAAAA,GAAwB;AACnCC,IAAAA,UAAAA;AACAC,IAAAA,KAAAA;AACAC,IAAAA,EAAAA;AACAC,IAAAA,SAAAA;AACAC,IAAAA,cAAAA;AACAC,IAAAA,QAAAA;AACAC,IAAAA,SAAAA;AACAC,IAAAA;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../src/services/ai.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAEnD,eAAO,MAAM,iBAAiB,WAAY,KAAK,MAAM,KAAG,QAAQ,EAAE,CAAC,WAIjE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai.js","sources":["../../src/services/ai.ts"],"sourcesContent":["import type { Core, Modules } from '@strapi/types';\n\nexport const createAiNamespace = (strapi: Core.Strapi): Modules.AI.AiNamespace => ({\n get admin(): Modules.AI.AiAdminService {\n return strapi.get('ai.admin');\n },\n});\n"],"names":["createAiNamespace","strapi","admin","get"],"mappings":";;AAEO,MAAMA,iBAAAA,GAAoB,CAACC,MAAAA,IAAiD;AACjF,QAAA,IAAIC,KAAAA,CAAAA,GAAmC;YACrC,OAAOD,MAAAA,CAAOE,GAAG,CAAC,UAAA,CAAA;AACpB,QAAA;AACF,KAAA;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai.mjs","sources":["../../src/services/ai.ts"],"sourcesContent":["import type { Core, Modules } from '@strapi/types';\n\nexport const createAiNamespace = (strapi: Core.Strapi): Modules.AI.AiNamespace => ({\n get admin(): Modules.AI.AiAdminService {\n return strapi.get('ai.admin');\n },\n});\n"],"names":["createAiNamespace","strapi","admin","get"],"mappings":"AAEO,MAAMA,iBAAAA,GAAoB,CAACC,MAAAA,IAAiD;AACjF,QAAA,IAAIC,KAAAA,CAAAA,GAAmC;YACrC,OAAOD,MAAAA,CAAOE,GAAG,CAAC,UAAA,CAAA;AACpB,QAAA;AACF,KAAA;;;;"}
|
|
@@ -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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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,CA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BAAA,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;;;;"}
|
|
@@ -119,7 +119,7 @@ const imageNodeValidator = strapiUtils.yup.object().shape({
|
|
|
119
119
|
caption: strapiUtils.yup.string().nullable(),
|
|
120
120
|
width: strapiUtils.yup.number().required(),
|
|
121
121
|
height: strapiUtils.yup.number().required(),
|
|
122
|
-
formats: strapiUtils.yup.object().
|
|
122
|
+
formats: strapiUtils.yup.object().nullable(),
|
|
123
123
|
hash: strapiUtils.yup.string().required(),
|
|
124
124
|
ext: strapiUtils.yup.string().required(),
|
|
125
125
|
mime: strapiUtils.yup.string().required(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks-validator.js","sources":["../../../src/services/entity-validator/blocks-validator.ts"],"sourcesContent":["import { yup } from '@strapi/utils';\n\nconst textNodeValidator = yup.object().shape({\n type: yup.string().equals(['text']).required(),\n text: yup\n .string()\n .test(\n 'is-valid-text',\n 'Text must be defined with at least an empty string',\n (text: unknown) => {\n return typeof text === 'string' || text === '';\n }\n ),\n bold: yup.boolean(),\n italic: yup.boolean(),\n underline: yup.boolean(),\n strikethrough: yup.boolean(),\n code: yup.boolean(),\n});\n\nconst checkValidLink = (link: string) => {\n try {\n // eslint-disable-next-line no-new\n new URL(link.startsWith('/') ? `https://strapi.io${link}` : link);\n } catch (error) {\n return false;\n }\n return true;\n};\n\nconst linkNodeValidator = yup.object().shape({\n type: yup.string().equals(['link']).required(),\n url: yup\n .string()\n .test('invalid-url', 'Please specify a valid link.', (value) => checkValidLink(value ?? '')),\n children: yup.array().of(textNodeValidator).required(),\n});\n\n// TODO: remove any with a correct Type\nconst inlineNodeValidator: any = yup.lazy((value: { type: string }) => {\n switch (value.type) {\n case 'text':\n return textNodeValidator;\n case 'link':\n return linkNodeValidator;\n default:\n return yup.mixed().test('invalid-type', 'Inline node must be Text or Link', () => {\n return false;\n });\n }\n});\n\nconst paragraphNodeValidator = yup.object().shape({\n type: yup.string().equals(['paragraph']).required(),\n children: yup\n .array()\n .of(inlineNodeValidator)\n .min(1, 'Paragraph node children must have at least one Text or Link node')\n .required(),\n});\n\nconst headingNodeValidator = yup.object().shape({\n type: yup.string().equals(['heading']).required(),\n level: yup.number().oneOf([1, 2, 3, 4, 5, 6]).required(),\n children: yup\n .array()\n .of(inlineNodeValidator)\n .min(1, 'Heading node children must have at least one Text or Link node')\n .required(),\n});\n\nconst quoteNodeValidator = yup.object().shape({\n type: yup.string().equals(['quote']).required(),\n children: yup\n .array()\n .of(inlineNodeValidator)\n .min(1, 'Quote node children must have at least one Text or Link node')\n .required(),\n});\n\nconst codeBlockValidator = yup.object().shape({\n type: yup.string().equals(['code']).required(),\n syntax: yup.string().nullable(),\n children: yup\n .array()\n .of(textNodeValidator)\n .min(1, 'Quote node children must have at least one Text or Link node')\n .required(),\n});\n\nconst listItemNode = yup.object().shape({\n type: yup.string().equals(['list-item']).required(),\n children: yup.array().of(inlineNodeValidator).required(),\n});\n\n// Allow children to be either a listItemNode or a listNode itself\n// @ts-expect-error - listChildrenValidator needs a type\nconst listChildrenValidator = yup.lazy((value: { type: string }) => {\n switch (value.type) {\n case 'list':\n return listNodeValidator;\n case 'list-item':\n return listItemNode;\n default:\n return yup.mixed().test('invalid-type', 'Inline node must be list-item or list', () => {\n return false;\n });\n }\n});\n\n// @ts-expect-error - listNodeValidator needs a type\nconst listNodeValidator = yup.object().shape({\n type: yup.string().equals(['list']).required(),\n format: yup.string().equals(['ordered', 'unordered']).required(),\n children: yup\n .array()\n .of(listChildrenValidator)\n .min(1, 'List node children must have at least one ListItem or ListNode')\n .required(),\n});\n\nconst imageNodeValidator = yup.object().shape({\n type: yup.string().equals(['image']).required(),\n image: yup.object().shape({\n name: yup.string().required(),\n alternativeText: yup.string().nullable(),\n url: yup.string().required(),\n caption: yup.string().nullable(),\n width: yup.number().required(),\n height: yup.number().required(),\n formats: yup.object().required(),\n hash: yup.string().required(),\n ext: yup.string().required(),\n mime: yup.string().required(),\n size: yup.number().required(),\n previewUrl: yup.string().nullable(),\n provider: yup.string().required(),\n provider_metadata: yup.mixed().nullable(),\n createdAt: yup.string().required(),\n updatedAt: yup.string().required(),\n }),\n children: yup.array().of(inlineNodeValidator).required(),\n});\n\n// TODO: remove the any and replace with a correct Type\nconst blockNodeValidator: any = yup.lazy((value: { type: string }) => {\n switch (value.type) {\n case 'paragraph':\n return paragraphNodeValidator;\n case 'heading':\n return headingNodeValidator;\n case 'quote':\n return quoteNodeValidator;\n case 'list':\n return listNodeValidator;\n case 'image':\n return imageNodeValidator;\n case 'code':\n return codeBlockValidator;\n default:\n return yup.mixed().test('invalid-type', 'Block node is of invalid type', () => {\n return false;\n });\n }\n});\n\nconst blocksValidatorSchema = yup.array().of(blockNodeValidator);\n\nexport const blocksValidator = () => blocksValidatorSchema;\n"],"names":["textNodeValidator","yup","object","shape","type","string","equals","required","text","test","bold","boolean","italic","underline","strikethrough","code","checkValidLink","link","URL","startsWith","error","linkNodeValidator","url","value","children","array","of","inlineNodeValidator","lazy","mixed","paragraphNodeValidator","min","headingNodeValidator","level","number","oneOf","quoteNodeValidator","codeBlockValidator","syntax","nullable","listItemNode","listChildrenValidator","listNodeValidator","format","imageNodeValidator","image","name","alternativeText","caption","width","height","formats","hash","ext","mime","size","previewUrl","provider","provider_metadata","createdAt","updatedAt","blockNodeValidator","blocksValidatorSchema","blocksValidator"],"mappings":";;;;AAEA,MAAMA,iBAAAA,GAAoBC,eAAAA,CAAIC,MAAM,EAAA,CAAGC,KAAK,CAAC;AAC3CC,IAAAA,IAAAA,EAAMH,eAAAA,CAAII,MAAM,EAAA,CAAGC,MAAM,CAAC;AAAC,QAAA;AAAO,KAAA,CAAA,CAAEC,QAAQ,EAAA;AAC5CC,IAAAA,IAAAA,EAAMP,gBACHI,MAAM,EAAA,CACNI,IAAI,CACH,eAAA,EACA,sDACA,CAACD,IAAAA,GAAAA;QACC,OAAO,OAAOA,IAAAA,KAAS,QAAA,IAAYA,IAAAA,KAAS,EAAA;AAC9C,IAAA,CAAA,CAAA;AAEJE,IAAAA,IAAAA,EAAMT,gBAAIU,OAAO,EAAA;AACjBC,IAAAA,MAAAA,EAAQX,gBAAIU,OAAO,EAAA;AACnBE,IAAAA,SAAAA,EAAWZ,gBAAIU,OAAO,EAAA;AACtBG,IAAAA,aAAAA,EAAeb,gBAAIU,OAAO,EAAA;AAC1BI,IAAAA,IAAAA,EAAMd,gBAAIU,OAAO;AACnB,CAAA,CAAA;AAEA,MAAMK,iBAAiB,CAACC,IAAAA,GAAAA;IACtB,IAAI;;QAEF,IAAIC,GAAAA,CAAID,KAAKE,UAAU,CAAC,OAAO,CAAC,iBAAiB,EAAEF,IAAAA,CAAAA,CAAM,GAAGA,IAAAA,CAAAA;AAC9D,IAAA,CAAA,CAAE,OAAOG,KAAAA,EAAO;QACd,OAAO,KAAA;AACT,IAAA;IACA,OAAO,IAAA;AACT,CAAA;AAEA,MAAMC,iBAAAA,GAAoBpB,eAAAA,CAAIC,MAAM,EAAA,CAAGC,KAAK,CAAC;AAC3CC,IAAAA,IAAAA,EAAMH,eAAAA,CAAII,MAAM,EAAA,CAAGC,MAAM,CAAC;AAAC,QAAA;AAAO,KAAA,CAAA,CA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E,QAAQ;AAClC,KAAA,CAAA;AACAiB,IAAAA,QAAAA,EAAUvB,gBAAIwB,KAAK,EAAA,CAAGC,EAAE,CAACC,qBAAqBpB,QAAQ;AACxD,CAAA,CAAA;AAEA;AACA,MAAMsD,kBAAAA,GAA0B5D,eAAAA,CAAI2B,IAAI,CAAC,CAACL,KAAAA,GAAAA;AACxC,IAAA,OAAQA,MAAMnB,IAAI;QAChB,KAAK,WAAA;YACH,OAAO0B,sBAAAA;QACT,KAAK,SAAA;YACH,OAAOE,oBAAAA;QACT,KAAK,OAAA;YACH,OAAOI,kBAAAA;QACT,KAAK,MAAA;YACH,OAAOM,iBAAAA;QACT,KAAK,OAAA;YACH,OAAOE,kBAAAA;QACT,KAAK,MAAA;YACH,OAAOP,kBAAAA;AACT,QAAA;AACE,YAAA,OAAOpC,gBAAI4B,KAAK,EAAA,CAAGpB,IAAI,CAAC,gBAAgB,+BAAA,EAAiC,IAAA;gBACvE,OAAO,KAAA;AACT,YAAA,CAAA,CAAA;AACJ;AACF,CAAA,CAAA;AAEA,MAAMqD,qBAAAA,GAAwB7D,eAAAA,CAAIwB,KAAK,EAAA,CAAGC,EAAE,CAACmC,kBAAAA,CAAAA;AAEtC,MAAME,eAAAA,GAAkB,IAAMD;;;;"}
|
|
1
|
+
{"version":3,"file":"blocks-validator.js","sources":["../../../src/services/entity-validator/blocks-validator.ts"],"sourcesContent":["import { yup } from '@strapi/utils';\n\nconst textNodeValidator = yup.object().shape({\n type: yup.string().equals(['text']).required(),\n text: yup\n .string()\n .test(\n 'is-valid-text',\n 'Text must be defined with at least an empty string',\n (text: unknown) => {\n return typeof text === 'string' || text === '';\n }\n ),\n bold: yup.boolean(),\n italic: yup.boolean(),\n underline: yup.boolean(),\n strikethrough: yup.boolean(),\n code: yup.boolean(),\n});\n\nconst checkValidLink = (link: string) => {\n try {\n // eslint-disable-next-line no-new\n new URL(link.startsWith('/') ? `https://strapi.io${link}` : link);\n } catch (error) {\n return false;\n }\n return true;\n};\n\nconst linkNodeValidator = yup.object().shape({\n type: yup.string().equals(['link']).required(),\n url: yup\n .string()\n .test('invalid-url', 'Please specify a valid link.', (value) => checkValidLink(value ?? '')),\n children: yup.array().of(textNodeValidator).required(),\n});\n\n// TODO: remove any with a correct Type\nconst inlineNodeValidator: any = yup.lazy((value: { type: string }) => {\n switch (value.type) {\n case 'text':\n return textNodeValidator;\n case 'link':\n return linkNodeValidator;\n default:\n return yup.mixed().test('invalid-type', 'Inline node must be Text or Link', () => {\n return false;\n });\n }\n});\n\nconst paragraphNodeValidator = yup.object().shape({\n type: yup.string().equals(['paragraph']).required(),\n children: yup\n .array()\n .of(inlineNodeValidator)\n .min(1, 'Paragraph node children must have at least one Text or Link node')\n .required(),\n});\n\nconst headingNodeValidator = yup.object().shape({\n type: yup.string().equals(['heading']).required(),\n level: yup.number().oneOf([1, 2, 3, 4, 5, 6]).required(),\n children: yup\n .array()\n .of(inlineNodeValidator)\n .min(1, 'Heading node children must have at least one Text or Link node')\n .required(),\n});\n\nconst quoteNodeValidator = yup.object().shape({\n type: yup.string().equals(['quote']).required(),\n children: yup\n .array()\n .of(inlineNodeValidator)\n .min(1, 'Quote node children must have at least one Text or Link node')\n .required(),\n});\n\nconst codeBlockValidator = yup.object().shape({\n type: yup.string().equals(['code']).required(),\n syntax: yup.string().nullable(),\n children: yup\n .array()\n .of(textNodeValidator)\n .min(1, 'Quote node children must have at least one Text or Link node')\n .required(),\n});\n\nconst listItemNode = yup.object().shape({\n type: yup.string().equals(['list-item']).required(),\n children: yup.array().of(inlineNodeValidator).required(),\n});\n\n// Allow children to be either a listItemNode or a listNode itself\n// @ts-expect-error - listChildrenValidator needs a type\nconst listChildrenValidator = yup.lazy((value: { type: string }) => {\n switch (value.type) {\n case 'list':\n return listNodeValidator;\n case 'list-item':\n return listItemNode;\n default:\n return yup.mixed().test('invalid-type', 'Inline node must be list-item or list', () => {\n return false;\n });\n }\n});\n\n// @ts-expect-error - listNodeValidator needs a type\nconst listNodeValidator = yup.object().shape({\n type: yup.string().equals(['list']).required(),\n format: yup.string().equals(['ordered', 'unordered']).required(),\n children: yup\n .array()\n .of(listChildrenValidator)\n .min(1, 'List node children must have at least one ListItem or ListNode')\n .required(),\n});\n\nconst imageNodeValidator = yup.object().shape({\n type: yup.string().equals(['image']).required(),\n image: yup.object().shape({\n name: yup.string().required(),\n alternativeText: yup.string().nullable(),\n url: yup.string().required(),\n caption: yup.string().nullable(),\n width: yup.number().required(),\n height: yup.number().required(),\n formats: yup.object().nullable(),\n hash: yup.string().required(),\n ext: yup.string().required(),\n mime: yup.string().required(),\n size: yup.number().required(),\n previewUrl: yup.string().nullable(),\n provider: yup.string().required(),\n provider_metadata: yup.mixed().nullable(),\n createdAt: yup.string().required(),\n updatedAt: yup.string().required(),\n }),\n children: yup.array().of(inlineNodeValidator).required(),\n});\n\n// TODO: remove the any and replace with a correct Type\nconst blockNodeValidator: any = yup.lazy((value: { type: string }) => {\n switch (value.type) {\n case 'paragraph':\n return paragraphNodeValidator;\n case 'heading':\n return headingNodeValidator;\n case 'quote':\n return quoteNodeValidator;\n case 'list':\n return listNodeValidator;\n case 'image':\n return imageNodeValidator;\n case 'code':\n return codeBlockValidator;\n default:\n return yup.mixed().test('invalid-type', 'Block node is of invalid type', () => {\n return false;\n });\n }\n});\n\nconst blocksValidatorSchema = yup.array().of(blockNodeValidator);\n\nexport const blocksValidator = () => blocksValidatorSchema;\n"],"names":["textNodeValidator","yup","object","shape","type","string","equals","required","text","test","bold","boolean","italic","underline","strikethrough","code","checkValidLink","link","URL","startsWith","error","linkNodeValidator","url","value","children","array","of","inlineNodeValidator","lazy","mixed","paragraphNodeValidator","min","headingNodeValidator","level","number","oneOf","quoteNodeValidator","codeBlockValidator","syntax","nullable","listItemNode","listChildrenValidator","listNodeValidator","format","imageNodeValidator","image","name","alternativeText","caption","width","height","formats","hash","ext","mime","size","previewUrl","provider","provider_metadata","createdAt","updatedAt","blockNodeValidator","blocksValidatorSchema","blocksValidator"],"mappings":";;;;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D,CAAA,CAAA;AAEA;AACA,MAAMsD,kBAAAA,GAA0B5D,eAAAA,CAAI2B,IAAI,CAAC,CAACL,KAAAA,GAAAA;AACxC,IAAA,OAAQA,MAAMnB,IAAI;QAChB,KAAK,WAAA;YACH,OAAO0B,sBAAAA;QACT,KAAK,SAAA;YACH,OAAOE,oBAAAA;QACT,KAAK,OAAA;YACH,OAAOI,kBAAAA;QACT,KAAK,MAAA;YACH,OAAOM,iBAAAA;QACT,KAAK,OAAA;YACH,OAAOE,kBAAAA;QACT,KAAK,MAAA;YACH,OAAOP,kBAAAA;AACT,QAAA;AACE,YAAA,OAAOpC,gBAAI4B,KAAK,EAAA,CAAGpB,IAAI,CAAC,gBAAgB,+BAAA,EAAiC,IAAA;gBACvE,OAAO,KAAA;AACT,YAAA,CAAA,CAAA;AACJ;AACF,CAAA,CAAA;AAEA,MAAMqD,qBAAAA,GAAwB7D,eAAAA,CAAIwB,KAAK,EAAA,CAAGC,EAAE,CAACmC,kBAAAA,CAAAA;AAEtC,MAAME,eAAAA,GAAkB,IAAMD;;;;"}
|
|
@@ -117,7 +117,7 @@ const imageNodeValidator = yup.object().shape({
|
|
|
117
117
|
caption: yup.string().nullable(),
|
|
118
118
|
width: yup.number().required(),
|
|
119
119
|
height: yup.number().required(),
|
|
120
|
-
formats: yup.object().
|
|
120
|
+
formats: yup.object().nullable(),
|
|
121
121
|
hash: yup.string().required(),
|
|
122
122
|
ext: yup.string().required(),
|
|
123
123
|
mime: yup.string().required(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks-validator.mjs","sources":["../../../src/services/entity-validator/blocks-validator.ts"],"sourcesContent":["import { yup } from '@strapi/utils';\n\nconst textNodeValidator = yup.object().shape({\n type: yup.string().equals(['text']).required(),\n text: yup\n .string()\n .test(\n 'is-valid-text',\n 'Text must be defined with at least an empty string',\n (text: unknown) => {\n return typeof text === 'string' || text === '';\n }\n ),\n bold: yup.boolean(),\n italic: yup.boolean(),\n underline: yup.boolean(),\n strikethrough: yup.boolean(),\n code: yup.boolean(),\n});\n\nconst checkValidLink = (link: string) => {\n try {\n // eslint-disable-next-line no-new\n new URL(link.startsWith('/') ? `https://strapi.io${link}` : link);\n } catch (error) {\n return false;\n }\n return true;\n};\n\nconst linkNodeValidator = yup.object().shape({\n type: yup.string().equals(['link']).required(),\n url: yup\n .string()\n .test('invalid-url', 'Please specify a valid link.', (value) => checkValidLink(value ?? '')),\n children: yup.array().of(textNodeValidator).required(),\n});\n\n// TODO: remove any with a correct Type\nconst inlineNodeValidator: any = yup.lazy((value: { type: string }) => {\n switch (value.type) {\n case 'text':\n return textNodeValidator;\n case 'link':\n return linkNodeValidator;\n default:\n return yup.mixed().test('invalid-type', 'Inline node must be Text or Link', () => {\n return false;\n });\n }\n});\n\nconst paragraphNodeValidator = yup.object().shape({\n type: yup.string().equals(['paragraph']).required(),\n children: yup\n .array()\n .of(inlineNodeValidator)\n .min(1, 'Paragraph node children must have at least one Text or Link node')\n .required(),\n});\n\nconst headingNodeValidator = yup.object().shape({\n type: yup.string().equals(['heading']).required(),\n level: yup.number().oneOf([1, 2, 3, 4, 5, 6]).required(),\n children: yup\n .array()\n .of(inlineNodeValidator)\n .min(1, 'Heading node children must have at least one Text or Link node')\n .required(),\n});\n\nconst quoteNodeValidator = yup.object().shape({\n type: yup.string().equals(['quote']).required(),\n children: yup\n .array()\n .of(inlineNodeValidator)\n .min(1, 'Quote node children must have at least one Text or Link node')\n .required(),\n});\n\nconst codeBlockValidator = yup.object().shape({\n type: yup.string().equals(['code']).required(),\n syntax: yup.string().nullable(),\n children: yup\n .array()\n .of(textNodeValidator)\n .min(1, 'Quote node children must have at least one Text or Link node')\n .required(),\n});\n\nconst listItemNode = yup.object().shape({\n type: yup.string().equals(['list-item']).required(),\n children: yup.array().of(inlineNodeValidator).required(),\n});\n\n// Allow children to be either a listItemNode or a listNode itself\n// @ts-expect-error - listChildrenValidator needs a type\nconst listChildrenValidator = yup.lazy((value: { type: string }) => {\n switch (value.type) {\n case 'list':\n return listNodeValidator;\n case 'list-item':\n return listItemNode;\n default:\n return yup.mixed().test('invalid-type', 'Inline node must be list-item or list', () => {\n return false;\n });\n }\n});\n\n// @ts-expect-error - listNodeValidator needs a type\nconst listNodeValidator = yup.object().shape({\n type: yup.string().equals(['list']).required(),\n format: yup.string().equals(['ordered', 'unordered']).required(),\n children: yup\n .array()\n .of(listChildrenValidator)\n .min(1, 'List node children must have at least one ListItem or ListNode')\n .required(),\n});\n\nconst imageNodeValidator = yup.object().shape({\n type: yup.string().equals(['image']).required(),\n image: yup.object().shape({\n name: yup.string().required(),\n alternativeText: yup.string().nullable(),\n url: yup.string().required(),\n caption: yup.string().nullable(),\n width: yup.number().required(),\n height: yup.number().required(),\n formats: yup.object().required(),\n hash: yup.string().required(),\n ext: yup.string().required(),\n mime: yup.string().required(),\n size: yup.number().required(),\n previewUrl: yup.string().nullable(),\n provider: yup.string().required(),\n provider_metadata: yup.mixed().nullable(),\n createdAt: yup.string().required(),\n updatedAt: yup.string().required(),\n }),\n children: yup.array().of(inlineNodeValidator).required(),\n});\n\n// TODO: remove the any and replace with a correct Type\nconst blockNodeValidator: any = yup.lazy((value: { type: string }) => {\n switch (value.type) {\n case 'paragraph':\n return paragraphNodeValidator;\n case 'heading':\n return headingNodeValidator;\n case 'quote':\n return quoteNodeValidator;\n case 'list':\n return listNodeValidator;\n case 'image':\n return imageNodeValidator;\n case 'code':\n return codeBlockValidator;\n default:\n return yup.mixed().test('invalid-type', 'Block node is of invalid type', () => {\n return false;\n });\n }\n});\n\nconst blocksValidatorSchema = yup.array().of(blockNodeValidator);\n\nexport const blocksValidator = () => blocksValidatorSchema;\n"],"names":["textNodeValidator","yup","object","shape","type","string","equals","required","text","test","bold","boolean","italic","underline","strikethrough","code","checkValidLink","link","URL","startsWith","error","linkNodeValidator","url","value","children","array","of","inlineNodeValidator","lazy","mixed","paragraphNodeValidator","min","headingNodeValidator","level","number","oneOf","quoteNodeValidator","codeBlockValidator","syntax","nullable","listItemNode","listChildrenValidator","listNodeValidator","format","imageNodeValidator","image","name","alternativeText","caption","width","height","formats","hash","ext","mime","size","previewUrl","provider","provider_metadata","createdAt","updatedAt","blockNodeValidator","blocksValidatorSchema","blocksValidator"],"mappings":";;AAEA,MAAMA,iBAAAA,GAAoBC,GAAAA,CAAIC,MAAM,EAAA,CAAGC,KAAK,CAAC;AAC3CC,IAAAA,IAAAA,EAAMH,GAAAA,CAAII,MAAM,EAAA,CAAGC,MAAM,CAAC;AAAC,QAAA;AAAO,KAAA,CAAA,CAAEC,QAAQ,EAAA;AAC5CC,IAAAA,IAAAA,EAAMP,IACHI,MAAM,EAAA,CACNI,IAAI,CACH,eAAA,EACA,sDACA,CAACD,IAAAA,GAAAA;QACC,OAAO,OAAOA,IAAAA,KAAS,QAAA,IAAYA,IAAAA,KAAS,EAAA;AAC9C,IAAA,CAAA,CAAA;AAEJE,IAAAA,IAAAA,EAAMT,IAAIU,OAAO,EAAA;AACjBC,IAAAA,MAAAA,EAAQX,IAAIU,OAAO,EAAA;AACnBE,IAAAA,SAAAA,EAAWZ,IAAIU,OAAO,EAAA;AACtBG,IAAAA,aAAAA,EAAeb,IAAIU,OAAO,EAAA;AAC1BI,IAAAA,IAAAA,EAAMd,IAAIU,OAAO;AACnB,CAAA,CAAA;AAEA,MAAMK,iBAAiB,CAACC,IAAAA,GAAAA;IACtB,IAAI;;QAEF,IAAIC,GAAAA,CAAID,KAAKE,UAAU,CAAC,OAAO,CAAC,iBAAiB,EAAEF,IAAAA,CAAAA,CAAM,GAAGA,IAAAA,CAAAA;AAC9D,IAAA,CAAA,CAAE,OAAOG,KAAAA,EAAO;QACd,OAAO,KAAA;AACT,IAAA;IACA,OAAO,IAAA;AACT,CAAA;AAEA,MAAMC,iBAAAA,GAAoBpB,GAAAA,CAAIC,MAAM,EAAA,CAAGC,KAAK,CAAC;AAC3CC,IAAAA,IAAAA,EAAMH,GAAAA,CAAII,MAAM,EAAA,CAAGC,MAAM,CAAC;AA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A,CAAII,MAAM,EAAA,CAAGE,QAAQ;AAClC,KAAA,CAAA;AACAiB,IAAAA,QAAAA,EAAUvB,IAAIwB,KAAK,EAAA,CAAGC,EAAE,CAACC,qBAAqBpB,QAAQ;AACxD,CAAA,CAAA;AAEA;AACA,MAAMsD,kBAAAA,GAA0B5D,GAAAA,CAAI2B,IAAI,CAAC,CAACL,KAAAA,GAAAA;AACxC,IAAA,OAAQA,MAAMnB,IAAI;QAChB,KAAK,WAAA;YACH,OAAO0B,sBAAAA;QACT,KAAK,SAAA;YACH,OAAOE,oBAAAA;QACT,KAAK,OAAA;YACH,OAAOI,kBAAAA;QACT,KAAK,MAAA;YACH,OAAOM,iBAAAA;QACT,KAAK,OAAA;YACH,OAAOE,kBAAAA;QACT,KAAK,MAAA;YACH,OAAOP,kBAAAA;AACT,QAAA;AACE,YAAA,OAAOpC,IAAI4B,KAAK,EAAA,CAAGpB,IAAI,CAAC,gBAAgB,+BAAA,EAAiC,IAAA;gBACvE,OAAO,KAAA;AACT,YAAA,CAAA,CAAA;AACJ;AACF,CAAA,CAAA;AAEA,MAAMqD,qBAAAA,GAAwB7D,GAAAA,CAAIwB,KAAK,EAAA,CAAGC,EAAE,CAACmC,kBAAAA,CAAAA;AAEtC,MAAME,eAAAA,GAAkB,IAAMD;;;;"}
|
|
1
|
+
{"version":3,"file":"blocks-validator.mjs","sources":["../../../src/services/entity-validator/blocks-validator.ts"],"sourcesContent":["import { yup } from '@strapi/utils';\n\nconst textNodeValidator = yup.object().shape({\n type: yup.string().equals(['text']).required(),\n text: yup\n .string()\n .test(\n 'is-valid-text',\n 'Text must be defined with at least an empty string',\n (text: unknown) => {\n return typeof text === 'string' || text === '';\n }\n ),\n bold: yup.boolean(),\n italic: yup.boolean(),\n underline: yup.boolean(),\n strikethrough: yup.boolean(),\n code: yup.boolean(),\n});\n\nconst checkValidLink = (link: string) => {\n try {\n // eslint-disable-next-line no-new\n new URL(link.startsWith('/') ? `https://strapi.io${link}` : link);\n } catch (error) {\n return false;\n }\n return true;\n};\n\nconst linkNodeValidator = yup.object().shape({\n type: yup.string().equals(['link']).required(),\n url: yup\n .string()\n .test('invalid-url', 'Please specify a valid link.', (value) => checkValidLink(value ?? '')),\n children: yup.array().of(textNodeValidator).required(),\n});\n\n// TODO: remove any with a correct Type\nconst inlineNodeValidator: any = yup.lazy((value: { type: string }) => {\n switch (value.type) {\n case 'text':\n return textNodeValidator;\n case 'link':\n return linkNodeValidator;\n default:\n return yup.mixed().test('invalid-type', 'Inline node must be Text or Link', () => {\n return false;\n });\n }\n});\n\nconst paragraphNodeValidator = yup.object().shape({\n type: yup.string().equals(['paragraph']).required(),\n children: yup\n .array()\n .of(inlineNodeValidator)\n .min(1, 'Paragraph node children must have at least one Text or Link node')\n .required(),\n});\n\nconst headingNodeValidator = yup.object().shape({\n type: yup.string().equals(['heading']).required(),\n level: yup.number().oneOf([1, 2, 3, 4, 5, 6]).required(),\n children: yup\n .array()\n .of(inlineNodeValidator)\n .min(1, 'Heading node children must have at least one Text or Link node')\n .required(),\n});\n\nconst quoteNodeValidator = yup.object().shape({\n type: yup.string().equals(['quote']).required(),\n children: yup\n .array()\n .of(inlineNodeValidator)\n .min(1, 'Quote node children must have at least one Text or Link node')\n .required(),\n});\n\nconst codeBlockValidator = yup.object().shape({\n type: yup.string().equals(['code']).required(),\n syntax: yup.string().nullable(),\n children: yup\n .array()\n .of(textNodeValidator)\n .min(1, 'Quote node children must have at least one Text or Link node')\n .required(),\n});\n\nconst listItemNode = yup.object().shape({\n type: yup.string().equals(['list-item']).required(),\n children: yup.array().of(inlineNodeValidator).required(),\n});\n\n// Allow children to be either a listItemNode or a listNode itself\n// @ts-expect-error - listChildrenValidator needs a type\nconst listChildrenValidator = yup.lazy((value: { type: string }) => {\n switch (value.type) {\n case 'list':\n return listNodeValidator;\n case 'list-item':\n return listItemNode;\n default:\n return yup.mixed().test('invalid-type', 'Inline node must be list-item or list', () => {\n return false;\n });\n }\n});\n\n// @ts-expect-error - listNodeValidator needs a type\nconst listNodeValidator = yup.object().shape({\n type: yup.string().equals(['list']).required(),\n format: yup.string().equals(['ordered', 'unordered']).required(),\n children: yup\n .array()\n .of(listChildrenValidator)\n .min(1, 'List node children must have at least one ListItem or ListNode')\n .required(),\n});\n\nconst imageNodeValidator = yup.object().shape({\n type: yup.string().equals(['image']).required(),\n image: yup.object().shape({\n name: yup.string().required(),\n alternativeText: yup.string().nullable(),\n url: yup.string().required(),\n caption: yup.string().nullable(),\n width: yup.number().required(),\n height: yup.number().required(),\n formats: yup.object().nullable(),\n hash: yup.string().required(),\n ext: yup.string().required(),\n mime: yup.string().required(),\n size: yup.number().required(),\n previewUrl: yup.string().nullable(),\n provider: yup.string().required(),\n provider_metadata: yup.mixed().nullable(),\n createdAt: yup.string().required(),\n updatedAt: yup.string().required(),\n }),\n children: yup.array().of(inlineNodeValidator).required(),\n});\n\n// TODO: remove the any and replace with a correct Type\nconst blockNodeValidator: any = yup.lazy((value: { type: string }) => {\n switch (value.type) {\n case 'paragraph':\n return paragraphNodeValidator;\n case 'heading':\n return headingNodeValidator;\n case 'quote':\n return quoteNodeValidator;\n case 'list':\n return listNodeValidator;\n case 'image':\n return imageNodeValidator;\n case 'code':\n return codeBlockValidator;\n default:\n return yup.mixed().test('invalid-type', 'Block node is of invalid type', () => {\n return false;\n });\n }\n});\n\nconst blocksValidatorSchema = yup.array().of(blockNodeValidator);\n\nexport const blocksValidator = () => blocksValidatorSchema;\n"],"names":["textNodeValidator","yup","object","shape","type","string","equals","required","text","test","bold","boolean","italic","underline","strikethrough","code","checkValidLink","link","URL","startsWith","error","linkNodeValidator","url","value","children","array","of","inlineNodeValidator","lazy","mixed","paragraphNodeValidator","min","headingNodeValidator","level","number","oneOf","quoteNodeValidator","codeBlockValidator","syntax","nullable","listItemNode","listChildrenValidator","listNodeValidator","format","imageNodeValidator","image","name","alternativeText","caption","width","height","formats","hash","ext","mime","size","previewUrl","provider","provider_metadata","createdAt","updatedAt","blockNodeValidator","blocksValidator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AAQ;AACxD,CAAA,CAAA;AAEA;AACA,MAAMsD,kBAAAA,GAA0B5D,GAAAA,CAAI2B,IAAI,CAAC,CAACL,KAAAA,GAAAA;AACxC,IAAA,OAAQA,MAAMnB,IAAI;QAChB,KAAK,WAAA;YACH,OAAO0B,sBAAAA;QACT,KAAK,SAAA;YACH,OAAOE,oBAAAA;QACT,KAAK,OAAA;YACH,OAAOI,kBAAAA;QACT,KAAK,MAAA;YACH,OAAOM,iBAAAA;QACT,KAAK,OAAA;YACH,OAAOE,kBAAAA;QACT,KAAK,MAAA;YACH,OAAOP,kBAAAA;AACT,QAAA;AACE,YAAA,OAAOpC,IAAI4B,KAAK,EAAA,CAAGpB,IAAI,CAAC,gBAAgB,+BAAA,EAAiC,IAAA;gBACvE,OAAO,KAAA;AACT,YAAA,CAAA,CAAA;AACJ;AACF,CAAA,CAAA;AAEA,MAAMqD,qBAAAA,GAAwB7D,GAAAA,CAAIwB,KAAK,EAAA,CAAGC,EAAE,CAACmC,kBAAAA,CAAAA;AAEtC,MAAME,eAAAA,GAAkB,IAAMD;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.43.0",
|
|
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.
|
|
63
|
-
"@strapi/database": "5.
|
|
64
|
-
"@strapi/generators": "5.
|
|
65
|
-
"@strapi/logger": "5.
|
|
66
|
-
"@strapi/permissions": "5.
|
|
67
|
-
"@strapi/types": "5.
|
|
68
|
-
"@strapi/typescript-utils": "5.
|
|
69
|
-
"@strapi/utils": "5.
|
|
62
|
+
"@strapi/admin": "5.43.0",
|
|
63
|
+
"@strapi/database": "5.43.0",
|
|
64
|
+
"@strapi/generators": "5.43.0",
|
|
65
|
+
"@strapi/logger": "5.43.0",
|
|
66
|
+
"@strapi/permissions": "5.43.0",
|
|
67
|
+
"@strapi/types": "5.43.0",
|
|
68
|
+
"@strapi/typescript-utils": "5.43.0",
|
|
69
|
+
"@strapi/utils": "5.43.0",
|
|
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",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"semver": "7.5.4",
|
|
109
109
|
"statuses": "2.0.1",
|
|
110
110
|
"typescript": "5.4.4",
|
|
111
|
-
"undici": "6.
|
|
111
|
+
"undici": "6.25.0",
|
|
112
112
|
"yup": "0.32.9",
|
|
113
113
|
"zod": "3.25.67"
|
|
114
114
|
},
|
|
@@ -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.
|
|
136
|
+
"eslint-config-custom": "5.43.0",
|
|
137
137
|
"supertest": "7.2.2",
|
|
138
|
-
"tsconfig": "5.
|
|
138
|
+
"tsconfig": "5.43.0",
|
|
139
139
|
"vitest": "catalog:",
|
|
140
|
-
"vitest-config": "5.
|
|
140
|
+
"vitest-config": "5.43.0"
|
|
141
141
|
},
|
|
142
142
|
"engines": {
|
|
143
143
|
"node": ">=20.0.0 <=24.x.x",
|