@powersync/web 0.0.0-dev-20260305124002 → 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.
@@ -13555,7 +13555,7 @@ function requireDist () {
13555
13555
 
13556
13556
  var distExports = requireDist();
13557
13557
 
13558
- var version = "1.47.0";
13558
+ var version = "1.48.0";
13559
13559
  var PACKAGE = {
13560
13560
  version: version};
13561
13561
 
@@ -15528,8 +15528,9 @@ class TriggerManagerImpl {
15528
15528
  ...config
15529
15529
  };
15530
15530
  }
15531
- generateTriggerName(operation, destinationTable, triggerId) {
15532
- return `__ps_temp_trigger_${operation.toLowerCase()}__${destinationTable}__${triggerId}`;
15531
+ generateTriggerName(operation, destinationTable, triggerId, managedExternally = false) {
15532
+ const managedTerm = managedExternally ? '_external' : '';
15533
+ return `__ps${managedTerm}_temp_trigger_${operation.toLowerCase()}__${destinationTable}__${triggerId}`;
15533
15534
  }
15534
15535
  /**
15535
15536
  * Cleanup any SQLite triggers or tables that are no longer in use.
@@ -15586,6 +15587,31 @@ class TriggerManagerImpl {
15586
15587
  }
15587
15588
  });
15588
15589
  }
15590
+ async createDiffDestinationTable(tableName, options) {
15591
+ const tableTriggerTypeClause = options?.temporary ? 'TEMP' : '';
15592
+ const onlyIfNotExists = options?.onlyIfNotExists ? 'IF NOT EXISTS' : '';
15593
+ let x = `
15594
+ CREATE ${tableTriggerTypeClause} TABLE ${onlyIfNotExists} ${tableName} (
15595
+ operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
15596
+ id TEXT,
15597
+ operation TEXT,
15598
+ timestamp TEXT,
15599
+ value TEXT,
15600
+ previous_value TEXT
15601
+ )
15602
+ `;
15603
+ console.log(x);
15604
+ await this.db.execute(/* sql */ `
15605
+ CREATE ${tableTriggerTypeClause} TABLE ${onlyIfNotExists} ${tableName} (
15606
+ operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
15607
+ id TEXT,
15608
+ operation TEXT,
15609
+ timestamp TEXT,
15610
+ value TEXT,
15611
+ previous_value TEXT
15612
+ )
15613
+ `);
15614
+ }
15589
15615
  async createDiffTrigger(options) {
15590
15616
  await this.db.waitForReady();
15591
15617
  const { source, destination, columns, when, hooks, manageDestinationExternally = false,
@@ -15669,7 +15695,7 @@ class TriggerManagerImpl {
15669
15695
  `);
15670
15696
  }
15671
15697
  if (operations.includes(DiffTriggerOperation.INSERT)) {
15672
- const insertTriggerId = this.generateTriggerName(DiffTriggerOperation.INSERT, destination, id);
15698
+ const insertTriggerId = this.generateTriggerName(DiffTriggerOperation.INSERT, destination, id, manageDestinationExternally);
15673
15699
  triggerIds.push(insertTriggerId);
15674
15700
  await tx.execute(/* sql */ `
15675
15701
  CREATE ${tableTriggerTypeClause} TRIGGER ${insertTriggerId} AFTER INSERT ON ${internalSource} ${whenClauses[DiffTriggerOperation.INSERT]} BEGIN
@@ -15687,7 +15713,7 @@ class TriggerManagerImpl {
15687
15713
  `);
15688
15714
  }
15689
15715
  if (operations.includes(DiffTriggerOperation.UPDATE)) {
15690
- const updateTriggerId = this.generateTriggerName(DiffTriggerOperation.UPDATE, destination, id);
15716
+ const updateTriggerId = this.generateTriggerName(DiffTriggerOperation.UPDATE, destination, id, manageDestinationExternally);
15691
15717
  triggerIds.push(updateTriggerId);
15692
15718
  await tx.execute(/* sql */ `
15693
15719
  CREATE ${tableTriggerTypeClause} TRIGGER ${updateTriggerId} AFTER
@@ -15707,7 +15733,7 @@ class TriggerManagerImpl {
15707
15733
  `);
15708
15734
  }
15709
15735
  if (operations.includes(DiffTriggerOperation.DELETE)) {
15710
- const deleteTriggerId = this.generateTriggerName(DiffTriggerOperation.DELETE, destination, id);
15736
+ const deleteTriggerId = this.generateTriggerName(DiffTriggerOperation.DELETE, destination, id, manageDestinationExternally);
15711
15737
  triggerIds.push(deleteTriggerId);
15712
15738
  // Create delete trigger for basic JSON
15713
15739
  await tx.execute(/* sql */ `