@strapi/core 5.0.0-beta.4 → 5.0.0-beta.5
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/migrations/database/5.0.0-discard-drafts.d.ts +12 -0
- package/dist/migrations/database/5.0.0-discard-drafts.d.ts.map +1 -0
- package/dist/migrations/database/5.0.0-discard-drafts.js +49 -0
- package/dist/migrations/database/5.0.0-discard-drafts.js.map +1 -0
- package/dist/migrations/database/5.0.0-discard-drafts.mjs +49 -0
- package/dist/migrations/database/5.0.0-discard-drafts.mjs.map +1 -0
- package/dist/providers/registries.d.ts.map +1 -1
- package/dist/providers/registries.js +2 -0
- package/dist/providers/registries.js.map +1 -1
- package/dist/providers/registries.mjs +2 -0
- package/dist/providers/registries.mjs.map +1 -1
- package/package.json +13 -13
- package/dist/services/document-service/document-engine.d.ts +0 -1
- package/dist/services/document-service/document-engine.d.ts.map +0 -1
@@ -0,0 +1,12 @@
|
|
1
|
+
import type { Migration } from '@strapi/database';
|
2
|
+
/**
|
3
|
+
* On V4 there was no concept of document, and an entry could be in a draft or published state.
|
4
|
+
* But not both at the same time.
|
5
|
+
*
|
6
|
+
* On V5 we introduced the concept of document, and an entry can be in a draft or published state,
|
7
|
+
* with the requirement that a document must always have a draft.
|
8
|
+
*
|
9
|
+
* This migration creates the document draft counterpart for all the entries that were in a published state.
|
10
|
+
*/
|
11
|
+
export declare const discardDocumentDrafts: Migration;
|
12
|
+
//# sourceMappingURL=5.0.0-discard-drafts.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"5.0.0-discard-drafts.d.ts","sourceRoot":"","sources":["../../../src/migrations/database/5.0.0-discard-drafts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAY,SAAS,EAAE,MAAM,kBAAkB,CAAC;AA8E5D;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,EAAE,SASnC,CAAC"}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
|
+
const strapiUtils = require("@strapi/utils");
|
4
|
+
async function* getBatchToDiscard({
|
5
|
+
db,
|
6
|
+
trx,
|
7
|
+
uid,
|
8
|
+
batchSize = 1e3
|
9
|
+
}) {
|
10
|
+
let offset = 0;
|
11
|
+
let hasMore = true;
|
12
|
+
while (hasMore) {
|
13
|
+
const batch = await db.queryBuilder(uid).select(["id", "documentId", "locale"]).where({ publishedAt: { $ne: null } }).limit(batchSize).offset(offset).orderBy("id").transacting(trx).execute();
|
14
|
+
if (batch.length < batchSize) {
|
15
|
+
hasMore = false;
|
16
|
+
}
|
17
|
+
offset += batchSize;
|
18
|
+
yield batch;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
const migrateUp = async (trx, db) => {
|
22
|
+
for (const meta of db.metadata.values()) {
|
23
|
+
const hasTable = await trx.schema.hasTable(meta.tableName);
|
24
|
+
if (!hasTable) {
|
25
|
+
continue;
|
26
|
+
}
|
27
|
+
const uid = meta.uid;
|
28
|
+
const model = strapi.getModel(uid);
|
29
|
+
const hasDP = strapiUtils.contentTypes.hasDraftAndPublish(model);
|
30
|
+
if (!hasDP) {
|
31
|
+
continue;
|
32
|
+
}
|
33
|
+
const discardDraft = async (entry) => strapi.documents(uid).discardDraft({ documentId: entry.documentId, locale: entry.locale });
|
34
|
+
for await (const batch of getBatchToDiscard({ db, trx, uid: meta.uid })) {
|
35
|
+
await strapiUtils.async.map(batch, discardDraft, { concurrency: 10 });
|
36
|
+
}
|
37
|
+
}
|
38
|
+
};
|
39
|
+
const discardDocumentDrafts = {
|
40
|
+
name: "core::5.0.0-discard-drafts",
|
41
|
+
async up(trx, db) {
|
42
|
+
await migrateUp(trx, db);
|
43
|
+
},
|
44
|
+
async down() {
|
45
|
+
throw new Error("not implemented");
|
46
|
+
}
|
47
|
+
};
|
48
|
+
exports.discardDocumentDrafts = discardDocumentDrafts;
|
49
|
+
//# sourceMappingURL=5.0.0-discard-drafts.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"5.0.0-discard-drafts.js","sources":["../../../src/migrations/database/5.0.0-discard-drafts.ts"],"sourcesContent":["/* eslint-disable no-continue */\nimport type { UID } from '@strapi/types';\nimport type { Database, Migration } from '@strapi/database';\nimport { async, contentTypes } from '@strapi/utils';\n\ntype DocumentVersion = { documentId: string; locale: string };\ntype Knex = Parameters<Migration['up']>[0];\n\n/**\n * Load a batch of versions to discard.\n *\n * Versions with only a draft version will be ignored.\n * Only versions with a published version (which always have a draft version) will be discarded.\n */\nasync function* getBatchToDiscard({\n db,\n trx,\n uid,\n batchSize = 1000,\n}: {\n db: Database;\n trx: Knex;\n uid: string;\n batchSize?: number;\n}) {\n let offset = 0;\n let hasMore = true;\n\n while (hasMore) {\n // Look for the published entries to discard\n const batch: DocumentVersion[] = await db\n .queryBuilder(uid)\n .select(['id', 'documentId', 'locale'])\n .where({ publishedAt: { $ne: null } })\n .limit(batchSize)\n .offset(offset)\n .orderBy('id')\n .transacting(trx)\n .execute();\n\n if (batch.length < batchSize) {\n hasMore = false;\n }\n\n offset += batchSize;\n yield batch;\n }\n}\n\nconst migrateUp = async (trx: Knex, db: Database) => {\n for (const meta of db.metadata.values()) {\n const hasTable = await trx.schema.hasTable(meta.tableName);\n\n if (!hasTable) {\n continue;\n }\n\n const uid = meta.uid as UID.ContentType;\n const model = strapi.getModel(uid);\n const hasDP = contentTypes.hasDraftAndPublish(model);\n if (!hasDP) {\n continue;\n }\n\n const discardDraft = async (entry: DocumentVersion) =>\n strapi\n .documents(uid)\n // Discard draft by referencing the documentId and locale\n .discardDraft({ documentId: entry.documentId, locale: entry.locale });\n\n /**\n * Load a batch of entries (batched to prevent loading millions of rows at once ),\n * and discard them using the document service.\n */\n for await (const batch of getBatchToDiscard({ db, trx, uid: meta.uid })) {\n await async.map(batch, discardDraft, { concurrency: 10 });\n }\n }\n};\n\n/**\n * On V4 there was no concept of document, and an entry could be in a draft or published state.\n * But not both at the same time.\n *\n * On V5 we introduced the concept of document, and an entry can be in a draft or published state,\n * with the requirement that a document must always have a draft.\n *\n * This migration creates the document draft counterpart for all the entries that were in a published state.\n */\nexport const discardDocumentDrafts: Migration = {\n name: 'core::5.0.0-discard-drafts',\n async up(trx, db) {\n // TODO: Log to inform the user that the migration is running in the background\n await migrateUp(trx, db);\n },\n async down() {\n throw new Error('not implemented');\n },\n};\n"],"names":["contentTypes","async"],"mappings":";;;AAcA,gBAAgB,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AACd,GAKG;AACD,MAAI,SAAS;AACb,MAAI,UAAU;AAEd,SAAO,SAAS;AAEd,UAAM,QAA2B,MAAM,GACpC,aAAa,GAAG,EAChB,OAAO,CAAC,MAAM,cAAc,QAAQ,CAAC,EACrC,MAAM,EAAE,aAAa,EAAE,KAAK,KAAO,EAAA,CAAC,EACpC,MAAM,SAAS,EACf,OAAO,MAAM,EACb,QAAQ,IAAI,EACZ,YAAY,GAAG,EACf,QAAQ;AAEP,QAAA,MAAM,SAAS,WAAW;AAClB,gBAAA;AAAA,IACZ;AAEU,cAAA;AACJ,UAAA;AAAA,EACR;AACF;AAEA,MAAM,YAAY,OAAO,KAAW,OAAiB;AACnD,aAAW,QAAQ,GAAG,SAAS,OAAA,GAAU;AACvC,UAAM,WAAW,MAAM,IAAI,OAAO,SAAS,KAAK,SAAS;AAEzD,QAAI,CAAC,UAAU;AACb;AAAA,IACF;AAEA,UAAM,MAAM,KAAK;AACX,UAAA,QAAQ,OAAO,SAAS,GAAG;AAC3B,UAAA,QAAQA,YAAAA,aAAa,mBAAmB,KAAK;AACnD,QAAI,CAAC,OAAO;AACV;AAAA,IACF;AAEA,UAAM,eAAe,OAAO,UAC1B,OACG,UAAU,GAAG,EAEb,aAAa,EAAE,YAAY,MAAM,YAAY,QAAQ,MAAM,QAAQ;AAMvD,qBAAA,SAAS,kBAAkB,EAAE,IAAI,KAAK,KAAK,KAAK,IAAI,CAAC,GAAG;AACvE,YAAMC,YAAAA,MAAM,IAAI,OAAO,cAAc,EAAE,aAAa,IAAI;AAAA,IAC1D;AAAA,EACF;AACF;AAWO,MAAM,wBAAmC;AAAA,EAC9C,MAAM;AAAA,EACN,MAAM,GAAG,KAAK,IAAI;AAEV,UAAA,UAAU,KAAK,EAAE;AAAA,EACzB;AAAA,EACA,MAAM,OAAO;AACL,UAAA,IAAI,MAAM,iBAAiB;AAAA,EACnC;AACF;;"}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import { contentTypes, async } from "@strapi/utils";
|
2
|
+
async function* getBatchToDiscard({
|
3
|
+
db,
|
4
|
+
trx,
|
5
|
+
uid,
|
6
|
+
batchSize = 1e3
|
7
|
+
}) {
|
8
|
+
let offset = 0;
|
9
|
+
let hasMore = true;
|
10
|
+
while (hasMore) {
|
11
|
+
const batch = await db.queryBuilder(uid).select(["id", "documentId", "locale"]).where({ publishedAt: { $ne: null } }).limit(batchSize).offset(offset).orderBy("id").transacting(trx).execute();
|
12
|
+
if (batch.length < batchSize) {
|
13
|
+
hasMore = false;
|
14
|
+
}
|
15
|
+
offset += batchSize;
|
16
|
+
yield batch;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
const migrateUp = async (trx, db) => {
|
20
|
+
for (const meta of db.metadata.values()) {
|
21
|
+
const hasTable = await trx.schema.hasTable(meta.tableName);
|
22
|
+
if (!hasTable) {
|
23
|
+
continue;
|
24
|
+
}
|
25
|
+
const uid = meta.uid;
|
26
|
+
const model = strapi.getModel(uid);
|
27
|
+
const hasDP = contentTypes.hasDraftAndPublish(model);
|
28
|
+
if (!hasDP) {
|
29
|
+
continue;
|
30
|
+
}
|
31
|
+
const discardDraft = async (entry) => strapi.documents(uid).discardDraft({ documentId: entry.documentId, locale: entry.locale });
|
32
|
+
for await (const batch of getBatchToDiscard({ db, trx, uid: meta.uid })) {
|
33
|
+
await async.map(batch, discardDraft, { concurrency: 10 });
|
34
|
+
}
|
35
|
+
}
|
36
|
+
};
|
37
|
+
const discardDocumentDrafts = {
|
38
|
+
name: "core::5.0.0-discard-drafts",
|
39
|
+
async up(trx, db) {
|
40
|
+
await migrateUp(trx, db);
|
41
|
+
},
|
42
|
+
async down() {
|
43
|
+
throw new Error("not implemented");
|
44
|
+
}
|
45
|
+
};
|
46
|
+
export {
|
47
|
+
discardDocumentDrafts
|
48
|
+
};
|
49
|
+
//# sourceMappingURL=5.0.0-discard-drafts.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"5.0.0-discard-drafts.mjs","sources":["../../../src/migrations/database/5.0.0-discard-drafts.ts"],"sourcesContent":["/* eslint-disable no-continue */\nimport type { UID } from '@strapi/types';\nimport type { Database, Migration } from '@strapi/database';\nimport { async, contentTypes } from '@strapi/utils';\n\ntype DocumentVersion = { documentId: string; locale: string };\ntype Knex = Parameters<Migration['up']>[0];\n\n/**\n * Load a batch of versions to discard.\n *\n * Versions with only a draft version will be ignored.\n * Only versions with a published version (which always have a draft version) will be discarded.\n */\nasync function* getBatchToDiscard({\n db,\n trx,\n uid,\n batchSize = 1000,\n}: {\n db: Database;\n trx: Knex;\n uid: string;\n batchSize?: number;\n}) {\n let offset = 0;\n let hasMore = true;\n\n while (hasMore) {\n // Look for the published entries to discard\n const batch: DocumentVersion[] = await db\n .queryBuilder(uid)\n .select(['id', 'documentId', 'locale'])\n .where({ publishedAt: { $ne: null } })\n .limit(batchSize)\n .offset(offset)\n .orderBy('id')\n .transacting(trx)\n .execute();\n\n if (batch.length < batchSize) {\n hasMore = false;\n }\n\n offset += batchSize;\n yield batch;\n }\n}\n\nconst migrateUp = async (trx: Knex, db: Database) => {\n for (const meta of db.metadata.values()) {\n const hasTable = await trx.schema.hasTable(meta.tableName);\n\n if (!hasTable) {\n continue;\n }\n\n const uid = meta.uid as UID.ContentType;\n const model = strapi.getModel(uid);\n const hasDP = contentTypes.hasDraftAndPublish(model);\n if (!hasDP) {\n continue;\n }\n\n const discardDraft = async (entry: DocumentVersion) =>\n strapi\n .documents(uid)\n // Discard draft by referencing the documentId and locale\n .discardDraft({ documentId: entry.documentId, locale: entry.locale });\n\n /**\n * Load a batch of entries (batched to prevent loading millions of rows at once ),\n * and discard them using the document service.\n */\n for await (const batch of getBatchToDiscard({ db, trx, uid: meta.uid })) {\n await async.map(batch, discardDraft, { concurrency: 10 });\n }\n }\n};\n\n/**\n * On V4 there was no concept of document, and an entry could be in a draft or published state.\n * But not both at the same time.\n *\n * On V5 we introduced the concept of document, and an entry can be in a draft or published state,\n * with the requirement that a document must always have a draft.\n *\n * This migration creates the document draft counterpart for all the entries that were in a published state.\n */\nexport const discardDocumentDrafts: Migration = {\n name: 'core::5.0.0-discard-drafts',\n async up(trx, db) {\n // TODO: Log to inform the user that the migration is running in the background\n await migrateUp(trx, db);\n },\n async down() {\n throw new Error('not implemented');\n },\n};\n"],"names":[],"mappings":";AAcA,gBAAgB,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AACd,GAKG;AACD,MAAI,SAAS;AACb,MAAI,UAAU;AAEd,SAAO,SAAS;AAEd,UAAM,QAA2B,MAAM,GACpC,aAAa,GAAG,EAChB,OAAO,CAAC,MAAM,cAAc,QAAQ,CAAC,EACrC,MAAM,EAAE,aAAa,EAAE,KAAK,KAAO,EAAA,CAAC,EACpC,MAAM,SAAS,EACf,OAAO,MAAM,EACb,QAAQ,IAAI,EACZ,YAAY,GAAG,EACf,QAAQ;AAEP,QAAA,MAAM,SAAS,WAAW;AAClB,gBAAA;AAAA,IACZ;AAEU,cAAA;AACJ,UAAA;AAAA,EACR;AACF;AAEA,MAAM,YAAY,OAAO,KAAW,OAAiB;AACnD,aAAW,QAAQ,GAAG,SAAS,OAAA,GAAU;AACvC,UAAM,WAAW,MAAM,IAAI,OAAO,SAAS,KAAK,SAAS;AAEzD,QAAI,CAAC,UAAU;AACb;AAAA,IACF;AAEA,UAAM,MAAM,KAAK;AACX,UAAA,QAAQ,OAAO,SAAS,GAAG;AAC3B,UAAA,QAAQ,aAAa,mBAAmB,KAAK;AACnD,QAAI,CAAC,OAAO;AACV;AAAA,IACF;AAEA,UAAM,eAAe,OAAO,UAC1B,OACG,UAAU,GAAG,EAEb,aAAa,EAAE,YAAY,MAAM,YAAY,QAAQ,MAAM,QAAQ;AAMvD,qBAAA,SAAS,kBAAkB,EAAE,IAAI,KAAK,KAAK,KAAK,IAAI,CAAC,GAAG;AACvE,YAAM,MAAM,IAAI,OAAO,cAAc,EAAE,aAAa,IAAI;AAAA,IAC1D;AAAA,EACF;AACF;AAWO,MAAM,wBAAmC;AAAA,EAC9C,MAAM;AAAA,EACN,MAAM,GAAG,KAAK,IAAI;AAEV,UAAA,UAAU,KAAK,EAAE;AAAA,EACzB;AAAA,EACA,MAAM,OAAO;AACL,UAAA,IAAI,MAAM,iBAAiB;AAAA,EACnC;AACF;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"registries.d.ts","sourceRoot":"","sources":["../../src/providers/registries.ts"],"names":[],"mappings":";
|
1
|
+
{"version":3,"file":"registries.d.ts","sourceRoot":"","sources":["../../src/providers/registries.ts"],"names":[],"mappings":";AAQA,wBA+BG"}
|
@@ -17,6 +17,7 @@ const validators = require("../registries/validators.js");
|
|
17
17
|
const models = require("../registries/models.js");
|
18
18
|
const index = require("../loaders/index.js");
|
19
19
|
const draftPublish = require("../migrations/draft-publish.js");
|
20
|
+
const _5_0_0DiscardDrafts = require("../migrations/database/5.0.0-discard-drafts.js");
|
20
21
|
const registries = provider.defineProvider({
|
21
22
|
init(strapi) {
|
22
23
|
strapi.add("content-types", () => contentTypes()).add("components", () => components()).add("services", () => services(strapi)).add("policies", () => policies()).add("middlewares", () => middlewares()).add("hooks", () => hooks()).add("controllers", () => controllers(strapi)).add("modules", () => modules(strapi)).add("plugins", () => plugins(strapi)).add("custom-fields", () => customFields(strapi)).add("apis", () => apis(strapi)).add("models", () => models.registry()).add("sanitizers", sanitizers()).add("validators", validators());
|
@@ -27,6 +28,7 @@ const registries = provider.defineProvider({
|
|
27
28
|
strapi.get("hooks").set("strapi::content-types.afterSync", strapiUtils.hooks.createAsyncParallelHook());
|
28
29
|
strapi.hook("strapi::content-types.beforeSync").register(draftPublish.disable);
|
29
30
|
strapi.hook("strapi::content-types.afterSync").register(draftPublish.enable);
|
31
|
+
strapi.db.migrations.providers.internal.register(_5_0_0DiscardDrafts.discardDocumentDrafts);
|
30
32
|
}
|
31
33
|
});
|
32
34
|
module.exports = registries;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"registries.js","sources":["../../src/providers/registries.ts"],"sourcesContent":["import { hooks } from '@strapi/utils';\n\nimport { defineProvider } from './provider';\nimport * as registries from '../registries';\nimport { loadApplicationContext } from '../loaders';\nimport * as draftAndPublishSync from '../migrations/draft-publish';\n\nexport default defineProvider({\n init(strapi) {\n strapi\n .add('content-types', () => registries.contentTypes())\n .add('components', () => registries.components())\n .add('services', () => registries.services(strapi))\n .add('policies', () => registries.policies())\n .add('middlewares', () => registries.middlewares())\n .add('hooks', () => registries.hooks())\n .add('controllers', () => registries.controllers(strapi))\n .add('modules', () => registries.modules(strapi))\n .add('plugins', () => registries.plugins(strapi))\n .add('custom-fields', () => registries.customFields(strapi))\n .add('apis', () => registries.apis(strapi))\n .add('models', () => registries.models())\n .add('sanitizers', registries.sanitizers())\n .add('validators', registries.validators());\n },\n async register(strapi) {\n await loadApplicationContext(strapi);\n\n strapi.get('hooks').set('strapi::content-types.beforeSync', hooks.createAsyncParallelHook());\n strapi.get('hooks').set('strapi::content-types.afterSync', hooks.createAsyncParallelHook());\n\n strapi.hook('strapi::content-types.beforeSync').register(draftAndPublishSync.disable);\n strapi.hook('strapi::content-types.afterSync').register(draftAndPublishSync.enable);\n },\n});\n"],"names":["defineProvider","registries.contentTypes","registries.components","registries.services","registries.policies","registries.middlewares","registries.hooks","registries.controllers","registries.modules","registries.plugins","registries.customFields","registries.apis","registries.models","registries.sanitizers","registries.validators","loadApplicationContext","hooks","draftAndPublishSync.disable","draftAndPublishSync.enable"],"mappings":"
|
1
|
+
{"version":3,"file":"registries.js","sources":["../../src/providers/registries.ts"],"sourcesContent":["import { hooks } from '@strapi/utils';\n\nimport { defineProvider } from './provider';\nimport * as registries from '../registries';\nimport { loadApplicationContext } from '../loaders';\nimport * as draftAndPublishSync from '../migrations/draft-publish';\nimport { discardDocumentDrafts } from '../migrations/database/5.0.0-discard-drafts';\n\nexport default defineProvider({\n init(strapi) {\n strapi\n .add('content-types', () => registries.contentTypes())\n .add('components', () => registries.components())\n .add('services', () => registries.services(strapi))\n .add('policies', () => registries.policies())\n .add('middlewares', () => registries.middlewares())\n .add('hooks', () => registries.hooks())\n .add('controllers', () => registries.controllers(strapi))\n .add('modules', () => registries.modules(strapi))\n .add('plugins', () => registries.plugins(strapi))\n .add('custom-fields', () => registries.customFields(strapi))\n .add('apis', () => registries.apis(strapi))\n .add('models', () => registries.models())\n .add('sanitizers', registries.sanitizers())\n .add('validators', registries.validators());\n },\n async register(strapi) {\n await loadApplicationContext(strapi);\n\n strapi.get('hooks').set('strapi::content-types.beforeSync', hooks.createAsyncParallelHook());\n strapi.get('hooks').set('strapi::content-types.afterSync', hooks.createAsyncParallelHook());\n\n // Content migration to enable draft and publish\n strapi.hook('strapi::content-types.beforeSync').register(draftAndPublishSync.disable);\n strapi.hook('strapi::content-types.afterSync').register(draftAndPublishSync.enable);\n\n // Database migrations\n strapi.db.migrations.providers.internal.register(discardDocumentDrafts);\n },\n});\n"],"names":["defineProvider","registries.contentTypes","registries.components","registries.services","registries.policies","registries.middlewares","registries.hooks","registries.controllers","registries.modules","registries.plugins","registries.customFields","registries.apis","registries.models","registries.sanitizers","registries.validators","loadApplicationContext","hooks","draftAndPublishSync.disable","draftAndPublishSync.enable","discardDocumentDrafts"],"mappings":";;;;;;;;;;;;;;;;;;;;AAQA,MAAA,aAAeA,wBAAe;AAAA,EAC5B,KAAK,QAAQ;AAER,WAAA,IAAI,iBAAiB,MAAMC,aAAyB,CAAA,EACpD,IAAI,cAAc,MAAMC,WAAuB,CAAA,EAC/C,IAAI,YAAY,MAAMC,SAAoB,MAAM,CAAC,EACjD,IAAI,YAAY,MAAMC,SAAqB,CAAA,EAC3C,IAAI,eAAe,MAAMC,YAAuB,CAAC,EACjD,IAAI,SAAS,MAAMC,OAAkB,EACrC,IAAI,eAAe,MAAMC,YAAuB,MAAM,CAAC,EACvD,IAAI,WAAW,MAAMC,QAAmB,MAAM,CAAC,EAC/C,IAAI,WAAW,MAAMC,QAAmB,MAAM,CAAC,EAC/C,IAAI,iBAAiB,MAAMC,aAAwB,MAAM,CAAC,EAC1D,IAAI,QAAQ,MAAMC,KAAgB,MAAM,CAAC,EACzC,IAAI,UAAU,MAAMC,gBAAmB,CAAA,EACvC,IAAI,cAAcC,YAAuB,EACzC,IAAI,cAAcC,WAAW,CAAY;AAAA,EAC9C;AAAA,EACA,MAAM,SAAS,QAAQ;AACrB,UAAMC,MAAAA,uBAAuB,MAAM;AAEnC,WAAO,IAAI,OAAO,EAAE,IAAI,oCAAoCC,YAAA,MAAM,yBAAyB;AAC3F,WAAO,IAAI,OAAO,EAAE,IAAI,mCAAmCA,YAAA,MAAM,yBAAyB;AAG1F,WAAO,KAAK,kCAAkC,EAAE,SAASC,aAA2B,OAAA;AACpF,WAAO,KAAK,iCAAiC,EAAE,SAASC,aAA0B,MAAA;AAGlF,WAAO,GAAG,WAAW,UAAU,SAAS,SAASC,oBAAAA,qBAAqB;AAAA,EACxE;AACF,CAAC;;"}
|
@@ -16,6 +16,7 @@ import validatorsRegistry from "../registries/validators.mjs";
|
|
16
16
|
import { registry } from "../registries/models.mjs";
|
17
17
|
import { loadApplicationContext } from "../loaders/index.mjs";
|
18
18
|
import { disable as disableDraftAndPublish, enable as enableDraftAndPublish } from "../migrations/draft-publish.mjs";
|
19
|
+
import { discardDocumentDrafts } from "../migrations/database/5.0.0-discard-drafts.mjs";
|
19
20
|
const registries = defineProvider({
|
20
21
|
init(strapi) {
|
21
22
|
strapi.add("content-types", () => contentTypesRegistry()).add("components", () => componentsRegistry()).add("services", () => servicesRegistry(strapi)).add("policies", () => policiesRegistry()).add("middlewares", () => middlewaresRegistry()).add("hooks", () => hooksRegistry()).add("controllers", () => controllersRegistry(strapi)).add("modules", () => modulesRegistry(strapi)).add("plugins", () => pluginsRegistry(strapi)).add("custom-fields", () => customFieldsRegistry(strapi)).add("apis", () => apisRegistry(strapi)).add("models", () => registry()).add("sanitizers", sanitizersRegistry()).add("validators", validatorsRegistry());
|
@@ -26,6 +27,7 @@ const registries = defineProvider({
|
|
26
27
|
strapi.get("hooks").set("strapi::content-types.afterSync", hooks.createAsyncParallelHook());
|
27
28
|
strapi.hook("strapi::content-types.beforeSync").register(disableDraftAndPublish);
|
28
29
|
strapi.hook("strapi::content-types.afterSync").register(enableDraftAndPublish);
|
30
|
+
strapi.db.migrations.providers.internal.register(discardDocumentDrafts);
|
29
31
|
}
|
30
32
|
});
|
31
33
|
export {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"registries.mjs","sources":["../../src/providers/registries.ts"],"sourcesContent":["import { hooks } from '@strapi/utils';\n\nimport { defineProvider } from './provider';\nimport * as registries from '../registries';\nimport { loadApplicationContext } from '../loaders';\nimport * as draftAndPublishSync from '../migrations/draft-publish';\n\nexport default defineProvider({\n init(strapi) {\n strapi\n .add('content-types', () => registries.contentTypes())\n .add('components', () => registries.components())\n .add('services', () => registries.services(strapi))\n .add('policies', () => registries.policies())\n .add('middlewares', () => registries.middlewares())\n .add('hooks', () => registries.hooks())\n .add('controllers', () => registries.controllers(strapi))\n .add('modules', () => registries.modules(strapi))\n .add('plugins', () => registries.plugins(strapi))\n .add('custom-fields', () => registries.customFields(strapi))\n .add('apis', () => registries.apis(strapi))\n .add('models', () => registries.models())\n .add('sanitizers', registries.sanitizers())\n .add('validators', registries.validators());\n },\n async register(strapi) {\n await loadApplicationContext(strapi);\n\n strapi.get('hooks').set('strapi::content-types.beforeSync', hooks.createAsyncParallelHook());\n strapi.get('hooks').set('strapi::content-types.afterSync', hooks.createAsyncParallelHook());\n\n strapi.hook('strapi::content-types.beforeSync').register(draftAndPublishSync.disable);\n strapi.hook('strapi::content-types.afterSync').register(draftAndPublishSync.enable);\n },\n});\n"],"names":["registries.contentTypes","registries.components","registries.services","registries.policies","registries.middlewares","registries.hooks","registries.controllers","registries.modules","registries.plugins","registries.customFields","registries.apis","registries.models","registries.sanitizers","registries.validators","draftAndPublishSync.disable","draftAndPublishSync.enable"],"mappings":"
|
1
|
+
{"version":3,"file":"registries.mjs","sources":["../../src/providers/registries.ts"],"sourcesContent":["import { hooks } from '@strapi/utils';\n\nimport { defineProvider } from './provider';\nimport * as registries from '../registries';\nimport { loadApplicationContext } from '../loaders';\nimport * as draftAndPublishSync from '../migrations/draft-publish';\nimport { discardDocumentDrafts } from '../migrations/database/5.0.0-discard-drafts';\n\nexport default defineProvider({\n init(strapi) {\n strapi\n .add('content-types', () => registries.contentTypes())\n .add('components', () => registries.components())\n .add('services', () => registries.services(strapi))\n .add('policies', () => registries.policies())\n .add('middlewares', () => registries.middlewares())\n .add('hooks', () => registries.hooks())\n .add('controllers', () => registries.controllers(strapi))\n .add('modules', () => registries.modules(strapi))\n .add('plugins', () => registries.plugins(strapi))\n .add('custom-fields', () => registries.customFields(strapi))\n .add('apis', () => registries.apis(strapi))\n .add('models', () => registries.models())\n .add('sanitizers', registries.sanitizers())\n .add('validators', registries.validators());\n },\n async register(strapi) {\n await loadApplicationContext(strapi);\n\n strapi.get('hooks').set('strapi::content-types.beforeSync', hooks.createAsyncParallelHook());\n strapi.get('hooks').set('strapi::content-types.afterSync', hooks.createAsyncParallelHook());\n\n // Content migration to enable draft and publish\n strapi.hook('strapi::content-types.beforeSync').register(draftAndPublishSync.disable);\n strapi.hook('strapi::content-types.afterSync').register(draftAndPublishSync.enable);\n\n // Database migrations\n strapi.db.migrations.providers.internal.register(discardDocumentDrafts);\n },\n});\n"],"names":["registries.contentTypes","registries.components","registries.services","registries.policies","registries.middlewares","registries.hooks","registries.controllers","registries.modules","registries.plugins","registries.customFields","registries.apis","registries.models","registries.sanitizers","registries.validators","draftAndPublishSync.disable","draftAndPublishSync.enable"],"mappings":";;;;;;;;;;;;;;;;;;;AAQA,MAAA,aAAe,eAAe;AAAA,EAC5B,KAAK,QAAQ;AAER,WAAA,IAAI,iBAAiB,MAAMA,qBAAyB,CAAA,EACpD,IAAI,cAAc,MAAMC,mBAAuB,CAAA,EAC/C,IAAI,YAAY,MAAMC,iBAAoB,MAAM,CAAC,EACjD,IAAI,YAAY,MAAMC,iBAAqB,CAAA,EAC3C,IAAI,eAAe,MAAMC,oBAAuB,CAAC,EACjD,IAAI,SAAS,MAAMC,eAAkB,EACrC,IAAI,eAAe,MAAMC,oBAAuB,MAAM,CAAC,EACvD,IAAI,WAAW,MAAMC,gBAAmB,MAAM,CAAC,EAC/C,IAAI,WAAW,MAAMC,gBAAmB,MAAM,CAAC,EAC/C,IAAI,iBAAiB,MAAMC,qBAAwB,MAAM,CAAC,EAC1D,IAAI,QAAQ,MAAMC,aAAgB,MAAM,CAAC,EACzC,IAAI,UAAU,MAAMC,SAAmB,CAAA,EACvC,IAAI,cAAcC,oBAAuB,EACzC,IAAI,cAAcC,mBAAW,CAAY;AAAA,EAC9C;AAAA,EACA,MAAM,SAAS,QAAQ;AACrB,UAAM,uBAAuB,MAAM;AAEnC,WAAO,IAAI,OAAO,EAAE,IAAI,oCAAoC,MAAM,yBAAyB;AAC3F,WAAO,IAAI,OAAO,EAAE,IAAI,mCAAmC,MAAM,yBAAyB;AAG1F,WAAO,KAAK,kCAAkC,EAAE,SAASC,sBAA2B;AACpF,WAAO,KAAK,iCAAiC,EAAE,SAASC,qBAA0B;AAGlF,WAAO,GAAG,WAAW,UAAU,SAAS,SAAS,qBAAqB;AAAA,EACxE;AACF,CAAC;"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@strapi/core",
|
3
|
-
"version": "5.0.0-beta.
|
3
|
+
"version": "5.0.0-beta.5",
|
4
4
|
"description": "Core of Strapi",
|
5
5
|
"homepage": "https://strapi.io",
|
6
6
|
"bugs": {
|
@@ -55,16 +55,16 @@
|
|
55
55
|
"@koa/cors": "5.0.0",
|
56
56
|
"@koa/router": "12.0.1",
|
57
57
|
"@paralleldrive/cuid2": "2.2.2",
|
58
|
-
"@strapi/admin": "5.0.0-beta.
|
59
|
-
"@strapi/database": "5.0.0-beta.
|
60
|
-
"@strapi/generate-new": "5.0.0-beta.
|
61
|
-
"@strapi/generators": "5.0.0-beta.
|
62
|
-
"@strapi/logger": "5.0.0-beta.
|
58
|
+
"@strapi/admin": "5.0.0-beta.5",
|
59
|
+
"@strapi/database": "5.0.0-beta.5",
|
60
|
+
"@strapi/generate-new": "5.0.0-beta.5",
|
61
|
+
"@strapi/generators": "5.0.0-beta.5",
|
62
|
+
"@strapi/logger": "5.0.0-beta.5",
|
63
63
|
"@strapi/pack-up": "5.0.0",
|
64
|
-
"@strapi/permissions": "5.0.0-beta.
|
65
|
-
"@strapi/types": "5.0.0-beta.
|
66
|
-
"@strapi/typescript-utils": "5.0.0-beta.
|
67
|
-
"@strapi/utils": "5.0.0-beta.
|
64
|
+
"@strapi/permissions": "5.0.0-beta.5",
|
65
|
+
"@strapi/types": "5.0.0-beta.5",
|
66
|
+
"@strapi/typescript-utils": "5.0.0-beta.5",
|
67
|
+
"@strapi/utils": "5.0.0-beta.5",
|
68
68
|
"bcryptjs": "2.4.3",
|
69
69
|
"boxen": "5.1.2",
|
70
70
|
"chalk": "4.1.2",
|
@@ -122,13 +122,13 @@
|
|
122
122
|
"@types/node": "18.19.24",
|
123
123
|
"@types/node-schedule": "2.1.0",
|
124
124
|
"@types/statuses": "2.0.1",
|
125
|
-
"eslint-config-custom": "5.0.0-beta.
|
125
|
+
"eslint-config-custom": "5.0.0-beta.5",
|
126
126
|
"supertest": "6.3.3",
|
127
|
-
"tsconfig": "5.0.0-beta.
|
127
|
+
"tsconfig": "5.0.0-beta.5"
|
128
128
|
},
|
129
129
|
"engines": {
|
130
130
|
"node": ">=18.0.0 <=20.x.x",
|
131
131
|
"npm": ">=6.0.0"
|
132
132
|
},
|
133
|
-
"gitHead": "
|
133
|
+
"gitHead": "2aa7d7fb419d7ece2dc1b6c0f45d6c8948abc137"
|
134
134
|
}
|
@@ -1 +0,0 @@
|
|
1
|
-
//# sourceMappingURL=document-engine.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"document-engine.d.ts","sourceRoot":"","sources":["../../../src/services/document-service/document-engine.ts"],"names":[],"mappings":""}
|