@dbos-inc/dbos-cloud 0.8.49-preview → 0.8.51-preview
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/applications/delete-app.ts +7 -7
- package/applications/deploy-app-code.ts +7 -7
- package/applications/get-app-logs.ts +7 -7
- package/applications/list-apps.ts +7 -7
- package/applications/register-app.ts +7 -7
- package/cloudutils.ts +17 -2
- package/dist/packages/dbos-cloud/applications/delete-app.js +4 -4
- package/dist/packages/dbos-cloud/applications/delete-app.js.map +1 -1
- package/dist/packages/dbos-cloud/applications/deploy-app-code.js +4 -4
- package/dist/packages/dbos-cloud/applications/deploy-app-code.js.map +1 -1
- package/dist/packages/dbos-cloud/applications/get-app-logs.js +4 -4
- package/dist/packages/dbos-cloud/applications/get-app-logs.js.map +1 -1
- package/dist/packages/dbos-cloud/applications/list-apps.js +4 -4
- package/dist/packages/dbos-cloud/applications/list-apps.js.map +1 -1
- package/dist/packages/dbos-cloud/applications/register-app.js +4 -4
- package/dist/packages/dbos-cloud/applications/register-app.js.map +1 -1
- package/dist/packages/dbos-cloud/cloudutils.d.ts +2 -0
- package/dist/packages/dbos-cloud/cloudutils.d.ts.map +1 -1
- package/dist/packages/dbos-cloud/cloudutils.js +9 -2
- package/dist/packages/dbos-cloud/cloudutils.js.map +1 -1
- package/dist/packages/dbos-cloud/register.d.ts.map +1 -1
- package/dist/packages/dbos-cloud/register.js +3 -2
- package/dist/packages/dbos-cloud/register.js.map +1 -1
- package/dist/packages/dbos-cloud/userdb.d.ts +3 -3
- package/dist/packages/dbos-cloud/userdb.d.ts.map +1 -1
- package/dist/packages/dbos-cloud/userdb.js +12 -6
- package/dist/packages/dbos-cloud/userdb.js.map +1 -1
- package/package.json +3 -2
- package/register.ts +6 -5
- package/userdb.ts +17 -11
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import { getCloudCredentials, getLogger } from "../cloudutils";
|
|
1
|
+
import axios, { AxiosError } from "axios";
|
|
2
|
+
import { handleAPIErrors, getCloudCredentials, getLogger } from "../cloudutils";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
|
|
5
5
|
export async function deleteApp(host: string): Promise<number> {
|
|
@@ -24,12 +24,12 @@ export async function deleteApp(host: string): Promise<number> {
|
|
|
24
24
|
logger.info(`Successfully deleted application: ${appName}`);
|
|
25
25
|
return 0;
|
|
26
26
|
} catch (e) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const errorLabel = `Failed to delete application ${appName}`;
|
|
28
|
+
if (axios.isAxiosError(e) && (e as AxiosError).response) {
|
|
29
|
+
handleAPIErrors(errorLabel, e);
|
|
30
30
|
} else {
|
|
31
|
-
logger.error(
|
|
32
|
-
return 1;
|
|
31
|
+
logger.error(`${errorLabel}: ${(e as Error).message}`);
|
|
33
32
|
}
|
|
33
|
+
return 1;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import axios from "axios";
|
|
1
|
+
import axios, { AxiosError } from "axios";
|
|
2
2
|
import { execSync } from "child_process";
|
|
3
3
|
import { writeFileSync, existsSync } from 'fs';
|
|
4
|
-
import { createDirectory, dbosConfigFilePath, getCloudCredentials, getLogger, readFileSync, runCommand, sleep } from "../cloudutils";
|
|
4
|
+
import { handleAPIErrors, createDirectory, dbosConfigFilePath, getCloudCredentials, getLogger, readFileSync, runCommand, sleep } from "../cloudutils";
|
|
5
5
|
import path from "path";
|
|
6
6
|
import { Application } from "./types";
|
|
7
7
|
|
|
@@ -103,13 +103,13 @@ export async function deployAppCode(host: string, docker: boolean): Promise<numb
|
|
|
103
103
|
logger.info(`Access your application at https://${host}/${userCredentials.userName}/application/${appName}`)
|
|
104
104
|
return 0;
|
|
105
105
|
} catch (e) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
const errorLabel = `Failed to deploy application ${appName}`;
|
|
107
|
+
if (axios.isAxiosError(e) && (e as AxiosError).response) {
|
|
108
|
+
handleAPIErrors(errorLabel, e);
|
|
109
109
|
} else {
|
|
110
|
-
logger.error(
|
|
111
|
-
return 1;
|
|
110
|
+
logger.error(`${errorLabel}: ${(e as Error).message}`);
|
|
112
111
|
}
|
|
112
|
+
return 1;
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import { getCloudCredentials, getLogger } from "../cloudutils";
|
|
1
|
+
import axios , { AxiosError } from "axios";
|
|
2
|
+
import { handleAPIErrors, getCloudCredentials, getLogger } from "../cloudutils";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
|
|
5
5
|
export async function getAppLogs(host: string): Promise<number> {
|
|
@@ -24,12 +24,12 @@ export async function getAppLogs(host: string): Promise<number> {
|
|
|
24
24
|
logger.info(res.data)
|
|
25
25
|
return 0;
|
|
26
26
|
} catch (e) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const errorLabel = `Failed to retrieve logs of application ${appName}`;
|
|
28
|
+
if (axios.isAxiosError(e) && (e as AxiosError).response) {
|
|
29
|
+
handleAPIErrors(errorLabel, e);
|
|
30
30
|
} else {
|
|
31
|
-
logger.error(
|
|
32
|
-
return 1;
|
|
31
|
+
logger.error(`${errorLabel}: ${(e as Error).message}`);
|
|
33
32
|
}
|
|
33
|
+
return 1;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import { getCloudCredentials, getLogger } from "../cloudutils";
|
|
1
|
+
import axios, { AxiosError } from "axios";
|
|
2
|
+
import { handleAPIErrors, getCloudCredentials, getLogger } from "../cloudutils";
|
|
3
3
|
import { Application } from "./types";
|
|
4
4
|
|
|
5
5
|
export async function listApps(host: string, json: boolean): Promise<number> {
|
|
@@ -36,12 +36,12 @@ export async function listApps(host: string, json: boolean): Promise<number> {
|
|
|
36
36
|
}
|
|
37
37
|
return 0;
|
|
38
38
|
} catch (e) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const errorLabel = 'Failed to list applications';
|
|
40
|
+
if (axios.isAxiosError(e) && (e as AxiosError).response) {
|
|
41
|
+
handleAPIErrors(errorLabel, e);
|
|
42
42
|
} else {
|
|
43
|
-
logger.error(
|
|
44
|
-
return 1;
|
|
43
|
+
logger.error(`${errorLabel}: ${(e as Error).message}`);
|
|
45
44
|
}
|
|
45
|
+
return 1;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import { getCloudCredentials, getLogger } from "../cloudutils";
|
|
1
|
+
import axios, { AxiosError } from "axios";
|
|
2
|
+
import { handleAPIErrors, getCloudCredentials, getLogger } from "../cloudutils";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
|
|
5
5
|
export async function registerApp(dbname: string, host: string): Promise<number> {
|
|
@@ -32,12 +32,12 @@ export async function registerApp(dbname: string, host: string): Promise<number>
|
|
|
32
32
|
logger.info(`${appName} ID: ${uuid}`);
|
|
33
33
|
return 0;
|
|
34
34
|
} catch (e) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
const errorLabel = `Failed to register application ${appName}`;
|
|
36
|
+
if (axios.isAxiosError(e) && (e as AxiosError).response) {
|
|
37
|
+
handleAPIErrors(errorLabel, e);
|
|
38
38
|
} else {
|
|
39
|
-
logger.error(
|
|
40
|
-
return 1;
|
|
39
|
+
logger.error(`${errorLabel}: ${(e as Error).message}`);
|
|
41
40
|
}
|
|
41
|
+
return 1;
|
|
42
42
|
}
|
|
43
43
|
}
|
package/cloudutils.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { DBOSCloudCredentials, dbosEnvPath } from "./login";
|
|
2
2
|
import TransportStream = require("winston-transport");
|
|
3
|
-
import fs from "fs";
|
|
4
3
|
import { spawn, StdioOptions } from 'child_process';
|
|
5
4
|
import { transports, createLogger, format, Logger } from "winston";
|
|
5
|
+
import fs from "fs";
|
|
6
|
+
import { AxiosError } from "axios";
|
|
6
7
|
|
|
7
8
|
export const dbosConfigFilePath = "dbos-config.yaml";
|
|
8
9
|
|
|
10
|
+
// FIXME: we should have a global instance of the logger created in cli.ts
|
|
9
11
|
export function getLogger(): Logger {
|
|
10
12
|
const winstonTransports: TransportStream[] = [];
|
|
11
13
|
winstonTransports.push(
|
|
@@ -96,4 +98,17 @@ export type ValuesOf<T> = T[keyof T];
|
|
|
96
98
|
|
|
97
99
|
export function createDirectory(path: string): string | undefined {
|
|
98
100
|
return fs.mkdirSync(path, { recursive: true });
|
|
99
|
-
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
interface CloudAPIErrorResponse {
|
|
104
|
+
message: string,
|
|
105
|
+
statusCode: number,
|
|
106
|
+
requestID: string,
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function handleAPIErrors(label: string, e: AxiosError) {
|
|
110
|
+
const logger = getLogger();
|
|
111
|
+
const resp: CloudAPIErrorResponse = e.response?.data as CloudAPIErrorResponse;
|
|
112
|
+
logger.error(`[${resp.requestID}] ${label}: ${resp.message}.`);
|
|
113
|
+
}
|
|
114
|
+
|
|
@@ -27,14 +27,14 @@ async function deleteApp(host) {
|
|
|
27
27
|
return 0;
|
|
28
28
|
}
|
|
29
29
|
catch (e) {
|
|
30
|
+
const errorLabel = `Failed to delete application ${appName}`;
|
|
30
31
|
if (axios_1.default.isAxiosError(e) && e.response) {
|
|
31
|
-
|
|
32
|
-
return 1;
|
|
32
|
+
(0, cloudutils_1.handleAPIErrors)(errorLabel, e);
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
|
-
logger.error(
|
|
36
|
-
return 1;
|
|
35
|
+
logger.error(`${errorLabel}: ${e.message}`);
|
|
37
36
|
}
|
|
37
|
+
return 1;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
exports.deleteApp = deleteApp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete-app.js","sourceRoot":"","sources":["../../../../applications/delete-app.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"delete-app.js","sourceRoot":"","sources":["../../../../applications/delete-app.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0C;AAC1C,8CAAgF;AAChF,0DAA6B;AAEtB,KAAK,UAAU,SAAS,CAAC,IAAY;IAC1C,MAAM,MAAM,GAAG,IAAA,sBAAS,GAAE,CAAA;IAC1B,MAAM,eAAe,GAAG,IAAA,gCAAmB,GAAE,CAAC;IAC9C,MAAM,WAAW,GAAG,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC;IAEtD,8DAA8D;IAC9D,MAAM,WAAW,GAAG,OAAO,CAAC,mBAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAqB,CAAC;IAC1F,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC;IACjC,MAAM,CAAC,IAAI,CAAC,8CAA8C,OAAO,EAAE,CAAC,CAAA;IACpE,MAAM,CAAC,IAAI,CAAC,yBAAyB,OAAO,EAAE,CAAC,CAAA;IAE/C,IAAI,CAAC;QACH,MAAM,eAAK,CAAC,MAAM,CAAC,WAAW,IAAI,IAAI,eAAe,CAAC,QAAQ,gBAAgB,OAAO,EAAE,EAAE;YACvF,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,aAAa,EAAE,WAAW;aAC3B;SACF,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,qCAAqC,OAAO,EAAE,CAAC,CAAC;QAC5D,OAAO,CAAC,CAAC;IACX,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,UAAU,GAAG,gCAAgC,OAAO,EAAE,CAAC;QAC7D,IAAI,eAAK,CAAC,YAAY,CAAC,CAAC,CAAC,IAAK,CAAgB,CAAC,QAAQ,EAAE,CAAC;YACxD,IAAA,4BAAe,EAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,KAAK,CAAC,GAAG,UAAU,KAAM,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC;AA9BD,8BA8BC"}
|
|
@@ -87,14 +87,14 @@ async function deployAppCode(host, docker) {
|
|
|
87
87
|
return 0;
|
|
88
88
|
}
|
|
89
89
|
catch (e) {
|
|
90
|
+
const errorLabel = `Failed to deploy application ${appName}`;
|
|
90
91
|
if (axios_1.default.isAxiosError(e) && e.response) {
|
|
91
|
-
|
|
92
|
-
return 1;
|
|
92
|
+
(0, cloudutils_1.handleAPIErrors)(errorLabel, e);
|
|
93
93
|
}
|
|
94
94
|
else {
|
|
95
|
-
logger.error(
|
|
96
|
-
return 1;
|
|
95
|
+
logger.error(`${errorLabel}: ${e.message}`);
|
|
97
96
|
}
|
|
97
|
+
return 1;
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
exports.deployAppCode = deployAppCode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-app-code.js","sourceRoot":"","sources":["../../../../applications/deploy-app-code.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"deploy-app-code.js","sourceRoot":"","sources":["../../../../applications/deploy-app-code.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0C;AAC1C,iDAAyC;AACzC,2BAA+C;AAC/C,8CAAsJ;AACtJ,gDAAwB;AAGxB,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAOnC,KAAK,UAAU,aAAa,CAAC,IAAY,EAAE,MAAe;IAC/D,MAAM,MAAM,GAAG,IAAA,sBAAS,GAAE,CAAA;IAC1B,MAAM,eAAe,GAAG,IAAA,gCAAmB,GAAE,CAAC;IAC9C,MAAM,WAAW,GAAG,SAA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AAQ,EAAC,aAAa,aAAa,EAAE,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,CAAC,KAAK,CAAC,+BAA+B,OAAO,KAAM,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;QAChF,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -27,14 +27,14 @@ async function getAppLogs(host) {
|
|
|
27
27
|
return 0;
|
|
28
28
|
}
|
|
29
29
|
catch (e) {
|
|
30
|
+
const errorLabel = `Failed to retrieve logs of application ${appName}`;
|
|
30
31
|
if (axios_1.default.isAxiosError(e) && e.response) {
|
|
31
|
-
|
|
32
|
-
return 1;
|
|
32
|
+
(0, cloudutils_1.handleAPIErrors)(errorLabel, e);
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
|
-
logger.error(
|
|
36
|
-
return 1;
|
|
35
|
+
logger.error(`${errorLabel}: ${e.message}`);
|
|
37
36
|
}
|
|
37
|
+
return 1;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
exports.getAppLogs = getAppLogs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-app-logs.js","sourceRoot":"","sources":["../../../../applications/get-app-logs.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"get-app-logs.js","sourceRoot":"","sources":["../../../../applications/get-app-logs.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA2C;AAC3C,8CAAgF;AAChF,0DAA6B;AAEtB,KAAK,UAAU,UAAU,CAAC,IAAY;IAC3C,MAAM,MAAM,GAAG,IAAA,sBAAS,GAAE,CAAC;IAC3B,MAAM,eAAe,GAAG,IAAA,gCAAmB,GAAE,CAAC;IAC9C,MAAM,WAAW,GAAG,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC;IAEtD,8DAA8D;IAC9D,MAAM,WAAW,GAAG,OAAO,CAAC,mBAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAqB,CAAC;IAC1F,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC;IACjC,MAAM,CAAC,IAAI,CAAC,oCAAoC,OAAO,EAAE,CAAC,CAAA;IAE1D,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI,eAAe,CAAC,QAAQ,qBAAqB,OAAO,EAAE,EAAE;YACrG,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,aAAa,EAAE,WAAW;aAC3B;SACF,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,+CAA+C,OAAO,EAAE,CAAC,CAAC;QACtE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACrB,OAAO,CAAC,CAAC;IACX,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,UAAU,GAAG,0CAA0C,OAAO,EAAE,CAAC;QACvE,IAAI,eAAK,CAAC,YAAY,CAAC,CAAC,CAAC,IAAK,CAAgB,CAAC,QAAQ,EAAE,CAAC;YACxD,IAAA,4BAAe,EAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,KAAK,CAAC,GAAG,UAAU,KAAM,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC;AA9BD,gCA8BC"}
|
|
@@ -38,14 +38,14 @@ async function listApps(host, json) {
|
|
|
38
38
|
return 0;
|
|
39
39
|
}
|
|
40
40
|
catch (e) {
|
|
41
|
+
const errorLabel = 'Failed to list applications';
|
|
41
42
|
if (axios_1.default.isAxiosError(e) && e.response) {
|
|
42
|
-
|
|
43
|
-
return 1;
|
|
43
|
+
(0, cloudutils_1.handleAPIErrors)(errorLabel, e);
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
|
-
logger.error(
|
|
47
|
-
return 1;
|
|
46
|
+
logger.error(`${errorLabel}: ${e.message}`);
|
|
48
47
|
}
|
|
48
|
+
return 1;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
exports.listApps = listApps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-apps.js","sourceRoot":"","sources":["../../../../applications/list-apps.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"list-apps.js","sourceRoot":"","sources":["../../../../applications/list-apps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0C;AAC1C,8CAAgF;AAGzE,KAAK,UAAU,QAAQ,CAAC,IAAY,EAAE,IAAa;IACxD,MAAM,MAAM,GAAG,IAAA,sBAAS,GAAE,CAAC;IAC3B,MAAM,eAAe,GAAG,IAAA,gCAAmB,GAAE,CAAC;IAC9C,MAAM,WAAW,GAAG,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC;IAEtD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,eAAK,CAAC,GAAG,CAC1B,WAAW,IAAI,IAAI,eAAe,CAAC,QAAQ,cAAc,EACzD;YACE,OAAO,EAAE;gBACP,aAAa,EAAE,WAAW;aAC3B;SACF,CACF,CAAC;QACF,MAAM,YAAY,GAAkB,IAAI,CAAC,IAAqB,CAAC;QAC/D,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC9B,MAAM,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;YACrC,OAAO,CAAC,CAAC;QACX,CAAC;QACD,IAAI,IAAI,EAAE,CAAC;YACT,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,4BAA4B,eAAe,CAAC,QAAQ,EAAE,CAAC,CAAA;YACnE,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;gBACzB,OAAO,CAAC,GAAG,CAAC,qBAAqB,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;gBAC7C,OAAO,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC7B,OAAO,CAAC,GAAG,CAAC,kBAAkB,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC;gBAClD,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;gBACrC,OAAO,CAAC,GAAG,CAAC,YAAY,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;gBACvC,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;YAC3C,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,UAAU,GAAG,6BAA6B,CAAC;QACjD,IAAI,eAAK,CAAC,YAAY,CAAC,CAAC,CAAC,IAAK,CAAgB,CAAC,QAAQ,EAAE,CAAC;YACxD,IAAA,4BAAe,EAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,KAAK,CAAC,GAAG,UAAU,KAAM,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC;AA1CD,4BA0CC"}
|
|
@@ -32,14 +32,14 @@ async function registerApp(dbname, host) {
|
|
|
32
32
|
return 0;
|
|
33
33
|
}
|
|
34
34
|
catch (e) {
|
|
35
|
+
const errorLabel = `Failed to register application ${appName}`;
|
|
35
36
|
if (axios_1.default.isAxiosError(e) && e.response) {
|
|
36
|
-
|
|
37
|
-
return 1;
|
|
37
|
+
(0, cloudutils_1.handleAPIErrors)(errorLabel, e);
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
|
-
logger.error(
|
|
41
|
-
return 1;
|
|
40
|
+
logger.error(`${errorLabel}: ${e.message}`);
|
|
42
41
|
}
|
|
42
|
+
return 1;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
exports.registerApp = registerApp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-app.js","sourceRoot":"","sources":["../../../../applications/register-app.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"register-app.js","sourceRoot":"","sources":["../../../../applications/register-app.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0C;AAC1C,8CAAgF;AAChF,0DAA6B;AAEtB,KAAK,UAAU,WAAW,CAAC,MAAc,EAAE,IAAY;IAC5D,MAAM,MAAM,GAAG,IAAA,sBAAS,GAAE,CAAC;IAC3B,MAAM,eAAe,GAAG,IAAA,gCAAmB,GAAE,CAAC;IAC9C,MAAM,WAAW,GAAG,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC;IAEtD,8DAA8D;IAC9D,MAAM,WAAW,GAAG,OAAO,CAAC,mBAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAqB,CAAC;IAC1F,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC;IACjC,MAAM,CAAC,IAAI,CAAC,8CAA8C,OAAO,EAAE,CAAC,CAAA;IACpE,MAAM,CAAC,IAAI,CAAC,4BAA4B,OAAO,EAAE,CAAC,CAAA;IAElD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,GAAG,CAC9B,WAAW,IAAI,IAAI,eAAe,CAAC,QAAQ,cAAc,EACzD;YACE,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,MAAM;SACjB,EACD;YACE,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,aAAa,EAAE,WAAW;aAC3B;SACF,CACF,CAAC;QACF,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAc,CAAC;QACrC,MAAM,CAAC,IAAI,CAAC,4BAA4B,OAAO,EAAE,CAAC,CAAC;QACnD,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,QAAQ,IAAI,EAAE,CAAC,CAAC;QACtC,OAAO,CAAC,CAAC;IACX,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,UAAU,GAAG,kCAAkC,OAAO,EAAE,CAAC;QAC/D,IAAI,eAAK,CAAC,YAAY,CAAC,CAAC,CAAC,IAAK,CAAgB,CAAC,QAAQ,EAAE,CAAC;YACxD,IAAA,4BAAe,EAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,KAAK,CAAC,GAAG,UAAU,KAAM,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC;AAtCD,kCAsCC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { DBOSCloudCredentials } from "./login";
|
|
3
3
|
import { Logger } from "winston";
|
|
4
|
+
import { AxiosError } from "axios";
|
|
4
5
|
export declare const dbosConfigFilePath = "dbos-config.yaml";
|
|
5
6
|
export declare function getLogger(): Logger;
|
|
6
7
|
export declare function getCloudCredentials(): DBOSCloudCredentials;
|
|
@@ -10,4 +11,5 @@ export declare function readFileSync(path: string, encoding?: BufferEncoding): s
|
|
|
10
11
|
export declare const sleep: (ms: number) => Promise<unknown>;
|
|
11
12
|
export type ValuesOf<T> = T[keyof T];
|
|
12
13
|
export declare function createDirectory(path: string): string | undefined;
|
|
14
|
+
export declare function handleAPIErrors(label: string, e: AxiosError): void;
|
|
13
15
|
//# sourceMappingURL=cloudutils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloudutils.d.ts","sourceRoot":"","sources":["../../../cloudutils.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAe,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"cloudutils.d.ts","sourceRoot":"","sources":["../../../cloudutils.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAe,MAAM,SAAS,CAAC;AAG5D,OAAO,EAAoC,MAAM,EAAE,MAAM,SAAS,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,eAAO,MAAM,kBAAkB,qBAAqB,CAAC;AAGrD,wBAAgB,SAAS,IAAI,MAAM,CASlC;AAqBD,wBAAgB,mBAAmB,IAAI,oBAAoB,CAW1D;AAED,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C;AAGD,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,EAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAkBhF;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,cAAuB,GAAG,MAAM,GAAG,MAAM,CAa7F;AAED,eAAO,MAAM,KAAK,OAAQ,MAAM,qBAA0C,CAAC;AAE3E,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAGrC,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEhE;AAQD,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,QAI3D"}
|
|
@@ -3,12 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createDirectory = exports.sleep = exports.readFileSync = exports.runCommand = exports.credentialsExist = exports.getCloudCredentials = exports.getLogger = exports.dbosConfigFilePath = void 0;
|
|
6
|
+
exports.handleAPIErrors = exports.createDirectory = exports.sleep = exports.readFileSync = exports.runCommand = exports.credentialsExist = exports.getCloudCredentials = exports.getLogger = exports.dbosConfigFilePath = void 0;
|
|
7
7
|
const login_1 = require("./login");
|
|
8
|
-
const fs_1 = __importDefault(require("fs"));
|
|
9
8
|
const child_process_1 = require("child_process");
|
|
10
9
|
const winston_1 = require("winston");
|
|
10
|
+
const fs_1 = __importDefault(require("fs"));
|
|
11
11
|
exports.dbosConfigFilePath = "dbos-config.yaml";
|
|
12
|
+
// FIXME: we should have a global instance of the logger created in cli.ts
|
|
12
13
|
function getLogger() {
|
|
13
14
|
const winstonTransports = [];
|
|
14
15
|
winstonTransports.push(new winston_1.transports.Console({
|
|
@@ -86,4 +87,10 @@ function createDirectory(path) {
|
|
|
86
87
|
return fs_1.default.mkdirSync(path, { recursive: true });
|
|
87
88
|
}
|
|
88
89
|
exports.createDirectory = createDirectory;
|
|
90
|
+
function handleAPIErrors(label, e) {
|
|
91
|
+
const logger = getLogger();
|
|
92
|
+
const resp = e.response?.data;
|
|
93
|
+
logger.error(`[${resp.requestID}] ${label}: ${resp.message}.`);
|
|
94
|
+
}
|
|
95
|
+
exports.handleAPIErrors = handleAPIErrors;
|
|
89
96
|
//# sourceMappingURL=cloudutils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloudutils.js","sourceRoot":"","sources":["../../../cloudutils.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA4D;AAE5D,
|
|
1
|
+
{"version":3,"file":"cloudutils.js","sourceRoot":"","sources":["../../../cloudutils.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA4D;AAE5D,iDAAoD;AACpD,qCAAmE;AACnE,4CAAoB;AAGP,QAAA,kBAAkB,GAAG,kBAAkB,CAAC;AAErD,0EAA0E;AAC1E,SAAgB,SAAS;IACvB,MAAM,iBAAiB,GAAsB,EAAE,CAAC;IAChD,iBAAiB,CAAC,IAAI,CACpB,IAAI,oBAAU,CAAC,OAAO,CAAC;QACrB,MAAM,EAAE,aAAa;QACrB,KAAK,EA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version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../register.ts"],"names":[],"mappings":"AAGA,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../register.ts"],"names":[],"mappings":"AAGA,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA+BlF"}
|
|
@@ -25,11 +25,12 @@ async function registerUser(username, host) {
|
|
|
25
25
|
logger.info(`Registered user ${userName}, UUID: ${userUUID}`);
|
|
26
26
|
}
|
|
27
27
|
catch (e) {
|
|
28
|
+
const errorLabel = `Failed to register user ${username}`;
|
|
28
29
|
if (axios_1.default.isAxiosError(e) && e.response) {
|
|
29
|
-
|
|
30
|
+
(0, cloudutils_1.handleAPIErrors)(errorLabel, e);
|
|
30
31
|
}
|
|
31
32
|
else {
|
|
32
|
-
logger.error(
|
|
33
|
+
logger.error(`${errorLabel}: ${e.message}`);
|
|
33
34
|
}
|
|
34
35
|
return 1;
|
|
35
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../register.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../register.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0C;AAC1C,6CAA+E;AAExE,KAAK,UAAU,YAAY,CAAC,QAAgB,EAAE,IAAY;IAC/D,MAAM,eAAe,GAAG,IAAA,gCAAmB,GAAE,CAAC;IAC9C,MAAM,WAAW,GAAG,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC;IACtD,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC;IAC1C,MAAM,MAAM,GAAG,IAAA,sBAAS,GAAE,CAAC;IAC3B,IAAI,CAAC;QACH,4BAA4B;QAC5B,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,GAAG,CAC9B,WAAW,IAAI,OAAO,EACtB;YACE,IAAI,EAAE,QAAQ;SACf,EACD;YACE,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,aAAa,EAAE,WAAW;aAC3B;SACF,CACF,CAAC;QACF,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAc,CAAC;QACzC,MAAM,CAAC,IAAI,CAAC,mBAAmB,QAAQ,WAAW,QAAQ,EAAE,CAAC,CAAC;IAChE,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,UAAU,GAAG,2BAA2B,QAAQ,EAAE,CAAC;QACzD,IAAI,eAAK,CAAC,YAAY,CAAC,CAAC,CAAC,IAAK,CAAgB,CAAC,QAAQ,EAAE,CAAC;YACxD,IAAA,4BAAe,EAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,KAAK,CAAC,GAAG,UAAU,KAAM,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AA/BD,oCA+BC"}
|
|
@@ -4,8 +4,8 @@ export interface UserDBInstance {
|
|
|
4
4
|
readonly HostName: string;
|
|
5
5
|
readonly Port: number;
|
|
6
6
|
}
|
|
7
|
-
export declare function createUserDb(host: string, dbName: string, adminName: string, adminPassword: string, sync: boolean): Promise<
|
|
8
|
-
export declare function deleteUserDb(host: string, dbName: string): Promise<
|
|
9
|
-
export declare function getUserDb(host: string, dbName: string, json: boolean): Promise<
|
|
7
|
+
export declare function createUserDb(host: string, dbName: string, adminName: string, adminPassword: string, sync: boolean): Promise<1 | undefined>;
|
|
8
|
+
export declare function deleteUserDb(host: string, dbName: string): Promise<1 | undefined>;
|
|
9
|
+
export declare function getUserDb(host: string, dbName: string, json: boolean): Promise<1 | undefined>;
|
|
10
10
|
export declare function getUserDBInfo(host: string, dbName: string): Promise<UserDBInstance>;
|
|
11
11
|
//# sourceMappingURL=userdb.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userdb.d.ts","sourceRoot":"","sources":["../../../userdb.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"userdb.d.ts","sourceRoot":"","sources":["../../../userdb.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,0BAqCvH;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,0BAsB9D;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,0BAuB1E;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAYzF"}
|
|
@@ -30,12 +30,14 @@ async function createUserDb(host, dbName, adminName, adminPassword, sync) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
catch (e) {
|
|
33
|
+
const errorLabel = `Failed to create database ${dbName}`;
|
|
33
34
|
if (axios_1.default.isAxiosError(e) && e.response) {
|
|
34
|
-
|
|
35
|
+
(0, cloudutils_1.handleAPIErrors)(errorLabel, e);
|
|
35
36
|
}
|
|
36
37
|
else {
|
|
37
|
-
logger.error(
|
|
38
|
+
logger.error(`${errorLabel}: ${e.message}`);
|
|
38
39
|
}
|
|
40
|
+
return 1;
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
exports.createUserDb = createUserDb;
|
|
@@ -53,12 +55,14 @@ async function deleteUserDb(host, dbName) {
|
|
|
53
55
|
logger.info(`Database deleted: ${dbName}`);
|
|
54
56
|
}
|
|
55
57
|
catch (e) {
|
|
58
|
+
const errorLabel = `Failed to delete database ${dbName}`;
|
|
56
59
|
if (axios_1.default.isAxiosError(e) && e.response) {
|
|
57
|
-
|
|
60
|
+
(0, cloudutils_1.handleAPIErrors)(errorLabel, e);
|
|
58
61
|
}
|
|
59
62
|
else {
|
|
60
|
-
logger.error(
|
|
63
|
+
logger.error(`${errorLabel}: ${e.message}`);
|
|
61
64
|
}
|
|
65
|
+
return 1;
|
|
62
66
|
}
|
|
63
67
|
}
|
|
64
68
|
exports.deleteUserDb = deleteUserDb;
|
|
@@ -78,12 +82,14 @@ async function getUserDb(host, dbName, json) {
|
|
|
78
82
|
}
|
|
79
83
|
}
|
|
80
84
|
catch (e) {
|
|
85
|
+
const errorLabel = `Failed to retreive database record ${dbName}`;
|
|
81
86
|
if (axios_1.default.isAxiosError(e) && e.response) {
|
|
82
|
-
|
|
87
|
+
(0, cloudutils_1.handleAPIErrors)(errorLabel, e);
|
|
83
88
|
}
|
|
84
89
|
else {
|
|
85
|
-
logger.error(
|
|
90
|
+
logger.error(`${errorLabel}: ${e.message}`);
|
|
86
91
|
}
|
|
92
|
+
return 1;
|
|
87
93
|
}
|
|
88
94
|
}
|
|
89
95
|
exports.getUserDb = getUserDb;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userdb.js","sourceRoot":"","sources":["../../../userdb.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"userdb.js","sourceRoot":"","sources":["../../../userdb.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0C;AAC1C,6CAA+E;AAC/E,2CAAwC;AASjC,KAAK,UAAU,YAAY,CAAC,IAAY,EAAE,MAAc,EAAE,SAAiB,EAAE,aAAqB,EAAE,IAAa;IACtH,MAAM,MAAM,GAAG,IAAA,sBAAS,GAAE,CAAC;IAC3B,MAAM,eAAe,GAAG,IAAA,gCAAmB,GAAE,CAAC;IAC9C,MAAM,WAAW,GAAG,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC;IAEtD,IAAI,CAAC;QACH,MAAM,eAAK,CAAC,IAAI,CACd,WAAW,IAAI,IAAI,eAAe,CAAC,QAAQ,mBAAmB,EAC9D,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,EACpE;YACE,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,aAAa,EAAE,WAAW;aAC3B;SACF,CACF,CAAC;QAEF,MAAM,CAAC,IAAI,CAAC,2CAA2C,MAAM,EAAE,CAAC,CAAC;QAEjE,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,MAAM,GAAG,EAAE,CAAC;YAChB,OAAO,MAAM,IAAI,WAAW,IAAI,MAAM,IAAI,YAAY,EAAE,CAAC;gBACvD,MAAM,IAAA,aAAK,EAAC,KAAK,CAAC,CAAC;gBACnB,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;gBACrD,MAAM,CAAC,IAAI,CAAC,UAAU,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IACX,CAAC;AACH,CAAC;AAvBD,8BAuBC;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,IAAI,eAAe,CAAC,QAAQ,0BAA0B,MAAM,EAAE,EAAE;QACzG,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,WAAW;SAC3B;KACF,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC,IAAsB,CAAC;AACpC,CAAC;AAZD,sCAYC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dbos-inc/dbos-cloud",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.51-preview",
|
|
4
4
|
"description": "Tool for performing application deployment to DBOS cloud",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"jest": "^29.6.1",
|
|
30
30
|
"nerdbank-gitversioning": "^3.6.133",
|
|
31
31
|
"supertest": "^6.3.3",
|
|
32
|
-
"ts-jest": "^29.1.1"
|
|
32
|
+
"ts-jest": "^29.1.1",
|
|
33
|
+
"typescript": "^5.3.3"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
35
36
|
"@opentelemetry/api-logs": "^0.47.0",
|
package/register.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import { getCloudCredentials, getLogger } from "./cloudutils";
|
|
1
|
+
import axios, { AxiosError } from "axios";
|
|
2
|
+
import { handleAPIErrors, getCloudCredentials, getLogger } from "./cloudutils";
|
|
3
3
|
|
|
4
4
|
export async function registerUser(username: string, host: string): Promise<number> {
|
|
5
5
|
const userCredentials = getCloudCredentials();
|
|
@@ -23,10 +23,11 @@ export async function registerUser(username: string, host: string): Promise<numb
|
|
|
23
23
|
const userUUID = register.data as string;
|
|
24
24
|
logger.info(`Registered user ${userName}, UUID: ${userUUID}`);
|
|
25
25
|
} catch (e) {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const errorLabel = `Failed to register user ${username}`;
|
|
27
|
+
if (axios.isAxiosError(e) && (e as AxiosError).response) {
|
|
28
|
+
handleAPIErrors(errorLabel, e);
|
|
28
29
|
} else {
|
|
29
|
-
logger.error(
|
|
30
|
+
logger.error(`${errorLabel}: ${(e as Error).message}`);
|
|
30
31
|
}
|
|
31
32
|
return 1;
|
|
32
33
|
}
|
package/userdb.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import { getCloudCredentials, getLogger } from "./cloudutils";
|
|
1
|
+
import axios, { AxiosError } from "axios";
|
|
2
|
+
import { handleAPIErrors, getCloudCredentials, getLogger } from "./cloudutils";
|
|
3
3
|
import { sleep } from "../../src/utils";
|
|
4
4
|
|
|
5
5
|
export interface UserDBInstance {
|
|
@@ -38,11 +38,13 @@ export async function createUserDb(host: string, dbName: string, adminName: stri
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
} catch (e) {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
const errorLabel = `Failed to create database ${dbName}`;
|
|
42
|
+
if (axios.isAxiosError(e) && (e as AxiosError).response) {
|
|
43
|
+
handleAPIErrors(errorLabel, e);
|
|
43
44
|
} else {
|
|
44
|
-
logger.error(
|
|
45
|
+
logger.error(`${errorLabel}: ${(e as Error).message}`);
|
|
45
46
|
}
|
|
47
|
+
return 1;
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
50
|
|
|
@@ -60,11 +62,13 @@ export async function deleteUserDb(host: string, dbName: string) {
|
|
|
60
62
|
});
|
|
61
63
|
logger.info(`Database deleted: ${dbName}`);
|
|
62
64
|
} catch (e) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
const errorLabel = `Failed to delete database ${dbName}`;
|
|
66
|
+
if (axios.isAxiosError(e) && (e as AxiosError).response) {
|
|
67
|
+
handleAPIErrors(errorLabel, e);
|
|
65
68
|
} else {
|
|
66
|
-
logger.error(
|
|
69
|
+
logger.error(`${errorLabel}: ${(e as Error).message}`);
|
|
67
70
|
}
|
|
71
|
+
return 1;
|
|
68
72
|
}
|
|
69
73
|
}
|
|
70
74
|
|
|
@@ -83,11 +87,13 @@ export async function getUserDb(host: string, dbName: string, json: boolean) {
|
|
|
83
87
|
console.log(`Port: ${userDBInfo.Port}`);
|
|
84
88
|
}
|
|
85
89
|
} catch (e) {
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
const errorLabel = `Failed to retreive database record ${dbName}`;
|
|
91
|
+
if (axios.isAxiosError(e) && (e as AxiosError).response) {
|
|
92
|
+
handleAPIErrors(errorLabel, e);
|
|
88
93
|
} else {
|
|
89
|
-
logger.error(
|
|
94
|
+
logger.error(`${errorLabel}: ${(e as Error).message}`);
|
|
90
95
|
}
|
|
96
|
+
return 1;
|
|
91
97
|
}
|
|
92
98
|
}
|
|
93
99
|
|