@takeshape/schema 9.36.4 → 9.38.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/dist/builtin-schema.js +20 -20
- package/dist/migration/index.d.ts +1 -0
- package/dist/migration/index.d.ts.map +1 -1
- package/dist/migration/index.js +4 -1
- package/dist/migration/to/v3.31.0.d.ts +5 -0
- package/dist/migration/to/v3.31.0.d.ts.map +1 -0
- package/dist/migration/to/v3.31.0.js +53 -0
- package/dist/project-schema/index.d.ts +4 -1
- package/dist/project-schema/index.d.ts.map +1 -1
- package/dist/project-schema/index.js +20 -3
- package/dist/project-schema/latest.d.ts +43 -18
- package/dist/project-schema/latest.d.ts.map +1 -1
- package/dist/project-schema/migrate.d.ts.map +1 -1
- package/dist/project-schema/migrate.js +4 -0
- package/dist/project-schema/v3.31.0.d.ts +1449 -0
- package/dist/project-schema/v3.31.0.d.ts.map +1 -0
- package/dist/project-schema/v3.31.0.js +5 -0
- package/dist/relationships.js +2 -2
- package/dist/schema-util.d.ts +2 -2
- package/dist/schema-util.d.ts.map +1 -1
- package/dist/schema-util.js +12 -12
- package/dist/schemas/index.d.ts +2 -2
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +6 -4
- package/dist/schemas/index.ts +4 -2
- package/dist/schemas/project-schema/latest.json +89 -32
- package/dist/schemas/project-schema/v3.31.0.json +3089 -0
- package/dist/schemas/project-schema.json +7 -1
- package/dist/types/types.d.ts +4 -4
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts +4 -3
- package/dist/types/utils.d.ts.map +1 -1
- package/dist/types/utils.js +9 -3
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +13 -3
- package/es/builtin-schema.js +20 -20
- package/es/migration/index.js +3 -1
- package/es/migration/to/v3.31.0.js +38 -0
- package/es/project-schema/index.js +3 -1
- package/es/project-schema/migrate.js +5 -1
- package/es/project-schema/v3.31.0.js +1 -0
- package/es/relationships.js +2 -2
- package/es/schema-util.js +12 -12
- package/es/schemas/index.js +4 -3
- package/es/schemas/index.ts +4 -2
- package/es/schemas/project-schema/latest.json +89 -32
- package/es/schemas/project-schema/v3.31.0.json +3089 -0
- package/es/schemas/project-schema.json +7 -1
- package/es/types/utils.js +7 -3
- package/es/validate.js +13 -3
- package/examples/dependencies/stripe-starter-resolved.json +210 -210
- package/examples/latest/betzino.json +4383 -4383
- package/examples/latest/blog-schema.json +49 -49
- package/examples/latest/brewery-schema.json +39 -39
- package/examples/latest/complex-project-schema.json +412 -412
- package/examples/latest/complex-schema.json +1166 -1166
- package/examples/latest/fabric-ecommerce.json +17 -17
- package/examples/latest/frank-and-fred-schema.json +2242 -2242
- package/examples/latest/klirr-schema.json +3254 -3254
- package/examples/latest/massive-schema.json +785 -785
- package/examples/latest/mill-components-schema.json +215 -215
- package/examples/latest/one-earth.json +1394 -1394
- package/examples/latest/pet-oneof-array.json +33 -33
- package/examples/latest/post-schema.json +32 -32
- package/examples/latest/pruned-shopify-product-schema.json +1 -1
- package/examples/latest/real-world-schema.json +94 -94
- package/examples/latest/recursive-repeater-schema.json +17 -17
- package/examples/latest/recursive-schema.json +17 -17
- package/examples/latest/rick-and-morty-ast.json +180 -180
- package/examples/latest/rick-and-morty-graphql.json +133 -133
- package/examples/latest/rick-and-morty-rest.json +1 -1
- package/examples/latest/schema-with-repeater-draftjs.json +48 -48
- package/examples/latest/shape-books-v3_2_0.json +137 -137
- package/examples/latest/shape-books.json +137 -137
- package/examples/latest/shopify-lookbook.json +41 -41
- package/examples/latest/shopify-product-2022-07.json +124 -124
- package/examples/latest/shopify-product-2023-04.json +125 -125
- package/examples/latest/shopify-store-with-widget.json +94 -94
- package/examples/latest/stripe-product-runtime-schema.json +127 -130
- package/examples/latest/stripe-starter-resolved.json +300 -509
- package/examples/latest/user-schema-no-required.json +22 -22
- package/examples/latest/user-schema-with-defaults.json +23 -23
- package/package.json +5 -5
- package/examples/latest/shopify-namespace-schema.json +0 -364
|
@@ -114,11 +114,17 @@
|
|
|
114
114
|
{
|
|
115
115
|
"$ref": "https://schema.takeshape.io/project-schema/v3.28.0#"
|
|
116
116
|
},
|
|
117
|
+
{
|
|
118
|
+
"$ref": "https://schema.takeshape.io/project-schema/v3.29.0#"
|
|
119
|
+
},
|
|
117
120
|
{
|
|
118
121
|
"$ref": "https://schema.takeshape.io/project-schema/v3.30.0#"
|
|
119
122
|
},
|
|
123
|
+
{
|
|
124
|
+
"$ref": "https://schema.takeshape.io/project-schema/v3.31.0#"
|
|
125
|
+
},
|
|
120
126
|
{
|
|
121
127
|
"$ref": "https://schema.takeshape.io/project-schema/v4.0.0#"
|
|
122
128
|
}
|
|
123
129
|
]
|
|
124
|
-
}
|
|
130
|
+
}
|
package/es/types/utils.js
CHANGED
|
@@ -26,6 +26,7 @@ export function isComposeResolver(resolver) {
|
|
|
26
26
|
const {
|
|
27
27
|
definitions: {
|
|
28
28
|
takeshapeResolver,
|
|
29
|
+
shapedbResolver,
|
|
29
30
|
utilResolver,
|
|
30
31
|
graphqlResolver,
|
|
31
32
|
restResolver,
|
|
@@ -35,6 +36,9 @@ const {
|
|
|
35
36
|
export function isTakeshapeResolver(resolver) {
|
|
36
37
|
return isBasicResolver(resolver) && takeshapeResolver.properties.name.enum.includes(resolver.name);
|
|
37
38
|
}
|
|
39
|
+
export function isShapedbResolver(resolver) {
|
|
40
|
+
return isBasicResolver(resolver) && shapedbResolver.properties.name.enum.includes(resolver.name);
|
|
41
|
+
}
|
|
38
42
|
export function isGraphqlResolver(resolver) {
|
|
39
43
|
return isBasicResolver(resolver) && graphqlResolver.properties.name.enum.includes(resolver.name);
|
|
40
44
|
}
|
|
@@ -166,7 +170,7 @@ export function isAllOfSchema(propertySchema) {
|
|
|
166
170
|
return isArray(propertySchema.allOf);
|
|
167
171
|
}
|
|
168
172
|
export function isExtendsSchema(propertySchema) {
|
|
169
|
-
return isArray(propertySchema.extends);
|
|
173
|
+
return isRecord(propertySchema) && isArray(propertySchema.extends);
|
|
170
174
|
}
|
|
171
175
|
export function isOneOfSchema(propertySchema) {
|
|
172
176
|
return isArray(propertySchema.oneOf);
|
|
@@ -181,7 +185,7 @@ export function isReturnShapeArraySchema(returnShape) {
|
|
|
181
185
|
return typeof returnShape === 'object' && returnShape.type === 'array';
|
|
182
186
|
}
|
|
183
187
|
export function isObjectSchema(propertySchema) {
|
|
184
|
-
return propertySchema.type === 'object' && isRecord(propertySchema.properties);
|
|
188
|
+
return isRecord(propertySchema) && propertySchema.type === 'object' && isRecord(propertySchema.properties);
|
|
185
189
|
}
|
|
186
190
|
/** Service Config Utils **/
|
|
187
191
|
|
|
@@ -274,5 +278,5 @@ export const getRefType = refSchema => {
|
|
|
274
278
|
export function isPropertySchemaWithRelationship(schema) {
|
|
275
279
|
var _schema$Resolver;
|
|
276
280
|
|
|
277
|
-
return ((_schema$Resolver = schema['@resolver']) === null || _schema$Resolver === void 0 ? void 0 : _schema$Resolver.name) === '
|
|
281
|
+
return ((_schema$Resolver = schema['@resolver']) === null || _schema$Resolver === void 0 ? void 0 : _schema$Resolver.name) === 'shapedb:getRelated';
|
|
278
282
|
}
|
package/es/validate.js
CHANGED
|
@@ -184,7 +184,8 @@ function enumerateBasicResolvers(resolver, path) {
|
|
|
184
184
|
|
|
185
185
|
visit(resolver, path);
|
|
186
186
|
return results;
|
|
187
|
-
}
|
|
187
|
+
} // eslint-disable-next-line complexity
|
|
188
|
+
|
|
188
189
|
|
|
189
190
|
function validateResolver(projectSchema, basePath, baseResolver) {
|
|
190
191
|
const errors = [];
|
|
@@ -228,13 +229,22 @@ function validateResolver(projectSchema, basePath, baseResolver) {
|
|
|
228
229
|
};
|
|
229
230
|
|
|
230
231
|
const isLessThanV3_9_0 = lt(getSemver(projectSchema.schemaVersion), '3.9.0');
|
|
232
|
+
const isLessThanV3_31_0 = lt(getSemver(projectSchema.schemaVersion), '3.31.0');
|
|
231
233
|
const getNamespace = createGetNamespace(projectSchema);
|
|
232
234
|
|
|
233
235
|
for (const [resolver, path] of enumerateBasicResolvers(baseResolver, basePath)) {
|
|
234
236
|
if (isBasicResolver(resolver)) {
|
|
235
|
-
var _projectSchema$servic;
|
|
237
|
+
var _projectSchema$servic, _projectSchema$servic2;
|
|
238
|
+
|
|
239
|
+
if (isLessThanV3_31_0 && 'service' in resolver && resolver.service !== 'takeshape:local' && !((_projectSchema$servic = projectSchema.services) !== null && _projectSchema$servic !== void 0 && _projectSchema$servic[resolver.service])) {
|
|
240
|
+
errors.push({
|
|
241
|
+
type: 'notFound',
|
|
242
|
+
path: path.concat(['service']),
|
|
243
|
+
message: `Invalid service "${resolver.service}"`
|
|
244
|
+
});
|
|
245
|
+
}
|
|
236
246
|
|
|
237
|
-
if ('service' in resolver && resolver.service !== 'takeshape
|
|
247
|
+
if (!isLessThanV3_31_0 && 'service' in resolver && resolver.service !== 'shapedb' && resolver.service !== 'takeshape' && !((_projectSchema$servic2 = projectSchema.services) !== null && _projectSchema$servic2 !== void 0 && _projectSchema$servic2[resolver.service])) {
|
|
238
248
|
errors.push({
|
|
239
249
|
type: 'notFound',
|
|
240
250
|
path: path.concat(['service']),
|