powersync 0.9.4 → 0.9.6

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 CHANGED
@@ -239,7 +239,7 @@ $ npm install -g powersync
239
239
  $ powersync COMMAND
240
240
  running command...
241
241
  $ powersync (--version)
242
- powersync/0.9.4 linux-x64 node-v24.15.0
242
+ powersync/0.9.6 linux-x64 node-v24.15.0
243
243
  $ powersync --help [COMMAND]
244
244
  USAGE
245
245
  $ powersync COMMAND
@@ -272,6 +272,7 @@ See [docs/usage.md](../docs/usage.md) for full usage and resolution order (flags
272
272
 
273
273
  - [`powersync autocomplete [SHELL]`](#powersync-autocomplete-shell)
274
274
  - [`powersync commands`](#powersync-commands)
275
+ - [`powersync compact`](#powersync-compact)
275
276
  - [`powersync configure ide`](#powersync-configure-ide)
276
277
  - [`powersync deploy`](#powersync-deploy)
277
278
  - [`powersync deploy service-config`](#powersync-deploy-service-config)
@@ -339,7 +340,7 @@ EXAMPLES
339
340
  $ powersync autocomplete --refresh-cache
340
341
  ```
341
342
 
342
- _See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v3.2.40/src/commands/autocomplete/index.ts)_
343
+ _See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v3.2.46/src/commands/autocomplete/index.ts)_
343
344
 
344
345
  ## `powersync commands`
345
346
 
@@ -368,7 +369,46 @@ DESCRIPTION
368
369
  List all powersync commands.
369
370
  ```
370
371
 
371
- _See code: [@oclif/plugin-commands](https://github.com/oclif/plugin-commands/blob/v4.1.40/src/commands/commands.ts)_
372
+ _See code: [@oclif/plugin-commands](https://github.com/oclif/plugin-commands/blob/4.1.47/src/commands/commands.ts)_
373
+
374
+ ## `powersync compact`
375
+
376
+ [Cloud only] Compact the linked Cloud instance.
377
+
378
+ ```
379
+ USAGE
380
+ $ powersync compact [--directory <value>] [--instance-id <value> --project-id <value>] [--org-id <value>]
381
+ [--timeout <value>]
382
+
383
+ FLAGS
384
+ --timeout=<value> [default: 30] Maximum time to wait for compaction to complete, in minutes. Use 0 to wait
385
+ indefinitely.
386
+
387
+ PROJECT FLAGS
388
+ --directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
389
+ required if multiple powersync config files are present in subdirectories of the current working
390
+ directory.
391
+
392
+ CLOUD_PROJECT FLAGS
393
+ --instance-id=<value> PowerSync Cloud instance ID. Manually passed if the current context has not been linked.
394
+ --org-id=<value> Organization ID (optional). Defaults to the token’s single org when only one is available; pass
395
+ explicitly if the token has multiple orgs.
396
+ --project-id=<value> Project ID. Manually passed if the current context has not been linked.
397
+
398
+ DESCRIPTION
399
+ [Cloud only] Compact the linked Cloud instance.
400
+
401
+ Trigger compaction on the linked PowerSync Cloud instance to reclaim sync bucket storage.
402
+
403
+ EXAMPLES
404
+ $ powersync compact
405
+
406
+ $ powersync compact --timeout=120
407
+
408
+ $ powersync compact --timeout=0
409
+ ```
410
+
411
+ _See code: [src/commands/compact.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/compact.ts)_
372
412
 
373
413
  ## `powersync configure ide`
374
414
 
@@ -388,7 +428,7 @@ EXAMPLES
388
428
  $ powersync configure ide
389
429
  ```
390
430
 
391
- _See code: [src/commands/configure/ide.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/configure/ide.ts)_
431
+ _See code: [src/commands/configure/ide.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/configure/ide.ts)_
392
432
 
393
433
  ## `powersync deploy`
394
434
 
@@ -434,7 +474,7 @@ EXAMPLES
434
474
  $ powersync deploy --instance-id=<id> --project-id=<id>
435
475
  ```
436
476
 
437
- _See code: [src/commands/deploy/index.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/deploy/index.ts)_
477
+ _See code: [src/commands/deploy/index.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/deploy/index.ts)_
438
478
 
439
479
  ## `powersync deploy service-config`
440
480
 
@@ -475,7 +515,7 @@ EXAMPLES
475
515
  $ powersync deploy service-config --instance-id=<id> --project-id=<id>
476
516
  ```
477
517
 
478
- _See code: [src/commands/deploy/service-config.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/deploy/service-config.ts)_
518
+ _See code: [src/commands/deploy/service-config.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/deploy/service-config.ts)_
479
519
 
480
520
  ## `powersync deploy sync-config`
481
521
 
@@ -516,7 +556,7 @@ EXAMPLES
516
556
  $ powersync deploy sync-config --instance-id=<id> --project-id=<id>
517
557
  ```
518
558
 
519
- _See code: [src/commands/deploy/sync-config.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/deploy/sync-config.ts)_
559
+ _See code: [src/commands/deploy/sync-config.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/deploy/sync-config.ts)_
520
560
 
521
561
  ## `powersync destroy`
522
562
 
@@ -553,7 +593,7 @@ EXAMPLES
553
593
  $ powersync destroy --confirm=yes
554
594
  ```
555
595
 
556
- _See code: [src/commands/destroy.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/destroy.ts)_
596
+ _See code: [src/commands/destroy.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/destroy.ts)_
557
597
 
558
598
  ## `powersync docker configure`
559
599
 
@@ -591,7 +631,7 @@ EXAMPLES
591
631
  $ powersync docker configure --database=postgres --storage=postgres
592
632
  ```
593
633
 
594
- _See code: [@powersync/cli-plugin-docker](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/docker/configure.ts)_
634
+ _See code: [@powersync/cli-plugin-docker](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/docker/configure.ts)_
595
635
 
596
636
  ## `powersync docker reset`
597
637
 
@@ -620,7 +660,7 @@ EXAMPLES
620
660
  $ powersync docker reset
621
661
  ```
622
662
 
623
- _See code: [@powersync/cli-plugin-docker](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/docker/reset.ts)_
663
+ _See code: [@powersync/cli-plugin-docker](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/docker/reset.ts)_
624
664
 
625
665
  ## `powersync docker start`
626
666
 
@@ -648,7 +688,7 @@ EXAMPLES
648
688
  $ powersync docker start
649
689
  ```
650
690
 
651
- _See code: [@powersync/cli-plugin-docker](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/docker/start.ts)_
691
+ _See code: [@powersync/cli-plugin-docker](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/docker/start.ts)_
652
692
 
653
693
  ## `powersync docker stop`
654
694
 
@@ -690,7 +730,7 @@ EXAMPLES
690
730
  $ powersync docker stop --project-name=powersync_myapp --remove
691
731
  ```
692
732
 
693
- _See code: [@powersync/cli-plugin-docker](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/docker/stop.ts)_
733
+ _See code: [@powersync/cli-plugin-docker](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/docker/stop.ts)_
694
734
 
695
735
  ## `powersync edit config`
696
736
 
@@ -732,7 +772,7 @@ EXAMPLES
732
772
  $ powersync edit config --directory ./powersync
733
773
  ```
734
774
 
735
- _See code: [@powersync/cli-plugin-config-edit](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/edit/config.ts)_
775
+ _See code: [@powersync/cli-plugin-config-edit](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/edit/config.ts)_
736
776
 
737
777
  ## `powersync fetch config`
738
778
 
@@ -769,7 +809,7 @@ EXAMPLES
769
809
  $ powersync fetch config --output=json
770
810
  ```
771
811
 
772
- _See code: [src/commands/fetch/config.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/fetch/config.ts)_
812
+ _See code: [src/commands/fetch/config.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/fetch/config.ts)_
773
813
 
774
814
  ## `powersync fetch instances`
775
815
 
@@ -797,7 +837,7 @@ EXAMPLES
797
837
  $ powersync fetch instances --project-id=<id> --output=json
798
838
  ```
799
839
 
800
- _See code: [src/commands/fetch/instances.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/fetch/instances.ts)_
840
+ _See code: [src/commands/fetch/instances.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/fetch/instances.ts)_
801
841
 
802
842
  ## `powersync fetch status`
803
843
 
@@ -842,7 +882,7 @@ EXAMPLES
842
882
  $ powersync fetch status --instance-id=<id> --project-id=<id>
843
883
  ```
844
884
 
845
- _See code: [src/commands/fetch/status.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/fetch/status.ts)_
885
+ _See code: [src/commands/fetch/status.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/fetch/status.ts)_
846
886
 
847
887
  ## `powersync generate schema`
848
888
 
@@ -890,7 +930,7 @@ EXAMPLES
890
930
  $ powersync generate schema --output=dart --output-path=lib/schema.dart --instance-id=<id> --project-id=<id>
891
931
  ```
892
932
 
893
- _See code: [src/commands/generate/schema.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/generate/schema.ts)_
933
+ _See code: [src/commands/generate/schema.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/generate/schema.ts)_
894
934
 
895
935
  ## `powersync generate token`
896
936
 
@@ -936,7 +976,7 @@ EXAMPLES
936
976
  $ powersync generate token --subject=user-123 --expires-in-seconds=3600
937
977
  ```
938
978
 
939
- _See code: [src/commands/generate/token.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/generate/token.ts)_
979
+ _See code: [src/commands/generate/token.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/generate/token.ts)_
940
980
 
941
981
  ## `powersync help [COMMAND]`
942
982
 
@@ -956,7 +996,7 @@ DESCRIPTION
956
996
  Display help for powersync.
957
997
  ```
958
998
 
959
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.37/src/commands/help.ts)_
999
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/6.2.45/src/commands/help.ts)_
960
1000
 
961
1001
  ## `powersync init cloud`
962
1002
 
@@ -982,7 +1022,7 @@ EXAMPLES
982
1022
  $ powersync init cloud --directory=powersync
983
1023
  ```
984
1024
 
985
- _See code: [src/commands/init/cloud.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/init/cloud.ts)_
1025
+ _See code: [src/commands/init/cloud.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/init/cloud.ts)_
986
1026
 
987
1027
  ## `powersync init self-hosted`
988
1028
 
@@ -1009,7 +1049,7 @@ EXAMPLES
1009
1049
  $ powersync init self-hosted --directory=powersync
1010
1050
  ```
1011
1051
 
1012
- _See code: [src/commands/init/self-hosted.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/init/self-hosted.ts)_
1052
+ _See code: [src/commands/init/self-hosted.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/init/self-hosted.ts)_
1013
1053
 
1014
1054
  ## `powersync link cloud`
1015
1055
 
@@ -1048,7 +1088,7 @@ EXAMPLES
1048
1088
  $ powersync link cloud --instance-id=<id> --project-id=<project-id> --org-id=<org-id>
1049
1089
  ```
1050
1090
 
1051
- _See code: [src/commands/link/cloud.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/link/cloud.ts)_
1091
+ _See code: [src/commands/link/cloud.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/link/cloud.ts)_
1052
1092
 
1053
1093
  ## `powersync link self-hosted`
1054
1094
 
@@ -1076,7 +1116,7 @@ EXAMPLES
1076
1116
  $ powersync link self-hosted --api-url=https://powersync.example.com
1077
1117
  ```
1078
1118
 
1079
- _See code: [src/commands/link/self-hosted.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/link/self-hosted.ts)_
1119
+ _See code: [src/commands/link/self-hosted.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/link/self-hosted.ts)_
1080
1120
 
1081
1121
  ## `powersync login`
1082
1122
 
@@ -1097,7 +1137,7 @@ EXAMPLES
1097
1137
  $ powersync login
1098
1138
  ```
1099
1139
 
1100
- _See code: [src/commands/login.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/login.ts)_
1140
+ _See code: [src/commands/login.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/login.ts)_
1101
1141
 
1102
1142
  ## `powersync logout`
1103
1143
 
@@ -1117,7 +1157,7 @@ EXAMPLES
1117
1157
  $ powersync logout
1118
1158
  ```
1119
1159
 
1120
- _See code: [src/commands/logout.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/logout.ts)_
1160
+ _See code: [src/commands/logout.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/logout.ts)_
1121
1161
 
1122
1162
  ## `powersync migrate sync-rules`
1123
1163
 
@@ -1154,7 +1194,7 @@ DESCRIPTION
1154
1194
  Migrates Sync Rules to Sync Streams
1155
1195
  ```
1156
1196
 
1157
- _See code: [src/commands/migrate/sync-rules.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/migrate/sync-rules.ts)_
1197
+ _See code: [src/commands/migrate/sync-rules.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/migrate/sync-rules.ts)_
1158
1198
 
1159
1199
  ## `powersync plugins`
1160
1200
 
@@ -1177,7 +1217,7 @@ EXAMPLES
1177
1217
  $ powersync plugins
1178
1218
  ```
1179
1219
 
1180
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.55/src/commands/plugins/index.ts)_
1220
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.62/src/commands/plugins/index.ts)_
1181
1221
 
1182
1222
  ## `powersync plugins add PLUGIN`
1183
1223
 
@@ -1251,7 +1291,7 @@ EXAMPLES
1251
1291
  $ powersync plugins inspect myplugin
1252
1292
  ```
1253
1293
 
1254
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.55/src/commands/plugins/inspect.ts)_
1294
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.62/src/commands/plugins/inspect.ts)_
1255
1295
 
1256
1296
  ## `powersync plugins install PLUGIN`
1257
1297
 
@@ -1300,7 +1340,7 @@ EXAMPLES
1300
1340
  $ powersync plugins install someuser/someplugin
1301
1341
  ```
1302
1342
 
1303
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.55/src/commands/plugins/install.ts)_
1343
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.62/src/commands/plugins/install.ts)_
1304
1344
 
1305
1345
  ## `powersync plugins link PATH`
1306
1346
 
@@ -1331,7 +1371,7 @@ EXAMPLES
1331
1371
  $ powersync plugins link myplugin
1332
1372
  ```
1333
1373
 
1334
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.55/src/commands/plugins/link.ts)_
1374
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.62/src/commands/plugins/link.ts)_
1335
1375
 
1336
1376
  ## `powersync plugins remove [PLUGIN]`
1337
1377
 
@@ -1372,7 +1412,7 @@ FLAGS
1372
1412
  --reinstall Reinstall all plugins after uninstalling.
1373
1413
  ```
1374
1414
 
1375
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.55/src/commands/plugins/reset.ts)_
1415
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.62/src/commands/plugins/reset.ts)_
1376
1416
 
1377
1417
  ## `powersync plugins uninstall [PLUGIN]`
1378
1418
 
@@ -1400,7 +1440,7 @@ EXAMPLES
1400
1440
  $ powersync plugins uninstall myplugin
1401
1441
  ```
1402
1442
 
1403
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.55/src/commands/plugins/uninstall.ts)_
1443
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.62/src/commands/plugins/uninstall.ts)_
1404
1444
 
1405
1445
  ## `powersync plugins unlink [PLUGIN]`
1406
1446
 
@@ -1444,7 +1484,7 @@ DESCRIPTION
1444
1484
  Update installed plugins.
1445
1485
  ```
1446
1486
 
1447
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.55/src/commands/plugins/update.ts)_
1487
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.62/src/commands/plugins/update.ts)_
1448
1488
 
1449
1489
  ## `powersync pull instance`
1450
1490
 
@@ -1486,7 +1526,7 @@ EXAMPLES
1486
1526
  $ powersync pull instance --instance-id=<id> --project-id=<id> --org-id=<org-id>
1487
1527
  ```
1488
1528
 
1489
- _See code: [src/commands/pull/instance.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/pull/instance.ts)_
1529
+ _See code: [src/commands/pull/instance.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/pull/instance.ts)_
1490
1530
 
1491
1531
  ## `powersync status`
1492
1532
 
@@ -1531,7 +1571,7 @@ EXAMPLES
1531
1571
  $ powersync status --instance-id=<id> --project-id=<id>
1532
1572
  ```
1533
1573
 
1534
- _See code: [src/commands/status.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/status.ts)_
1574
+ _See code: [src/commands/status.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/status.ts)_
1535
1575
 
1536
1576
  ## `powersync stop`
1537
1577
 
@@ -1568,7 +1608,7 @@ EXAMPLES
1568
1608
  $ powersync stop --confirm=yes
1569
1609
  ```
1570
1610
 
1571
- _See code: [src/commands/stop.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/stop.ts)_
1611
+ _See code: [src/commands/stop.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/stop.ts)_
1572
1612
 
1573
1613
  ## `powersync validate`
1574
1614
 
@@ -1620,6 +1660,6 @@ EXAMPLES
1620
1660
  $ powersync validate --api-url=https://powersync.example.com
1621
1661
  ```
1622
1662
 
1623
- _See code: [src/commands/validate.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.4/src/commands/validate.ts)_
1663
+ _See code: [src/commands/validate.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.6/src/commands/validate.ts)_
1624
1664
 
1625
1665
  <!-- commandsstop -->
@@ -0,0 +1,10 @@
1
+ import { CloudInstanceCommand } from '@powersync/cli-core';
2
+ export default class Compact extends CloudInstanceCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ timeout: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
7
+ };
8
+ static summary: string;
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,72 @@
1
+ import { Flags, ux } from '@oclif/core';
2
+ import { CloudInstanceCommand } from '@powersync/cli-core';
3
+ import ora from 'ora';
4
+ import { waitForOperationStatusChange } from '../api/cloud/wait-for-operation.js';
5
+ const DEFAULT_COMPACT_TIMEOUT_MINUTES = 30;
6
+ export default class Compact extends CloudInstanceCommand {
7
+ static description = 'Trigger compaction on the linked PowerSync Cloud instance to reclaim sync bucket storage.';
8
+ static examples = [
9
+ '<%= config.bin %> <%= command.id %>',
10
+ '<%= config.bin %> <%= command.id %> --timeout=120',
11
+ '<%= config.bin %> <%= command.id %> --timeout=0'
12
+ ];
13
+ static flags = {
14
+ timeout: Flags.integer({
15
+ default: DEFAULT_COMPACT_TIMEOUT_MINUTES,
16
+ description: 'Maximum time to wait for compaction to complete, in minutes. Use 0 to wait indefinitely.',
17
+ min: 0
18
+ })
19
+ };
20
+ static summary = '[Cloud only] Compact the linked Cloud instance.';
21
+ async run() {
22
+ const { flags } = await this.parse(Compact);
23
+ const { linked } = await this.loadProject(flags);
24
+ const { client } = this;
25
+ const timeoutMs = flags.timeout === 0 ? Number.POSITIVE_INFINITY : flags.timeout * 60 * 1000;
26
+ const spinner = ora({
27
+ discardStdin: false,
28
+ prefixText: `\n${ux.colorize('yellow', 'Compacting')} instance ${ux.colorize('blue', linked.instance_id)} in project ${ux.colorize('blue', linked.project_id)} in org ${ux.colorize('blue', linked.org_id)}\n`,
29
+ spinner: 'moon',
30
+ suffixText: '\nThis may take a few minutes.\n'
31
+ });
32
+ spinner.start();
33
+ try {
34
+ const compactResult = await client.compact({
35
+ app_id: linked.project_id,
36
+ id: linked.instance_id,
37
+ org_id: linked.org_id
38
+ });
39
+ if (compactResult.operation_id) {
40
+ const status = await waitForOperationStatusChange({
41
+ client,
42
+ instanceId: linked.instance_id,
43
+ linked,
44
+ operationId: compactResult.operation_id,
45
+ timeoutMs
46
+ });
47
+ spinner.stop();
48
+ if (status === 'completed') {
49
+ this.log(ux.colorize('green', 'Instance compacted successfully.'));
50
+ }
51
+ else {
52
+ this.styledError({
53
+ message: `Operation failed. Check instance diagnostics for details, for example: ${ux.colorize('blue', 'powersync status')}`
54
+ });
55
+ }
56
+ }
57
+ else {
58
+ spinner.stop();
59
+ this.log(ux.colorize('green', 'Instance compacted successfully.'));
60
+ }
61
+ }
62
+ catch (error) {
63
+ spinner.stop();
64
+ this.styledError({
65
+ error,
66
+ message: `Failed to compact instance ${linked.instance_id} in project ${linked.project_id} in org ${linked.org_id}`,
67
+ suggestions: ['Check your network connection and try again.', 'If the problem persists, contact support.']
68
+ });
69
+ }
70
+ }
71
+ }
72
+ //# sourceMappingURL=compact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compact.js","sourceRoot":"","sources":["../../src/commands/comp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C,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,EAAE,CAAC;YACf,IAAI,CAAC,WAAW,CAAC;gBACf,KAAK;gBACL,OAAO,EAAE,8BAA8B,MAAM,CAAC,WAAW,eAAe,MAAM,CAAC,UAAU,WAAW,MAAM,CAAC,MAAM,EAAE;gBACnH,WAAW,EAAE,CAAC,8CAA8C,EAAE,2CAA2C,CAAC;aAC3G,CAAC,CAAC;QACL,CAAC;IACH,CAAC"}
@@ -1,5 +1,80 @@
1
1
  {
2
2
  "commands": {
3
+ "compact": {
4
+ "aliases": [],
5
+ "args": {},
6
+ "description": "Trigger compaction on the linked PowerSync Cloud instance to reclaim sync bucket storage.",
7
+ "examples": [
8
+ "<%= config.bin %> <%= command.id %>",
9
+ "<%= config.bin %> <%= command.id %> --timeout=120",
10
+ "<%= config.bin %> <%= command.id %> --timeout=0"
11
+ ],
12
+ "flags": {
13
+ "directory": {
14
+ "description": "Directory containing PowerSync config. Defaults to \"powersync\". This is required if multiple powersync config files are present in subdirectories of the current working directory.",
15
+ "helpGroup": "PROJECT",
16
+ "name": "directory",
17
+ "default": "powersync",
18
+ "hasDynamicHelp": false,
19
+ "multiple": false,
20
+ "type": "option"
21
+ },
22
+ "instance-id": {
23
+ "dependsOn": [
24
+ "project-id"
25
+ ],
26
+ "description": "PowerSync Cloud instance ID. Manually passed if the current context has not been linked.",
27
+ "helpGroup": "CLOUD_PROJECT",
28
+ "name": "instance-id",
29
+ "required": false,
30
+ "hasDynamicHelp": false,
31
+ "multiple": false,
32
+ "type": "option"
33
+ },
34
+ "org-id": {
35
+ "description": "Organization ID (optional). Defaults to the token’s single org when only one is available; pass explicitly if the token has multiple orgs.",
36
+ "helpGroup": "CLOUD_PROJECT",
37
+ "name": "org-id",
38
+ "required": false,
39
+ "hasDynamicHelp": false,
40
+ "multiple": false,
41
+ "type": "option"
42
+ },
43
+ "project-id": {
44
+ "description": "Project ID. Manually passed if the current context has not been linked.",
45
+ "helpGroup": "CLOUD_PROJECT",
46
+ "name": "project-id",
47
+ "required": false,
48
+ "hasDynamicHelp": false,
49
+ "multiple": false,
50
+ "type": "option"
51
+ },
52
+ "timeout": {
53
+ "description": "Maximum time to wait for compaction to complete, in minutes. Use 0 to wait indefinitely.",
54
+ "name": "timeout",
55
+ "default": 30,
56
+ "hasDynamicHelp": false,
57
+ "multiple": false,
58
+ "type": "option"
59
+ }
60
+ },
61
+ "hasDynamicHelp": false,
62
+ "hiddenAliases": [],
63
+ "id": "compact",
64
+ "pluginAlias": "powersync",
65
+ "pluginName": "powersync",
66
+ "pluginType": "core",
67
+ "strict": true,
68
+ "summary": "[Cloud only] Compact the linked Cloud instance.",
69
+ "enableJsonFlag": false,
70
+ "commandHelpGroup": "CLOUD",
71
+ "isESM": true,
72
+ "relativePath": [
73
+ "dist",
74
+ "commands",
75
+ "compact.js"
76
+ ]
77
+ },
3
78
  "destroy": {
4
79
  "aliases": [],
5
80
  "args": {},
@@ -1727,5 +1802,5 @@
1727
1802
  ]
1728
1803
  }
1729
1804
  },
1730
- "version": "0.9.4"
1805
+ "version": "0.9.6"
1731
1806
  }
package/package.json CHANGED
@@ -1,50 +1,49 @@
1
1
  {
2
2
  "name": "powersync",
3
3
  "description": "A CLI for managing PowerSync instances",
4
- "version": "0.9.4",
4
+ "version": "0.9.6",
5
5
  "author": "POWERSYNC",
6
6
  "bin": {
7
7
  "powersync": "./bin/run.js"
8
8
  },
9
9
  "bugs": "https://github.com/powersync-ja/powersync-cli/issues",
10
10
  "dependencies": {
11
- "@fastify/cors": "^10.0.0",
12
- "@inquirer/prompts": "^7.2.0",
11
+ "@fastify/cors": "^10.1.0",
12
+ "@inquirer/prompts": "^7.10.1",
13
13
  "@journeyapps-labs/common-utils": "^1.0.1",
14
- "@oclif/core": "^4",
15
- "@oclif/plugin-autocomplete": "^3.2.40",
16
- "@oclif/plugin-commands": "^4.1.40",
17
- "@oclif/plugin-help": "^6",
18
- "@oclif/plugin-plugins": "^5",
19
- "@powersync/sync-config-tools": "^0.1.1",
20
- "@powersync/management-client": "^0.0.6",
21
- "@powersync/management-types": "^0.0.5",
22
- "@powersync/service-sync-rules": "^0.34.0",
23
- "@powersync/service-types": "^0.15.0",
14
+ "@oclif/core": "^4.10.6",
15
+ "@oclif/plugin-autocomplete": "^3.2.46",
16
+ "@oclif/plugin-commands": "^4.1.47",
17
+ "@oclif/plugin-help": "^6.2.45",
18
+ "@oclif/plugin-plugins": "^5.4.62",
19
+ "@powersync/management-client": "^0.1.1",
20
+ "@powersync/management-types": "^0.2.0",
21
+ "@powersync/service-sync-rules": "^0.36.0",
22
+ "@powersync/service-types": "^0.15.2",
23
+ "@powersync/sync-config-tools": "^0.1.2",
24
24
  "bson": "^7.2.0",
25
- "fastify": "^5.0.0",
26
- "jose": "^6.1.3",
27
- "lodash": "^4.17.23",
25
+ "fastify": "^5.8.5",
26
+ "jose": "^6.2.3",
27
+ "lodash": "^4.18.1",
28
28
  "open": "^11.0.0",
29
- "ora": "^9.0.0",
29
+ "ora": "^9.4.0",
30
30
  "ts-codec": "^1.3.0",
31
- "yaml": "^2",
32
- "@powersync/cli-core": "0.9.4",
33
- "@powersync/cli-plugin-config-edit": "0.9.4",
34
- "@powersync/cli-plugin-docker": "0.9.4",
35
- "@powersync/cli-schemas": "0.9.4"
31
+ "yaml": "^2.8.3",
32
+ "@powersync/cli-core": "0.9.6",
33
+ "@powersync/cli-schemas": "0.9.6",
34
+ "@powersync/cli-plugin-docker": "0.9.6",
35
+ "@powersync/cli-plugin-config-edit": "0.9.6"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@oclif/prettier-config": "^0.2.1",
39
- "@oclif/test": "^4",
40
- "@types/lodash": "^4.17.23",
41
- "@types/node": "^24",
42
- "oclif": "4.22.81",
43
- "shx": "^0.3.3",
44
- "ts-node": "^10",
45
- "tsx": "^4",
46
- "typescript": "^5",
47
- "vitest": "^4.0.0"
39
+ "@oclif/test": "^4.1.18",
40
+ "@types/lodash": "^4.17.24",
41
+ "@types/node": "^24.12.2",
42
+ "oclif": "4.23.0",
43
+ "ts-node": "^10.9.2",
44
+ "tsx": "^4.21.0",
45
+ "typescript": "^5.9.3",
46
+ "vitest": "^4.1.5"
48
47
  },
49
48
  "engines": {
50
49
  "node": ">=18.0.0"