@typia/utils 12.0.0-dev.20260310 → 12.0.0-dev.20260312
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/converters/LlmSchemaConverter.d.ts +0 -1
- package/lib/converters/LlmSchemaConverter.js +4 -31
- package/lib/converters/LlmSchemaConverter.js.map +1 -1
- package/lib/converters/LlmSchemaConverter.mjs +2 -32
- package/lib/converters/LlmSchemaConverter.mjs.map +1 -1
- package/lib/converters/OpenApiConverter.d.ts +29 -16
- package/lib/converters/OpenApiConverter.js +25 -15
- package/lib/converters/OpenApiConverter.js.map +1 -1
- package/lib/converters/OpenApiConverter.mjs +25 -15
- package/lib/converters/OpenApiConverter.mjs.map +1 -1
- package/lib/converters/internal/OpenApiV3Downgrader.js +38 -18
- package/lib/converters/internal/OpenApiV3Downgrader.js.map +1 -1
- package/lib/converters/internal/OpenApiV3Downgrader.mjs +50 -27
- package/lib/converters/internal/OpenApiV3Downgrader.mjs.map +1 -1
- package/lib/converters/internal/OpenApiV3Upgrader.js +36 -18
- package/lib/converters/internal/OpenApiV3Upgrader.js.map +1 -1
- package/lib/converters/internal/OpenApiV3Upgrader.mjs +50 -29
- package/lib/converters/internal/OpenApiV3Upgrader.mjs.map +1 -1
- package/lib/converters/internal/OpenApiV3_1Upgrader.js +38 -20
- package/lib/converters/internal/OpenApiV3_1Upgrader.js.map +1 -1
- package/lib/converters/internal/OpenApiV3_1Upgrader.mjs +51 -29
- package/lib/converters/internal/OpenApiV3_1Upgrader.mjs.map +1 -1
- package/lib/converters/internal/OpenApiV3_2Upgrader.d.ts +16 -0
- package/lib/converters/internal/OpenApiV3_2Upgrader.js +204 -0
- package/lib/converters/internal/OpenApiV3_2Upgrader.js.map +1 -0
- package/lib/converters/internal/OpenApiV3_2Upgrader.mjs +243 -0
- package/lib/converters/internal/OpenApiV3_2Upgrader.mjs.map +1 -0
- package/lib/converters/internal/SwaggerV2Downgrader.js +38 -18
- package/lib/converters/internal/SwaggerV2Downgrader.js.map +1 -1
- package/lib/converters/internal/SwaggerV2Downgrader.mjs +50 -27
- package/lib/converters/internal/SwaggerV2Downgrader.mjs.map +1 -1
- package/lib/converters/internal/SwaggerV2Upgrader.js +37 -19
- package/lib/converters/internal/SwaggerV2Upgrader.js.map +1 -1
- package/lib/converters/internal/SwaggerV2Upgrader.mjs +50 -29
- package/lib/converters/internal/SwaggerV2Upgrader.mjs.map +1 -1
- package/lib/http/HttpLlm.js +4 -5
- package/lib/http/HttpLlm.js.map +1 -1
- package/lib/http/HttpLlm.mjs +0 -1
- package/lib/http/HttpLlm.mjs.map +1 -1
- package/lib/http/internal/HttpLlmApplicationComposer.js +3 -4
- package/lib/http/internal/HttpLlmApplicationComposer.js.map +1 -1
- package/lib/http/internal/HttpLlmApplicationComposer.mjs +0 -1
- package/lib/http/internal/HttpLlmApplicationComposer.mjs.map +1 -1
- package/lib/http/internal/HttpMigrateApplicationComposer.js +1 -1
- package/lib/http/internal/HttpMigrateApplicationComposer.js.map +1 -1
- package/lib/http/internal/HttpMigrateApplicationComposer.mjs +1 -1
- package/lib/http/internal/HttpMigrateApplicationComposer.mjs.map +1 -1
- package/lib/http/internal/HttpMigrateRouteComposer.d.ts +1 -1
- package/lib/utils/LlmJson.d.ts +19 -1
- package/lib/utils/LlmJson.js +27 -0
- package/lib/utils/LlmJson.js.map +1 -1
- package/lib/utils/LlmJson.mjs +27 -0
- package/lib/utils/LlmJson.mjs.map +1 -1
- package/package.json +2 -2
- package/src/converters/LlmSchemaConverter.ts +1 -31
- package/src/converters/OpenApiConverter.ts +322 -285
- package/src/converters/internal/OpenApiV3Downgrader.ts +381 -355
- package/src/converters/internal/OpenApiV3Upgrader.ts +494 -470
- package/src/converters/internal/OpenApiV3_1Upgrader.ts +710 -685
- package/src/converters/internal/OpenApiV3_2Upgrader.ts +342 -0
- package/src/converters/internal/SwaggerV2Downgrader.ts +450 -424
- package/src/converters/internal/SwaggerV2Upgrader.ts +547 -523
- package/src/http/HttpLlm.ts +0 -1
- package/src/http/internal/HttpLlmApplicationComposer.ts +0 -1
- package/src/http/internal/HttpMigrateApplicationComposer.ts +56 -56
- package/src/http/internal/HttpMigrateRouteComposer.ts +505 -505
- package/src/utils/LlmJson.ts +173 -141
package/src/http/HttpLlm.ts
CHANGED
|
@@ -113,7 +113,6 @@ export namespace HttpLlm {
|
|
|
113
113
|
return HttpLlmApplicationComposer.application({
|
|
114
114
|
migrate,
|
|
115
115
|
config: {
|
|
116
|
-
reference: props.config?.reference ?? true,
|
|
117
116
|
strict: props.config?.strict ?? false,
|
|
118
117
|
maxLength: props.config?.maxLength ?? 64,
|
|
119
118
|
equals: props.config?.equals ?? false,
|
|
@@ -36,7 +36,6 @@ export namespace HttpLlmApplicationComposer {
|
|
|
36
36
|
const config: IHttpLlmApplication.IConfig = {
|
|
37
37
|
maxLength: props.config?.maxLength ?? 64,
|
|
38
38
|
equals: props.config?.equals ?? false,
|
|
39
|
-
reference: props.config?.reference ?? true,
|
|
40
39
|
strict: props.config?.strict ?? false,
|
|
41
40
|
};
|
|
42
41
|
// seed with pre-existing migration errors, excluding human-only endpoints
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IHttpMigrateApplication,
|
|
3
|
-
IHttpMigrateRoute,
|
|
4
|
-
OpenApi,
|
|
5
|
-
} from "@typia/interface";
|
|
6
|
-
|
|
7
|
-
import { EndpointUtil } from "../../utils/internal/EndpointUtil";
|
|
8
|
-
import { HttpMigrateRouteAccessor } from "./HttpMigrateRouteAccessor";
|
|
9
|
-
import { HttpMigrateRouteComposer } from "./HttpMigrateRouteComposer";
|
|
10
|
-
|
|
11
|
-
export namespace HttpMigrateApplicationComposer {
|
|
12
|
-
export const compose = (
|
|
13
|
-
document: OpenApi.IDocument,
|
|
14
|
-
): IHttpMigrateApplication => {
|
|
15
|
-
const errors: IHttpMigrateApplication.IError[] = [];
|
|
16
|
-
const entire: Array<IHttpMigrateRoute | null> = Object.entries({
|
|
17
|
-
...(document.paths ?? {}),
|
|
18
|
-
...(document.webhooks ?? {}),
|
|
19
|
-
})
|
|
20
|
-
.map(([path, collection]) =>
|
|
21
|
-
(["head", "get", "post", "put", "patch", "delete"] as const)
|
|
22
|
-
.filter((method) => collection[method] !== undefined)
|
|
23
|
-
.map((method) => {
|
|
24
|
-
const operation: OpenApi.IOperation = collection[method]!;
|
|
25
|
-
const migrated: IHttpMigrateRoute | string[] =
|
|
26
|
-
HttpMigrateRouteComposer.compose({
|
|
27
|
-
document,
|
|
28
|
-
method,
|
|
29
|
-
path,
|
|
30
|
-
emendedPath: EndpointUtil.reJoinWithDecimalParameters(path),
|
|
31
|
-
operation,
|
|
32
|
-
});
|
|
33
|
-
if (Array.isArray(migrated)) {
|
|
34
|
-
errors.push({
|
|
35
|
-
method,
|
|
36
|
-
path,
|
|
37
|
-
operation: () => operation,
|
|
38
|
-
messages: migrated,
|
|
39
|
-
});
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
return migrated;
|
|
43
|
-
}),
|
|
44
|
-
)
|
|
45
|
-
.flat();
|
|
46
|
-
const operations: IHttpMigrateRoute[] = entire.filter(
|
|
47
|
-
(o): o is IHttpMigrateRoute => !!o,
|
|
48
|
-
);
|
|
49
|
-
HttpMigrateRouteAccessor.overwrite(operations);
|
|
50
|
-
return {
|
|
51
|
-
document: () => document,
|
|
52
|
-
routes: operations,
|
|
53
|
-
errors,
|
|
54
|
-
} satisfies IHttpMigrateApplication as IHttpMigrateApplication;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
IHttpMigrateApplication,
|
|
3
|
+
IHttpMigrateRoute,
|
|
4
|
+
OpenApi,
|
|
5
|
+
} from "@typia/interface";
|
|
6
|
+
|
|
7
|
+
import { EndpointUtil } from "../../utils/internal/EndpointUtil";
|
|
8
|
+
import { HttpMigrateRouteAccessor } from "./HttpMigrateRouteAccessor";
|
|
9
|
+
import { HttpMigrateRouteComposer } from "./HttpMigrateRouteComposer";
|
|
10
|
+
|
|
11
|
+
export namespace HttpMigrateApplicationComposer {
|
|
12
|
+
export const compose = (
|
|
13
|
+
document: OpenApi.IDocument,
|
|
14
|
+
): IHttpMigrateApplication => {
|
|
15
|
+
const errors: IHttpMigrateApplication.IError[] = [];
|
|
16
|
+
const entire: Array<IHttpMigrateRoute | null> = Object.entries({
|
|
17
|
+
...(document.paths ?? {}),
|
|
18
|
+
...(document.webhooks ?? {}),
|
|
19
|
+
})
|
|
20
|
+
.map(([path, collection]) =>
|
|
21
|
+
(["head", "get", "post", "put", "patch", "delete", "query"] as const)
|
|
22
|
+
.filter((method) => collection[method] !== undefined)
|
|
23
|
+
.map((method) => {
|
|
24
|
+
const operation: OpenApi.IOperation = collection[method]!;
|
|
25
|
+
const migrated: IHttpMigrateRoute | string[] =
|
|
26
|
+
HttpMigrateRouteComposer.compose({
|
|
27
|
+
document,
|
|
28
|
+
method,
|
|
29
|
+
path,
|
|
30
|
+
emendedPath: EndpointUtil.reJoinWithDecimalParameters(path),
|
|
31
|
+
operation,
|
|
32
|
+
});
|
|
33
|
+
if (Array.isArray(migrated)) {
|
|
34
|
+
errors.push({
|
|
35
|
+
method,
|
|
36
|
+
path,
|
|
37
|
+
operation: () => operation,
|
|
38
|
+
messages: migrated,
|
|
39
|
+
});
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
return migrated;
|
|
43
|
+
}),
|
|
44
|
+
)
|
|
45
|
+
.flat();
|
|
46
|
+
const operations: IHttpMigrateRoute[] = entire.filter(
|
|
47
|
+
(o): o is IHttpMigrateRoute => !!o,
|
|
48
|
+
);
|
|
49
|
+
HttpMigrateRouteAccessor.overwrite(operations);
|
|
50
|
+
return {
|
|
51
|
+
document: () => document,
|
|
52
|
+
routes: operations,
|
|
53
|
+
errors,
|
|
54
|
+
} satisfies IHttpMigrateApplication as IHttpMigrateApplication;
|
|
55
|
+
};
|
|
56
|
+
}
|