@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.mjs
CHANGED
|
@@ -12487,16 +12487,21 @@ class TriggerManagerImpl {
|
|
|
12487
12487
|
}
|
|
12488
12488
|
});
|
|
12489
12489
|
}
|
|
12490
|
-
/**
|
|
12491
|
-
* Creates a diff trigger destination table on the database with the given configuration.
|
|
12492
|
-
* By default this is invoked internally when creating a diff trigger, but can
|
|
12493
|
-
* be used manually if `manageDestinationExternally` is set to true.
|
|
12494
|
-
*/
|
|
12495
12490
|
async createDiffDestinationTable(tableName, options) {
|
|
12496
|
-
const tableTriggerTypeClause =
|
|
12491
|
+
const tableTriggerTypeClause = options?.temporary ? 'TEMP' : '';
|
|
12497
12492
|
const onlyIfNotExists = options?.onlyIfNotExists ? 'IF NOT EXISTS' : '';
|
|
12498
|
-
|
|
12499
|
-
|
|
12493
|
+
let x = `
|
|
12494
|
+
CREATE ${tableTriggerTypeClause} TABLE ${onlyIfNotExists} ${tableName} (
|
|
12495
|
+
operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
12496
|
+
id TEXT,
|
|
12497
|
+
operation TEXT,
|
|
12498
|
+
timestamp TEXT,
|
|
12499
|
+
value TEXT,
|
|
12500
|
+
previous_value TEXT
|
|
12501
|
+
)
|
|
12502
|
+
`;
|
|
12503
|
+
console.log(x);
|
|
12504
|
+
await this.db.execute(/* sql */ `
|
|
12500
12505
|
CREATE ${tableTriggerTypeClause} TABLE ${onlyIfNotExists} ${tableName} (
|
|
12501
12506
|
operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
12502
12507
|
id TEXT,
|
|
@@ -12578,11 +12583,16 @@ class TriggerManagerImpl {
|
|
|
12578
12583
|
// Allow user code to execute in this lock context before the trigger is created.
|
|
12579
12584
|
await hooks?.beforeCreate?.(tx);
|
|
12580
12585
|
if (!manageDestinationExternally) {
|
|
12581
|
-
await
|
|
12582
|
-
|
|
12583
|
-
|
|
12584
|
-
|
|
12585
|
-
|
|
12586
|
+
await tx.execute(/* sql */ `
|
|
12587
|
+
CREATE ${tableTriggerTypeClause} TABLE ${destination} (
|
|
12588
|
+
operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
12589
|
+
id TEXT,
|
|
12590
|
+
operation TEXT,
|
|
12591
|
+
timestamp TEXT,
|
|
12592
|
+
value TEXT,
|
|
12593
|
+
previous_value TEXT
|
|
12594
|
+
)
|
|
12595
|
+
`);
|
|
12586
12596
|
}
|
|
12587
12597
|
if (operations.includes(DiffTriggerOperation.INSERT)) {
|
|
12588
12598
|
const insertTriggerId = this.generateTriggerName(DiffTriggerOperation.INSERT, destination, id, manageDestinationExternally);
|