@powersync/common 1.32.0 → 1.33.0

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.
@@ -0,0 +1,53 @@
1
+ import { StreamingSyncRequest } from './streaming-sync-types.js';
2
+ /**
3
+ * An internal instruction emitted by the sync client in the core extension in response to the JS
4
+ * SDK passing sync data into the extension.
5
+ */
6
+ export type Instruction = {
7
+ LogLine: LogLine;
8
+ } | {
9
+ UpdateSyncStatus: UpdateSyncStatus;
10
+ } | {
11
+ EstablishSyncStream: EstablishSyncStream;
12
+ } | {
13
+ FetchCredentials: FetchCredentials;
14
+ } | {
15
+ CloseSyncStream: any;
16
+ } | {
17
+ FlushFileSystem: any;
18
+ } | {
19
+ DidCompleteSync: any;
20
+ };
21
+ export interface LogLine {
22
+ severity: 'DEBUG' | 'INFO' | 'WARNING';
23
+ line: string;
24
+ }
25
+ export interface EstablishSyncStream {
26
+ request: StreamingSyncRequest;
27
+ }
28
+ export interface UpdateSyncStatus {
29
+ status: CoreSyncStatus;
30
+ }
31
+ export interface CoreSyncStatus {
32
+ connected: boolean;
33
+ connecting: boolean;
34
+ priority_status: SyncPriorityStatus[];
35
+ downloading: DownloadProgress | null;
36
+ }
37
+ export interface SyncPriorityStatus {
38
+ priority: number;
39
+ last_synced_at: number | number;
40
+ has_synced: boolean | null;
41
+ }
42
+ export interface DownloadProgress {
43
+ buckets: Record<string, BucketProgress>;
44
+ }
45
+ export interface BucketProgress {
46
+ priority: number;
47
+ at_last: number;
48
+ since_last: number;
49
+ target_count: number;
50
+ }
51
+ export interface FetchCredentials {
52
+ did_expire: boolean;
53
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,10 +1,6 @@
1
+ import { BucketProgress } from 'src/client/sync/stream/core-instruction.js';
1
2
  /** @internal */
2
- export type InternalProgressInformation = Record<string, {
3
- priority: number;
4
- atLast: number;
5
- sinceLast: number;
6
- targetCount: number;
7
- }>;
3
+ export type InternalProgressInformation = Record<string, BucketProgress>;
8
4
  /**
9
5
  * @internal The priority used by the core extension to indicate that a full sync was completed.
10
6
  */
@@ -46,8 +46,8 @@ export class SyncProgress {
46
46
  for (const progress of Object.values(this.internal)) {
47
47
  // Include higher-priority buckets, which are represented by lower numbers.
48
48
  if (progress.priority <= priority) {
49
- downloaded += progress.sinceLast;
50
- total += progress.targetCount - progress.atLast;
49
+ downloaded += progress.since_last;
50
+ total += progress.target_count - progress.at_last;
51
51
  }
52
52
  }
53
53
  let progress = total == 0 ? 0.0 : downloaded / total;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powersync/common",
3
- "version": "1.32.0",
3
+ "version": "1.33.0",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -45,7 +45,6 @@
45
45
  "async-mutex": "^0.4.0",
46
46
  "bson": "^6.6.0",
47
47
  "buffer": "^6.0.3",
48
- "can-ndjson-stream": "^1.0.2",
49
48
  "cross-fetch": "^4.0.0",
50
49
  "event-iterator": "^2.0.0",
51
50
  "rollup": "4.14.3",