@powersync/common 0.0.0-dev-20240508113424 → 0.0.0-dev-20240509081154
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/lib/client/AbstractPowerSyncDatabase.js +1 -0
- package/lib/client/sync/bucket/BucketStorageAdapter.d.ts +2 -1
- package/lib/client/sync/bucket/BucketStorageAdapter.js +1 -0
- package/lib/client/sync/bucket/CrudEntry.d.ts +1 -1
- package/lib/client/sync/bucket/CrudTransaction.d.ts +2 -2
- package/lib/client/sync/bucket/OplogEntry.d.ts +4 -4
- package/lib/client/sync/bucket/SyncDataBucket.d.ts +5 -4
- package/lib/client/sync/stream/AbstractStreamingSyncImplementation.d.ts +1 -1
- package/lib/db/Column.d.ts +2 -2
- package/lib/db/crud/SyncStatus.d.ts +2 -2
- package/lib/db/schema/Index.d.ts +1 -1
- package/lib/db/schema/IndexedColumn.d.ts +2 -2
- package/lib/db/schema/Schema.d.ts +3 -3
- package/lib/db/schema/Schema.js +1 -2
- package/lib/db/schema/Table.d.ts +3 -3
- package/lib/db/schema/TableV2.d.ts +3 -3
- package/package.json +1 -1
|
@@ -239,6 +239,7 @@ export class AbstractPowerSyncDatabase extends BaseObserver {
|
|
|
239
239
|
await tx.execute(`DELETE FROM ${PSInternalTable.OPLOG}`);
|
|
240
240
|
await tx.execute(`DELETE FROM ${PSInternalTable.CRUD}`);
|
|
241
241
|
await tx.execute(`DELETE FROM ${PSInternalTable.BUCKETS}`);
|
|
242
|
+
await tx.execute(`DELETE FROM ${PSInternalTable.UNTYPED}`);
|
|
242
243
|
const tableGlob = clearLocal ? 'ps_data_*' : 'ps_data__*';
|
|
243
244
|
const existingTableRows = await tx.execute(`
|
|
244
245
|
SELECT name FROM sqlite_master WHERE type='table' AND name GLOB ?
|
|
@@ -38,7 +38,8 @@ export declare enum PSInternalTable {
|
|
|
38
38
|
DATA = "ps_data",
|
|
39
39
|
CRUD = "ps_crud",
|
|
40
40
|
BUCKETS = "ps_buckets",
|
|
41
|
-
OPLOG = "ps_oplog"
|
|
41
|
+
OPLOG = "ps_oplog",
|
|
42
|
+
UNTYPED = "ps_untyped"
|
|
42
43
|
}
|
|
43
44
|
export interface BucketStorageListener extends BaseListener {
|
|
44
45
|
crudUpdate: () => void;
|
|
@@ -12,7 +12,7 @@ export declare class CrudTransaction extends CrudBatch {
|
|
|
12
12
|
/**
|
|
13
13
|
* If null, this contains a list of changes recorded without an explicit transaction associated.
|
|
14
14
|
*/
|
|
15
|
-
transactionId?: number
|
|
15
|
+
transactionId?: number;
|
|
16
16
|
constructor(
|
|
17
17
|
/**
|
|
18
18
|
* List of client-side changes.
|
|
@@ -25,5 +25,5 @@ export declare class CrudTransaction extends CrudBatch {
|
|
|
25
25
|
/**
|
|
26
26
|
* If null, this contains a list of changes recorded without an explicit transaction associated.
|
|
27
27
|
*/
|
|
28
|
-
transactionId?: number
|
|
28
|
+
transactionId?: number);
|
|
29
29
|
}
|
|
@@ -14,10 +14,10 @@ export declare class OplogEntry {
|
|
|
14
14
|
op: OpType;
|
|
15
15
|
checksum: number;
|
|
16
16
|
subkey: string;
|
|
17
|
-
object_type?: string
|
|
18
|
-
object_id?: string
|
|
19
|
-
data?: string
|
|
17
|
+
object_type?: string;
|
|
18
|
+
object_id?: string;
|
|
19
|
+
data?: string;
|
|
20
20
|
static fromRow(row: OplogEntryJSON): OplogEntry;
|
|
21
|
-
constructor(op_id: OpId, op: OpType, checksum: number, subkey: string, object_type?: string
|
|
21
|
+
constructor(op_id: OpId, op: OpType, checksum: number, subkey: string, object_type?: string, object_id?: string, data?: string);
|
|
22
22
|
toJSON(): OplogEntryJSON;
|
|
23
23
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OpId } from './CrudEntry';
|
|
1
2
|
import { OplogEntry, OplogEntryJSON } from './OplogEntry';
|
|
2
3
|
export type SyncDataBucketJSON = {
|
|
3
4
|
bucket: string;
|
|
@@ -17,11 +18,11 @@ export declare class SyncDataBucket {
|
|
|
17
18
|
/**
|
|
18
19
|
* The `after` specified in the request.
|
|
19
20
|
*/
|
|
20
|
-
after?:
|
|
21
|
+
after?: OpId;
|
|
21
22
|
/**
|
|
22
23
|
* Use this for the next request.
|
|
23
24
|
*/
|
|
24
|
-
next_after?:
|
|
25
|
+
next_after?: OpId;
|
|
25
26
|
static fromRow(row: SyncDataBucketJSON): SyncDataBucket;
|
|
26
27
|
constructor(bucket: string, data: OplogEntry[],
|
|
27
28
|
/**
|
|
@@ -31,10 +32,10 @@ export declare class SyncDataBucket {
|
|
|
31
32
|
/**
|
|
32
33
|
* The `after` specified in the request.
|
|
33
34
|
*/
|
|
34
|
-
after?:
|
|
35
|
+
after?: OpId,
|
|
35
36
|
/**
|
|
36
37
|
* Use this for the next request.
|
|
37
38
|
*/
|
|
38
|
-
next_after?:
|
|
39
|
+
next_after?: OpId);
|
|
39
40
|
toJSON(): SyncDataBucketJSON;
|
|
40
41
|
}
|
|
@@ -77,7 +77,7 @@ export declare abstract class AbstractStreamingSyncImplementation extends BaseOb
|
|
|
77
77
|
constructor(options: AbstractStreamingSyncImplementationOptions);
|
|
78
78
|
waitForReady(): Promise<void>;
|
|
79
79
|
waitForStatus(status: SyncStatusOptions): Promise<void>;
|
|
80
|
-
get lastSyncedAt(): Date
|
|
80
|
+
get lastSyncedAt(): Date;
|
|
81
81
|
get isConnected(): boolean;
|
|
82
82
|
protected get logger(): ILogger;
|
|
83
83
|
dispose(): Promise<void>;
|
package/lib/db/Column.d.ts
CHANGED
|
@@ -11,9 +11,9 @@ export declare class Column {
|
|
|
11
11
|
protected options: ColumnOptions;
|
|
12
12
|
constructor(options: ColumnOptions);
|
|
13
13
|
get name(): string;
|
|
14
|
-
get type(): ColumnType
|
|
14
|
+
get type(): ColumnType;
|
|
15
15
|
toJSON(): {
|
|
16
16
|
name: string;
|
|
17
|
-
type: ColumnType
|
|
17
|
+
type: ColumnType;
|
|
18
18
|
};
|
|
19
19
|
}
|
|
@@ -19,12 +19,12 @@ export declare class SyncStatus {
|
|
|
19
19
|
* Time that a last sync has fully completed, if any.
|
|
20
20
|
* Currently this is reset to null after a restart.
|
|
21
21
|
*/
|
|
22
|
-
get lastSyncedAt(): Date
|
|
22
|
+
get lastSyncedAt(): Date;
|
|
23
23
|
/**
|
|
24
24
|
* Indicates whether there has been at least one full sync, if any.
|
|
25
25
|
* Is undefined when unknown, for example when state is still being loaded from the database.
|
|
26
26
|
*/
|
|
27
|
-
get hasSynced(): boolean
|
|
27
|
+
get hasSynced(): boolean;
|
|
28
28
|
/**
|
|
29
29
|
* Upload/download status
|
|
30
30
|
*/
|
package/lib/db/schema/Index.d.ts
CHANGED
|
@@ -10,10 +10,10 @@ export declare class IndexedColumn {
|
|
|
10
10
|
static createAscending(column: string): IndexedColumn;
|
|
11
11
|
constructor(options: IndexColumnOptions);
|
|
12
12
|
get name(): string;
|
|
13
|
-
get ascending(): boolean
|
|
13
|
+
get ascending(): boolean;
|
|
14
14
|
toJSON(table: Table): {
|
|
15
15
|
name: string;
|
|
16
|
-
ascending: boolean
|
|
16
|
+
ascending: boolean;
|
|
17
17
|
type: ColumnType;
|
|
18
18
|
};
|
|
19
19
|
}
|
|
@@ -8,9 +8,9 @@ type SchemaTableType<S extends SchemaType> = {
|
|
|
8
8
|
* A schema is a collection of tables. It is used to define the structure of a database.
|
|
9
9
|
*/
|
|
10
10
|
export declare class Schema<S extends SchemaType = SchemaType> {
|
|
11
|
-
tables: ClassicTable[] | S;
|
|
12
11
|
readonly types: SchemaTableType<S>;
|
|
13
12
|
readonly props: S;
|
|
13
|
+
readonly tables: ClassicTable[];
|
|
14
14
|
constructor(tables: ClassicTable[] | S);
|
|
15
15
|
validate(): void;
|
|
16
16
|
toJSON(): {
|
|
@@ -21,13 +21,13 @@ export declare class Schema<S extends SchemaType = SchemaType> {
|
|
|
21
21
|
insert_only: boolean;
|
|
22
22
|
columns: {
|
|
23
23
|
name: string;
|
|
24
|
-
type: import("../Column").ColumnType
|
|
24
|
+
type: import("../Column").ColumnType;
|
|
25
25
|
}[];
|
|
26
26
|
indexes: {
|
|
27
27
|
name: string;
|
|
28
28
|
columns: {
|
|
29
29
|
name: string;
|
|
30
|
-
ascending: boolean
|
|
30
|
+
ascending: boolean;
|
|
31
31
|
type: import("../Column").ColumnType;
|
|
32
32
|
}[];
|
|
33
33
|
}[];
|
package/lib/db/schema/Schema.js
CHANGED
|
@@ -3,14 +3,13 @@ import { Table as ClassicTable } from './Table';
|
|
|
3
3
|
* A schema is a collection of tables. It is used to define the structure of a database.
|
|
4
4
|
*/
|
|
5
5
|
export class Schema {
|
|
6
|
-
tables;
|
|
7
6
|
/*
|
|
8
7
|
Only available when constructing with mapped typed definition columns
|
|
9
8
|
*/
|
|
10
9
|
types;
|
|
11
10
|
props;
|
|
11
|
+
tables;
|
|
12
12
|
constructor(tables) {
|
|
13
|
-
this.tables = tables;
|
|
14
13
|
if (Array.isArray(tables)) {
|
|
15
14
|
this.tables = tables;
|
|
16
15
|
}
|
package/lib/db/schema/Table.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare class Table {
|
|
|
21
21
|
static createTable(name: string, table: TableV2): Table;
|
|
22
22
|
constructor(options: TableOptions);
|
|
23
23
|
get name(): string;
|
|
24
|
-
get viewNameOverride(): string
|
|
24
|
+
get viewNameOverride(): string;
|
|
25
25
|
get viewName(): string;
|
|
26
26
|
get columns(): Column[];
|
|
27
27
|
get indexes(): Index[];
|
|
@@ -37,13 +37,13 @@ export declare class Table {
|
|
|
37
37
|
insert_only: boolean;
|
|
38
38
|
columns: {
|
|
39
39
|
name: string;
|
|
40
|
-
type: import("../Column").ColumnType
|
|
40
|
+
type: import("../Column").ColumnType;
|
|
41
41
|
}[];
|
|
42
42
|
indexes: {
|
|
43
43
|
name: string;
|
|
44
44
|
columns: {
|
|
45
45
|
name: string;
|
|
46
|
-
ascending: boolean
|
|
46
|
+
ascending: boolean;
|
|
47
47
|
type: import("../Column").ColumnType;
|
|
48
48
|
}[];
|
|
49
49
|
}[];
|
|
@@ -4,9 +4,9 @@ export type BaseColumnType<T extends number | string | null> = {
|
|
|
4
4
|
type: ColumnType;
|
|
5
5
|
};
|
|
6
6
|
export declare const column: {
|
|
7
|
-
text: BaseColumnType<string
|
|
8
|
-
integer: BaseColumnType<number
|
|
9
|
-
real: BaseColumnType<number
|
|
7
|
+
text: BaseColumnType<string>;
|
|
8
|
+
integer: BaseColumnType<number>;
|
|
9
|
+
real: BaseColumnType<number>;
|
|
10
10
|
};
|
|
11
11
|
export type ColumnsType = Record<string, BaseColumnType<any>>;
|
|
12
12
|
export type ExtractColumnValueType<T extends BaseColumnType<any>> = T extends BaseColumnType<infer R> ? R : unknown;
|