@dbos-inc/dbos-sdk 0.10.6-preview → 0.10.12-preview.gd659422f8d
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/dbos-executor.d.ts +1 -1
- package/dist/src/dbos-executor.d.ts.map +1 -1
- package/dist/src/testing/testing_runtime.d.ts +2 -0
- package/dist/src/testing/testing_runtime.d.ts.map +1 -1
- package/dist/src/testing/testing_runtime.js +4 -1
- package/dist/src/testing/testing_runtime.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/examples/hello/migrations/20240212161006_create_dbos_hello_tables.js +2 -0
- package/package.json +1 -1
- package/dist/packages/communicator-bcrypt/index.d.ts +0 -8
- package/dist/packages/communicator-bcrypt/index.d.ts.map +0 -1
- package/dist/packages/communicator-bcrypt/index.js +0 -43
- package/dist/packages/communicator-bcrypt/index.js.map +0 -1
- package/dist/packages/communicator-datetime/index.d.ts +0 -7
- package/dist/packages/communicator-datetime/index.d.ts.map +0 -1
- package/dist/packages/communicator-datetime/index.js +0 -35
- package/dist/packages/communicator-datetime/index.js.map +0 -1
- package/dist/packages/communicator-random/index.d.ts +0 -6
- package/dist/packages/communicator-random/index.d.ts.map +0 -1
- package/dist/packages/communicator-random/index.js +0 -26
- package/dist/packages/communicator-random/index.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/delete-app.d.ts +0 -2
- package/dist/packages/dbos-cloud/applications/delete-app.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/delete-app.js +0 -41
- package/dist/packages/dbos-cloud/applications/delete-app.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/deploy-app-code.d.ts +0 -2
- package/dist/packages/dbos-cloud/applications/deploy-app-code.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/deploy-app-code.js +0 -161
- package/dist/packages/dbos-cloud/applications/deploy-app-code.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/get-app-info.d.ts +0 -2
- package/dist/packages/dbos-cloud/applications/get-app-info.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/get-app-info.js +0 -54
- package/dist/packages/dbos-cloud/applications/get-app-info.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/get-app-logs.d.ts +0 -2
- package/dist/packages/dbos-cloud/applications/get-app-logs.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/get-app-logs.js +0 -53
- package/dist/packages/dbos-cloud/applications/get-app-logs.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/index.d.ts +0 -7
- package/dist/packages/dbos-cloud/applications/index.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/index.js +0 -16
- package/dist/packages/dbos-cloud/applications/index.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/list-apps.d.ts +0 -2
- package/dist/packages/dbos-cloud/applications/list-apps.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/list-apps.js +0 -54
- package/dist/packages/dbos-cloud/applications/list-apps.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/register-app.d.ts +0 -2
- package/dist/packages/dbos-cloud/applications/register-app.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/register-app.js +0 -46
- package/dist/packages/dbos-cloud/applications/register-app.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/types.d.ts +0 -9
- package/dist/packages/dbos-cloud/applications/types.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/types.js +0 -3
- package/dist/packages/dbos-cloud/applications/types.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/update-app.d.ts +0 -2
- package/dist/packages/dbos-cloud/applications/update-app.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/update-app.js +0 -45
- package/dist/packages/dbos-cloud/applications/update-app.js.map +0 -1
- package/dist/packages/dbos-cloud/cli.d.ts +0 -3
- package/dist/packages/dbos-cloud/cli.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/cli.js +0 -155
- package/dist/packages/dbos-cloud/cli.js.map +0 -1
- package/dist/packages/dbos-cloud/cloudutils.d.ts +0 -29
- package/dist/packages/dbos-cloud/cloudutils.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/cloudutils.js +0 -138
- package/dist/packages/dbos-cloud/cloudutils.js.map +0 -1
- package/dist/packages/dbos-cloud/login.d.ts +0 -2
- package/dist/packages/dbos-cloud/login.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/login.js +0 -103
- package/dist/packages/dbos-cloud/login.js.map +0 -1
- package/dist/packages/dbos-cloud/register.d.ts +0 -2
- package/dist/packages/dbos-cloud/register.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/register.js +0 -75
- package/dist/packages/dbos-cloud/register.js.map +0 -1
- package/dist/packages/dbos-cloud/userdb.d.ts +0 -13
- package/dist/packages/dbos-cloud/userdb.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/userdb.js +0 -153
- package/dist/packages/dbos-cloud/userdb.js.map +0 -1
- package/dist/packages/dbos-openapi/TypeParser.d.ts +0 -36
- package/dist/packages/dbos-openapi/TypeParser.d.ts.map +0 -1
- package/dist/packages/dbos-openapi/TypeParser.js +0 -162
- package/dist/packages/dbos-openapi/TypeParser.js.map +0 -1
- package/dist/packages/dbos-openapi/cli.d.ts +0 -3
- package/dist/packages/dbos-openapi/cli.d.ts.map +0 -1
- package/dist/packages/dbos-openapi/cli.js +0 -32
- package/dist/packages/dbos-openapi/cli.js.map +0 -1
- package/dist/packages/dbos-openapi/openApi.d.ts +0 -36
- package/dist/packages/dbos-openapi/openApi.d.ts.map +0 -1
- package/dist/packages/dbos-openapi/openApi.js +0 -566
- package/dist/packages/dbos-openapi/openApi.js.map +0 -1
- package/dist/packages/dbos-openapi/tests/makeProgram.d.ts +0 -3
- package/dist/packages/dbos-openapi/tests/makeProgram.d.ts.map +0 -1
- package/dist/packages/dbos-openapi/tests/makeProgram.js +0 -71
- package/dist/packages/dbos-openapi/tests/makeProgram.js.map +0 -1
- package/dist/packages/dbos-openapi/tests/openapi.test.d.ts +0 -2
- package/dist/packages/dbos-openapi/tests/openapi.test.d.ts.map +0 -1
- package/dist/packages/dbos-openapi/tests/openapi.test.js +0 -373
- package/dist/packages/dbos-openapi/tests/openapi.test.js.map +0 -1
- package/dist/packages/dbos-openapi/tsDiagUtil.d.ts +0 -16
- package/dist/packages/dbos-openapi/tsDiagUtil.d.ts.map +0 -1
- package/dist/packages/dbos-openapi/tsDiagUtil.js +0 -72
- package/dist/packages/dbos-openapi/tsDiagUtil.js.map +0 -1
@@ -1,54 +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.listApps = void 0;
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
8
|
-
const cloudutils_1 = require("../cloudutils");
|
9
|
-
async function listApps(host, json) {
|
10
|
-
const logger = (0, cloudutils_1.getLogger)();
|
11
|
-
const userCredentials = (0, cloudutils_1.getCloudCredentials)();
|
12
|
-
const bearerToken = "Bearer " + userCredentials.token;
|
13
|
-
try {
|
14
|
-
const list = await axios_1.default.get(`https://${host}/v1alpha1/${userCredentials.userName}/applications`, {
|
15
|
-
headers: {
|
16
|
-
Authorization: bearerToken,
|
17
|
-
},
|
18
|
-
});
|
19
|
-
const applications = list.data;
|
20
|
-
if (applications.length === 0) {
|
21
|
-
logger.info("No applications found");
|
22
|
-
return 1;
|
23
|
-
}
|
24
|
-
if (json) {
|
25
|
-
console.log(JSON.stringify(applications));
|
26
|
-
}
|
27
|
-
else {
|
28
|
-
logger.info(`Listing applications for ${userCredentials.userName}`);
|
29
|
-
applications.forEach(app => {
|
30
|
-
console.log(`Application Name: ${app.Name}`);
|
31
|
-
console.log(`ID: ${app.ID}`);
|
32
|
-
console.log(`Postgres Instance Name: ${app.PostgresInstanceName}`);
|
33
|
-
console.log(`Application Database Name: ${app.ApplicationDatabaseName}`);
|
34
|
-
console.log(`Status: ${app.Status}`);
|
35
|
-
console.log(`Version: ${app.Version}`);
|
36
|
-
console.log('-------------------------');
|
37
|
-
});
|
38
|
-
}
|
39
|
-
return 0;
|
40
|
-
}
|
41
|
-
catch (e) {
|
42
|
-
const errorLabel = 'Failed to list applications';
|
43
|
-
const axiosError = e;
|
44
|
-
if ((0, cloudutils_1.isCloudAPIErrorResponse)(axiosError.response?.data)) {
|
45
|
-
(0, cloudutils_1.handleAPIErrors)(errorLabel, axiosError);
|
46
|
-
}
|
47
|
-
else {
|
48
|
-
logger.error(`${errorLabel}: ${e.message}`);
|
49
|
-
}
|
50
|
-
return 1;
|
51
|
-
}
|
52
|
-
}
|
53
|
-
exports.listApps = listApps;
|
54
|
-
//# sourceMappingURL=list-apps.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"list-apps.js","sourceRoot":"","sources":["../../../../packages/dbos-cloud/applications/list-apps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0C;AAC1C,8CAAyG;AAGlG,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,aAAa,eAAe,CAAC,QAAQ,eAAe,EACnE;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,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3,"file":"register-app.d.ts","sourceRoot":"","sources":["../../../../packages/dbos-cloud/applications/register-app.ts"],"names":[],"mappings":"AAGA,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAuC/E"}
|
@@ -1,46 +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.registerApp = void 0;
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
8
|
-
const cloudutils_1 = require("../cloudutils");
|
9
|
-
async function registerApp(dbname, host) {
|
10
|
-
const logger = (0, cloudutils_1.getLogger)();
|
11
|
-
const userCredentials = (0, cloudutils_1.getCloudCredentials)();
|
12
|
-
const bearerToken = "Bearer " + userCredentials.token;
|
13
|
-
const appName = (0, cloudutils_1.retrieveApplicationName)(logger);
|
14
|
-
if (appName === null) {
|
15
|
-
return 1;
|
16
|
-
}
|
17
|
-
logger.info(`Registering application: ${appName}`);
|
18
|
-
try {
|
19
|
-
const register = await axios_1.default.put(`https://${host}/v1alpha1/${userCredentials.userName}/applications`, {
|
20
|
-
name: appName,
|
21
|
-
database: dbname,
|
22
|
-
}, {
|
23
|
-
headers: {
|
24
|
-
"Content-Type": "application/json",
|
25
|
-
Authorization: bearerToken,
|
26
|
-
},
|
27
|
-
});
|
28
|
-
const uuid = register.data;
|
29
|
-
logger.info(`Successfully registered: ${appName}`);
|
30
|
-
logger.info(`${appName} ID: ${uuid}`);
|
31
|
-
return 0;
|
32
|
-
}
|
33
|
-
catch (e) {
|
34
|
-
const errorLabel = `Failed to register application ${appName}`;
|
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.registerApp = registerApp;
|
46
|
-
//# sourceMappingURL=register-app.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"register-app.js","sourceRoot":"","sources":["../../../../packages/dbos-cloud/applications/register-app.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0C;AAC1C,8CAAkI;AAE3H,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,MAAM,OAAO,GAAG,IAAA,oCAAuB,EAAC,MAAM,CAAC,CAAC;IAChD,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,CAAC,IAAI,CAAC,4BAA4B,OAAO,EAAE,CAAC,CAAA;IAElD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,GAAG,CAC9B,WAAW,IAAI,aAAa,eAAe,CAAC,QAAQ,eAAe,EACnE;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,MAAM,UAAU,GAAG,CAAe,CAAC;QACnC,IAAI,IAAA,oCAAuB,EAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC;YACvD,IAAA,4BAAe,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAC1C,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;AAvCD,kCAuCC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../packages/dbos-cloud/applications/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,oBAAoB,EAAE,MAAM,CAAC;IAC7B,uBAAuB,EAAE,MAAM,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../packages/dbos-cloud/applications/types.ts"],"names":[],"mappings":""}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"update-app.d.ts","sourceRoot":"","sources":["../../../../packages/dbos-cloud/applications/update-app.ts"],"names":[],"mappings":"AAIA,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAsC7D"}
|
@@ -1,45 +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.updateApp = void 0;
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
8
|
-
const cloudutils_1 = require("../cloudutils");
|
9
|
-
async function updateApp(host) {
|
10
|
-
const logger = (0, cloudutils_1.getLogger)();
|
11
|
-
const userCredentials = (0, cloudutils_1.getCloudCredentials)();
|
12
|
-
const bearerToken = "Bearer " + userCredentials.token;
|
13
|
-
const appName = (0, cloudutils_1.retrieveApplicationName)(logger);
|
14
|
-
if (appName === null) {
|
15
|
-
return 1;
|
16
|
-
}
|
17
|
-
logger.info(`Updating application: ${appName}`);
|
18
|
-
try {
|
19
|
-
logger.info(`Updating application ${appName}`);
|
20
|
-
const update = await axios_1.default.patch(`https://${host}/v1alpha1/${userCredentials.userName}/applications/${appName}`, {
|
21
|
-
name: appName,
|
22
|
-
}, {
|
23
|
-
headers: {
|
24
|
-
"Content-Type": "application/json",
|
25
|
-
Authorization: bearerToken,
|
26
|
-
},
|
27
|
-
});
|
28
|
-
const application = update.data;
|
29
|
-
logger.info(`Successfully updated: ${application.Name}`);
|
30
|
-
return 0;
|
31
|
-
}
|
32
|
-
catch (e) {
|
33
|
-
const errorLabel = "Failed to update application";
|
34
|
-
const axiosError = e;
|
35
|
-
if ((0, cloudutils_1.isCloudAPIErrorResponse)(axiosError.response?.data)) {
|
36
|
-
(0, cloudutils_1.handleAPIErrors)(errorLabel, axiosError);
|
37
|
-
}
|
38
|
-
else {
|
39
|
-
logger.error(`${errorLabel}: ${e.message}`);
|
40
|
-
}
|
41
|
-
return 1;
|
42
|
-
}
|
43
|
-
}
|
44
|
-
exports.updateApp = updateApp;
|
45
|
-
//# sourceMappingURL=update-app.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"update-app.js","sourceRoot":"","sources":["../../../../packages/dbos-cloud/applications/update-app.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0C;AAC1C,8CAAkI;AAG3H,KAAK,UAAU,SAAS,CAAC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AAC,CAAC;IACX,CAAC;AACH,CAAC;AAtCD,8BAsCC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../packages/dbos-cloud/cli.ts"],"names":[],"mappings":""}
|
@@ -1,155 +0,0 @@
|
|
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 cloudutils_1 = require("./cloudutils");
|
10
|
-
const get_app_info_1 = require("./applications/get-app-info");
|
11
|
-
const program = new commander_1.Command();
|
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>', 'Username')
|
23
|
-
.action(async (options) => {
|
24
|
-
const exitCode = await (0, login_1.login)(options.username);
|
25
|
-
process.exit(exitCode);
|
26
|
-
});
|
27
|
-
program
|
28
|
-
.command('register')
|
29
|
-
.description('Register a user with DBOS cloud')
|
30
|
-
.requiredOption('-u, --username <string>', 'Username')
|
31
|
-
.action(async (options) => {
|
32
|
-
const exitCode = await (0, register_1.registerUser)(options.username, cloudutils_1.DBOSCloudHost);
|
33
|
-
process.exit(exitCode);
|
34
|
-
});
|
35
|
-
program
|
36
|
-
.command('logout')
|
37
|
-
.description('Log out of DBOS cloud')
|
38
|
-
.action(() => {
|
39
|
-
if ((0, cloudutils_1.credentialsExist)()) {
|
40
|
-
(0, cloudutils_1.deleteCredentials)();
|
41
|
-
}
|
42
|
-
process.exit(0);
|
43
|
-
});
|
44
|
-
/////////////////////////////
|
45
|
-
/* APPLICATIONS MANAGEMENT */
|
46
|
-
/////////////////////////////
|
47
|
-
const applicationCommands = program
|
48
|
-
.command('application')
|
49
|
-
.alias('applications')
|
50
|
-
.alias('app')
|
51
|
-
.alias('apps')
|
52
|
-
.description('Manage your DBOS applications');
|
53
|
-
applicationCommands
|
54
|
-
.command('register')
|
55
|
-
.description('Register this application')
|
56
|
-
.requiredOption('-d, --database <string>', 'Specify a Postgres database instance for this application')
|
57
|
-
.action(async (options) => {
|
58
|
-
const exitCode = await (0, applications_1.registerApp)(options.database, cloudutils_1.DBOSCloudHost);
|
59
|
-
process.exit(exitCode);
|
60
|
-
});
|
61
|
-
applicationCommands
|
62
|
-
.command('update')
|
63
|
-
.description('Update this application')
|
64
|
-
.action(async () => {
|
65
|
-
const exitCode = await (0, applications_1.updateApp)(cloudutils_1.DBOSCloudHost);
|
66
|
-
process.exit(exitCode);
|
67
|
-
});
|
68
|
-
applicationCommands
|
69
|
-
.command('deploy')
|
70
|
-
.description('Deploy this application to the cloud')
|
71
|
-
.option('--no-docker', 'Build the code locally without using Docker')
|
72
|
-
.action(async (options) => {
|
73
|
-
const exitCode = await (0, applications_1.deployAppCode)(cloudutils_1.DBOSCloudHost, options.docker);
|
74
|
-
process.exit(exitCode);
|
75
|
-
});
|
76
|
-
applicationCommands
|
77
|
-
.command('delete')
|
78
|
-
.description('Delete this application')
|
79
|
-
.action(async () => {
|
80
|
-
const exitCode = await (0, applications_1.deleteApp)(cloudutils_1.DBOSCloudHost);
|
81
|
-
process.exit(exitCode);
|
82
|
-
});
|
83
|
-
applicationCommands
|
84
|
-
.command('list')
|
85
|
-
.description('List all applications')
|
86
|
-
.option('--json', 'Emit JSON output')
|
87
|
-
.action(async (options) => {
|
88
|
-
const exitCode = await (0, applications_1.listApps)(cloudutils_1.DBOSCloudHost, options.json);
|
89
|
-
process.exit(exitCode);
|
90
|
-
});
|
91
|
-
applicationCommands
|
92
|
-
.command('status')
|
93
|
-
.description("Retrieve this application's status")
|
94
|
-
.option('--json', 'Emit JSON output')
|
95
|
-
.action(async (options) => {
|
96
|
-
const exitCode = await (0, get_app_info_1.getAppInfo)(cloudutils_1.DBOSCloudHost, options.json);
|
97
|
-
process.exit(exitCode);
|
98
|
-
});
|
99
|
-
applicationCommands
|
100
|
-
.command('logs')
|
101
|
-
.description("Print this application's logs")
|
102
|
-
.option('-l, --last <integer>', 'How far back to query, in seconds from current time. By default, we retrieve all data', parseInt)
|
103
|
-
.action(async (options) => {
|
104
|
-
const exitCode = await (0, applications_1.getAppLogs)(cloudutils_1.DBOSCloudHost, options.last);
|
105
|
-
process.exit(exitCode);
|
106
|
-
});
|
107
|
-
//////////////////////////////////
|
108
|
-
/* DATABASE INSTANCE MANAGEMENT */
|
109
|
-
//////////////////////////////////
|
110
|
-
const databaseCommands = program
|
111
|
-
.command('database')
|
112
|
-
.alias('databases')
|
113
|
-
.alias('db')
|
114
|
-
.description('Manage Postgres database instances');
|
115
|
-
databaseCommands
|
116
|
-
.command('provision')
|
117
|
-
.description("Provision a Postgres database instance")
|
118
|
-
.argument('<string>', 'database instance name')
|
119
|
-
.requiredOption('-a, --admin <string>', 'Specify the admin user')
|
120
|
-
.requiredOption('-W, --password <string>', 'Specify the admin password')
|
121
|
-
.action((async (dbname, options) => {
|
122
|
-
const exitCode = await (0, userdb_1.createUserDb)(cloudutils_1.DBOSCloudHost, dbname, options.admin, options.password, true);
|
123
|
-
process.exit(exitCode);
|
124
|
-
}));
|
125
|
-
databaseCommands
|
126
|
-
.command('status')
|
127
|
-
.description("Retrieve the status of a Postgres database instance")
|
128
|
-
.argument('<string>', 'database instance name')
|
129
|
-
.option('--json', 'Emit JSON output')
|
130
|
-
.action((async (dbname, options) => {
|
131
|
-
const exitCode = await (0, userdb_1.getUserDb)(cloudutils_1.DBOSCloudHost, dbname, options.json);
|
132
|
-
process.exit(exitCode);
|
133
|
-
}));
|
134
|
-
databaseCommands
|
135
|
-
.command('list')
|
136
|
-
.description("List all your Postgres database instances")
|
137
|
-
.option('--json', 'Emit JSON output')
|
138
|
-
.action((async (options) => {
|
139
|
-
const exitCode = await (0, userdb_1.listUserDB)(cloudutils_1.DBOSCloudHost, options.json);
|
140
|
-
process.exit(exitCode);
|
141
|
-
}));
|
142
|
-
databaseCommands
|
143
|
-
.command('destroy')
|
144
|
-
.description("Destroy a Postgres database instance")
|
145
|
-
.argument('<string>', 'database instance name')
|
146
|
-
.action((async (dbname) => {
|
147
|
-
const exitCode = await (0, userdb_1.deleteUserDb)(cloudutils_1.DBOSCloudHost, dbname);
|
148
|
-
process.exit(exitCode);
|
149
|
-
}));
|
150
|
-
program.parse(process.argv);
|
151
|
-
// If no arguments provided, display help by default
|
152
|
-
if (!process.argv.slice(2).length) {
|
153
|
-
program.outputHelp();
|
154
|
-
}
|
155
|
-
//# sourceMappingURL=cli.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../packages/dbos-cloud/cli.ts"],"names":[],"mappings":";;;AAEA,iDAOwB;AACxB,yCAAoC;AACpC,mCAAgC;AAChC,yCAA0C;AAC1C,qCAA6E;AAC7E,6CAAkF;AAClF,8DAAyD;AAEzD,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,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,UAAU,CAAC;KACrD,MAAM,CAAC,KAAK,EAAE,OAA6B,EAAE,EAAE;IAC9C,MAAM,QAAQ,GAAG,MAAM,IAAA,aAAK,EAAC,OAAO,CAAC,QAAQ,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AC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACzB,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,CAAC;IAClC,OAAO,CAAC,UAAU,EAAE,CAAC;AACvB,CAAC"}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
/// <reference types="node" />
|
2
|
-
import { Logger } from "winston";
|
3
|
-
import { AxiosError } from "axios";
|
4
|
-
export interface DBOSCloudCredentials {
|
5
|
-
token: string;
|
6
|
-
userName: string;
|
7
|
-
}
|
8
|
-
export declare const dbosConfigFilePath = "dbos-config.yaml";
|
9
|
-
export declare const DBOSCloudHost: string;
|
10
|
-
export declare const dbosEnvPath = ".dbos";
|
11
|
-
export declare function retrieveApplicationName(logger: Logger): string | null;
|
12
|
-
export declare function getLogger(): Logger;
|
13
|
-
export declare function getCloudCredentials(): DBOSCloudCredentials;
|
14
|
-
export declare function credentialsExist(): boolean;
|
15
|
-
export declare function deleteCredentials(): void;
|
16
|
-
export declare function runCommand(command: string, args?: string[]): Promise<number>;
|
17
|
-
export declare function readFileSync(path: string, encoding?: BufferEncoding): string | Buffer;
|
18
|
-
export declare const sleep: (ms: number) => Promise<unknown>;
|
19
|
-
export type ValuesOf<T> = T[keyof T];
|
20
|
-
export declare function createDirectory(path: string): string | undefined;
|
21
|
-
interface CloudAPIErrorResponse {
|
22
|
-
message: string;
|
23
|
-
statusCode: number;
|
24
|
-
requestID: string;
|
25
|
-
}
|
26
|
-
export declare function isCloudAPIErrorResponse(obj: unknown): obj is CloudAPIErrorResponse;
|
27
|
-
export declare function handleAPIErrors(label: string, e: AxiosError): void;
|
28
|
-
export {};
|
29
|
-
//# sourceMappingURL=cloudutils.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"cloudutils.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B,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,QAI3D"}
|
@@ -1,138 +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.handleAPIErrors = exports.isCloudAPIErrorResponse = exports.createDirectory = exports.sleep = exports.readFileSync = exports.runCommand = exports.deleteCredentials = exports.credentialsExist = exports.getCloudCredentials = exports.getLogger = exports.retrieveApplicationName = exports.dbosEnvPath = exports.DBOSCloudHost = exports.dbosConfigFilePath = void 0;
|
7
|
-
const child_process_1 = require("child_process");
|
8
|
-
const winston_1 = require("winston");
|
9
|
-
const fs_1 = __importDefault(require("fs"));
|
10
|
-
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
11
|
-
const node_path_1 = __importDefault(require("node:path"));
|
12
|
-
exports.dbosConfigFilePath = "dbos-config.yaml";
|
13
|
-
exports.DBOSCloudHost = process.env.DBOS_DOMAIN || "cloud.dbos.dev";
|
14
|
-
exports.dbosEnvPath = ".dbos";
|
15
|
-
function retrieveApplicationName(logger) {
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
17
|
-
const packageJson = require(node_path_1.default.join(process.cwd(), 'package.json'));
|
18
|
-
const appName = packageJson.name;
|
19
|
-
if (appName === undefined) {
|
20
|
-
logger.error("Error: cannot find a valid package.json file. Please run this command in an application root directory.");
|
21
|
-
return null;
|
22
|
-
}
|
23
|
-
logger.info(`Loaded application name from package.json: ${appName}`);
|
24
|
-
return appName;
|
25
|
-
}
|
26
|
-
exports.retrieveApplicationName = retrieveApplicationName;
|
27
|
-
// FIXME: we should have a global instance of the logger created in cli.ts
|
28
|
-
function getLogger() {
|
29
|
-
const winstonTransports = [];
|
30
|
-
winstonTransports.push(new winston_1.transports.Console({
|
31
|
-
format: consoleFormat,
|
32
|
-
level: "info",
|
33
|
-
}));
|
34
|
-
return (0, winston_1.createLogger)({ transports: winstonTransports });
|
35
|
-
}
|
36
|
-
exports.getLogger = getLogger;
|
37
|
-
const consoleFormat = winston_1.format.combine(winston_1.format.errors({ stack: true }), winston_1.format.timestamp(), winston_1.format.colorize(), winston_1.format.printf((info) => {
|
38
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
39
|
-
const { timestamp, level, message, stack } = info;
|
40
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment
|
41
|
-
const ts = timestamp.slice(0, 19).replace("T", " ");
|
42
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment
|
43
|
-
const formattedStack = stack?.split("\n").slice(1).join("\n");
|
44
|
-
const messageString = typeof message === "string" ? message : JSON.stringify(message);
|
45
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
46
|
-
return `${ts} [${level}]: ${messageString} ${stack ? "\n" + formattedStack : ""}`;
|
47
|
-
}));
|
48
|
-
function isTokenExpired(token) {
|
49
|
-
try {
|
50
|
-
const { exp } = jsonwebtoken_1.default.decode(token);
|
51
|
-
if (!exp)
|
52
|
-
return false;
|
53
|
-
return Date.now() >= exp * 1000;
|
54
|
-
}
|
55
|
-
catch (error) {
|
56
|
-
return true;
|
57
|
-
}
|
58
|
-
}
|
59
|
-
function getCloudCredentials() {
|
60
|
-
const logger = getLogger();
|
61
|
-
if (!credentialsExist()) {
|
62
|
-
logger.error("Error: not logged in");
|
63
|
-
process.exit(1);
|
64
|
-
}
|
65
|
-
const userCredentials = JSON.parse(fs_1.default.readFileSync(`./${exports.dbosEnvPath}/credentials`).toString("utf-8"));
|
66
|
-
const credentials = {
|
67
|
-
userName: userCredentials.userName,
|
68
|
-
token: userCredentials.token.replace(/\r|\n/g, ""), // Trim the trailing /r /n.
|
69
|
-
};
|
70
|
-
if (isTokenExpired(credentials.token)) {
|
71
|
-
logger.error("Error: Login expired. Please log in again with 'npx dbos-cloud login -u <username>'");
|
72
|
-
process.exit(1);
|
73
|
-
}
|
74
|
-
return credentials;
|
75
|
-
}
|
76
|
-
exports.getCloudCredentials = getCloudCredentials;
|
77
|
-
function credentialsExist() {
|
78
|
-
return fs_1.default.existsSync(`./${exports.dbosEnvPath}/credentials`);
|
79
|
-
}
|
80
|
-
exports.credentialsExist = credentialsExist;
|
81
|
-
function deleteCredentials() {
|
82
|
-
fs_1.default.unlinkSync(`./${exports.dbosEnvPath}/credentials`);
|
83
|
-
}
|
84
|
-
exports.deleteCredentials = deleteCredentials;
|
85
|
-
// Run a command, streaming its output to stdout
|
86
|
-
function runCommand(command, args = []) {
|
87
|
-
return new Promise((resolve, reject) => {
|
88
|
-
const stdio = 'inherit';
|
89
|
-
const process = (0, child_process_1.spawn)(command, args, { stdio });
|
90
|
-
process.on('close', (code) => {
|
91
|
-
if (code === 0) {
|
92
|
-
resolve(code);
|
93
|
-
}
|
94
|
-
else {
|
95
|
-
reject(new Error(`Command "${command}" exited with code ${code}`));
|
96
|
-
}
|
97
|
-
});
|
98
|
-
process.on('error', (error) => {
|
99
|
-
reject(error);
|
100
|
-
});
|
101
|
-
});
|
102
|
-
}
|
103
|
-
exports.runCommand = runCommand;
|
104
|
-
function readFileSync(path, encoding = "utf8") {
|
105
|
-
// First, check the file
|
106
|
-
fs_1.default.stat(path, (error, stats) => {
|
107
|
-
if (error) {
|
108
|
-
throw new Error(`checking on ${path}. ${error.code}: ${error.errno}`);
|
109
|
-
}
|
110
|
-
else if (!stats.isFile()) {
|
111
|
-
throw new Error(`config file ${path} is not a file`);
|
112
|
-
}
|
113
|
-
});
|
114
|
-
// Then, read its content
|
115
|
-
const fileContent = fs_1.default.readFileSync(path, { encoding });
|
116
|
-
return fileContent;
|
117
|
-
}
|
118
|
-
exports.readFileSync = readFileSync;
|
119
|
-
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
120
|
-
exports.sleep = sleep;
|
121
|
-
function createDirectory(path) {
|
122
|
-
return fs_1.default.mkdirSync(path, { recursive: true });
|
123
|
-
}
|
124
|
-
exports.createDirectory = createDirectory;
|
125
|
-
function isCloudAPIErrorResponse(obj) {
|
126
|
-
return typeof obj === 'object' && obj !== null &&
|
127
|
-
'message' in obj && typeof obj['message'] === 'string' &&
|
128
|
-
'statusCode' in obj && typeof obj['statusCode'] === 'number' &&
|
129
|
-
'requestID' in obj && typeof obj['requestID'] === 'string';
|
130
|
-
}
|
131
|
-
exports.isCloudAPIErrorResponse = isCloudAPIErrorResponse;
|
132
|
-
function handleAPIErrors(label, e) {
|
133
|
-
const logger = getLogger();
|
134
|
-
const resp = e.response?.data;
|
135
|
-
logger.error(`[${resp.requestID}] ${label}: ${resp.message}.`);
|
136
|
-
}
|
137
|
-
exports.handleAPIErrors = handleAPIErrors;
|
138
|
-
//# sourceMappingURL=cloudutils.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"cloudutils.js","sourceRoot":"","sources":["../../../packages/dbos-cloud/cloudutils.ts"],"names":[],"mappings":";;;;;;AACA,iDAAoD;AACpD,qCAAmE;AACnE,4CAAoB;AAEpB,gEAA+B;AAC/B,0DAA6B;AAOhB,QAAA,kBAAkB,GAAG,kBAAkB,CAAC;AACxC,QAAA,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,gBAAgB,CAAC;AAC5D,QAAA,WAAW,GAAG,OAAO,CAAC;AAEnC,SAAgB,uBAAuB,CAAC,MAAc;IAClD,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,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,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