@powersync/service-module-postgres-storage 0.0.0-dev-20250820110726 → 0.0.0-dev-20250825132649
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 -9
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/storage/PostgresReportStorageFactory.d.ts +2 -2
- package/dist/@types/storage/storage-index.d.ts +0 -1
- package/dist/@types/{storage/PostgresTestStorageFactoryGenerator.d.ts → utils/test-utils.d.ts} +4 -4
- package/dist/@types/utils/utils-index.d.ts +1 -0
- package/dist/storage/PostgresReportStorageFactory.js +4 -56
- package/dist/storage/PostgresReportStorageFactory.js.map +1 -1
- package/dist/storage/storage-index.js +0 -1
- package/dist/storage/storage-index.js.map +1 -1
- package/dist/{storage/PostgresTestStorageFactoryGenerator.js → utils/test-utils.js} +7 -7
- package/dist/utils/test-utils.js.map +1 -0
- package/dist/utils/utils-index.js +1 -0
- package/dist/utils/utils-index.js.map +1 -1
- package/package.json +9 -9
- package/src/storage/PostgresReportStorageFactory.ts +9 -59
- package/src/storage/storage-index.ts +0 -1
- package/src/{storage/PostgresTestStorageFactoryGenerator.ts → utils/test-utils.ts} +6 -6
- package/src/utils/utils-index.ts +1 -0
- package/test/src/__snapshots__/connection-report-storage.test.ts.snap +31 -18
- package/test/src/__snapshots__/storage_sync.test.ts.snap +12 -11
- package/test/src/connection-report-storage.test.ts +22 -27
- package/test/src/util.ts +2 -1
- package/dist/storage/PostgresTestStorageFactoryGenerator.js.map +0 -1
|
@@ -16,8 +16,8 @@ export declare class PostgresReportStorageFactory implements storage.ReportStora
|
|
|
16
16
|
private updateTableFilter;
|
|
17
17
|
reportClientConnection(data: event_types.ClientConnectionBucketData): Promise<void>;
|
|
18
18
|
reportClientDisconnection(data: event_types.ClientDisconnectionEventData): Promise<void>;
|
|
19
|
-
getConnectedClients(
|
|
20
|
-
getClientConnectionReports(data: event_types.ClientConnectionReportRequest): Promise<event_types.
|
|
19
|
+
getConnectedClients(): Promise<event_types.ClientConnectionReportResponse>;
|
|
20
|
+
getClientConnectionReports(data: event_types.ClientConnectionReportRequest): Promise<event_types.ClientConnectionReportResponse>;
|
|
21
21
|
deleteOldConnectionData(data: event_types.DeleteOldConnectionData): Promise<void>;
|
|
22
22
|
[Symbol.asyncDispose](): Promise<void>;
|
|
23
23
|
prepareStatements(connection: pg_wire.PgConnection): Promise<void>;
|
package/dist/@types/{storage/PostgresTestStorageFactoryGenerator.d.ts → utils/test-utils.d.ts}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { framework, TestStorageOptions } from '@powersync/service-core';
|
|
2
2
|
import { PostgresMigrationAgent } from '../migrations/PostgresMigrationAgent.js';
|
|
3
3
|
import { PostgresStorageConfigDecoded } from '../types/types.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { PostgresReportStorageFactory } from '../storage/PostgresReportStorageFactory.js';
|
|
5
|
+
import { PostgresBucketStorageFactory } from '../storage/PostgresBucketStorageFactory.js';
|
|
6
6
|
export type PostgresTestStorageOptions = {
|
|
7
7
|
url: string;
|
|
8
8
|
/**
|
|
@@ -11,9 +11,9 @@ export type PostgresTestStorageOptions = {
|
|
|
11
11
|
*/
|
|
12
12
|
migrationAgent?: (config: PostgresStorageConfigDecoded) => PostgresMigrationAgent;
|
|
13
13
|
};
|
|
14
|
-
export declare
|
|
14
|
+
export declare function postgresTestSetup(factoryOptions: PostgresTestStorageOptions): {
|
|
15
15
|
reportFactory: (options?: TestStorageOptions) => Promise<PostgresReportStorageFactory>;
|
|
16
16
|
factory: (options?: TestStorageOptions) => Promise<PostgresBucketStorageFactory>;
|
|
17
17
|
migrate: (direction: framework.migrations.Direction) => Promise<void>;
|
|
18
18
|
};
|
|
19
|
-
export declare
|
|
19
|
+
export declare function postgresTestStorageFactoryGenerator(factoryOptions: PostgresTestStorageOptions): (options?: TestStorageOptions) => Promise<PostgresBucketStorageFactory>;
|
|
@@ -44,57 +44,7 @@ export class PostgresReportStorageFactory {
|
|
|
44
44
|
sdks: result.sdks?.data || []
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
async listConnectionsQuery(
|
|
48
|
-
const { range } = data;
|
|
49
|
-
if (!range) {
|
|
50
|
-
return this.db.sql `
|
|
51
|
-
WITH
|
|
52
|
-
filtered AS (
|
|
53
|
-
SELECT
|
|
54
|
-
*
|
|
55
|
-
FROM
|
|
56
|
-
connection_report_events
|
|
57
|
-
WHERE
|
|
58
|
-
disconnected_at IS NULL
|
|
59
|
-
AND jwt_exp > NOW()
|
|
60
|
-
),
|
|
61
|
-
unique_users AS (
|
|
62
|
-
SELECT
|
|
63
|
-
COUNT(DISTINCT user_id) AS count
|
|
64
|
-
FROM
|
|
65
|
-
filtered
|
|
66
|
-
),
|
|
67
|
-
sdk_versions_array AS (
|
|
68
|
-
SELECT
|
|
69
|
-
sdk,
|
|
70
|
-
COUNT(DISTINCT client_id) AS clients,
|
|
71
|
-
COUNT(DISTINCT user_id) AS users
|
|
72
|
-
FROM
|
|
73
|
-
filtered
|
|
74
|
-
GROUP BY
|
|
75
|
-
sdk
|
|
76
|
-
)
|
|
77
|
-
SELECT
|
|
78
|
-
(
|
|
79
|
-
SELECT
|
|
80
|
-
COALESCE(count, 0)
|
|
81
|
-
FROM
|
|
82
|
-
unique_users
|
|
83
|
-
) AS users,
|
|
84
|
-
(
|
|
85
|
-
SELECT
|
|
86
|
-
JSON_AGG(ROW_TO_JSON(s))
|
|
87
|
-
FROM
|
|
88
|
-
sdk_versions_array s
|
|
89
|
-
) AS sdks;
|
|
90
|
-
`
|
|
91
|
-
.decoded(SdkReporting)
|
|
92
|
-
.first();
|
|
93
|
-
}
|
|
94
|
-
const endDate = data.range?.end ? new Date(data.range.end) : new Date();
|
|
95
|
-
const startDate = new Date(range.start);
|
|
96
|
-
const lt = endDate.toISOString();
|
|
97
|
-
const gt = startDate.toISOString();
|
|
47
|
+
async listConnectionsQuery() {
|
|
98
48
|
return await this.db.sql `
|
|
99
49
|
WITH
|
|
100
50
|
filtered AS (
|
|
@@ -104,9 +54,7 @@ export class PostgresReportStorageFactory {
|
|
|
104
54
|
connection_report_events
|
|
105
55
|
WHERE
|
|
106
56
|
disconnected_at IS NULL
|
|
107
|
-
AND jwt_exp > NOW()
|
|
108
|
-
AND connected_at >= ${{ type: 1184, value: gt }}
|
|
109
|
-
AND connected_at <= ${{ type: 1184, value: lt }}
|
|
57
|
+
AND jwt_exp > NOW() AT TIME ZONE 'UTC'
|
|
110
58
|
),
|
|
111
59
|
unique_users AS (
|
|
112
60
|
SELECT
|
|
@@ -209,8 +157,8 @@ export class PostgresReportStorageFactory {
|
|
|
209
157
|
AND connected_at = ${{ type: 1184, value: connectIsoString }}
|
|
210
158
|
`.execute();
|
|
211
159
|
}
|
|
212
|
-
async getConnectedClients(
|
|
213
|
-
const result = await this.listConnectionsQuery(
|
|
160
|
+
async getConnectedClients() {
|
|
161
|
+
const result = await this.listConnectionsQuery();
|
|
214
162
|
return this.mapListCurrentConnectionsResponse(result);
|
|
215
163
|
}
|
|
216
164
|
async getClientConnectionReports(data) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostgresReportStorageFactory.js","sourceRoot":"","sources":["../../src/storage/PostgresReportStorageFactory.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,OAAO,KAAK,YAAY,MAAM,iCAAiC,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAuB,MAAM,iCAAiC,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAMrD,MAAM,OAAO,4BAA4B;IAEjB;IADb,EAAE,CAA8B;IACzC,YAAsB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I,GAAG,CAAC,CAAC;QAC7E,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;YACpB,MAAM,CAAC,IAAI,CACT,YAAY,IAAI,CAAC,WAAW,EAAE,KAAK,WAAW,oEAAoE,CACnH,CAAC;QACJ,CAAC;IACH,CAAC;IAED,KAAK,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;QACzB,MAAM,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,UAAgC;QACtD,+EAA+E;QAC/E,qCAAqC;IACvC,CAAC;CACF"}
|
|
@@ -2,5 +2,4 @@ export * from './PostgresBucketStorageFactory.js';
|
|
|
2
2
|
export * from './PostgresCompactor.js';
|
|
3
3
|
export * from './PostgresStorageProvider.js';
|
|
4
4
|
export * from './PostgresSyncRulesStorage.js';
|
|
5
|
-
export * from './PostgresTestStorageFactoryGenerator.js';
|
|
6
5
|
//# sourceMappingURL=storage-index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-index.js","sourceRoot":"","sources":["../../src/storage/storage-index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC
|
|
1
|
+
{"version":3,"file":"storage-index.js","sourceRoot":"","sources":["../../src/storage/storage-index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC"}
|
|
@@ -53,9 +53,9 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
|
|
|
53
53
|
import { framework } from '@powersync/service-core';
|
|
54
54
|
import { PostgresMigrationAgent } from '../migrations/PostgresMigrationAgent.js';
|
|
55
55
|
import { normalizePostgresStorageConfig } from '../types/types.js';
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
export
|
|
56
|
+
import { PostgresReportStorageFactory } from '../storage/PostgresReportStorageFactory.js';
|
|
57
|
+
import { PostgresBucketStorageFactory } from '../storage/PostgresBucketStorageFactory.js';
|
|
58
|
+
export function postgresTestSetup(factoryOptions) {
|
|
59
59
|
const BASE_CONFIG = {
|
|
60
60
|
type: 'postgresql',
|
|
61
61
|
uri: factoryOptions.url,
|
|
@@ -130,8 +130,8 @@ export const postgresTestSetup = (factoryOptions) => {
|
|
|
130
130
|
},
|
|
131
131
|
migrate
|
|
132
132
|
};
|
|
133
|
-
}
|
|
134
|
-
export
|
|
133
|
+
}
|
|
134
|
+
export function postgresTestStorageFactoryGenerator(factoryOptions) {
|
|
135
135
|
return postgresTestSetup(factoryOptions).factory;
|
|
136
|
-
}
|
|
137
|
-
//# sourceMappingURL=
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=test-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-utils.js","sourceRoot":"","sources":["../../src/utils/test-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAiE,MAAM,yBAAyB,CAAC;AACnH,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,8BAA8B,EAAgC,MAAM,mBAAmB,CAAC;AACjG,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAW1F,MAAM,UAAU,iBAAiB,CAAC,cAA0C;IAC1E,MAAM,WAAW,GAAG;QAClB,IAAI,EAAE,YAAqB;QAC3B,GAAG,EAAE,cAAc,CAAC,GAAG;QACvB,OAAO,EAAE,SAAkB;KAC5B,CAAC;IAEF,MAAM,uBAAuB,GAAG,8BAA8B,CAAC,WAAW,CAA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AO,EAAE,EAAE,CAAC;gBACZ,iFAAiF;gBACjF,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;gBAC5B,MAAM,EAAE,CAAC;YACX,CAAC;QACH,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,OAA4B,EAAE,EAAE;YAC9C,IAAI,CAAC;gBACH,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,CAAC;oBACzB,MAAM,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;gBACnD,CAAC;gBAED,OAAO,IAAI,4BAA4B,CAAC;oBACtC,MAAM,EAAE,uBAAuB;oBAC/B,gBAAgB,EAAE,OAAO;iBAC1B,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,EAAE,EAAE,CAAC;gBACZ,iFAAiF;gBACjF,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;gBAC5B,MAAM,EAAE,CAAC;YACX,CAAC;QACH,CAAC;QACD,OAAO;KACR,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mCAAmC,CAAC,cAA0C;IAC5F,OAAO,iBAAiB,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC;AACnD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-index.js","sourceRoot":"","sources":["../../src/utils/utils-index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"utils-index.js","sourceRoot":"","sources":["../../src/utils/utils-index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@powersync/service-module-postgres-storage",
|
|
3
3
|
"repository": "https://github.com/powersync-ja/powersync-service",
|
|
4
4
|
"types": "dist/@types/index.d.ts",
|
|
5
|
-
"version": "0.0.0-dev-
|
|
5
|
+
"version": "0.0.0-dev-20250825132649",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"publishConfig": {
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"p-defer": "^4.0.1",
|
|
29
29
|
"ts-codec": "^1.3.0",
|
|
30
30
|
"uuid": "^11.1.0",
|
|
31
|
-
"@powersync/lib-service-postgres": "0.0.0-dev-
|
|
32
|
-
"@powersync/lib-services-framework": "0.0.0-dev-
|
|
33
|
-
"@powersync/service-core": "0.0.0-dev-
|
|
34
|
-
"@powersync/service-types": "0.0.0-dev-
|
|
35
|
-
"@powersync/service-core-tests": "0.0.0-dev-
|
|
36
|
-
"@powersync/service-jpgwire": "0.0.0-dev-
|
|
37
|
-
"@powersync/service-jsonbig": "0.0.0-dev-
|
|
38
|
-
"@powersync/service-sync-rules": "0.0.0-dev-
|
|
31
|
+
"@powersync/lib-service-postgres": "0.0.0-dev-20250825132649",
|
|
32
|
+
"@powersync/lib-services-framework": "0.0.0-dev-20250825132649",
|
|
33
|
+
"@powersync/service-core": "0.0.0-dev-20250825132649",
|
|
34
|
+
"@powersync/service-types": "0.0.0-dev-20250825132649",
|
|
35
|
+
"@powersync/service-core-tests": "0.0.0-dev-20250825132649",
|
|
36
|
+
"@powersync/service-jpgwire": "0.0.0-dev-20250825132649",
|
|
37
|
+
"@powersync/service-jsonbig": "0.0.0-dev-20250825132649",
|
|
38
|
+
"@powersync/service-sync-rules": "0.0.0-dev-20250825132649"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"typescript": "^5.7.3"
|
|
@@ -42,7 +42,9 @@ export class PostgresReportStorageFactory implements storage.ReportStorage {
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
private mapListCurrentConnectionsResponse(
|
|
45
|
+
private mapListCurrentConnectionsResponse(
|
|
46
|
+
result: SdkReportingDecoded | null
|
|
47
|
+
): event_types.ClientConnectionReportResponse {
|
|
46
48
|
if (!result) {
|
|
47
49
|
return {
|
|
48
50
|
users: 0,
|
|
@@ -54,57 +56,7 @@ export class PostgresReportStorageFactory implements storage.ReportStorage {
|
|
|
54
56
|
sdks: result.sdks?.data || []
|
|
55
57
|
};
|
|
56
58
|
}
|
|
57
|
-
private async listConnectionsQuery(
|
|
58
|
-
const { range } = data;
|
|
59
|
-
if (!range) {
|
|
60
|
-
return this.db.sql`
|
|
61
|
-
WITH
|
|
62
|
-
filtered AS (
|
|
63
|
-
SELECT
|
|
64
|
-
*
|
|
65
|
-
FROM
|
|
66
|
-
connection_report_events
|
|
67
|
-
WHERE
|
|
68
|
-
disconnected_at IS NULL
|
|
69
|
-
AND jwt_exp > NOW()
|
|
70
|
-
),
|
|
71
|
-
unique_users AS (
|
|
72
|
-
SELECT
|
|
73
|
-
COUNT(DISTINCT user_id) AS count
|
|
74
|
-
FROM
|
|
75
|
-
filtered
|
|
76
|
-
),
|
|
77
|
-
sdk_versions_array AS (
|
|
78
|
-
SELECT
|
|
79
|
-
sdk,
|
|
80
|
-
COUNT(DISTINCT client_id) AS clients,
|
|
81
|
-
COUNT(DISTINCT user_id) AS users
|
|
82
|
-
FROM
|
|
83
|
-
filtered
|
|
84
|
-
GROUP BY
|
|
85
|
-
sdk
|
|
86
|
-
)
|
|
87
|
-
SELECT
|
|
88
|
-
(
|
|
89
|
-
SELECT
|
|
90
|
-
COALESCE(count, 0)
|
|
91
|
-
FROM
|
|
92
|
-
unique_users
|
|
93
|
-
) AS users,
|
|
94
|
-
(
|
|
95
|
-
SELECT
|
|
96
|
-
JSON_AGG(ROW_TO_JSON(s))
|
|
97
|
-
FROM
|
|
98
|
-
sdk_versions_array s
|
|
99
|
-
) AS sdks;
|
|
100
|
-
`
|
|
101
|
-
.decoded(SdkReporting)
|
|
102
|
-
.first();
|
|
103
|
-
}
|
|
104
|
-
const endDate = data.range?.end ? new Date(data.range.end) : new Date();
|
|
105
|
-
const startDate = new Date(range.start);
|
|
106
|
-
const lt = endDate.toISOString();
|
|
107
|
-
const gt = startDate.toISOString();
|
|
59
|
+
private async listConnectionsQuery() {
|
|
108
60
|
return await this.db.sql`
|
|
109
61
|
WITH
|
|
110
62
|
filtered AS (
|
|
@@ -114,9 +66,7 @@ export class PostgresReportStorageFactory implements storage.ReportStorage {
|
|
|
114
66
|
connection_report_events
|
|
115
67
|
WHERE
|
|
116
68
|
disconnected_at IS NULL
|
|
117
|
-
AND jwt_exp > NOW()
|
|
118
|
-
AND connected_at >= ${{ type: 1184, value: gt }}
|
|
119
|
-
AND connected_at <= ${{ type: 1184, value: lt }}
|
|
69
|
+
AND jwt_exp > NOW() AT TIME ZONE 'UTC'
|
|
120
70
|
),
|
|
121
71
|
unique_users AS (
|
|
122
72
|
SELECT
|
|
@@ -164,7 +114,7 @@ export class PostgresReportStorageFactory implements storage.ReportStorage {
|
|
|
164
114
|
async reportClientConnection(data: event_types.ClientConnectionBucketData): Promise<void> {
|
|
165
115
|
const { sdk, connected_at, user_id, user_agent, jwt_exp, client_id } = data;
|
|
166
116
|
const connectIsoString = connected_at.toISOString();
|
|
167
|
-
const jwtExpIsoString = jwt_exp
|
|
117
|
+
const jwtExpIsoString = jwt_exp.toISOString();
|
|
168
118
|
const { gte, lt } = this.updateTableFilter();
|
|
169
119
|
const uuid = v4();
|
|
170
120
|
const result = await this.db.sql`
|
|
@@ -221,14 +171,14 @@ export class PostgresReportStorageFactory implements storage.ReportStorage {
|
|
|
221
171
|
AND connected_at = ${{ type: 1184, value: connectIsoString }}
|
|
222
172
|
`.execute();
|
|
223
173
|
}
|
|
224
|
-
async getConnectedClients(
|
|
225
|
-
const result = await this.listConnectionsQuery(
|
|
174
|
+
async getConnectedClients(): Promise<event_types.ClientConnectionReportResponse> {
|
|
175
|
+
const result = await this.listConnectionsQuery();
|
|
226
176
|
return this.mapListCurrentConnectionsResponse(result);
|
|
227
177
|
}
|
|
228
178
|
|
|
229
179
|
async getClientConnectionReports(
|
|
230
180
|
data: event_types.ClientConnectionReportRequest
|
|
231
|
-
): Promise<event_types.
|
|
181
|
+
): Promise<event_types.ClientConnectionReportResponse> {
|
|
232
182
|
const { start, end } = data;
|
|
233
183
|
const result = await this.db.sql`
|
|
234
184
|
WITH
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { framework, PowerSyncMigrationManager, ServiceContext, TestStorageOptions } from '@powersync/service-core';
|
|
2
2
|
import { PostgresMigrationAgent } from '../migrations/PostgresMigrationAgent.js';
|
|
3
3
|
import { normalizePostgresStorageConfig, PostgresStorageConfigDecoded } from '../types/types.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { PostgresReportStorageFactory } from '../storage/PostgresReportStorageFactory.js';
|
|
5
|
+
import { PostgresBucketStorageFactory } from '../storage/PostgresBucketStorageFactory.js';
|
|
6
6
|
|
|
7
7
|
export type PostgresTestStorageOptions = {
|
|
8
8
|
url: string;
|
|
@@ -13,7 +13,7 @@ export type PostgresTestStorageOptions = {
|
|
|
13
13
|
migrationAgent?: (config: PostgresStorageConfigDecoded) => PostgresMigrationAgent;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
export
|
|
16
|
+
export function postgresTestSetup(factoryOptions: PostgresTestStorageOptions) {
|
|
17
17
|
const BASE_CONFIG = {
|
|
18
18
|
type: 'postgresql' as const,
|
|
19
19
|
uri: factoryOptions.url,
|
|
@@ -82,8 +82,8 @@ export const postgresTestSetup = (factoryOptions: PostgresTestStorageOptions) =>
|
|
|
82
82
|
},
|
|
83
83
|
migrate
|
|
84
84
|
};
|
|
85
|
-
}
|
|
85
|
+
}
|
|
86
86
|
|
|
87
|
-
export
|
|
87
|
+
export function postgresTestStorageFactoryGenerator(factoryOptions: PostgresTestStorageOptions) {
|
|
88
88
|
return postgresTestSetup(factoryOptions).factory;
|
|
89
|
-
}
|
|
89
|
+
}
|
package/src/utils/utils-index.ts
CHANGED
|
@@ -17,23 +17,6 @@ exports[`Connection report storage > Should create a connection event if its aft
|
|
|
17
17
|
]
|
|
18
18
|
`;
|
|
19
19
|
|
|
20
|
-
exports[`Connection report storage > Should create a sdk event if its after a day 1`] = `
|
|
21
|
-
[
|
|
22
|
-
{
|
|
23
|
-
"client_id": "client_week",
|
|
24
|
-
"sdk": "powersync-js/1.24.5",
|
|
25
|
-
"user_agent": "powersync-js/1.21.0 powersync-web Firefox/141 linux",
|
|
26
|
-
"user_id": "user_week",
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"client_id": "client_week",
|
|
30
|
-
"sdk": "powersync-js/1.24.5",
|
|
31
|
-
"user_agent": "powersync-js/1.21.0 powersync-web Firefox/141 linux",
|
|
32
|
-
"user_id": "user_week",
|
|
33
|
-
},
|
|
34
|
-
]
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
20
|
exports[`Connection report storage > Should delete rows older than specified range 1`] = `
|
|
38
21
|
{
|
|
39
22
|
"sdks": [
|
|
@@ -62,6 +45,11 @@ exports[`Connection report storage > Should delete rows older than specified ran
|
|
|
62
45
|
"sdk": "powersync-js/1.24.5",
|
|
63
46
|
"users": 1,
|
|
64
47
|
},
|
|
48
|
+
{
|
|
49
|
+
"clients": 1,
|
|
50
|
+
"sdk": "unknown",
|
|
51
|
+
"users": 1,
|
|
52
|
+
},
|
|
65
53
|
],
|
|
66
54
|
"users": 5,
|
|
67
55
|
}
|
|
@@ -75,8 +63,18 @@ exports[`Connection report storage > Should show connected users with start rang
|
|
|
75
63
|
"sdk": "powersync-dart/1.6.4",
|
|
76
64
|
"users": 1,
|
|
77
65
|
},
|
|
66
|
+
{
|
|
67
|
+
"clients": 1,
|
|
68
|
+
"sdk": "powersync-js/1.21.1",
|
|
69
|
+
"users": 1,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"clients": 1,
|
|
73
|
+
"sdk": "unknown",
|
|
74
|
+
"users": 1,
|
|
75
|
+
},
|
|
78
76
|
],
|
|
79
|
-
"users":
|
|
77
|
+
"users": 2,
|
|
80
78
|
}
|
|
81
79
|
`;
|
|
82
80
|
|
|
@@ -111,6 +109,11 @@ exports[`Connection report storage > Should show connection report data for user
|
|
|
111
109
|
"sdk": "powersync-js/1.21.4",
|
|
112
110
|
"users": 1,
|
|
113
111
|
},
|
|
112
|
+
{
|
|
113
|
+
"clients": 1,
|
|
114
|
+
"sdk": "unknown",
|
|
115
|
+
"users": 1,
|
|
116
|
+
},
|
|
114
117
|
],
|
|
115
118
|
"users": 3,
|
|
116
119
|
}
|
|
@@ -154,6 +157,11 @@ exports[`Connection report storage > Should show connection report data for user
|
|
|
154
157
|
"sdk": "powersync-js/1.24.5",
|
|
155
158
|
"users": 1,
|
|
156
159
|
},
|
|
160
|
+
{
|
|
161
|
+
"clients": 1,
|
|
162
|
+
"sdk": "unknown",
|
|
163
|
+
"users": 1,
|
|
164
|
+
},
|
|
157
165
|
],
|
|
158
166
|
"users": 7,
|
|
159
167
|
}
|
|
@@ -187,6 +195,11 @@ exports[`Connection report storage > Should show connection report data for user
|
|
|
187
195
|
"sdk": "powersync-js/1.24.5",
|
|
188
196
|
"users": 1,
|
|
189
197
|
},
|
|
198
|
+
{
|
|
199
|
+
"clients": 1,
|
|
200
|
+
"sdk": "unknown",
|
|
201
|
+
"users": 1,
|
|
202
|
+
},
|
|
190
203
|
],
|
|
191
204
|
"users": 5,
|
|
192
205
|
}
|
|
@@ -39,7 +39,7 @@ exports[`sync - postgres > compacting data - invalidate checkpoint 2`] = `
|
|
|
39
39
|
"bucket": "mybucket[]",
|
|
40
40
|
"data": [
|
|
41
41
|
{
|
|
42
|
-
"checksum": -
|
|
42
|
+
"checksum": -93886621,
|
|
43
43
|
"op": "CLEAR",
|
|
44
44
|
"op_id": "2",
|
|
45
45
|
},
|
|
@@ -74,7 +74,7 @@ exports[`sync - postgres > compacting data - invalidate checkpoint 2`] = `
|
|
|
74
74
|
"bucket": "mybucket[]",
|
|
75
75
|
"data": [
|
|
76
76
|
{
|
|
77
|
-
"checksum":
|
|
77
|
+
"checksum": 1859363232,
|
|
78
78
|
"data": "{"id":"t1","description":"Test 1b"}",
|
|
79
79
|
"object_id": "t1",
|
|
80
80
|
"object_type": "test",
|
|
@@ -83,7 +83,7 @@ exports[`sync - postgres > compacting data - invalidate checkpoint 2`] = `
|
|
|
83
83
|
"subkey": "02d285ac-4f96-5124-8fba-c6d1df992dd1",
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
|
-
"checksum":
|
|
86
|
+
"checksum": 3028503153,
|
|
87
87
|
"data": "{"id":"t2","description":"Test 2b"}",
|
|
88
88
|
"object_id": "t2",
|
|
89
89
|
"object_type": "test",
|
|
@@ -203,6 +203,7 @@ exports[`sync - postgres > sends checkpoint complete line for empty checkpoint 1
|
|
|
203
203
|
"next_after": "1",
|
|
204
204
|
},
|
|
205
205
|
},
|
|
206
|
+
null,
|
|
206
207
|
{
|
|
207
208
|
"checkpoint_complete": {
|
|
208
209
|
"last_op_id": "1",
|
|
@@ -274,7 +275,7 @@ exports[`sync - postgres > sync buckets in order 1`] = `
|
|
|
274
275
|
"bucket": "b1[]",
|
|
275
276
|
"data": [
|
|
276
277
|
{
|
|
277
|
-
"checksum":
|
|
278
|
+
"checksum": 2912868539,
|
|
278
279
|
"data": "{"id":"earlier","description":"Test 2"}",
|
|
279
280
|
"object_id": "earlier",
|
|
280
281
|
"object_type": "test",
|
|
@@ -299,7 +300,7 @@ exports[`sync - postgres > sync buckets in order 1`] = `
|
|
|
299
300
|
"bucket": "b0[]",
|
|
300
301
|
"data": [
|
|
301
302
|
{
|
|
302
|
-
"checksum":
|
|
303
|
+
"checksum": 920318466,
|
|
303
304
|
"data": "{"id":"t1","description":"Test 1"}",
|
|
304
305
|
"object_id": "t1",
|
|
305
306
|
"object_type": "test",
|
|
@@ -354,7 +355,7 @@ exports[`sync - postgres > sync global data 1`] = `
|
|
|
354
355
|
"bucket": "mybucket[]",
|
|
355
356
|
"data": [
|
|
356
357
|
{
|
|
357
|
-
"checksum":
|
|
358
|
+
"checksum": 920318466,
|
|
358
359
|
"data": "{"id":"t1","description":"Test 1"}",
|
|
359
360
|
"object_id": "t1",
|
|
360
361
|
"object_type": "test",
|
|
@@ -363,7 +364,7 @@ exports[`sync - postgres > sync global data 1`] = `
|
|
|
363
364
|
"subkey": "02d285ac-4f96-5124-8fba-c6d1df992dd1",
|
|
364
365
|
},
|
|
365
366
|
{
|
|
366
|
-
"checksum":
|
|
367
|
+
"checksum": 3280762209,
|
|
367
368
|
"data": "{"id":"t2","description":"Test 2"}",
|
|
368
369
|
"object_id": "t2",
|
|
369
370
|
"object_type": "test",
|
|
@@ -702,7 +703,7 @@ exports[`sync - postgres > sync updates to data query only 2`] = `
|
|
|
702
703
|
"bucket": "by_user["user1"]",
|
|
703
704
|
"data": [
|
|
704
705
|
{
|
|
705
|
-
"checksum":
|
|
706
|
+
"checksum": 1418351250,
|
|
706
707
|
"data": "{"id":"list1","user_id":"user1","name":"User 1"}",
|
|
707
708
|
"object_id": "list1",
|
|
708
709
|
"object_type": "lists",
|
|
@@ -787,7 +788,7 @@ exports[`sync - postgres > sync updates to global data 2`] = `
|
|
|
787
788
|
"bucket": "mybucket[]",
|
|
788
789
|
"data": [
|
|
789
790
|
{
|
|
790
|
-
"checksum":
|
|
791
|
+
"checksum": 920318466,
|
|
791
792
|
"data": "{"id":"t1","description":"Test 1"}",
|
|
792
793
|
"object_id": "t1",
|
|
793
794
|
"object_type": "test",
|
|
@@ -836,7 +837,7 @@ exports[`sync - postgres > sync updates to global data 3`] = `
|
|
|
836
837
|
"bucket": "mybucket[]",
|
|
837
838
|
"data": [
|
|
838
839
|
{
|
|
839
|
-
"checksum":
|
|
840
|
+
"checksum": 3280762209,
|
|
840
841
|
"data": "{"id":"t2","description":"Test 2"}",
|
|
841
842
|
"object_id": "t2",
|
|
842
843
|
"object_type": "test",
|
|
@@ -909,7 +910,7 @@ exports[`sync - postgres > sync updates to parameter query + data 2`] = `
|
|
|
909
910
|
"bucket": "by_user["user1"]",
|
|
910
911
|
"data": [
|
|
911
912
|
{
|
|
912
|
-
"checksum":
|
|
913
|
+
"checksum": 1418351250,
|
|
913
914
|
"data": "{"id":"list1","user_id":"user1","name":"User 1"}",
|
|
914
915
|
"object_id": "list1",
|
|
915
916
|
"object_type": "lists",
|