@skmtc/core 0.0.798 → 0.0.800
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/esm/context/GenerateContext.d.ts +26 -1
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +26 -1
- package/esm/context/ParseContext.d.ts +64 -3
- package/esm/context/ParseContext.d.ts.map +1 -1
- package/esm/context/ParseContext.js +61 -0
- package/esm/context/ResultsHandler.d.ts +10 -3
- package/esm/context/ResultsHandler.d.ts.map +1 -1
- package/esm/dsl/model/types.d.ts +51 -4
- package/esm/dsl/model/types.d.ts.map +1 -1
- package/esm/dsl/operation/types.d.ts +61 -3
- package/esm/dsl/operation/types.d.ts.map +1 -1
- package/esm/oas/array/array-types.d.ts +23 -0
- package/esm/oas/array/array-types.d.ts.map +1 -1
- package/esm/oas/array/array-types.js +7 -0
- package/esm/oas/boolean/boolean-types.d.ts +25 -1
- package/esm/oas/boolean/boolean-types.d.ts.map +1 -1
- package/esm/oas/boolean/boolean-types.js +6 -0
- package/esm/oas/discriminator/discriminator-types.d.ts +17 -0
- package/esm/oas/discriminator/discriminator-types.d.ts.map +1 -1
- package/esm/oas/discriminator/discriminator-types.js +7 -0
- package/esm/oas/integer/integer-types.d.ts +18 -0
- package/esm/oas/integer/integer-types.d.ts.map +1 -1
- package/esm/oas/integer/integer-types.js +18 -0
- package/esm/oas/mediaType/mediaType-types.d.ts +17 -0
- package/esm/oas/mediaType/mediaType-types.d.ts.map +1 -1
- package/esm/oas/mediaType/mediaType-types.js +6 -0
- package/esm/oas/number/number-types.d.ts +12 -0
- package/esm/oas/number/number-types.d.ts.map +1 -1
- package/esm/oas/number/number-types.js +12 -0
- package/esm/oas/operation/Operation.d.ts +47 -2
- package/esm/oas/operation/Operation.d.ts.map +1 -1
- package/esm/oas/operation/Operation.js +43 -0
- package/esm/oas/ref/Ref.d.ts +49 -2
- package/esm/oas/ref/Ref.d.ts.map +1 -1
- package/esm/oas/ref/Ref.js +28 -0
- package/esm/oas/serverVariable/ServerVariable.d.ts +34 -0
- package/esm/oas/serverVariable/ServerVariable.d.ts.map +1 -1
- package/esm/oas/serverVariable/ServerVariable.js +24 -0
- package/esm/oas/string/string-types.d.ts +38 -1
- package/esm/oas/string/string-types.d.ts.map +1 -1
- package/esm/oas/string/string-types.js +12 -0
- package/esm/oas/union/union-types.d.ts +20 -0
- package/esm/oas/union/union-types.d.ts.map +1 -1
- package/esm/oas/union/union-types.js +7 -0
- package/esm/oas/unknown/unknown-types.d.ts +18 -0
- package/esm/oas/unknown/unknown-types.d.ts.map +1 -1
- package/esm/oas/unknown/unknown-types.js +6 -0
- package/esm/typescript/List.d.ts +64 -3
- package/esm/typescript/List.d.ts.map +1 -1
- package/esm/typescript/List.js +43 -0
- package/package.json +1 -1
- package/script/context/GenerateContext.d.ts +26 -1
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +26 -1
- package/script/context/ParseContext.d.ts +64 -3
- package/script/context/ParseContext.d.ts.map +1 -1
- package/script/context/ParseContext.js +61 -0
- package/script/context/ResultsHandler.d.ts +10 -3
- package/script/context/ResultsHandler.d.ts.map +1 -1
- package/script/dsl/model/types.d.ts +51 -4
- package/script/dsl/model/types.d.ts.map +1 -1
- package/script/dsl/operation/types.d.ts +61 -3
- package/script/dsl/operation/types.d.ts.map +1 -1
- package/script/oas/array/array-types.d.ts +23 -0
- package/script/oas/array/array-types.d.ts.map +1 -1
- package/script/oas/array/array-types.js +7 -0
- package/script/oas/boolean/boolean-types.d.ts +25 -1
- package/script/oas/boolean/boolean-types.d.ts.map +1 -1
- package/script/oas/boolean/boolean-types.js +6 -0
- package/script/oas/discriminator/discriminator-types.d.ts +17 -0
- package/script/oas/discriminator/discriminator-types.d.ts.map +1 -1
- package/script/oas/discriminator/discriminator-types.js +7 -0
- package/script/oas/integer/integer-types.d.ts +18 -0
- package/script/oas/integer/integer-types.d.ts.map +1 -1
- package/script/oas/integer/integer-types.js +18 -0
- package/script/oas/mediaType/mediaType-types.d.ts +17 -0
- package/script/oas/mediaType/mediaType-types.d.ts.map +1 -1
- package/script/oas/mediaType/mediaType-types.js +6 -0
- package/script/oas/number/number-types.d.ts +12 -0
- package/script/oas/number/number-types.d.ts.map +1 -1
- package/script/oas/number/number-types.js +12 -0
- package/script/oas/operation/Operation.d.ts +47 -2
- package/script/oas/operation/Operation.d.ts.map +1 -1
- package/script/oas/operation/Operation.js +43 -0
- package/script/oas/ref/Ref.d.ts +49 -2
- package/script/oas/ref/Ref.d.ts.map +1 -1
- package/script/oas/ref/Ref.js +28 -0
- package/script/oas/serverVariable/ServerVariable.d.ts +34 -0
- package/script/oas/serverVariable/ServerVariable.d.ts.map +1 -1
- package/script/oas/serverVariable/ServerVariable.js +24 -0
- package/script/oas/string/string-types.d.ts +38 -1
- package/script/oas/string/string-types.d.ts.map +1 -1
- package/script/oas/string/string-types.js +12 -0
- package/script/oas/union/union-types.d.ts +20 -0
- package/script/oas/union/union-types.d.ts.map +1 -1
- package/script/oas/union/union-types.js +7 -0
- package/script/oas/unknown/unknown-types.d.ts +18 -0
- package/script/oas/unknown/unknown-types.d.ts.map +1 -1
- package/script/oas/unknown/unknown-types.js +6 -0
- package/script/typescript/List.d.ts +64 -3
- package/script/typescript/List.d.ts.map +1 -1
- package/script/typescript/List.js +43 -0
package/script/oas/ref/Ref.d.ts
CHANGED
|
@@ -10,6 +10,11 @@ import type { OasDocument } from '../document/Document.js';
|
|
|
10
10
|
import type { RefName } from '../../types/RefName.js';
|
|
11
11
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
12
12
|
import type { OasSecurityScheme } from '../securitySchemes/SecurityScheme.js';
|
|
13
|
+
/**
|
|
14
|
+
* Field data for creating OAS reference objects.
|
|
15
|
+
*
|
|
16
|
+
* @template T - The type of component being referenced (e.g., 'schema', 'response')
|
|
17
|
+
*/
|
|
13
18
|
export type RefFields<T extends OasRefData['refType']> = {
|
|
14
19
|
refType: T;
|
|
15
20
|
$ref: string;
|
|
@@ -102,11 +107,39 @@ export type RefFields<T extends OasRefData['refType']> = {
|
|
|
102
107
|
*/
|
|
103
108
|
export declare class OasRef<T extends OasRefData['refType']> {
|
|
104
109
|
#private;
|
|
110
|
+
/** OAS type identifier */
|
|
105
111
|
oasType: 'ref';
|
|
112
|
+
/** Type identifier */
|
|
106
113
|
type: 'ref';
|
|
114
|
+
/**
|
|
115
|
+
* Creates a new OAS reference instance.
|
|
116
|
+
*
|
|
117
|
+
* @param fields - Reference field data including refType and $ref
|
|
118
|
+
* @param oasDocument - Document containing the referenced component
|
|
119
|
+
*/
|
|
107
120
|
constructor(fields: RefFields<T>, oasDocument: OasDocument);
|
|
121
|
+
/**
|
|
122
|
+
* Type guard to check if this instance is a reference.
|
|
123
|
+
*
|
|
124
|
+
* @returns Always true for OasRef instances
|
|
125
|
+
*/
|
|
108
126
|
isRef(): this is OasRef<T>;
|
|
127
|
+
/**
|
|
128
|
+
* Recursively resolves this reference to its final target component.
|
|
129
|
+
*
|
|
130
|
+
* Follows reference chains until reaching a non-reference component,
|
|
131
|
+
* with protection against infinite loops.
|
|
132
|
+
*
|
|
133
|
+
* @param lookupsPerformed - Internal counter to prevent infinite recursion
|
|
134
|
+
* @returns The resolved component
|
|
135
|
+
* @throws Error if maximum lookup depth is exceeded
|
|
136
|
+
*/
|
|
109
137
|
resolve(lookupsPerformed?: number): ResolvedRef<T>;
|
|
138
|
+
/**
|
|
139
|
+
* Resolves this reference one level, potentially returning another reference.
|
|
140
|
+
*
|
|
141
|
+
* @returns Either the resolved component or another reference in the chain
|
|
142
|
+
*/
|
|
110
143
|
resolveOnce(): OasRef<T> | ResolvedRef<T>;
|
|
111
144
|
toRefName(): RefName;
|
|
112
145
|
get $ref(): string;
|
|
@@ -115,10 +148,24 @@ export declare class OasRef<T extends OasRefData['refType']> {
|
|
|
115
148
|
toJsonSchema({ resolve }: ToJsonSchemaOptions): OpenAPIV3.ReferenceObject | ResolvedRefJsonType<T>;
|
|
116
149
|
toJSON(): object;
|
|
117
150
|
}
|
|
118
|
-
|
|
151
|
+
/**
|
|
152
|
+
* Type representing the JSON schema result from resolving a reference.
|
|
153
|
+
*
|
|
154
|
+
* @template T - The type of component being referenced
|
|
155
|
+
*/
|
|
156
|
+
export type ResolvedRefJsonType<T extends OasRefData['refType']> = ReturnType<ResolvedRef<T>['toJsonSchema']>;
|
|
157
|
+
/**
|
|
158
|
+
* Union type of all OAS component types that can be referenced.
|
|
159
|
+
*
|
|
160
|
+
* Includes all OpenAPI component types that support $ref resolution.
|
|
161
|
+
*/
|
|
119
162
|
export type OasComponentType = OasSchema | OasResponse | OasParameter | OasExample | OasRequestBody | OasHeader | OasSecurityScheme;
|
|
163
|
+
/**
|
|
164
|
+
* Type representing a resolved reference to a specific component type.
|
|
165
|
+
*
|
|
166
|
+
* @template T - The type of component being referenced (e.g., 'schema', 'response')
|
|
167
|
+
*/
|
|
120
168
|
export type ResolvedRef<T extends OasRefData['refType']> = Extract<OasComponentType, {
|
|
121
169
|
oasType: T;
|
|
122
170
|
}>;
|
|
123
|
-
export {};
|
|
124
171
|
//# sourceMappingURL=Ref.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ref.d.ts","sourceRoot":"","sources":["../../../src/oas/ref/Ref.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAGhD,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,KAAK,EAAE,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AAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,IAAI,UAAU,CAC3E,WAAW,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAC/B,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GACxB,SAAS,GACT,WAAW,GACX,YAAY,GACZ,UAAU,GACV,cAAc,GACd,SAAS,GACT,iBAAiB,CAAA;AAErB;;;;GAIG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,gBAAgB,EAAE;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,CAAC,CAAA"}
|
package/script/oas/ref/Ref.js
CHANGED
|
@@ -104,13 +104,21 @@ const MAX_LOOKUPS = 10;
|
|
|
104
104
|
* ```
|
|
105
105
|
*/
|
|
106
106
|
class OasRef {
|
|
107
|
+
/**
|
|
108
|
+
* Creates a new OAS reference instance.
|
|
109
|
+
*
|
|
110
|
+
* @param fields - Reference field data including refType and $ref
|
|
111
|
+
* @param oasDocument - Document containing the referenced component
|
|
112
|
+
*/
|
|
107
113
|
constructor(fields, oasDocument) {
|
|
114
|
+
/** OAS type identifier */
|
|
108
115
|
Object.defineProperty(this, "oasType", {
|
|
109
116
|
enumerable: true,
|
|
110
117
|
configurable: true,
|
|
111
118
|
writable: true,
|
|
112
119
|
value: 'ref'
|
|
113
120
|
});
|
|
121
|
+
/** Type identifier */
|
|
114
122
|
Object.defineProperty(this, "type", {
|
|
115
123
|
enumerable: true,
|
|
116
124
|
configurable: true,
|
|
@@ -122,9 +130,24 @@ class OasRef {
|
|
|
122
130
|
__classPrivateFieldSet(this, _OasRef_fields, fields, "f");
|
|
123
131
|
__classPrivateFieldSet(this, _OasRef_oasDocument, oasDocument, "f");
|
|
124
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Type guard to check if this instance is a reference.
|
|
135
|
+
*
|
|
136
|
+
* @returns Always true for OasRef instances
|
|
137
|
+
*/
|
|
125
138
|
isRef() {
|
|
126
139
|
return true;
|
|
127
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Recursively resolves this reference to its final target component.
|
|
143
|
+
*
|
|
144
|
+
* Follows reference chains until reaching a non-reference component,
|
|
145
|
+
* with protection against infinite loops.
|
|
146
|
+
*
|
|
147
|
+
* @param lookupsPerformed - Internal counter to prevent infinite recursion
|
|
148
|
+
* @returns The resolved component
|
|
149
|
+
* @throws Error if maximum lookup depth is exceeded
|
|
150
|
+
*/
|
|
128
151
|
resolve(lookupsPerformed = 0) {
|
|
129
152
|
if (lookupsPerformed >= MAX_LOOKUPS) {
|
|
130
153
|
throw new Error('Max lookups reached');
|
|
@@ -132,6 +155,11 @@ class OasRef {
|
|
|
132
155
|
const resolved = this.resolveOnce();
|
|
133
156
|
return resolved.isRef() ? resolved.resolve(lookupsPerformed + 1) : resolved;
|
|
134
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* Resolves this reference one level, potentially returning another reference.
|
|
160
|
+
*
|
|
161
|
+
* @returns Either the resolved component or another reference in the chain
|
|
162
|
+
*/
|
|
135
163
|
resolveOnce() {
|
|
136
164
|
const c = this.oasDocument.components;
|
|
137
165
|
const refName = (0, refFns_js_1.toRefName)(this.$ref);
|
|
@@ -1,16 +1,50 @@
|
|
|
1
1
|
import type { ToJsonSchemaOptions } from '../schema/Schema.js';
|
|
2
2
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
3
|
+
/**
|
|
4
|
+
* Fields for configuring an OpenAPI server variable object.
|
|
5
|
+
*
|
|
6
|
+
* Represents the configuration data needed to create a server variable,
|
|
7
|
+
* including default values, enumeration constraints, and extensions.
|
|
8
|
+
*/
|
|
3
9
|
export type ServerVariableFields = {
|
|
10
|
+
/** Human-readable description of the server variable */
|
|
4
11
|
description?: string | undefined;
|
|
12
|
+
/** Default value for the server variable */
|
|
5
13
|
default: string;
|
|
14
|
+
/** Array of allowed values for the server variable */
|
|
6
15
|
enums?: string[] | undefined;
|
|
16
|
+
/** OpenAPI specification extensions */
|
|
7
17
|
extensionFields?: Record<string, unknown>;
|
|
8
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* Represents an OpenAPI server variable object.
|
|
21
|
+
*
|
|
22
|
+
* Server variables provide parameterization for server URLs,
|
|
23
|
+
* allowing dynamic server configuration with default values
|
|
24
|
+
* and enumeration constraints.
|
|
25
|
+
*
|
|
26
|
+
* @example Basic server variable
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const serverVar = new OasServerVariable({
|
|
29
|
+
* default: 'api',
|
|
30
|
+
* description: 'API version subdomain',
|
|
31
|
+
* enums: ['api', 'api-staging', 'api-dev']
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* console.log(serverVar.default); // 'api'
|
|
35
|
+
* console.log(serverVar.enums); // ['api', 'api-staging', 'api-dev']
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
9
38
|
export declare class OasServerVariable {
|
|
39
|
+
/** Type identifier for OAS server variable objects */
|
|
10
40
|
oasType: 'serverVariable';
|
|
41
|
+
/** Human-readable description of the server variable */
|
|
11
42
|
description: string | undefined;
|
|
43
|
+
/** Default value for the server variable */
|
|
12
44
|
default: string;
|
|
45
|
+
/** Array of allowed values for the server variable */
|
|
13
46
|
enums?: string[] | undefined;
|
|
47
|
+
/** OpenAPI specification extensions */
|
|
14
48
|
extensionFields: Record<string, unknown> | undefined;
|
|
15
49
|
constructor(fields: ServerVariableFields);
|
|
16
50
|
isRef(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerVariable.d.ts","sourceRoot":"","sources":["../../../src/oas/serverVariable/ServerVariable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,CAAC,EAAE,MAAM,GAA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EAAE,gBAAgB,CAAmB;IAC5C,wDAAwD;IACxD,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAA;IACf,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IAC5B,uCAAuC;IACvC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;gBACxC,MAAM,EAAE,oBAAoB;IAOxC,KAAK,IAAI,OAAO;IAIhB,OAAO,IAAI,iBAAiB;IAI5B,WAAW,IAAI,iBAAiB;IAIhC,YAAY,CAAC,QAAQ,EAAE,mBAAmB,GAAG,SAAS,CAAC,oBAAoB;CAO5E"}
|
|
@@ -1,32 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OasServerVariable = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Represents an OpenAPI server variable object.
|
|
6
|
+
*
|
|
7
|
+
* Server variables provide parameterization for server URLs,
|
|
8
|
+
* allowing dynamic server configuration with default values
|
|
9
|
+
* and enumeration constraints.
|
|
10
|
+
*
|
|
11
|
+
* @example Basic server variable
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const serverVar = new OasServerVariable({
|
|
14
|
+
* default: 'api',
|
|
15
|
+
* description: 'API version subdomain',
|
|
16
|
+
* enums: ['api', 'api-staging', 'api-dev']
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* console.log(serverVar.default); // 'api'
|
|
20
|
+
* console.log(serverVar.enums); // ['api', 'api-staging', 'api-dev']
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
4
23
|
class OasServerVariable {
|
|
5
24
|
constructor(fields) {
|
|
25
|
+
/** Type identifier for OAS server variable objects */
|
|
6
26
|
Object.defineProperty(this, "oasType", {
|
|
7
27
|
enumerable: true,
|
|
8
28
|
configurable: true,
|
|
9
29
|
writable: true,
|
|
10
30
|
value: 'serverVariable'
|
|
11
31
|
});
|
|
32
|
+
/** Human-readable description of the server variable */
|
|
12
33
|
Object.defineProperty(this, "description", {
|
|
13
34
|
enumerable: true,
|
|
14
35
|
configurable: true,
|
|
15
36
|
writable: true,
|
|
16
37
|
value: void 0
|
|
17
38
|
});
|
|
39
|
+
/** Default value for the server variable */
|
|
18
40
|
Object.defineProperty(this, "default", {
|
|
19
41
|
enumerable: true,
|
|
20
42
|
configurable: true,
|
|
21
43
|
writable: true,
|
|
22
44
|
value: void 0
|
|
23
45
|
});
|
|
46
|
+
/** Array of allowed values for the server variable */
|
|
24
47
|
Object.defineProperty(this, "enums", {
|
|
25
48
|
enumerable: true,
|
|
26
49
|
configurable: true,
|
|
27
50
|
writable: true,
|
|
28
51
|
value: void 0
|
|
29
52
|
});
|
|
53
|
+
/** OpenAPI specification extensions */
|
|
30
54
|
Object.defineProperty(this, "extensionFields", {
|
|
31
55
|
enumerable: true,
|
|
32
56
|
configurable: true,
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
+
/**
|
|
3
|
+
* Union type for OpenAPI string format specifiers.
|
|
4
|
+
*
|
|
5
|
+
* Represents the standard string formats defined in OpenAPI v3,
|
|
6
|
+
* providing semantic meaning for string validation and processing.
|
|
7
|
+
* Used for generating appropriate validation rules in target languages.
|
|
8
|
+
*/
|
|
9
|
+
export type StringFormat = 'date-time' | 'time' | 'date' | 'duration' | 'email' | 'hostname' | 'ipv4' | 'ipv6' | 'uuid' | 'uri' | 'regex' | 'password' | 'byte' | 'binary';
|
|
10
|
+
/**
|
|
11
|
+
* Valibot enum schema for valid OpenAPI string format values.
|
|
12
|
+
*
|
|
13
|
+
* Defines the standard string formats supported by OpenAPI v3,
|
|
14
|
+
* including date/time formats, network formats, and encoding formats.
|
|
15
|
+
*/
|
|
2
16
|
export declare const stringFormat: v.EnumSchema<{
|
|
3
17
|
readonly 'date-time': "date-time";
|
|
4
18
|
readonly time: "time";
|
|
@@ -15,6 +29,12 @@ export declare const stringFormat: v.EnumSchema<{
|
|
|
15
29
|
readonly byte: "byte";
|
|
16
30
|
readonly binary: "binary";
|
|
17
31
|
}, undefined>;
|
|
32
|
+
/**
|
|
33
|
+
* Valibot schema for validating OpenAPI string data objects.
|
|
34
|
+
*
|
|
35
|
+
* Validates string schema objects including length constraints,
|
|
36
|
+
* pattern validation, format specifiers, and enumeration values.
|
|
37
|
+
*/
|
|
18
38
|
export declare const oasStringData: v.ObjectSchema<{
|
|
19
39
|
readonly type: v.LiteralSchema<"string", undefined>;
|
|
20
40
|
readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -28,18 +48,35 @@ export declare const oasStringData: v.ObjectSchema<{
|
|
|
28
48
|
readonly nullable: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
29
49
|
readonly example: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
30
50
|
}, undefined>;
|
|
31
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Data type for OpenAPI string schema objects.
|
|
53
|
+
*
|
|
54
|
+
* Represents string schemas with validation constraints,
|
|
55
|
+
* format specifiers, and metadata. Used throughout the
|
|
56
|
+
* SKMTC pipeline for string type processing and code generation.
|
|
57
|
+
*/
|
|
32
58
|
export type OasStringData = {
|
|
59
|
+
/** Human-readable title for the string */
|
|
33
60
|
title?: string;
|
|
61
|
+
/** Detailed description of the string's purpose */
|
|
34
62
|
description?: string;
|
|
63
|
+
/** Default value for the string */
|
|
35
64
|
default?: string;
|
|
65
|
+
/** Type identifier (always 'string') */
|
|
36
66
|
type: 'string';
|
|
67
|
+
/** Maximum allowed length */
|
|
37
68
|
maxLength?: number;
|
|
69
|
+
/** Minimum required length */
|
|
38
70
|
minLength?: number;
|
|
71
|
+
/** Regular expression pattern for validation */
|
|
39
72
|
pattern?: string;
|
|
73
|
+
/** Array of valid enumeration values */
|
|
40
74
|
enum?: string[];
|
|
75
|
+
/** Format specifier (date-time, email, etc.) */
|
|
41
76
|
format?: string;
|
|
77
|
+
/** Whether null values are allowed */
|
|
42
78
|
nullable?: boolean;
|
|
79
|
+
/** Example value for documentation */
|
|
43
80
|
example?: string;
|
|
44
81
|
};
|
|
45
82
|
//# sourceMappingURL=string-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string-types.d.ts","sourceRoot":"","sources":["../../../src/oas/string/string-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B
|
|
1
|
+
{"version":3,"file":"string-types.d.ts","sourceRoot":"","sources":["../../../src/oas/string/string-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,MAAM,GACN,MAAM,GACN,UAAU,GACV,OAAO,GACP,UAAU,GACV,MAAM,GACN,MAAM,GACN,MAAM,GACN,KAAK,GACL,OAAO,GACP,UAAU,GACV,MAAM,GACN,QAAQ,CAAA;AAEZ;;;;;GAKG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;aAevB,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;aAYxB,CAAA;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,wCAAwC;IACxC,IAAI,EAAE,QAAQ,CAAA;IACd,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,sCAAsC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA"}
|
|
@@ -35,6 +35,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.oasStringData = exports.stringFormat = void 0;
|
|
37
37
|
const v = __importStar(require("valibot"));
|
|
38
|
+
/**
|
|
39
|
+
* Valibot enum schema for valid OpenAPI string format values.
|
|
40
|
+
*
|
|
41
|
+
* Defines the standard string formats supported by OpenAPI v3,
|
|
42
|
+
* including date/time formats, network formats, and encoding formats.
|
|
43
|
+
*/
|
|
38
44
|
exports.stringFormat = v.enum({
|
|
39
45
|
'date-time': 'date-time',
|
|
40
46
|
time: 'time',
|
|
@@ -51,6 +57,12 @@ exports.stringFormat = v.enum({
|
|
|
51
57
|
byte: 'byte',
|
|
52
58
|
binary: 'binary'
|
|
53
59
|
});
|
|
60
|
+
/**
|
|
61
|
+
* Valibot schema for validating OpenAPI string data objects.
|
|
62
|
+
*
|
|
63
|
+
* Validates string schema objects including length constraints,
|
|
64
|
+
* pattern validation, format specifiers, and enumeration values.
|
|
65
|
+
*/
|
|
54
66
|
exports.oasStringData = v.object({
|
|
55
67
|
type: v.literal('string'),
|
|
56
68
|
title: v.optional(v.string()),
|
|
@@ -2,14 +2,34 @@ import * as v from 'valibot';
|
|
|
2
2
|
import { type OasSchemaData } from '../schema/schema-types.js';
|
|
3
3
|
import { type OasSchemaRefData } from '../ref/ref-types.js';
|
|
4
4
|
import { type OasDiscriminatorData } from '../discriminator/discriminator-types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Data type for OpenAPI union schema objects.
|
|
7
|
+
*
|
|
8
|
+
* Represents union types (oneOf/anyOf) that allow values to match
|
|
9
|
+
* one or more of several possible schemas. Includes support for
|
|
10
|
+
* discriminator properties for efficient type resolution.
|
|
11
|
+
*/
|
|
5
12
|
export type OasUnionData = {
|
|
13
|
+
/** Type category identifier for schema objects */
|
|
6
14
|
oasType: 'schema';
|
|
15
|
+
/** Type identifier (always 'union') */
|
|
7
16
|
type: 'union';
|
|
17
|
+
/** Human-readable title for the union */
|
|
8
18
|
title?: string;
|
|
19
|
+
/** Detailed description of the union's purpose */
|
|
9
20
|
description?: string;
|
|
21
|
+
/** Array of schemas that comprise the union */
|
|
10
22
|
members: (OasSchemaData | OasSchemaRefData)[];
|
|
23
|
+
/** Optional discriminator for efficient type resolution */
|
|
11
24
|
discriminator?: OasDiscriminatorData;
|
|
12
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Valibot schema for validating OpenAPI union data objects.
|
|
28
|
+
*
|
|
29
|
+
* Validates union schemas including member schema arrays and optional
|
|
30
|
+
* discriminator properties. Uses lazy evaluation to handle recursive
|
|
31
|
+
* schema references in union members.
|
|
32
|
+
*/
|
|
13
33
|
export declare const oasUnionData: v.ObjectSchema<{
|
|
14
34
|
readonly oasType: v.LiteralSchema<"schema", undefined>;
|
|
15
35
|
readonly type: v.LiteralSchema<"union", undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"union-types.d.ts","sourceRoot":"","sources":["../../../src/oas/union/union-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,2BAA2B,CAAA;AAC7E,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,qBAAqB,CAAA;AAC7E,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,yCAAyC,CAAA;AAEhD,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,QAAQ,CAAA;IACjB,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,CAAC,aAAa,GAAG,gBAAgB,CAAC,EAAE,CAAA;IAC7C,aAAa,CAAC,EAAE,oBAAoB,CAAA;CACrC,CAAA;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;aAOvB,CAAA"}
|
|
1
|
+
{"version":3,"file":"union-types.d.ts","sourceRoot":"","sources":["../../../src/oas/union/union-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,2BAA2B,CAAA;AAC7E,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,qBAAqB,CAAA;AAC7E,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,yCAAyC,CAAA;AAEhD;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,kDAAkD;IAClD,OAAO,EAAE,QAAQ,CAAA;IACjB,uCAAuC;IACvC,IAAI,EAAE,OAAO,CAAA;IACb,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,+CAA+C;IAC/C,OAAO,EAAE,CAAC,aAAa,GAAG,gBAAgB,CAAC,EAAE,CAAA;IAC7C,2DAA2D;IAC3D,aAAa,CAAC,EAAE,oBAAoB,CAAA;CACrC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;aAOvB,CAAA"}
|
|
@@ -38,6 +38,13 @@ const v = __importStar(require("valibot"));
|
|
|
38
38
|
const schema_types_js_1 = require("../schema/schema-types.js");
|
|
39
39
|
const ref_types_js_1 = require("../ref/ref-types.js");
|
|
40
40
|
const discriminator_types_js_1 = require("../discriminator/discriminator-types.js");
|
|
41
|
+
/**
|
|
42
|
+
* Valibot schema for validating OpenAPI union data objects.
|
|
43
|
+
*
|
|
44
|
+
* Validates union schemas including member schema arrays and optional
|
|
45
|
+
* discriminator properties. Uses lazy evaluation to handle recursive
|
|
46
|
+
* schema references in union members.
|
|
47
|
+
*/
|
|
41
48
|
exports.oasUnionData = v.object({
|
|
42
49
|
oasType: v.literal('schema'),
|
|
43
50
|
type: v.literal('union'),
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
+
/**
|
|
3
|
+
* Valibot schema for validating OpenAPI unknown data objects.
|
|
4
|
+
*
|
|
5
|
+
* Validates unknown/unspecified schemas used as fallbacks when
|
|
6
|
+
* schema types cannot be determined or for flexible data handling.
|
|
7
|
+
*/
|
|
2
8
|
export declare const oasUnknownData: v.ObjectSchema<{
|
|
3
9
|
readonly oasType: v.LiteralSchema<"schema", undefined>;
|
|
4
10
|
readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -6,11 +12,23 @@ export declare const oasUnknownData: v.ObjectSchema<{
|
|
|
6
12
|
readonly default: v.OptionalSchema<v.UnknownSchema, undefined>;
|
|
7
13
|
readonly type: v.LiteralSchema<"unknown", undefined>;
|
|
8
14
|
}, undefined>;
|
|
15
|
+
/**
|
|
16
|
+
* Data type for OpenAPI unknown schema objects.
|
|
17
|
+
*
|
|
18
|
+
* Represents schemas with unspecified or flexible types, used as
|
|
19
|
+
* fallbacks when schema types cannot be determined or when maximum
|
|
20
|
+
* flexibility is required in the API specification.
|
|
21
|
+
*/
|
|
9
22
|
export type OasUnknownData = {
|
|
23
|
+
/** Type category identifier for schema objects */
|
|
10
24
|
oasType: 'schema';
|
|
25
|
+
/** Human-readable title for the unknown schema */
|
|
11
26
|
title?: string;
|
|
27
|
+
/** Detailed description of the schema's purpose */
|
|
12
28
|
description?: string;
|
|
29
|
+
/** Default value of any type */
|
|
13
30
|
default?: unknown;
|
|
31
|
+
/** Type identifier (always 'unknown') */
|
|
14
32
|
type: 'unknown';
|
|
15
33
|
};
|
|
16
34
|
//# sourceMappingURL=unknown-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unknown-types.d.ts","sourceRoot":"","sources":["../../../src/oas/unknown/unknown-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,eAAO,MAAM,cAAc;;;;;;aAMzB,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,QAAQ,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,EAAE,SAAS,CAAA;CAChB,CAAA"}
|
|
1
|
+
{"version":3,"file":"unknown-types.d.ts","sourceRoot":"","sources":["../../../src/oas/unknown/unknown-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;GAKG;AACH,eAAO,MAAM,cAAc;;;;;;aAMzB,CAAA;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,kDAAkD;IAClD,OAAO,EAAE,QAAQ,CAAA;IACjB,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gCAAgC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,yCAAyC;IACzC,IAAI,EAAE,SAAS,CAAA;CAChB,CAAA"}
|
|
@@ -35,6 +35,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.oasUnknownData = void 0;
|
|
37
37
|
const v = __importStar(require("valibot"));
|
|
38
|
+
/**
|
|
39
|
+
* Valibot schema for validating OpenAPI unknown data objects.
|
|
40
|
+
*
|
|
41
|
+
* Validates unknown/unspecified schemas used as fallbacks when
|
|
42
|
+
* schema types cannot be determined or for flexible data handling.
|
|
43
|
+
*/
|
|
38
44
|
exports.oasUnknownData = v.object({
|
|
39
45
|
oasType: v.literal('schema'),
|
|
40
46
|
title: v.optional(v.string()),
|
|
@@ -11,17 +11,32 @@ export type ListParams<V extends Stringable> = List<V[], ', ', '()'>;
|
|
|
11
11
|
export type SkipEmptyOption = {
|
|
12
12
|
skipEmpty?: boolean;
|
|
13
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* Type alias for creating key-value pair lists.
|
|
16
|
+
*
|
|
17
|
+
* Creates a List specialized for key-value pairs with colon separator
|
|
18
|
+
* and no bookends (e.g., "key1: value1, key2: value2").
|
|
19
|
+
*
|
|
20
|
+
* @template Key - Type of the keys (must be stringable)
|
|
21
|
+
* @template Value - Type of the values (must be stringable)
|
|
22
|
+
*/
|
|
14
23
|
export type ListKeyValue<Key extends Stringable, Value extends Stringable> = List<[
|
|
15
24
|
Key,
|
|
16
25
|
Value
|
|
17
26
|
], ': ', 'none'>;
|
|
18
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Type representing the different bookend styles for lists.
|
|
29
|
+
*/
|
|
30
|
+
export type BookendsType = '[]' | '{}' | '()' | '<>' | 'none';
|
|
19
31
|
type ConstructorOptions<Separator extends string = ', ', Bookends extends BookendsType = 'none'> = {
|
|
20
32
|
separator?: Separator;
|
|
21
33
|
bookends?: Bookends;
|
|
22
34
|
skipEmpty?: boolean;
|
|
23
35
|
};
|
|
24
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Utility type to extract the item type from an array type.
|
|
38
|
+
*/
|
|
39
|
+
export type ExtractArrayItem<ArrayOf> = ArrayOf extends Array<infer Item> ? Item : never;
|
|
25
40
|
type ToFilteredKeyValueReturn<Value extends undefined | Stringable | Stringable[] | List> = Value extends undefined ? undefined : List<[string, Stringable | Stringable[] | List], ': ', 'none'>;
|
|
26
41
|
type ToConditionalReturn<Value extends Stringable, Condition extends boolean> = Condition extends true ? List<[Value], ', ', 'none'> : List<never[], ', ', 'none'>;
|
|
27
42
|
/**
|
|
@@ -136,6 +151,14 @@ export declare class List<Values extends Stringable[] = Stringable[], Separator
|
|
|
136
151
|
* ```
|
|
137
152
|
*/
|
|
138
153
|
constructor(values: (ExtractArrayItem<Values> | undefined)[], { separator, bookends, skipEmpty }?: ConstructorOptions<Separator, Bookends>);
|
|
154
|
+
/**
|
|
155
|
+
* Converts the list to its string representation.
|
|
156
|
+
*
|
|
157
|
+
* Joins all values with the configured separator and wraps with bookends.
|
|
158
|
+
* Returns empty string if skipEmpty is enabled and list is empty.
|
|
159
|
+
*
|
|
160
|
+
* @returns Formatted string representation of the list
|
|
161
|
+
*/
|
|
139
162
|
toString(): string;
|
|
140
163
|
/**
|
|
141
164
|
* Create an empty List that will render as an empty string ''
|
|
@@ -241,13 +264,51 @@ export declare class List<Values extends Stringable[] = Stringable[], Separator
|
|
|
241
264
|
*/
|
|
242
265
|
static hasValue: (value: undefined | Stringable | Stringable[] | List) => value is Stringable | Stringable[] | List;
|
|
243
266
|
}
|
|
244
|
-
|
|
267
|
+
/**
|
|
268
|
+
* Mapping function type for transforming keys into values.
|
|
269
|
+
*/
|
|
270
|
+
export type KeyMapFn<V extends Stringable> = (key: string, index: number) => V;
|
|
271
|
+
/**
|
|
272
|
+
* Utility class for working with arrays of string keys.
|
|
273
|
+
*
|
|
274
|
+
* Provides methods for transforming key arrays into objects and lists
|
|
275
|
+
* with custom mapping functions.
|
|
276
|
+
*/
|
|
245
277
|
export declare class KeyList {
|
|
278
|
+
/** Array of string keys */
|
|
246
279
|
keys: string[];
|
|
280
|
+
/**
|
|
281
|
+
* Creates a new KeyList instance.
|
|
282
|
+
*
|
|
283
|
+
* @param keys - Array of string keys to work with
|
|
284
|
+
*/
|
|
247
285
|
constructor(keys: string[]);
|
|
286
|
+
/**
|
|
287
|
+
* Transforms keys into an object using a mapping function.
|
|
288
|
+
*
|
|
289
|
+
* @param mapFn - Function to transform each key into a value
|
|
290
|
+
* @param options - Options for handling empty values
|
|
291
|
+
* @returns Object with keys mapped to transformed values
|
|
292
|
+
*/
|
|
248
293
|
toObject<V extends Stringable>(mapFn: KeyMapFn<V>, { skipEmpty }?: SkipEmptyOption): ListObject<V>;
|
|
294
|
+
/**
|
|
295
|
+
* Creates a plain object with keys as both keys and values.
|
|
296
|
+
*
|
|
297
|
+
* @returns Object where each key maps to itself
|
|
298
|
+
*/
|
|
249
299
|
toObjectPlain(): ListObject<string>;
|
|
300
|
+
/**
|
|
301
|
+
* Transforms keys into a List using a mapping function.
|
|
302
|
+
*
|
|
303
|
+
* @param mapFn - Function to transform each key into a value
|
|
304
|
+
* @returns List containing the transformed values
|
|
305
|
+
*/
|
|
250
306
|
toLines<V extends Stringable>(mapFn: KeyMapFn<V>): ListLines<V>;
|
|
307
|
+
/**
|
|
308
|
+
* Creates a List with keys as the values.
|
|
309
|
+
*
|
|
310
|
+
* @returns List containing the original keys
|
|
311
|
+
*/
|
|
251
312
|
toLinesPlain(): ListLines<string>;
|
|
252
313
|
}
|
|
253
314
|
type Entry<T extends Stringable> = [key: string, value: T];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/typescript/List.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAGtD,4EAA4E;AAC5E,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,UAAU,IAAI,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAEpE,2DAA2D;AAC3D,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,UAAU,IAAI,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;AAErE,8EAA8E;AAC9E,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,UAAU,IAAI,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAEnE,gFAAgF;AAChF,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,UAAU,IAAI,IAAI,CAA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