@powersync/common 1.16.1 → 1.17.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.
- package/dist/index.js +4 -4
- package/lib/client/AbstractPowerSyncDatabase.d.ts +10 -3
- package/lib/client/AbstractPowerSyncDatabase.js +44 -22
- package/lib/client/AbstractPowerSyncDatabase.js.map +1 -1
- package/lib/client/AbstractPowerSyncOpenFactory.d.ts +1 -1
- package/lib/client/SQLOpenFactory.js +2 -1
- package/lib/client/SQLOpenFactory.js.map +1 -1
- package/lib/client/constants.d.ts +1 -0
- package/lib/client/constants.js +2 -0
- package/lib/client/constants.js.map +1 -0
- package/lib/client/sync/bucket/BucketStorageAdapter.d.ts +4 -0
- package/lib/client/sync/bucket/CrudEntry.d.ts +2 -7
- package/lib/client/sync/bucket/SqliteBucketStorage.d.ts +3 -1
- package/lib/client/sync/bucket/SqliteBucketStorage.js +27 -23
- package/lib/client/sync/bucket/SqliteBucketStorage.js.map +1 -1
- package/lib/client/sync/bucket/SyncDataBucket.d.ts +0 -1
- package/lib/client/sync/bucket/SyncDataBucket.js +0 -1
- package/lib/client/sync/bucket/SyncDataBucket.js.map +1 -1
- package/lib/client/sync/stream/AbstractRemote.d.ts +2 -0
- package/lib/client/sync/stream/AbstractRemote.js +13 -2
- package/lib/client/sync/stream/AbstractRemote.js.map +1 -1
- package/lib/client/sync/stream/AbstractStreamingSyncImplementation.js +7 -3
- package/lib/client/sync/stream/AbstractStreamingSyncImplementation.js.map +1 -1
- package/lib/client/sync/stream/streaming-sync-types.d.ts +1 -0
- package/lib/client/sync/stream/streaming-sync-types.js.map +1 -1
- package/lib/db/schema/Column.d.ts +30 -0
- package/lib/db/{Column.js → schema/Column.js} +17 -0
- package/lib/db/schema/Column.js.map +1 -0
- package/lib/db/schema/Index.d.ts +1 -1
- package/lib/db/schema/IndexedColumn.d.ts +1 -1
- package/lib/db/schema/IndexedColumn.js +1 -1
- package/lib/db/schema/IndexedColumn.js.map +1 -1
- package/lib/db/schema/Schema.d.ts +6 -7
- package/lib/db/schema/Schema.js +11 -2
- package/lib/db/schema/Schema.js.map +1 -1
- package/lib/db/schema/Table.d.ts +89 -9
- package/lib/db/schema/Table.js +64 -9
- package/lib/db/schema/Table.js.map +1 -1
- package/lib/db/schema/TableV2.d.ts +8 -29
- package/lib/db/schema/TableV2.js +5 -40
- package/lib/db/schema/TableV2.js.map +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.js +4 -4
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
- package/lib/db/Column.d.ts +0 -19
- package/lib/db/Column.js.map +0 -1
- package/lib/utils/strings.d.ts +0 -3
- package/lib/utils/strings.js +0 -10
- package/lib/utils/strings.js.map +0 -1
|
@@ -1,30 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
real: BaseColumnType<number | null>;
|
|
10
|
-
};
|
|
11
|
-
export type ColumnsType = Record<string, BaseColumnType<any>>;
|
|
12
|
-
export type ExtractColumnValueType<T extends BaseColumnType<any>> = T extends BaseColumnType<infer R> ? R : unknown;
|
|
13
|
-
export type RowType<T extends TableV2<any>> = {
|
|
14
|
-
[K in keyof T['columns']]: ExtractColumnValueType<T['columns'][K]>;
|
|
15
|
-
} & {
|
|
16
|
-
id: string;
|
|
17
|
-
};
|
|
18
|
-
export type IndexShorthand = Record<string, string[]>;
|
|
19
|
-
export interface TableV2Options {
|
|
20
|
-
indexes?: IndexShorthand;
|
|
21
|
-
localOnly?: boolean;
|
|
22
|
-
insertOnly?: boolean;
|
|
23
|
-
viewName?: string;
|
|
24
|
-
}
|
|
25
|
-
export declare class TableV2<Columns extends ColumnsType = ColumnsType> {
|
|
26
|
-
columns: Columns;
|
|
27
|
-
options: TableV2Options;
|
|
28
|
-
indexes: Index[];
|
|
29
|
-
constructor(columns: Columns, options?: TableV2Options);
|
|
1
|
+
import { ColumnsType } from './Column';
|
|
2
|
+
import { Table } from './Table';
|
|
3
|
+
/**
|
|
4
|
+
Generate a new table from the columns and indexes
|
|
5
|
+
@deprecated You should use {@link Table} instead as it now allows TableV2 syntax.
|
|
6
|
+
This will be removed in the next major release.
|
|
7
|
+
*/
|
|
8
|
+
export declare class TableV2<Columns extends ColumnsType = ColumnsType> extends Table<Columns> {
|
|
30
9
|
}
|
package/lib/db/schema/TableV2.js
CHANGED
|
@@ -1,44 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { IndexedColumn } from './IndexedColumn';
|
|
4
|
-
const text = {
|
|
5
|
-
type: ColumnType.TEXT
|
|
6
|
-
};
|
|
7
|
-
const integer = {
|
|
8
|
-
type: ColumnType.INTEGER
|
|
9
|
-
};
|
|
10
|
-
const real = {
|
|
11
|
-
type: ColumnType.REAL
|
|
12
|
-
};
|
|
13
|
-
export const column = {
|
|
14
|
-
text,
|
|
15
|
-
integer,
|
|
16
|
-
real
|
|
17
|
-
};
|
|
18
|
-
/*
|
|
1
|
+
import { Table } from './Table';
|
|
2
|
+
/**
|
|
19
3
|
Generate a new table from the columns and indexes
|
|
4
|
+
@deprecated You should use {@link Table} instead as it now allows TableV2 syntax.
|
|
5
|
+
This will be removed in the next major release.
|
|
20
6
|
*/
|
|
21
|
-
export class TableV2 {
|
|
22
|
-
columns;
|
|
23
|
-
options;
|
|
24
|
-
indexes;
|
|
25
|
-
constructor(columns, options = {}) {
|
|
26
|
-
this.columns = columns;
|
|
27
|
-
this.options = options;
|
|
28
|
-
if (options?.indexes) {
|
|
29
|
-
this.indexes = Object.entries(options.indexes).map(([name, columns]) => {
|
|
30
|
-
if (name.startsWith('-')) {
|
|
31
|
-
return new Index({
|
|
32
|
-
name: name.substring(1),
|
|
33
|
-
columns: columns.map((c) => new IndexedColumn({ name: c, ascending: false }))
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
return new Index({
|
|
37
|
-
name: name,
|
|
38
|
-
columns: columns.map((c) => new IndexedColumn({ name: c, ascending: true }))
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}
|
|
7
|
+
export class TableV2 extends Table {
|
|
43
8
|
}
|
|
44
9
|
//# sourceMappingURL=TableV2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableV2.js","sourceRoot":"","sources":["../../../src/db/schema/TableV2.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TableV2.js","sourceRoot":"","sources":["../../../src/db/schema/TableV2.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;;;EAIE;AACF,MAAM,OAAO,OAAmD,SAAQ,KAAc;CAAG"}
|
package/lib/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export * from './client/SQLOpenFactory';
|
|
|
4
4
|
export * from './client/connection/PowerSyncBackendConnector';
|
|
5
5
|
export * from './client/connection/PowerSyncCredentials';
|
|
6
6
|
export * from './client/sync/bucket/BucketStorageAdapter';
|
|
7
|
-
export
|
|
7
|
+
export { UpdateType, CrudEntry, OpId } from './client/sync/bucket/CrudEntry';
|
|
8
8
|
export * from './client/sync/bucket/SqliteBucketStorage';
|
|
9
9
|
export * from './client/sync/bucket/CrudBatch';
|
|
10
10
|
export * from './client/sync/bucket/CrudTransaction';
|
|
@@ -15,20 +15,20 @@ export * from './client/sync/bucket/OplogEntry';
|
|
|
15
15
|
export * from './client/sync/stream/AbstractRemote';
|
|
16
16
|
export * from './client/sync/stream/AbstractStreamingSyncImplementation';
|
|
17
17
|
export * from './client/sync/stream/streaming-sync-types';
|
|
18
|
+
export { MAX_OP_ID } from './client/constants';
|
|
18
19
|
export * from './db/crud/SyncStatus';
|
|
19
20
|
export * from './db/crud/UploadQueueStatus';
|
|
20
21
|
export * from './db/schema/Schema';
|
|
21
22
|
export * from './db/schema/Table';
|
|
22
23
|
export * from './db/schema/Index';
|
|
23
24
|
export * from './db/schema/IndexedColumn';
|
|
25
|
+
export * from './db/schema/Column';
|
|
26
|
+
export * from './db/schema/TableV2';
|
|
24
27
|
export * from './db/crud/SyncStatus';
|
|
25
28
|
export * from './db/crud/UploadQueueStatus';
|
|
26
29
|
export * from './db/DBAdapter';
|
|
27
|
-
export * from './db/Column';
|
|
28
|
-
export * from './db/schema/TableV2';
|
|
29
30
|
export * from './utils/AbortOperation';
|
|
30
31
|
export * from './utils/BaseObserver';
|
|
31
|
-
export * from './utils/strings';
|
|
32
32
|
export * from './utils/DataStream';
|
|
33
33
|
export * from './utils/parseQuery';
|
|
34
34
|
export * from './types/types';
|
package/lib/index.js
CHANGED
|
@@ -4,7 +4,7 @@ export * from './client/SQLOpenFactory';
|
|
|
4
4
|
export * from './client/connection/PowerSyncBackendConnector';
|
|
5
5
|
export * from './client/connection/PowerSyncCredentials';
|
|
6
6
|
export * from './client/sync/bucket/BucketStorageAdapter';
|
|
7
|
-
export
|
|
7
|
+
export { UpdateType, CrudEntry } from './client/sync/bucket/CrudEntry';
|
|
8
8
|
export * from './client/sync/bucket/SqliteBucketStorage';
|
|
9
9
|
export * from './client/sync/bucket/CrudBatch';
|
|
10
10
|
export * from './client/sync/bucket/CrudTransaction';
|
|
@@ -15,20 +15,20 @@ export * from './client/sync/bucket/OplogEntry';
|
|
|
15
15
|
export * from './client/sync/stream/AbstractRemote';
|
|
16
16
|
export * from './client/sync/stream/AbstractStreamingSyncImplementation';
|
|
17
17
|
export * from './client/sync/stream/streaming-sync-types';
|
|
18
|
+
export { MAX_OP_ID } from './client/constants';
|
|
18
19
|
export * from './db/crud/SyncStatus';
|
|
19
20
|
export * from './db/crud/UploadQueueStatus';
|
|
20
21
|
export * from './db/schema/Schema';
|
|
21
22
|
export * from './db/schema/Table';
|
|
22
23
|
export * from './db/schema/Index';
|
|
23
24
|
export * from './db/schema/IndexedColumn';
|
|
25
|
+
export * from './db/schema/Column';
|
|
26
|
+
export * from './db/schema/TableV2';
|
|
24
27
|
export * from './db/crud/SyncStatus';
|
|
25
28
|
export * from './db/crud/UploadQueueStatus';
|
|
26
29
|
export * from './db/DBAdapter';
|
|
27
|
-
export * from './db/Column';
|
|
28
|
-
export * from './db/schema/TableV2';
|
|
29
30
|
export * from './utils/AbortOperation';
|
|
30
31
|
export * from './utils/BaseObserver';
|
|
31
|
-
export * from './utils/strings';
|
|
32
32
|
export * from './utils/DataStream';
|
|
33
33
|
export * from './utils/parseQuery';
|
|
34
34
|
export * from './types/types';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC;AACtD,cAAc,yBAAyB,CAAC;AACxC,cAAc,+CAA+C,CAAC;AAC9D,cAAc,0CAA0C,CAAC;AACzD,cAAc,2CAA2C,CAAC;AAC1D,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC;AACtD,cAAc,yBAAyB,CAAC;AACxC,cAAc,+CAA+C,CAAC;AAC9D,cAAc,0CAA0C,CAAC;AACzD,cAAc,2CAA2C,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAQ,MAAM,gCAAgC,CAAC;AAC7E,cAAc,0CAA0C,CAAC;AACzD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0DAA0D,CAAC;AACzE,cAAc,2CAA2C,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gBAAgB,CAAC;AAE/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,eAAe,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powersync/common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"rsocket-websocket-client": "1.0.0-alpha.3",
|
|
47
47
|
"text-encoding": "^0.7.0",
|
|
48
48
|
"typescript": "^5.5.3",
|
|
49
|
-
"vitest": "^
|
|
49
|
+
"vitest": "^2.0.5",
|
|
50
50
|
"web-streams-polyfill": "3.2.1"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
package/lib/db/Column.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare enum ColumnType {
|
|
2
|
-
TEXT = "TEXT",
|
|
3
|
-
INTEGER = "INTEGER",
|
|
4
|
-
REAL = "REAL"
|
|
5
|
-
}
|
|
6
|
-
export interface ColumnOptions {
|
|
7
|
-
name: string;
|
|
8
|
-
type?: ColumnType;
|
|
9
|
-
}
|
|
10
|
-
export declare class Column {
|
|
11
|
-
protected options: ColumnOptions;
|
|
12
|
-
constructor(options: ColumnOptions);
|
|
13
|
-
get name(): string;
|
|
14
|
-
get type(): ColumnType | undefined;
|
|
15
|
-
toJSON(): {
|
|
16
|
-
name: string;
|
|
17
|
-
type: ColumnType | undefined;
|
|
18
|
-
};
|
|
19
|
-
}
|
package/lib/db/Column.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Column.js","sourceRoot":"","sources":["../../src/db/Column.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,2BAAa,CAAA;IACb,iCAAmB,CAAA;IACnB,2BAAa,CAAA;AACf,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB;AAOD,MAAM,OAAO,MAAM;IACK;IAAtB,YAAsB,OAAsB;QAAtB,YAAO,GAAP,OAAO,CAAe;IAAG,CAAC;IAEhD,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC;CACF"}
|
package/lib/utils/strings.d.ts
DELETED
package/lib/utils/strings.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export function quoteString(s) {
|
|
2
|
-
return `'${s.replaceAll("'", "''")}'`;
|
|
3
|
-
}
|
|
4
|
-
export function quoteJsonPath(path) {
|
|
5
|
-
return quoteString(`$.${path}`);
|
|
6
|
-
}
|
|
7
|
-
export function quoteIdentifier(s) {
|
|
8
|
-
return `"${s.replaceAll('"', '""')}"`;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=strings.js.map
|
package/lib/utils/strings.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"strings.js","sourceRoot":"","sources":["../../src/utils/strings.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CAAC,CAAS;IACnC,OAAO,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,WAAW,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,CAAS;IACvC,OAAO,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC;AACxC,CAAC"}
|