@elysiajs/openapi 1.3.6 → 1.3.7
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/dist/cjs/gen/index.js +17 -11
- package/dist/gen/index.mjs +17 -11
- package/package.json +1 -1
package/dist/cjs/gen/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var import_os = require("os");
|
|
|
29
29
|
var import_path = require("path");
|
|
30
30
|
var import_child_process = require("child_process");
|
|
31
31
|
var matchRoute = /: Elysia<(.*)>/gs;
|
|
32
|
-
var matchStatus = /(\d{3}):/
|
|
32
|
+
var matchStatus = /(\d{3}):/g;
|
|
33
33
|
var wrapStatusInQuote = (value) => value.replace(matchStatus, '"$1":');
|
|
34
34
|
var exec = (command, cwd) => (0, import_child_process.spawnSync)(command, {
|
|
35
35
|
shell: true,
|
|
@@ -89,18 +89,22 @@ var fromTypes = (targetFilePath, {
|
|
|
89
89
|
)?.[0];
|
|
90
90
|
if (!instance) return;
|
|
91
91
|
for (let i = 0; i < 3; i++)
|
|
92
|
-
instance = instance.slice(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
instance = instance.slice(
|
|
93
|
+
instance.indexOf(
|
|
94
|
+
"}, {",
|
|
95
|
+
// remove just `}, `, leaving `{`
|
|
96
|
+
3
|
|
97
|
+
)
|
|
98
|
+
);
|
|
99
|
+
const routesString = wrapStatusInQuote(
|
|
100
|
+
// Intentionally not adding "}"
|
|
101
|
+
// to avoid mismatched bracket in loop below
|
|
102
|
+
instance.slice(3, instance.indexOf("}, {", 4))
|
|
103
|
+
);
|
|
97
104
|
const routes = {};
|
|
98
105
|
for (const route of routesString.slice(1).split("} & {")) {
|
|
99
|
-
let schema = (0, import_typemap.TypeBox)(`{${route}}
|
|
100
|
-
if (schema.type !== "object")
|
|
101
|
-
schema = (0, import_typemap.TypeBox)(`{${route}}`);
|
|
102
|
-
if (schema.type !== "object") continue;
|
|
103
|
-
}
|
|
106
|
+
let schema = (0, import_typemap.TypeBox)(`{${route}}`);
|
|
107
|
+
if (schema.type !== "object") continue;
|
|
104
108
|
const paths = [];
|
|
105
109
|
while (true) {
|
|
106
110
|
const keys = Object.keys(schema.properties);
|
|
@@ -128,6 +132,8 @@ var fromTypes = (targetFilePath, {
|
|
|
128
132
|
);
|
|
129
133
|
console.warn(error);
|
|
130
134
|
return;
|
|
135
|
+
} finally {
|
|
136
|
+
(0, import_fs.rmSync)(tmpRoot, { recursive: true, force: true });
|
|
131
137
|
}
|
|
132
138
|
};
|
|
133
139
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/gen/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import { tmpdir } from "os";
|
|
|
11
11
|
import { join } from "path";
|
|
12
12
|
import { spawnSync } from "child_process";
|
|
13
13
|
var matchRoute = /: Elysia<(.*)>/gs;
|
|
14
|
-
var matchStatus = /(\d{3}):/
|
|
14
|
+
var matchStatus = /(\d{3}):/g;
|
|
15
15
|
var wrapStatusInQuote = (value) => value.replace(matchStatus, '"$1":');
|
|
16
16
|
var exec = (command, cwd) => spawnSync(command, {
|
|
17
17
|
shell: true,
|
|
@@ -71,18 +71,22 @@ var fromTypes = (targetFilePath, {
|
|
|
71
71
|
)?.[0];
|
|
72
72
|
if (!instance) return;
|
|
73
73
|
for (let i = 0; i < 3; i++)
|
|
74
|
-
instance = instance.slice(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
instance = instance.slice(
|
|
75
|
+
instance.indexOf(
|
|
76
|
+
"}, {",
|
|
77
|
+
// remove just `}, `, leaving `{`
|
|
78
|
+
3
|
|
79
|
+
)
|
|
80
|
+
);
|
|
81
|
+
const routesString = wrapStatusInQuote(
|
|
82
|
+
// Intentionally not adding "}"
|
|
83
|
+
// to avoid mismatched bracket in loop below
|
|
84
|
+
instance.slice(3, instance.indexOf("}, {", 4))
|
|
85
|
+
);
|
|
79
86
|
const routes = {};
|
|
80
87
|
for (const route of routesString.slice(1).split("} & {")) {
|
|
81
|
-
let schema = TypeBox(`{${route}}
|
|
82
|
-
if (schema.type !== "object")
|
|
83
|
-
schema = TypeBox(`{${route}}`);
|
|
84
|
-
if (schema.type !== "object") continue;
|
|
85
|
-
}
|
|
88
|
+
let schema = TypeBox(`{${route}}`);
|
|
89
|
+
if (schema.type !== "object") continue;
|
|
86
90
|
const paths = [];
|
|
87
91
|
while (true) {
|
|
88
92
|
const keys = Object.keys(schema.properties);
|
|
@@ -110,6 +114,8 @@ var fromTypes = (targetFilePath, {
|
|
|
110
114
|
);
|
|
111
115
|
console.warn(error);
|
|
112
116
|
return;
|
|
117
|
+
} finally {
|
|
118
|
+
rmSync(tmpRoot, { recursive: true, force: true });
|
|
113
119
|
}
|
|
114
120
|
};
|
|
115
121
|
export {
|