@powersync/service-core 0.5.1 → 0.6.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.
@@ -0,0 +1,883 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import type fastify from 'fastify';
3
+ import * as system from '../system/system-index.js';
4
+ import { CreateRequestQueueParams } from './hooks.js';
5
+ import { RouteDefinition } from './router.js';
6
+ /**
7
+ * A list of route definitions to be registered as endpoints.
8
+ * Supplied concurrency limits will be applied to the grouped routes.
9
+ */
10
+ export type RouteRegistrationOptions = {
11
+ routes: RouteDefinition[];
12
+ queueOptions: CreateRequestQueueParams;
13
+ };
14
+ /**
15
+ * HTTP routes separated by API and Sync stream categories.
16
+ * This allows for separate concurrency limits.
17
+ */
18
+ export type RouteDefinitions = {
19
+ api?: Partial<RouteRegistrationOptions>;
20
+ syncStream?: Partial<RouteRegistrationOptions>;
21
+ };
22
+ export type FastifyServerConfig = {
23
+ system: system.CorePowerSyncSystem;
24
+ routes?: RouteDefinitions;
25
+ };
26
+ export declare const DEFAULT_ROUTE_OPTIONS: {
27
+ api: {
28
+ routes: ((import("@powersync/lib-services-framework").Endpoint<{
29
+ connection_id?: string | undefined;
30
+ }, {
31
+ credentials?: {
32
+ postgres_uri: string;
33
+ } | undefined;
34
+ }, import("./router.js").Context, import("./router.js").RequestEndpointHandlerPayload<{
35
+ connection_id?: string | undefined;
36
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>, import("@powersync/lib-services-framework").EndpointHandler<import("./router.js").RequestEndpointHandlerPayload<{
37
+ connection_id?: string | undefined;
38
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>, {
39
+ credentials?: {
40
+ postgres_uri: string;
41
+ } | undefined;
42
+ }>> & {
43
+ path: string;
44
+ method: import("@powersync/lib-services-framework").HTTPMethod.POST;
45
+ authorize: (payload: import("./router.js").RequestEndpointHandlerPayload) => {
46
+ authorized: boolean;
47
+ errors: string[];
48
+ } | {
49
+ authorized: boolean;
50
+ errors?: undefined;
51
+ };
52
+ validator: import("@powersync/lib-services-framework").MicroValidator<{
53
+ connection_id?: string | undefined;
54
+ }, string[]>;
55
+ handler: (payload: import("./router.js").RequestEndpointHandlerPayload<{
56
+ connection_id?: string | undefined;
57
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>) => Promise<{
58
+ credentials?: {
59
+ postgres_uri: string;
60
+ } | undefined;
61
+ }>;
62
+ }) | (import("@powersync/lib-services-framework").Endpoint<{
63
+ sql: {
64
+ query: string;
65
+ args: (string | number | boolean)[];
66
+ };
67
+ connection_id?: string | undefined;
68
+ }, {
69
+ results: {
70
+ columns: string[];
71
+ rows: (string | number | boolean | null)[][];
72
+ };
73
+ success: boolean;
74
+ error?: string | undefined;
75
+ }, import("./router.js").Context, import("./router.js").RequestEndpointHandlerPayload<{
76
+ sql: {
77
+ query: string;
78
+ args: (string | number | boolean)[];
79
+ };
80
+ connection_id?: string | undefined;
81
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>, import("@powersync/lib-services-framework").EndpointHandler<import("./router.js").RequestEndpointHandlerPayload<{
82
+ sql: {
83
+ query: string;
84
+ args: (string | number | boolean)[];
85
+ };
86
+ connection_id?: string | undefined;
87
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>, {
88
+ results: {
89
+ columns: string[];
90
+ rows: (string | number | boolean | null)[][];
91
+ };
92
+ success: boolean;
93
+ error?: string | undefined;
94
+ }>> & {
95
+ path: string;
96
+ method: import("@powersync/lib-services-framework").HTTPMethod.POST;
97
+ authorize: (payload: import("./router.js").RequestEndpointHandlerPayload) => {
98
+ authorized: boolean;
99
+ errors: string[];
100
+ } | {
101
+ authorized: boolean;
102
+ errors?: undefined;
103
+ };
104
+ validator: import("@powersync/lib-services-framework").MicroValidator<{
105
+ sql: {
106
+ query: string;
107
+ args: (string | number | boolean)[];
108
+ };
109
+ connection_id?: string | undefined;
110
+ }, string[]>;
111
+ handler: (payload: import("./router.js").RequestEndpointHandlerPayload<{
112
+ sql: {
113
+ query: string;
114
+ args: (string | number | boolean)[];
115
+ };
116
+ connection_id?: string | undefined;
117
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>) => Promise<{
118
+ results: {
119
+ columns: string[];
120
+ rows: (string | number | boolean | null)[][];
121
+ };
122
+ success: boolean;
123
+ error?: string | undefined;
124
+ }>;
125
+ }) | (import("@powersync/lib-services-framework").Endpoint<{
126
+ sync_rules_content?: boolean | undefined;
127
+ }, {
128
+ connections: {
129
+ errors: {
130
+ message: string;
131
+ level: "warning" | "fatal";
132
+ }[];
133
+ id: string;
134
+ postgres_uri: string;
135
+ connected: boolean;
136
+ }[];
137
+ active_sync_rules?: {
138
+ errors: {
139
+ level: "warning" | "fatal";
140
+ message: string;
141
+ }[];
142
+ connections: {
143
+ id: string;
144
+ tag: string;
145
+ slot_name: string;
146
+ initial_replication_done: boolean;
147
+ tables: {
148
+ schema: string;
149
+ name: string;
150
+ replication_id: string[];
151
+ data_queries: boolean;
152
+ parameter_queries: boolean;
153
+ errors: {
154
+ level: "warning" | "fatal";
155
+ message: string;
156
+ }[];
157
+ pattern?: string | undefined;
158
+ }[];
159
+ last_lsn?: string | undefined;
160
+ last_keepalive_ts?: string | undefined;
161
+ last_checkpoint_ts?: string | undefined;
162
+ replication_lag_bytes?: number | undefined;
163
+ }[];
164
+ content?: string | undefined;
165
+ } | undefined;
166
+ deploying_sync_rules?: {
167
+ errors: {
168
+ level: "warning" | "fatal";
169
+ message: string;
170
+ }[];
171
+ connections: {
172
+ id: string;
173
+ tag: string;
174
+ slot_name: string;
175
+ initial_replication_done: boolean;
176
+ tables: {
177
+ schema: string;
178
+ name: string;
179
+ replication_id: string[];
180
+ data_queries: boolean;
181
+ parameter_queries: boolean;
182
+ errors: {
183
+ level: "warning" | "fatal";
184
+ message: string;
185
+ }[];
186
+ pattern?: string | undefined;
187
+ }[];
188
+ last_lsn?: string | undefined;
189
+ last_keepalive_ts?: string | undefined;
190
+ last_checkpoint_ts?: string | undefined;
191
+ replication_lag_bytes?: number | undefined;
192
+ }[];
193
+ content?: string | undefined;
194
+ } | undefined;
195
+ }, import("./router.js").Context, import("./router.js").RequestEndpointHandlerPayload<{
196
+ sync_rules_content?: boolean | undefined;
197
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>, import("@powersync/lib-services-framework").EndpointHandler<import("./router.js").RequestEndpointHandlerPayload<{
198
+ sync_rules_content?: boolean | undefined;
199
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>, {
200
+ connections: {
201
+ errors: {
202
+ message: string;
203
+ level: "warning" | "fatal";
204
+ }[];
205
+ id: string;
206
+ postgres_uri: string;
207
+ connected: boolean;
208
+ }[];
209
+ active_sync_rules?: {
210
+ errors: {
211
+ level: "warning" | "fatal";
212
+ message: string;
213
+ }[];
214
+ connections: {
215
+ id: string;
216
+ tag: string;
217
+ slot_name: string;
218
+ initial_replication_done: boolean;
219
+ tables: {
220
+ schema: string;
221
+ name: string;
222
+ replication_id: string[];
223
+ data_queries: boolean;
224
+ parameter_queries: boolean;
225
+ errors: {
226
+ level: "warning" | "fatal";
227
+ message: string;
228
+ }[];
229
+ pattern?: string | undefined;
230
+ }[];
231
+ last_lsn?: string | undefined;
232
+ last_keepalive_ts?: string | undefined;
233
+ last_checkpoint_ts?: string | undefined;
234
+ replication_lag_bytes?: number | undefined;
235
+ }[];
236
+ content?: string | undefined;
237
+ } | undefined;
238
+ deploying_sync_rules?: {
239
+ errors: {
240
+ level: "warning" | "fatal";
241
+ message: string;
242
+ }[];
243
+ connections: {
244
+ id: string;
245
+ tag: string;
246
+ slot_name: string;
247
+ initial_replication_done: boolean;
248
+ tables: {
249
+ schema: string;
250
+ name: string;
251
+ replication_id: string[];
252
+ data_queries: boolean;
253
+ parameter_queries: boolean;
254
+ errors: {
255
+ level: "warning" | "fatal";
256
+ message: string;
257
+ }[];
258
+ pattern?: string | undefined;
259
+ }[];
260
+ last_lsn?: string | undefined;
261
+ last_keepalive_ts?: string | undefined;
262
+ last_checkpoint_ts?: string | undefined;
263
+ replication_lag_bytes?: number | undefined;
264
+ }[];
265
+ content?: string | undefined;
266
+ } | undefined;
267
+ }>> & {
268
+ path: string;
269
+ method: import("@powersync/lib-services-framework").HTTPMethod.POST;
270
+ authorize: (payload: import("./router.js").RequestEndpointHandlerPayload) => {
271
+ authorized: boolean;
272
+ errors: string[];
273
+ } | {
274
+ authorized: boolean;
275
+ errors?: undefined;
276
+ };
277
+ validator: import("@powersync/lib-services-framework").MicroValidator<{
278
+ sync_rules_content?: boolean | undefined;
279
+ }, string[]>;
280
+ handler: (payload: import("./router.js").RequestEndpointHandlerPayload<{
281
+ sync_rules_content?: boolean | undefined;
282
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>) => Promise<{
283
+ connections: {
284
+ errors: {
285
+ message: string;
286
+ level: "warning" | "fatal";
287
+ }[];
288
+ id: string;
289
+ postgres_uri: string;
290
+ connected: boolean;
291
+ }[];
292
+ active_sync_rules?: {
293
+ errors: {
294
+ level: "warning" | "fatal";
295
+ message: string;
296
+ }[];
297
+ connections: {
298
+ id: string;
299
+ tag: string;
300
+ slot_name: string;
301
+ initial_replication_done: boolean;
302
+ tables: {
303
+ schema: string;
304
+ name: string;
305
+ replication_id: string[];
306
+ data_queries: boolean;
307
+ parameter_queries: boolean;
308
+ errors: {
309
+ level: "warning" | "fatal";
310
+ message: string;
311
+ }[];
312
+ pattern?: string | undefined;
313
+ }[];
314
+ last_lsn?: string | undefined;
315
+ last_keepalive_ts?: string | undefined;
316
+ last_checkpoint_ts?: string | undefined;
317
+ replication_lag_bytes?: number | undefined;
318
+ }[];
319
+ content?: string | undefined;
320
+ } | undefined;
321
+ deploying_sync_rules?: {
322
+ errors: {
323
+ level: "warning" | "fatal";
324
+ message: string;
325
+ }[];
326
+ connections: {
327
+ id: string;
328
+ tag: string;
329
+ slot_name: string;
330
+ initial_replication_done: boolean;
331
+ tables: {
332
+ schema: string;
333
+ name: string;
334
+ replication_id: string[];
335
+ data_queries: boolean;
336
+ parameter_queries: boolean;
337
+ errors: {
338
+ level: "warning" | "fatal";
339
+ message: string;
340
+ }[];
341
+ pattern?: string | undefined;
342
+ }[];
343
+ last_lsn?: string | undefined;
344
+ last_keepalive_ts?: string | undefined;
345
+ last_checkpoint_ts?: string | undefined;
346
+ replication_lag_bytes?: number | undefined;
347
+ }[];
348
+ content?: string | undefined;
349
+ } | undefined;
350
+ }>;
351
+ }) | (import("@powersync/lib-services-framework").Endpoint<{}, {
352
+ connections: {
353
+ tag: string;
354
+ schemas: {
355
+ name: string;
356
+ tables: {
357
+ name: string;
358
+ columns: {
359
+ type: string;
360
+ name: string;
361
+ pg_type: string;
362
+ }[];
363
+ }[];
364
+ }[];
365
+ id?: string | undefined;
366
+ }[];
367
+ }, import("./router.js").Context, import("./router.js").RequestEndpointHandlerPayload<{}, import("./router.js").Context, import("./router.js").BasicRouterRequest>, import("@powersync/lib-services-framework").EndpointHandler<import("./router.js").RequestEndpointHandlerPayload<{}, import("./router.js").Context, import("./router.js").BasicRouterRequest>, {
368
+ connections: {
369
+ tag: string;
370
+ schemas: {
371
+ name: string;
372
+ tables: {
373
+ name: string;
374
+ columns: {
375
+ type: string;
376
+ name: string;
377
+ pg_type: string;
378
+ }[];
379
+ }[];
380
+ }[];
381
+ id?: string | undefined;
382
+ }[];
383
+ }>> & {
384
+ path: string;
385
+ method: import("@powersync/lib-services-framework").HTTPMethod.POST;
386
+ authorize: (payload: import("./router.js").RequestEndpointHandlerPayload) => {
387
+ authorized: boolean;
388
+ errors: string[];
389
+ } | {
390
+ authorized: boolean;
391
+ errors?: undefined;
392
+ };
393
+ validator: import("@powersync/lib-services-framework").MicroValidator<{}, string[]>;
394
+ handler: (payload: import("./router.js").RequestEndpointHandlerPayload<{}, import("./router.js").Context, import("./router.js").BasicRouterRequest>) => Promise<{
395
+ connections: {
396
+ tag: string;
397
+ schemas: {
398
+ name: string;
399
+ tables: {
400
+ name: string;
401
+ columns: {
402
+ type: string;
403
+ name: string;
404
+ pg_type: string;
405
+ }[];
406
+ }[];
407
+ }[];
408
+ id?: string | undefined;
409
+ }[];
410
+ }>;
411
+ }) | (import("@powersync/lib-services-framework").Endpoint<{}, {
412
+ connections: {
413
+ tag: string;
414
+ slot_name: string;
415
+ id?: string | undefined;
416
+ }[];
417
+ }, import("./router.js").Context, import("./router.js").RequestEndpointHandlerPayload<{}, import("./router.js").Context, import("./router.js").BasicRouterRequest>, import("@powersync/lib-services-framework").EndpointHandler<import("./router.js").RequestEndpointHandlerPayload<{}, import("./router.js").Context, import("./router.js").BasicRouterRequest>, {
418
+ connections: {
419
+ tag: string;
420
+ slot_name: string;
421
+ id?: string | undefined;
422
+ }[];
423
+ }>> & {
424
+ path: string;
425
+ method: import("@powersync/lib-services-framework").HTTPMethod.POST;
426
+ authorize: (payload: import("./router.js").RequestEndpointHandlerPayload) => {
427
+ authorized: boolean;
428
+ errors: string[];
429
+ } | {
430
+ authorized: boolean;
431
+ errors?: undefined;
432
+ };
433
+ validator: import("@powersync/lib-services-framework").MicroValidator<{}, string[]>;
434
+ handler: (payload: import("./router.js").RequestEndpointHandlerPayload<{}, import("./router.js").Context, import("./router.js").BasicRouterRequest>) => Promise<{
435
+ connections: {
436
+ tag: string;
437
+ slot_name: string;
438
+ id?: string | undefined;
439
+ }[];
440
+ }>;
441
+ }) | (import("@powersync/lib-services-framework").Endpoint<{
442
+ sync_rules: string;
443
+ }, {
444
+ errors: {
445
+ message: string;
446
+ level: "warning" | "fatal";
447
+ }[];
448
+ connections: {
449
+ id: string;
450
+ tag: string;
451
+ slot_name: string;
452
+ initial_replication_done: boolean;
453
+ tables: {
454
+ errors: {
455
+ message: string;
456
+ level: "warning" | "fatal";
457
+ }[];
458
+ name: string;
459
+ schema: string;
460
+ replication_id: string[];
461
+ data_queries: boolean;
462
+ parameter_queries: boolean;
463
+ pattern?: string | undefined;
464
+ }[];
465
+ last_checkpoint_ts?: string | undefined;
466
+ last_keepalive_ts?: string | undefined;
467
+ last_lsn?: string | undefined;
468
+ replication_lag_bytes?: number | undefined;
469
+ }[];
470
+ content?: string | undefined;
471
+ }, import("./router.js").Context, import("./router.js").RequestEndpointHandlerPayload<{
472
+ sync_rules: string;
473
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>, import("@powersync/lib-services-framework").EndpointHandler<import("./router.js").RequestEndpointHandlerPayload<{
474
+ sync_rules: string;
475
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>, {
476
+ errors: {
477
+ message: string;
478
+ level: "warning" | "fatal";
479
+ }[];
480
+ connections: {
481
+ id: string;
482
+ tag: string;
483
+ slot_name: string;
484
+ initial_replication_done: boolean;
485
+ tables: {
486
+ errors: {
487
+ message: string;
488
+ level: "warning" | "fatal";
489
+ }[];
490
+ name: string;
491
+ schema: string;
492
+ replication_id: string[];
493
+ data_queries: boolean;
494
+ parameter_queries: boolean;
495
+ pattern?: string | undefined;
496
+ }[];
497
+ last_checkpoint_ts?: string | undefined;
498
+ last_keepalive_ts?: string | undefined;
499
+ last_lsn?: string | undefined;
500
+ replication_lag_bytes?: number | undefined;
501
+ }[];
502
+ content?: string | undefined;
503
+ }>> & {
504
+ path: string;
505
+ method: import("@powersync/lib-services-framework").HTTPMethod.POST;
506
+ authorize: (payload: import("./router.js").RequestEndpointHandlerPayload) => {
507
+ authorized: boolean;
508
+ errors: string[];
509
+ } | {
510
+ authorized: boolean;
511
+ errors?: undefined;
512
+ };
513
+ validator: import("@powersync/lib-services-framework").MicroValidator<{
514
+ sync_rules: string;
515
+ }, string[]>;
516
+ handler: (payload: import("./router.js").RequestEndpointHandlerPayload<{
517
+ sync_rules: string;
518
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>) => Promise<{
519
+ errors: {
520
+ message: string;
521
+ level: "warning" | "fatal";
522
+ }[];
523
+ connections: {
524
+ id: string;
525
+ tag: string;
526
+ slot_name: string;
527
+ initial_replication_done: boolean;
528
+ tables: {
529
+ errors: {
530
+ message: string;
531
+ level: "warning" | "fatal";
532
+ }[];
533
+ name: string;
534
+ schema: string;
535
+ replication_id: string[];
536
+ data_queries: boolean;
537
+ parameter_queries: boolean;
538
+ pattern?: string | undefined;
539
+ }[];
540
+ last_checkpoint_ts?: string | undefined;
541
+ last_keepalive_ts?: string | undefined;
542
+ last_lsn?: string | undefined;
543
+ replication_lag_bytes?: number | undefined;
544
+ }[];
545
+ content?: string | undefined;
546
+ }>;
547
+ }) | (import("@powersync/lib-services-framework").Endpoint<{}, {
548
+ checkpoint: string;
549
+ }, import("./router.js").Context, import("./router.js").RequestEndpointHandlerPayload<{}, import("./router.js").Context, import("./router.js").BasicRouterRequest>, import("@powersync/lib-services-framework").EndpointHandler<import("./router.js").RequestEndpointHandlerPayload<{}, import("./router.js").Context, import("./router.js").BasicRouterRequest>, {
550
+ checkpoint: string;
551
+ }>> & {
552
+ path: string;
553
+ method: import("@powersync/lib-services-framework").HTTPMethod.GET;
554
+ authorize: (payload: import("./router.js").RequestEndpointHandlerPayload) => Promise<{
555
+ authorized: boolean;
556
+ errors: any[];
557
+ } | {
558
+ authorized: boolean;
559
+ errors?: undefined;
560
+ }>;
561
+ validator: import("@powersync/lib-services-framework").MicroValidator<{}, string[]>;
562
+ handler: (payload: import("./router.js").RequestEndpointHandlerPayload<{}, import("./router.js").Context, import("./router.js").BasicRouterRequest>) => Promise<{
563
+ checkpoint: string;
564
+ }>;
565
+ }) | (import("@powersync/lib-services-framework").Endpoint<{}, {
566
+ write_checkpoint: string;
567
+ }, import("./router.js").Context, import("./router.js").RequestEndpointHandlerPayload<{}, import("./router.js").Context, import("./router.js").BasicRouterRequest>, import("@powersync/lib-services-framework").EndpointHandler<import("./router.js").RequestEndpointHandlerPayload<{}, import("./router.js").Context, import("./router.js").BasicRouterRequest>, {
568
+ write_checkpoint: string;
569
+ }>> & {
570
+ path: string;
571
+ method: import("@powersync/lib-services-framework").HTTPMethod.GET;
572
+ authorize: (payload: import("./router.js").RequestEndpointHandlerPayload) => Promise<{
573
+ authorized: boolean;
574
+ errors: any[];
575
+ } | {
576
+ authorized: boolean;
577
+ errors?: undefined;
578
+ }>;
579
+ validator: import("@powersync/lib-services-framework").MicroValidator<{}, string[]>;
580
+ handler: (payload: import("./router.js").RequestEndpointHandlerPayload<{}, import("./router.js").Context, import("./router.js").BasicRouterRequest>) => Promise<{
581
+ write_checkpoint: string;
582
+ }>;
583
+ }) | (import("@powersync/lib-services-framework").Endpoint<{
584
+ password: string;
585
+ user: string;
586
+ }, {
587
+ token: string;
588
+ user_id: string;
589
+ }, import("./router.js").Context, import("./router.js").RequestEndpointHandlerPayload<{
590
+ password: string;
591
+ user: string;
592
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>, import("@powersync/lib-services-framework").EndpointHandler<import("./router.js").RequestEndpointHandlerPayload<{
593
+ password: string;
594
+ user: string;
595
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>, {
596
+ token: string;
597
+ user_id: string;
598
+ }>> & {
599
+ path: string;
600
+ method: import("@powersync/lib-services-framework").HTTPMethod.POST;
601
+ validator: import("@powersync/lib-services-framework").MicroValidator<{
602
+ password: string;
603
+ user: string;
604
+ }, string[]>;
605
+ handler: (payload: import("./router.js").RequestEndpointHandlerPayload<{
606
+ password: string;
607
+ user: string;
608
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>) => Promise<{
609
+ token: string;
610
+ user_id: string;
611
+ }>;
612
+ }) | (import("@powersync/lib-services-framework").Endpoint<{}, {
613
+ token: string;
614
+ user_id: string | undefined;
615
+ endpoint: string;
616
+ }, import("./router.js").Context, import("./router.js").RequestEndpointHandlerPayload<{}, import("./router.js").Context, import("./router.js").BasicRouterRequest>, import("@powersync/lib-services-framework").EndpointHandler<import("./router.js").RequestEndpointHandlerPayload<{}, import("./router.js").Context, import("./router.js").BasicRouterRequest>, {
617
+ token: string;
618
+ user_id: string | undefined;
619
+ endpoint: string;
620
+ }>> & {
621
+ path: string;
622
+ method: import("@powersync/lib-services-framework").HTTPMethod.POST;
623
+ validator: import("@powersync/lib-services-framework").MicroValidator<{}, string[]>;
624
+ authorize: (payload: import("./router.js").RequestEndpointHandlerPayload) => Promise<{
625
+ authorized: boolean;
626
+ errors: any[];
627
+ } | {
628
+ authorized: boolean;
629
+ errors?: undefined;
630
+ }>;
631
+ handler: (payload: import("./router.js").RequestEndpointHandlerPayload<{}, import("./router.js").Context, import("./router.js").BasicRouterRequest>) => Promise<{
632
+ token: string;
633
+ user_id: string | undefined;
634
+ endpoint: string;
635
+ }>;
636
+ }) | (import("@powersync/lib-services-framework").Endpoint<{
637
+ data: {
638
+ type: string;
639
+ id: string;
640
+ op: string;
641
+ data?: any;
642
+ op_id?: number | undefined;
643
+ }[];
644
+ write_checkpoint?: boolean | undefined;
645
+ }, {
646
+ write_checkpoint: string;
647
+ checkpoint?: undefined;
648
+ } | {
649
+ write_checkpoint?: undefined;
650
+ checkpoint?: undefined;
651
+ } | {
652
+ checkpoint: string;
653
+ write_checkpoint?: undefined;
654
+ }, import("./router.js").Context, import("./router.js").RequestEndpointHandlerPayload<{
655
+ data: {
656
+ type: string;
657
+ id: string;
658
+ op: string;
659
+ data?: any;
660
+ op_id?: number | undefined;
661
+ }[];
662
+ write_checkpoint?: boolean | undefined;
663
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>, import("@powersync/lib-services-framework").EndpointHandler<import("./router.js").RequestEndpointHandlerPayload<{
664
+ data: {
665
+ type: string;
666
+ id: string;
667
+ op: string;
668
+ data?: any;
669
+ op_id?: number | undefined;
670
+ }[];
671
+ write_checkpoint?: boolean | undefined;
672
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>, {
673
+ write_checkpoint: string;
674
+ checkpoint?: undefined;
675
+ } | {
676
+ write_checkpoint?: undefined;
677
+ checkpoint?: undefined;
678
+ } | {
679
+ checkpoint: string;
680
+ write_checkpoint?: undefined;
681
+ }>> & {
682
+ path: string;
683
+ method: import("@powersync/lib-services-framework").HTTPMethod.POST;
684
+ validator: import("@powersync/lib-services-framework").MicroValidator<{
685
+ data: {
686
+ type: string;
687
+ id: string;
688
+ op: string;
689
+ data?: any;
690
+ op_id?: number | undefined;
691
+ }[];
692
+ write_checkpoint?: boolean | undefined;
693
+ }, string[]>;
694
+ authorize: (payload: import("./router.js").RequestEndpointHandlerPayload) => Promise<{
695
+ authorized: boolean;
696
+ errors: any[];
697
+ } | {
698
+ authorized: boolean;
699
+ errors?: undefined;
700
+ }>;
701
+ handler: (payload: import("./router.js").RequestEndpointHandlerPayload<{
702
+ data: {
703
+ type: string;
704
+ id: string;
705
+ op: string;
706
+ data?: any;
707
+ op_id?: number | undefined;
708
+ }[];
709
+ write_checkpoint?: boolean | undefined;
710
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>) => Promise<{
711
+ write_checkpoint: string;
712
+ checkpoint?: undefined;
713
+ } | {
714
+ write_checkpoint?: undefined;
715
+ checkpoint?: undefined;
716
+ } | {
717
+ checkpoint: string;
718
+ write_checkpoint?: undefined;
719
+ }>;
720
+ }) | (import("@powersync/lib-services-framework").Endpoint<{
721
+ content: string;
722
+ }, {
723
+ slot_name: string;
724
+ }, import("./router.js").Context, import("./router.js").RequestEndpointHandlerPayload<{
725
+ content: string;
726
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>, import("@powersync/lib-services-framework").EndpointHandler<import("./router.js").RequestEndpointHandlerPayload<{
727
+ content: string;
728
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>, {
729
+ slot_name: string;
730
+ }>> & {
731
+ path: string;
732
+ method: import("@powersync/lib-services-framework").HTTPMethod.POST;
733
+ authorize: (payload: import("./router.js").RequestEndpointHandlerPayload) => {
734
+ authorized: boolean;
735
+ errors: string[];
736
+ } | {
737
+ authorized: boolean;
738
+ errors?: undefined;
739
+ };
740
+ parse: boolean;
741
+ plugins: fastify.FastifyPluginAsync[];
742
+ validator: import("@powersync/lib-services-framework").MicroValidator<{
743
+ content: string;
744
+ }, string[]>;
745
+ handler: (payload: import("./router.js").RequestEndpointHandlerPayload<{
746
+ content: string;
747
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>) => Promise<{
748
+ slot_name: string;
749
+ }>;
750
+ }) | (import("@powersync/lib-services-framework").Endpoint<{
751
+ content: string;
752
+ }, import("@powersync/lib-services-framework").RouterResponse<string>, import("./router.js").Context, import("./router.js").RequestEndpointHandlerPayload<{
753
+ content: string;
754
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>, import("@powersync/lib-services-framework").EndpointHandler<import("./router.js").RequestEndpointHandlerPayload<{
755
+ content: string;
756
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>, import("@powersync/lib-services-framework").RouterResponse<string>>> & {
757
+ path: string;
758
+ method: import("@powersync/lib-services-framework").HTTPMethod.POST;
759
+ authorize: (payload: import("./router.js").RequestEndpointHandlerPayload) => {
760
+ authorized: boolean;
761
+ errors: string[];
762
+ } | {
763
+ authorized: boolean;
764
+ errors?: undefined;
765
+ };
766
+ parse: boolean;
767
+ plugins: fastify.FastifyPluginAsync[];
768
+ validator: import("@powersync/lib-services-framework").MicroValidator<{
769
+ content: string;
770
+ }, string[]>;
771
+ handler: (payload: import("./router.js").RequestEndpointHandlerPayload<{
772
+ content: string;
773
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>) => Promise<import("@powersync/lib-services-framework").RouterResponse<string>>;
774
+ }) | (import("@powersync/lib-services-framework").Endpoint<any, import("@powersync/lib-services-framework").RouterResponse<string>, import("./router.js").Context, import("./router.js").RequestEndpointHandlerPayload<any, import("./router.js").Context, import("./router.js").BasicRouterRequest>, import("@powersync/lib-services-framework").EndpointHandler<import("./router.js").RequestEndpointHandlerPayload<any, import("./router.js").Context, import("./router.js").BasicRouterRequest>, import("@powersync/lib-services-framework").RouterResponse<string>>> & {
775
+ path: string;
776
+ method: import("@powersync/lib-services-framework").HTTPMethod.GET;
777
+ authorize: (payload: import("./router.js").RequestEndpointHandlerPayload) => {
778
+ authorized: boolean;
779
+ errors: string[];
780
+ } | {
781
+ authorized: boolean;
782
+ errors?: undefined;
783
+ };
784
+ handler: (payload: import("./router.js").RequestEndpointHandlerPayload<any, import("./router.js").Context, import("./router.js").BasicRouterRequest>) => Promise<import("@powersync/lib-services-framework").RouterResponse<string>>;
785
+ }) | (import("@powersync/lib-services-framework").Endpoint<{}, {
786
+ slot_name: string;
787
+ }, import("./router.js").Context, import("./router.js").RequestEndpointHandlerPayload<{}, import("./router.js").Context, import("./router.js").BasicRouterRequest>, import("@powersync/lib-services-framework").EndpointHandler<import("./router.js").RequestEndpointHandlerPayload<{}, import("./router.js").Context, import("./router.js").BasicRouterRequest>, {
788
+ slot_name: string;
789
+ }>> & {
790
+ path: string;
791
+ method: import("@powersync/lib-services-framework").HTTPMethod.POST;
792
+ authorize: (payload: import("./router.js").RequestEndpointHandlerPayload) => {
793
+ authorized: boolean;
794
+ errors: string[];
795
+ } | {
796
+ authorized: boolean;
797
+ errors?: undefined;
798
+ };
799
+ validator: import("@powersync/lib-services-framework").MicroValidator<{}, string[]>;
800
+ handler: (payload: import("./router.js").RequestEndpointHandlerPayload<{}, import("./router.js").Context, import("./router.js").BasicRouterRequest>) => Promise<{
801
+ slot_name: string;
802
+ }>;
803
+ }))[];
804
+ queueOptions: {
805
+ concurrency: number;
806
+ max_queue_depth: number;
807
+ };
808
+ };
809
+ syncStream: {
810
+ routes: (import("@powersync/lib-services-framework").Endpoint<{
811
+ parameters?: Record<string, any> | undefined;
812
+ buckets?: {
813
+ name: string;
814
+ after: string;
815
+ }[] | undefined;
816
+ only?: string[] | undefined;
817
+ include_checksum?: boolean | undefined;
818
+ raw_data?: boolean | undefined;
819
+ binary_data?: boolean | undefined;
820
+ }, import("@powersync/lib-services-framework").RouterResponse<import("stream").Readable> | undefined, import("./router.js").Context, import("./router.js").RequestEndpointHandlerPayload<{
821
+ parameters?: Record<string, any> | undefined;
822
+ buckets?: {
823
+ name: string;
824
+ after: string;
825
+ }[] | undefined;
826
+ only?: string[] | undefined;
827
+ include_checksum?: boolean | undefined;
828
+ raw_data?: boolean | undefined;
829
+ binary_data?: boolean | undefined;
830
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>, import("@powersync/lib-services-framework").EndpointHandler<import("./router.js").RequestEndpointHandlerPayload<{
831
+ parameters?: Record<string, any> | undefined;
832
+ buckets?: {
833
+ name: string;
834
+ after: string;
835
+ }[] | undefined;
836
+ only?: string[] | undefined;
837
+ include_checksum?: boolean | undefined;
838
+ raw_data?: boolean | undefined;
839
+ binary_data?: boolean | undefined;
840
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>, import("@powersync/lib-services-framework").RouterResponse<import("stream").Readable> | undefined>> & {
841
+ path: import("./endpoints/sync-stream.js").SyncRoutes;
842
+ method: import("@powersync/lib-services-framework").HTTPMethod.POST;
843
+ authorize: (payload: import("./router.js").RequestEndpointHandlerPayload) => Promise<{
844
+ authorized: boolean;
845
+ errors: any[];
846
+ } | {
847
+ authorized: boolean;
848
+ errors?: undefined;
849
+ }>;
850
+ validator: import("@powersync/lib-services-framework").MicroValidator<{
851
+ parameters?: Record<string, any> | undefined;
852
+ buckets?: {
853
+ name: string;
854
+ after: string;
855
+ }[] | undefined;
856
+ only?: string[] | undefined;
857
+ include_checksum?: boolean | undefined;
858
+ raw_data?: boolean | undefined;
859
+ binary_data?: boolean | undefined;
860
+ }, string[]>;
861
+ handler: (payload: import("./router.js").RequestEndpointHandlerPayload<{
862
+ parameters?: Record<string, any> | undefined;
863
+ buckets?: {
864
+ name: string;
865
+ after: string;
866
+ }[] | undefined;
867
+ only?: string[] | undefined;
868
+ include_checksum?: boolean | undefined;
869
+ raw_data?: boolean | undefined;
870
+ binary_data?: boolean | undefined;
871
+ }, import("./router.js").Context, import("./router.js").BasicRouterRequest>) => Promise<import("@powersync/lib-services-framework").RouterResponse<import("stream").Readable> | undefined>;
872
+ })[];
873
+ queueOptions: {
874
+ concurrency: number;
875
+ max_queue_depth: number;
876
+ };
877
+ };
878
+ };
879
+ /**
880
+ * Registers default routes on a Fastify server. Consumers can optionally configure
881
+ * concurrency queue limits or override routes.
882
+ */
883
+ export declare function configureFastifyServer(server: fastify.FastifyInstance, options: FastifyServerConfig): void;