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.cjs
CHANGED
|
@@ -3218,26 +3218,10 @@ function buildIndex(list) {
|
|
|
3218
3218
|
for (const plan of list) byName.set(plan.name, plan);
|
|
3219
3219
|
return { list, byName };
|
|
3220
3220
|
}
|
|
3221
|
-
function
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
return
|
|
3225
|
-
if (cached) return cached;
|
|
3226
|
-
if (inFlight) return inFlight;
|
|
3227
|
-
if (!plans) throw new TypeError("subscriptions(): `plans` is required.");
|
|
3228
|
-
inFlight = (async () => {
|
|
3229
|
-
const list = typeof plans === "function" ? await plans() : plans;
|
|
3230
|
-
validatePlansShape(list);
|
|
3231
|
-
const resolved = buildIndex(list);
|
|
3232
|
-
cached = resolved;
|
|
3233
|
-
return resolved;
|
|
3234
|
-
})();
|
|
3235
|
-
try {
|
|
3236
|
-
return await inFlight;
|
|
3237
|
-
} finally {
|
|
3238
|
-
inFlight = null;
|
|
3239
|
-
}
|
|
3240
|
-
};
|
|
3221
|
+
async function resolvePlans(plans) {
|
|
3222
|
+
const list = typeof plans === "function" ? await plans() : plans;
|
|
3223
|
+
validatePlansShape(list);
|
|
3224
|
+
return buildIndex(list);
|
|
3241
3225
|
}
|
|
3242
3226
|
function hasSubscriptionAccess(subscription, accessStatuses = DEFAULT_ACCESS_STATUSES) {
|
|
3243
3227
|
return accessStatuses.includes(subscription.status);
|
|
@@ -4690,13 +4674,13 @@ function subscriptions(subsOptions) {
|
|
|
4690
4674
|
}
|
|
4691
4675
|
const dedupeEnabled = subsOptions.enableWebhookEventTable !== false;
|
|
4692
4676
|
return (options, registry) => {
|
|
4693
|
-
const
|
|
4677
|
+
const plansRef = () => resolvePlans(subsOptions.plans);
|
|
4694
4678
|
if (registry) {
|
|
4695
4679
|
registry.subscriptionWebhookSync = async (ctx, payload, meta) => {
|
|
4696
4680
|
const syncCtx = {
|
|
4697
4681
|
context: ctx.context
|
|
4698
4682
|
};
|
|
4699
|
-
const plans = await
|
|
4683
|
+
const plans = await plansRef();
|
|
4700
4684
|
try {
|
|
4701
4685
|
await syncWebhookPayload(syncCtx, payload, options.client, plans, subsOptions, {
|
|
4702
4686
|
dedupe: dedupeEnabled,
|
|
@@ -4752,7 +4736,7 @@ function subscriptions(subsOptions) {
|
|
|
4752
4736
|
});
|
|
4753
4737
|
}
|
|
4754
4738
|
const payload = parsedPayload;
|
|
4755
|
-
const plans = await
|
|
4739
|
+
const plans = await plansRef();
|
|
4756
4740
|
const claimed = await claimWebhookEventForReplay(syncCtx, row);
|
|
4757
4741
|
if (!claimed?.lockedBy) {
|
|
4758
4742
|
throw new api.APIError("CONFLICT", {
|
|
@@ -4789,7 +4773,7 @@ function subscriptions(subsOptions) {
|
|
|
4789
4773
|
...dedupeEnabled ? webhookEventTable : {}
|
|
4790
4774
|
};
|
|
4791
4775
|
return {
|
|
4792
|
-
endpoints: buildSubscriptionEndpoints(options, subsOptions,
|
|
4776
|
+
endpoints: buildSubscriptionEndpoints(options, subsOptions, plansRef),
|
|
4793
4777
|
schema
|
|
4794
4778
|
};
|
|
4795
4779
|
};
|
|
@@ -5154,7 +5138,7 @@ var onUserDelete = (options) => async (user, context) => {
|
|
|
5154
5138
|
|
|
5155
5139
|
// package.json
|
|
5156
5140
|
var package_default = {
|
|
5157
|
-
version: "2.2.
|
|
5141
|
+
version: "2.2.1"};
|
|
5158
5142
|
|
|
5159
5143
|
// src/version.ts
|
|
5160
5144
|
var version = package_default.version;
|