@dbos-inc/dbos-sdk 0.10.7-preview → 0.10.11-preview
Sign up to get free protection for your applications and to get access to all the features.
- 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/package.json +1 -1
- package/dist/packages/communicator-bcrypt/index.d.ts +0 -8
- package/dist/packages/communicator-bcrypt/index.d.ts.map +0 -1
- package/dist/packages/communicator-bcrypt/index.js +0 -43
- package/dist/packages/communicator-bcrypt/index.js.map +0 -1
- package/dist/packages/communicator-datetime/index.d.ts +0 -7
- package/dist/packages/communicator-datetime/index.d.ts.map +0 -1
- package/dist/packages/communicator-datetime/index.js +0 -35
- package/dist/packages/communicator-datetime/index.js.map +0 -1
- package/dist/packages/communicator-random/index.d.ts +0 -6
- package/dist/packages/communicator-random/index.d.ts.map +0 -1
- package/dist/packages/communicator-random/index.js +0 -26
- package/dist/packages/communicator-random/index.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/delete-app.d.ts +0 -2
- package/dist/packages/dbos-cloud/applications/delete-app.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/delete-app.js +0 -41
- package/dist/packages/dbos-cloud/applications/delete-app.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/deploy-app-code.d.ts +0 -2
- package/dist/packages/dbos-cloud/applications/deploy-app-code.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/deploy-app-code.js +0 -161
- package/dist/packages/dbos-cloud/applications/deploy-app-code.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/get-app-info.d.ts +0 -2
- package/dist/packages/dbos-cloud/applications/get-app-info.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/get-app-info.js +0 -54
- package/dist/packages/dbos-cloud/applications/get-app-info.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/get-app-logs.d.ts +0 -2
- package/dist/packages/dbos-cloud/applications/get-app-logs.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/get-app-logs.js +0 -53
- package/dist/packages/dbos-cloud/applications/get-app-logs.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/index.d.ts +0 -7
- package/dist/packages/dbos-cloud/applications/index.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/index.js +0 -16
- package/dist/packages/dbos-cloud/applications/index.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/list-apps.d.ts +0 -2
- package/dist/packages/dbos-cloud/applications/list-apps.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/list-apps.js +0 -54
- package/dist/packages/dbos-cloud/applications/list-apps.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/register-app.d.ts +0 -2
- package/dist/packages/dbos-cloud/applications/register-app.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/register-app.js +0 -46
- package/dist/packages/dbos-cloud/applications/register-app.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/types.d.ts +0 -9
- package/dist/packages/dbos-cloud/applications/types.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/types.js +0 -3
- package/dist/packages/dbos-cloud/applications/types.js.map +0 -1
- package/dist/packages/dbos-cloud/applications/update-app.d.ts +0 -2
- package/dist/packages/dbos-cloud/applications/update-app.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/applications/update-app.js +0 -45
- package/dist/packages/dbos-cloud/applications/update-app.js.map +0 -1
- package/dist/packages/dbos-cloud/cli.d.ts +0 -3
- package/dist/packages/dbos-cloud/cli.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/cli.js +0 -155
- package/dist/packages/dbos-cloud/cli.js.map +0 -1
- package/dist/packages/dbos-cloud/cloudutils.d.ts +0 -29
- package/dist/packages/dbos-cloud/cloudutils.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/cloudutils.js +0 -140
- package/dist/packages/dbos-cloud/cloudutils.js.map +0 -1
- package/dist/packages/dbos-cloud/login.d.ts +0 -2
- package/dist/packages/dbos-cloud/login.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/login.js +0 -103
- package/dist/packages/dbos-cloud/login.js.map +0 -1
- package/dist/packages/dbos-cloud/register.d.ts +0 -2
- package/dist/packages/dbos-cloud/register.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/register.js +0 -75
- package/dist/packages/dbos-cloud/register.js.map +0 -1
- package/dist/packages/dbos-cloud/userdb.d.ts +0 -13
- package/dist/packages/dbos-cloud/userdb.d.ts.map +0 -1
- package/dist/packages/dbos-cloud/userdb.js +0 -153
- package/dist/packages/dbos-cloud/userdb.js.map +0 -1
- package/dist/packages/dbos-openapi/TypeParser.d.ts +0 -36
- package/dist/packages/dbos-openapi/TypeParser.d.ts.map +0 -1
- package/dist/packages/dbos-openapi/TypeParser.js +0 -162
- package/dist/packages/dbos-openapi/TypeParser.js.map +0 -1
- package/dist/packages/dbos-openapi/cli.d.ts +0 -3
- package/dist/packages/dbos-openapi/cli.d.ts.map +0 -1
- package/dist/packages/dbos-openapi/cli.js +0 -32
- package/dist/packages/dbos-openapi/cli.js.map +0 -1
- package/dist/packages/dbos-openapi/openApi.d.ts +0 -36
- package/dist/packages/dbos-openapi/openApi.d.ts.map +0 -1
- package/dist/packages/dbos-openapi/openApi.js +0 -566
- package/dist/packages/dbos-openapi/openApi.js.map +0 -1
- package/dist/packages/dbos-openapi/tests/makeProgram.d.ts +0 -3
- package/dist/packages/dbos-openapi/tests/makeProgram.d.ts.map +0 -1
- package/dist/packages/dbos-openapi/tests/makeProgram.js +0 -71
- package/dist/packages/dbos-openapi/tests/makeProgram.js.map +0 -1
- package/dist/packages/dbos-openapi/tests/openapi.test.d.ts +0 -2
- package/dist/packages/dbos-openapi/tests/openapi.test.d.ts.map +0 -1
- package/dist/packages/dbos-openapi/tests/openapi.test.js +0 -373
- package/dist/packages/dbos-openapi/tests/openapi.test.js.map +0 -1
- package/dist/packages/dbos-openapi/tsDiagUtil.d.ts +0 -16
- package/dist/packages/dbos-openapi/tsDiagUtil.d.ts.map +0 -1
- package/dist/packages/dbos-openapi/tsDiagUtil.js +0 -72
- package/dist/packages/dbos-openapi/tsDiagUtil.js.map +0 -1
package/package.json
CHANGED
@@ -1,8 +0,0 @@
|
|
1
|
-
import { CommunicatorContext } from '@dbos-inc/dbos-sdk';
|
2
|
-
declare class BcryptCommunicator {
|
3
|
-
static bcryptGenSalt(_ctx: CommunicatorContext, saltRounds?: number): Promise<string>;
|
4
|
-
static bcryptHash(_ctx: CommunicatorContext, txt: string, saltRounds?: number): Promise<string>;
|
5
|
-
static bcryptCompare(txt: string, hashedTxt: string): Promise<boolean>;
|
6
|
-
}
|
7
|
-
export { BcryptCommunicator };
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/communicator-bcrypt/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AAKrE,cAAM,kBAAkB;WAGP,aAAa,CAAC,IAAI,EAAE,mBAAmB,EAAE,UAAU,GAAE,MAAW,GAAI,OAAO,CAAC,MAAM,CAAC;WAMnF,UAAU,CAAC,IAAI,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,GAAE,MAAW,GAAI,OAAO,CAAC,MAAM,CAAC;WAI7F,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAI/E;AAED,OACA,EACI,kBAAkB,EACrB,CAAA"}
|
@@ -1,43 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
-
};
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
-
};
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
-
};
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
exports.BcryptCommunicator = void 0;
|
16
|
-
const dbos_sdk_1 = require("@dbos-inc/dbos-sdk");
|
17
|
-
const bcryptjs_1 = __importDefault(require("bcryptjs"));
|
18
|
-
class BcryptCommunicator {
|
19
|
-
static async bcryptGenSalt(_ctx, saltRounds = 10) {
|
20
|
-
return await bcryptjs_1.default.genSalt(saltRounds);
|
21
|
-
}
|
22
|
-
static async bcryptHash(_ctx, txt, saltRounds = 10) {
|
23
|
-
return await bcryptjs_1.default.hash(txt, saltRounds);
|
24
|
-
}
|
25
|
-
static async bcryptCompare(txt, hashedTxt) {
|
26
|
-
const isMatch = bcryptjs_1.default.compare(txt, hashedTxt);
|
27
|
-
return isMatch;
|
28
|
-
}
|
29
|
-
}
|
30
|
-
exports.BcryptCommunicator = BcryptCommunicator;
|
31
|
-
__decorate([
|
32
|
-
(0, dbos_sdk_1.Communicator)(),
|
33
|
-
__metadata("design:type", Function),
|
34
|
-
__metadata("design:paramtypes", [Object, Number]),
|
35
|
-
__metadata("design:returntype", Promise)
|
36
|
-
], BcryptCommunicator, "bcryptGenSalt", null);
|
37
|
-
__decorate([
|
38
|
-
(0, dbos_sdk_1.Communicator)(),
|
39
|
-
__metadata("design:type", Function),
|
40
|
-
__metadata("design:paramtypes", [Object, String, Number]),
|
41
|
-
__metadata("design:returntype", Promise)
|
42
|
-
], BcryptCommunicator, "bcryptHash", null);
|
43
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/communicator-bcrypt/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,iDAAqE;AAErE,wDAAgC;AAGhC,MAAM,kBAAkB;IAGP,AAAb,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,IAAyB,EAAE,aAAqB,EAAE;QAEzE,OAAO,MAAM,kBAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC;IAGY,AAAb,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,IAAyB,EAAE,GAAW,EAAE,aAAqB,EAAE;QACnF,OAAO,MAAM,kBAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IAChD,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,GAAW,EAAE,SAAiB;QACrD,MAAM,OAAO,GAAG,kBAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QACjD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAIG,gDAAkB;AAlBL;IADZ,IAAA,uBAAY,GAAE;;;;6CAId;AAGY;IADZ,IAAA,uBAAY,GAAE;;;;0CAGd"}
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import { CommunicatorContext } from '@dbos-inc/dbos-sdk';
|
2
|
-
declare class CurrentTimeCommunicator {
|
3
|
-
static getCurrentDate(_ctx: CommunicatorContext): Promise<Date>;
|
4
|
-
static getCurrentTime(_ctx: CommunicatorContext): Promise<number>;
|
5
|
-
}
|
6
|
-
export { CurrentTimeCommunicator };
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/communicator-datetime/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AAErE,cAAM,uBAAuB;IAGzB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,mBAAmB,GAAI,OAAO,CAAC,IAAI,CAAC;IAKhE,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,mBAAmB,GAAI,OAAO,CAAC,MAAM,CAAC;CAGrE;AAED,OACA,EACI,uBAAuB,EAC1B,CAAA"}
|
@@ -1,35 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
-
};
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.CurrentTimeCommunicator = void 0;
|
13
|
-
const dbos_sdk_1 = require("@dbos-inc/dbos-sdk");
|
14
|
-
class CurrentTimeCommunicator {
|
15
|
-
static getCurrentDate(_ctx) {
|
16
|
-
return Promise.resolve(new Date());
|
17
|
-
}
|
18
|
-
static getCurrentTime(_ctx) {
|
19
|
-
return Promise.resolve(new Date().getTime());
|
20
|
-
}
|
21
|
-
}
|
22
|
-
exports.CurrentTimeCommunicator = CurrentTimeCommunicator;
|
23
|
-
__decorate([
|
24
|
-
(0, dbos_sdk_1.Communicator)(),
|
25
|
-
__metadata("design:type", Function),
|
26
|
-
__metadata("design:paramtypes", [Object]),
|
27
|
-
__metadata("design:returntype", Promise)
|
28
|
-
], CurrentTimeCommunicator, "getCurrentDate", null);
|
29
|
-
__decorate([
|
30
|
-
(0, dbos_sdk_1.Communicator)(),
|
31
|
-
__metadata("design:type", Function),
|
32
|
-
__metadata("design:paramtypes", [Object]),
|
33
|
-
__metadata("design:returntype", Promise)
|
34
|
-
], CurrentTimeCommunicator, "getCurrentTime", null);
|
35
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/communicator-datetime/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,iDAAqE;AAErE,MAAM,uBAAuB;IAGlB,AAAP,MAAM,CAAC,cAAc,CAAC,IAAyB;QAC3C,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;IACvC,CAAC;IAGM,AAAP,MAAM,CAAC,cAAc,CAAC,IAAyB;QAC3C,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;IACjD,CAAC;CACJ;AAIG,0DAAuB;AAZhB;IADN,IAAA,uBAAY,GAAE;;;;mDAGd;AAGM;IADN,IAAA,uBAAY,GAAE;;;;mDAGd"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/communicator-random/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AAErE,cAAM,kBAAkB;IAGpB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,mBAAmB,GAAI,OAAO,CAAC,MAAM,CAAC;CAG7D;AAED,OACA,EACI,kBAAkB,EACrB,CAAA"}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
-
};
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.RandomCommunicator = void 0;
|
13
|
-
const dbos_sdk_1 = require("@dbos-inc/dbos-sdk");
|
14
|
-
class RandomCommunicator {
|
15
|
-
static random(_ctx) {
|
16
|
-
return Promise.resolve(Math.random());
|
17
|
-
}
|
18
|
-
}
|
19
|
-
exports.RandomCommunicator = RandomCommunicator;
|
20
|
-
__decorate([
|
21
|
-
(0, dbos_sdk_1.Communicator)(),
|
22
|
-
__metadata("design:type", Function),
|
23
|
-
__metadata("design:paramtypes", [Object]),
|
24
|
-
__metadata("design:returntype", Promise)
|
25
|
-
], RandomCommunicator, "random", null);
|
26
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/communicator-random/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,iDAAqE;AAErE,MAAM,kBAAkB;IAGb,AAAP,MAAM,CAAC,MAAM,CAAC,IAAyB;QACnC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1C,CAAC;CACJ;AAIG,gDAAkB;AAPX;IADN,IAAA,uBAAY,GAAE;;;;sCAGd"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"delete-app.d.ts","sourceRoot":"","sources":["../../../../packages/dbos-cloud/applications/delete-app.ts"],"names":[],"mappings":"AAGA,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA+B7D"}
|
@@ -1,41 +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.deleteApp = void 0;
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
8
|
-
const cloudutils_1 = require("../cloudutils");
|
9
|
-
async function deleteApp(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(`Deleting application: ${appName}`);
|
18
|
-
try {
|
19
|
-
await axios_1.default.delete(`https://${host}/v1alpha1/${userCredentials.userName}/applications/${appName}`, {
|
20
|
-
headers: {
|
21
|
-
"Content-Type": "application/json",
|
22
|
-
Authorization: bearerToken,
|
23
|
-
},
|
24
|
-
});
|
25
|
-
logger.info(`Successfully deleted application: ${appName}`);
|
26
|
-
return 0;
|
27
|
-
}
|
28
|
-
catch (e) {
|
29
|
-
const errorLabel = `Failed to delete application ${appName}`;
|
30
|
-
const axiosError = e;
|
31
|
-
if ((0, cloudutils_1.isCloudAPIErrorResponse)(axiosError.response?.data)) {
|
32
|
-
(0, cloudutils_1.handleAPIErrors)(errorLabel, axiosError);
|
33
|
-
}
|
34
|
-
else {
|
35
|
-
logger.error(`${errorLabel}: ${e.message}`);
|
36
|
-
}
|
37
|
-
return 1;
|
38
|
-
}
|
39
|
-
}
|
40
|
-
exports.deleteApp = deleteApp;
|
41
|
-
//# sourceMappingURL=delete-app.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"delete-app.js","sourceRoot":"","sources":["../../../../packages/dbos-cloud/applications/delete-app.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0C;AAC1C,8CAAkI;AAE3H,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,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,yBAAyB,OAAO,EAAE,CAAC,CAAA;IAE/C,IAAI,CAAC;QACH,MAAM,eAAK,CAAC,MAAM,CAAC,WAAW,IAAI,aAAa,eAAe,CAAC,QAAQ,iBAAiB,OAAO,EAAE,EAAE;YACjG,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,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;AA/BD,8BA+BC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"deploy-app-code.d.ts","sourceRoot":"","sources":["../../../../packages/dbos-cloud/applications/deploy-app-code.ts"],"names":[],"mappings":"AAcA,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAsGlF"}
|
@@ -1,161 +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.deployAppCode = void 0;
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
8
|
-
const child_process_1 = require("child_process");
|
9
|
-
const fs_1 = require("fs");
|
10
|
-
const cloudutils_1 = require("../cloudutils");
|
11
|
-
const path_1 = __importDefault(require("path"));
|
12
|
-
const deployDirectoryName = "dbos_deploy";
|
13
|
-
async function deployAppCode(host, docker) {
|
14
|
-
const logger = (0, cloudutils_1.getLogger)();
|
15
|
-
const userCredentials = (0, cloudutils_1.getCloudCredentials)();
|
16
|
-
const bearerToken = "Bearer " + userCredentials.token;
|
17
|
-
const appName = (0, cloudutils_1.retrieveApplicationName)(logger);
|
18
|
-
if (appName === null) {
|
19
|
-
return 1;
|
20
|
-
}
|
21
|
-
logger.info(`Loaded application name from package.json: ${appName}`);
|
22
|
-
(0, cloudutils_1.createDirectory)(deployDirectoryName);
|
23
|
-
// Verify that package-lock.json exists
|
24
|
-
if (!(0, fs_1.existsSync)(path_1.default.join(process.cwd(), 'package-lock.json'))) {
|
25
|
-
logger.error("package-lock.json not found. Please run 'npm install' before deploying.");
|
26
|
-
return 1;
|
27
|
-
}
|
28
|
-
if (docker) {
|
29
|
-
// Build the application inside a Docker container using the same base image as our cloud setup
|
30
|
-
logger.info(`Building ${appName} using Docker`);
|
31
|
-
const dockerSuccess = await buildAppInDocker(appName);
|
32
|
-
if (!dockerSuccess) {
|
33
|
-
return 1;
|
34
|
-
}
|
35
|
-
}
|
36
|
-
else {
|
37
|
-
// Zip the current directory and deploy from there. Requires app to have already been built. Only for testing.
|
38
|
-
(0, child_process_1.execSync)(`zip -ry ${deployDirectoryName}/${appName}.zip ./* -x ${deployDirectoryName}/* > /dev/null`);
|
39
|
-
}
|
40
|
-
const interpolatedConfig = readInterpolatedConfig(cloudutils_1.dbosConfigFilePath);
|
41
|
-
(0, fs_1.writeFileSync)(`${deployDirectoryName}/${cloudutils_1.dbosConfigFilePath}`, interpolatedConfig);
|
42
|
-
(0, child_process_1.execSync)(`zip -j ${deployDirectoryName}/${appName}.zip ${deployDirectoryName}/${cloudutils_1.dbosConfigFilePath} > /dev/null`);
|
43
|
-
try {
|
44
|
-
const zipData = (0, cloudutils_1.readFileSync)(`${deployDirectoryName}/${appName}.zip`, "base64");
|
45
|
-
// Submit the deploy request
|
46
|
-
logger.info(`Submitting deploy request for ${appName}`);
|
47
|
-
const response = await axios_1.default.post(`https://${host}/v1alpha1/${userCredentials.userName}/applications/${appName}`, {
|
48
|
-
application_archive: zipData,
|
49
|
-
}, {
|
50
|
-
headers: {
|
51
|
-
"Content-Type": "application/json",
|
52
|
-
Authorization: bearerToken,
|
53
|
-
},
|
54
|
-
});
|
55
|
-
const deployOutput = response.data;
|
56
|
-
logger.info(`Submitted deploy request for ${appName}. Assigned version: ${deployOutput.ApplicationVersion}`);
|
57
|
-
// Wait for the application to become available
|
58
|
-
let count = 0;
|
59
|
-
let applicationAvailable = false;
|
60
|
-
while (!applicationAvailable) {
|
61
|
-
count += 1;
|
62
|
-
if (count % 5 === 0) {
|
63
|
-
logger.info(`Waiting for ${appName} with version ${deployOutput.ApplicationVersion} to be available`);
|
64
|
-
if (count > 20) {
|
65
|
-
logger.info(`If ${appName} takes too long to become available, check its logs with 'npx dbos-cloud applications logs'`);
|
66
|
-
}
|
67
|
-
}
|
68
|
-
if (count > 180) {
|
69
|
-
logger.error("Application taking too long to become available");
|
70
|
-
return 1;
|
71
|
-
}
|
72
|
-
// Retrieve the application status, check if it is "AVAILABLE"
|
73
|
-
const list = await axios_1.default.get(`https://${host}/v1alpha1/${userCredentials.userName}/applications`, {
|
74
|
-
headers: {
|
75
|
-
Authorization: bearerToken,
|
76
|
-
},
|
77
|
-
});
|
78
|
-
const applications = list.data;
|
79
|
-
for (const application of applications) {
|
80
|
-
if (application.Name === appName && application.Status === "AVAILABLE") {
|
81
|
-
applicationAvailable = true;
|
82
|
-
}
|
83
|
-
}
|
84
|
-
await (0, cloudutils_1.sleep)(1000);
|
85
|
-
}
|
86
|
-
await (0, cloudutils_1.sleep)(5000); // Leave time for route cache updates
|
87
|
-
logger.info(`Application ${appName} successfuly deployed`);
|
88
|
-
logger.info(`Access your application at https://${host}/apps/${userCredentials.userName}/${appName}`);
|
89
|
-
return 0;
|
90
|
-
}
|
91
|
-
catch (e) {
|
92
|
-
const errorLabel = `Failed to deploy application ${appName}`;
|
93
|
-
const axiosError = e;
|
94
|
-
if ((0, cloudutils_1.isCloudAPIErrorResponse)(axiosError.response?.data)) {
|
95
|
-
(0, cloudutils_1.handleAPIErrors)(errorLabel, axiosError);
|
96
|
-
}
|
97
|
-
else {
|
98
|
-
logger.error(`${errorLabel}: ${e.message}`);
|
99
|
-
}
|
100
|
-
return 1;
|
101
|
-
}
|
102
|
-
}
|
103
|
-
exports.deployAppCode = deployAppCode;
|
104
|
-
function readInterpolatedConfig(configFilePath) {
|
105
|
-
const configFileContent = (0, cloudutils_1.readFileSync)(configFilePath);
|
106
|
-
const regex = /\${([^}]+)}/g; // Regex to match ${VAR_NAME} style placeholders
|
107
|
-
return configFileContent.replace(regex, (_, g1) => {
|
108
|
-
return process.env[g1] || ""; // If the env variable is not set, return an empty string.
|
109
|
-
});
|
110
|
-
}
|
111
|
-
async function buildAppInDocker(appName) {
|
112
|
-
const logger = (0, cloudutils_1.getLogger)();
|
113
|
-
// Verify Docker is running
|
114
|
-
try {
|
115
|
-
(0, child_process_1.execSync)(`docker > /dev/null 2>&1`);
|
116
|
-
}
|
117
|
-
catch (e) {
|
118
|
-
logger.error("Docker not available. To deploy, please start the Docker daemon and make the `docker` command runnable without sudo.");
|
119
|
-
return false;
|
120
|
-
}
|
121
|
-
const dockerFileName = `${deployDirectoryName}/Dockerfile.dbos`;
|
122
|
-
const containerName = `dbos-builder-${appName}`;
|
123
|
-
// Dockerfile content
|
124
|
-
const dockerFileContent = `
|
125
|
-
FROM node:lts-bookworm-slim
|
126
|
-
RUN apt update
|
127
|
-
RUN apt install -y zip
|
128
|
-
WORKDIR /app
|
129
|
-
COPY . .
|
130
|
-
RUN npm clean-install
|
131
|
-
RUN npm run build
|
132
|
-
RUN npm prune --omit=dev
|
133
|
-
RUN zip -ry ${appName}.zip ./* -x "${appName}.zip" -x "${deployDirectoryName}/*" > /dev/null
|
134
|
-
`;
|
135
|
-
const dockerIgnoreContent = `
|
136
|
-
node_modules/
|
137
|
-
${deployDirectoryName}/
|
138
|
-
dist/
|
139
|
-
.dbos/
|
140
|
-
`;
|
141
|
-
try {
|
142
|
-
// Write the Dockerfile and .dockerignore
|
143
|
-
(0, fs_1.writeFileSync)(dockerFileName, dockerFileContent);
|
144
|
-
(0, fs_1.writeFileSync)(`${deployDirectoryName}/Dockerfile.dbos.dockerignore`, dockerIgnoreContent);
|
145
|
-
// Build the Docker image. As build takes a long time, use runCommand to stream its output to stdout.
|
146
|
-
await (0, cloudutils_1.runCommand)('docker', ['build', '-t', appName, '-f', dockerFileName, '.']);
|
147
|
-
// Run the container
|
148
|
-
(0, child_process_1.execSync)(`docker run -d --name ${containerName} ${appName}`);
|
149
|
-
// Copy the archive from the container to the local deploy directory
|
150
|
-
(0, child_process_1.execSync)(`docker cp ${containerName}:/app/${appName}.zip ${deployDirectoryName}/${appName}.zip`);
|
151
|
-
// Stop and remove the container
|
152
|
-
(0, child_process_1.execSync)(`docker stop ${containerName}`);
|
153
|
-
(0, child_process_1.execSync)(`docker rm ${containerName}`);
|
154
|
-
return true;
|
155
|
-
}
|
156
|
-
catch (e) {
|
157
|
-
logger.error(`Failed to build application ${appName}: ${e.message}`);
|
158
|
-
return false;
|
159
|
-
}
|
160
|
-
}
|
161
|
-
//# sourceMappingURL=deploy-app-code.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"deploy-app-code.js","sourceRoot":"","sources":["../../../../packages/dbos-cloud/applications/deploy-app-code.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0C;AAC1C,iDAAyC;AACzC,2BAA+C;AAC/C,8CAAwM;AACxM,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,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,8CAA8C,OAAO,EAAE,CAAC,CAAA;IAEpE,IAAA,4BAAe,EAAC,mBAAmB,CAAC,CAAC;IAErC,uCAAuC;IACvC,IAAI,CAAC,IAAA,eAAU,EAAC,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC;QAC/D,MAAM,CAAC,KAAK,CAAC,yEAAyE,CAAC,CAAA;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AAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CA0C7E"}
|
@@ -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.getAppInfo = void 0;
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
8
|
-
const cloudutils_1 = require("../cloudutils");
|
9
|
-
async function getAppInfo(host, json) {
|
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, json);
|
14
|
-
if (appName === null) {
|
15
|
-
return 1;
|
16
|
-
}
|
17
|
-
if (!json) {
|
18
|
-
logger.info(`Retrieving info for application: ${appName}`);
|
19
|
-
}
|
20
|
-
try {
|
21
|
-
const res = await axios_1.default.get(`https://${host}/v1alpha1/${userCredentials.userName}/applications/${appName}`, {
|
22
|
-
headers: {
|
23
|
-
"Content-Type": "application/json",
|
24
|
-
Authorization: bearerToken,
|
25
|
-
}
|
26
|
-
});
|
27
|
-
const app = res.data;
|
28
|
-
if (json) {
|
29
|
-
console.log(JSON.stringify(app));
|
30
|
-
}
|
31
|
-
else {
|
32
|
-
console.log(`Application Name: ${app.Name}`);
|
33
|
-
console.log(`ID: ${app.ID}`);
|
34
|
-
console.log(`Postgres Instance Name: ${app.PostgresInstanceName}`);
|
35
|
-
console.log(`Application Database Name: ${app.ApplicationDatabaseName}`);
|
36
|
-
console.log(`Status: ${app.Status}`);
|
37
|
-
console.log(`Version: ${app.Version}`);
|
38
|
-
}
|
39
|
-
return 0;
|
40
|
-
}
|
41
|
-
catch (e) {
|
42
|
-
const errorLabel = `Failed to retrieve info for application ${appName}`;
|
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.getAppInfo = getAppInfo;
|
54
|
-
//# sourceMappingURL=get-app-info.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"get-app-info.js","sourceRoot":"","sources":["../../../../packages/dbos-cloud/applications/get-app-info.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA2C;AAC3C,8CAAkI;AAG3H,KAAK,UAAU,UAAU,CAAC,IAAY,EAAE,IAAa;IAC1D,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,EAAE,IAAI,CAAC,CAAC;IACtD,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,CAAC,IAAI,CAAC,oCAAoC,OAAO,EAAE,CAAC,CAAA;IAC5D,CAAC;IAED,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,WAAW,IAAI,aAAa,eAAe,CAAC,QAAQ,iBAAiB,OAAO,EAAE,EAAE;YAC1G,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,aAAa,EAAE,WAAW;aAC3B;SACF,CAAC,CAAC;QACH,MAAM,GAAG,GAAG,GAAG,CAAC,IAAmB,CAAA;QACnC,IAAI,IAAI,EAAE,CAAC;YACT,OAAO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,CAAC,CAyC5E"}
|
@@ -1,53 +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.getAppLogs = void 0;
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
8
|
-
const cloudutils_1 = require("../cloudutils");
|
9
|
-
async function getAppLogs(host, last) {
|
10
|
-
if (last != undefined && (isNaN(last) || last <= 0)) {
|
11
|
-
throw new Error('The --last parmameter must be an integer greater than 0');
|
12
|
-
}
|
13
|
-
if (last == undefined) {
|
14
|
-
last = 0; //internally, 0 means "get all the logs." This is the default.
|
15
|
-
}
|
16
|
-
const logger = (0, cloudutils_1.getLogger)();
|
17
|
-
const userCredentials = (0, cloudutils_1.getCloudCredentials)();
|
18
|
-
const bearerToken = "Bearer " + userCredentials.token;
|
19
|
-
const appName = (0, cloudutils_1.retrieveApplicationName)(logger);
|
20
|
-
if (appName === null) {
|
21
|
-
return 1;
|
22
|
-
}
|
23
|
-
logger.info(`Retrieving logs for application: ${appName}`);
|
24
|
-
try {
|
25
|
-
const res = await axios_1.default.get(`https://${host}/v1alpha1/${userCredentials.userName}/logs/applications/${appName}?last=${last}`, {
|
26
|
-
headers: {
|
27
|
-
"Content-Type": "application/json",
|
28
|
-
Authorization: bearerToken,
|
29
|
-
}
|
30
|
-
});
|
31
|
-
if (res.data == "") {
|
32
|
-
logger.info(`No logs found for the specified parameters`);
|
33
|
-
}
|
34
|
-
else {
|
35
|
-
logger.info(`Successfully retrieved logs of application: ${appName}`);
|
36
|
-
logger.info(res.data);
|
37
|
-
}
|
38
|
-
return 0;
|
39
|
-
}
|
40
|
-
catch (e) {
|
41
|
-
const errorLabel = `Failed to retrieve logs of application ${appName}`;
|
42
|
-
const axiosError = e;
|
43
|
-
if ((0, cloudutils_1.isCloudAPIErrorResponse)(axiosError.response?.data)) {
|
44
|
-
(0, cloudutils_1.handleAPIErrors)(errorLabel, axiosError);
|
45
|
-
}
|
46
|
-
else {
|
47
|
-
logger.error(`${errorLabel}: ${e.message}`);
|
48
|
-
}
|
49
|
-
return 1;
|
50
|
-
}
|
51
|
-
}
|
52
|
-
exports.getAppLogs = getAppLogs;
|
53
|
-
//# sourceMappingURL=get-app-logs.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"get-app-logs.js","sourceRoot":"","sources":["../../../../packages/dbos-cloud/applications/get-app-logs.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA2C;AAC3C,8CAAkI;AAE3H,KAAK,UAAU,UAAU,CAAC,IAAY,EAAE,IAAY;IACzD,IAAI,IAAI,IAAI,SAAS,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IACD,IAAI,IAAI,IAAI,SAAS,EAAE,CAAC;QACtB,IAAI,GAAG,CAAC,CAAA,CAAM,8DAA8D;IAC9E,CAAC;IACD,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,oCAAoC,OAAO,EAAE,CAAC,CAAA;IAE1D,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,WAAW,IAAI,aAAa,eAAe,CAAC,QAAQ,sBAAsB,OAAO,SAAS,IAAI,EAAE,EAAE;YAC5H,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,aAAa,EAAE,WAAW;aAC3B;SACF,CAAC,CAAC;QACH,IAAI,GAAG,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;YACnB,MAAM,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;QAC5D,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,+CAA+C,OAAO,EAAE,CAAC,CAAC;YACtE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACvB,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,UAAU,GAAG,0CAA0C,OAAO,EAAE,CAAC;QACvE,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;AAzCD,gCAyCC"}
|
@@ -1,7 +0,0 @@
|
|
1
|
-
export { registerApp } from './register-app';
|
2
|
-
export { listApps } from './list-apps';
|
3
|
-
export { deleteApp } from './delete-app';
|
4
|
-
export { deployAppCode } from './deploy-app-code';
|
5
|
-
export { getAppLogs } from './get-app-logs';
|
6
|
-
export { updateApp } from './update-app';
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/dbos-cloud/applications/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.updateApp = exports.getAppLogs = exports.deployAppCode = exports.deleteApp = exports.listApps = exports.registerApp = void 0;
|
4
|
-
var register_app_1 = require("./register-app");
|
5
|
-
Object.defineProperty(exports, "registerApp", { enumerable: true, get: function () { return register_app_1.registerApp; } });
|
6
|
-
var list_apps_1 = require("./list-apps");
|
7
|
-
Object.defineProperty(exports, "listApps", { enumerable: true, get: function () { return list_apps_1.listApps; } });
|
8
|
-
var delete_app_1 = require("./delete-app");
|
9
|
-
Object.defineProperty(exports, "deleteApp", { enumerable: true, get: function () { return delete_app_1.deleteApp; } });
|
10
|
-
var deploy_app_code_1 = require("./deploy-app-code");
|
11
|
-
Object.defineProperty(exports, "deployAppCode", { enumerable: true, get: function () { return deploy_app_code_1.deployAppCode; } });
|
12
|
-
var get_app_logs_1 = require("./get-app-logs");
|
13
|
-
Object.defineProperty(exports, "getAppLogs", { enumerable: true, get: function () { return get_app_logs_1.getAppLogs; } });
|
14
|
-
var update_app_1 = require("./update-app");
|
15
|
-
Object.defineProperty(exports, "updateApp", { enumerable: true, get: function () { return update_app_1.updateApp; } });
|
16
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/dbos-cloud/applications/index.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,yCAAuC;AAA9B,qGAAA,QAAQ,OAAA;AACjB,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AAClB,qDAAkD;AAAzC,gHAAA,aAAa,OAAA;AACtB,+CAA4C;AAAnC,0GAAA,UAAU,OAAA;AACnB,2CAAyC;AAAhC,uGAAA,SAAS,OAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"list-apps.d.ts","sourceRoot":"","sources":["../../../../packages/dbos-cloud/applications/list-apps.ts"],"names":[],"mappings":"AAIA,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CA4C3E"}
|