@strapi/data-transfer 5.0.0-beta.9 → 5.0.0-rc.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/LICENSE +19 -4
- package/dist/engine/validation/schemas/index.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 +19 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -13
- package/dist/index.mjs.map +1 -1
- package/dist/strapi/providers/local-destination/index.d.ts.map +1 -1
- package/dist/strapi/queries/link.d.ts +1 -0
- package/dist/strapi/queries/link.d.ts.map +1 -1
- package/dist/utils/schema.d.ts +1 -0
- package/dist/utils/schema.d.ts.map +1 -1
- package/package.json +6 -6
package/LICENSE
CHANGED
|
@@ -2,9 +2,23 @@ Copyright (c) 2015-present Strapi Solutions SAS
|
|
|
2
2
|
|
|
3
3
|
Portions of the Strapi software are licensed as follows:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
* All software that resides under an "ee/" directory (the “EE Software”), if that directory exists, is licensed under the license defined below.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Enterprise License
|
|
8
|
+
|
|
9
|
+
If you or the company you represent has entered into a written agreement referencing the Enterprise Edition of the Strapi source code available at
|
|
10
|
+
https://github.com/strapi/strapi, then such agreement applies to your use of the Enterprise Edition of the Strapi Software. If you or the company you
|
|
11
|
+
represent is using the Enterprise Edition of the Strapi Software in connection with a subscription to our cloud offering, then the agreement you have
|
|
12
|
+
agreed to with respect to our cloud offering and the licenses included in such agreement apply to your use of the Enterprise Edition of the Strapi Software.
|
|
13
|
+
Otherwise, the Strapi Enterprise Software License Agreement (found here https://strapi.io/enterprise-terms) applies to your use of the Enterprise Edition of the Strapi Software.
|
|
14
|
+
|
|
15
|
+
BY ACCESSING OR USING THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE RELEVANT REFERENCED AGREEMENT.
|
|
16
|
+
IF YOU ARE NOT AUTHORIZED TO ACCEPT THESE TERMS ON BEHALF OF THE COMPANY YOU REPRESENT OR IF YOU DO NOT AGREE TO ALL OF THE RELEVANT TERMS AND CONDITIONS REFERENCED AND YOU
|
|
17
|
+
HAVE NOT OTHERWISE EXECUTED A WRITTEN AGREEMENT WITH STRAPI, YOU ARE NOT AUTHORIZED TO ACCESS OR USE OR ALLOW ANY USER TO ACCESS OR USE ANY PART OF
|
|
18
|
+
THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE. YOUR ACCESS RIGHTS ARE CONDITIONAL ON YOUR CONSENT TO THE RELEVANT REFERENCED TERMS TO THE EXCLUSION OF ALL OTHER TERMS;
|
|
19
|
+
IF THE RELEVANT REFERENCED TERMS ARE CONSIDERED AN OFFER BY YOU, ACCEPTANCE IS EXPRESSLY LIMITED TO THE RELEVANT REFERENCED TERMS.
|
|
20
|
+
|
|
21
|
+
* All software outside of the above-mentioned directories or restrictions above is available under the "MIT Expat" license as set forth below.
|
|
8
22
|
|
|
9
23
|
MIT Expat License
|
|
10
24
|
|
|
@@ -18,5 +32,6 @@ furnished to do so, subject to the following conditions:
|
|
|
18
32
|
The above copyright notice and this permission notice shall be included in all
|
|
19
33
|
copies or substantial portions of the Software.
|
|
20
34
|
|
|
21
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
|
|
35
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
36
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
37
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -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,7 +1,5 @@
|
|
|
1
|
-
/// <reference types="lodash" />
|
|
2
1
|
/// <reference types="node" />
|
|
3
2
|
import type { Readable } from 'stream';
|
|
4
|
-
import type { Struct } 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)) {
|
|
@@ -1640,9 +1644,7 @@ const filterValidRelationalAttributes = (attributes) => {
|
|
|
1640
1644
|
const isOwner = (attribute) => {
|
|
1641
1645
|
return attribute.owner || !attribute.mappedBy && !attribute.morphBy;
|
|
1642
1646
|
};
|
|
1643
|
-
const isComponentLike = (attribute) =>
|
|
1644
|
-
return attribute.component || attribute.components;
|
|
1645
|
-
};
|
|
1647
|
+
const isComponentLike = (attribute) => attribute.joinTable?.name.endsWith("_cmps");
|
|
1646
1648
|
return Object.entries(attributes).filter(([, attribute]) => {
|
|
1647
1649
|
return attribute.type === "relation" && isOwner(attribute) && !isComponentLike(attribute);
|
|
1648
1650
|
}).reduce((acc, [key, attribute]) => ({ ...acc, [key]: attribute }), {});
|
|
@@ -1658,7 +1660,8 @@ const getLinkKind = (attribute, uid) => {
|
|
|
1658
1660
|
};
|
|
1659
1661
|
const link = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1660
1662
|
__proto__: null,
|
|
1661
|
-
createLinkQuery
|
|
1663
|
+
createLinkQuery,
|
|
1664
|
+
filterValidRelationalAttributes
|
|
1662
1665
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1663
1666
|
const index$6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1664
1667
|
__proto__: null,
|
|
@@ -1998,10 +2001,10 @@ class LocalStrapiDestinationProvider {
|
|
|
1998
2001
|
}
|
|
1999
2002
|
getSchemas() {
|
|
2000
2003
|
assertValidStrapi(this.strapi, "Not able to get Schemas");
|
|
2001
|
-
const schemas = {
|
|
2004
|
+
const schemas = schemasToValidJSON({
|
|
2002
2005
|
...this.strapi.contentTypes,
|
|
2003
2006
|
...this.strapi.components
|
|
2004
|
-
};
|
|
2007
|
+
});
|
|
2005
2008
|
return mapSchemasValues(schemas);
|
|
2006
2009
|
}
|
|
2007
2010
|
createEntitiesWriteStream() {
|
|
@@ -2419,10 +2422,10 @@ class LocalStrapiSourceProvider {
|
|
|
2419
2422
|
}
|
|
2420
2423
|
getSchemas() {
|
|
2421
2424
|
assertValidStrapi(this.strapi, "Not able to get Schemas");
|
|
2422
|
-
const schemas = {
|
|
2425
|
+
const schemas = schemasToValidJSON({
|
|
2423
2426
|
...this.strapi.contentTypes,
|
|
2424
2427
|
...this.strapi.components
|
|
2425
|
-
};
|
|
2428
|
+
});
|
|
2426
2429
|
return mapSchemasValues(schemas);
|
|
2427
2430
|
}
|
|
2428
2431
|
createSchemasReadStream() {
|
|
@@ -3998,11 +4001,14 @@ class LocalFileSourceProvider {
|
|
|
3998
4001
|
return this.#metadata ?? null;
|
|
3999
4002
|
}
|
|
4000
4003
|
async getSchemas() {
|
|
4001
|
-
const
|
|
4002
|
-
|
|
4004
|
+
const schemaCollection = await collect(
|
|
4005
|
+
this.createSchemasReadStream()
|
|
4006
|
+
);
|
|
4007
|
+
if (fp.isEmpty(schemaCollection)) {
|
|
4003
4008
|
throw new ProviderInitializationError("Could not load schemas from Strapi data file.");
|
|
4004
4009
|
}
|
|
4005
|
-
|
|
4010
|
+
const schemas = fp.keyBy("uid", schemaCollection);
|
|
4011
|
+
return schemasToValidJSON(schemas);
|
|
4006
4012
|
}
|
|
4007
4013
|
createEntitiesReadStream() {
|
|
4008
4014
|
return this.#streamJsonlDirectory("entities");
|