@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.node.cjs
CHANGED
|
@@ -9967,16 +9967,21 @@ class TriggerManagerImpl {
|
|
|
9967
9967
|
}
|
|
9968
9968
|
});
|
|
9969
9969
|
}
|
|
9970
|
-
/**
|
|
9971
|
-
* Creates a diff trigger destination table on the database with the given configuration.
|
|
9972
|
-
* By default this is invoked internally when creating a diff trigger, but can
|
|
9973
|
-
* be used manually if `manageDestinationExternally` is set to true.
|
|
9974
|
-
*/
|
|
9975
9970
|
async createDiffDestinationTable(tableName, options) {
|
|
9976
|
-
const tableTriggerTypeClause =
|
|
9971
|
+
const tableTriggerTypeClause = options?.temporary ? 'TEMP' : '';
|
|
9977
9972
|
const onlyIfNotExists = options?.onlyIfNotExists ? 'IF NOT EXISTS' : '';
|
|
9978
|
-
|
|
9979
|
-
|
|
9973
|
+
let x = `
|
|
9974
|
+
CREATE ${tableTriggerTypeClause} TABLE ${onlyIfNotExists} ${tableName} (
|
|
9975
|
+
operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
9976
|
+
id TEXT,
|
|
9977
|
+
operation TEXT,
|
|
9978
|
+
timestamp TEXT,
|
|
9979
|
+
value TEXT,
|
|
9980
|
+
previous_value TEXT
|
|
9981
|
+
)
|
|
9982
|
+
`;
|
|
9983
|
+
console.log(x);
|
|
9984
|
+
await this.db.execute(/* sql */ `
|
|
9980
9985
|
CREATE ${tableTriggerTypeClause} TABLE ${onlyIfNotExists} ${tableName} (
|
|
9981
9986
|
operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
9982
9987
|
id TEXT,
|
|
@@ -10058,11 +10063,16 @@ class TriggerManagerImpl {
|
|
|
10058
10063
|
// Allow user code to execute in this lock context before the trigger is created.
|
|
10059
10064
|
await hooks?.beforeCreate?.(tx);
|
|
10060
10065
|
if (!manageDestinationExternally) {
|
|
10061
|
-
await
|
|
10062
|
-
|
|
10063
|
-
|
|
10064
|
-
|
|
10065
|
-
|
|
10066
|
+
await tx.execute(/* sql */ `
|
|
10067
|
+
CREATE ${tableTriggerTypeClause} TABLE ${destination} (
|
|
10068
|
+
operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
10069
|
+
id TEXT,
|
|
10070
|
+
operation TEXT,
|
|
10071
|
+
timestamp TEXT,
|
|
10072
|
+
value TEXT,
|
|
10073
|
+
previous_value TEXT
|
|
10074
|
+
)
|
|
10075
|
+
`);
|
|
10066
10076
|
}
|
|
10067
10077
|
if (operations.includes(exports.DiffTriggerOperation.INSERT)) {
|
|
10068
10078
|
const insertTriggerId = this.generateTriggerName(exports.DiffTriggerOperation.INSERT, destination, id, manageDestinationExternally);
|