@better-auth/stripe 1.3.2 → 1.3.3
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/.turbo/turbo-build.log +4 -4
- package/dist/index.cjs +9 -41
- package/dist/index.mjs +9 -41
- package/package.json +2 -2
- package/src/index.ts +10 -44
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
|
|
2
|
-
> @better-auth/stripe@1.3.
|
|
2
|
+
> @better-auth/stripe@1.3.3 build /home/runner/work/better-auth/better-auth/packages/stripe
|
|
3
3
|
> unbuild
|
|
4
4
|
|
|
5
5
|
[info] Automatically detected entries: src/index, src/client [esm] [cjs] [dts]
|
|
6
6
|
[info] Building stripe
|
|
7
7
|
[success] Build succeeded for stripe
|
|
8
|
-
[log] dist/index.cjs (total size:
|
|
8
|
+
[log] dist/index.cjs (total size: 41.3 kB, chunk size: 41.3 kB, exports: stripe)
|
|
9
9
|
|
|
10
10
|
[log] dist/client.cjs (total size: 224 B, chunk size: 224 B, exports: stripeClient)
|
|
11
11
|
|
|
12
|
-
[log] dist/index.mjs (total size:
|
|
12
|
+
[log] dist/index.mjs (total size: 40.5 kB, chunk size: 40.5 kB, exports: stripe)
|
|
13
13
|
|
|
14
14
|
[log] dist/client.mjs (total size: 197 B, chunk size: 197 B, exports: stripeClient)
|
|
15
15
|
|
|
16
|
-
Σ Total dist size (byte size):
|
|
16
|
+
Σ Total dist size (byte size): 204 kB
|
|
17
17
|
[log]
|
package/dist/index.cjs
CHANGED
|
@@ -580,48 +580,16 @@ const stripe = (options) => {
|
|
|
580
580
|
redirect: true
|
|
581
581
|
});
|
|
582
582
|
}
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
(
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
update: {
|
|
592
|
-
...incompleteSubscription,
|
|
593
|
-
plan: plan.name.toLowerCase(),
|
|
594
|
-
seats: ctx.body.seats || 1,
|
|
595
|
-
stripeCustomerId: customerId,
|
|
596
|
-
status: "active"
|
|
597
|
-
},
|
|
598
|
-
where: [
|
|
599
|
-
{
|
|
600
|
-
field: "id",
|
|
601
|
-
value: incompleteSubscription.id
|
|
602
|
-
}
|
|
603
|
-
]
|
|
604
|
-
});
|
|
605
|
-
subscription = {
|
|
606
|
-
...incompleteSubscription,
|
|
607
|
-
plan: plan.name.toLowerCase(),
|
|
608
|
-
seats: ctx.body.seats || 1,
|
|
609
|
-
stripeCustomerId: customerId
|
|
610
|
-
};
|
|
611
|
-
} else {
|
|
612
|
-
const newSubscription = await ctx.context.adapter.create({
|
|
613
|
-
model: "subscription",
|
|
614
|
-
data: {
|
|
615
|
-
plan: plan.name.toLowerCase(),
|
|
616
|
-
stripeCustomerId: customerId,
|
|
617
|
-
status: "incomplete",
|
|
618
|
-
referenceId,
|
|
619
|
-
seats: ctx.body.seats || 1
|
|
620
|
-
}
|
|
621
|
-
});
|
|
622
|
-
subscription = newSubscription;
|
|
583
|
+
const subscription = existingSubscription || await ctx.context.adapter.create({
|
|
584
|
+
model: "subscription",
|
|
585
|
+
data: {
|
|
586
|
+
plan: plan.name.toLowerCase(),
|
|
587
|
+
stripeCustomerId: customerId,
|
|
588
|
+
status: "incomplete",
|
|
589
|
+
referenceId,
|
|
590
|
+
seats: ctx.body.seats || 1
|
|
623
591
|
}
|
|
624
|
-
}
|
|
592
|
+
});
|
|
625
593
|
if (!subscription) {
|
|
626
594
|
ctx.context.logger.error("Subscription ID not found");
|
|
627
595
|
throw new api.APIError("INTERNAL_SERVER_ERROR");
|
package/dist/index.mjs
CHANGED
|
@@ -564,48 +564,16 @@ const stripe = (options) => {
|
|
|
564
564
|
redirect: true
|
|
565
565
|
});
|
|
566
566
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
(
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
update: {
|
|
576
|
-
...incompleteSubscription,
|
|
577
|
-
plan: plan.name.toLowerCase(),
|
|
578
|
-
seats: ctx.body.seats || 1,
|
|
579
|
-
stripeCustomerId: customerId,
|
|
580
|
-
status: "active"
|
|
581
|
-
},
|
|
582
|
-
where: [
|
|
583
|
-
{
|
|
584
|
-
field: "id",
|
|
585
|
-
value: incompleteSubscription.id
|
|
586
|
-
}
|
|
587
|
-
]
|
|
588
|
-
});
|
|
589
|
-
subscription = {
|
|
590
|
-
...incompleteSubscription,
|
|
591
|
-
plan: plan.name.toLowerCase(),
|
|
592
|
-
seats: ctx.body.seats || 1,
|
|
593
|
-
stripeCustomerId: customerId
|
|
594
|
-
};
|
|
595
|
-
} else {
|
|
596
|
-
const newSubscription = await ctx.context.adapter.create({
|
|
597
|
-
model: "subscription",
|
|
598
|
-
data: {
|
|
599
|
-
plan: plan.name.toLowerCase(),
|
|
600
|
-
stripeCustomerId: customerId,
|
|
601
|
-
status: "incomplete",
|
|
602
|
-
referenceId,
|
|
603
|
-
seats: ctx.body.seats || 1
|
|
604
|
-
}
|
|
605
|
-
});
|
|
606
|
-
subscription = newSubscription;
|
|
567
|
+
const subscription = existingSubscription || await ctx.context.adapter.create({
|
|
568
|
+
model: "subscription",
|
|
569
|
+
data: {
|
|
570
|
+
plan: plan.name.toLowerCase(),
|
|
571
|
+
stripeCustomerId: customerId,
|
|
572
|
+
status: "incomplete",
|
|
573
|
+
referenceId,
|
|
574
|
+
seats: ctx.body.seats || 1
|
|
607
575
|
}
|
|
608
|
-
}
|
|
576
|
+
});
|
|
609
577
|
if (!subscription) {
|
|
610
578
|
ctx.context.logger.error("Subscription ID not found");
|
|
611
579
|
throw new APIError("INTERNAL_SERVER_ERROR");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/stripe",
|
|
3
3
|
"author": "Bereket Engida",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.3",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"zod": "^4.0.0",
|
|
38
|
-
"better-auth": "^1.3.
|
|
38
|
+
"better-auth": "^1.3.3"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/better-sqlite3": "^7.6.12",
|
package/src/index.ts
CHANGED
|
@@ -396,52 +396,18 @@ export const stripe = <O extends StripeOptions>(options: O) => {
|
|
|
396
396
|
});
|
|
397
397
|
}
|
|
398
398
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
if (incompleteSubscription) {
|
|
406
|
-
await ctx.context.adapter.update({
|
|
407
|
-
model: "subscription",
|
|
408
|
-
update: {
|
|
409
|
-
...incompleteSubscription,
|
|
410
|
-
plan: plan.name.toLowerCase(),
|
|
411
|
-
seats: ctx.body.seats || 1,
|
|
412
|
-
stripeCustomerId: customerId,
|
|
413
|
-
status: "active",
|
|
414
|
-
},
|
|
415
|
-
where: [
|
|
416
|
-
{
|
|
417
|
-
field: "id",
|
|
418
|
-
value: incompleteSubscription.id,
|
|
419
|
-
},
|
|
420
|
-
],
|
|
421
|
-
});
|
|
422
|
-
subscription = {
|
|
423
|
-
...incompleteSubscription,
|
|
399
|
+
const subscription =
|
|
400
|
+
existingSubscription ||
|
|
401
|
+
(await ctx.context.adapter.create<InputSubscription, Subscription>({
|
|
402
|
+
model: "subscription",
|
|
403
|
+
data: {
|
|
424
404
|
plan: plan.name.toLowerCase(),
|
|
425
|
-
seats: ctx.body.seats || 1,
|
|
426
405
|
stripeCustomerId: customerId,
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
>({
|
|
433
|
-
model: "subscription",
|
|
434
|
-
data: {
|
|
435
|
-
plan: plan.name.toLowerCase(),
|
|
436
|
-
stripeCustomerId: customerId,
|
|
437
|
-
status: "incomplete",
|
|
438
|
-
referenceId,
|
|
439
|
-
seats: ctx.body.seats || 1,
|
|
440
|
-
},
|
|
441
|
-
});
|
|
442
|
-
subscription = newSubscription;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
406
|
+
status: "incomplete",
|
|
407
|
+
referenceId,
|
|
408
|
+
seats: ctx.body.seats || 1,
|
|
409
|
+
},
|
|
410
|
+
}));
|
|
445
411
|
|
|
446
412
|
if (!subscription) {
|
|
447
413
|
ctx.context.logger.error("Subscription ID not found");
|