better-auth-streampay 2.2.0 → 2.2.1
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 +9 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3216,26 +3216,10 @@ function buildIndex(list) {
|
|
|
3216
3216
|
for (const plan of list) byName.set(plan.name, plan);
|
|
3217
3217
|
return { list, byName };
|
|
3218
3218
|
}
|
|
3219
|
-
function
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
return
|
|
3223
|
-
if (cached) return cached;
|
|
3224
|
-
if (inFlight) return inFlight;
|
|
3225
|
-
if (!plans) throw new TypeError("subscriptions(): `plans` is required.");
|
|
3226
|
-
inFlight = (async () => {
|
|
3227
|
-
const list = typeof plans === "function" ? await plans() : plans;
|
|
3228
|
-
validatePlansShape(list);
|
|
3229
|
-
const resolved = buildIndex(list);
|
|
3230
|
-
cached = resolved;
|
|
3231
|
-
return resolved;
|
|
3232
|
-
})();
|
|
3233
|
-
try {
|
|
3234
|
-
return await inFlight;
|
|
3235
|
-
} finally {
|
|
3236
|
-
inFlight = null;
|
|
3237
|
-
}
|
|
3238
|
-
};
|
|
3219
|
+
async function resolvePlans(plans) {
|
|
3220
|
+
const list = typeof plans === "function" ? await plans() : plans;
|
|
3221
|
+
validatePlansShape(list);
|
|
3222
|
+
return buildIndex(list);
|
|
3239
3223
|
}
|
|
3240
3224
|
function hasSubscriptionAccess(subscription, accessStatuses = DEFAULT_ACCESS_STATUSES) {
|
|
3241
3225
|
return accessStatuses.includes(subscription.status);
|
|
@@ -4688,13 +4672,13 @@ function subscriptions(subsOptions) {
|
|
|
4688
4672
|
}
|
|
4689
4673
|
const dedupeEnabled = subsOptions.enableWebhookEventTable !== false;
|
|
4690
4674
|
return (options, registry) => {
|
|
4691
|
-
const
|
|
4675
|
+
const plansRef = () => resolvePlans(subsOptions.plans);
|
|
4692
4676
|
if (registry) {
|
|
4693
4677
|
registry.subscriptionWebhookSync = async (ctx, payload, meta) => {
|
|
4694
4678
|
const syncCtx = {
|
|
4695
4679
|
context: ctx.context
|
|
4696
4680
|
};
|
|
4697
|
-
const plans = await
|
|
4681
|
+
const plans = await plansRef();
|
|
4698
4682
|
try {
|
|
4699
4683
|
await syncWebhookPayload(syncCtx, payload, options.client, plans, subsOptions, {
|
|
4700
4684
|
dedupe: dedupeEnabled,
|
|
@@ -4750,7 +4734,7 @@ function subscriptions(subsOptions) {
|
|
|
4750
4734
|
});
|
|
4751
4735
|
}
|
|
4752
4736
|
const payload = parsedPayload;
|
|
4753
|
-
const plans = await
|
|
4737
|
+
const plans = await plansRef();
|
|
4754
4738
|
const claimed = await claimWebhookEventForReplay(syncCtx, row);
|
|
4755
4739
|
if (!claimed?.lockedBy) {
|
|
4756
4740
|
throw new APIError("CONFLICT", {
|
|
@@ -4787,7 +4771,7 @@ function subscriptions(subsOptions) {
|
|
|
4787
4771
|
...dedupeEnabled ? webhookEventTable : {}
|
|
4788
4772
|
};
|
|
4789
4773
|
return {
|
|
4790
|
-
endpoints: buildSubscriptionEndpoints(options, subsOptions,
|
|
4774
|
+
endpoints: buildSubscriptionEndpoints(options, subsOptions, plansRef),
|
|
4791
4775
|
schema
|
|
4792
4776
|
};
|
|
4793
4777
|
};
|
|
@@ -5152,7 +5136,7 @@ var onUserDelete = (options) => async (user, context) => {
|
|
|
5152
5136
|
|
|
5153
5137
|
// package.json
|
|
5154
5138
|
var package_default = {
|
|
5155
|
-
version: "2.2.
|
|
5139
|
+
version: "2.2.1"};
|
|
5156
5140
|
|
|
5157
5141
|
// src/version.ts
|
|
5158
5142
|
var version = package_default.version;
|