@powersync/service-core 1.17.0 → 1.18.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.
@@ -70,6 +70,7 @@ export declare const diagnostics: router.Endpoint<{
70
70
  errors: {
71
71
  message: string;
72
72
  level: "warning" | "fatal";
73
+ ts?: string | undefined;
73
74
  }[];
74
75
  id: string;
75
76
  postgres_uri: string;
@@ -79,6 +80,7 @@ export declare const diagnostics: router.Endpoint<{
79
80
  errors: {
80
81
  level: "warning" | "fatal";
81
82
  message: string;
83
+ ts?: string | undefined;
82
84
  }[];
83
85
  connections: {
84
86
  id: string;
@@ -94,6 +96,7 @@ export declare const diagnostics: router.Endpoint<{
94
96
  errors: {
95
97
  level: "warning" | "fatal";
96
98
  message: string;
99
+ ts?: string | undefined;
97
100
  }[];
98
101
  pattern?: string | undefined;
99
102
  }[];
@@ -108,6 +111,7 @@ export declare const diagnostics: router.Endpoint<{
108
111
  errors: {
109
112
  level: "warning" | "fatal";
110
113
  message: string;
114
+ ts?: string | undefined;
111
115
  }[];
112
116
  connections: {
113
117
  id: string;
@@ -123,6 +127,7 @@ export declare const diagnostics: router.Endpoint<{
123
127
  errors: {
124
128
  level: "warning" | "fatal";
125
129
  message: string;
130
+ ts?: string | undefined;
126
131
  }[];
127
132
  pattern?: string | undefined;
128
133
  }[];
@@ -142,6 +147,7 @@ export declare const diagnostics: router.Endpoint<{
142
147
  errors: {
143
148
  message: string;
144
149
  level: "warning" | "fatal";
150
+ ts?: string | undefined;
145
151
  }[];
146
152
  id: string;
147
153
  postgres_uri: string;
@@ -151,6 +157,7 @@ export declare const diagnostics: router.Endpoint<{
151
157
  errors: {
152
158
  level: "warning" | "fatal";
153
159
  message: string;
160
+ ts?: string | undefined;
154
161
  }[];
155
162
  connections: {
156
163
  id: string;
@@ -166,6 +173,7 @@ export declare const diagnostics: router.Endpoint<{
166
173
  errors: {
167
174
  level: "warning" | "fatal";
168
175
  message: string;
176
+ ts?: string | undefined;
169
177
  }[];
170
178
  pattern?: string | undefined;
171
179
  }[];
@@ -180,6 +188,7 @@ export declare const diagnostics: router.Endpoint<{
180
188
  errors: {
181
189
  level: "warning" | "fatal";
182
190
  message: string;
191
+ ts?: string | undefined;
183
192
  }[];
184
193
  connections: {
185
194
  id: string;
@@ -195,6 +204,7 @@ export declare const diagnostics: router.Endpoint<{
195
204
  errors: {
196
205
  level: "warning" | "fatal";
197
206
  message: string;
207
+ ts?: string | undefined;
198
208
  }[];
199
209
  pattern?: string | undefined;
200
210
  }[];
@@ -225,6 +235,7 @@ export declare const diagnostics: router.Endpoint<{
225
235
  errors: {
226
236
  message: string;
227
237
  level: "warning" | "fatal";
238
+ ts?: string | undefined;
228
239
  }[];
229
240
  id: string;
230
241
  postgres_uri: string;
@@ -234,6 +245,7 @@ export declare const diagnostics: router.Endpoint<{
234
245
  errors: {
235
246
  level: "warning" | "fatal";
236
247
  message: string;
248
+ ts?: string | undefined;
237
249
  }[];
238
250
  connections: {
239
251
  id: string;
@@ -249,6 +261,7 @@ export declare const diagnostics: router.Endpoint<{
249
261
  errors: {
250
262
  level: "warning" | "fatal";
251
263
  message: string;
264
+ ts?: string | undefined;
252
265
  }[];
253
266
  pattern?: string | undefined;
254
267
  }[];
@@ -263,6 +276,7 @@ export declare const diagnostics: router.Endpoint<{
263
276
  errors: {
264
277
  level: "warning" | "fatal";
265
278
  message: string;
279
+ ts?: string | undefined;
266
280
  }[];
267
281
  connections: {
268
282
  id: string;
@@ -278,6 +292,7 @@ export declare const diagnostics: router.Endpoint<{
278
292
  errors: {
279
293
  level: "warning" | "fatal";
280
294
  message: string;
295
+ ts?: string | undefined;
281
296
  }[];
282
297
  pattern?: string | undefined;
283
298
  }[];
@@ -403,6 +418,7 @@ export declare const validate: router.Endpoint<{
403
418
  errors: {
404
419
  message: string;
405
420
  level: "warning" | "fatal";
421
+ ts?: string | undefined;
406
422
  }[];
407
423
  connections: {
408
424
  id: string;
@@ -413,6 +429,7 @@ export declare const validate: router.Endpoint<{
413
429
  errors: {
414
430
  message: string;
415
431
  level: "warning" | "fatal";
432
+ ts?: string | undefined;
416
433
  }[];
417
434
  name: string;
418
435
  schema: string;
@@ -435,6 +452,7 @@ export declare const validate: router.Endpoint<{
435
452
  errors: {
436
453
  message: string;
437
454
  level: "warning" | "fatal";
455
+ ts?: string | undefined;
438
456
  }[];
439
457
  connections: {
440
458
  id: string;
@@ -445,6 +463,7 @@ export declare const validate: router.Endpoint<{
445
463
  errors: {
446
464
  message: string;
447
465
  level: "warning" | "fatal";
466
+ ts?: string | undefined;
448
467
  }[];
449
468
  name: string;
450
469
  schema: string;
@@ -478,6 +497,7 @@ export declare const validate: router.Endpoint<{
478
497
  errors: {
479
498
  message: string;
480
499
  level: "warning" | "fatal";
500
+ ts?: string | undefined;
481
501
  }[];
482
502
  connections: {
483
503
  id: string;
@@ -488,6 +508,7 @@ export declare const validate: router.Endpoint<{
488
508
  errors: {
489
509
  message: string;
490
510
  level: "warning" | "fatal";
511
+ ts?: string | undefined;
491
512
  }[];
492
513
  name: string;
493
514
  schema: string;
@@ -574,6 +595,7 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
574
595
  errors: {
575
596
  message: string;
576
597
  level: "warning" | "fatal";
598
+ ts?: string | undefined;
577
599
  }[];
578
600
  id: string;
579
601
  postgres_uri: string;
@@ -583,6 +605,7 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
583
605
  errors: {
584
606
  level: "warning" | "fatal";
585
607
  message: string;
608
+ ts?: string | undefined;
586
609
  }[];
587
610
  connections: {
588
611
  id: string;
@@ -598,6 +621,7 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
598
621
  errors: {
599
622
  level: "warning" | "fatal";
600
623
  message: string;
624
+ ts?: string | undefined;
601
625
  }[];
602
626
  pattern?: string | undefined;
603
627
  }[];
@@ -612,6 +636,7 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
612
636
  errors: {
613
637
  level: "warning" | "fatal";
614
638
  message: string;
639
+ ts?: string | undefined;
615
640
  }[];
616
641
  connections: {
617
642
  id: string;
@@ -627,6 +652,7 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
627
652
  errors: {
628
653
  level: "warning" | "fatal";
629
654
  message: string;
655
+ ts?: string | undefined;
630
656
  }[];
631
657
  pattern?: string | undefined;
632
658
  }[];
@@ -646,6 +672,7 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
646
672
  errors: {
647
673
  message: string;
648
674
  level: "warning" | "fatal";
675
+ ts?: string | undefined;
649
676
  }[];
650
677
  id: string;
651
678
  postgres_uri: string;
@@ -655,6 +682,7 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
655
682
  errors: {
656
683
  level: "warning" | "fatal";
657
684
  message: string;
685
+ ts?: string | undefined;
658
686
  }[];
659
687
  connections: {
660
688
  id: string;
@@ -670,6 +698,7 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
670
698
  errors: {
671
699
  level: "warning" | "fatal";
672
700
  message: string;
701
+ ts?: string | undefined;
673
702
  }[];
674
703
  pattern?: string | undefined;
675
704
  }[];
@@ -684,6 +713,7 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
684
713
  errors: {
685
714
  level: "warning" | "fatal";
686
715
  message: string;
716
+ ts?: string | undefined;
687
717
  }[];
688
718
  connections: {
689
719
  id: string;
@@ -699,6 +729,7 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
699
729
  errors: {
700
730
  level: "warning" | "fatal";
701
731
  message: string;
732
+ ts?: string | undefined;
702
733
  }[];
703
734
  pattern?: string | undefined;
704
735
  }[];
@@ -729,6 +760,7 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
729
760
  errors: {
730
761
  message: string;
731
762
  level: "warning" | "fatal";
763
+ ts?: string | undefined;
732
764
  }[];
733
765
  id: string;
734
766
  postgres_uri: string;
@@ -738,6 +770,7 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
738
770
  errors: {
739
771
  level: "warning" | "fatal";
740
772
  message: string;
773
+ ts?: string | undefined;
741
774
  }[];
742
775
  connections: {
743
776
  id: string;
@@ -753,6 +786,7 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
753
786
  errors: {
754
787
  level: "warning" | "fatal";
755
788
  message: string;
789
+ ts?: string | undefined;
756
790
  }[];
757
791
  pattern?: string | undefined;
758
792
  }[];
@@ -767,6 +801,7 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
767
801
  errors: {
768
802
  level: "warning" | "fatal";
769
803
  message: string;
804
+ ts?: string | undefined;
770
805
  }[];
771
806
  connections: {
772
807
  id: string;
@@ -782,6 +817,7 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
782
817
  errors: {
783
818
  level: "warning" | "fatal";
784
819
  message: string;
820
+ ts?: string | undefined;
785
821
  }[];
786
822
  pattern?: string | undefined;
787
823
  }[];
@@ -904,6 +940,7 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
904
940
  errors: {
905
941
  message: string;
906
942
  level: "warning" | "fatal";
943
+ ts?: string | undefined;
907
944
  }[];
908
945
  connections: {
909
946
  id: string;
@@ -914,6 +951,7 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
914
951
  errors: {
915
952
  message: string;
916
953
  level: "warning" | "fatal";
954
+ ts?: string | undefined;
917
955
  }[];
918
956
  name: string;
919
957
  schema: string;
@@ -936,6 +974,7 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
936
974
  errors: {
937
975
  message: string;
938
976
  level: "warning" | "fatal";
977
+ ts?: string | undefined;
939
978
  }[];
940
979
  connections: {
941
980
  id: string;
@@ -946,6 +985,7 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
946
985
  errors: {
947
986
  message: string;
948
987
  level: "warning" | "fatal";
988
+ ts?: string | undefined;
949
989
  }[];
950
990
  name: string;
951
991
  schema: string;
@@ -979,6 +1019,7 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
979
1019
  errors: {
980
1020
  message: string;
981
1021
  level: "warning" | "fatal";
1022
+ ts?: string | undefined;
982
1023
  }[];
983
1024
  connections: {
984
1025
  id: string;
@@ -989,6 +1030,7 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
989
1030
  errors: {
990
1031
  message: string;
991
1032
  level: "warning" | "fatal";
1033
+ ts?: string | undefined;
992
1034
  }[];
993
1035
  name: string;
994
1036
  schema: string;
@@ -152,7 +152,7 @@ export const validate = routeDefinition({
152
152
  const connectionStatus = await apiHandler.getConnectionStatus();
153
153
  if (!connectionStatus) {
154
154
  return internal_routes.ValidateResponse.encode({
155
- errors: [{ level: 'fatal', message: 'No connection configured' }],
155
+ errors: [{ level: 'fatal', message: 'No connection configured', ts: new Date().toISOString() }],
156
156
  connections: []
157
157
  });
158
158
  }
@@ -162,7 +162,7 @@ export const validate = routeDefinition({
162
162
  live_status: false
163
163
  }));
164
164
  if (connectionStatus == null) {
165
- status.errors.push({ level: 'fatal', message: 'No connection configured' });
165
+ status.errors.push({ level: 'fatal', message: 'No connection configured', ts: new Date().toISOString() });
166
166
  }
167
167
  return internal_routes.ValidateResponse.encode(status);
168
168
  }
@@ -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,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,KAAK,GAAG,MAAM,wBAAwB,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC;IACxC,IAAI,EAAE,2BAA2B;IACjC,MAAM,EAAE,MAAM,C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,YAAY,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC"}
@@ -69,6 +69,7 @@ export interface BucketStorageBatch extends ObserverClient<BucketBatchStorageLis
69
69
  * Not relevant for streams where the source keeps track of replication progress, such as Postgres.
70
70
  */
71
71
  resumeFromLsn: string | null;
72
+ noCheckpointBeforeLsn: string;
72
73
  markSnapshotDone(tables: SourceTable[], no_checkpoint_before_lsn: string): Promise<SourceTable[]>;
73
74
  updateTableProgress(table: SourceTable, progress: Partial<TableSnapshotStatus>): Promise<SourceTable>;
74
75
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"BucketStorageBatch.js","sourceRoot":"","sources":["../../src/storage/BucketStorageBatch.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,mCAAmC,GAAqC;IACnF,sBAAsB,EAAE,IAAI;IAC5B,uBAAuB,EAAE,IAAI;CAC9B,CAAC;AAgHF,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,qCAAiB,CAAA;IACjB,qCAAiB,CAAA;AACnB,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B"}
1
+ {"version":3,"file":"BucketStorageBatch.js","sourceRoot":"","sources":["../../src/storage/BucketStorageBatch.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,mCAAmC,GAAqC;IACnF,sBAAsB,EAAE,IAAI;IAC5B,uBAAuB,EAAE,IAAI;CAC9B,CAAC;AAkHF,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,qCAAiB,CAAA;IACjB,qCAAiB,CAAA;AACnB,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B"}
@@ -13,6 +13,7 @@ export interface PersistedSyncRulesContent {
13
13
  readonly active: boolean;
14
14
  readonly last_checkpoint_lsn: string | null;
15
15
  readonly last_fatal_error?: string | null;
16
+ readonly last_fatal_error_ts?: Date | null;
16
17
  readonly last_keepalive_ts?: Date | null;
17
18
  readonly last_checkpoint_ts?: Date | null;
18
19
  parsed(options: ParseSyncRulesOptions): PersistedSyncRules;
@@ -42,7 +42,7 @@ export interface SyncRulesBucketStorage extends ObserverClient<SyncRulesBucketSt
42
42
  * This could be a recoverable error (e.g. temporary network failure),
43
43
  * or a permanent error (e.g. missing toast data).
44
44
  *
45
- * Errors are cleared on commit.
45
+ * Errors are cleared on flush.
46
46
  */
47
47
  reportError(e: any): Promise<void>;
48
48
  compact(options?: CompactOptions): Promise<void>;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
- "version": "1.17.0",
8
+ "version": "1.18.0",
9
9
  "main": "dist/index.js",
10
10
  "license": "FSL-1.1-ALv2",
11
11
  "type": "module",
@@ -33,11 +33,11 @@
33
33
  "uuid": "^11.1.0",
34
34
  "winston": "^3.13.0",
35
35
  "yaml": "^2.3.2",
36
- "@powersync/lib-services-framework": "0.7.11",
37
- "@powersync/service-jsonbig": "0.17.12",
38
- "@powersync/service-rsocket-router": "0.2.8",
36
+ "@powersync/lib-services-framework": "0.7.12",
37
+ "@powersync/service-rsocket-router": "0.2.9",
39
38
  "@powersync/service-sync-rules": "0.29.8",
40
- "@powersync/service-types": "0.13.2"
39
+ "@powersync/service-types": "0.13.3",
40
+ "@powersync/service-jsonbig": "0.17.12"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/async": "^3.2.24",
@@ -1,6 +1,6 @@
1
1
  import { logger } from '@powersync/lib-services-framework';
2
2
  import { DEFAULT_TAG, SourceTableInterface, SqlSyncRules } from '@powersync/service-sync-rules';
3
- import { SyncRulesStatus, TableInfo } from '@powersync/service-types';
3
+ import { ReplicationError, SyncRulesStatus, TableInfo } from '@powersync/service-types';
4
4
 
5
5
  import * as storage from '../storage/storage-index.js';
6
6
  import { RouteAPI } from './RouteAPI.js';
@@ -39,6 +39,7 @@ export async function getSyncRulesStatus(
39
39
  const include_content = options.include_content ?? false;
40
40
  const live_status = options.live_status ?? false;
41
41
  const check_connection = options.check_connection ?? false;
42
+ const now = new Date().toISOString();
42
43
 
43
44
  let rules: SqlSyncRules;
44
45
  let persisted: storage.PersistedSyncRules;
@@ -49,7 +50,7 @@ export async function getSyncRulesStatus(
49
50
  return {
50
51
  content: include_content ? sync_rules.sync_rules_content : undefined,
51
52
  connections: [],
52
- errors: [{ level: 'fatal', message: e.message }]
53
+ errors: [{ level: 'fatal', message: e.message, ts: now }]
53
54
  };
54
55
  }
55
56
 
@@ -99,7 +100,7 @@ export async function getSyncRulesStatus(
99
100
  data_queries: false,
100
101
  parameter_queries: false,
101
102
  replication_id: [],
102
- errors: [{ level: 'fatal', message: 'connection failed' }]
103
+ errors: [{ level: 'fatal', message: 'connection failed', ts: now }]
103
104
  };
104
105
  } else {
105
106
  const source: SourceTableInterface = {
@@ -115,7 +116,7 @@ export async function getSyncRulesStatus(
115
116
  data_queries: syncData,
116
117
  parameter_queries: syncParameters,
117
118
  replication_id: [],
118
- errors: [{ level: 'fatal', message: 'connection failed' }]
119
+ errors: [{ level: 'fatal', message: 'connection failed', ts: now }]
119
120
  };
120
121
  }
121
122
  });
@@ -123,13 +124,18 @@ export async function getSyncRulesStatus(
123
124
 
124
125
  const errors = tables_flat.flatMap((info) => info.errors);
125
126
  if (sync_rules.last_fatal_error) {
126
- errors.push({ level: 'fatal', message: sync_rules.last_fatal_error });
127
+ errors.push({
128
+ level: 'fatal',
129
+ message: sync_rules.last_fatal_error,
130
+ ts: sync_rules.last_fatal_error_ts?.toISOString()
131
+ });
127
132
  }
128
133
  errors.push(
129
134
  ...rules.errors.map((e) => {
130
135
  return {
131
136
  level: e.type,
132
- message: e.message
137
+ message: e.message,
138
+ ts: now
133
139
  };
134
140
  })
135
141
  );
@@ -140,7 +146,8 @@ export async function getSyncRulesStatus(
140
146
  if (sync_rules.last_checkpoint_ts == null && sync_rules.last_keepalive_ts == null) {
141
147
  errors.push({
142
148
  level: 'warning',
143
- message: 'No checkpoint found, cannot calculate replication lag'
149
+ message: 'No checkpoint found, cannot calculate replication lag',
150
+ ts: now
144
151
  });
145
152
  } else {
146
153
  const lastTime = Math.max(
@@ -155,12 +162,14 @@ export async function getSyncRulesStatus(
155
162
  if (lagSeconds > 15 * 60) {
156
163
  errors.push({
157
164
  level: 'fatal',
158
- message: `No replicated commit in more than ${lagSeconds}s`
165
+ message: `No replicated commit in more than ${lagSeconds}s`,
166
+ ts: now
159
167
  });
160
168
  } else if (lagSeconds > 5 * 60) {
161
169
  errors.push({
162
170
  level: 'warning',
163
- message: `No replicated commit in more than ${lagSeconds}s`
171
+ message: `No replicated commit in more than ${lagSeconds}s`,
172
+ ts: now
164
173
  });
165
174
  }
166
175
  }
@@ -186,9 +195,9 @@ export async function getSyncRulesStatus(
186
195
  };
187
196
  }
188
197
 
189
- function deduplicate(errors: { level: 'warning' | 'fatal'; message: string }[]) {
198
+ function deduplicate(errors: ReplicationError[]): ReplicationError[] {
190
199
  let seen = new Set<string>();
191
- let result: { level: 'warning' | 'fatal'; message: string }[] = [];
200
+ let result: ReplicationError[] = [];
192
201
  for (let error of errors) {
193
202
  const key = JSON.stringify(error);
194
203
  if (seen.has(key)) {
@@ -0,0 +1,47 @@
1
+ import { ResolvedPowerSyncConfig } from '../util/util-index.js';
2
+ import { AbstractModule } from './AbstractModule.js';
3
+
4
+ interface DynamicModuleMap {
5
+ [key: string]: () => Promise<AbstractModule>;
6
+ }
7
+
8
+ export interface ModuleLoaders {
9
+ storage: DynamicModuleMap;
10
+ connection: DynamicModuleMap;
11
+ }
12
+ /**
13
+ * Utility function to dynamically load and instantiate modules.
14
+ */
15
+ export async function loadModules(config: ResolvedPowerSyncConfig, loaders: ModuleLoaders) {
16
+ const requiredConnections = [...new Set(config.connections?.map((connection) => connection.type) || [])];
17
+ const missingConnectionModules: string[] = [];
18
+ const modulePromises: Promise<AbstractModule>[] = [];
19
+
20
+ // 1. Map connection types to their module loading promises making note of any
21
+ // missing connection types.
22
+ requiredConnections.forEach((connectionType) => {
23
+ const modulePromise = loaders.connection[connectionType];
24
+ if (modulePromise !== undefined) {
25
+ modulePromises.push(modulePromise());
26
+ } else {
27
+ missingConnectionModules.push(connectionType);
28
+ }
29
+ });
30
+
31
+ // Fail if any connection types are not found.
32
+ if (missingConnectionModules.length > 0) {
33
+ throw new Error(`Invalid connection types: "${[...missingConnectionModules].join(', ')}"`);
34
+ }
35
+
36
+ if (loaders.storage[config.storage.type] !== undefined) {
37
+ modulePromises.push(loaders.storage[config.storage.type]());
38
+ } else {
39
+ throw new Error(`Invalid storage type: "${config.storage.type}"`);
40
+ }
41
+
42
+ // 2. Dynamically import and instantiate module classes and resolve all promises
43
+ // raising errors if any modules could not be imported.
44
+ const moduleInstances = await Promise.all(modulePromises);
45
+
46
+ return moduleInstances;
47
+ }
@@ -1,2 +1,3 @@
1
1
  export * from './ModuleManager.js';
2
2
  export * from './AbstractModule.js';
3
+ export * from './loader.js';
@@ -189,7 +189,7 @@ export const validate = routeDefinition({
189
189
  const connectionStatus = await apiHandler.getConnectionStatus();
190
190
  if (!connectionStatus) {
191
191
  return internal_routes.ValidateResponse.encode({
192
- errors: [{ level: 'fatal', message: 'No connection configured' }],
192
+ errors: [{ level: 'fatal', message: 'No connection configured', ts: new Date().toISOString() }],
193
193
  connections: []
194
194
  });
195
195
  }
@@ -206,7 +206,7 @@ export const validate = routeDefinition({
206
206
  ))!;
207
207
 
208
208
  if (connectionStatus == null) {
209
- status.errors.push({ level: 'fatal', message: 'No connection configured' });
209
+ status.errors.push({ level: 'fatal', message: 'No connection configured', ts: new Date().toISOString() });
210
210
  }
211
211
 
212
212
  return internal_routes.ValidateResponse.encode(status);
@@ -83,6 +83,8 @@ export interface BucketStorageBatch extends ObserverClient<BucketBatchStorageLis
83
83
  */
84
84
  resumeFromLsn: string | null;
85
85
 
86
+ noCheckpointBeforeLsn: string;
87
+
86
88
  markSnapshotDone(tables: SourceTable[], no_checkpoint_before_lsn: string): Promise<SourceTable[]>;
87
89
 
88
90
  updateTableProgress(table: SourceTable, progress: Partial<TableSnapshotStatus>): Promise<SourceTable>;
@@ -17,6 +17,7 @@ export interface PersistedSyncRulesContent {
17
17
  readonly last_checkpoint_lsn: string | null;
18
18
 
19
19
  readonly last_fatal_error?: string | null;
20
+ readonly last_fatal_error_ts?: Date | null;
20
21
  readonly last_keepalive_ts?: Date | null;
21
22
  readonly last_checkpoint_ts?: Date | null;
22
23
 
@@ -56,7 +56,7 @@ export interface SyncRulesBucketStorage
56
56
  * This could be a recoverable error (e.g. temporary network failure),
57
57
  * or a permanent error (e.g. missing toast data).
58
58
  *
59
- * Errors are cleared on commit.
59
+ * Errors are cleared on flush.
60
60
  */
61
61
  reportError(e: any): Promise<void>;
62
62