@powersync/service-core 1.15.3 → 1.15.4
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 +11 -0
- package/dist/routes/configure-fastify.d.ts +5 -5
- package/dist/routes/endpoints/sync-stream.d.ts +10 -10
- package/dist/util/protocol-types.d.ts +4 -4
- package/dist/util/protocol-types.js +1 -1
- package/dist/util/protocol-types.js.map +1 -1
- package/package.json +5 -5
- package/src/util/protocol-types.ts +2 -2
- package/test/src/util/protocol_types.test.ts +43 -0
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @powersync/service-core
|
|
2
2
|
|
|
3
|
+
## 1.15.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a2b8bb0: Avoid frequent write checkpoint lookups when the user does not have one.
|
|
8
|
+
- f400b0f: Protocol: Allow `null` as stream parameter.
|
|
9
|
+
- Updated dependencies [17aae6d]
|
|
10
|
+
- @powersync/service-sync-rules@0.29.2
|
|
11
|
+
- @powersync/lib-services-framework@0.7.5
|
|
12
|
+
- @powersync/service-rsocket-router@0.2.2
|
|
13
|
+
|
|
3
14
|
## 1.15.3
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -686,9 +686,9 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
|
|
|
686
686
|
client_id?: string | undefined;
|
|
687
687
|
streams?: {
|
|
688
688
|
subscriptions: {
|
|
689
|
+
parameters: Record<string, any> | null;
|
|
689
690
|
stream: string;
|
|
690
691
|
override_priority: number | null;
|
|
691
|
-
parameters?: Record<string, any> | undefined;
|
|
692
692
|
}[];
|
|
693
693
|
include_defaults?: boolean | undefined;
|
|
694
694
|
} | undefined;
|
|
@@ -704,9 +704,9 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
|
|
|
704
704
|
client_id?: string | undefined;
|
|
705
705
|
streams?: {
|
|
706
706
|
subscriptions: {
|
|
707
|
+
parameters: Record<string, any> | null;
|
|
707
708
|
stream: string;
|
|
708
709
|
override_priority: number | null;
|
|
709
|
-
parameters?: Record<string, any> | undefined;
|
|
710
710
|
}[];
|
|
711
711
|
include_defaults?: boolean | undefined;
|
|
712
712
|
} | undefined;
|
|
@@ -722,9 +722,9 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
|
|
|
722
722
|
client_id?: string | undefined;
|
|
723
723
|
streams?: {
|
|
724
724
|
subscriptions: {
|
|
725
|
+
parameters: Record<string, any> | null;
|
|
725
726
|
stream: string;
|
|
726
727
|
override_priority: number | null;
|
|
727
|
-
parameters?: Record<string, any> | undefined;
|
|
728
728
|
}[];
|
|
729
729
|
include_defaults?: boolean | undefined;
|
|
730
730
|
} | undefined;
|
|
@@ -744,9 +744,9 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
|
|
|
744
744
|
client_id?: string | undefined;
|
|
745
745
|
streams?: {
|
|
746
746
|
subscriptions: {
|
|
747
|
+
parameters: Record<string, any> | null;
|
|
747
748
|
stream: string;
|
|
748
749
|
override_priority: number | null;
|
|
749
|
-
parameters?: Record<string, any> | undefined;
|
|
750
750
|
}[];
|
|
751
751
|
include_defaults?: boolean | undefined;
|
|
752
752
|
} | undefined;
|
|
@@ -763,9 +763,9 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
|
|
|
763
763
|
client_id?: string | undefined;
|
|
764
764
|
streams?: {
|
|
765
765
|
subscriptions: {
|
|
766
|
+
parameters: Record<string, any> | null;
|
|
766
767
|
stream: string;
|
|
767
768
|
override_priority: number | null;
|
|
768
|
-
parameters?: Record<string, any> | undefined;
|
|
769
769
|
}[];
|
|
770
770
|
include_defaults?: boolean | undefined;
|
|
771
771
|
} | undefined;
|
|
@@ -15,9 +15,9 @@ export declare const syncStreamed: router.Endpoint<{
|
|
|
15
15
|
client_id?: string | undefined;
|
|
16
16
|
streams?: {
|
|
17
17
|
subscriptions: {
|
|
18
|
+
parameters: Record<string, any> | null;
|
|
18
19
|
stream: string;
|
|
19
20
|
override_priority: number | null;
|
|
20
|
-
parameters?: Record<string, any> | undefined;
|
|
21
21
|
}[];
|
|
22
22
|
include_defaults?: boolean | undefined;
|
|
23
23
|
} | undefined;
|
|
@@ -33,9 +33,9 @@ export declare const syncStreamed: router.Endpoint<{
|
|
|
33
33
|
client_id?: string | undefined;
|
|
34
34
|
streams?: {
|
|
35
35
|
subscriptions: {
|
|
36
|
+
parameters: Record<string, any> | null;
|
|
36
37
|
stream: string;
|
|
37
38
|
override_priority: number | null;
|
|
38
|
-
parameters?: Record<string, any> | undefined;
|
|
39
39
|
}[];
|
|
40
40
|
include_defaults?: boolean | undefined;
|
|
41
41
|
} | undefined;
|
|
@@ -51,9 +51,9 @@ export declare const syncStreamed: router.Endpoint<{
|
|
|
51
51
|
client_id?: string | undefined;
|
|
52
52
|
streams?: {
|
|
53
53
|
subscriptions: {
|
|
54
|
+
parameters: Record<string, any> | null;
|
|
54
55
|
stream: string;
|
|
55
56
|
override_priority: number | null;
|
|
56
|
-
parameters?: Record<string, any> | undefined;
|
|
57
57
|
}[];
|
|
58
58
|
include_defaults?: boolean | undefined;
|
|
59
59
|
} | undefined;
|
|
@@ -73,9 +73,9 @@ export declare const syncStreamed: router.Endpoint<{
|
|
|
73
73
|
client_id?: string | undefined;
|
|
74
74
|
streams?: {
|
|
75
75
|
subscriptions: {
|
|
76
|
+
parameters: Record<string, any> | null;
|
|
76
77
|
stream: string;
|
|
77
78
|
override_priority: number | null;
|
|
78
|
-
parameters?: Record<string, any> | undefined;
|
|
79
79
|
}[];
|
|
80
80
|
include_defaults?: boolean | undefined;
|
|
81
81
|
} | undefined;
|
|
@@ -92,9 +92,9 @@ export declare const syncStreamed: router.Endpoint<{
|
|
|
92
92
|
client_id?: string | undefined;
|
|
93
93
|
streams?: {
|
|
94
94
|
subscriptions: {
|
|
95
|
+
parameters: Record<string, any> | null;
|
|
95
96
|
stream: string;
|
|
96
97
|
override_priority: number | null;
|
|
97
|
-
parameters?: Record<string, any> | undefined;
|
|
98
98
|
}[];
|
|
99
99
|
include_defaults?: boolean | undefined;
|
|
100
100
|
} | undefined;
|
|
@@ -112,9 +112,9 @@ export declare const SYNC_STREAM_ROUTES: (router.Endpoint<{
|
|
|
112
112
|
client_id?: string | undefined;
|
|
113
113
|
streams?: {
|
|
114
114
|
subscriptions: {
|
|
115
|
+
parameters: Record<string, any> | null;
|
|
115
116
|
stream: string;
|
|
116
117
|
override_priority: number | null;
|
|
117
|
-
parameters?: Record<string, any> | undefined;
|
|
118
118
|
}[];
|
|
119
119
|
include_defaults?: boolean | undefined;
|
|
120
120
|
} | undefined;
|
|
@@ -130,9 +130,9 @@ export declare const SYNC_STREAM_ROUTES: (router.Endpoint<{
|
|
|
130
130
|
client_id?: string | undefined;
|
|
131
131
|
streams?: {
|
|
132
132
|
subscriptions: {
|
|
133
|
+
parameters: Record<string, any> | null;
|
|
133
134
|
stream: string;
|
|
134
135
|
override_priority: number | null;
|
|
135
|
-
parameters?: Record<string, any> | undefined;
|
|
136
136
|
}[];
|
|
137
137
|
include_defaults?: boolean | undefined;
|
|
138
138
|
} | undefined;
|
|
@@ -148,9 +148,9 @@ export declare const SYNC_STREAM_ROUTES: (router.Endpoint<{
|
|
|
148
148
|
client_id?: string | undefined;
|
|
149
149
|
streams?: {
|
|
150
150
|
subscriptions: {
|
|
151
|
+
parameters: Record<string, any> | null;
|
|
151
152
|
stream: string;
|
|
152
153
|
override_priority: number | null;
|
|
153
|
-
parameters?: Record<string, any> | undefined;
|
|
154
154
|
}[];
|
|
155
155
|
include_defaults?: boolean | undefined;
|
|
156
156
|
} | undefined;
|
|
@@ -170,9 +170,9 @@ export declare const SYNC_STREAM_ROUTES: (router.Endpoint<{
|
|
|
170
170
|
client_id?: string | undefined;
|
|
171
171
|
streams?: {
|
|
172
172
|
subscriptions: {
|
|
173
|
+
parameters: Record<string, any> | null;
|
|
173
174
|
stream: string;
|
|
174
175
|
override_priority: number | null;
|
|
175
|
-
parameters?: Record<string, any> | undefined;
|
|
176
176
|
}[];
|
|
177
177
|
include_defaults?: boolean | undefined;
|
|
178
178
|
} | undefined;
|
|
@@ -189,9 +189,9 @@ export declare const SYNC_STREAM_ROUTES: (router.Endpoint<{
|
|
|
189
189
|
client_id?: string | undefined;
|
|
190
190
|
streams?: {
|
|
191
191
|
subscriptions: {
|
|
192
|
+
parameters: Record<string, any> | null;
|
|
192
193
|
stream: string;
|
|
193
194
|
override_priority: number | null;
|
|
194
|
-
parameters?: Record<string, any> | undefined;
|
|
195
195
|
}[];
|
|
196
196
|
include_defaults?: boolean | undefined;
|
|
197
197
|
} | undefined;
|
|
@@ -20,7 +20,7 @@ export declare const RequestedStreamSubscription: t.ObjectCodec<{
|
|
|
20
20
|
/**
|
|
21
21
|
* An optional dictionary of parameters to pass to this specific stream.
|
|
22
22
|
*/
|
|
23
|
-
parameters: t.
|
|
23
|
+
parameters: t.Union<t.RecordCodec<t.Codec<any, any, t.CodecType.Any, t.CodecProps>>, t.Codec<null, null, t.CodecType.Null, t.CodecProps>>;
|
|
24
24
|
/**
|
|
25
25
|
* Set when the client wishes to re-assign a different priority to this stream.
|
|
26
26
|
*
|
|
@@ -51,7 +51,7 @@ export declare const StreamSubscriptionRequest: t.ObjectCodec<{
|
|
|
51
51
|
/**
|
|
52
52
|
* An optional dictionary of parameters to pass to this specific stream.
|
|
53
53
|
*/
|
|
54
|
-
parameters: t.
|
|
54
|
+
parameters: t.Union<t.RecordCodec<t.Codec<any, any, t.CodecType.Any, t.CodecProps>>, t.Codec<null, null, t.CodecType.Null, t.CodecProps>>;
|
|
55
55
|
/**
|
|
56
56
|
* Set when the client wishes to re-assign a different priority to this stream.
|
|
57
57
|
*
|
|
@@ -98,16 +98,16 @@ export declare const StreamingSyncRequest: t.ObjectCodec<{
|
|
|
98
98
|
*/
|
|
99
99
|
streams: t.OptionalCodec<t.Codec<{
|
|
100
100
|
subscriptions: {
|
|
101
|
+
parameters: Record<string, any> | null;
|
|
101
102
|
stream: string;
|
|
102
103
|
override_priority: number | null;
|
|
103
|
-
parameters?: Record<string, any> | undefined;
|
|
104
104
|
}[];
|
|
105
105
|
include_defaults?: boolean | undefined;
|
|
106
106
|
}, {
|
|
107
107
|
subscriptions: {
|
|
108
|
+
parameters: Record<string, any> | null;
|
|
108
109
|
stream: string;
|
|
109
110
|
override_priority: number | null;
|
|
110
|
-
parameters?: Record<string, any> | undefined;
|
|
111
111
|
}[];
|
|
112
112
|
include_defaults?: boolean | undefined;
|
|
113
113
|
}, string, t.CodecProps>>;
|
|
@@ -17,7 +17,7 @@ export const RequestedStreamSubscription = t.object({
|
|
|
17
17
|
/**
|
|
18
18
|
* An optional dictionary of parameters to pass to this specific stream.
|
|
19
19
|
*/
|
|
20
|
-
parameters: t.record(t.any).
|
|
20
|
+
parameters: t.union(t.record(t.any), t.Null),
|
|
21
21
|
/**
|
|
22
22
|
* Set when the client wishes to re-assign a different priority to this stream.
|
|
23
23
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol-types.js","sourceRoot":"","sources":["../../src/util/protocol-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAI9B,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,IAAI,EAAE,CAAC,CAAC,MAAM;IAEd;;OAEG;IACH,KAAK,EAAE,CAAC,CAAC,MAAM;CAChB,CAAC,CAAC;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD;;OAEG;IACH,MAAM,EAAE,CAAC,CAAC,MAAM;IAChB;;OAEG;IACH,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"protocol-types.js","sourceRoot":"","sources":["../../src/util/protocol-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,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AAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IAEtC;;OAEG;IACH,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE;IAE9B;;OAEG;IACH,OAAO,EAAE,yBAAyB,CAAC,QAAQ,EAAE;CAC9C,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
|
-
"version": "1.15.
|
|
8
|
+
"version": "1.15.4",
|
|
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.
|
|
36
|
+
"@powersync/lib-services-framework": "0.7.5",
|
|
37
37
|
"@powersync/service-jsonbig": "0.17.11",
|
|
38
|
-
"@powersync/service-rsocket-router": "0.2.
|
|
39
|
-
"@powersync/service-
|
|
40
|
-
"@powersync/service-
|
|
38
|
+
"@powersync/service-rsocket-router": "0.2.2",
|
|
39
|
+
"@powersync/service-types": "0.13.0",
|
|
40
|
+
"@powersync/service-sync-rules": "0.29.2"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/async": "^3.2.24",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as t from 'ts-codec';
|
|
2
|
-
import {
|
|
2
|
+
import { BucketPriority, SqliteJsonRow } from '@powersync/service-sync-rules';
|
|
3
3
|
import { JsonContainer } from '@powersync/service-jsonbig';
|
|
4
4
|
|
|
5
5
|
export const BucketRequest = t.object({
|
|
@@ -24,7 +24,7 @@ export const RequestedStreamSubscription = t.object({
|
|
|
24
24
|
/**
|
|
25
25
|
* An optional dictionary of parameters to pass to this specific stream.
|
|
26
26
|
*/
|
|
27
|
-
parameters: t.record(t.any).
|
|
27
|
+
parameters: t.union(t.record(t.any), t.Null),
|
|
28
28
|
/**
|
|
29
29
|
* Set when the client wishes to re-assign a different priority to this stream.
|
|
30
30
|
*
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { StreamingSyncRequest } from '@/index.js';
|
|
2
|
+
import { schema } from '@powersync/lib-services-framework';
|
|
3
|
+
import { describe, test, expect, it } from 'vitest';
|
|
4
|
+
|
|
5
|
+
describe('protocol types', () => {
|
|
6
|
+
describe('StreamingSyncRequest', () => {
|
|
7
|
+
const validator = schema.createTsCodecValidator(StreamingSyncRequest, { allowAdditional: true });
|
|
8
|
+
|
|
9
|
+
test('with streams', () => {
|
|
10
|
+
expect(
|
|
11
|
+
validator.validate({
|
|
12
|
+
buckets: [],
|
|
13
|
+
include_checksum: true,
|
|
14
|
+
raw_data: true,
|
|
15
|
+
binary_data: true,
|
|
16
|
+
client_id: '0da33a94-c140-4b42-b3b3-a1df3b1352a3',
|
|
17
|
+
parameters: {},
|
|
18
|
+
streams: {
|
|
19
|
+
include_defaults: true,
|
|
20
|
+
subscriptions: [{ stream: 'does_not_exist', parameters: null, override_priority: null }]
|
|
21
|
+
}
|
|
22
|
+
} as any)
|
|
23
|
+
).toMatchObject({ valid: true });
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test('does not allow missing parameters', () => {
|
|
27
|
+
expect(
|
|
28
|
+
validator.validate({
|
|
29
|
+
buckets: [],
|
|
30
|
+
include_checksum: true,
|
|
31
|
+
raw_data: true,
|
|
32
|
+
binary_data: true,
|
|
33
|
+
client_id: '0da33a94-c140-4b42-b3b3-a1df3b1352a3',
|
|
34
|
+
parameters: {},
|
|
35
|
+
streams: {
|
|
36
|
+
include_defaults: true,
|
|
37
|
+
subscriptions: [{ stream: 'a', override_priority: null }]
|
|
38
|
+
}
|
|
39
|
+
} as any)
|
|
40
|
+
).toMatchObject({ valid: false });
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
});
|