@powersync/service-core 0.2.0 → 0.2.1

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.
@@ -252,7 +252,7 @@ bucket_definitions:
252
252
  { op: 'REMOVE', object_id: 'test1', checksum: c2 }
253
253
  ]);
254
254
 
255
- const checksums = await storage.getChecksums(checkpoint, ['global[]']);
255
+ const checksums = [...(await storage.getChecksums(checkpoint, ['global[]'])).values()];
256
256
  expect(checksums).toEqual([
257
257
  {
258
258
  bucket: 'global[]',
@@ -599,7 +599,7 @@ bucket_definitions:
599
599
  { op: 'REMOVE', object_id: 'test1', checksum: c2 }
600
600
  ]);
601
601
 
602
- const checksums = await storage.getChecksums(checkpoint, ['global[]']);
602
+ const checksums = [...(await storage.getChecksums(checkpoint, ['global[]'])).values()];
603
603
  expect(checksums).toEqual([
604
604
  {
605
605
  bucket: 'global[]',
@@ -713,7 +713,7 @@ bucket_definitions:
713
713
  { op: 'REMOVE', object_id: 'test1', checksum: c2 }
714
714
  ]);
715
715
 
716
- const checksums = await storage.getChecksums(checkpoint, ['global[]']);
716
+ const checksums = [...(await storage.getChecksums(checkpoint, ['global[]'])).values()];
717
717
  expect(checksums).toEqual([
718
718
  {
719
719
  bucket: 'global[]',
@@ -50,7 +50,7 @@ function defineBatchTests(factory: StorageFactory) {
50
50
  const duration = Date.now() - start;
51
51
  const used = Math.round(process.memoryUsage().heapUsed / 1024 / 1024);
52
52
  const checksum = await context.storage!.getChecksums(checkpoint, ['global[]']);
53
- expect(checksum[0].count).toEqual(operation_count);
53
+ expect(checksum.get('global[]')!.count).toEqual(operation_count);
54
54
  const perSecond = Math.round((operation_count / duration) * 1000);
55
55
  console.log(`${operation_count} ops in ${duration}ms ${perSecond} ops/s. ${used}MB heap`);
56
56
  }),
@@ -101,7 +101,7 @@ function defineBatchTests(factory: StorageFactory) {
101
101
  const checkpoint = await context.getCheckpoint({ timeout: 100_000 });
102
102
  const duration = Date.now() - start;
103
103
  const checksum = await context.storage!.getChecksums(checkpoint, ['global[]']);
104
- expect(checksum[0].count).toEqual(operation_count);
104
+ expect(checksum.get('global[]')!.count).toEqual(operation_count);
105
105
  const perSecond = Math.round((operation_count / duration) * 1000);
106
106
  console.log(`${operation_count} ops in ${duration}ms ${perSecond} ops/s.`);
107
107
  printMemoryUsage();
@@ -157,7 +157,7 @@ function defineBatchTests(factory: StorageFactory) {
157
157
  const duration = Date.now() - start;
158
158
  const used = Math.round(process.memoryUsage().heapUsed / 1024 / 1024);
159
159
  const checksum = await context.storage!.getChecksums(checkpoint, ['global[]']);
160
- expect(checksum[0].count).toEqual(operationCount);
160
+ expect(checksum.get('global[]')!.count).toEqual(operationCount);
161
161
  const perSecond = Math.round((operationCount / duration) * 1000);
162
162
  // This number depends on the test machine, so we keep the test significantly
163
163
  // lower than expected numbers.
@@ -174,7 +174,7 @@ function defineBatchTests(factory: StorageFactory) {
174
174
  const truncateDuration = Date.now() - truncateStart;
175
175
 
176
176
  const checksum2 = await context.storage!.getChecksums(checkpoint2, ['global[]']);
177
- const truncateCount = checksum2[0].count - checksum[0].count;
177
+ const truncateCount = checksum2.get('global[]')!.count - checksum.get('global[]')!.count;
178
178
  expect(truncateCount).toEqual(numTransactions * perTransaction);
179
179
  const truncatePerSecond = Math.round((truncateCount / truncateDuration) * 1000);
180
180
  console.log(`Truncated ${truncateCount} ops in ${truncateDuration}ms ${truncatePerSecond} ops/s. ${used}MB heap`);