@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 CHANGED
@@ -12490,7 +12490,7 @@ class TriggerManagerImpl {
12490
12490
  }
12491
12491
  async createDiffTrigger(options) {
12492
12492
  await this.db.waitForReady();
12493
- const { source, destination, columns, when, hooks, persistDestination = false,
12493
+ const { source, destination, columns, when, hooks, manageDestinationExternally = false,
12494
12494
  // Fall back to the provided default if not given on this level
12495
12495
  useStorage = this.defaultConfig.useStorageByDefault } = options;
12496
12496
  const operations = Object.keys(when);
@@ -12545,11 +12545,11 @@ class TriggerManagerImpl {
12545
12545
  * we need to ensure we can cleanup the created resources.
12546
12546
  * We unfortunately cannot rely on transaction rollback.
12547
12547
  */
12548
- const cleanup = async (force) => {
12548
+ const cleanup = async () => {
12549
12549
  disposeWarningListener();
12550
12550
  return this.db.writeLock(async (tx) => {
12551
12551
  await this.removeTriggers(tx, triggerIds);
12552
- if (!persistDestination || force) {
12552
+ if (!manageDestinationExternally) {
12553
12553
  await tx.execute(/* sql */ `DROP TABLE IF EXISTS ${destination};`);
12554
12554
  }
12555
12555
  await releaseStorageClaim?.();
@@ -12558,16 +12558,18 @@ class TriggerManagerImpl {
12558
12558
  const setup = async (tx) => {
12559
12559
  // Allow user code to execute in this lock context before the trigger is created.
12560
12560
  await hooks?.beforeCreate?.(tx);
12561
- await tx.execute(/* sql */ `
12562
- CREATE ${tableTriggerTypeClause} TABLE ${persistDestination ? 'IF NOT EXISTS ' : ''}${destination} (
12563
- operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
12564
- id TEXT,
12565
- operation TEXT,
12566
- timestamp TEXT,
12567
- value TEXT,
12568
- previous_value TEXT
12569
- )
12570
- `);
12561
+ if (!manageDestinationExternally) {
12562
+ await tx.execute(/* sql */ `
12563
+ CREATE ${tableTriggerTypeClause} TABLE ${destination} (
12564
+ operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
12565
+ id TEXT,
12566
+ operation TEXT,
12567
+ timestamp TEXT,
12568
+ value TEXT,
12569
+ previous_value TEXT
12570
+ )
12571
+ `);
12572
+ }
12571
12573
  if (operations.includes(exports.DiffTriggerOperation.INSERT)) {
12572
12574
  const insertTriggerId = this.generateTriggerName(exports.DiffTriggerOperation.INSERT, destination, id);
12573
12575
  triggerIds.push(insertTriggerId);