@powersync/common 0.0.0-dev-20260305092446 → 0.0.0-dev-20260305124002
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 +15 -13
- package/dist/bundle.cjs.map +1 -1
- package/dist/bundle.mjs +15 -13
- package/dist/bundle.mjs.map +1 -1
- package/dist/bundle.node.cjs +15 -13
- package/dist/bundle.node.cjs.map +1 -1
- package/dist/bundle.node.mjs +15 -13
- package/dist/bundle.node.mjs.map +1 -1
- package/dist/index.d.cts +5 -4
- package/lib/client/triggers/TriggerManager.d.ts +4 -3
- package/lib/client/triggers/TriggerManagerImpl.d.ts +1 -1
- package/lib/client/triggers/TriggerManagerImpl.js +15 -13
- package/lib/client/triggers/TriggerManagerImpl.js.map +1 -1
- package/package.json +1 -1
- package/src/client/triggers/TriggerManager.ts +4 -3
- package/src/client/triggers/TriggerManagerImpl.ts +15 -13
package/dist/bundle.node.cjs
CHANGED
|
@@ -9968,7 +9968,7 @@ class TriggerManagerImpl {
|
|
|
9968
9968
|
}
|
|
9969
9969
|
async createDiffTrigger(options) {
|
|
9970
9970
|
await this.db.waitForReady();
|
|
9971
|
-
const { source, destination, columns, when, hooks,
|
|
9971
|
+
const { source, destination, columns, when, hooks, manageDestinationExternally = false,
|
|
9972
9972
|
// Fall back to the provided default if not given on this level
|
|
9973
9973
|
useStorage = this.defaultConfig.useStorageByDefault } = options;
|
|
9974
9974
|
const operations = Object.keys(when);
|
|
@@ -10023,11 +10023,11 @@ class TriggerManagerImpl {
|
|
|
10023
10023
|
* we need to ensure we can cleanup the created resources.
|
|
10024
10024
|
* We unfortunately cannot rely on transaction rollback.
|
|
10025
10025
|
*/
|
|
10026
|
-
const cleanup = async (
|
|
10026
|
+
const cleanup = async () => {
|
|
10027
10027
|
disposeWarningListener();
|
|
10028
10028
|
return this.db.writeLock(async (tx) => {
|
|
10029
10029
|
await this.removeTriggers(tx, triggerIds);
|
|
10030
|
-
if (!
|
|
10030
|
+
if (!manageDestinationExternally) {
|
|
10031
10031
|
await tx.execute(/* sql */ `DROP TABLE IF EXISTS ${destination};`);
|
|
10032
10032
|
}
|
|
10033
10033
|
await releaseStorageClaim?.();
|
|
@@ -10036,16 +10036,18 @@ class TriggerManagerImpl {
|
|
|
10036
10036
|
const setup = async (tx) => {
|
|
10037
10037
|
// Allow user code to execute in this lock context before the trigger is created.
|
|
10038
10038
|
await hooks?.beforeCreate?.(tx);
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
|
|
10042
|
-
|
|
10043
|
-
|
|
10044
|
-
|
|
10045
|
-
|
|
10046
|
-
|
|
10047
|
-
|
|
10048
|
-
|
|
10039
|
+
if (!manageDestinationExternally) {
|
|
10040
|
+
await tx.execute(/* sql */ `
|
|
10041
|
+
CREATE ${tableTriggerTypeClause} TABLE ${destination} (
|
|
10042
|
+
operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
10043
|
+
id TEXT,
|
|
10044
|
+
operation TEXT,
|
|
10045
|
+
timestamp TEXT,
|
|
10046
|
+
value TEXT,
|
|
10047
|
+
previous_value TEXT
|
|
10048
|
+
)
|
|
10049
|
+
`);
|
|
10050
|
+
}
|
|
10049
10051
|
if (operations.includes(exports.DiffTriggerOperation.INSERT)) {
|
|
10050
10052
|
const insertTriggerId = this.generateTriggerName(exports.DiffTriggerOperation.INSERT, destination, id);
|
|
10051
10053
|
triggerIds.push(insertTriggerId);
|