@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.
@@ -16972,7 +16972,7 @@ class TriggerManagerImpl {
16972
16972
  }
16973
16973
  async createDiffTrigger(options) {
16974
16974
  await this.db.waitForReady();
16975
- const { source, destination, columns, when, hooks, persistDestination = false,
16975
+ const { source, destination, columns, when, hooks, manageDestinationExternally = false,
16976
16976
  // Fall back to the provided default if not given on this level
16977
16977
  useStorage = this.defaultConfig.useStorageByDefault } = options;
16978
16978
  const operations = Object.keys(when);
@@ -17027,11 +17027,11 @@ class TriggerManagerImpl {
17027
17027
  * we need to ensure we can cleanup the created resources.
17028
17028
  * We unfortunately cannot rely on transaction rollback.
17029
17029
  */
17030
- const cleanup = async (force) => {
17030
+ const cleanup = async () => {
17031
17031
  disposeWarningListener();
17032
17032
  return this.db.writeLock(async (tx) => {
17033
17033
  await this.removeTriggers(tx, triggerIds);
17034
- if (!persistDestination || force) {
17034
+ if (!manageDestinationExternally) {
17035
17035
  await tx.execute(/* sql */ `DROP TABLE IF EXISTS ${destination};`);
17036
17036
  }
17037
17037
  await releaseStorageClaim?.();
@@ -17040,16 +17040,18 @@ class TriggerManagerImpl {
17040
17040
  const setup = async (tx) => {
17041
17041
  // Allow user code to execute in this lock context before the trigger is created.
17042
17042
  await hooks?.beforeCreate?.(tx);
17043
- await tx.execute(/* sql */ `
17044
- CREATE ${tableTriggerTypeClause} TABLE ${persistDestination ? 'IF NOT EXISTS ' : ''}${destination} (
17045
- operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
17046
- id TEXT,
17047
- operation TEXT,
17048
- timestamp TEXT,
17049
- value TEXT,
17050
- previous_value TEXT
17051
- )
17052
- `);
17043
+ if (!manageDestinationExternally) {
17044
+ await tx.execute(/* sql */ `
17045
+ CREATE ${tableTriggerTypeClause} TABLE ${destination} (
17046
+ operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
17047
+ id TEXT,
17048
+ operation TEXT,
17049
+ timestamp TEXT,
17050
+ value TEXT,
17051
+ previous_value TEXT
17052
+ )
17053
+ `);
17054
+ }
17053
17055
  if (operations.includes(DiffTriggerOperation.INSERT)) {
17054
17056
  const insertTriggerId = this.generateTriggerName(DiffTriggerOperation.INSERT, destination, id);
17055
17057
  triggerIds.push(insertTriggerId);