@dbos-inc/dbos-sdk 0.7.18-preview

Sign up to get free protection for your applications and to get access to all the features.
Files changed (203) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +30 -0
  3. package/dbos-config.schema.json +121 -0
  4. package/dbos-test-config.yaml +16 -0
  5. package/dist/schemas/system_db_schema.d.ts +34 -0
  6. package/dist/schemas/system_db_schema.d.ts.map +1 -0
  7. package/dist/schemas/system_db_schema.js +75 -0
  8. package/dist/schemas/system_db_schema.js.map +1 -0
  9. package/dist/schemas/user_db_schema.d.ts +11 -0
  10. package/dist/schemas/user_db_schema.d.ts.map +1 -0
  11. package/dist/schemas/user_db_schema.js +16 -0
  12. package/dist/schemas/user_db_schema.js.map +1 -0
  13. package/dist/src/cloud-cli/applications/configure.d.ts +2 -0
  14. package/dist/src/cloud-cli/applications/configure.d.ts.map +1 -0
  15. package/dist/src/cloud-cli/applications/configure.js +57 -0
  16. package/dist/src/cloud-cli/applications/configure.js.map +1 -0
  17. package/dist/src/cloud-cli/applications/delete-app.d.ts +2 -0
  18. package/dist/src/cloud-cli/applications/delete-app.d.ts.map +1 -0
  19. package/dist/src/cloud-cli/applications/delete-app.js +36 -0
  20. package/dist/src/cloud-cli/applications/delete-app.js.map +1 -0
  21. package/dist/src/cloud-cli/applications/deploy-app-code.d.ts +2 -0
  22. package/dist/src/cloud-cli/applications/deploy-app-code.d.ts.map +1 -0
  23. package/dist/src/cloud-cli/applications/deploy-app-code.js +64 -0
  24. package/dist/src/cloud-cli/applications/deploy-app-code.js.map +1 -0
  25. package/dist/src/cloud-cli/applications/get-app-logs.d.ts +2 -0
  26. package/dist/src/cloud-cli/applications/get-app-logs.d.ts.map +1 -0
  27. package/dist/src/cloud-cli/applications/get-app-logs.js +37 -0
  28. package/dist/src/cloud-cli/applications/get-app-logs.js.map +1 -0
  29. package/dist/src/cloud-cli/applications/index.d.ts +8 -0
  30. package/dist/src/cloud-cli/applications/index.d.ts.map +1 -0
  31. package/dist/src/cloud-cli/applications/index.js +18 -0
  32. package/dist/src/cloud-cli/applications/index.js.map +1 -0
  33. package/dist/src/cloud-cli/applications/list-apps.d.ts +2 -0
  34. package/dist/src/cloud-cli/applications/list-apps.d.ts.map +1 -0
  35. package/dist/src/cloud-cli/applications/list-apps.js +45 -0
  36. package/dist/src/cloud-cli/applications/list-apps.js.map +1 -0
  37. package/dist/src/cloud-cli/applications/register-app.d.ts +2 -0
  38. package/dist/src/cloud-cli/applications/register-app.d.ts.map +1 -0
  39. package/dist/src/cloud-cli/applications/register-app.js +41 -0
  40. package/dist/src/cloud-cli/applications/register-app.js.map +1 -0
  41. package/dist/src/cloud-cli/applications/types.d.ts +7 -0
  42. package/dist/src/cloud-cli/applications/types.d.ts.map +1 -0
  43. package/dist/src/cloud-cli/applications/types.js +3 -0
  44. package/dist/src/cloud-cli/applications/types.js.map +1 -0
  45. package/dist/src/cloud-cli/applications/update-app.d.ts +2 -0
  46. package/dist/src/cloud-cli/applications/update-app.d.ts.map +1 -0
  47. package/dist/src/cloud-cli/applications/update-app.js +42 -0
  48. package/dist/src/cloud-cli/applications/update-app.js.map +1 -0
  49. package/dist/src/cloud-cli/cli.d.ts +3 -0
  50. package/dist/src/cloud-cli/cli.d.ts.map +1 -0
  51. package/dist/src/cloud-cli/cli.js +148 -0
  52. package/dist/src/cloud-cli/cli.js.map +1 -0
  53. package/dist/src/cloud-cli/login.d.ts +7 -0
  54. package/dist/src/cloud-cli/login.d.ts.map +1 -0
  55. package/dist/src/cloud-cli/login.js +40 -0
  56. package/dist/src/cloud-cli/login.js.map +1 -0
  57. package/dist/src/cloud-cli/register.d.ts +2 -0
  58. package/dist/src/cloud-cli/register.d.ts.map +1 -0
  59. package/dist/src/cloud-cli/register.js +35 -0
  60. package/dist/src/cloud-cli/register.js.map +1 -0
  61. package/dist/src/cloud-cli/userdb.d.ts +4 -0
  62. package/dist/src/cloud-cli/userdb.d.ts.map +1 -0
  63. package/dist/src/cloud-cli/userdb.js +149 -0
  64. package/dist/src/cloud-cli/userdb.js.map +1 -0
  65. package/dist/src/cloud-cli/utils.d.ts +3 -0
  66. package/dist/src/cloud-cli/utils.d.ts.map +1 -0
  67. package/dist/src/cloud-cli/utils.js +17 -0
  68. package/dist/src/cloud-cli/utils.js.map +1 -0
  69. package/dist/src/communicator.d.ts +24 -0
  70. package/dist/src/communicator.d.ts.map +1 -0
  71. package/dist/src/communicator.js +26 -0
  72. package/dist/src/communicator.js.map +1 -0
  73. package/dist/src/context.d.ts +60 -0
  74. package/dist/src/context.d.ts.map +1 -0
  75. package/dist/src/context.js +94 -0
  76. package/dist/src/context.js.map +1 -0
  77. package/dist/src/data_validation.d.ts +3 -0
  78. package/dist/src/data_validation.d.ts.map +1 -0
  79. package/dist/src/data_validation.js +168 -0
  80. package/dist/src/data_validation.js.map +1 -0
  81. package/dist/src/dbos-executor.d.ts +79 -0
  82. package/dist/src/dbos-executor.d.ts.map +1 -0
  83. package/dist/src/dbos-executor.js +408 -0
  84. package/dist/src/dbos-executor.js.map +1 -0
  85. package/dist/src/dbos-runtime/TypeParser.d.ts +33 -0
  86. package/dist/src/dbos-runtime/TypeParser.d.ts.map +1 -0
  87. package/dist/src/dbos-runtime/TypeParser.js +104 -0
  88. package/dist/src/dbos-runtime/TypeParser.js.map +1 -0
  89. package/dist/src/dbos-runtime/applicationVersion.d.ts +3 -0
  90. package/dist/src/dbos-runtime/applicationVersion.d.ts.map +1 -0
  91. package/dist/src/dbos-runtime/applicationVersion.js +13 -0
  92. package/dist/src/dbos-runtime/applicationVersion.js.map +1 -0
  93. package/dist/src/dbos-runtime/cli.d.ts +8 -0
  94. package/dist/src/dbos-runtime/cli.d.ts.map +1 -0
  95. package/dist/src/dbos-runtime/cli.js +52 -0
  96. package/dist/src/dbos-runtime/cli.js.map +1 -0
  97. package/dist/src/dbos-runtime/config.d.ts +28 -0
  98. package/dist/src/dbos-runtime/config.d.ts.map +1 -0
  99. package/dist/src/dbos-runtime/config.js +111 -0
  100. package/dist/src/dbos-runtime/config.js.map +1 -0
  101. package/dist/src/dbos-runtime/init.d.ts +7 -0
  102. package/dist/src/dbos-runtime/init.d.ts.map +1 -0
  103. package/dist/src/dbos-runtime/init.js +51 -0
  104. package/dist/src/dbos-runtime/init.js.map +1 -0
  105. package/dist/src/dbos-runtime/openApi.d.ts +35 -0
  106. package/dist/src/dbos-runtime/openApi.d.ts.map +1 -0
  107. package/dist/src/dbos-runtime/openApi.js +595 -0
  108. package/dist/src/dbos-runtime/openApi.js.map +1 -0
  109. package/dist/src/dbos-runtime/runtime.d.ts +28 -0
  110. package/dist/src/dbos-runtime/runtime.d.ts.map +1 -0
  111. package/dist/src/dbos-runtime/runtime.js +96 -0
  112. package/dist/src/dbos-runtime/runtime.js.map +1 -0
  113. package/dist/src/dbos-runtime/tsDiagUtil.d.ts +16 -0
  114. package/dist/src/dbos-runtime/tsDiagUtil.d.ts.map +1 -0
  115. package/dist/src/dbos-runtime/tsDiagUtil.js +72 -0
  116. package/dist/src/dbos-runtime/tsDiagUtil.js.map +1 -0
  117. package/dist/src/decorators.d.ts +118 -0
  118. package/dist/src/decorators.d.ts.map +1 -0
  119. package/dist/src/decorators.js +467 -0
  120. package/dist/src/decorators.js.map +1 -0
  121. package/dist/src/error.d.ts +44 -0
  122. package/dist/src/error.d.ts.map +1 -0
  123. package/dist/src/error.js +164 -0
  124. package/dist/src/error.js.map +1 -0
  125. package/dist/src/httpServer/handler.d.ts +62 -0
  126. package/dist/src/httpServer/handler.d.ts.map +1 -0
  127. package/dist/src/httpServer/handler.js +168 -0
  128. package/dist/src/httpServer/handler.js.map +1 -0
  129. package/dist/src/httpServer/middleware.d.ts +56 -0
  130. package/dist/src/httpServer/middleware.d.ts.map +1 -0
  131. package/dist/src/httpServer/middleware.js +57 -0
  132. package/dist/src/httpServer/middleware.js.map +1 -0
  133. package/dist/src/httpServer/server.d.ts +40 -0
  134. package/dist/src/httpServer/server.d.ts.map +1 -0
  135. package/dist/src/httpServer/server.js +231 -0
  136. package/dist/src/httpServer/server.js.map +1 -0
  137. package/dist/src/index.d.ts +12 -0
  138. package/dist/src/index.d.ts.map +1 -0
  139. package/dist/src/index.js +75 -0
  140. package/dist/src/index.js.map +1 -0
  141. package/dist/src/provenance/provenance_daemon.d.ts +34 -0
  142. package/dist/src/provenance/provenance_daemon.d.ts.map +1 -0
  143. package/dist/src/provenance/provenance_daemon.js +86 -0
  144. package/dist/src/provenance/provenance_daemon.js.map +1 -0
  145. package/dist/src/system_database.d.ts +69 -0
  146. package/dist/src/system_database.d.ts.map +1 -0
  147. package/dist/src/system_database.js +384 -0
  148. package/dist/src/system_database.js.map +1 -0
  149. package/dist/src/telemetry/collector.d.ts +17 -0
  150. package/dist/src/telemetry/collector.d.ts.map +1 -0
  151. package/dist/src/telemetry/collector.js +77 -0
  152. package/dist/src/telemetry/collector.js.map +1 -0
  153. package/dist/src/telemetry/exporters.d.ts +29 -0
  154. package/dist/src/telemetry/exporters.d.ts.map +1 -0
  155. package/dist/src/telemetry/exporters.js +186 -0
  156. package/dist/src/telemetry/exporters.js.map +1 -0
  157. package/dist/src/telemetry/index.d.ts +7 -0
  158. package/dist/src/telemetry/index.d.ts.map +1 -0
  159. package/dist/src/telemetry/index.js +3 -0
  160. package/dist/src/telemetry/index.js.map +1 -0
  161. package/dist/src/telemetry/logs.d.ts +25 -0
  162. package/dist/src/telemetry/logs.d.ts.map +1 -0
  163. package/dist/src/telemetry/logs.js +91 -0
  164. package/dist/src/telemetry/logs.js.map +1 -0
  165. package/dist/src/telemetry/signals.d.ts +30 -0
  166. package/dist/src/telemetry/signals.d.ts.map +1 -0
  167. package/dist/src/telemetry/signals.js +11 -0
  168. package/dist/src/telemetry/signals.js.map +1 -0
  169. package/dist/src/telemetry/traces.d.ts +17 -0
  170. package/dist/src/telemetry/traces.d.ts.map +1 -0
  171. package/dist/src/telemetry/traces.js +76 -0
  172. package/dist/src/telemetry/traces.js.map +1 -0
  173. package/dist/src/testing/testing_runtime.d.ts +76 -0
  174. package/dist/src/testing/testing_runtime.d.ts.map +1 -0
  175. package/dist/src/testing/testing_runtime.js +147 -0
  176. package/dist/src/testing/testing_runtime.js.map +1 -0
  177. package/dist/src/transaction.d.ts +28 -0
  178. package/dist/src/transaction.d.ts.map +1 -0
  179. package/dist/src/transaction.js +27 -0
  180. package/dist/src/transaction.js.map +1 -0
  181. package/dist/src/user_database.d.ts +132 -0
  182. package/dist/src/user_database.d.ts.map +1 -0
  183. package/dist/src/user_database.js +324 -0
  184. package/dist/src/user_database.js.map +1 -0
  185. package/dist/src/utils.d.ts +6 -0
  186. package/dist/src/utils.d.ts.map +1 -0
  187. package/dist/src/utils.js +35 -0
  188. package/dist/src/utils.js.map +1 -0
  189. package/dist/src/workflow.d.ts +179 -0
  190. package/dist/src/workflow.d.ts.map +1 -0
  191. package/dist/src/workflow.js +446 -0
  192. package/dist/src/workflow.js.map +1 -0
  193. package/examples/hello/README.md +41 -0
  194. package/examples/hello/dbos-config.yaml +15 -0
  195. package/examples/hello/jest.config.js +8 -0
  196. package/examples/hello/knexfile.ts +23 -0
  197. package/examples/hello/migrations/create_dbos_hello_tables.ts +12 -0
  198. package/examples/hello/package.json +21 -0
  199. package/examples/hello/src/operations.test.ts +38 -0
  200. package/examples/hello/src/operations.ts +21 -0
  201. package/examples/hello/start_postgres_docker.sh +23 -0
  202. package/examples/hello/tsconfig.json +24 -0
  203. package/package.json +78 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-apps.d.ts","sourceRoot":"","sources":["../../../../src/cloud-cli/applications/list-apps.ts"],"names":[],"mappings":"AAKA,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAmC1E"}
@@ -0,0 +1,45 @@
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.listApps = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const logs_1 = require("../../telemetry/logs");
9
+ const utils_1 = require("../utils");
10
+ async function listApps(host, port) {
11
+ const logger = (0, logs_1.createGlobalLogger)();
12
+ const userCredentials = (0, utils_1.getCloudCredentials)();
13
+ const bearerToken = "Bearer " + userCredentials.token;
14
+ try {
15
+ const list = await axios_1.default.get(`http://${host}:${port}/${userCredentials.userName}/application`, {
16
+ headers: {
17
+ Authorization: bearerToken,
18
+ },
19
+ });
20
+ const data = list.data;
21
+ if (data.length === 0) {
22
+ logger.info("no application found");
23
+ return 1;
24
+ }
25
+ const formattedData = [];
26
+ for (const application of data) {
27
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
28
+ formattedData.push({ "Name": application.Name, "ID": application.ID, "Status": application.Status, "MaxVMs": application.MaxVMs });
29
+ }
30
+ console.log(JSON.stringify(formattedData));
31
+ return 0;
32
+ }
33
+ catch (e) {
34
+ if (axios_1.default.isAxiosError(e) && e.response) {
35
+ logger.error(`failed to list applications: ${e.response?.data}`);
36
+ return 1;
37
+ }
38
+ else {
39
+ logger.error(`failed to list applications: ${e.message}`);
40
+ return 1;
41
+ }
42
+ }
43
+ }
44
+ exports.listApps = listApps;
45
+ //# sourceMappingURL=list-apps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-apps.js","sourceRoot":"","sources":["../../../../src/cloud-cli/applications/list-apps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,+CAA0D;AAC1D,oCAA+C;AAGxC,KAAK,UAAU,QAAQ,CAAC,IAAY,EAAE,IAAY;IACvD,MAAM,MAAM,GAAG,IAAA,yBAAkB,GAAE,CAAC;IACpC,MAAM,eAAe,GAAG,IAAA,2BAAmB,GAAE,CAAC;IAC9C,MAAM,WAAW,GAAG,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC;IAEtD,IAAI;QACF,MAAM,IAAI,GAAG,MAAM,eAAK,CAAC,GAAG,CAC1B,UAAU,IAAI,IAAI,IAAI,IAAI,eAAe,CAAC,QAAQ,cAAc,EAChE;YACE,OAAO,EAAE;gBACP,aAAa,EAAE,WAAW;aAC3B;SACF,CACF,CAAC;QACF,MAAM,IAAI,GAAkB,IAAI,CAAC,IAAqB,CAAC;QACvD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;YACrB,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;YACpC,OAAO,CAAC,CAAC;SACV;QACD,MAAM,aAAa,GAAkB,EAAE,CAAA;QACvC,KAAK,MAAM,WAAW,IAAI,IAAI,EAAE;YAC9B,+GAA+G;YAC/G,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,EAAE,EAAE,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;SACpI;QACD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC;QAC3C,OAAO,CAAC,CAAC;KACV;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,eAAK,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;YACvC,MAAM,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;YACjE,OAAO,CAAC,CAAC;SACV;aAAM;YACL,MAAM,CAAC,KAAK,CAAC,gCAAiC,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;YACrE,OAAO,CAAC,CAAC;SACV;KACF;AACH,CAAC;AAnCD,4BAmCC"}
@@ -0,0 +1,2 @@
1
+ export declare function registerApp(appName: string, host: string, port: string, machines: number): Promise<number>;
2
+ //# sourceMappingURL=register-app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-app.d.ts","sourceRoot":"","sources":["../../../../src/cloud-cli/applications/register-app.ts"],"names":[],"mappings":"AAIA,wBAAsB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAgChH"}
@@ -0,0 +1,41 @@
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.registerApp = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const logs_1 = require("../../telemetry/logs");
9
+ const utils_1 = require("../utils");
10
+ async function registerApp(appName, host, port, machines) {
11
+ const logger = (0, logs_1.createGlobalLogger)();
12
+ const userCredentials = (0, utils_1.getCloudCredentials)();
13
+ const bearerToken = "Bearer " + userCredentials.token;
14
+ try {
15
+ const register = await axios_1.default.put(`http://${host}:${port}/${userCredentials.userName}/application`, {
16
+ name: appName,
17
+ max_vms: machines
18
+ }, {
19
+ headers: {
20
+ "Content-Type": "application/json",
21
+ Authorization: bearerToken,
22
+ },
23
+ });
24
+ const uuid = register.data;
25
+ logger.info(`Successfully registered: ${appName}`);
26
+ logger.info(`${appName} ID: ${uuid}`);
27
+ return 0;
28
+ }
29
+ catch (e) {
30
+ if (axios_1.default.isAxiosError(e) && e.response) {
31
+ logger.error(`failed to register application ${appName}: ${e.response?.data}`);
32
+ return 1;
33
+ }
34
+ else {
35
+ logger.error(`failed to register application ${appName}: ${e.message}`);
36
+ return 1;
37
+ }
38
+ }
39
+ }
40
+ exports.registerApp = registerApp;
41
+ //# sourceMappingURL=register-app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-app.js","sourceRoot":"","sources":["../../../../src/cloud-cli/applications/register-app.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,+CAA0D;AAC1D,oCAA+C;AAExC,KAAK,UAAU,WAAW,CAAC,OAAe,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":"types.d.ts","sourceRoot":"","sources":["../../../../src/cloud-cli/applications/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/cloud-cli/applications/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export declare function updateApp(appName: string, host: string, port: string, machines: number): Promise<number>;
2
+ //# sourceMappingURL=update-app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-app.d.ts","sourceRoot":"","sources":["../../../../src/cloud-cli/applications/update-app.ts"],"names":[],"mappings":"AAKA,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiC9G"}
@@ -0,0 +1,42 @@
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.updateApp = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const logs_1 = require("../../telemetry/logs");
9
+ const utils_1 = require("../utils");
10
+ async function updateApp(appName, host, port, machines) {
11
+ const logger = (0, logs_1.createGlobalLogger)();
12
+ const userCredentials = (0, utils_1.getCloudCredentials)();
13
+ const bearerToken = "Bearer " + userCredentials.token;
14
+ try {
15
+ logger.info(`Updating application ${appName} to ${machines} machines`);
16
+ const update = await axios_1.default.patch(`http://${host}:${port}/${userCredentials.userName}/application/${appName}`, {
17
+ name: appName,
18
+ max_vms: machines
19
+ }, {
20
+ headers: {
21
+ "Content-Type": "application/json",
22
+ Authorization: bearerToken,
23
+ },
24
+ });
25
+ const application = update.data;
26
+ logger.info(`Successfully updated: ${application.Name}`);
27
+ console.log(JSON.stringify({ "Name": application.Name, "ID": application.ID, "Status": application.Status, "MaxVMs": application.MaxVMs }));
28
+ return 0;
29
+ }
30
+ catch (e) {
31
+ if (axios_1.default.isAxiosError(e) && e.response) {
32
+ logger.error(`failed to update application ${appName}: ${e.response?.data}`);
33
+ return 1;
34
+ }
35
+ else {
36
+ logger.error(`failed to update application ${appName}: ${e.message}`);
37
+ return 1;
38
+ }
39
+ }
40
+ }
41
+ exports.updateApp = updateApp;
42
+ //# sourceMappingURL=update-app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-app.js","sourceRoot":"","sources":["../../../../src/cloud-cli/applications/update-app.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,+CAA0D;AAC1D,oCAA+C;AAGxC,KAAK,UAAU,SAAS,CAAC,OAAe,EAAE,IAAY,EAAE,IAAY,EAAE,QAAgB;IAC3F,MAAM,MAAM,GAAG,IAAA,yBAAkB,GAAE,CAAC;IACpC,MAAM,eAAe,GAAG,IAAA,2BAAmB,GAAE,CAAC;IAC9C,MAAM,WAAW,GAAG,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC;IAEtD,IAAI;QACF,MAAM,CAAC,IAAI,CAAC,wBAAwB,OAAO,OAAO,QAAQ,WAAW,CAAC,CAAC;QACvE,MAAM,MAAM,GAAG,MAAM,eAAK,CAAC,KAAK,CAC9B,UAAU,IAAI,IAAI,IAAI,IAAI,eAAe,CAAC,QAAQ,gBAAgB,OAAO,EAAE,EAC3E;YACE,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,QAAQ;SAClB,EACD;YACE,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,aAAa,EAAE,WAAW;aAC3B;SACF,CACF,CAAC;QACF,MAAM,WAAW,GAAgB,MAAM,CAAC,IAAmB,CAAC;QAC5D,MAAM,CAAC,IAAI,CAAC,yBAAyB,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;QACzD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,EAAE,EAAE,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAC5I,OAAO,CAAC,CAAC;KACV;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,eAAK,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;YACvC,MAAM,CAAC,KAAK,CAAC,gCAAgC,OAAO,KAAK,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;YAC7E,OAAO,CAAC,CAAC;SACV;aAAM;YACL,MAAM,CAAC,KAAK,CAAC,gCAAgC,OAAO,KAAM,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;YACjF,OAAO,CAAC,CAAC;SACV;KACF;AACH,CAAC;AAjCD,8BAiCC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/cloud-cli/cli.ts"],"names":[],"mappings":""}
@@ -0,0 +1,148 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const applications_1 = require("./applications/");
5
+ const commander_1 = require("commander");
6
+ const login_1 = require("./login");
7
+ const register_1 = require("./register");
8
+ const userdb_1 = require("./userdb");
9
+ const program = new commander_1.Command();
10
+ const DEFAULT_HOST = "localhost";
11
+ const DEFAULT_PORT = "8080";
12
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
13
+ const packageJson = require('../../../package.json');
14
+ program.
15
+ version(packageJson.version);
16
+ /////////////////////
17
+ /* AUTHENTICATION */
18
+ /////////////////////
19
+ program
20
+ .command('login')
21
+ .description('Log in to DBOS cloud')
22
+ .requiredOption('-u, --userName <string>', 'User name for login')
23
+ .action((options) => {
24
+ (0, login_1.login)(options.userName);
25
+ });
26
+ program
27
+ .command('register')
28
+ .description('Register a user and log in to DBOS cloud')
29
+ .requiredOption('-u, --userName <string>', 'User name')
30
+ .option('-h, --host <string>', 'Specify the host', DEFAULT_HOST)
31
+ .option('-p, --port <string>', 'Specify the port', DEFAULT_PORT)
32
+ .action(async (options) => {
33
+ const success = await (0, register_1.registerUser)(options.userName, options.host, options.port);
34
+ // Then, log in as the user.
35
+ if (success) {
36
+ (0, login_1.login)(options.userName);
37
+ }
38
+ });
39
+ /////////////////////////////
40
+ /* APPLICATIONS MANAGEMENT */
41
+ /////////////////////////////
42
+ const applicationCommands = program
43
+ .command('applications')
44
+ .description('Manage your DBOS applications')
45
+ .option('-h, --host <string>', 'Specify the host', DEFAULT_HOST)
46
+ .option('-p, --port <string>', 'Specify the port', DEFAULT_PORT);
47
+ applicationCommands
48
+ .command('register')
49
+ .description('Register a new application')
50
+ .requiredOption('-n, --name <string>', 'Specify the app name')
51
+ .option('-m, --machines <string>', 'Number of VMs to deploy', '1')
52
+ .action(async (options) => {
53
+ const { host, port } = applicationCommands.opts();
54
+ const exitCode = await (0, applications_1.registerApp)(options.name, host, port, parseInt(options.machines));
55
+ process.exit(exitCode);
56
+ });
57
+ applicationCommands
58
+ .command('update')
59
+ .description('Update an application')
60
+ .requiredOption('-n, --name <string>', 'Specify the app name')
61
+ .requiredOption('-m, --machines <string>', 'Number of VMs to deploy')
62
+ .action(async (options) => {
63
+ const { host, port } = applicationCommands.opts();
64
+ const exitCode = await (0, applications_1.updateApp)(options.name, host, port, parseInt(options.machines));
65
+ process.exit(exitCode);
66
+ });
67
+ applicationCommands
68
+ .command('deploy')
69
+ .description('Deploy an application code to the cloud')
70
+ .requiredOption('-n, --name <string>', 'Specify the app name')
71
+ .action(async (options) => {
72
+ const { host, port } = applicationCommands.opts();
73
+ const exitCode = await (0, applications_1.deployAppCode)(options.name, host, port);
74
+ process.exit(exitCode);
75
+ });
76
+ applicationCommands
77
+ .command('delete')
78
+ .description('Delete a previously deployed application')
79
+ .requiredOption('-n, --name <string>', 'Specify the app name')
80
+ .action(async (options) => {
81
+ const { host, port } = applicationCommands.opts();
82
+ const exitCode = await (0, applications_1.deleteApp)(options.name, host, port);
83
+ process.exit(exitCode);
84
+ });
85
+ applicationCommands
86
+ .command('list')
87
+ .description('List all deployed applications')
88
+ .action(async () => {
89
+ const { host, port } = applicationCommands.opts();
90
+ const exitCode = await (0, applications_1.listApps)(host, port);
91
+ process.exit(exitCode);
92
+ });
93
+ applicationCommands
94
+ .command('logs')
95
+ .description('Print the microVM logs of a deployed application')
96
+ .requiredOption('-n, --name <string>', 'Specify the app name')
97
+ .action(async (options) => {
98
+ const { host, port } = applicationCommands.opts();
99
+ const exitCode = await (0, applications_1.getAppLogs)(options.name, host, port);
100
+ process.exit(exitCode);
101
+ });
102
+ applicationCommands
103
+ .command('configure')
104
+ .description('Configure an application to be deployed')
105
+ .option('-d, --dbname <string>', 'Specify the name of an already setup RDS user databases')
106
+ .action(async (options) => {
107
+ const { host, port } = applicationCommands.opts();
108
+ await (0, applications_1.configureApp)(host, port, options.dbname);
109
+ });
110
+ //////////////////////////////
111
+ /* USER DATABASE MANAGEMENT */
112
+ //////////////////////////////
113
+ const userdb = program
114
+ .command('userdb')
115
+ .description('Manage your databases')
116
+ .option('-h, --host <string>', 'Specify the host', DEFAULT_HOST)
117
+ .option('-p, --port <string>', 'Specify the port', DEFAULT_PORT);
118
+ userdb
119
+ .command('create')
120
+ .argument('<string>', 'database name')
121
+ .option('-a, --admin <string>', 'Specify the admin user', 'postgres')
122
+ .option('-W, --password <string>', 'Specify the admin password', 'postgres')
123
+ .option('-s, --sync', 'make synchronous call', false)
124
+ .action((async (dbname, options) => {
125
+ const { host, port } = applicationCommands.opts();
126
+ await (0, userdb_1.createUserDb)(host, port, dbname, options.admin, options.password, options.sync);
127
+ }));
128
+ userdb
129
+ .command('status')
130
+ .argument('<string>', 'database name')
131
+ .action((async (dbname) => {
132
+ const { host, port } = applicationCommands.opts();
133
+ await (0, userdb_1.getUserDb)(host, port, dbname);
134
+ }));
135
+ userdb
136
+ .command('delete')
137
+ .argument('<string>', 'database name')
138
+ .option('-s, --sync', 'make synchronous call', false)
139
+ .action((async (dbname, options) => {
140
+ const { host, port } = applicationCommands.opts();
141
+ await (0, userdb_1.deleteUserDb)(host, port, dbname, options.sync);
142
+ }));
143
+ program.parse(process.argv);
144
+ // If no arguments provided, display help by default
145
+ if (!process.argv.slice(2).length) {
146
+ program.outputHelp();
147
+ }
148
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../src/cloud-cli/cli.ts"],"names":[],"mappings":";;;AAEA,kDAQyB;AACzB,yCAAoC;AACpC,mCAAgC;AAChC,yCAA0C;AAC1C,qCAAiE;AAEjE,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,MAAM,YAAY,GAAG,WAAW,CAAA;AAChC,MAAM,YAAY,GAAG,MAAM,CAAA;AAE3B,8DAA8D;AAC9D,MAAM,WAAW,GAAG,OAAO,CAAC,uBAAuB,CAAwB,CAAC;AAC5E,OAAO;IACL,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;AAE/B,qBAAqB;AACrB,qBAAqB;AACrB,qBAAqB;AAErB,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,sBAAsB,CAAC;KACnC,cAAc,CAAC,yBAAyB,EAAE,qBAAqB,CAAC;KAChE,MAAM,CAAC,CAAC,OAA6B,EAAE,EAAE;IACxC,IAAA,aAAK,EAAC,OAAO,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EAAE,MAAc,EAAE,EAAE;IAChC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAmC,mBAAmB,CAAC,IAAI,EAAE,CAAA;IACjF,MAAM,IAAA,kBAAS,EAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;AACrC,CAAC,CAAC,CAAC,CAAA;AAEL,MAAM;KACH,OAAO,CAAC,QAAQ,CAAC;KACjB,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC;KACrC,MAAM,CAAC,YAAY,EAAE,uBAAuB,EAAE,KAAK,CAAC;KACpD,MAAM,CAAC,CAAC,KAAK,EAAE,MAAc,EAAE,OAA0B,EAAE,EAAE;IAC5D,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAmC,mBAAmB,CAAC,IAAI,EAAE,CAAA;IACjF,MAAM,IAAA,qBAAY,EAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;AACtD,CAAC,CAAC,CAAC,CAAA;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;IACjC,OAAO,CAAC,UAAU,EAAE,CAAC;CACtB"}
@@ -0,0 +1,7 @@
1
+ export declare const dbosEnvPath = ".dbos";
2
+ export interface DBOSCloudCredentials {
3
+ token: string;
4
+ userName: string;
5
+ }
6
+ export declare function login(userName: string): void;
7
+ //# sourceMappingURL=login.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/cloud-cli/login.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW,UAAU,CAAC;AAGnC,MAAM,WAAW,oBAAoB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CACjB;AAUD,wBAAgB,KAAK,CAAE,QAAQ,EAAE,MAAM,QA8BtC"}
@@ -0,0 +1,40 @@
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 = exports.dbosEnvPath = void 0;
7
+ const child_process_1 = require("child_process");
8
+ const jwt_simple_1 = require("jwt-simple");
9
+ const logs_1 = require("../telemetry/logs");
10
+ const fs_1 = __importDefault(require("fs"));
11
+ exports.dbosEnvPath = ".dbos";
12
+ const secretKey = "SOME SECRET";
13
+ function login(userName) {
14
+ const logger = (0, logs_1.createGlobalLogger)();
15
+ // TODO: in the future, we should integrate with Okta for login.
16
+ // Generate a valid JWT token based on the userName and store it in the `./.dbos/credentials` file.
17
+ // Then the deploy command can retrieve the token from this file.
18
+ logger.info(`Logging in as user: ${userName}`);
19
+ const algorithm = "HS256";
20
+ const issued = Date.now();
21
+ const expires = issued + 1000; // Expires after 1 sec.
22
+ const session = {
23
+ id: 1,
24
+ dateCreated: Date.now(),
25
+ username: userName,
26
+ issued: issued,
27
+ expires: expires
28
+ };
29
+ const token = (0, jwt_simple_1.encode)(session, secretKey, algorithm);
30
+ const credentials = {
31
+ token,
32
+ userName,
33
+ };
34
+ (0, child_process_1.execSync)(`mkdir -p ${exports.dbosEnvPath}`);
35
+ fs_1.default.writeFileSync(`${exports.dbosEnvPath}/credentials`, JSON.stringify(credentials), "utf-8");
36
+ logger.info(`Successfully logged in as user: ${userName}`);
37
+ logger.info(`You can view your credentials in: ./${exports.dbosEnvPath}/credentials`);
38
+ }
39
+ exports.login = login;
40
+ //# sourceMappingURL=login.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/cloud-cli/login.ts"],"names":[],"mappings":";;;;;;AAAA,iDAAyC;AACzC,2CAAgD;AAChD,4CAAuD;AACvD,4CAAoB;AAEP,QAAA,WAAW,GAAG,OAAO,CAAC;AACnC,MAAM,SAAS,GAAG,aAAa,CAAC;AAehC,SAAgB,KAAK,CAAE,QAAgB;IACrC,MAAM,MAAM,GAAG,IAAA,yBAAkB,GAAE,CAAC;IACpC,gEAAgE;IAChE,mGAAmG;IACnG,iEAAiE;IACjE,MAAM,CAAC,IAAI,CAAC,uBAAuB,QAAQ,EAAE,CAAC,CAAC;IAE/C,MAAM,SAAS,GAAe,OAAO,CAAC;IACtC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC1B,MAAM,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC,uBAAuB;IACtD,MAAM,OAAO,GAAY;QACvB,EAAE,EAAE,CAAC;QACL,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE;QACvB,QAAQ,EAAE,QAAQ;QAClB,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,OAAO;KACjB,CAAC;IAEF,MAAM,KAAK,GAAG,IAAA,mBAAM,EAAC,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IAEpD,MAAM,WAAW,GAAyB;QACxC,KAAK;QACL,QAAQ;KACT,CAAA;IAED,IAAA,wBAAQ,EAAC,YAAY,mBAAW,EAAE,CAAC,CAAC;IACpC,YAAE,CAAC,aAAa,CAAC,GAAG,mBAAW,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,CAAC;IAErF,MAAM,CAAC,IAAI,CAAC,mCAAmC,QAAQ,EAAE,CAAC,CAAC;IAC3D,MAAM,CAAC,IAAI,CAAC,uCAAuC,mBAAW,cAAc,CAAC,CAAC;AAChF,CAAC;AA9BD,sBA8BC"}
@@ -0,0 +1,2 @@
1
+ export declare function registerUser(userName: string, host: string, port: string): Promise<boolean>;
2
+ //# sourceMappingURL=register.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/cloud-cli/register.ts"],"names":[],"mappings":"AAGA,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,oBA0B9E"}
@@ -0,0 +1,35 @@
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 logs_1 = require("../telemetry/logs");
9
+ async function registerUser(userName, host, port) {
10
+ const logger = (0, logs_1.createGlobalLogger)();
11
+ try {
12
+ // First, register the user.
13
+ const register = await axios_1.default.put(`http://${host}:${port}/user`, {
14
+ name: userName,
15
+ }, {
16
+ headers: {
17
+ "Content-Type": "application/json",
18
+ },
19
+ });
20
+ const userUUID = register.data;
21
+ logger.info(`Registered user ${userName}, UUID: ${userUUID}`);
22
+ }
23
+ catch (e) {
24
+ if (axios_1.default.isAxiosError(e) && e.response) {
25
+ logger.error(`failed to register user ${userName}: ${e.response.data}`);
26
+ }
27
+ else {
28
+ logger.error(`failed to register user ${userName}: ${e.message}`);
29
+ }
30
+ return false;
31
+ }
32
+ return true;
33
+ }
34
+ exports.registerUser = registerUser;
35
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/cloud-cli/register.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,4CAAuD;AAEhD,KAAK,UAAU,YAAY,CAAC,QAAgB,EAAE,IAAY,EAAE,IAAY;IAC7E,MAAM,MAAM,GAAG,IAAA,yBAAkB,GAAE,CAAC;IACpC,IAAI;QACF,4BAA4B;QAC5B,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,GAAG,CAC9B,UAAU,IAAI,IAAI,IAAI,OAAO,EAC7B;YACE,IAAI,EAAE,QAAQ;SACf,EACD;YACE,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;SACF,CACF,CAAC;QACF,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAc,CAAC;QACzC,MAAM,CAAC,IAAI,CAAC,mBAAmB,QAAQ,WAAW,QAAQ,EAAE,CAAC,CAAC;KAC/D;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,eAAK,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;YACvC,MAAM,CAAC,KAAK,CAAC,2BAA2B,QAAQ,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;SACzE;aAAM;YACL,MAAM,CAAC,KAAK,CAAC,2BAA2B,QAAQ,KAAM,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;SAC9E;QACD,OAAO,KAAK,CAAC;KACd;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AA1BD,oCA0BC"}
@@ -0,0 +1,4 @@
1
+ export declare function createUserDb(host: string, port: string, dbName: string, adminName: string, adminPassword: string, sync: boolean): Promise<void>;
2
+ export declare function deleteUserDb(host: string, port: string, dbName: string, sync: boolean): Promise<void>;
3
+ export declare function getUserDb(host: string, port: string, dbName: string): Promise<void>;
4
+ //# sourceMappingURL=userdb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userdb.d.ts","sourceRoot":"","sources":["../../../src/cloud-cli/userdb.ts"],"names":[],"mappings":"AAKA,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,iBAuDrI;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,iBAuD3F;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,iBAczE"}
@@ -0,0 +1,149 @@
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.getUserDb = exports.deleteUserDb = exports.createUserDb = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const logs_1 = require("../telemetry/logs");
9
+ const utils_1 = require("./utils");
10
+ const utils_2 = require("../utils");
11
+ async function createUserDb(host, port, dbName, adminName, adminPassword, sync) {
12
+ const logger = (0, logs_1.createGlobalLogger)();
13
+ const userCredentials = (0, utils_1.getCloudCredentials)();
14
+ const bearerToken = "Bearer " + userCredentials.token;
15
+ try {
16
+ await axios_1.default.post(`http://${host}:${port}/${userCredentials.userName}/databases/userdb`, { "Name": dbName, "AdminName": adminName, "AdminPassword": adminPassword }, {
17
+ headers: {
18
+ "Content-Type": "application/json",
19
+ Authorization: bearerToken,
20
+ },
21
+ });
22
+ logger.info(`Successfully started creating database: ${dbName}`);
23
+ if (sync) {
24
+ let status = "";
25
+ let data;
26
+ while (status != "available") {
27
+ await (0, utils_2.sleep)(60000);
28
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
29
+ data = await getDb(host, port, dbName);
30
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
31
+ logger.info(data);
32
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
33
+ status = data.Status;
34
+ }
35
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
36
+ const dbhostname = data.HostName;
37
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
38
+ const dbport = data.Port;
39
+ // Update the clouddb info record
40
+ logger.info("Saving db state to cloud db");
41
+ await axios_1.default.put(`http://${host}:${port}/${userCredentials.userName}/databases/userdb/info`,
42
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
43
+ { "Name": dbName, "Status": status, "HostName": dbhostname, "Port": dbport }, {
44
+ headers: {
45
+ "Content-Type": "application/json",
46
+ Authorization: bearerToken,
47
+ },
48
+ });
49
+ }
50
+ }
51
+ catch (e) {
52
+ if (axios_1.default.isAxiosError(e) && e.response) {
53
+ logger.error(`Error creating database ${dbName}: ${e.response?.data}`);
54
+ }
55
+ else {
56
+ logger.error(`Error creating database ${dbName}: ${e.message}`);
57
+ }
58
+ }
59
+ }
60
+ exports.createUserDb = createUserDb;
61
+ async function deleteUserDb(host, port, dbName, sync) {
62
+ const logger = (0, logs_1.createGlobalLogger)();
63
+ const userCredentials = (0, utils_1.getCloudCredentials)();
64
+ const bearerToken = "Bearer " + userCredentials.token;
65
+ try {
66
+ await axios_1.default.delete(`http://${host}:${port}/${userCredentials.userName}/databases/userdb/${dbName}`, {
67
+ headers: {
68
+ "Content-Type": "application/json",
69
+ Authorization: bearerToken,
70
+ },
71
+ });
72
+ logger.info(`Successfully started deleting database: ${dbName}`);
73
+ if (sync) {
74
+ let status = "deleting";
75
+ while (status == "deleting") {
76
+ await (0, utils_2.sleep)(60000);
77
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
78
+ let data;
79
+ try {
80
+ // HACK to exit gracefully because the get throws an exception on 500
81
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
82
+ data = await getDb(host, port, dbName);
83
+ }
84
+ catch (e) {
85
+ logger.info(`Deleted database: ${dbName}`);
86
+ break;
87
+ }
88
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
89
+ logger.info(data);
90
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
91
+ status = data.Status;
92
+ }
93
+ // Update the clouddb info record
94
+ logger.info("Saving db state to cloud db");
95
+ await axios_1.default.put(`http://${host}:${port}/${userCredentials.userName}/databases/userdb/info`, { "Name": dbName, "Status": "deleted", "HostName": "", "Port": 0 }, {
96
+ headers: {
97
+ "Content-Type": "application/json",
98
+ Authorization: bearerToken,
99
+ },
100
+ });
101
+ }
102
+ }
103
+ catch (e) {
104
+ if (axios_1.default.isAxiosError(e) && e.response) {
105
+ logger.error(`Error deleting database ${dbName}: ${e.response?.data}`);
106
+ }
107
+ else {
108
+ logger.error(`Error deleting database ${dbName}: ${e.message}`);
109
+ }
110
+ }
111
+ }
112
+ exports.deleteUserDb = deleteUserDb;
113
+ async function getUserDb(host, port, dbName) {
114
+ const logger = (0, logs_1.createGlobalLogger)();
115
+ try {
116
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
117
+ const res = await getDb(host, port, dbName);
118
+ logger.info(res);
119
+ }
120
+ catch (e) {
121
+ if (axios_1.default.isAxiosError(e) && e.response) {
122
+ logger.error(`Error getting database ${dbName}: ${e.response?.data}`);
123
+ }
124
+ else {
125
+ logger.error(`Error getting database ${dbName}: ${e.message}`);
126
+ }
127
+ }
128
+ }
129
+ exports.getUserDb = getUserDb;
130
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-explicit-any
131
+ async function getDb(host, port, dbName) {
132
+ const userCredentials = (0, utils_1.getCloudCredentials)();
133
+ const bearerToken = "Bearer " + userCredentials.token;
134
+ const res = await axios_1.default.get(`http://${host}:${port}/${userCredentials.userName}/databases/userdb/${dbName}`, {
135
+ headers: {
136
+ "Content-Type": "application/json",
137
+ Authorization: bearerToken,
138
+ },
139
+ });
140
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-enum-comparison
141
+ if (res.status == axios_1.default.HttpStatusCode.Ok) {
142
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
143
+ return res.data;
144
+ }
145
+ else {
146
+ return { "Status": "notfound" };
147
+ }
148
+ }
149
+ //# sourceMappingURL=userdb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userdb.js","sourceRoot":"","sources":["../../../src/cloud-cli/userdb.ts"],"names":[],"mappings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