@skmtc/core 0.0.796 → 0.0.798
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/app/validate.d.ts +32 -0
- package/esm/app/validate.d.ts.map +1 -1
- package/esm/app/validate.js +32 -0
- package/esm/context/CoreContext.d.ts +147 -2
- package/esm/context/CoreContext.d.ts.map +1 -1
- package/esm/context/CoreContext.js +87 -0
- package/esm/context/GenerateContext.d.ts +180 -0
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +25 -0
- package/esm/context/ParseContext.d.ts +6 -0
- package/esm/context/ParseContext.d.ts.map +1 -1
- package/esm/context/ParseContext.js +6 -0
- package/esm/dsl/constants.d.ts +28 -0
- package/esm/dsl/constants.d.ts.map +1 -1
- package/esm/dsl/constants.js +28 -0
- package/esm/oas/_helpers/parseDefault.d.ts +148 -0
- package/esm/oas/_helpers/parseDefault.d.ts.map +1 -1
- package/esm/oas/_helpers/parseDefault.js +128 -0
- package/esm/oas/_helpers/parseEnum.d.ts +124 -0
- package/esm/oas/_helpers/parseEnum.d.ts.map +1 -1
- package/esm/oas/_helpers/parseEnum.js +104 -0
- package/esm/oas/_helpers/parseExample.d.ts +107 -0
- package/esm/oas/_helpers/parseExample.d.ts.map +1 -1
- package/esm/oas/_helpers/parseExample.js +87 -0
- package/esm/oas/_helpers/parseFormat.d.ts +154 -0
- package/esm/oas/_helpers/parseFormat.d.ts.map +1 -1
- package/esm/oas/_helpers/parseFormat.js +138 -0
- package/esm/oas/_helpers/parseNullable.d.ts +127 -0
- package/esm/oas/_helpers/parseNullable.d.ts.map +1 -1
- package/esm/oas/_helpers/parseNullable.js +113 -0
- package/esm/oas/example/toExamplesV3.d.ts +39 -0
- package/esm/oas/example/toExamplesV3.d.ts.map +1 -1
- package/esm/oas/example/toExamplesV3.js +29 -0
- package/esm/oas/object/Object.d.ts +6 -0
- package/esm/oas/object/Object.d.ts.map +1 -1
- package/esm/oas/object/Object.js +6 -0
- package/esm/oas/operation/Operation.d.ts +34 -0
- package/esm/oas/operation/Operation.d.ts.map +1 -1
- package/esm/oas/operation/Operation.js +14 -0
- package/esm/oas/parameter/Parameter.d.ts +3 -0
- package/esm/oas/parameter/Parameter.d.ts.map +1 -1
- package/esm/oas/parameter/Parameter.js +3 -0
- package/esm/oas/ref/ref-types.d.ts +42 -0
- package/esm/oas/ref/ref-types.d.ts.map +1 -1
- package/esm/oas/ref/ref-types.js +9 -0
- package/esm/oas/securitySchemes/security-scheme-types.d.ts +63 -0
- package/esm/oas/securitySchemes/security-scheme-types.d.ts.map +1 -1
- package/esm/oas/securitySchemes/security-scheme-types.js +15 -0
- package/esm/run/toV3JsonDocument.d.ts +90 -0
- package/esm/run/toV3JsonDocument.d.ts.map +1 -1
- package/esm/run/toV3JsonDocument.js +84 -0
- package/esm/types/Results.d.ts +32 -0
- package/esm/types/Results.d.ts.map +1 -1
- package/esm/types/Results.js +12 -0
- package/package.json +1 -1
- package/script/app/validate.d.ts +32 -0
- package/script/app/validate.d.ts.map +1 -1
- package/script/app/validate.js +32 -0
- package/script/context/CoreContext.d.ts +147 -2
- package/script/context/CoreContext.d.ts.map +1 -1
- package/script/context/CoreContext.js +87 -0
- package/script/context/GenerateContext.d.ts +180 -0
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +25 -0
- package/script/context/ParseContext.d.ts +6 -0
- package/script/context/ParseContext.d.ts.map +1 -1
- package/script/context/ParseContext.js +6 -0
- package/script/dsl/constants.d.ts +28 -0
- package/script/dsl/constants.d.ts.map +1 -1
- package/script/dsl/constants.js +28 -0
- package/script/oas/_helpers/parseDefault.d.ts +148 -0
- package/script/oas/_helpers/parseDefault.d.ts.map +1 -1
- package/script/oas/_helpers/parseDefault.js +128 -0
- package/script/oas/_helpers/parseEnum.d.ts +124 -0
- package/script/oas/_helpers/parseEnum.d.ts.map +1 -1
- package/script/oas/_helpers/parseEnum.js +104 -0
- package/script/oas/_helpers/parseExample.d.ts +107 -0
- package/script/oas/_helpers/parseExample.d.ts.map +1 -1
- package/script/oas/_helpers/parseExample.js +87 -0
- package/script/oas/_helpers/parseFormat.d.ts +154 -0
- package/script/oas/_helpers/parseFormat.d.ts.map +1 -1
- package/script/oas/_helpers/parseFormat.js +138 -0
- package/script/oas/_helpers/parseNullable.d.ts +127 -0
- package/script/oas/_helpers/parseNullable.d.ts.map +1 -1
- package/script/oas/_helpers/parseNullable.js +113 -0
- package/script/oas/example/toExamplesV3.d.ts +39 -0
- package/script/oas/example/toExamplesV3.d.ts.map +1 -1
- package/script/oas/example/toExamplesV3.js +29 -0
- package/script/oas/object/Object.d.ts +6 -0
- package/script/oas/object/Object.d.ts.map +1 -1
- package/script/oas/object/Object.js +6 -0
- package/script/oas/operation/Operation.d.ts +34 -0
- package/script/oas/operation/Operation.d.ts.map +1 -1
- package/script/oas/operation/Operation.js +14 -0
- package/script/oas/parameter/Parameter.d.ts +3 -0
- package/script/oas/parameter/Parameter.d.ts.map +1 -1
- package/script/oas/parameter/Parameter.js +3 -0
- package/script/oas/ref/ref-types.d.ts +42 -0
- package/script/oas/ref/ref-types.d.ts.map +1 -1
- package/script/oas/ref/ref-types.js +9 -0
- package/script/oas/securitySchemes/security-scheme-types.d.ts +63 -0
- package/script/oas/securitySchemes/security-scheme-types.d.ts.map +1 -1
- package/script/oas/securitySchemes/security-scheme-types.js +15 -0
- package/script/run/toV3JsonDocument.d.ts +90 -0
- package/script/run/toV3JsonDocument.d.ts.map +1 -1
- package/script/run/toV3JsonDocument.js +84 -0
- package/script/types/Results.d.ts +32 -0
- package/script/types/Results.d.ts.map +1 -1
- package/script/types/Results.js +12 -0
|
@@ -1,55 +1,118 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
+
/**
|
|
3
|
+
* Data type for HTTP authentication security schemes.
|
|
4
|
+
*
|
|
5
|
+
* Represents HTTP authentication mechanisms like Basic, Bearer,
|
|
6
|
+
* and other HTTP authentication schemes as defined in RFC 7235.
|
|
7
|
+
*/
|
|
2
8
|
export type OasHttpSecuritySchemeData = {
|
|
9
|
+
/** Security scheme type identifier */
|
|
3
10
|
type: 'http';
|
|
11
|
+
/** Human-readable description of the security scheme */
|
|
4
12
|
description?: string;
|
|
13
|
+
/** HTTP authorization scheme (e.g., 'basic', 'bearer') */
|
|
5
14
|
scheme: string;
|
|
15
|
+
/** Format hint for bearer tokens (e.g., 'JWT') */
|
|
6
16
|
bearerFormat?: string;
|
|
7
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Valibot schema for validating HTTP security scheme data.
|
|
20
|
+
*/
|
|
8
21
|
export declare const oasHttpSecuritySchemeData: v.ObjectSchema<{
|
|
9
22
|
readonly type: v.LiteralSchema<"http", undefined>;
|
|
10
23
|
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
11
24
|
readonly scheme: v.StringSchema<undefined>;
|
|
12
25
|
readonly bearerFormat: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
13
26
|
}, undefined>;
|
|
27
|
+
/**
|
|
28
|
+
* Data type for API key authentication security schemes.
|
|
29
|
+
*
|
|
30
|
+
* Represents API key authentication where the key is passed
|
|
31
|
+
* via header, query parameter, or cookie.
|
|
32
|
+
*/
|
|
14
33
|
export type OasApiKeySecuritySchemeData = {
|
|
34
|
+
/** Security scheme type identifier */
|
|
15
35
|
type: 'apiKey';
|
|
36
|
+
/** Human-readable description of the security scheme */
|
|
16
37
|
description?: string;
|
|
38
|
+
/** Name of the header, query parameter, or cookie */
|
|
17
39
|
name: string;
|
|
40
|
+
/** Location where the API key should be sent */
|
|
18
41
|
in: 'header' | 'query' | 'cookie';
|
|
19
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* Valibot schema for validating API key security scheme data.
|
|
45
|
+
*/
|
|
20
46
|
export declare const oasApiKeySecuritySchemeData: v.ObjectSchema<{
|
|
21
47
|
readonly type: v.LiteralSchema<"apiKey", undefined>;
|
|
22
48
|
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
23
49
|
readonly name: v.StringSchema<undefined>;
|
|
24
50
|
readonly in: v.UnionSchema<[v.LiteralSchema<"header", undefined>, v.LiteralSchema<"query", undefined>, v.LiteralSchema<"cookie", undefined>], undefined>;
|
|
25
51
|
}, undefined>;
|
|
52
|
+
/**
|
|
53
|
+
* Data type for OAuth2 implicit flow configuration.
|
|
54
|
+
*
|
|
55
|
+
* Represents the implicit OAuth2 flow where tokens are obtained
|
|
56
|
+
* directly from the authorization endpoint without client authentication.
|
|
57
|
+
*/
|
|
26
58
|
export type OasImplicitOAuth2FlowData = {
|
|
59
|
+
/** URL for the OAuth2 authorization endpoint */
|
|
27
60
|
authorizationUrl: string;
|
|
61
|
+
/** Optional URL for token refresh */
|
|
28
62
|
refreshUrl: string | undefined;
|
|
63
|
+
/** Available scopes mapped to their descriptions */
|
|
29
64
|
scopes: Record<string, string>;
|
|
30
65
|
};
|
|
66
|
+
/**
|
|
67
|
+
* Valibot schema for validating OAuth2 implicit flow data.
|
|
68
|
+
*/
|
|
31
69
|
export declare const oasImplicitOAuth2FlowData: v.ObjectSchema<{
|
|
32
70
|
readonly authorizationUrl: v.StringSchema<undefined>;
|
|
33
71
|
readonly refreshUrl: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
34
72
|
readonly scopes: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
|
|
35
73
|
}, undefined>;
|
|
74
|
+
/**
|
|
75
|
+
* Data type for OAuth2 authorization code flow configuration.
|
|
76
|
+
*
|
|
77
|
+
* Represents the authorization code OAuth2 flow, the most secure
|
|
78
|
+
* flow suitable for server-side applications with client authentication.
|
|
79
|
+
*/
|
|
36
80
|
export type OasAuthorizationCodeOAuth2FlowData = {
|
|
81
|
+
/** URL for the OAuth2 authorization endpoint */
|
|
37
82
|
authorizationUrl: string;
|
|
83
|
+
/** URL for the OAuth2 token endpoint */
|
|
38
84
|
tokenUrl: string;
|
|
85
|
+
/** Optional URL for token refresh */
|
|
39
86
|
refreshUrl: string | undefined;
|
|
87
|
+
/** Available scopes mapped to their descriptions */
|
|
40
88
|
scopes: Record<string, string>;
|
|
41
89
|
};
|
|
90
|
+
/**
|
|
91
|
+
* Valibot schema for validating OAuth2 authorization code flow data.
|
|
92
|
+
*/
|
|
42
93
|
export declare const oasAuthorizationCodeOAuth2FlowData: v.ObjectSchema<{
|
|
43
94
|
readonly authorizationUrl: v.StringSchema<undefined>;
|
|
44
95
|
readonly tokenUrl: v.StringSchema<undefined>;
|
|
45
96
|
readonly refreshUrl: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
46
97
|
readonly scopes: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
|
|
47
98
|
}, undefined>;
|
|
99
|
+
/**
|
|
100
|
+
* Data type for OAuth2 client credentials flow configuration.
|
|
101
|
+
*
|
|
102
|
+
* Represents the client credentials OAuth2 flow used for
|
|
103
|
+
* server-to-server authentication without user involvement.
|
|
104
|
+
*/
|
|
48
105
|
export type OasClientCredentialsOAuth2FlowData = {
|
|
106
|
+
/** URL for the OAuth2 token endpoint */
|
|
49
107
|
tokenUrl: string;
|
|
108
|
+
/** Optional URL for token refresh */
|
|
50
109
|
refreshUrl: string | undefined;
|
|
110
|
+
/** Available scopes mapped to their descriptions */
|
|
51
111
|
scopes: Record<string, string>;
|
|
52
112
|
};
|
|
113
|
+
/**
|
|
114
|
+
* Valibot schema for validating OAuth2 client credentials flow data.
|
|
115
|
+
*/
|
|
53
116
|
export declare const oasClientCredentialsOAuth2FlowData: v.ObjectSchema<{
|
|
54
117
|
readonly tokenUrl: v.StringSchema<undefined>;
|
|
55
118
|
readonly refreshUrl: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security-scheme-types.d.ts","sourceRoot":"","sources":["../../../src/oas/securitySchemes/security-scheme-types.ts"],"names":[],"mappings":"AAAA,OAAO,KA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QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B,CAAA;AAED,eAAO,MAAM,yBAAyB;;;;aAIpC,CAAA;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,iBAAiB,CAAC,EAAE,kCAAkC,CAAA;IACtD,iBAAiB,CAAC,EAAE,kCAAkC,CAAA;IACtD,QAAQ,CAAC,EAAE,yBAAyB,CAAA;IACpC,QAAQ,CAAC,EAAE,yBAAyB,CAAA;CACrC,CAAA;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;aAK7B,CAAA;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE,QAAQ,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,kBAAkB,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;aAItC,CAAA;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE,eAAe,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gBAAgB,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,2BAA2B;;;;aAItC,CAAA;AAEF,MAAM,MAAM,qBAAqB,GAC7B,yBAAyB,GACzB,2BAA2B,GAC3B,2BAA2B,GAC3B,2BAA2B,CAAA;AAE/B,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAKhC,CAAA"}
|
|
1
|
+
{"version":3,"file":"security-scheme-types.d.ts","sourceRoot":"","sources":["../../../src/oas/securitySchemes/security-scheme-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;GAKG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACt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,2BAA2B,GAC3B,2BAA2B,CAAA;AAE/B,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAKhC,CAAA"}
|
|
@@ -35,29 +35,44 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.oasSecuritySchemeData = exports.oasOpenIdSecuritySchemeData = exports.oasOAuth2SecuritySchemeData = exports.oasOAuth2FlowsData = exports.oasPasswordOAuth2FlowData = exports.oasClientCredentialsOAuth2FlowData = exports.oasAuthorizationCodeOAuth2FlowData = exports.oasImplicitOAuth2FlowData = exports.oasApiKeySecuritySchemeData = exports.oasHttpSecuritySchemeData = void 0;
|
|
37
37
|
const v = __importStar(require("valibot"));
|
|
38
|
+
/**
|
|
39
|
+
* Valibot schema for validating HTTP security scheme data.
|
|
40
|
+
*/
|
|
38
41
|
exports.oasHttpSecuritySchemeData = v.object({
|
|
39
42
|
type: v.literal('http'),
|
|
40
43
|
description: v.optional(v.string()),
|
|
41
44
|
scheme: v.string(),
|
|
42
45
|
bearerFormat: v.optional(v.string())
|
|
43
46
|
});
|
|
47
|
+
/**
|
|
48
|
+
* Valibot schema for validating API key security scheme data.
|
|
49
|
+
*/
|
|
44
50
|
exports.oasApiKeySecuritySchemeData = v.object({
|
|
45
51
|
type: v.literal('apiKey'),
|
|
46
52
|
description: v.optional(v.string()),
|
|
47
53
|
name: v.string(),
|
|
48
54
|
in: v.union([v.literal('header'), v.literal('query'), v.literal('cookie')])
|
|
49
55
|
});
|
|
56
|
+
/**
|
|
57
|
+
* Valibot schema for validating OAuth2 implicit flow data.
|
|
58
|
+
*/
|
|
50
59
|
exports.oasImplicitOAuth2FlowData = v.object({
|
|
51
60
|
authorizationUrl: v.string(),
|
|
52
61
|
refreshUrl: v.optional(v.string()),
|
|
53
62
|
scopes: v.record(v.string(), v.string())
|
|
54
63
|
});
|
|
64
|
+
/**
|
|
65
|
+
* Valibot schema for validating OAuth2 authorization code flow data.
|
|
66
|
+
*/
|
|
55
67
|
exports.oasAuthorizationCodeOAuth2FlowData = v.object({
|
|
56
68
|
authorizationUrl: v.string(),
|
|
57
69
|
tokenUrl: v.string(),
|
|
58
70
|
refreshUrl: v.optional(v.string()),
|
|
59
71
|
scopes: v.record(v.string(), v.string())
|
|
60
72
|
});
|
|
73
|
+
/**
|
|
74
|
+
* Valibot schema for validating OAuth2 client credentials flow data.
|
|
75
|
+
*/
|
|
61
76
|
exports.oasClientCredentialsOAuth2FlowData = v.object({
|
|
62
77
|
tokenUrl: v.string(),
|
|
63
78
|
refreshUrl: v.optional(v.string()),
|
|
@@ -1,7 +1,97 @@
|
|
|
1
1
|
import "../_dnt.polyfills.js";
|
|
2
2
|
import type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
|
|
3
|
+
/**
|
|
4
|
+
* Union type representing any supported OpenAPI document version.
|
|
5
|
+
*
|
|
6
|
+
* SKMTC supports processing OpenAPI/Swagger documents from version 2.0 through 3.1,
|
|
7
|
+
* automatically converting them to OpenAPI 3.0 format for internal processing.
|
|
8
|
+
*/
|
|
3
9
|
type AnyOasDocument = OpenAPIV2.Document | OpenAPIV3.Document | OpenAPIV3_1.Document;
|
|
10
|
+
/**
|
|
11
|
+
* Parses a string into an OpenAPI document object.
|
|
12
|
+
*
|
|
13
|
+
* Automatically detects whether the input string is JSON or YAML format based on
|
|
14
|
+
* the content, then parses it into an OpenAPI document object. Supports all
|
|
15
|
+
* OpenAPI versions (2.0, 3.0.x, 3.1.x).
|
|
16
|
+
*
|
|
17
|
+
* @param schema - The OpenAPI document as a JSON or YAML string
|
|
18
|
+
* @returns Parsed OpenAPI document object
|
|
19
|
+
*
|
|
20
|
+
* @example Parsing JSON OpenAPI document
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const jsonSchema = `{
|
|
23
|
+
* "openapi": "3.0.0",
|
|
24
|
+
* "info": { "title": "My API", "version": "1.0.0" },
|
|
25
|
+
* "paths": {}
|
|
26
|
+
* }`;
|
|
27
|
+
* const document = stringToSchema(jsonSchema);
|
|
28
|
+
* console.log(document.info.title); // "My API"
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example Parsing YAML OpenAPI document
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const yamlSchema = `
|
|
34
|
+
* openapi: 3.0.0
|
|
35
|
+
* info:
|
|
36
|
+
* title: My API
|
|
37
|
+
* version: 1.0.0
|
|
38
|
+
* paths: {}
|
|
39
|
+
* `;
|
|
40
|
+
* const document = stringToSchema(yamlSchema);
|
|
41
|
+
* console.log(document.info.title); // "My API"
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @throws {SyntaxError} If the JSON is malformed
|
|
45
|
+
* @throws {Error} If the YAML is malformed
|
|
46
|
+
*/
|
|
4
47
|
export declare const stringToSchema: (schema: string) => AnyOasDocument;
|
|
48
|
+
/**
|
|
49
|
+
* Converts any OpenAPI document version to OpenAPI 3.0 format.
|
|
50
|
+
*
|
|
51
|
+
* SKMTC processes all documents using OpenAPI 3.0 as the internal format.
|
|
52
|
+
* This function handles version detection and conversion from:
|
|
53
|
+
* - OpenAPI 3.0.x (returned as-is)
|
|
54
|
+
* - OpenAPI 3.1.x (downgraded to 3.0 with allOf transformations)
|
|
55
|
+
* - Swagger 2.0 (upgraded to OpenAPI 3.0)
|
|
56
|
+
*
|
|
57
|
+
* @param schema - The OpenAPI document to convert
|
|
58
|
+
* @returns Promise resolving to an OpenAPI 3.0 document
|
|
59
|
+
*
|
|
60
|
+
* @example Converting OpenAPI 3.1 to 3.0
|
|
61
|
+
* ```typescript
|
|
62
|
+
* const openapi31Doc = {
|
|
63
|
+
* openapi: "3.1.0",
|
|
64
|
+
* info: { title: "My API", version: "1.0.0" },
|
|
65
|
+
* paths: {}
|
|
66
|
+
* };
|
|
67
|
+
* const v3Doc = await toV3Document(openapi31Doc);
|
|
68
|
+
* console.log(v3Doc.openapi); // "3.0.3" (converted)
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @example Converting Swagger 2.0 to OpenAPI 3.0
|
|
72
|
+
* ```typescript
|
|
73
|
+
* const swagger2Doc = {
|
|
74
|
+
* swagger: "2.0",
|
|
75
|
+
* info: { title: "My API", version: "1.0.0" },
|
|
76
|
+
* paths: {}
|
|
77
|
+
* };
|
|
78
|
+
* const v3Doc = await toV3Document(swagger2Doc);
|
|
79
|
+
* console.log(v3Doc.openapi); // "3.0.0" (converted)
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @example OpenAPI 3.0 passthrough
|
|
83
|
+
* ```typescript
|
|
84
|
+
* const openapi30Doc = {
|
|
85
|
+
* openapi: "3.0.2",
|
|
86
|
+
* info: { title: "My API", version: "1.0.0" },
|
|
87
|
+
* paths: {}
|
|
88
|
+
* };
|
|
89
|
+
* const v3Doc = await toV3Document(openapi30Doc);
|
|
90
|
+
* console.log(v3Doc === openapi30Doc); // true (same object)
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @throws {Error} If the document version is not recognized or supported
|
|
94
|
+
*/
|
|
5
95
|
export declare const toV3Document: (schema: AnyOasDocument) => Promise<OpenAPIV3.Document>;
|
|
6
96
|
export {};
|
|
7
97
|
//# sourceMappingURL=toV3JsonDocument.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toV3JsonDocument.d.ts","sourceRoot":"","sources":["../../src/run/toV3JsonDocument.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAUtE,KAAK,cAAc,GAAG,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAA;AAEpF,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,cAM/C,CAAA;AAED,eAAO,MAAM,YAAY,GAAU,QAAQ,cAAc,KAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CA0BrF,CAAA"}
|
|
1
|
+
{"version":3,"file":"toV3JsonDocument.d.ts","sourceRoot":"","sources":["../../src/run/toV3JsonDocument.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAUtE;;;;;GAKG;AACH,KAAK,cAAc,GAAG,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAA;AAEpF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,cAM/C,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,eAAO,MAAM,YAAY,GAAU,QAAQ,cAAc,KAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CA0BrF,CAAA"}
|
|
@@ -9,6 +9,43 @@ const parse_js_1 = require("../deps/jsr.io/@std/yaml/1.0.9/parse.js");
|
|
|
9
9
|
const openapi_down_convert_1 = require("@apiture/openapi-down-convert");
|
|
10
10
|
const ts_pattern_1 = require("ts-pattern");
|
|
11
11
|
const swagger2openapi_1 = __importDefault(require("swagger2openapi"));
|
|
12
|
+
/**
|
|
13
|
+
* Parses a string into an OpenAPI document object.
|
|
14
|
+
*
|
|
15
|
+
* Automatically detects whether the input string is JSON or YAML format based on
|
|
16
|
+
* the content, then parses it into an OpenAPI document object. Supports all
|
|
17
|
+
* OpenAPI versions (2.0, 3.0.x, 3.1.x).
|
|
18
|
+
*
|
|
19
|
+
* @param schema - The OpenAPI document as a JSON or YAML string
|
|
20
|
+
* @returns Parsed OpenAPI document object
|
|
21
|
+
*
|
|
22
|
+
* @example Parsing JSON OpenAPI document
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const jsonSchema = `{
|
|
25
|
+
* "openapi": "3.0.0",
|
|
26
|
+
* "info": { "title": "My API", "version": "1.0.0" },
|
|
27
|
+
* "paths": {}
|
|
28
|
+
* }`;
|
|
29
|
+
* const document = stringToSchema(jsonSchema);
|
|
30
|
+
* console.log(document.info.title); // "My API"
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example Parsing YAML OpenAPI document
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const yamlSchema = `
|
|
36
|
+
* openapi: 3.0.0
|
|
37
|
+
* info:
|
|
38
|
+
* title: My API
|
|
39
|
+
* version: 1.0.0
|
|
40
|
+
* paths: {}
|
|
41
|
+
* `;
|
|
42
|
+
* const document = stringToSchema(yamlSchema);
|
|
43
|
+
* console.log(document.info.title); // "My API"
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @throws {SyntaxError} If the JSON is malformed
|
|
47
|
+
* @throws {Error} If the YAML is malformed
|
|
48
|
+
*/
|
|
12
49
|
const stringToSchema = (schema) => {
|
|
13
50
|
if (schema.trimStart().startsWith('{')) {
|
|
14
51
|
return JSON.parse(schema);
|
|
@@ -18,6 +55,53 @@ const stringToSchema = (schema) => {
|
|
|
18
55
|
}
|
|
19
56
|
};
|
|
20
57
|
exports.stringToSchema = stringToSchema;
|
|
58
|
+
/**
|
|
59
|
+
* Converts any OpenAPI document version to OpenAPI 3.0 format.
|
|
60
|
+
*
|
|
61
|
+
* SKMTC processes all documents using OpenAPI 3.0 as the internal format.
|
|
62
|
+
* This function handles version detection and conversion from:
|
|
63
|
+
* - OpenAPI 3.0.x (returned as-is)
|
|
64
|
+
* - OpenAPI 3.1.x (downgraded to 3.0 with allOf transformations)
|
|
65
|
+
* - Swagger 2.0 (upgraded to OpenAPI 3.0)
|
|
66
|
+
*
|
|
67
|
+
* @param schema - The OpenAPI document to convert
|
|
68
|
+
* @returns Promise resolving to an OpenAPI 3.0 document
|
|
69
|
+
*
|
|
70
|
+
* @example Converting OpenAPI 3.1 to 3.0
|
|
71
|
+
* ```typescript
|
|
72
|
+
* const openapi31Doc = {
|
|
73
|
+
* openapi: "3.1.0",
|
|
74
|
+
* info: { title: "My API", version: "1.0.0" },
|
|
75
|
+
* paths: {}
|
|
76
|
+
* };
|
|
77
|
+
* const v3Doc = await toV3Document(openapi31Doc);
|
|
78
|
+
* console.log(v3Doc.openapi); // "3.0.3" (converted)
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @example Converting Swagger 2.0 to OpenAPI 3.0
|
|
82
|
+
* ```typescript
|
|
83
|
+
* const swagger2Doc = {
|
|
84
|
+
* swagger: "2.0",
|
|
85
|
+
* info: { title: "My API", version: "1.0.0" },
|
|
86
|
+
* paths: {}
|
|
87
|
+
* };
|
|
88
|
+
* const v3Doc = await toV3Document(swagger2Doc);
|
|
89
|
+
* console.log(v3Doc.openapi); // "3.0.0" (converted)
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @example OpenAPI 3.0 passthrough
|
|
93
|
+
* ```typescript
|
|
94
|
+
* const openapi30Doc = {
|
|
95
|
+
* openapi: "3.0.2",
|
|
96
|
+
* info: { title: "My API", version: "1.0.0" },
|
|
97
|
+
* paths: {}
|
|
98
|
+
* };
|
|
99
|
+
* const v3Doc = await toV3Document(openapi30Doc);
|
|
100
|
+
* console.log(v3Doc === openapi30Doc); // true (same object)
|
|
101
|
+
* ```
|
|
102
|
+
*
|
|
103
|
+
* @throws {Error} If the document version is not recognized or supported
|
|
104
|
+
*/
|
|
21
105
|
const toV3Document = async (schema) => {
|
|
22
106
|
return await (0, ts_pattern_1.match)(schema)
|
|
23
107
|
.with({ openapi: ts_pattern_1.P.string.startsWith('3.0') }, doc => doc)
|
|
@@ -1,10 +1,42 @@
|
|
|
1
1
|
import "../_dnt.polyfills.js";
|
|
2
2
|
import * as v from 'valibot';
|
|
3
|
+
/**
|
|
4
|
+
* Type representing the possible outcomes of SKMTC processing operations.
|
|
5
|
+
*
|
|
6
|
+
* Used throughout the SKMTC pipeline to track and categorize the results
|
|
7
|
+
* of parsing, generation, and rendering operations.
|
|
8
|
+
*/
|
|
3
9
|
export type ResultType = 'success' | 'warning' | 'error' | 'skipped' | 'notSupported';
|
|
10
|
+
/**
|
|
11
|
+
* Type representing result types that indicate issues or problems.
|
|
12
|
+
*
|
|
13
|
+
* Used for filtering and handling results that require attention,
|
|
14
|
+
* excluding successful, skipped, or unsupported operations.
|
|
15
|
+
*/
|
|
4
16
|
export type WarningError = 'warning' | 'error';
|
|
17
|
+
/**
|
|
18
|
+
* Valibot schema for validating ResultType values.
|
|
19
|
+
*
|
|
20
|
+
* Used for runtime validation of result type values throughout
|
|
21
|
+
* the SKMTC pipeline to ensure type safety and data integrity.
|
|
22
|
+
*/
|
|
5
23
|
export declare const resultType: v.GenericSchema<ResultType>;
|
|
24
|
+
/**
|
|
25
|
+
* Interface representing a hierarchical results structure.
|
|
26
|
+
*
|
|
27
|
+
* Allows for nested result tracking where each key can contain
|
|
28
|
+
* a result type, another results item (for nesting), or an array
|
|
29
|
+
* of results items for collections.
|
|
30
|
+
*/
|
|
6
31
|
export interface ResultsItem {
|
|
32
|
+
/** Dynamic key-value pairs for hierarchical result tracking */
|
|
7
33
|
[key: string]: ResultType | ResultsItem | Array<ResultsItem | null>;
|
|
8
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Valibot schema for validating ResultsItem structures.
|
|
37
|
+
*
|
|
38
|
+
* Uses lazy evaluation to handle recursive result item validation,
|
|
39
|
+
* supporting nested hierarchical result structures.
|
|
40
|
+
*/
|
|
9
41
|
export declare const resultsItem: v.GenericSchema<ResultsItem>;
|
|
10
42
|
//# sourceMappingURL=Results.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Results.d.ts","sourceRoot":"","sources":["../../src/types/Results.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,cAAc,CAAA;AAErF,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,CAAA;AAE9C,eAAO,MAAM,UAAU,EAAE,CAAC,CAAC,aAAa,CAAC,UAAU,CAMjD,CAAA;AAEF,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;CACpE;AAED,eAAO,MAAM,WAAW,EAAE,CAAC,CAAC,aAAa,CAAC,WAAW,CAGpD,CAAA"}
|
|
1
|
+
{"version":3,"file":"Results.d.ts","sourceRoot":"","sources":["../../src/types/Results.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,cAAc,CAAA;AAErF;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,CAAA;AAE9C;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,CAAC,CAAC,aAAa,CAAC,UAAU,CAMjD,CAAA;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,+DAA+D;IAC/D,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;CACpE;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,CAAC,CAAC,aAAa,CAAC,WAAW,CAGpD,CAAA"}
|
package/script/types/Results.js
CHANGED
|
@@ -36,6 +36,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.resultsItem = exports.resultType = void 0;
|
|
37
37
|
require("../_dnt.polyfills.js");
|
|
38
38
|
const v = __importStar(require("valibot"));
|
|
39
|
+
/**
|
|
40
|
+
* Valibot schema for validating ResultType values.
|
|
41
|
+
*
|
|
42
|
+
* Used for runtime validation of result type values throughout
|
|
43
|
+
* the SKMTC pipeline to ensure type safety and data integrity.
|
|
44
|
+
*/
|
|
39
45
|
exports.resultType = v.union([
|
|
40
46
|
v.literal('success'),
|
|
41
47
|
v.literal('warning'),
|
|
@@ -43,4 +49,10 @@ exports.resultType = v.union([
|
|
|
43
49
|
v.literal('skipped'),
|
|
44
50
|
v.literal('notSupported')
|
|
45
51
|
]);
|
|
52
|
+
/**
|
|
53
|
+
* Valibot schema for validating ResultsItem structures.
|
|
54
|
+
*
|
|
55
|
+
* Uses lazy evaluation to handle recursive result item validation,
|
|
56
|
+
* supporting nested hierarchical result structures.
|
|
57
|
+
*/
|
|
46
58
|
exports.resultsItem = v.record(v.string(), v.lazy(() => v.union([exports.resultsItem, exports.resultType, v.array(v.lazy(() => exports.resultsItem))])));
|