@powersync/web 1.28.1 → 1.28.2
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/worker/SharedSyncImplementation.umd.js +21 -10
- package/dist/worker/SharedSyncImplementation.umd.js.map +1 -1
- package/dist/worker/WASQLiteDB.umd.js +21 -10
- package/dist/worker/WASQLiteDB.umd.js.map +1 -1
- package/lib/package.json +2 -2
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -7914,7 +7914,7 @@ function requireDist () {
|
|
|
7914
7914
|
|
|
7915
7915
|
var distExports = requireDist();
|
|
7916
7916
|
|
|
7917
|
-
var version = "1.
|
|
7917
|
+
var version = "1.42.0";
|
|
7918
7918
|
var PACKAGE = {
|
|
7919
7919
|
version: version};
|
|
7920
7920
|
|
|
@@ -8662,9 +8662,11 @@ class AbstractRemote {
|
|
|
8662
8662
|
// Create a new stream splitting the response at line endings while also handling cancellations
|
|
8663
8663
|
// by closing the reader.
|
|
8664
8664
|
const reader = res.body.getReader();
|
|
8665
|
+
let readerReleased = false;
|
|
8665
8666
|
// This will close the network request and read stream
|
|
8666
8667
|
const closeReader = async () => {
|
|
8667
8668
|
try {
|
|
8669
|
+
readerReleased = true;
|
|
8668
8670
|
await reader.cancel();
|
|
8669
8671
|
}
|
|
8670
8672
|
catch (ex) {
|
|
@@ -8672,17 +8674,21 @@ class AbstractRemote {
|
|
|
8672
8674
|
}
|
|
8673
8675
|
reader.releaseLock();
|
|
8674
8676
|
};
|
|
8677
|
+
const stream = new DataStream({
|
|
8678
|
+
logger: this.logger,
|
|
8679
|
+
mapLine: mapLine
|
|
8680
|
+
});
|
|
8675
8681
|
abortSignal?.addEventListener('abort', () => {
|
|
8676
8682
|
closeReader();
|
|
8683
|
+
stream.close();
|
|
8677
8684
|
});
|
|
8678
8685
|
const decoder = this.createTextDecoder();
|
|
8679
8686
|
let buffer = '';
|
|
8680
|
-
const stream = new DataStream({
|
|
8681
|
-
logger: this.logger,
|
|
8682
|
-
mapLine: mapLine
|
|
8683
|
-
});
|
|
8684
8687
|
const l = stream.registerListener({
|
|
8685
8688
|
lowWater: async () => {
|
|
8689
|
+
if (stream.closed || abortSignal?.aborted || readerReleased) {
|
|
8690
|
+
return;
|
|
8691
|
+
}
|
|
8686
8692
|
try {
|
|
8687
8693
|
let didCompleteLine = false;
|
|
8688
8694
|
while (!didCompleteLine) {
|
|
@@ -9842,6 +9848,7 @@ class TriggerManagerImpl {
|
|
|
9842
9848
|
await hooks?.beforeCreate?.(tx);
|
|
9843
9849
|
await tx.execute(/* sql */ `
|
|
9844
9850
|
CREATE TEMP TABLE ${destination} (
|
|
9851
|
+
operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
9845
9852
|
id TEXT,
|
|
9846
9853
|
operation TEXT,
|
|
9847
9854
|
timestamp TEXT,
|
|
@@ -9952,17 +9959,20 @@ class TriggerManagerImpl {
|
|
|
9952
9959
|
const callbackResult = await options.onChange({
|
|
9953
9960
|
...tx,
|
|
9954
9961
|
destinationTable: destination,
|
|
9955
|
-
withDiff: async (query, params) => {
|
|
9962
|
+
withDiff: async (query, params, options) => {
|
|
9956
9963
|
// Wrap the query to expose the destination table
|
|
9964
|
+
const operationIdSelect = options?.castOperationIdAsText
|
|
9965
|
+
? 'id, operation, CAST(operation_id AS TEXT) as operation_id, timestamp, value, previous_value'
|
|
9966
|
+
: '*';
|
|
9957
9967
|
const wrappedQuery = /* sql */ `
|
|
9958
9968
|
WITH
|
|
9959
9969
|
DIFF AS (
|
|
9960
9970
|
SELECT
|
|
9961
|
-
|
|
9971
|
+
${operationIdSelect}
|
|
9962
9972
|
FROM
|
|
9963
9973
|
${destination}
|
|
9964
9974
|
ORDER BY
|
|
9965
|
-
|
|
9975
|
+
operation_id ASC
|
|
9966
9976
|
) ${query}
|
|
9967
9977
|
`;
|
|
9968
9978
|
return tx.getAll(wrappedQuery, params);
|
|
@@ -9976,13 +9986,14 @@ class TriggerManagerImpl {
|
|
|
9976
9986
|
id,
|
|
9977
9987
|
${contextColumns.length > 0
|
|
9978
9988
|
? `${contextColumns.map((col) => `json_extract(value, '$.${col}') as ${col}`).join(', ')},`
|
|
9979
|
-
: ''}
|
|
9989
|
+
: ''} operation_id as __operation_id,
|
|
9990
|
+
operation as __operation,
|
|
9980
9991
|
timestamp as __timestamp,
|
|
9981
9992
|
previous_value as __previous_value
|
|
9982
9993
|
FROM
|
|
9983
9994
|
${destination}
|
|
9984
9995
|
ORDER BY
|
|
9985
|
-
|
|
9996
|
+
__operation_id ASC
|
|
9986
9997
|
) ${query}
|
|
9987
9998
|
`;
|
|
9988
9999
|
return tx.getAll(wrappedQuery, params);
|