@powersync/common 0.0.0-dev-20260306114652 → 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/bundle.cjs +23 -13
- package/dist/bundle.cjs.map +1 -1
- package/dist/bundle.mjs +23 -13
- package/dist/bundle.mjs.map +1 -1
- package/dist/bundle.node.cjs +23 -13
- package/dist/bundle.node.cjs.map +1 -1
- package/dist/bundle.node.mjs +23 -13
- package/dist/bundle.node.mjs.map +1 -1
- package/dist/index.d.cts +19 -14
- package/lib/client/triggers/TriggerManager.d.ts +17 -0
- package/lib/client/triggers/TriggerManagerImpl.d.ts +2 -14
- package/lib/client/triggers/TriggerManagerImpl.js +23 -13
- package/lib/client/triggers/TriggerManagerImpl.js.map +1 -1
- package/package.json +1 -1
- package/src/client/triggers/TriggerManager.ts +20 -0
- package/src/client/triggers/TriggerManagerImpl.ts +25 -24
package/dist/bundle.cjs
CHANGED
|
@@ -12489,16 +12489,21 @@ class TriggerManagerImpl {
|
|
|
12489
12489
|
}
|
|
12490
12490
|
});
|
|
12491
12491
|
}
|
|
12492
|
-
/**
|
|
12493
|
-
* Creates a diff trigger destination table on the database with the given configuration.
|
|
12494
|
-
* By default this is invoked internally when creating a diff trigger, but can
|
|
12495
|
-
* be used manually if `manageDestinationExternally` is set to true.
|
|
12496
|
-
*/
|
|
12497
12492
|
async createDiffDestinationTable(tableName, options) {
|
|
12498
|
-
const tableTriggerTypeClause =
|
|
12493
|
+
const tableTriggerTypeClause = options?.temporary ? 'TEMP' : '';
|
|
12499
12494
|
const onlyIfNotExists = options?.onlyIfNotExists ? 'IF NOT EXISTS' : '';
|
|
12500
|
-
|
|
12501
|
-
|
|
12495
|
+
let x = `
|
|
12496
|
+
CREATE ${tableTriggerTypeClause} TABLE ${onlyIfNotExists} ${tableName} (
|
|
12497
|
+
operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
12498
|
+
id TEXT,
|
|
12499
|
+
operation TEXT,
|
|
12500
|
+
timestamp TEXT,
|
|
12501
|
+
value TEXT,
|
|
12502
|
+
previous_value TEXT
|
|
12503
|
+
)
|
|
12504
|
+
`;
|
|
12505
|
+
console.log(x);
|
|
12506
|
+
await this.db.execute(/* sql */ `
|
|
12502
12507
|
CREATE ${tableTriggerTypeClause} TABLE ${onlyIfNotExists} ${tableName} (
|
|
12503
12508
|
operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
12504
12509
|
id TEXT,
|
|
@@ -12580,11 +12585,16 @@ class TriggerManagerImpl {
|
|
|
12580
12585
|
// Allow user code to execute in this lock context before the trigger is created.
|
|
12581
12586
|
await hooks?.beforeCreate?.(tx);
|
|
12582
12587
|
if (!manageDestinationExternally) {
|
|
12583
|
-
await
|
|
12584
|
-
|
|
12585
|
-
|
|
12586
|
-
|
|
12587
|
-
|
|
12588
|
+
await tx.execute(/* sql */ `
|
|
12589
|
+
CREATE ${tableTriggerTypeClause} TABLE ${destination} (
|
|
12590
|
+
operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
12591
|
+
id TEXT,
|
|
12592
|
+
operation TEXT,
|
|
12593
|
+
timestamp TEXT,
|
|
12594
|
+
value TEXT,
|
|
12595
|
+
previous_value TEXT
|
|
12596
|
+
)
|
|
12597
|
+
`);
|
|
12588
12598
|
}
|
|
12589
12599
|
if (operations.includes(exports.DiffTriggerOperation.INSERT)) {
|
|
12590
12600
|
const insertTriggerId = this.generateTriggerName(exports.DiffTriggerOperation.INSERT, destination, id, manageDestinationExternally);
|