@powersync/service-core 0.6.0 → 0.7.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 +12 -0
- package/dist/routes/configure-fastify.d.ts +0 -171
- package/dist/routes/configure-fastify.js +1 -2
- package/dist/routes/configure-fastify.js.map +1 -1
- package/dist/routes/endpoints/admin.d.ts +0 -34
- package/dist/routes/endpoints/admin.js +2 -22
- package/dist/routes/endpoints/admin.js.map +1 -1
- package/dist/routes/endpoints/route-endpoints-index.d.ts +0 -1
- package/dist/routes/endpoints/route-endpoints-index.js +0 -1
- package/dist/routes/endpoints/route-endpoints-index.js.map +1 -1
- package/package.json +4 -4
- package/src/routes/configure-fastify.ts +1 -2
- package/src/routes/endpoints/admin.ts +2 -24
- package/src/routes/endpoints/route-endpoints-index.ts +0 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/routes/endpoints/dev.d.ts +0 -312
- package/dist/routes/endpoints/dev.js +0 -172
- package/dist/routes/endpoints/dev.js.map +0 -1
- package/src/routes/endpoints/dev.ts +0 -199
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @powersync/service-core
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- c9ad713: Removed unused development routes
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [c9ad713]
|
|
12
|
+
- @powersync/service-types@0.2.0
|
|
13
|
+
- @powersync/service-jpgwire@0.17.14
|
|
14
|
+
|
|
3
15
|
## 0.6.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -26,40 +26,6 @@ export type FastifyServerConfig = {
|
|
|
26
26
|
export declare const DEFAULT_ROUTE_OPTIONS: {
|
|
27
27
|
api: {
|
|
28
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
29
|
sql: {
|
|
64
30
|
query: string;
|
|
65
31
|
args: (string | number | boolean)[];
|
|
@@ -580,143 +546,6 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
|
|
|
580
546
|
handler: (payload: import("./router.js").RequestEndpointHandlerPayload<{}, import("./router.js").Context, import("./router.js").BasicRouterRequest>) => Promise<{
|
|
581
547
|
write_checkpoint: string;
|
|
582
548
|
}>;
|
|
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
549
|
}) | (import("@powersync/lib-services-framework").Endpoint<{
|
|
721
550
|
content: string;
|
|
722
551
|
}, {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { registerFastifyRoutes } from './route-register.js';
|
|
2
2
|
import { ADMIN_ROUTES } from './endpoints/admin.js';
|
|
3
3
|
import { CHECKPOINT_ROUTES } from './endpoints/checkpointing.js';
|
|
4
|
-
import { DEV_ROUTES } from './endpoints/dev.js';
|
|
5
4
|
import { SYNC_RULES_ROUTES } from './endpoints/sync-rules.js';
|
|
6
5
|
import { SYNC_STREAM_ROUTES } from './endpoints/sync-stream.js';
|
|
7
6
|
import { createRequestQueueHook } from './hooks.js';
|
|
8
7
|
export const DEFAULT_ROUTE_OPTIONS = {
|
|
9
8
|
api: {
|
|
10
|
-
routes: [...ADMIN_ROUTES, ...CHECKPOINT_ROUTES, ...
|
|
9
|
+
routes: [...ADMIN_ROUTES, ...CHECKPOINT_ROUTES, ...SYNC_RULES_ROUTES],
|
|
11
10
|
queueOptions: {
|
|
12
11
|
concurrency: 10,
|
|
13
12
|
max_queue_depth: 20
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure-fastify.js","sourceRoot":"","sources":["../../src/routes/configure-fastify.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAI5D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"configure-fastify.js","sourceRoot":"","sources":["../../src/routes/config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IAAI,qBAAqB,CAAC,GAAG,CAAC,YAAY,CAAC,CAC3F,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,qDAAqD;IACrD,MAAM,CAAC,QAAQ,CAAC,KAAK,WAAW,YAAY;QAC1C,qBAAqB,CACnB,YAAY,EACZ,KAAK,IAAI,EAAE;YACT,OAAO;gBACL,OAAO,EAAE,SAAS;gBAClB,MAAM,EAAE,MAAM;aACf,CAAC;QACJ,CAAC,EACD,MAAM,CAAC,UAAU,EAAE,MAAM,IAAI,qBAAqB,CAAC,UAAU,CAAC,MAAM,CACrE,CAAC;QACF,uCAAuC;QACvC,YAAY,CAAC,OAAO,CAClB,WAAW,EACX,sBAAsB,CAAC,MAAM,CAAC,UAAU,EAAE,YAAY,IAAI,qBAAqB,CAAC,UAAU,CAAC,YAAY,CAAC,CACzG,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -490,40 +490,6 @@ export declare const validate: router.Endpoint<{
|
|
|
490
490
|
}>;
|
|
491
491
|
};
|
|
492
492
|
export declare const ADMIN_ROUTES: ((router.Endpoint<{
|
|
493
|
-
connection_id?: string | undefined;
|
|
494
|
-
}, {
|
|
495
|
-
credentials?: {
|
|
496
|
-
postgres_uri: string;
|
|
497
|
-
} | undefined;
|
|
498
|
-
}, import("../router.js").Context, import("../router.js").RequestEndpointHandlerPayload<{
|
|
499
|
-
connection_id?: string | undefined;
|
|
500
|
-
}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, router.EndpointHandler<import("../router.js").RequestEndpointHandlerPayload<{
|
|
501
|
-
connection_id?: string | undefined;
|
|
502
|
-
}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, {
|
|
503
|
-
credentials?: {
|
|
504
|
-
postgres_uri: string;
|
|
505
|
-
} | undefined;
|
|
506
|
-
}>> & {
|
|
507
|
-
path: string;
|
|
508
|
-
method: router.HTTPMethod.POST;
|
|
509
|
-
authorize: (payload: import("../router.js").RequestEndpointHandlerPayload) => {
|
|
510
|
-
authorized: boolean;
|
|
511
|
-
errors: string[];
|
|
512
|
-
} | {
|
|
513
|
-
authorized: boolean;
|
|
514
|
-
errors?: undefined;
|
|
515
|
-
};
|
|
516
|
-
validator: schema.MicroValidator<{
|
|
517
|
-
connection_id?: string | undefined;
|
|
518
|
-
}, string[]>;
|
|
519
|
-
handler: (payload: import("../router.js").RequestEndpointHandlerPayload<{
|
|
520
|
-
connection_id?: string | undefined;
|
|
521
|
-
}, import("../router.js").Context, import("../router.js").BasicRouterRequest>) => Promise<{
|
|
522
|
-
credentials?: {
|
|
523
|
-
postgres_uri: string;
|
|
524
|
-
} | undefined;
|
|
525
|
-
}>;
|
|
526
|
-
}) | (router.Endpoint<{
|
|
527
493
|
sql: {
|
|
528
494
|
query: string;
|
|
529
495
|
args: (string | number | boolean)[];
|
|
@@ -3,28 +3,8 @@ import { SqlSyncRules, StaticSchema, isJsonValue, toSyncRulesValue } from '@powe
|
|
|
3
3
|
import { internal_routes } from '@powersync/service-types';
|
|
4
4
|
import * as api from '../../api/api-index.js';
|
|
5
5
|
import * as util from '../../util/util-index.js';
|
|
6
|
-
import { routeDefinition } from '../router.js';
|
|
7
6
|
import { authApi } from '../auth.js';
|
|
8
|
-
|
|
9
|
-
path: '/api/admin/v1/demo-credentials',
|
|
10
|
-
method: router.HTTPMethod.POST,
|
|
11
|
-
authorize: authApi,
|
|
12
|
-
validator: schema.createTsCodecValidator(internal_routes.DemoCredentialsRequest, {
|
|
13
|
-
allowAdditional: true
|
|
14
|
-
}),
|
|
15
|
-
handler: async (payload) => {
|
|
16
|
-
const connection = payload.context.system.config.connection;
|
|
17
|
-
if (connection == null || !connection.demo_database) {
|
|
18
|
-
return internal_routes.DemoCredentialsResponse.encode({});
|
|
19
|
-
}
|
|
20
|
-
const uri = util.buildDemoPgUri(connection);
|
|
21
|
-
return internal_routes.DemoCredentialsResponse.encode({
|
|
22
|
-
credentials: {
|
|
23
|
-
postgres_uri: uri
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
});
|
|
7
|
+
import { routeDefinition } from '../router.js';
|
|
28
8
|
export const executeSql = routeDefinition({
|
|
29
9
|
path: '/api/admin/v1/execute-sql',
|
|
30
10
|
method: router.HTTPMethod.POST,
|
|
@@ -203,5 +183,5 @@ function mapColumnValue(value) {
|
|
|
203
183
|
return null;
|
|
204
184
|
}
|
|
205
185
|
}
|
|
206
|
-
export const ADMIN_ROUTES = [
|
|
186
|
+
export const ADMIN_ROUTES = [executeSql, diagnostics, getSchema, reprocess, validate];
|
|
207
187
|
//# sourceMappingURL=admin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../../../src/routes/endpoints/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAe,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACvH,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,KAAK,GAAG,MAAM,wBAAwB,CAAC;AAC9C,OAAO,KAAK,IAAI,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../../../src/routes/endpoints/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAe,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACvH,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,KAAK,GAAG,MAAM,wBAAwB,CAAC;AAC9C,OAAO,KAAK,IAAI,MAAM,0BAA0B,CAAC;AAGjD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,O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C,UAAU,EAAE,MAAM,EAAE;YAC/D,eAAe,EAAE,KAAK;YACtB,gBAAgB,EAAE,gBAAgB,EAAE,SAAS;YAC7C,WAAW,EAAE,KAAK;SACnB,CAAC,CAAE,CAAC;QAEL,IAAI,gBAAgB,IAAI,IAAI,EAAE;YAC5B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,0BAA0B,EAAE,CAAC,CAAC;SAC7E;QAED,OAAO,eAAe,CAAC,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACzD,CAAC;CACF,CAAC,CAAC;AAEH,SAAS,cAAc,CAAC,KAAkB;IACxC,IAAI,OAAO,KAAK,IAAI,QAAQ,EAAE;QAC5B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;KACtB;SAAM,IAAI,WAAW,CAAC,KAAK,CAAC,EAAE;QAC7B,OAAO,KAAK,CAAC;KACd;SAAM;QACL,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-endpoints-index.js","sourceRoot":"","sources":["../../../src/routes/endpoints/route-endpoints-index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"route-endpoints-index.js","sourceRoot":"","sources":["../../../src/routes/endpoints/route-endpoints-index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
|
-
"version": "0.
|
|
8
|
+
"version": "0.7.0",
|
|
9
9
|
"main": "dist/index.js",
|
|
10
10
|
"license": "FSL-1.1-Apache-2.0",
|
|
11
11
|
"type": "module",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"winston": "^3.13.0",
|
|
35
35
|
"yaml": "^2.3.2",
|
|
36
36
|
"@powersync/lib-services-framework": "0.1.1",
|
|
37
|
+
"@powersync/service-jpgwire": "0.17.14",
|
|
37
38
|
"@powersync/service-jsonbig": "0.17.10",
|
|
38
|
-
"@powersync/service-jpgwire": "0.17.13",
|
|
39
|
-
"@powersync/service-sync-rules": "0.18.1",
|
|
40
39
|
"@powersync/service-rsocket-router": "0.0.10",
|
|
41
|
-
"@powersync/service-
|
|
40
|
+
"@powersync/service-sync-rules": "0.18.1",
|
|
41
|
+
"@powersync/service-types": "0.2.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/async": "^3.2.24",
|
|
@@ -5,7 +5,6 @@ import * as system from '../system/system-index.js';
|
|
|
5
5
|
|
|
6
6
|
import { ADMIN_ROUTES } from './endpoints/admin.js';
|
|
7
7
|
import { CHECKPOINT_ROUTES } from './endpoints/checkpointing.js';
|
|
8
|
-
import { DEV_ROUTES } from './endpoints/dev.js';
|
|
9
8
|
import { SYNC_RULES_ROUTES } from './endpoints/sync-rules.js';
|
|
10
9
|
import { SYNC_STREAM_ROUTES } from './endpoints/sync-stream.js';
|
|
11
10
|
import { createRequestQueueHook, CreateRequestQueueParams } from './hooks.js';
|
|
@@ -36,7 +35,7 @@ export type FastifyServerConfig = {
|
|
|
36
35
|
|
|
37
36
|
export const DEFAULT_ROUTE_OPTIONS = {
|
|
38
37
|
api: {
|
|
39
|
-
routes: [...ADMIN_ROUTES, ...CHECKPOINT_ROUTES, ...
|
|
38
|
+
routes: [...ADMIN_ROUTES, ...CHECKPOINT_ROUTES, ...SYNC_RULES_ROUTES],
|
|
40
39
|
queueOptions: {
|
|
41
40
|
concurrency: 10,
|
|
42
41
|
max_queue_depth: 20
|
|
@@ -5,31 +5,9 @@ import { internal_routes } from '@powersync/service-types';
|
|
|
5
5
|
import * as api from '../../api/api-index.js';
|
|
6
6
|
import * as util from '../../util/util-index.js';
|
|
7
7
|
|
|
8
|
-
import { routeDefinition } from '../router.js';
|
|
9
8
|
import { PersistedSyncRulesContent } from '../../storage/BucketStorage.js';
|
|
10
9
|
import { authApi } from '../auth.js';
|
|
11
|
-
|
|
12
|
-
const demoCredentials = routeDefinition({
|
|
13
|
-
path: '/api/admin/v1/demo-credentials',
|
|
14
|
-
method: router.HTTPMethod.POST,
|
|
15
|
-
authorize: authApi,
|
|
16
|
-
validator: schema.createTsCodecValidator(internal_routes.DemoCredentialsRequest, {
|
|
17
|
-
allowAdditional: true
|
|
18
|
-
}),
|
|
19
|
-
handler: async (payload) => {
|
|
20
|
-
const connection = payload.context.system.config.connection;
|
|
21
|
-
if (connection == null || !connection.demo_database) {
|
|
22
|
-
return internal_routes.DemoCredentialsResponse.encode({});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const uri = util.buildDemoPgUri(connection);
|
|
26
|
-
return internal_routes.DemoCredentialsResponse.encode({
|
|
27
|
-
credentials: {
|
|
28
|
-
postgres_uri: uri
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
});
|
|
10
|
+
import { routeDefinition } from '../router.js';
|
|
33
11
|
|
|
34
12
|
export const executeSql = routeDefinition({
|
|
35
13
|
path: '/api/admin/v1/execute-sql',
|
|
@@ -234,4 +212,4 @@ function mapColumnValue(value: SqliteValue) {
|
|
|
234
212
|
}
|
|
235
213
|
}
|
|
236
214
|
|
|
237
|
-
export const ADMIN_ROUTES = [
|
|
215
|
+
export const ADMIN_ROUTES = [executeSql, diagnostics, getSchema, reprocess, validate];
|