@takeshape/schema 8.44.0 → 8.44.4
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.
|
@@ -166,25 +166,25 @@ const idSchema = {
|
|
|
166
166
|
},
|
|
167
167
|
required: ['_id']
|
|
168
168
|
};
|
|
169
|
-
|
|
170
|
-
function rewriteSchema(shapeSchema) {
|
|
169
|
+
export function rewriteSchema(shapeSchema) {
|
|
171
170
|
return JSON.parse(JSON.stringify(shapeSchema), (key, value) => {
|
|
172
|
-
|
|
171
|
+
if (typeof value === 'object') {
|
|
172
|
+
var _value$required;
|
|
173
173
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
174
|
+
// Remove required
|
|
175
|
+
if ((_value$required = value.required) !== null && _value$required !== void 0 && _value$required.length) {
|
|
176
|
+
delete value.required;
|
|
177
|
+
} // Remove default
|
|
178
178
|
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
if (value.type !== undefined && value.default !== undefined) {
|
|
181
|
+
delete value.default;
|
|
182
|
+
}
|
|
182
183
|
}
|
|
183
184
|
|
|
184
185
|
return value;
|
|
185
186
|
});
|
|
186
187
|
}
|
|
187
|
-
|
|
188
188
|
export function getIDQueryArgs(templateName) {
|
|
189
189
|
return (context, shape) => {
|
|
190
190
|
var _shape$model;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ObjectSchema, PropertySchema, Shape } from '../project-schema';
|
|
1
|
+
import type { ObjectSchema, PropertySchema, Shape, ShapeSchema } from '../project-schema';
|
|
2
2
|
import type { ResolvedTemplate, TemplateContext } from './types';
|
|
3
3
|
export declare const TSGetArgs: (context: unknown, shape: Shape) => ResolvedTemplate;
|
|
4
4
|
export declare const TSGetSingletonArgs: (context: unknown, shape: Shape) => ResolvedTemplate;
|
|
@@ -21,6 +21,7 @@ export declare const termsProps: ObjectSchema;
|
|
|
21
21
|
export declare const ContentStructureInput: Shape;
|
|
22
22
|
export declare function getPaginatedListShape(context: unknown, shape: Shape): ResolvedTemplate;
|
|
23
23
|
export declare function getSearchResultsShape(context: unknown, shape: Shape): ResolvedTemplate;
|
|
24
|
+
export declare function rewriteSchema(shapeSchema: ShapeSchema): ShapeSchema;
|
|
24
25
|
export declare function getIDQueryArgs(templateName: string): (context: unknown, shape: Shape) => ResolvedTemplate;
|
|
25
26
|
export declare function getMutationArgs(templateName: string, verb: string): ({ projectSchema }: TemplateContext, shape: Shape) => ResolvedTemplate;
|
|
26
27
|
export declare function getMutationResultType(verb: string): (context: unknown, shape: Shape) => ResolvedTemplate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../src/template-shapes/templates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,cAAc,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../src/template-shapes/templates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,EAAC,MAAM,mBAAmB,CAAC;AACxF,OAAO,KAAK,EAAC,gBAAgB,EAAE,eAAe,EAAC,MAAM,SAAS,CAAC;AAa/D,eAAO,MAAM,SAAS,YAsKH,OAAO,SAAS,KAAK,KAAG,gBAAgB,AAtKP,CAAC;AACrD,eAAO,MAAM,kBAAkB,YAqKZ,OAAO,SAAS,KAAK,KAAG,gBAAgB,AArKW,CAAC;AACvE,eAAO,MAAM,UAAU,YAkUJ,eAAe,SAAS,KAAK,KAAG,gBAAgB,AAlUA,CAAC;AACpE,eAAO,MAAM,YAAY,YAiUN,eAAe,SAAS,KAAK,KAAG,gBAAgB,AAjUK,CAAC;AACzE,eAAO,MAAM,UAAU,sBAmLI,eAAe,SAAS,KAAK,KAAG,gBAAgB,AAnLZ,CAAC;AAChE,eAAO,MAAM,UAAU,sBAkLI,eAAe,SAAS,KAAK,KAAG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,SAAS,KAAK,KAAG,gBAAgB,CAuE1E;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,aAC/B,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,CAuBlE"}
|
|
@@ -10,7 +10,9 @@ exports.getMutationResultType = getMutationResultType;
|
|
|
10
10
|
exports.getPaginatedListShape = getPaginatedListShape;
|
|
11
11
|
exports.getSearchResultsShape = getSearchResultsShape;
|
|
12
12
|
exports.getShapeListQueryArgs = getShapeListQueryArgs;
|
|
13
|
-
exports.
|
|
13
|
+
exports.localeProps = void 0;
|
|
14
|
+
exports.rewriteSchema = rewriteSchema;
|
|
15
|
+
exports.termsProps = void 0;
|
|
14
16
|
|
|
15
17
|
var _migration = require("../migration");
|
|
16
18
|
|
|
@@ -213,16 +215,18 @@ const idSchema = {
|
|
|
213
215
|
|
|
214
216
|
function rewriteSchema(shapeSchema) {
|
|
215
217
|
return JSON.parse(JSON.stringify(shapeSchema), (key, value) => {
|
|
216
|
-
|
|
218
|
+
if (typeof value === 'object') {
|
|
219
|
+
var _value$required;
|
|
217
220
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
221
|
+
// Remove required
|
|
222
|
+
if ((_value$required = value.required) !== null && _value$required !== void 0 && _value$required.length) {
|
|
223
|
+
delete value.required;
|
|
224
|
+
} // Remove default
|
|
222
225
|
|
|
223
226
|
|
|
224
|
-
|
|
225
|
-
|
|
227
|
+
if (value.type !== undefined && value.default !== undefined) {
|
|
228
|
+
delete value.default;
|
|
229
|
+
}
|
|
226
230
|
}
|
|
227
231
|
|
|
228
232
|
return value;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takeshape/schema",
|
|
3
|
-
"version": "8.44.
|
|
3
|
+
"version": "8.44.4",
|
|
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.44.
|
|
25
|
-
"@takeshape/json-schema": "8.44.
|
|
26
|
-
"@takeshape/util": "8.44.
|
|
24
|
+
"@takeshape/errors": "8.44.4",
|
|
25
|
+
"@takeshape/json-schema": "8.44.4",
|
|
26
|
+
"@takeshape/util": "8.44.4",
|
|
27
27
|
"ajv": "^7.0.4",
|
|
28
28
|
"ajv-formats": "^1.5.1",
|
|
29
29
|
"lodash": "^4.17.20",
|