@strapi/data-transfer 5.0.0-beta.0 → 5.0.0-beta.10
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/engine/diagnostic.d.ts.map +1 -1
- package/dist/engine/index.d.ts.map +1 -1
- package/dist/engine/validation/provider.d.ts +1 -1
- package/dist/engine/validation/provider.d.ts.map +1 -1
- package/dist/engine/validation/schemas/index.d.ts.map +1 -1
- package/dist/file/providers/destination/utils.d.ts.map +1 -1
- package/dist/file/providers/source/index.d.ts +1 -3
- package/dist/file/providers/source/index.d.ts.map +1 -1
- package/dist/index.js +84 -53
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +85 -54
- package/dist/index.mjs.map +1 -1
- package/dist/strapi/providers/local-destination/index.d.ts +4 -4
- package/dist/strapi/providers/local-destination/index.d.ts.map +1 -1
- package/dist/strapi/providers/local-destination/strategies/restore/configuration.d.ts +3 -3
- package/dist/strapi/providers/local-destination/strategies/restore/configuration.d.ts.map +1 -1
- package/dist/strapi/providers/local-destination/strategies/restore/entities.d.ts +5 -5
- package/dist/strapi/providers/local-destination/strategies/restore/entities.d.ts.map +1 -1
- package/dist/strapi/providers/local-destination/strategies/restore/index.d.ts +3 -3
- package/dist/strapi/providers/local-destination/strategies/restore/index.d.ts.map +1 -1
- package/dist/strapi/providers/local-destination/strategies/restore/links.d.ts +2 -2
- package/dist/strapi/providers/local-destination/strategies/restore/links.d.ts.map +1 -1
- package/dist/strapi/providers/local-source/assets.d.ts +2 -2
- package/dist/strapi/providers/local-source/assets.d.ts.map +1 -1
- package/dist/strapi/providers/local-source/configuration.d.ts +2 -2
- package/dist/strapi/providers/local-source/configuration.d.ts.map +1 -1
- package/dist/strapi/providers/local-source/entities.d.ts +2 -2
- package/dist/strapi/providers/local-source/entities.d.ts.map +1 -1
- package/dist/strapi/providers/local-source/index.d.ts +4 -4
- package/dist/strapi/providers/local-source/index.d.ts.map +1 -1
- package/dist/strapi/providers/local-source/links.d.ts +2 -2
- package/dist/strapi/providers/local-source/links.d.ts.map +1 -1
- package/dist/strapi/providers/remote-destination/index.d.ts +2 -2
- package/dist/strapi/providers/remote-source/index.d.ts +2 -2
- package/dist/strapi/providers/remote-source/index.d.ts.map +1 -1
- package/dist/strapi/providers/utils.d.ts +1 -1
- package/dist/strapi/providers/utils.d.ts.map +1 -1
- package/dist/strapi/queries/entity.d.ts +2 -2
- package/dist/strapi/queries/entity.d.ts.map +1 -1
- package/dist/strapi/queries/link.d.ts +3 -2
- package/dist/strapi/queries/link.d.ts.map +1 -1
- package/dist/strapi/remote/handlers/utils.d.ts.map +1 -1
- package/dist/utils/components.d.ts +23 -13
- package/dist/utils/components.d.ts.map +1 -1
- package/dist/utils/middleware.d.ts.map +1 -1
- package/dist/utils/providers.d.ts +2 -2
- package/dist/utils/providers.d.ts.map +1 -1
- package/dist/utils/schema.d.ts +3 -2
- package/dist/utils/schema.d.ts.map +1 -1
- package/dist/utils/stream.d.ts.map +1 -1
- package/dist/utils/transaction.d.ts +2 -2
- package/dist/utils/transaction.d.ts.map +1 -1
- package/package.json +11 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostic.d.ts","sourceRoot":"","sources":["../../src/engine/diagnostic.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,0BAA0B;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,cAAc,EAAE,CAAC,GAAG,OAAO,IAAI;IACrE,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE;QACP,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,IAAI,CAAC;KACjB,GAAG,CAAC,CAAC;CACP,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAE1D,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,IAAI,CAC1E,UAAU,E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O,KAAK,MAAM,MAAM,UAAU,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { IDestinationProvider, ISourceProvider, ProviderType } from '../../../types';
|
|
2
|
-
declare const validateProvider: <T extends ProviderType>(type: ProviderType, provider?: ([T] extends [
|
|
2
|
+
declare const validateProvider: <T extends ProviderType>(type: ProviderType, provider?: ([T] extends ['source'] ? ISourceProvider : IDestinationProvider) | null) => undefined;
|
|
3
3
|
export { validateProvider };
|
|
4
4
|
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/engine/validation/provider.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAO1F,QAAA,MAAM,gBAAgB,iCACd,YAAY
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/engine/validation/provider.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAO1F,QAAA,MAAM,gBAAgB,iCACd,YAAY,aACP,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,eAAe,GAAG,oBAAoB,CAAC,GAAG,IAAI,cAapF,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/engine/validation/schemas/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/engine/validation/schemas/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAqChD,QAAA,MAAM,UAAU;iBAED,IAAI,EAAE;kBAOL,IAAI,EAAE;CAGrB,CAAC;AAEF,QAAA,MAAM,cAAc,YAAa,CAAC,KAAK,CAAC,YAAY,MAAM,iBAAiB,WAG1E,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/file/providers/destination/utils.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,OAAO,GAAG,MAAM,YAAY,CAAC;AAE7B;;;GAGG;AACH,eAAO,MAAM,qBAAqB,SACzB,MAAM,6BACI,MAQhB,CAAC;AAEJ,eAAO,MAAM,oBAAoB,YACtB,IAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/file/providers/destination/utils.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,OAAO,GAAG,MAAM,YAAY,CAAC;AAE7B;;;GAGG;AACH,eAAO,MAAM,qBAAqB,SACzB,MAAM,6BACI,MAQhB,CAAC;AAEJ,eAAO,MAAM,oBAAoB,YACtB,IAAI,IAAI,eACJ,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,MAAM,+BAuDxC,CAAC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
/// <reference types="lodash" />
|
|
2
1
|
/// <reference types="node" />
|
|
3
2
|
import type { Readable } from 'stream';
|
|
4
|
-
import type { Schema } from '@strapi/types';
|
|
5
3
|
import type { IMetadata, ISourceProvider, ProviderType } from '../../../../types';
|
|
6
4
|
/**
|
|
7
5
|
* Provider options
|
|
@@ -30,7 +28,7 @@ declare class LocalFileSourceProvider implements ISourceProvider {
|
|
|
30
28
|
*/
|
|
31
29
|
bootstrap(): Promise<void>;
|
|
32
30
|
getMetadata(): Promise<IMetadata | null>;
|
|
33
|
-
getSchemas(): Promise<
|
|
31
|
+
getSchemas(): Promise<any>;
|
|
34
32
|
createEntitiesReadStream(): Readable;
|
|
35
33
|
createSchemasReadStream(): Readable;
|
|
36
34
|
createLinksReadStream(): Readable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/file/providers/source/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/file/providers/source/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAYvC,OAAO,KAAK,EAAU,SAAS,EAAE,eAAe,EAAE,YAAY,EAAS,MAAM,mBAAmB,CAAC;AAajG;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IAEF,UAAU,EAAE;QACV,OAAO,EAAE,OAAO,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;IAEF,WAAW,EAAE;QACX,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;CACH;AAED,eAAO,MAAM,6BAA6B,YAAa,+BAA+B,4BAErF,CAAC;AAEF,cAAM,uBAAwB,YAAW,eAAe;;IACtD,IAAI,EAAE,YAAY,CAAY;IAE9B,IAAI,SAAwB;IAE5B,OAAO,EAAE,+BAA+B,CAAC;gBAI7B,OAAO,EAAE,+BAA+B;IAUpD;;OAEG;IACG,SAAS;IA+BT,WAAW;IAQX,UAAU;IAgBhB,wBAAwB,IAAI,QAAQ;IAIpC,uBAAuB,IAAI,QAAQ;IAInC,qBAAqB,IAAI,QAAQ;IAIjC,6BAA6B,IAAI,QAAQ;IAKzC,sBAAsB,IAAI,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;CA8KvD"}
|
package/dist/index.js
CHANGED
|
@@ -224,9 +224,13 @@ const VALID_SCHEMA_PROPERTIES = [
|
|
|
224
224
|
const mapSchemasValues = (schemas) => {
|
|
225
225
|
return fp.mapValues(fp.pick(VALID_SCHEMA_PROPERTIES), schemas);
|
|
226
226
|
};
|
|
227
|
+
const schemasToValidJSON = (schemas) => {
|
|
228
|
+
return JSON.parse(JSON.stringify(schemas));
|
|
229
|
+
};
|
|
227
230
|
const schema = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
228
231
|
__proto__: null,
|
|
229
|
-
mapSchemasValues
|
|
232
|
+
mapSchemasValues,
|
|
233
|
+
schemasToValidJSON
|
|
230
234
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
231
235
|
const createTransaction = (strapi2) => {
|
|
232
236
|
const fns = [];
|
|
@@ -336,7 +340,7 @@ const isAttributeIgnorable = (diff2) => {
|
|
|
336
340
|
return diff2.path.length === 3 && // Root property must be attributes
|
|
337
341
|
diff2.path[0] === "attributes" && // Need a valid string attribute name
|
|
338
342
|
typeof diff2.path[1] === "string" && // The diff must be on ignorable attribute properties
|
|
339
|
-
["private", "required", "configurable"].includes(diff2.path[2]);
|
|
343
|
+
["private", "required", "configurable", "default"].includes(diff2.path[2]);
|
|
340
344
|
};
|
|
341
345
|
const isOptionalAdminType = (diff2) => {
|
|
342
346
|
if ("value" in diff2 && fp.isObject(diff2.value)) {
|
|
@@ -1068,8 +1072,8 @@ ${formattedDiffs}`,
|
|
|
1068
1072
|
}
|
|
1069
1073
|
const { type, data } = entity2;
|
|
1070
1074
|
const attributes = schemas[type].attributes;
|
|
1071
|
-
const
|
|
1072
|
-
const updatedEntity = fp.set("data", fp.
|
|
1075
|
+
const attributesToKeep = Object.keys(attributes).concat("documentId");
|
|
1076
|
+
const updatedEntity = fp.set("data", fp.pick(attributesToKeep, data), entity2);
|
|
1073
1077
|
callback(null, updatedEntity);
|
|
1074
1078
|
}
|
|
1075
1079
|
})
|
|
@@ -1283,6 +1287,34 @@ const deleteComponent = async (uid, componentToDelete) => {
|
|
|
1283
1287
|
await deleteComponents(uid, componentToDelete);
|
|
1284
1288
|
await strapi.db.query(uid).delete({ where: { id: componentToDelete.id } });
|
|
1285
1289
|
};
|
|
1290
|
+
const resolveComponentUID = ({
|
|
1291
|
+
paths,
|
|
1292
|
+
strapi: strapi2,
|
|
1293
|
+
data,
|
|
1294
|
+
contentType
|
|
1295
|
+
}) => {
|
|
1296
|
+
let value = data;
|
|
1297
|
+
let cType = contentType;
|
|
1298
|
+
for (const path2 of paths) {
|
|
1299
|
+
value = fp.get(path2, value);
|
|
1300
|
+
if (typeof cType === "function") {
|
|
1301
|
+
cType = cType(value);
|
|
1302
|
+
}
|
|
1303
|
+
if (path2 in cType.attributes) {
|
|
1304
|
+
const attribute = cType.attributes[path2];
|
|
1305
|
+
if (attribute.type === "component") {
|
|
1306
|
+
cType = strapi2.getModel(attribute.component);
|
|
1307
|
+
}
|
|
1308
|
+
if (attribute.type === "dynamiczone") {
|
|
1309
|
+
cType = ({ __component }) => strapi2.getModel(__component);
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
if ("uid" in cType) {
|
|
1314
|
+
return cType.uid;
|
|
1315
|
+
}
|
|
1316
|
+
return void 0;
|
|
1317
|
+
};
|
|
1286
1318
|
const sanitizeComponentLikeAttributes = (model, data) => {
|
|
1287
1319
|
const { attributes } = model;
|
|
1288
1320
|
const componentLikeAttributesKey = Object.entries(attributes).filter(([, attribute]) => attribute.type === "component" || attribute.type === "dynamiczone").map(([key]) => key);
|
|
@@ -1301,13 +1333,9 @@ const createEntityQuery = (strapi2) => {
|
|
|
1301
1333
|
return getComponents(uid, entity2);
|
|
1302
1334
|
},
|
|
1303
1335
|
delete(uid, componentsToDelete) {
|
|
1304
|
-
return deleteComponents(
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
{
|
|
1308
|
-
loadComponents: false
|
|
1309
|
-
}
|
|
1310
|
-
);
|
|
1336
|
+
return deleteComponents(uid, componentsToDelete, {
|
|
1337
|
+
loadComponents: false
|
|
1338
|
+
});
|
|
1311
1339
|
}
|
|
1312
1340
|
};
|
|
1313
1341
|
const query = (uid) => {
|
|
@@ -1536,6 +1564,9 @@ const createLinkQuery = (strapi2, trx) => {
|
|
|
1536
1564
|
const metadata = strapi2.db.metadata.get(left.type);
|
|
1537
1565
|
const attribute = metadata.attributes[left.field];
|
|
1538
1566
|
const payload = {};
|
|
1567
|
+
if (!attribute) {
|
|
1568
|
+
return;
|
|
1569
|
+
}
|
|
1539
1570
|
if (attribute.type !== "relation") {
|
|
1540
1571
|
throw new Error(`Attribute ${left.field} is not a relation`);
|
|
1541
1572
|
}
|
|
@@ -1613,9 +1644,7 @@ const filterValidRelationalAttributes = (attributes) => {
|
|
|
1613
1644
|
const isOwner = (attribute) => {
|
|
1614
1645
|
return attribute.owner || !attribute.mappedBy && !attribute.morphBy;
|
|
1615
1646
|
};
|
|
1616
|
-
const isComponentLike = (attribute) =>
|
|
1617
|
-
return attribute.component || attribute.components;
|
|
1618
|
-
};
|
|
1647
|
+
const isComponentLike = (attribute) => attribute.joinTable?.name.endsWith("_cmps");
|
|
1619
1648
|
return Object.entries(attributes).filter(([, attribute]) => {
|
|
1620
1649
|
return attribute.type === "relation" && isOwner(attribute) && !isComponentLike(attribute);
|
|
1621
1650
|
}).reduce((acc, [key, attribute]) => ({ ...acc, [key]: attribute }), {});
|
|
@@ -1631,7 +1660,8 @@ const getLinkKind = (attribute, uid) => {
|
|
|
1631
1660
|
};
|
|
1632
1661
|
const link = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1633
1662
|
__proto__: null,
|
|
1634
|
-
createLinkQuery
|
|
1663
|
+
createLinkQuery,
|
|
1664
|
+
filterValidRelationalAttributes
|
|
1635
1665
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1636
1666
|
const index$6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1637
1667
|
__proto__: null,
|
|
@@ -1648,29 +1678,6 @@ const createEntitiesWriteStream = (options) => {
|
|
|
1648
1678
|
const { type, id, data } = entity2;
|
|
1649
1679
|
const { create, getDeepPopulateComponentLikeQuery } = query(type);
|
|
1650
1680
|
const contentType = strapi2.getModel(type);
|
|
1651
|
-
let cType = contentType;
|
|
1652
|
-
const resolveType = (paths) => {
|
|
1653
|
-
let value = data;
|
|
1654
|
-
for (const path2 of paths) {
|
|
1655
|
-
value = fp.get(path2, value);
|
|
1656
|
-
if (typeof cType === "function") {
|
|
1657
|
-
cType = cType(value);
|
|
1658
|
-
}
|
|
1659
|
-
if (path2 in cType.attributes) {
|
|
1660
|
-
const attribute = cType.attributes[path2];
|
|
1661
|
-
if (attribute.type === "component") {
|
|
1662
|
-
cType = strapi2.getModel(attribute.component);
|
|
1663
|
-
}
|
|
1664
|
-
if (attribute.type === "dynamiczone") {
|
|
1665
|
-
cType = ({ __component }) => strapi2.getModel(__component);
|
|
1666
|
-
}
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
if ("uid" in cType) {
|
|
1670
|
-
return cType.uid;
|
|
1671
|
-
}
|
|
1672
|
-
return void 0;
|
|
1673
|
-
};
|
|
1674
1681
|
try {
|
|
1675
1682
|
const created = await create({
|
|
1676
1683
|
data,
|
|
@@ -1680,8 +1687,8 @@ const createEntitiesWriteStream = (options) => {
|
|
|
1680
1687
|
const diffs = diff(data, created);
|
|
1681
1688
|
updateMappingTable(type, id, created.id);
|
|
1682
1689
|
diffs.forEach((diff2) => {
|
|
1683
|
-
if (diff2.kind === "modified" && fp.last(diff2.path) === "id") {
|
|
1684
|
-
const target =
|
|
1690
|
+
if (diff2.kind === "modified" && fp.last(diff2.path) === "id" && "kind" in contentType) {
|
|
1691
|
+
const target = resolveComponentUID({ paths: diff2.path, data, contentType, strapi: strapi2 });
|
|
1685
1692
|
if (!target) {
|
|
1686
1693
|
return;
|
|
1687
1694
|
}
|
|
@@ -1994,10 +2001,10 @@ class LocalStrapiDestinationProvider {
|
|
|
1994
2001
|
}
|
|
1995
2002
|
getSchemas() {
|
|
1996
2003
|
assertValidStrapi(this.strapi, "Not able to get Schemas");
|
|
1997
|
-
const schemas = {
|
|
2004
|
+
const schemas = schemasToValidJSON({
|
|
1998
2005
|
...this.strapi.contentTypes,
|
|
1999
2006
|
...this.strapi.components
|
|
2000
|
-
};
|
|
2007
|
+
});
|
|
2001
2008
|
return mapSchemasValues(schemas);
|
|
2002
2009
|
}
|
|
2003
2010
|
createEntitiesWriteStream() {
|
|
@@ -2311,11 +2318,31 @@ function getFileStats(filepath, strapi2, isLocal = false) {
|
|
|
2311
2318
|
});
|
|
2312
2319
|
});
|
|
2313
2320
|
}
|
|
2321
|
+
async function signFile(file) {
|
|
2322
|
+
const { provider } = strapi.plugins.upload;
|
|
2323
|
+
const { provider: providerName } = strapi.config.get("plugin.upload");
|
|
2324
|
+
const isPrivate = await provider.isPrivate();
|
|
2325
|
+
if (file?.provider === providerName && isPrivate) {
|
|
2326
|
+
const signUrl = async (file2) => {
|
|
2327
|
+
const signedUrl = await provider.getSignedUrl(file2);
|
|
2328
|
+
file2.url = signedUrl.url;
|
|
2329
|
+
};
|
|
2330
|
+
await signUrl(file);
|
|
2331
|
+
if (file.formats) {
|
|
2332
|
+
for (const format of Object.keys(file.formats)) {
|
|
2333
|
+
await signUrl(file.formats[format]);
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2314
2338
|
const createAssetsStream = (strapi2) => {
|
|
2315
2339
|
const generator = async function* () {
|
|
2316
2340
|
const stream2 = strapi2.db.queryBuilder("plugin::upload.file").select("*").stream();
|
|
2317
2341
|
for await (const file of stream2) {
|
|
2318
2342
|
const isLocalProvider = file.provider === "local";
|
|
2343
|
+
if (!isLocalProvider) {
|
|
2344
|
+
await signFile(file);
|
|
2345
|
+
}
|
|
2319
2346
|
const filepath = isLocalProvider ? path.join(strapi2.dirs.static.public, file.url) : file.url;
|
|
2320
2347
|
const stats = await getFileStats(filepath, strapi2, isLocalProvider);
|
|
2321
2348
|
const stream22 = getFileStream(filepath, strapi2, isLocalProvider);
|
|
@@ -2395,10 +2422,10 @@ class LocalStrapiSourceProvider {
|
|
|
2395
2422
|
}
|
|
2396
2423
|
getSchemas() {
|
|
2397
2424
|
assertValidStrapi(this.strapi, "Not able to get Schemas");
|
|
2398
|
-
const schemas = {
|
|
2425
|
+
const schemas = schemasToValidJSON({
|
|
2399
2426
|
...this.strapi.contentTypes,
|
|
2400
2427
|
...this.strapi.components
|
|
2401
|
-
};
|
|
2428
|
+
});
|
|
2402
2429
|
return mapSchemasValues(schemas);
|
|
2403
2430
|
}
|
|
2404
2431
|
createSchemasReadStream() {
|
|
@@ -2973,10 +3000,8 @@ class RemoteStrapiSourceProvider {
|
|
|
2973
3000
|
});
|
|
2974
3001
|
}
|
|
2975
3002
|
async getSchemas() {
|
|
2976
|
-
const schemas = await this.dispatcher?.dispatchTransferAction(
|
|
2977
|
-
|
|
2978
|
-
) ?? null;
|
|
2979
|
-
return schemas;
|
|
3003
|
+
const schemas = await this.dispatcher?.dispatchTransferAction("getSchemas");
|
|
3004
|
+
return schemas ?? null;
|
|
2980
3005
|
}
|
|
2981
3006
|
async #startStep(step) {
|
|
2982
3007
|
try {
|
|
@@ -3114,8 +3139,11 @@ const transformUpgradeHeader = (header = "") => {
|
|
|
3114
3139
|
return header.split(",").map((s) => s.trim().toLowerCase());
|
|
3115
3140
|
};
|
|
3116
3141
|
let timeouts;
|
|
3142
|
+
const hasHttpServer = () => {
|
|
3143
|
+
return typeof strapi !== "undefined" && !!strapi?.server?.httpServer;
|
|
3144
|
+
};
|
|
3117
3145
|
const disableTimeouts = () => {
|
|
3118
|
-
if (!
|
|
3146
|
+
if (!hasHttpServer()) {
|
|
3119
3147
|
return;
|
|
3120
3148
|
}
|
|
3121
3149
|
const { httpServer } = strapi.server;
|
|
@@ -3130,7 +3158,7 @@ const disableTimeouts = () => {
|
|
|
3130
3158
|
strapi.log.info("[Data transfer] Disabling http timeouts");
|
|
3131
3159
|
};
|
|
3132
3160
|
const resetTimeouts = () => {
|
|
3133
|
-
if (!
|
|
3161
|
+
if (!hasHttpServer() || !timeouts) {
|
|
3134
3162
|
return;
|
|
3135
3163
|
}
|
|
3136
3164
|
const { httpServer } = strapi.server;
|
|
@@ -3973,11 +4001,14 @@ class LocalFileSourceProvider {
|
|
|
3973
4001
|
return this.#metadata ?? null;
|
|
3974
4002
|
}
|
|
3975
4003
|
async getSchemas() {
|
|
3976
|
-
const
|
|
3977
|
-
|
|
4004
|
+
const schemaCollection = await collect(
|
|
4005
|
+
this.createSchemasReadStream()
|
|
4006
|
+
);
|
|
4007
|
+
if (fp.isEmpty(schemaCollection)) {
|
|
3978
4008
|
throw new ProviderInitializationError("Could not load schemas from Strapi data file.");
|
|
3979
4009
|
}
|
|
3980
|
-
|
|
4010
|
+
const schemas = fp.keyBy("uid", schemaCollection);
|
|
4011
|
+
return schemasToValidJSON(schemas);
|
|
3981
4012
|
}
|
|
3982
4013
|
createEntitiesReadStream() {
|
|
3983
4014
|
return this.#streamJsonlDirectory("entities");
|