@nestia/sdk 3.12.2-dev.20240905 → 3.13.0-dev.2024910
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/INestiaConfig.d.ts +0 -93
- package/lib/NestiaSdkApplication.d.ts +0 -1
- package/lib/NestiaSdkApplication.js +2 -25
- package/lib/NestiaSdkApplication.js.map +1 -1
- package/lib/executable/internal/NestiaConfigLoader.js +2 -26
- package/lib/executable/internal/NestiaConfigLoader.js.map +1 -1
- package/lib/executable/internal/NestiaSdkCommand.d.ts +0 -1
- package/lib/executable/internal/NestiaSdkCommand.js +0 -7
- package/lib/executable/internal/NestiaSdkCommand.js.map +1 -1
- package/lib/executable/sdk.js +2 -5
- package/lib/executable/sdk.js.map +1 -1
- package/lib/generates/internal/SdkAliasCollection.js +5 -5
- package/package.json +9 -10
- package/src/INestiaConfig.ts +0 -98
- package/src/NestiaSdkApplication.ts +1 -29
- package/src/executable/internal/NestiaSdkCommand.ts +0 -8
- package/src/executable/sdk.ts +2 -4
- package/lib/generates/OpenAiGenerator.d.ts +0 -4
- package/lib/generates/OpenAiGenerator.js +0 -58
- package/lib/generates/OpenAiGenerator.js.map +0 -1
- package/src/generates/OpenAiGenerator.ts +0 -59
package/lib/INestiaConfig.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { INestApplication } from "@nestjs/common";
|
|
2
2
|
import { OpenApi } from "@samchon/openapi";
|
|
3
|
-
import { IOpenAiSchema } from "@wrtnio/openai-function-schema";
|
|
4
3
|
/**
|
|
5
4
|
* Definition for the `nestia.config.ts` file.
|
|
6
5
|
*
|
|
@@ -22,14 +21,6 @@ export interface INestiaConfig {
|
|
|
22
21
|
* If not specified, you can't build the `swagger.json`.
|
|
23
22
|
*/
|
|
24
23
|
swagger?: INestiaConfig.ISwaggerConfig;
|
|
25
|
-
/**
|
|
26
|
-
* Configuration for the OpenAI funtion call schema generation.
|
|
27
|
-
*
|
|
28
|
-
* You can generate the schema for the OpenAI function call through
|
|
29
|
-
* this configuration. Recommend to use the function call schemas with
|
|
30
|
-
* the {@link swagger} document.
|
|
31
|
-
*/
|
|
32
|
-
openai?: INestiaConfig.IOpenAiConnfig;
|
|
33
24
|
/**
|
|
34
25
|
* Output directory that SDK would be placed in.
|
|
35
26
|
*
|
|
@@ -251,88 +242,4 @@ export declare namespace INestiaConfig {
|
|
|
251
242
|
path: string;
|
|
252
243
|
}): string;
|
|
253
244
|
}
|
|
254
|
-
/**
|
|
255
|
-
* Configuration for the OpenAI funtion call schema generation.
|
|
256
|
-
*/
|
|
257
|
-
interface IOpenAiConnfig {
|
|
258
|
-
/**
|
|
259
|
-
* Output path of the `openai.json`.
|
|
260
|
-
*
|
|
261
|
-
* If you've configured only directory, the file name would be the `openai.json`.
|
|
262
|
-
* Otherwise you've configured the full path with file name and extension, the
|
|
263
|
-
* `openai.json` file would be renamed to it.
|
|
264
|
-
*/
|
|
265
|
-
output: string;
|
|
266
|
-
/**
|
|
267
|
-
* Whether the parameters are keyworded or not.
|
|
268
|
-
*
|
|
269
|
-
* If this property value is `true`, length of the
|
|
270
|
-
* {@link IOpenAiDocument.IFunction.parameters} is always 1, and type of the
|
|
271
|
-
* pararameter is always {@link IOpenAiSchema.IObject} type. Also, its
|
|
272
|
-
* properties are following below rules:
|
|
273
|
-
*
|
|
274
|
-
* - `pathParameters`: Path parameters of {@link ISwaggerMigrateRoute.parameters}
|
|
275
|
-
* - `query`: Query parameter of {@link ISwaggerMigrateRoute.query}
|
|
276
|
-
* - `body`: Body parameter of {@link ISwaggerMigrateRoute.body}
|
|
277
|
-
*
|
|
278
|
-
* ```typescript
|
|
279
|
-
* {
|
|
280
|
-
* ...pathParameters,
|
|
281
|
-
* query,
|
|
282
|
-
* body,
|
|
283
|
-
* }
|
|
284
|
-
* ```
|
|
285
|
-
*
|
|
286
|
-
* Otherwise (this property value is `false`), length of the
|
|
287
|
-
* {@link IOpenAiDocument.IFunction.parameters} is variable, and sequence of the
|
|
288
|
-
* parameters are following below rules.
|
|
289
|
-
*
|
|
290
|
-
* ```typescript
|
|
291
|
-
* [
|
|
292
|
-
* ...pathParameters,
|
|
293
|
-
* ...(query ? [query] : []),
|
|
294
|
-
* ...(body ? [body] : []),
|
|
295
|
-
* ]
|
|
296
|
-
* ```
|
|
297
|
-
*
|
|
298
|
-
* @default false
|
|
299
|
-
*/
|
|
300
|
-
keyword?: boolean;
|
|
301
|
-
/**
|
|
302
|
-
* Separator function for the parameters.
|
|
303
|
-
*
|
|
304
|
-
* When composing parameter arguments through OpenAI function call,
|
|
305
|
-
* there can be a case that some parameters must be composed by human, or
|
|
306
|
-
* LLM cannot understand the parameter. For example, if the parameter type
|
|
307
|
-
* has configured {@link IOpenAiSchema.IString["x-wrtn-secret-key"]}, the
|
|
308
|
-
* secret key value must be composed by human, not by LLM (Large Language Model).
|
|
309
|
-
*
|
|
310
|
-
* In that case, if you configure this property with a function that
|
|
311
|
-
* predicating whether the schema value must be composed by human or not,
|
|
312
|
-
* the parameters would be separated into two parts.
|
|
313
|
-
*
|
|
314
|
-
* - {@link IOpenAiFunction.separated.llm}
|
|
315
|
-
* - {@link IOpenAiFunction.separated.human}
|
|
316
|
-
*
|
|
317
|
-
* When writing the function, note that returning value `true` means to be
|
|
318
|
-
* a human composing the value, and `false` means to LLM composing the value.
|
|
319
|
-
* Also, when predicating the schema, it would better to utilize the
|
|
320
|
-
* {@link OpenAiTypeChecker} features.
|
|
321
|
-
*
|
|
322
|
-
* @param schema Schema to be separated.
|
|
323
|
-
* @returns Whether the schema value must be composed by human or not.
|
|
324
|
-
* @default null
|
|
325
|
-
*/
|
|
326
|
-
separate?: null | ((schema: IOpenAiSchema) => boolean);
|
|
327
|
-
/**
|
|
328
|
-
* Whether to beautify JSON content or not.
|
|
329
|
-
*
|
|
330
|
-
* If you configure this property to be `true`, the `openai.json` file would
|
|
331
|
-
* be beautified with indentation (2 spaces) and line breaks. If you configure
|
|
332
|
-
* numeric value instead, the indentation would be specified by the number.
|
|
333
|
-
*
|
|
334
|
-
* @default false
|
|
335
|
-
*/
|
|
336
|
-
beautify?: boolean | number;
|
|
337
|
-
}
|
|
338
245
|
}
|
|
@@ -23,7 +23,6 @@ const ReflectControllerAnalyzer_1 = require("./analyses/ReflectControllerAnalyze
|
|
|
23
23
|
const TypedHttpRouteAnalyzer_1 = require("./analyses/TypedHttpRouteAnalyzer");
|
|
24
24
|
const TypedWebSocketRouteAnalyzer_1 = require("./analyses/TypedWebSocketRouteAnalyzer");
|
|
25
25
|
const E2eGenerator_1 = require("./generates/E2eGenerator");
|
|
26
|
-
const OpenAiGenerator_1 = require("./generates/OpenAiGenerator");
|
|
27
26
|
const SdkGenerator_1 = require("./generates/SdkGenerator");
|
|
28
27
|
const SwaggerGenerator_1 = require("./generates/SwaggerGenerator");
|
|
29
28
|
const IReflectOperationError_1 = require("./structures/IReflectOperationError");
|
|
@@ -35,10 +34,8 @@ class NestiaSdkApplication {
|
|
|
35
34
|
}
|
|
36
35
|
all() {
|
|
37
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
var _a
|
|
39
|
-
if (!this.config.output &&
|
|
40
|
-
!((_a = this.config.swagger) === null || _a === void 0 ? void 0 : _a.output) &&
|
|
41
|
-
!((_b = this.config.openai) === null || _b === void 0 ? void 0 : _b.output))
|
|
37
|
+
var _a;
|
|
38
|
+
if (!this.config.output && !((_a = this.config.swagger) === null || _a === void 0 ? void 0 : _a.output))
|
|
42
39
|
throw new Error([
|
|
43
40
|
"Error on NestiaApplication.all(): nothing to generate, configure at least one property of below:",
|
|
44
41
|
"",
|
|
@@ -56,8 +53,6 @@ class NestiaSdkApplication {
|
|
|
56
53
|
}
|
|
57
54
|
if (this.config.swagger)
|
|
58
55
|
yield SwaggerGenerator_1.SwaggerGenerator.generate(app);
|
|
59
|
-
if (this.config.openai)
|
|
60
|
-
yield OpenAiGenerator_1.OpenAiGenerator.generate(app);
|
|
61
56
|
}),
|
|
62
57
|
});
|
|
63
58
|
});
|
|
@@ -118,24 +113,6 @@ class NestiaSdkApplication {
|
|
|
118
113
|
});
|
|
119
114
|
});
|
|
120
115
|
}
|
|
121
|
-
openai() {
|
|
122
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
-
var _a;
|
|
124
|
-
if (!((_a = this.config.openai) === null || _a === void 0 ? void 0 : _a.output))
|
|
125
|
-
throw new Error(`Error on NestiaApplication.openai(): configure INestiaConfig.openai property.`);
|
|
126
|
-
const parsed = path_1.default.parse(this.config.openai.output);
|
|
127
|
-
const directory = !!parsed.ext
|
|
128
|
-
? path_1.default.resolve(parsed.dir)
|
|
129
|
-
: this.config.openai.output;
|
|
130
|
-
const stats = yield fs_1.default.promises.lstat(directory);
|
|
131
|
-
if (stats.isDirectory() === false)
|
|
132
|
-
throw new Error("Error on NestiaApplication.openai(): output directory does not exists.");
|
|
133
|
-
print_title("Nestia OpenAI Function Calling Schema Generator");
|
|
134
|
-
yield this.generate({
|
|
135
|
-
generate: OpenAiGenerator_1.OpenAiGenerator.generate,
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
116
|
generate(props) {
|
|
140
117
|
return __awaiter(this, void 0, void 0, function* () {
|
|
141
118
|
var _a, _b, _c, _d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NestiaSdkApplication.js","sourceRoot":"","sources":["../src/NestiaSdkApplication.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,+BAA8C;AAI9C,kEAA+D;AAC/D,8DAA2D;AAC3D,0DAAuD;AACvD,oFAAiF;AACjF,8EAA2E;AAC3E,wFAAqF;AACrF,2DAAwD;AACxD,
|
|
1
|
+
{"version":3,"file":"NestiaSdkApplication.js","sourceRoot":"","sources":["../src/NestiaSdkApplication.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,+BAA8C;AAI9C,kEAA+D;AAC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=> { const $guard = typia_1.default.assert.guard; const $join = typia_1.default.assert.join; const $io0 = input => null !== input.input && undefined !== input.input && ("function" === typeof input.input || "string" === typeof input.input || (Array.isArray(input.input) && input.input.every(elem => "string" === typeof elem) || "object" === typeof input.input && null !== input.input && $io1(input.input))) && (undefined === input.swagger || "object" === typeof input.swagger && null !== input.swagger && $io2(input.swagger)) && (undefined === input.
|
|
104
|
+
return (() => { const $guard = typia_1.default.assert.guard; const $join = typia_1.default.assert.join; const $io0 = input => null !== input.input && undefined !== input.input && ("function" === typeof input.input || "string" === typeof input.input || (Array.isArray(input.input) && input.input.every(elem => "string" === typeof elem) || "object" === typeof input.input && null !== input.input && $io1(input.input))) && (undefined === input.swagger || "object" === typeof input.swagger && null !== input.swagger && $io2(input.swagger)) && (undefined === input.output || "string" === typeof input.output) && (undefined === input.distribute || "string" === typeof input.distribute) && (undefined === input.simulate || "boolean" === typeof input.simulate) && (undefined === input.e2e || "string" === typeof input.e2e) && (undefined === input.propagate || "boolean" === typeof input.propagate) && (undefined === input.clone || "boolean" === typeof input.clone) && (undefined === input.primitive || "boolean" === typeof input.primitive) && (undefined === input.assert || "boolean" === typeof input.assert) && (undefined === input.json || "boolean" === typeof input.json); const $io1 = input => Array.isArray(input.include) && input.include.every(elem => "string" === typeof elem) && (undefined === input.exclude || Array.isArray(input.exclude) && input.exclude.every(elem => "string" === typeof elem)); const $io2 = input => "string" === typeof input.output && (undefined === input.openapi || "2.0" === input.openapi || "3.0" === input.openapi || "3.1" === input.openapi) && (undefined === input.beautify || "number" === typeof input.beautify || "boolean" === typeof input.beautify) && (undefined === input.additional || "boolean" === typeof input.additional) && (undefined === input.info || "object" === typeof input.info && null !== input.info && false === Array.isArray(input.info) && $io3(input.info)) && (undefined === input.servers || Array.isArray(input.servers) && input.servers.every(elem => "object" === typeof elem && null !== elem && $io6(elem))) && (undefined === input.security || "object" === typeof input.security && null !== input.security && false === Array.isArray(input.security) && $io9(input.security)) && (undefined === input.tags || Array.isArray(input.tags) && input.tags.every(elem => "object" === typeof elem && null !== elem && $io20(elem))) && (undefined === input.decompose || "boolean" === typeof input.decompose); const $io3 = input => (undefined === input.title || "string" === typeof input.title) && (undefined === input.summary || "string" === typeof input.summary) && (undefined === input.description || "string" === typeof input.description) && (undefined === input.termsOfService || "string" === typeof input.termsOfService) && (undefined === input.contact || "object" === typeof input.contact && null !== input.contact && false === Array.isArray(input.contact) && $io4(input.contact)) && (undefined === input.license || "object" === typeof input.license && null !== input.license && $io5(input.license)) && (undefined === input.version || "string" === typeof input.version); const $io4 = input => (undefined === input.name || "string" === typeof input.name) && (undefined === input.url || "string" === typeof input.url) && (undefined === input.email || "string" === typeof input.email && /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i.test(input.email)); const $io5 = input => "string" === typeof input.name && (undefined === input.identifier || "string" === typeof input.identifier) && (undefined === input.url || "string" === typeof input.url); const $io6 = input => "string" === typeof input.url && (undefined === input.description || "string" === typeof input.description) && (undefined === input.variables || "object" === typeof input.variables && null !== input.variables && false === Array.isArray(input.variables) && $io7(input.variables)); const $io7 = input => Object.keys(input).every(key => {
|
|
105
105
|
const value = input[key];
|
|
106
106
|
if (undefined === value)
|
|
107
107
|
return true;
|
|
@@ -116,7 +116,7 @@ var NestiaConfigLoader;
|
|
|
116
116
|
if (undefined === value)
|
|
117
117
|
return true;
|
|
118
118
|
return "string" === typeof value;
|
|
119
|
-
}); const $io17 = input => (undefined === input.authorizationUrl || "string" === typeof input.authorizationUrl) && (undefined === input.refreshUrl || "string" === typeof input.refreshUrl) && (undefined === input.scopes || "object" === typeof input.scopes && null !== input.scopes && false === Array.isArray(input.scopes) && $io16(input.scopes)); const $io18 = input => (undefined === input.tokenUrl || "string" === typeof input.tokenUrl) && (undefined === input.refreshUrl || "string" === typeof input.refreshUrl) && (undefined === input.scopes || "object" === typeof input.scopes && null !== input.scopes && false === Array.isArray(input.scopes) && $io16(input.scopes)); const $io19 = input => "openIdConnect" === input.type && "string" === typeof input.openIdConnectUrl && (undefined === input.description || "string" === typeof input.description); const $io20 = input => "string" === typeof input.name && (undefined === input.description || "string" === typeof input.description); const $
|
|
119
|
+
}); const $io17 = input => (undefined === input.authorizationUrl || "string" === typeof input.authorizationUrl) && (undefined === input.refreshUrl || "string" === typeof input.refreshUrl) && (undefined === input.scopes || "object" === typeof input.scopes && null !== input.scopes && false === Array.isArray(input.scopes) && $io16(input.scopes)); const $io18 = input => (undefined === input.tokenUrl || "string" === typeof input.tokenUrl) && (undefined === input.refreshUrl || "string" === typeof input.refreshUrl) && (undefined === input.scopes || "object" === typeof input.scopes && null !== input.scopes && false === Array.isArray(input.scopes) && $io16(input.scopes)); const $io19 = input => "openIdConnect" === input.type && "string" === typeof input.openIdConnectUrl && (undefined === input.description || "string" === typeof input.description); const $io20 = input => "string" === typeof input.name && (undefined === input.description || "string" === typeof input.description); const $iu0 = input => (() => {
|
|
120
120
|
if ("apiKey" === input.type)
|
|
121
121
|
return $io10(input);
|
|
122
122
|
else if ("basic" === input.scheme)
|
|
@@ -157,14 +157,6 @@ var NestiaConfigLoader;
|
|
|
157
157
|
path: _path + ".swagger",
|
|
158
158
|
expected: "(INestiaConfig.ISwaggerConfig | undefined)",
|
|
159
159
|
value: input.swagger
|
|
160
|
-
}, _errorFactory)) && (undefined === input.openai || ("object" === typeof input.openai && null !== input.openai || $guard(_exceptionable, {
|
|
161
|
-
path: _path + ".openai",
|
|
162
|
-
expected: "(INestiaConfig.IOpenAiConnfig | undefined)",
|
|
163
|
-
value: input.openai
|
|
164
|
-
}, _errorFactory)) && $ao21(input.openai, _path + ".openai", true && _exceptionable) || $guard(_exceptionable, {
|
|
165
|
-
path: _path + ".openai",
|
|
166
|
-
expected: "(INestiaConfig.IOpenAiConnfig | undefined)",
|
|
167
|
-
value: input.openai
|
|
168
160
|
}, _errorFactory)) && (undefined === input.output || "string" === typeof input.output || $guard(_exceptionable, {
|
|
169
161
|
path: _path + ".output",
|
|
170
162
|
expected: "(string | undefined)",
|
|
@@ -592,22 +584,6 @@ var NestiaConfigLoader;
|
|
|
592
584
|
path: _path + ".description",
|
|
593
585
|
expected: "(string | undefined)",
|
|
594
586
|
value: input.description
|
|
595
|
-
}, _errorFactory)); const $ao21 = (input, _path, _exceptionable = true) => ("string" === typeof input.output || $guard(_exceptionable, {
|
|
596
|
-
path: _path + ".output",
|
|
597
|
-
expected: "string",
|
|
598
|
-
value: input.output
|
|
599
|
-
}, _errorFactory)) && (undefined === input.keyword || "boolean" === typeof input.keyword || $guard(_exceptionable, {
|
|
600
|
-
path: _path + ".keyword",
|
|
601
|
-
expected: "(boolean | undefined)",
|
|
602
|
-
value: input.keyword
|
|
603
|
-
}, _errorFactory)) && (null === input.separate || undefined === input.separate || "function" === typeof input.separate || $guard(_exceptionable, {
|
|
604
|
-
path: _path + ".separate",
|
|
605
|
-
expected: "(null | undefined)",
|
|
606
|
-
value: input.separate
|
|
607
|
-
}, _errorFactory)) && (undefined === input.beautify || "number" === typeof input.beautify || "boolean" === typeof input.beautify || $guard(_exceptionable, {
|
|
608
|
-
path: _path + ".beautify",
|
|
609
|
-
expected: "(boolean | number | undefined)",
|
|
610
|
-
value: input.beautify
|
|
611
587
|
}, _errorFactory)); const $au0 = (input, _path, _exceptionable = true) => (() => {
|
|
612
588
|
if ("apiKey" === input.type)
|
|
613
589
|
return $ao10(input, _path, true && _exceptionable);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NestiaConfigLoader.js","sourceRoot":"","sources":["../../../src/executable/internal/NestiaConfigLoader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6GAA0G;AAC1G,4CAAoB;AACpB,gDAAwB;AACxB,qCAAmC;AACnC,uCAAiC;AACjC,4DAA4B;AAC5B,kDAA0B;AAI1B,IA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EAnEgB,kBAAkB,kCAAlB,kBAAkB,QAmElC"}
|
|
@@ -26,12 +26,6 @@ var NestiaSdkCommand;
|
|
|
26
26
|
validate: (config) => { var _a; return !!((_a = config.swagger) === null || _a === void 0 ? void 0 : _a.output); },
|
|
27
27
|
solution: "configure INestiaConfig.swagger property.",
|
|
28
28
|
});
|
|
29
|
-
NestiaSdkCommand.openai = () => main({
|
|
30
|
-
title: "OpenAI Function Calling Schema",
|
|
31
|
-
generate: (app) => app.openai(),
|
|
32
|
-
validate: (config) => { var _a; return !!((_a = config.openai) === null || _a === void 0 ? void 0 : _a.output); },
|
|
33
|
-
solution: "configure INestiaConfig.openai property.",
|
|
34
|
-
});
|
|
35
29
|
NestiaSdkCommand.e2e = () => main({
|
|
36
30
|
title: "E2E Functions",
|
|
37
31
|
generate: (app) => app.e2e(),
|
|
@@ -52,7 +46,6 @@ var NestiaSdkCommand;
|
|
|
52
46
|
"",
|
|
53
47
|
" - INestiaConfig.output",
|
|
54
48
|
" - INestiaConfig.swagger.output",
|
|
55
|
-
" - INestiaConfig.openai.output",
|
|
56
49
|
].join("\n"),
|
|
57
50
|
});
|
|
58
51
|
const main = (props) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NestiaSdkCommand.js","sourceRoot":"","sources":["../../../src/executable/internal/NestiaSdkCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,qEAAkE;AAClE,6DAA0D;AAE1D,IAAiB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"NestiaSdkCommand.js","sourceRoot":"","sources":["../../../src/executable/internal/NestiaSdkCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,qEAAkE;AAClE,6DAA0D;AAE1D,IAAiB,gBAAgB,CAgGhC;AAhGD,WAAiB,gBAAgB;IAClB,oBAAG,GAAG,GAAG,EAAE,CACtB,IAAI,CAAC;QACH,KAAK,EAAE,aAAa;QACpB,QAAQ,EAAE,CAAC,GA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AAK,KAAK,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;aACzB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,wBAAwB,CAAC,CAAC;QAEzD,MAAM,IAAI,GAAW,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QACrC,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,KAAK;YAC1C,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,iBAAiB,KAAK,CAAC,SAAS,OAAO,CAAC,CAAC;QACxE,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC,EAhGgB,gBAAgB,gCAAhB,gBAAgB,QAgGhC"}
|
package/lib/executable/sdk.js
CHANGED
|
@@ -50,9 +50,8 @@ npx @nestia/sdk [command] [options?]
|
|
|
50
50
|
2. npx @nestia/sdk init
|
|
51
51
|
3. npx @nestia/sdk sdk --config? [config file] --project? [project file]
|
|
52
52
|
4. npx @nestia/sdk swagger --config? [config file] --project? [project file]
|
|
53
|
-
5. npx @nestia/sdk
|
|
54
|
-
6. npx @nestia/sdk
|
|
55
|
-
7. npx @nestia/sdk generate --config? [config file] --project? [project file]
|
|
53
|
+
5. npx @nestia/sdk e2e --config? [config file] --project? [project file]
|
|
54
|
+
6. npx @nestia/sdk generate --config? [config file] --project? [project file]
|
|
56
55
|
`;
|
|
57
56
|
function halt(desc) {
|
|
58
57
|
console.error(desc);
|
|
@@ -94,8 +93,6 @@ function main() {
|
|
|
94
93
|
yield execute((c) => c.sdk());
|
|
95
94
|
else if (type === "swagger")
|
|
96
95
|
yield execute((c) => c.swagger());
|
|
97
|
-
else if (type === "openai")
|
|
98
|
-
yield execute((c) => c.openai());
|
|
99
96
|
else if (type === "e2e")
|
|
100
97
|
yield execute((c) => c.e2e());
|
|
101
98
|
else if (type === "all")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/executable/sdk.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kEAA+B;AAC/B,4CAAoB;AACpB,sDAA8B;AAE9B,4DAAyD;AAGzD,MAAM,KAAK,GAAG
|
|
1
|
+
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/executable/sdk.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kEAA+B;AAC/B,4CAAoB;AACpB,sDAA8B;AAE9B,4DAAyD;AAGzD,MAAM,KAAK,GAAG;;;;;;;;;;;;CAYb,CAAC;AAEF,SAAS,IAAI,CAAC,IAAY;IACxB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACpB,iBAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC;AAED,SAAS,YAAY,CAAC,IAAc;;IAClC,uBAAuB;IACvB,MAAM,MAAM,GAAG,MAAA,6BAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,mCAAI,KAAK,CAAC;IACzD,MAAM,MAAM,GAAW,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,MAAM,UAAU,CAAC;IAE5E,KAAK,MAAM,GAAG,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,EAAE,CAAC;QAC/C,MAAM,OAAO,GAAW,GAAG,MAAM,IAAI,GAAG,EAAE,CAAC;QAC3C,OAAO,CAAC,GAAG,CAAC,OAAO,OAAO,EAAE,CAAC,CAAC;QAC9B,uBAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC;AAED,SAAe,UAAU;;QACvB,IAAI,YAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC,KAAK,IAAI;YAC5C,IA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G,EAAE,EAAE;IACnB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjB,iBAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC,CAAC,CAAC"}
|
|
@@ -47,20 +47,20 @@ var SdkAliasCollection;
|
|
|
47
47
|
return typescript_1.default.factory.createTypeReferenceNode(importer.external({
|
|
48
48
|
type: true,
|
|
49
49
|
library: "@nestia/fetcher",
|
|
50
|
-
instance: (() => { const $io0 = input => ("application/json" === input.contentType || "application/x-www-form-urlencoded" === input.contentType || "multipart/form-data" === input.contentType || "text/plain" === input.contentType) && "boolean" === typeof input.encrypted && "body" === input.category && "string" === typeof input.name && "number" === typeof input.index && ("object" === typeof input.type && null !== input.type && $io1(input.type)) && ("object" === typeof input.metadata && null !== input.metadata && $io2(input.metadata)) && ("object" === typeof input.components && null !== input.components && $io20(input.components)) && "function" === typeof input.validate && true && (undefined === input.examples || "object" === typeof input.examples && null !== input.examples && false === Array.isArray(input.examples) && $io26(input.examples)) && (null === input.description || "string" === typeof input.description) && (Array.isArray(input.jsDocTags) && input.jsDocTags.every(elem => "object" === typeof elem && null !== elem && $io8(elem))); const $io1 = input => "string" === typeof input.name && (undefined === input.typeArguments || Array.isArray(input.typeArguments) && input.typeArguments.every(elem => "object" === typeof elem && null !== elem && $io1(elem))); const $io2 = input => "boolean" === typeof input.any && "boolean" === typeof input.required && "boolean" === typeof input.optional && "boolean" === typeof input.nullable && "boolean" === typeof input.functional && (Array.isArray(input.atomics) && input.atomics.every(elem => "object" === typeof elem && null !== elem && $io3(elem))) && (Array.isArray(input.constants) && input.constants.every(elem => "object" === typeof elem && null !== elem && $iu0(elem))) && (Array.isArray(input.templates) && input.templates.every(elem => "object" === typeof elem && null !== elem && $io15(elem))) && (null === input.escaped || "object" === typeof input.escaped && null !== input.escaped && $io16(input.escaped)) && (null === input.rest || "object" === typeof input.rest && null !== input.rest && $io2(input.rest)) && (Array.isArray(input.arrays) && input.arrays.every(elem => "object" === typeof elem && null !== elem && $io17(elem))) && (Array.isArray(input.tuples) && input.tuples.every(elem => "object" === typeof elem && null !== elem && $io18(elem))) && (Array.isArray(input.objects) && input.objects.every(elem => "string" === typeof elem)) && (Array.isArray(input.aliases) && input.aliases.every(elem => "string" === typeof elem)) && (Array.isArray(input.natives) && input.natives.every(elem => "string" === typeof elem)) && (Array.isArray(input.sets) && input.sets.every(elem => "object" === typeof elem && null !== elem && $io2(elem))) && (Array.isArray(input.maps) && input.maps.every(elem => "object" === typeof elem && null !== elem && $io19(elem))); const $io3 = input => ("string" === input.type || "number" === input.type || "bigint" === input.type || "boolean" === input.type) && (Array.isArray(input.tags) && input.tags.every(elem => Array.isArray(elem) && elem.every(elem => "object" === typeof elem && null !== elem && $io4(elem)))); const $io4 = input => ("string" === input.target || "number" === input.target || "bigint" === input.target || "boolean" === input.target || "array" === input.target) && "string" === typeof input.name && "string" === typeof input.kind && (null !== input.exclusive && undefined !== input.exclusive && ("boolean" === typeof input.exclusive || Array.isArray(input.exclusive) && input.exclusive.every(elem => "string" === typeof elem))) && true && (undefined === input.validate || "string" === typeof input.validate) && (undefined === input.schema || "object" === typeof input.schema && null !== input.schema && false === Array.isArray(input.schema) && $io5(input.schema)); const $io5 = input => true; const $io6 = input => "boolean" === input.type && (Array.isArray(input.values) && input.values.every(elem => "object" === typeof elem && null !== elem && $io7(elem))); const $io7 = input => "boolean" === typeof input.value && (undefined === input.tags || Array.isArray(input.tags) && input.tags.every(elem => Array.isArray(elem) && elem.every(elem => "object" === typeof elem && null !== elem && $io4(elem)))) && (null === input.description || undefined === input.description || "string" === typeof input.description) && (undefined === input.jsDocTags || Array.isArray(input.jsDocTags) && input.jsDocTags.every(elem => "object" === typeof elem && null !== elem && $io8(elem))); const $io8 = input => "string" === typeof input.name && (undefined === input.text || Array.isArray(input.text) && input.text.every(elem => "object" === typeof elem && null !== elem && $io9(elem))); const $io9 = input => "string" === typeof input.text && "string" === typeof input.kind; const $io10 = input => "number" === input.type && (Array.isArray(input.values) && input.values.every(elem => "object" === typeof elem && null !== elem && $io11(elem))); const $io11 = input => "number" === typeof input.value && (undefined === input.tags || Array.isArray(input.tags) && input.tags.every(elem => Array.isArray(elem) && elem.every(elem => "object" === typeof elem && null !== elem && $io4(elem)))) && (null === input.description || undefined === input.description || "string" === typeof input.description) && (undefined === input.jsDocTags || Array.isArray(input.jsDocTags) && input.jsDocTags.every(elem => "object" === typeof elem && null !== elem && $io8(elem))); const $io12 = input => "string" === input.type && (Array.isArray(input.values) && input.values.every(elem => "object" === typeof elem && null !== elem && $io13(elem))); const $io13 = input => "string" === typeof input.value && (undefined === input.tags || Array.isArray(input.tags) && input.tags.every(elem => Array.isArray(elem) && elem.every(elem => "object" === typeof elem && null !== elem && $io4(elem)))) && (null === input.description || undefined === input.description || "string" === typeof input.description) && (undefined === input.jsDocTags || Array.isArray(input.jsDocTags) && input.jsDocTags.every(elem => "object" === typeof elem && null !== elem && $io8(elem))); const $io14 = input => "bigint" === input.type && (Array.isArray(input.values) && input.values.every(elem => "object" === typeof elem && null !== elem && $io13(elem))); const $io15 = input => Array.isArray(input.row) && input.row.every(elem => "object" === typeof elem && null !== elem && $io2(elem)) && (undefined === input.tags || Array.isArray(input.tags) && input.tags.every(elem => Array.isArray(elem) && elem.every(elem => "object" === typeof elem && null !== elem && $io4(elem)))); const $io16 = input => "object" === typeof input.original && null !== input.original && $io2(input.original) && ("object" === typeof input.returns && null !== input.returns && $io2(input.returns)); const $io17 = input => "string" === typeof input.name && (Array.isArray(input.tags) && input.tags.every(elem => Array.isArray(elem) && elem.every(elem => "object" === typeof elem && null !== elem && $io4(elem)))); const $io18 = input => "string" === typeof input.name && (Array.isArray(input.tags) && input.tags.every(elem => Array.isArray(elem) && elem.every(elem => "object" === typeof elem && null !== elem && $io4(elem)))); const $io19 = input => "object" === typeof input.key && null !== input.key && $io2(input.key) && ("object" === typeof input.value && null !== input.value && $io2(input.value)); const $io20 = input => Array.isArray(input.objects) && input.objects.every(elem => "object" === typeof elem && null !== elem && $io21(elem)) && (Array.isArray(input.aliases) && input.aliases.every(elem => "object" === typeof elem && null !== elem && $io23(elem))) && (Array.isArray(input.arrays) && input.arrays.every(elem => "object" === typeof elem && null !== elem && $io24(elem))) && (Array.isArray(input.tuples) && input.tuples.every(elem => "object" === typeof elem && null !== elem && $io25(elem))); const $io21 = input => "string" === typeof input.name && (Array.isArray(input.properties) && input.properties.every(elem => "object" === typeof elem && null !== elem && $io22(elem))) && (undefined === input.description || "string" === typeof input.description) && (Array.isArray(input.jsDocTags) && input.jsDocTags.every(elem => "object" === typeof elem && null !== elem && $io8(elem))) && "number" === typeof input.index && "boolean" === typeof input.recursive && (Array.isArray(input.nullables) && input.nullables.every(elem => "boolean" === typeof elem)); const $io22 = input => "object" === typeof input.key && null !== input.key && $io2(input.key) && ("object" === typeof input.value && null !== input.value && $io2(input.value)) && (null === input.description || "string" === typeof input.description) && (Array.isArray(input.jsDocTags) && input.jsDocTags.every(elem => "object" === typeof elem && null !== elem && $io8(elem))); const $io23 = input => "string" === typeof input.name && ("object" === typeof input.value && null !== input.value && $io2(input.value)) && (Array.isArray(input.nullables) && input.nullables.every(elem => "boolean" === typeof elem)) && (null === input.description || "string" === typeof input.description) && (Array.isArray(input.jsDocTags) && input.jsDocTags.every(elem => "object" === typeof elem && null !== elem && $io8(elem))) && "boolean" === typeof input.recursive; const $io24 = input => "string" === typeof input.name && ("object" === typeof input.value && null !== input.value && $io2(input.value)) && (Array.isArray(input.nullables) && input.nullables.every(elem => "boolean" === typeof elem)) && "boolean" === typeof input.recursive && (null === input.index || "number" === typeof input.index); const $io25 = input => "string" === typeof input.name && (Array.isArray(input.elements) && input.elements.every(elem => "object" === typeof elem && null !== elem && $io2(elem))) && (null === input.index || "number" === typeof input.index) && "boolean" === typeof input.recursive && (Array.isArray(input.nullables) && input.nullables.every(elem => "boolean" === typeof elem)); const $io26 = input => Object.keys(input).every(key => {
|
|
50
|
+
instance: (() => { const $io0 = input => ("application/json" === input.contentType || "application/x-www-form-urlencoded" === input.contentType || "multipart/form-data" === input.contentType || "text/plain" === input.contentType) && "boolean" === typeof input.encrypted && "body" === input.category && "string" === typeof input.name && "number" === typeof input.index && ("object" === typeof input.type && null !== input.type && $io1(input.type)) && ("object" === typeof input.metadata && null !== input.metadata && $io2(input.metadata)) && ("object" === typeof input.components && null !== input.components && $io22(input.components)) && "function" === typeof input.validate && true && (undefined === input.examples || "object" === typeof input.examples && null !== input.examples && false === Array.isArray(input.examples) && $io28(input.examples)) && (null === input.description || "string" === typeof input.description) && (Array.isArray(input.jsDocTags) && input.jsDocTags.every(elem => "object" === typeof elem && null !== elem && $io5(elem))); const $io1 = input => "string" === typeof input.name && (undefined === input.typeArguments || Array.isArray(input.typeArguments) && input.typeArguments.every(elem => "object" === typeof elem && null !== elem && $io1(elem))); const $io2 = input => "boolean" === typeof input.any && "boolean" === typeof input.required && "boolean" === typeof input.optional && "boolean" === typeof input.nullable && (Array.isArray(input.functions) && input.functions.every(elem => "object" === typeof elem && null !== elem && $io3(elem))) && (Array.isArray(input.atomics) && input.atomics.every(elem => "object" === typeof elem && null !== elem && $io7(elem))) && (Array.isArray(input.constants) && input.constants.every(elem => "object" === typeof elem && null !== elem && $iu0(elem))) && (Array.isArray(input.templates) && input.templates.every(elem => "object" === typeof elem && null !== elem && $io17(elem))) && (null === input.escaped || "object" === typeof input.escaped && null !== input.escaped && $io18(input.escaped)) && (null === input.rest || "object" === typeof input.rest && null !== input.rest && $io2(input.rest)) && (Array.isArray(input.arrays) && input.arrays.every(elem => "object" === typeof elem && null !== elem && $io19(elem))) && (Array.isArray(input.tuples) && input.tuples.every(elem => "object" === typeof elem && null !== elem && $io20(elem))) && (Array.isArray(input.objects) && input.objects.every(elem => "string" === typeof elem)) && (Array.isArray(input.aliases) && input.aliases.every(elem => "string" === typeof elem)) && (Array.isArray(input.natives) && input.natives.every(elem => "string" === typeof elem)) && (Array.isArray(input.sets) && input.sets.every(elem => "object" === typeof elem && null !== elem && $io2(elem))) && (Array.isArray(input.maps) && input.maps.every(elem => "object" === typeof elem && null !== elem && $io21(elem))); const $io3 = input => Array.isArray(input.parameters) && input.parameters.every(elem => "object" === typeof elem && null !== elem && $io4(elem)) && ("object" === typeof input.output && null !== input.output && $io2(input.output)) && "boolean" === typeof input.async; const $io4 = input => "string" === typeof input.name && ("object" === typeof input.type && null !== input.type && $io2(input.type)) && (null === input.description || "string" === typeof input.description) && (Array.isArray(input.jsDocTags) && input.jsDocTags.every(elem => "object" === typeof elem && null !== elem && $io5(elem))); const $io5 = input => "string" === typeof input.name && (undefined === input.text || Array.isArray(input.text) && input.text.every(elem => "object" === typeof elem && null !== elem && $io6(elem))); const $io6 = input => "string" === typeof input.text && "string" === typeof input.kind; const $io7 = input => ("string" === input.type || "number" === input.type || "bigint" === input.type || "boolean" === input.type) && (Array.isArray(input.tags) && input.tags.every(elem => Array.isArray(elem) && elem.every(elem => "object" === typeof elem && null !== elem && $io8(elem)))); const $io8 = input => ("string" === input.target || "number" === input.target || "bigint" === input.target || "boolean" === input.target || "array" === input.target) && "string" === typeof input.name && "string" === typeof input.kind && (null !== input.exclusive && undefined !== input.exclusive && ("boolean" === typeof input.exclusive || Array.isArray(input.exclusive) && input.exclusive.every(elem => "string" === typeof elem))) && true && (undefined === input.validate || "string" === typeof input.validate) && (undefined === input.schema || "object" === typeof input.schema && null !== input.schema && false === Array.isArray(input.schema) && $io9(input.schema)); const $io9 = input => true; const $io10 = input => "boolean" === input.type && (Array.isArray(input.values) && input.values.every(elem => "object" === typeof elem && null !== elem && $io11(elem))); const $io11 = input => "boolean" === typeof input.value && (undefined === input.tags || Array.isArray(input.tags) && input.tags.every(elem => Array.isArray(elem) && elem.every(elem => "object" === typeof elem && null !== elem && $io8(elem)))) && (null === input.description || undefined === input.description || "string" === typeof input.description) && (undefined === input.jsDocTags || Array.isArray(input.jsDocTags) && input.jsDocTags.every(elem => "object" === typeof elem && null !== elem && $io5(elem))); const $io12 = input => "number" === input.type && (Array.isArray(input.values) && input.values.every(elem => "object" === typeof elem && null !== elem && $io13(elem))); const $io13 = input => "number" === typeof input.value && (undefined === input.tags || Array.isArray(input.tags) && input.tags.every(elem => Array.isArray(elem) && elem.every(elem => "object" === typeof elem && null !== elem && $io8(elem)))) && (null === input.description || undefined === input.description || "string" === typeof input.description) && (undefined === input.jsDocTags || Array.isArray(input.jsDocTags) && input.jsDocTags.every(elem => "object" === typeof elem && null !== elem && $io5(elem))); const $io14 = input => "string" === input.type && (Array.isArray(input.values) && input.values.every(elem => "object" === typeof elem && null !== elem && $io15(elem))); const $io15 = input => "string" === typeof input.value && (undefined === input.tags || Array.isArray(input.tags) && input.tags.every(elem => Array.isArray(elem) && elem.every(elem => "object" === typeof elem && null !== elem && $io8(elem)))) && (null === input.description || undefined === input.description || "string" === typeof input.description) && (undefined === input.jsDocTags || Array.isArray(input.jsDocTags) && input.jsDocTags.every(elem => "object" === typeof elem && null !== elem && $io5(elem))); const $io16 = input => "bigint" === input.type && (Array.isArray(input.values) && input.values.every(elem => "object" === typeof elem && null !== elem && $io15(elem))); const $io17 = input => Array.isArray(input.row) && input.row.every(elem => "object" === typeof elem && null !== elem && $io2(elem)) && (undefined === input.tags || Array.isArray(input.tags) && input.tags.every(elem => Array.isArray(elem) && elem.every(elem => "object" === typeof elem && null !== elem && $io8(elem)))); const $io18 = input => "object" === typeof input.original && null !== input.original && $io2(input.original) && ("object" === typeof input.returns && null !== input.returns && $io2(input.returns)); const $io19 = input => "string" === typeof input.name && (Array.isArray(input.tags) && input.tags.every(elem => Array.isArray(elem) && elem.every(elem => "object" === typeof elem && null !== elem && $io8(elem)))); const $io20 = input => "string" === typeof input.name && (Array.isArray(input.tags) && input.tags.every(elem => Array.isArray(elem) && elem.every(elem => "object" === typeof elem && null !== elem && $io8(elem)))); const $io21 = input => "object" === typeof input.key && null !== input.key && $io2(input.key) && ("object" === typeof input.value && null !== input.value && $io2(input.value)); const $io22 = input => Array.isArray(input.objects) && input.objects.every(elem => "object" === typeof elem && null !== elem && $io23(elem)) && (Array.isArray(input.aliases) && input.aliases.every(elem => "object" === typeof elem && null !== elem && $io25(elem))) && (Array.isArray(input.arrays) && input.arrays.every(elem => "object" === typeof elem && null !== elem && $io26(elem))) && (Array.isArray(input.tuples) && input.tuples.every(elem => "object" === typeof elem && null !== elem && $io27(elem))); const $io23 = input => "string" === typeof input.name && (Array.isArray(input.properties) && input.properties.every(elem => "object" === typeof elem && null !== elem && $io24(elem))) && (undefined === input.description || "string" === typeof input.description) && (Array.isArray(input.jsDocTags) && input.jsDocTags.every(elem => "object" === typeof elem && null !== elem && $io5(elem))) && "number" === typeof input.index && "boolean" === typeof input.recursive && (Array.isArray(input.nullables) && input.nullables.every(elem => "boolean" === typeof elem)); const $io24 = input => "object" === typeof input.key && null !== input.key && $io2(input.key) && ("object" === typeof input.value && null !== input.value && $io2(input.value)) && (null === input.description || "string" === typeof input.description) && (Array.isArray(input.jsDocTags) && input.jsDocTags.every(elem => "object" === typeof elem && null !== elem && $io5(elem))); const $io25 = input => "string" === typeof input.name && ("object" === typeof input.value && null !== input.value && $io2(input.value)) && (Array.isArray(input.nullables) && input.nullables.every(elem => "boolean" === typeof elem)) && (null === input.description || "string" === typeof input.description) && (Array.isArray(input.jsDocTags) && input.jsDocTags.every(elem => "object" === typeof elem && null !== elem && $io5(elem))) && "boolean" === typeof input.recursive; const $io26 = input => "string" === typeof input.name && ("object" === typeof input.value && null !== input.value && $io2(input.value)) && (Array.isArray(input.nullables) && input.nullables.every(elem => "boolean" === typeof elem)) && "boolean" === typeof input.recursive && (null === input.index || "number" === typeof input.index); const $io27 = input => "string" === typeof input.name && (Array.isArray(input.elements) && input.elements.every(elem => "object" === typeof elem && null !== elem && $io2(elem))) && (null === input.index || "number" === typeof input.index) && "boolean" === typeof input.recursive && (Array.isArray(input.nullables) && input.nullables.every(elem => "boolean" === typeof elem)); const $io28 = input => Object.keys(input).every(key => {
|
|
51
51
|
const value = input[key];
|
|
52
52
|
if (undefined === value)
|
|
53
53
|
return true;
|
|
54
54
|
return true;
|
|
55
55
|
}); const $iu0 = input => (() => {
|
|
56
56
|
if ("bigint" === input.type)
|
|
57
|
-
return $
|
|
57
|
+
return $io16(input);
|
|
58
58
|
else if ("string" === input.type)
|
|
59
|
-
return $
|
|
59
|
+
return $io14(input);
|
|
60
60
|
else if ("number" === input.type)
|
|
61
|
-
return $
|
|
61
|
+
return $io12(input);
|
|
62
62
|
else if ("boolean" === input.type)
|
|
63
|
-
return $
|
|
63
|
+
return $io10(input);
|
|
64
64
|
else
|
|
65
65
|
return false;
|
|
66
66
|
})(); return input => "object" === typeof input && null !== input && $io0(input); })()(param) &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestia/sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.13.0-dev.2024910",
|
|
4
4
|
"description": "Nestia SDK and Swagger generator",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -32,10 +32,9 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://nestia.io",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@nestia/core": "^3.
|
|
36
|
-
"@nestia/fetcher": "^3.
|
|
37
|
-
"@samchon/openapi": "^0.
|
|
38
|
-
"@wrtnio/openai-function-schema": "^0.2.3",
|
|
35
|
+
"@nestia/core": "^3.13.0-dev.2024910",
|
|
36
|
+
"@nestia/fetcher": "^3.13.0-dev.2024910",
|
|
37
|
+
"@samchon/openapi": "^1.0.0",
|
|
39
38
|
"cli": "^1.0.1",
|
|
40
39
|
"get-function-location": "^2.0.0",
|
|
41
40
|
"glob": "^7.2.0",
|
|
@@ -45,16 +44,16 @@
|
|
|
45
44
|
"tsconfck": "^2.1.2",
|
|
46
45
|
"tsconfig-paths": "^4.1.1",
|
|
47
46
|
"tstl": "^3.0.0",
|
|
48
|
-
"typia": "
|
|
47
|
+
"typia": ">=6.10.0 <7.0.0"
|
|
49
48
|
},
|
|
50
49
|
"peerDependencies": {
|
|
51
|
-
"@nestia/core": ">=3.
|
|
52
|
-
"@nestia/fetcher": ">=3.
|
|
50
|
+
"@nestia/core": ">=3.13.0-dev.2024910",
|
|
51
|
+
"@nestia/fetcher": ">=3.13.0-dev.2024910",
|
|
53
52
|
"@nestjs/common": ">=7.0.1",
|
|
54
53
|
"@nestjs/core": ">=7.0.1",
|
|
55
54
|
"reflect-metadata": ">=0.1.12",
|
|
56
55
|
"ts-node": ">=10.6.0",
|
|
57
|
-
"typia": ">=6.
|
|
56
|
+
"typia": ">=6.10.0 <7.0.0"
|
|
58
57
|
},
|
|
59
58
|
"devDependencies": {
|
|
60
59
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
@@ -71,7 +70,7 @@
|
|
|
71
70
|
"rimraf": "^3.0.2",
|
|
72
71
|
"tgrid": "^1.0.3",
|
|
73
72
|
"ts-patch": "^3.2.1",
|
|
74
|
-
"typescript": "
|
|
73
|
+
"typescript": "5.5.4",
|
|
75
74
|
"typescript-transform-paths": "^3.4.4",
|
|
76
75
|
"uuid": "^9.0.0"
|
|
77
76
|
},
|
package/src/INestiaConfig.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { INestApplication } from "@nestjs/common";
|
|
2
2
|
import { OpenApi } from "@samchon/openapi";
|
|
3
|
-
import { IOpenAiSchema } from "@wrtnio/openai-function-schema";
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Definition for the `nestia.config.ts` file.
|
|
@@ -29,15 +28,6 @@ export interface INestiaConfig {
|
|
|
29
28
|
*/
|
|
30
29
|
swagger?: INestiaConfig.ISwaggerConfig;
|
|
31
30
|
|
|
32
|
-
/**
|
|
33
|
-
* Configuration for the OpenAI funtion call schema generation.
|
|
34
|
-
*
|
|
35
|
-
* You can generate the schema for the OpenAI function call through
|
|
36
|
-
* this configuration. Recommend to use the function call schemas with
|
|
37
|
-
* the {@link swagger} document.
|
|
38
|
-
*/
|
|
39
|
-
openai?: INestiaConfig.IOpenAiConnfig;
|
|
40
|
-
|
|
41
31
|
/**
|
|
42
32
|
* Output directory that SDK would be placed in.
|
|
43
33
|
*
|
|
@@ -278,92 +268,4 @@ export namespace INestiaConfig {
|
|
|
278
268
|
path: string;
|
|
279
269
|
}): string;
|
|
280
270
|
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Configuration for the OpenAI funtion call schema generation.
|
|
284
|
-
*/
|
|
285
|
-
export interface IOpenAiConnfig {
|
|
286
|
-
/**
|
|
287
|
-
* Output path of the `openai.json`.
|
|
288
|
-
*
|
|
289
|
-
* If you've configured only directory, the file name would be the `openai.json`.
|
|
290
|
-
* Otherwise you've configured the full path with file name and extension, the
|
|
291
|
-
* `openai.json` file would be renamed to it.
|
|
292
|
-
*/
|
|
293
|
-
output: string;
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
* Whether the parameters are keyworded or not.
|
|
297
|
-
*
|
|
298
|
-
* If this property value is `true`, length of the
|
|
299
|
-
* {@link IOpenAiDocument.IFunction.parameters} is always 1, and type of the
|
|
300
|
-
* pararameter is always {@link IOpenAiSchema.IObject} type. Also, its
|
|
301
|
-
* properties are following below rules:
|
|
302
|
-
*
|
|
303
|
-
* - `pathParameters`: Path parameters of {@link ISwaggerMigrateRoute.parameters}
|
|
304
|
-
* - `query`: Query parameter of {@link ISwaggerMigrateRoute.query}
|
|
305
|
-
* - `body`: Body parameter of {@link ISwaggerMigrateRoute.body}
|
|
306
|
-
*
|
|
307
|
-
* ```typescript
|
|
308
|
-
* {
|
|
309
|
-
* ...pathParameters,
|
|
310
|
-
* query,
|
|
311
|
-
* body,
|
|
312
|
-
* }
|
|
313
|
-
* ```
|
|
314
|
-
*
|
|
315
|
-
* Otherwise (this property value is `false`), length of the
|
|
316
|
-
* {@link IOpenAiDocument.IFunction.parameters} is variable, and sequence of the
|
|
317
|
-
* parameters are following below rules.
|
|
318
|
-
*
|
|
319
|
-
* ```typescript
|
|
320
|
-
* [
|
|
321
|
-
* ...pathParameters,
|
|
322
|
-
* ...(query ? [query] : []),
|
|
323
|
-
* ...(body ? [body] : []),
|
|
324
|
-
* ]
|
|
325
|
-
* ```
|
|
326
|
-
*
|
|
327
|
-
* @default false
|
|
328
|
-
*/
|
|
329
|
-
keyword?: boolean;
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Separator function for the parameters.
|
|
333
|
-
*
|
|
334
|
-
* When composing parameter arguments through OpenAI function call,
|
|
335
|
-
* there can be a case that some parameters must be composed by human, or
|
|
336
|
-
* LLM cannot understand the parameter. For example, if the parameter type
|
|
337
|
-
* has configured {@link IOpenAiSchema.IString["x-wrtn-secret-key"]}, the
|
|
338
|
-
* secret key value must be composed by human, not by LLM (Large Language Model).
|
|
339
|
-
*
|
|
340
|
-
* In that case, if you configure this property with a function that
|
|
341
|
-
* predicating whether the schema value must be composed by human or not,
|
|
342
|
-
* the parameters would be separated into two parts.
|
|
343
|
-
*
|
|
344
|
-
* - {@link IOpenAiFunction.separated.llm}
|
|
345
|
-
* - {@link IOpenAiFunction.separated.human}
|
|
346
|
-
*
|
|
347
|
-
* When writing the function, note that returning value `true` means to be
|
|
348
|
-
* a human composing the value, and `false` means to LLM composing the value.
|
|
349
|
-
* Also, when predicating the schema, it would better to utilize the
|
|
350
|
-
* {@link OpenAiTypeChecker} features.
|
|
351
|
-
*
|
|
352
|
-
* @param schema Schema to be separated.
|
|
353
|
-
* @returns Whether the schema value must be composed by human or not.
|
|
354
|
-
* @default null
|
|
355
|
-
*/
|
|
356
|
-
separate?: null | ((schema: IOpenAiSchema) => boolean);
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* Whether to beautify JSON content or not.
|
|
360
|
-
*
|
|
361
|
-
* If you configure this property to be `true`, the `openai.json` file would
|
|
362
|
-
* be beautified with indentation (2 spaces) and line breaks. If you configure
|
|
363
|
-
* numeric value instead, the indentation would be specified by the number.
|
|
364
|
-
*
|
|
365
|
-
* @default false
|
|
366
|
-
*/
|
|
367
|
-
beautify?: boolean | number;
|
|
368
|
-
}
|
|
369
271
|
}
|
|
@@ -11,7 +11,6 @@ import { ReflectControllerAnalyzer } from "./analyses/ReflectControllerAnalyzer"
|
|
|
11
11
|
import { TypedHttpRouteAnalyzer } from "./analyses/TypedHttpRouteAnalyzer";
|
|
12
12
|
import { TypedWebSocketRouteAnalyzer } from "./analyses/TypedWebSocketRouteAnalyzer";
|
|
13
13
|
import { E2eGenerator } from "./generates/E2eGenerator";
|
|
14
|
-
import { OpenAiGenerator } from "./generates/OpenAiGenerator";
|
|
15
14
|
import { SdkGenerator } from "./generates/SdkGenerator";
|
|
16
15
|
import { SwaggerGenerator } from "./generates/SwaggerGenerator";
|
|
17
16
|
import { INestiaProject } from "./structures/INestiaProject";
|
|
@@ -28,11 +27,7 @@ export class NestiaSdkApplication {
|
|
|
28
27
|
public constructor(private readonly config: INestiaConfig) {}
|
|
29
28
|
|
|
30
29
|
public async all(): Promise<void> {
|
|
31
|
-
if (
|
|
32
|
-
!this.config.output &&
|
|
33
|
-
!this.config.swagger?.output &&
|
|
34
|
-
!this.config.openai?.output
|
|
35
|
-
)
|
|
30
|
+
if (!this.config.output && !this.config.swagger?.output)
|
|
36
31
|
throw new Error(
|
|
37
32
|
[
|
|
38
33
|
"Error on NestiaApplication.all(): nothing to generate, configure at least one property of below:",
|
|
@@ -50,7 +45,6 @@ export class NestiaSdkApplication {
|
|
|
50
45
|
if (this.config.e2e) await E2eGenerator.generate(app);
|
|
51
46
|
}
|
|
52
47
|
if (this.config.swagger) await SwaggerGenerator.generate(app);
|
|
53
|
-
if (this.config.openai) await OpenAiGenerator.generate(app);
|
|
54
48
|
},
|
|
55
49
|
});
|
|
56
50
|
}
|
|
@@ -129,28 +123,6 @@ export class NestiaSdkApplication {
|
|
|
129
123
|
});
|
|
130
124
|
}
|
|
131
125
|
|
|
132
|
-
public async openai(): Promise<void> {
|
|
133
|
-
if (!this.config.openai?.output)
|
|
134
|
-
throw new Error(
|
|
135
|
-
`Error on NestiaApplication.openai(): configure INestiaConfig.openai property.`,
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
const parsed: path.ParsedPath = path.parse(this.config.openai.output);
|
|
139
|
-
const directory: string = !!parsed.ext
|
|
140
|
-
? path.resolve(parsed.dir)
|
|
141
|
-
: this.config.openai.output;
|
|
142
|
-
const stats: fs.Stats = await fs.promises.lstat(directory);
|
|
143
|
-
if (stats.isDirectory() === false)
|
|
144
|
-
throw new Error(
|
|
145
|
-
"Error on NestiaApplication.openai(): output directory does not exists.",
|
|
146
|
-
);
|
|
147
|
-
|
|
148
|
-
print_title("Nestia OpenAI Function Calling Schema Generator");
|
|
149
|
-
await this.generate({
|
|
150
|
-
generate: OpenAiGenerator.generate,
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
|
|
154
126
|
private async generate(props: {
|
|
155
127
|
generate: (app: ITypedApplication) => Promise<void>;
|
|
156
128
|
validate?: (app: ITypedApplication) => IReflectOperationError[];
|
|
@@ -19,13 +19,6 @@ export namespace NestiaSdkCommand {
|
|
|
19
19
|
validate: (config) => !!config.swagger?.output,
|
|
20
20
|
solution: "configure INestiaConfig.swagger property.",
|
|
21
21
|
});
|
|
22
|
-
export const openai = () =>
|
|
23
|
-
main({
|
|
24
|
-
title: "OpenAI Function Calling Schema",
|
|
25
|
-
generate: (app) => app.openai(),
|
|
26
|
-
validate: (config) => !!config.openai?.output,
|
|
27
|
-
solution: "configure INestiaConfig.openai property.",
|
|
28
|
-
});
|
|
29
22
|
export const e2e = () =>
|
|
30
23
|
main({
|
|
31
24
|
title: "E2E Functions",
|
|
@@ -48,7 +41,6 @@ export namespace NestiaSdkCommand {
|
|
|
48
41
|
"",
|
|
49
42
|
" - INestiaConfig.output",
|
|
50
43
|
" - INestiaConfig.swagger.output",
|
|
51
|
-
" - INestiaConfig.openai.output",
|
|
52
44
|
].join("\n"),
|
|
53
45
|
});
|
|
54
46
|
|
package/src/executable/sdk.ts
CHANGED
|
@@ -16,9 +16,8 @@ npx @nestia/sdk [command] [options?]
|
|
|
16
16
|
2. npx @nestia/sdk init
|
|
17
17
|
3. npx @nestia/sdk sdk --config? [config file] --project? [project file]
|
|
18
18
|
4. npx @nestia/sdk swagger --config? [config file] --project? [project file]
|
|
19
|
-
5. npx @nestia/sdk
|
|
20
|
-
6. npx @nestia/sdk
|
|
21
|
-
7. npx @nestia/sdk generate --config? [config file] --project? [project file]
|
|
19
|
+
5. npx @nestia/sdk e2e --config? [config file] --project? [project file]
|
|
20
|
+
6. npx @nestia/sdk generate --config? [config file] --project? [project file]
|
|
22
21
|
`;
|
|
23
22
|
|
|
24
23
|
function halt(desc: string): never {
|
|
@@ -64,7 +63,6 @@ async function main() {
|
|
|
64
63
|
else if (type === "init") await initialize();
|
|
65
64
|
else if (type === "sdk") await execute((c) => c.sdk());
|
|
66
65
|
else if (type === "swagger") await execute((c) => c.swagger());
|
|
67
|
-
else if (type === "openai") await execute((c) => c.openai());
|
|
68
66
|
else if (type === "e2e") await execute((c) => c.e2e());
|
|
69
67
|
else if (type === "all") await execute((c) => c.all());
|
|
70
68
|
else halt(USAGE);
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.OpenAiGenerator = void 0;
|
|
16
|
-
const openai_function_schema_1 = require("@wrtnio/openai-function-schema");
|
|
17
|
-
const fs_1 = __importDefault(require("fs"));
|
|
18
|
-
const path_1 = __importDefault(require("path"));
|
|
19
|
-
const SwaggerGenerator_1 = require("./SwaggerGenerator");
|
|
20
|
-
var OpenAiGenerator;
|
|
21
|
-
(function (OpenAiGenerator) {
|
|
22
|
-
OpenAiGenerator.generate = (app) => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
var _a;
|
|
24
|
-
console.log("Generating OpenAI Function Calling Document");
|
|
25
|
-
const config = app.project.config.openai;
|
|
26
|
-
if (config === undefined)
|
|
27
|
-
throw new Error("OpenAI configuration is not defined");
|
|
28
|
-
const parsed = path_1.default.parse(config.output);
|
|
29
|
-
const directory = path_1.default.dirname(parsed.dir);
|
|
30
|
-
if (fs_1.default.existsSync(directory) === false)
|
|
31
|
-
try {
|
|
32
|
-
yield fs_1.default.promises.mkdir(directory);
|
|
33
|
-
}
|
|
34
|
-
catch (_b) { }
|
|
35
|
-
if (fs_1.default.existsSync(directory) === false)
|
|
36
|
-
throw new Error(`Error on NestiaApplication.openai(): failed to create output directory: ${directory}`);
|
|
37
|
-
const location = !!parsed.ext
|
|
38
|
-
? path_1.default.resolve(config.output)
|
|
39
|
-
: path_1.default.join(path_1.default.resolve(config.output), "openai.json");
|
|
40
|
-
const swagger = yield SwaggerGenerator_1.SwaggerGenerator.compose({
|
|
41
|
-
config: (_a = app.project.config.swagger) !== null && _a !== void 0 ? _a : { output: "" },
|
|
42
|
-
routes: app.routes.filter((route) => route.protocol === "http"),
|
|
43
|
-
document: {
|
|
44
|
-
openapi: "3.1.0",
|
|
45
|
-
components: {},
|
|
46
|
-
"x-samchon-emended": true,
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
const document = openai_function_schema_1.OpenAiComposer.document({
|
|
50
|
-
swagger,
|
|
51
|
-
options: config,
|
|
52
|
-
});
|
|
53
|
-
yield fs_1.default.promises.writeFile(location, !config.beautify
|
|
54
|
-
? JSON.stringify(document)
|
|
55
|
-
: JSON.stringify(document, null, typeof config.beautify === "number" ? config.beautify : 2), "utf8");
|
|
56
|
-
});
|
|
57
|
-
})(OpenAiGenerator || (exports.OpenAiGenerator = OpenAiGenerator = {}));
|
|
58
|
-
//# sourceMappingURL=OpenAiGenerator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAiGenerator.js","sourceRoot":"","sources":["../../src/generates/OpenAiGenerator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,2EAGwC;AACxC,4CAAoB;AACpB,gDAAwB;AAGxB,yDAAsD;AAEtD,IAAiB,eAAe,CA+C/B;AA/CD,WAAiB,eAAe;IACjB,wBAAQ,GAAG,CAAO,GAAsB,EAAiB,EAAE;;QACtE,OAAO,CAAC,GAAG,CAAC,6CAA6C,CAAC,CAAC;QAE3D,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;QACzC,IAAI,MAAM,KAAK,SAAS;YACtB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QAEzD,MAAM,MAAM,GAAoB,cAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC1D,MAAM,SAAS,GAAW,cAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACnD,IAAI,YAAE,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,KAAK;YACpC,IAAI,CAAC;gBACH,MAAM,YAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YACrC,CAAC;YAAC,WAAM,CAAC,CAAA,CAAC;QACZ,IAAI,YAAE,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,KAAK;YACpC,M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@@
|
|
|
1
|
-
import { OpenApi } from "@samchon/openapi";
|
|
2
|
-
import {
|
|
3
|
-
IOpenAiDocument,
|
|
4
|
-
OpenAiComposer,
|
|
5
|
-
} from "@wrtnio/openai-function-schema";
|
|
6
|
-
import fs from "fs";
|
|
7
|
-
import path from "path";
|
|
8
|
-
|
|
9
|
-
import { ITypedApplication } from "../structures/ITypedApplication";
|
|
10
|
-
import { SwaggerGenerator } from "./SwaggerGenerator";
|
|
11
|
-
|
|
12
|
-
export namespace OpenAiGenerator {
|
|
13
|
-
export const generate = async (app: ITypedApplication): Promise<void> => {
|
|
14
|
-
console.log("Generating OpenAI Function Calling Document");
|
|
15
|
-
|
|
16
|
-
const config = app.project.config.openai;
|
|
17
|
-
if (config === undefined)
|
|
18
|
-
throw new Error("OpenAI configuration is not defined");
|
|
19
|
-
|
|
20
|
-
const parsed: path.ParsedPath = path.parse(config.output);
|
|
21
|
-
const directory: string = path.dirname(parsed.dir);
|
|
22
|
-
if (fs.existsSync(directory) === false)
|
|
23
|
-
try {
|
|
24
|
-
await fs.promises.mkdir(directory);
|
|
25
|
-
} catch {}
|
|
26
|
-
if (fs.existsSync(directory) === false)
|
|
27
|
-
throw new Error(
|
|
28
|
-
`Error on NestiaApplication.openai(): failed to create output directory: ${directory}`,
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
const location: string = !!parsed.ext
|
|
32
|
-
? path.resolve(config.output)
|
|
33
|
-
: path.join(path.resolve(config.output), "openai.json");
|
|
34
|
-
const swagger: OpenApi.IDocument = await SwaggerGenerator.compose({
|
|
35
|
-
config: app.project.config.swagger ?? { output: "" },
|
|
36
|
-
routes: app.routes.filter((route) => route.protocol === "http"),
|
|
37
|
-
document: {
|
|
38
|
-
openapi: "3.1.0",
|
|
39
|
-
components: {},
|
|
40
|
-
"x-samchon-emended": true,
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
const document: IOpenAiDocument = OpenAiComposer.document({
|
|
44
|
-
swagger,
|
|
45
|
-
options: config,
|
|
46
|
-
});
|
|
47
|
-
await fs.promises.writeFile(
|
|
48
|
-
location,
|
|
49
|
-
!config.beautify
|
|
50
|
-
? JSON.stringify(document)
|
|
51
|
-
: JSON.stringify(
|
|
52
|
-
document,
|
|
53
|
-
null,
|
|
54
|
-
typeof config.beautify === "number" ? config.beautify : 2,
|
|
55
|
-
),
|
|
56
|
-
"utf8",
|
|
57
|
-
);
|
|
58
|
-
};
|
|
59
|
-
}
|