@takeshape/schema 8.66.2 → 8.67.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/index.js +2 -1
- package/es/migration/index.js +8 -2
- package/es/migration/to/v3.14.0.js +10 -0
- package/es/project-schema/index.js +1 -0
- package/es/project-schema/v3.13.1.js +1 -0
- package/es/project-schema/v3.14.0.js +1 -0
- package/es/rewrite.js +59 -0
- package/es/schemas/index.js +4 -3
- package/es/schemas/index.ts +4 -2
- package/es/schemas/project-schema/v3.14.0.json +2379 -0
- package/es/schemas/project-schema.json +2 -1
- package/es/template-shapes/templates.js +56 -45
- package/es/template-shapes/types.js +8 -1
- package/es/types/utils.js +1 -0
- 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/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +14 -0
- package/lib/migration/index.d.ts.map +1 -1
- package/lib/migration/index.js +8 -1
- package/lib/migration/to/v3.14.0.d.ts +4 -0
- package/lib/migration/to/v3.14.0.d.ts.map +1 -0
- package/lib/migration/to/v3.14.0.js +18 -0
- package/lib/project-schema/index.d.ts +3 -1
- package/lib/project-schema/index.d.ts.map +1 -1
- package/lib/project-schema/index.js +32 -19
- package/lib/project-schema/latest.d.ts +120 -1
- package/lib/project-schema/latest.d.ts.map +1 -1
- package/lib/project-schema/v3.13.1.d.ts +1413 -0
- package/lib/project-schema/v3.13.1.d.ts.map +1 -0
- package/lib/project-schema/v3.13.1.js +5 -0
- package/lib/project-schema/v3.14.0.d.ts +1437 -0
- package/lib/project-schema/v3.14.0.d.ts.map +1 -0
- package/lib/project-schema/v3.14.0.js +5 -0
- package/lib/rewrite.d.ts +10 -0
- package/lib/rewrite.d.ts.map +1 -0
- package/lib/rewrite.js +69 -0
- package/lib/schemas/index.d.ts +2 -2
- package/lib/schemas/index.d.ts.map +1 -1
- package/lib/schemas/index.js +23 -21
- package/lib/schemas/index.ts +4 -2
- package/lib/schemas/project-schema/v3.14.0.json +2379 -0
- package/lib/schemas/project-schema.json +2 -1
- package/lib/template-shapes/templates.d.ts +11 -4
- package/lib/template-shapes/templates.d.ts.map +1 -1
- package/lib/template-shapes/templates.js +60 -49
- package/lib/template-shapes/types.d.ts +6 -0
- package/lib/template-shapes/types.d.ts.map +1 -1
- package/lib/template-shapes/types.js +11 -1
- package/lib/types/types.d.ts +2 -2
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/utils.d.ts +2 -1
- package/lib/types/utils.d.ts.map +1 -1
- package/lib/types/utils.js +3 -1
- package/package.json +4 -4
package/es/index.js
CHANGED
package/es/migration/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isLatestProjectSchema, isProjectSchemaV1, isProjectSchemaV3, isProjectSchemaV3_1, isProjectSchemaV3_2, isProjectSchemaV3_3, isProjectSchemaV3_4, isProjectSchemaV3_5, isProjectSchemaV3_5_1, isProjectSchemaV3_6, isProjectSchemaV3_7, isProjectSchemaV3_8, isProjectSchemaV3_9, isProjectSchemaV3_10, isProjectSchemaV3_11, isProjectSchemaV3_12, isProjectSchemaV3_12_1, isProjectSchemaV3_12_2, isProjectSchemaV3_12_3 } from '../types/utils';
|
|
1
|
+
import { isLatestProjectSchema, isProjectSchemaV1, isProjectSchemaV3, isProjectSchemaV3_1, isProjectSchemaV3_2, isProjectSchemaV3_3, isProjectSchemaV3_4, isProjectSchemaV3_5, isProjectSchemaV3_5_1, isProjectSchemaV3_6, isProjectSchemaV3_7, isProjectSchemaV3_8, isProjectSchemaV3_9, isProjectSchemaV3_10, isProjectSchemaV3_11, isProjectSchemaV3_12, isProjectSchemaV3_12_1, isProjectSchemaV3_12_2, isProjectSchemaV3_12_3, isProjectSchemaV3_13_0 } from '../types/utils';
|
|
2
2
|
import migrateToV3 from './to/v3.0.0';
|
|
3
3
|
import migrateToV3_1 from './to/v3.1.0';
|
|
4
4
|
import migrateToV3_2 from './to/v3.2.0';
|
|
@@ -17,8 +17,10 @@ import migrateToV3_12_1 from './to/v3.12.1';
|
|
|
17
17
|
import migrateToV3_12_2 from './to/v3.12.2';
|
|
18
18
|
import migrateToV3_12_3 from './to/v3.12.3';
|
|
19
19
|
import migrateToV3_13_0 from './to/v3.13.0';
|
|
20
|
+
import migrateToV3_14_0 from './to/v3.14.0';
|
|
20
21
|
export * from './utils';
|
|
21
|
-
export const listTypePrefix = 'PaginatedList';
|
|
22
|
+
export const listTypePrefix = 'PaginatedList'; // eslint-disable-next-line complexity
|
|
23
|
+
|
|
22
24
|
export async function migrateToLatestProjectSchema(context, projectSchema) {
|
|
23
25
|
if (projectSchema.schemaVersion === '4.0.0') {
|
|
24
26
|
throw new Error('You are using an unreleased schema version. Migration is not possible');
|
|
@@ -96,6 +98,10 @@ export async function migrateToLatestProjectSchema(context, projectSchema) {
|
|
|
96
98
|
projectSchema = migrateToV3_13_0(projectSchema);
|
|
97
99
|
}
|
|
98
100
|
|
|
101
|
+
if (isProjectSchemaV3_13_0(projectSchema)) {
|
|
102
|
+
projectSchema = migrateToV3_14_0(projectSchema);
|
|
103
|
+
}
|
|
104
|
+
|
|
99
105
|
return projectSchema;
|
|
100
106
|
}
|
|
101
107
|
export async function ensureLatest(context, schema) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/rewrite.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import defaults from 'lodash/fp/defaults';
|
|
2
|
+
const rewriteSchemaCache = new Map();
|
|
3
|
+
|
|
4
|
+
function getRewriteCache(options) {
|
|
5
|
+
// Ensure key order does not invalidate the cache
|
|
6
|
+
const key = JSON.stringify(options, Object.keys(options).sort());
|
|
7
|
+
let cache = rewriteSchemaCache.get(key);
|
|
8
|
+
|
|
9
|
+
if (!cache) {
|
|
10
|
+
cache = new WeakMap();
|
|
11
|
+
rewriteSchemaCache.set(key, cache);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return cache;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Rewrite a schema, applying optional modifications.
|
|
18
|
+
*/
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
export function rewriteSchema(schema, options) {
|
|
23
|
+
const rewriteCache = getRewriteCache(defaults({
|
|
24
|
+
removeDefault: false,
|
|
25
|
+
removeRequired: false,
|
|
26
|
+
replaceInput: false
|
|
27
|
+
}, options));
|
|
28
|
+
let rewrittenSchema = rewriteCache.get(schema);
|
|
29
|
+
|
|
30
|
+
if (rewrittenSchema) {
|
|
31
|
+
return rewrittenSchema;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
rewrittenSchema = JSON.parse(JSON.stringify(schema), (_key, value) => {
|
|
35
|
+
if (typeof value === 'object') {
|
|
36
|
+
var _value$required;
|
|
37
|
+
|
|
38
|
+
// Remove required
|
|
39
|
+
if (options.removeRequired && (_value$required = value.required) !== null && _value$required !== void 0 && _value$required.length) {
|
|
40
|
+
delete value.required;
|
|
41
|
+
} // Remove default
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
if (options.removeDefault && value.type !== undefined && value.default !== undefined) {
|
|
45
|
+
delete value.default;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (options.replaceInput && value['@input']) {
|
|
49
|
+
return { ...value['@input'],
|
|
50
|
+
'@mapping': value['@mapping']
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return value;
|
|
56
|
+
});
|
|
57
|
+
rewriteCache.set(schema, rewrittenSchema);
|
|
58
|
+
return rewrittenSchema;
|
|
59
|
+
}
|
package/es/schemas/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// This file is generated by "pnpm json2ts"
|
|
2
|
-
export const CURRENT_SCHEMA_VERSION = '3.
|
|
2
|
+
export const CURRENT_SCHEMA_VERSION = '3.14.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.14.0.json';
|
|
5
5
|
import projectSchemaV4_0_0 from './project-schema/v4.0.0.json';
|
|
6
|
+
import projectSchemaV3_14_0 from './project-schema/v3.14.0.json';
|
|
6
7
|
import projectSchemaV3_13_0 from './project-schema/v3.13.0.json';
|
|
7
8
|
import projectSchemaV3_12_3 from './project-schema/v3.12.3.json';
|
|
8
9
|
import projectSchemaV3_12_2 from './project-schema/v3.12.2.json';
|
|
@@ -34,4 +35,4 @@ import projectSchemaV3_0_0 from './project-schema/v3.0.0.json';
|
|
|
34
35
|
import metaSchemaV3_0_0 from './project-schema/meta-schema-v3.0.0.json';
|
|
35
36
|
import projectSchemaV1_0_0 from './project-schema/v1.0.0.json';
|
|
36
37
|
import metaSchemaV1_0_0 from './project-schema/meta-schema-v1.0.0.json';
|
|
37
|
-
export const allProjectSchemas = [projectSchemaV4_0_0, projectSchemaV3_13_0, projectSchemaV3_12_3, projectSchemaV3_12_2, projectSchemaV3_12_1, projectSchemaV3_12_0, projectSchemaV3_11_0, projectSchemaV3_10_0, projectSchemaV3_9_0, metaSchemaV3_9_0, projectSchemaV3_8_0, metaSchemaV3_8_0, projectSchemaV3_7_0, metaSchemaV3_7_0, projectSchemaV3_6_0, metaSchemaV3_6_0, projectSchemaV3_5_1, metaSchemaV3_5_1, projectSchemaV3_5_0, metaSchemaV3_5_0, projectSchemaV3_4_0, metaSchemaV3_4_0, projectSchemaV3_3_0, metaSchemaV3_3_0, projectSchemaV3_2_0, metaSchemaV3_2_0, projectSchemaV3_1_0, metaSchemaV3_1_0, projectSchemaV3_0_0, metaSchemaV3_0_0, projectSchemaV1_0_0, metaSchemaV1_0_0];
|
|
38
|
+
export const allProjectSchemas = [projectSchemaV4_0_0, projectSchemaV3_14_0, projectSchemaV3_13_0, projectSchemaV3_12_3, projectSchemaV3_12_2, projectSchemaV3_12_1, projectSchemaV3_12_0, projectSchemaV3_11_0, projectSchemaV3_10_0, projectSchemaV3_9_0, metaSchemaV3_9_0, projectSchemaV3_8_0, metaSchemaV3_8_0, projectSchemaV3_7_0, metaSchemaV3_7_0, projectSchemaV3_6_0, metaSchemaV3_6_0, projectSchemaV3_5_1, metaSchemaV3_5_1, projectSchemaV3_5_0, metaSchemaV3_5_0, projectSchemaV3_4_0, metaSchemaV3_4_0, projectSchemaV3_3_0, metaSchemaV3_3_0, projectSchemaV3_2_0, metaSchemaV3_2_0, projectSchemaV3_1_0, metaSchemaV3_1_0, projectSchemaV3_0_0, metaSchemaV3_0_0, projectSchemaV1_0_0, metaSchemaV1_0_0];
|
package/es/schemas/index.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// This file is generated by "pnpm json2ts"
|
|
2
|
-
export const CURRENT_SCHEMA_VERSION = '3.
|
|
2
|
+
export const CURRENT_SCHEMA_VERSION = '3.14.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.14.0.json';
|
|
5
5
|
import projectSchemaV4_0_0 from './project-schema/v4.0.0.json';
|
|
6
|
+
import projectSchemaV3_14_0 from './project-schema/v3.14.0.json';
|
|
6
7
|
import projectSchemaV3_13_0 from './project-schema/v3.13.0.json';
|
|
7
8
|
import projectSchemaV3_12_3 from './project-schema/v3.12.3.json';
|
|
8
9
|
import projectSchemaV3_12_2 from './project-schema/v3.12.2.json';
|
|
@@ -36,6 +37,7 @@ import projectSchemaV1_0_0 from './project-schema/v1.0.0.json';
|
|
|
36
37
|
import metaSchemaV1_0_0 from './project-schema/meta-schema-v1.0.0.json';
|
|
37
38
|
export const allProjectSchemas = [
|
|
38
39
|
projectSchemaV4_0_0,
|
|
40
|
+
projectSchemaV3_14_0,
|
|
39
41
|
projectSchemaV3_13_0,
|
|
40
42
|
projectSchemaV3_12_3,
|
|
41
43
|
projectSchemaV3_12_2,
|