@dbos-inc/dbos-sdk 0.8.28-preview → 0.8.32-preview
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/cloud-cli/applications/configure.d.ts +2 -0
- package/dist/src/cloud-cli/applications/configure.d.ts.map +1 -0
- package/dist/src/cloud-cli/applications/configure.js +64 -0
- package/dist/src/cloud-cli/applications/configure.js.map +1 -0
- package/dist/src/cloud-cli/applications/deploy-app-code.d.ts.map +1 -1
- package/dist/src/cloud-cli/applications/deploy-app-code.js +63 -6
- package/dist/src/cloud-cli/applications/deploy-app-code.js.map +1 -1
- package/dist/src/cloud-cli/cli.js +0 -0
- package/dist/src/cloud-cli/userdb.d.ts.map +1 -1
- package/dist/src/cloud-cli/userdb.js +3 -2
- package/dist/src/cloud-cli/userdb.js.map +1 -1
- package/dist/src/cloud-cli/utils.d.ts +1 -0
- package/dist/src/cloud-cli/utils.d.ts.map +1 -1
- package/dist/src/cloud-cli/utils.js +21 -1
- package/dist/src/cloud-cli/utils.js.map +1 -1
- package/dist/src/dbos-executor.d.ts +4 -3
- package/dist/src/dbos-executor.d.ts.map +1 -1
- package/dist/src/dbos-executor.js +57 -33
- package/dist/src/dbos-executor.js.map +1 -1
- package/dist/src/dbos-runtime/TypeParser.d.ts +33 -0
- package/dist/src/dbos-runtime/TypeParser.d.ts.map +1 -0
- package/dist/src/dbos-runtime/TypeParser.js +104 -0
- package/dist/src/dbos-runtime/TypeParser.js.map +1 -0
- package/dist/src/dbos-runtime/openApi.d.ts +35 -0
- package/dist/src/dbos-runtime/openApi.d.ts.map +1 -0
- package/dist/src/dbos-runtime/openApi.js +595 -0
- package/dist/src/dbos-runtime/openApi.js.map +1 -0
- package/dist/src/dbos-runtime/tsDiagUtil.d.ts +16 -0
- package/dist/src/dbos-runtime/tsDiagUtil.d.ts.map +1 -0
- package/dist/src/dbos-runtime/tsDiagUtil.js +72 -0
- package/dist/src/dbos-runtime/tsDiagUtil.js.map +1 -0
- package/dist/src/httpServer/server.js +1 -1
- package/dist/src/httpServer/server.js.map +1 -1
- package/dist/src/provenance/provenance_daemon.d.ts +34 -0
- package/dist/src/provenance/provenance_daemon.d.ts.map +1 -0
- package/dist/src/provenance/provenance_daemon.js +86 -0
- package/dist/src/provenance/provenance_daemon.js.map +1 -0
- package/dist/src/system_database.d.ts +8 -4
- package/dist/src/system_database.d.ts.map +1 -1
- package/dist/src/system_database.js +71 -10
- package/dist/src/system_database.js.map +1 -1
- package/dist/src/telemetry/signals.d.ts +20 -0
- package/dist/src/telemetry/signals.d.ts.map +1 -0
- package/dist/src/telemetry/signals.js +11 -0
- package/dist/src/telemetry/signals.js.map +1 -0
- package/dist/src/workflow.d.ts +1 -1
- package/dist/src/workflow.d.ts.map +1 -1
- package/examples/hello/.eslintignore +4 -0
- package/examples/hello/.eslintrc +19 -0
- package/examples/hello/knexfile.ts +1 -1
- package/examples/hello/package.json +5 -2
- package/examples/hello/src/operations.ts +2 -2
- package/examples/hello/tsconfig.json +2 -2
- package/package.json +2 -2
@@ -0,0 +1,595 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.generateOpenApi = exports.OpenApiGenerator = void 0;
|
7
|
+
const typescript_1 = __importDefault(require("typescript"));
|
8
|
+
const TypeParser_1 = require("./TypeParser");
|
9
|
+
const handler_1 = require("../httpServer/handler");
|
10
|
+
const ts_json_schema_generator_1 = require("ts-json-schema-generator");
|
11
|
+
const node_path_1 = __importDefault(require("node:path"));
|
12
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
13
|
+
const tsDiagUtil_1 = require("./tsDiagUtil");
|
14
|
+
function isValid(value) { return value !== undefined; }
|
15
|
+
// ts-json-schema-generator does not support BigInt, so OpenApiGenerator needs a custom type, formatter and parser for it
|
16
|
+
class BigIntType extends ts_json_schema_generator_1.PrimitiveType {
|
17
|
+
getId() { return "integer"; }
|
18
|
+
}
|
19
|
+
class BigIntKeywordParser {
|
20
|
+
supportsNode(node) {
|
21
|
+
return node.kind === typescript_1.default.SyntaxKind.BigIntKeyword;
|
22
|
+
}
|
23
|
+
createType(_node, _context, _reference) {
|
24
|
+
return new BigIntType();
|
25
|
+
}
|
26
|
+
}
|
27
|
+
class BigIntTypeFormatter {
|
28
|
+
supportsType(type) {
|
29
|
+
return type instanceof BigIntType;
|
30
|
+
}
|
31
|
+
getDefinition(_type) {
|
32
|
+
// Note, JSON Schema integer type is not constrained to a specific size, so it is a valid type for BigInt
|
33
|
+
return { type: "integer", description: "bigint" };
|
34
|
+
}
|
35
|
+
getChildren(_type) {
|
36
|
+
return [];
|
37
|
+
}
|
38
|
+
}
|
39
|
+
// type guard functions for ts.Type/TypeNode
|
40
|
+
function isNodeWithTypeArguments(node) {
|
41
|
+
return "typeArguments" in node;
|
42
|
+
}
|
43
|
+
function isObjectType(node) {
|
44
|
+
return !!(node.flags & typescript_1.default.TypeFlags.Object);
|
45
|
+
}
|
46
|
+
function isTypeReference(node) {
|
47
|
+
return isObjectType(node) && !!(node.objectFlags & typescript_1.default.ObjectFlags.Reference);
|
48
|
+
}
|
49
|
+
// workflow UUID header parameter info which is added to every generated endpoint
|
50
|
+
const workflowUuidParamName = "dbosWorkflowUUID";
|
51
|
+
const workflowUuidRef = { $ref: `#/components/parameters/${workflowUuidParamName}` };
|
52
|
+
const workflowUuidParam = [workflowUuidParamName, {
|
53
|
+
name: 'dbos-workflowuuid',
|
54
|
+
in: 'header',
|
55
|
+
required: false,
|
56
|
+
description: "Caller specified [workflow idempotency key](https://docs.dbos.dev/tutorials/idempotency-tutorial#setting-idempotency-keys)",
|
57
|
+
schema: { type: 'string' },
|
58
|
+
}];
|
59
|
+
class OpenApiGenerator {
|
60
|
+
program;
|
61
|
+
#checker;
|
62
|
+
#schemaGenerator;
|
63
|
+
#schemaMap = new Map();
|
64
|
+
#securitySchemeMap = new Map();
|
65
|
+
#diags = new tsDiagUtil_1.DiagnosticsCollector();
|
66
|
+
get diags() { return this.#diags.diags; }
|
67
|
+
constructor(program) {
|
68
|
+
this.program = program;
|
69
|
+
this.#checker = program.getTypeChecker();
|
70
|
+
const config = {
|
71
|
+
discriminatorType: 'open-api',
|
72
|
+
encodeRefs: false
|
73
|
+
};
|
74
|
+
const parser = (0, ts_json_schema_generator_1.createParser)(program, config, aug => aug.addNodeParser(new BigIntKeywordParser()));
|
75
|
+
const formatter = (0, ts_json_schema_generator_1.createFormatter)(config, (fmt) => fmt.addTypeFormatter(new BigIntTypeFormatter()));
|
76
|
+
this.#schemaGenerator = new ts_json_schema_generator_1.SchemaGenerator(program, parser, formatter, {});
|
77
|
+
}
|
78
|
+
generate(classes, title, version) {
|
79
|
+
const paths = new Array();
|
80
|
+
classes.forEach((cls, index) => {
|
81
|
+
// if the class name is not specified, manufacture a name using the class index as the prefix
|
82
|
+
// JS class identifiers cannot start with a digit but OpenApi security scheme names can
|
83
|
+
const securitySchemeName = cls.name ? `${cls.name}Auth` : `${index}ClassAuth`;
|
84
|
+
const securitySchemeDecorator = this.getDBOSDecorator(cls, 'OpenApiSecurityScheme');
|
85
|
+
const securityScheme = this.parseSecurityScheme(securitySchemeDecorator?.args[0]);
|
86
|
+
const defaultRoles = this.parseStringLiteralArray(this.getDBOSDecorator(cls, 'DefaultRequiredRole')?.args[0]) ?? [];
|
87
|
+
if (securityScheme) {
|
88
|
+
this.#securitySchemeMap.set(securitySchemeName, securityScheme);
|
89
|
+
}
|
90
|
+
for (const method of cls.methods) {
|
91
|
+
const http = this.getHttpInfo(method);
|
92
|
+
if (!http)
|
93
|
+
continue;
|
94
|
+
const path = this.generatePath(method, http, defaultRoles, securityScheme ? securitySchemeName : undefined);
|
95
|
+
if (path)
|
96
|
+
paths.push(path);
|
97
|
+
}
|
98
|
+
});
|
99
|
+
const openApi = {
|
100
|
+
openapi: "3.0.3",
|
101
|
+
info: { title, version },
|
102
|
+
paths: Object.fromEntries(paths),
|
103
|
+
components: {
|
104
|
+
parameters: Object.fromEntries([workflowUuidParam]),
|
105
|
+
schemas: Object.fromEntries(this.#schemaMap),
|
106
|
+
securitySchemes: Object.fromEntries(this.#securitySchemeMap)
|
107
|
+
}
|
108
|
+
};
|
109
|
+
return (0, tsDiagUtil_1.diagResult)(openApi, this.diags);
|
110
|
+
}
|
111
|
+
generatePath(method, { verb, path }, defaultRoles, securityScheme) {
|
112
|
+
const sourcedParams = method.parameters
|
113
|
+
// The first parameter of a handle method must be an DBOSContext, which is not exposed via the API
|
114
|
+
.slice(1)
|
115
|
+
.map(p => [p, this.getParamSource(p, verb)]);
|
116
|
+
const parameters = this.generateParameters(sourcedParams);
|
117
|
+
// add optional parameter for workflow UUID header
|
118
|
+
parameters.push(workflowUuidRef);
|
119
|
+
const requestBody = this.generateRequestBody(sourcedParams);
|
120
|
+
const response = this.generateResponse(method);
|
121
|
+
if (!response)
|
122
|
+
return;
|
123
|
+
// if there is a security scheme specified, create a security requirement for it
|
124
|
+
// unless the method has no required roles
|
125
|
+
const security = new Array();
|
126
|
+
if (securityScheme) {
|
127
|
+
const roles = this.parseStringLiteralArray(this.getDBOSDecorator(method, 'RequiredRole')?.args[0]) ?? defaultRoles;
|
128
|
+
if (roles.length > 0) {
|
129
|
+
security.push({ [securityScheme]: [] });
|
130
|
+
}
|
131
|
+
}
|
132
|
+
const operation = {
|
133
|
+
operationId: method.name,
|
134
|
+
responses: Object.fromEntries([response]),
|
135
|
+
parameters,
|
136
|
+
requestBody,
|
137
|
+
security: security.length > 0 ? security : undefined,
|
138
|
+
};
|
139
|
+
// validate all path parameters have matching parameters with URL ArgSource
|
140
|
+
const pathParams = path.split('/')
|
141
|
+
.filter(p => p.startsWith(':'))
|
142
|
+
.map(p => p.substring(1));
|
143
|
+
for (const pathParam of pathParams) {
|
144
|
+
const param = sourcedParams.find(([parameter, _]) => parameter.name === pathParam);
|
145
|
+
if (!param) {
|
146
|
+
this.#diags.raise(`Missing path parameter ${pathParam} for ${method.name}`, method.node);
|
147
|
+
return;
|
148
|
+
}
|
149
|
+
if (param[1] !== handler_1.ArgSources.URL) {
|
150
|
+
this.#diags.raise(`Path parameter ${pathParam} must be a URL parameter: ${method.name}`, param[0].node);
|
151
|
+
return;
|
152
|
+
}
|
153
|
+
}
|
154
|
+
// OpenAPI indicates path parameters with curly braces, but DBOS uses colons
|
155
|
+
const $path = path.split('/')
|
156
|
+
.map(p => p.startsWith(':') ? `{${p.substring(1)}}` : p)
|
157
|
+
.join('/');
|
158
|
+
switch (verb) {
|
159
|
+
case handler_1.APITypes.GET: return [$path, { get: operation }];
|
160
|
+
case handler_1.APITypes.POST: return [$path, { post: operation }];
|
161
|
+
}
|
162
|
+
}
|
163
|
+
getMethodReturnType(node) {
|
164
|
+
// if the method has a declared return type, try to use that
|
165
|
+
if (node.type) {
|
166
|
+
if (!isNodeWithTypeArguments(node.type)) {
|
167
|
+
this.#diags.warn(`Unexpected type node kind ${typescript_1.default.SyntaxKind[node.type.kind]}`, node.type);
|
168
|
+
}
|
169
|
+
else {
|
170
|
+
// return type must be a Promise<T>, so take the first type argument
|
171
|
+
const typeArg = node.type.typeArguments?.[0];
|
172
|
+
if (typeArg)
|
173
|
+
return this.#checker.getTypeFromTypeNode(typeArg);
|
174
|
+
const printer = typescript_1.default.createPrinter();
|
175
|
+
const text = printer.printNode(typescript_1.default.EmitHint.Unspecified, node.type, node.getSourceFile());
|
176
|
+
this.#diags.warn(`Unexpected return type without at least one type argument ${text}`, node.type);
|
177
|
+
}
|
178
|
+
}
|
179
|
+
// if the return type is inferred or the Promise type argument could not be determined,
|
180
|
+
// infer the return type via the type checker
|
181
|
+
const signature = this.#checker.getSignatureFromDeclaration(node);
|
182
|
+
const returnType = signature?.getReturnType();
|
183
|
+
if (!returnType || !isTypeReference(returnType))
|
184
|
+
return undefined;
|
185
|
+
// again, return type must be a Promise<T>, so take the first type argument
|
186
|
+
return returnType.typeArguments?.[0];
|
187
|
+
}
|
188
|
+
generateResponse(method) {
|
189
|
+
const returnType = this.getMethodReturnType(method.node);
|
190
|
+
if (!returnType) {
|
191
|
+
this.#diags.raise(`Could not determine return type of ${method.name}`, method.node);
|
192
|
+
return;
|
193
|
+
}
|
194
|
+
if (returnType.flags & typescript_1.default.TypeFlags.VoidLike) {
|
195
|
+
return ["204", { description: "No Content" }];
|
196
|
+
}
|
197
|
+
const typeNode = this.#checker.typeToTypeNode(returnType, undefined, undefined);
|
198
|
+
if (!typeNode) {
|
199
|
+
this.#diags.warn(`Could not determine return type node of ${method.name}`, method.node);
|
200
|
+
}
|
201
|
+
return ["200", {
|
202
|
+
description: "Ok",
|
203
|
+
content: {
|
204
|
+
"application/json": {
|
205
|
+
schema: this.generateSchema(typeNode)
|
206
|
+
}
|
207
|
+
}
|
208
|
+
}];
|
209
|
+
}
|
210
|
+
generateParameters(sourcedParams) {
|
211
|
+
if (sourcedParams.length === 0)
|
212
|
+
return [];
|
213
|
+
return sourcedParams
|
214
|
+
// QUERY and URL parameters are specified in the Operation.parameters field
|
215
|
+
.filter(([_, source]) => source === handler_1.ArgSources.QUERY || source === handler_1.ArgSources.URL)
|
216
|
+
.map(([parameter, argSource]) => this.generateParameter(parameter, argSource))
|
217
|
+
.filter(isValid);
|
218
|
+
}
|
219
|
+
generateParameter(parameter, argSource) {
|
220
|
+
if (argSource === handler_1.ArgSources.BODY) {
|
221
|
+
this.#diags.raise(`BODY parameters must be specified in the Operation.requestBody field: ${parameter.name}`, parameter.node);
|
222
|
+
return;
|
223
|
+
}
|
224
|
+
if (argSource === handler_1.ArgSources.URL && !parameter.required) {
|
225
|
+
this.#diags.raise(`URL parameters must be required: ${parameter.name}`, parameter.node);
|
226
|
+
return;
|
227
|
+
}
|
228
|
+
const schema = this.generateSchema(parameter.node);
|
229
|
+
const name = this.getParamName(parameter);
|
230
|
+
const location = this.getLocation(parameter, argSource);
|
231
|
+
if (!name || !location)
|
232
|
+
return;
|
233
|
+
return {
|
234
|
+
name,
|
235
|
+
in: location,
|
236
|
+
required: parameter.required,
|
237
|
+
schema
|
238
|
+
};
|
239
|
+
}
|
240
|
+
getLocation(parameter, argSource) {
|
241
|
+
switch (argSource) {
|
242
|
+
case handler_1.ArgSources.QUERY: return 'query';
|
243
|
+
case handler_1.ArgSources.URL: return 'path';
|
244
|
+
default:
|
245
|
+
this.#diags.raise(`Unsupported Parameter ArgSource: ${argSource}`, parameter.node);
|
246
|
+
return;
|
247
|
+
}
|
248
|
+
}
|
249
|
+
generateRequestBody(sourcedParams) {
|
250
|
+
// BODY parameters are specified in the Operation.requestBody field
|
251
|
+
const parameters = sourcedParams
|
252
|
+
.filter(([_, source]) => source === handler_1.ArgSources.BODY)
|
253
|
+
.map(([parameter, _]) => [this.getParamName(parameter), parameter]);
|
254
|
+
if (parameters.length === 0)
|
255
|
+
return undefined;
|
256
|
+
const properties = parameters.map(([name, parameter]) => [name, this.generateSchema(parameter.node)]);
|
257
|
+
const schema = {
|
258
|
+
type: 'object',
|
259
|
+
properties: Object.fromEntries(properties),
|
260
|
+
required: parameters.filter(([_, parameter]) => parameter.required).map(([name, _]) => name),
|
261
|
+
};
|
262
|
+
return {
|
263
|
+
required: true,
|
264
|
+
content: {
|
265
|
+
"application/json": { schema }
|
266
|
+
}
|
267
|
+
};
|
268
|
+
}
|
269
|
+
generateSchema(node) {
|
270
|
+
if (!node)
|
271
|
+
return { description: "Undefined Node" };
|
272
|
+
const schema = this.#schemaGenerator.createSchemaFromNodes([node]);
|
273
|
+
if (!schema.$ref)
|
274
|
+
return { description: "No $ref" };
|
275
|
+
const slashIndex = schema.$ref.lastIndexOf('/');
|
276
|
+
if (slashIndex === -1)
|
277
|
+
return { description: `Invalid $ref ${schema.$ref}` };
|
278
|
+
const name = schema.$ref.substring(slashIndex + 1);
|
279
|
+
const defs = new Map(Object.entries(schema.definitions ?? {}));
|
280
|
+
if (defs.size === 0)
|
281
|
+
return { description: "No definitions" };
|
282
|
+
const def = defs.get(name);
|
283
|
+
if (!def)
|
284
|
+
return { description: `No definition ${name}` };
|
285
|
+
if (typeof def === 'boolean')
|
286
|
+
return { description: `Definition ${name} is a boolean` };
|
287
|
+
if (defs.size > 1) {
|
288
|
+
defs.delete(name);
|
289
|
+
for (const [$name, $def] of defs) {
|
290
|
+
if (typeof $def === 'boolean')
|
291
|
+
continue;
|
292
|
+
const $schema = this.mapSchema($def);
|
293
|
+
if ($schema)
|
294
|
+
this.#schemaMap.set($name, $schema);
|
295
|
+
}
|
296
|
+
}
|
297
|
+
return this.mapSchema(def);
|
298
|
+
}
|
299
|
+
getDBOSDecorator(decorated, name) {
|
300
|
+
const filtered = decorated.decorators.filter(d => d.module === '@dbos-inc/dbos-sdk' && d.name === name);
|
301
|
+
if (filtered.length === 0)
|
302
|
+
return undefined;
|
303
|
+
if (filtered.length > 1) {
|
304
|
+
this.#diags.raise(`Multiple ${JSON.stringify(name)} decorators found on ${decorated.name ?? "<unknown>"}`, decorated.node);
|
305
|
+
}
|
306
|
+
return filtered[0];
|
307
|
+
}
|
308
|
+
getHttpInfo(method) {
|
309
|
+
const getApiDecorator = this.getDBOSDecorator(method, 'GetApi');
|
310
|
+
const postApiDecorator = this.getDBOSDecorator(method, 'PostApi');
|
311
|
+
if (getApiDecorator && postApiDecorator) {
|
312
|
+
this.#diags.raise(`Method ${method.name} has both GetApi and PostApi decorators`);
|
313
|
+
return;
|
314
|
+
}
|
315
|
+
if (!getApiDecorator && !postApiDecorator)
|
316
|
+
return undefined;
|
317
|
+
const verb = getApiDecorator ? handler_1.APITypes.GET : handler_1.APITypes.POST;
|
318
|
+
const arg = getApiDecorator ? getApiDecorator.args[0] : postApiDecorator?.args[0];
|
319
|
+
if (!arg) {
|
320
|
+
this.#diags.raise(`Missing path argument for ${verb}Api decorator`, method.node);
|
321
|
+
return;
|
322
|
+
}
|
323
|
+
if (!typescript_1.default.isStringLiteral(arg)) {
|
324
|
+
this.#diags.raise(`Unexpected path argument type: ${typescript_1.default.SyntaxKind[arg.kind]}`, method.node);
|
325
|
+
return;
|
326
|
+
}
|
327
|
+
return { verb, path: arg.text };
|
328
|
+
}
|
329
|
+
getParamSource(parameter, verb) {
|
330
|
+
const argSource = this.getDBOSDecorator(parameter, 'ArgSource');
|
331
|
+
if (!argSource)
|
332
|
+
return getDefaultArgSource(verb);
|
333
|
+
if (!typescript_1.default.isPropertyAccessExpression(argSource.args[0])) {
|
334
|
+
this.#diags.raise(`Unexpected ArgSource argument type: ${typescript_1.default.SyntaxKind[argSource.args[0].kind]}`, parameter.node);
|
335
|
+
return;
|
336
|
+
}
|
337
|
+
switch (argSource.args[0].name.text) {
|
338
|
+
case "BODY": return handler_1.ArgSources.BODY;
|
339
|
+
case "QUERY": return handler_1.ArgSources.QUERY;
|
340
|
+
case "URL": return handler_1.ArgSources.URL;
|
341
|
+
case "DEFAULT": return getDefaultArgSource(verb);
|
342
|
+
default:
|
343
|
+
this.#diags.raise(`Unexpected ArgSource argument: ${argSource.args[0].name.text}`, parameter.node);
|
344
|
+
return;
|
345
|
+
}
|
346
|
+
function getDefaultArgSource(verb) {
|
347
|
+
switch (verb) {
|
348
|
+
case handler_1.APITypes.GET: return handler_1.ArgSources.QUERY;
|
349
|
+
case handler_1.APITypes.POST: return handler_1.ArgSources.BODY;
|
350
|
+
}
|
351
|
+
}
|
352
|
+
}
|
353
|
+
getParamName(parameter) {
|
354
|
+
const argName = this.getDBOSDecorator(parameter, 'ArgName');
|
355
|
+
if (!argName)
|
356
|
+
return parameter.name;
|
357
|
+
const nameParam = argName.args[0];
|
358
|
+
if (nameParam && typescript_1.default.isStringLiteral(nameParam))
|
359
|
+
return nameParam.text;
|
360
|
+
this.#diags.raise(`Unexpected ArgName argument type: ${typescript_1.default.SyntaxKind[nameParam.kind]}`, parameter.node);
|
361
|
+
}
|
362
|
+
mapSchema(schema) {
|
363
|
+
if (Array.isArray(schema.type)) {
|
364
|
+
this.#diags.raise(`OpenApi 3.0.x doesn't support type arrays: ${JSON.stringify(schema.type)}`);
|
365
|
+
return;
|
366
|
+
}
|
367
|
+
if (schema.$ref) {
|
368
|
+
const $ref = schema.$ref.replace("#/definitions/", "#/components/schemas/");
|
369
|
+
return { $ref };
|
370
|
+
}
|
371
|
+
const [maximum, exclusiveMaximum] = getMaxes();
|
372
|
+
const [minimum, exclusiveMinimum] = getMins();
|
373
|
+
const base = {
|
374
|
+
title: schema.title,
|
375
|
+
multipleOf: schema.multipleOf,
|
376
|
+
maximum,
|
377
|
+
exclusiveMaximum,
|
378
|
+
minimum,
|
379
|
+
exclusiveMinimum,
|
380
|
+
maxLength: schema.maxLength,
|
381
|
+
minLength: schema.minLength,
|
382
|
+
pattern: schema.pattern,
|
383
|
+
maxItems: schema.maxItems,
|
384
|
+
minItems: schema.minItems,
|
385
|
+
uniqueItems: schema.uniqueItems,
|
386
|
+
maxProperties: schema.maxProperties,
|
387
|
+
minProperties: schema.minProperties,
|
388
|
+
required: schema.required,
|
389
|
+
enum: schema.enum,
|
390
|
+
description: schema.description,
|
391
|
+
format: schema.format,
|
392
|
+
default: schema.default,
|
393
|
+
// OpenApi 3.0.x doesn't support boolean schema types, so filter those out when mapping these fields
|
394
|
+
allOf: schema.allOf?.filter(isSchema).map(s => this.mapSchema(s)).filter(isValid),
|
395
|
+
oneOf: schema.oneOf?.filter(isSchema).map(s => this.mapSchema(s)).filter(isValid),
|
396
|
+
anyOf: schema.anyOf?.filter(isSchema).map(s => this.mapSchema(s)).filter(isValid),
|
397
|
+
not: schema.not
|
398
|
+
? isSchema(schema.not) ? this.mapSchema(schema.not) : undefined
|
399
|
+
: undefined,
|
400
|
+
properties: schema.properties
|
401
|
+
? Object.fromEntries(Object.entries(schema.properties)
|
402
|
+
.filter((entry) => isSchema(entry[1]))
|
403
|
+
.map(([name, prop]) => [name, this.mapSchema(prop)])
|
404
|
+
.filter((entry) => isValid(entry[1])))
|
405
|
+
: undefined,
|
406
|
+
additionalProperties: typeof schema.additionalProperties === 'object'
|
407
|
+
? this.mapSchema(schema.additionalProperties)
|
408
|
+
: schema.additionalProperties,
|
409
|
+
};
|
410
|
+
if (schema.type === 'array') {
|
411
|
+
if (schema.items === undefined) {
|
412
|
+
this.#diags.raise(`Array schema has no items`);
|
413
|
+
return;
|
414
|
+
}
|
415
|
+
if (Array.isArray(schema.items)) {
|
416
|
+
this.#diags.raise(`OpenApi 3.0.x doesn't support array items arrays: ${JSON.stringify(schema.items)}`);
|
417
|
+
return;
|
418
|
+
}
|
419
|
+
if (typeof schema.items === 'boolean') {
|
420
|
+
this.#diags.raise(`OpenApi 3.0.x doesn't support array items booleans: ${JSON.stringify(schema.items)}`);
|
421
|
+
return;
|
422
|
+
}
|
423
|
+
return {
|
424
|
+
type: schema.type,
|
425
|
+
items: this.mapSchema(schema.items),
|
426
|
+
...base,
|
427
|
+
};
|
428
|
+
}
|
429
|
+
return {
|
430
|
+
// OpenApi 3.0.x doesn't support null type value, so map null type to undefined and add nullable: true property
|
431
|
+
type: schema.type === 'null' ? undefined : schema.type,
|
432
|
+
...base,
|
433
|
+
nullable: schema.type === 'null' ? true : undefined,
|
434
|
+
};
|
435
|
+
function isSchema(schema) {
|
436
|
+
return typeof schema === "object";
|
437
|
+
}
|
438
|
+
// Convert JSON Schema Draft 7 (used by ts-json-schema-generator) max/min and exclusive max/min values to JSON Schema Draft 5 (used by OpenAPI).
|
439
|
+
// In Draft 5, exclusive max/min values are booleans
|
440
|
+
// In Draft 7, exclusive max/min values are numbers
|
441
|
+
function getMaxes() {
|
442
|
+
const { maximum: max, exclusiveMaximum: xMax } = schema;
|
443
|
+
if (max) {
|
444
|
+
if (xMax) {
|
445
|
+
return (xMax < max) ? [xMax, true] : [max, false];
|
446
|
+
}
|
447
|
+
else {
|
448
|
+
return [max, false];
|
449
|
+
}
|
450
|
+
}
|
451
|
+
else {
|
452
|
+
return xMax ? [xMax, true] : [undefined, undefined];
|
453
|
+
}
|
454
|
+
}
|
455
|
+
function getMins() {
|
456
|
+
const { minimum: min, exclusiveMinimum: xMin } = schema;
|
457
|
+
if (min) {
|
458
|
+
if (xMin) {
|
459
|
+
return (xMin > min) ? [xMin, true] : [min, false];
|
460
|
+
}
|
461
|
+
else {
|
462
|
+
return [min, false];
|
463
|
+
}
|
464
|
+
}
|
465
|
+
else {
|
466
|
+
return xMin ? [xMin, true] : [undefined, undefined];
|
467
|
+
}
|
468
|
+
}
|
469
|
+
}
|
470
|
+
parseStringLiteralArray(node) {
|
471
|
+
if (!node)
|
472
|
+
return undefined;
|
473
|
+
if (!typescript_1.default.isArrayLiteralExpression(node)) {
|
474
|
+
this.#diags.raise(`Expected Array Literal node, received: ${typescript_1.default.SyntaxKind[node.kind]}`, node);
|
475
|
+
return;
|
476
|
+
}
|
477
|
+
const values = new Array();
|
478
|
+
for (const exp of node.elements) {
|
479
|
+
if (typescript_1.default.isStringLiteral(exp)) {
|
480
|
+
values.push(exp.getText());
|
481
|
+
}
|
482
|
+
else {
|
483
|
+
this.#diags.raise(`Expected String Literal node, received: ${typescript_1.default.SyntaxKind[exp.kind]}`, exp);
|
484
|
+
}
|
485
|
+
}
|
486
|
+
return values;
|
487
|
+
}
|
488
|
+
parseSecurityScheme(arg) {
|
489
|
+
if (!arg)
|
490
|
+
return undefined;
|
491
|
+
if (!typescript_1.default.isObjectLiteralExpression(arg)) {
|
492
|
+
this.#diags.raise(`Expected Object Literal node, received: ${typescript_1.default.SyntaxKind[arg.kind]}`, arg);
|
493
|
+
return undefined;
|
494
|
+
}
|
495
|
+
const map = new Map();
|
496
|
+
for (const prop of arg.properties) {
|
497
|
+
if (!typescript_1.default.isPropertyAssignment(prop)) {
|
498
|
+
this.#diags.raise(`Expected Property Assignment node, received: ${typescript_1.default.SyntaxKind[prop.kind]}`, prop);
|
499
|
+
continue;
|
500
|
+
}
|
501
|
+
if (!typescript_1.default.isStringLiteral(prop.initializer)) {
|
502
|
+
this.#diags.raise(`Expected String Literal node, received: ${typescript_1.default.SyntaxKind[prop.initializer.kind]}`, prop.initializer);
|
503
|
+
continue;
|
504
|
+
}
|
505
|
+
map.set(prop.name.getText(), prop.initializer.text);
|
506
|
+
}
|
507
|
+
const type = map.get("type");
|
508
|
+
const description = map.get("description");
|
509
|
+
if (!type) {
|
510
|
+
this.#diags.raise(`missing type property`, arg);
|
511
|
+
return;
|
512
|
+
}
|
513
|
+
if (type === 'http') {
|
514
|
+
const scheme = map.get("scheme");
|
515
|
+
if (!scheme) {
|
516
|
+
this.#diags.raise(`missing scheme property`, arg);
|
517
|
+
return;
|
518
|
+
}
|
519
|
+
const bearerFormat = map.get("bearerFormat");
|
520
|
+
return { type, scheme, bearerFormat, description };
|
521
|
+
}
|
522
|
+
if (type === 'apiKey') {
|
523
|
+
const name = map.get("name");
|
524
|
+
if (!name) {
|
525
|
+
this.#diags.raise(`missing name property`, arg);
|
526
|
+
return;
|
527
|
+
}
|
528
|
+
const $in = map.get("id");
|
529
|
+
if (!$in) {
|
530
|
+
this.#diags.raise(`missing in property`, arg);
|
531
|
+
return;
|
532
|
+
}
|
533
|
+
return { type, name, in: $in, description };
|
534
|
+
}
|
535
|
+
if (type === "openIdConnect") {
|
536
|
+
const openIdConnectUrl = map.get("openIdConnectUrl");
|
537
|
+
if (!openIdConnectUrl) {
|
538
|
+
this.#diags.raise(`missing openIdConnectUrl property`, arg);
|
539
|
+
return;
|
540
|
+
}
|
541
|
+
return { type, openIdConnectUrl, description };
|
542
|
+
}
|
543
|
+
if (type === 'oauth2') {
|
544
|
+
this.#diags.raise(`OAuth2 Security Scheme not supported`, arg);
|
545
|
+
}
|
546
|
+
else {
|
547
|
+
this.#diags.raise(`unrecognized Security Scheme type ${type}`, arg);
|
548
|
+
}
|
549
|
+
return;
|
550
|
+
}
|
551
|
+
}
|
552
|
+
exports.OpenApiGenerator = OpenApiGenerator;
|
553
|
+
async function findPackageInfo(entrypoint) {
|
554
|
+
let dirname = node_path_1.default.dirname(entrypoint);
|
555
|
+
while (dirname !== '/') {
|
556
|
+
try {
|
557
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
558
|
+
const packageJson = JSON.parse(await promises_1.default.readFile(node_path_1.default.join(dirname, 'package.json'), { encoding: 'utf-8' }));
|
559
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
560
|
+
const name = packageJson.name ?? "unknown";
|
561
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
562
|
+
const version = packageJson.version;
|
563
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
564
|
+
const isPrivate = packageJson.private ?? false;
|
565
|
+
return {
|
566
|
+
name,
|
567
|
+
version: version
|
568
|
+
? version
|
569
|
+
: isPrivate ? "private" : "unknown"
|
570
|
+
};
|
571
|
+
}
|
572
|
+
catch (error) {
|
573
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
|
574
|
+
if (error.code !== 'ENOENT')
|
575
|
+
throw error;
|
576
|
+
}
|
577
|
+
dirname = node_path_1.default.dirname(dirname);
|
578
|
+
}
|
579
|
+
return { name: "unknown", version: "unknown" };
|
580
|
+
}
|
581
|
+
async function generateOpenApi(entrypoint) {
|
582
|
+
const program = typescript_1.default.createProgram([entrypoint], {});
|
583
|
+
const parser = new TypeParser_1.TypeParser(program);
|
584
|
+
const classes = parser.parse();
|
585
|
+
(0, tsDiagUtil_1.logDiagnostics)(parser.diags);
|
586
|
+
if (!classes || classes.length === 0)
|
587
|
+
return undefined;
|
588
|
+
const { name, version } = await findPackageInfo(entrypoint);
|
589
|
+
const generator = new OpenApiGenerator(program);
|
590
|
+
const openapi = generator.generate(classes, name, version);
|
591
|
+
(0, tsDiagUtil_1.logDiagnostics)(generator.diags);
|
592
|
+
return openapi;
|
593
|
+
}
|
594
|
+
exports.generateOpenApi = generateOpenApi;
|
595
|
+
//# sourceMappingURL=openApi.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"openApi.js","sourceRoot":"","sources":["../../../src/dbos-runtime/openApi.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4B;AAC5B,6CAA+F;AAC/F,mDAA6D;A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e,CAAC,UAAU,CAAC,CAAC;IAC5D,MAAM,SAAS,GAAG,IAAI,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3D,IAAA,2BAAc,EAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAChC,OAAO,OAAO,CAAC;AACjB,CAAC;AAdD,0CAcC"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import * as ts from 'typescript';
|
2
|
+
export interface DiagnosticOptions {
|
3
|
+
code?: number;
|
4
|
+
node?: ts.Node;
|
5
|
+
category?: ts.DiagnosticCategory;
|
6
|
+
}
|
7
|
+
export declare function createDiagnostic(messageText: string, options?: DiagnosticOptions): ts.Diagnostic;
|
8
|
+
export declare function diagResult<T>(value: T, diags: readonly ts.Diagnostic[]): T | undefined;
|
9
|
+
export declare function logDiagnostics(diags: readonly ts.Diagnostic[]): void;
|
10
|
+
export declare class DiagnosticsCollector {
|
11
|
+
#private;
|
12
|
+
get diags(): readonly ts.Diagnostic[];
|
13
|
+
raise(message: string, node?: ts.Node): void;
|
14
|
+
warn(message: string, node?: ts.Node): void;
|
15
|
+
}
|
16
|
+
//# sourceMappingURL=tsDiagUtil.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"tsDiagUtil.d.ts","sourceRoot":"","sources":["../../../src/dbos-runtime/tsDiagUtil.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAIjC,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC;IACf,QAAQ,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC;CAClC;AAED,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,EAAE,CAAC,UAAU,CAchG;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,UAAU,EAAE,GAAG,CAAC,GAAG,SAAS,CAEtF;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC,UAAU,EAAE,GAAG,IAAI,CAYpE;AAED,qBAAa,oBAAoB;;IAE/B,IAAI,KAAK,6BAAsD;IAE/D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,IAAI;IAI5C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,IAAI;CAG5C"}
|