@powersync/service-core 0.0.0-dev-20250227082606 → 0.0.0-dev-20250303114151

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +1 -10
  2. package/dist/routes/RouterEngine.js.map +1 -1
  3. package/dist/routes/endpoints/socket-route.js +1 -2
  4. package/dist/routes/endpoints/socket-route.js.map +1 -1
  5. package/dist/routes/endpoints/sync-stream.js +1 -2
  6. package/dist/routes/endpoints/sync-stream.js.map +1 -1
  7. package/dist/sync/BucketChecksumState.d.ts +1 -5
  8. package/dist/sync/BucketChecksumState.js +5 -13
  9. package/dist/sync/BucketChecksumState.js.map +1 -1
  10. package/dist/sync/sync-index.d.ts +0 -1
  11. package/dist/sync/sync-index.js +0 -1
  12. package/dist/sync/sync-index.js.map +1 -1
  13. package/dist/sync/sync.d.ts +1 -3
  14. package/dist/sync/sync.js +18 -8
  15. package/dist/sync/sync.js.map +1 -1
  16. package/dist/system/ServiceContext.d.ts +0 -3
  17. package/dist/system/ServiceContext.js +0 -7
  18. package/dist/system/ServiceContext.js.map +1 -1
  19. package/dist/util/config/compound-config-collector.js +1 -13
  20. package/dist/util/config/compound-config-collector.js.map +1 -1
  21. package/dist/util/config/types.d.ts +2 -7
  22. package/dist/util/config/types.js.map +1 -1
  23. package/package.json +2 -2
  24. package/src/routes/RouterEngine.ts +0 -1
  25. package/src/routes/endpoints/socket-route.ts +1 -2
  26. package/src/routes/endpoints/sync-stream.ts +1 -2
  27. package/src/sync/BucketChecksumState.ts +5 -31
  28. package/src/sync/sync-index.ts +0 -1
  29. package/src/sync/sync.ts +24 -21
  30. package/src/system/ServiceContext.ts +0 -9
  31. package/src/util/config/compound-config-collector.ts +1 -24
  32. package/src/util/config/types.ts +2 -8
  33. package/test/src/sync/BucketChecksumState.test.ts +0 -15
  34. package/tsconfig.tsbuildinfo +1 -1
  35. package/dist/sync/SyncContext.d.ts +0 -17
  36. package/dist/sync/SyncContext.js +0 -23
  37. package/dist/sync/SyncContext.js.map +0 -1
  38. package/dist/util/config/defaults.d.ts +0 -5
  39. package/dist/util/config/defaults.js +0 -6
  40. package/dist/util/config/defaults.js.map +0 -1
  41. package/src/sync/SyncContext.ts +0 -36
  42. package/src/util/config/defaults.ts +0 -5
@@ -1,17 +0,0 @@
1
- import { SemaphoreInterface } from 'async-mutex';
2
- export interface SyncContextOptions {
3
- maxBuckets: number;
4
- maxParameterQueryResults: number;
5
- maxDataFetchConcurrency: number;
6
- }
7
- /**
8
- * Represents the context in which sync happens.
9
- *
10
- * This is global to all sync requests, not per request.
11
- */
12
- export declare class SyncContext {
13
- readonly maxBuckets: number;
14
- readonly maxParameterQueryResults: number;
15
- readonly syncSemaphore: SemaphoreInterface;
16
- constructor(options: SyncContextOptions);
17
- }
@@ -1,23 +0,0 @@
1
- import { Semaphore, withTimeout } from 'async-mutex';
2
- /**
3
- * Maximum duration to wait for the mutex to become available.
4
- *
5
- * This gives an explicit error if there are mutex issues, rather than just hanging.
6
- */
7
- const MUTEX_ACQUIRE_TIMEOUT = 30_000;
8
- /**
9
- * Represents the context in which sync happens.
10
- *
11
- * This is global to all sync requests, not per request.
12
- */
13
- export class SyncContext {
14
- maxBuckets;
15
- maxParameterQueryResults;
16
- syncSemaphore;
17
- constructor(options) {
18
- this.maxBuckets = options.maxBuckets;
19
- this.maxParameterQueryResults = options.maxParameterQueryResults;
20
- this.syncSemaphore = withTimeout(new Semaphore(options.maxDataFetchConcurrency), MUTEX_ACQUIRE_TIMEOUT, new Error(`Timeout while waiting for data`));
21
- }
22
- }
23
- //# sourceMappingURL=SyncContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SyncContext.js","sourceRoot":"","sources":["../../src/sync/SyncContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAsB,WAAW,EAAE,MAAM,aAAa,CAAC;AAQzE;;;;GAIG;AACH,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAErC;;;;GAIG;AACH,MAAM,OAAO,WAAW;IACb,UAAU,CAAS;IACnB,wBAAwB,CAAS;IAEjC,aAAa,CAAqB;IAE3C,YAAY,OAA2B;QACrC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC;QACjE,IAAI,CAAC,aAAa,GAAG,WAAW,CAC9B,IAAI,SAAS,CAAC,OAAO,CAAC,uBAAuB,CAAC,EAC9C,qBAAqB,EACrB,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAC5C,CAAC;IACJ,CAAC;CACF"}
@@ -1,5 +0,0 @@
1
- export declare const DEFAULT_MAX_POOL_SIZE = 8;
2
- export declare const DEFAULT_MAX_CONCURRENT_CONNECTIONS = 200;
3
- export declare const DEFAULT_MAX_DATA_FETCH_CONCURRENCY = 10;
4
- export declare const DEFAULT_MAX_BUCKETS_PER_CONNECTION = 1000;
5
- export declare const DEFAULT_MAX_PARAMETER_QUERY_RESULTS = 1000;
@@ -1,6 +0,0 @@
1
- export const DEFAULT_MAX_POOL_SIZE = 8;
2
- export const DEFAULT_MAX_CONCURRENT_CONNECTIONS = 200;
3
- export const DEFAULT_MAX_DATA_FETCH_CONCURRENCY = 10;
4
- export const DEFAULT_MAX_BUCKETS_PER_CONNECTION = 1000;
5
- export const DEFAULT_MAX_PARAMETER_QUERY_RESULTS = 1000;
6
- //# sourceMappingURL=defaults.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../src/util/config/defaults.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AACvC,MAAM,CAAC,MAAM,kCAAkC,GAAG,GAAG,CAAC;AACtD,MAAM,CAAC,MAAM,kCAAkC,GAAG,EAAE,CAAC;AACrD,MAAM,CAAC,MAAM,kCAAkC,GAAG,IAAI,CAAC;AACvD,MAAM,CAAC,MAAM,mCAAmC,GAAG,IAAI,CAAC"}
@@ -1,36 +0,0 @@
1
- import { Semaphore, SemaphoreInterface, withTimeout } from 'async-mutex';
2
-
3
- export interface SyncContextOptions {
4
- maxBuckets: number;
5
- maxParameterQueryResults: number;
6
- maxDataFetchConcurrency: number;
7
- }
8
-
9
- /**
10
- * Maximum duration to wait for the mutex to become available.
11
- *
12
- * This gives an explicit error if there are mutex issues, rather than just hanging.
13
- */
14
- const MUTEX_ACQUIRE_TIMEOUT = 30_000;
15
-
16
- /**
17
- * Represents the context in which sync happens.
18
- *
19
- * This is global to all sync requests, not per request.
20
- */
21
- export class SyncContext {
22
- readonly maxBuckets: number;
23
- readonly maxParameterQueryResults: number;
24
-
25
- readonly syncSemaphore: SemaphoreInterface;
26
-
27
- constructor(options: SyncContextOptions) {
28
- this.maxBuckets = options.maxBuckets;
29
- this.maxParameterQueryResults = options.maxParameterQueryResults;
30
- this.syncSemaphore = withTimeout(
31
- new Semaphore(options.maxDataFetchConcurrency),
32
- MUTEX_ACQUIRE_TIMEOUT,
33
- new Error(`Timeout while waiting for data`)
34
- );
35
- }
36
- }
@@ -1,5 +0,0 @@
1
- export const DEFAULT_MAX_POOL_SIZE = 8;
2
- export const DEFAULT_MAX_CONCURRENT_CONNECTIONS = 200;
3
- export const DEFAULT_MAX_DATA_FETCH_CONCURRENCY = 10;
4
- export const DEFAULT_MAX_BUCKETS_PER_CONNECTION = 1000;
5
- export const DEFAULT_MAX_PARAMETER_QUERY_RESULTS = 1000;