@powersync/service-core 0.0.0-dev-20250310190630 → 0.0.0-dev-20250312090341
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 +2 -7
- package/dist/api/api-index.d.ts +0 -1
- package/dist/api/api-index.js +0 -1
- package/dist/api/api-index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/metrics/Metrics.d.ts +30 -0
- package/dist/metrics/Metrics.js +202 -0
- package/dist/metrics/Metrics.js.map +1 -0
- package/dist/replication/AbstractReplicationJob.d.ts +0 -2
- package/dist/replication/AbstractReplicationJob.js.map +1 -1
- package/dist/replication/AbstractReplicator.d.ts +0 -3
- package/dist/replication/AbstractReplicator.js +0 -3
- package/dist/replication/AbstractReplicator.js.map +1 -1
- package/dist/replication/ReplicationModule.d.ts +0 -7
- package/dist/replication/ReplicationModule.js +0 -1
- package/dist/replication/ReplicationModule.js.map +1 -1
- package/dist/replication/replication-index.d.ts +0 -1
- package/dist/replication/replication-index.js +0 -1
- package/dist/replication/replication-index.js.map +1 -1
- package/dist/routes/endpoints/socket-route.js +5 -5
- package/dist/routes/endpoints/socket-route.js.map +1 -1
- package/dist/routes/endpoints/sync-stream.js +6 -6
- package/dist/routes/endpoints/sync-stream.js.map +1 -1
- package/dist/storage/SyncRulesBucketStorage.d.ts +2 -1
- package/dist/storage/SyncRulesBucketStorage.js +1 -1
- package/dist/storage/SyncRulesBucketStorage.js.map +1 -1
- package/dist/storage/bson.d.ts +1 -0
- package/dist/storage/bson.js +6 -10
- package/dist/storage/bson.js.map +1 -1
- package/dist/storage/storage-index.d.ts +0 -1
- package/dist/storage/storage-index.js +0 -1
- package/dist/storage/storage-index.js.map +1 -1
- package/dist/sync/BucketChecksumState.d.ts +3 -0
- package/dist/sync/BucketChecksumState.js +51 -21
- package/dist/sync/BucketChecksumState.js.map +1 -1
- package/dist/sync/RequestTracker.d.ts +0 -3
- package/dist/sync/RequestTracker.js +3 -8
- package/dist/sync/RequestTracker.js.map +1 -1
- package/dist/sync/util.d.ts +1 -0
- package/dist/sync/util.js +11 -0
- package/dist/sync/util.js.map +1 -1
- package/dist/system/ServiceContext.d.ts +3 -3
- package/dist/system/ServiceContext.js +3 -7
- package/dist/system/ServiceContext.js.map +1 -1
- package/dist/util/config/compound-config-collector.js +1 -2
- package/dist/util/config/compound-config-collector.js.map +1 -1
- package/package.json +7 -7
- package/src/api/api-index.ts +0 -1
- package/src/index.ts +2 -2
- package/src/metrics/Metrics.ts +255 -0
- package/src/replication/AbstractReplicationJob.ts +0 -2
- package/src/replication/AbstractReplicator.ts +0 -7
- package/src/replication/ReplicationModule.ts +0 -10
- package/src/replication/replication-index.ts +0 -1
- package/src/routes/endpoints/socket-route.ts +5 -6
- package/src/routes/endpoints/sync-stream.ts +6 -7
- package/src/storage/SyncRulesBucketStorage.ts +3 -2
- package/src/storage/bson.ts +7 -9
- package/src/storage/storage-index.ts +0 -1
- package/src/sync/BucketChecksumState.ts +54 -22
- package/src/sync/RequestTracker.ts +3 -9
- package/src/sync/util.ts +12 -0
- package/src/system/ServiceContext.ts +4 -9
- package/src/util/config/compound-config-collector.ts +1 -2
- package/test/src/sync/BucketChecksumState.test.ts +3 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/api/api-metrics.d.ts +0 -11
- package/dist/api/api-metrics.js +0 -30
- package/dist/api/api-metrics.js.map +0 -1
- package/dist/metrics/MetricsEngine.d.ts +0 -21
- package/dist/metrics/MetricsEngine.js +0 -79
- package/dist/metrics/MetricsEngine.js.map +0 -1
- package/dist/metrics/metrics-index.d.ts +0 -4
- package/dist/metrics/metrics-index.js +0 -5
- package/dist/metrics/metrics-index.js.map +0 -1
- package/dist/metrics/metrics-interfaces.d.ts +0 -36
- package/dist/metrics/metrics-interfaces.js +0 -6
- package/dist/metrics/metrics-interfaces.js.map +0 -1
- package/dist/metrics/open-telemetry/OpenTelemetryMetricsFactory.d.ts +0 -10
- package/dist/metrics/open-telemetry/OpenTelemetryMetricsFactory.js +0 -51
- package/dist/metrics/open-telemetry/OpenTelemetryMetricsFactory.js.map +0 -1
- package/dist/metrics/open-telemetry/util.d.ts +0 -6
- package/dist/metrics/open-telemetry/util.js +0 -56
- package/dist/metrics/open-telemetry/util.js.map +0 -1
- package/dist/replication/replication-metrics.d.ts +0 -11
- package/dist/replication/replication-metrics.js +0 -39
- package/dist/replication/replication-metrics.js.map +0 -1
- package/dist/storage/storage-metrics.d.ts +0 -4
- package/dist/storage/storage-metrics.js +0 -56
- package/dist/storage/storage-metrics.js.map +0 -1
- package/src/api/api-metrics.ts +0 -35
- package/src/metrics/MetricsEngine.ts +0 -98
- package/src/metrics/metrics-index.ts +0 -4
- package/src/metrics/metrics-interfaces.ts +0 -41
- package/src/metrics/open-telemetry/OpenTelemetryMetricsFactory.ts +0 -66
- package/src/metrics/open-telemetry/util.ts +0 -74
- package/src/replication/replication-metrics.ts +0 -45
- package/src/storage/storage-metrics.ts +0 -67
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LifeCycledSystem, MigrationManager, ServiceIdentifier, container } from '@powersync/lib-services-framework';
|
|
2
2
|
|
|
3
3
|
import { framework } from '../index.js';
|
|
4
|
-
import * as metrics from '../metrics/
|
|
4
|
+
import * as metrics from '../metrics/Metrics.js';
|
|
5
5
|
import { PowerSyncMigrationManager } from '../migrations/PowerSyncMigrationManager.js';
|
|
6
6
|
import * as replication from '../replication/replication-index.js';
|
|
7
7
|
import * as routes from '../routes/routes-index.js';
|
|
@@ -12,7 +12,7 @@ import { SyncContext } from '../sync/SyncContext.js';
|
|
|
12
12
|
export interface ServiceContext {
|
|
13
13
|
configuration: utils.ResolvedPowerSyncConfig;
|
|
14
14
|
lifeCycleEngine: LifeCycledSystem;
|
|
15
|
-
|
|
15
|
+
metrics: metrics.Metrics | null;
|
|
16
16
|
replicationEngine: replication.ReplicationEngine | null;
|
|
17
17
|
routerEngine: routes.RouterEngine | null;
|
|
18
18
|
storageEngine: storage.StorageEngine;
|
|
@@ -37,11 +37,6 @@ export class ServiceContextContainer implements ServiceContext {
|
|
|
37
37
|
configuration
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
this.lifeCycleEngine.withLifecycle(this.storageEngine, {
|
|
41
|
-
start: (storageEngine) => storageEngine.start(),
|
|
42
|
-
stop: (storageEngine) => storageEngine.shutDown()
|
|
43
|
-
});
|
|
44
|
-
|
|
45
40
|
this.syncContext = new SyncContext({
|
|
46
41
|
maxDataFetchConcurrency: configuration.api_parameters.max_data_fetch_concurrency,
|
|
47
42
|
maxBuckets: configuration.api_parameters.max_buckets_per_connection,
|
|
@@ -70,8 +65,8 @@ export class ServiceContextContainer implements ServiceContext {
|
|
|
70
65
|
return container.getOptional(routes.RouterEngine);
|
|
71
66
|
}
|
|
72
67
|
|
|
73
|
-
get
|
|
74
|
-
return container.
|
|
68
|
+
get metrics(): metrics.Metrics | null {
|
|
69
|
+
return container.getOptional(metrics.Metrics);
|
|
75
70
|
}
|
|
76
71
|
|
|
77
72
|
get migrations(): PowerSyncMigrationManager {
|
|
@@ -170,8 +170,7 @@ export class CompoundConfigCollector {
|
|
|
170
170
|
baseConfig.api?.parameters?.max_data_fetch_concurrency ?? DEFAULT_MAX_DATA_FETCH_CONCURRENCY
|
|
171
171
|
},
|
|
172
172
|
// TODO maybe move this out of the connection or something
|
|
173
|
-
|
|
174
|
-
slot_name_prefix: 'powersync_',
|
|
173
|
+
slot_name_prefix: baseConfig.replication?.connections?.[0]?.slot_name_prefix ?? 'powersync_',
|
|
175
174
|
parameters: baseConfig.parameters ?? {}
|
|
176
175
|
};
|
|
177
176
|
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
SyncContext,
|
|
9
9
|
WatchFilterEvent
|
|
10
10
|
} from '@/index.js';
|
|
11
|
+
import { JSONBig } from '@powersync/service-jsonbig';
|
|
11
12
|
import { RequestParameters, SqliteJsonRow, SqliteJsonValue, SqlSyncRules } from '@powersync/service-sync-rules';
|
|
12
13
|
import { describe, expect, test } from 'vitest';
|
|
13
14
|
|
|
@@ -99,7 +100,7 @@ bucket_definitions:
|
|
|
99
100
|
update: {
|
|
100
101
|
updatedDataBuckets: ['global[]'],
|
|
101
102
|
invalidateDataBuckets: false,
|
|
102
|
-
|
|
103
|
+
updatedParameterLookups: new Set(),
|
|
103
104
|
invalidateParameterBuckets: false
|
|
104
105
|
}
|
|
105
106
|
}))!;
|
|
@@ -533,7 +534,7 @@ bucket_definitions:
|
|
|
533
534
|
update: {
|
|
534
535
|
invalidateDataBuckets: false,
|
|
535
536
|
updatedDataBuckets: [],
|
|
536
|
-
|
|
537
|
+
updatedParameterLookups: new Set([JSONBig.stringify(['by_project', '1', 'u1'])]),
|
|
537
538
|
invalidateParameterBuckets: false
|
|
538
539
|
}
|
|
539
540
|
}))!;
|