@powersync/service-core 1.20.4 → 1.20.5

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.
Files changed (151) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/api/RouteAPI.d.ts +14 -0
  3. package/dist/api/api-index.d.ts +1 -1
  4. package/dist/api/api-index.js +1 -1
  5. package/dist/api/api-index.js.map +1 -1
  6. package/dist/api/api-metrics.js.map +1 -1
  7. package/dist/api/diagnostics.js +16 -14
  8. package/dist/api/diagnostics.js.map +1 -1
  9. package/dist/auth/CachedKeyCollector.js +1 -1
  10. package/dist/auth/CachedKeyCollector.js.map +1 -1
  11. package/dist/auth/CompoundKeyCollector.js.map +1 -1
  12. package/dist/auth/KeyStore.js.map +1 -1
  13. package/dist/auth/RemoteJWKSCollector.js.map +1 -1
  14. package/dist/auth/StaticKeyCollector.d.ts +1 -1
  15. package/dist/auth/StaticKeyCollector.js.map +1 -1
  16. package/dist/auth/StaticSupabaseKeyCollector.d.ts +1 -1
  17. package/dist/auth/StaticSupabaseKeyCollector.js.map +1 -1
  18. package/dist/entry/commands/teardown-action.js +1 -1
  19. package/dist/entry/commands/teardown-action.js.map +1 -1
  20. package/dist/entry/entry-index.d.ts +1 -1
  21. package/dist/entry/entry-index.js +1 -1
  22. package/dist/entry/entry-index.js.map +1 -1
  23. package/dist/events/EventsEngine.js +1 -1
  24. package/dist/events/EventsEngine.js.map +1 -1
  25. package/dist/metrics/MetricsEngine.d.ts +1 -1
  26. package/dist/metrics/metrics-index.d.ts +3 -3
  27. package/dist/metrics/metrics-index.js +3 -3
  28. package/dist/metrics/metrics-index.js.map +1 -1
  29. package/dist/metrics/open-telemetry/util.js +1 -1
  30. package/dist/metrics/open-telemetry/util.js.map +1 -1
  31. package/dist/metrics/register-metrics.js +2 -2
  32. package/dist/metrics/register-metrics.js.map +1 -1
  33. package/dist/modules/AbstractModule.d.ts +1 -1
  34. package/dist/modules/AbstractModule.js.map +1 -1
  35. package/dist/modules/modules-index.d.ts +1 -1
  36. package/dist/modules/modules-index.js +1 -1
  37. package/dist/modules/modules-index.js.map +1 -1
  38. package/dist/replication/AbstractReplicationJob.d.ts +1 -1
  39. package/dist/replication/replication-index.d.ts +3 -3
  40. package/dist/replication/replication-index.js +3 -3
  41. package/dist/replication/replication-index.js.map +1 -1
  42. package/dist/replication/replication-metrics.js.map +1 -1
  43. package/dist/routes/configure-fastify.d.ts +59 -32
  44. package/dist/routes/endpoints/admin.d.ts +108 -54
  45. package/dist/routes/endpoints/sync-rules.js +3 -3
  46. package/dist/routes/endpoints/sync-rules.js.map +1 -1
  47. package/dist/routes/endpoints/sync-stream.d.ts +10 -10
  48. package/dist/routes/hooks.js +1 -1
  49. package/dist/routes/hooks.js.map +1 -1
  50. package/dist/routes/route-register.js.map +1 -1
  51. package/dist/storage/BucketStorageBatch.d.ts +1 -1
  52. package/dist/storage/BucketStorageFactory.d.ts +5 -3
  53. package/dist/storage/BucketStorageFactory.js +10 -8
  54. package/dist/storage/BucketStorageFactory.js.map +1 -1
  55. package/dist/storage/ChecksumCache.js.map +1 -1
  56. package/dist/storage/PersistedSyncRulesContent.js +14 -2
  57. package/dist/storage/PersistedSyncRulesContent.js.map +1 -1
  58. package/dist/storage/ReplicationEventPayload.d.ts +1 -1
  59. package/dist/storage/SourceTable.d.ts +1 -1
  60. package/dist/storage/SourceTable.js.map +1 -1
  61. package/dist/storage/storage-index.d.ts +8 -8
  62. package/dist/storage/storage-index.js +8 -8
  63. package/dist/storage/storage-index.js.map +1 -1
  64. package/dist/storage/storage-metrics.js.map +1 -1
  65. package/dist/streams/streams-index.d.ts +2 -2
  66. package/dist/streams/streams-index.js +2 -2
  67. package/dist/streams/streams-index.js.map +1 -1
  68. package/dist/sync/BucketChecksumState.js +4 -19
  69. package/dist/sync/BucketChecksumState.js.map +1 -1
  70. package/dist/sync/RequestTracker.js +1 -1
  71. package/dist/sync/RequestTracker.js.map +1 -1
  72. package/dist/sync/sync-index.d.ts +2 -2
  73. package/dist/sync/sync-index.js +2 -2
  74. package/dist/sync/sync-index.js.map +1 -1
  75. package/dist/sync/sync.js.map +1 -1
  76. package/dist/sync/util.js.map +1 -1
  77. package/dist/system/ServiceContext.d.ts +1 -1
  78. package/dist/system/ServiceContext.js +1 -1
  79. package/dist/system/ServiceContext.js.map +1 -1
  80. package/dist/util/config/collectors/impl/base64-config-collector.d.ts +1 -1
  81. package/dist/util/config/collectors/impl/base64-config-collector.js.map +1 -1
  82. package/dist/util/config/collectors/impl/filesystem-config-collector.d.ts +1 -1
  83. package/dist/util/config/collectors/impl/filesystem-config-collector.js +1 -1
  84. package/dist/util/config/collectors/impl/filesystem-config-collector.js.map +1 -1
  85. package/dist/util/config/sync-rules/sync-rules-provider.js.map +1 -1
  86. package/dist/util/config.js +1 -1
  87. package/dist/util/config.js.map +1 -1
  88. package/dist/util/errors.d.ts +3 -0
  89. package/dist/util/errors.js +15 -0
  90. package/dist/util/errors.js.map +1 -0
  91. package/dist/util/protocol-types.d.ts +2 -2
  92. package/dist/util/util-index.d.ts +1 -1
  93. package/dist/util/util-index.js +1 -1
  94. package/dist/util/util-index.js.map +1 -1
  95. package/dist/util/utils.d.ts +1 -1
  96. package/package.json +5 -5
  97. package/src/api/RouteAPI.ts +17 -0
  98. package/src/api/api-index.ts +1 -1
  99. package/src/api/api-metrics.ts +1 -1
  100. package/src/api/diagnostics.ts +18 -19
  101. package/src/auth/CachedKeyCollector.ts +2 -3
  102. package/src/auth/CompoundKeyCollector.ts +2 -3
  103. package/src/auth/KeyStore.ts +1 -1
  104. package/src/auth/RemoteJWKSCollector.ts +0 -1
  105. package/src/auth/StaticKeyCollector.ts +1 -1
  106. package/src/auth/StaticSupabaseKeyCollector.ts +1 -1
  107. package/src/entry/commands/teardown-action.ts +1 -1
  108. package/src/entry/entry-index.ts +1 -1
  109. package/src/events/EventsEngine.ts +1 -1
  110. package/src/metrics/MetricsEngine.ts +1 -1
  111. package/src/metrics/metrics-index.ts +3 -3
  112. package/src/metrics/open-telemetry/util.ts +1 -1
  113. package/src/metrics/register-metrics.ts +3 -3
  114. package/src/modules/AbstractModule.ts +1 -1
  115. package/src/modules/modules-index.ts +1 -1
  116. package/src/replication/AbstractReplicationJob.ts +1 -1
  117. package/src/replication/replication-index.ts +3 -3
  118. package/src/replication/replication-metrics.ts +1 -1
  119. package/src/routes/endpoints/sync-rules.ts +3 -5
  120. package/src/routes/hooks.ts +2 -2
  121. package/src/routes/route-register.ts +2 -10
  122. package/src/storage/BucketStorageBatch.ts +1 -1
  123. package/src/storage/BucketStorageFactory.ts +18 -14
  124. package/src/storage/ChecksumCache.ts +1 -1
  125. package/src/storage/PersistedSyncRulesContent.ts +18 -2
  126. package/src/storage/ReplicationEventPayload.ts +1 -1
  127. package/src/storage/SourceTable.ts +1 -1
  128. package/src/storage/storage-index.ts +8 -8
  129. package/src/storage/storage-metrics.ts +2 -2
  130. package/src/streams/streams-index.ts +2 -2
  131. package/src/sync/BucketChecksumState.ts +5 -21
  132. package/src/sync/RequestTracker.ts +1 -1
  133. package/src/sync/sync-index.ts +2 -2
  134. package/src/sync/sync.ts +1 -7
  135. package/src/sync/util.ts +1 -1
  136. package/src/system/ServiceContext.ts +1 -1
  137. package/src/util/config/collectors/impl/base64-config-collector.ts +1 -1
  138. package/src/util/config/collectors/impl/filesystem-config-collector.ts +2 -2
  139. package/src/util/config/sync-rules/sync-rules-provider.ts +1 -1
  140. package/src/util/config.ts +1 -1
  141. package/src/util/errors.ts +21 -0
  142. package/src/util/util-index.ts +1 -1
  143. package/src/util/utils.ts +1 -1
  144. package/test/src/auth.test.ts +7 -7
  145. package/test/src/module-loader.test.ts +1 -1
  146. package/test/src/routes/mocks.ts +1 -1
  147. package/test/src/routes/stream.test.ts +1 -2
  148. package/test/src/sync/BucketChecksumState.test.ts +2 -2
  149. package/test/src/util/protocol_types.test.ts +1 -1
  150. package/tsconfig.tsbuildinfo +1 -1
  151. package/vitest.config.ts +1 -1
@@ -92,8 +92,8 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
92
92
  }, {
93
93
  connections: {
94
94
  errors: {
95
- message: string;
96
95
  level: "warning" | "fatal";
96
+ message: string;
97
97
  location?: {
98
98
  start_offset: number;
99
99
  end_offset: number;
@@ -140,6 +140,9 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
140
140
  last_keepalive_ts?: string | undefined;
141
141
  last_checkpoint_ts?: string | undefined;
142
142
  replication_lag_bytes?: number | undefined;
143
+ wal_status?: string | undefined;
144
+ safe_wal_size?: number | undefined;
145
+ max_slot_wal_keep_size?: number | undefined;
143
146
  }[];
144
147
  content?: string | undefined;
145
148
  } | undefined;
@@ -179,6 +182,9 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
179
182
  last_keepalive_ts?: string | undefined;
180
183
  last_checkpoint_ts?: string | undefined;
181
184
  replication_lag_bytes?: number | undefined;
185
+ wal_status?: string | undefined;
186
+ safe_wal_size?: number | undefined;
187
+ max_slot_wal_keep_size?: number | undefined;
182
188
  }[];
183
189
  content?: string | undefined;
184
190
  } | undefined;
@@ -189,8 +195,8 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
189
195
  }, import("./router.js").Context, import("./router.js").BasicRouterRequest>, {
190
196
  connections: {
191
197
  errors: {
192
- message: string;
193
198
  level: "warning" | "fatal";
199
+ message: string;
194
200
  location?: {
195
201
  start_offset: number;
196
202
  end_offset: number;
@@ -237,6 +243,9 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
237
243
  last_keepalive_ts?: string | undefined;
238
244
  last_checkpoint_ts?: string | undefined;
239
245
  replication_lag_bytes?: number | undefined;
246
+ wal_status?: string | undefined;
247
+ safe_wal_size?: number | undefined;
248
+ max_slot_wal_keep_size?: number | undefined;
240
249
  }[];
241
250
  content?: string | undefined;
242
251
  } | undefined;
@@ -276,6 +285,9 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
276
285
  last_keepalive_ts?: string | undefined;
277
286
  last_checkpoint_ts?: string | undefined;
278
287
  replication_lag_bytes?: number | undefined;
288
+ wal_status?: string | undefined;
289
+ safe_wal_size?: number | undefined;
290
+ max_slot_wal_keep_size?: number | undefined;
279
291
  }[];
280
292
  content?: string | undefined;
281
293
  } | undefined;
@@ -297,8 +309,8 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
297
309
  }, import("./router.js").Context, import("./router.js").BasicRouterRequest>) => Promise<{
298
310
  connections: {
299
311
  errors: {
300
- message: string;
301
312
  level: "warning" | "fatal";
313
+ message: string;
302
314
  location?: {
303
315
  start_offset: number;
304
316
  end_offset: number;
@@ -345,6 +357,9 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
345
357
  last_keepalive_ts?: string | undefined;
346
358
  last_checkpoint_ts?: string | undefined;
347
359
  replication_lag_bytes?: number | undefined;
360
+ wal_status?: string | undefined;
361
+ safe_wal_size?: number | undefined;
362
+ max_slot_wal_keep_size?: number | undefined;
348
363
  }[];
349
364
  content?: string | undefined;
350
365
  } | undefined;
@@ -384,6 +399,9 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
384
399
  last_keepalive_ts?: string | undefined;
385
400
  last_checkpoint_ts?: string | undefined;
386
401
  replication_lag_bytes?: number | undefined;
402
+ wal_status?: string | undefined;
403
+ safe_wal_size?: number | undefined;
404
+ max_slot_wal_keep_size?: number | undefined;
387
405
  }[];
388
406
  content?: string | undefined;
389
407
  } | undefined;
@@ -396,10 +414,10 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
396
414
  tables: {
397
415
  name: string;
398
416
  columns: {
399
- type: string;
400
417
  name: string;
401
418
  sqlite_type: number | import("@powersync/service-types").SqliteSchemaTypeText;
402
419
  internal_type: string;
420
+ type: string;
403
421
  pg_type: string;
404
422
  description?: string | undefined;
405
423
  }[];
@@ -417,10 +435,10 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
417
435
  tables: {
418
436
  name: string;
419
437
  columns: {
420
- type: string;
421
438
  name: string;
422
439
  sqlite_type: number | import("@powersync/service-types").SqliteSchemaTypeText;
423
440
  internal_type: string;
441
+ type: string;
424
442
  pg_type: string;
425
443
  description?: string | undefined;
426
444
  }[];
@@ -449,10 +467,10 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
449
467
  tables: {
450
468
  name: string;
451
469
  columns: {
452
- type: string;
453
470
  name: string;
454
471
  sqlite_type: number | import("@powersync/service-types").SqliteSchemaTypeText;
455
472
  internal_type: string;
473
+ type: string;
456
474
  pg_type: string;
457
475
  description?: string | undefined;
458
476
  }[];
@@ -497,8 +515,8 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
497
515
  sync_rules: string;
498
516
  }, {
499
517
  errors: {
500
- message: string;
501
518
  level: "warning" | "fatal";
519
+ message: string;
502
520
  location?: {
503
521
  start_offset: number;
504
522
  end_offset: number;
@@ -511,26 +529,29 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
511
529
  slot_name: string;
512
530
  initial_replication_done: boolean;
513
531
  tables: {
532
+ name: string;
533
+ schema: string;
534
+ replication_id: string[];
535
+ data_queries: boolean;
536
+ parameter_queries: boolean;
514
537
  errors: {
515
- message: string;
516
538
  level: "warning" | "fatal";
539
+ message: string;
517
540
  location?: {
518
541
  start_offset: number;
519
542
  end_offset: number;
520
543
  } | undefined;
521
544
  ts?: string | undefined;
522
545
  }[];
523
- name: string;
524
- schema: string;
525
- replication_id: string[];
526
- data_queries: boolean;
527
- parameter_queries: boolean;
528
546
  pattern?: string | undefined;
529
547
  }[];
530
548
  last_lsn?: string | undefined;
531
549
  last_keepalive_ts?: string | undefined;
532
550
  last_checkpoint_ts?: string | undefined;
533
551
  replication_lag_bytes?: number | undefined;
552
+ wal_status?: string | undefined;
553
+ safe_wal_size?: number | undefined;
554
+ max_slot_wal_keep_size?: number | undefined;
534
555
  }[];
535
556
  content?: string | undefined;
536
557
  }, import("./router.js").Context, import("./router.js").RequestEndpointHandlerPayload<{
@@ -539,8 +560,8 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
539
560
  sync_rules: string;
540
561
  }, import("./router.js").Context, import("./router.js").BasicRouterRequest>, {
541
562
  errors: {
542
- message: string;
543
563
  level: "warning" | "fatal";
564
+ message: string;
544
565
  location?: {
545
566
  start_offset: number;
546
567
  end_offset: number;
@@ -553,26 +574,29 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
553
574
  slot_name: string;
554
575
  initial_replication_done: boolean;
555
576
  tables: {
577
+ name: string;
578
+ schema: string;
579
+ replication_id: string[];
580
+ data_queries: boolean;
581
+ parameter_queries: boolean;
556
582
  errors: {
557
- message: string;
558
583
  level: "warning" | "fatal";
584
+ message: string;
559
585
  location?: {
560
586
  start_offset: number;
561
587
  end_offset: number;
562
588
  } | undefined;
563
589
  ts?: string | undefined;
564
590
  }[];
565
- name: string;
566
- schema: string;
567
- replication_id: string[];
568
- data_queries: boolean;
569
- parameter_queries: boolean;
570
591
  pattern?: string | undefined;
571
592
  }[];
572
593
  last_lsn?: string | undefined;
573
594
  last_keepalive_ts?: string | undefined;
574
595
  last_checkpoint_ts?: string | undefined;
575
596
  replication_lag_bytes?: number | undefined;
597
+ wal_status?: string | undefined;
598
+ safe_wal_size?: number | undefined;
599
+ max_slot_wal_keep_size?: number | undefined;
576
600
  }[];
577
601
  content?: string | undefined;
578
602
  }>> & {
@@ -592,8 +616,8 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
592
616
  sync_rules: string;
593
617
  }, import("./router.js").Context, import("./router.js").BasicRouterRequest>) => Promise<{
594
618
  errors: {
595
- message: string;
596
619
  level: "warning" | "fatal";
620
+ message: string;
597
621
  location?: {
598
622
  start_offset: number;
599
623
  end_offset: number;
@@ -606,26 +630,29 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
606
630
  slot_name: string;
607
631
  initial_replication_done: boolean;
608
632
  tables: {
633
+ name: string;
634
+ schema: string;
635
+ replication_id: string[];
636
+ data_queries: boolean;
637
+ parameter_queries: boolean;
609
638
  errors: {
610
- message: string;
611
639
  level: "warning" | "fatal";
640
+ message: string;
612
641
  location?: {
613
642
  start_offset: number;
614
643
  end_offset: number;
615
644
  } | undefined;
616
645
  ts?: string | undefined;
617
646
  }[];
618
- name: string;
619
- schema: string;
620
- replication_id: string[];
621
- data_queries: boolean;
622
- parameter_queries: boolean;
623
647
  pattern?: string | undefined;
624
648
  }[];
625
649
  last_lsn?: string | undefined;
626
650
  last_keepalive_ts?: string | undefined;
627
651
  last_checkpoint_ts?: string | undefined;
628
652
  replication_lag_bytes?: number | undefined;
653
+ wal_status?: string | undefined;
654
+ safe_wal_size?: number | undefined;
655
+ max_slot_wal_keep_size?: number | undefined;
629
656
  }[];
630
657
  content?: string | undefined;
631
658
  }>;
@@ -792,8 +819,8 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
792
819
  client_id?: string | undefined;
793
820
  streams?: {
794
821
  subscriptions: {
795
- parameters: Record<string, any> | null;
796
822
  stream: string;
823
+ parameters: Record<string, any> | null;
797
824
  override_priority: number | null;
798
825
  }[];
799
826
  include_defaults?: boolean | undefined;
@@ -811,8 +838,8 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
811
838
  client_id?: string | undefined;
812
839
  streams?: {
813
840
  subscriptions: {
814
- parameters: Record<string, any> | null;
815
841
  stream: string;
842
+ parameters: Record<string, any> | null;
816
843
  override_priority: number | null;
817
844
  }[];
818
845
  include_defaults?: boolean | undefined;
@@ -830,8 +857,8 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
830
857
  client_id?: string | undefined;
831
858
  streams?: {
832
859
  subscriptions: {
833
- parameters: Record<string, any> | null;
834
860
  stream: string;
861
+ parameters: Record<string, any> | null;
835
862
  override_priority: number | null;
836
863
  }[];
837
864
  include_defaults?: boolean | undefined;
@@ -853,8 +880,8 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
853
880
  client_id?: string | undefined;
854
881
  streams?: {
855
882
  subscriptions: {
856
- parameters: Record<string, any> | null;
857
883
  stream: string;
884
+ parameters: Record<string, any> | null;
858
885
  override_priority: number | null;
859
886
  }[];
860
887
  include_defaults?: boolean | undefined;
@@ -873,8 +900,8 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
873
900
  client_id?: string | undefined;
874
901
  streams?: {
875
902
  subscriptions: {
876
- parameters: Record<string, any> | null;
877
903
  stream: string;
904
+ parameters: Record<string, any> | null;
878
905
  override_priority: number | null;
879
906
  }[];
880
907
  include_defaults?: boolean | undefined;