powersync 0.6.0 → 0.7.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 +26 -25
- package/dist/commands/instance/config.js +2 -2
- package/dist/commands/instance/create.d.ts +1 -0
- package/dist/commands/instance/create.js +15 -8
- package/dist/commands/instance/deploy.js +2 -3
- package/dist/commands/instance/destroy.js +2 -2
- package/dist/commands/instance/generate-dev-token.js +2 -2
- package/dist/commands/instance/schema.js +2 -2
- package/dist/commands/instance/set.js +2 -2
- package/dist/commands/instance/status.js +2 -2
- package/dist/commands/instance/stop.js +2 -2
- package/dist/commands/instance/sync-rules/deploy.js +2 -2
- package/dist/commands/instance/sync-rules/generate-schema.js +3 -2
- package/dist/commands/instance/sync-rules/validate.js +2 -2
- package/dist/commands/instances.js +2 -2
- package/dist/commands.utils.js +7 -1
- package/dist/service/accounts.client.js +4 -4
- package/dist/service/powersync.client.js +57312 -25766
- package/dist/service/utils.js +4 -4
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +8 -4
- package/oclif.manifest.json +9 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ USAGE
|
|
|
26
26
|
|
|
27
27
|
The following environment variables can be injected:
|
|
28
28
|
|
|
29
|
-
* `AUTH_TOKEN` - The access token used to authenticate with the PowerSync service. [Learn more](https://docs.powersync.com/usage/tools/cli
|
|
29
|
+
* `AUTH_TOKEN` - The access token used to authenticate with the PowerSync service. [Learn more](https://docs.powersync.com/usage/tools/cli#personal-access-token).
|
|
30
30
|
* `ORG_ID` - The PowerSync organization ID. This is the first UUID in your project's dashboard URL. `123` in this example: `https://powersync.journeyapps.com/org/123/app/456`.
|
|
31
31
|
* `PROJECT_ID` - The PowerSync project ID. This is the second UUID in your project's dashboard URL. `456` in this example: `https://powersync.journeyapps.com/org/123/app/456`.
|
|
32
32
|
* `INSTANCE_ID` - The PowerSync instance ID. Get this by running `npx powersync instances`.
|
|
@@ -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.7.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.7.0/src/commands/instance/config.ts)_
|
|
111
111
|
|
|
112
112
|
## `powersync instance create`
|
|
113
113
|
|
|
@@ -116,18 +116,19 @@ Create a new instance.
|
|
|
116
116
|
```
|
|
117
117
|
USAGE
|
|
118
118
|
$ npx powersync instance create [-n <value>] [-h <value>] [-w <value>] [-a <value>] [-i <value>] [-o <value>] [-r
|
|
119
|
-
<value>] [-s] [-b]
|
|
119
|
+
<value>] [-s] [-j <value>] [-b]
|
|
120
120
|
|
|
121
121
|
FLAGS
|
|
122
|
-
-a, --jwtAudiences=<value>
|
|
123
|
-
-b, --[no-]useSupabaseAuth
|
|
124
|
-
-h, --hostname=<value>
|
|
125
|
-
-i, --name=<value>
|
|
126
|
-
-
|
|
127
|
-
-
|
|
128
|
-
-
|
|
129
|
-
-
|
|
130
|
-
-
|
|
122
|
+
-a, --jwtAudiences=<value> JWT audiences (comma separated).
|
|
123
|
+
-b, --[no-]useSupabaseAuth Use Supabase auth.
|
|
124
|
+
-h, --hostname=<value> Hostname to connect to database.
|
|
125
|
+
-i, --name=<value> Name of the instance.
|
|
126
|
+
-j, --supabaseJWTSecret=<value> Supabase JWT secret
|
|
127
|
+
-n, --databaseName=<value> Name of the database.
|
|
128
|
+
-o, --port=<value> Port number to connect to database.
|
|
129
|
+
-r, --region=<value> Region to deploy instance to.
|
|
130
|
+
-s, --skipInteraction Skip interactivity.
|
|
131
|
+
-w, --jwksUri=<value> JWKS URI (must include https://).
|
|
131
132
|
|
|
132
133
|
DESCRIPTION
|
|
133
134
|
Create a new instance.
|
|
@@ -136,7 +137,7 @@ EXAMPLES
|
|
|
136
137
|
$ npx powersync instance create
|
|
137
138
|
```
|
|
138
139
|
|
|
139
|
-
_See code: [src/commands/instance/create.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
140
|
+
_See code: [src/commands/instance/create.ts](https://github.com/powersync-ja/cli/blob/v0.7.0/src/commands/instance/create.ts)_
|
|
140
141
|
|
|
141
142
|
## `powersync instance deploy`
|
|
142
143
|
|
|
@@ -162,7 +163,7 @@ EXAMPLES
|
|
|
162
163
|
$ npx powersync instance deploy
|
|
163
164
|
```
|
|
164
165
|
|
|
165
|
-
_See code: [src/commands/instance/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
166
|
+
_See code: [src/commands/instance/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.7.0/src/commands/instance/deploy.ts)_
|
|
166
167
|
|
|
167
168
|
## `powersync instance destroy`
|
|
168
169
|
|
|
@@ -182,7 +183,7 @@ EXAMPLES
|
|
|
182
183
|
$ npx powersync instance destroy
|
|
183
184
|
```
|
|
184
185
|
|
|
185
|
-
_See code: [src/commands/instance/destroy.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
186
|
+
_See code: [src/commands/instance/destroy.ts](https://github.com/powersync-ja/cli/blob/v0.7.0/src/commands/instance/destroy.ts)_
|
|
186
187
|
|
|
187
188
|
## `powersync instance generate-dev-token`
|
|
188
189
|
|
|
@@ -203,7 +204,7 @@ EXAMPLES
|
|
|
203
204
|
$ npx powersync instance generate-dev-token
|
|
204
205
|
```
|
|
205
206
|
|
|
206
|
-
_See code: [src/commands/instance/generate-dev-token.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
207
|
+
_See code: [src/commands/instance/generate-dev-token.ts](https://github.com/powersync-ja/cli/blob/v0.7.0/src/commands/instance/generate-dev-token.ts)_
|
|
207
208
|
|
|
208
209
|
## `powersync instance schema`
|
|
209
210
|
|
|
@@ -220,7 +221,7 @@ EXAMPLES
|
|
|
220
221
|
$ npx powersync instance schema
|
|
221
222
|
```
|
|
222
223
|
|
|
223
|
-
_See code: [src/commands/instance/schema.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
224
|
+
_See code: [src/commands/instance/schema.ts](https://github.com/powersync-ja/cli/blob/v0.7.0/src/commands/instance/schema.ts)_
|
|
224
225
|
|
|
225
226
|
## `powersync instance set`
|
|
226
227
|
|
|
@@ -242,7 +243,7 @@ EXAMPLES
|
|
|
242
243
|
$ npx powersync instance set --instanceId=1234
|
|
243
244
|
```
|
|
244
245
|
|
|
245
|
-
_See code: [src/commands/instance/set.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
246
|
+
_See code: [src/commands/instance/set.ts](https://github.com/powersync-ja/cli/blob/v0.7.0/src/commands/instance/set.ts)_
|
|
246
247
|
|
|
247
248
|
## `powersync instance status`
|
|
248
249
|
|
|
@@ -267,7 +268,7 @@ EXAMPLES
|
|
|
267
268
|
$ npx powersync instance status --orgId=1234 --projectId=1234 --instanceId=1234 --authToken=1234
|
|
268
269
|
```
|
|
269
270
|
|
|
270
|
-
_See code: [src/commands/instance/status.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
271
|
+
_See code: [src/commands/instance/status.ts](https://github.com/powersync-ja/cli/blob/v0.7.0/src/commands/instance/status.ts)_
|
|
271
272
|
|
|
272
273
|
## `powersync instance stop`
|
|
273
274
|
|
|
@@ -287,7 +288,7 @@ EXAMPLES
|
|
|
287
288
|
$ npx powersync instance stop
|
|
288
289
|
```
|
|
289
290
|
|
|
290
|
-
_See code: [src/commands/instance/stop.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
291
|
+
_See code: [src/commands/instance/stop.ts](https://github.com/powersync-ja/cli/blob/v0.7.0/src/commands/instance/stop.ts)_
|
|
291
292
|
|
|
292
293
|
## `powersync instance sync-rules deploy`
|
|
293
294
|
|
|
@@ -312,7 +313,7 @@ EXAMPLES
|
|
|
312
313
|
$ npx powersync instance sync-rules deploy -f path/to/file
|
|
313
314
|
```
|
|
314
315
|
|
|
315
|
-
_See code: [src/commands/instance/sync-rules/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
316
|
+
_See code: [src/commands/instance/sync-rules/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.7.0/src/commands/instance/sync-rules/deploy.ts)_
|
|
316
317
|
|
|
317
318
|
## `powersync instance sync-rules generate-schema`
|
|
318
319
|
|
|
@@ -338,7 +339,7 @@ EXAMPLES
|
|
|
338
339
|
$ npx powersync instance sync-rules generate-schema -f path/to/file
|
|
339
340
|
```
|
|
340
341
|
|
|
341
|
-
_See code: [src/commands/instance/sync-rules/generate-schema.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
342
|
+
_See code: [src/commands/instance/sync-rules/generate-schema.ts](https://github.com/powersync-ja/cli/blob/v0.7.0/src/commands/instance/sync-rules/generate-schema.ts)_
|
|
342
343
|
|
|
343
344
|
## `powersync instance sync-rules validate`
|
|
344
345
|
|
|
@@ -362,7 +363,7 @@ EXAMPLES
|
|
|
362
363
|
$ npx powersync instance sync-rules validate -f path/to/file
|
|
363
364
|
```
|
|
364
365
|
|
|
365
|
-
_See code: [src/commands/instance/sync-rules/validate.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
366
|
+
_See code: [src/commands/instance/sync-rules/validate.ts](https://github.com/powersync-ja/cli/blob/v0.7.0/src/commands/instance/sync-rules/validate.ts)_
|
|
366
367
|
|
|
367
368
|
## `powersync instances`
|
|
368
369
|
|
|
@@ -379,5 +380,5 @@ EXAMPLES
|
|
|
379
380
|
$ npx powersync instances
|
|
380
381
|
```
|
|
381
382
|
|
|
382
|
-
_See code: [src/commands/instances.ts](https://github.com/powersync-ja/cli/blob/v0.
|
|
383
|
+
_See code: [src/commands/instances.ts](https://github.com/powersync-ja/cli/blob/v0.7.0/src/commands/instances.ts)_
|
|
383
384
|
<!-- commandsstop -->
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Command, ux } from '@oclif/core';
|
|
2
2
|
import * as PowerSyncClient from '../../service/powersync.client.js';
|
|
3
|
-
import {
|
|
3
|
+
import { checkThatEnvVariablesAreSet, red } from '../../utils.js';
|
|
4
4
|
export default class InstanceConfig extends Command {
|
|
5
5
|
static description = 'Display the instance config.';
|
|
6
6
|
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
7
7
|
async run() {
|
|
8
|
-
|
|
8
|
+
checkThatEnvVariablesAreSet(this.config.bin, true);
|
|
9
9
|
const config = await PowerSyncClient.getInstanceConfig();
|
|
10
10
|
if (!config) {
|
|
11
11
|
return this.log(red('No instance config found.'));
|
|
@@ -13,6 +13,7 @@ export default class InstanceCreate extends Command {
|
|
|
13
13
|
port: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
14
14
|
region: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
15
15
|
skipInteraction: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
16
|
+
supabaseJWTSecret: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
16
17
|
useSupabaseAuth: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
17
18
|
};
|
|
18
19
|
run(): Promise<void>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
/* eslint-disable camelcase */
|
|
2
1
|
import { Command, Flags, ux } from '@oclif/core';
|
|
3
2
|
import inquirer from 'inquirer';
|
|
4
3
|
import ora from 'ora';
|
|
5
4
|
import { generateCommonDeployQuestions } from '../../commands.utils.js';
|
|
6
5
|
import * as PowerSyncClient from '../../service/powersync.client.js';
|
|
7
|
-
import { bold,
|
|
6
|
+
import { bold, checkThatEnvVariablesAreSet, green, red, updateEnvFileVariableValue } from '../../utils.js';
|
|
8
7
|
export default class InstanceCreate extends Command {
|
|
9
8
|
static description = 'Create a new instance.';
|
|
10
9
|
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
@@ -19,10 +18,11 @@ export default class InstanceCreate extends Command {
|
|
|
19
18
|
port: Flags.integer({ char: 'o', description: 'Port number to connect to database.' }),
|
|
20
19
|
region: Flags.string({ char: 'r', description: 'Region to deploy instance to.' }),
|
|
21
20
|
skipInteraction: Flags.boolean({ char: 's', description: 'Skip interactivity.' }),
|
|
21
|
+
supabaseJWTSecret: Flags.string({ allowNo: true, char: 'j', description: 'Supabase JWT secret' }),
|
|
22
22
|
useSupabaseAuth: Flags.boolean({ allowNo: true, char: 'b', description: 'Use Supabase auth.' })
|
|
23
23
|
};
|
|
24
24
|
async run() {
|
|
25
|
-
|
|
25
|
+
checkThatEnvVariablesAreSet(this.config.bin);
|
|
26
26
|
const { flags } = await this.parse(InstanceCreate);
|
|
27
27
|
const regions = await PowerSyncClient.getRegions();
|
|
28
28
|
let answers = {
|
|
@@ -30,8 +30,8 @@ export default class InstanceCreate extends Command {
|
|
|
30
30
|
databasePassword: undefined,
|
|
31
31
|
databaseUsername: undefined,
|
|
32
32
|
hostname: undefined,
|
|
33
|
-
jwksAudiences: undefined,
|
|
34
33
|
jwksUri: undefined,
|
|
34
|
+
jwtAudiences: undefined,
|
|
35
35
|
name: undefined,
|
|
36
36
|
port: undefined,
|
|
37
37
|
region: undefined,
|
|
@@ -68,9 +68,11 @@ export default class InstanceCreate extends Command {
|
|
|
68
68
|
const region = flags.region?.toLowerCase() || answers.region?.toLowerCase();
|
|
69
69
|
const useSupabaseAuth = flags.useSupabaseAuth || answers.useSupabaseAuth;
|
|
70
70
|
const jwksUri = flags.jwksUri || answers.jwksUri;
|
|
71
|
-
const answerAudiences = answers.
|
|
72
|
-
const flagsAudiences = flags.
|
|
73
|
-
const audiences = flagsAudiences
|
|
71
|
+
const answerAudiences = answers.jwtAudiences ? answers.jwtAudiences.split(',') : [];
|
|
72
|
+
const flagsAudiences = flags.jwtAudiences ? flags.jwtAudiences.split(',') : [];
|
|
73
|
+
const audiences = [...flagsAudiences, ...answerAudiences];
|
|
74
|
+
const supabaseJWTSecret = flags.supabaseJWTSecret ?? answers.supabaseJWTSecret;
|
|
75
|
+
// TODO, support other connection types
|
|
74
76
|
const connection = {
|
|
75
77
|
database: databaseName,
|
|
76
78
|
debug_api: false,
|
|
@@ -89,7 +91,12 @@ export default class InstanceCreate extends Command {
|
|
|
89
91
|
client_auth: {
|
|
90
92
|
additional_audiences: audiences || undefined,
|
|
91
93
|
jwks_uri: jwksUri || undefined,
|
|
92
|
-
supabase: useSupabaseAuth
|
|
94
|
+
supabase: useSupabaseAuth,
|
|
95
|
+
supabase_jwt_secret: supabaseJWTSecret
|
|
96
|
+
? {
|
|
97
|
+
secret: supabaseJWTSecret
|
|
98
|
+
}
|
|
99
|
+
: undefined
|
|
93
100
|
},
|
|
94
101
|
region,
|
|
95
102
|
replication: {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
/* eslint-disable camelcase */
|
|
2
1
|
import { Command, Flags, ux } from '@oclif/core';
|
|
3
2
|
import inquirer from 'inquirer';
|
|
4
3
|
import ora from 'ora';
|
|
5
4
|
import { generateCommonDeployQuestions } from '../../commands.utils.js';
|
|
6
5
|
import * as PowerSyncClient from '../../service/powersync.client.js';
|
|
7
|
-
import { bold,
|
|
6
|
+
import { bold, checkThatEnvVariablesAreSet, green, red } from '../../utils.js';
|
|
8
7
|
export default class InstanceDeploy extends Command {
|
|
9
8
|
static description = 'Deploy changes to an existing instance.';
|
|
10
9
|
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
@@ -20,7 +19,7 @@ export default class InstanceDeploy extends Command {
|
|
|
20
19
|
useSupabaseAuth: Flags.boolean({ allowNo: true, char: 'b', description: 'Use Supabase auth.' })
|
|
21
20
|
};
|
|
22
21
|
async run() {
|
|
23
|
-
|
|
22
|
+
checkThatEnvVariablesAreSet(this.config.bin, true);
|
|
24
23
|
const { flags } = await this.parse(InstanceDeploy);
|
|
25
24
|
let answers = {
|
|
26
25
|
databaseName: undefined,
|
|
@@ -2,7 +2,7 @@ import { Command, Flags, ux } from '@oclif/core';
|
|
|
2
2
|
import inquirer from 'inquirer';
|
|
3
3
|
import ora from 'ora';
|
|
4
4
|
import * as PowerSyncClient from '../../service/powersync.client.js';
|
|
5
|
-
import { bold,
|
|
5
|
+
import { bold, checkThatEnvVariablesAreSet, green, red } from '../../utils.js';
|
|
6
6
|
export default class InstanceDestroy extends Command {
|
|
7
7
|
static description = 'Destroy the current instance - THIS CANNOT BE UNDONE.';
|
|
8
8
|
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
@@ -10,7 +10,7 @@ export default class InstanceDestroy extends Command {
|
|
|
10
10
|
skipConfirmation: Flags.boolean({ char: 's', description: 'Ignore confirmation question.' })
|
|
11
11
|
};
|
|
12
12
|
async run() {
|
|
13
|
-
|
|
13
|
+
checkThatEnvVariablesAreSet(this.config.bin, true);
|
|
14
14
|
const { flags } = await this.parse(InstanceDestroy);
|
|
15
15
|
const config = await PowerSyncClient.getInstanceConfig();
|
|
16
16
|
const questions = [
|
|
@@ -2,7 +2,7 @@ import { Command, Flags, ux } from '@oclif/core';
|
|
|
2
2
|
import clipboard from 'clipboardy';
|
|
3
3
|
import inquirer from 'inquirer';
|
|
4
4
|
import * as PowerSyncClient from '../../service/powersync.client.js';
|
|
5
|
-
import { bold,
|
|
5
|
+
import { bold, checkThatEnvVariablesAreSet, convertSeconds, green } from '../../utils.js';
|
|
6
6
|
export default class InstanceGenerateDevToken extends Command {
|
|
7
7
|
static description = 'Generate a developer token using the Token subject/ User ID.';
|
|
8
8
|
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
@@ -14,7 +14,7 @@ export default class InstanceGenerateDevToken extends Command {
|
|
|
14
14
|
userId: Flags.string({ char: 'u', description: 'The Token subject/User ID for the developer token' })
|
|
15
15
|
};
|
|
16
16
|
async run() {
|
|
17
|
-
|
|
17
|
+
checkThatEnvVariablesAreSet(this.config.bin, true);
|
|
18
18
|
const { flags } = await this.parse(InstanceGenerateDevToken);
|
|
19
19
|
const questions = [
|
|
20
20
|
{
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/* eslint-disable perfectionist/sort-objects */
|
|
2
2
|
import { Command, ux } from '@oclif/core';
|
|
3
3
|
import * as PowerSyncClient from '../../service/powersync.client.js';
|
|
4
|
-
import {
|
|
4
|
+
import { checkThatEnvVariablesAreSet } from '../../utils.js';
|
|
5
5
|
export default class InstanceSchema extends Command {
|
|
6
6
|
static description = 'View the schema of the current instance.';
|
|
7
7
|
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
8
8
|
async run() {
|
|
9
|
-
|
|
9
|
+
checkThatEnvVariablesAreSet(this.config.bin, true);
|
|
10
10
|
const result = await PowerSyncClient.getInstanceSchema();
|
|
11
11
|
result.connections[0].schemas.map((schema) => {
|
|
12
12
|
ux.log(`\nSCHEMA: ${schema.name}\n`);
|
|
@@ -2,7 +2,7 @@ import { Command, Flags, ux } from '@oclif/core';
|
|
|
2
2
|
import inquirer from 'inquirer';
|
|
3
3
|
import * as PowerSyncClient from '../../service/powersync.client.js';
|
|
4
4
|
import { ENV_VARIABLES } from '../../service/powersync.client.js';
|
|
5
|
-
import { bold,
|
|
5
|
+
import { bold, checkThatEnvVariablesAreSet, green, updateEnvFileVariableValue } from '../../utils.js';
|
|
6
6
|
export default class InstanceSet extends Command {
|
|
7
7
|
static description = 'Set the current instance.';
|
|
8
8
|
static examples = ['<%= config.bin %> <%= command.id %>', '<%= config.bin %> <%= command.id %> --instanceId=1234'];
|
|
@@ -10,7 +10,7 @@ export default class InstanceSet extends Command {
|
|
|
10
10
|
instanceId: Flags.string({ char: 'i', description: 'Instance ID to change to.' })
|
|
11
11
|
};
|
|
12
12
|
async run() {
|
|
13
|
-
|
|
13
|
+
checkThatEnvVariablesAreSet(this.config.bin);
|
|
14
14
|
const { flags } = await this.parse(InstanceSet);
|
|
15
15
|
const list = await PowerSyncClient.getInstancesList();
|
|
16
16
|
const instances = list.instances.map((instance) => ({ name: instance.name, value: instance.id }));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command, Flags, ux } from '@oclif/core';
|
|
2
2
|
import * as PowerSyncClient from '../../service/powersync.client.js';
|
|
3
|
-
import {
|
|
3
|
+
import { checkThatEnvVariablesAreSet, green, red } from '../../utils.js';
|
|
4
4
|
export default class InstanceStatus extends Command {
|
|
5
5
|
static description = 'View the status of the current instance. View the status of a different instance by using flags.';
|
|
6
6
|
static examples = [
|
|
@@ -28,7 +28,7 @@ export default class InstanceStatus extends Command {
|
|
|
28
28
|
async run() {
|
|
29
29
|
const { flags } = await this.parse(InstanceStatus);
|
|
30
30
|
if (!flags.authToken || !flags.instanceId || !flags.orgId || !flags.projectId) {
|
|
31
|
-
|
|
31
|
+
checkThatEnvVariablesAreSet(this.config.bin, true);
|
|
32
32
|
}
|
|
33
33
|
const diagnostics = await PowerSyncClient.getInstanceDiagnostics({
|
|
34
34
|
authToken: flags.authToken,
|
|
@@ -2,7 +2,7 @@ import { Command, Flags, ux } from '@oclif/core';
|
|
|
2
2
|
import inquirer from 'inquirer';
|
|
3
3
|
import ora from 'ora';
|
|
4
4
|
import * as PowerSyncClient from '../../service/powersync.client.js';
|
|
5
|
-
import { bold,
|
|
5
|
+
import { bold, checkThatEnvVariablesAreSet, red, yellow } from '../../utils.js';
|
|
6
6
|
export default class InstanceDeactivate extends Command {
|
|
7
7
|
static description = 'Stop the current instance.';
|
|
8
8
|
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
@@ -10,7 +10,7 @@ export default class InstanceDeactivate extends Command {
|
|
|
10
10
|
skipConfirmation: Flags.boolean({ char: 's', description: 'Ignore confirmation question.' })
|
|
11
11
|
};
|
|
12
12
|
async run() {
|
|
13
|
-
|
|
13
|
+
checkThatEnvVariablesAreSet(this.config.bin, true);
|
|
14
14
|
const { flags } = await this.parse(InstanceDeactivate);
|
|
15
15
|
const questions = [
|
|
16
16
|
{
|
|
@@ -3,7 +3,7 @@ import inquirer from 'inquirer';
|
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import ora from 'ora';
|
|
5
5
|
import * as PowerSyncClient from '../../../service/powersync.client.js';
|
|
6
|
-
import { bold,
|
|
6
|
+
import { bold, checkThatEnvVariablesAreSet, green, red } from '../../../utils.js';
|
|
7
7
|
export default class SyncRulesDeploy extends Command {
|
|
8
8
|
static description = 'Deploy sync rules from a local sync rules config file to the current instance.';
|
|
9
9
|
static examples = [
|
|
@@ -16,7 +16,7 @@ export default class SyncRulesDeploy extends Command {
|
|
|
16
16
|
skipConfirmation: Flags.boolean({ char: 's', description: 'Ignore confirmation question.' })
|
|
17
17
|
};
|
|
18
18
|
async run() {
|
|
19
|
-
|
|
19
|
+
checkThatEnvVariablesAreSet(this.config.bin, true);
|
|
20
20
|
const { flags } = await this.parse(SyncRulesDeploy);
|
|
21
21
|
const questions = [
|
|
22
22
|
{
|
|
@@ -3,7 +3,7 @@ import inquirer from 'inquirer';
|
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import { LANGUAGES } from '../../../constants.js';
|
|
5
5
|
import * as PowerSyncClient from '../../../service/powersync.client.js';
|
|
6
|
-
import {
|
|
6
|
+
import { checkThatEnvVariablesAreSet, green, red } from '../../../utils.js';
|
|
7
7
|
export default class SyncRulesGenerateSchema extends Command {
|
|
8
8
|
static description = 'Generate schema in your language from your sync rules config file.';
|
|
9
9
|
static examples = [
|
|
@@ -20,7 +20,7 @@ export default class SyncRulesGenerateSchema extends Command {
|
|
|
20
20
|
})
|
|
21
21
|
};
|
|
22
22
|
async run() {
|
|
23
|
-
|
|
23
|
+
checkThatEnvVariablesAreSet(this.config.bin, true);
|
|
24
24
|
const { flags } = await this.parse(SyncRulesGenerateSchema);
|
|
25
25
|
const questions = [
|
|
26
26
|
{
|
|
@@ -36,6 +36,7 @@ export default class SyncRulesGenerateSchema extends Command {
|
|
|
36
36
|
const parsedSchema = new PowerSyncClient.StaticSchema(schema.connections);
|
|
37
37
|
const syncRulesFromFile = fs.readFileSync(flags.filePath, 'utf8');
|
|
38
38
|
const syncRules = PowerSyncClient.SqlSyncRules.fromYaml(syncRulesFromFile, {
|
|
39
|
+
defaultSchema: 'public',
|
|
39
40
|
schema: parsedSchema,
|
|
40
41
|
throwOnError: false
|
|
41
42
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command, Flags, ux } from '@oclif/core';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import * as PowerSyncClient from '../../../service/powersync.client.js';
|
|
4
|
-
import {
|
|
4
|
+
import { checkThatEnvVariablesAreSet, green, red } from '../../../utils.js';
|
|
5
5
|
export default class SyncRulesValidate extends Command {
|
|
6
6
|
static description = 'Validate sync rules from a local sync rules config file.';
|
|
7
7
|
static examples = [
|
|
@@ -13,7 +13,7 @@ export default class SyncRulesValidate extends Command {
|
|
|
13
13
|
filePath: Flags.string({ char: 'f', description: 'Path to the sync rules config file.', required: true })
|
|
14
14
|
};
|
|
15
15
|
async run() {
|
|
16
|
-
|
|
16
|
+
checkThatEnvVariablesAreSet(this.config.bin, true);
|
|
17
17
|
const { flags } = await this.parse(SyncRulesValidate);
|
|
18
18
|
const syncRules = fs.readFileSync(flags.filePath, 'utf8');
|
|
19
19
|
const validation = await PowerSyncClient.validateSyncRules(syncRules);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Command, ux } from '@oclif/core';
|
|
2
2
|
import * as AccountsClient from '../service/accounts.client.js';
|
|
3
3
|
import * as PowerSyncClient from '../service/powersync.client.js';
|
|
4
|
-
import { bold,
|
|
4
|
+
import { bold, checkThatEnvVariablesAreSet, green, red } from '../utils.js';
|
|
5
5
|
export default class InstancesList extends Command {
|
|
6
6
|
static description = 'View list of instances.';
|
|
7
7
|
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
8
8
|
async run() {
|
|
9
|
-
|
|
9
|
+
checkThatEnvVariablesAreSet(this.config.bin, false);
|
|
10
10
|
const project = await AccountsClient.getCurrentPowerSyncProject();
|
|
11
11
|
const list = await PowerSyncClient.getInstancesList();
|
|
12
12
|
const { instances } = list;
|
package/dist/commands.utils.js
CHANGED
|
@@ -60,6 +60,12 @@ export const generateCommonDeployQuestions = (flags) => [
|
|
|
60
60
|
// eslint-disable-next-line eqeqeq,no-eq-null
|
|
61
61
|
when: flags.useSupabaseAuth == null && !flags.jwksUri
|
|
62
62
|
},
|
|
63
|
+
{
|
|
64
|
+
message: 'Enter the Supabase JWT secret (see https://docs.powersync.com/installation/authentication-setup/supabase-auth#supabase-auth)',
|
|
65
|
+
name: 'supabaseJWTSecret',
|
|
66
|
+
type: 'password',
|
|
67
|
+
when: (answers) => (flags.useSupabaseAuth || answers.useSupabaseAuth) && !flags.supabaseJWTSecret
|
|
68
|
+
},
|
|
63
69
|
{
|
|
64
70
|
message: 'Enter your JWKS URI (must include https://)?',
|
|
65
71
|
name: 'jwksUri',
|
|
@@ -79,7 +85,7 @@ export const generateCommonDeployQuestions = (flags) => [
|
|
|
79
85
|
},
|
|
80
86
|
{
|
|
81
87
|
message: 'Enter your JWT Audiences? (comma separated)',
|
|
82
|
-
name: '
|
|
88
|
+
name: 'jwtAudiences',
|
|
83
89
|
type: 'input',
|
|
84
90
|
when: (answers) => answers.useAudiences
|
|
85
91
|
}
|
|
@@ -11157,7 +11157,7 @@ var files = [
|
|
|
11157
11157
|
"/dist",
|
|
11158
11158
|
"/oclif.manifest.json"
|
|
11159
11159
|
];
|
|
11160
|
-
var version = "0.
|
|
11160
|
+
var version = "0.7.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";
|
|
@@ -11215,12 +11215,12 @@ var dependencies = {
|
|
|
11215
11215
|
};
|
|
11216
11216
|
var devDependencies = {
|
|
11217
11217
|
"@changesets/cli": "^2.27.7",
|
|
11218
|
-
"@journeyapps-platform/powersync
|
|
11218
|
+
"@journeyapps-platform/types-powersync": "^1.12.1",
|
|
11219
11219
|
"@journeyapps-platform/sdk-accounts-hub": "^7.0.1",
|
|
11220
11220
|
"@journeyapps-platform/sdk-common": "^5.5.0",
|
|
11221
|
-
"@journeyapps-platform/sdk-powersync": "^
|
|
11221
|
+
"@journeyapps-platform/sdk-powersync": "^2.5.1",
|
|
11222
11222
|
"@journeyapps-platform/types-accounts-hub": "^7.0.1",
|
|
11223
|
-
"@powersync/service-sync-rules": "^0.
|
|
11223
|
+
"@powersync/service-sync-rules": "^0.27.0",
|
|
11224
11224
|
"@rollup/plugin-commonjs": "^26.0.1",
|
|
11225
11225
|
"@rollup/plugin-json": "^6.1.0",
|
|
11226
11226
|
"@rollup/plugin-node-resolve": "^15.2.3",
|