@powersync/web 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.
@@ -15588,7 +15588,7 @@ class TriggerManagerImpl {
15588
15588
  }
15589
15589
  async createDiffTrigger(options) {
15590
15590
  await this.db.waitForReady();
15591
- const { source, destination, columns, when, hooks, persistDestination = false,
15591
+ const { source, destination, columns, when, hooks, manageDestinationExternally = false,
15592
15592
  // Fall back to the provided default if not given on this level
15593
15593
  useStorage = this.defaultConfig.useStorageByDefault } = options;
15594
15594
  const operations = Object.keys(when);
@@ -15643,11 +15643,11 @@ class TriggerManagerImpl {
15643
15643
  * we need to ensure we can cleanup the created resources.
15644
15644
  * We unfortunately cannot rely on transaction rollback.
15645
15645
  */
15646
- const cleanup = async (force) => {
15646
+ const cleanup = async () => {
15647
15647
  disposeWarningListener();
15648
15648
  return this.db.writeLock(async (tx) => {
15649
15649
  await this.removeTriggers(tx, triggerIds);
15650
- if (!persistDestination || force) {
15650
+ if (!manageDestinationExternally) {
15651
15651
  await tx.execute(/* sql */ `DROP TABLE IF EXISTS ${destination};`);
15652
15652
  }
15653
15653
  await releaseStorageClaim?.();
@@ -15656,16 +15656,18 @@ class TriggerManagerImpl {
15656
15656
  const setup = async (tx) => {
15657
15657
  // Allow user code to execute in this lock context before the trigger is created.
15658
15658
  await hooks?.beforeCreate?.(tx);
15659
- await tx.execute(/* sql */ `
15660
- CREATE ${tableTriggerTypeClause} TABLE ${persistDestination ? 'IF NOT EXISTS ' : ''}${destination} (
15661
- operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
15662
- id TEXT,
15663
- operation TEXT,
15664
- timestamp TEXT,
15665
- value TEXT,
15666
- previous_value TEXT
15667
- )
15668
- `);
15659
+ if (!manageDestinationExternally) {
15660
+ await tx.execute(/* sql */ `
15661
+ CREATE ${tableTriggerTypeClause} TABLE ${destination} (
15662
+ operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
15663
+ id TEXT,
15664
+ operation TEXT,
15665
+ timestamp TEXT,
15666
+ value TEXT,
15667
+ previous_value TEXT
15668
+ )
15669
+ `);
15670
+ }
15669
15671
  if (operations.includes(DiffTriggerOperation.INSERT)) {
15670
15672
  const insertTriggerId = this.generateTriggerName(DiffTriggerOperation.INSERT, destination, id);
15671
15673
  triggerIds.push(insertTriggerId);