@takeshape/schema 9.80.4 → 9.81.3
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/api-version.js +0 -9
- package/dist/builtin-schema.js +0 -5
- package/dist/content-schema-transform.js +4 -52
- package/dist/create-input-schema.js +7 -19
- package/dist/enum.js +0 -3
- package/dist/flatten-templates.js +0 -11
- package/dist/get-is-leaf.js +8 -18
- package/dist/index.js +0 -58
- package/dist/interfaces.js +2 -26
- package/dist/layers/layers.js +23 -103
- package/dist/layers/refs.js +26 -69
- package/dist/layers/type-utils.js +11 -43
- package/dist/layers/visitor.js +0 -6
- package/dist/migration/index.js +0 -51
- package/dist/migration/to/v3.0.0.js +31 -45
- package/dist/migration/to/v3.1.0.js +15 -41
- package/dist/migration/to/v3.10.0.js +6 -20
- package/dist/migration/to/v3.11.0.js +8 -20
- package/dist/migration/to/v3.12.0.js +2 -3
- package/dist/migration/to/v3.12.1.js +2 -3
- package/dist/migration/to/v3.12.2.js +2 -3
- package/dist/migration/to/v3.12.3.js +16 -21
- package/dist/migration/to/v3.13.0.js +2 -7
- package/dist/migration/to/v3.14.0.js +2 -3
- package/dist/migration/to/v3.15.0.js +2 -3
- package/dist/migration/to/v3.16.0.js +2 -3
- package/dist/migration/to/v3.17.0.js +4 -9
- package/dist/migration/to/v3.17.1.js +2 -3
- package/dist/migration/to/v3.18.0.js +2 -15
- package/dist/migration/to/v3.18.1.js +2 -7
- package/dist/migration/to/v3.18.2.js +8 -10
- package/dist/migration/to/v3.19.0.js +2 -3
- package/dist/migration/to/v3.2.0.js +2 -3
- package/dist/migration/to/v3.20.0.js +10 -11
- package/dist/migration/to/v3.21.0.js +2 -3
- package/dist/migration/to/v3.22.0.js +4 -9
- package/dist/migration/to/v3.23.0.js +2 -3
- package/dist/migration/to/v3.24.0.js +2 -3
- package/dist/migration/to/v3.25.0.js +2 -3
- package/dist/migration/to/v3.26.0.js +2 -3
- package/dist/migration/to/v3.27.0.js +2 -3
- package/dist/migration/to/v3.28.0.js +2 -3
- package/dist/migration/to/v3.29.0.js +2 -3
- package/dist/migration/to/v3.3.0.js +3 -4
- package/dist/migration/to/v3.30.0.js +2 -3
- package/dist/migration/to/v3.31.0.js +2 -12
- package/dist/migration/to/v3.32.0.js +12 -22
- package/dist/migration/to/v3.33.0.js +2 -3
- package/dist/migration/to/v3.34.0.js +14 -43
- package/dist/migration/to/v3.35.0.js +2 -3
- package/dist/migration/to/v3.36.0.js +6 -10
- package/dist/migration/to/v3.37.0.js +2 -3
- package/dist/migration/to/v3.38.0.js +2 -3
- package/dist/migration/to/v3.39.0.js +6 -13
- package/dist/migration/to/v3.4.0.js +2 -3
- package/dist/migration/to/v3.5.0.js +2 -3
- package/dist/migration/to/v3.5.1.js +2 -3
- package/dist/migration/to/v3.6.0.js +2 -3
- package/dist/migration/to/v3.7.0.js +2 -3
- package/dist/migration/to/v3.8.0.js +2 -3
- package/dist/migration/to/v3.9.0.js +8 -24
- package/dist/migration/utils.js +0 -2
- package/dist/mocks.js +9 -12
- package/dist/models/project-schema.js +0 -34
- package/dist/models/query.js +0 -9
- package/dist/models/service.js +0 -8
- package/dist/models/shape.js +0 -29
- package/dist/project-schema/index.js +1 -105
- package/dist/project-schema/migrate.js +1 -54
- package/dist/refs.js +39 -159
- package/dist/relationships.js +13 -57
- package/dist/scalars.js +0 -1
- package/dist/schema-transform.js +0 -11
- package/dist/schema-util.js +75 -271
- package/dist/schemas/index.js +0 -64
- package/dist/services.js +24 -44
- package/dist/taxonomies.js +0 -13
- package/dist/template-shapes/index.js +1 -8
- package/dist/template-shapes/templates.js +9 -40
- package/dist/template-shapes/types.js +4 -5
- package/dist/template-shapes/where.js +14 -110
- package/dist/types/index.js +0 -4
- package/dist/types/types.js +41 -13
- package/dist/types/utils.js +15 -89
- package/dist/unions.js +8 -38
- package/dist/util/api-indexing.js +2 -19
- package/dist/util/detect-cycles.js +2 -16
- package/dist/util/find-shape-at-path.js +1 -15
- package/dist/util/form-config.js +6 -23
- package/dist/util/get-conflicting-properties.js +7 -17
- package/dist/util/get-return-shape.js +0 -11
- package/dist/util/has-arg.js +0 -6
- package/dist/util/index.js +0 -18
- package/dist/util/merge.js +28 -74
- package/dist/util/patch-schema.js +5 -13
- package/dist/validate.js +15 -234
- package/dist/versions.js +0 -2
- package/dist/workflows.js +0 -15
- package/es/api-version.js +0 -4
- package/es/content-schema-transform.js +4 -38
- package/es/create-input-schema.js +7 -14
- package/es/enum.js +0 -2
- package/es/flatten-templates.js +0 -4
- package/es/get-is-leaf.js +8 -13
- package/es/index.js +1 -0
- package/es/interfaces.js +2 -14
- package/es/layers/layers.js +23 -90
- package/es/layers/refs.js +22 -45
- package/es/layers/type-utils.js +11 -16
- package/es/layers/visitor.js +0 -3
- package/es/migration/to/v3.0.0.js +31 -38
- package/es/migration/to/v3.1.0.js +16 -34
- package/es/migration/to/v3.10.0.js +6 -17
- package/es/migration/to/v3.11.0.js +8 -18
- package/es/migration/to/v3.12.0.js +2 -2
- package/es/migration/to/v3.12.1.js +2 -2
- package/es/migration/to/v3.12.2.js +2 -2
- package/es/migration/to/v3.12.3.js +16 -19
- package/es/migration/to/v3.13.0.js +2 -4
- package/es/migration/to/v3.14.0.js +2 -2
- package/es/migration/to/v3.15.0.js +2 -2
- package/es/migration/to/v3.16.0.js +2 -2
- package/es/migration/to/v3.17.0.js +4 -4
- package/es/migration/to/v3.17.1.js +2 -2
- package/es/migration/to/v3.18.0.js +2 -10
- package/es/migration/to/v3.18.1.js +2 -3
- package/es/migration/to/v3.18.2.js +8 -8
- package/es/migration/to/v3.19.0.js +2 -2
- package/es/migration/to/v3.2.0.js +2 -2
- package/es/migration/to/v3.20.0.js +10 -9
- package/es/migration/to/v3.21.0.js +2 -2
- package/es/migration/to/v3.22.0.js +4 -6
- package/es/migration/to/v3.23.0.js +2 -2
- package/es/migration/to/v3.24.0.js +2 -2
- package/es/migration/to/v3.25.0.js +2 -2
- package/es/migration/to/v3.26.0.js +2 -2
- package/es/migration/to/v3.27.0.js +2 -2
- package/es/migration/to/v3.28.0.js +2 -2
- package/es/migration/to/v3.29.0.js +2 -2
- package/es/migration/to/v3.3.0.js +3 -3
- package/es/migration/to/v3.30.0.js +2 -2
- package/es/migration/to/v3.31.0.js +2 -5
- package/es/migration/to/v3.32.0.js +12 -21
- package/es/migration/to/v3.33.0.js +2 -2
- package/es/migration/to/v3.34.0.js +16 -32
- package/es/migration/to/v3.35.0.js +2 -2
- package/es/migration/to/v3.36.0.js +6 -8
- package/es/migration/to/v3.37.0.js +2 -2
- package/es/migration/to/v3.38.0.js +2 -2
- package/es/migration/to/v3.39.0.js +6 -12
- package/es/migration/to/v3.4.0.js +2 -2
- package/es/migration/to/v3.5.0.js +2 -2
- package/es/migration/to/v3.5.1.js +2 -2
- package/es/migration/to/v3.6.0.js +2 -2
- package/es/migration/to/v3.7.0.js +2 -2
- package/es/migration/to/v3.8.0.js +2 -2
- package/es/migration/to/v3.9.0.js +8 -20
- package/es/mocks.js +10 -6
- package/es/models/project-schema.js +0 -26
- package/es/models/query.js +0 -7
- package/es/models/service.js +0 -6
- package/es/models/shape.js +1 -25
- package/es/project-schema/index.js +0 -5
- package/es/project-schema/migrate.js +3 -51
- package/es/refs.js +40 -96
- package/es/relationships.js +14 -42
- package/es/schema-transform.js +0 -7
- package/es/schema-util.js +75 -180
- package/es/services.js +18 -27
- package/es/taxonomies.js +0 -9
- package/es/template-shapes/index.js +1 -4
- package/es/template-shapes/templates.js +9 -18
- package/es/template-shapes/types.js +3 -4
- package/es/template-shapes/where.js +14 -94
- package/es/types/types.js +43 -10
- package/es/types/utils.js +16 -24
- package/es/unions.js +8 -22
- package/es/util/api-indexing.js +2 -12
- package/es/util/detect-cycles.js +2 -14
- package/es/util/find-shape-at-path.js +2 -12
- package/es/util/form-config.js +7 -19
- package/es/util/get-conflicting-properties.js +8 -14
- package/es/util/get-return-shape.js +0 -8
- package/es/util/has-arg.js +0 -3
- package/es/util/merge.js +28 -55
- package/es/util/patch-schema.js +5 -7
- package/es/validate.js +15 -194
- package/es/workflows.js +0 -6
- package/package.json +5 -5
|
@@ -5,11 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.findSchemaAtPath = findSchemaAtPath;
|
|
7
7
|
exports.findShapeAtPath = findShapeAtPath;
|
|
8
|
-
|
|
9
8
|
var _types = require("../types");
|
|
10
|
-
|
|
11
9
|
var _refs = require("../refs");
|
|
12
|
-
|
|
13
10
|
/**
|
|
14
11
|
*
|
|
15
12
|
* @param projectSchema
|
|
@@ -23,37 +20,29 @@ function findSchemaAtPath(projectSchema, schema, queryPath) {
|
|
|
23
20
|
if (queryPath.length === 0) {
|
|
24
21
|
return schema;
|
|
25
22
|
}
|
|
26
|
-
|
|
27
23
|
const [prop, ...rest] = queryPath;
|
|
28
|
-
|
|
29
24
|
if ((0, _types.isRefSchema)(schema)) {
|
|
30
25
|
const ref = (0, _refs.getRef)(projectSchema, schema);
|
|
31
|
-
|
|
32
26
|
if (ref) {
|
|
33
27
|
const shapeSchema = (0, _refs.refItemToShapeSchema)(projectSchema, ref);
|
|
34
|
-
|
|
35
28
|
if (shapeSchema) {
|
|
36
29
|
return findSchemaAtPath(projectSchema, shapeSchema, queryPath);
|
|
37
30
|
}
|
|
38
31
|
}
|
|
39
|
-
|
|
40
32
|
return undefined;
|
|
41
33
|
}
|
|
42
|
-
|
|
43
34
|
if ((0, _types.isArraySchema)(schema)) {
|
|
44
35
|
return findSchemaAtPath(projectSchema, schema.items, queryPath);
|
|
45
36
|
}
|
|
46
|
-
|
|
47
37
|
if ((0, _types.isObjectSchema)(schema)) {
|
|
48
38
|
const propSchema = schema.properties[prop];
|
|
49
|
-
|
|
50
39
|
if (propSchema) {
|
|
51
40
|
return findSchemaAtPath(projectSchema, propSchema, rest);
|
|
52
41
|
}
|
|
53
42
|
}
|
|
54
|
-
|
|
55
43
|
return undefined;
|
|
56
44
|
}
|
|
45
|
+
|
|
57
46
|
/**
|
|
58
47
|
*
|
|
59
48
|
* @param projectSchema
|
|
@@ -63,11 +52,8 @@ function findSchemaAtPath(projectSchema, schema, queryPath) {
|
|
|
63
52
|
* @example
|
|
64
53
|
* findShapeAtPath(projectSchema, projectSchema.shapes.Shopify_ProductConnection.shape, ['edges', 'node']) // finds Shopify_Product
|
|
65
54
|
*/
|
|
66
|
-
|
|
67
|
-
|
|
68
55
|
function findShapeAtPath(projectSchema, propSchema, queryPath) {
|
|
69
56
|
const result = findSchemaAtPath(projectSchema, propSchema, queryPath);
|
|
70
|
-
|
|
71
57
|
if (result) {
|
|
72
58
|
const refItem = (0, _refs.getRef)(projectSchema, result.items ?? result);
|
|
73
59
|
return refItem && (0, _refs.refItemToShape)(projectSchema, refItem);
|
package/dist/util/form-config.js
CHANGED
|
@@ -5,13 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.findShapeFormConfig = findShapeFormConfig;
|
|
7
7
|
exports.normalizeForms = normalizeForms;
|
|
8
|
-
|
|
9
8
|
var _util = require("@takeshape/util");
|
|
10
|
-
|
|
11
9
|
var _refs = require("../refs");
|
|
12
|
-
|
|
13
10
|
var _schemaUtil = require("../schema-util");
|
|
14
|
-
|
|
15
11
|
/**
|
|
16
12
|
* If there any non-normal (nested) forms in the schema, create forms for referenced shapes.
|
|
17
13
|
* The original forms are left intact.
|
|
@@ -21,7 +17,6 @@ function normalizeForms(projectSchema) {
|
|
|
21
17
|
const {
|
|
22
18
|
forms = {}
|
|
23
19
|
} = projectSchema;
|
|
24
|
-
|
|
25
20
|
const storeSourceForm = (shapeName, formConfig, propName) => {
|
|
26
21
|
// Leave original forms intact for backwards compatibility
|
|
27
22
|
if (!forms[shapeName]) {
|
|
@@ -29,30 +24,24 @@ function normalizeForms(projectSchema) {
|
|
|
29
24
|
normalizedForms[shapeName] = {
|
|
30
25
|
default: (0, _util.deepClone)(formConfig)
|
|
31
26
|
};
|
|
32
|
-
}
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
34
|
-
|
|
27
|
+
}
|
|
35
28
|
|
|
29
|
+
// Remove prop now that it has been normalized
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
36
31
|
delete normalizedForms[shapeName].default.properties[propName];
|
|
37
32
|
}
|
|
38
33
|
};
|
|
39
|
-
|
|
40
34
|
const normalizeNested = (shapeName, formConfig) => {
|
|
41
35
|
const shape = projectSchema.shapes[shapeName];
|
|
42
|
-
|
|
43
36
|
if (!shape || !formConfig.properties) {
|
|
44
37
|
return;
|
|
45
38
|
}
|
|
46
|
-
|
|
47
39
|
const propertyAccessor = (0, _schemaUtil.createSchemaPropertyAccessor)(projectSchema, shape);
|
|
48
|
-
|
|
49
40
|
for (const propName of Object.keys(formConfig.properties)) {
|
|
50
41
|
const propConfig = formConfig.properties[propName];
|
|
51
42
|
const propSchema = propertyAccessor.getValue(propName);
|
|
52
|
-
|
|
53
43
|
if (propSchema) {
|
|
54
44
|
const ref = (0, _refs.getRefOrItemsRef)(projectSchema, propSchema);
|
|
55
|
-
|
|
56
45
|
if (ref && propConfig.properties) {
|
|
57
46
|
const nestedShapeName = (0, _refs.refItemToShapeName)(ref);
|
|
58
47
|
normalizedForms[nestedShapeName] = {
|
|
@@ -64,38 +53,32 @@ function normalizeForms(projectSchema) {
|
|
|
64
53
|
}
|
|
65
54
|
}
|
|
66
55
|
};
|
|
67
|
-
|
|
68
56
|
if (forms) {
|
|
69
57
|
for (const shapeName of Object.keys(forms)) {
|
|
70
|
-
normalizeNested(shapeName, forms[shapeName].default);
|
|
58
|
+
normalizeNested(shapeName, forms[shapeName].default);
|
|
71
59
|
|
|
60
|
+
// copy forms with no changes
|
|
72
61
|
if (!normalizedForms[shapeName]) {
|
|
73
62
|
normalizedForms[shapeName] = forms[shapeName];
|
|
74
63
|
}
|
|
75
64
|
}
|
|
76
65
|
}
|
|
77
|
-
|
|
78
66
|
return normalizedForms;
|
|
79
67
|
}
|
|
80
|
-
|
|
81
68
|
const cache = new WeakMap();
|
|
69
|
+
|
|
82
70
|
/**
|
|
83
71
|
* Find the form config for a given shape name and the form key.
|
|
84
72
|
*/
|
|
85
|
-
|
|
86
73
|
function findShapeFormConfig(projectSchema, shapeName, formName) {
|
|
87
74
|
var _normalizedForms$shap;
|
|
88
|
-
|
|
89
75
|
if (!projectSchema.forms) {
|
|
90
76
|
return;
|
|
91
77
|
}
|
|
92
|
-
|
|
93
78
|
let normalizedForms = cache.get(projectSchema);
|
|
94
|
-
|
|
95
79
|
if (!normalizedForms) {
|
|
96
80
|
normalizedForms = normalizeForms(projectSchema);
|
|
97
81
|
cache.set(projectSchema, normalizedForms);
|
|
98
82
|
}
|
|
99
|
-
|
|
100
83
|
return (_normalizedForms$shap = normalizedForms[shapeName]) === null || _normalizedForms$shap === void 0 ? void 0 : _normalizedForms$shap[formName];
|
|
101
84
|
}
|
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getConflictingProperties = getConflictingProperties;
|
|
7
|
-
|
|
8
7
|
var _refs = require("../refs");
|
|
9
|
-
|
|
10
8
|
var _util = require("@takeshape/util");
|
|
11
|
-
|
|
12
9
|
var _types = require("../types");
|
|
13
|
-
|
|
14
10
|
/**
|
|
15
11
|
* Normalize ref, oneOf and array schemas and get a list of @ref expressions
|
|
16
12
|
*/
|
|
@@ -22,40 +18,35 @@ function getRefStrings(context, propertySchema) {
|
|
|
22
18
|
return ref ? (0, _refs.refItemToAtRef)(ref) : undefined;
|
|
23
19
|
}).filter(_util.isDefined);
|
|
24
20
|
}
|
|
25
|
-
|
|
26
21
|
function isRefEqual(context, a, b) {
|
|
27
22
|
return (0, _util.setIsEqual)(getRefStrings(context, a), getRefStrings(context, b));
|
|
28
23
|
}
|
|
24
|
+
|
|
29
25
|
/**
|
|
30
26
|
* Given a list of shapes find the conflicting props
|
|
31
27
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
28
|
function getConflictingProperties(context, shapes) {
|
|
35
29
|
const conflicts = new Set();
|
|
36
30
|
const allProps = {};
|
|
37
|
-
|
|
38
31
|
for (const shape of Object.values(shapes)) {
|
|
39
32
|
const schema = (0, _refs.dereferenceSchema)(context, shape.schema, ['shapes', shape.name]);
|
|
40
|
-
|
|
41
33
|
if (!(0, _types.isObjectSchema)(schema)) {
|
|
42
34
|
continue;
|
|
43
35
|
}
|
|
44
|
-
|
|
45
36
|
const required = new Set(schema.required ?? []);
|
|
46
|
-
|
|
47
37
|
for (const [name, prop] of Object.entries(schema.properties)) {
|
|
48
38
|
// skip props that we know already have conflict
|
|
49
39
|
if (conflicts.has(name)) {
|
|
50
40
|
continue;
|
|
51
41
|
}
|
|
52
|
-
|
|
53
42
|
const isRequired = required.has(name);
|
|
54
|
-
|
|
55
43
|
if (allProps[name]) {
|
|
56
|
-
if (
|
|
57
|
-
|
|
58
|
-
|
|
44
|
+
if (
|
|
45
|
+
// same type
|
|
46
|
+
allProps[name][0].type !== prop.type ||
|
|
47
|
+
// same refs
|
|
48
|
+
!isRefEqual(context, allProps[name][0], prop) ||
|
|
49
|
+
// same nullability
|
|
59
50
|
isRequired !== allProps[name][1]) {
|
|
60
51
|
conflicts.add(name);
|
|
61
52
|
}
|
|
@@ -64,6 +55,5 @@ function getConflictingProperties(context, shapes) {
|
|
|
64
55
|
}
|
|
65
56
|
}
|
|
66
57
|
}
|
|
67
|
-
|
|
68
58
|
return conflicts;
|
|
69
59
|
}
|
|
@@ -5,16 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getReturnShape = getReturnShape;
|
|
7
7
|
exports.getReturnShapeRef = getReturnShapeRef;
|
|
8
|
-
|
|
9
8
|
var _refs = require("../refs");
|
|
10
|
-
|
|
11
9
|
function isQuery(propOrQuery) {
|
|
12
10
|
return 'shape' in propOrQuery && 'resolver' in propOrQuery;
|
|
13
11
|
}
|
|
14
|
-
|
|
15
12
|
function getReturnShapeHelper(projectSchema, propOrQuery) {
|
|
16
13
|
let shape;
|
|
17
|
-
|
|
18
14
|
if (isQuery(propOrQuery)) {
|
|
19
15
|
const {
|
|
20
16
|
shapeName
|
|
@@ -22,28 +18,21 @@ function getReturnShapeHelper(projectSchema, propOrQuery) {
|
|
|
22
18
|
shape = projectSchema.shapes[shapeName];
|
|
23
19
|
} else {
|
|
24
20
|
const ref = (0, _refs.getRef)(projectSchema, propOrQuery);
|
|
25
|
-
|
|
26
21
|
if (ref) {
|
|
27
22
|
shape = (0, _refs.refItemToShape)(projectSchema, ref);
|
|
28
23
|
}
|
|
29
24
|
}
|
|
30
|
-
|
|
31
25
|
return shape;
|
|
32
26
|
}
|
|
33
|
-
|
|
34
27
|
function getReturnShapeRef(context, propOrQuery) {
|
|
35
28
|
return isQuery(propOrQuery) ? (0, _refs.parseReturnShape)(context, propOrQuery.shape).ref : (0, _refs.getRef)(context, propOrQuery);
|
|
36
29
|
}
|
|
37
|
-
|
|
38
30
|
const cache = new WeakMap();
|
|
39
|
-
|
|
40
31
|
function getReturnShape(projectSchema, propOrQuery) {
|
|
41
32
|
let result = cache.get(propOrQuery);
|
|
42
|
-
|
|
43
33
|
if (result === undefined) {
|
|
44
34
|
result = getReturnShapeHelper(projectSchema, propOrQuery);
|
|
45
35
|
cache.set(propOrQuery, result ?? null);
|
|
46
36
|
}
|
|
47
|
-
|
|
48
37
|
return result ?? undefined;
|
|
49
38
|
}
|
package/dist/util/has-arg.js
CHANGED
|
@@ -5,22 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getArgs = getArgs;
|
|
7
7
|
exports.hasArg = hasArg;
|
|
8
|
-
|
|
9
8
|
var _findShapeAtPath = require("./find-shape-at-path");
|
|
10
|
-
|
|
11
9
|
function getArgs(prop) {
|
|
12
10
|
return '@args' in prop ? prop['@args'] : 'args' in prop ? prop.args : undefined;
|
|
13
11
|
}
|
|
14
|
-
|
|
15
12
|
function hasArg(projectSchema, prop, argPath) {
|
|
16
13
|
var _projectSchema$shapes;
|
|
17
|
-
|
|
18
14
|
const args = getArgs(prop);
|
|
19
|
-
|
|
20
15
|
if (!args) {
|
|
21
16
|
return false;
|
|
22
17
|
}
|
|
23
|
-
|
|
24
18
|
const schema = typeof args === 'string' ? (_projectSchema$shapes = projectSchema.shapes[args]) === null || _projectSchema$shapes === void 0 ? void 0 : _projectSchema$shapes.schema : args;
|
|
25
19
|
const pathArray = Array.isArray(argPath) ? argPath : argPath.split('.');
|
|
26
20
|
return Boolean((0, _findShapeAtPath.findSchemaAtPath)(projectSchema, schema, pathArray));
|
package/dist/util/index.js
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
6
|
var _apiIndexing = require("./api-indexing");
|
|
8
|
-
|
|
9
7
|
Object.keys(_apiIndexing).forEach(function (key) {
|
|
10
8
|
if (key === "default" || key === "__esModule") return;
|
|
11
9
|
if (key in exports && exports[key] === _apiIndexing[key]) return;
|
|
@@ -16,9 +14,7 @@ Object.keys(_apiIndexing).forEach(function (key) {
|
|
|
16
14
|
}
|
|
17
15
|
});
|
|
18
16
|
});
|
|
19
|
-
|
|
20
17
|
var _detectCycles = require("./detect-cycles");
|
|
21
|
-
|
|
22
18
|
Object.keys(_detectCycles).forEach(function (key) {
|
|
23
19
|
if (key === "default" || key === "__esModule") return;
|
|
24
20
|
if (key in exports && exports[key] === _detectCycles[key]) return;
|
|
@@ -29,9 +25,7 @@ Object.keys(_detectCycles).forEach(function (key) {
|
|
|
29
25
|
}
|
|
30
26
|
});
|
|
31
27
|
});
|
|
32
|
-
|
|
33
28
|
var _findShapeAtPath = require("./find-shape-at-path");
|
|
34
|
-
|
|
35
29
|
Object.keys(_findShapeAtPath).forEach(function (key) {
|
|
36
30
|
if (key === "default" || key === "__esModule") return;
|
|
37
31
|
if (key in exports && exports[key] === _findShapeAtPath[key]) return;
|
|
@@ -42,9 +36,7 @@ Object.keys(_findShapeAtPath).forEach(function (key) {
|
|
|
42
36
|
}
|
|
43
37
|
});
|
|
44
38
|
});
|
|
45
|
-
|
|
46
39
|
var _getConflictingProperties = require("./get-conflicting-properties");
|
|
47
|
-
|
|
48
40
|
Object.keys(_getConflictingProperties).forEach(function (key) {
|
|
49
41
|
if (key === "default" || key === "__esModule") return;
|
|
50
42
|
if (key in exports && exports[key] === _getConflictingProperties[key]) return;
|
|
@@ -55,9 +47,7 @@ Object.keys(_getConflictingProperties).forEach(function (key) {
|
|
|
55
47
|
}
|
|
56
48
|
});
|
|
57
49
|
});
|
|
58
|
-
|
|
59
50
|
var _getReturnShape = require("./get-return-shape");
|
|
60
|
-
|
|
61
51
|
Object.keys(_getReturnShape).forEach(function (key) {
|
|
62
52
|
if (key === "default" || key === "__esModule") return;
|
|
63
53
|
if (key in exports && exports[key] === _getReturnShape[key]) return;
|
|
@@ -68,9 +58,7 @@ Object.keys(_getReturnShape).forEach(function (key) {
|
|
|
68
58
|
}
|
|
69
59
|
});
|
|
70
60
|
});
|
|
71
|
-
|
|
72
61
|
var _hasArg = require("./has-arg");
|
|
73
|
-
|
|
74
62
|
Object.keys(_hasArg).forEach(function (key) {
|
|
75
63
|
if (key === "default" || key === "__esModule") return;
|
|
76
64
|
if (key in exports && exports[key] === _hasArg[key]) return;
|
|
@@ -81,9 +69,7 @@ Object.keys(_hasArg).forEach(function (key) {
|
|
|
81
69
|
}
|
|
82
70
|
});
|
|
83
71
|
});
|
|
84
|
-
|
|
85
72
|
var _merge = require("./merge");
|
|
86
|
-
|
|
87
73
|
Object.keys(_merge).forEach(function (key) {
|
|
88
74
|
if (key === "default" || key === "__esModule") return;
|
|
89
75
|
if (key in exports && exports[key] === _merge[key]) return;
|
|
@@ -94,9 +80,7 @@ Object.keys(_merge).forEach(function (key) {
|
|
|
94
80
|
}
|
|
95
81
|
});
|
|
96
82
|
});
|
|
97
|
-
|
|
98
83
|
var _formConfig = require("./form-config");
|
|
99
|
-
|
|
100
84
|
Object.keys(_formConfig).forEach(function (key) {
|
|
101
85
|
if (key === "default" || key === "__esModule") return;
|
|
102
86
|
if (key in exports && exports[key] === _formConfig[key]) return;
|
|
@@ -107,9 +91,7 @@ Object.keys(_formConfig).forEach(function (key) {
|
|
|
107
91
|
}
|
|
108
92
|
});
|
|
109
93
|
});
|
|
110
|
-
|
|
111
94
|
var _patchSchema = require("./patch-schema");
|
|
112
|
-
|
|
113
95
|
Object.keys(_patchSchema).forEach(function (key) {
|
|
114
96
|
if (key === "default" || key === "__esModule") return;
|
|
115
97
|
if (key in exports && exports[key] === _patchSchema[key]) return;
|