@takeshape/schema 8.32.0 → 8.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/migration-utils.js +186 -0
- package/es/migration.js +105 -4
- package/es/mocks.js +1 -0
- package/es/project-schema/index.js +1 -0
- package/es/project-schema/v3.11.0.js +1 -0
- package/es/schemas/index.js +4 -3
- package/es/schemas/index.ts +4 -2
- package/es/schemas/project-schema/v3.11.0.json +2135 -0
- package/es/services.js +57 -255
- package/es/types/types.js +9 -0
- package/es/types/utils.js +19 -12
- package/examples/latest/blog-schema.json +2 -1
- package/examples/latest/brewery-schema.json +2 -1
- package/examples/latest/complex-project-schema.json +2 -1
- package/examples/latest/fabric-ecommerce.json +2 -2
- package/examples/latest/frank-and-fred-schema.json +2 -1
- package/examples/latest/massive-schema.json +2 -1
- package/examples/latest/mill-components-schema.json +2 -1
- package/examples/latest/pet-oneof-array.json +2 -1
- package/examples/latest/post-schema.json +2 -1
- package/examples/latest/pruned-shopify-product-schema.json +2 -2
- package/examples/latest/real-world-schema.json +2 -1
- package/examples/latest/recursive-repeater-schema.json +2 -1
- package/examples/latest/recursive-schema.json +2 -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 +2 -1
- package/examples/latest/shape-books-v3_2_0.json +2 -1
- package/examples/latest/shape-books.json +2 -1
- package/examples/latest/shopify-lookbook.json +1 -1
- package/examples/latest/shopify-store-with-widget.json +2 -2
- package/examples/latest/stripe-starter-resolved.json +2 -2
- package/examples/latest/user-schema-no-required.json +2 -1
- package/examples/latest/user-schema-with-defaults.json +2 -1
- package/lib/migration-utils.d.ts +18 -0
- package/lib/migration-utils.d.ts.map +1 -0
- package/lib/migration-utils.js +203 -0
- package/lib/migration.d.ts +3 -3
- package/lib/migration.d.ts.map +1 -1
- package/lib/migration.js +110 -5
- package/lib/mocks.d.ts.map +1 -1
- package/lib/mocks.js +1 -0
- package/lib/project-schema/index.d.ts +3 -1
- package/lib/project-schema/index.d.ts.map +1 -1
- package/lib/project-schema/index.js +26 -13
- package/lib/project-schema/latest.d.ts +26 -17
- package/lib/project-schema/latest.d.ts.map +1 -1
- package/lib/project-schema/v3.11.0.d.ts +1211 -0
- package/lib/project-schema/v3.11.0.d.ts.map +1 -0
- package/lib/project-schema/v3.11.0.js +5 -0
- package/lib/schemas/index.d.ts +2051 -2
- package/lib/schemas/index.d.ts.map +1 -1
- package/lib/schemas/index.js +17 -15
- package/lib/schemas/index.ts +4 -2
- package/lib/schemas/project-schema/v3.11.0.json +2135 -0
- package/lib/services.d.ts +11 -27
- package/lib/services.d.ts.map +1 -1
- package/lib/services.js +54 -261
- package/lib/types/types.d.ts +16 -5
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/types.js +9 -0
- package/lib/types/utils.d.ts +8 -5
- package/lib/types/utils.d.ts.map +1 -1
- package/lib/types/utils.js +25 -13
- package/lib/validate.d.ts +1 -1
- package/lib/validate.d.ts.map +1 -1
- package/package.json +4 -4
package/lib/types/utils.js
CHANGED
|
@@ -13,6 +13,7 @@ exports.isBasicAuthentication = isBasicAuthentication;
|
|
|
13
13
|
exports.isBasicResolver = isBasicResolver;
|
|
14
14
|
exports.isBearerAuthentication = isBearerAuthentication;
|
|
15
15
|
exports.isComposeResolver = isComposeResolver;
|
|
16
|
+
exports.isCustomAuthentication = isCustomAuthentication;
|
|
16
17
|
exports.isDirectiveConfig = isDirectiveConfig;
|
|
17
18
|
exports.isDirectiveMappingArray = isDirectiveMappingArray;
|
|
18
19
|
exports.isDirectiveMappingMap = isDirectiveMappingMap;
|
|
@@ -22,6 +23,7 @@ exports.isGraphQLServiceConfig = isGraphQLServiceConfig;
|
|
|
22
23
|
exports.isGraphqlResolver = isGraphqlResolver;
|
|
23
24
|
exports.isLatestProjectSchema = void 0;
|
|
24
25
|
exports.isOAuth2Authentication = isOAuth2Authentication;
|
|
26
|
+
exports.isOAuth2BearerAuthentication = isOAuth2BearerAuthentication;
|
|
25
27
|
exports.isObjectSchema = isObjectSchema;
|
|
26
28
|
exports.isOneOfSchema = isOneOfSchema;
|
|
27
29
|
exports.isOpenAPIServiceConfig = isOpenAPIServiceConfig;
|
|
@@ -34,7 +36,7 @@ exports.isParameterSerializeContentOptions = isParameterSerializeContentOptions;
|
|
|
34
36
|
exports.isParameterSerializeStyleForPathParams = isParameterSerializeStyleForPathParams;
|
|
35
37
|
exports.isParameterSerializeStyleForSearchParams = isParameterSerializeStyleForSearchParams;
|
|
36
38
|
exports.isParameterSerializeStyleOptions = isParameterSerializeStyleOptions;
|
|
37
|
-
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_10 = exports.isProjectSchemaV3_1 = exports.isProjectSchemaV3 = exports.isProjectSchemaV1 = void 0;
|
|
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_11 = exports.isProjectSchemaV3_10 = exports.isProjectSchemaV3_1 = exports.isProjectSchemaV3 = exports.isProjectSchemaV1 = void 0;
|
|
38
40
|
exports.isProjectSchemaWithServices = isProjectSchemaWithServices;
|
|
39
41
|
exports.isRESTServiceConfig = isRESTServiceConfig;
|
|
40
42
|
exports.isRefSchema = isRefSchema;
|
|
@@ -150,6 +152,8 @@ const isProjectSchemaV3_9 = createVersionPredicate('3.9.0');
|
|
|
150
152
|
exports.isProjectSchemaV3_9 = isProjectSchemaV3_9;
|
|
151
153
|
const isProjectSchemaV3_10 = createVersionPredicate('3.10.0');
|
|
152
154
|
exports.isProjectSchemaV3_10 = isProjectSchemaV3_10;
|
|
155
|
+
const isProjectSchemaV3_11 = createVersionPredicate('3.11.0');
|
|
156
|
+
exports.isProjectSchemaV3_11 = isProjectSchemaV3_11;
|
|
153
157
|
const isLatestProjectSchema = createVersionPredicate(_schemas.CURRENT_SCHEMA_VERSION);
|
|
154
158
|
exports.isLatestProjectSchema = isLatestProjectSchema;
|
|
155
159
|
|
|
@@ -172,7 +176,7 @@ function isAnyProjectSchema(value) {
|
|
|
172
176
|
}
|
|
173
177
|
|
|
174
178
|
const maybeSchema = value;
|
|
175
|
-
return (0, _util.isObject)(value) && (0, _isString.default)(maybeSchema.projectId) && (isProjectSchemaV1(maybeSchema) || isProjectSchemaV3(maybeSchema) || isProjectSchemaV3_1(maybeSchema) || isProjectSchemaV3_2(maybeSchema) || isProjectSchemaV3_3(maybeSchema) || isProjectSchemaV3_4(maybeSchema) || isProjectSchemaV3_5(maybeSchema) || isProjectSchemaV3_5_1(maybeSchema) || isProjectSchemaV3_6(maybeSchema) || isProjectSchemaV3_7(maybeSchema) || isProjectSchemaV3_8(maybeSchema) || isProjectSchemaV3_9(maybeSchema) || isProjectSchemaV3_10(maybeSchema));
|
|
179
|
+
return (0, _util.isObject)(value) && (0, _isString.default)(maybeSchema.projectId) && (isProjectSchemaV1(maybeSchema) || isProjectSchemaV3(maybeSchema) || isProjectSchemaV3_1(maybeSchema) || isProjectSchemaV3_2(maybeSchema) || isProjectSchemaV3_3(maybeSchema) || isProjectSchemaV3_4(maybeSchema) || isProjectSchemaV3_5(maybeSchema) || isProjectSchemaV3_5_1(maybeSchema) || isProjectSchemaV3_6(maybeSchema) || isProjectSchemaV3_7(maybeSchema) || isProjectSchemaV3_8(maybeSchema) || isProjectSchemaV3_9(maybeSchema) || isProjectSchemaV3_10(maybeSchema) || isProjectSchemaV3_11(maybeSchema));
|
|
176
180
|
}
|
|
177
181
|
|
|
178
182
|
function isProjectSchemaWithServices(schema) {
|
|
@@ -352,33 +356,41 @@ function isEncryptedServiceConfig(maybeConfig) {
|
|
|
352
356
|
}
|
|
353
357
|
|
|
354
358
|
function isServiceConfigWithOAuth2Authentication(maybeServiceConfig) {
|
|
355
|
-
return isAnyServiceConfig(maybeServiceConfig) && maybeServiceConfig.
|
|
359
|
+
return isAnyServiceConfig(maybeServiceConfig) && isServiceAuthentication(maybeServiceConfig.authentication) && isOAuth2Authentication(maybeServiceConfig.authentication);
|
|
356
360
|
}
|
|
357
361
|
|
|
358
362
|
function isServiceConfigWithCustomAuthentication(maybeServiceConfig) {
|
|
359
|
-
return isAnyServiceConfig(maybeServiceConfig) && maybeServiceConfig.
|
|
363
|
+
return isAnyServiceConfig(maybeServiceConfig) && isServiceAuthentication(maybeServiceConfig.authentication) && isCustomAuthentication(maybeServiceConfig.authentication);
|
|
360
364
|
}
|
|
361
365
|
/** Authentication Utils **/
|
|
362
366
|
|
|
363
367
|
|
|
364
368
|
function isServiceAuthentication(maybeAuthentication) {
|
|
365
|
-
return maybeAuthentication
|
|
369
|
+
return maybeAuthentication === null || maybeAuthentication === void 0 ? void 0 : maybeAuthentication.type;
|
|
366
370
|
}
|
|
367
371
|
|
|
368
|
-
function isBearerAuthentication(
|
|
369
|
-
return
|
|
372
|
+
function isBearerAuthentication(authentication) {
|
|
373
|
+
return (authentication === null || authentication === void 0 ? void 0 : authentication.type) === 'bearer';
|
|
370
374
|
}
|
|
371
375
|
|
|
372
|
-
function isBasicAuthentication(
|
|
373
|
-
return
|
|
376
|
+
function isBasicAuthentication(authentication) {
|
|
377
|
+
return (authentication === null || authentication === void 0 ? void 0 : authentication.type) === 'basic';
|
|
374
378
|
}
|
|
375
379
|
|
|
376
|
-
function isSearchParamsAuthentication(
|
|
377
|
-
return (
|
|
380
|
+
function isSearchParamsAuthentication(authentication) {
|
|
381
|
+
return (authentication === null || authentication === void 0 ? void 0 : authentication.type) === 'searchParams';
|
|
378
382
|
}
|
|
379
383
|
|
|
380
|
-
function isOAuth2Authentication(
|
|
381
|
-
return
|
|
384
|
+
function isOAuth2Authentication(authentication) {
|
|
385
|
+
return (authentication === null || authentication === void 0 ? void 0 : authentication.type) === 'oauth2';
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
function isOAuth2BearerAuthentication(authentication) {
|
|
389
|
+
return (authentication === null || authentication === void 0 ? void 0 : authentication.type) === 'oauth2Bearer';
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
function isCustomAuthentication(authentication) {
|
|
393
|
+
return (authentication === null || authentication === void 0 ? void 0 : authentication.type) === 'custom';
|
|
382
394
|
}
|
|
383
395
|
/** Miscellaneous Utils **/
|
|
384
396
|
|
package/lib/validate.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { ErrorObject } from 'ajv';
|
|
1
2
|
import type { RoleImport, RoleInput } from './auth-schemas';
|
|
2
3
|
import type { AnyProjectSchema, ProjectSchema, LayerSchemaV4_0_0 } from './project-schema';
|
|
3
4
|
import { SchemaValidationErrorItem } from '@takeshape/errors';
|
|
4
|
-
import { ErrorObject } from 'ajv';
|
|
5
5
|
export declare type SchemaValidationResult = {
|
|
6
6
|
valid: true;
|
|
7
7
|
schema: AnyProjectSchema;
|
package/lib/validate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/validate.ts"],"names":[],"mappings":"
|
|
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,EAElB,MAAM,kBAAkB,CAAC;AAE1B,OA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F"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takeshape/schema",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.33.0",
|
|
4
4
|
"description": "TakeShape Schema",
|
|
5
5
|
"homepage": "https://www.takeshape.io",
|
|
6
6
|
"repository": {
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"examples"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@takeshape/errors": "8.
|
|
25
|
-
"@takeshape/json-schema": "8.
|
|
26
|
-
"@takeshape/util": "8.
|
|
24
|
+
"@takeshape/errors": "8.33.0",
|
|
25
|
+
"@takeshape/json-schema": "8.33.0",
|
|
26
|
+
"@takeshape/util": "8.33.0",
|
|
27
27
|
"ajv": "^7.0.4",
|
|
28
28
|
"ajv-formats": "^1.5.1",
|
|
29
29
|
"lodash": "^4.17.20",
|