@tsed/schema 7.84.0 → 7.85.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/lib/browser/schema.umd.min.js +1 -1
- package/lib/browser/schema.umd.min.js.map +1 -1
- package/lib/cjs/components/default/anyMapper.js +1 -1
- package/lib/cjs/components/default/anyMapper.js.map +1 -1
- package/lib/cjs/components/default/discriminatorMappingMapper.js +26 -0
- package/lib/cjs/components/default/discriminatorMappingMapper.js.map +1 -0
- package/lib/cjs/components/default/{inlineEnumsMapper.js → enumsMapper.js} +5 -5
- package/lib/cjs/components/default/enumsMapper.js.map +1 -0
- package/lib/cjs/components/default/inheritedClassMapper.js +16 -2
- package/lib/cjs/components/default/inheritedClassMapper.js.map +1 -1
- package/lib/cjs/components/default/requiredMapper.js +1 -4
- package/lib/cjs/components/default/requiredMapper.js.map +1 -1
- package/lib/cjs/components/default/schemaMapper.js +7 -10
- package/lib/cjs/components/default/schemaMapper.js.map +1 -1
- package/lib/cjs/components/index.js +4 -1
- package/lib/cjs/components/index.js.map +1 -1
- package/lib/cjs/components/open-spec/discriminatorMappingMapper.js +9 -0
- package/lib/cjs/components/open-spec/discriminatorMappingMapper.js.map +1 -0
- package/lib/cjs/components/open-spec/enumsMapper.js +19 -0
- package/lib/cjs/components/open-spec/enumsMapper.js.map +1 -0
- package/lib/cjs/decorators/common/labelledAs.js +39 -0
- package/lib/cjs/decorators/common/labelledAs.js.map +1 -0
- package/lib/cjs/decorators/generics/genericOf.js +2 -2
- package/lib/cjs/decorators/generics/genericOf.js.map +1 -1
- package/lib/cjs/decorators/operations/returns.js +2 -2
- package/lib/cjs/decorators/operations/returns.js.map +1 -1
- package/lib/cjs/domain/JsonSchema.js +9 -1
- package/lib/cjs/domain/JsonSchema.js.map +1 -1
- package/lib/cjs/fn/allOf.js +16 -0
- package/lib/cjs/fn/allOf.js.map +1 -0
- package/lib/cjs/fn/any.js +14 -0
- package/lib/cjs/fn/any.js.map +1 -0
- package/lib/cjs/fn/anyOf.js +16 -0
- package/lib/cjs/fn/anyOf.js.map +1 -0
- package/lib/cjs/fn/boolean.js +14 -0
- package/lib/cjs/fn/boolean.js.map +1 -0
- package/lib/cjs/fn/collection.js +56 -0
- package/lib/cjs/fn/collection.js.map +1 -0
- package/lib/cjs/fn/date.js +33 -0
- package/lib/cjs/fn/date.js.map +1 -0
- package/lib/cjs/fn/email.js +22 -0
- package/lib/cjs/fn/email.js.map +1 -0
- package/lib/cjs/fn/enums.js +12 -0
- package/lib/cjs/fn/enums.js.map +1 -0
- package/lib/cjs/fn/from.js +32 -0
- package/lib/cjs/fn/from.js.map +1 -0
- package/lib/cjs/fn/integer.js +17 -0
- package/lib/cjs/fn/integer.js.map +1 -0
- package/lib/cjs/fn/lazyRef.js +21 -0
- package/lib/cjs/fn/lazyRef.js.map +1 -0
- package/lib/cjs/fn/number.js +14 -0
- package/lib/cjs/fn/number.js.map +1 -0
- package/lib/cjs/fn/object.js +26 -0
- package/lib/cjs/fn/object.js.map +1 -0
- package/lib/cjs/fn/oneOf.js +17 -0
- package/lib/cjs/fn/oneOf.js.map +1 -0
- package/lib/cjs/fn/string.js +14 -0
- package/lib/cjs/fn/string.js.map +1 -0
- package/lib/cjs/fn/uri.js +17 -0
- package/lib/cjs/fn/uri.js.map +1 -0
- package/lib/cjs/fn/url.js +15 -0
- package/lib/cjs/fn/url.js.map +1 -0
- package/lib/cjs/index.js +22 -2
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/registries/JsonSchemaMapperContainer.js +3 -3
- package/lib/cjs/registries/JsonSchemaMapperContainer.js.map +1 -1
- package/lib/cjs/utils/ref.js +3 -1
- package/lib/cjs/utils/ref.js.map +1 -1
- package/lib/cjs/utils/transformToOS2.js +5 -4
- package/lib/cjs/utils/transformToOS2.js.map +1 -1
- package/lib/esm/components/default/anyMapper.js +2 -2
- package/lib/esm/components/default/anyMapper.js.map +1 -1
- package/lib/esm/components/default/discriminatorMappingMapper.js +22 -0
- package/lib/esm/components/default/discriminatorMappingMapper.js.map +1 -0
- package/lib/esm/components/default/{inlineEnumsMapper.js → enumsMapper.js} +3 -3
- package/lib/esm/components/default/enumsMapper.js.map +1 -0
- package/lib/esm/components/default/inheritedClassMapper.js +16 -2
- package/lib/esm/components/default/inheritedClassMapper.js.map +1 -1
- package/lib/esm/components/default/requiredMapper.js +1 -4
- package/lib/esm/components/default/requiredMapper.js.map +1 -1
- package/lib/esm/components/default/schemaMapper.js +7 -10
- package/lib/esm/components/default/schemaMapper.js.map +1 -1
- package/lib/esm/components/index.js +4 -1
- package/lib/esm/components/index.js.map +1 -1
- package/lib/esm/components/open-spec/discriminatorMappingMapper.js +7 -0
- package/lib/esm/components/open-spec/discriminatorMappingMapper.js.map +1 -0
- package/lib/esm/components/open-spec/enumsMapper.js +15 -0
- package/lib/esm/components/open-spec/enumsMapper.js.map +1 -0
- package/lib/esm/decorators/common/labelledAs.js +35 -0
- package/lib/esm/decorators/common/labelledAs.js.map +1 -0
- package/lib/esm/decorators/generics/genericOf.js +1 -1
- package/lib/esm/decorators/generics/genericOf.js.map +1 -1
- package/lib/esm/decorators/operations/returns.js +1 -1
- package/lib/esm/decorators/operations/returns.js.map +1 -1
- package/lib/esm/domain/JsonSchema.js +9 -1
- package/lib/esm/domain/JsonSchema.js.map +1 -1
- package/lib/esm/fn/allOf.js +12 -0
- package/lib/esm/fn/allOf.js.map +1 -0
- package/lib/esm/fn/any.js +10 -0
- package/lib/esm/fn/any.js.map +1 -0
- package/lib/esm/fn/anyOf.js +12 -0
- package/lib/esm/fn/anyOf.js.map +1 -0
- package/lib/esm/fn/boolean.js +10 -0
- package/lib/esm/fn/boolean.js.map +1 -0
- package/lib/esm/fn/collection.js +50 -0
- package/lib/esm/fn/collection.js.map +1 -0
- package/lib/esm/fn/date.js +27 -0
- package/lib/esm/fn/date.js.map +1 -0
- package/lib/esm/fn/email.js +18 -0
- package/lib/esm/fn/email.js.map +1 -0
- package/lib/esm/fn/enums.js +8 -0
- package/lib/esm/fn/enums.js.map +1 -0
- package/lib/esm/fn/from.js +28 -0
- package/lib/esm/fn/from.js.map +1 -0
- package/lib/esm/fn/integer.js +13 -0
- package/lib/esm/fn/integer.js.map +1 -0
- package/lib/esm/fn/lazyRef.js +17 -0
- package/lib/esm/fn/lazyRef.js.map +1 -0
- package/lib/esm/fn/number.js +10 -0
- package/lib/esm/fn/number.js.map +1 -0
- package/lib/esm/fn/object.js +22 -0
- package/lib/esm/fn/object.js.map +1 -0
- package/lib/esm/fn/oneOf.js +13 -0
- package/lib/esm/fn/oneOf.js.map +1 -0
- package/lib/esm/fn/string.js +10 -0
- package/lib/esm/fn/string.js.map +1 -0
- package/lib/esm/fn/uri.js +13 -0
- package/lib/esm/fn/uri.js.map +1 -0
- package/lib/esm/fn/url.js +11 -0
- package/lib/esm/fn/url.js.map +1 -0
- package/lib/esm/index.js +22 -2
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/registries/JsonSchemaMapperContainer.js +1 -1
- package/lib/esm/registries/JsonSchemaMapperContainer.js.map +1 -1
- package/lib/esm/utils/ref.js +3 -1
- package/lib/esm/utils/ref.js.map +1 -1
- package/lib/esm/utils/transformToOS2.js +5 -4
- package/lib/esm/utils/transformToOS2.js.map +1 -1
- package/lib/types/components/default/discriminatorMappingMapper.d.ts +9 -0
- package/lib/types/components/default/enumsMapper.d.ts +3 -0
- package/lib/types/components/index.d.ts +4 -1
- package/lib/types/components/open-spec/discriminatorMappingMapper.d.ts +1 -0
- package/lib/types/components/open-spec/enumsMapper.d.ts +3 -0
- package/lib/types/decorators/common/labelledAs.d.ts +24 -0
- package/lib/types/fn/allOf.d.ts +9 -0
- package/lib/types/fn/any.d.ts +7 -0
- package/lib/types/fn/anyOf.d.ts +9 -0
- package/lib/types/fn/boolean.d.ts +7 -0
- package/lib/types/fn/collection.d.ts +43 -0
- package/lib/types/fn/date.d.ts +19 -0
- package/lib/types/fn/email.d.ts +14 -0
- package/lib/types/fn/enums.d.ts +1 -0
- package/lib/types/fn/from.d.ts +14 -0
- package/lib/types/fn/integer.d.ts +10 -0
- package/lib/types/fn/lazyRef.d.ts +5 -0
- package/lib/types/fn/number.d.ts +6 -0
- package/lib/types/fn/object.d.ts +21 -0
- package/lib/types/fn/oneOf.d.ts +10 -0
- package/lib/types/fn/string.d.ts +7 -0
- package/lib/types/fn/uri.d.ts +9 -0
- package/lib/types/fn/url.d.ts +7 -0
- package/lib/types/index.d.ts +22 -2
- package/lib/types/interfaces/JsonSchemaOptions.d.ts +3 -0
- package/lib/types/registries/JsonSchemaMapperContainer.d.ts +1 -1
- package/lib/types/utils/ref.d.ts +1 -1
- package/lib/types/utils/transformToOS2.d.ts +2 -2
- package/lib/types-esm/components/default/discriminatorMappingMapper.d.ts +9 -0
- package/lib/types-esm/components/default/{inlineEnumsMapper.d.ts → enumsMapper.d.ts} +1 -1
- package/lib/types-esm/components/index.d.ts +4 -1
- package/lib/types-esm/components/open-spec/discriminatorMappingMapper.d.ts +1 -0
- package/lib/{types/components/default/inlineEnumsMapper.d.ts → types-esm/components/open-spec/enumsMapper.d.ts} +1 -1
- package/lib/types-esm/decorators/common/labelledAs.d.ts +24 -0
- package/lib/types-esm/fn/allOf.d.ts +9 -0
- package/lib/types-esm/fn/any.d.ts +7 -0
- package/lib/types-esm/fn/anyOf.d.ts +9 -0
- package/lib/types-esm/fn/boolean.d.ts +7 -0
- package/lib/types-esm/fn/collection.d.ts +43 -0
- package/lib/types-esm/fn/date.d.ts +19 -0
- package/lib/types-esm/fn/email.d.ts +14 -0
- package/lib/types-esm/fn/enums.d.ts +1 -0
- package/lib/types-esm/fn/from.d.ts +14 -0
- package/lib/types-esm/fn/integer.d.ts +10 -0
- package/lib/types-esm/fn/lazyRef.d.ts +5 -0
- package/lib/types-esm/fn/number.d.ts +6 -0
- package/lib/types-esm/fn/object.d.ts +21 -0
- package/lib/types-esm/fn/oneOf.d.ts +10 -0
- package/lib/types-esm/fn/string.d.ts +7 -0
- package/lib/types-esm/fn/uri.d.ts +9 -0
- package/lib/types-esm/fn/url.d.ts +7 -0
- package/lib/types-esm/index.d.ts +22 -2
- package/lib/types-esm/interfaces/JsonSchemaOptions.d.ts +3 -0
- package/lib/types-esm/registries/JsonSchemaMapperContainer.d.ts +1 -1
- package/lib/types-esm/utils/ref.d.ts +1 -1
- package/lib/types-esm/utils/transformToOS2.d.ts +2 -2
- package/package.json +8 -8
- package/lib/cjs/components/default/inlineEnumsMapper.js.map +0 -1
- package/lib/cjs/utils/from.js +0 -280
- package/lib/cjs/utils/from.js.map +0 -1
- package/lib/esm/components/default/inlineEnumsMapper.js.map +0 -1
- package/lib/esm/utils/from.js +0 -256
- package/lib/esm/utils/from.js.map +0 -1
- package/lib/types/utils/from.d.ts +0 -190
- package/lib/types-esm/utils/from.d.ts +0 -190
|
@@ -18,4 +18,4 @@ export declare function getJsonSchemaMapper(type: string, options: any): JsonSch
|
|
|
18
18
|
*/
|
|
19
19
|
export declare function execMapper(type: string, args: any[], options: any, parent?: any): any;
|
|
20
20
|
export declare function hasMapper(type: string): boolean;
|
|
21
|
-
export declare function
|
|
21
|
+
export declare function execOneOfMapper(types: string[], options: any): string;
|
|
@@ -11,4 +11,4 @@ export declare function createRef(name: string, schema: JsonSchema, options: Jso
|
|
|
11
11
|
/**
|
|
12
12
|
* @ignore
|
|
13
13
|
*/
|
|
14
|
-
export declare function toRef(value: JsonSchema, schema:
|
|
14
|
+
export declare function toRef(value: JsonSchema, schema: unknown | undefined, options: JsonSchemaOptions): any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OpenSpec2, OpenSpec3, OS3Operation } from "@tsed/openspec";
|
|
2
|
-
export declare function transformSecurity(securitySchemes: any):
|
|
1
|
+
import { OpenSpec2, OpenSpec3, type OS2Security, OS3Operation } from "@tsed/openspec";
|
|
2
|
+
export declare function transformSecurity(securitySchemes: any): Record<string, OS2Security>;
|
|
3
3
|
export declare function transformInformation(server: any): {
|
|
4
4
|
host: string | undefined;
|
|
5
5
|
basePath: string;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@tsed/schema",
|
|
3
3
|
"description": "JsonSchema module for Ts.ED Framework",
|
|
4
4
|
"type": "commonjs",
|
|
5
|
-
"version": "7.
|
|
5
|
+
"version": "7.85.0",
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
7
|
"main": "./lib/cjs/index.js",
|
|
8
8
|
"module": "./lib/esm/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"tsed"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@tsed/openspec": "7.
|
|
40
|
+
"@tsed/openspec": "7.85.0",
|
|
41
41
|
"change-case": "^4.1.2",
|
|
42
42
|
"fs-extra": "^11.2.0",
|
|
43
43
|
"json-schema": "0.4.0",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@apidevtools/swagger-parser": "10.1.0",
|
|
50
|
-
"@tsed/barrels": "7.
|
|
51
|
-
"@tsed/core": "7.
|
|
52
|
-
"@tsed/openspec": "7.
|
|
53
|
-
"@tsed/typescript": "7.
|
|
50
|
+
"@tsed/barrels": "7.85.0",
|
|
51
|
+
"@tsed/core": "7.85.0",
|
|
52
|
+
"@tsed/openspec": "7.85.0",
|
|
53
|
+
"@tsed/typescript": "7.85.0",
|
|
54
54
|
"@types/fs-extra": "11.0.4",
|
|
55
55
|
"@types/json-schema": "7.0.15",
|
|
56
56
|
"@types/picomatch": "2.3.3",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"vitest": "2.0.4"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@tsed/core": "7.
|
|
65
|
-
"@tsed/openspec": "7.
|
|
64
|
+
"@tsed/core": "7.85.0",
|
|
65
|
+
"@tsed/openspec": "7.85.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependenciesMeta": {
|
|
68
68
|
"@tsed/core": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inlineEnumsMapper.js","sourceRoot":"","sources":["../../../../src/components/default/inlineEnumsMapper.ts"],"names":[],"mappings":";;;AAEA,gGAAuF;AAEvF,SAAgB,iBAAiB,CAAC,GAAQ,EAAE,MAAkB,EAAE,OAA0B;IACxF,IAAI,OAAO,CAAC,WAAW,IAAI,GAAG,CAAC,IAAI,EAAE,eAAe,EAAE;QACpD,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC;KACnC;IAED,IAAI,GAAG,CAAC,IAAI,EAAE;QACZ,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;KAClF;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAVD,8CAUC;AAED,IAAA,uDAAwB,EAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC"}
|
package/lib/cjs/utils/from.js
DELETED
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.enums = exports.lazyRef = exports.allOf = exports.oneOf = exports.anyOf = exports.any = exports.object = exports.set = exports.map = exports.array = exports.url = exports.uri = exports.email = exports.time = exports.datetime = exports.date = exports.boolean = exports.string = exports.integer = exports.number = exports.from = void 0;
|
|
4
|
-
const core_1 = require("@tsed/core");
|
|
5
|
-
const JsonEntityStore_js_1 = require("../domain/JsonEntityStore.js");
|
|
6
|
-
const JsonFormatTypes_js_1 = require("../domain/JsonFormatTypes.js");
|
|
7
|
-
const JsonLazyRef_js_1 = require("../domain/JsonLazyRef.js");
|
|
8
|
-
const JsonSchema_js_1 = require("../domain/JsonSchema.js");
|
|
9
|
-
const enumRegistries_js_1 = require("../registries/enumRegistries.js");
|
|
10
|
-
const getJsonEntityStore_js_1 = require("./getJsonEntityStore.js");
|
|
11
|
-
/**
|
|
12
|
-
* Create a new model from the given type.
|
|
13
|
-
*
|
|
14
|
-
* ```typescript
|
|
15
|
-
* from(String)
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
19
|
-
*
|
|
20
|
-
* @schemaFunctional
|
|
21
|
-
*/
|
|
22
|
-
function from(type = Object) {
|
|
23
|
-
if ((0, core_1.isClass)(type)) {
|
|
24
|
-
const { schema } = (0, getJsonEntityStore_js_1.getJsonEntityStore)(type);
|
|
25
|
-
schema.properties = function properties(obj) {
|
|
26
|
-
Object.entries(obj).forEach(([propertyKey, propSchema]) => {
|
|
27
|
-
(0, getJsonEntityStore_js_1.getJsonEntityStore)(type.prototype, propertyKey).schema.assign(propSchema);
|
|
28
|
-
});
|
|
29
|
-
return this;
|
|
30
|
-
};
|
|
31
|
-
return schema;
|
|
32
|
-
}
|
|
33
|
-
return JsonSchema_js_1.JsonSchema.from({ type });
|
|
34
|
-
}
|
|
35
|
-
exports.from = from;
|
|
36
|
-
/**
|
|
37
|
-
* Declare a new number model.
|
|
38
|
-
*
|
|
39
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
40
|
-
*
|
|
41
|
-
* @schemaFunctional
|
|
42
|
-
*/
|
|
43
|
-
function number() {
|
|
44
|
-
return from(Number);
|
|
45
|
-
}
|
|
46
|
-
exports.number = number;
|
|
47
|
-
/**
|
|
48
|
-
* Declare a new integer model.
|
|
49
|
-
*
|
|
50
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
51
|
-
*
|
|
52
|
-
* @schemaFunctional
|
|
53
|
-
*/
|
|
54
|
-
function integer() {
|
|
55
|
-
return from(Number).integer();
|
|
56
|
-
}
|
|
57
|
-
exports.integer = integer;
|
|
58
|
-
/**
|
|
59
|
-
* Declare a new string model.
|
|
60
|
-
*
|
|
61
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
62
|
-
*
|
|
63
|
-
* @schemaFunctional
|
|
64
|
-
*/
|
|
65
|
-
function string() {
|
|
66
|
-
return from(String);
|
|
67
|
-
}
|
|
68
|
-
exports.string = string;
|
|
69
|
-
/**
|
|
70
|
-
* Declare a new boolean model.
|
|
71
|
-
*
|
|
72
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
73
|
-
*
|
|
74
|
-
* @schemaFunctional
|
|
75
|
-
*/
|
|
76
|
-
function boolean() {
|
|
77
|
-
return from(Boolean);
|
|
78
|
-
}
|
|
79
|
-
exports.boolean = boolean;
|
|
80
|
-
/**
|
|
81
|
-
* Declare a new string model with `format: date`.
|
|
82
|
-
*
|
|
83
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
84
|
-
*
|
|
85
|
-
* @schemaFunctional
|
|
86
|
-
*/
|
|
87
|
-
function date() {
|
|
88
|
-
return from(Date).format(JsonFormatTypes_js_1.JsonFormatTypes.DATE);
|
|
89
|
-
}
|
|
90
|
-
exports.date = date;
|
|
91
|
-
/**
|
|
92
|
-
* Declare a new string model with `format: datetime`.
|
|
93
|
-
*
|
|
94
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
95
|
-
*
|
|
96
|
-
* @schemaFunctional
|
|
97
|
-
*/
|
|
98
|
-
function datetime() {
|
|
99
|
-
return from(Date).format(JsonFormatTypes_js_1.JsonFormatTypes.DATE_TIME);
|
|
100
|
-
}
|
|
101
|
-
exports.datetime = datetime;
|
|
102
|
-
/**
|
|
103
|
-
* Declare a new string model with `format: time`.
|
|
104
|
-
*
|
|
105
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
106
|
-
*
|
|
107
|
-
* @schemaFunctional
|
|
108
|
-
*/
|
|
109
|
-
function time() {
|
|
110
|
-
return from(Date).format(JsonFormatTypes_js_1.JsonFormatTypes.TIME);
|
|
111
|
-
}
|
|
112
|
-
exports.time = time;
|
|
113
|
-
/**
|
|
114
|
-
* Declare a new string model with `format: email`.
|
|
115
|
-
*
|
|
116
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
117
|
-
*
|
|
118
|
-
* @schemaFunctional
|
|
119
|
-
*/
|
|
120
|
-
function email() {
|
|
121
|
-
return from(String).format(JsonFormatTypes_js_1.JsonFormatTypes.EMAIL);
|
|
122
|
-
}
|
|
123
|
-
exports.email = email;
|
|
124
|
-
/**
|
|
125
|
-
* Declare a new string model with `format: uri`.
|
|
126
|
-
*
|
|
127
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
128
|
-
*
|
|
129
|
-
* @schemaFunctional
|
|
130
|
-
*/
|
|
131
|
-
function uri() {
|
|
132
|
-
return from(String).format(JsonFormatTypes_js_1.JsonFormatTypes.URI);
|
|
133
|
-
}
|
|
134
|
-
exports.uri = uri;
|
|
135
|
-
/**
|
|
136
|
-
* Declare a new string model with `format: url`.
|
|
137
|
-
*
|
|
138
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
139
|
-
*
|
|
140
|
-
* @schemaFunctional
|
|
141
|
-
*/
|
|
142
|
-
function url() {
|
|
143
|
-
return from(String).format(JsonFormatTypes_js_1.JsonFormatTypes.URL);
|
|
144
|
-
}
|
|
145
|
-
exports.url = url;
|
|
146
|
-
/**
|
|
147
|
-
* Declare a new object model with `additionalProperties: true`.
|
|
148
|
-
*
|
|
149
|
-
* ```json
|
|
150
|
-
* {
|
|
151
|
-
* "type": "array"
|
|
152
|
-
* }
|
|
153
|
-
* ```
|
|
154
|
-
*
|
|
155
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
156
|
-
*
|
|
157
|
-
* @schemaFunctional
|
|
158
|
-
*/
|
|
159
|
-
function array() {
|
|
160
|
-
return from(Array);
|
|
161
|
-
}
|
|
162
|
-
exports.array = array;
|
|
163
|
-
/**
|
|
164
|
-
* Declare a new object model with `additionalProperties: true`.
|
|
165
|
-
*
|
|
166
|
-
* ```json
|
|
167
|
-
* {
|
|
168
|
-
* "type": "object",
|
|
169
|
-
* "additionalProperties": true
|
|
170
|
-
* }
|
|
171
|
-
* ```
|
|
172
|
-
*
|
|
173
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
174
|
-
*
|
|
175
|
-
* @schemaFunctional
|
|
176
|
-
*/
|
|
177
|
-
function map() {
|
|
178
|
-
return from(Map).unknown(true);
|
|
179
|
-
}
|
|
180
|
-
exports.map = map;
|
|
181
|
-
/**
|
|
182
|
-
* Declare a new array model with `uniqueItems: true`.
|
|
183
|
-
*
|
|
184
|
-
* ```json
|
|
185
|
-
* {
|
|
186
|
-
* "type": "array",
|
|
187
|
-
* "uniqueItems": true
|
|
188
|
-
* }
|
|
189
|
-
* ```
|
|
190
|
-
*
|
|
191
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
192
|
-
*
|
|
193
|
-
* @schemaFunctional
|
|
194
|
-
*/
|
|
195
|
-
function set() {
|
|
196
|
-
return from(Array).uniqueItems(true);
|
|
197
|
-
}
|
|
198
|
-
exports.set = set;
|
|
199
|
-
/**
|
|
200
|
-
* Declare a new object model.
|
|
201
|
-
*
|
|
202
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
203
|
-
*
|
|
204
|
-
* @schemaFunctional
|
|
205
|
-
*/
|
|
206
|
-
function object(properties = {}) {
|
|
207
|
-
return from(Object).properties(properties);
|
|
208
|
-
}
|
|
209
|
-
exports.object = object;
|
|
210
|
-
/**
|
|
211
|
-
* Declare a model with any type (By default: `integer`, `number`, `string`, `boolean`, `array`, `object`, `null`)
|
|
212
|
-
*
|
|
213
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
214
|
-
*
|
|
215
|
-
* @schemaFunctional
|
|
216
|
-
*/
|
|
217
|
-
function any(...types) {
|
|
218
|
-
return from().any(...types);
|
|
219
|
-
}
|
|
220
|
-
exports.any = any;
|
|
221
|
-
/**
|
|
222
|
-
* See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27
|
|
223
|
-
*
|
|
224
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
225
|
-
*
|
|
226
|
-
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27
|
|
227
|
-
* @schemaFunctional
|
|
228
|
-
*/
|
|
229
|
-
function anyOf(...anyOf) {
|
|
230
|
-
return from().anyOf(anyOf);
|
|
231
|
-
}
|
|
232
|
-
exports.anyOf = anyOf;
|
|
233
|
-
/**
|
|
234
|
-
* See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28
|
|
235
|
-
*
|
|
236
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
237
|
-
*
|
|
238
|
-
* @schemaFunctional
|
|
239
|
-
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28
|
|
240
|
-
*/
|
|
241
|
-
function oneOf(...oneOf) {
|
|
242
|
-
return from().oneOf(oneOf);
|
|
243
|
-
}
|
|
244
|
-
exports.oneOf = oneOf;
|
|
245
|
-
/**
|
|
246
|
-
* See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26
|
|
247
|
-
*
|
|
248
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
249
|
-
*
|
|
250
|
-
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26
|
|
251
|
-
* @schemaFunctional
|
|
252
|
-
*/
|
|
253
|
-
function allOf(...allOf) {
|
|
254
|
-
return from().allOf(allOf);
|
|
255
|
-
}
|
|
256
|
-
exports.allOf = allOf;
|
|
257
|
-
/**
|
|
258
|
-
* Declare a sub schema which will be resolved later. Use this function when you have a circular reference between two schemes.
|
|
259
|
-
*
|
|
260
|
-
* @schemaFunctional
|
|
261
|
-
*/
|
|
262
|
-
function lazyRef(cb) {
|
|
263
|
-
try {
|
|
264
|
-
// solve issue with a self referenced model
|
|
265
|
-
if (cb()) {
|
|
266
|
-
// type is already accessible
|
|
267
|
-
return JsonEntityStore_js_1.JsonEntityStore.from(cb()).schema;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
catch (er) { }
|
|
271
|
-
return new JsonLazyRef_js_1.JsonLazyRef(cb);
|
|
272
|
-
}
|
|
273
|
-
exports.lazyRef = lazyRef;
|
|
274
|
-
function enums(e) {
|
|
275
|
-
const schema = string().enum(e);
|
|
276
|
-
enumRegistries_js_1.enumsRegistry.set(e, schema);
|
|
277
|
-
return schema;
|
|
278
|
-
}
|
|
279
|
-
exports.enums = enums;
|
|
280
|
-
//# sourceMappingURL=from.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"from.js","sourceRoot":"","sources":["../../../src/utils/from.ts"],"names":[],"mappings":";;;AAAA,qCAAyC;AACzC,qEAA6D;AAC7D,qEAA6D;AAC7D,6DAAqD;AACrD,2DAAmD;AACnD,uEAA8D;AAC9D,mEAA2D;AAE3D;;;;;;;;;;GAUG;AACH,SAAgB,IAAI,CAAC,OAAkB,MAAM;IAC3C,IAAI,IAAA,cAAO,EAAC,IAAI,CAAC,EAAE;QACjB,MAAM,EAAC,MAAM,EAAC,GAAG,IAAA,0CAAkB,EAAC,IAAI,CAAC,CAAC;QAE1C,MAAM,CAAC,UAAU,GAAG,SAAS,UAAU,CAAC,GAAgC;YACtE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,EAAE;gBACxD,IAAA,0CAAkB,EAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YAC5E,CAAC,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;QAEF,OAAO,MAAM,CAAC;KACf;IAED,OAAO,0BAAU,CAAC,IAAI,CAAC,EAAC,IAAI,EAAC,CAAC,CAAC;AACjC,CAAC;AAhBD,oBAgBC;AAED;;;;;;GAMG;AACH,SAAgB,MAAM;IACpB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC;AAFD,wBAEC;AAED;;;;;;G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,CAAC,CAAC,MAAa,CAAC;SACjD;KACF;IAAC,OAAO,EAAE,EAAE,GAAE;IAEf,OAAO,IAAI,4BAAW,CAAC,EAAE,CAAC,CAAC;AAC7B,CAAC;AAVD,0BAUC;AACD,SAAgB,KAAK,CAAC,CAAsB;IAC1C,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAChC,iCAAa,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAE7B,OAAO,MAAM,CAAC;AAChB,CAAC;AALD,sBAKC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inlineEnumsMapper.js","sourceRoot":"","sources":["../../../../src/components/default/inlineEnumsMapper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,wBAAwB,EAAC,MAAM,+CAA+C,CAAC;AAEvF,MAAM,UAAU,iBAAiB,CAAC,GAAQ,EAAE,MAAkB,EAAE,OAA0B;IACxF,IAAI,OAAO,CAAC,WAAW,IAAI,GAAG,CAAC,IAAI,EAAE,eAAe,EAAE;QACpD,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC;KACnC;IAED,IAAI,GAAG,CAAC,IAAI,EAAE;QACZ,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;KAClF;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,wBAAwB,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC"}
|
package/lib/esm/utils/from.js
DELETED
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
import { isClass } from "@tsed/core";
|
|
2
|
-
import { JsonEntityStore } from "../domain/JsonEntityStore.js";
|
|
3
|
-
import { JsonFormatTypes } from "../domain/JsonFormatTypes.js";
|
|
4
|
-
import { JsonLazyRef } from "../domain/JsonLazyRef.js";
|
|
5
|
-
import { JsonSchema } from "../domain/JsonSchema.js";
|
|
6
|
-
import { enumsRegistry } from "../registries/enumRegistries.js";
|
|
7
|
-
import { getJsonEntityStore } from "./getJsonEntityStore.js";
|
|
8
|
-
/**
|
|
9
|
-
* Create a new model from the given type.
|
|
10
|
-
*
|
|
11
|
-
* ```typescript
|
|
12
|
-
* from(String)
|
|
13
|
-
* ```
|
|
14
|
-
*
|
|
15
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
16
|
-
*
|
|
17
|
-
* @schemaFunctional
|
|
18
|
-
*/
|
|
19
|
-
export function from(type = Object) {
|
|
20
|
-
if (isClass(type)) {
|
|
21
|
-
const { schema } = getJsonEntityStore(type);
|
|
22
|
-
schema.properties = function properties(obj) {
|
|
23
|
-
Object.entries(obj).forEach(([propertyKey, propSchema]) => {
|
|
24
|
-
getJsonEntityStore(type.prototype, propertyKey).schema.assign(propSchema);
|
|
25
|
-
});
|
|
26
|
-
return this;
|
|
27
|
-
};
|
|
28
|
-
return schema;
|
|
29
|
-
}
|
|
30
|
-
return JsonSchema.from({ type });
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Declare a new number model.
|
|
34
|
-
*
|
|
35
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
36
|
-
*
|
|
37
|
-
* @schemaFunctional
|
|
38
|
-
*/
|
|
39
|
-
export function number() {
|
|
40
|
-
return from(Number);
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Declare a new integer model.
|
|
44
|
-
*
|
|
45
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
46
|
-
*
|
|
47
|
-
* @schemaFunctional
|
|
48
|
-
*/
|
|
49
|
-
export function integer() {
|
|
50
|
-
return from(Number).integer();
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Declare a new string model.
|
|
54
|
-
*
|
|
55
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
56
|
-
*
|
|
57
|
-
* @schemaFunctional
|
|
58
|
-
*/
|
|
59
|
-
export function string() {
|
|
60
|
-
return from(String);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Declare a new boolean model.
|
|
64
|
-
*
|
|
65
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
66
|
-
*
|
|
67
|
-
* @schemaFunctional
|
|
68
|
-
*/
|
|
69
|
-
export function boolean() {
|
|
70
|
-
return from(Boolean);
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Declare a new string model with `format: date`.
|
|
74
|
-
*
|
|
75
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
76
|
-
*
|
|
77
|
-
* @schemaFunctional
|
|
78
|
-
*/
|
|
79
|
-
export function date() {
|
|
80
|
-
return from(Date).format(JsonFormatTypes.DATE);
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Declare a new string model with `format: datetime`.
|
|
84
|
-
*
|
|
85
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
86
|
-
*
|
|
87
|
-
* @schemaFunctional
|
|
88
|
-
*/
|
|
89
|
-
export function datetime() {
|
|
90
|
-
return from(Date).format(JsonFormatTypes.DATE_TIME);
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Declare a new string model with `format: time`.
|
|
94
|
-
*
|
|
95
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
96
|
-
*
|
|
97
|
-
* @schemaFunctional
|
|
98
|
-
*/
|
|
99
|
-
export function time() {
|
|
100
|
-
return from(Date).format(JsonFormatTypes.TIME);
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Declare a new string model with `format: email`.
|
|
104
|
-
*
|
|
105
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
106
|
-
*
|
|
107
|
-
* @schemaFunctional
|
|
108
|
-
*/
|
|
109
|
-
export function email() {
|
|
110
|
-
return from(String).format(JsonFormatTypes.EMAIL);
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Declare a new string model with `format: uri`.
|
|
114
|
-
*
|
|
115
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
116
|
-
*
|
|
117
|
-
* @schemaFunctional
|
|
118
|
-
*/
|
|
119
|
-
export function uri() {
|
|
120
|
-
return from(String).format(JsonFormatTypes.URI);
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Declare a new string model with `format: url`.
|
|
124
|
-
*
|
|
125
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
126
|
-
*
|
|
127
|
-
* @schemaFunctional
|
|
128
|
-
*/
|
|
129
|
-
export function url() {
|
|
130
|
-
return from(String).format(JsonFormatTypes.URL);
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Declare a new object model with `additionalProperties: true`.
|
|
134
|
-
*
|
|
135
|
-
* ```json
|
|
136
|
-
* {
|
|
137
|
-
* "type": "array"
|
|
138
|
-
* }
|
|
139
|
-
* ```
|
|
140
|
-
*
|
|
141
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
142
|
-
*
|
|
143
|
-
* @schemaFunctional
|
|
144
|
-
*/
|
|
145
|
-
export function array() {
|
|
146
|
-
return from(Array);
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Declare a new object model with `additionalProperties: true`.
|
|
150
|
-
*
|
|
151
|
-
* ```json
|
|
152
|
-
* {
|
|
153
|
-
* "type": "object",
|
|
154
|
-
* "additionalProperties": true
|
|
155
|
-
* }
|
|
156
|
-
* ```
|
|
157
|
-
*
|
|
158
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
159
|
-
*
|
|
160
|
-
* @schemaFunctional
|
|
161
|
-
*/
|
|
162
|
-
export function map() {
|
|
163
|
-
return from(Map).unknown(true);
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Declare a new array model with `uniqueItems: true`.
|
|
167
|
-
*
|
|
168
|
-
* ```json
|
|
169
|
-
* {
|
|
170
|
-
* "type": "array",
|
|
171
|
-
* "uniqueItems": true
|
|
172
|
-
* }
|
|
173
|
-
* ```
|
|
174
|
-
*
|
|
175
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
176
|
-
*
|
|
177
|
-
* @schemaFunctional
|
|
178
|
-
*/
|
|
179
|
-
export function set() {
|
|
180
|
-
return from(Array).uniqueItems(true);
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Declare a new object model.
|
|
184
|
-
*
|
|
185
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
186
|
-
*
|
|
187
|
-
* @schemaFunctional
|
|
188
|
-
*/
|
|
189
|
-
export function object(properties = {}) {
|
|
190
|
-
return from(Object).properties(properties);
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Declare a model with any type (By default: `integer`, `number`, `string`, `boolean`, `array`, `object`, `null`)
|
|
194
|
-
*
|
|
195
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
196
|
-
*
|
|
197
|
-
* @schemaFunctional
|
|
198
|
-
*/
|
|
199
|
-
export function any(...types) {
|
|
200
|
-
return from().any(...types);
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27
|
|
204
|
-
*
|
|
205
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
206
|
-
*
|
|
207
|
-
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27
|
|
208
|
-
* @schemaFunctional
|
|
209
|
-
*/
|
|
210
|
-
export function anyOf(...anyOf) {
|
|
211
|
-
return from().anyOf(anyOf);
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28
|
|
215
|
-
*
|
|
216
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
217
|
-
*
|
|
218
|
-
* @schemaFunctional
|
|
219
|
-
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28
|
|
220
|
-
*/
|
|
221
|
-
export function oneOf(...oneOf) {
|
|
222
|
-
return from().oneOf(oneOf);
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26
|
|
226
|
-
*
|
|
227
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
228
|
-
*
|
|
229
|
-
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26
|
|
230
|
-
* @schemaFunctional
|
|
231
|
-
*/
|
|
232
|
-
export function allOf(...allOf) {
|
|
233
|
-
return from().allOf(allOf);
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Declare a sub schema which will be resolved later. Use this function when you have a circular reference between two schemes.
|
|
237
|
-
*
|
|
238
|
-
* @schemaFunctional
|
|
239
|
-
*/
|
|
240
|
-
export function lazyRef(cb) {
|
|
241
|
-
try {
|
|
242
|
-
// solve issue with a self referenced model
|
|
243
|
-
if (cb()) {
|
|
244
|
-
// type is already accessible
|
|
245
|
-
return JsonEntityStore.from(cb()).schema;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
catch (er) { }
|
|
249
|
-
return new JsonLazyRef(cb);
|
|
250
|
-
}
|
|
251
|
-
export function enums(e) {
|
|
252
|
-
const schema = string().enum(e);
|
|
253
|
-
enumsRegistry.set(e, schema);
|
|
254
|
-
return schema;
|
|
255
|
-
}
|
|
256
|
-
//# sourceMappingURL=from.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"from.js","sourceRoot":"","sources":["../../../src/utils/from.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAO,MAAM,YAAY,CAAC;AACzC,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AACrD,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