powersync 0.7.1 → 0.8.0
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/README.md +25 -17
- package/dist/commands/instance/create.d.ts +16 -0
- package/dist/commands/instance/create.js +89 -73
- package/dist/commands/instance/deploy.d.ts +3 -0
- package/dist/commands/instance/deploy.js +23 -23
- package/dist/commands.utils.d.ts +2 -2
- package/dist/commands.utils.js +46 -7
- package/dist/connection.utils.d.ts +56 -0
- package/dist/connection.utils.js +76 -0
- package/dist/instance-command-flags.d.ts +1 -0
- package/dist/instance-command-flags.js +9 -0
- package/dist/service/accounts.client.js +1 -1
- package/dist/service/powersync.client.js +1 -1
- package/dist/service/utils.js +1 -1
- package/oclif.manifest.json +47 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -90,7 +90,7 @@ EXAMPLES
|
|
|
90
90
|
$ npx powersync init
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
_See code: [src/commands/init.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
93
|
+
_See code: [src/commands/init.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/init.ts)_
|
|
94
94
|
|
|
95
95
|
## `powersync instance config`
|
|
96
96
|
|
|
@@ -107,7 +107,7 @@ EXAMPLES
|
|
|
107
107
|
$ npx powersync instance config
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
-
_See code: [src/commands/instance/config.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
110
|
+
_See code: [src/commands/instance/config.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/config.ts)_
|
|
111
111
|
|
|
112
112
|
## `powersync instance create`
|
|
113
113
|
|
|
@@ -115,8 +115,8 @@ Create a new instance.
|
|
|
115
115
|
|
|
116
116
|
```
|
|
117
117
|
USAGE
|
|
118
|
-
$ npx powersync instance create [-i <value>] [
|
|
119
|
-
<value>] [-s] [-j <value>] [-b]
|
|
118
|
+
$ npx powersync instance create [-i <value>] [--protocol <value>] [-r <value>] [-t postgresql|mongodb] [-n <value>] [-h
|
|
119
|
+
<value>] [-w <value>] [-a <value>] [-o <value>] [-s] [-j <value>] [-b]
|
|
120
120
|
|
|
121
121
|
FLAGS
|
|
122
122
|
-a, --jwtAudiences=<value> JWT audiences (comma separated).
|
|
@@ -128,7 +128,10 @@ FLAGS
|
|
|
128
128
|
-o, --port=<value> Port number to connect to database.
|
|
129
129
|
-r, --region=<value> Region to deploy instance to.
|
|
130
130
|
-s, --skipInteraction Skip interactivity.
|
|
131
|
+
-t, --connectionType=<option> Type of database connection.
|
|
132
|
+
<options: postgresql|mongodb>
|
|
131
133
|
-w, --jwksUri=<value> JWKS URI (must include https://).
|
|
134
|
+
--protocol=<value> Database protocol to use (e.g., for MongoDB: mongodb+srv or mongodb).
|
|
132
135
|
|
|
133
136
|
DESCRIPTION
|
|
134
137
|
Create a new instance.
|
|
@@ -137,7 +140,7 @@ EXAMPLES
|
|
|
137
140
|
$ npx powersync instance create
|
|
138
141
|
```
|
|
139
142
|
|
|
140
|
-
_See code: [src/commands/instance/create.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
143
|
+
_See code: [src/commands/instance/create.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/create.ts)_
|
|
141
144
|
|
|
142
145
|
## `powersync instance deploy`
|
|
143
146
|
|
|
@@ -145,7 +148,8 @@ Deploy changes to an existing instance.
|
|
|
145
148
|
|
|
146
149
|
```
|
|
147
150
|
USAGE
|
|
148
|
-
$ npx powersync instance deploy [
|
|
151
|
+
$ npx powersync instance deploy [--protocol <value>] [-r <value>] [-t postgresql|mongodb] [-n <value>] [-h <value>] [-w
|
|
152
|
+
<value>] [-a <value>] [-o <value>] [-s] [-j <value>] [-b]
|
|
149
153
|
|
|
150
154
|
FLAGS
|
|
151
155
|
-a, --jwtAudiences=<value> JWT audiences (comma separated).
|
|
@@ -154,8 +158,12 @@ FLAGS
|
|
|
154
158
|
-j, --supabaseJWTSecret=<value> Supabase JWT secret
|
|
155
159
|
-n, --databaseName=<value> Name of the database.
|
|
156
160
|
-o, --port=<value> Port number to connect to database.
|
|
161
|
+
-r, --region=<value> Region to deploy instance to.
|
|
157
162
|
-s, --skipInteraction Skip interactivity.
|
|
163
|
+
-t, --connectionType=<option> Type of database connection.
|
|
164
|
+
<options: postgresql|mongodb>
|
|
158
165
|
-w, --jwksUri=<value> JWKS URI (must include https://).
|
|
166
|
+
--protocol=<value> Database protocol to use (e.g., for MongoDB: mongodb+srv or mongodb).
|
|
159
167
|
|
|
160
168
|
DESCRIPTION
|
|
161
169
|
Deploy changes to an existing instance.
|
|
@@ -164,7 +172,7 @@ EXAMPLES
|
|
|
164
172
|
$ npx powersync instance deploy
|
|
165
173
|
```
|
|
166
174
|
|
|
167
|
-
_See code: [src/commands/instance/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
175
|
+
_See code: [src/commands/instance/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/deploy.ts)_
|
|
168
176
|
|
|
169
177
|
## `powersync instance destroy`
|
|
170
178
|
|
|
@@ -184,7 +192,7 @@ EXAMPLES
|
|
|
184
192
|
$ npx powersync instance destroy
|
|
185
193
|
```
|
|
186
194
|
|
|
187
|
-
_See code: [src/commands/instance/destroy.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
195
|
+
_See code: [src/commands/instance/destroy.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/destroy.ts)_
|
|
188
196
|
|
|
189
197
|
## `powersync instance generate-dev-token`
|
|
190
198
|
|
|
@@ -205,7 +213,7 @@ EXAMPLES
|
|
|
205
213
|
$ npx powersync instance generate-dev-token
|
|
206
214
|
```
|
|
207
215
|
|
|
208
|
-
_See code: [src/commands/instance/generate-dev-token.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
216
|
+
_See code: [src/commands/instance/generate-dev-token.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/generate-dev-token.ts)_
|
|
209
217
|
|
|
210
218
|
## `powersync instance schema`
|
|
211
219
|
|
|
@@ -222,7 +230,7 @@ EXAMPLES
|
|
|
222
230
|
$ npx powersync instance schema
|
|
223
231
|
```
|
|
224
232
|
|
|
225
|
-
_See code: [src/commands/instance/schema.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
233
|
+
_See code: [src/commands/instance/schema.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/schema.ts)_
|
|
226
234
|
|
|
227
235
|
## `powersync instance set`
|
|
228
236
|
|
|
@@ -244,7 +252,7 @@ EXAMPLES
|
|
|
244
252
|
$ npx powersync instance set --instanceId=1234
|
|
245
253
|
```
|
|
246
254
|
|
|
247
|
-
_See code: [src/commands/instance/set.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
255
|
+
_See code: [src/commands/instance/set.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/set.ts)_
|
|
248
256
|
|
|
249
257
|
## `powersync instance status`
|
|
250
258
|
|
|
@@ -269,7 +277,7 @@ EXAMPLES
|
|
|
269
277
|
$ npx powersync instance status --orgId=1234 --projectId=1234 --instanceId=1234 --authToken=1234
|
|
270
278
|
```
|
|
271
279
|
|
|
272
|
-
_See code: [src/commands/instance/status.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
280
|
+
_See code: [src/commands/instance/status.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/status.ts)_
|
|
273
281
|
|
|
274
282
|
## `powersync instance stop`
|
|
275
283
|
|
|
@@ -289,7 +297,7 @@ EXAMPLES
|
|
|
289
297
|
$ npx powersync instance stop
|
|
290
298
|
```
|
|
291
299
|
|
|
292
|
-
_See code: [src/commands/instance/stop.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
300
|
+
_See code: [src/commands/instance/stop.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/stop.ts)_
|
|
293
301
|
|
|
294
302
|
## `powersync instance sync-rules deploy`
|
|
295
303
|
|
|
@@ -314,7 +322,7 @@ EXAMPLES
|
|
|
314
322
|
$ npx powersync instance sync-rules deploy -f path/to/file
|
|
315
323
|
```
|
|
316
324
|
|
|
317
|
-
_See code: [src/commands/instance/sync-rules/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
325
|
+
_See code: [src/commands/instance/sync-rules/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/sync-rules/deploy.ts)_
|
|
318
326
|
|
|
319
327
|
## `powersync instance sync-rules generate-schema`
|
|
320
328
|
|
|
@@ -340,7 +348,7 @@ EXAMPLES
|
|
|
340
348
|
$ npx powersync instance sync-rules generate-schema -f path/to/file
|
|
341
349
|
```
|
|
342
350
|
|
|
343
|
-
_See code: [src/commands/instance/sync-rules/generate-schema.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
351
|
+
_See code: [src/commands/instance/sync-rules/generate-schema.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/sync-rules/generate-schema.ts)_
|
|
344
352
|
|
|
345
353
|
## `powersync instance sync-rules validate`
|
|
346
354
|
|
|
@@ -364,7 +372,7 @@ EXAMPLES
|
|
|
364
372
|
$ npx powersync instance sync-rules validate -f path/to/file
|
|
365
373
|
```
|
|
366
374
|
|
|
367
|
-
_See code: [src/commands/instance/sync-rules/validate.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
375
|
+
_See code: [src/commands/instance/sync-rules/validate.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/sync-rules/validate.ts)_
|
|
368
376
|
|
|
369
377
|
## `powersync instances`
|
|
370
378
|
|
|
@@ -381,5 +389,5 @@ EXAMPLES
|
|
|
381
389
|
$ npx powersync instances
|
|
382
390
|
```
|
|
383
391
|
|
|
384
|
-
_See code: [src/commands/instances.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
392
|
+
_See code: [src/commands/instances.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instances.ts)_
|
|
385
393
|
<!-- commandsstop -->
|
|
@@ -3,6 +3,7 @@ export default class InstanceCreate extends Command {
|
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
|
+
connectionType: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
6
7
|
databaseName: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
7
8
|
databasePassword: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
8
9
|
databaseUsername: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
@@ -14,7 +15,22 @@ export default class InstanceCreate extends Command {
|
|
|
14
15
|
supabaseJWTSecret: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
15
16
|
useSupabaseAuth: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
16
17
|
name: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
18
|
+
protocol: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
17
19
|
region: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
18
20
|
};
|
|
19
21
|
run(): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Create deployment configuration from flags and answers
|
|
24
|
+
* @param flags - Command flags from CLI
|
|
25
|
+
* @param answers - User answers from interactive prompts
|
|
26
|
+
* @returns Object containing deployment config and database connection
|
|
27
|
+
*/
|
|
28
|
+
private createDeployConfig;
|
|
29
|
+
/**
|
|
30
|
+
* Gather user input through interactive prompts if needed
|
|
31
|
+
* @param flags - Command flags from CLI
|
|
32
|
+
* @param regions - Available regions for deployment
|
|
33
|
+
* @returns Object containing user answers and questions that were asked
|
|
34
|
+
*/
|
|
35
|
+
private gatherInputs;
|
|
20
36
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
1
2
|
import { Command, Flags, ux } from '@oclif/core';
|
|
2
3
|
import inquirer from 'inquirer';
|
|
3
4
|
import ora from 'ora';
|
|
4
5
|
import { generateCommonDeployQuestions } from '../../commands.utils.js';
|
|
6
|
+
import { buildDatabaseConnection } from '../../connection.utils.js';
|
|
5
7
|
import { generateCommonInstanceConfigFlags } from '../../instance-command-flags.js';
|
|
6
8
|
import * as PowerSyncClient from '../../service/powersync.client.js';
|
|
7
9
|
import { bold, checkThatEnvVariablesAreSet, green, red, updateEnvFileVariableValue } from '../../utils.js';
|
|
@@ -10,6 +12,7 @@ export default class InstanceCreate extends Command {
|
|
|
10
12
|
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
11
13
|
static flags = {
|
|
12
14
|
name: Flags.string({ char: 'i', description: 'Name of the instance.' }),
|
|
15
|
+
protocol: Flags.string({ description: 'Database protocol to use (e.g., for MongoDB: mongodb+srv or mongodb).' }),
|
|
13
16
|
region: Flags.string({ char: 'r', description: 'Region to deploy instance to.' }),
|
|
14
17
|
...generateCommonInstanceConfigFlags()
|
|
15
18
|
};
|
|
@@ -18,46 +21,38 @@ export default class InstanceCreate extends Command {
|
|
|
18
21
|
const parsed = await this.parse(InstanceCreate);
|
|
19
22
|
const flags = parsed.flags;
|
|
20
23
|
const regions = await PowerSyncClient.getRegions();
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
jwtAudiences: undefined,
|
|
28
|
-
name: undefined,
|
|
29
|
-
port: undefined,
|
|
30
|
-
region: undefined,
|
|
31
|
-
useSupabaseAuth: undefined
|
|
32
|
-
};
|
|
33
|
-
if (!flags.skipInteraction) {
|
|
34
|
-
const questions = [
|
|
35
|
-
{
|
|
36
|
-
message: 'What do you want to name your instance?',
|
|
37
|
-
name: 'name',
|
|
38
|
-
type: 'input',
|
|
39
|
-
validate(value) {
|
|
40
|
-
return value.length > 3 ? true : 'Please enter a name with at least 3 characters.';
|
|
41
|
-
},
|
|
42
|
-
when: !flags.name
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
choices: regions.map((region) => region.toUpperCase()),
|
|
46
|
-
message: 'What region do you want to use?',
|
|
47
|
-
name: 'region',
|
|
48
|
-
type: 'list',
|
|
49
|
-
when: !flags.region
|
|
50
|
-
},
|
|
51
|
-
...generateCommonDeployQuestions(flags)
|
|
52
|
-
];
|
|
53
|
-
answers = await inquirer.prompt(questions);
|
|
24
|
+
const { answers } = await this.gatherInputs(flags, regions);
|
|
25
|
+
const { config, connection } = this.createDeployConfig(flags, answers);
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
+
const connectionResponse = await PowerSyncClient.testConnection(connection);
|
|
28
|
+
if (connectionResponse.error) {
|
|
29
|
+
return ux.error(red(`There was an issue testing the connection from the PowerSync service to your database: ${connectionResponse.error}. Please double-check your entered values.`), { exit: 1 });
|
|
54
30
|
}
|
|
31
|
+
const spinner = ora({
|
|
32
|
+
prefixText: 'Creating instance.\n',
|
|
33
|
+
spinner: 'moon',
|
|
34
|
+
suffixText: '\nThis may take a few minutes.\n'
|
|
35
|
+
});
|
|
36
|
+
spinner.start();
|
|
55
37
|
const instanceName = flags.name || answers.name;
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
38
|
+
const instance = await PowerSyncClient.createInstance(instanceName);
|
|
39
|
+
await PowerSyncClient.deployInstance(config, instance.id);
|
|
40
|
+
const status = await PowerSyncClient.waitForStatusChange(instance.id);
|
|
41
|
+
spinner.stop();
|
|
42
|
+
if (status === 'failed') {
|
|
43
|
+
return ux.error(red(`There was an error creating the instance. Please try again.`), { exit: 1 });
|
|
44
|
+
}
|
|
45
|
+
updateEnvFileVariableValue(PowerSyncClient.ENV_VARIABLES.INSTANCE_ID, instance.id);
|
|
46
|
+
ux.log(green(`Instance with id ${bold(instance.id)} has been created successfully.`));
|
|
47
|
+
ux.log(green(`Current instance has been set to ${bold(instance.id)}.`));
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Create deployment configuration from flags and answers
|
|
51
|
+
* @param flags - Command flags from CLI
|
|
52
|
+
* @param answers - User answers from interactive prompts
|
|
53
|
+
* @returns Object containing deployment config and database connection
|
|
54
|
+
*/
|
|
55
|
+
createDeployConfig(flags, answers) {
|
|
61
56
|
const region = flags.region?.toLowerCase() || answers.region?.toLowerCase();
|
|
62
57
|
const useSupabaseAuth = flags.useSupabaseAuth || answers.useSupabaseAuth;
|
|
63
58
|
const jwksUri = flags.jwksUri || answers.jwksUri;
|
|
@@ -65,21 +60,16 @@ export default class InstanceCreate extends Command {
|
|
|
65
60
|
const flagsAudiences = flags.jwtAudiences ? flags.jwtAudiences.split(',') : [];
|
|
66
61
|
const audiences = [...new Set([...flagsAudiences, ...answerAudiences])];
|
|
67
62
|
const supabaseJWTSecret = flags.supabaseJWTSecret ?? answers.supabaseJWTSecret;
|
|
68
|
-
//
|
|
69
|
-
const connection = {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
sslmode: 'verify-full',
|
|
79
|
-
tag: 'default',
|
|
80
|
-
type: 'postgresql',
|
|
81
|
-
username: databaseUsername
|
|
82
|
-
};
|
|
63
|
+
// Build database connection based on type
|
|
64
|
+
const connection = buildDatabaseConnection({
|
|
65
|
+
connectionType: flags.connectionType || answers.connectionType,
|
|
66
|
+
databaseName: flags.databaseName || answers.databaseName,
|
|
67
|
+
databasePassword: flags.databasePassword || answers.databasePassword,
|
|
68
|
+
databaseUsername: flags.databaseUsername || answers.databaseUsername,
|
|
69
|
+
hostname: flags.hostname || answers.hostname,
|
|
70
|
+
port: flags.port || answers.port,
|
|
71
|
+
protocol: flags.protocol || answers.protocol
|
|
72
|
+
});
|
|
83
73
|
const config = {
|
|
84
74
|
client_auth: {
|
|
85
75
|
additional_audiences: audiences || undefined,
|
|
@@ -93,29 +83,55 @@ export default class InstanceCreate extends Command {
|
|
|
93
83
|
},
|
|
94
84
|
region: region,
|
|
95
85
|
replication: {
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
96
87
|
connections: [connection]
|
|
97
88
|
}
|
|
98
89
|
};
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
90
|
+
return { config, connection };
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Gather user input through interactive prompts if needed
|
|
94
|
+
* @param flags - Command flags from CLI
|
|
95
|
+
* @param regions - Available regions for deployment
|
|
96
|
+
* @returns Object containing user answers and questions that were asked
|
|
97
|
+
*/
|
|
98
|
+
async gatherInputs(flags, regions) {
|
|
99
|
+
const answers = {
|
|
100
|
+
connectionType: undefined,
|
|
101
|
+
databaseName: undefined,
|
|
102
|
+
databasePassword: undefined,
|
|
103
|
+
databaseUsername: undefined,
|
|
104
|
+
hostname: undefined,
|
|
105
|
+
jwksUri: undefined,
|
|
106
|
+
jwtAudiences: undefined,
|
|
107
|
+
name: undefined,
|
|
108
|
+
port: undefined,
|
|
109
|
+
region: undefined,
|
|
110
|
+
useSupabaseAuth: undefined
|
|
111
|
+
};
|
|
112
|
+
if (flags.skipInteraction) {
|
|
113
|
+
return { answers, questions: [] };
|
|
116
114
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
const questions = [
|
|
116
|
+
{
|
|
117
|
+
message: 'What do you want to name your instance?',
|
|
118
|
+
name: 'name',
|
|
119
|
+
type: 'input',
|
|
120
|
+
validate(value) {
|
|
121
|
+
return value.length > 3 ? true : 'Please enter a name with at least 3 characters.';
|
|
122
|
+
},
|
|
123
|
+
when: !flags.name
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
choices: regions.map((region) => region.toUpperCase()),
|
|
127
|
+
message: 'What region do you want to use?',
|
|
128
|
+
name: 'region',
|
|
129
|
+
type: 'list',
|
|
130
|
+
when: !flags.region
|
|
131
|
+
},
|
|
132
|
+
...generateCommonDeployQuestions(flags)
|
|
133
|
+
];
|
|
134
|
+
const promptAnswers = await inquirer.prompt(questions);
|
|
135
|
+
return { answers: promptAnswers, questions };
|
|
120
136
|
}
|
|
121
137
|
}
|
|
@@ -3,6 +3,7 @@ export default class InstanceDeploy extends Command {
|
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
|
+
connectionType: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
6
7
|
databaseName: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
7
8
|
databasePassword: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
8
9
|
databaseUsername: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
@@ -13,6 +14,8 @@ export default class InstanceDeploy extends Command {
|
|
|
13
14
|
skipInteraction: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
14
15
|
supabaseJWTSecret: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
15
16
|
useSupabaseAuth: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
17
|
+
protocol: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
18
|
+
region: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
16
19
|
};
|
|
17
20
|
run(): Promise<void>;
|
|
18
21
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable camelcase */
|
|
2
|
+
import { Command, Flags, ux } from '@oclif/core';
|
|
2
3
|
import inquirer from 'inquirer';
|
|
3
4
|
import ora from 'ora';
|
|
4
5
|
import { generateCommonDeployQuestions } from '../../commands.utils.js';
|
|
6
|
+
import { buildDatabaseConnection } from '../../connection.utils.js';
|
|
5
7
|
import { generateCommonInstanceConfigFlags } from '../../instance-command-flags.js';
|
|
6
8
|
import * as PowerSyncClient from '../../service/powersync.client.js';
|
|
7
9
|
import { bold, checkThatEnvVariablesAreSet, green, red } from '../../utils.js';
|
|
@@ -9,6 +11,8 @@ export default class InstanceDeploy extends Command {
|
|
|
9
11
|
static description = 'Deploy changes to an existing instance.';
|
|
10
12
|
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
11
13
|
static flags = {
|
|
14
|
+
protocol: Flags.string({ description: 'Database protocol to use (e.g., for MongoDB: mongodb+srv or mongodb).' }),
|
|
15
|
+
region: Flags.string({ char: 'r', description: 'Region to deploy instance to.' }),
|
|
12
16
|
...generateCommonInstanceConfigFlags()
|
|
13
17
|
};
|
|
14
18
|
async run() {
|
|
@@ -16,6 +20,7 @@ export default class InstanceDeploy extends Command {
|
|
|
16
20
|
const parsed = await this.parse(InstanceDeploy);
|
|
17
21
|
const flags = parsed.flags;
|
|
18
22
|
let answers = {
|
|
23
|
+
connectionType: undefined,
|
|
19
24
|
databaseName: undefined,
|
|
20
25
|
databasePassword: undefined,
|
|
21
26
|
databaseUsername: undefined,
|
|
@@ -23,17 +28,14 @@ export default class InstanceDeploy extends Command {
|
|
|
23
28
|
jwksUri: undefined,
|
|
24
29
|
jwtAudiences: undefined,
|
|
25
30
|
port: undefined,
|
|
31
|
+
protocol: undefined,
|
|
32
|
+
region: undefined,
|
|
26
33
|
useSupabaseAuth: undefined
|
|
27
34
|
};
|
|
28
35
|
if (!flags.skipInteraction) {
|
|
29
36
|
const questions = generateCommonDeployQuestions(flags);
|
|
30
37
|
answers = await inquirer.prompt(questions);
|
|
31
38
|
}
|
|
32
|
-
const port = flags.port || answers.port;
|
|
33
|
-
const password = flags.databasePassword || answers.databasePassword;
|
|
34
|
-
const hostname = flags.hostname || answers.hostname;
|
|
35
|
-
const databaseName = flags.databaseName || answers.databaseName;
|
|
36
|
-
const databaseUsername = flags.databaseUsername || answers.databaseUsername;
|
|
37
39
|
const useSupabaseAuth = flags.useSupabaseAuth || answers.useSupabaseAuth;
|
|
38
40
|
const jwksUri = flags.jwksUri || answers.jwksUri;
|
|
39
41
|
const answerAudiences = answers.jwtAudiences ? answers.jwtAudiences.split(',') : [];
|
|
@@ -41,7 +43,19 @@ export default class InstanceDeploy extends Command {
|
|
|
41
43
|
const audiences = [...new Set([...flagsAudiences, ...answerAudiences])];
|
|
42
44
|
const supabaseJWTSecret = flags.supabaseJWTSecret ?? answers.supabaseJWTSecret;
|
|
43
45
|
const instanceConfig = await PowerSyncClient.getInstanceConfig();
|
|
44
|
-
const
|
|
46
|
+
const region = instanceConfig.config?.region || flags.region || answers.region;
|
|
47
|
+
if (!region) {
|
|
48
|
+
ux.error(red(`No region is configured for this instance. Please specify a region in the instance configuration or via command flags before deploying.`), { exit: 1 });
|
|
49
|
+
}
|
|
50
|
+
const connection = buildDatabaseConnection({
|
|
51
|
+
connectionType: flags.connectionType || answers.connectionType,
|
|
52
|
+
databaseName: flags.databaseName || answers.databaseName,
|
|
53
|
+
databasePassword: flags.databasePassword || answers.databasePassword,
|
|
54
|
+
databaseUsername: flags.databaseUsername || answers.databaseUsername,
|
|
55
|
+
hostname: flags.hostname || answers.hostname,
|
|
56
|
+
port: flags.port || answers.port,
|
|
57
|
+
protocol: flags.protocol || answers.protocol
|
|
58
|
+
});
|
|
45
59
|
const config = {
|
|
46
60
|
client_auth: {
|
|
47
61
|
additional_audiences: audiences || undefined,
|
|
@@ -55,22 +69,8 @@ export default class InstanceDeploy extends Command {
|
|
|
55
69
|
},
|
|
56
70
|
region,
|
|
57
71
|
replication: {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
database: databaseName,
|
|
61
|
-
debug_api: false,
|
|
62
|
-
hostname,
|
|
63
|
-
name: 'Default',
|
|
64
|
-
password: {
|
|
65
|
-
secret: password
|
|
66
|
-
},
|
|
67
|
-
port: Number(port),
|
|
68
|
-
sslmode: 'verify-full',
|
|
69
|
-
tag: 'default',
|
|
70
|
-
type: 'postgresql',
|
|
71
|
-
username: databaseUsername
|
|
72
|
-
}
|
|
73
|
-
]
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
73
|
+
connections: [connection]
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
76
|
const spinner = ora({
|
package/dist/commands.utils.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const generateCommonDeployQuestions: (flags: any) =>
|
|
1
|
+
import type { DistinctQuestion } from 'inquirer';
|
|
2
|
+
export declare const generateCommonDeployQuestions: (flags: any) => DistinctQuestion[];
|
package/dist/commands.utils.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2
2
|
export const generateCommonDeployQuestions = (flags) => [
|
|
3
|
+
// Connection Type Selection
|
|
4
|
+
{
|
|
5
|
+
choices: [
|
|
6
|
+
{ name: 'PostgreSQL', value: 'postgresql' },
|
|
7
|
+
{ name: 'MongoDB', value: 'mongodb' }
|
|
8
|
+
],
|
|
9
|
+
default: 'postgresql',
|
|
10
|
+
message: 'What type of database are you connecting to?',
|
|
11
|
+
name: 'connectionType',
|
|
12
|
+
type: 'list',
|
|
13
|
+
when: !flags.connectionType
|
|
14
|
+
},
|
|
15
|
+
// Common Database Connection Fields
|
|
3
16
|
{
|
|
4
17
|
message: 'What is your database hostname?',
|
|
5
18
|
name: 'hostname',
|
|
@@ -10,7 +23,10 @@ export const generateCommonDeployQuestions = (flags) => [
|
|
|
10
23
|
when: !flags.hostname
|
|
11
24
|
},
|
|
12
25
|
{
|
|
13
|
-
default
|
|
26
|
+
default(answers) {
|
|
27
|
+
const connType = flags.connectionType || answers.connectionType;
|
|
28
|
+
return connType === 'mongodb' ? 27_017 : 5432;
|
|
29
|
+
},
|
|
14
30
|
message: 'What is the port number of your database?',
|
|
15
31
|
name: 'port',
|
|
16
32
|
type: 'input',
|
|
@@ -24,24 +40,35 @@ export const generateCommonDeployQuestions = (flags) => [
|
|
|
24
40
|
when: !flags.port
|
|
25
41
|
},
|
|
26
42
|
{
|
|
27
|
-
default
|
|
43
|
+
default(answers) {
|
|
44
|
+
const connType = flags.connectionType || answers.connectionType;
|
|
45
|
+
return connType === 'postgresql' ? 'postgres' : undefined;
|
|
46
|
+
},
|
|
28
47
|
message: 'What is your database name?',
|
|
29
48
|
name: 'databaseName',
|
|
30
49
|
type: 'input',
|
|
31
50
|
validate(value) {
|
|
32
51
|
return value.length > 0 ? true : 'Please enter your database name.';
|
|
33
52
|
},
|
|
34
|
-
when
|
|
53
|
+
when() {
|
|
54
|
+
if (flags.databaseName) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
35
59
|
},
|
|
36
60
|
{
|
|
37
|
-
default
|
|
61
|
+
default(answers) {
|
|
62
|
+
const connType = flags.connectionType || answers.connectionType;
|
|
63
|
+
return connType === 'postgresql' ? 'postgres' : undefined;
|
|
64
|
+
},
|
|
38
65
|
message: 'What is your database username?',
|
|
39
66
|
name: 'databaseUsername',
|
|
40
67
|
type: 'input',
|
|
41
68
|
validate(value) {
|
|
42
69
|
return value.length > 0 ? true : 'Please enter your database username.';
|
|
43
70
|
},
|
|
44
|
-
when: !flags.
|
|
71
|
+
when: !flags.databaseUserName
|
|
45
72
|
},
|
|
46
73
|
{
|
|
47
74
|
message: 'What is your database password?',
|
|
@@ -52,13 +79,25 @@ export const generateCommonDeployQuestions = (flags) => [
|
|
|
52
79
|
},
|
|
53
80
|
when: !flags.databasePassword
|
|
54
81
|
},
|
|
82
|
+
{
|
|
83
|
+
default: 'mongodb+srv',
|
|
84
|
+
message: 'What is your database protocol? (e.g., mongodb, mongodb+srv)',
|
|
85
|
+
name: 'protocol',
|
|
86
|
+
type: 'input',
|
|
87
|
+
validate(value) {
|
|
88
|
+
return value.length > 0 ? true : 'Please enter your database protocol.';
|
|
89
|
+
},
|
|
90
|
+
when: (answers) => (flags.connectionType === 'mongodb' || answers.connectionType === 'mongodb') && !flags.protocol
|
|
91
|
+
},
|
|
92
|
+
// Authentication Questions (existing)
|
|
55
93
|
{
|
|
56
94
|
default: false,
|
|
57
95
|
message: 'Are you using Supabase auth?',
|
|
58
96
|
name: 'useSupabaseAuth',
|
|
59
97
|
type: 'confirm',
|
|
60
|
-
|
|
61
|
-
|
|
98
|
+
when: (answers) => flags.useSupabaseAuth === null &&
|
|
99
|
+
!flags.jwksUri &&
|
|
100
|
+
(flags.connectionType === 'postgresql' || answers.connectionType === 'postgresql')
|
|
62
101
|
},
|
|
63
102
|
{
|
|
64
103
|
message: 'Enter the Supabase JWT secret (see https://docs.powersync.com/installation/authentication-setup/supabase-auth#supabase-auth)',
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ConnectionType } from '@journeyapps-platform/types-powersync';
|
|
2
|
+
export interface ConnectionParams {
|
|
3
|
+
connectionType?: string;
|
|
4
|
+
databaseName?: string;
|
|
5
|
+
databasePassword?: string;
|
|
6
|
+
databaseUsername?: string;
|
|
7
|
+
hostname?: string;
|
|
8
|
+
port?: number;
|
|
9
|
+
protocol?: string;
|
|
10
|
+
}
|
|
11
|
+
interface PostgreSQLConnection {
|
|
12
|
+
database: string;
|
|
13
|
+
hostname: string;
|
|
14
|
+
name: string;
|
|
15
|
+
password: {
|
|
16
|
+
secret: string;
|
|
17
|
+
};
|
|
18
|
+
port: number;
|
|
19
|
+
sslmode?: 'verify-ca' | 'verify-full';
|
|
20
|
+
tag: string;
|
|
21
|
+
type: ConnectionType.POSTGRES;
|
|
22
|
+
username?: string;
|
|
23
|
+
}
|
|
24
|
+
interface MongoDBConnection {
|
|
25
|
+
database?: string;
|
|
26
|
+
hostname?: string;
|
|
27
|
+
name: string;
|
|
28
|
+
password?: {
|
|
29
|
+
secret: string;
|
|
30
|
+
};
|
|
31
|
+
post_images?: 'auto_configure' | 'off' | 'read_only';
|
|
32
|
+
tag: string;
|
|
33
|
+
type: ConnectionType.MONGODB;
|
|
34
|
+
uri?: string;
|
|
35
|
+
username?: string;
|
|
36
|
+
}
|
|
37
|
+
export type DatabaseConnection = MongoDBConnection | PostgreSQLConnection;
|
|
38
|
+
/**
|
|
39
|
+
* Build PostgreSQL connection object
|
|
40
|
+
* @param params - Connection parameters for PostgreSQL
|
|
41
|
+
* @returns PostgreSQL connection configuration object
|
|
42
|
+
*/
|
|
43
|
+
export declare function buildPostgreSQLConnection(params: ConnectionParams): PostgreSQLConnection;
|
|
44
|
+
/**
|
|
45
|
+
* Build MongoDB connection object
|
|
46
|
+
* @param params - Connection parameters for MongoDB
|
|
47
|
+
* @returns MongoDB connection configuration object
|
|
48
|
+
*/
|
|
49
|
+
export declare function buildMongoDBConnection(params: ConnectionParams): MongoDBConnection;
|
|
50
|
+
/**
|
|
51
|
+
* Build database connection object based on connection type
|
|
52
|
+
* @param params - Connection parameters including connection type
|
|
53
|
+
* @returns Database connection configuration object for the specified type
|
|
54
|
+
*/
|
|
55
|
+
export declare function buildDatabaseConnection(params: ConnectionParams): DatabaseConnection;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build PostgreSQL connection object
|
|
3
|
+
* @param params - Connection parameters for PostgreSQL
|
|
4
|
+
* @returns PostgreSQL connection configuration object
|
|
5
|
+
*/
|
|
6
|
+
export function buildPostgreSQLConnection(params) {
|
|
7
|
+
if (!params.hostname) {
|
|
8
|
+
throw new Error('Hostname is required for PostgreSQL connection');
|
|
9
|
+
}
|
|
10
|
+
if (!params.databaseName) {
|
|
11
|
+
throw new Error('Database name is required for PostgreSQL connection');
|
|
12
|
+
}
|
|
13
|
+
if (!params.databasePassword) {
|
|
14
|
+
throw new Error('Database password is required for PostgreSQL connection');
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
database: params.databaseName,
|
|
18
|
+
hostname: params.hostname,
|
|
19
|
+
name: 'Default',
|
|
20
|
+
password: {
|
|
21
|
+
secret: params.databasePassword
|
|
22
|
+
},
|
|
23
|
+
port: params.port || 5432,
|
|
24
|
+
sslmode: 'verify-full',
|
|
25
|
+
tag: 'default',
|
|
26
|
+
type: 'postgresql',
|
|
27
|
+
username: params.databaseUsername
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Build MongoDB connection object
|
|
32
|
+
* @param params - Connection parameters for MongoDB
|
|
33
|
+
* @returns MongoDB connection configuration object
|
|
34
|
+
*/
|
|
35
|
+
export function buildMongoDBConnection(params) {
|
|
36
|
+
const { databaseName, databasePassword, databaseUsername, hostname } = params;
|
|
37
|
+
if (!hostname) {
|
|
38
|
+
throw new Error('Hostname or connection string is required for MongoDB connection');
|
|
39
|
+
}
|
|
40
|
+
if (!databaseName) {
|
|
41
|
+
throw new Error('Database name or connection string is required for MongoDB connection');
|
|
42
|
+
}
|
|
43
|
+
const credentials = databaseUsername ? `${databaseUsername}${databasePassword ? `:${databasePassword}` : ''}@` : '';
|
|
44
|
+
const protocol = params.protocol || 'mongodb+srv';
|
|
45
|
+
const port = params.port && protocol !== 'mongodb+srv' ? `:${params.port}` : '';
|
|
46
|
+
const uri = `${protocol}://${credentials}${hostname}${port}/${databaseName}`;
|
|
47
|
+
return {
|
|
48
|
+
database: databaseName,
|
|
49
|
+
name: 'Default',
|
|
50
|
+
password: databasePassword ? { secret: databasePassword } : undefined,
|
|
51
|
+
post_images: 'auto_configure',
|
|
52
|
+
tag: 'default',
|
|
53
|
+
type: 'mongodb',
|
|
54
|
+
uri,
|
|
55
|
+
username: databaseUsername
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Build database connection object based on connection type
|
|
60
|
+
* @param params - Connection parameters including connection type
|
|
61
|
+
* @returns Database connection configuration object for the specified type
|
|
62
|
+
*/
|
|
63
|
+
export function buildDatabaseConnection(params) {
|
|
64
|
+
const connectionType = params.connectionType || 'postgresql';
|
|
65
|
+
switch (connectionType) {
|
|
66
|
+
case 'postgresql': {
|
|
67
|
+
return buildPostgreSQLConnection(params);
|
|
68
|
+
}
|
|
69
|
+
case 'mongodb': {
|
|
70
|
+
return buildMongoDBConnection(params);
|
|
71
|
+
}
|
|
72
|
+
default: {
|
|
73
|
+
throw new Error(`Unsupported connection type: ${connectionType}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const generateCommonInstanceConfigFlags: () => {
|
|
2
|
+
connectionType: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
2
3
|
databaseName: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
3
4
|
databasePassword: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
4
5
|
databaseUsername: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
2
|
export const generateCommonInstanceConfigFlags = () => ({
|
|
3
|
+
// Connection flags
|
|
4
|
+
connectionType: Flags.string({
|
|
5
|
+
char: 't',
|
|
6
|
+
description: 'Type of database connection.',
|
|
7
|
+
options: ['postgresql', 'mongodb']
|
|
8
|
+
}),
|
|
9
|
+
// Common database flags
|
|
3
10
|
databaseName: Flags.string({ char: 'n', description: 'Name of the database.' }),
|
|
4
11
|
databasePassword: Flags.string({ char: 'p', description: 'Password of the database.', hidden: true }),
|
|
5
12
|
databaseUsername: Flags.string({ char: 'u', description: 'Username of the database.', hidden: true }),
|
|
6
13
|
hostname: Flags.string({ char: 'h', description: 'Hostname to connect to database.' }),
|
|
14
|
+
// JWT/Auth flags
|
|
7
15
|
jwksUri: Flags.string({ char: 'w', description: 'JWKS URI (must include https://).' }),
|
|
8
16
|
jwtAudiences: Flags.string({ char: 'a', default: '', description: 'JWT audiences (comma separated).' }),
|
|
9
17
|
port: Flags.integer({ char: 'o', description: 'Port number to connect to database.' }),
|
|
18
|
+
// General flags
|
|
10
19
|
skipInteraction: Flags.boolean({ char: 's', description: 'Skip interactivity.' }),
|
|
11
20
|
supabaseJWTSecret: Flags.string({ allowNo: true, char: 'j', description: 'Supabase JWT secret' }),
|
|
12
21
|
useSupabaseAuth: Flags.boolean({ allowNo: true, char: 'b', description: 'Use Supabase auth.' })
|
|
@@ -11157,7 +11157,7 @@ var files = [
|
|
|
11157
11157
|
"/dist",
|
|
11158
11158
|
"/oclif.manifest.json"
|
|
11159
11159
|
];
|
|
11160
|
-
var version = "0.
|
|
11160
|
+
var version = "0.8.0";
|
|
11161
11161
|
var bugs = "https://github.com/powersync-ja/cli/issues";
|
|
11162
11162
|
var types = "dist/index.d.ts";
|
|
11163
11163
|
var exports = "./lib/index.js";
|
|
@@ -47503,7 +47503,7 @@ var files = [
|
|
|
47503
47503
|
"/dist",
|
|
47504
47504
|
"/oclif.manifest.json"
|
|
47505
47505
|
];
|
|
47506
|
-
var version = "0.
|
|
47506
|
+
var version = "0.8.0";
|
|
47507
47507
|
var bugs = "https://github.com/powersync-ja/cli/issues";
|
|
47508
47508
|
var types$2 = "dist/index.d.ts";
|
|
47509
47509
|
var exports = "./lib/index.js";
|
package/dist/service/utils.js
CHANGED
package/oclif.manifest.json
CHANGED
|
@@ -86,6 +86,13 @@
|
|
|
86
86
|
"multiple": false,
|
|
87
87
|
"type": "option"
|
|
88
88
|
},
|
|
89
|
+
"protocol": {
|
|
90
|
+
"description": "Database protocol to use (e.g., for MongoDB: mongodb+srv or mongodb).",
|
|
91
|
+
"name": "protocol",
|
|
92
|
+
"hasDynamicHelp": false,
|
|
93
|
+
"multiple": false,
|
|
94
|
+
"type": "option"
|
|
95
|
+
},
|
|
89
96
|
"region": {
|
|
90
97
|
"char": "r",
|
|
91
98
|
"description": "Region to deploy instance to.",
|
|
@@ -94,6 +101,18 @@
|
|
|
94
101
|
"multiple": false,
|
|
95
102
|
"type": "option"
|
|
96
103
|
},
|
|
104
|
+
"connectionType": {
|
|
105
|
+
"char": "t",
|
|
106
|
+
"description": "Type of database connection.",
|
|
107
|
+
"name": "connectionType",
|
|
108
|
+
"hasDynamicHelp": false,
|
|
109
|
+
"multiple": false,
|
|
110
|
+
"options": [
|
|
111
|
+
"postgresql",
|
|
112
|
+
"mongodb"
|
|
113
|
+
],
|
|
114
|
+
"type": "option"
|
|
115
|
+
},
|
|
97
116
|
"databaseName": {
|
|
98
117
|
"char": "n",
|
|
99
118
|
"description": "Name of the database.",
|
|
@@ -200,6 +219,33 @@
|
|
|
200
219
|
"<%= config.bin %> <%= command.id %>"
|
|
201
220
|
],
|
|
202
221
|
"flags": {
|
|
222
|
+
"protocol": {
|
|
223
|
+
"description": "Database protocol to use (e.g., for MongoDB: mongodb+srv or mongodb).",
|
|
224
|
+
"name": "protocol",
|
|
225
|
+
"hasDynamicHelp": false,
|
|
226
|
+
"multiple": false,
|
|
227
|
+
"type": "option"
|
|
228
|
+
},
|
|
229
|
+
"region": {
|
|
230
|
+
"char": "r",
|
|
231
|
+
"description": "Region to deploy instance to.",
|
|
232
|
+
"name": "region",
|
|
233
|
+
"hasDynamicHelp": false,
|
|
234
|
+
"multiple": false,
|
|
235
|
+
"type": "option"
|
|
236
|
+
},
|
|
237
|
+
"connectionType": {
|
|
238
|
+
"char": "t",
|
|
239
|
+
"description": "Type of database connection.",
|
|
240
|
+
"name": "connectionType",
|
|
241
|
+
"hasDynamicHelp": false,
|
|
242
|
+
"multiple": false,
|
|
243
|
+
"options": [
|
|
244
|
+
"postgresql",
|
|
245
|
+
"mongodb"
|
|
246
|
+
],
|
|
247
|
+
"type": "option"
|
|
248
|
+
},
|
|
203
249
|
"databaseName": {
|
|
204
250
|
"char": "n",
|
|
205
251
|
"description": "Name of the database.",
|
|
@@ -650,5 +696,5 @@
|
|
|
650
696
|
]
|
|
651
697
|
}
|
|
652
698
|
},
|
|
653
|
-
"version": "0.
|
|
699
|
+
"version": "0.8.0"
|
|
654
700
|
}
|