@takeshape/schema 10.4.9 → 10.6.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/dist/api-version.d.ts +1 -1
- package/dist/api-version.d.ts.map +1 -1
- package/dist/builtin-schema.d.ts +2 -2
- package/dist/builtin-schema.d.ts.map +1 -1
- package/dist/content-schema-transform.d.ts +10 -10
- package/dist/content-schema-transform.d.ts.map +1 -1
- package/dist/content-schema-transform.js +1 -1
- package/dist/create-input-schema.d.ts +3 -3
- package/dist/create-input-schema.d.ts.map +1 -1
- package/dist/enum.d.ts +1 -1
- package/dist/enum.d.ts.map +1 -1
- package/dist/enum.js +1 -1
- package/dist/flatten-templates.d.ts +1 -1
- package/dist/flatten-templates.d.ts.map +1 -1
- package/dist/flatten-templates.js +2 -2
- package/dist/get-is-leaf.js +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -49
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js +2 -2
- package/dist/layers/layers.d.ts +2 -2
- package/dist/layers/layers.d.ts.map +1 -1
- package/dist/layers/layers.js +23 -27
- package/dist/layers/refs.d.ts +7 -7
- package/dist/layers/refs.d.ts.map +1 -1
- package/dist/layers/refs.js +2 -2
- package/dist/layers/type-utils.d.ts +1 -1
- package/dist/layers/type-utils.d.ts.map +1 -1
- package/dist/layers/visitor.d.ts +2 -2
- package/dist/layers/visitor.d.ts.map +1 -1
- package/dist/migration/to/v3.0.0.d.ts +1 -1
- package/dist/migration/to/v3.0.0.d.ts.map +1 -1
- package/dist/migration/to/v3.0.0.js +1 -1
- package/dist/migration/to/v3.1.0.d.ts +1 -1
- package/dist/migration/to/v3.1.0.d.ts.map +1 -1
- package/dist/migration/to/v3.10.0.d.ts.map +1 -1
- package/dist/migration/to/v3.11.0.d.ts.map +1 -1
- package/dist/migration/to/v3.13.0.d.ts.map +1 -1
- package/dist/migration/to/v3.17.0.d.ts +1 -1
- package/dist/migration/to/v3.17.0.d.ts.map +1 -1
- package/dist/migration/to/v3.17.1.d.ts +1 -1
- package/dist/migration/to/v3.17.1.d.ts.map +1 -1
- package/dist/migration/to/v3.18.0.d.ts +1 -1
- package/dist/migration/to/v3.18.0.d.ts.map +1 -1
- package/dist/migration/to/v3.18.1.d.ts.map +1 -1
- package/dist/migration/to/v3.18.2.d.ts.map +1 -1
- package/dist/migration/to/v3.19.0.d.ts +1 -1
- package/dist/migration/to/v3.19.0.d.ts.map +1 -1
- package/dist/migration/to/v3.20.0.d.ts.map +1 -1
- package/dist/migration/to/v3.21.0.d.ts +1 -1
- package/dist/migration/to/v3.21.0.d.ts.map +1 -1
- package/dist/migration/to/v3.22.0.d.ts +1 -1
- package/dist/migration/to/v3.22.0.d.ts.map +1 -1
- package/dist/migration/to/v3.23.0.d.ts +1 -1
- package/dist/migration/to/v3.23.0.d.ts.map +1 -1
- package/dist/migration/to/v3.24.0.d.ts +1 -1
- package/dist/migration/to/v3.24.0.d.ts.map +1 -1
- package/dist/migration/to/v3.25.0.d.ts +1 -1
- package/dist/migration/to/v3.25.0.d.ts.map +1 -1
- package/dist/migration/to/v3.26.0.d.ts +1 -1
- package/dist/migration/to/v3.26.0.d.ts.map +1 -1
- package/dist/migration/to/v3.27.0.d.ts +1 -1
- package/dist/migration/to/v3.27.0.d.ts.map +1 -1
- package/dist/migration/to/v3.28.0.d.ts +1 -1
- package/dist/migration/to/v3.28.0.d.ts.map +1 -1
- package/dist/migration/to/v3.29.0.d.ts +1 -1
- package/dist/migration/to/v3.29.0.d.ts.map +1 -1
- package/dist/migration/to/v3.30.0.d.ts +1 -1
- package/dist/migration/to/v3.30.0.d.ts.map +1 -1
- package/dist/migration/to/v3.31.0.d.ts +1 -1
- package/dist/migration/to/v3.31.0.d.ts.map +1 -1
- package/dist/migration/to/v3.32.0.d.ts +1 -1
- package/dist/migration/to/v3.32.0.d.ts.map +1 -1
- package/dist/migration/to/v3.32.0.js +10 -12
- package/dist/migration/to/v3.33.0.d.ts +1 -1
- package/dist/migration/to/v3.33.0.d.ts.map +1 -1
- package/dist/migration/to/v3.34.0.d.ts +1 -1
- package/dist/migration/to/v3.34.0.d.ts.map +1 -1
- package/dist/migration/to/v3.34.0.js +7 -10
- package/dist/migration/to/v3.35.0.d.ts +1 -1
- package/dist/migration/to/v3.35.0.d.ts.map +1 -1
- package/dist/migration/to/v3.36.0.d.ts +1 -1
- package/dist/migration/to/v3.36.0.d.ts.map +1 -1
- package/dist/migration/to/v3.36.0.js +13 -15
- package/dist/migration/to/v3.37.0.d.ts +1 -1
- package/dist/migration/to/v3.37.0.d.ts.map +1 -1
- package/dist/migration/to/v3.38.0.d.ts +1 -1
- package/dist/migration/to/v3.38.0.d.ts.map +1 -1
- package/dist/migration/to/v3.39.0.d.ts +1 -1
- package/dist/migration/to/v3.39.0.d.ts.map +1 -1
- package/dist/migration/to/v3.9.0.d.ts +1 -1
- package/dist/migration/to/v3.9.0.d.ts.map +1 -1
- package/dist/migration/types.d.ts +4 -4
- package/dist/migration/types.d.ts.map +1 -1
- package/dist/migration/utils.js +1 -1
- package/dist/mocks.d.ts.map +1 -1
- package/dist/mocks.js +1 -1
- package/dist/models/project-schema.d.ts +4 -4
- package/dist/models/project-schema.d.ts.map +1 -1
- package/dist/models/project-schema.js +4 -4
- package/dist/models/query.d.ts +2 -2
- package/dist/models/query.d.ts.map +1 -1
- package/dist/models/service.d.ts +2 -2
- package/dist/models/service.d.ts.map +1 -1
- package/dist/models/shape.d.ts +3 -3
- package/dist/models/shape.d.ts.map +1 -1
- package/dist/patterns.d.ts +4 -4
- package/dist/patterns.d.ts.map +1 -1
- package/dist/refs.d.ts +14 -14
- package/dist/refs.d.ts.map +1 -1
- package/dist/refs.js +4 -4
- package/dist/relationships.d.ts.map +1 -1
- package/dist/relationships.js +2 -4
- package/dist/schema-transform.d.ts +1 -1
- package/dist/schema-transform.d.ts.map +1 -1
- package/dist/schema-transform.js +1 -1
- package/dist/schema-util.d.ts +7 -7
- package/dist/schema-util.d.ts.map +1 -1
- package/dist/schema-util.js +9 -9
- package/dist/services.d.ts +2 -3
- package/dist/services.d.ts.map +1 -1
- package/dist/services.js +2 -2
- package/dist/taxonomies.d.ts +4 -4
- package/dist/taxonomies.d.ts.map +1 -1
- package/dist/taxonomies.js +1 -1
- package/dist/template-shapes/index.d.ts +2 -2
- package/dist/template-shapes/index.d.ts.map +1 -1
- package/dist/template-shapes/templates.d.ts +1 -1
- package/dist/template-shapes/templates.d.ts.map +1 -1
- package/dist/template-shapes/templates.js +4 -4
- package/dist/template-shapes/types.d.ts +5 -5
- package/dist/template-shapes/types.d.ts.map +1 -1
- package/dist/template-shapes/where.d.ts +2 -2
- package/dist/template-shapes/where.d.ts.map +1 -1
- package/dist/template-shapes/where.js +3 -3
- package/dist/types/types.d.ts +22 -22
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts +2 -2
- package/dist/types/utils.d.ts.map +1 -1
- package/dist/types/utils.js +2 -2
- package/dist/unions.d.ts +3 -3
- package/dist/unions.d.ts.map +1 -1
- package/dist/unions.js +2 -2
- package/dist/util/api-indexing.d.ts +1 -1
- package/dist/util/api-indexing.d.ts.map +1 -1
- package/dist/util/api-indexing.js +1 -1
- package/dist/util/detect-cycles.d.ts +1 -1
- package/dist/util/detect-cycles.d.ts.map +1 -1
- package/dist/util/detect-cycles.js +1 -1
- package/dist/util/find-shape-at-path.d.ts +1 -1
- package/dist/util/find-shape-at-path.d.ts.map +1 -1
- package/dist/util/form-config.d.ts +2 -3
- package/dist/util/form-config.d.ts.map +1 -1
- package/dist/util/form-config.js +4 -8
- package/dist/util/get-conflicting-properties.d.ts +2 -2
- package/dist/util/get-conflicting-properties.d.ts.map +1 -1
- package/dist/util/get-conflicting-properties.js +1 -1
- package/dist/util/get-return-shape.d.ts +2 -2
- package/dist/util/get-return-shape.d.ts.map +1 -1
- package/dist/util/has-arg.d.ts +2 -2
- package/dist/util/has-arg.d.ts.map +1 -1
- package/dist/util/merge.d.ts +1 -1
- package/dist/util/merge.d.ts.map +1 -1
- package/dist/util/merge.js +3 -5
- package/dist/util/patch-schema.d.ts +2 -2
- package/dist/util/patch-schema.d.ts.map +1 -1
- package/dist/validate.d.ts +11 -11
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +12 -13
- package/dist/workflows.d.ts +3 -3
- package/dist/workflows.d.ts.map +1 -1
- package/dist/workflows.js +4 -1
- package/es/content-schema-transform.js +1 -1
- package/es/enum.js +1 -1
- package/es/flatten-templates.js +2 -2
- package/es/get-is-leaf.js +1 -1
- package/es/index.js +3 -3
- package/es/interfaces.js +2 -2
- package/es/layers/layers.js +4 -8
- package/es/layers/refs.js +2 -2
- package/es/migration/to/v3.0.0.js +1 -1
- package/es/migration/to/v3.32.0.js +10 -12
- package/es/migration/to/v3.34.0.js +7 -10
- package/es/migration/to/v3.36.0.js +13 -15
- package/es/migration/utils.js +1 -1
- package/es/mocks.js +1 -1
- package/es/models/project-schema.js +4 -4
- package/es/models/shape.js +0 -1
- package/es/refs.js +4 -4
- package/es/relationships.js +2 -4
- package/es/schema-transform.js +1 -1
- package/es/schema-util.js +9 -9
- package/es/services.js +2 -2
- package/es/taxonomies.js +1 -1
- package/es/template-shapes/templates.js +4 -4
- package/es/template-shapes/where.js +3 -3
- package/es/types/utils.js +2 -3
- package/es/unions.js +2 -2
- package/es/util/api-indexing.js +1 -1
- package/es/util/detect-cycles.js +1 -1
- package/es/util/form-config.js +4 -8
- package/es/util/get-conflicting-properties.js +1 -1
- package/es/util/merge.js +3 -5
- package/es/validate.js +12 -13
- package/es/workflows.js +4 -1
- package/package.json +6 -6
package/dist/unions.js
CHANGED
|
@@ -9,12 +9,12 @@ exports.isUnionSchema = isUnionSchema;
|
|
|
9
9
|
exports.oneOfToObject = oneOfToObject;
|
|
10
10
|
exports.transformOneOf = transformOneOf;
|
|
11
11
|
exports.wrapOneOfObjects = exports.unwrapOneOfObjects = void 0;
|
|
12
|
-
var _refs = require("./refs");
|
|
13
12
|
var _util = require("@takeshape/util");
|
|
14
13
|
var _omit = _interopRequireDefault(require("lodash/omit"));
|
|
14
|
+
var _errors = require("@takeshape/errors");
|
|
15
|
+
var _refs = require("./refs");
|
|
15
16
|
var _contentSchemaTransform = require("./content-schema-transform");
|
|
16
17
|
var _utils = require("./types/utils");
|
|
17
|
-
var _errors = require("@takeshape/errors");
|
|
18
18
|
var _schemaUtil = require("./schema-util");
|
|
19
19
|
var _templates = require("./template-shapes/templates");
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ShapeLoaders, ProjectSchemaJSON } from '../project-schema';
|
|
2
1
|
import type { Maybe } from '@takeshape/util';
|
|
2
|
+
import type { ShapeLoaders, ProjectSchemaJSON } from '../project-schema';
|
|
3
3
|
import type { GetQueryIndexingConfig, ListQueryIndexingConfig } from '../types';
|
|
4
4
|
export declare function serviceHasIndexedShapes(schema: ProjectSchemaJSON, serviceId: string): boolean;
|
|
5
5
|
export declare function getIndexedServices(projectSchema: ProjectSchemaJSON, configs: ShapeLoaders[keyof ShapeLoaders]): string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-indexing.d.ts","sourceRoot":"","sources":["../../../src/util/api-indexing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"api-indexing.d.ts","sourceRoot":"","sources":["../../../src/util/api-indexing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AAE3C,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EAGlB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAC,sBAAsB,EAAE,uBAAuB,EAAC,MAAM,UAAU,CAAC;AAM9E,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAgB7F;AAED,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,iBAAiB,EAAE,OAAO,EAAE,YAAY,CAAC,MAAM,YAAY,CAAC,YAM7G;AAoBD,KAAK,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC,CAAC;AA4BtF,eAAO,MAAM,wBAAwB,mCAAoC,CAAC;AAC1E,eAAO,MAAM,sBAAsB,uCAAmC,CAAC"}
|
|
@@ -7,8 +7,8 @@ exports.getGetQueryIndexConfig = void 0;
|
|
|
7
7
|
exports.getIndexedServices = getIndexedServices;
|
|
8
8
|
exports.getListQueryIndexConfigs = void 0;
|
|
9
9
|
exports.serviceHasIndexedShapes = serviceHasIndexedShapes;
|
|
10
|
-
var _types = require("../types");
|
|
11
10
|
var _util = require("@takeshape/util");
|
|
11
|
+
var _types = require("../types");
|
|
12
12
|
var _services = require("../services");
|
|
13
13
|
var _schemaUtil = require("../schema-util");
|
|
14
14
|
var _refs = require("../refs");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProjectSchemaJSON, PropertySchema } from '../project-schema';
|
|
1
|
+
import { type ProjectSchemaJSON, type PropertySchema } from '../project-schema';
|
|
2
2
|
type SchemaPredicate = (projectSchema: ProjectSchemaJSON, propSchema: PropertySchema, shapeName?: string, propName?: string) => boolean;
|
|
3
3
|
/**
|
|
4
4
|
* Use a basic depth-first search to determine whether a schema contains a cycle
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect-cycles.d.ts","sourceRoot":"","sources":["../../../src/util/detect-cycles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"detect-cycles.d.ts","sourceRoot":"","sources":["../../../src/util/detect-cycles.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAS9E,KAAK,eAAe,GAAG,CACrB,aAAa,EAAE,iBAAiB,EAChC,UAAU,EAAE,cAAc,EAC1B,SAAS,CAAC,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,MAAM,KACd,OAAO,CAAC;AAEb;;GAEG;AACH,wBAAgB,QAAQ,CACtB,aAAa,EAAE,iBAAiB,EAChC,MAAM,EAAE,cAAc,EACtB,SAAS,GAAE,eAA6B,GACvC,OAAO,CAiDT"}
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.hasCycle = hasCycle;
|
|
7
|
-
var _refs = require("../refs");
|
|
8
7
|
var _util = require("@takeshape/util");
|
|
8
|
+
var _refs = require("../refs");
|
|
9
9
|
function immutableSetAdd(set, str) {
|
|
10
10
|
const result = new Set(set);
|
|
11
11
|
result.add(str);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-shape-at-path.d.ts","sourceRoot":"","sources":["../../../src/util/find-shape-at-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,cAAc,EAAE,SAAS,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"find-shape-at-path.d.ts","sourceRoot":"","sources":["../../../src/util/find-shape-at-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAI9F;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,aAAa,EAAE,iBAAiB,EAChC,MAAM,EAAE,cAAc,EACtB,SAAS,EAAE,MAAM,EAAE,GAClB,cAAc,GAAG,SAAS,CA8B5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,aAAa,EAAE,iBAAiB,EAChC,UAAU,EAAE,cAAc,EAC1B,SAAS,EAAE,MAAM,EAAE,GAClB,SAAS,GAAG,SAAS,CAMvB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { ProjectSchemaJSON } from '../project-schema';
|
|
1
|
+
import { type Maybe } from '@takeshape/util';
|
|
2
|
+
import { type FormConfig, type FormMap, type ProjectSchemaJSON } from '../project-schema';
|
|
4
3
|
/**
|
|
5
4
|
* If there any non-normal (nested) forms in the schema, create forms for referenced shapes.
|
|
6
5
|
* The original forms are left intact.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-config.d.ts","sourceRoot":"","sources":["../../../src/util/form-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"form-config.d.ts","sourceRoot":"","sources":["../../../src/util/form-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,KAAK,EAAC,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAC,KAAK,UAAU,EAAE,KAAK,OAAO,EAAE,KAAK,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAIxF;;;GAGG;AACH,wBAAgB,cAAc,CAAC,aAAa,EAAE,iBAAiB,GAAG,OAAO,CA+CxE;AAID;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,iBAAiB,EAChC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,KAAK,CAAC,UAAU,CAAC,CAYnB"}
|
package/dist/util/form-config.js
CHANGED
|
@@ -20,11 +20,9 @@ function normalizeForms(projectSchema) {
|
|
|
20
20
|
const storeSourceForm = (shapeName, formConfig, propName) => {
|
|
21
21
|
// Leave original forms intact for backwards compatibility
|
|
22
22
|
if (!forms[shapeName]) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
}
|
|
23
|
+
normalizedForms[shapeName] ||= {
|
|
24
|
+
default: (0, _util.deepClone)(formConfig)
|
|
25
|
+
};
|
|
28
26
|
|
|
29
27
|
// Remove prop now that it has been normalized
|
|
30
28
|
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
@@ -58,9 +56,7 @@ function normalizeForms(projectSchema) {
|
|
|
58
56
|
normalizeNested(shapeName, forms[shapeName].default);
|
|
59
57
|
|
|
60
58
|
// copy forms with no changes
|
|
61
|
-
|
|
62
|
-
normalizedForms[shapeName] = forms[shapeName];
|
|
63
|
-
}
|
|
59
|
+
normalizedForms[shapeName] ||= forms[shapeName];
|
|
64
60
|
}
|
|
65
61
|
}
|
|
66
62
|
return normalizedForms;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ShapeJSON } from '../project-schema';
|
|
2
|
-
import { ServicesShapesContext } from '../refs';
|
|
1
|
+
import { type ShapeJSON } from '../project-schema';
|
|
2
|
+
import { type ServicesShapesContext } from '../refs';
|
|
3
3
|
/**
|
|
4
4
|
* Given a list of shapes find the conflicting props
|
|
5
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-conflicting-properties.d.ts","sourceRoot":"","sources":["../../../src/util/get-conflicting-properties.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-conflicting-properties.d.ts","sourceRoot":"","sources":["../../../src/util/get-conflicting-properties.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,KAAK,SAAS,EAAC,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAkE,KAAK,qBAAqB,EAAC,MAAM,SAAS,CAAC;AAqBpH;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAoCzG"}
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getConflictingProperties = getConflictingProperties;
|
|
7
|
-
var _refs = require("../refs");
|
|
8
7
|
var _util = require("@takeshape/util");
|
|
8
|
+
var _refs = require("../refs");
|
|
9
9
|
var _types = require("../types");
|
|
10
10
|
/**
|
|
11
11
|
* Normalize ref, oneOf and array schemas and get a list of @ref expressions
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ProjectSchemaJSON, PropertySchema, QueryJSON, ShapeJSON } from '../project-schema';
|
|
2
|
-
import { ServicesShapesContext } from '../refs';
|
|
1
|
+
import { type ProjectSchemaJSON, type PropertySchema, type QueryJSON, type ShapeJSON } from '../project-schema';
|
|
2
|
+
import { type ServicesShapesContext } from '../refs';
|
|
3
3
|
export declare function getReturnShapeRef(context: ServicesShapesContext, propOrQuery: PropertySchema | QueryJSON): import("@takeshape/util").Maybe<import("../refs").RefItem>;
|
|
4
4
|
export declare function getReturnShape(projectSchema: ProjectSchemaJSON, propOrQuery: PropertySchema | QueryJSON): ShapeJSON | undefined;
|
|
5
5
|
//# sourceMappingURL=get-return-shape.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-return-shape.d.ts","sourceRoot":"","sources":["../../../src/util/get-return-shape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"get-return-shape.d.ts","sourceRoot":"","sources":["../../../src/util/get-return-shape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAC9G,OAAO,EAA2C,KAAK,qBAAqB,EAAC,MAAM,SAAS,CAAC;AAwB7F,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,cAAc,GAAG,SAAS,8DAExG;AAGD,wBAAgB,cAAc,CAC5B,aAAa,EAAE,iBAAiB,EAChC,WAAW,EAAE,cAAc,GAAG,SAAS,GACtC,SAAS,GAAG,SAAS,CAQvB"}
|
package/dist/util/has-arg.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Args, ProjectSchemaJSON } from '../project-schema';
|
|
2
|
-
import { SchemaWithArgs } from '../types';
|
|
1
|
+
import { type Args, type ProjectSchemaJSON } from '../project-schema';
|
|
2
|
+
import { type SchemaWithArgs } from '../types';
|
|
3
3
|
export declare function getArgs(prop: SchemaWithArgs): Args | undefined;
|
|
4
4
|
export declare function hasArg(projectSchema: ProjectSchemaJSON, prop: SchemaWithArgs, argPath: string | string[]): boolean;
|
|
5
5
|
//# sourceMappingURL=has-arg.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"has-arg.d.ts","sourceRoot":"","sources":["../../../src/util/has-arg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"has-arg.d.ts","sourceRoot":"","sources":["../../../src/util/has-arg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,IAAI,EAAE,KAAK,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAC,KAAK,cAAc,EAAC,MAAM,UAAU,CAAC;AAG7C,wBAAgB,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,CAE9D;AAED,wBAAgB,MAAM,CAAC,aAAa,EAAE,iBAAiB,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAWlH"}
|
package/dist/util/merge.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormConfig, ObjectSchema, ProjectSchemaJSON } from '../project-schema';
|
|
1
|
+
import { type FormConfig, type ObjectSchema, type ProjectSchemaJSON } from '../project-schema';
|
|
2
2
|
export declare function mergeObjectSchemas(...args: Array<ObjectSchema | undefined>): ObjectSchema;
|
|
3
3
|
export declare function mergeSchemaProperties(parent: ObjectSchema, overrides: ObjectSchema): ObjectSchema;
|
|
4
4
|
export declare function rebaseSchemaProperties(base: ObjectSchema, parent: ObjectSchema, head: ObjectSchema): ObjectSchema;
|
package/dist/util/merge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../src/util/merge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../src/util/merge.ts"],"names":[],"mappings":"AAWA,OAAO,EAAC,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,KAAK,iBAAiB,EAAiB,MAAM,mBAAmB,CAAC;AAE7G,wBAAgB,kBAAkB,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,SAAS,CAAC,GAAG,YAAY,CAEzF;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,GAAG,YAAY,CAgBjG;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,GAAG,YAAY,CAiBjH;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,GAAG,UAAU,CAezF;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,GAAG,UAAU,CAgBvG;AAED,wBAAgB,gBAAgB,CAAC,GAAG,OAAO,EAAE,UAAU,EAAE,GAAG,UAAU,CAErE;AAiLD,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,iBAAiB,EACvB,MAAM,EAAE,iBAAiB,EACzB,IAAI,EAAE,iBAAiB,GACtB;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,SAAS,CAAA;CAAC,GAAG;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,YAAY,EAAE,iBAAiB,CAAA;CAAC,CAwChG"}
|
package/dist/util/merge.js
CHANGED
|
@@ -18,9 +18,9 @@ var _unset = _interopRequireDefault(require("lodash/unset"));
|
|
|
18
18
|
var _set = _interopRequireDefault(require("lodash/set"));
|
|
19
19
|
var _last = _interopRequireDefault(require("lodash/last"));
|
|
20
20
|
var _omit = _interopRequireDefault(require("lodash/omit"));
|
|
21
|
-
var _types = require("../types");
|
|
22
21
|
var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
|
|
23
22
|
var _pickBy = _interopRequireDefault(require("lodash/pickBy"));
|
|
23
|
+
var _types = require("../types");
|
|
24
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
25
|
function mergeObjectSchemas(...args) {
|
|
26
26
|
return args.filter(_util.isDefined).reduce(mergeSchemaProperties, {
|
|
@@ -153,7 +153,7 @@ function compareSection(section, original, updated) {
|
|
|
153
153
|
return changes;
|
|
154
154
|
}
|
|
155
155
|
function compareSections(parent, branch) {
|
|
156
|
-
return mergeableSections.flatMap(section => parent[section]
|
|
156
|
+
return mergeableSections.flatMap(section => parent[section] ?? branch[section] ? compareSection(section, parent[section] ?? {}, branch[section] ?? {}) : []);
|
|
157
157
|
}
|
|
158
158
|
function findChangedShape(schema, change) {
|
|
159
159
|
return schema.shapes[change.path[1]];
|
|
@@ -205,9 +205,7 @@ function attemptToMerge(base, parent, head, change) {
|
|
|
205
205
|
mergedObjSchema = rebaseSchemaProperties(toObj, baseObj, fromObj);
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
|
|
209
|
-
mergedObjSchema = mergeSchemaProperties(toObj, fromObj);
|
|
210
|
-
}
|
|
208
|
+
mergedObjSchema ||= mergeSchemaProperties(toObj, fromObj);
|
|
211
209
|
return {
|
|
212
210
|
...rebaseShapeProperties(toShape, fromShape, baseShape),
|
|
213
211
|
schema: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ProjectSchemaJSON } from '../project-schema';
|
|
2
|
-
import { ProjectSchemaUpdate } from '../migration/types';
|
|
1
|
+
import { type ProjectSchemaJSON } from '../project-schema';
|
|
2
|
+
import { type ProjectSchemaUpdate } from '../migration/types';
|
|
3
3
|
export declare function shallowMerge<T>(original: Record<string, T> | undefined, update: Record<string, T | null> | undefined): Record<string, T>;
|
|
4
4
|
/**
|
|
5
5
|
* Apply a schema update to a schema.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patch-schema.d.ts","sourceRoot":"","sources":["../../../src/util/patch-schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"patch-schema.d.ts","sourceRoot":"","sources":["../../../src/util/patch-schema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAC,KAAK,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AAI5D,wBAAgB,YAAY,CAAC,CAAC,EAC5B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,SAAS,EACvC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,SAAS,GAC3C,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAenB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,iBAAiB,EAAE,aAAa,EAAE,CAAC,EAAE,MAAM,EAAE,mBAAmB,GAAG,CAAC,CAczG"}
|
package/dist/validate.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ErrorObject } from 'ajv';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { type SchemaValidationErrorItem } from '@takeshape/errors';
|
|
3
|
+
import { type Entitlements } from '@takeshape/util';
|
|
4
|
+
import { type SetRequired } from 'type-fest';
|
|
4
5
|
import type { AnyProjectSchemaJSON, ProjectSchemaJSON } from './project-schema';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { SetRequired } from 'type-fest';
|
|
6
|
+
import type { ProjectSchemaImport, LayerState } from './types/types';
|
|
7
|
+
import type { RoleImport, RoleInput } from './auth-schemas';
|
|
8
8
|
export type SchemaValidationResult = {
|
|
9
9
|
valid: true;
|
|
10
10
|
schema: AnyProjectSchemaJSON;
|
|
@@ -15,22 +15,22 @@ export type SchemaValidationResult = {
|
|
|
15
15
|
errors: SchemaValidationErrorItem[];
|
|
16
16
|
};
|
|
17
17
|
export declare function formatError(error: ErrorObject): SchemaValidationErrorItem;
|
|
18
|
-
export
|
|
18
|
+
export type Validation = {
|
|
19
19
|
version: string;
|
|
20
20
|
schemaId: string;
|
|
21
21
|
isVersion: (schemaVersion?: string) => boolean;
|
|
22
22
|
validate: (schema: unknown, options?: ValidateSyntaxOptions) => SchemaValidationResult;
|
|
23
|
-
}
|
|
24
|
-
export
|
|
23
|
+
};
|
|
24
|
+
export type ValidateSyntaxOptions = {
|
|
25
25
|
suppressErrorPaths?: string[];
|
|
26
26
|
resolveLayer?: ResolveLayer;
|
|
27
|
-
}
|
|
27
|
+
};
|
|
28
28
|
export type ResolveLayer = (layerId: string) => Promise<LayerState>;
|
|
29
|
-
export
|
|
29
|
+
export type ValidateContext = {
|
|
30
30
|
resolveLayer?: ResolveLayer;
|
|
31
31
|
allowDisconnectedLayers?: boolean;
|
|
32
32
|
entitlements: Entitlements;
|
|
33
|
-
}
|
|
33
|
+
} & ValidateSyntaxOptions;
|
|
34
34
|
export type ValidateReferencesContext = SetRequired<ValidateContext, 'resolveLayer'>;
|
|
35
35
|
export declare function validateSchemaSyntax(obj: unknown, options?: ValidateSyntaxOptions): SchemaValidationResult;
|
|
36
36
|
/**
|
package/dist/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;
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,WAAW,EAAC,MAAM,KAAK,CAAC;AAGvD,OAAO,EAAwB,KAAK,yBAAyB,EAAC,MAAM,mBAAmB,CAAC;AAKxF,OAAO,EAEL,KAAK,YAAY,EAKlB,MAAM,iBAAiB,CAAC;AAUzB,OAAO,EAAC,KAAK,WAAW,EAAC,MAAM,WAAW,CAAC;AA6B3C,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EAYlB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAC,mBAAmB,EAAE,UAAU,EAAc,MAAM,eAAe,CAAC;AAChF,OAAO,KAAK,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AA82B1D,MAAM,MAAM,sBAAsB,GAC9B;IAAC,KAAK,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,oBAAoB,CAAC;IAAC,MAAM,EAAE,SAAS,CAAA;CAAC,GAC9D;IAAC,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,yBAAyB,EAAE,CAAA;CAAC,CAAC;AAE3E,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,yBAAyB,CAuBzE;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,CAAC,aAAa,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;IAC/C,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,qBAAqB,KAAK,sBAAsB,CAAC;CACxF,CAAC;AACF,MAAM,MAAM,qBAAqB,GAAG;IAClC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;AAEpE,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,YAAY,EAAE,YAAY,CAAC;CAC5B,GAAG,qBAAqB,CAAC;AAE1B,MAAM,MAAM,yBAAyB,GAAG,WAAW,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;AAmHrF,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,GAAE,qBAA0B,GAAG,sBAAsB,CAW9G;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAgC5G;AAED,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,OAAO,GAAG,iBAAiB,CAgB7E;AAgBD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,OAAO,GAAG,SAAS,CAQpE;AAgBD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,OAAO,GAAG,UAAU,CAQrE;AAED,MAAM,MAAM,mCAAmC,GAC3C;IAAC,KAAK,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,mBAAmB,CAAC;IAAC,MAAM,EAAE,SAAS,CAAA;CAAC,GAC7D;IAAC,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,yBAAyB,EAAE,CAAA;CAAC,CAAC;AAE3E;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,OAAO,GAAG,mCAAmC,CAIrG;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,WAAW,EAAE,OAAO,GAAG,mBAAmB,CAQxF"}
|
package/dist/validate.js
CHANGED
|
@@ -11,7 +11,6 @@ exports.validateProjectSchemaImport = validateProjectSchemaImport;
|
|
|
11
11
|
exports.validateRoleInput = validateRoleInput;
|
|
12
12
|
exports.validateSchema = validateSchema;
|
|
13
13
|
exports.validateSchemaSyntax = validateSchemaSyntax;
|
|
14
|
-
var _types = require("./types/types");
|
|
15
14
|
var _jsonpathPlus = require("jsonpath-plus");
|
|
16
15
|
var _jsonSchema = require("@takeshape/json-schema");
|
|
17
16
|
var _errors = require("@takeshape/errors");
|
|
@@ -19,6 +18,16 @@ var _coerce = _interopRequireDefault(require("semver/functions/coerce"));
|
|
|
19
18
|
var _neq = _interopRequireDefault(require("semver/functions/neq"));
|
|
20
19
|
var _lt = _interopRequireDefault(require("semver/functions/lt"));
|
|
21
20
|
var _isUndefined = _interopRequireDefault(require("lodash/isUndefined"));
|
|
21
|
+
var _util = require("@takeshape/util");
|
|
22
|
+
var _uniqBy = _interopRequireDefault(require("lodash/uniqBy"));
|
|
23
|
+
var _initial = _interopRequireDefault(require("lodash/initial"));
|
|
24
|
+
var _last = _interopRequireDefault(require("lodash/last"));
|
|
25
|
+
var _get = _interopRequireDefault(require("lodash/get"));
|
|
26
|
+
var _size = _interopRequireDefault(require("lodash/size"));
|
|
27
|
+
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
28
|
+
var _pick = _interopRequireDefault(require("lodash/pick"));
|
|
29
|
+
var _pMap = _interopRequireDefault(require("p-map"));
|
|
30
|
+
var _lodash = require("lodash");
|
|
22
31
|
var _versions = require("./versions");
|
|
23
32
|
var _workflows = require("./workflows");
|
|
24
33
|
var _schemas = require("./schemas");
|
|
@@ -31,17 +40,8 @@ var _refs = require("./refs");
|
|
|
31
40
|
var _scalars = require("./scalars");
|
|
32
41
|
var _unions = require("./unions");
|
|
33
42
|
var _enum = require("./enum");
|
|
34
|
-
var _util = require("@takeshape/util");
|
|
35
|
-
var _uniqBy = _interopRequireDefault(require("lodash/uniqBy"));
|
|
36
|
-
var _initial = _interopRequireDefault(require("lodash/initial"));
|
|
37
|
-
var _last = _interopRequireDefault(require("lodash/last"));
|
|
38
43
|
var _relationships = require("./relationships");
|
|
39
|
-
var
|
|
40
|
-
var _size = _interopRequireDefault(require("lodash/size"));
|
|
41
|
-
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
42
|
-
var _pick = _interopRequireDefault(require("lodash/pick"));
|
|
43
|
-
var _pMap = _interopRequireDefault(require("p-map"));
|
|
44
|
-
var _lodash = require("lodash");
|
|
44
|
+
var _types = require("./types/types");
|
|
45
45
|
var _projectSchema = require("./project-schema");
|
|
46
46
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
47
47
|
const builtInShapeNames = new Set([...Object.keys(_builtinSchema.builtInShapes), ..._scalars.scalars, 'object']);
|
|
@@ -147,8 +147,6 @@ function enumerateBasicResolvers(resolver, path) {
|
|
|
147
147
|
visit(resolver, path);
|
|
148
148
|
return results;
|
|
149
149
|
}
|
|
150
|
-
|
|
151
|
-
// eslint-disable-next-line complexity
|
|
152
150
|
function validateResolver(projectSchema, basePath, baseResolver) {
|
|
153
151
|
const errors = [];
|
|
154
152
|
const isValidShapeName = shapeName => {
|
|
@@ -199,6 +197,7 @@ function validateResolver(projectSchema, basePath, baseResolver) {
|
|
|
199
197
|
const parsed = (0, _refs.parsePropertyRef)(resolver.to);
|
|
200
198
|
if (parsed) {
|
|
201
199
|
const error = delegateResolverMissingConfig(parsed, resolver);
|
|
200
|
+
// eslint-disable-next-line max-depth
|
|
202
201
|
if (error) {
|
|
203
202
|
errors.push(error);
|
|
204
203
|
}
|
package/dist/workflows.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ProjectSchemaJSON, PropertySchema, Workflow, WorkflowMap, WorkflowStep, ShapeJSON } from './project-schema';
|
|
1
|
+
import { type ProjectSchemaJSON, type PropertySchema, type Workflow, type WorkflowMap, type WorkflowStep, type ShapeJSON } from './project-schema';
|
|
2
2
|
export declare const defaultWorkflow: Workflow;
|
|
3
3
|
export declare function getWorkflow(projectSchema: ProjectSchemaJSON, shapeId: string): Workflow;
|
|
4
|
-
export
|
|
4
|
+
export type StepContext = {
|
|
5
5
|
index: number;
|
|
6
6
|
step: WorkflowStep;
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
8
|
export declare function statusFallback(workflow: Workflow, enabled: boolean): WorkflowStep;
|
|
9
9
|
export declare function findWorkflowStep(workflow: Workflow, keyOrName: string): StepContext | undefined;
|
|
10
10
|
export declare function getStatusField(workflows: WorkflowMap, shape: Pick<ShapeJSON, 'workflow'>): PropertySchema;
|
package/dist/workflows.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../src/workflows.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../src/workflows.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,kBAAkB,CAAC;AAG1B,eAAO,MAAM,eAAe,EAAE,QAmB7B,CAAC;AAEF,wBAAgB,WAAW,CAAC,aAAa,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,GAAG,QAAQ,CAQvF;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,YAAY,CAAC;CACpB,CAAC;AAEF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,YAAY,CAEjF;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAG/F;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,cAAc,CAYzG;AAED,MAAM,MAAM,6BAA6B,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtF,wBAAgB,YAAY,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,6BAA6B,GAAG,YAAY,EAAE,CASpH;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,6BAA6B,GAAG,MAAM,EAAE,CAQpH;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,EAAE,CAE5D"}
|
package/dist/workflows.js
CHANGED
|
@@ -47,7 +47,10 @@ function findWorkflowStep(workflow, keyOrName) {
|
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
function getStatusField(workflows, shape) {
|
|
50
|
-
|
|
50
|
+
let workflow = defaultWorkflow;
|
|
51
|
+
if (shape.workflow && workflows[shape.workflow]) {
|
|
52
|
+
workflow = workflows[shape.workflow];
|
|
53
|
+
}
|
|
51
54
|
return {
|
|
52
55
|
type: 'string',
|
|
53
56
|
title: 'Status',
|
|
@@ -39,7 +39,7 @@ export function preferSourceKey(name, schema) {
|
|
|
39
39
|
}
|
|
40
40
|
export function findTransforms(pluginMap, schema, name, shape) {
|
|
41
41
|
const type = getType(schema);
|
|
42
|
-
if (pluginMap && (pluginMap[type]
|
|
42
|
+
if (pluginMap && (pluginMap[type] ?? pluginMap['*'])) {
|
|
43
43
|
const plugins = (pluginMap[type] ?? []).concat(pluginMap['*'] ?? []);
|
|
44
44
|
return plugins.find(plugin => plugin.filter(schema, name, shape));
|
|
45
45
|
}
|
package/es/enum.js
CHANGED
|
@@ -3,7 +3,7 @@ export function isEnumLikeSchema(schema) {
|
|
|
3
3
|
return true;
|
|
4
4
|
}
|
|
5
5
|
if (schema.oneOf) {
|
|
6
|
-
return schema.oneOf.every(optionSchema => optionSchema.title !== undefined && (optionSchema.enum
|
|
6
|
+
return schema.oneOf.every(optionSchema => optionSchema.title !== undefined && (optionSchema.enum ?? optionSchema.const));
|
|
7
7
|
}
|
|
8
8
|
return false;
|
|
9
9
|
}
|
package/es/flatten-templates.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { resolveTemplate, isValidTemplate } from './template-shapes';
|
|
2
|
-
import { getAllRefs } from './schema-util';
|
|
3
1
|
import set from 'lodash/set';
|
|
4
2
|
import { deepClone } from '@takeshape/util';
|
|
3
|
+
import { resolveTemplate, isValidTemplate } from './template-shapes';
|
|
4
|
+
import { getAllRefs } from './schema-util';
|
|
5
5
|
import { refItemToNamespacedShapeName } from './refs';
|
|
6
6
|
export function flattenTemplates(projectSchema) {
|
|
7
7
|
const templateRefs = getAllRefs(projectSchema, ref => Boolean(ref.template));
|
package/es/get-is-leaf.js
CHANGED
|
@@ -11,7 +11,7 @@ function isLeafTypeV3(projectSchema, propertySchema) {
|
|
|
11
11
|
// If is not a structure, then is a leaf
|
|
12
12
|
!['object', 'array'].includes(type) ||
|
|
13
13
|
// If is relationship, then is a leaf
|
|
14
|
-
isPropertySchemaWithRelationship(propertySchema['@output'] ?? propertySchema) || propertySchema['@tag'] && scalarTags.has(propertySchema['@tag']) ||
|
|
14
|
+
isPropertySchemaWithRelationship(propertySchema['@output'] ?? propertySchema) || Boolean(propertySchema['@tag'] && scalarTags.has(propertySchema['@tag'])) ||
|
|
15
15
|
// If is array, then should not be a synchronized structure
|
|
16
16
|
type === 'array' && !propertySchema['@syncLocaleStructure'] || isBuiltinType(projectSchema, propertySchema)));
|
|
17
17
|
}
|
package/es/index.js
CHANGED
|
@@ -9,12 +9,11 @@ export * from './services';
|
|
|
9
9
|
export * from './template-shapes';
|
|
10
10
|
export * from './taxonomies';
|
|
11
11
|
export * from './workflows';
|
|
12
|
-
export * from './builtin-schema';
|
|
13
12
|
export * from './auth-schemas';
|
|
14
13
|
export * from './api-version';
|
|
15
14
|
export * from './migration';
|
|
16
15
|
export * from './validate';
|
|
17
|
-
export
|
|
16
|
+
export * from './builtin-schema';
|
|
18
17
|
export * from './versions';
|
|
19
18
|
export * from './mocks';
|
|
20
19
|
export * from './util';
|
|
@@ -29,4 +28,5 @@ export * from './flatten-templates';
|
|
|
29
28
|
export * from './relationships';
|
|
30
29
|
export * from './create-input-schema';
|
|
31
30
|
export * from './schema-transform';
|
|
32
|
-
export * from './interfaces';
|
|
31
|
+
export * from './interfaces';
|
|
32
|
+
export {};
|
package/es/interfaces.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getRef, refItemToShape, refItemToNamespacedShapeName, normalizeRefExpression, shapeToRefItem, refExpressionToRefItem } from './refs';
|
|
2
1
|
import mapValues from 'lodash/mapValues';
|
|
3
|
-
import { isUnionSchema } from './unions';
|
|
4
2
|
import { isDefined } from '@takeshape/util';
|
|
3
|
+
import { getRef, refItemToShape, refItemToNamespacedShapeName, normalizeRefExpression, shapeToRefItem, refExpressionToRefItem } from './refs';
|
|
4
|
+
import { isUnionSchema } from './unions';
|
|
5
5
|
export function isInterfaceShape(shape) {
|
|
6
6
|
return shape?.type === 'interface';
|
|
7
7
|
}
|
package/es/layers/layers.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import minimatch from 'minimatch';
|
|
2
2
|
import { deepClone, isDefined, isRecord } from '@takeshape/util';
|
|
3
3
|
import uniq from 'lodash/uniq';
|
|
4
|
+
import set from 'lodash/set';
|
|
5
|
+
import { parseTemplateShape } from '../refs';
|
|
4
6
|
import { getArgsReferenceWithPath, getRefOrItemsRef, dereferenceSchema, parseReturnShape, refItemToString, splitAtRef } from './refs';
|
|
5
7
|
import { isAllOfSchema, isObjectSchema, isOneOfSchema, isRefSchema } from './type-utils';
|
|
6
8
|
import { visitSchemaProperties } from './visitor';
|
|
7
|
-
import set from 'lodash/set';
|
|
8
|
-
import { parseTemplateShape } from '../refs';
|
|
9
9
|
const layerDefaults = {
|
|
10
10
|
namespace: '',
|
|
11
11
|
visibility: []
|
|
@@ -181,9 +181,7 @@ function collectServiceRefs(flattenedSchema, getLayer) {
|
|
|
181
181
|
return refs;
|
|
182
182
|
}
|
|
183
183
|
function ensureServiceLayer(flattenedSchema, layerId) {
|
|
184
|
-
|
|
185
|
-
flattenedSchema.serviceLayers = {};
|
|
186
|
-
}
|
|
184
|
+
flattenedSchema.serviceLayers ||= {};
|
|
187
185
|
let serviceLayer = flattenedSchema.serviceLayers[layerId];
|
|
188
186
|
if (!serviceLayer) {
|
|
189
187
|
serviceLayer = {
|
|
@@ -304,9 +302,7 @@ export function flattenSchema(projectSchema, getLayer) {
|
|
|
304
302
|
const shape = getLayer(layerId)?.shapes?.[shapeName];
|
|
305
303
|
if (shape) {
|
|
306
304
|
const serviceLayer = ensureServiceLayer(flattenedSchema, layerId);
|
|
307
|
-
|
|
308
|
-
serviceLayer.shapes = {};
|
|
309
|
-
}
|
|
305
|
+
serviceLayer.shapes ||= {};
|
|
310
306
|
serviceLayer.shapes[shapeName] = shape;
|
|
311
307
|
}
|
|
312
308
|
}
|
package/es/layers/refs.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { isAllOfSchema, isOneOfSchema, isRefSchema } from './type-utils';
|
|
2
|
-
import { parseTemplateShape } from '../refs';
|
|
3
1
|
import assign from 'lodash/fp/assign';
|
|
4
2
|
import omit from 'lodash/fp/omit';
|
|
5
3
|
import { mergeWithArrayConcat } from '@takeshape/util';
|
|
6
4
|
import isEmpty from 'lodash/isEmpty';
|
|
5
|
+
import { parseTemplateShape } from '../refs';
|
|
6
|
+
import { isAllOfSchema, isOneOfSchema, isRefSchema } from './type-utils';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* This interface describes a parsed `@ref` or `$ref`.
|
|
@@ -13,7 +13,7 @@ function isColor(schema) {
|
|
|
13
13
|
type,
|
|
14
14
|
properties
|
|
15
15
|
} = schema;
|
|
16
|
-
return Boolean(type === 'object' && properties
|
|
16
|
+
return Boolean(type === 'object' && properties?.hsl && properties.hsv && properties.rgb && properties.hex);
|
|
17
17
|
}
|
|
18
18
|
function getModelType(contentType) {
|
|
19
19
|
if (contentType.single) {
|
|
@@ -60,18 +60,16 @@ const migrate = async (_, projectSchema) => {
|
|
|
60
60
|
if (indexedShapes) {
|
|
61
61
|
for (const [name, config] of Object.entries(indexedShapes)) {
|
|
62
62
|
let shape = updatedShapes[name];
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
};
|
|
74
|
-
}
|
|
63
|
+
shape ||= {
|
|
64
|
+
name,
|
|
65
|
+
id: name,
|
|
66
|
+
title: name,
|
|
67
|
+
schema: {
|
|
68
|
+
extends: [{
|
|
69
|
+
'@ref': normalizeRefExpression(projectSchema, name)
|
|
70
|
+
}]
|
|
71
|
+
}
|
|
72
|
+
};
|
|
75
73
|
const loaders = queriesToLoaders(config.queries);
|
|
76
74
|
if (loaders) {
|
|
77
75
|
shape.loaders = loaders;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { deepClone } from '@takeshape/util';
|
|
2
|
-
import { createSchemaPropertyAccessor, SERVICE_OBJECT_PATTERN_NAME } from '../../schema-util';
|
|
3
|
-
import { getRefOrItemsRef } from '../../refs';
|
|
4
2
|
import upperFirst from 'lodash/upperFirst';
|
|
5
3
|
import set from 'lodash/fp/set';
|
|
6
4
|
import unset from 'lodash/fp/unset';
|
|
5
|
+
import { createSchemaPropertyAccessor, SERVICE_OBJECT_PATTERN_NAME } from '../../schema-util';
|
|
6
|
+
import { getRefOrItemsRef } from '../../refs';
|
|
7
7
|
import { getServiceObjectFields } from '../../services';
|
|
8
8
|
import { CURRENT_SCHEMA_VERSION } from '../../schemas';
|
|
9
9
|
|
|
@@ -27,11 +27,9 @@ export function normalizeForms(projectSchema) {
|
|
|
27
27
|
forms = {}
|
|
28
28
|
} = projectSchema;
|
|
29
29
|
const storeSourceForm = (shapeName, formConfig, propName) => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
34
|
-
}
|
|
30
|
+
normalizedForms[shapeName] ||= {
|
|
31
|
+
default: deepClone(formConfig)
|
|
32
|
+
};
|
|
35
33
|
const propConfig = normalizedForms[shapeName].default.properties[propName];
|
|
36
34
|
delete propConfig.properties;
|
|
37
35
|
delete propConfig.order;
|
|
@@ -64,9 +62,7 @@ export function normalizeForms(projectSchema) {
|
|
|
64
62
|
normalizeNested(shapeName, forms[shapeName].default);
|
|
65
63
|
|
|
66
64
|
// copy forms with no changes
|
|
67
|
-
|
|
68
|
-
normalizedForms[shapeName] = forms[shapeName];
|
|
69
|
-
}
|
|
65
|
+
normalizedForms[shapeName] ||= forms[shapeName];
|
|
70
66
|
}
|
|
71
67
|
}
|
|
72
68
|
return normalizedForms;
|
|
@@ -107,6 +103,7 @@ export function migrateInterfaceShapes(projectSchema) {
|
|
|
107
103
|
continue;
|
|
108
104
|
}
|
|
109
105
|
for (const template of ['CreateArgs', 'UpdateArgs']) {
|
|
106
|
+
// eslint-disable-next-line max-depth
|
|
110
107
|
if (mutation.args === `${template}<${interfaceShapeName}>`) {
|
|
111
108
|
updatedProjectSchema = set(['mutations', mutationName], {
|
|
112
109
|
...mutation,
|