@dbos-inc/dbos-sdk 0.10.7-preview → 0.10.11-preview

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. package/dist/src/dbos-executor.d.ts +1 -1
  2. package/dist/src/dbos-executor.d.ts.map +1 -1
  3. package/dist/src/testing/testing_runtime.d.ts +2 -0
  4. package/dist/src/testing/testing_runtime.d.ts.map +1 -1
  5. package/dist/src/testing/testing_runtime.js +4 -1
  6. package/dist/src/testing/testing_runtime.js.map +1 -1
  7. package/dist/tsconfig.build.tsbuildinfo +1 -1
  8. package/package.json +1 -1
  9. package/dist/packages/communicator-bcrypt/index.d.ts +0 -8
  10. package/dist/packages/communicator-bcrypt/index.d.ts.map +0 -1
  11. package/dist/packages/communicator-bcrypt/index.js +0 -43
  12. package/dist/packages/communicator-bcrypt/index.js.map +0 -1
  13. package/dist/packages/communicator-datetime/index.d.ts +0 -7
  14. package/dist/packages/communicator-datetime/index.d.ts.map +0 -1
  15. package/dist/packages/communicator-datetime/index.js +0 -35
  16. package/dist/packages/communicator-datetime/index.js.map +0 -1
  17. package/dist/packages/communicator-random/index.d.ts +0 -6
  18. package/dist/packages/communicator-random/index.d.ts.map +0 -1
  19. package/dist/packages/communicator-random/index.js +0 -26
  20. package/dist/packages/communicator-random/index.js.map +0 -1
  21. package/dist/packages/dbos-cloud/applications/delete-app.d.ts +0 -2
  22. package/dist/packages/dbos-cloud/applications/delete-app.d.ts.map +0 -1
  23. package/dist/packages/dbos-cloud/applications/delete-app.js +0 -41
  24. package/dist/packages/dbos-cloud/applications/delete-app.js.map +0 -1
  25. package/dist/packages/dbos-cloud/applications/deploy-app-code.d.ts +0 -2
  26. package/dist/packages/dbos-cloud/applications/deploy-app-code.d.ts.map +0 -1
  27. package/dist/packages/dbos-cloud/applications/deploy-app-code.js +0 -161
  28. package/dist/packages/dbos-cloud/applications/deploy-app-code.js.map +0 -1
  29. package/dist/packages/dbos-cloud/applications/get-app-info.d.ts +0 -2
  30. package/dist/packages/dbos-cloud/applications/get-app-info.d.ts.map +0 -1
  31. package/dist/packages/dbos-cloud/applications/get-app-info.js +0 -54
  32. package/dist/packages/dbos-cloud/applications/get-app-info.js.map +0 -1
  33. package/dist/packages/dbos-cloud/applications/get-app-logs.d.ts +0 -2
  34. package/dist/packages/dbos-cloud/applications/get-app-logs.d.ts.map +0 -1
  35. package/dist/packages/dbos-cloud/applications/get-app-logs.js +0 -53
  36. package/dist/packages/dbos-cloud/applications/get-app-logs.js.map +0 -1
  37. package/dist/packages/dbos-cloud/applications/index.d.ts +0 -7
  38. package/dist/packages/dbos-cloud/applications/index.d.ts.map +0 -1
  39. package/dist/packages/dbos-cloud/applications/index.js +0 -16
  40. package/dist/packages/dbos-cloud/applications/index.js.map +0 -1
  41. package/dist/packages/dbos-cloud/applications/list-apps.d.ts +0 -2
  42. package/dist/packages/dbos-cloud/applications/list-apps.d.ts.map +0 -1
  43. package/dist/packages/dbos-cloud/applications/list-apps.js +0 -54
  44. package/dist/packages/dbos-cloud/applications/list-apps.js.map +0 -1
  45. package/dist/packages/dbos-cloud/applications/register-app.d.ts +0 -2
  46. package/dist/packages/dbos-cloud/applications/register-app.d.ts.map +0 -1
  47. package/dist/packages/dbos-cloud/applications/register-app.js +0 -46
  48. package/dist/packages/dbos-cloud/applications/register-app.js.map +0 -1
  49. package/dist/packages/dbos-cloud/applications/types.d.ts +0 -9
  50. package/dist/packages/dbos-cloud/applications/types.d.ts.map +0 -1
  51. package/dist/packages/dbos-cloud/applications/types.js +0 -3
  52. package/dist/packages/dbos-cloud/applications/types.js.map +0 -1
  53. package/dist/packages/dbos-cloud/applications/update-app.d.ts +0 -2
  54. package/dist/packages/dbos-cloud/applications/update-app.d.ts.map +0 -1
  55. package/dist/packages/dbos-cloud/applications/update-app.js +0 -45
  56. package/dist/packages/dbos-cloud/applications/update-app.js.map +0 -1
  57. package/dist/packages/dbos-cloud/cli.d.ts +0 -3
  58. package/dist/packages/dbos-cloud/cli.d.ts.map +0 -1
  59. package/dist/packages/dbos-cloud/cli.js +0 -155
  60. package/dist/packages/dbos-cloud/cli.js.map +0 -1
  61. package/dist/packages/dbos-cloud/cloudutils.d.ts +0 -29
  62. package/dist/packages/dbos-cloud/cloudutils.d.ts.map +0 -1
  63. package/dist/packages/dbos-cloud/cloudutils.js +0 -140
  64. package/dist/packages/dbos-cloud/cloudutils.js.map +0 -1
  65. package/dist/packages/dbos-cloud/login.d.ts +0 -2
  66. package/dist/packages/dbos-cloud/login.d.ts.map +0 -1
  67. package/dist/packages/dbos-cloud/login.js +0 -103
  68. package/dist/packages/dbos-cloud/login.js.map +0 -1
  69. package/dist/packages/dbos-cloud/register.d.ts +0 -2
  70. package/dist/packages/dbos-cloud/register.d.ts.map +0 -1
  71. package/dist/packages/dbos-cloud/register.js +0 -75
  72. package/dist/packages/dbos-cloud/register.js.map +0 -1
  73. package/dist/packages/dbos-cloud/userdb.d.ts +0 -13
  74. package/dist/packages/dbos-cloud/userdb.d.ts.map +0 -1
  75. package/dist/packages/dbos-cloud/userdb.js +0 -153
  76. package/dist/packages/dbos-cloud/userdb.js.map +0 -1
  77. package/dist/packages/dbos-openapi/TypeParser.d.ts +0 -36
  78. package/dist/packages/dbos-openapi/TypeParser.d.ts.map +0 -1
  79. package/dist/packages/dbos-openapi/TypeParser.js +0 -162
  80. package/dist/packages/dbos-openapi/TypeParser.js.map +0 -1
  81. package/dist/packages/dbos-openapi/cli.d.ts +0 -3
  82. package/dist/packages/dbos-openapi/cli.d.ts.map +0 -1
  83. package/dist/packages/dbos-openapi/cli.js +0 -32
  84. package/dist/packages/dbos-openapi/cli.js.map +0 -1
  85. package/dist/packages/dbos-openapi/openApi.d.ts +0 -36
  86. package/dist/packages/dbos-openapi/openApi.d.ts.map +0 -1
  87. package/dist/packages/dbos-openapi/openApi.js +0 -566
  88. package/dist/packages/dbos-openapi/openApi.js.map +0 -1
  89. package/dist/packages/dbos-openapi/tests/makeProgram.d.ts +0 -3
  90. package/dist/packages/dbos-openapi/tests/makeProgram.d.ts.map +0 -1
  91. package/dist/packages/dbos-openapi/tests/makeProgram.js +0 -71
  92. package/dist/packages/dbos-openapi/tests/makeProgram.js.map +0 -1
  93. package/dist/packages/dbos-openapi/tests/openapi.test.d.ts +0 -2
  94. package/dist/packages/dbos-openapi/tests/openapi.test.d.ts.map +0 -1
  95. package/dist/packages/dbos-openapi/tests/openapi.test.js +0 -373
  96. package/dist/packages/dbos-openapi/tests/openapi.test.js.map +0 -1
  97. package/dist/packages/dbos-openapi/tsDiagUtil.d.ts +0 -16
  98. package/dist/packages/dbos-openapi/tsDiagUtil.d.ts.map +0 -1
  99. package/dist/packages/dbos-openapi/tsDiagUtil.js +0 -72
  100. package/dist/packages/dbos-openapi/tsDiagUtil.js.map +0 -1
@@ -1,103 +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.login = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
- const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
9
- const jwks_rsa_1 = __importDefault(require("jwks-rsa"));
10
- const child_process_1 = require("child_process");
11
- const fs_1 = __importDefault(require("fs"));
12
- const cloudutils_1 = require("./cloudutils");
13
- const DBOSCloudHost = process.env.DBOS_DOMAIN || "cloud.dbos.dev";
14
- const productionEnvironment = DBOSCloudHost === "cloud.dbos.dev";
15
- const Auth0Domain = productionEnvironment ? 'login.dbos.dev' : 'dbos-inc.us.auth0.com';
16
- const DBOSClientID = productionEnvironment ? '6p7Sjxf13cyLMkdwn14MxlH7JdhILled' : 'G38fLmVErczEo9ioCFjVIHea6yd0qMZu';
17
- const DBOSCloudIdentifier = 'dbos-cloud-api';
18
- const client = (0, jwks_rsa_1.default)({
19
- jwksUri: `https://${Auth0Domain}/.well-known/jwks.json`
20
- });
21
- async function getSigningKey(kid) {
22
- const key = await client.getSigningKey(kid);
23
- return key.getPublicKey();
24
- }
25
- async function verifyToken(token) {
26
- const decoded = jsonwebtoken_1.default.decode(token, { complete: true });
27
- if (!decoded || typeof decoded === 'string' || !decoded.header.kid) {
28
- throw new Error('Invalid token');
29
- }
30
- const signingKey = await getSigningKey(decoded.header.kid);
31
- return new Promise((resolve, reject) => {
32
- jsonwebtoken_1.default.verify(token, signingKey, { algorithms: ['RS256'] }, (err, verifiedToken) => {
33
- if (err) {
34
- reject(err);
35
- }
36
- else {
37
- resolve(verifiedToken);
38
- }
39
- });
40
- });
41
- }
42
- async function login(username) {
43
- const logger = (0, cloudutils_1.getLogger)();
44
- logger.info(`Please authenticate with DBOS Cloud!`);
45
- const deviceCodeRequest = {
46
- method: 'POST',
47
- url: `https://${Auth0Domain}/oauth/device/code`,
48
- headers: { 'content-type': 'application/x-www-form-urlencoded' },
49
- data: { client_id: DBOSClientID, scope: 'sub', audience: DBOSCloudIdentifier }
50
- };
51
- let deviceCodeResponse;
52
- try {
53
- const response = await axios_1.default.request(deviceCodeRequest);
54
- deviceCodeResponse = response.data;
55
- }
56
- catch (e) {
57
- e.message = `failed to log in: ${e.message}`;
58
- logger.error(e);
59
- }
60
- if (!deviceCodeResponse) {
61
- return 1;
62
- }
63
- console.log(`Login URL: ${deviceCodeResponse.verification_uri_complete}`);
64
- const tokenRequest = {
65
- method: 'POST',
66
- url: `https://${Auth0Domain}/oauth/token`,
67
- headers: { 'content-type': 'application/x-www-form-urlencoded' },
68
- data: new URLSearchParams({
69
- grant_type: 'urn:ietf:params:oauth:grant-type:device_code',
70
- device_code: deviceCodeResponse.device_code,
71
- client_id: DBOSClientID
72
- })
73
- };
74
- let tokenResponse;
75
- let elapsedTimeSec = 0;
76
- while (elapsedTimeSec < deviceCodeResponse.expires_in) {
77
- try {
78
- await (0, cloudutils_1.sleep)(deviceCodeResponse.interval * 1000);
79
- elapsedTimeSec += deviceCodeResponse.interval;
80
- const response = await axios_1.default.request(tokenRequest);
81
- tokenResponse = response.data;
82
- break;
83
- }
84
- catch (e) {
85
- logger.info(`Waiting for login...`);
86
- }
87
- }
88
- if (!tokenResponse) {
89
- return 1;
90
- }
91
- await verifyToken(tokenResponse.access_token);
92
- const credentials = {
93
- token: tokenResponse.access_token,
94
- userName: username,
95
- };
96
- (0, child_process_1.execSync)(`mkdir -p ${cloudutils_1.dbosEnvPath}`);
97
- fs_1.default.writeFileSync(`${cloudutils_1.dbosEnvPath}/credentials`, JSON.stringify(credentials), "utf-8");
98
- logger.info(`Successfully logged in as user: ${credentials.userName}`);
99
- logger.info(`You can view your credentials in: ./${cloudutils_1.dbosEnvPath}/credentials`);
100
- return 0;
101
- }
102
- exports.login = login;
103
- //# sourceMappingURL=login.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"login.js","sourceRoot":"","sources":["../../../packages/dbos-cloud/login.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,gEAA+C;AAC/C,wDAAkC;AAClC,iDAAyC;AACzC,4CAAoB;AACpB,6CAAmF;AAEnF,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,gBAAgB,CAAC;AAClE,MAAM,qBAAqB,GAAG,aAAa,KAAK,gBAAgB,CAAC;AACjE,MAAM,WAAW,GAAG,qBAAqB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,uBAAuB,CAAC;AACvF,MAAM,YAAY,GAAG,qBAAqB,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAAC,kCAAkC,CAAC;AACrH,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AAiB7C,MAAM,MAAM,GAAG,IAAA,kBAAU,EAAC;IACxB,OAAO,EAAE,WAAW,WAAW,wBAAwB;CACxD,CAAC,CAAC;AAEH,KAAK,UAAU,aAAa,CAAC,GAAW;IACtC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IAC5C,OAAO,GAAG,CAAC,YAAY,EAAE,CAAC;AAC5B,CAAC;AAED,KAAK,UAAU,WAAW,CA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AE,CAAC;QACnB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,WAAW,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;IAC9C,MAAM,WAAW,GAAyB;QACxC,KAAK,EAAE,aAAa,CAAC,YAAY;QACjC,QAAQ,EAAE,QAAQ;KACnB,CAAC;IACF,IAAA,wBAAQ,EAAC,YAAY,wBAAW,EAAE,CAAC,CAAC;IACpC,YAAE,CAAC,aAAa,CAAC,GAAG,wBAAW,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,CAAC;IACrF,MAAM,CAAC,IAAI,CAAC,mCAAmC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC;IACvE,MAAM,CAAC,IAAI,CAAC,uCAAuC,wBAAW,cAAc,CAAC,CAAC;IAC9E,OAAO,CAAC,CAAC;AACX,CAAC;AA5DD,sBA4DC"}
@@ -1,2 +0,0 @@
1
- export declare function registerUser(username: string, host: string): Promise<number>;
2
- //# sourceMappingURL=register.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../packages/dbos-cloud/register.ts"],"names":[],"mappings":"AAUA,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA2DlF"}
@@ -1,75 +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.registerUser = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
- const cloudutils_1 = require("./cloudutils");
9
- const readline_1 = __importDefault(require("readline"));
10
- const login_1 = require("./login");
11
- const rl = readline_1.default.createInterface({
12
- input: process.stdin,
13
- output: process.stdout
14
- });
15
- async function registerUser(username, host) {
16
- const logger = (0, cloudutils_1.getLogger)();
17
- let givenName = "";
18
- let familyName = "";
19
- let company = "";
20
- if (!(0, cloudutils_1.credentialsExist)()) {
21
- logger.info("Welcome to DBOS Cloud!");
22
- logger.info("Before creating an account, please tell us a bit about yourself!");
23
- const prompt = (query) => new Promise((resolve) => rl.question(query, resolve));
24
- givenName = await prompt("Enter First/Given Name: ");
25
- familyName = await prompt("Enter Last/Family Name: ");
26
- company = await prompt("Enter Company: ");
27
- const exitCode = await (0, login_1.login)(username);
28
- if (exitCode !== 0) {
29
- return exitCode;
30
- }
31
- }
32
- else {
33
- const userCredentials = (0, cloudutils_1.getCloudCredentials)();
34
- if (userCredentials.userName !== username) {
35
- logger.error(`You are trying to register ${username}, but are currently logged in as ${userCredentials.userName}. Please run "npx dbos-cloud logout".`);
36
- return 1;
37
- }
38
- else {
39
- logger.info(`You are currently logged in as ${userCredentials.userName}. Registering ${userCredentials.userName} with DBOS Cloud...`);
40
- }
41
- }
42
- const userCredentials = (0, cloudutils_1.getCloudCredentials)();
43
- const bearerToken = "Bearer " + userCredentials.token;
44
- const loginName = userCredentials.userName;
45
- try {
46
- // First, register the user.
47
- const register = await axios_1.default.put(`https://${host}/v1alpha1/user`, {
48
- name: loginName,
49
- given_name: givenName,
50
- family_name: familyName,
51
- company: company,
52
- }, {
53
- headers: {
54
- "Content-Type": "application/json",
55
- Authorization: bearerToken,
56
- },
57
- });
58
- const userUUID = register.data;
59
- logger.info(`Registered user ${loginName}, UUID: ${userUUID}`);
60
- }
61
- catch (e) {
62
- const errorLabel = `Failed to register user ${loginName}`;
63
- const axiosError = e;
64
- if ((0, cloudutils_1.isCloudAPIErrorResponse)(axiosError.response?.data)) {
65
- (0, cloudutils_1.handleAPIErrors)(errorLabel, axiosError);
66
- }
67
- else {
68
- logger.error(`${errorLabel}: ${e.message}`);
69
- }
70
- return 1;
71
- }
72
- return 0;
73
- }
74
- exports.registerUser = registerUser;
75
- //# sourceMappingURL=register.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../packages/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CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AA3DD,oCA2DC"}
@@ -1,13 +0,0 @@
1
- export interface UserDBInstance {
2
- readonly PostgresInstanceName: string;
3
- readonly Status: string;
4
- readonly HostName: string;
5
- readonly Port: number;
6
- readonly AdminUsername: string;
7
- }
8
- export declare function createUserDb(host: string, dbName: string, adminName: string, adminPassword: string, sync: boolean): Promise<1 | 0>;
9
- export declare function deleteUserDb(host: string, dbName: string): Promise<1 | 0>;
10
- export declare function getUserDb(host: string, dbName: string, json: boolean): Promise<1 | 0>;
11
- export declare function listUserDB(host: string, json: boolean): Promise<1 | 0>;
12
- export declare function getUserDBInfo(host: string, dbName: string): Promise<UserDBInstance>;
13
- //# sourceMappingURL=userdb.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"userdb.d.ts","sourceRoot":"","sources":["../../../packages/dbos-cloud/userdb.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,kBAuCvH;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAwB9D;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,kBAyB1E;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,kBAqC3D;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAYzF"}
@@ -1,153 +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.getUserDBInfo = exports.listUserDB = exports.getUserDb = exports.deleteUserDb = exports.createUserDb = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
- const cloudutils_1 = require("./cloudutils");
9
- const utils_1 = require("../../src/utils");
10
- async function createUserDb(host, dbName, adminName, adminPassword, sync) {
11
- const logger = (0, cloudutils_1.getLogger)();
12
- const userCredentials = (0, cloudutils_1.getCloudCredentials)();
13
- const bearerToken = "Bearer " + userCredentials.token;
14
- try {
15
- await axios_1.default.post(`https://${host}/v1alpha1/${userCredentials.userName}/databases/userdb`, { Name: dbName, AdminName: adminName, AdminPassword: adminPassword }, {
16
- headers: {
17
- "Content-Type": "application/json",
18
- Authorization: bearerToken,
19
- },
20
- });
21
- logger.info(`Successfully started creating database: ${dbName}`);
22
- if (sync) {
23
- let status = "";
24
- while (status != "available" && status != "backing-up") {
25
- await (0, utils_1.sleep)(30000);
26
- const userDBInfo = await getUserDBInfo(host, dbName);
27
- logger.info(userDBInfo);
28
- status = userDBInfo.Status;
29
- }
30
- }
31
- return 0;
32
- }
33
- catch (e) {
34
- const errorLabel = `Failed to create database ${dbName}`;
35
- const axiosError = e;
36
- if ((0, cloudutils_1.isCloudAPIErrorResponse)(axiosError.response?.data)) {
37
- (0, cloudutils_1.handleAPIErrors)(errorLabel, axiosError);
38
- }
39
- else {
40
- logger.error(`${errorLabel}: ${e.message}`);
41
- }
42
- return 1;
43
- }
44
- }
45
- exports.createUserDb = createUserDb;
46
- async function deleteUserDb(host, dbName) {
47
- const logger = (0, cloudutils_1.getLogger)();
48
- const userCredentials = (0, cloudutils_1.getCloudCredentials)();
49
- const bearerToken = "Bearer " + userCredentials.token;
50
- try {
51
- await axios_1.default.delete(`https://${host}/v1alpha1/${userCredentials.userName}/databases/userdb/${dbName}`, {
52
- headers: {
53
- "Content-Type": "application/json",
54
- Authorization: bearerToken,
55
- },
56
- });
57
- logger.info(`Database deleted: ${dbName}`);
58
- return 0;
59
- }
60
- catch (e) {
61
- const errorLabel = `Failed to delete database ${dbName}`;
62
- const axiosError = e;
63
- if ((0, cloudutils_1.isCloudAPIErrorResponse)(axiosError.response?.data)) {
64
- (0, cloudutils_1.handleAPIErrors)(errorLabel, axiosError);
65
- }
66
- else {
67
- logger.error(`${errorLabel}: ${e.message}`);
68
- }
69
- return 1;
70
- }
71
- }
72
- exports.deleteUserDb = deleteUserDb;
73
- async function getUserDb(host, dbName, json) {
74
- const logger = (0, cloudutils_1.getLogger)();
75
- try {
76
- const userDBInfo = await getUserDBInfo(host, dbName);
77
- if (json) {
78
- console.log(JSON.stringify(userDBInfo));
79
- }
80
- else {
81
- console.log(`Postgres Instance Name: ${userDBInfo.PostgresInstanceName}`);
82
- console.log(`Status: ${userDBInfo.Status}`);
83
- console.log(`Host Name: ${userDBInfo.HostName}`);
84
- console.log(`Port: ${userDBInfo.Port}`);
85
- console.log(`Admin Username: ${userDBInfo.AdminUsername}`);
86
- }
87
- return 0;
88
- }
89
- catch (e) {
90
- const errorLabel = `Failed to retrieve database record ${dbName}`;
91
- const axiosError = e;
92
- if ((0, cloudutils_1.isCloudAPIErrorResponse)(axiosError.response?.data)) {
93
- (0, cloudutils_1.handleAPIErrors)(errorLabel, axiosError);
94
- }
95
- else {
96
- logger.error(`${errorLabel}: ${e.message}`);
97
- }
98
- return 1;
99
- }
100
- }
101
- exports.getUserDb = getUserDb;
102
- async function listUserDB(host, json) {
103
- const logger = (0, cloudutils_1.getLogger)();
104
- try {
105
- const userCredentials = (0, cloudutils_1.getCloudCredentials)();
106
- const bearerToken = "Bearer " + userCredentials.token;
107
- const res = await axios_1.default.get(`https://${host}/v1alpha1/${userCredentials.userName}/databases`, {
108
- headers: {
109
- "Content-Type": "application/json",
110
- Authorization: bearerToken,
111
- },
112
- });
113
- const userDBs = res.data;
114
- if (json) {
115
- console.log(JSON.stringify(userDBs));
116
- }
117
- else {
118
- userDBs.forEach(userDBInfo => {
119
- console.log(`Postgres Instance Name: ${userDBInfo.PostgresInstanceName}`);
120
- console.log(`Status: ${userDBInfo.Status}`);
121
- console.log(`Host Name: ${userDBInfo.HostName}`);
122
- console.log(`Port: ${userDBInfo.Port}`);
123
- console.log(`Admin Username: ${userDBInfo.AdminUsername}`);
124
- });
125
- }
126
- return 0;
127
- }
128
- catch (e) {
129
- const errorLabel = `Failed to retrieve info`;
130
- const axiosError = e;
131
- if ((0, cloudutils_1.isCloudAPIErrorResponse)(axiosError.response?.data)) {
132
- (0, cloudutils_1.handleAPIErrors)(errorLabel, axiosError);
133
- }
134
- else {
135
- logger.error(`${errorLabel}: ${e.message}`);
136
- }
137
- return 1;
138
- }
139
- }
140
- exports.listUserDB = listUserDB;
141
- async function getUserDBInfo(host, dbName) {
142
- const userCredentials = (0, cloudutils_1.getCloudCredentials)();
143
- const bearerToken = "Bearer " + userCredentials.token;
144
- const res = await axios_1.default.get(`https://${host}/v1alpha1/${userCredentials.userName}/databases/userdb/info/${dbName}`, {
145
- headers: {
146
- "Content-Type": "application/json",
147
- Authorization: bearerToken,
148
- },
149
- });
150
- return res.data;
151
- }
152
- exports.getUserDBInfo = getUserDBInfo;
153
- //# sourceMappingURL=userdb.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"userdb.js","sourceRoot":"","sources":["../../../packages/dbos-cloud/userdb.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0C;AAC1C,6CAAwG;AACxG,2CAAwC;AAUjC,KAAK,UAAU,YAAY,CAAC,IAAY,EAAE,MAAc,EAAE,SAAiB,EAAE,aAAqB,EAAE,IAAa;IACtH,MAAM,MAAM,GAAG,IAAA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O,CAAC,CAAC;IACX,CAAC;AACH,CAAC;AArCD,gCAqCC;AAEM,KAAK,UAAU,aAAa,CAAC,IAAY,EAAE,MAAc;IAC9D,MAAM,eAAe,GAAG,IAAA,gCAAmB,GAAE,CAAC;IAC9C,MAAM,WAAW,GAAG,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC;IAEtD,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,WAAW,IAAI,aAAa,eAAe,CAAC,QAAQ,0BAA0B,MAAM,EAAE,EAAE;QAClH,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,WAAW;SAC3B;KACF,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC,IAAsB,CAAC;AACpC,CAAC;AAZD,sCAYC"}
@@ -1,36 +0,0 @@
1
- import ts from 'typescript';
2
- export interface ClassInfo {
3
- readonly node: ts.ClassDeclaration;
4
- readonly name?: string;
5
- readonly decorators: readonly DecoratorInfo[];
6
- readonly methods: readonly MethodInfo[];
7
- }
8
- export interface MethodInfo {
9
- readonly node: ts.MethodDeclaration;
10
- readonly name: string;
11
- readonly decorators: readonly DecoratorInfo[];
12
- readonly parameters: readonly ParameterInfo[];
13
- }
14
- export interface ParameterInfo {
15
- readonly node: ts.ParameterDeclaration;
16
- readonly name: string;
17
- readonly decorators: readonly DecoratorInfo[];
18
- readonly required: boolean;
19
- }
20
- export interface DecoratorInfo {
21
- node: ts.Decorator;
22
- args: readonly ts.Expression[];
23
- name?: string;
24
- module?: string;
25
- }
26
- export declare class TypeParser {
27
- #private;
28
- get diags(): readonly ts.Diagnostic[];
29
- constructor(program: ts.Program);
30
- parse(): readonly ClassInfo[] | undefined;
31
- }
32
- export declare function findPackageInfo(entrypoints: string[]): Promise<{
33
- name: string;
34
- version: string;
35
- }>;
36
- //# sourceMappingURL=TypeParser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TypeParser.d.ts","sourceRoot":"","sources":["../../../packages/dbos-openapi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AC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CA4BvG"}
@@ -1,162 +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.findPackageInfo = exports.TypeParser = void 0;
7
- const typescript_1 = __importDefault(require("typescript"));
8
- const tsDiagUtil_1 = require("./tsDiagUtil");
9
- const node_path_1 = __importDefault(require("node:path"));
10
- const promises_1 = __importDefault(require("node:fs/promises"));
11
- function isStaticMethod(node) {
12
- const mods = node.modifiers ?? [];
13
- return mods.some(m => m.kind === typescript_1.default.SyntaxKind.StaticKeyword);
14
- }
15
- class TypeParser {
16
- #program;
17
- #checker;
18
- #diags = new tsDiagUtil_1.DiagnosticsCollector();
19
- get diags() { return this.#diags.diags; }
20
- constructor(program) {
21
- this.#program = program;
22
- this.#checker = program.getTypeChecker();
23
- }
24
- parse() {
25
- const classes = new Array();
26
- for (const file of this.#program.getSourceFiles()) {
27
- if (file.isDeclarationFile)
28
- continue;
29
- for (const stmt of file.statements) {
30
- if (typescript_1.default.isClassDeclaration(stmt)) {
31
- const staticMethods = stmt.members
32
- .filter(typescript_1.default.isMethodDeclaration)
33
- // Only static methods are supported now, so filter out instance methods by default
34
- .filter(isStaticMethod)
35
- .map(m => this.#getMethod(m));
36
- classes.push({
37
- node: stmt,
38
- // a class may not have a name if it's the default export
39
- name: stmt.name?.getText(),
40
- decorators: this.#getDecorators(stmt),
41
- methods: staticMethods,
42
- });
43
- }
44
- }
45
- }
46
- if (classes.length === 0) {
47
- this.#diags.warn(`no classes found in ${JSON.stringify(this.#program.getRootFileNames())}`);
48
- }
49
- return (0, tsDiagUtil_1.diagResult)(classes, this.diags);
50
- }
51
- #getMethod(node) {
52
- const name = node.name.getText();
53
- const decorators = this.#getDecorators(node);
54
- const parameters = node.parameters.map(p => this.#getParameter(p));
55
- return { node, name, decorators, parameters };
56
- }
57
- #getParameter(node) {
58
- const decorators = this.#getDecorators(node);
59
- const name = node.name.getText();
60
- const required = !node.questionToken && !node.initializer;
61
- return { node, name, decorators, required };
62
- }
63
- #getImportSpecifierFromPAE(pae, checker) {
64
- const node = pae.expression;
65
- const symbol = checker.getSymbolAtLocation(node);
66
- const decls = symbol?.getDeclarations() ?? [];
67
- for (const decl of decls) {
68
- if (typescript_1.default.isNamespaceImport(decl)) {
69
- const name = pae.name;
70
- const module = decl.parent.parent.moduleSpecifier;
71
- return { name: name.getText(), module: module.text };
72
- }
73
- if (typescript_1.default.isImportClause(decl)) {
74
- const name = pae.name;
75
- const module = decl.parent.moduleSpecifier;
76
- return { name: name.getText(), module: module.text };
77
- }
78
- }
79
- return undefined;
80
- }
81
- #getDecoratorIdentifier(node) {
82
- if (typescript_1.default.isCallExpression(node.expression)) {
83
- if (typescript_1.default.isPropertyAccessExpression(node.expression.expression)) {
84
- const pae = node.expression.expression;
85
- // Let's imagine a module is the expression
86
- const { name, module } = this.#getImportSpecifierFromPAE(pae, this.#checker) ?? {};
87
- return { name, module, args: node.expression.arguments };
88
- }
89
- if (typescript_1.default.isIdentifier(node.expression.expression)) {
90
- const { name, module } = this.#getImportSpecifier(node.expression.expression, this.#checker) ?? {};
91
- return { name, module, args: node.expression.arguments };
92
- }
93
- this.#diags.raise(`Unexpected decorator CallExpression.expression type: ${typescript_1.default.SyntaxKind[node.expression.expression.kind]}`, node);
94
- }
95
- if (typescript_1.default.isIdentifier(node.expression)) {
96
- const { name, module } = this.#getImportSpecifier(node.expression, this.#checker) ?? {};
97
- return { name, module, args: [] };
98
- }
99
- this.#diags.raise(`Unexpected decorator expression type: ${typescript_1.default.SyntaxKind[node.expression.kind]}`, node);
100
- }
101
- #getImportSpecifier(node, checker) {
102
- const symbol = checker.getSymbolAtLocation(node);
103
- const decls = symbol?.getDeclarations() ?? [];
104
- for (const decl of decls) {
105
- if (typescript_1.default.isImportSpecifier(decl)) {
106
- // decl.name is the name for this type used in the local module.
107
- // If the type name was overridden in the local module, the original type name is stored in decl.propertyName.
108
- // Otherwise, decl.propertyName is undefined.
109
- const name = (decl.propertyName ?? decl.name).getText();
110
- // comment in TS AST declaration indicates moduleSpecifier *must* be a string literal
111
- // "If [ImportDeclaration.moduleSpecifier] is not a StringLiteral it will be a grammar error."
112
- const module = decl.parent.parent.parent.moduleSpecifier;
113
- return { name, module: module.text };
114
- }
115
- }
116
- return undefined;
117
- }
118
- #getDecorators(node) {
119
- return (typescript_1.default.getDecorators(node) ?? [])
120
- .map(node => {
121
- const decoratorIdentifier = this.#getDecoratorIdentifier(node);
122
- if (!decoratorIdentifier)
123
- return undefined;
124
- const { name, module, args } = decoratorIdentifier;
125
- return { node, name, module, args };
126
- })
127
- .filter((d) => !!d);
128
- }
129
- }
130
- exports.TypeParser = TypeParser;
131
- async function findPackageInfo(entrypoints) {
132
- for (const entrypoint of entrypoints) {
133
- let dirname = node_path_1.default.dirname(entrypoint);
134
- while (dirname !== '/') {
135
- try {
136
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
137
- const packageJson = JSON.parse(await promises_1.default.readFile(node_path_1.default.join(dirname, 'package.json'), { encoding: 'utf-8' }));
138
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
139
- const name = packageJson.name ?? "unknown";
140
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
141
- const version = packageJson.version;
142
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
143
- const isPrivate = packageJson.private ?? false;
144
- return {
145
- name,
146
- version: version
147
- ? version
148
- : isPrivate ? "private" : "unknown"
149
- };
150
- }
151
- catch (error) {
152
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
153
- if (error.code !== 'ENOENT')
154
- throw error;
155
- }
156
- dirname = node_path_1.default.dirname(dirname);
157
- }
158
- }
159
- return { name: "unknown", version: "unknown" };
160
- }
161
- exports.findPackageInfo = findPackageInfo;
162
- //# sourceMappingURL=TypeParser.js.map
@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ages/dbos-openapi/cli.ts"],"names":[],"mappings":""}
@@ -1,32 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const commander_1 = require("commander");
8
- const openApi_1 = require("./openApi");
9
- const yaml_1 = __importDefault(require("yaml"));
10
- const promises_1 = __importDefault(require("node:fs/promises"));
11
- const node_path_1 = __importDefault(require("node:path"));
12
- const program = new commander_1.Command();
13
- ////////////////////////
14
- /* OpenAPI */
15
- ////////////////////////
16
- program
17
- .command("generate")
18
- .argument('<entrypoint>', 'Specify the entrypoint file path')
19
- .action(async (entrypoint) => {
20
- const openapi = await (0, openApi_1.generateOpenApi)(entrypoint);
21
- if (openapi) {
22
- const filename = node_path_1.default.join(node_path_1.default.dirname(entrypoint), "openapi.yaml");
23
- const yaml = `# OpenApi specification generated for application\n\n` + yaml_1.default.stringify(openapi, { aliasDuplicateObjects: false });
24
- await promises_1.default.writeFile(filename, yaml, { encoding: 'utf-8' });
25
- }
26
- });
27
- program.parse(process.argv);
28
- // If no arguments provided, display help by default
29
- if (!process.argv.slice(2).length) {
30
- program.outputHelp();
31
- }
32
- //# sourceMappingURL=cli.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../packages/dbos-openapi/cli.ts"],"names":[],"mappings":";;;;;;AAEA,yCAAoC;AACpC,uCAA4C;AAC5C,gDAAwB;AACxB,gEAAkC;AAClC,0DAA6B;AAE7B,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,wBAAwB;AACxB,cAAc;AACd,wBAAwB;AAExB,OAAO;KACJ,OAAO,CAAC,UAAU,CAAC;KACnB,QAAQ,CAAC,cAAc,EAAE,kCAAkC,CAAC;KAC5D,MAAM,CAAC,KAAK,EAAE,UAAkB,EAAE,EAAE;IACnC,MAAM,OAAO,GAAG,MAAM,IAAA,yBAAe,EAAC,UAAU,CAAC,CAAC;IAClD,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,QAAQ,GAAG,mBAAI,CAAC,IAAI,CAAC,mBAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC,CAAC;QACrE,MAAM,IAAI,GAAG,uDAAuD,GAAG,cAAI,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,qBAAqB,EAAE,KAAK,EAAE,CAAC,CAAC;QACjI,MAAM,kBAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE5B,oDAAoD;AACpD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,OAAO,CAAC,UAAU,EAAE,CAAC;AACvB,CAAC"}