@powersync/service-module-mongodb-storage 0.0.0-dev-20251110113516 → 0.0.0-dev-20251111070830
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 +5 -3
- package/dist/migrations/db/migrations/1752661449910-connection-reporting.js +1 -21
- package/dist/migrations/db/migrations/1752661449910-connection-reporting.js.map +1 -1
- package/dist/migrations/db/migrations/1762790715147-connection-reporting2.d.ts +3 -0
- package/dist/migrations/db/migrations/1762790715147-connection-reporting2.js +36 -0
- package/dist/migrations/db/migrations/1762790715147-connection-reporting2.js.map +1 -0
- package/dist/storage/MongoReportStorage.d.ts +1 -1
- package/dist/storage/MongoReportStorage.js +1 -1
- package/dist/storage/MongoReportStorage.js.map +1 -1
- package/package.json +4 -4
- package/src/migrations/db/migrations/1752661449910-connection-reporting.ts +1 -35
- package/src/migrations/db/migrations/1762790715147-connection-reporting2.ts +58 -0
- package/src/storage/MongoReportStorage.ts +2 -2
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
# @powersync/service-module-mongodb-storage
|
|
2
2
|
|
|
3
|
-
## 0.0.0-dev-
|
|
3
|
+
## 0.0.0-dev-20251111070830
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
+
- c6bdb4f: [MongoDB storage] Fix migration for indexes on connection_report_events.
|
|
7
8
|
- 422ae99: General client connections analytics added
|
|
9
|
+
- Updated dependencies [c6bdb4f]
|
|
8
10
|
- Updated dependencies [422ae99]
|
|
9
|
-
- @powersync/service-core@0.0.0-dev-
|
|
10
|
-
- @powersync/service-types@0.0.0-dev-
|
|
11
|
+
- @powersync/service-core@0.0.0-dev-20251111070830
|
|
12
|
+
- @powersync/service-types@0.0.0-dev-20251111070830
|
|
11
13
|
|
|
12
14
|
## 0.12.9
|
|
13
15
|
|
|
@@ -1,27 +1,7 @@
|
|
|
1
1
|
import * as storage from '../../../storage/storage-index.js';
|
|
2
2
|
export const up = async (context) => {
|
|
3
3
|
const { service_context: { configuration } } = context;
|
|
4
|
-
|
|
5
|
-
try {
|
|
6
|
-
await db.createConnectionReportingCollection();
|
|
7
|
-
await db.connection_report_events.createIndex({
|
|
8
|
-
connected_at: 1,
|
|
9
|
-
jwt_exp: 1,
|
|
10
|
-
disconnected_at: 1
|
|
11
|
-
}, { name: 'connection_list_index' });
|
|
12
|
-
await db.connection_report_events.createIndex({
|
|
13
|
-
user_id: 1
|
|
14
|
-
}, { name: 'connection_user_id_index' });
|
|
15
|
-
await db.connection_report_events.createIndex({
|
|
16
|
-
client_id: 1
|
|
17
|
-
}, { name: 'connection_client_id_index' });
|
|
18
|
-
await db.connection_report_events.createIndex({
|
|
19
|
-
sdk: 1
|
|
20
|
-
}, { name: 'connection_index' });
|
|
21
|
-
}
|
|
22
|
-
finally {
|
|
23
|
-
await db.client.close();
|
|
24
|
-
}
|
|
4
|
+
// No-op - moved to 1762790715147-connection-reporting2
|
|
25
5
|
};
|
|
26
6
|
export const down = async (context) => {
|
|
27
7
|
const { service_context: { configuration } } = context;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1752661449910-connection-reporting.js","sourceRoot":"","sources":["../../../../src/migrations/db/migrations/1752661449910-connection-reporting.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,mCAAmC,CAAC;AAG7D,MAAM,CAAC,MAAM,EAAE,GAA0C,KAAK,EAAE,OAAO,EAAE,EAAE;IACzE,MAAM,EACJ,eAAe,EAAE,EAAE,aAAa,EAAE,EACnC,GAAG,OAAO,CAAC;IACZ,
|
|
1
|
+
{"version":3,"file":"1752661449910-connection-reporting.js","sourceRoot":"","sources":["../../../../src/migrations/db/migrations/1752661449910-connection-reporting.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,mCAAmC,CAAC;AAG7D,MAAM,CAAC,MAAM,EAAE,GAA0C,KAAK,EAAE,OAAO,EAAE,EAAE;IACzE,MAAM,EACJ,eAAe,EAAE,EAAE,aAAa,EAAE,EACnC,GAAG,OAAO,CAAC;IACZ,uDAAuD;AACzD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAA0C,KAAK,EAAE,OAAO,EAAE,EAAE;IAC3E,MAAM,EACJ,eAAe,EAAE,EAAE,aAAa,EAAE,EACnC,GAAG,OAAO,CAAC;IAEZ,MAAM,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,aAAa,CAAC,OAA6B,CAAC,CAAC;IAErF,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,EAAE,CAAC,cAAc,CAAC,0BAA0B,CAAC,CAAC;IACzD,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as storage from '../../../storage/storage-index.js';
|
|
2
|
+
export const up = async (context) => {
|
|
3
|
+
const { service_context: { configuration } } = context;
|
|
4
|
+
const db = storage.createPowerSyncMongo(configuration.storage);
|
|
5
|
+
try {
|
|
6
|
+
await db.createConnectionReportingCollection();
|
|
7
|
+
await db.connection_report_events.createIndex({
|
|
8
|
+
connected_at: 1,
|
|
9
|
+
jwt_exp: 1,
|
|
10
|
+
disconnected_at: 1
|
|
11
|
+
}, { name: 'connection_list_index' });
|
|
12
|
+
await db.connection_report_events.createIndex({
|
|
13
|
+
user_id: 1
|
|
14
|
+
}, { name: 'connection_user_id_index' });
|
|
15
|
+
await db.connection_report_events.createIndex({
|
|
16
|
+
client_id: 1
|
|
17
|
+
}, { name: 'connection_client_id_index' });
|
|
18
|
+
await db.connection_report_events.createIndex({
|
|
19
|
+
sdk: 1
|
|
20
|
+
}, { name: 'connection_index' });
|
|
21
|
+
}
|
|
22
|
+
finally {
|
|
23
|
+
await db.client.close();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
export const down = async (context) => {
|
|
27
|
+
const { service_context: { configuration } } = context;
|
|
28
|
+
const db = storage.createPowerSyncMongo(configuration.storage);
|
|
29
|
+
try {
|
|
30
|
+
await db.db.dropCollection('connection_report_events');
|
|
31
|
+
}
|
|
32
|
+
finally {
|
|
33
|
+
await db.client.close();
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=1762790715147-connection-reporting2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1762790715147-connection-reporting2.js","sourceRoot":"","sources":["../../../../src/migrations/db/migrations/1762790715147-connection-reporting2.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,mCAAmC,CAAC;AAG7D,MAAM,CAAC,MAAM,EAAE,GAA0C,KAAK,EAAE,OAAO,EAAE,EAAE;IACzE,MAAM,EACJ,eAAe,EAAE,EAAE,aAAa,EAAE,EACnC,GAAG,OAAO,CAAC;IACZ,MAAM,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,aAAa,CAAC,OAA6B,CAAC,CAAC;IAErF,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,mCAAmC,EAAE,CAAC;QAE/C,MAAM,EAAE,CAAC,wBAAwB,CAAC,WAAW,CAC3C;YACE,YAAY,EAAE,CAAC;YACf,OAAO,EAAE,CAAC;YACV,eAAe,EAAE,CAAC;SACnB,EACD,EAAE,IAAI,EAAE,uBAAuB,EAAE,CAClC,CAAC;QAEF,MAAM,EAAE,CAAC,wBAAwB,CAAC,WAAW,CAC3C;YACE,OAAO,EAAE,CAAC;SACX,EACD,EAAE,IAAI,EAAE,0BAA0B,EAAE,CACrC,CAAC;QACF,MAAM,EAAE,CAAC,wBAAwB,CAAC,WAAW,CAC3C;YACE,SAAS,EAAE,CAAC;SACb,EACD,EAAE,IAAI,EAAE,4BAA4B,EAAE,CACvC,CAAC;QACF,MAAM,EAAE,CAAC,wBAAwB,CAAC,WAAW,CAC3C;YACE,GAAG,EAAE,CAAC;SACP,EACD,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAC7B,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAA0C,KAAK,EAAE,OAAO,EAAE,EAAE;IAC3E,MAAM,EACJ,eAAe,EAAE,EAAE,aAAa,EAAE,EACnC,GAAG,OAAO,CAAC;IAEZ,MAAM,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,aAAa,CAAC,OAA6B,CAAC,CAAC;IAErF,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,EAAE,CAAC,cAAc,CAAC,0BAA0B,CAAC,CAAC;IACzD,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -6,7 +6,7 @@ export declare class MongoReportStorage implements storage.ReportStorage {
|
|
|
6
6
|
constructor(db: PowerSyncMongo);
|
|
7
7
|
deleteOldConnectionData(data: event_types.DeleteOldConnectionData): Promise<void>;
|
|
8
8
|
getClientConnectionReports(data: event_types.ClientConnectionReportRequest): Promise<event_types.ClientConnectionReportResponse>;
|
|
9
|
-
|
|
9
|
+
getGeneralClientConnectionAnalytics(data: event_types.ClientConnectionAnalyticsRequest): Promise<event_types.PaginatedResponse<event_types.ClientConnection>>;
|
|
10
10
|
reportClientConnection(data: event_types.ClientConnectionBucketData): Promise<void>;
|
|
11
11
|
reportClientDisconnection(data: event_types.ClientDisconnectionEventData): Promise<void>;
|
|
12
12
|
getConnectedClients(): Promise<event_types.ClientConnectionReportResponse>;
|
|
@@ -33,7 +33,7 @@ export class MongoReportStorage {
|
|
|
33
33
|
.toArray();
|
|
34
34
|
return result[0];
|
|
35
35
|
}
|
|
36
|
-
async
|
|
36
|
+
async getGeneralClientConnectionAnalytics(data) {
|
|
37
37
|
const { cursor, date_range } = data;
|
|
38
38
|
const limit = data?.limit || 100;
|
|
39
39
|
const connected_at = date_range ? { connected_at: { $lte: date_range.end, $gte: date_range.start } } : undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MongoReportStorage.js","sourceRoot":"","sources":["../../src/storage/MongoReportStorage.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAC;AAElE,MAAM,OAAO,kBAAkB;IACb,EAAE,CAAiB;IAEnC,YAAY,EAAkB;QAC5B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IACD,KAAK,CAAC,uBAAuB,CAAC,IAAyC;QACrE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;QACtB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,wBAAwB,CAAC,UAAU,CAAC;YAC/D,YAAY,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE;YAC3B,GAAG,EAAE;gBACH,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;gBACtC,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,IAAI,IAAI,EAAE,EAAE,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;aACtE;SACF,CAAC,CAAC;QACH,IAAI,MAAM,CAAC,YAAY,GAAG,CAAC,EAAE,CAAC;YAC5B,MAAM,CAAC,IAAI,CACT,YAAY,IAAI,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,YAAY,qEAAqE,CAC5H,CAAC;QACJ,CAAC;IACH,CAAC;IAED,KAAK,CAAC,0BAA0B,CAC9B,IAA+C;QAE/C,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QAC5B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,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,MAAc,EAAE,QAAgB;QACtD,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAG,KAAK,GAAG,CAAC,CAAC;QAC1B,OAAO;YACL,OAAO,EAAE,MAAM;YACf,SAAS,EAAE,QAAQ;YACnB,YAAY,EAAE;gBACZ,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;gBAC5C,GAAG,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;aAC9C;SACF,CAAC;IACJ,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@powersync/service-module-mongodb-storage",
|
|
3
3
|
"repository": "https://github.com/powersync-ja/powersync-service",
|
|
4
4
|
"types": "dist/index.d.ts",
|
|
5
|
-
"version": "0.0.0-dev-
|
|
5
|
+
"version": "0.0.0-dev-20251111070830",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"license": "FSL-1.1-ALv2",
|
|
8
8
|
"type": "module",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"uuid": "^11.1.0",
|
|
30
30
|
"@powersync/lib-service-mongodb": "0.6.11",
|
|
31
31
|
"@powersync/lib-services-framework": "0.7.9",
|
|
32
|
-
"@powersync/service-core": "0.0.0-dev-
|
|
32
|
+
"@powersync/service-core": "0.0.0-dev-20251111070830",
|
|
33
33
|
"@powersync/service-jsonbig": "0.17.12",
|
|
34
34
|
"@powersync/service-sync-rules": "0.29.6",
|
|
35
|
-
"@powersync/service-types": "0.0.0-dev-
|
|
35
|
+
"@powersync/service-types": "0.0.0-dev-20251111070830"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@powersync/service-core-tests": "0.0.0-dev-
|
|
38
|
+
"@powersync/service-core-tests": "0.0.0-dev-20251111070830"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "tsc -b",
|
|
@@ -6,41 +6,7 @@ export const up: migrations.PowerSyncMigrationFunction = async (context) => {
|
|
|
6
6
|
const {
|
|
7
7
|
service_context: { configuration }
|
|
8
8
|
} = context;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
try {
|
|
12
|
-
await db.createConnectionReportingCollection();
|
|
13
|
-
|
|
14
|
-
await db.connection_report_events.createIndex(
|
|
15
|
-
{
|
|
16
|
-
connected_at: 1,
|
|
17
|
-
jwt_exp: 1,
|
|
18
|
-
disconnected_at: 1
|
|
19
|
-
},
|
|
20
|
-
{ name: 'connection_list_index' }
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
await db.connection_report_events.createIndex(
|
|
24
|
-
{
|
|
25
|
-
user_id: 1
|
|
26
|
-
},
|
|
27
|
-
{ name: 'connection_user_id_index' }
|
|
28
|
-
);
|
|
29
|
-
await db.connection_report_events.createIndex(
|
|
30
|
-
{
|
|
31
|
-
client_id: 1
|
|
32
|
-
},
|
|
33
|
-
{ name: 'connection_client_id_index' }
|
|
34
|
-
);
|
|
35
|
-
await db.connection_report_events.createIndex(
|
|
36
|
-
{
|
|
37
|
-
sdk: 1
|
|
38
|
-
},
|
|
39
|
-
{ name: 'connection_index' }
|
|
40
|
-
);
|
|
41
|
-
} finally {
|
|
42
|
-
await db.client.close();
|
|
43
|
-
}
|
|
9
|
+
// No-op - moved to 1762790715147-connection-reporting2
|
|
44
10
|
};
|
|
45
11
|
|
|
46
12
|
export const down: migrations.PowerSyncMigrationFunction = async (context) => {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { migrations } from '@powersync/service-core';
|
|
2
|
+
import * as storage from '../../../storage/storage-index.js';
|
|
3
|
+
import { MongoStorageConfig } from '../../../types/types.js';
|
|
4
|
+
|
|
5
|
+
export const up: migrations.PowerSyncMigrationFunction = async (context) => {
|
|
6
|
+
const {
|
|
7
|
+
service_context: { configuration }
|
|
8
|
+
} = context;
|
|
9
|
+
const db = storage.createPowerSyncMongo(configuration.storage as MongoStorageConfig);
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
await db.createConnectionReportingCollection();
|
|
13
|
+
|
|
14
|
+
await db.connection_report_events.createIndex(
|
|
15
|
+
{
|
|
16
|
+
connected_at: 1,
|
|
17
|
+
jwt_exp: 1,
|
|
18
|
+
disconnected_at: 1
|
|
19
|
+
},
|
|
20
|
+
{ name: 'connection_list_index' }
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
await db.connection_report_events.createIndex(
|
|
24
|
+
{
|
|
25
|
+
user_id: 1
|
|
26
|
+
},
|
|
27
|
+
{ name: 'connection_user_id_index' }
|
|
28
|
+
);
|
|
29
|
+
await db.connection_report_events.createIndex(
|
|
30
|
+
{
|
|
31
|
+
client_id: 1
|
|
32
|
+
},
|
|
33
|
+
{ name: 'connection_client_id_index' }
|
|
34
|
+
);
|
|
35
|
+
await db.connection_report_events.createIndex(
|
|
36
|
+
{
|
|
37
|
+
sdk: 1
|
|
38
|
+
},
|
|
39
|
+
{ name: 'connection_index' }
|
|
40
|
+
);
|
|
41
|
+
} finally {
|
|
42
|
+
await db.client.close();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const down: migrations.PowerSyncMigrationFunction = async (context) => {
|
|
47
|
+
const {
|
|
48
|
+
service_context: { configuration }
|
|
49
|
+
} = context;
|
|
50
|
+
|
|
51
|
+
const db = storage.createPowerSyncMongo(configuration.storage as MongoStorageConfig);
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
await db.db.dropCollection('connection_report_events');
|
|
55
|
+
} finally {
|
|
56
|
+
await db.client.close();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
@@ -44,8 +44,8 @@ export class MongoReportStorage implements storage.ReportStorage {
|
|
|
44
44
|
return result[0];
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
async
|
|
48
|
-
data: event_types.
|
|
47
|
+
async getGeneralClientConnectionAnalytics(
|
|
48
|
+
data: event_types.ClientConnectionAnalyticsRequest
|
|
49
49
|
): Promise<event_types.PaginatedResponse<event_types.ClientConnection>> {
|
|
50
50
|
const { cursor, date_range } = data;
|
|
51
51
|
const limit = data?.limit || 100;
|