powersync 0.2.2 → 0.2.4
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 +24 -24
- package/dist/commands/instance/create.js +1 -1
- package/dist/commands/instance/deploy.js +3 -1
- package/dist/commands/instance/destroy.js +1 -1
- package/dist/commands/instance/sync-rules/deploy.js +2 -2
- package/dist/commands/instance/sync-rules/generate-schema.js +2 -2
- package/dist/commands/instance/sync-rules/validate.js +2 -2
- package/dist/service/accounts.client.js +450 -169
- package/dist/service/powersync.client.js +464 -183
- package/dist/service/utils.js +276 -5
- package/dist/utils.js +5 -10
- package/oclif.manifest.json +7 -7
- package/package.json +20 -18
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ $ npm install -g powersync
|
|
|
13
13
|
$ powersync COMMAND
|
|
14
14
|
running command...
|
|
15
15
|
$ powersync (--version)
|
|
16
|
-
powersync/0.2.
|
|
16
|
+
powersync/0.2.4 linux-x64 node-v20.11.0
|
|
17
17
|
$ powersync --help [COMMAND]
|
|
18
18
|
USAGE
|
|
19
19
|
$ powersync COMMAND
|
|
@@ -57,7 +57,7 @@ DESCRIPTION
|
|
|
57
57
|
Display help for powersync.
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.0.
|
|
60
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.0.13/src/commands/help.ts)_
|
|
61
61
|
|
|
62
62
|
## `powersync init`
|
|
63
63
|
|
|
@@ -74,7 +74,7 @@ EXAMPLES
|
|
|
74
74
|
$ powersync init
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
_See code: [src/commands/init.ts](https://github.com/powersync-ja/cli/blob/v0.2.
|
|
77
|
+
_See code: [src/commands/init.ts](https://github.com/powersync-ja/cli/blob/v0.2.4/src/commands/init.ts)_
|
|
78
78
|
|
|
79
79
|
## `powersync instance config`
|
|
80
80
|
|
|
@@ -91,7 +91,7 @@ EXAMPLES
|
|
|
91
91
|
$ powersync instance config
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
_See code: [src/commands/instance/config.ts](https://github.com/powersync-ja/cli/blob/v0.2.
|
|
94
|
+
_See code: [src/commands/instance/config.ts](https://github.com/powersync-ja/cli/blob/v0.2.4/src/commands/instance/config.ts)_
|
|
95
95
|
|
|
96
96
|
## `powersync instance create`
|
|
97
97
|
|
|
@@ -118,7 +118,7 @@ EXAMPLES
|
|
|
118
118
|
$ powersync instance create
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
-
_See code: [src/commands/instance/create.ts](https://github.com/powersync-ja/cli/blob/v0.2.
|
|
121
|
+
_See code: [src/commands/instance/create.ts](https://github.com/powersync-ja/cli/blob/v0.2.4/src/commands/instance/create.ts)_
|
|
122
122
|
|
|
123
123
|
## `powersync instance deploy`
|
|
124
124
|
|
|
@@ -143,7 +143,7 @@ EXAMPLES
|
|
|
143
143
|
$ powersync instance deploy
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
-
_See code: [src/commands/instance/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.2.
|
|
146
|
+
_See code: [src/commands/instance/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.2.4/src/commands/instance/deploy.ts)_
|
|
147
147
|
|
|
148
148
|
## `powersync instance destroy`
|
|
149
149
|
|
|
@@ -163,7 +163,7 @@ EXAMPLES
|
|
|
163
163
|
$ powersync instance destroy
|
|
164
164
|
```
|
|
165
165
|
|
|
166
|
-
_See code: [src/commands/instance/destroy.ts](https://github.com/powersync-ja/cli/blob/v0.2.
|
|
166
|
+
_See code: [src/commands/instance/destroy.ts](https://github.com/powersync-ja/cli/blob/v0.2.4/src/commands/instance/destroy.ts)_
|
|
167
167
|
|
|
168
168
|
## `powersync instance schema`
|
|
169
169
|
|
|
@@ -180,7 +180,7 @@ EXAMPLES
|
|
|
180
180
|
$ powersync instance schema
|
|
181
181
|
```
|
|
182
182
|
|
|
183
|
-
_See code: [src/commands/instance/schema.ts](https://github.com/powersync-ja/cli/blob/v0.2.
|
|
183
|
+
_See code: [src/commands/instance/schema.ts](https://github.com/powersync-ja/cli/blob/v0.2.4/src/commands/instance/schema.ts)_
|
|
184
184
|
|
|
185
185
|
## `powersync instance set`
|
|
186
186
|
|
|
@@ -202,7 +202,7 @@ EXAMPLES
|
|
|
202
202
|
$ powersync instance set --instanceId=1234
|
|
203
203
|
```
|
|
204
204
|
|
|
205
|
-
_See code: [src/commands/instance/set.ts](https://github.com/powersync-ja/cli/blob/v0.2.
|
|
205
|
+
_See code: [src/commands/instance/set.ts](https://github.com/powersync-ja/cli/blob/v0.2.4/src/commands/instance/set.ts)_
|
|
206
206
|
|
|
207
207
|
## `powersync instance status`
|
|
208
208
|
|
|
@@ -227,7 +227,7 @@ EXAMPLES
|
|
|
227
227
|
$ powersync instance status --orgId=1234 --appId=1234 --instanceId=1234 --authToken=1234
|
|
228
228
|
```
|
|
229
229
|
|
|
230
|
-
_See code: [src/commands/instance/status.ts](https://github.com/powersync-ja/cli/blob/v0.2.
|
|
230
|
+
_See code: [src/commands/instance/status.ts](https://github.com/powersync-ja/cli/blob/v0.2.4/src/commands/instance/status.ts)_
|
|
231
231
|
|
|
232
232
|
## `powersync instance stop`
|
|
233
233
|
|
|
@@ -247,22 +247,22 @@ EXAMPLES
|
|
|
247
247
|
$ powersync instance stop
|
|
248
248
|
```
|
|
249
249
|
|
|
250
|
-
_See code: [src/commands/instance/stop.ts](https://github.com/powersync-ja/cli/blob/v0.2.
|
|
250
|
+
_See code: [src/commands/instance/stop.ts](https://github.com/powersync-ja/cli/blob/v0.2.4/src/commands/instance/stop.ts)_
|
|
251
251
|
|
|
252
252
|
## `powersync instance sync-rules deploy`
|
|
253
253
|
|
|
254
|
-
Deploy sync rules from a local file to the current instance.
|
|
254
|
+
Deploy sync rules from a local sync rules file to the current instance.
|
|
255
255
|
|
|
256
256
|
```
|
|
257
257
|
USAGE
|
|
258
258
|
$ powersync instance sync-rules deploy -f <value> [-s]
|
|
259
259
|
|
|
260
260
|
FLAGS
|
|
261
|
-
-f, --filePath=<value> (required) Path to the file.
|
|
261
|
+
-f, --filePath=<value> (required) Path to the sync rules config file.
|
|
262
262
|
-s, --skipConfirmation Ignore confirmation question.
|
|
263
263
|
|
|
264
264
|
DESCRIPTION
|
|
265
|
-
Deploy sync rules from a local file to the current instance.
|
|
265
|
+
Deploy sync rules from a local sync rules file to the current instance.
|
|
266
266
|
|
|
267
267
|
EXAMPLES
|
|
268
268
|
$ powersync instance sync-rules deploy
|
|
@@ -272,23 +272,23 @@ EXAMPLES
|
|
|
272
272
|
$ powersync instance sync-rules deploy -f path/to/file
|
|
273
273
|
```
|
|
274
274
|
|
|
275
|
-
_See code: [src/commands/instance/sync-rules/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.2.
|
|
275
|
+
_See code: [src/commands/instance/sync-rules/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.2.4/src/commands/instance/sync-rules/deploy.ts)_
|
|
276
276
|
|
|
277
277
|
## `powersync instance sync-rules generate-schema`
|
|
278
278
|
|
|
279
|
-
Generate schema in your language from sync rules.
|
|
279
|
+
Generate schema in your language from your sync rules file.
|
|
280
280
|
|
|
281
281
|
```
|
|
282
282
|
USAGE
|
|
283
283
|
$ powersync instance sync-rules generate-schema -f <value> [-l js|dart]
|
|
284
284
|
|
|
285
285
|
FLAGS
|
|
286
|
-
-f, --filePath=<value> (required) Path to the file.
|
|
286
|
+
-f, --filePath=<value> (required) Path to the sync rules config file.
|
|
287
287
|
-l, --language=<option> Choose language for output.
|
|
288
288
|
<options: js|dart>
|
|
289
289
|
|
|
290
290
|
DESCRIPTION
|
|
291
|
-
Generate schema in your language from sync rules.
|
|
291
|
+
Generate schema in your language from your sync rules file.
|
|
292
292
|
|
|
293
293
|
EXAMPLES
|
|
294
294
|
$ powersync instance sync-rules generate-schema
|
|
@@ -298,21 +298,21 @@ EXAMPLES
|
|
|
298
298
|
$ powersync instance sync-rules generate-schema -f path/to/file
|
|
299
299
|
```
|
|
300
300
|
|
|
301
|
-
_See code: [src/commands/instance/sync-rules/generate-schema.ts](https://github.com/powersync-ja/cli/blob/v0.2.
|
|
301
|
+
_See code: [src/commands/instance/sync-rules/generate-schema.ts](https://github.com/powersync-ja/cli/blob/v0.2.4/src/commands/instance/sync-rules/generate-schema.ts)_
|
|
302
302
|
|
|
303
303
|
## `powersync instance sync-rules validate`
|
|
304
304
|
|
|
305
|
-
Validate sync rules from a local file.
|
|
305
|
+
Validate sync rules from a local sync rules file.
|
|
306
306
|
|
|
307
307
|
```
|
|
308
308
|
USAGE
|
|
309
309
|
$ powersync instance sync-rules validate -f <value>
|
|
310
310
|
|
|
311
311
|
FLAGS
|
|
312
|
-
-f, --filePath=<value> (required) Path to the file.
|
|
312
|
+
-f, --filePath=<value> (required) Path to the sync rules config file.
|
|
313
313
|
|
|
314
314
|
DESCRIPTION
|
|
315
|
-
Validate sync rules from a local file.
|
|
315
|
+
Validate sync rules from a local sync rules file.
|
|
316
316
|
|
|
317
317
|
EXAMPLES
|
|
318
318
|
$ powersync instance sync-rules validate
|
|
@@ -322,7 +322,7 @@ EXAMPLES
|
|
|
322
322
|
$ powersync instance sync-rules validate -f path/to/file
|
|
323
323
|
```
|
|
324
324
|
|
|
325
|
-
_See code: [src/commands/instance/sync-rules/validate.ts](https://github.com/powersync-ja/cli/blob/v0.2.
|
|
325
|
+
_See code: [src/commands/instance/sync-rules/validate.ts](https://github.com/powersync-ja/cli/blob/v0.2.4/src/commands/instance/sync-rules/validate.ts)_
|
|
326
326
|
|
|
327
327
|
## `powersync instances`
|
|
328
328
|
|
|
@@ -339,5 +339,5 @@ EXAMPLES
|
|
|
339
339
|
$ powersync instances
|
|
340
340
|
```
|
|
341
341
|
|
|
342
|
-
_See code: [src/commands/instances.ts](https://github.com/powersync-ja/cli/blob/v0.2.
|
|
342
|
+
_See code: [src/commands/instances.ts](https://github.com/powersync-ja/cli/blob/v0.2.4/src/commands/instances.ts)_
|
|
343
343
|
<!-- commandsstop -->
|
|
@@ -152,7 +152,7 @@ export default class InstanceCreate extends Command {
|
|
|
152
152
|
});
|
|
153
153
|
spinner.start();
|
|
154
154
|
const instance = await PowerSyncClient.createInstance(instanceName);
|
|
155
|
-
await PowerSyncClient.deployInstance(config, instance.id);
|
|
155
|
+
await PowerSyncClient.deployInstance(config, instance.id, { options: { shouldApplyAdditionalHeaders: false } });
|
|
156
156
|
let status = 'pending';
|
|
157
157
|
status = await PowerSyncClient.waitForStatusChange(instance.id);
|
|
158
158
|
spinner.stop();
|
|
@@ -97,7 +97,9 @@ export default class InstanceDeploy extends Command {
|
|
|
97
97
|
const databaseName = flags.databaseName || answers.databaseName;
|
|
98
98
|
const databaseUsername = flags.databaseUsername || answers.databaseUsername;
|
|
99
99
|
const useSupabaseAuth = flags.useSupabaseAuth || answers.useSupabaseAuth;
|
|
100
|
-
const instanceConfig = await PowerSyncClient.getInstanceConfig(
|
|
100
|
+
const instanceConfig = await PowerSyncClient.getInstanceConfig({
|
|
101
|
+
options: { shouldApplyAdditionalHeaders: false }
|
|
102
|
+
});
|
|
101
103
|
const { region } = instanceConfig.config;
|
|
102
104
|
const config = {
|
|
103
105
|
client_auth: {
|
|
@@ -12,7 +12,7 @@ export default class InstanceDestroy extends Command {
|
|
|
12
12
|
async run() {
|
|
13
13
|
checkForValidEnvFile(this.config.bin, true);
|
|
14
14
|
const { flags } = await this.parse(InstanceDestroy);
|
|
15
|
-
const config = await PowerSyncClient.getInstanceConfig();
|
|
15
|
+
const config = await PowerSyncClient.getInstanceConfig({ options: { shouldApplyAdditionalHeaders: false } });
|
|
16
16
|
const questions = [
|
|
17
17
|
{
|
|
18
18
|
message: `Please type ${red(config.name)} to confirm you want to destroy this instance.\n`,
|
|
@@ -5,14 +5,14 @@ import ora from 'ora';
|
|
|
5
5
|
import * as PowerSyncClient from '../../../service/powersync.client.js';
|
|
6
6
|
import { bold, checkForValidEnvFile, green, red } from '../../../utils.js';
|
|
7
7
|
export default class SyncRulesDeploy extends Command {
|
|
8
|
-
static description = 'Deploy sync rules from a local file to the current instance.';
|
|
8
|
+
static description = 'Deploy sync rules from a local sync rules file to the current instance.';
|
|
9
9
|
static examples = [
|
|
10
10
|
'<%= config.bin %> <%= command.id %>',
|
|
11
11
|
'<%= config.bin %> <%= command.id %> --filePath path/to/file',
|
|
12
12
|
'<%= config.bin %> <%= command.id %> -f path/to/file'
|
|
13
13
|
];
|
|
14
14
|
static flags = {
|
|
15
|
-
filePath: Flags.string({ char: 'f', description: 'Path to the file.', required: true }),
|
|
15
|
+
filePath: Flags.string({ char: 'f', description: 'Path to the sync rules config file.', required: true }),
|
|
16
16
|
skipConfirmation: Flags.boolean({ char: 's', description: 'Ignore confirmation question.' })
|
|
17
17
|
};
|
|
18
18
|
async run() {
|
|
@@ -5,14 +5,14 @@ import { LANGUAGES } from '../../../constants.js';
|
|
|
5
5
|
import * as PowerSyncClient from '../../../service/powersync.client.js';
|
|
6
6
|
import { checkForValidEnvFile, green, red } from '../../../utils.js';
|
|
7
7
|
export default class SyncRulesGenerateSchema extends Command {
|
|
8
|
-
static description = 'Generate schema in your language from sync rules.';
|
|
8
|
+
static description = 'Generate schema in your language from your sync rules file.';
|
|
9
9
|
static examples = [
|
|
10
10
|
'<%= config.bin %> <%= command.id %>',
|
|
11
11
|
'<%= config.bin %> <%= command.id %> --filePath path/to/file',
|
|
12
12
|
'<%= config.bin %> <%= command.id %> -f path/to/file'
|
|
13
13
|
];
|
|
14
14
|
static flags = {
|
|
15
|
-
filePath: Flags.string({ char: 'f', description: 'Path to the file.', required: true }),
|
|
15
|
+
filePath: Flags.string({ char: 'f', description: 'Path to the sync rules config file.', required: true }),
|
|
16
16
|
language: Flags.string({
|
|
17
17
|
char: 'l',
|
|
18
18
|
description: 'Choose language for output.',
|
|
@@ -3,14 +3,14 @@ import fs from 'node:fs';
|
|
|
3
3
|
import * as PowerSyncClient from '../../../service/powersync.client.js';
|
|
4
4
|
import { checkForValidEnvFile, green, red } from '../../../utils.js';
|
|
5
5
|
export default class SyncRulesValidate extends Command {
|
|
6
|
-
static description = 'Validate sync rules from a local file.';
|
|
6
|
+
static description = 'Validate sync rules from a local sync rules file.';
|
|
7
7
|
static examples = [
|
|
8
8
|
'<%= config.bin %> <%= command.id %>',
|
|
9
9
|
'<%= config.bin %> <%= command.id %> --filePath path/to/file',
|
|
10
10
|
'<%= config.bin %> <%= command.id %> -f path/to/file'
|
|
11
11
|
];
|
|
12
12
|
static flags = {
|
|
13
|
-
filePath: Flags.string({ char: 'f', description: 'Path to the file.', required: true })
|
|
13
|
+
filePath: Flags.string({ char: 'f', description: 'Path to the sync rules config file.', required: true })
|
|
14
14
|
};
|
|
15
15
|
async run() {
|
|
16
16
|
checkForValidEnvFile(this.config.bin, true);
|