@takeshape/schema 8.218.3 → 8.219.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/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.23.0.d.ts +5 -0
- package/dist/migration/to/v3.23.0.d.ts.map +1 -0
- package/dist/migration/to/v3.23.0.js +18 -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 +34 -2
- 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.23.0.d.ts +1377 -0
- package/dist/project-schema/v3.23.0.d.ts.map +1 -0
- package/dist/project-schema/v3.23.0.js +5 -0
- package/dist/refs.d.ts +9 -0
- package/dist/refs.d.ts.map +1 -1
- package/dist/refs.js +44 -0
- package/dist/schema-util.d.ts +0 -9
- package/dist/schema-util.d.ts.map +1 -1
- package/dist/schema-util.js +1 -24
- 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 +80 -2
- package/dist/schemas/project-schema/v3.23.0.json +2452 -0
- package/dist/schemas/project-schema.json +3 -0
- package/dist/services.js +1 -1
- package/dist/types/types.d.ts +2 -2
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts +2 -1
- package/dist/types/utils.d.ts.map +1 -1
- package/dist/types/utils.js +6 -1
- package/dist/util/api-indexing.js +1 -1
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +24 -1
- package/es/migration/index.js +3 -1
- package/es/migration/to/v3.23.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.23.0.js +1 -0
- package/es/refs.js +38 -0
- package/es/schema-util.js +2 -19
- package/es/schemas/index.js +4 -3
- package/es/schemas/index.ts +4 -2
- package/es/schemas/project-schema/latest.json +80 -2
- package/es/schemas/project-schema/v3.23.0.json +2452 -0
- package/es/schemas/project-schema.json +3 -0
- package/es/services.js +2 -2
- package/es/types/utils.js +4 -1
- package/es/util/api-indexing.js +2 -2
- package/es/validate.js +25 -2
- 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/complex-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/klirr-schema.json +1 -1
- package/examples/latest/massive-schema.json +1 -1
- package/examples/latest/mill-components-schema.json +1 -1
- package/examples/latest/one-earth.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-product-2022-07.json +1 -1
- package/examples/latest/shopify-store-with-widget.json +1 -1
- package/examples/latest/stripe-product-runtime-schema.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/package.json +4 -4
package/es/services.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mergeWithArrayMerge } from '@takeshape/util';
|
|
1
|
+
import { isDefined, mergeWithArrayMerge } from '@takeshape/util';
|
|
2
2
|
import { createAjv } from '@takeshape/json-schema';
|
|
3
3
|
import { SchemaValidationError } from '@takeshape/errors';
|
|
4
4
|
import isNull from 'lodash/isNull';
|
|
@@ -170,7 +170,7 @@ export function getServiceObjectFields(projectSchema, shape, provider) {
|
|
|
170
170
|
}
|
|
171
171
|
export function getResolverServices(resolver) {
|
|
172
172
|
const resolverArray = 'compose' in resolver ? resolver.compose : [resolver];
|
|
173
|
-
return uniq(resolverArray.map(resolver => resolver.service));
|
|
173
|
+
return uniq(resolverArray.map(resolver => 'service' in resolver ? resolver.service : undefined).filter(isDefined));
|
|
174
174
|
}
|
|
175
175
|
export function isMissingAuth(service) {
|
|
176
176
|
return service.authenticationType !== 'none' && isEmpty(service.authentication);
|
package/es/types/utils.js
CHANGED
|
@@ -14,7 +14,10 @@ import satisfies from 'semver/functions/satisfies';
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
export function isBasicResolver(resolver) {
|
|
17
|
-
return
|
|
17
|
+
return isRecord(resolver) && isString(resolver.name);
|
|
18
|
+
}
|
|
19
|
+
export function isServiceResolver(resolver) {
|
|
20
|
+
return isRecord(resolver) && isString(resolver.name) && isString(resolver.service);
|
|
18
21
|
}
|
|
19
22
|
export function isComposeResolver(resolver) {
|
|
20
23
|
return Boolean(isArray(resolver === null || resolver === void 0 ? void 0 : resolver.compose) && resolver.compose.length && resolver.compose.every(isBasicResolver));
|
package/es/util/api-indexing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isServiceResolver } from '../types';
|
|
2
2
|
export function serviceHasIndexedShapes(schema, serviceId) {
|
|
3
3
|
for (const config of Object.values(schema.indexedShapes ?? {})) {
|
|
4
4
|
var _config$queries$list;
|
|
@@ -6,7 +6,7 @@ export function serviceHasIndexedShapes(schema, serviceId) {
|
|
|
6
6
|
const queryName = (_config$queries$list = config.queries.list) === null || _config$queries$list === void 0 ? void 0 : _config$queries$list.name;
|
|
7
7
|
const query = queryName && schema.queries[queryName];
|
|
8
8
|
|
|
9
|
-
if (query &&
|
|
9
|
+
if (query && isServiceResolver(query.resolver) && query.resolver.service === serviceId) {
|
|
10
10
|
return true;
|
|
11
11
|
}
|
|
12
12
|
}
|
package/es/validate.js
CHANGED
|
@@ -16,7 +16,7 @@ import { getAllNamespaceShapes, getAllRefsInShapes } from './schema-util';
|
|
|
16
16
|
import { builtInShapes } from './builtin-schema';
|
|
17
17
|
import { isValidTemplate } from './template-shapes';
|
|
18
18
|
import { isBasicResolver, isComposeResolver, isExtendsSchema, isObjectSchema } from './types/utils';
|
|
19
|
-
import { refItemToAtRef, refItemToShapeName, parseReturnShape, getRefShapeName } from './refs';
|
|
19
|
+
import { refItemToAtRef, refItemToShapeName, parseReturnShape, getRefShapeName, parsePropertyRef, propertyRefItemToPath, createGetNamespace } from './refs';
|
|
20
20
|
import { scalars } from './scalars';
|
|
21
21
|
import { isUnionSchema } from './unions';
|
|
22
22
|
import { isEnumLikeSchema } from './enum';
|
|
@@ -194,12 +194,13 @@ function validateResolver(projectSchema, basePath, resolver) {
|
|
|
194
194
|
};
|
|
195
195
|
|
|
196
196
|
const isLessThanV3_9_0 = lt(getSemver(projectSchema.schemaVersion), '3.9.0');
|
|
197
|
+
const getNamespace = createGetNamespace(projectSchema);
|
|
197
198
|
|
|
198
199
|
const validateBasicResolver = resolver => {
|
|
199
200
|
if (isBasicResolver(resolver)) {
|
|
200
201
|
var _projectSchema$servic;
|
|
201
202
|
|
|
202
|
-
if (resolver.service !== 'takeshape:local' && !((_projectSchema$servic = projectSchema.services) !== null && _projectSchema$servic !== void 0 && _projectSchema$servic[resolver.service])) {
|
|
203
|
+
if ('service' in resolver && resolver.service !== 'takeshape:local' && !((_projectSchema$servic = projectSchema.services) !== null && _projectSchema$servic !== void 0 && _projectSchema$servic[resolver.service])) {
|
|
203
204
|
errors.push({
|
|
204
205
|
type: 'notFound',
|
|
205
206
|
path: basePath.concat(['service']),
|
|
@@ -246,6 +247,28 @@ function validateResolver(projectSchema, basePath, resolver) {
|
|
|
246
247
|
});
|
|
247
248
|
}
|
|
248
249
|
}
|
|
250
|
+
|
|
251
|
+
if (resolver.name === 'delegate') {
|
|
252
|
+
const parsed = parsePropertyRef(resolver.to);
|
|
253
|
+
|
|
254
|
+
if (parsed) {
|
|
255
|
+
const targetResolver = get(projectSchema, propertyRefItemToPath(getNamespace, parsed));
|
|
256
|
+
|
|
257
|
+
if (!isBasicResolver(targetResolver) && !isComposeResolver(targetResolver)) {
|
|
258
|
+
errors.push({
|
|
259
|
+
type: 'notFound',
|
|
260
|
+
path: basePath.concat('to'),
|
|
261
|
+
message: `Missing resolver config at property ref "${resolver.to}"`
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
} else {
|
|
265
|
+
errors.push({
|
|
266
|
+
type: 'conflict',
|
|
267
|
+
path: basePath.concat('to'),
|
|
268
|
+
message: `Unable to parse property ref "${resolver.to}"`
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
}
|
|
249
272
|
} else {
|
|
250
273
|
errors.push({
|
|
251
274
|
type: 'notFound',
|
|
@@ -52529,6 +52529,6 @@
|
|
|
52529
52529
|
}
|
|
52530
52530
|
}
|
|
52531
52531
|
},
|
|
52532
|
-
"schemaVersion": "3.
|
|
52532
|
+
"schemaVersion": "3.23.0",
|
|
52533
52533
|
"services": {}
|
|
52534
52534
|
}
|
|
@@ -10509,5 +10509,5 @@
|
|
|
10509
10509
|
}
|
|
10510
10510
|
}
|
|
10511
10511
|
},
|
|
10512
|
-
"schemaVersion": "3.
|
|
10512
|
+
"schemaVersion": "3.23.0"
|
|
10513
10513
|
}
|
|
@@ -23255,6 +23255,6 @@
|
|
|
23255
23255
|
}
|
|
23256
23256
|
}
|
|
23257
23257
|
},
|
|
23258
|
-
"schemaVersion": "3.
|
|
23258
|
+
"schemaVersion": "3.23.0",
|
|
23259
23259
|
"services": {}
|
|
23260
23260
|
}
|
|
@@ -34790,6 +34790,6 @@
|
|
|
34790
34790
|
}
|
|
34791
34791
|
}
|
|
34792
34792
|
},
|
|
34793
|
-
"schemaVersion": "3.
|
|
34793
|
+
"schemaVersion": "3.23.0",
|
|
34794
34794
|
"services": {}
|
|
34795
34795
|
}
|
|
@@ -14220,6 +14220,6 @@
|
|
|
14220
14220
|
}
|
|
14221
14221
|
}
|
|
14222
14222
|
},
|
|
14223
|
-
"schemaVersion": "3.
|
|
14223
|
+
"schemaVersion": "3.23.0",
|
|
14224
14224
|
"services": {}
|
|
14225
14225
|
}
|
|
@@ -12564,5 +12564,5 @@
|
|
|
12564
12564
|
}
|
|
12565
12565
|
}
|
|
12566
12566
|
},
|
|
12567
|
-
"schemaVersion": "3.
|
|
12567
|
+
"schemaVersion": "3.23.0"
|
|
12568
12568
|
}
|
|
@@ -29320,5 +29320,5 @@
|
|
|
29320
29320
|
}
|
|
29321
29321
|
}
|
|
29322
29322
|
},
|
|
29323
|
-
"schemaVersion": "3.
|
|
29323
|
+
"schemaVersion": "3.23.0"
|
|
29324
29324
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takeshape/schema",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.219.0",
|
|
4
4
|
"description": "TakeShape Schema",
|
|
5
5
|
"homepage": "https://www.takeshape.io",
|
|
6
6
|
"repository": {
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"examples"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@takeshape/errors": "8.
|
|
25
|
-
"@takeshape/json-schema": "8.
|
|
26
|
-
"@takeshape/util": "8.
|
|
24
|
+
"@takeshape/errors": "8.219.0",
|
|
25
|
+
"@takeshape/json-schema": "8.219.0",
|
|
26
|
+
"@takeshape/util": "8.219.0",
|
|
27
27
|
"ajv": "^8.10.0",
|
|
28
28
|
"ajv-formats": "^2.1.1",
|
|
29
29
|
"blueimp-md5": "^2.10.0",
|