@powersync/service-core 1.19.2 → 1.20.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/CHANGELOG.md +34 -0
- package/dist/api/diagnostics.js +11 -4
- package/dist/api/diagnostics.js.map +1 -1
- package/dist/entry/commands/compact-action.js +13 -2
- package/dist/entry/commands/compact-action.js.map +1 -1
- package/dist/entry/commands/config-command.js +2 -2
- package/dist/entry/commands/config-command.js.map +1 -1
- package/dist/replication/AbstractReplicator.js +2 -5
- package/dist/replication/AbstractReplicator.js.map +1 -1
- package/dist/routes/configure-fastify.d.ts +84 -0
- package/dist/routes/endpoints/admin.d.ts +168 -0
- package/dist/routes/endpoints/admin.js +33 -20
- package/dist/routes/endpoints/admin.js.map +1 -1
- package/dist/routes/endpoints/sync-rules.js +6 -9
- package/dist/routes/endpoints/sync-rules.js.map +1 -1
- package/dist/storage/BucketStorageFactory.d.ts +43 -15
- package/dist/storage/BucketStorageFactory.js +70 -1
- package/dist/storage/BucketStorageFactory.js.map +1 -1
- package/dist/storage/PersistedSyncRulesContent.d.ts +28 -2
- package/dist/storage/PersistedSyncRulesContent.js +79 -1
- package/dist/storage/PersistedSyncRulesContent.js.map +1 -1
- package/dist/storage/StorageVersionConfig.d.ts +20 -0
- package/dist/storage/StorageVersionConfig.js +20 -0
- package/dist/storage/StorageVersionConfig.js.map +1 -0
- package/dist/storage/SyncRulesBucketStorage.d.ts +2 -1
- package/dist/storage/SyncRulesBucketStorage.js.map +1 -1
- package/dist/storage/storage-index.d.ts +1 -0
- package/dist/storage/storage-index.js +1 -0
- package/dist/storage/storage-index.js.map +1 -1
- package/dist/sync/BucketChecksumState.d.ts +6 -2
- package/dist/sync/BucketChecksumState.js +85 -10
- package/dist/sync/BucketChecksumState.js.map +1 -1
- package/dist/util/config/collectors/config-collector.js +13 -0
- package/dist/util/config/collectors/config-collector.js.map +1 -1
- package/dist/util/config/sync-rules/impl/base64-sync-rules-collector.d.ts +1 -1
- package/dist/util/config/sync-rules/impl/base64-sync-rules-collector.js +4 -4
- package/dist/util/config/sync-rules/impl/base64-sync-rules-collector.js.map +1 -1
- package/dist/util/config/sync-rules/impl/filesystem-sync-rules-collector.d.ts +1 -1
- package/dist/util/config/sync-rules/impl/filesystem-sync-rules-collector.js +2 -2
- package/dist/util/config/sync-rules/impl/filesystem-sync-rules-collector.js.map +1 -1
- package/dist/util/config/sync-rules/impl/inline-sync-rules-collector.d.ts +1 -1
- package/dist/util/config/sync-rules/impl/inline-sync-rules-collector.js +3 -3
- package/dist/util/config/sync-rules/impl/inline-sync-rules-collector.js.map +1 -1
- package/dist/util/config/types.d.ts +1 -1
- package/dist/util/config/types.js.map +1 -1
- package/dist/util/env.d.ts +1 -0
- package/dist/util/env.js +5 -0
- package/dist/util/env.js.map +1 -1
- package/package.json +6 -6
- package/src/api/diagnostics.ts +12 -4
- package/src/entry/commands/compact-action.ts +15 -2
- package/src/entry/commands/config-command.ts +3 -3
- package/src/replication/AbstractReplicator.ts +3 -5
- package/src/routes/endpoints/admin.ts +42 -25
- package/src/routes/endpoints/sync-rules.ts +14 -13
- package/src/storage/BucketStorageFactory.ts +110 -19
- package/src/storage/PersistedSyncRulesContent.ts +114 -4
- package/src/storage/StorageVersionConfig.ts +30 -0
- package/src/storage/SyncRulesBucketStorage.ts +2 -1
- package/src/storage/storage-index.ts +1 -0
- package/src/sync/BucketChecksumState.ts +129 -16
- package/src/util/config/collectors/config-collector.ts +16 -0
- package/src/util/config/sync-rules/impl/base64-sync-rules-collector.ts +5 -5
- package/src/util/config/sync-rules/impl/filesystem-sync-rules-collector.ts +3 -3
- package/src/util/config/sync-rules/impl/inline-sync-rules-collector.ts +4 -4
- package/src/util/config/types.ts +1 -2
- package/src/util/env.ts +5 -0
- package/test/src/config.test.ts +115 -0
- package/test/src/routes/admin.test.ts +48 -0
- package/test/src/routes/mocks.ts +22 -1
- package/test/src/routes/stream.test.ts +3 -2
- package/test/src/sync/BucketChecksumState.test.ts +285 -78
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -73,6 +73,10 @@ export declare const diagnostics: router.Endpoint<{
|
|
|
73
73
|
errors: {
|
|
74
74
|
message: string;
|
|
75
75
|
level: "warning" | "fatal";
|
|
76
|
+
location?: {
|
|
77
|
+
start_offset: number;
|
|
78
|
+
end_offset: number;
|
|
79
|
+
} | undefined;
|
|
76
80
|
ts?: string | undefined;
|
|
77
81
|
}[];
|
|
78
82
|
id: string;
|
|
@@ -83,6 +87,10 @@ export declare const diagnostics: router.Endpoint<{
|
|
|
83
87
|
errors: {
|
|
84
88
|
level: "warning" | "fatal";
|
|
85
89
|
message: string;
|
|
90
|
+
location?: {
|
|
91
|
+
start_offset: number;
|
|
92
|
+
end_offset: number;
|
|
93
|
+
} | undefined;
|
|
86
94
|
ts?: string | undefined;
|
|
87
95
|
}[];
|
|
88
96
|
connections: {
|
|
@@ -99,6 +107,10 @@ export declare const diagnostics: router.Endpoint<{
|
|
|
99
107
|
errors: {
|
|
100
108
|
level: "warning" | "fatal";
|
|
101
109
|
message: string;
|
|
110
|
+
location?: {
|
|
111
|
+
start_offset: number;
|
|
112
|
+
end_offset: number;
|
|
113
|
+
} | undefined;
|
|
102
114
|
ts?: string | undefined;
|
|
103
115
|
}[];
|
|
104
116
|
pattern?: string | undefined;
|
|
@@ -114,6 +126,10 @@ export declare const diagnostics: router.Endpoint<{
|
|
|
114
126
|
errors: {
|
|
115
127
|
level: "warning" | "fatal";
|
|
116
128
|
message: string;
|
|
129
|
+
location?: {
|
|
130
|
+
start_offset: number;
|
|
131
|
+
end_offset: number;
|
|
132
|
+
} | undefined;
|
|
117
133
|
ts?: string | undefined;
|
|
118
134
|
}[];
|
|
119
135
|
connections: {
|
|
@@ -130,6 +146,10 @@ export declare const diagnostics: router.Endpoint<{
|
|
|
130
146
|
errors: {
|
|
131
147
|
level: "warning" | "fatal";
|
|
132
148
|
message: string;
|
|
149
|
+
location?: {
|
|
150
|
+
start_offset: number;
|
|
151
|
+
end_offset: number;
|
|
152
|
+
} | undefined;
|
|
133
153
|
ts?: string | undefined;
|
|
134
154
|
}[];
|
|
135
155
|
pattern?: string | undefined;
|
|
@@ -150,6 +170,10 @@ export declare const diagnostics: router.Endpoint<{
|
|
|
150
170
|
errors: {
|
|
151
171
|
message: string;
|
|
152
172
|
level: "warning" | "fatal";
|
|
173
|
+
location?: {
|
|
174
|
+
start_offset: number;
|
|
175
|
+
end_offset: number;
|
|
176
|
+
} | undefined;
|
|
153
177
|
ts?: string | undefined;
|
|
154
178
|
}[];
|
|
155
179
|
id: string;
|
|
@@ -160,6 +184,10 @@ export declare const diagnostics: router.Endpoint<{
|
|
|
160
184
|
errors: {
|
|
161
185
|
level: "warning" | "fatal";
|
|
162
186
|
message: string;
|
|
187
|
+
location?: {
|
|
188
|
+
start_offset: number;
|
|
189
|
+
end_offset: number;
|
|
190
|
+
} | undefined;
|
|
163
191
|
ts?: string | undefined;
|
|
164
192
|
}[];
|
|
165
193
|
connections: {
|
|
@@ -176,6 +204,10 @@ export declare const diagnostics: router.Endpoint<{
|
|
|
176
204
|
errors: {
|
|
177
205
|
level: "warning" | "fatal";
|
|
178
206
|
message: string;
|
|
207
|
+
location?: {
|
|
208
|
+
start_offset: number;
|
|
209
|
+
end_offset: number;
|
|
210
|
+
} | undefined;
|
|
179
211
|
ts?: string | undefined;
|
|
180
212
|
}[];
|
|
181
213
|
pattern?: string | undefined;
|
|
@@ -191,6 +223,10 @@ export declare const diagnostics: router.Endpoint<{
|
|
|
191
223
|
errors: {
|
|
192
224
|
level: "warning" | "fatal";
|
|
193
225
|
message: string;
|
|
226
|
+
location?: {
|
|
227
|
+
start_offset: number;
|
|
228
|
+
end_offset: number;
|
|
229
|
+
} | undefined;
|
|
194
230
|
ts?: string | undefined;
|
|
195
231
|
}[];
|
|
196
232
|
connections: {
|
|
@@ -207,6 +243,10 @@ export declare const diagnostics: router.Endpoint<{
|
|
|
207
243
|
errors: {
|
|
208
244
|
level: "warning" | "fatal";
|
|
209
245
|
message: string;
|
|
246
|
+
location?: {
|
|
247
|
+
start_offset: number;
|
|
248
|
+
end_offset: number;
|
|
249
|
+
} | undefined;
|
|
210
250
|
ts?: string | undefined;
|
|
211
251
|
}[];
|
|
212
252
|
pattern?: string | undefined;
|
|
@@ -238,6 +278,10 @@ export declare const diagnostics: router.Endpoint<{
|
|
|
238
278
|
errors: {
|
|
239
279
|
message: string;
|
|
240
280
|
level: "warning" | "fatal";
|
|
281
|
+
location?: {
|
|
282
|
+
start_offset: number;
|
|
283
|
+
end_offset: number;
|
|
284
|
+
} | undefined;
|
|
241
285
|
ts?: string | undefined;
|
|
242
286
|
}[];
|
|
243
287
|
id: string;
|
|
@@ -248,6 +292,10 @@ export declare const diagnostics: router.Endpoint<{
|
|
|
248
292
|
errors: {
|
|
249
293
|
level: "warning" | "fatal";
|
|
250
294
|
message: string;
|
|
295
|
+
location?: {
|
|
296
|
+
start_offset: number;
|
|
297
|
+
end_offset: number;
|
|
298
|
+
} | undefined;
|
|
251
299
|
ts?: string | undefined;
|
|
252
300
|
}[];
|
|
253
301
|
connections: {
|
|
@@ -264,6 +312,10 @@ export declare const diagnostics: router.Endpoint<{
|
|
|
264
312
|
errors: {
|
|
265
313
|
level: "warning" | "fatal";
|
|
266
314
|
message: string;
|
|
315
|
+
location?: {
|
|
316
|
+
start_offset: number;
|
|
317
|
+
end_offset: number;
|
|
318
|
+
} | undefined;
|
|
267
319
|
ts?: string | undefined;
|
|
268
320
|
}[];
|
|
269
321
|
pattern?: string | undefined;
|
|
@@ -279,6 +331,10 @@ export declare const diagnostics: router.Endpoint<{
|
|
|
279
331
|
errors: {
|
|
280
332
|
level: "warning" | "fatal";
|
|
281
333
|
message: string;
|
|
334
|
+
location?: {
|
|
335
|
+
start_offset: number;
|
|
336
|
+
end_offset: number;
|
|
337
|
+
} | undefined;
|
|
282
338
|
ts?: string | undefined;
|
|
283
339
|
}[];
|
|
284
340
|
connections: {
|
|
@@ -295,6 +351,10 @@ export declare const diagnostics: router.Endpoint<{
|
|
|
295
351
|
errors: {
|
|
296
352
|
level: "warning" | "fatal";
|
|
297
353
|
message: string;
|
|
354
|
+
location?: {
|
|
355
|
+
start_offset: number;
|
|
356
|
+
end_offset: number;
|
|
357
|
+
} | undefined;
|
|
298
358
|
ts?: string | undefined;
|
|
299
359
|
}[];
|
|
300
360
|
pattern?: string | undefined;
|
|
@@ -421,6 +481,10 @@ export declare const validate: router.Endpoint<{
|
|
|
421
481
|
errors: {
|
|
422
482
|
message: string;
|
|
423
483
|
level: "warning" | "fatal";
|
|
484
|
+
location?: {
|
|
485
|
+
start_offset: number;
|
|
486
|
+
end_offset: number;
|
|
487
|
+
} | undefined;
|
|
424
488
|
ts?: string | undefined;
|
|
425
489
|
}[];
|
|
426
490
|
connections: {
|
|
@@ -432,6 +496,10 @@ export declare const validate: router.Endpoint<{
|
|
|
432
496
|
errors: {
|
|
433
497
|
message: string;
|
|
434
498
|
level: "warning" | "fatal";
|
|
499
|
+
location?: {
|
|
500
|
+
start_offset: number;
|
|
501
|
+
end_offset: number;
|
|
502
|
+
} | undefined;
|
|
435
503
|
ts?: string | undefined;
|
|
436
504
|
}[];
|
|
437
505
|
name: string;
|
|
@@ -455,6 +523,10 @@ export declare const validate: router.Endpoint<{
|
|
|
455
523
|
errors: {
|
|
456
524
|
message: string;
|
|
457
525
|
level: "warning" | "fatal";
|
|
526
|
+
location?: {
|
|
527
|
+
start_offset: number;
|
|
528
|
+
end_offset: number;
|
|
529
|
+
} | undefined;
|
|
458
530
|
ts?: string | undefined;
|
|
459
531
|
}[];
|
|
460
532
|
connections: {
|
|
@@ -466,6 +538,10 @@ export declare const validate: router.Endpoint<{
|
|
|
466
538
|
errors: {
|
|
467
539
|
message: string;
|
|
468
540
|
level: "warning" | "fatal";
|
|
541
|
+
location?: {
|
|
542
|
+
start_offset: number;
|
|
543
|
+
end_offset: number;
|
|
544
|
+
} | undefined;
|
|
469
545
|
ts?: string | undefined;
|
|
470
546
|
}[];
|
|
471
547
|
name: string;
|
|
@@ -500,6 +576,10 @@ export declare const validate: router.Endpoint<{
|
|
|
500
576
|
errors: {
|
|
501
577
|
message: string;
|
|
502
578
|
level: "warning" | "fatal";
|
|
579
|
+
location?: {
|
|
580
|
+
start_offset: number;
|
|
581
|
+
end_offset: number;
|
|
582
|
+
} | undefined;
|
|
503
583
|
ts?: string | undefined;
|
|
504
584
|
}[];
|
|
505
585
|
connections: {
|
|
@@ -511,6 +591,10 @@ export declare const validate: router.Endpoint<{
|
|
|
511
591
|
errors: {
|
|
512
592
|
message: string;
|
|
513
593
|
level: "warning" | "fatal";
|
|
594
|
+
location?: {
|
|
595
|
+
start_offset: number;
|
|
596
|
+
end_offset: number;
|
|
597
|
+
} | undefined;
|
|
514
598
|
ts?: string | undefined;
|
|
515
599
|
}[];
|
|
516
600
|
name: string;
|
|
@@ -598,6 +682,10 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
|
|
|
598
682
|
errors: {
|
|
599
683
|
message: string;
|
|
600
684
|
level: "warning" | "fatal";
|
|
685
|
+
location?: {
|
|
686
|
+
start_offset: number;
|
|
687
|
+
end_offset: number;
|
|
688
|
+
} | undefined;
|
|
601
689
|
ts?: string | undefined;
|
|
602
690
|
}[];
|
|
603
691
|
id: string;
|
|
@@ -608,6 +696,10 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
|
|
|
608
696
|
errors: {
|
|
609
697
|
level: "warning" | "fatal";
|
|
610
698
|
message: string;
|
|
699
|
+
location?: {
|
|
700
|
+
start_offset: number;
|
|
701
|
+
end_offset: number;
|
|
702
|
+
} | undefined;
|
|
611
703
|
ts?: string | undefined;
|
|
612
704
|
}[];
|
|
613
705
|
connections: {
|
|
@@ -624,6 +716,10 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
|
|
|
624
716
|
errors: {
|
|
625
717
|
level: "warning" | "fatal";
|
|
626
718
|
message: string;
|
|
719
|
+
location?: {
|
|
720
|
+
start_offset: number;
|
|
721
|
+
end_offset: number;
|
|
722
|
+
} | undefined;
|
|
627
723
|
ts?: string | undefined;
|
|
628
724
|
}[];
|
|
629
725
|
pattern?: string | undefined;
|
|
@@ -639,6 +735,10 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
|
|
|
639
735
|
errors: {
|
|
640
736
|
level: "warning" | "fatal";
|
|
641
737
|
message: string;
|
|
738
|
+
location?: {
|
|
739
|
+
start_offset: number;
|
|
740
|
+
end_offset: number;
|
|
741
|
+
} | undefined;
|
|
642
742
|
ts?: string | undefined;
|
|
643
743
|
}[];
|
|
644
744
|
connections: {
|
|
@@ -655,6 +755,10 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
|
|
|
655
755
|
errors: {
|
|
656
756
|
level: "warning" | "fatal";
|
|
657
757
|
message: string;
|
|
758
|
+
location?: {
|
|
759
|
+
start_offset: number;
|
|
760
|
+
end_offset: number;
|
|
761
|
+
} | undefined;
|
|
658
762
|
ts?: string | undefined;
|
|
659
763
|
}[];
|
|
660
764
|
pattern?: string | undefined;
|
|
@@ -675,6 +779,10 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
|
|
|
675
779
|
errors: {
|
|
676
780
|
message: string;
|
|
677
781
|
level: "warning" | "fatal";
|
|
782
|
+
location?: {
|
|
783
|
+
start_offset: number;
|
|
784
|
+
end_offset: number;
|
|
785
|
+
} | undefined;
|
|
678
786
|
ts?: string | undefined;
|
|
679
787
|
}[];
|
|
680
788
|
id: string;
|
|
@@ -685,6 +793,10 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
|
|
|
685
793
|
errors: {
|
|
686
794
|
level: "warning" | "fatal";
|
|
687
795
|
message: string;
|
|
796
|
+
location?: {
|
|
797
|
+
start_offset: number;
|
|
798
|
+
end_offset: number;
|
|
799
|
+
} | undefined;
|
|
688
800
|
ts?: string | undefined;
|
|
689
801
|
}[];
|
|
690
802
|
connections: {
|
|
@@ -701,6 +813,10 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
|
|
|
701
813
|
errors: {
|
|
702
814
|
level: "warning" | "fatal";
|
|
703
815
|
message: string;
|
|
816
|
+
location?: {
|
|
817
|
+
start_offset: number;
|
|
818
|
+
end_offset: number;
|
|
819
|
+
} | undefined;
|
|
704
820
|
ts?: string | undefined;
|
|
705
821
|
}[];
|
|
706
822
|
pattern?: string | undefined;
|
|
@@ -716,6 +832,10 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
|
|
|
716
832
|
errors: {
|
|
717
833
|
level: "warning" | "fatal";
|
|
718
834
|
message: string;
|
|
835
|
+
location?: {
|
|
836
|
+
start_offset: number;
|
|
837
|
+
end_offset: number;
|
|
838
|
+
} | undefined;
|
|
719
839
|
ts?: string | undefined;
|
|
720
840
|
}[];
|
|
721
841
|
connections: {
|
|
@@ -732,6 +852,10 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
|
|
|
732
852
|
errors: {
|
|
733
853
|
level: "warning" | "fatal";
|
|
734
854
|
message: string;
|
|
855
|
+
location?: {
|
|
856
|
+
start_offset: number;
|
|
857
|
+
end_offset: number;
|
|
858
|
+
} | undefined;
|
|
735
859
|
ts?: string | undefined;
|
|
736
860
|
}[];
|
|
737
861
|
pattern?: string | undefined;
|
|
@@ -763,6 +887,10 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
|
|
|
763
887
|
errors: {
|
|
764
888
|
message: string;
|
|
765
889
|
level: "warning" | "fatal";
|
|
890
|
+
location?: {
|
|
891
|
+
start_offset: number;
|
|
892
|
+
end_offset: number;
|
|
893
|
+
} | undefined;
|
|
766
894
|
ts?: string | undefined;
|
|
767
895
|
}[];
|
|
768
896
|
id: string;
|
|
@@ -773,6 +901,10 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
|
|
|
773
901
|
errors: {
|
|
774
902
|
level: "warning" | "fatal";
|
|
775
903
|
message: string;
|
|
904
|
+
location?: {
|
|
905
|
+
start_offset: number;
|
|
906
|
+
end_offset: number;
|
|
907
|
+
} | undefined;
|
|
776
908
|
ts?: string | undefined;
|
|
777
909
|
}[];
|
|
778
910
|
connections: {
|
|
@@ -789,6 +921,10 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
|
|
|
789
921
|
errors: {
|
|
790
922
|
level: "warning" | "fatal";
|
|
791
923
|
message: string;
|
|
924
|
+
location?: {
|
|
925
|
+
start_offset: number;
|
|
926
|
+
end_offset: number;
|
|
927
|
+
} | undefined;
|
|
792
928
|
ts?: string | undefined;
|
|
793
929
|
}[];
|
|
794
930
|
pattern?: string | undefined;
|
|
@@ -804,6 +940,10 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
|
|
|
804
940
|
errors: {
|
|
805
941
|
level: "warning" | "fatal";
|
|
806
942
|
message: string;
|
|
943
|
+
location?: {
|
|
944
|
+
start_offset: number;
|
|
945
|
+
end_offset: number;
|
|
946
|
+
} | undefined;
|
|
807
947
|
ts?: string | undefined;
|
|
808
948
|
}[];
|
|
809
949
|
connections: {
|
|
@@ -820,6 +960,10 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
|
|
|
820
960
|
errors: {
|
|
821
961
|
level: "warning" | "fatal";
|
|
822
962
|
message: string;
|
|
963
|
+
location?: {
|
|
964
|
+
start_offset: number;
|
|
965
|
+
end_offset: number;
|
|
966
|
+
} | undefined;
|
|
823
967
|
ts?: string | undefined;
|
|
824
968
|
}[];
|
|
825
969
|
pattern?: string | undefined;
|
|
@@ -943,6 +1087,10 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
|
|
|
943
1087
|
errors: {
|
|
944
1088
|
message: string;
|
|
945
1089
|
level: "warning" | "fatal";
|
|
1090
|
+
location?: {
|
|
1091
|
+
start_offset: number;
|
|
1092
|
+
end_offset: number;
|
|
1093
|
+
} | undefined;
|
|
946
1094
|
ts?: string | undefined;
|
|
947
1095
|
}[];
|
|
948
1096
|
connections: {
|
|
@@ -954,6 +1102,10 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
|
|
|
954
1102
|
errors: {
|
|
955
1103
|
message: string;
|
|
956
1104
|
level: "warning" | "fatal";
|
|
1105
|
+
location?: {
|
|
1106
|
+
start_offset: number;
|
|
1107
|
+
end_offset: number;
|
|
1108
|
+
} | undefined;
|
|
957
1109
|
ts?: string | undefined;
|
|
958
1110
|
}[];
|
|
959
1111
|
name: string;
|
|
@@ -977,6 +1129,10 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
|
|
|
977
1129
|
errors: {
|
|
978
1130
|
message: string;
|
|
979
1131
|
level: "warning" | "fatal";
|
|
1132
|
+
location?: {
|
|
1133
|
+
start_offset: number;
|
|
1134
|
+
end_offset: number;
|
|
1135
|
+
} | undefined;
|
|
980
1136
|
ts?: string | undefined;
|
|
981
1137
|
}[];
|
|
982
1138
|
connections: {
|
|
@@ -988,6 +1144,10 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
|
|
|
988
1144
|
errors: {
|
|
989
1145
|
message: string;
|
|
990
1146
|
level: "warning" | "fatal";
|
|
1147
|
+
location?: {
|
|
1148
|
+
start_offset: number;
|
|
1149
|
+
end_offset: number;
|
|
1150
|
+
} | undefined;
|
|
991
1151
|
ts?: string | undefined;
|
|
992
1152
|
}[];
|
|
993
1153
|
name: string;
|
|
@@ -1022,6 +1182,10 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
|
|
|
1022
1182
|
errors: {
|
|
1023
1183
|
message: string;
|
|
1024
1184
|
level: "warning" | "fatal";
|
|
1185
|
+
location?: {
|
|
1186
|
+
start_offset: number;
|
|
1187
|
+
end_offset: number;
|
|
1188
|
+
} | undefined;
|
|
1025
1189
|
ts?: string | undefined;
|
|
1026
1190
|
}[];
|
|
1027
1191
|
connections: {
|
|
@@ -1033,6 +1197,10 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
|
|
|
1033
1197
|
errors: {
|
|
1034
1198
|
message: string;
|
|
1035
1199
|
level: "warning" | "fatal";
|
|
1200
|
+
location?: {
|
|
1201
|
+
start_offset: number;
|
|
1202
|
+
end_offset: number;
|
|
1203
|
+
} | undefined;
|
|
1036
1204
|
ts?: string | undefined;
|
|
1037
1205
|
}[];
|
|
1038
1206
|
name: string;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ErrorCode, errors, router, schema } from '@powersync/lib-services-framework';
|
|
2
2
|
import { SqlSyncRules, StaticSchema } from '@powersync/service-sync-rules';
|
|
3
3
|
import { internal_routes } from '@powersync/service-types';
|
|
4
|
+
import { DEFAULT_HYDRATION_STATE } from '@powersync/service-sync-rules';
|
|
4
5
|
import * as api from '../../api/api-index.js';
|
|
6
|
+
import * as storage from '../../storage/storage-index.js';
|
|
5
7
|
import { authApi } from '../auth.js';
|
|
6
8
|
import { routeDefinition } from '../router.js';
|
|
7
9
|
/**
|
|
@@ -102,12 +104,11 @@ export const reprocess = routeDefinition({
|
|
|
102
104
|
description: 'No active sync rules'
|
|
103
105
|
});
|
|
104
106
|
}
|
|
105
|
-
const new_rules = await activeBucketStorage.updateSyncRules({
|
|
106
|
-
content: active.sync_rules.config.content,
|
|
107
|
+
const new_rules = await activeBucketStorage.updateSyncRules(storage.updateSyncRulesFromYaml(active.sync_rules.config.content, {
|
|
107
108
|
// These sync rules already passed validation. But if the rules are not valid anymore due
|
|
108
109
|
// to a service change, we do want to report the error here.
|
|
109
110
|
validate: true
|
|
110
|
-
});
|
|
111
|
+
}));
|
|
111
112
|
const baseConfig = await apiHandler.getSourceConfig();
|
|
112
113
|
return internal_routes.ReprocessResponse.encode({
|
|
113
114
|
connections: [
|
|
@@ -121,6 +122,31 @@ export const reprocess = routeDefinition({
|
|
|
121
122
|
});
|
|
122
123
|
}
|
|
123
124
|
});
|
|
125
|
+
class FakeSyncRulesContentForValidation extends storage.PersistedSyncRulesContent {
|
|
126
|
+
apiHandler;
|
|
127
|
+
schema;
|
|
128
|
+
constructor(apiHandler, schema, data) {
|
|
129
|
+
super(data);
|
|
130
|
+
this.apiHandler = apiHandler;
|
|
131
|
+
this.schema = schema;
|
|
132
|
+
}
|
|
133
|
+
current_lock = null;
|
|
134
|
+
async lock() {
|
|
135
|
+
throw new Error('Lock not implemented');
|
|
136
|
+
}
|
|
137
|
+
parsed(options) {
|
|
138
|
+
return {
|
|
139
|
+
...this,
|
|
140
|
+
sync_rules: SqlSyncRules.fromYaml(this.sync_rules_content, {
|
|
141
|
+
...this.apiHandler.getParseSyncRulesOptions(),
|
|
142
|
+
schema: this.schema
|
|
143
|
+
}),
|
|
144
|
+
hydratedSyncRules() {
|
|
145
|
+
return this.sync_rules.config.hydrate({ hydrationState: DEFAULT_HYDRATION_STATE });
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
124
150
|
export const validate = routeDefinition({
|
|
125
151
|
path: '/api/admin/v1/validate',
|
|
126
152
|
method: router.HTTPMethod.POST,
|
|
@@ -132,29 +158,16 @@ export const validate = routeDefinition({
|
|
|
132
158
|
const apiHandler = service_context.routerEngine.getAPI();
|
|
133
159
|
const schemaData = await api.getConnectionsSchema(apiHandler);
|
|
134
160
|
const schema = new StaticSchema(schemaData.connections);
|
|
135
|
-
const sync_rules = {
|
|
161
|
+
const sync_rules = new FakeSyncRulesContentForValidation(apiHandler, schema, {
|
|
136
162
|
// Dummy values
|
|
137
163
|
id: 0,
|
|
138
164
|
slot_name: '',
|
|
139
165
|
active: false,
|
|
140
166
|
last_checkpoint_lsn: '',
|
|
141
|
-
|
|
142
|
-
return {
|
|
143
|
-
...this,
|
|
144
|
-
sync_rules: SqlSyncRules.fromYaml(content, {
|
|
145
|
-
...apiHandler.getParseSyncRulesOptions(),
|
|
146
|
-
schema
|
|
147
|
-
}),
|
|
148
|
-
hydratedSyncRules() {
|
|
149
|
-
return this.sync_rules.config.hydrate();
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
},
|
|
167
|
+
storageVersion: storage.LEGACY_STORAGE_VERSION,
|
|
153
168
|
sync_rules_content: content,
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
};
|
|
169
|
+
compiled_plan: null
|
|
170
|
+
});
|
|
158
171
|
const connectionStatus = await apiHandler.getConnectionStatus();
|
|
159
172
|
if (!connectionStatus) {
|
|
160
173
|
return internal_routes.ValidateResponse.encode({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../../../src/routes/endpoints/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AACtF,OAAO,
|
|
1
|
+
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../../../src/routes/endpoints/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AACtF,OAAO,EAAgB,YAAY,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,KAAK,GAAG,MAAM,wBAAwB,CAAC;AAC9C,OAAO,KAAK,OAAO,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC;IACxC,IAAI,EAAE,2BAA2B;IACjC,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI;IAC9B,SAAS,EAAE,OAAO;IAClB,SAAS,EAAE,MAAM,CAAC,sBAAsB,CAAC,eAAe,CAAC,iBAAiB,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;IACtG,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QACzB,MAAM,EACJ,MAAM,EAAE,EACN,GAAG,EAAE,EAAE,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E,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;gBAC/F,WAAW,EAAE,EAAE;aAChB,CAAC,CAAC;QACL,CAAC;QAED,MAAM,MAAM,GAAG,CAAC,MAAM,GAAG,CAAC,kBAAkB,CAC1C,eAAe,CAAC,aAAa,CAAC,mBAAmB,EACjD,UAAU,EACV,UAAU,EACV;YACE,eAAe,EAAE,KAAK;YACtB,gBAAgB,EAAE,gBAAgB,CAAC,SAAS;YAC5C,WAAW,EAAE,KAAK;SACnB,CACF,CAAE,CAAC;QAEJ,IAAI,gBAAgB,IAAI,IAAI,EAAE,CAAC;YAC7B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,0BAA0B,EAAE,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAC5G,CAAC;QAED,OAAO,eAAe,CAAC,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACzD,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { SqlSyncRules, SyncRulesErrors } from '@powersync/service-sync-rules';
|
|
|
3
3
|
import * as t from 'ts-codec';
|
|
4
4
|
import { authApi } from '../auth.js';
|
|
5
5
|
import { routeDefinition } from '../router.js';
|
|
6
|
+
import { updateSyncRulesFromConfig, updateSyncRulesFromYaml } from '../../storage/BucketStorageFactory.js';
|
|
6
7
|
const DeploySyncRulesRequest = t.object({
|
|
7
8
|
content: t.string
|
|
8
9
|
});
|
|
@@ -42,9 +43,10 @@ export const deploySyncRules = routeDefinition({
|
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
45
|
const content = payload.params.content;
|
|
46
|
+
let syncConfig;
|
|
45
47
|
try {
|
|
46
48
|
const apiHandler = service_context.routerEngine.getAPI();
|
|
47
|
-
SqlSyncRules.fromYaml(payload.params.content, {
|
|
49
|
+
syncConfig = SqlSyncRules.fromYaml(payload.params.content, {
|
|
48
50
|
...apiHandler.getParseSyncRulesOptions(),
|
|
49
51
|
// We don't do any schema-level validation at this point
|
|
50
52
|
schema: undefined
|
|
@@ -58,11 +60,7 @@ export const deploySyncRules = routeDefinition({
|
|
|
58
60
|
details: e.message
|
|
59
61
|
});
|
|
60
62
|
}
|
|
61
|
-
const sync_rules = await storageEngine.activeBucketStorage.updateSyncRules(
|
|
62
|
-
content: content,
|
|
63
|
-
// Aready validated above
|
|
64
|
-
validate: false
|
|
65
|
-
});
|
|
63
|
+
const sync_rules = await storageEngine.activeBucketStorage.updateSyncRules(updateSyncRulesFromConfig(syncConfig.config));
|
|
66
64
|
return {
|
|
67
65
|
slot_name: sync_rules.slot_name
|
|
68
66
|
};
|
|
@@ -139,12 +137,11 @@ export const reprocessSyncRules = routeDefinition({
|
|
|
139
137
|
description: 'No active sync rules'
|
|
140
138
|
});
|
|
141
139
|
}
|
|
142
|
-
const new_rules = await activeBucketStorage.updateSyncRules({
|
|
143
|
-
content: sync_rules.sync_rules.config.content,
|
|
140
|
+
const new_rules = await activeBucketStorage.updateSyncRules(updateSyncRulesFromYaml(sync_rules.sync_rules.config.content, {
|
|
144
141
|
// These sync rules already passed validation. But if the rules are not valid anymore due
|
|
145
142
|
// to a service change, we do want to report the error here.
|
|
146
143
|
validate: true
|
|
147
|
-
});
|
|
144
|
+
}));
|
|
148
145
|
return {
|
|
149
146
|
slot_name: new_rules.slot_name
|
|
150
147
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-rules.js","sourceRoot":"","sources":["../../../src/routes/endpoints/sync-rules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AACtF,OAAO,EAA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