@powersync/service-module-postgres-storage 0.0.0-dev-20250827072023 → 0.0.0-dev-20250828090417

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 (49) hide show
  1. package/CHANGELOG.md +20 -14
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/@types/storage/PostgresStorageProvider.d.ts +1 -1
  4. package/dist/@types/storage/PostgresSyncRulesStorage.d.ts +3 -1
  5. package/dist/@types/{utils/test-utils.d.ts → storage/PostgresTestStorageFactoryGenerator.d.ts} +3 -5
  6. package/dist/@types/storage/storage-index.d.ts +1 -0
  7. package/dist/@types/types/models/models-index.d.ts +0 -1
  8. package/dist/@types/utils/utils-index.d.ts +0 -1
  9. package/dist/migrations/scripts/1684951997326-init.js +0 -18
  10. package/dist/migrations/scripts/1684951997326-init.js.map +1 -1
  11. package/dist/storage/PostgresStorageProvider.js +1 -10
  12. package/dist/storage/PostgresStorageProvider.js.map +1 -1
  13. package/dist/storage/PostgresSyncRulesStorage.js +19 -6
  14. package/dist/storage/PostgresSyncRulesStorage.js.map +1 -1
  15. package/dist/{utils/test-utils.js → storage/PostgresTestStorageFactoryGenerator.js} +6 -22
  16. package/dist/storage/PostgresTestStorageFactoryGenerator.js.map +1 -0
  17. package/dist/storage/batch/PostgresBucketBatch.js +5 -2
  18. package/dist/storage/batch/PostgresBucketBatch.js.map +1 -1
  19. package/dist/storage/storage-index.js +1 -0
  20. package/dist/storage/storage-index.js.map +1 -1
  21. package/dist/types/models/models-index.js +0 -1
  22. package/dist/types/models/models-index.js.map +1 -1
  23. package/dist/utils/db.js +0 -1
  24. package/dist/utils/db.js.map +1 -1
  25. package/dist/utils/utils-index.js +0 -1
  26. package/dist/utils/utils-index.js.map +1 -1
  27. package/package.json +12 -11
  28. package/src/migrations/scripts/1684951997326-init.ts +0 -22
  29. package/src/storage/PostgresStorageProvider.ts +2 -13
  30. package/src/storage/PostgresSyncRulesStorage.ts +26 -7
  31. package/src/{utils/test-utils.ts → storage/PostgresTestStorageFactoryGenerator.ts} +5 -21
  32. package/src/storage/batch/PostgresBucketBatch.ts +4 -2
  33. package/src/storage/storage-index.ts +1 -0
  34. package/src/types/models/models-index.ts +0 -1
  35. package/src/utils/db.ts +0 -1
  36. package/src/utils/utils-index.ts +0 -1
  37. package/test/src/__snapshots__/storage_sync.test.ts.snap +110 -0
  38. package/test/src/util.ts +6 -3
  39. package/dist/@types/storage/PostgresReportStorageFactory.d.ts +0 -24
  40. package/dist/@types/types/models/SdkReporting.d.ts +0 -21
  41. package/dist/storage/PostgresReportStorageFactory.js +0 -238
  42. package/dist/storage/PostgresReportStorageFactory.js.map +0 -1
  43. package/dist/types/models/SdkReporting.js +0 -17
  44. package/dist/types/models/SdkReporting.js.map +0 -1
  45. package/dist/utils/test-utils.js.map +0 -1
  46. package/src/storage/PostgresReportStorageFactory.ts +0 -258
  47. package/src/types/models/SdkReporting.ts +0 -23
  48. package/test/src/__snapshots__/connection-report-storage.test.ts.snap +0 -215
  49. package/test/src/connection-report-storage.test.ts +0 -233
@@ -1,17 +0,0 @@
1
- import * as t from 'ts-codec';
2
- import { bigint, jsonb } from '../codecs.js';
3
- export const Sdks = t.object({
4
- sdk: t.string,
5
- clients: t.number,
6
- users: t.number
7
- });
8
- export const SdkReporting = t.object({
9
- users: bigint,
10
- sdks: t
11
- .object({
12
- data: jsonb(t.array(Sdks))
13
- })
14
- .optional()
15
- .or(t.Null)
16
- });
17
- //# sourceMappingURL=SdkReporting.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SdkReporting.js","sourceRoot":"","sources":["../../../src/types/models/SdkReporting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,GAAG,EAAE,CAAC,CAAC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AAI,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,258 +0,0 @@
1
- import { storage } from '@powersync/service-core';
2
- import * as pg_wire from '@powersync/service-jpgwire';
3
- import { event_types } from '@powersync/service-types';
4
- import { v4 } from 'uuid';
5
- import * as lib_postgres from '@powersync/lib-service-postgres';
6
- import { NormalizedPostgresStorageConfig } from '../types/types.js';
7
- import { SdkReporting, SdkReportingDecoded } from '../types/models/SdkReporting.js';
8
- import { toInteger } from 'ix/util/tointeger.js';
9
- import { logger } from '@powersync/lib-services-framework';
10
- import { getStorageApplicationName } from '../utils/application-name.js';
11
- import { STORAGE_SCHEMA_NAME } from '../utils/db.js';
12
-
13
- export type PostgresReportStorageOptions = {
14
- config: NormalizedPostgresStorageConfig;
15
- };
16
-
17
- export class PostgresReportStorageFactory implements storage.ReportStorage {
18
- readonly db: lib_postgres.DatabaseClient;
19
- constructor(protected options: PostgresReportStorageOptions) {
20
- this.db = new lib_postgres.DatabaseClient({
21
- config: options.config,
22
- schema: STORAGE_SCHEMA_NAME,
23
- applicationName: getStorageApplicationName()
24
- });
25
-
26
- this.db.registerListener({
27
- connectionCreated: async (connection) => this.prepareStatements(connection)
28
- });
29
- }
30
-
31
- private parseJsDate(date: Date) {
32
- const year = date.getFullYear();
33
- const month = date.getMonth();
34
- const today = date.getDate();
35
- const day = date.getDay();
36
- return {
37
- year,
38
- month,
39
- today,
40
- day,
41
- parsedDate: date
42
- };
43
- }
44
-
45
- private mapListCurrentConnectionsResponse(
46
- result: SdkReportingDecoded | null
47
- ): event_types.ClientConnectionReportResponse {
48
- if (!result) {
49
- return {
50
- users: 0,
51
- sdks: []
52
- };
53
- }
54
- return {
55
- users: Number(result.users),
56
- sdks: result.sdks?.data || []
57
- };
58
- }
59
- private async listConnectionsQuery() {
60
- return await 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() AT TIME ZONE 'UTC'
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
-
105
- private updateTableFilter() {
106
- const { year, month, today } = this.parseJsDate(new Date());
107
- const nextDay = today + 1;
108
- return {
109
- gte: new Date(year, month, today).toISOString(),
110
- lt: new Date(year, month, nextDay).toISOString()
111
- };
112
- }
113
-
114
- async reportClientConnection(data: event_types.ClientConnectionBucketData): Promise<void> {
115
- const { sdk, connected_at, user_id, user_agent, jwt_exp, client_id } = data;
116
- const connectIsoString = connected_at.toISOString();
117
- const jwtExpIsoString = jwt_exp.toISOString();
118
- const { gte, lt } = this.updateTableFilter();
119
- const uuid = v4();
120
- const result = await this.db.sql`
121
- UPDATE connection_report_events
122
- SET
123
- connected_at = ${{ type: 1184, value: connectIsoString }},
124
- sdk = ${{ type: 'varchar', value: sdk }},
125
- user_agent = ${{ type: 'varchar', value: user_agent }},
126
- jwt_exp = ${{ type: 1184, value: jwtExpIsoString }},
127
- disconnected_at = NULL
128
- WHERE
129
- user_id = ${{ type: 'varchar', value: user_id }}
130
- AND client_id = ${{ type: 'varchar', value: client_id }}
131
- AND connected_at >= ${{ type: 1184, value: gte }}
132
- AND connected_at < ${{ type: 1184, value: lt }};
133
- `.execute();
134
- if (result.results[1].status === 'UPDATE 0') {
135
- await this.db.sql`
136
- INSERT INTO
137
- connection_report_events (
138
- user_id,
139
- client_id,
140
- connected_at,
141
- sdk,
142
- user_agent,
143
- jwt_exp,
144
- id
145
- )
146
- VALUES
147
- (
148
- ${{ type: 'varchar', value: user_id }},
149
- ${{ type: 'varchar', value: client_id }},
150
- ${{ type: 1184, value: connectIsoString }},
151
- ${{ type: 'varchar', value: sdk }},
152
- ${{ type: 'varchar', value: user_agent }},
153
- ${{ type: 1184, value: jwtExpIsoString }},
154
- ${{ type: 'varchar', value: uuid }}
155
- )
156
- `.execute();
157
- }
158
- }
159
- async reportClientDisconnection(data: event_types.ClientDisconnectionEventData): Promise<void> {
160
- const { user_id, client_id, disconnected_at, connected_at } = data;
161
- const disconnectIsoString = disconnected_at.toISOString();
162
- const connectIsoString = connected_at.toISOString();
163
- await this.db.sql`
164
- UPDATE connection_report_events
165
- SET
166
- disconnected_at = ${{ type: 1184, value: disconnectIsoString }},
167
- jwt_exp = NULL
168
- WHERE
169
- user_id = ${{ type: 'varchar', value: user_id }}
170
- AND client_id = ${{ type: 'varchar', value: client_id }}
171
- AND connected_at = ${{ type: 1184, value: connectIsoString }}
172
- `.execute();
173
- }
174
- async getConnectedClients(): Promise<event_types.ClientConnectionReportResponse> {
175
- const result = await this.listConnectionsQuery();
176
- return this.mapListCurrentConnectionsResponse(result);
177
- }
178
-
179
- async getClientConnectionReports(
180
- data: event_types.ClientConnectionReportRequest
181
- ): Promise<event_types.ClientConnectionReportResponse> {
182
- const { start, end } = data;
183
- const result = await this.db.sql`
184
- WITH
185
- filtered AS (
186
- SELECT
187
- *
188
- FROM
189
- connection_report_events
190
- WHERE
191
- connected_at >= ${{ type: 1184, value: start.toISOString() }}
192
- AND connected_at <= ${{ type: 1184, value: end.toISOString() }}
193
- ),
194
- unique_users AS (
195
- SELECT
196
- COUNT(DISTINCT user_id) AS count
197
- FROM
198
- filtered
199
- ),
200
- sdk_versions_array AS (
201
- SELECT
202
- sdk,
203
- COUNT(DISTINCT client_id) AS clients,
204
- COUNT(DISTINCT user_id) AS users
205
- FROM
206
- filtered
207
- GROUP BY
208
- sdk
209
- )
210
- SELECT
211
- (
212
- SELECT
213
- COALESCE(count, 0)
214
- FROM
215
- unique_users
216
- ) AS users,
217
- (
218
- SELECT
219
- JSON_AGG(ROW_TO_JSON(s))
220
- FROM
221
- sdk_versions_array s
222
- ) AS sdks;
223
- `
224
- .decoded(SdkReporting)
225
- .first();
226
- return this.mapListCurrentConnectionsResponse(result);
227
- }
228
- async deleteOldConnectionData(data: event_types.DeleteOldConnectionData): Promise<void> {
229
- const { date } = data;
230
- const result = await this.db.sql`
231
- DELETE FROM connection_report_events
232
- WHERE
233
- connected_at < ${{ type: 1184, value: date.toISOString() }}
234
- AND (
235
- disconnected_at IS NOT NULL
236
- OR (
237
- jwt_exp < NOW() AT TIME ZONE 'UTC'
238
- AND disconnected_at IS NULL
239
- )
240
- );
241
- `.execute();
242
- const deletedRows = toInteger(result.results[1].status.split(' ')[1] || '0');
243
- if (deletedRows > 0) {
244
- logger.info(
245
- `TTL from ${date.toISOString()}: ${deletedRows} PostgresSQL rows have been removed from connection_report_events.`
246
- );
247
- }
248
- }
249
-
250
- async [Symbol.asyncDispose]() {
251
- await this.db[Symbol.asyncDispose]();
252
- }
253
-
254
- async prepareStatements(connection: pg_wire.PgConnection) {
255
- // It should be possible to prepare statements for some common operations here.
256
- // This has not been implemented yet.
257
- }
258
- }
@@ -1,23 +0,0 @@
1
- import * as t from 'ts-codec';
2
- import { bigint, jsonb } from '../codecs.js';
3
-
4
- export const Sdks = t.object({
5
- sdk: t.string,
6
- clients: t.number,
7
- users: t.number
8
- });
9
-
10
- export type Sdks = t.Encoded<typeof Sdks>;
11
-
12
- export const SdkReporting = t.object({
13
- users: bigint,
14
- sdks: t
15
- .object({
16
- data: jsonb<Sdks[]>(t.array(Sdks))
17
- })
18
- .optional()
19
- .or(t.Null)
20
- });
21
-
22
- export type SdkReporting = t.Encoded<typeof SdkReporting>;
23
- export type SdkReportingDecoded = t.Decoded<typeof SdkReporting>;
@@ -1,215 +0,0 @@
1
- // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
-
3
- exports[`Connection report storage > Should create a connection event if its after a day 1`] = `
4
- [
5
- {
6
- "client_id": "client_week",
7
- "sdk": "powersync-js/1.24.5",
8
- "user_agent": "powersync-js/1.21.0 powersync-web Firefox/141 linux",
9
- "user_id": "user_week",
10
- },
11
- {
12
- "client_id": "client_week",
13
- "sdk": "powersync-js/1.24.5",
14
- "user_agent": "powersync-js/1.21.0 powersync-web Firefox/141 linux",
15
- "user_id": "user_week",
16
- },
17
- ]
18
- `;
19
-
20
- exports[`Connection report storage > Should delete rows older than specified range 1`] = `
21
- {
22
- "sdks": [
23
- {
24
- "clients": 1,
25
- "sdk": "powersync-dart/1.6.4",
26
- "users": 1,
27
- },
28
- {
29
- "clients": 1,
30
- "sdk": "powersync-js/1.21.1",
31
- "users": 1,
32
- },
33
- {
34
- "clients": 1,
35
- "sdk": "powersync-js/1.21.2",
36
- "users": 1,
37
- },
38
- {
39
- "clients": 1,
40
- "sdk": "powersync-js/1.21.4",
41
- "users": 1,
42
- },
43
- {
44
- "clients": 1,
45
- "sdk": "powersync-js/1.24.5",
46
- "users": 1,
47
- },
48
- {
49
- "clients": 1,
50
- "sdk": "unknown",
51
- "users": 1,
52
- },
53
- ],
54
- "users": 5,
55
- }
56
- `;
57
-
58
- exports[`Connection report storage > Should update a connection event and make it disconnected 1`] = `
59
- [
60
- {
61
- "client_id": "client_three",
62
- "sdk": "powersync-js/1.21.2",
63
- "user_agent": "powersync-js/1.21.0 powersync-web Firefox/141 linux",
64
- "user_id": "user_three",
65
- },
66
- ]
67
- `;
68
-
69
- exports[`Connection report storage > Should update a connection event if its within a day 1`] = `
70
- [
71
- {
72
- "client_id": "client_one",
73
- "sdk": "powersync-dart/1.6.4",
74
- "user_agent": "powersync-dart/1.6.4 Dart (flutter-web) Chrome/128 android",
75
- "user_id": "user_one",
76
- },
77
- ]
78
- `;
79
-
80
- exports[`Report storage tests > Should show connection report data for user over the past day 1`] = `
81
- {
82
- "sdks": [
83
- {
84
- "clients": 1,
85
- "sdk": "powersync-dart/1.6.4",
86
- "users": 1,
87
- },
88
- {
89
- "clients": 1,
90
- "sdk": "powersync-js/1.21.1",
91
- "users": 1,
92
- },
93
- {
94
- "clients": 1,
95
- "sdk": "powersync-js/1.21.4",
96
- "users": 1,
97
- },
98
- {
99
- "clients": 1,
100
- "sdk": "unknown",
101
- "users": 1,
102
- },
103
- ],
104
- "users": 3,
105
- }
106
- `;
107
-
108
- exports[`Report storage tests > Should show connection report data for user over the past month 1`] = `
109
- {
110
- "sdks": [
111
- {
112
- "clients": 1,
113
- "sdk": "powersync-dart/1.6.4",
114
- "users": 1,
115
- },
116
- {
117
- "clients": 1,
118
- "sdk": "powersync-js/1.21.1",
119
- "users": 1,
120
- },
121
- {
122
- "clients": 1,
123
- "sdk": "powersync-js/1.21.2",
124
- "users": 1,
125
- },
126
- {
127
- "clients": 1,
128
- "sdk": "powersync-js/1.21.4",
129
- "users": 1,
130
- },
131
- {
132
- "clients": 1,
133
- "sdk": "powersync-js/1.23.6",
134
- "users": 1,
135
- },
136
- {
137
- "clients": 1,
138
- "sdk": "powersync-js/1.23.7",
139
- "users": 1,
140
- },
141
- {
142
- "clients": 1,
143
- "sdk": "powersync-js/1.24.5",
144
- "users": 1,
145
- },
146
- {
147
- "clients": 1,
148
- "sdk": "unknown",
149
- "users": 1,
150
- },
151
- ],
152
- "users": 7,
153
- }
154
- `;
155
-
156
- exports[`Report storage tests > Should show connection report data for user over the past week 1`] = `
157
- {
158
- "sdks": [
159
- {
160
- "clients": 1,
161
- "sdk": "powersync-dart/1.6.4",
162
- "users": 1,
163
- },
164
- {
165
- "clients": 1,
166
- "sdk": "powersync-js/1.21.1",
167
- "users": 1,
168
- },
169
- {
170
- "clients": 1,
171
- "sdk": "powersync-js/1.21.2",
172
- "users": 1,
173
- },
174
- {
175
- "clients": 1,
176
- "sdk": "powersync-js/1.21.4",
177
- "users": 1,
178
- },
179
- {
180
- "clients": 1,
181
- "sdk": "powersync-js/1.24.5",
182
- "users": 1,
183
- },
184
- {
185
- "clients": 1,
186
- "sdk": "unknown",
187
- "users": 1,
188
- },
189
- ],
190
- "users": 5,
191
- }
192
- `;
193
-
194
- exports[`Report storage tests > Should show currently connected users 1`] = `
195
- {
196
- "sdks": [
197
- {
198
- "clients": 1,
199
- "sdk": "powersync-dart/1.6.4",
200
- "users": 1,
201
- },
202
- {
203
- "clients": 1,
204
- "sdk": "powersync-js/1.21.1",
205
- "users": 1,
206
- },
207
- {
208
- "clients": 1,
209
- "sdk": "unknown",
210
- "users": 1,
211
- },
212
- ],
213
- "users": 2,
214
- }
215
- `;