@powersync/web 0.0.0-dev-20260305124002 → 0.0.0-dev-20260306125455
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 +32 -6
- package/dist/worker/SharedSyncImplementation.umd.js.map +1 -1
- package/dist/worker/WASQLiteDB.umd.js +32 -6
- 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
|
@@ -14939,7 +14939,7 @@ function requireDist () {
|
|
|
14939
14939
|
|
|
14940
14940
|
var distExports = requireDist();
|
|
14941
14941
|
|
|
14942
|
-
var version = "1.
|
|
14942
|
+
var version = "1.48.0";
|
|
14943
14943
|
var PACKAGE = {
|
|
14944
14944
|
version: version};
|
|
14945
14945
|
|
|
@@ -16912,8 +16912,9 @@ class TriggerManagerImpl {
|
|
|
16912
16912
|
...config
|
|
16913
16913
|
};
|
|
16914
16914
|
}
|
|
16915
|
-
generateTriggerName(operation, destinationTable, triggerId) {
|
|
16916
|
-
|
|
16915
|
+
generateTriggerName(operation, destinationTable, triggerId, managedExternally = false) {
|
|
16916
|
+
const managedTerm = managedExternally ? '_external' : '';
|
|
16917
|
+
return `__ps${managedTerm}_temp_trigger_${operation.toLowerCase()}__${destinationTable}__${triggerId}`;
|
|
16917
16918
|
}
|
|
16918
16919
|
/**
|
|
16919
16920
|
* Cleanup any SQLite triggers or tables that are no longer in use.
|
|
@@ -16970,6 +16971,31 @@ class TriggerManagerImpl {
|
|
|
16970
16971
|
}
|
|
16971
16972
|
});
|
|
16972
16973
|
}
|
|
16974
|
+
async createDiffDestinationTable(tableName, options) {
|
|
16975
|
+
const tableTriggerTypeClause = options?.temporary ? 'TEMP' : '';
|
|
16976
|
+
const onlyIfNotExists = options?.onlyIfNotExists ? 'IF NOT EXISTS' : '';
|
|
16977
|
+
let x = `
|
|
16978
|
+
CREATE ${tableTriggerTypeClause} TABLE ${onlyIfNotExists} ${tableName} (
|
|
16979
|
+
operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
16980
|
+
id TEXT,
|
|
16981
|
+
operation TEXT,
|
|
16982
|
+
timestamp TEXT,
|
|
16983
|
+
value TEXT,
|
|
16984
|
+
previous_value TEXT
|
|
16985
|
+
)
|
|
16986
|
+
`;
|
|
16987
|
+
console.log(x);
|
|
16988
|
+
await this.db.execute(/* sql */ `
|
|
16989
|
+
CREATE ${tableTriggerTypeClause} TABLE ${onlyIfNotExists} ${tableName} (
|
|
16990
|
+
operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
16991
|
+
id TEXT,
|
|
16992
|
+
operation TEXT,
|
|
16993
|
+
timestamp TEXT,
|
|
16994
|
+
value TEXT,
|
|
16995
|
+
previous_value TEXT
|
|
16996
|
+
)
|
|
16997
|
+
`);
|
|
16998
|
+
}
|
|
16973
16999
|
async createDiffTrigger(options) {
|
|
16974
17000
|
await this.db.waitForReady();
|
|
16975
17001
|
const { source, destination, columns, when, hooks, manageDestinationExternally = false,
|
|
@@ -17053,7 +17079,7 @@ class TriggerManagerImpl {
|
|
|
17053
17079
|
`);
|
|
17054
17080
|
}
|
|
17055
17081
|
if (operations.includes(DiffTriggerOperation.INSERT)) {
|
|
17056
|
-
const insertTriggerId = this.generateTriggerName(DiffTriggerOperation.INSERT, destination, id);
|
|
17082
|
+
const insertTriggerId = this.generateTriggerName(DiffTriggerOperation.INSERT, destination, id, manageDestinationExternally);
|
|
17057
17083
|
triggerIds.push(insertTriggerId);
|
|
17058
17084
|
await tx.execute(/* sql */ `
|
|
17059
17085
|
CREATE ${tableTriggerTypeClause} TRIGGER ${insertTriggerId} AFTER INSERT ON ${internalSource} ${whenClauses[DiffTriggerOperation.INSERT]} BEGIN
|
|
@@ -17071,7 +17097,7 @@ class TriggerManagerImpl {
|
|
|
17071
17097
|
`);
|
|
17072
17098
|
}
|
|
17073
17099
|
if (operations.includes(DiffTriggerOperation.UPDATE)) {
|
|
17074
|
-
const updateTriggerId = this.generateTriggerName(DiffTriggerOperation.UPDATE, destination, id);
|
|
17100
|
+
const updateTriggerId = this.generateTriggerName(DiffTriggerOperation.UPDATE, destination, id, manageDestinationExternally);
|
|
17075
17101
|
triggerIds.push(updateTriggerId);
|
|
17076
17102
|
await tx.execute(/* sql */ `
|
|
17077
17103
|
CREATE ${tableTriggerTypeClause} TRIGGER ${updateTriggerId} AFTER
|
|
@@ -17091,7 +17117,7 @@ class TriggerManagerImpl {
|
|
|
17091
17117
|
`);
|
|
17092
17118
|
}
|
|
17093
17119
|
if (operations.includes(DiffTriggerOperation.DELETE)) {
|
|
17094
|
-
const deleteTriggerId = this.generateTriggerName(DiffTriggerOperation.DELETE, destination, id);
|
|
17120
|
+
const deleteTriggerId = this.generateTriggerName(DiffTriggerOperation.DELETE, destination, id, manageDestinationExternally);
|
|
17095
17121
|
triggerIds.push(deleteTriggerId);
|
|
17096
17122
|
// Create delete trigger for basic JSON
|
|
17097
17123
|
await tx.execute(/* sql */ `
|