@powersync/service-module-mongodb-storage 0.0.0-dev-20250819134004 → 0.0.0-dev-20250820110726

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 (22) hide show
  1. package/CHANGELOG.md +7 -7
  2. package/dist/migrations/db/migrations/1752661449910-connection-reporting.js +48 -0
  3. package/dist/migrations/db/migrations/1752661449910-connection-reporting.js.map +1 -0
  4. package/dist/storage/MongoReportStorage.js +6 -6
  5. package/dist/storage/MongoReportStorage.js.map +1 -1
  6. package/dist/storage/implementation/MongoTestReportStorageFactoryGenerator.js +1 -1
  7. package/dist/storage/implementation/MongoTestReportStorageFactoryGenerator.js.map +1 -1
  8. package/dist/storage/implementation/db.d.ts +2 -2
  9. package/dist/storage/implementation/db.js +6 -6
  10. package/dist/storage/implementation/db.js.map +1 -1
  11. package/package.json +8 -8
  12. package/src/migrations/db/migrations/1752661449910-connection-reporting.ts +70 -0
  13. package/src/storage/MongoReportStorage.ts +6 -6
  14. package/src/storage/implementation/MongoTestReportStorageFactoryGenerator.ts +1 -1
  15. package/src/storage/implementation/db.ts +6 -6
  16. package/test/src/__snapshots__/{sdk-report-storage.test.ts.snap → connection-report-storage.test.ts.snap} +32 -32
  17. package/test/src/{sdk-report-storage.test.ts → connection-report-storage.test.ts} +11 -11
  18. package/tsconfig.tsbuildinfo +1 -1
  19. package/dist/migrations/db/migrations/1752661449910-sdk-reporting.js +0 -48
  20. package/dist/migrations/db/migrations/1752661449910-sdk-reporting.js.map +0 -1
  21. package/src/migrations/db/migrations/1752661449910-sdk-reporting.ts +0 -70
  22. /package/dist/migrations/db/migrations/{1752661449910-sdk-reporting.d.ts → 1752661449910-connection-reporting.d.ts} +0 -0
@@ -96,7 +96,7 @@ describe('SDK reporting storage', async () => {
96
96
  };
97
97
 
98
98
  async function loadData() {
99
- await factory.db.sdk_report_events.insertMany([
99
+ await factory.db.connection_report_events.insertMany([
100
100
  user_one,
101
101
  user_two,
102
102
  user_three,
@@ -108,7 +108,7 @@ describe('SDK reporting storage', async () => {
108
108
  }
109
109
 
110
110
  function deleteData() {
111
- return factory.db.sdk_report_events.deleteMany();
111
+ return factory.db.connection_report_events.deleteMany();
112
112
  }
113
113
 
114
114
  beforeAll(async () => {
@@ -147,21 +147,21 @@ describe('SDK reporting storage', async () => {
147
147
  });
148
148
  expect(current).toMatchSnapshot();
149
149
  });
150
- it('Should show SDK scrape data for user over the past month', async () => {
150
+ it('Should show connection report data for user over the past month', async () => {
151
151
  const sdk = await factory.getClientConnectionReports({
152
152
  start: monthAgo,
153
153
  end: now
154
154
  });
155
155
  expect(sdk).toMatchSnapshot();
156
156
  });
157
- it('Should show SDK scrape data for user over the past week', async () => {
157
+ it('Should show connection report data for user over the past week', async () => {
158
158
  const sdk = await factory.getClientConnectionReports({
159
159
  start: weekAgo,
160
160
  end: now
161
161
  });
162
162
  expect(sdk).toMatchSnapshot();
163
163
  });
164
- it('Should show SDK scrape data for user over the past day', async () => {
164
+ it('Should show connection report data for user over the past day', async () => {
165
165
  const sdk = await factory.getClientConnectionReports({
166
166
  start: dayAgo,
167
167
  end: now
@@ -169,7 +169,7 @@ describe('SDK reporting storage', async () => {
169
169
  expect(sdk).toMatchSnapshot();
170
170
  });
171
171
 
172
- it('Should update a sdk event if its within a day', async () => {
172
+ it('Should update a connection report if its within a day', async () => {
173
173
  const newConnectAt = new Date(
174
174
  now.getFullYear(),
175
175
  now.getMonth(),
@@ -187,7 +187,7 @@ describe('SDK reporting storage', async () => {
187
187
  user_agent: user_one.user_agent
188
188
  });
189
189
 
190
- const sdk = await factory.db.sdk_report_events.find({ user_id: user_one.user_id }).toArray();
190
+ const sdk = await factory.db.connection_report_events.find({ user_id: user_one.user_id }).toArray();
191
191
  expect(sdk).toHaveLength(1);
192
192
  expect(new Date(sdk[0].connected_at)).toEqual(newConnectAt);
193
193
  expect(new Date(sdk[0].jwt_exp!)).toEqual(jwtExp);
@@ -196,7 +196,7 @@ describe('SDK reporting storage', async () => {
196
196
  expect(cleaned).toMatchSnapshot();
197
197
  });
198
198
 
199
- it('Should update a connected sdk event and make it disconnected', async () => {
199
+ it('Should update a connected connection report and make it disconnected', async () => {
200
200
  const disconnectAt = new Date(
201
201
  now.getFullYear(),
202
202
  now.getMonth(),
@@ -215,14 +215,14 @@ describe('SDK reporting storage', async () => {
215
215
  connected_at: user_three.connected_at
216
216
  });
217
217
 
218
- const sdk = await factory.db.sdk_report_events.find({ user_id: user_three.user_id }).toArray();
218
+ const sdk = await factory.db.connection_report_events.find({ user_id: user_three.user_id }).toArray();
219
219
  expect(sdk).toHaveLength(1);
220
220
  expect(new Date(sdk[0].disconnected_at!)).toEqual(disconnectAt);
221
221
  const cleaned = removeVolatileFields(sdk);
222
222
  expect(cleaned).toMatchSnapshot();
223
223
  });
224
224
 
225
- it('Should create a sdk event if its after a day', async () => {
225
+ it('Should create a connection report if its after a day', async () => {
226
226
  const newConnectAt = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, now.getHours());
227
227
  const jwtExp = new Date(newConnectAt.getFullYear(), newConnectAt.getMonth(), newConnectAt.getDate() + 1);
228
228
 
@@ -235,7 +235,7 @@ describe('SDK reporting storage', async () => {
235
235
  user_agent: user_week.user_agent
236
236
  });
237
237
 
238
- const sdk = await factory.db.sdk_report_events.find({ user_id: user_week.user_id }).toArray();
238
+ const sdk = await factory.db.connection_report_events.find({ user_id: user_week.user_id }).toArray();
239
239
  expect(sdk).toHaveLength(2);
240
240
  const cleaned = removeVolatileFields(sdk);
241
241
  expect(cleaned).toMatchSnapshot();