@qazuor/qzpay-drizzle 1.8.0 → 1.9.0

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
@@ -1118,6 +1118,7 @@ function mapDrizzlePollingJobToCore(row) {
1118
1118
  subscriptionId: row.subscriptionId,
1119
1119
  provider: row.provider,
1120
1120
  providerResourceId: row.providerResourceId,
1121
+ resourceType: row.resourceType,
1121
1122
  status: row.status,
1122
1123
  attempts: row.attempts,
1123
1124
  maxAttempts: row.maxAttempts,
@@ -1139,6 +1140,7 @@ function mapPollingScheduleInputToDrizzleInsert(input) {
1139
1140
  subscriptionId: input.subscriptionId,
1140
1141
  provider: input.provider,
1141
1142
  providerResourceId: input.providerResourceId,
1143
+ resourceType: input.resourceType ?? "subscription",
1142
1144
  status: "pending",
1143
1145
  attempts: 0,
1144
1146
  maxAttempts: input.maxAttempts ?? POLLING_JOB_DEFAULTS.maxAttempts,
@@ -1941,10 +1943,23 @@ var billingSubscriptionPollingJobs = pgCore.pgTable(
1941
1943
  */
1942
1944
  provider: pgCore.varchar("provider", { length: 50 }).notNull(),
1943
1945
  /**
1944
- * Provider-side resource id (e.g. MP preapproval id) that the
1945
- * poller uses to query the provider's REST endpoint.
1946
+ * Provider-side resource id (e.g. MP preapproval id, MP preference
1947
+ * id) that the poller uses to query the provider's REST endpoint.
1948
+ * Interpretation depends on {@link resourceType}.
1946
1949
  */
1947
1950
  providerResourceId: pgCore.varchar("provider_resource_id", { length: 255 }).notNull(),
1951
+ /**
1952
+ * Provider-agnostic classification of the polled resource.
1953
+ * - `subscription`: recurring authorization (MP preapproval, Stripe subscription).
1954
+ * - `one_time_payment`: deferred-payment checkout session whose
1955
+ * payment id isn't known yet (MP preference one-time, Stripe
1956
+ * checkout.session in payment mode). The poller's adapter search
1957
+ * call resolves the actual payment when the user completes the flow.
1958
+ *
1959
+ * Default `'subscription'` keeps backward compatibility for pre-existing
1960
+ * rows enqueued before the column was introduced.
1961
+ */
1962
+ resourceType: pgCore.varchar("resource_type", { length: 20 }).notNull().default("subscription"),
1948
1963
  /**
1949
1964
  * Job lifecycle status.
1950
1965
  * - `pending`: cron will pick up when due