@dbos-inc/dbos-cloud 2.2.9-preview.g48d872ebd0 → 2.3.7-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/dist/applications/delete-app.d.ts.map +1 -1
- package/dist/applications/delete-app.js +5 -5
- package/dist/applications/delete-app.js.map +1 -1
- package/dist/applications/deploy-app-code.d.ts.map +1 -1
- package/dist/applications/deploy-app-code.js +56 -45
- package/dist/applications/deploy-app-code.js.map +1 -1
- package/dist/applications/get-app-info.d.ts.map +1 -1
- package/dist/applications/get-app-info.js +5 -5
- package/dist/applications/get-app-info.js.map +1 -1
- package/dist/applications/get-app-logs.d.ts.map +1 -1
- package/dist/applications/get-app-logs.js +9 -9
- package/dist/applications/get-app-logs.js.map +1 -1
- package/dist/applications/index.d.ts +7 -7
- package/dist/applications/index.js +7 -7
- package/dist/applications/list-app-versions.d.ts.map +1 -1
- package/dist/applications/list-app-versions.js +7 -7
- package/dist/applications/list-app-versions.js.map +1 -1
- package/dist/applications/list-apps.js +7 -7
- package/dist/applications/manage-workflows.d.ts +10 -0
- package/dist/applications/manage-workflows.d.ts.map +1 -1
- package/dist/applications/manage-workflows.js +34 -4
- package/dist/applications/manage-workflows.js.map +1 -1
- package/dist/applications/register-app.d.ts +1 -1
- package/dist/applications/register-app.d.ts.map +1 -1
- package/dist/applications/register-app.js +6 -6
- package/dist/applications/register-app.js.map +1 -1
- package/dist/applications/secrets.d.ts +1 -1
- package/dist/applications/secrets.d.ts.map +1 -1
- package/dist/applications/secrets.js +14 -14
- package/dist/applications/secrets.js.map +1 -1
- package/dist/applications/update-app.d.ts +1 -1
- package/dist/applications/update-app.d.ts.map +1 -1
- package/dist/applications/update-app.js +4 -4
- package/dist/applications/update-app.js.map +1 -1
- package/dist/cli.js +223 -171
- package/dist/cli.js.map +1 -1
- package/dist/cloudutils.d.ts +2 -2
- package/dist/cloudutils.d.ts.map +1 -1
- package/dist/cloudutils.js +51 -51
- package/dist/cloudutils.js.map +1 -1
- package/dist/configutils.js +3 -3
- package/dist/dashboards/dashboards.js +11 -11
- package/dist/databases/databases.d.ts +2 -2
- package/dist/databases/databases.d.ts.map +1 -1
- package/dist/databases/databases.js +62 -51
- package/dist/databases/databases.js.map +1 -1
- package/dist/organizations/organization.d.ts.map +1 -1
- package/dist/organizations/organization.js +12 -12
- package/dist/organizations/organization.js.map +1 -1
- package/dist/users/authentication.d.ts +1 -1
- package/dist/users/authentication.d.ts.map +1 -1
- package/dist/users/authentication.js +23 -23
- package/dist/users/authentication.js.map +1 -1
- package/dist/users/login.d.ts.map +1 -1
- package/dist/users/login.js +5 -5
- package/dist/users/login.js.map +1 -1
- package/dist/users/profile.d.ts.map +1 -1
- package/dist/users/profile.js +4 -4
- package/dist/users/profile.js.map +1 -1
- package/dist/users/register.d.ts.map +1 -1
- package/dist/users/register.js +1 -1
- package/dist/users/register.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,43 +1,46 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { registerApp, updateApp, listApps, deleteApp, deployAppCode, getAppLogs, createSecret, listSecrets } from
|
|
3
|
-
import { Command } from
|
|
4
|
-
import { login } from
|
|
5
|
-
import { registerUser } from
|
|
6
|
-
import { createUserDb, getUserDb, deleteUserDb, listUserDB, resetDBCredentials, linkUserDB, unlinkUserDB, restoreUserDB, connect } from
|
|
7
|
-
import { launchDashboard, getDashboardURL, deleteDashboard } from
|
|
8
|
-
import { DBOSCloudHost, credentialsExist, dbosConfigFilePath, deleteCredentials, getLogger } from
|
|
9
|
-
import { getAppInfo } from
|
|
10
|
-
import promptSync from
|
|
11
|
-
import chalk from
|
|
12
|
-
import fs from
|
|
13
|
-
import { fileURLToPath } from
|
|
14
|
-
import path from
|
|
15
|
-
import updateNotifier from
|
|
16
|
-
import { profile } from
|
|
17
|
-
import { revokeRefreshToken } from
|
|
18
|
-
import { listAppVersions } from
|
|
19
|
-
import { orgInvite, orgListUsers, renameOrganization, joinOrganization, removeUserFromOrg } from
|
|
20
|
-
import { listWorkflows } from
|
|
21
|
-
import { importSecrets } from
|
|
2
|
+
import { registerApp, updateApp, listApps, deleteApp, deployAppCode, getAppLogs, createSecret, listSecrets, } from './applications/index.js';
|
|
3
|
+
import { Command } from 'commander';
|
|
4
|
+
import { login } from './users/login.js';
|
|
5
|
+
import { registerUser } from './users/register.js';
|
|
6
|
+
import { createUserDb, getUserDb, deleteUserDb, listUserDB, resetDBCredentials, linkUserDB, unlinkUserDB, restoreUserDB, connect, } from './databases/databases.js';
|
|
7
|
+
import { launchDashboard, getDashboardURL, deleteDashboard } from './dashboards/dashboards.js';
|
|
8
|
+
import { DBOSCloudHost, credentialsExist, dbosConfigFilePath, deleteCredentials, getLogger } from './cloudutils.js';
|
|
9
|
+
import { getAppInfo } from './applications/get-app-info.js';
|
|
10
|
+
import promptSync from 'prompt-sync';
|
|
11
|
+
import chalk from 'chalk';
|
|
12
|
+
import fs from 'fs';
|
|
13
|
+
import { fileURLToPath } from 'url';
|
|
14
|
+
import path from 'path';
|
|
15
|
+
import updateNotifier from 'update-notifier';
|
|
16
|
+
import { profile } from './users/profile.js';
|
|
17
|
+
import { revokeRefreshToken } from './users/authentication.js';
|
|
18
|
+
import { listAppVersions } from './applications/list-app-versions.js';
|
|
19
|
+
import { orgInvite, orgListUsers, renameOrganization, joinOrganization, removeUserFromOrg, } from './organizations/organization.js';
|
|
20
|
+
import { listQueuedWorkflows, listWorkflows, } from './applications/manage-workflows.js';
|
|
21
|
+
import { importSecrets } from './applications/secrets.js';
|
|
22
22
|
// Read local package.json
|
|
23
|
-
const __dirname = fileURLToPath(new URL(
|
|
24
|
-
const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname,
|
|
23
|
+
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
24
|
+
const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json')).toString());
|
|
25
25
|
// Notify the user if the package requires an update.
|
|
26
26
|
try {
|
|
27
27
|
const notifier = updateNotifier({
|
|
28
28
|
pkg: packageJson,
|
|
29
29
|
updateCheckInterval: 0,
|
|
30
30
|
});
|
|
31
|
-
if (notifier.update &&
|
|
31
|
+
if (notifier.update &&
|
|
32
|
+
!notifier.update.current.includes('preview') &&
|
|
33
|
+
!notifier.update.current.includes('placeholder') &&
|
|
34
|
+
notifier.update.current !== notifier.update.latest) {
|
|
32
35
|
console.log(`
|
|
33
|
-
${chalk.yellow(
|
|
36
|
+
${chalk.yellow('-----------------------------------------------------------------------------------------')}
|
|
34
37
|
|
|
35
38
|
DBOS Cloud CLI Update available ${chalk.gray(notifier.update.current)} → ${chalk.green(notifier.update.latest)}
|
|
36
39
|
|
|
37
40
|
To upgrade the DBOS Cloud CLI to the latest version, run the following command:
|
|
38
|
-
${chalk.cyan(
|
|
41
|
+
${chalk.cyan('`npm i -g @dbos-inc/dbos-cloud@latest`')}
|
|
39
42
|
|
|
40
|
-
${chalk.yellow(
|
|
43
|
+
${chalk.yellow('-----------------------------------------------------------------------------------------')}`);
|
|
41
44
|
}
|
|
42
45
|
}
|
|
43
46
|
catch (error) {
|
|
@@ -49,34 +52,34 @@ program.version(packageJson.version);
|
|
|
49
52
|
/* AUTHENTICATION */
|
|
50
53
|
/////////////////////
|
|
51
54
|
program
|
|
52
|
-
.command(
|
|
53
|
-
.description(
|
|
54
|
-
.option(
|
|
55
|
-
.option(
|
|
55
|
+
.command('login')
|
|
56
|
+
.description('Log in to DBOS cloud')
|
|
57
|
+
.option('--get-refresh-token', 'Get a refresh token you can use to programatically log in')
|
|
58
|
+
.option('--with-refresh-token <token>', 'Use a refresh token to programatically log in')
|
|
56
59
|
.action(async (options) => {
|
|
57
60
|
const exitCode = await login(DBOSCloudHost, options.getRefreshToken || false, options.withRefreshToken);
|
|
58
61
|
process.exit(exitCode);
|
|
59
62
|
});
|
|
60
63
|
program
|
|
61
|
-
.command(
|
|
62
|
-
.description(
|
|
63
|
-
.option(
|
|
64
|
+
.command('profile')
|
|
65
|
+
.description('Get user information')
|
|
66
|
+
.option('--json', 'Emit JSON output')
|
|
64
67
|
.action(async (options) => {
|
|
65
68
|
const exitCode = await profile(DBOSCloudHost, options.json);
|
|
66
69
|
process.exit(exitCode);
|
|
67
70
|
});
|
|
68
71
|
program
|
|
69
|
-
.command(
|
|
70
|
-
.description(
|
|
71
|
-
.requiredOption(
|
|
72
|
-
.option(
|
|
72
|
+
.command('register')
|
|
73
|
+
.description('Register a user with DBOS cloud')
|
|
74
|
+
.requiredOption('-u, --username <string>', 'Username')
|
|
75
|
+
.option('-s, --secret <string>', 'Organization secret')
|
|
73
76
|
.action(async (options) => {
|
|
74
77
|
const exitCode = await registerUser(options.username, options.secret, DBOSCloudHost);
|
|
75
78
|
process.exit(exitCode);
|
|
76
79
|
});
|
|
77
80
|
program
|
|
78
|
-
.command(
|
|
79
|
-
.description(
|
|
81
|
+
.command('logout')
|
|
82
|
+
.description('Log out of DBOS cloud')
|
|
80
83
|
.action(() => {
|
|
81
84
|
if (credentialsExist()) {
|
|
82
85
|
deleteCredentials();
|
|
@@ -84,9 +87,9 @@ program
|
|
|
84
87
|
process.exit(0);
|
|
85
88
|
});
|
|
86
89
|
program
|
|
87
|
-
.command(
|
|
88
|
-
.description(
|
|
89
|
-
.argument(
|
|
90
|
+
.command('revoke')
|
|
91
|
+
.description('Revoke a refresh token')
|
|
92
|
+
.argument('<token>', 'Token to revoke')
|
|
90
93
|
.action(async (token) => {
|
|
91
94
|
const exitCode = await revokeRefreshToken(getLogger(), token);
|
|
92
95
|
process.exit(exitCode);
|
|
@@ -94,129 +97,139 @@ program
|
|
|
94
97
|
/////////////////////////////
|
|
95
98
|
/* APPLICATIONS MANAGEMENT */
|
|
96
99
|
/////////////////////////////
|
|
97
|
-
const applicationCommands = program
|
|
100
|
+
const applicationCommands = program
|
|
101
|
+
.command('application')
|
|
102
|
+
.alias('applications')
|
|
103
|
+
.alias('app')
|
|
104
|
+
.alias('apps')
|
|
105
|
+
.description('Manage your DBOS applications');
|
|
98
106
|
applicationCommands
|
|
99
|
-
.command(
|
|
100
|
-
.description(
|
|
101
|
-
.argument(
|
|
102
|
-
.requiredOption(
|
|
103
|
-
.option(
|
|
104
|
-
.option(
|
|
107
|
+
.command('register')
|
|
108
|
+
.description('Register this application')
|
|
109
|
+
.argument('[string]', 'application name (Default: name from package.json)')
|
|
110
|
+
.requiredOption('-d, --database <string>', 'Specify a Postgres database instance for this application')
|
|
111
|
+
.option('--enable-timetravel', 'Enable time travel for the application', false)
|
|
112
|
+
.option('--executors-memory-mib <number>', 'Specify the memory in MiB for the executors of this application')
|
|
105
113
|
.action(async (appName, options) => {
|
|
106
114
|
const exitCode = await registerApp(options.database, DBOSCloudHost, options.enableTimetravel, appName, options.executorsMemoryMib);
|
|
107
115
|
process.exit(exitCode);
|
|
108
116
|
});
|
|
109
117
|
applicationCommands
|
|
110
|
-
.command(
|
|
111
|
-
.description(
|
|
112
|
-
.argument(
|
|
113
|
-
.option(
|
|
118
|
+
.command('update')
|
|
119
|
+
.description('Update this application')
|
|
120
|
+
.argument('[string]', 'application name (Default: name from package.json)')
|
|
121
|
+
.option('--executors-memory-mib <number>', 'Specify the memory in MiB for the executors of this application')
|
|
114
122
|
.action(async (appName, options) => {
|
|
115
123
|
const exitCode = await updateApp(DBOSCloudHost, appName, options.executorsMemoryMib);
|
|
116
124
|
process.exit(exitCode);
|
|
117
125
|
});
|
|
118
126
|
applicationCommands
|
|
119
|
-
.command(
|
|
120
|
-
.description(
|
|
121
|
-
.argument(
|
|
122
|
-
.option(
|
|
123
|
-
.option(
|
|
124
|
-
.option(
|
|
125
|
-
.option(
|
|
127
|
+
.command('deploy')
|
|
128
|
+
.description('Deploy this application to the cloud and run associated database migration commands')
|
|
129
|
+
.argument('[string]', 'application name (Default: name from package.json)')
|
|
130
|
+
.option('-p, --previous-version <string>', 'Specify a previous version to restore')
|
|
131
|
+
.option('-d, --database <string>', 'Specify a Postgres database instance for this application. This cannot be changed after the application is first deployed.')
|
|
132
|
+
.option('--enable-timetravel', 'Enable time travel for the application. This cannot be changed after the application is first deployed.', false)
|
|
133
|
+
.option('--verbose', 'Verbose log of deployment step')
|
|
126
134
|
.action(async (appName, options) => {
|
|
127
135
|
const exitCode = await deployAppCode(DBOSCloudHost, false, options.previousVersion ?? null, options.verbose ?? false, null, appName, options.database, options.enableTimetravel);
|
|
128
136
|
process.exit(exitCode);
|
|
129
137
|
});
|
|
130
138
|
applicationCommands
|
|
131
|
-
.command(
|
|
132
|
-
.description(
|
|
133
|
-
.argument(
|
|
139
|
+
.command('rollback')
|
|
140
|
+
.description('Deploy this application to the cloud and run associated database rollback commands')
|
|
141
|
+
.argument('[string]', 'application name (Default: name from package.json)')
|
|
134
142
|
.action(async (appName) => {
|
|
135
143
|
console.warn(`dbos-cloud app rollback is deprecated. Please use 'dbos-cloud db connect' instead and run rollback commands locally`);
|
|
136
144
|
const exitCode = await deployAppCode(DBOSCloudHost, true, null, false, null, appName);
|
|
137
145
|
process.exit(exitCode);
|
|
138
146
|
});
|
|
139
147
|
applicationCommands
|
|
140
|
-
.command(
|
|
148
|
+
.command('change-database-instance')
|
|
141
149
|
.description("Change this application's database instance and redeploy it")
|
|
142
|
-
.argument(
|
|
143
|
-
.option(
|
|
144
|
-
.option(
|
|
145
|
-
.requiredOption(
|
|
150
|
+
.argument('[string]', 'application name (Default: name from package.json)')
|
|
151
|
+
.option('--verbose', 'Verbose log of deployment step')
|
|
152
|
+
.option('-p, --previous-version <string>', 'Specify a previous version to restore')
|
|
153
|
+
.requiredOption('-d, --database <string>', 'Specify the new database instance name for this application')
|
|
146
154
|
.action(async (appName, options) => {
|
|
147
155
|
const exitCode = await deployAppCode(DBOSCloudHost, false, options.previousVersion ?? null, options.verbose ?? false, options.database, appName);
|
|
148
156
|
process.exit(exitCode);
|
|
149
157
|
});
|
|
150
158
|
applicationCommands
|
|
151
|
-
.command(
|
|
152
|
-
.description(
|
|
153
|
-
.argument(
|
|
154
|
-
.option(
|
|
159
|
+
.command('delete')
|
|
160
|
+
.description('Delete this application')
|
|
161
|
+
.argument('[string]', 'application name (Default: name from package.json)')
|
|
162
|
+
.option('--dropdb', 'Drop application database')
|
|
155
163
|
.action(async (appName, options) => {
|
|
156
164
|
const exitCode = await deleteApp(DBOSCloudHost, options.dropdb, appName);
|
|
157
165
|
process.exit(exitCode);
|
|
158
166
|
});
|
|
159
167
|
applicationCommands
|
|
160
|
-
.command(
|
|
161
|
-
.description(
|
|
162
|
-
.option(
|
|
168
|
+
.command('list')
|
|
169
|
+
.description('List all applications')
|
|
170
|
+
.option('--json', 'Emit JSON output')
|
|
163
171
|
.action(async (options) => {
|
|
164
172
|
const exitCode = await listApps(DBOSCloudHost, options.json);
|
|
165
173
|
process.exit(exitCode);
|
|
166
174
|
});
|
|
167
175
|
applicationCommands
|
|
168
|
-
.command(
|
|
176
|
+
.command('status')
|
|
169
177
|
.description("Retrieve this application's status")
|
|
170
|
-
.argument(
|
|
171
|
-
.option(
|
|
178
|
+
.argument('[string]', 'application name (Default: name from package.json)')
|
|
179
|
+
.option('--json', 'Emit JSON output')
|
|
172
180
|
.action(async (appName, options) => {
|
|
173
181
|
const exitCode = await getAppInfo(DBOSCloudHost, options.json, appName);
|
|
174
182
|
process.exit(exitCode);
|
|
175
183
|
});
|
|
176
184
|
applicationCommands
|
|
177
|
-
.command(
|
|
185
|
+
.command('versions')
|
|
178
186
|
.description("Retrieve a list of an application's versions")
|
|
179
|
-
.argument(
|
|
180
|
-
.option(
|
|
187
|
+
.argument('[string]', 'application name (Default: name from package.json)')
|
|
188
|
+
.option('--json', 'Emit JSON output')
|
|
181
189
|
.action(async (appName, options) => {
|
|
182
190
|
const exitCode = await listAppVersions(DBOSCloudHost, options.json, appName);
|
|
183
191
|
process.exit(exitCode);
|
|
184
192
|
});
|
|
185
193
|
applicationCommands
|
|
186
|
-
.command(
|
|
194
|
+
.command('logs')
|
|
187
195
|
.description("Print this application's logs")
|
|
188
|
-
.argument(
|
|
189
|
-
.option(
|
|
190
|
-
.option(
|
|
196
|
+
.argument('[string]', 'application name (Default: name from package.json)')
|
|
197
|
+
.option('-l, --last <integer>', 'How far back to query, in seconds from current time. By default, we retrieve all data', parseInt)
|
|
198
|
+
.option('-p, --pagesize <integer>', 'How many lines to fetch at once when paginating. Default is 1000', parseInt)
|
|
191
199
|
.action(async (appName, options) => {
|
|
192
200
|
const exitCode = await getAppLogs(DBOSCloudHost, options.last, options.pagesize, appName);
|
|
193
201
|
process.exit(exitCode);
|
|
194
202
|
});
|
|
195
|
-
const secretsCommands = applicationCommands
|
|
203
|
+
const secretsCommands = applicationCommands
|
|
204
|
+
.command('secret')
|
|
205
|
+
.alias('secrets')
|
|
206
|
+
.alias('sec')
|
|
207
|
+
.alias('env')
|
|
208
|
+
.description('Manage your application environment and secrets');
|
|
196
209
|
secretsCommands
|
|
197
|
-
.command(
|
|
198
|
-
.description(
|
|
199
|
-
.argument(
|
|
200
|
-
.requiredOption(
|
|
201
|
-
.requiredOption(
|
|
210
|
+
.command('create')
|
|
211
|
+
.description('Create a secret for this application')
|
|
212
|
+
.argument('[string]', 'application name (Default: name from package.json)')
|
|
213
|
+
.requiredOption('-s, --name <string>', 'Specify the name of the variable to create')
|
|
214
|
+
.requiredOption('-v, --value <string>', 'Specify the value of the variable')
|
|
202
215
|
.action(async (appName, options) => {
|
|
203
216
|
const exitCode = await createSecret(DBOSCloudHost, appName, options.name, options.value);
|
|
204
217
|
process.exit(exitCode);
|
|
205
218
|
});
|
|
206
219
|
secretsCommands
|
|
207
|
-
.command(
|
|
208
|
-
.description(
|
|
209
|
-
.argument(
|
|
210
|
-
.requiredOption(
|
|
220
|
+
.command('import')
|
|
221
|
+
.description('Import environment variables and secrets from a dotenv file')
|
|
222
|
+
.argument('[string]', 'application name (Default: name from package.json)')
|
|
223
|
+
.requiredOption('-d, --dotenv <string>', 'Path to a dotenv file')
|
|
211
224
|
.action(async (appName, options) => {
|
|
212
225
|
const exitCode = await importSecrets(DBOSCloudHost, appName, options.dotenv);
|
|
213
226
|
process.exit(exitCode);
|
|
214
227
|
});
|
|
215
228
|
secretsCommands
|
|
216
|
-
.command(
|
|
217
|
-
.description(
|
|
218
|
-
.argument(
|
|
219
|
-
.option(
|
|
229
|
+
.command('list')
|
|
230
|
+
.description('List secrets for this application')
|
|
231
|
+
.argument('[string]', 'application name (Default: name from package.json)')
|
|
232
|
+
.option('--json', 'Emit JSON output')
|
|
220
233
|
.action(async (appName, options) => {
|
|
221
234
|
const exitCode = await listSecrets(DBOSCloudHost, appName, options.json);
|
|
222
235
|
process.exit(exitCode);
|
|
@@ -224,103 +237,107 @@ secretsCommands
|
|
|
224
237
|
//////////////////////////////////
|
|
225
238
|
/* DATABASE INSTANCE MANAGEMENT */
|
|
226
239
|
//////////////////////////////////
|
|
227
|
-
const databaseCommands = program
|
|
240
|
+
const databaseCommands = program
|
|
241
|
+
.command('database')
|
|
242
|
+
.alias('databases')
|
|
243
|
+
.alias('db')
|
|
244
|
+
.description('Manage Postgres database instances');
|
|
228
245
|
const prompt = promptSync({ sigint: true });
|
|
229
246
|
databaseCommands
|
|
230
|
-
.command(
|
|
231
|
-
.description(
|
|
232
|
-
.argument(
|
|
233
|
-
.requiredOption(
|
|
234
|
-
.option(
|
|
247
|
+
.command('provision')
|
|
248
|
+
.description('Provision a Postgres database instance')
|
|
249
|
+
.argument('<name>', 'database instance name')
|
|
250
|
+
.requiredOption('-U, --username <string>', 'Specify your database username')
|
|
251
|
+
.option('-W, --password <string>', 'Specify your database user password')
|
|
235
252
|
.action(async (dbname, options) => {
|
|
236
253
|
if (!options.password) {
|
|
237
|
-
options.password = prompt(
|
|
254
|
+
options.password = prompt('Database Password: ', { echo: '*' });
|
|
238
255
|
}
|
|
239
256
|
const exitCode = await createUserDb(DBOSCloudHost, dbname, options.username, options.password, true);
|
|
240
257
|
process.exit(exitCode);
|
|
241
258
|
});
|
|
242
259
|
databaseCommands
|
|
243
|
-
.command(
|
|
244
|
-
.description(
|
|
245
|
-
.argument(
|
|
246
|
-
.option(
|
|
260
|
+
.command('status')
|
|
261
|
+
.description('Retrieve the status of a Postgres database instance')
|
|
262
|
+
.argument('<name>', 'database instance name')
|
|
263
|
+
.option('--json', 'Emit JSON output')
|
|
247
264
|
.action(async (dbname, options) => {
|
|
248
265
|
const exitCode = await getUserDb(DBOSCloudHost, dbname, options.json);
|
|
249
266
|
process.exit(exitCode);
|
|
250
267
|
});
|
|
251
268
|
databaseCommands
|
|
252
|
-
.command(
|
|
253
|
-
.description(
|
|
254
|
-
.option(
|
|
269
|
+
.command('list')
|
|
270
|
+
.description('List all your Postgres database instances')
|
|
271
|
+
.option('--json', 'Emit JSON output')
|
|
255
272
|
.action(async (options) => {
|
|
256
273
|
const exitCode = await listUserDB(DBOSCloudHost, options.json);
|
|
257
274
|
process.exit(exitCode);
|
|
258
275
|
});
|
|
259
276
|
databaseCommands
|
|
260
|
-
.command(
|
|
261
|
-
.description(
|
|
262
|
-
.argument(
|
|
263
|
-
.option(
|
|
277
|
+
.command('reset-password')
|
|
278
|
+
.description('Reset password for a Postgres database instance')
|
|
279
|
+
.argument('[name]', 'database instance name')
|
|
280
|
+
.option('-W, --password <string>', 'Specify the database user password')
|
|
264
281
|
.action(async (dbName, options) => {
|
|
265
282
|
const exitCode = await resetDBCredentials(DBOSCloudHost, dbName, options.password);
|
|
266
283
|
process.exit(exitCode);
|
|
267
284
|
});
|
|
268
285
|
databaseCommands
|
|
269
|
-
.command(
|
|
270
|
-
.description(
|
|
271
|
-
.argument(
|
|
286
|
+
.command('destroy')
|
|
287
|
+
.description('Destroy a Postgres database instance')
|
|
288
|
+
.argument('<name>', 'database instance name')
|
|
272
289
|
.action(async (dbname) => {
|
|
273
290
|
const exitCode = await deleteUserDb(DBOSCloudHost, dbname);
|
|
274
291
|
process.exit(exitCode);
|
|
275
292
|
});
|
|
276
293
|
databaseCommands
|
|
277
|
-
.command(
|
|
278
|
-
.description(
|
|
279
|
-
.argument(
|
|
280
|
-
.requiredOption(
|
|
281
|
-
.requiredOption(
|
|
294
|
+
.command('restore')
|
|
295
|
+
.description('Restore a Postgres database instance to a specified point in time')
|
|
296
|
+
.argument('<name>', 'database instance name')
|
|
297
|
+
.requiredOption('-t, --restore-time <string>', 'Specify the point in time to which to restore the database. Must be a timestamp in RFC 3339 format. Example: 2009-09-07T23:45:00Z')
|
|
298
|
+
.requiredOption('-n, --target-name <string>', 'Specify the new database instance name')
|
|
282
299
|
.action(async (dbname, options) => {
|
|
283
300
|
const exitCode = await restoreUserDB(DBOSCloudHost, dbname, options.targetName, options.restoreTime, true);
|
|
284
301
|
process.exit(exitCode);
|
|
285
302
|
});
|
|
286
303
|
databaseCommands
|
|
287
|
-
.command(
|
|
288
|
-
.description(
|
|
289
|
-
.argument(
|
|
290
|
-
.requiredOption(
|
|
291
|
-
.option(
|
|
292
|
-
.option(
|
|
293
|
-
.option(
|
|
294
|
-
.option(
|
|
304
|
+
.command('link')
|
|
305
|
+
.description('Link your own Postgres database instance to DBOS Cloud')
|
|
306
|
+
.argument('<name>', 'database instance name')
|
|
307
|
+
.requiredOption('-H, --hostname <string>', 'Specify your database hostname')
|
|
308
|
+
.option('-p, --port <number>', 'Specify your database port', '5432')
|
|
309
|
+
.option('-W, --password <string>', 'Specify password for the dbosadmin user')
|
|
310
|
+
.option('--enable-timetravel', 'Enable time travel on the linked database', false)
|
|
311
|
+
.option('--supabase-ref <string>', 'Link a Supabase database')
|
|
295
312
|
.action(async (dbname, options) => {
|
|
296
313
|
if (!options.password) {
|
|
297
|
-
options.password = prompt(
|
|
314
|
+
options.password = prompt('Password for the dbosadmin user: ', { echo: '*' });
|
|
298
315
|
}
|
|
299
316
|
const exitCode = await linkUserDB(DBOSCloudHost, dbname, options.hostname, Number(options.port), options.password, options.enableTimetravel, options.supabaseRef);
|
|
300
317
|
process.exit(exitCode);
|
|
301
318
|
});
|
|
302
319
|
databaseCommands
|
|
303
|
-
.command(
|
|
304
|
-
.description(
|
|
305
|
-
.argument(
|
|
320
|
+
.command('unlink')
|
|
321
|
+
.description('Unlink a Postgres database instance')
|
|
322
|
+
.argument('<name>', 'database instance name')
|
|
306
323
|
.action(async (dbname) => {
|
|
307
324
|
const exitCode = await unlinkUserDB(DBOSCloudHost, dbname);
|
|
308
325
|
process.exit(exitCode);
|
|
309
326
|
});
|
|
310
327
|
databaseCommands
|
|
311
|
-
.command(
|
|
328
|
+
.command('connect')
|
|
312
329
|
.description(`Load cloud database connection information into ${dbosConfigFilePath}`)
|
|
313
|
-
.argument(
|
|
314
|
-
.option(
|
|
330
|
+
.argument('[name]', 'database instance name')
|
|
331
|
+
.option('-W, --password <string>', 'Specify the database user password')
|
|
315
332
|
.action(async (dbname, options) => {
|
|
316
333
|
const exitCode = await connect(DBOSCloudHost, dbname, options.password, false);
|
|
317
334
|
process.exit(exitCode);
|
|
318
335
|
});
|
|
319
336
|
databaseCommands
|
|
320
|
-
.command(
|
|
337
|
+
.command('local')
|
|
321
338
|
.description(`Configure ${dbosConfigFilePath} to use a DBOS Cloud database for local development`)
|
|
322
|
-
.argument(
|
|
323
|
-
.option(
|
|
339
|
+
.argument('[name]', 'database instance name')
|
|
340
|
+
.option('-W, --password <string>', 'Specify the database user password')
|
|
324
341
|
.action(async (dbname, options) => {
|
|
325
342
|
const exitCode = await connect(DBOSCloudHost, dbname, options.password, true);
|
|
326
343
|
process.exit(exitCode);
|
|
@@ -328,24 +345,24 @@ databaseCommands
|
|
|
328
345
|
/////////////////////
|
|
329
346
|
/* USER DASHBOARDS */
|
|
330
347
|
/////////////////////
|
|
331
|
-
const dashboardCommands = program.command(
|
|
348
|
+
const dashboardCommands = program.command('dashboard').description('Manage Monitoring Dashboards');
|
|
332
349
|
dashboardCommands
|
|
333
|
-
.command(
|
|
334
|
-
.description(
|
|
350
|
+
.command('launch')
|
|
351
|
+
.description('Deploy the Monitoring Dashboard')
|
|
335
352
|
.action(async () => {
|
|
336
353
|
const exitCode = await launchDashboard(DBOSCloudHost);
|
|
337
354
|
process.exit(exitCode);
|
|
338
355
|
});
|
|
339
356
|
dashboardCommands
|
|
340
|
-
.command(
|
|
341
|
-
.description(
|
|
357
|
+
.command('url')
|
|
358
|
+
.description('Deploy the Monitoring Dashboard if it does not exist; then return its URL')
|
|
342
359
|
.action(async () => {
|
|
343
360
|
const exitCode = await getDashboardURL(DBOSCloudHost);
|
|
344
361
|
process.exit(exitCode);
|
|
345
362
|
});
|
|
346
363
|
dashboardCommands
|
|
347
|
-
.command(
|
|
348
|
-
.description(
|
|
364
|
+
.command('delete')
|
|
365
|
+
.description('Delete your Monitoring Dashboard')
|
|
349
366
|
.action(async () => {
|
|
350
367
|
const exitCode = await deleteDashboard(DBOSCloudHost);
|
|
351
368
|
process.exit(exitCode);
|
|
@@ -353,45 +370,49 @@ dashboardCommands
|
|
|
353
370
|
////////////////////////////
|
|
354
371
|
/* ORGANIZATIONS COMMANDS */
|
|
355
372
|
////////////////////////////
|
|
356
|
-
const orgCommands = program
|
|
373
|
+
const orgCommands = program
|
|
374
|
+
.command('organization')
|
|
375
|
+
.alias('organizations')
|
|
376
|
+
.alias('org')
|
|
377
|
+
.description('Manage dbos organizations');
|
|
357
378
|
orgCommands
|
|
358
|
-
.command(
|
|
359
|
-
.description(
|
|
360
|
-
.option(
|
|
379
|
+
.command('invite')
|
|
380
|
+
.description('Generate an invite secret for a user to join your organization')
|
|
381
|
+
.option('--json', 'Emit JSON output')
|
|
361
382
|
.action(async (options) => {
|
|
362
383
|
const exitCode = await orgInvite(DBOSCloudHost, options.json);
|
|
363
384
|
process.exit(exitCode);
|
|
364
385
|
});
|
|
365
386
|
orgCommands
|
|
366
|
-
.command(
|
|
367
|
-
.description(
|
|
368
|
-
.option(
|
|
387
|
+
.command('list')
|
|
388
|
+
.description('List users in your organization')
|
|
389
|
+
.option('--json', 'Emit JSON output')
|
|
369
390
|
.action(async (options) => {
|
|
370
391
|
const exitCode = await orgListUsers(DBOSCloudHost, options.json);
|
|
371
392
|
process.exit(exitCode);
|
|
372
393
|
});
|
|
373
394
|
orgCommands
|
|
374
|
-
.command(
|
|
375
|
-
.description(
|
|
376
|
-
.argument(
|
|
377
|
-
.argument(
|
|
395
|
+
.command('rename')
|
|
396
|
+
.description('Rename the organization')
|
|
397
|
+
.argument('<oldname>', 'Organization old name')
|
|
398
|
+
.argument('<newname>', 'Organization new name')
|
|
378
399
|
.action(async (oldname, newname) => {
|
|
379
400
|
const exitCode = await renameOrganization(DBOSCloudHost, oldname, newname);
|
|
380
401
|
process.exit(exitCode);
|
|
381
402
|
});
|
|
382
403
|
orgCommands
|
|
383
|
-
.command(
|
|
384
|
-
.description(
|
|
385
|
-
.argument(
|
|
386
|
-
.argument(
|
|
404
|
+
.command('join')
|
|
405
|
+
.description('Join an organization with an invite secret')
|
|
406
|
+
.argument('<organization>', 'Organization name')
|
|
407
|
+
.argument('<secret>', 'Organization secret')
|
|
387
408
|
.action(async (organization, secret) => {
|
|
388
409
|
const exitCode = await joinOrganization(DBOSCloudHost, organization, secret);
|
|
389
410
|
process.exit(exitCode);
|
|
390
411
|
});
|
|
391
412
|
orgCommands
|
|
392
|
-
.command(
|
|
393
|
-
.description(
|
|
394
|
-
.argument(
|
|
413
|
+
.command('remove')
|
|
414
|
+
.description('Remove a user from an organization')
|
|
415
|
+
.argument('<username>', 'User to remove')
|
|
395
416
|
.action(async (username) => {
|
|
396
417
|
const exitCode = await removeUserFromOrg(DBOSCloudHost, username);
|
|
397
418
|
process.exit(exitCode);
|
|
@@ -399,12 +420,16 @@ orgCommands
|
|
|
399
420
|
////////////////////////////
|
|
400
421
|
/* WORKFLOW COMMANDS */
|
|
401
422
|
////////////////////////////
|
|
402
|
-
const workflowCommands = program
|
|
423
|
+
const workflowCommands = program
|
|
424
|
+
.command('workflow')
|
|
425
|
+
.alias('workflows')
|
|
426
|
+
.alias('wf')
|
|
427
|
+
.description('Manage DBOS workflows');
|
|
403
428
|
workflowCommands
|
|
404
429
|
.command('list')
|
|
405
430
|
.description('List workflows from your application')
|
|
406
|
-
.argument(
|
|
407
|
-
.option('-l, --limit <number>', 'Limit the results returned',
|
|
431
|
+
.argument('[string]', 'application name (Default: name from package.json)')
|
|
432
|
+
.option('-l, --limit <number>', 'Limit the results returned', '10')
|
|
408
433
|
.option('-o, --offset <number>', 'Skip workflows from the results returned.')
|
|
409
434
|
.option('-u, --workflowUUIDs <uuid...>', 'Retrieve specific UUIDs')
|
|
410
435
|
.option('-U, --user <string>', 'Retrieve workflows run by this user')
|
|
@@ -412,6 +437,7 @@ workflowCommands
|
|
|
412
437
|
.option('-e, --end-time <string>', 'Retrieve workflows starting before this timestamp (ISO 8601 format)')
|
|
413
438
|
.option('-S, --status <string>', 'Retrieve workflows with this status (PENDING, SUCCESS, ERROR, RETRIES_EXCEEDED, ENQUEUED, or CANCELLED)')
|
|
414
439
|
.option('-v, --application-version <string>', 'Retrieve workflows with this application version')
|
|
440
|
+
.option('-n, --name <string>', 'Retrieve functions with this name')
|
|
415
441
|
.action(async (appName, options) => {
|
|
416
442
|
const input = {
|
|
417
443
|
limit: Number(options.limit),
|
|
@@ -422,10 +448,36 @@ workflowCommands
|
|
|
422
448
|
status: options.status,
|
|
423
449
|
application_version: options.applicationVersion,
|
|
424
450
|
offset: Number(options.offset),
|
|
451
|
+
workflow_name: options.name,
|
|
425
452
|
};
|
|
426
453
|
const exitCode = await listWorkflows(DBOSCloudHost, input, appName);
|
|
427
454
|
process.exit(exitCode);
|
|
428
455
|
});
|
|
456
|
+
const queueCommands = workflowCommands.command('queue').alias('queues').alias('q').description('Manage DBOS queues');
|
|
457
|
+
queueCommands
|
|
458
|
+
.command('list')
|
|
459
|
+
.description('List enqueued functions from your application')
|
|
460
|
+
.argument('[string]', 'application name (Default: name from package.json)')
|
|
461
|
+
.option('-l, --limit <number>', 'Limit the results returned')
|
|
462
|
+
.option('-o, --offset <number>', 'Skip functions from the results returned.')
|
|
463
|
+
.option('-s, --start-time <string>', 'Retrieve functions starting after this timestamp (ISO 8601 format)')
|
|
464
|
+
.option('-e, --end-time <string>', 'Retrieve functions starting before this timestamp (ISO 8601 format)')
|
|
465
|
+
.option('-q, --queue <string>', 'Retrieve functions run on this queue')
|
|
466
|
+
.option('-n, --name <string>', 'Retrieve functions with this name')
|
|
467
|
+
.option('-S, --status <string>', 'Retrieve functions with this status (PENDING, SUCCESS, ERROR, RETRIES_EXCEEDED, ENQUEUED, or CANCELLED)')
|
|
468
|
+
.action(async (appName, options) => {
|
|
469
|
+
const input = {
|
|
470
|
+
limit: Number(options.limit),
|
|
471
|
+
start_time: options.startTime,
|
|
472
|
+
end_time: options.endTime,
|
|
473
|
+
status: options.status,
|
|
474
|
+
offset: Number(options.offset),
|
|
475
|
+
workflow_name: options.name,
|
|
476
|
+
queue_name: options.queue,
|
|
477
|
+
};
|
|
478
|
+
const exitCode = await listQueuedWorkflows(DBOSCloudHost, input, appName);
|
|
479
|
+
process.exit(exitCode);
|
|
480
|
+
});
|
|
429
481
|
program.parse(process.argv);
|
|
430
482
|
// If no arguments provided, display help by default
|
|
431
483
|
if (!process.argv.slice(2).length) {
|