@takeshape/schema 8.215.4 → 8.217.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.22.0.d.ts +5 -0
- package/dist/migration/to/v3.22.0.d.ts.map +1 -0
- package/dist/migration/to/v3.22.0.js +44 -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 +15 -9
- 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.22.0.d.ts +1345 -0
- package/dist/project-schema/v3.22.0.d.ts.map +1 -0
- package/dist/project-schema/v3.22.0.js +5 -0
- 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 +22 -18
- package/dist/schemas/project-schema/v3.22.0.json +2375 -0
- package/dist/schemas/project-schema.json +3 -0
- package/dist/types/types.d.ts +8 -2
- package/dist/types/types.d.ts.map +1 -1
- package/dist/util/api-indexing.d.ts +7 -1
- package/dist/util/api-indexing.d.ts.map +1 -1
- package/dist/util/api-indexing.js +27 -1
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +22 -1
- package/es/migration/index.js +3 -1
- package/es/migration/to/v3.22.0.js +33 -0
- package/es/project-schema/index.js +3 -1
- package/es/project-schema/migrate.js +5 -1
- package/es/project-schema/v3.22.0.js +1 -0
- package/es/schemas/index.js +4 -3
- package/es/schemas/index.ts +4 -2
- package/es/schemas/project-schema/latest.json +22 -18
- package/es/schemas/project-schema/v3.22.0.json +2375 -0
- package/es/schemas/project-schema.json +3 -0
- package/es/util/api-indexing.js +24 -1
- package/es/validate.js +22 -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/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 +2 -2
- package/examples/latest/shopify-store-with-widget.json +1 -1
- package/examples/latest/stripe-product-runtime-schema.json +7 -6
- 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/util/api-indexing.js
CHANGED
|
@@ -12,4 +12,27 @@ export function serviceHasIndexedShapes(schema, serviceId) {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
return false;
|
|
15
|
-
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function getQueryIndexConfigHelper(op) {
|
|
18
|
+
return ({
|
|
19
|
+
indexedShapes
|
|
20
|
+
}, shapeName) => {
|
|
21
|
+
const indexingConfig = indexedShapes === null || indexedShapes === void 0 ? void 0 : indexedShapes[shapeName];
|
|
22
|
+
|
|
23
|
+
if (indexingConfig) {
|
|
24
|
+
const queryConfig = indexingConfig.queries[op];
|
|
25
|
+
|
|
26
|
+
if (queryConfig) {
|
|
27
|
+
return {
|
|
28
|
+
shapeName,
|
|
29
|
+
...indexingConfig.query,
|
|
30
|
+
...queryConfig
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const getListQueryIndexConfig = getQueryIndexConfigHelper('list');
|
|
38
|
+
export const getGetQueryIndexConfig = getQueryIndexConfigHelper('get');
|
package/es/validate.js
CHANGED
|
@@ -307,8 +307,17 @@ function validateQueryConfigs(projectSchema, additionalShapeNames = builtInShape
|
|
|
307
307
|
return errors;
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
+
function hasIdField(selectionSet, idField) {
|
|
311
|
+
// TODO allow GraphQL parser implementation to be passed in
|
|
312
|
+
const topLevel = selectionSet.replace(/^\s*{\s*/, '') // remove first {
|
|
313
|
+
.replace(/\s*}\s*$/, '') // remove last {
|
|
314
|
+
.replace(/{[^}]*}|:/g, '') // remove nested selections and :
|
|
315
|
+
.split(/\s+/g);
|
|
316
|
+
return topLevel.includes(idField);
|
|
317
|
+
}
|
|
318
|
+
|
|
310
319
|
function validateIndexedShapeConfig(projectSchema, shapeName, config) {
|
|
311
|
-
var _config$queries;
|
|
320
|
+
var _config$queries, _config$query;
|
|
312
321
|
|
|
313
322
|
const errors = [];
|
|
314
323
|
const list = (_config$queries = config.queries) === null || _config$queries === void 0 ? void 0 : _config$queries.list;
|
|
@@ -323,6 +332,18 @@ function validateIndexedShapeConfig(projectSchema, shapeName, config) {
|
|
|
323
332
|
}
|
|
324
333
|
}
|
|
325
334
|
|
|
335
|
+
if ((_config$query = config.query) !== null && _config$query !== void 0 && _config$query.selectionSet) {
|
|
336
|
+
const idField = config.idField ?? 'id';
|
|
337
|
+
|
|
338
|
+
if (!hasIdField(config.query.selectionSet, idField)) {
|
|
339
|
+
errors.push({
|
|
340
|
+
path: ['indexedShapes', shapeName, 'query', 'selectionSet'],
|
|
341
|
+
type: 'notFound',
|
|
342
|
+
message: `selectionSet must contain "${idField}"`
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
326
347
|
return errors;
|
|
327
348
|
}
|
|
328
349
|
|
|
@@ -52529,6 +52529,6 @@
|
|
|
52529
52529
|
}
|
|
52530
52530
|
}
|
|
52531
52531
|
},
|
|
52532
|
-
"schemaVersion": "3.
|
|
52532
|
+
"schemaVersion": "3.22.0",
|
|
52533
52533
|
"services": {}
|
|
52534
52534
|
}
|
|
@@ -10509,5 +10509,5 @@
|
|
|
10509
10509
|
}
|
|
10510
10510
|
}
|
|
10511
10511
|
},
|
|
10512
|
-
"schemaVersion": "3.
|
|
10512
|
+
"schemaVersion": "3.22.0"
|
|
10513
10513
|
}
|
|
@@ -23255,6 +23255,6 @@
|
|
|
23255
23255
|
}
|
|
23256
23256
|
}
|
|
23257
23257
|
},
|
|
23258
|
-
"schemaVersion": "3.
|
|
23258
|
+
"schemaVersion": "3.22.0",
|
|
23259
23259
|
"services": {}
|
|
23260
23260
|
}
|
|
@@ -34790,6 +34790,6 @@
|
|
|
34790
34790
|
}
|
|
34791
34791
|
}
|
|
34792
34792
|
},
|
|
34793
|
-
"schemaVersion": "3.
|
|
34793
|
+
"schemaVersion": "3.22.0",
|
|
34794
34794
|
"services": {}
|
|
34795
34795
|
}
|
|
@@ -14220,6 +14220,6 @@
|
|
|
14220
14220
|
}
|
|
14221
14221
|
}
|
|
14222
14222
|
},
|
|
14223
|
-
"schemaVersion": "3.
|
|
14223
|
+
"schemaVersion": "3.22.0",
|
|
14224
14224
|
"services": {}
|
|
14225
14225
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"en-us"
|
|
10
10
|
],
|
|
11
11
|
"apiVersion": "2",
|
|
12
|
-
"schemaVersion": "3.
|
|
12
|
+
"schemaVersion": "3.22.0",
|
|
13
13
|
"queries": {
|
|
14
14
|
"getAsset": {
|
|
15
15
|
"shape": "Asset",
|
|
@@ -39001,4 +39001,4 @@
|
|
|
39001
39001
|
"authentication": "secret"
|
|
39002
39002
|
}
|
|
39003
39003
|
}
|
|
39004
|
-
}
|
|
39004
|
+
}
|
|
@@ -12564,5 +12564,5 @@
|
|
|
12564
12564
|
}
|
|
12565
12565
|
}
|
|
12566
12566
|
},
|
|
12567
|
-
"schemaVersion": "3.
|
|
12567
|
+
"schemaVersion": "3.22.0"
|
|
12568
12568
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"en-us"
|
|
10
10
|
],
|
|
11
11
|
"apiVersion": "2",
|
|
12
|
-
"schemaVersion": "3.
|
|
12
|
+
"schemaVersion": "3.22.0",
|
|
13
13
|
"queries": {
|
|
14
14
|
"getAsset": {
|
|
15
15
|
"shape": "Asset",
|
|
@@ -4406,12 +4406,10 @@
|
|
|
4406
4406
|
"Stripe_Product": {
|
|
4407
4407
|
"queries": {
|
|
4408
4408
|
"list": {
|
|
4409
|
-
"name": "Stripe_listProducts"
|
|
4410
|
-
"objectDepthLimit": 1
|
|
4409
|
+
"name": "Stripe_listProducts"
|
|
4411
4410
|
},
|
|
4412
4411
|
"get": {
|
|
4413
|
-
"name": "Stripe_getProduct"
|
|
4414
|
-
"objectDepthLimit": 1
|
|
4412
|
+
"name": "Stripe_getProduct"
|
|
4415
4413
|
}
|
|
4416
4414
|
},
|
|
4417
4415
|
"triggers": [
|
|
@@ -4420,7 +4418,10 @@
|
|
|
4420
4418
|
"query": "list",
|
|
4421
4419
|
"interval": 1440
|
|
4422
4420
|
}
|
|
4423
|
-
]
|
|
4421
|
+
],
|
|
4422
|
+
"query": {
|
|
4423
|
+
"maxDepth": 1
|
|
4424
|
+
}
|
|
4424
4425
|
}
|
|
4425
4426
|
}
|
|
4426
4427
|
}
|
|
@@ -29320,5 +29320,5 @@
|
|
|
29320
29320
|
}
|
|
29321
29321
|
}
|
|
29322
29322
|
},
|
|
29323
|
-
"schemaVersion": "3.
|
|
29323
|
+
"schemaVersion": "3.22.0"
|
|
29324
29324
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takeshape/schema",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.217.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.217.0",
|
|
25
|
+
"@takeshape/json-schema": "8.217.0",
|
|
26
|
+
"@takeshape/util": "8.217.0",
|
|
27
27
|
"ajv": "^8.10.0",
|
|
28
28
|
"ajv-formats": "^2.1.1",
|
|
29
29
|
"blueimp-md5": "^2.10.0",
|