@powersync/service-sync-rules 0.0.0-dev-20251209070120 → 0.0.0-dev-20260114145741
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/dist/BaseSqlDataQuery.d.ts +3 -9
- package/dist/BaseSqlDataQuery.js +10 -10
- package/dist/BaseSqlDataQuery.js.map +1 -1
- package/dist/BucketParameterQuerier.d.ts +15 -5
- package/dist/BucketParameterQuerier.js +18 -3
- package/dist/BucketParameterQuerier.js.map +1 -1
- package/dist/BucketSource.d.ts +94 -25
- package/dist/BucketSource.js +67 -0
- package/dist/BucketSource.js.map +1 -1
- package/dist/HydratedSyncRules.d.ts +46 -0
- package/dist/HydratedSyncRules.js +88 -0
- package/dist/HydratedSyncRules.js.map +1 -0
- package/dist/HydrationState.d.ts +45 -0
- package/dist/HydrationState.js +41 -0
- package/dist/HydrationState.js.map +1 -0
- package/dist/SqlBucketDescriptor.d.ts +31 -28
- package/dist/SqlBucketDescriptor.js +89 -112
- package/dist/SqlBucketDescriptor.js.map +1 -1
- package/dist/SqlDataQuery.d.ts +4 -4
- package/dist/SqlDataQuery.js +5 -6
- package/dist/SqlDataQuery.js.map +1 -1
- package/dist/SqlParameterQuery.d.ts +17 -9
- package/dist/SqlParameterQuery.js +49 -21
- package/dist/SqlParameterQuery.js.map +1 -1
- package/dist/SqlSyncRules.d.ts +13 -29
- package/dist/SqlSyncRules.js +48 -77
- package/dist/SqlSyncRules.js.map +1 -1
- package/dist/StaticSqlParameterQuery.d.ts +13 -3
- package/dist/StaticSqlParameterQuery.js +39 -4
- package/dist/StaticSqlParameterQuery.js.map +1 -1
- package/dist/TableValuedFunctionSqlParameterQuery.d.ts +14 -4
- package/dist/TableValuedFunctionSqlParameterQuery.js +42 -7
- package/dist/TableValuedFunctionSqlParameterQuery.js.map +1 -1
- package/dist/compatibility.d.ts +23 -1
- package/dist/compatibility.js +32 -4
- package/dist/compatibility.js.map +1 -1
- package/dist/events/SqlEventDescriptor.js +1 -1
- package/dist/events/SqlEventDescriptor.js.map +1 -1
- package/dist/events/SqlEventSourceQuery.d.ts +1 -1
- package/dist/events/SqlEventSourceQuery.js +1 -2
- package/dist/events/SqlEventSourceQuery.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/json_schema.js +5 -1
- package/dist/json_schema.js.map +1 -1
- package/dist/request_functions.js +1 -1
- package/dist/request_functions.js.map +1 -1
- package/dist/schema-generators/SchemaGenerator.js +1 -1
- package/dist/schema-generators/SchemaGenerator.js.map +1 -1
- package/dist/streams/filter.d.ts +34 -4
- package/dist/streams/filter.js +93 -23
- package/dist/streams/filter.js.map +1 -1
- package/dist/streams/from_sql.js +2 -5
- package/dist/streams/from_sql.js.map +1 -1
- package/dist/streams/parameter.d.ts +7 -6
- package/dist/streams/stream.d.ts +25 -15
- package/dist/streams/stream.js +59 -87
- package/dist/streams/stream.js.map +1 -1
- package/dist/streams/variant.d.ts +14 -21
- package/dist/streams/variant.js +68 -45
- package/dist/streams/variant.js.map +1 -1
- package/dist/types/custom_sqlite_value.d.ts +1 -1
- package/dist/types/time.d.ts +24 -5
- package/dist/types/time.js +67 -12
- package/dist/types/time.js.map +1 -1
- package/dist/types.d.ts +44 -24
- package/dist/types.js +4 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +4 -2
- package/dist/utils.js +6 -3
- package/dist/utils.js.map +1 -1
- package/package.json +4 -3
- package/schema/sync_rules.json +9 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/streams/stream.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/streams/stream.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAIL,gBAAgB,EAIjB,MAAM,oBAAoB,CAAC;AAO5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AC,KAA2B;QACxC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,iBAAiB,CAAC,MAAoB,EAAE,MAAwD;QAC9F,OAAO,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrD,CAAC;IAED,sBAAsB,CAAC,MAA2C;QAChE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACxC,MAAM,CAAC,GAAG;YACR,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG;SACrB,CAAC;QAEF,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC;IAED,WAAW,CAAC,OAA2B;QACrC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;YAC5C,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,GAAG,GAAa;YACpB,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC;QAEF,uFAAuF;QACvF,wFAAwF;QACxF,sFAAsF;QACtF,OAAO,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC;YACtC,KAAK,EAAE,OAAO,CAAC,WAAW;YAC1B,GAAG,EAAE,OAAO,CAAC,MAAM;YACnB,0BAA0B,EAAE,GAAG,EAAE;gBAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC;YAClD,CAAC;SACF,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { BucketInclusionReason } from '../BucketDescription.js';
|
|
2
2
|
import { BucketParameterQuerier } from '../BucketParameterQuerier.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { BucketDataSource, BucketParameterQuerierSource, ParameterIndexLookupCreator } from '../BucketSource.js';
|
|
4
|
+
import { BucketDataScope } from '../HydrationState.js';
|
|
5
|
+
import { CreateSourceParams, ScopedParameterLookup } from '../index.js';
|
|
6
|
+
import { RequestParameters, SqliteJsonValue, TableRow } from '../types.js';
|
|
5
7
|
import { BucketParameter, SubqueryEvaluator } from './parameter.js';
|
|
6
8
|
import { SyncStream } from './stream.js';
|
|
7
9
|
/**
|
|
@@ -44,10 +46,12 @@ export declare class StreamVariant {
|
|
|
44
46
|
*/
|
|
45
47
|
requestFilters: RequestFilter[];
|
|
46
48
|
constructor(id: number);
|
|
49
|
+
defaultBucketPrefix(streamName: string): string;
|
|
50
|
+
indexLookupCreators(): ParameterIndexLookupCreator[];
|
|
47
51
|
/**
|
|
48
52
|
* Given a row in the table this stream selects from, returns all ids of buckets to which that row belongs to.
|
|
49
53
|
*/
|
|
50
|
-
|
|
54
|
+
bucketParametersForRow(options: TableRow): string[];
|
|
51
55
|
/**
|
|
52
56
|
* Given a row to evaluate, returns all instantiations of parameters that satisfy conditions.
|
|
53
57
|
*
|
|
@@ -62,23 +66,8 @@ export declare class StreamVariant {
|
|
|
62
66
|
* @returns Each instantiation, with each sub-array having a value for a parameter.
|
|
63
67
|
*/
|
|
64
68
|
private cartesianProductOfParameterInstantiations;
|
|
65
|
-
|
|
66
|
-
querier(stream: SyncStream, reason: BucketInclusionReason, params: RequestParameters, bucketIdTransformer: BucketIdTransformer): BucketParameterQuerier | null;
|
|
69
|
+
querier(stream: SyncStream, reason: BucketInclusionReason, params: RequestParameters, bucketScope: BucketDataScope, hydratedSubqueries: HydratedSubqueries): BucketParameterQuerier | null;
|
|
67
70
|
findStaticInstantiations(params: RequestParameters): SqliteJsonValue[][];
|
|
68
|
-
/**
|
|
69
|
-
* Creates lookup indices for dynamically-resolved parameters.
|
|
70
|
-
*
|
|
71
|
-
* Resolving dynamic parameters is a two-step process: First, for tables referenced in subqueries, we create an index
|
|
72
|
-
* to resolve which request parameters would match rows in subqueries. Then, when resolving bucket ids for a request,
|
|
73
|
-
* we compute subquery results by looking up results in that index.
|
|
74
|
-
*
|
|
75
|
-
* This implements the first step of that process.
|
|
76
|
-
*
|
|
77
|
-
* @param result The array into which evaluation results should be written to.
|
|
78
|
-
* @param sourceTable A table we depend on in a subquery.
|
|
79
|
-
* @param row Row data to index.
|
|
80
|
-
*/
|
|
81
|
-
pushParameterRowEvaluation(result: EvaluatedParametersResult[], sourceTable: SourceTableInterface, row: SqliteRow): void;
|
|
82
71
|
debugRepresentation(): any;
|
|
83
72
|
/**
|
|
84
73
|
* Replaces {@link StreamVariant.parameters} with static values looked up in request parameters.
|
|
@@ -90,13 +79,15 @@ export declare class StreamVariant {
|
|
|
90
79
|
/**
|
|
91
80
|
* Builds a bucket id for an instantiation, like `stream|0[1,2,"foo"]`.
|
|
92
81
|
*
|
|
93
|
-
* @param
|
|
82
|
+
* @param bucketPrefix The name of the the bucket, excluding parameters
|
|
94
83
|
* @param instantiation An instantiation for all parameters in this variant.
|
|
95
84
|
* @param transformer A transformer adding version information to the inner id.
|
|
96
85
|
* @returns The generated bucket id
|
|
97
86
|
*/
|
|
98
|
-
private
|
|
87
|
+
private serializeBucketParameters;
|
|
99
88
|
private resolveBucket;
|
|
89
|
+
createParameterQuerierSource(params: CreateSourceParams, stream: SyncStream, querierDataSource: BucketDataSource): BucketParameterQuerierSource;
|
|
90
|
+
private queriersForSubscription;
|
|
100
91
|
}
|
|
101
92
|
/**
|
|
102
93
|
* A stateless filter condition that only depends on the request itself, e.g. `WHERE token_parameters.is_admin`.
|
|
@@ -120,3 +111,5 @@ export interface SubqueryRequestFilter {
|
|
|
120
111
|
matches(params: RequestParameters, results: SqliteJsonValue[]): boolean;
|
|
121
112
|
}
|
|
122
113
|
export type RequestFilter = StaticRequestFilter | SubqueryRequestFilter;
|
|
114
|
+
type HydratedSubqueries = Map<SubqueryEvaluator, (params: RequestParameters) => ScopedParameterLookup[]>;
|
|
115
|
+
export {};
|
package/dist/streams/variant.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isJsonValue, JSONBucketNameSerialize } from '../utils.js';
|
|
1
|
+
import { buildBucketName, isJsonValue, JSONBucketNameSerialize } from '../utils.js';
|
|
2
2
|
import { cartesianProduct } from './utils.js';
|
|
3
3
|
/**
|
|
4
4
|
* A variant of a stream.
|
|
@@ -46,11 +46,17 @@ export class StreamVariant {
|
|
|
46
46
|
this.additionalRowFilters = [];
|
|
47
47
|
this.requestFilters = [];
|
|
48
48
|
}
|
|
49
|
+
defaultBucketPrefix(streamName) {
|
|
50
|
+
return `${streamName}|${this.id}`;
|
|
51
|
+
}
|
|
52
|
+
indexLookupCreators() {
|
|
53
|
+
return this.subqueries.flatMap((subquery) => subquery.indexLookupCreators());
|
|
54
|
+
}
|
|
49
55
|
/**
|
|
50
56
|
* Given a row in the table this stream selects from, returns all ids of buckets to which that row belongs to.
|
|
51
57
|
*/
|
|
52
|
-
|
|
53
|
-
return this.instantiationsForRow(options).map((values) => this.
|
|
58
|
+
bucketParametersForRow(options) {
|
|
59
|
+
return this.instantiationsForRow(options).map((values) => this.serializeBucketParameters(values));
|
|
54
60
|
}
|
|
55
61
|
/**
|
|
56
62
|
* Given a row to evaluate, returns all instantiations of parameters that satisfy conditions.
|
|
@@ -89,10 +95,7 @@ export class StreamVariant {
|
|
|
89
95
|
cartesianProductOfParameterInstantiations(instantiations) {
|
|
90
96
|
return [...cartesianProduct(...instantiations)];
|
|
91
97
|
}
|
|
92
|
-
|
|
93
|
-
return this.requestFilters.some((f) => f.type == 'dynamic');
|
|
94
|
-
}
|
|
95
|
-
querier(stream, reason, params, bucketIdTransformer) {
|
|
98
|
+
querier(stream, reason, params, bucketScope, hydratedSubqueries) {
|
|
96
99
|
const instantiation = this.partiallyEvaluateParameters(params);
|
|
97
100
|
if (instantiation == null) {
|
|
98
101
|
return null;
|
|
@@ -111,14 +114,18 @@ export class StreamVariant {
|
|
|
111
114
|
}
|
|
112
115
|
}
|
|
113
116
|
for (const subquery of this.subqueries) {
|
|
114
|
-
|
|
117
|
+
const subqueryLookup = hydratedSubqueries.get(subquery);
|
|
118
|
+
if (subqueryLookup == null) {
|
|
119
|
+
throw new Error('Internal error, missing subquery lookup');
|
|
120
|
+
}
|
|
121
|
+
subqueryToLookups.set(subquery, subqueryLookup(params));
|
|
115
122
|
}
|
|
116
123
|
const staticBuckets = [];
|
|
117
124
|
if (dynamicParameters.length == 0 && dynamicRequestFilters.length == 0) {
|
|
118
125
|
// When we have no dynamic parameters, the partial evaluation is a full instantiation.
|
|
119
126
|
const instantiations = this.cartesianProductOfParameterInstantiations(instantiation);
|
|
120
127
|
for (const instantiation of instantiations) {
|
|
121
|
-
staticBuckets.push(this.resolveBucket(stream, instantiation, reason,
|
|
128
|
+
staticBuckets.push(this.resolveBucket(stream, instantiation, reason, bucketScope));
|
|
122
129
|
}
|
|
123
130
|
}
|
|
124
131
|
const variant = this;
|
|
@@ -156,7 +163,7 @@ export class StreamVariant {
|
|
|
156
163
|
perParameterInstantiation[lookup.index] = subqueryResults.get(lookup.subquery);
|
|
157
164
|
}
|
|
158
165
|
const product = variant.cartesianProductOfParameterInstantiations(perParameterInstantiation);
|
|
159
|
-
return Promise.resolve(product.map((e) => variant.resolveBucket(stream, e, reason,
|
|
166
|
+
return Promise.resolve(product.map((e) => variant.resolveBucket(stream, e, reason, bucketScope)));
|
|
160
167
|
}
|
|
161
168
|
};
|
|
162
169
|
}
|
|
@@ -168,36 +175,6 @@ export class StreamVariant {
|
|
|
168
175
|
// This will be an array of values (i.e. a total evaluation) because there are no dynamic parameters.
|
|
169
176
|
this.partiallyEvaluateParameters(params));
|
|
170
177
|
}
|
|
171
|
-
/**
|
|
172
|
-
* Creates lookup indices for dynamically-resolved parameters.
|
|
173
|
-
*
|
|
174
|
-
* Resolving dynamic parameters is a two-step process: First, for tables referenced in subqueries, we create an index
|
|
175
|
-
* to resolve which request parameters would match rows in subqueries. Then, when resolving bucket ids for a request,
|
|
176
|
-
* we compute subquery results by looking up results in that index.
|
|
177
|
-
*
|
|
178
|
-
* This implements the first step of that process.
|
|
179
|
-
*
|
|
180
|
-
* @param result The array into which evaluation results should be written to.
|
|
181
|
-
* @param sourceTable A table we depend on in a subquery.
|
|
182
|
-
* @param row Row data to index.
|
|
183
|
-
*/
|
|
184
|
-
pushParameterRowEvaluation(result, sourceTable, row) {
|
|
185
|
-
for (const subquery of this.subqueries) {
|
|
186
|
-
if (subquery.parameterTable.matches(sourceTable)) {
|
|
187
|
-
const lookups = subquery.lookupsForParameterRow(sourceTable, row);
|
|
188
|
-
if (lookups == null) {
|
|
189
|
-
continue;
|
|
190
|
-
}
|
|
191
|
-
// The row of the subquery. Since we only support subqueries with a single column, we unconditionally name the
|
|
192
|
-
// column `result` for simplicity.
|
|
193
|
-
const resultRow = { result: lookups.value };
|
|
194
|
-
result.push(...lookups.lookups.map((l) => ({
|
|
195
|
-
lookup: l,
|
|
196
|
-
bucketParameters: [resultRow]
|
|
197
|
-
})));
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
178
|
debugRepresentation() {
|
|
202
179
|
return {
|
|
203
180
|
id: this.id,
|
|
@@ -244,24 +221,70 @@ export class StreamVariant {
|
|
|
244
221
|
/**
|
|
245
222
|
* Builds a bucket id for an instantiation, like `stream|0[1,2,"foo"]`.
|
|
246
223
|
*
|
|
247
|
-
* @param
|
|
224
|
+
* @param bucketPrefix The name of the the bucket, excluding parameters
|
|
248
225
|
* @param instantiation An instantiation for all parameters in this variant.
|
|
249
226
|
* @param transformer A transformer adding version information to the inner id.
|
|
250
227
|
* @returns The generated bucket id
|
|
251
228
|
*/
|
|
252
|
-
|
|
229
|
+
serializeBucketParameters(instantiation) {
|
|
253
230
|
if (instantiation.length != this.parameters.length) {
|
|
254
231
|
throw Error('Internal error, instantiation length mismatch');
|
|
255
232
|
}
|
|
256
|
-
return
|
|
233
|
+
return JSONBucketNameSerialize.stringify(instantiation);
|
|
257
234
|
}
|
|
258
|
-
resolveBucket(stream, instantiation, reason,
|
|
235
|
+
resolveBucket(stream, instantiation, reason, bucketScope) {
|
|
259
236
|
return {
|
|
260
237
|
definition: stream.name,
|
|
261
238
|
inclusion_reasons: [reason],
|
|
262
|
-
bucket: this.
|
|
239
|
+
bucket: buildBucketName(bucketScope, this.serializeBucketParameters(instantiation)),
|
|
263
240
|
priority: stream.priority
|
|
264
241
|
};
|
|
265
242
|
}
|
|
243
|
+
createParameterQuerierSource(params, stream, querierDataSource) {
|
|
244
|
+
const hydrationState = params.hydrationState;
|
|
245
|
+
const bucketScope = hydrationState.getBucketSourceScope(querierDataSource);
|
|
246
|
+
const hydratedSubqueries = new Map(this.subqueries.map((s) => [s, s.hydrateLookupsForRequest(hydrationState)]));
|
|
247
|
+
return {
|
|
248
|
+
pushBucketParameterQueriers: (result, options) => {
|
|
249
|
+
const subscriptions = options.streams[stream.name] ?? [];
|
|
250
|
+
if (!stream.subscribedToByDefault && !subscriptions.length) {
|
|
251
|
+
// The client is not subscribing to this stream, so don't query buckets related to it.
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
let hasExplicitDefaultSubscription = false;
|
|
255
|
+
for (const subscription of subscriptions) {
|
|
256
|
+
let subscriptionParams = options.globalParameters;
|
|
257
|
+
if (subscription.parameters != null) {
|
|
258
|
+
subscriptionParams = subscriptionParams.withAddedStreamParameters(subscription.parameters);
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
hasExplicitDefaultSubscription = true;
|
|
262
|
+
}
|
|
263
|
+
this.queriersForSubscription(stream, result, subscription, subscriptionParams, bucketScope, hydratedSubqueries);
|
|
264
|
+
}
|
|
265
|
+
// If the stream is subscribed to by default and there is no explicit subscription that would match the default
|
|
266
|
+
// subscription, also include the default querier.
|
|
267
|
+
if (stream.subscribedToByDefault && !hasExplicitDefaultSubscription) {
|
|
268
|
+
this.queriersForSubscription(stream, result, null, options.globalParameters, bucketScope, hydratedSubqueries);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
queriersForSubscription(stream, result, subscription, params, bucketScope, hydratedSubqueries) {
|
|
274
|
+
const reason = subscription != null ? { subscription: subscription.opaque_id } : 'default';
|
|
275
|
+
try {
|
|
276
|
+
const querier = this.querier(stream, reason, params, bucketScope, hydratedSubqueries);
|
|
277
|
+
if (querier) {
|
|
278
|
+
result.queriers.push(querier);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
catch (e) {
|
|
282
|
+
result.errors.push({
|
|
283
|
+
descriptor: stream.name,
|
|
284
|
+
message: `Error evaluating bucket ids: ${e.message}`,
|
|
285
|
+
subscription: subscription ?? undefined
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
}
|
|
266
289
|
}
|
|
267
290
|
//# sourceMappingURL=variant.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variant.js","sourceRoot":"","sources":["../../src/streams/variant.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"variant.js","sourceRoot":"","sources":["../../src/streams/variant.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAGpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,aAAa;IACxB,EAAE,CAAS;IACX,UAAU,CAAoB;IAC9B,UAAU,CAAsB;IAEhC;;;;OAIG;IACH,oBAAoB,CAAiC;IAErD;;;;;OAKG;IACH,cAAc,CAAkB;IAEhC,YAAY,EAAU;QACpB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,oBAAoB,G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AAI,CAAC;YACH,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,kBAAkB,CAAC,CAAC;YACtF,IAAI,OAAO,EAAE,CAAC;gBACZ,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;gBACjB,UAAU,EAAE,MAAM,CAAC,IAAI;gBACvB,OAAO,EAAE,gCAAgC,CAAC,CAAC,OAAO,EAAE;gBACpD,YAAY,EAAE,YAAY,IAAI,SAAS;aACxC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CompatibilityContext } from '../compatibility.js';
|
|
2
|
-
import { SqliteValue } from '../types.js';
|
|
3
2
|
import { SqliteValueType } from '../ExpressionType.js';
|
|
3
|
+
import { SqliteValue } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* A value that decays into a {@link SqliteValue} in a context-specific way.
|
|
6
6
|
*
|
package/dist/types/time.d.ts
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import { SqliteValueType } from '../ExpressionType.js';
|
|
2
|
-
import { CompatibilityContext } from '../compatibility.js';
|
|
2
|
+
import { CompatibilityContext, TimeValuePrecision } from '../compatibility.js';
|
|
3
3
|
import { SqliteValue } from '../types.js';
|
|
4
4
|
import { CustomSqliteValue } from './custom_sqlite_value.js';
|
|
5
|
+
export interface DateTimeSourceOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The amount of sub-second digits provided by the source database.
|
|
8
|
+
*
|
|
9
|
+
* We can't infer this by parsing the iso representation alone, since trailing zeroes might be omitted from the
|
|
10
|
+
* representation.
|
|
11
|
+
*/
|
|
12
|
+
subSecondPrecision: TimeValuePrecision;
|
|
13
|
+
/**
|
|
14
|
+
* The default precision to use when rendering {@link DateTimeValue}s in a compatibility context that doesn't have a
|
|
15
|
+
* {@link CompatibilityContext.maxTimeValuePrecision} set.
|
|
16
|
+
*
|
|
17
|
+
* This is usually the same as {@link subSecondPrecision}, except for MySQL, where we can provide microseconds
|
|
18
|
+
* precision but default to milliseconds.
|
|
19
|
+
*/
|
|
20
|
+
defaultSubSecondPrecision: TimeValuePrecision;
|
|
21
|
+
}
|
|
5
22
|
/**
|
|
6
23
|
* In old versions of the sync service, timestamp values were formatted with a space between the date and time
|
|
7
24
|
* components.
|
|
@@ -12,7 +29,8 @@ import { CustomSqliteValue } from './custom_sqlite_value.js';
|
|
|
12
29
|
export declare class DateTimeValue extends CustomSqliteValue {
|
|
13
30
|
readonly iso8601Representation: string;
|
|
14
31
|
private readonly fixedLegacyRepresentation;
|
|
15
|
-
|
|
32
|
+
private readonly options;
|
|
33
|
+
constructor(iso8601Representation: string, fixedLegacyRepresentation: string | undefined, options: DateTimeSourceOptions);
|
|
16
34
|
get legacyRepresentation(): string;
|
|
17
35
|
get sqliteType(): SqliteValueType;
|
|
18
36
|
toSqliteValue(context: CompatibilityContext): string;
|
|
@@ -25,9 +43,10 @@ export declare class DateTimeValue extends CustomSqliteValue {
|
|
|
25
43
|
*/
|
|
26
44
|
export declare class TimeValue extends CustomSqliteValue {
|
|
27
45
|
readonly timeSeconds: string;
|
|
28
|
-
readonly fraction: string
|
|
29
|
-
|
|
30
|
-
|
|
46
|
+
readonly fraction: string;
|
|
47
|
+
private readonly options;
|
|
48
|
+
constructor(timeSeconds: string, fraction: string, options: DateTimeSourceOptions);
|
|
49
|
+
static parse(value: string, options: DateTimeSourceOptions): TimeValue | null;
|
|
31
50
|
toSqliteValue(context: CompatibilityContext): SqliteValue;
|
|
32
51
|
get sqliteType(): SqliteValueType;
|
|
33
52
|
}
|
package/dist/types/time.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CompatibilityOption } from '../compatibility.js';
|
|
1
|
+
import { CompatibilityOption, TimeValuePrecision } from '../compatibility.js';
|
|
2
2
|
import { CustomSqliteValue } from './custom_sqlite_value.js';
|
|
3
3
|
/**
|
|
4
4
|
* In old versions of the sync service, timestamp values were formatted with a space between the date and time
|
|
@@ -10,11 +10,13 @@ import { CustomSqliteValue } from './custom_sqlite_value.js';
|
|
|
10
10
|
export class DateTimeValue extends CustomSqliteValue {
|
|
11
11
|
iso8601Representation;
|
|
12
12
|
fixedLegacyRepresentation;
|
|
13
|
+
options;
|
|
13
14
|
// YYYY-MM-DDThh:mm:ss.sss / YYYY-MM-DDThh:mm:ss.sssZ
|
|
14
|
-
constructor(iso8601Representation, fixedLegacyRepresentation = undefined) {
|
|
15
|
+
constructor(iso8601Representation, fixedLegacyRepresentation = undefined, options) {
|
|
15
16
|
super();
|
|
16
17
|
this.iso8601Representation = iso8601Representation;
|
|
17
18
|
this.fixedLegacyRepresentation = fixedLegacyRepresentation;
|
|
19
|
+
this.options = options;
|
|
18
20
|
}
|
|
19
21
|
// YYYY-MM-DD hh:mm:ss.sss / YYYY-MM-DD hh:mm:ss.sssZ
|
|
20
22
|
get legacyRepresentation() {
|
|
@@ -24,9 +26,25 @@ export class DateTimeValue extends CustomSqliteValue {
|
|
|
24
26
|
return 'text';
|
|
25
27
|
}
|
|
26
28
|
toSqliteValue(context) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
if (context.isEnabled(CompatibilityOption.timestampsIso8601)) {
|
|
30
|
+
return renderSubseconds(() => {
|
|
31
|
+
// Match the `.123` subsecond part and/or a `Z` suffix.
|
|
32
|
+
const matchSubSeconds = /(?:\.(\d+))?([zZ]?)$/.exec(this.iso8601Representation);
|
|
33
|
+
if (matchSubSeconds == null || matchSubSeconds[0].length == 0) {
|
|
34
|
+
return [this.iso8601Representation, '', ''];
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
return [
|
|
38
|
+
this.iso8601Representation.slice(0, -matchSubSeconds[0].length),
|
|
39
|
+
matchSubSeconds[1] ?? '',
|
|
40
|
+
matchSubSeconds[2] ?? ''
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
}, this.options, context);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
return this.legacyRepresentation;
|
|
47
|
+
}
|
|
30
48
|
}
|
|
31
49
|
}
|
|
32
50
|
/**
|
|
@@ -38,30 +56,67 @@ export class DateTimeValue extends CustomSqliteValue {
|
|
|
38
56
|
export class TimeValue extends CustomSqliteValue {
|
|
39
57
|
timeSeconds;
|
|
40
58
|
fraction;
|
|
41
|
-
|
|
59
|
+
options;
|
|
60
|
+
constructor(timeSeconds, fraction, options) {
|
|
42
61
|
super();
|
|
43
62
|
this.timeSeconds = timeSeconds;
|
|
44
63
|
this.fraction = fraction;
|
|
64
|
+
this.options = options;
|
|
45
65
|
}
|
|
46
|
-
static parse(value) {
|
|
47
|
-
const match = /^([\d:]+)(
|
|
66
|
+
static parse(value, options) {
|
|
67
|
+
const match = /^([\d:]+)(?:\.(\d+))?$/.exec(value);
|
|
48
68
|
if (match == null) {
|
|
49
69
|
return null;
|
|
50
70
|
}
|
|
51
71
|
const [_, timeSeconds, fraction] = match;
|
|
52
|
-
return new TimeValue(timeSeconds, fraction);
|
|
72
|
+
return new TimeValue(timeSeconds, fraction, options);
|
|
53
73
|
}
|
|
54
74
|
toSqliteValue(context) {
|
|
55
75
|
if (context.isEnabled(CompatibilityOption.timestampsIso8601)) {
|
|
56
|
-
|
|
57
|
-
return `${this.timeSeconds}${fraction}`;
|
|
76
|
+
return renderSubseconds(() => [this.timeSeconds, this.fraction ?? '', ''], this.options, context);
|
|
58
77
|
}
|
|
59
78
|
else {
|
|
60
|
-
|
|
79
|
+
if (this.fraction) {
|
|
80
|
+
return `${this.timeSeconds}.${this.fraction}`;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
return this.timeSeconds;
|
|
84
|
+
}
|
|
61
85
|
}
|
|
62
86
|
}
|
|
63
87
|
get sqliteType() {
|
|
64
88
|
return 'text';
|
|
65
89
|
}
|
|
66
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Renders a time value with a designated precision.
|
|
93
|
+
*
|
|
94
|
+
* @param split Returns the original time value, split into the part before the sub-second fraction and the subsecond
|
|
95
|
+
* fraction. The `.` separator should not be part of either string.
|
|
96
|
+
* @param options Information about precision overred by the source database.
|
|
97
|
+
* @param context The {@link CompatibilityContext} to take into consideration.
|
|
98
|
+
* @returns The rendered value.
|
|
99
|
+
*/
|
|
100
|
+
function renderSubseconds(split, options, context) {
|
|
101
|
+
const maxPrecision = context.maxTimeValuePrecision ?? options.defaultSubSecondPrecision;
|
|
102
|
+
const maxSubSecondDigits = Math.min(maxPrecision.subSecondDigits, options.subSecondPrecision.subSecondDigits);
|
|
103
|
+
// Note: We are deliberately not rounding here, we always trim precision away. Rounding would require a parsed date
|
|
104
|
+
// with subsecond precision, which is just painful in JS. Maybe with the temporal API in Node 25...
|
|
105
|
+
let [withoutSubseconds, subseconds, suffix] = split();
|
|
106
|
+
if (maxPrecision == TimeValuePrecision.seconds) {
|
|
107
|
+
// Avoid a trailing `.` if we only care about seconds.
|
|
108
|
+
return `${withoutSubseconds}${suffix}`;
|
|
109
|
+
}
|
|
110
|
+
if (subseconds.length > maxSubSecondDigits) {
|
|
111
|
+
// Trim unwanted precision.
|
|
112
|
+
subseconds = subseconds.substring(0, maxSubSecondDigits);
|
|
113
|
+
}
|
|
114
|
+
else if (subseconds.length < maxSubSecondDigits) {
|
|
115
|
+
// Let's say we had a source database stripping trailing zeroes from the subsecond field. Perhaps the
|
|
116
|
+
// subSecondPrecision is generally micros, but one value has .123456 and one has .1234 instead of .123400. For
|
|
117
|
+
// consistency, we pad those value.
|
|
118
|
+
subseconds = subseconds.padEnd(maxSubSecondDigits, '0');
|
|
119
|
+
}
|
|
120
|
+
return `${withoutSubseconds}.${subseconds}${suffix}`;
|
|
121
|
+
}
|
|
67
122
|
//# sourceMappingURL=time.js.map
|
package/dist/types/time.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time.js","sourceRoot":"","sources":["../../src/types/time.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"time.js","sourceRoot":"","sources":["../../src/types/time.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEpG,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAoB7D;;;;;;GAMG;AACH,MAAM,OAAO,aAAc,SAAQ,iBAAiB;IAIvC;IACQ;IACA;IALnB,qDAAqD;IAErD,YACW,qBAA6B,EACrB,4BAAgD,SAAS,EACzD,OAA8B;QAE/C,KAAK,EAAE,CAAC;QAJC,0BAAqB,GAArB,qBAAqB,CAAQ;QACrB,8BAAyB,GAAzB,yBAAyB,CAAgC;QACzD,YAAO,GAAP,OAAO,CAAuB;IAGjD,CAAC;IAED,qDAAqD;IACrD,IAAW,oBAAoB;QAC7B,OAAO,IAAI,CAAC,yBAAyB,IAAI,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACxF,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,aAAa,CAAC,OAA6B;QACzC,IAAI,OAAO,CAAC,SAAS,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,EAAE,CAAC;YAC7D,OAAO,gBAAgB,CACrB,GAAG,EAAE;gBACH,uDAAuD;gBACvD,MAAM,eAAe,GAAG,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;gBAChF,IAAI,eAAe,IAAI,IAAI,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;oBAC9D,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,EAA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1D,CAAC;IAED,OAAO,GAAG,iBAAiB,IAAI,UAAU,GAAG,MAAM,EAAE,CAAC;AACvD,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import { JsonContainer } from '@powersync/service-jsonbig';
|
|
2
|
+
import { BucketPriority } from './BucketDescription.js';
|
|
3
|
+
import { ScopedParameterLookup, UnscopedParameterLookup } from './BucketParameterQuerier.js';
|
|
4
|
+
import { CompatibilityContext } from './compatibility.js';
|
|
2
5
|
import { ColumnDefinition } from './ExpressionType.js';
|
|
6
|
+
import { RequestFunctionCall } from './request_functions.js';
|
|
3
7
|
import { SourceTableInterface } from './SourceTableInterface.js';
|
|
4
8
|
import { SyncRulesOptions } from './SqlSyncRules.js';
|
|
5
9
|
import { TablePattern } from './TablePattern.js';
|
|
6
|
-
import { BucketPriority } from './BucketDescription.js';
|
|
7
|
-
import { ParameterLookup } from './BucketParameterQuerier.js';
|
|
8
10
|
import { CustomSqliteValue } from './types/custom_sqlite_value.js';
|
|
9
|
-
import { CompatibilityContext } from './compatibility.js';
|
|
10
|
-
import { RequestFunctionCall } from './request_functions.js';
|
|
11
|
-
export interface SyncRules {
|
|
12
|
-
evaluateRow(options: EvaluateRowOptions): EvaluationResult[];
|
|
13
|
-
evaluateParameterRow(table: SourceTableInterface, row: SqliteRow): EvaluatedParametersResult[];
|
|
14
|
-
}
|
|
15
11
|
export interface QueryParseOptions extends SyncRulesOptions {
|
|
16
12
|
accept_potentially_dangerous_queries?: boolean;
|
|
17
13
|
priority?: BucketPriority;
|
|
@@ -21,7 +17,16 @@ export interface StreamParseOptions extends QueryParseOptions {
|
|
|
21
17
|
auto_subscribe?: boolean;
|
|
22
18
|
}
|
|
23
19
|
export interface EvaluatedParameters {
|
|
24
|
-
lookup:
|
|
20
|
+
lookup: ScopedParameterLookup;
|
|
21
|
+
/**
|
|
22
|
+
* Parameters used to generate bucket id. May be incomplete.
|
|
23
|
+
*
|
|
24
|
+
* JSON-serializable.
|
|
25
|
+
*/
|
|
26
|
+
bucketParameters: Record<string, SqliteJsonValue>[];
|
|
27
|
+
}
|
|
28
|
+
export interface UnscopedEvaluatedParameters {
|
|
29
|
+
lookup: UnscopedParameterLookup;
|
|
25
30
|
/**
|
|
26
31
|
* Parameters used to generate bucket id. May be incomplete.
|
|
27
32
|
*
|
|
@@ -30,6 +35,7 @@ export interface EvaluatedParameters {
|
|
|
30
35
|
bucketParameters: Record<string, SqliteJsonValue>[];
|
|
31
36
|
}
|
|
32
37
|
export type EvaluatedParametersResult = EvaluatedParameters | EvaluationError;
|
|
38
|
+
export type UnscopedEvaluatedParametersResult = UnscopedEvaluatedParameters | EvaluationError;
|
|
33
39
|
export interface EvaluatedRow {
|
|
34
40
|
bucket: string;
|
|
35
41
|
/** Output table - may be different from input table. */
|
|
@@ -41,13 +47,41 @@ export interface EvaluatedRow {
|
|
|
41
47
|
/** Must be JSON-serializable. */
|
|
42
48
|
data: SqliteJsonRow;
|
|
43
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Bucket data as evaluated by the BucketDataSource.
|
|
52
|
+
*
|
|
53
|
+
* The bucket name must still be resolved, external to this.
|
|
54
|
+
*/
|
|
55
|
+
export interface UnscopedEvaluatedRow {
|
|
56
|
+
/**
|
|
57
|
+
* Serialized evaluated parameters used to generate the bucket id. Serialized as a JSON array.
|
|
58
|
+
*
|
|
59
|
+
* Examples:
|
|
60
|
+
* [] // no bucket parameters
|
|
61
|
+
* [1] // single numeric parameter
|
|
62
|
+
* [1,"foo"] // multiple parameters
|
|
63
|
+
*
|
|
64
|
+
* The bucket name is derived by using concetenating these parameters with the generated bucket name.
|
|
65
|
+
*/
|
|
66
|
+
serializedBucketParameters: string;
|
|
67
|
+
/** Output table - may be different from input table. */
|
|
68
|
+
table: string;
|
|
69
|
+
/**
|
|
70
|
+
* Convenience attribute. Must match data.id.
|
|
71
|
+
*/
|
|
72
|
+
id: string;
|
|
73
|
+
/** Must be JSON-serializable. */
|
|
74
|
+
data: SqliteJsonRow;
|
|
75
|
+
}
|
|
44
76
|
export interface EvaluationError {
|
|
45
77
|
error: string;
|
|
46
78
|
}
|
|
47
|
-
export declare function isEvaluationError(e:
|
|
79
|
+
export declare function isEvaluationError(e: EvaluationResult | UnscopedEvaluationResult | EvaluatedParametersResult | UnscopedEvaluatedParametersResult): e is EvaluationError;
|
|
48
80
|
export declare function isEvaluatedRow(e: EvaluationResult): e is EvaluatedRow;
|
|
81
|
+
export declare function isSourceEvaluatedRow(e: UnscopedEvaluationResult): e is UnscopedEvaluatedRow;
|
|
49
82
|
export declare function isEvaluatedParameters(e: EvaluatedParametersResult): e is EvaluatedParameters;
|
|
50
83
|
export type EvaluationResult = EvaluatedRow | EvaluationError;
|
|
84
|
+
export type UnscopedEvaluationResult = UnscopedEvaluatedRow | EvaluationError;
|
|
51
85
|
export interface RequestJwtPayload {
|
|
52
86
|
/**
|
|
53
87
|
* user_id
|
|
@@ -190,21 +224,7 @@ export interface InputParameter {
|
|
|
190
224
|
*/
|
|
191
225
|
parametersToLookupValue(parameters: ParameterValueSet): SqliteValue;
|
|
192
226
|
}
|
|
193
|
-
/**
|
|
194
|
-
* Transforms bucket ids generated when evaluating the row by e.g. encoding version information.
|
|
195
|
-
*
|
|
196
|
-
* Because buckets are recreated on a sync rule redeploy, it makes sense to use different bucket ids (otherwise, clients
|
|
197
|
-
* may run into checksum errors causing a sync to take longer than necessary or breaking progress).
|
|
198
|
-
*
|
|
199
|
-
* So, this transformer receives the original bucket id as generated by defined sync rules, and can prepend a version
|
|
200
|
-
* identifier.
|
|
201
|
-
*
|
|
202
|
-
* Note that this transformation has not been present in older versions of the sync service. To preserve backwards
|
|
203
|
-
* compatibility, sync rules will not use this function without an opt-in.
|
|
204
|
-
*/
|
|
205
|
-
export type BucketIdTransformer = (regularId: string) => string;
|
|
206
227
|
export interface EvaluateRowOptions extends TableRow {
|
|
207
|
-
bucketIdTransformer: BucketIdTransformer;
|
|
208
228
|
}
|
|
209
229
|
/**
|
|
210
230
|
* A row associated with the table it's coming from.
|