@takeshape/schema 8.61.0 → 8.64.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/es/migration/to/v3.13.0.js +2 -2
- package/es/schema-util.js +5 -5
- package/es/schemas/project-schema/v3.13.0.json +3 -3
- package/es/schemas/project-schema.json +2 -1
- package/examples/latest/betzino.json +603 -603
- package/examples/latest/blog-schema.json +3 -3
- package/examples/latest/brewery-schema.json +1 -1
- package/examples/latest/complex-project-schema.json +33 -33
- package/examples/latest/frank-and-fred-schema.json +224 -224
- package/examples/latest/massive-schema.json +85 -85
- package/examples/latest/mill-components-schema.json +13 -13
- package/examples/latest/post-schema.json +1 -1
- package/examples/latest/real-world-schema.json +5 -5
- package/examples/latest/recursive-repeater-schema.json +1 -1
- package/examples/latest/recursive-schema.json +1 -1
- package/examples/latest/rick-and-morty-ast.json +11 -11
- package/examples/latest/rick-and-morty-graphql.json +6 -6
- package/examples/latest/schema-with-repeater-draftjs.json +3 -3
- package/examples/latest/shape-books-v3_2_0.json +11 -11
- package/examples/latest/shape-books.json +11 -11
- package/examples/latest/shopify-lookbook.json +2 -2
- package/examples/latest/stripe-starter-resolved.json +1 -1
- package/lib/migration/to/v3.13.0.js +2 -2
- package/lib/project-schema/latest.d.ts +2 -2
- package/lib/project-schema/v3.13.0.d.ts +2 -2
- package/lib/schema-util.js +5 -5
- package/lib/schemas/project-schema/v3.13.0.json +3 -3
- package/lib/schemas/project-schema.json +2 -1
- package/package.json +4 -4
|
@@ -4,12 +4,12 @@ import get from 'lodash/get';
|
|
|
4
4
|
function migrateToV3_13_0(projectSchema) {
|
|
5
5
|
visit(projectSchema, ['@relationship'], (relationship, path) => {
|
|
6
6
|
const parent = get(projectSchema, path.slice(0, -1));
|
|
7
|
-
parent['@
|
|
7
|
+
parent['@backreference'] = {
|
|
8
8
|
enabled: true
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
if (relationship.relatedName) {
|
|
12
|
-
parent['@
|
|
12
|
+
parent['@backreference'].name = relationship.relatedName;
|
|
13
13
|
delete relationship.relatedName;
|
|
14
14
|
}
|
|
15
15
|
});
|
package/es/schema-util.js
CHANGED
|
@@ -44,7 +44,7 @@ export const objectSchemaKeys = [...commonSchemaKeys, 'properties', 'required'];
|
|
|
44
44
|
export const arraySchemaKeys = [...commonSchemaKeys, 'items', 'additionalItems', 'maxItems', 'minItems', 'uniqueItems'];
|
|
45
45
|
export const multipleRelationshipSchemaKeys = [...schemaMetadataKeys, 'maxItems', 'minItems']; // All properties except properties, items, additionalItems
|
|
46
46
|
|
|
47
|
-
export const nonStructuralSchemaKeys = [...scalarSchemaKeys, '@relationship', '@
|
|
47
|
+
export const nonStructuralSchemaKeys = [...scalarSchemaKeys, '@relationship', '@backreference', 'required', 'maxItems', 'minItems', 'uniqueItems'];
|
|
48
48
|
const commonProperties = {
|
|
49
49
|
_id: {
|
|
50
50
|
title: 'Id',
|
|
@@ -426,22 +426,22 @@ export function findExistingRelationships(projectSchema, shapes) {
|
|
|
426
426
|
|
|
427
427
|
const findRelationships = (schema, path) => {
|
|
428
428
|
if (schema['@relationship']) {
|
|
429
|
-
var _schema$
|
|
429
|
+
var _schema$Backreferenc;
|
|
430
430
|
|
|
431
431
|
const {
|
|
432
432
|
shapeIds: relatedShapeIds
|
|
433
433
|
} = schema['@relationship'];
|
|
434
|
-
const relatedName = (_schema$
|
|
434
|
+
const relatedName = (_schema$Backreferenc = schema['@backreference']) === null || _schema$Backreferenc === void 0 ? void 0 : _schema$Backreferenc.name;
|
|
435
435
|
|
|
436
436
|
for (const shapeId of relatedShapeIds) {
|
|
437
437
|
if (shapeIds.has(shapeId)) {
|
|
438
|
-
var _schema$
|
|
438
|
+
var _schema$Backreferenc2;
|
|
439
439
|
|
|
440
440
|
addRelationship(relationships, shapeId, {
|
|
441
441
|
relatedName,
|
|
442
442
|
path: path.slice(1),
|
|
443
443
|
shapeId: path[0],
|
|
444
|
-
hasBackreference: Boolean((_schema$
|
|
444
|
+
hasBackreference: Boolean((_schema$Backreferenc2 = schema['@backreference']) === null || _schema$Backreferenc2 === void 0 ? void 0 : _schema$Backreferenc2.enabled)
|
|
445
445
|
});
|
|
446
446
|
}
|
|
447
447
|
}
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"required": ["shapeIds"],
|
|
63
63
|
"additionalProperties": false
|
|
64
64
|
},
|
|
65
|
-
"
|
|
65
|
+
"backreference": {
|
|
66
66
|
"title": "Back Reference",
|
|
67
67
|
"description": "A configuration object for a reverse reference in a relationship.",
|
|
68
68
|
"type": "object",
|
|
@@ -1459,8 +1459,8 @@
|
|
|
1459
1459
|
"@relationship": {
|
|
1460
1460
|
"$ref": "#/definitions/relationship"
|
|
1461
1461
|
},
|
|
1462
|
-
"@
|
|
1463
|
-
"$ref": "#/definitions/
|
|
1462
|
+
"@backreference": {
|
|
1463
|
+
"$ref": "#/definitions/backreference"
|
|
1464
1464
|
},
|
|
1465
1465
|
"@syncLocaleStructure": {
|
|
1466
1466
|
"type": "boolean"
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
{"$ref": "https://schema.takeshape.io/project-schema/v3.11.0#"},
|
|
20
20
|
{"$ref": "https://schema.takeshape.io/project-schema/v3.12.0#"},
|
|
21
21
|
{"$ref": "https://schema.takeshape.io/project-schema/v3.12.1#"},
|
|
22
|
-
{"$ref": "https://schema.takeshape.io/project-schema/v3.12.2#"}
|
|
22
|
+
{"$ref": "https://schema.takeshape.io/project-schema/v3.12.2#"},
|
|
23
|
+
{"$ref": "https://schema.takeshape.io/project-schema/v3.13.0#"}
|
|
23
24
|
]
|
|
24
25
|
}
|