@powersync/service-core 0.0.0-dev-20250116115804 → 0.0.0-dev-20250122110924

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 (52) hide show
  1. package/CHANGELOG.md +13 -8
  2. package/dist/auth/RemoteJWKSCollector.d.ts +3 -0
  3. package/dist/auth/RemoteJWKSCollector.js +8 -4
  4. package/dist/auth/RemoteJWKSCollector.js.map +1 -1
  5. package/dist/entry/cli-entry.js +2 -0
  6. package/dist/entry/cli-entry.js.map +1 -1
  7. package/dist/entry/commands/teardown-action.js +2 -1
  8. package/dist/entry/commands/teardown-action.js.map +1 -1
  9. package/dist/entry/commands/test-connection-action.d.ts +2 -0
  10. package/dist/entry/commands/test-connection-action.js +32 -0
  11. package/dist/entry/commands/test-connection-action.js.map +1 -0
  12. package/dist/metrics/Metrics.js +2 -2
  13. package/dist/metrics/Metrics.js.map +1 -1
  14. package/dist/replication/AbstractReplicator.d.ts +2 -0
  15. package/dist/replication/AbstractReplicator.js.map +1 -1
  16. package/dist/replication/ReplicationEngine.d.ts +2 -0
  17. package/dist/replication/ReplicationEngine.js +3 -0
  18. package/dist/replication/ReplicationEngine.js.map +1 -1
  19. package/dist/replication/ReplicationModule.d.ts +8 -2
  20. package/dist/replication/ReplicationModule.js +6 -11
  21. package/dist/replication/ReplicationModule.js.map +1 -1
  22. package/dist/routes/endpoints/admin.js +3 -3
  23. package/dist/routes/endpoints/admin.js.map +1 -1
  24. package/dist/routes/endpoints/socket-route.js +5 -5
  25. package/dist/routes/endpoints/socket-route.js.map +1 -1
  26. package/dist/routes/endpoints/sync-rules.js +9 -9
  27. package/dist/routes/endpoints/sync-rules.js.map +1 -1
  28. package/dist/routes/endpoints/sync-stream.js +5 -5
  29. package/dist/routes/endpoints/sync-stream.js.map +1 -1
  30. package/dist/routes/route-register.js +4 -4
  31. package/dist/routes/route-register.js.map +1 -1
  32. package/dist/util/config/compound-config-collector.js +6 -9
  33. package/dist/util/config/compound-config-collector.js.map +1 -1
  34. package/dist/util/utils.js +2 -1
  35. package/dist/util/utils.js.map +1 -1
  36. package/package.json +5 -5
  37. package/src/auth/RemoteJWKSCollector.ts +18 -5
  38. package/src/entry/cli-entry.ts +2 -0
  39. package/src/entry/commands/teardown-action.ts +2 -1
  40. package/src/entry/commands/test-connection-action.ts +41 -0
  41. package/src/metrics/Metrics.ts +2 -2
  42. package/src/replication/AbstractReplicator.ts +3 -0
  43. package/src/replication/ReplicationEngine.ts +5 -0
  44. package/src/replication/ReplicationModule.ts +15 -13
  45. package/src/routes/endpoints/admin.ts +3 -3
  46. package/src/routes/endpoints/socket-route.ts +5 -5
  47. package/src/routes/endpoints/sync-rules.ts +9 -9
  48. package/src/routes/endpoints/sync-stream.ts +5 -5
  49. package/src/routes/route-register.ts +4 -4
  50. package/src/util/config/compound-config-collector.ts +7 -9
  51. package/src/util/utils.ts +2 -1
  52. package/tsconfig.tsbuildinfo +1 -1
@@ -95,18 +95,16 @@ export class CompoundConfigCollector {
95
95
  reject_ip_ranges: []
96
96
  };
97
97
 
98
- const block_local_jwks = baseConfig.client_auth?.block_local_jwks;
99
- if (block_local_jwks == true) {
98
+ if (baseConfig.client_auth?.jwks_reject_ip_ranges != null) {
100
99
  jwksLookup = {
101
- reject_ip_ranges: ['local'],
102
- reject_ipv6: true
103
- };
104
- } else if (Array.isArray(block_local_jwks)) {
105
- jwksLookup = {
106
- reject_ip_ranges: block_local_jwks,
107
- reject_ipv6: true
100
+ reject_ip_ranges: baseConfig.client_auth?.jwks_reject_ip_ranges
108
101
  };
109
102
  }
103
+ if (baseConfig.client_auth?.block_local_jwks) {
104
+ // Deprecated - recommend method is to use jwks_reject_ip_ranges
105
+ jwksLookup.reject_ip_ranges.push('local');
106
+ jwksLookup.reject_ipv6 = true;
107
+ }
110
108
 
111
109
  for (let uri of jwks_uris) {
112
110
  collectors.add(new auth.CachedKeyCollector(new auth.RemoteJWKSCollector(uri, { lookupOptions: jwksLookup })));
package/src/util/utils.ts CHANGED
@@ -7,6 +7,7 @@ import { BucketChecksum, OpId, OplogEntry } from './protocol-types.js';
7
7
  import * as storage from '../storage/storage-index.js';
8
8
 
9
9
  import { PartialChecksum } from '../storage/ChecksumCache.js';
10
+ import { ServiceAssertionError } from '@powersync/lib-services-framework';
10
11
 
11
12
  export type ChecksumMap = Map<string, BucketChecksum>;
12
13
 
@@ -34,7 +35,7 @@ export function timestampToOpId(ts: bigint): OpId {
34
35
  // Dynamic values are passed in in some cases, so we make extra sure that the
35
36
  // number is a bigint and not number or Long.
36
37
  if (typeof ts != 'bigint') {
37
- throw new Error(`bigint expected, got: ${ts} (${typeof ts})`);
38
+ throw new ServiceAssertionError(`bigint expected, got: ${ts} (${typeof ts})`);
38
39
  }
39
40
  return ts.toString(10);
40
41
  }