@powersync/common 1.16.2 → 1.18.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/bundle.mjs +17 -0
- package/lib/client/AbstractPowerSyncDatabase.d.ts +22 -15
- package/lib/client/AbstractPowerSyncDatabase.js +51 -35
- package/lib/client/AbstractPowerSyncDatabase.js.map +1 -1
- package/lib/client/AbstractPowerSyncOpenFactory.d.ts +5 -5
- package/lib/client/SQLOpenFactory.d.ts +1 -1
- package/lib/client/connection/PowerSyncBackendConnector.d.ts +2 -2
- package/lib/client/sync/bucket/BucketStorageAdapter.d.ts +8 -4
- package/lib/client/sync/bucket/CrudBatch.d.ts +1 -1
- package/lib/client/sync/bucket/CrudTransaction.d.ts +2 -2
- package/lib/client/sync/bucket/CrudTransaction.js +1 -1
- package/lib/client/sync/bucket/CrudTransaction.js.map +1 -1
- package/lib/client/sync/bucket/OplogEntry.d.ts +2 -2
- package/lib/client/sync/bucket/OplogEntry.js +1 -1
- package/lib/client/sync/bucket/OplogEntry.js.map +1 -1
- package/lib/client/sync/bucket/SqliteBucketStorage.d.ts +9 -6
- package/lib/client/sync/bucket/SqliteBucketStorage.js +28 -12
- package/lib/client/sync/bucket/SqliteBucketStorage.js.map +1 -1
- package/lib/client/sync/bucket/SyncDataBatch.d.ts +1 -1
- package/lib/client/sync/bucket/SyncDataBatch.js +1 -1
- package/lib/client/sync/bucket/SyncDataBatch.js.map +1 -1
- package/lib/client/sync/bucket/SyncDataBucket.d.ts +2 -2
- package/lib/client/sync/bucket/SyncDataBucket.js +1 -1
- package/lib/client/sync/bucket/SyncDataBucket.js.map +1 -1
- package/lib/client/sync/stream/AbstractRemote.d.ts +8 -6
- package/lib/client/sync/stream/AbstractRemote.js +17 -6
- package/lib/client/sync/stream/AbstractRemote.js.map +1 -1
- package/lib/client/sync/stream/AbstractStreamingSyncImplementation.d.ts +8 -8
- package/lib/client/sync/stream/AbstractStreamingSyncImplementation.js +14 -10
- package/lib/client/sync/stream/AbstractStreamingSyncImplementation.js.map +1 -1
- package/lib/client/sync/stream/streaming-sync-types.d.ts +4 -3
- package/lib/client/sync/stream/streaming-sync-types.js.map +1 -1
- package/lib/db/DBAdapter.d.ts +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 +3 -3
- package/lib/db/schema/Index.js +1 -1
- package/lib/db/schema/Index.js.map +1 -1
- package/lib/db/schema/IndexedColumn.d.ts +2 -2
- 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 +90 -10
- 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 +34 -35
- package/lib/index.js +34 -35
- package/lib/index.js.map +1 -1
- package/lib/utils/DataStream.d.ts +1 -1
- package/lib/utils/DataStream.js +1 -1
- package/lib/utils/DataStream.js.map +1 -1
- package/lib/utils/parseQuery.d.ts +1 -1
- package/lib/utils/throttle.d.ts +14 -0
- package/lib/utils/throttle.js +46 -0
- package/lib/utils/throttle.js.map +1 -0
- package/package.json +13 -6
- package/dist/index.js +0 -16
- 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
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Throttle a function to be called at most once every "wait" milliseconds,
|
|
3
|
+
* on the trailing edge.
|
|
4
|
+
*
|
|
5
|
+
* Roughly equivalent to lodash/throttle with {leading: false, trailing: true}
|
|
6
|
+
*/
|
|
7
|
+
export function throttleTrailing(func, wait) {
|
|
8
|
+
let timeoutId = null;
|
|
9
|
+
const later = () => {
|
|
10
|
+
func();
|
|
11
|
+
timeoutId = null;
|
|
12
|
+
};
|
|
13
|
+
return function () {
|
|
14
|
+
if (timeoutId == null) {
|
|
15
|
+
timeoutId = setTimeout(later, wait);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Throttle a function to be called at most once every "wait" milliseconds,
|
|
21
|
+
* on the leading and trailing edge.
|
|
22
|
+
*
|
|
23
|
+
* Roughly equivalent to lodash/throttle with {leading: true, trailing: true}
|
|
24
|
+
*/
|
|
25
|
+
export function throttleLeadingTrailing(func, wait) {
|
|
26
|
+
let timeoutId = null;
|
|
27
|
+
let lastCallTime = 0;
|
|
28
|
+
const invokeFunction = () => {
|
|
29
|
+
func();
|
|
30
|
+
lastCallTime = Date.now();
|
|
31
|
+
timeoutId = null;
|
|
32
|
+
};
|
|
33
|
+
return function () {
|
|
34
|
+
const now = Date.now();
|
|
35
|
+
const timeToWait = wait - (now - lastCallTime);
|
|
36
|
+
if (timeToWait <= 0) {
|
|
37
|
+
// Leading edge: Call the function immediately if enough time has passed
|
|
38
|
+
invokeFunction();
|
|
39
|
+
}
|
|
40
|
+
else if (!timeoutId) {
|
|
41
|
+
// Set a timeout for the trailing edge if not already set
|
|
42
|
+
timeoutId = setTimeout(invokeFunction, timeToWait);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=throttle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throttle.js","sourceRoot":"","sources":["../../src/utils/throttle.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAgB,EAAE,IAAY;IAC7D,IAAI,SAAS,GAAyC,IAAI,CAAC;IAE3D,MAAM,KAAK,GAAG,GAAG,EAAE;QACjB,IAAI,EAAE,CAAC;QACP,SAAS,GAAG,IAAI,CAAC;IACnB,CAAC,CAAC;IAEF,OAAO;QACL,IAAI,SAAS,IAAI,IAAI,EAAE,CAAC;YACtB,SAAS,GAAG,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACtC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAgB,EAAE,IAAY;IACpE,IAAI,SAAS,GAAyC,IAAI,CAAC;IAC3D,IAAI,YAAY,GAAW,CAAC,CAAC;IAE7B,MAAM,cAAc,GAAG,GAAG,EAAE;QAC1B,IAAI,EAAE,CAAC;QACP,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC1B,SAAS,GAAG,IAAI,CAAC;IACnB,CAAC,CAAC;IAEF,OAAO;QACL,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,GAAG,GAAG,YAAY,CAAC,CAAC;QAE/C,IAAI,UAAU,IAAI,CAAC,EAAE,CAAC;YACpB,wEAAwE;YACxE,cAAc,EAAE,CAAC;QACnB,CAAC;aAAM,IAAI,CAAC,SAAS,EAAE,CAAC;YACtB,yDAAyD;YACzD,SAAS,GAAG,UAAU,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;QACrD,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powersync/common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"description": "API definitions for JourneyApps PowerSync",
|
|
9
|
-
"
|
|
9
|
+
"type": "module",
|
|
10
|
+
"main": "dist/bundle.mjs",
|
|
11
|
+
"module": "dist/bundle.mjs",
|
|
10
12
|
"types": "lib/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": "./dist/bundle.mjs",
|
|
16
|
+
"default": "./dist/bundle.mjs",
|
|
17
|
+
"types": "./lib/index.d.ts"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
11
20
|
"author": "JOURNEYAPPS",
|
|
12
21
|
"license": "Apache-2.0",
|
|
13
22
|
"files": [
|
|
@@ -31,7 +40,6 @@
|
|
|
31
40
|
"@rollup/plugin-json": "^6.1.0",
|
|
32
41
|
"@rollup/plugin-node-resolve": "15.2.3",
|
|
33
42
|
"@rollup/plugin-terser": "^0.4.4",
|
|
34
|
-
"@types/lodash": "^4.14.197",
|
|
35
43
|
"@types/node": "^20.5.9",
|
|
36
44
|
"@types/uuid": "^9.0.1",
|
|
37
45
|
"async-mutex": "^0.4.0",
|
|
@@ -40,18 +48,17 @@
|
|
|
40
48
|
"can-ndjson-stream": "^1.0.2",
|
|
41
49
|
"cross-fetch": "^4.0.0",
|
|
42
50
|
"event-iterator": "^2.0.0",
|
|
43
|
-
"lodash": "^4.17.21",
|
|
44
51
|
"rollup": "4.14.3",
|
|
45
52
|
"rsocket-core": "1.0.0-alpha.3",
|
|
46
53
|
"rsocket-websocket-client": "1.0.0-alpha.3",
|
|
47
54
|
"text-encoding": "^0.7.0",
|
|
48
55
|
"typescript": "^5.5.3",
|
|
49
|
-
"vitest": "^
|
|
56
|
+
"vitest": "^2.0.5",
|
|
50
57
|
"web-streams-polyfill": "3.2.1"
|
|
51
58
|
},
|
|
52
59
|
"scripts": {
|
|
53
60
|
"build": "tsc -b && rollup -c rollup.config.mjs",
|
|
54
|
-
"clean": "rm -rf lib tsconfig.tsbuildinfo
|
|
61
|
+
"clean": "rm -rf lib dist tsconfig.tsbuildinfo",
|
|
55
62
|
"test": "vitest"
|
|
56
63
|
}
|
|
57
64
|
}
|