@dbos-inc/dbos-sdk 0.10.7-preview → 0.10.12-preview.gd659422f8d
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/dbos-executor.d.ts +1 -1
- package/dist/src/dbos-executor.d.ts.map +1 -1
- package/dist/src/testing/testing_runtime.d.ts +2 -0
- package/dist/src/testing/testing_runtime.d.ts.map +1 -1
- package/dist/src/testing/testing_runtime.js +4 -1
- package/dist/src/testing/testing_runtime.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/examples/hello/migrations/20240212161006_create_dbos_hello_tables.js +2 -0
- package/package.json +1 -1
- package/dist/packages/communicator-bcrypt/index.d.ts +0 -8
- package/dist/packages/communicator-bcrypt/index.d.ts.map +0 -1
- package/dist/packages/communicator-bcrypt/index.js +0 -43
- package/dist/packages/communicator-bcrypt/index.js.map +0 -1
- package/dist/packages/communicator-datetime/index.d.ts +0 -7
- package/dist/packages/communicator-datetime/index.d.ts.map +0 -1
- package/dist/packages/communicator-datetime/index.js +0 -35
- package/dist/packages/communicator-datetime/index.js.map +0 -1
- package/dist/packages/communicator-random/index.d.ts +0 -6
- package/dist/packages/communicator-random/index.d.ts.map +0 -1
- package/dist/packages/communicator-random/index.js +0 -26
- package/dist/packages/communicator-random/index.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/delete-app.d.ts +0 -2
- package/dist/packages/dbos-cloud/applications/delete-app.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/delete-app.js +0 -41
- package/dist/packages/dbos-cloud/applications/delete-app.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/deploy-app-code.d.ts +0 -2
- package/dist/packages/dbos-cloud/applications/deploy-app-code.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/deploy-app-code.js +0 -161
- package/dist/packages/dbos-cloud/applications/deploy-app-code.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/get-app-info.d.ts +0 -2
- package/dist/packages/dbos-cloud/applications/get-app-info.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/get-app-info.js +0 -54
- package/dist/packages/dbos-cloud/applications/get-app-info.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/get-app-logs.d.ts +0 -2
- package/dist/packages/dbos-cloud/applications/get-app-logs.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/get-app-logs.js +0 -53
- package/dist/packages/dbos-cloud/applications/get-app-logs.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/index.d.ts +0 -7
- package/dist/packages/dbos-cloud/applications/index.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/index.js +0 -16
- package/dist/packages/dbos-cloud/applications/index.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/list-apps.d.ts +0 -2
- package/dist/packages/dbos-cloud/applications/list-apps.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/list-apps.js +0 -54
- package/dist/packages/dbos-cloud/applications/list-apps.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/register-app.d.ts +0 -2
- package/dist/packages/dbos-cloud/applications/register-app.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/register-app.js +0 -46
- package/dist/packages/dbos-cloud/applications/register-app.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/types.d.ts +0 -9
- package/dist/packages/dbos-cloud/applications/types.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/types.js +0 -3
- package/dist/packages/dbos-cloud/applications/types.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/update-app.d.ts +0 -2
- package/dist/packages/dbos-cloud/applications/update-app.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/update-app.js +0 -45
- package/dist/packages/dbos-cloud/applications/update-app.js.map +0 -1
- package/dist/packages/dbos-cloud/cli.d.ts +0 -3
- package/dist/packages/dbos-cloud/cli.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/cli.js +0 -155
- package/dist/packages/dbos-cloud/cli.js.map +0 -1
- package/dist/packages/dbos-cloud/cloudutils.d.ts +0 -29
- package/dist/packages/dbos-cloud/cloudutils.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/cloudutils.js +0 -140
- package/dist/packages/dbos-cloud/cloudutils.js.map +0 -1
- package/dist/packages/dbos-cloud/login.d.ts +0 -2
- package/dist/packages/dbos-cloud/login.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/login.js +0 -103
- package/dist/packages/dbos-cloud/login.js.map +0 -1
- package/dist/packages/dbos-cloud/register.d.ts +0 -2
- package/dist/packages/dbos-cloud/register.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/register.js +0 -75
- package/dist/packages/dbos-cloud/register.js.map +0 -1
- package/dist/packages/dbos-cloud/userdb.d.ts +0 -13
- package/dist/packages/dbos-cloud/userdb.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/userdb.js +0 -153
- package/dist/packages/dbos-cloud/userdb.js.map +0 -1
- package/dist/packages/dbos-openapi/TypeParser.d.ts +0 -36
- package/dist/packages/dbos-openapi/TypeParser.d.ts.map +0 -1
- package/dist/packages/dbos-openapi/TypeParser.js +0 -162
- package/dist/packages/dbos-openapi/TypeParser.js.map +0 -1
- package/dist/packages/dbos-openapi/cli.d.ts +0 -3
- package/dist/packages/dbos-openapi/cli.d.ts.map +0 -1
- package/dist/packages/dbos-openapi/cli.js +0 -32
- package/dist/packages/dbos-openapi/cli.js.map +0 -1
- package/dist/packages/dbos-openapi/openApi.d.ts +0 -36
- package/dist/packages/dbos-openapi/openApi.d.ts.map +0 -1
- package/dist/packages/dbos-openapi/openApi.js +0 -566
- package/dist/packages/dbos-openapi/openApi.js.map +0 -1
- package/dist/packages/dbos-openapi/tests/makeProgram.d.ts +0 -3
- package/dist/packages/dbos-openapi/tests/makeProgram.d.ts.map +0 -1
- package/dist/packages/dbos-openapi/tests/makeProgram.js +0 -71
- package/dist/packages/dbos-openapi/tests/makeProgram.js.map +0 -1
- package/dist/packages/dbos-openapi/tests/openapi.test.d.ts +0 -2
- package/dist/packages/dbos-openapi/tests/openapi.test.d.ts.map +0 -1
- package/dist/packages/dbos-openapi/tests/openapi.test.js +0 -373
- package/dist/packages/dbos-openapi/tests/openapi.test.js.map +0 -1
- package/dist/packages/dbos-openapi/tsDiagUtil.d.ts +0 -16
- package/dist/packages/dbos-openapi/tsDiagUtil.d.ts.map +0 -1
- package/dist/packages/dbos-openapi/tsDiagUtil.js +0 -72
- package/dist/packages/dbos-openapi/tsDiagUtil.js.map +0 -1
@@ -1,71 +0,0 @@
|
|
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.makeTestTypescriptProgram = void 0;
|
7
|
-
const typescript_1 = __importDefault(require("typescript"));
|
8
|
-
const node_path_1 = __importDefault(require("node:path"));
|
9
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
10
|
-
const sdkRepoRoot = node_path_1.default.join(__dirname, "../../..");
|
11
|
-
const dbosSDKModule = "node_modules/@dbos-inc/dbos-sdk/";
|
12
|
-
function readFile(fileName) {
|
13
|
-
if (fileName.startsWith(dbosSDKModule)) {
|
14
|
-
const $path = node_path_1.default.join(sdkRepoRoot, fileName.slice(dbosSDKModule.length));
|
15
|
-
return node_fs_1.default.existsSync($path) ? node_fs_1.default.readFileSync($path, "utf-8") : undefined;
|
16
|
-
}
|
17
|
-
if (fileName.startsWith("node_modules/@dbos-inc/")) {
|
18
|
-
return undefined;
|
19
|
-
}
|
20
|
-
if (fileName.startsWith("node_modules/")) {
|
21
|
-
const $path = node_path_1.default.join(sdkRepoRoot, fileName);
|
22
|
-
return node_fs_1.default.existsSync($path) ? node_fs_1.default.readFileSync($path, "utf-8") : undefined;
|
23
|
-
}
|
24
|
-
return undefined;
|
25
|
-
}
|
26
|
-
function readDirectory(directoryName) {
|
27
|
-
if (directoryName.startsWith(dbosSDKModule)) {
|
28
|
-
const $path = node_path_1.default.join(sdkRepoRoot, directoryName.slice(dbosSDKModule.length));
|
29
|
-
return node_fs_1.default.readdirSync($path, { withFileTypes: true }).filter(f => f.isDirectory()).map(f => f.name);
|
30
|
-
}
|
31
|
-
if (directoryName.startsWith("node_modules/")) {
|
32
|
-
const $path = node_path_1.default.join(sdkRepoRoot, directoryName);
|
33
|
-
return node_fs_1.default.readdirSync($path, { withFileTypes: true }).filter(f => f.isDirectory()).map(f => f.name);
|
34
|
-
}
|
35
|
-
return undefined;
|
36
|
-
}
|
37
|
-
/*
|
38
|
-
* Helper function to generate a TS program object from a string for testing TS Compiler related features
|
39
|
-
*/
|
40
|
-
function makeTestTypescriptProgram(source) {
|
41
|
-
const inputFileName = "operation.ts";
|
42
|
-
const sourceFile = typescript_1.default.createSourceFile(inputFileName, source, typescript_1.default.ScriptTarget.ESNext);
|
43
|
-
const compilerHost = {
|
44
|
-
getSourceFile: (fileName) => {
|
45
|
-
return fileName === inputFileName ? sourceFile : undefined;
|
46
|
-
},
|
47
|
-
writeFile: () => { },
|
48
|
-
getDefaultLibFileName: () => "lib.d.ts",
|
49
|
-
useCaseSensitiveFileNames: () => typescript_1.default.sys.useCaseSensitiveFileNames,
|
50
|
-
getCanonicalFileName: fileName => fileName,
|
51
|
-
getCurrentDirectory: () => "",
|
52
|
-
getNewLine: () => typescript_1.default.sys.newLine,
|
53
|
-
fileExists: (fileName) => (fileName === inputFileName)
|
54
|
-
? true
|
55
|
-
: readFile(fileName) !== undefined,
|
56
|
-
readFile,
|
57
|
-
directoryExists: (directoryName) => {
|
58
|
-
if (directoryName === "node_modules")
|
59
|
-
return true;
|
60
|
-
if (directoryName === "node_modules/@dbos-inc")
|
61
|
-
return true;
|
62
|
-
if (directoryName === "node_modules/@dbos-inc/dbos-sdk")
|
63
|
-
return true;
|
64
|
-
return readDirectory(directoryName) !== undefined;
|
65
|
-
},
|
66
|
-
getDirectories: (path) => readDirectory(path) ?? []
|
67
|
-
};
|
68
|
-
return typescript_1.default.createProgram([inputFileName], {}, compilerHost);
|
69
|
-
}
|
70
|
-
exports.makeTestTypescriptProgram = makeTestTypescriptProgram;
|
71
|
-
//# sourceMappingURL=makeProgram.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"makeProgram.js","sourceRoot":"","sources":["../../../../packages/dbos-openapi/tests/makeProgram.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4B;AAC5B,0DAA6B;AAC7B,sDAAyB;AAEzB,MAAM,WAAW,GAAG,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;AACrD,MAAM,aAAa,GAAG,kCAAkC,CAAC;AAEzD,SAAS,QAAQ,CAAC,QAAgB;IAChC,IAAI,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QACvC,MAAM,KAAK,GAAG,mBAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;QAC3E,OAAO,iBAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,iBAAE,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5E,CAAC;IACD,IAAI,QAAQ,CAAC,UAAU,CAAC,yBAAyB,CAAC,EAAE,CAAC;QACnD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,QAAQ,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;QACzC,MAAM,KAAK,GAAG,mBAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QAC/C,OAAO,iBAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,iBAAE,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5E,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,aAAa,CAAC,aAAqB;IAC1C,IAAI,aAA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C;QACpB,qBAAqB,EAAE,GAAG,EAAE,CAAC,UAAU;QACvC,yBAAyB,EAAE,GAAG,EAAE,CAAC,oBAAE,CAAC,GAAG,CAAC,yBAAyB;QACjE,oBAAoB,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ;QAC1C,mBAAmB,EAAE,GAAG,EAAE,CAAC,EAAE;QAC7B,UAAU,EAAE,GAAG,EAAE,CAAC,oBAAE,CAAC,GAAG,CAAC,OAAO;QAChC,UAAU,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,KAAK,aAAa,CAAC;YACpD,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,SAAS;QACpC,QAAQ;QACR,eAAe,EAAE,CAAC,aAAa,EAAE,EAAE;YACjC,IAAI,aAAa,KAAK,cAAc;gBAAE,OAAO,IAAI,CAAC;YAClD,IAAI,aAAa,KAAK,wBAAwB;gBAAE,OAAO,IAAI,CAAC;YAC5D,IAAI,aAAa,KAAK,iCAAiC;gBAAE,OAAO,IAAI,CAAC;YACrE,OAAO,aAAa,CAAC,aAAa,CAAC,KAAK,SAAS,CAAC;QACpD,CAAC;QACD,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE;KACpD,CAAC;IACF,OAAO,oBAAE,CAAC,aAAa,CAAC,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE,YAAY,CAAC,CAAC;AAC7D,CAAC;AA1BD,8DA0BC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"openapi.test.d.ts","sourceRoot":"","sources":["../../../../packages/dbos-openapi/tests/openapi.test.ts"],"names":[],"mappings":""}
|
@@ -1,373 +0,0 @@
|
|
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
|
-
const typescript_1 = __importDefault(require("typescript"));
|
7
|
-
const TypeParser_1 = require("../TypeParser");
|
8
|
-
const openApi_1 = require("../openApi");
|
9
|
-
const node_path_1 = __importDefault(require("node:path"));
|
10
|
-
const makeProgram_1 = require("./makeProgram");
|
11
|
-
const printer = typescript_1.default.createPrinter();
|
12
|
-
const entrypoint = node_path_1.default.join(__dirname, "../../../examples/hello/src/operations.ts");
|
13
|
-
const program = typescript_1.default.createProgram([entrypoint], {});
|
14
|
-
describe("TypeParser", () => {
|
15
|
-
it("examples/hello", () => {
|
16
|
-
const parser = new TypeParser_1.TypeParser(program);
|
17
|
-
const classes = parser.parse();
|
18
|
-
expect(parser.diags.length).toBe(0);
|
19
|
-
expect(classes).toBeDefined();
|
20
|
-
expect(classes.length).toBe(1);
|
21
|
-
const [$class] = classes;
|
22
|
-
expect($class.name).toBe("Hello");
|
23
|
-
expect($class.decorators.length).toBe(0);
|
24
|
-
expect($class.methods.length).toBe(1);
|
25
|
-
const [method] = $class.methods;
|
26
|
-
expect(method.name).toBe("helloTransaction");
|
27
|
-
expect(method.decorators.length).toBe(2);
|
28
|
-
const [dec1, dec2] = method.decorators;
|
29
|
-
expect(dec1.name).toBe("GetApi");
|
30
|
-
expect(dec1.args.length).toBe(1);
|
31
|
-
const [arg1] = dec1.args;
|
32
|
-
expect(arg1.kind).toBe(typescript_1.default.SyntaxKind.StringLiteral);
|
33
|
-
expect(arg1.text).toBe("/greeting/:user");
|
34
|
-
expect(dec2.name).toBe("Transaction");
|
35
|
-
expect(dec2.args.length).toBe(0);
|
36
|
-
expect(method.parameters.length).toBe(2);
|
37
|
-
const [param1, param2] = method.parameters;
|
38
|
-
expect(param1.name).toBe("ctxt");
|
39
|
-
expect(param1.decorators.length).toBe(0);
|
40
|
-
expect(param2.name).toBe("user");
|
41
|
-
expect(param2.decorators.length).toBe(1);
|
42
|
-
const [dec3] = param2.decorators;
|
43
|
-
expect(dec3.name).toBe("ArgSource");
|
44
|
-
const dec3param = printer.printNode(typescript_1.default.EmitHint.Unspecified, dec3.args[0], dec3.args[0].getSourceFile());
|
45
|
-
expect(dec3param).toBe("ArgSources.URL");
|
46
|
-
});
|
47
|
-
});
|
48
|
-
describe("OpenApiGenerator", () => {
|
49
|
-
it("examples/hello", () => {
|
50
|
-
const expected = {
|
51
|
-
openapi: "3.0.3",
|
52
|
-
info: {
|
53
|
-
title: "dbos-hello",
|
54
|
-
version: "0.0.1"
|
55
|
-
},
|
56
|
-
paths: {
|
57
|
-
"/greeting/{user}": {
|
58
|
-
get: {
|
59
|
-
operationId: "helloTransaction",
|
60
|
-
responses: {
|
61
|
-
"200": {
|
62
|
-
description: "Ok",
|
63
|
-
content: {
|
64
|
-
"application/json": {
|
65
|
-
schema: {
|
66
|
-
type: "string"
|
67
|
-
}
|
68
|
-
}
|
69
|
-
}
|
70
|
-
}
|
71
|
-
},
|
72
|
-
parameters: [
|
73
|
-
{
|
74
|
-
name: "user",
|
75
|
-
in: "path",
|
76
|
-
required: true,
|
77
|
-
schema: {
|
78
|
-
type: "string"
|
79
|
-
}
|
80
|
-
},
|
81
|
-
{
|
82
|
-
"$ref": "#/components/parameters/dbosWorkflowUUID"
|
83
|
-
}
|
84
|
-
]
|
85
|
-
}
|
86
|
-
}
|
87
|
-
},
|
88
|
-
components: {
|
89
|
-
schemas: {},
|
90
|
-
parameters: {
|
91
|
-
dbosWorkflowUUID: {
|
92
|
-
name: "dbos-workflowuuid",
|
93
|
-
in: "header",
|
94
|
-
required: false,
|
95
|
-
schema: {
|
96
|
-
type: "string"
|
97
|
-
}
|
98
|
-
}
|
99
|
-
}
|
100
|
-
}
|
101
|
-
};
|
102
|
-
const parser = new TypeParser_1.TypeParser(program);
|
103
|
-
const classes = parser.parse();
|
104
|
-
expect(parser.diags.length).toBe(0);
|
105
|
-
expect(classes).toBeDefined();
|
106
|
-
expect(classes.length).toBe(1);
|
107
|
-
const generator = new openApi_1.OpenApiGenerator(program);
|
108
|
-
const openApi = generator.generate(classes, "dbos-hello", "0.0.1");
|
109
|
-
expect(generator.diags.length).toBe(0);
|
110
|
-
expect(openApi).toBeDefined();
|
111
|
-
expect(openApi).toMatchObject(expected);
|
112
|
-
});
|
113
|
-
it("OpenApiSecurityScheme RequiredRole", () => {
|
114
|
-
const source = /*javascript*/ `
|
115
|
-
import { TransactionContext, Transaction, ArgSource, ArgSources, OpenApiSecurityScheme, RequiredRole } from '@dbos-inc/dbos-sdk';
|
116
|
-
import * as dbos from '@dbos-inc/dbos-sdk';
|
117
|
-
import dbossdk from '@dbos-inc/dbos-sdk';
|
118
|
-
|
119
|
-
@OpenApiSecurityScheme({ type: 'http', scheme: 'bearer' })
|
120
|
-
export class Hello {
|
121
|
-
@dbos.GetApi('/greeting/:user')
|
122
|
-
@RequiredRole(['user'])
|
123
|
-
static async helloTransaction(ctxt: HandlerContext, @dbossdk.ArgSource(ArgSources.URL) user: string): Promise<string> {
|
124
|
-
return "";
|
125
|
-
}
|
126
|
-
}
|
127
|
-
`;
|
128
|
-
const expected = {
|
129
|
-
openapi: "3.0.3",
|
130
|
-
info: {
|
131
|
-
title: "dbos-hello",
|
132
|
-
version: "0.0.1"
|
133
|
-
},
|
134
|
-
paths: {
|
135
|
-
"/greeting/{user}": {
|
136
|
-
get: {
|
137
|
-
operationId: "helloTransaction",
|
138
|
-
responses: {
|
139
|
-
200: {
|
140
|
-
description: "Ok",
|
141
|
-
content: {
|
142
|
-
"application/json": {
|
143
|
-
schema: {
|
144
|
-
type: "string"
|
145
|
-
}
|
146
|
-
}
|
147
|
-
}
|
148
|
-
}
|
149
|
-
},
|
150
|
-
parameters: [
|
151
|
-
{
|
152
|
-
name: "user",
|
153
|
-
in: "path",
|
154
|
-
required: true,
|
155
|
-
schema: {
|
156
|
-
type: "string"
|
157
|
-
}
|
158
|
-
},
|
159
|
-
{
|
160
|
-
$ref: "#/components/parameters/dbosWorkflowUUID"
|
161
|
-
}
|
162
|
-
],
|
163
|
-
security: [
|
164
|
-
{
|
165
|
-
HelloAuth: []
|
166
|
-
}
|
167
|
-
]
|
168
|
-
}
|
169
|
-
}
|
170
|
-
},
|
171
|
-
components: {
|
172
|
-
parameters: {
|
173
|
-
dbosWorkflowUUID: {
|
174
|
-
name: "dbos-workflowuuid",
|
175
|
-
in: "header",
|
176
|
-
required: false,
|
177
|
-
description: "Caller specified [workflow idempotency key](https://docs.dbos.dev/tutorials/idempotency-tutorial#setting-idempotency-keys)",
|
178
|
-
schema: {
|
179
|
-
type: "string"
|
180
|
-
}
|
181
|
-
}
|
182
|
-
},
|
183
|
-
schemas: {},
|
184
|
-
securitySchemes: {
|
185
|
-
HelloAuth: {
|
186
|
-
type: "http",
|
187
|
-
scheme: "bearer"
|
188
|
-
}
|
189
|
-
}
|
190
|
-
}
|
191
|
-
};
|
192
|
-
const program = (0, makeProgram_1.makeTestTypescriptProgram)(source);
|
193
|
-
const parser = new TypeParser_1.TypeParser(program);
|
194
|
-
const classes = parser.parse();
|
195
|
-
expect(parser.diags.length).toBe(0);
|
196
|
-
const generator = new openApi_1.OpenApiGenerator(program);
|
197
|
-
const openApi = generator.generate(classes, "dbos-hello", "0.0.1");
|
198
|
-
expect(generator.diags.length).toBe(0);
|
199
|
-
expect(openApi).toBeDefined();
|
200
|
-
expect(openApi).toMatchObject(expected);
|
201
|
-
});
|
202
|
-
it("OpenApiSecurityScheme DefaultRequiredRole", () => {
|
203
|
-
const source = /*javascript*/ `
|
204
|
-
import { TransactionContext, Transaction, GetApi, ArgSource, ArgSources, DefaultRequiredRole, OpenApiSecurityScheme } from '@dbos-inc/dbos-sdk'
|
205
|
-
|
206
|
-
@OpenApiSecurityScheme({ type: 'http', scheme: 'bearer' })
|
207
|
-
@DefaultRequiredRole(['user'])
|
208
|
-
export class Hello {
|
209
|
-
@GetApi('/greeting/:user')
|
210
|
-
static async helloTransaction(ctxt: HandlerContext, @ArgSource(ArgSources.URL) user: string): Promise<string> {
|
211
|
-
return "";
|
212
|
-
}
|
213
|
-
}
|
214
|
-
`;
|
215
|
-
const expected = {
|
216
|
-
openapi: "3.0.3",
|
217
|
-
info: {
|
218
|
-
title: "dbos-hello",
|
219
|
-
version: "0.0.1"
|
220
|
-
},
|
221
|
-
paths: {
|
222
|
-
"/greeting/{user}": {
|
223
|
-
get: {
|
224
|
-
operationId: "helloTransaction",
|
225
|
-
responses: {
|
226
|
-
200: {
|
227
|
-
description: "Ok",
|
228
|
-
content: {
|
229
|
-
"application/json": {
|
230
|
-
schema: {
|
231
|
-
type: "string"
|
232
|
-
}
|
233
|
-
}
|
234
|
-
}
|
235
|
-
}
|
236
|
-
},
|
237
|
-
parameters: [
|
238
|
-
{
|
239
|
-
name: "user",
|
240
|
-
in: "path",
|
241
|
-
required: true,
|
242
|
-
schema: {
|
243
|
-
type: "string"
|
244
|
-
}
|
245
|
-
},
|
246
|
-
{
|
247
|
-
$ref: "#/components/parameters/dbosWorkflowUUID"
|
248
|
-
}
|
249
|
-
],
|
250
|
-
security: [
|
251
|
-
{
|
252
|
-
HelloAuth: []
|
253
|
-
}
|
254
|
-
]
|
255
|
-
}
|
256
|
-
}
|
257
|
-
},
|
258
|
-
components: {
|
259
|
-
parameters: {
|
260
|
-
dbosWorkflowUUID: {
|
261
|
-
name: "dbos-workflowuuid",
|
262
|
-
in: "header",
|
263
|
-
required: false,
|
264
|
-
description: "Caller specified [workflow idempotency key](https://docs.dbos.dev/tutorials/idempotency-tutorial#setting-idempotency-keys)",
|
265
|
-
schema: {
|
266
|
-
type: "string"
|
267
|
-
}
|
268
|
-
}
|
269
|
-
},
|
270
|
-
schemas: {},
|
271
|
-
securitySchemes: {
|
272
|
-
HelloAuth: {
|
273
|
-
type: "http",
|
274
|
-
scheme: "bearer"
|
275
|
-
}
|
276
|
-
}
|
277
|
-
}
|
278
|
-
};
|
279
|
-
const program = (0, makeProgram_1.makeTestTypescriptProgram)(source);
|
280
|
-
const parser = new TypeParser_1.TypeParser(program);
|
281
|
-
const classes = parser.parse();
|
282
|
-
expect(parser.diags.length).toBe(0);
|
283
|
-
const generator = new openApi_1.OpenApiGenerator(program);
|
284
|
-
const openApi = generator.generate(classes, "dbos-hello", "0.0.1");
|
285
|
-
expect(generator.diags.length).toBe(0);
|
286
|
-
expect(openApi).toBeDefined();
|
287
|
-
expect(openApi).toMatchObject(expected);
|
288
|
-
});
|
289
|
-
it("OpenApiSecurityScheme empty RequiredRole array", () => {
|
290
|
-
const source = /*javascript*/ `
|
291
|
-
import { TransactionContext, Transaction, GetApi, ArgSource, ArgSources, OpenApiSecurityScheme, DefaultRequiredRole, RequiredRole } from '@dbos-inc/dbos-sdk'
|
292
|
-
|
293
|
-
@DefaultRequiredRole(['user'])
|
294
|
-
@OpenApiSecurityScheme({ type: 'http', scheme: 'bearer' })
|
295
|
-
export class Hello {
|
296
|
-
@GetApi('/greeting/:user')
|
297
|
-
@RequiredRole([])
|
298
|
-
static async helloTransaction(ctxt: HandlerContext, @ArgSource(ArgSources.URL) user: string): Promise<string> {
|
299
|
-
return "";
|
300
|
-
}
|
301
|
-
}
|
302
|
-
`;
|
303
|
-
const expected = {
|
304
|
-
openapi: "3.0.3",
|
305
|
-
info: {
|
306
|
-
title: "dbos-hello",
|
307
|
-
version: "0.0.1"
|
308
|
-
},
|
309
|
-
paths: {
|
310
|
-
"/greeting/{user}": {
|
311
|
-
get: {
|
312
|
-
operationId: "helloTransaction",
|
313
|
-
responses: {
|
314
|
-
200: {
|
315
|
-
description: "Ok",
|
316
|
-
content: {
|
317
|
-
"application/json": {
|
318
|
-
schema: {
|
319
|
-
type: "string"
|
320
|
-
}
|
321
|
-
}
|
322
|
-
}
|
323
|
-
}
|
324
|
-
},
|
325
|
-
parameters: [
|
326
|
-
{
|
327
|
-
name: "user",
|
328
|
-
in: "path",
|
329
|
-
required: true,
|
330
|
-
schema: {
|
331
|
-
type: "string"
|
332
|
-
}
|
333
|
-
},
|
334
|
-
{
|
335
|
-
$ref: "#/components/parameters/dbosWorkflowUUID"
|
336
|
-
}
|
337
|
-
]
|
338
|
-
}
|
339
|
-
}
|
340
|
-
},
|
341
|
-
components: {
|
342
|
-
parameters: {
|
343
|
-
dbosWorkflowUUID: {
|
344
|
-
name: "dbos-workflowuuid",
|
345
|
-
in: "header",
|
346
|
-
required: false,
|
347
|
-
description: "Caller specified [workflow idempotency key](https://docs.dbos.dev/tutorials/idempotency-tutorial#setting-idempotency-keys)",
|
348
|
-
schema: {
|
349
|
-
type: "string"
|
350
|
-
}
|
351
|
-
}
|
352
|
-
},
|
353
|
-
schemas: {},
|
354
|
-
securitySchemes: {
|
355
|
-
HelloAuth: {
|
356
|
-
type: "http",
|
357
|
-
scheme: "bearer"
|
358
|
-
}
|
359
|
-
}
|
360
|
-
}
|
361
|
-
};
|
362
|
-
const program = (0, makeProgram_1.makeTestTypescriptProgram)(source);
|
363
|
-
const parser = new TypeParser_1.TypeParser(program);
|
364
|
-
const classes = parser.parse();
|
365
|
-
expect(parser.diags.length).toBe(0);
|
366
|
-
const generator = new openApi_1.OpenApiGenerator(program);
|
367
|
-
const openApi = generator.generate(classes, "dbos-hello", "0.0.1");
|
368
|
-
expect(generator.diags.length).toBe(0);
|
369
|
-
expect(openApi).toBeDefined();
|
370
|
-
expect(openApi).toMatchObject(expected);
|
371
|
-
});
|
372
|
-
});
|
373
|
-
//# sourceMappingURL=openapi.test.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"openapi.test.js","sourceRoot":"","sources":["../../../../packages/dbos-openapi/tests/openapi.test.ts"],"names":[],"mappings":";;;;;AAAA,4DAA4B;AAC5B,8CAA2C;AAC3C,wCAA8C;AAC9C,0DAA6B;AAC7B,+CAA0D;AAE1D,MAAM,OAAO,GAAG,oBAAE,CAAC,aAAa,EAAE,CAAC;AAEnC,MAAM,UAAU,GAAG,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,2CAA2C,CAAC,CAAC;AACrF,MAAM,OAAO,GAAG,oBAAE,CAAC,aAAa,CAAC,CAAC,UAAU,CAAC,EAAE,EAAE,C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IAAI,EAAE,mBAAmB;wBACzB,EAAE,EAAE,QAAQ;wBACZ,QAAQ,EAAE,KAAK;wBACf,WAAW,EAAE,4HAA4H;wBACzI,MAAM,EAAE;4BACN,IAAI,EAAE,QAAQ;yBACf;qBACF;iBACF;gBACD,OAAO,EAAE,EAAE;gBACX,eAAe,EAAE;oBACf,SAAS,EAAE;wBACT,IAAI,EAAE,MAAM;wBACZ,MAAM,EAAE,QAAQ;qBACjB;iBACF;aACF;SACF,CAAC;QAEF,MAAM,OAAO,GAAG,IAAA,uCAAyB,EAAC,MAAM,CAAC,CAAC;QAClD,MAAM,MAAM,GAAG,IAAI,uBAAU,CAAC,OAAO,CAAC,CAAC;QACvC,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;QAC/B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpC,MAAM,SAAS,GAAG,IAAI,0BAAgB,CAAC,OAAO,CAAC,CAAC;QAChD,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,OAAQ,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;QACpE,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACvC,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;QAC9B,MAAM,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAC"}
|
@@ -1,16 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"tsDiagUtil.d.ts","sourceRoot":"","sources":["../../../packages/dbos-openapi/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"}
|
@@ -1,72 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
exports.DiagnosticsCollector = exports.logDiagnostics = exports.diagResult = exports.createDiagnostic = void 0;
|
27
|
-
const ts = __importStar(require("typescript"));
|
28
|
-
const printer = ts.createPrinter();
|
29
|
-
function createDiagnostic(messageText, options) {
|
30
|
-
const node = options?.node;
|
31
|
-
const category = options?.category ?? ts.DiagnosticCategory.Error;
|
32
|
-
const code = options?.code ?? 0;
|
33
|
-
return {
|
34
|
-
category,
|
35
|
-
code,
|
36
|
-
file: node?.getSourceFile(),
|
37
|
-
length: node?.getWidth(),
|
38
|
-
messageText,
|
39
|
-
start: node?.getStart(),
|
40
|
-
source: node ? printer.printNode(ts.EmitHint.Unspecified, node, node.getSourceFile()) : undefined,
|
41
|
-
};
|
42
|
-
}
|
43
|
-
exports.createDiagnostic = createDiagnostic;
|
44
|
-
function diagResult(value, diags) {
|
45
|
-
return diags.some(e => e.category === ts.DiagnosticCategory.Error) ? undefined : value;
|
46
|
-
}
|
47
|
-
exports.diagResult = diagResult;
|
48
|
-
function logDiagnostics(diags) {
|
49
|
-
if (diags.length > 0) {
|
50
|
-
const formatHost = {
|
51
|
-
getCurrentDirectory: () => ts.sys.getCurrentDirectory(),
|
52
|
-
getNewLine: () => ts.sys.newLine,
|
53
|
-
getCanonicalFileName: (fileName) => ts.sys.useCaseSensitiveFileNames
|
54
|
-
? fileName : fileName.toLowerCase()
|
55
|
-
};
|
56
|
-
const text = ts.formatDiagnosticsWithColorAndContext(diags, formatHost);
|
57
|
-
console.log(text);
|
58
|
-
}
|
59
|
-
}
|
60
|
-
exports.logDiagnostics = logDiagnostics;
|
61
|
-
class DiagnosticsCollector {
|
62
|
-
#diags = new Array();
|
63
|
-
get diags() { return this.#diags; }
|
64
|
-
raise(message, node) {
|
65
|
-
this.#diags.push(createDiagnostic(message, { node }));
|
66
|
-
}
|
67
|
-
warn(message, node) {
|
68
|
-
this.#diags.push(createDiagnostic(message, { node, category: ts.DiagnosticCategory.Warning }));
|
69
|
-
}
|
70
|
-
}
|
71
|
-
exports.DiagnosticsCollector = DiagnosticsCollector;
|
72
|
-
//# sourceMappingURL=tsDiagUtil.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"tsDiagUtil.js","sourceRoot":"","sources":["../../../packages/dbos-openapi/tsDiagUtil.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAEjC,MAAM,OAAO,GAAG,EAAE,CAAC,aAAa,EAAE,CAAC;AAQnC,SAAgB,gBAAgB,CAAC,WAAmB,EAAE,OAA2B;IAC/E,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,CAAC;IAC3B,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,EAAE,CAAC,k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