@takeshape/schema 8.65.0 → 8.68.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/content-schema-transform.js +2 -2
- package/es/index.js +2 -1
- package/es/migration/index.js +13 -2
- package/es/migration/to/v3.14.0.js +10 -0
- package/es/migration/to/v3.15.0.js +10 -0
- package/es/project-schema/index.js +2 -0
- package/es/project-schema/v3.13.1.js +1 -0
- package/es/project-schema/v3.14.0.js +1 -0
- package/es/project-schema/v3.15.0.js +1 -0
- package/es/refs.js +78 -1
- package/es/rewrite.js +59 -0
- package/es/schema-util.js +35 -121
- package/es/schemas/index.js +5 -3
- package/es/schemas/index.ts +6 -2
- package/es/schemas/project-schema/v3.14.0.json +2379 -0
- package/es/schemas/project-schema/v3.15.0.json +2359 -0
- package/es/schemas/project-schema.json +2 -1
- package/es/template-shapes/templates.js +56 -52
- package/es/template-shapes/types.js +8 -1
- package/es/types/utils.js +5 -0
- package/es/util/detect-cycles.js +2 -2
- package/es/util/index.js +2 -1
- package/es/util/merge.js +36 -0
- package/es/validate.js +2 -10
- 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/content-schema-transform.js +6 -6
- 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 +14 -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/migration/to/v3.15.0.d.ts +4 -0
- package/lib/migration/to/v3.15.0.d.ts.map +1 -0
- package/lib/migration/to/v3.15.0.js +18 -0
- package/lib/project-schema/index.d.ts +5 -1
- package/lib/project-schema/index.d.ts.map +1 -1
- package/lib/project-schema/index.js +45 -19
- package/lib/project-schema/latest.d.ts +164 -23
- 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/project-schema/v3.15.0.d.ts +1459 -0
- package/lib/project-schema/v3.15.0.d.ts.map +1 -0
- package/lib/project-schema/v3.15.0.js +5 -0
- package/lib/refs.d.ts +11 -2
- package/lib/refs.d.ts.map +1 -1
- package/lib/refs.js +83 -0
- package/lib/rewrite.d.ts +10 -0
- package/lib/rewrite.d.ts.map +1 -0
- package/lib/rewrite.js +69 -0
- package/lib/schema-util.d.ts +4 -16
- package/lib/schema-util.d.ts.map +1 -1
- package/lib/schema-util.js +41 -139
- package/lib/schemas/index.d.ts +2302 -2
- package/lib/schemas/index.d.ts.map +1 -1
- package/lib/schemas/index.js +25 -21
- package/lib/schemas/index.ts +6 -2
- package/lib/schemas/project-schema/v3.14.0.json +2379 -0
- package/lib/schemas/project-schema/v3.15.0.json +2359 -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 +63 -57
- 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 +4 -1
- package/lib/types/utils.d.ts.map +1 -1
- package/lib/types/utils.js +10 -1
- package/lib/util/detect-cycles.d.ts +1 -1
- package/lib/util/detect-cycles.js +2 -2
- package/lib/util/index.d.ts +1 -0
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +13 -0
- package/lib/util/merge.d.ts +5 -0
- package/lib/util/merge.d.ts.map +1 -0
- package/lib/util/merge.js +51 -0
- package/lib/validate.d.ts.map +1 -1
- package/lib/validate.js +3 -10
- package/package.json +4 -4
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
{"$ref": "https://schema.takeshape.io/project-schema/v3.12.0#"},
|
|
21
21
|
{"$ref": "https://schema.takeshape.io/project-schema/v3.12.1#"},
|
|
22
22
|
{"$ref": "https://schema.takeshape.io/project-schema/v3.12.2#"},
|
|
23
|
-
{"$ref": "https://schema.takeshape.io/project-schema/v3.13.0#"}
|
|
23
|
+
{"$ref": "https://schema.takeshape.io/project-schema/v3.13.0#"},
|
|
24
|
+
{"$ref": "https://schema.takeshape.io/project-schema/v3.15.0#"}
|
|
24
25
|
]
|
|
25
26
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { ObjectSchema, PropertySchema, Shape
|
|
1
|
+
import type { ObjectSchema, PropertySchema, Shape } from '../project-schema';
|
|
2
2
|
import type { ResolvedTemplate, TemplateContext } from './types';
|
|
3
|
+
import { TemplateVerbs } from './types';
|
|
3
4
|
export declare const TSGetArgs: (context: unknown, shape: Shape) => ResolvedTemplate;
|
|
4
5
|
export declare const TSGetSingletonArgs: (context: unknown, shape: Shape) => ResolvedTemplate;
|
|
5
6
|
export declare const TSListArgs: (context: TemplateContext, shape: Shape) => ResolvedTemplate;
|
|
@@ -21,10 +22,16 @@ export declare const termsProps: ObjectSchema;
|
|
|
21
22
|
export declare const ContentStructureInput: Shape;
|
|
22
23
|
export declare function getPaginatedListShape(context: unknown, shape: Shape): ResolvedTemplate;
|
|
23
24
|
export declare function getSearchResultsShape(context: unknown, shape: Shape): ResolvedTemplate;
|
|
24
|
-
export declare function rewriteSchema(shapeSchema: ShapeSchema): ShapeSchema;
|
|
25
25
|
export declare function getIDQueryArgs(templateName: string): (context: unknown, shape: Shape) => ResolvedTemplate;
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Construct a shape name used for a mutation input shape.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getMutationInputShapeName(verb: TemplateVerbs): (shapeName: string) => string;
|
|
30
|
+
/**
|
|
31
|
+
* Construct shapes for a mutation inputs, given source shape info.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getMutationArgs(templateName: string, verb: TemplateVerbs): ({ projectSchema }: TemplateContext, shape: Shape) => ResolvedTemplate;
|
|
34
|
+
export declare function getMutationResultType(verb: TemplateVerbs): (context: unknown, shape: Shape) => ResolvedTemplate;
|
|
28
35
|
export declare const commonSearchArgs: ObjectSchema;
|
|
29
36
|
export declare function getShapeListQueryArgs(templateName: string, legacyArgs: boolean): (context: TemplateContext, shape: Shape) => ResolvedTemplate;
|
|
30
37
|
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../src/template-shapes/templates.ts"],"names":[],"mappings":"AAAA,OA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S,KAAK,KAAG,gBAAgB,AAjQkB,CAAC;AAC9E,eAAO,MAAM,YAAY,YAgQN,OAAO,SAAS,KAAK,KAAG,gBAAgB,AAhQY,CAAC;AAExE,eAAO,MAAM,iBAAiB,OAU5B,CAAC;AAEH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAqB5D,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,YAMzB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,YAKxB,CAAC;AAEF,eAAO,MAAM,qBAAqB,OAsBjC,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG,gBAAgB,CAetF;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG,gBAAgB,CAmBtF;AAsBD,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,aAChC,OAAO,SAAS,KAAK,KAAG,gBAAgB,CAU1D;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,aAAa,eACxC,MAAM,YAG1B;AAaD;;GAEG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,uBAM9C,eAAe,SAAS,KAAK,KAAG,gBAAgB,CA6E1E;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,aAAa,aACtC,OAAO,SAAS,KAAK,KAAG,gBAAgB,CAiB1D;AAED,eAAO,MAAM,gBAAgB,EAAE,YAwB9B,CAAC;AAuBF,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,aAC5D,eAAe,SAAS,KAAK,KAAG,gBAAgB,CA0BlE"}
|
|
@@ -6,13 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.commonSearchProps = exports.commonSearchArgs = exports.UpdateResult = exports.UpdateArgs = exports.TSSearchSortInput = exports.TSSearchArgs = exports.TSListArgs = exports.TSGetSingletonArgs = exports.TSGetArgs = exports.SearchResults = exports.PaginatedList = exports.DuplicateResult = exports.DuplicateArgs = exports.DeleteResult = exports.DeleteArgs = exports.CreateResult = exports.CreateArgs = exports.ContentStructureInput = void 0;
|
|
7
7
|
exports.getIDQueryArgs = getIDQueryArgs;
|
|
8
8
|
exports.getMutationArgs = getMutationArgs;
|
|
9
|
+
exports.getMutationInputShapeName = getMutationInputShapeName;
|
|
9
10
|
exports.getMutationResultType = getMutationResultType;
|
|
10
11
|
exports.getPaginatedListShape = getPaginatedListShape;
|
|
11
12
|
exports.getSearchResultsShape = getSearchResultsShape;
|
|
12
13
|
exports.getShapeListQueryArgs = getShapeListQueryArgs;
|
|
13
|
-
exports.localeProps = void 0;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
exports.termsProps = exports.localeProps = void 0;
|
|
15
|
+
|
|
16
|
+
var _types = require("./types");
|
|
16
17
|
|
|
17
18
|
var _migration = require("../migration");
|
|
18
19
|
|
|
@@ -26,12 +27,12 @@ var _refs = require("../refs");
|
|
|
26
27
|
|
|
27
28
|
var _where = require("./where");
|
|
28
29
|
|
|
30
|
+
var _util2 = require("../util");
|
|
31
|
+
|
|
32
|
+
var _rewrite = require("../rewrite");
|
|
33
|
+
|
|
29
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
35
|
|
|
31
|
-
const CREATE = 'create';
|
|
32
|
-
const UPDATE = 'update';
|
|
33
|
-
const DELETE = 'delete';
|
|
34
|
-
const DUPLICATE = 'duplicate';
|
|
35
36
|
const TSGetArgs = getIDQueryArgs('TSGetArgs');
|
|
36
37
|
exports.TSGetArgs = TSGetArgs;
|
|
37
38
|
const TSGetSingletonArgs = getIDQueryArgs('TSGetSingletonArgs');
|
|
@@ -40,25 +41,25 @@ const TSListArgs = getShapeListQueryArgs('TSListArgs', true);
|
|
|
40
41
|
exports.TSListArgs = TSListArgs;
|
|
41
42
|
const TSSearchArgs = getShapeListQueryArgs('TSSearchArgs', false);
|
|
42
43
|
exports.TSSearchArgs = TSSearchArgs;
|
|
43
|
-
const CreateArgs = getMutationArgs('CreateArgs',
|
|
44
|
+
const CreateArgs = getMutationArgs('CreateArgs', _types.TemplateVerbs.Create);
|
|
44
45
|
exports.CreateArgs = CreateArgs;
|
|
45
|
-
const UpdateArgs = getMutationArgs('UpdateArgs',
|
|
46
|
+
const UpdateArgs = getMutationArgs('UpdateArgs', _types.TemplateVerbs.Update);
|
|
46
47
|
exports.UpdateArgs = UpdateArgs;
|
|
47
|
-
const DuplicateArgs = getMutationArgs('DuplicateArgs',
|
|
48
|
+
const DuplicateArgs = getMutationArgs('DuplicateArgs', _types.TemplateVerbs.Duplicate);
|
|
48
49
|
exports.DuplicateArgs = DuplicateArgs;
|
|
49
|
-
const DeleteArgs = getMutationArgs('DeleteArgs',
|
|
50
|
+
const DeleteArgs = getMutationArgs('DeleteArgs', _types.TemplateVerbs.Delete);
|
|
50
51
|
exports.DeleteArgs = DeleteArgs;
|
|
51
52
|
const PaginatedList = getPaginatedListShape;
|
|
52
53
|
exports.PaginatedList = PaginatedList;
|
|
53
54
|
const SearchResults = getSearchResultsShape;
|
|
54
55
|
exports.SearchResults = SearchResults;
|
|
55
|
-
const CreateResult = getMutationResultType(
|
|
56
|
+
const CreateResult = getMutationResultType(_types.TemplateVerbs.Create);
|
|
56
57
|
exports.CreateResult = CreateResult;
|
|
57
|
-
const UpdateResult = getMutationResultType(
|
|
58
|
+
const UpdateResult = getMutationResultType(_types.TemplateVerbs.Update);
|
|
58
59
|
exports.UpdateResult = UpdateResult;
|
|
59
|
-
const DuplicateResult = getMutationResultType(
|
|
60
|
+
const DuplicateResult = getMutationResultType(_types.TemplateVerbs.Duplicate);
|
|
60
61
|
exports.DuplicateResult = DuplicateResult;
|
|
61
|
-
const DeleteResult = getMutationResultType(
|
|
62
|
+
const DeleteResult = getMutationResultType(_types.TemplateVerbs.Delete);
|
|
62
63
|
exports.DeleteResult = DeleteResult;
|
|
63
64
|
const TSSearchSortInput = (0, _schemaUtil.createShape)('TSSearchSortInput', {
|
|
64
65
|
type: 'object',
|
|
@@ -213,31 +214,11 @@ const idSchema = {
|
|
|
213
214
|
required: ['_id']
|
|
214
215
|
};
|
|
215
216
|
|
|
216
|
-
function rewriteSchema(shapeSchema) {
|
|
217
|
-
return JSON.parse(JSON.stringify(shapeSchema), (key, value) => {
|
|
218
|
-
if (typeof value === 'object') {
|
|
219
|
-
var _value$required;
|
|
220
|
-
|
|
221
|
-
// Remove required
|
|
222
|
-
if ((_value$required = value.required) !== null && _value$required !== void 0 && _value$required.length) {
|
|
223
|
-
delete value.required;
|
|
224
|
-
} // Remove default
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
if (value.type !== undefined && value.default !== undefined) {
|
|
228
|
-
delete value.default;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
return value;
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
|
|
236
217
|
function getIDQueryArgs(templateName) {
|
|
237
218
|
return (context, shape) => {
|
|
238
219
|
var _shape$model;
|
|
239
220
|
|
|
240
|
-
const schema = ((_shape$model = shape.model) === null || _shape$model === void 0 ? void 0 : _shape$model.type) !== 'single' ? (0,
|
|
221
|
+
const schema = ((_shape$model = shape.model) === null || _shape$model === void 0 ? void 0 : _shape$model.type) !== 'single' ? (0, _util2.mergeSchemaProperties)(idSchema, localeProps) : localeProps;
|
|
241
222
|
const shapeName = (0, _refs.getFlattenedTemplateShapeName)(shape.name, templateName);
|
|
242
223
|
return {
|
|
243
224
|
shapeName,
|
|
@@ -247,29 +228,53 @@ function getIDQueryArgs(templateName) {
|
|
|
247
228
|
};
|
|
248
229
|
};
|
|
249
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* Construct a shape name used for a mutation input shape.
|
|
233
|
+
*/
|
|
250
234
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}
|
|
235
|
+
|
|
236
|
+
function getMutationInputShapeName(verb) {
|
|
237
|
+
return shapeName => {
|
|
238
|
+
return (0, _util.pascalCase)([verb, shapeName, 'input']);
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Create a shape name variant for an input. Updates will typically want a partial input.
|
|
244
|
+
*/
|
|
245
|
+
function getInputShapeName(shapeName, {
|
|
246
|
+
isPartial
|
|
247
|
+
}) {
|
|
248
|
+
return isPartial ? `${shapeName}PartialInput` : `${shapeName}Input`;
|
|
256
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* Construct shapes for a mutation inputs, given source shape info.
|
|
252
|
+
*/
|
|
253
|
+
|
|
257
254
|
|
|
258
255
|
function getMutationArgs(templateName, verb) {
|
|
256
|
+
const getShapeName = getMutationInputShapeName(verb);
|
|
257
|
+
const addLocale = verb === _types.TemplateVerbs.Update || verb === _types.TemplateVerbs.Duplicate;
|
|
258
|
+
const addStructure = verb === _types.TemplateVerbs.Update;
|
|
259
|
+
const isUpdate = verb === _types.TemplateVerbs.Update || verb === _types.TemplateVerbs.Duplicate;
|
|
259
260
|
return ({
|
|
260
261
|
projectSchema
|
|
261
262
|
}, shape) => {
|
|
262
|
-
const
|
|
263
|
-
const addStructure = verb === UPDATE;
|
|
264
|
-
const inputName = (0, _util.pascalCase)([verb, shape.name, 'input']);
|
|
263
|
+
const inputName = getShapeName(shape.name);
|
|
265
264
|
const isSingleton = shape.model && shape.model.type === 'single';
|
|
266
|
-
const
|
|
267
|
-
const
|
|
268
|
-
|
|
265
|
+
const shouldRequireId = !isSingleton && (verb === _types.TemplateVerbs.Update || verb === _types.TemplateVerbs.Delete || verb === _types.TemplateVerbs.Duplicate);
|
|
266
|
+
const rewrittenSchema = verb !== _types.TemplateVerbs.Delete ? (0, _rewrite.rewriteSchema)(shape.schema, isUpdate ? {
|
|
267
|
+
removeDefault: true,
|
|
268
|
+
removeRequired: true,
|
|
269
|
+
replaceInput: true
|
|
270
|
+
} : {
|
|
271
|
+
replaceInput: true
|
|
272
|
+
}) : undefined;
|
|
273
|
+
const inputShape = (0, _schemaUtil.createShape)(inputName, (0, _util2.mergeObjectSchemas)(shouldRequireId ? idSchema : undefined, rewrittenSchema), {
|
|
269
274
|
description: `${verb} ${shape.name} input`
|
|
270
275
|
});
|
|
271
276
|
const argsShapeName = (0, _refs.getFlattenedTemplateShapeName)(shape.name, templateName);
|
|
272
|
-
const argsShape = (0, _schemaUtil.createShape)(argsShapeName, mergeObjectSchemas({
|
|
277
|
+
const argsShape = (0, _schemaUtil.createShape)(argsShapeName, (0, _util2.mergeObjectSchemas)({
|
|
273
278
|
type: 'object',
|
|
274
279
|
properties: {
|
|
275
280
|
input: {
|
|
@@ -281,15 +286,12 @@ function getMutationArgs(templateName, verb) {
|
|
|
281
286
|
},
|
|
282
287
|
required: ['input']
|
|
283
288
|
}, addStructure ? contentStructureFields : undefined, addLocale ? localeProps : undefined));
|
|
284
|
-
|
|
285
|
-
const getInputShapeName = shapeName => isUpdate ? `${shapeName}PartialInput` : `${shapeName}Input`;
|
|
286
|
-
|
|
287
289
|
return {
|
|
288
290
|
shapeName: argsShapeName,
|
|
289
291
|
dependencies: {
|
|
290
292
|
[inputName]: inputShape,
|
|
291
293
|
[argsShapeName]: argsShape,
|
|
292
|
-
...(verb !==
|
|
294
|
+
...(verb !== _types.TemplateVerbs.Delete && (0, _keyBy.default)((0, _schemaUtil.getShapeDependencies)(projectSchema, shape, propSchema => {
|
|
293
295
|
if (!propSchema['@resolver']) {
|
|
294
296
|
return false;
|
|
295
297
|
}
|
|
@@ -297,17 +299,21 @@ function getMutationArgs(templateName, verb) {
|
|
|
297
299
|
const shapeName = (0, _refs.getRefShapeName)(projectSchema, propSchema);
|
|
298
300
|
|
|
299
301
|
if (shapeName) {
|
|
300
|
-
return shapeName !== 'TSRelationship' && !projectSchema.shapes[getInputShapeName(shapeName
|
|
302
|
+
return shapeName !== 'TSRelationship' && !projectSchema.shapes[getInputShapeName(shapeName, {
|
|
303
|
+
isPartial: isUpdate
|
|
304
|
+
})];
|
|
301
305
|
}
|
|
302
306
|
|
|
303
307
|
return true;
|
|
304
308
|
}).map(shapeName => {
|
|
305
309
|
const shape = projectSchema.shapes[shapeName];
|
|
306
|
-
const name = getInputShapeName(shapeName
|
|
310
|
+
const name = getInputShapeName(shapeName, {
|
|
311
|
+
isPartial: isUpdate
|
|
312
|
+
});
|
|
307
313
|
return { ...shape,
|
|
308
314
|
name,
|
|
309
315
|
id: name,
|
|
310
|
-
schema:
|
|
316
|
+
schema: rewrittenSchema
|
|
311
317
|
};
|
|
312
318
|
}), 'name')),
|
|
313
319
|
...(addStructure ? {
|
|
@@ -321,7 +327,7 @@ function getMutationArgs(templateName, verb) {
|
|
|
321
327
|
function getMutationResultType(verb) {
|
|
322
328
|
return (context, shape) => {
|
|
323
329
|
const shapeName = (0, _util.pascalCase)([verb, shape.name, 'result']);
|
|
324
|
-
const result = verb ===
|
|
330
|
+
const result = verb === _types.TemplateVerbs.Delete ? {
|
|
325
331
|
type: 'boolean'
|
|
326
332
|
} : {
|
|
327
333
|
'@ref': `local:${shape.name}`
|
|
@@ -427,7 +433,7 @@ function getShapeListQueryArgs(templateName, legacyArgs) {
|
|
|
427
433
|
shapeName,
|
|
428
434
|
dependencies: { ...dependencies,
|
|
429
435
|
TSSearchSortInput,
|
|
430
|
-
[shapeName]: (0, _schemaUtil.createShape)(shapeName, mergeObjectSchemas(commonSearchArgs, localeProps, legacyArgs ? legacyListArgs : undefined, isAllShapes ? shapeFilterProps : undefined, schema))
|
|
436
|
+
[shapeName]: (0, _schemaUtil.createShape)(shapeName, (0, _util2.mergeObjectSchemas)(commonSearchArgs, localeProps, legacyArgs ? legacyListArgs : undefined, isAllShapes ? shapeFilterProps : undefined, schema))
|
|
431
437
|
}
|
|
432
438
|
};
|
|
433
439
|
};
|
|
@@ -7,4 +7,10 @@ export interface TemplateContext {
|
|
|
7
7
|
projectSchema: ProjectSchema;
|
|
8
8
|
}
|
|
9
9
|
export declare type TemplateShapeFactory = (context: TemplateContext, shape: Shape) => ResolvedTemplate;
|
|
10
|
+
export declare const enum TemplateVerbs {
|
|
11
|
+
Create = "create",
|
|
12
|
+
Update = "update",
|
|
13
|
+
Duplicate = "duplicate",
|
|
14
|
+
Delete = "delete"
|
|
15
|
+
}
|
|
10
16
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/template-shapes/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAEjE,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,QAAQ,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,oBAAY,oBAAoB,GAAG,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,KAAK,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/template-shapes/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAEjE,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,QAAQ,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,oBAAY,oBAAoB,GAAG,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,KAAK,gBAAgB,CAAC;AAEhG,0BAAkB,aAAa;IAC7B,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,MAAM,WAAW;CAClB"}
|
|
@@ -2,4 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
|
-
});
|
|
5
|
+
});
|
|
6
|
+
exports.TemplateVerbs = void 0;
|
|
7
|
+
let TemplateVerbs;
|
|
8
|
+
exports.TemplateVerbs = TemplateVerbs;
|
|
9
|
+
|
|
10
|
+
(function (TemplateVerbs) {
|
|
11
|
+
TemplateVerbs["Create"] = "create";
|
|
12
|
+
TemplateVerbs["Update"] = "update";
|
|
13
|
+
TemplateVerbs["Duplicate"] = "duplicate";
|
|
14
|
+
TemplateVerbs["Delete"] = "delete";
|
|
15
|
+
})(TemplateVerbs || (exports.TemplateVerbs = TemplateVerbs = {}));
|
package/lib/types/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SetRequired, Merge, PartialDeep } from 'type-fest';
|
|
2
|
-
import type { ProjectSchema, ProjectSchemaV3_0_0, ProjectSchemaV3_1_0, ProjectSchemaV3_2_0, ProjectSchemaV3_3_0, ProjectSchemaV3_4_0, ProjectSchemaV3_5_0, ProjectSchemaV3_5_1, ProjectSchemaV3_6_0, ProjectSchemaV3_7_0, ProjectSchemaV3_8_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, Query, PropertySchema, StoredServiceMap, ServiceConfig, OAuth2Authentication, CustomAuthentication, ServiceAuthentication } from '../project-schema';
|
|
2
|
+
import type { ProjectSchema, ProjectSchemaV3_0_0, ProjectSchemaV3_1_0, ProjectSchemaV3_2_0, ProjectSchemaV3_3_0, ProjectSchemaV3_4_0, ProjectSchemaV3_5_0, ProjectSchemaV3_5_1, ProjectSchemaV3_6_0, ProjectSchemaV3_7_0, ProjectSchemaV3_8_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, Query, PropertySchema, StoredServiceMap, ServiceConfig, OAuth2Authentication, CustomAuthentication, ServiceAuthentication } from '../project-schema';
|
|
3
3
|
import type { Overwrite } from '@takeshape/util';
|
|
4
4
|
import { SERVICE_OBJECT_PATTERN_NAME } from '../schema-util';
|
|
5
5
|
/**
|
|
@@ -7,7 +7,7 @@ import { SERVICE_OBJECT_PATTERN_NAME } from '../schema-util';
|
|
|
7
7
|
* only type used in most runtime code. Updating this to a new version should
|
|
8
8
|
* trigger type errors that clue you in to code that needs review.
|
|
9
9
|
*/
|
|
10
|
-
export declare type ProjectSchemaV3X = ProjectSchemaV3_13_0 | ProjectSchemaV3_12_3 | ProjectSchemaV3_12_2 | ProjectSchemaV3_12_1 | ProjectSchemaV3_12_0 | ProjectSchemaV3_11_0 | ProjectSchemaV3_10_0 | ProjectSchemaV3_9_0 | ProjectSchemaV3_8_0 | ProjectSchemaV3_7_0 | ProjectSchemaV3_6_0 | ProjectSchemaV3_5_1 | ProjectSchemaV3_5_0 | ProjectSchemaV3_4_0 | ProjectSchemaV3_3_0 | ProjectSchemaV3_2_0 | ProjectSchemaV3_1_0 | ProjectSchemaV3_0_0;
|
|
10
|
+
export declare type ProjectSchemaV3X = ProjectSchemaV3_15_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 | ProjectSchemaV3_8_0 | ProjectSchemaV3_7_0 | ProjectSchemaV3_6_0 | ProjectSchemaV3_5_1 | ProjectSchemaV3_5_0 | ProjectSchemaV3_4_0 | ProjectSchemaV3_3_0 | ProjectSchemaV3_2_0 | ProjectSchemaV3_1_0 | ProjectSchemaV3_0_0;
|
|
11
11
|
export interface Content {
|
|
12
12
|
[name: string]: any;
|
|
13
13
|
_id: string;
|
package/lib/types/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAE,KAAK,EAAE,WAAW,EAAC,MAAM,WAAW,CAAC;AAC/D,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,EACL,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAC,2BAA2B,EAAC,MAAM,gBAAgB,CAAC;AAE3D;;;;GAIG;AACH,oBAAY,gBAAgB,GACxB,oBAAoB,GACpB,oBAAoB,GACpB,oBAAoB,GACpB,oBAAoB,GACpB,oBAAoB,GACpB,oBAAoB,GACpB,oBAAoB,GACpB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,CAAC;AAExB,MAAM,WAAW,OAAO;IACtB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,WAAW;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mB,GAAG,WAAW,CAC3C,WAAW,CAAC,2CAA2C,CAAC,EACxD,oBAAoB,CACrB,CAAC;AAEF,MAAM,WAAW,+BAAgC,SAAQ,aAAa;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,gBAAgB,CAAC;CAC5B;AAED;;GAEG;AACH,oBAAY,OAAO;IACjB,MAAM,SAAS;IACf,IAAI,SAAS;CACd;AAED;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC;IAClE,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,oBAAY,aAAa,GAAG,cAAc,GAAG,aAAa,CAAC;AAE3D;;GAEG;AACH,oBAAY,QAAQ;IAClB,OAAO,UAAU;IACjB,IAAI,SAAS;CACd;AAED,oBAAY,cAAc,GAAG,cAAc,GAAG,KAAK,CAAC;AAEpD;;GAEG;AACH,oBAAY,kBAAkB,GAAG,MAAM,CAAC;AACxC,oBAAY,kBAAkB,GAAG,CAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC;AACtE,oBAAY,sBAAsB,GAAG,kBAAkB,EAAE,CAAC;AAE1D,oBAAY,oBAAoB,GAAG,SAAS,CAC1C,aAAa,EACb;IACE,WAAW,EAAE,SAAS,CAAC;IACvB,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CACF,CAAC;AAEF,oBAAY,UAAU,GAAG,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC"}
|
package/lib/types/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnyProjectSchema, ProjectSchema, ProjectSchemaV1_0_0, ProjectSchemaV3_0_0, ProjectSchemaV3_1_0, ProjectSchemaV3_2_0, ProjectSchemaV3_3_0, ProjectSchemaV3_4_0, ProjectSchemaV3_5_0, ProjectSchemaV3_5_1, ProjectSchemaV3_6_0, ProjectSchemaV3_7_0, ProjectSchemaV3_8_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, DirectiveMappingArray, DirectiveMappingMap, DirectiveConfig, ParameterSerializeOptions, ParameterSerializeContentOptions, ParameterSerializeStyleOptions, BasicResolver, ComposeResolver, GraphqlResolver, TakeshapeResolver, RestResolver, AwsLambdaResolver, UtilResolver, ObjectSchema, ReturnShapeArraySchema, ShapeSchemaEnum, RefSchema, RefSchemaLegacy, PropertySchema, AnyServiceConfig, ServiceAuthentication, BearerAuthentication, BasicAuthentication, OAuth2Authentication, OAuth2BearerAuthentication, SearchParamsAuthentication, CustomAuthentication, ParameterOp, ParameterOpNested, ParameterOpMapping, ParameterOpValue, ParameterOpOp, ParameterSerializeStyleOptionsForSearchParams, ParameterSerializeStyleOptionsForPathParams, OneOfSchema, AllOfSchema } from '../project-schema';
|
|
1
|
+
import type { AnyProjectSchema, ProjectSchema, ProjectSchemaV1_0_0, ProjectSchemaV3_0_0, ProjectSchemaV3_1_0, ProjectSchemaV3_2_0, ProjectSchemaV3_3_0, ProjectSchemaV3_4_0, ProjectSchemaV3_5_0, ProjectSchemaV3_5_1, ProjectSchemaV3_6_0, ProjectSchemaV3_7_0, ProjectSchemaV3_8_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, DirectiveMappingArray, DirectiveMappingMap, DirectiveConfig, ParameterSerializeOptions, ParameterSerializeContentOptions, ParameterSerializeStyleOptions, BasicResolver, ComposeResolver, GraphqlResolver, TakeshapeResolver, RestResolver, AwsLambdaResolver, UtilResolver, ObjectSchema, ReturnShapeArraySchema, ShapeSchemaEnum, RefSchema, RefSchemaLegacy, PropertySchema, AnyServiceConfig, ServiceAuthentication, BearerAuthentication, BasicAuthentication, OAuth2Authentication, OAuth2BearerAuthentication, SearchParamsAuthentication, CustomAuthentication, ParameterOp, ParameterOpNested, ParameterOpMapping, ParameterOpValue, ParameterOpOp, ParameterSerializeStyleOptionsForSearchParams, ParameterSerializeStyleOptionsForPathParams, OneOfSchema, AllOfSchema, ExtendsSchema } from '../project-schema';
|
|
2
2
|
import type { Maybe } from '@takeshape/util';
|
|
3
3
|
import type { ShopifyServiceConfig, RESTServiceConfig, GraphQLServiceConfig, OpenAPIServiceConfig, EncryptedServiceConfig, SchemaWithArgs, SchemaWithRef, ServiceConfigWithOAuth2Authentication, ServiceConfigWithCustomAuthentication, LatestProjectSchemaWithServices, ProjectSchemaV3X } from './types';
|
|
4
4
|
import { ArgsType, RefType } from './types';
|
|
@@ -33,6 +33,8 @@ export declare const isProjectSchemaV3_12_1: (projectSchema: AnyProjectSchema) =
|
|
|
33
33
|
export declare const isProjectSchemaV3_12_2: (projectSchema: AnyProjectSchema) => projectSchema is ProjectSchemaV3_12_2;
|
|
34
34
|
export declare const isProjectSchemaV3_12_3: (projectSchema: AnyProjectSchema) => projectSchema is ProjectSchemaV3_12_3;
|
|
35
35
|
export declare const isProjectSchemaV3_13_0: (projectSchema: AnyProjectSchema) => projectSchema is ProjectSchemaV3_13_0;
|
|
36
|
+
export declare const isProjectSchemaV3_14_0: (projectSchema: AnyProjectSchema) => projectSchema is ProjectSchemaV3_14_0;
|
|
37
|
+
export declare const isProjectSchemaV3_15_0: (projectSchema: AnyProjectSchema) => projectSchema is ProjectSchemaV3_13_0;
|
|
36
38
|
export declare const isLatestProjectSchema: (projectSchema: AnyProjectSchema) => projectSchema is ProjectSchema;
|
|
37
39
|
export declare function isV1XSchema(maybeSchema: unknown): maybeSchema is ProjectSchemaV1_0_0;
|
|
38
40
|
export declare function isV3XSchema(maybeSchema: unknown): maybeSchema is ProjectSchemaV3X;
|
|
@@ -88,6 +90,7 @@ export declare function isParameterSerializeStyleOptions(maybeStyle: ParameterSe
|
|
|
88
90
|
export declare function isRefSchema(propertySchema: PropertySchema): propertySchema is RefSchema | RefSchemaLegacy;
|
|
89
91
|
export declare function isRefSchemaLegacy(propertySchema: PropertySchema): propertySchema is RefSchemaLegacy;
|
|
90
92
|
export declare function isAllOfSchema(propertySchema: PropertySchema): propertySchema is AllOfSchema;
|
|
93
|
+
export declare function isExtendsSchema(propertySchema: PropertySchema): propertySchema is ExtendsSchema;
|
|
91
94
|
export declare function isOneOfSchema(propertySchema: PropertySchema): propertySchema is OneOfSchema;
|
|
92
95
|
export declare function isEnumSchema(obj: PropertySchema): obj is ShapeSchemaEnum;
|
|
93
96
|
export declare function isArraySchema(propertySchema: PropertySchema): propertySchema is ReturnShapeArraySchema;
|
package/lib/types/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/types/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,yBAAyB,EACzB,gCAAgC,EAChC,8BAA8B,EAC9B,aAAa,EACb,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACtB,eAAe,EACf,SAAS,EACT,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,0BAA0B,EAC1B,0BAA0B,EAC1B,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,6CAA6C,EAC7C,2CAA2C,EAC3C,WAAW,EACX,WAAW,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/types/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,yBAAyB,EACzB,gCAAgC,EAChC,8BAA8B,EAC9B,aAAa,EACb,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACtB,eAAe,EACf,SAAS,EACT,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,0BAA0B,EAC1B,0BAA0B,EAC1B,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,6CAA6C,EAC7C,2CAA2C,EAC3C,WAAW,EACX,WAAW,EACX,aAAa,EACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AAE3C,OAAO,KAAK,EACV,oBAAoB,E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B,EAAE,GAAG,GACtB,kBAAkB,IAAI,qCAAqC,CAM7D;AAED,4BAA4B;AAE5B,wBAAgB,uBAAuB,CAAC,mBAAmB,EAAE,GAAG,GAAG,mBAAmB,IAAI,qBAAqB,CAE9G;AAED,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,qBAAqB,GAAG,cAAc,IAAI,oBAAoB,CAEpH;AAED,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,qBAAqB,GAAG,cAAc,IAAI,mBAAmB,CAElH;AAED,wBAAgB,4BAA4B,CAC1C,cAAc,EAAE,qBAAqB,GACpC,cAAc,IAAI,0BAA0B,CAE9C;AAED,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,qBAAqB,GAAG,cAAc,IAAI,oBAAoB,CAEpH;AAED,wBAAgB,4BAA4B,CAC1C,cAAc,EAAE,qBAAqB,GACpC,cAAc,IAAI,0BAA0B,CAE9C;AAED,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,qBAAqB,GAAG,cAAc,IAAI,oBAAoB,CAEpH;AAED,2BAA2B;AAE3B;;;;GAIG;AACH,eAAO,MAAM,WAAW,eAAgB,cAAc,KAAG,MAAM,QAAQ,CAQtE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,cAAe,aAAa,KAAG,MAAM,OAAO,CAQlE,CAAC"}
|
package/lib/types/utils.js
CHANGED
|
@@ -19,6 +19,7 @@ exports.isDirectiveMappingArray = isDirectiveMappingArray;
|
|
|
19
19
|
exports.isDirectiveMappingMap = isDirectiveMappingMap;
|
|
20
20
|
exports.isEncryptedServiceConfig = isEncryptedServiceConfig;
|
|
21
21
|
exports.isEnumSchema = isEnumSchema;
|
|
22
|
+
exports.isExtendsSchema = isExtendsSchema;
|
|
22
23
|
exports.isGraphQLServiceConfig = isGraphQLServiceConfig;
|
|
23
24
|
exports.isGraphqlResolver = isGraphqlResolver;
|
|
24
25
|
exports.isLatestProjectSchema = void 0;
|
|
@@ -36,7 +37,7 @@ exports.isParameterSerializeContentOptions = isParameterSerializeContentOptions;
|
|
|
36
37
|
exports.isParameterSerializeStyleForPathParams = isParameterSerializeStyleForPathParams;
|
|
37
38
|
exports.isParameterSerializeStyleForSearchParams = isParameterSerializeStyleForSearchParams;
|
|
38
39
|
exports.isParameterSerializeStyleOptions = isParameterSerializeStyleOptions;
|
|
39
|
-
exports.isProjectSchemaV3_9 = exports.isProjectSchemaV3_8 = exports.isProjectSchemaV3_7 = exports.isProjectSchemaV3_6 = exports.isProjectSchemaV3_5_1 = exports.isProjectSchemaV3_5 = exports.isProjectSchemaV3_4 = exports.isProjectSchemaV3_3 = exports.isProjectSchemaV3_2 = exports.isProjectSchemaV3_13_0 = exports.isProjectSchemaV3_12_3 = exports.isProjectSchemaV3_12_2 = exports.isProjectSchemaV3_12_1 = exports.isProjectSchemaV3_12 = exports.isProjectSchemaV3_11 = exports.isProjectSchemaV3_10 = exports.isProjectSchemaV3_1 = exports.isProjectSchemaV3 = exports.isProjectSchemaV1 = void 0;
|
|
40
|
+
exports.isProjectSchemaV3_9 = exports.isProjectSchemaV3_8 = exports.isProjectSchemaV3_7 = exports.isProjectSchemaV3_6 = exports.isProjectSchemaV3_5_1 = exports.isProjectSchemaV3_5 = exports.isProjectSchemaV3_4 = exports.isProjectSchemaV3_3 = exports.isProjectSchemaV3_2 = exports.isProjectSchemaV3_15_0 = exports.isProjectSchemaV3_14_0 = exports.isProjectSchemaV3_13_0 = exports.isProjectSchemaV3_12_3 = exports.isProjectSchemaV3_12_2 = exports.isProjectSchemaV3_12_1 = exports.isProjectSchemaV3_12 = exports.isProjectSchemaV3_11 = exports.isProjectSchemaV3_10 = exports.isProjectSchemaV3_1 = exports.isProjectSchemaV3 = exports.isProjectSchemaV1 = void 0;
|
|
40
41
|
exports.isProjectSchemaWithServices = isProjectSchemaWithServices;
|
|
41
42
|
exports.isRESTServiceConfig = isRESTServiceConfig;
|
|
42
43
|
exports.isRefSchema = isRefSchema;
|
|
@@ -167,6 +168,10 @@ const isProjectSchemaV3_12_3 = createVersionPredicate('3.12.3');
|
|
|
167
168
|
exports.isProjectSchemaV3_12_3 = isProjectSchemaV3_12_3;
|
|
168
169
|
const isProjectSchemaV3_13_0 = createVersionPredicate('3.13.0');
|
|
169
170
|
exports.isProjectSchemaV3_13_0 = isProjectSchemaV3_13_0;
|
|
171
|
+
const isProjectSchemaV3_14_0 = createVersionPredicate('3.14.0');
|
|
172
|
+
exports.isProjectSchemaV3_14_0 = isProjectSchemaV3_14_0;
|
|
173
|
+
const isProjectSchemaV3_15_0 = createVersionPredicate('3.15.0');
|
|
174
|
+
exports.isProjectSchemaV3_15_0 = isProjectSchemaV3_15_0;
|
|
170
175
|
const isLatestProjectSchema = createVersionPredicate(_schemas.CURRENT_SCHEMA_VERSION);
|
|
171
176
|
exports.isLatestProjectSchema = isLatestProjectSchema;
|
|
172
177
|
|
|
@@ -323,6 +328,10 @@ function isAllOfSchema(propertySchema) {
|
|
|
323
328
|
return (0, _isArray.default)(propertySchema.allOf);
|
|
324
329
|
}
|
|
325
330
|
|
|
331
|
+
function isExtendsSchema(propertySchema) {
|
|
332
|
+
return (0, _isArray.default)(propertySchema.extends);
|
|
333
|
+
}
|
|
334
|
+
|
|
326
335
|
function isOneOfSchema(propertySchema) {
|
|
327
336
|
return (0, _isArray.default)(propertySchema.oneOf);
|
|
328
337
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ProjectSchema, PropertySchema } from '../project-schema';
|
|
2
2
|
/**
|
|
3
|
-
* Use a basic depth-first search to
|
|
3
|
+
* Use a basic depth-first search to determine whether a schema contains a cycle
|
|
4
4
|
*/
|
|
5
5
|
export declare function hasCycle(projectSchema: ProjectSchema, schema: PropertySchema, shapesSeen?: Set<string>): boolean;
|
|
6
6
|
//# sourceMappingURL=detect-cycles.d.ts.map
|
|
@@ -13,7 +13,7 @@ function immutableSetAdd(set, str) {
|
|
|
13
13
|
return result;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Use a basic depth-first search to
|
|
16
|
+
* Use a basic depth-first search to determine whether a schema contains a cycle
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
|
|
@@ -34,7 +34,7 @@ function hasCycle(projectSchema, schema, shapesSeen = new Set()) {
|
|
|
34
34
|
return hasCycle(projectSchema, refShape.schema, immutableSetAdd(shapesSeen, refShape.name));
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const combo = schema.oneOf ?? schema.allOf;
|
|
37
|
+
const combo = schema.oneOf ?? schema.allOf ?? schema.extends;
|
|
38
38
|
|
|
39
39
|
if (combo) {
|
|
40
40
|
return combo.some(childSchema => hasCycle(projectSchema, childSchema, shapesSeen));
|
package/lib/util/index.d.ts
CHANGED
package/lib/util/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC"}
|
package/lib/util/index.js
CHANGED
|
@@ -15,4 +15,17 @@ Object.keys(_detectCycles).forEach(function (key) {
|
|
|
15
15
|
return _detectCycles[key];
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
var _merge = require("./merge");
|
|
21
|
+
|
|
22
|
+
Object.keys(_merge).forEach(function (key) {
|
|
23
|
+
if (key === "default" || key === "__esModule") return;
|
|
24
|
+
if (key in exports && exports[key] === _merge[key]) return;
|
|
25
|
+
Object.defineProperty(exports, key, {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _merge[key];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
18
31
|
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FormConfig, ObjectSchema } from '../project-schema';
|
|
2
|
+
export declare function mergeObjectSchemas(...args: Array<ObjectSchema | undefined>): ObjectSchema;
|
|
3
|
+
export declare function mergeSchemaProperties(base: ObjectSchema, overrides: ObjectSchema): ObjectSchema;
|
|
4
|
+
export declare function mergeFormProperties(base: FormConfig, overrides: FormConfig): FormConfig;
|
|
5
|
+
//# sourceMappingURL=merge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../src/util/merge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAI3D,wBAAgB,kBAAkB,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,SAAS,CAAC,GAAG,YAAY,CAEzF;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,GAAG,YAAY,CAgB/F;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,GAAG,UAAU,CAevF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.mergeFormProperties = mergeFormProperties;
|
|
7
|
+
exports.mergeObjectSchemas = mergeObjectSchemas;
|
|
8
|
+
exports.mergeSchemaProperties = mergeSchemaProperties;
|
|
9
|
+
|
|
10
|
+
var _util = require("@takeshape/util");
|
|
11
|
+
|
|
12
|
+
var _union = _interopRequireDefault(require("lodash/union"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
function mergeObjectSchemas(...args) {
|
|
17
|
+
return args.filter(_util.isDefined).reduce(mergeSchemaProperties, {
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function mergeSchemaProperties(base, overrides) {
|
|
24
|
+
const result = { ...base,
|
|
25
|
+
properties: { ...base.properties,
|
|
26
|
+
...overrides.properties
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const required = (0, _union.default)(base.required, overrides.required);
|
|
30
|
+
|
|
31
|
+
if (required.length) {
|
|
32
|
+
result.required = required;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function mergeFormProperties(base, overrides) {
|
|
39
|
+
const result = { ...base,
|
|
40
|
+
properties: { ...base.properties,
|
|
41
|
+
...overrides.properties
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const order = (0, _union.default)(base.order, overrides.order);
|
|
45
|
+
|
|
46
|
+
if (order.length) {
|
|
47
|
+
result.order = order;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return result;
|
|
51
|
+
}
|
package/lib/validate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,WAAW,EAAC,MAAM,KAAK,CAAC;AACvD,OAAO,KAAK,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAE1D,OAAO,KAAK,EAEV,gBAAgB,EAChB,aAAa,EASb,iBAAiB,EAIlB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAwB,yBAAyB,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,WAAW,EAAC,MAAM,KAAK,CAAC;AACvD,OAAO,KAAK,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAE1D,OAAO,KA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AqBD;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,OAAO,GAAG,gBAAgB,CASlF"}
|
package/lib/validate.js
CHANGED
|
@@ -52,6 +52,8 @@ var _enum = require("./enum");
|
|
|
52
52
|
|
|
53
53
|
var _metaSchemaV = _interopRequireDefault(require("./schemas/project-schema/meta-schema-v3.9.0.json"));
|
|
54
54
|
|
|
55
|
+
var _util = require("@takeshape/util");
|
|
56
|
+
|
|
55
57
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
56
58
|
|
|
57
59
|
function findDuplicates(items) {
|
|
@@ -377,22 +379,13 @@ function getModelShapeIds(shapes) {
|
|
|
377
379
|
}
|
|
378
380
|
|
|
379
381
|
const builtInModelShapeIds = getModelShapeIds(_builtinSchema.builtInShapes);
|
|
380
|
-
|
|
381
|
-
function isNumberLike(value) {
|
|
382
|
-
if (typeof value === 'number') {
|
|
383
|
-
return true;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
return /^\d+$/.test(value);
|
|
387
|
-
}
|
|
388
382
|
/**
|
|
389
383
|
* Verify the path has an allOf schema and not just prop named "allOf"
|
|
390
384
|
*/
|
|
391
385
|
|
|
392
|
-
|
|
393
386
|
function isAllOfPath(path) {
|
|
394
387
|
const index = path.indexOf('allOf');
|
|
395
|
-
return index !== -1 &&
|
|
388
|
+
return index !== -1 && (0, _util.isIntegerLike)(path[index + 1]);
|
|
396
389
|
}
|
|
397
390
|
|
|
398
391
|
function validateRefs(projectSchema, additionalShapeNames = builtInShapeNames) {
|