@qazuor/qzpay-drizzle 1.7.4 → 1.7.5

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/index.cjs CHANGED
@@ -2129,7 +2129,14 @@ var billingWebhookEvents = pgCore.pgTable(
2129
2129
  createdAt: pgCore.timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
2130
2130
  },
2131
2131
  (table) => ({
2132
- providerIdIdx: pgCore.index("idx_webhook_events_provider_id").on(table.providerEventId),
2132
+ // UNIQUE index on `provider_event_id` underpins the optimistic-insert
2133
+ // idempotency pattern adopted by consumers: handlers try the INSERT
2134
+ // first and treat a UNIQUE violation as "duplicate webhook, skip".
2135
+ // Without the UNIQUE constraint a duplicate event lands twice and the
2136
+ // downstream dispatcher runs twice — a silent double-activation bug.
2137
+ // Discovered while validating Hospeda SPEC-143 T-143-15 (e2e webhook
2138
+ // idempotency).
2139
+ providerIdIdx: pgCore.uniqueIndex("idx_webhook_events_provider_id").on(table.providerEventId),
2133
2140
  typeIdx: pgCore.index("idx_webhook_events_type").on(table.type),
2134
2141
  statusIdx: pgCore.index("idx_webhook_events_status").on(table.status)
2135
2142
  })