@takeshape/schema 8.87.0 → 8.87.1
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/index.js +3 -1
- package/es/migration/to/v3.16.0.js +10 -0
- package/es/project-schema/index.js +3 -1
- package/es/project-schema/migrate.js +5 -1
- package/es/project-schema/v3.16.0.js +1 -0
- package/es/schema-util.js +19 -4
- package/es/schemas/index.js +4 -3
- package/es/schemas/index.ts +4 -2
- package/es/schemas/project-schema/latest.json +10 -2
- package/es/schemas/project-schema/v3.16.0.json +2367 -0
- package/es/schemas/project-schema.json +3 -0
- package/es/validate.js +1 -1
- package/examples/latest/betzino.json +1 -1
- package/examples/latest/blog-schema.json +1 -1
- package/examples/latest/brewery-schema.json +1 -1
- package/examples/latest/complex-project-schema.json +1 -1
- package/examples/latest/fabric-ecommerce.json +1 -1
- package/examples/latest/frank-and-fred-schema.json +1 -1
- package/examples/latest/massive-schema.json +1 -1
- package/examples/latest/mill-components-schema.json +1 -1
- package/examples/latest/pet-oneof-array.json +1 -1
- package/examples/latest/post-schema.json +1 -1
- package/examples/latest/pruned-shopify-product-schema.json +1 -1
- package/examples/latest/real-world-schema.json +1 -1
- 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 +1 -1
- package/examples/latest/rick-and-morty-graphql.json +1 -1
- package/examples/latest/rick-and-morty-rest.json +1 -1
- package/examples/latest/schema-with-repeater-draftjs.json +1 -1
- package/examples/latest/shape-books-v3_2_0.json +1 -1
- package/examples/latest/shape-books.json +1 -1
- package/examples/latest/shopify-lookbook.json +1 -1
- package/examples/latest/shopify-store-with-widget.json +1 -1
- package/examples/latest/stripe-starter-resolved.json +1 -1
- package/examples/latest/user-schema-no-required.json +1 -1
- package/examples/latest/user-schema-with-defaults.json +1 -1
- package/lib/migration/index.d.ts +1 -0
- package/lib/migration/index.d.ts.map +1 -1
- package/lib/migration/index.js +4 -1
- package/lib/migration/to/v3.16.0.d.ts +5 -0
- package/lib/migration/to/v3.16.0.d.ts.map +1 -0
- package/lib/migration/to/v3.16.0.js +18 -0
- package/lib/project-schema/index.d.ts +4 -1
- package/lib/project-schema/index.d.ts.map +1 -1
- package/lib/project-schema/index.js +20 -3
- package/lib/project-schema/latest.d.ts +13 -1
- package/lib/project-schema/latest.d.ts.map +1 -1
- package/lib/project-schema/migrate.d.ts.map +1 -1
- package/lib/project-schema/migrate.js +4 -0
- package/lib/project-schema/v3.16.0.d.ts +1471 -0
- package/lib/project-schema/v3.16.0.d.ts.map +1 -0
- package/lib/project-schema/v3.16.0.js +5 -0
- package/lib/schema-util.d.ts.map +1 -1
- package/lib/schema-util.js +19 -4
- package/lib/schemas/index.d.ts +4583 -4583
- package/lib/schemas/index.d.ts.map +1 -1
- package/lib/schemas/index.js +6 -4
- package/lib/schemas/index.ts +4 -2
- package/lib/schemas/project-schema/latest.json +10 -2
- package/lib/schemas/project-schema/v3.16.0.json +2367 -0
- package/lib/schemas/project-schema.json +3 -0
- package/lib/types/types.d.ts +2 -2
- package/lib/types/types.d.ts.map +1 -1
- package/lib/validate.js +1 -1
- package/package.json +6 -6
package/es/migration/index.js
CHANGED
|
@@ -18,6 +18,7 @@ import migrateToV3_12_3 from './to/v3.12.3';
|
|
|
18
18
|
import migrateToV3_13_0 from './to/v3.13.0';
|
|
19
19
|
import migrateToV3_14_0 from './to/v3.14.0';
|
|
20
20
|
import migrateToV3_15_0 from './to/v3.15.0';
|
|
21
|
+
import migrateToV3_16_0 from './to/v3.16.0';
|
|
21
22
|
export const migrateTo = {
|
|
22
23
|
'v3.0.0': migrateToV3_0_0,
|
|
23
24
|
'v3.1.0': migrateToV3_1_0,
|
|
@@ -38,7 +39,8 @@ export const migrateTo = {
|
|
|
38
39
|
'v3.12.3': migrateToV3_12_3,
|
|
39
40
|
'v3.13.0': migrateToV3_13_0,
|
|
40
41
|
'v3.14.0': migrateToV3_14_0,
|
|
41
|
-
'v3.15.0': migrateToV3_15_0
|
|
42
|
+
'v3.15.0': migrateToV3_15_0,
|
|
43
|
+
'v3.16.0': migrateToV3_16_0
|
|
42
44
|
};
|
|
43
45
|
export * from './utils';
|
|
44
46
|
export const listTypePrefix = 'PaginatedList';
|
|
@@ -21,6 +21,7 @@ export * from './v3.12.3';
|
|
|
21
21
|
export * from './v3.13.0';
|
|
22
22
|
export * from './v3.14.0';
|
|
23
23
|
export * from './v3.15.0';
|
|
24
|
+
export * from './v3.16.0';
|
|
24
25
|
export * from './v4.0.0';
|
|
25
26
|
|
|
26
27
|
// Schema type utilities
|
|
@@ -63,5 +64,6 @@ export const isProjectSchemaV3_12_3 = createVersionPredicate('3.12.3');
|
|
|
63
64
|
export const isProjectSchemaV3_13_0 = createVersionPredicate('3.13.0');
|
|
64
65
|
export const isProjectSchemaV3_14_0 = createVersionPredicate('3.14.0');
|
|
65
66
|
export const isProjectSchemaV3_15_0 = createVersionPredicate('3.15.0');
|
|
66
|
-
export const
|
|
67
|
+
export const isProjectSchemaV3_16_0 = createVersionPredicate('3.16.0');
|
|
68
|
+
export const isLatestProjectSchema = createVersionPredicate('3.16.0');
|
|
67
69
|
export const isProjectSchemaV4_0_0 = createVersionPredicate('4.0.0');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// This file is generated by "pnpm json2ts"
|
|
2
2
|
import { migrateTo } from '../migration';
|
|
3
|
-
import { isProjectSchemaV1_0_0, isProjectSchemaV3_0_0, isProjectSchemaV3_1_0, isProjectSchemaV3_2_0, isProjectSchemaV3_3_0, isProjectSchemaV3_4_0, isProjectSchemaV3_5_0, isProjectSchemaV3_5_1, isProjectSchemaV3_6_0, isProjectSchemaV3_7_0, isProjectSchemaV3_8_0, isProjectSchemaV3_9_0, isProjectSchemaV3_10_0, isProjectSchemaV3_11_0, isProjectSchemaV3_12_0, isProjectSchemaV3_12_1, isProjectSchemaV3_12_2, isProjectSchemaV3_12_3, isProjectSchemaV3_13_0, isProjectSchemaV3_14_0, isProjectSchemaV4_0_0, isLatestProjectSchema } from './index'; // eslint-disable-next-line complexity
|
|
3
|
+
import { isProjectSchemaV1_0_0, isProjectSchemaV3_0_0, isProjectSchemaV3_1_0, isProjectSchemaV3_2_0, isProjectSchemaV3_3_0, isProjectSchemaV3_4_0, isProjectSchemaV3_5_0, isProjectSchemaV3_5_1, isProjectSchemaV3_6_0, isProjectSchemaV3_7_0, isProjectSchemaV3_8_0, isProjectSchemaV3_9_0, isProjectSchemaV3_10_0, isProjectSchemaV3_11_0, isProjectSchemaV3_12_0, isProjectSchemaV3_12_1, isProjectSchemaV3_12_2, isProjectSchemaV3_12_3, isProjectSchemaV3_13_0, isProjectSchemaV3_14_0, isProjectSchemaV3_15_0, isProjectSchemaV4_0_0, isLatestProjectSchema } from './index'; // eslint-disable-next-line complexity
|
|
4
4
|
|
|
5
5
|
export async function migrateToLatestProjectSchema(context, projectSchema) {
|
|
6
6
|
if (isLatestProjectSchema(projectSchema)) {
|
|
@@ -87,6 +87,10 @@ export async function migrateToLatestProjectSchema(context, projectSchema) {
|
|
|
87
87
|
projectSchema = await migrateTo['v3.15.0'](context, projectSchema);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
if (isProjectSchemaV3_15_0(projectSchema)) {
|
|
91
|
+
projectSchema = await migrateTo['v3.16.0'](context, projectSchema);
|
|
92
|
+
}
|
|
93
|
+
|
|
90
94
|
if (isProjectSchemaV4_0_0(projectSchema)) {
|
|
91
95
|
throw new Error('You are using an unreleased schema version. Migration is not possible');
|
|
92
96
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/schema-util.js
CHANGED
|
@@ -518,15 +518,26 @@ export function getArgsShapeSchema(context, argsSchema) {
|
|
|
518
518
|
}
|
|
519
519
|
}
|
|
520
520
|
|
|
521
|
-
const createShapeToPropertySchema = (projectSchema, definitions, definitionNames,
|
|
521
|
+
const createShapeToPropertySchema = (projectSchema, definitions, definitionNames, {
|
|
522
|
+
useShapeIdDiscriminator
|
|
523
|
+
}) => {
|
|
522
524
|
const rewriteRefs = (shape, addDiscriminator = false) => {
|
|
523
525
|
const handleSchema = (propSchema, addDiscriminator = false) => {
|
|
524
526
|
// Unwrap array schema
|
|
525
527
|
propSchema = propSchema.items ?? propSchema;
|
|
526
528
|
|
|
527
529
|
if (isOneOfSchema(propSchema)) {
|
|
530
|
+
const isUnion = isUnionSchema(propSchema);
|
|
531
|
+
|
|
532
|
+
if (useShapeIdDiscriminator && isUnion) {
|
|
533
|
+
propSchema.discriminator = {
|
|
534
|
+
propertyName: '_shapeId'
|
|
535
|
+
};
|
|
536
|
+
propSchema.required = ['_shapeId'];
|
|
537
|
+
}
|
|
538
|
+
|
|
528
539
|
propSchema.oneOf.forEach(schema => {
|
|
529
|
-
handleSchema(schema,
|
|
540
|
+
handleSchema(schema, isUnion);
|
|
530
541
|
});
|
|
531
542
|
return;
|
|
532
543
|
} // Add workflow validation
|
|
@@ -597,7 +608,9 @@ const createShapeToPropertySchema = (projectSchema, definitions, definitionNames
|
|
|
597
608
|
export function shapeToPropertySchema(projectSchema, shape) {
|
|
598
609
|
const definitions = {};
|
|
599
610
|
const definitionNames = new Set();
|
|
600
|
-
const convert = createShapeToPropertySchema(projectSchema, definitions, definitionNames
|
|
611
|
+
const convert = createShapeToPropertySchema(projectSchema, definitions, definitionNames, {
|
|
612
|
+
useShapeIdDiscriminator: true
|
|
613
|
+
});
|
|
601
614
|
return { ...convert(shape),
|
|
602
615
|
definitions
|
|
603
616
|
};
|
|
@@ -605,7 +618,9 @@ export function shapeToPropertySchema(projectSchema, shape) {
|
|
|
605
618
|
export function projectSchemaToJSONSchema(projectSchema) {
|
|
606
619
|
const definitions = {};
|
|
607
620
|
const definitionNames = new Set();
|
|
608
|
-
const convert = createShapeToPropertySchema(projectSchema, definitions, definitionNames,
|
|
621
|
+
const convert = createShapeToPropertySchema(projectSchema, definitions, definitionNames, {
|
|
622
|
+
useShapeIdDiscriminator: false
|
|
623
|
+
});
|
|
609
624
|
|
|
610
625
|
for (const shape of Object.values(projectSchema.shapes)) {
|
|
611
626
|
definitions[shape.name] = convert(shape);
|
package/es/schemas/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// This file is generated by "pnpm json2ts"
|
|
2
|
-
export const CURRENT_SCHEMA_VERSION = '3.
|
|
2
|
+
export const CURRENT_SCHEMA_VERSION = '3.16.0';
|
|
3
3
|
export { default as anyProjectSchema } from './project-schema.json';
|
|
4
|
-
export { default as latestSchemaJson } from './project-schema/v3.
|
|
4
|
+
export { default as latestSchemaJson } from './project-schema/v3.16.0.json';
|
|
5
5
|
import metaSchemaV1_0_0 from './project-schema/meta-schema-v1.0.0.json';
|
|
6
6
|
import projectSchemaV1_0_0 from './project-schema/v1.0.0.json';
|
|
7
7
|
import metaSchemaV3_0_0 from './project-schema/meta-schema-v3.0.0.json';
|
|
@@ -35,5 +35,6 @@ import projectSchemaV3_12_3 from './project-schema/v3.12.3.json';
|
|
|
35
35
|
import projectSchemaV3_13_0 from './project-schema/v3.13.0.json';
|
|
36
36
|
import projectSchemaV3_14_0 from './project-schema/v3.14.0.json';
|
|
37
37
|
import projectSchemaV3_15_0 from './project-schema/v3.15.0.json';
|
|
38
|
+
import projectSchemaV3_16_0 from './project-schema/v3.16.0.json';
|
|
38
39
|
import projectSchemaV4_0_0 from './project-schema/v4.0.0.json';
|
|
39
|
-
export const allProjectSchemas = [metaSchemaV1_0_0, projectSchemaV1_0_0, metaSchemaV3_0_0, projectSchemaV3_0_0, metaSchemaV3_1_0, projectSchemaV3_1_0, metaSchemaV3_2_0, projectSchemaV3_2_0, metaSchemaV3_3_0, projectSchemaV3_3_0, metaSchemaV3_4_0, projectSchemaV3_4_0, metaSchemaV3_5_0, projectSchemaV3_5_0, metaSchemaV3_5_1, projectSchemaV3_5_1, metaSchemaV3_6_0, projectSchemaV3_6_0, metaSchemaV3_7_0, projectSchemaV3_7_0, metaSchemaV3_8_0, projectSchemaV3_8_0, metaSchemaV3_9_0, projectSchemaV3_9_0, projectSchemaV3_10_0, projectSchemaV3_11_0, projectSchemaV3_12_0, projectSchemaV3_12_1, projectSchemaV3_12_2, projectSchemaV3_12_3, projectSchemaV3_13_0, projectSchemaV3_14_0, projectSchemaV3_15_0, projectSchemaV4_0_0];
|
|
40
|
+
export const allProjectSchemas = [metaSchemaV1_0_0, projectSchemaV1_0_0, metaSchemaV3_0_0, projectSchemaV3_0_0, metaSchemaV3_1_0, projectSchemaV3_1_0, metaSchemaV3_2_0, projectSchemaV3_2_0, metaSchemaV3_3_0, projectSchemaV3_3_0, metaSchemaV3_4_0, projectSchemaV3_4_0, metaSchemaV3_5_0, projectSchemaV3_5_0, metaSchemaV3_5_1, projectSchemaV3_5_1, metaSchemaV3_6_0, projectSchemaV3_6_0, metaSchemaV3_7_0, projectSchemaV3_7_0, metaSchemaV3_8_0, projectSchemaV3_8_0, metaSchemaV3_9_0, projectSchemaV3_9_0, projectSchemaV3_10_0, projectSchemaV3_11_0, projectSchemaV3_12_0, projectSchemaV3_12_1, projectSchemaV3_12_2, projectSchemaV3_12_3, projectSchemaV3_13_0, projectSchemaV3_14_0, projectSchemaV3_15_0, projectSchemaV3_16_0, projectSchemaV4_0_0];
|
package/es/schemas/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// This file is generated by "pnpm json2ts"
|
|
2
|
-
export const CURRENT_SCHEMA_VERSION = '3.
|
|
2
|
+
export const CURRENT_SCHEMA_VERSION = '3.16.0';
|
|
3
3
|
export {default as anyProjectSchema} from './project-schema.json';
|
|
4
|
-
export {default as latestSchemaJson} from './project-schema/v3.
|
|
4
|
+
export {default as latestSchemaJson} from './project-schema/v3.16.0.json';
|
|
5
5
|
import metaSchemaV1_0_0 from './project-schema/meta-schema-v1.0.0.json';
|
|
6
6
|
import projectSchemaV1_0_0 from './project-schema/v1.0.0.json';
|
|
7
7
|
import metaSchemaV3_0_0 from './project-schema/meta-schema-v3.0.0.json';
|
|
@@ -35,6 +35,7 @@ import projectSchemaV3_12_3 from './project-schema/v3.12.3.json';
|
|
|
35
35
|
import projectSchemaV3_13_0 from './project-schema/v3.13.0.json';
|
|
36
36
|
import projectSchemaV3_14_0 from './project-schema/v3.14.0.json';
|
|
37
37
|
import projectSchemaV3_15_0 from './project-schema/v3.15.0.json';
|
|
38
|
+
import projectSchemaV3_16_0 from './project-schema/v3.16.0.json';
|
|
38
39
|
import projectSchemaV4_0_0 from './project-schema/v4.0.0.json';
|
|
39
40
|
export const allProjectSchemas = [
|
|
40
41
|
metaSchemaV1_0_0,
|
|
@@ -70,5 +71,6 @@ export const allProjectSchemas = [
|
|
|
70
71
|
projectSchemaV3_13_0,
|
|
71
72
|
projectSchemaV3_14_0,
|
|
72
73
|
projectSchemaV3_15_0,
|
|
74
|
+
projectSchemaV3_16_0,
|
|
73
75
|
projectSchemaV4_0_0
|
|
74
76
|
];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"$id": "https://schema.takeshape.io/project-schema/v3.
|
|
3
|
+
"$id": "https://schema.takeshape.io/project-schema/v3.16.0#",
|
|
4
4
|
"title": "Project Schema",
|
|
5
5
|
"definitions": {
|
|
6
6
|
"schemaArray": {
|
|
@@ -1435,6 +1435,14 @@
|
|
|
1435
1435
|
"allOf": {
|
|
1436
1436
|
"$ref": "#/definitions/schemaArray"
|
|
1437
1437
|
},
|
|
1438
|
+
"discriminator": {
|
|
1439
|
+
"type": "object",
|
|
1440
|
+
"properties": {
|
|
1441
|
+
"propertyName": {
|
|
1442
|
+
"type": "string"
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
},
|
|
1438
1446
|
"oneOf": {
|
|
1439
1447
|
"$ref": "#/definitions/schemaArray"
|
|
1440
1448
|
},
|
|
@@ -2269,7 +2277,7 @@
|
|
|
2269
2277
|
},
|
|
2270
2278
|
"schemaVersion": {
|
|
2271
2279
|
"type": "string",
|
|
2272
|
-
"enum": ["3.
|
|
2280
|
+
"enum": ["3.16.0"],
|
|
2273
2281
|
"description": "The version of the schema format your project is using. We increase the version as we make breaking changes to the schema format."
|
|
2274
2282
|
},
|
|
2275
2283
|
"projectId": {
|