@powersync/web 0.0.0-dev-20260311080613 → 0.0.0-dev-20260311081226

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,
16975
+ const { source, destination, columns, when, hooks, setupContext,
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,13 +17027,19 @@ 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 () => {
17030
+ const cleanup = async (context) => {
17031
17031
  disposeWarningListener();
17032
- return this.db.writeLock(async (tx) => {
17032
+ const doCleanup = async (tx) => {
17033
17033
  await this.removeTriggers(tx, triggerIds);
17034
- await tx.execute(/* sql */ `DROP TABLE IF EXISTS ${destination};`);
17034
+ await tx.execute(`DROP TABLE IF EXISTS ${destination};`);
17035
17035
  await releaseStorageClaim?.();
17036
- });
17036
+ };
17037
+ if (context) {
17038
+ await doCleanup(context);
17039
+ }
17040
+ else {
17041
+ await this.db.writeLock(doCleanup);
17042
+ }
17037
17043
  };
17038
17044
  const setup = async (tx) => {
17039
17045
  // Allow user code to execute in this lock context before the trigger is created.
@@ -17107,7 +17113,12 @@ class TriggerManagerImpl {
17107
17113
  }
17108
17114
  };
17109
17115
  try {
17110
- await this.db.writeLock(setup);
17116
+ if (setupContext) {
17117
+ await setup(setupContext);
17118
+ }
17119
+ else {
17120
+ await this.db.writeLock(setup);
17121
+ }
17111
17122
  return cleanup;
17112
17123
  }
17113
17124
  catch (error) {