@commet/better-auth 1.1.0 → 1.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/README.md +2 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +64 -4
- package/dist/index.d.ts +64 -4
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
package/dist/index.d.cts
CHANGED
|
@@ -43,6 +43,8 @@ declare const features: (_config?: FeaturesConfig) => (commet: Commet) => {
|
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
45
|
}>)[];
|
|
46
|
+
} & {
|
|
47
|
+
use: any[];
|
|
46
48
|
}, _commet_node.FeatureAccess[] | null>;
|
|
47
49
|
getFeature: better_auth.StrictEndpoint<"/commet/features/:code", {
|
|
48
50
|
method: "GET";
|
|
@@ -69,6 +71,8 @@ declare const features: (_config?: FeaturesConfig) => (commet: Commet) => {
|
|
|
69
71
|
};
|
|
70
72
|
};
|
|
71
73
|
}>)[];
|
|
74
|
+
} & {
|
|
75
|
+
use: any[];
|
|
72
76
|
}, _commet_node.FeatureAccess | null>;
|
|
73
77
|
checkFeature: better_auth.StrictEndpoint<"/commet/features/:code/check", {
|
|
74
78
|
method: "GET";
|
|
@@ -95,6 +99,8 @@ declare const features: (_config?: FeaturesConfig) => (commet: Commet) => {
|
|
|
95
99
|
};
|
|
96
100
|
};
|
|
97
101
|
}>)[];
|
|
102
|
+
} & {
|
|
103
|
+
use: any[];
|
|
98
104
|
}, _commet_node.CheckResult | null>;
|
|
99
105
|
canUseFeature: better_auth.StrictEndpoint<"/commet/features/:code/can-use", {
|
|
100
106
|
method: "GET";
|
|
@@ -121,6 +127,8 @@ declare const features: (_config?: FeaturesConfig) => (commet: Commet) => {
|
|
|
121
127
|
};
|
|
122
128
|
};
|
|
123
129
|
}>)[];
|
|
130
|
+
} & {
|
|
131
|
+
use: any[];
|
|
124
132
|
}, _commet_node.CanUseResult | null>;
|
|
125
133
|
};
|
|
126
134
|
|
|
@@ -162,6 +170,8 @@ declare const portal: ({ returnUrl }?: PortalConfig) => (commet: Commet) => {
|
|
|
162
170
|
};
|
|
163
171
|
};
|
|
164
172
|
}>)[];
|
|
173
|
+
} & {
|
|
174
|
+
use: any[];
|
|
165
175
|
}, {
|
|
166
176
|
url: string;
|
|
167
177
|
redirect: boolean;
|
|
@@ -205,6 +215,8 @@ declare const seats: (_config?: SeatsConfig) => (commet: Commet) => {
|
|
|
205
215
|
};
|
|
206
216
|
};
|
|
207
217
|
}>)[];
|
|
218
|
+
} & {
|
|
219
|
+
use: any[];
|
|
208
220
|
}, Record<string, _commet_node.SeatBalance> | null>;
|
|
209
221
|
addSeats: better_auth.StrictEndpoint<"/commet/seats/add", {
|
|
210
222
|
method: "POST";
|
|
@@ -235,6 +247,8 @@ declare const seats: (_config?: SeatsConfig) => (commet: Commet) => {
|
|
|
235
247
|
};
|
|
236
248
|
};
|
|
237
249
|
}>)[];
|
|
250
|
+
} & {
|
|
251
|
+
use: any[];
|
|
238
252
|
}, _commet_node.SeatEvent | null>;
|
|
239
253
|
removeSeats: better_auth.StrictEndpoint<"/commet/seats/remove", {
|
|
240
254
|
method: "POST";
|
|
@@ -265,6 +279,8 @@ declare const seats: (_config?: SeatsConfig) => (commet: Commet) => {
|
|
|
265
279
|
};
|
|
266
280
|
};
|
|
267
281
|
}>)[];
|
|
282
|
+
} & {
|
|
283
|
+
use: any[];
|
|
268
284
|
}, _commet_node.SeatEvent | null>;
|
|
269
285
|
setSeats: better_auth.StrictEndpoint<"/commet/seats/set", {
|
|
270
286
|
method: "POST";
|
|
@@ -295,6 +311,8 @@ declare const seats: (_config?: SeatsConfig) => (commet: Commet) => {
|
|
|
295
311
|
};
|
|
296
312
|
};
|
|
297
313
|
}>)[];
|
|
314
|
+
} & {
|
|
315
|
+
use: any[];
|
|
298
316
|
}, _commet_node.SeatEvent | null>;
|
|
299
317
|
setAllSeats: better_auth.StrictEndpoint<"/commet/seats/set-all", {
|
|
300
318
|
method: "POST";
|
|
@@ -324,6 +342,8 @@ declare const seats: (_config?: SeatsConfig) => (commet: Commet) => {
|
|
|
324
342
|
};
|
|
325
343
|
};
|
|
326
344
|
}>)[];
|
|
345
|
+
} & {
|
|
346
|
+
use: any[];
|
|
327
347
|
}, _commet_node.SeatEvent[] | null>;
|
|
328
348
|
};
|
|
329
349
|
|
|
@@ -370,6 +390,8 @@ declare const subscriptions: (config?: SubscriptionsConfig) => (commet: Commet)
|
|
|
370
390
|
};
|
|
371
391
|
};
|
|
372
392
|
}>)[];
|
|
393
|
+
} & {
|
|
394
|
+
use: any[];
|
|
373
395
|
}, _commet_node.ActiveSubscription | null>;
|
|
374
396
|
changePlan: better_auth.StrictEndpoint<"/commet/subscription/change-plan", {
|
|
375
397
|
method: "POST";
|
|
@@ -405,6 +427,8 @@ declare const subscriptions: (config?: SubscriptionsConfig) => (commet: Commet)
|
|
|
405
427
|
};
|
|
406
428
|
};
|
|
407
429
|
}>)[];
|
|
430
|
+
} & {
|
|
431
|
+
use: any[];
|
|
408
432
|
}, _commet_node.Subscription | null>;
|
|
409
433
|
cancelSubscription: better_auth.StrictEndpoint<"/commet/subscription/cancel", {
|
|
410
434
|
method: "POST";
|
|
@@ -435,6 +459,8 @@ declare const subscriptions: (config?: SubscriptionsConfig) => (commet: Commet)
|
|
|
435
459
|
};
|
|
436
460
|
};
|
|
437
461
|
}>)[];
|
|
462
|
+
} & {
|
|
463
|
+
use: any[];
|
|
438
464
|
}, _commet_node.Subscription | null>;
|
|
439
465
|
};
|
|
440
466
|
|
|
@@ -449,7 +475,7 @@ declare const usage: (_config?: UsageConfig) => (commet: Commet) => {
|
|
|
449
475
|
trackUsage: better_auth.StrictEndpoint<"/commet/usage/track", {
|
|
450
476
|
method: "POST";
|
|
451
477
|
body: z.ZodObject<{
|
|
452
|
-
|
|
478
|
+
feature: z.ZodString;
|
|
453
479
|
value: z.ZodOptional<z.ZodNumber>;
|
|
454
480
|
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
455
481
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -477,6 +503,8 @@ declare const usage: (_config?: UsageConfig) => (commet: Commet) => {
|
|
|
477
503
|
};
|
|
478
504
|
};
|
|
479
505
|
}>)[];
|
|
506
|
+
} & {
|
|
507
|
+
use: any[];
|
|
480
508
|
}, _commet_node.UsageEvent | null>;
|
|
481
509
|
};
|
|
482
510
|
|
|
@@ -540,6 +568,8 @@ declare const webhooks: (config: WebhooksConfig) => (commet: Commet) => {
|
|
|
540
568
|
isAction: false;
|
|
541
569
|
};
|
|
542
570
|
cloneRequest: true;
|
|
571
|
+
} & {
|
|
572
|
+
use: any[];
|
|
543
573
|
}, {
|
|
544
574
|
received: boolean;
|
|
545
575
|
}>;
|
|
@@ -687,6 +717,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
687
717
|
};
|
|
688
718
|
};
|
|
689
719
|
}>)[];
|
|
720
|
+
} & {
|
|
721
|
+
use: any[];
|
|
690
722
|
}, {
|
|
691
723
|
url: string;
|
|
692
724
|
redirect: boolean;
|
|
@@ -717,6 +749,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
717
749
|
};
|
|
718
750
|
};
|
|
719
751
|
}>)[];
|
|
752
|
+
} & {
|
|
753
|
+
use: any[];
|
|
720
754
|
}, _commet_node.ActiveSubscription | null>;
|
|
721
755
|
changePlan: better_auth.StrictEndpoint<"/commet/subscription/change-plan", {
|
|
722
756
|
method: "POST";
|
|
@@ -752,6 +786,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
752
786
|
};
|
|
753
787
|
};
|
|
754
788
|
}>)[];
|
|
789
|
+
} & {
|
|
790
|
+
use: any[];
|
|
755
791
|
}, _commet_node.Subscription | null>;
|
|
756
792
|
cancelSubscription: better_auth.StrictEndpoint<"/commet/subscription/cancel", {
|
|
757
793
|
method: "POST";
|
|
@@ -782,6 +818,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
782
818
|
};
|
|
783
819
|
};
|
|
784
820
|
}>)[];
|
|
821
|
+
} & {
|
|
822
|
+
use: any[];
|
|
785
823
|
}, _commet_node.Subscription | null>;
|
|
786
824
|
} | {
|
|
787
825
|
listFeatures: better_auth.StrictEndpoint<"/commet/features", {
|
|
@@ -809,6 +847,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
809
847
|
};
|
|
810
848
|
};
|
|
811
849
|
}>)[];
|
|
850
|
+
} & {
|
|
851
|
+
use: any[];
|
|
812
852
|
}, _commet_node.FeatureAccess[] | null>;
|
|
813
853
|
getFeature: better_auth.StrictEndpoint<"/commet/features/:code", {
|
|
814
854
|
method: "GET";
|
|
@@ -835,6 +875,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
835
875
|
};
|
|
836
876
|
};
|
|
837
877
|
}>)[];
|
|
878
|
+
} & {
|
|
879
|
+
use: any[];
|
|
838
880
|
}, _commet_node.FeatureAccess | null>;
|
|
839
881
|
checkFeature: better_auth.StrictEndpoint<"/commet/features/:code/check", {
|
|
840
882
|
method: "GET";
|
|
@@ -861,6 +903,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
861
903
|
};
|
|
862
904
|
};
|
|
863
905
|
}>)[];
|
|
906
|
+
} & {
|
|
907
|
+
use: any[];
|
|
864
908
|
}, _commet_node.CheckResult | null>;
|
|
865
909
|
canUseFeature: better_auth.StrictEndpoint<"/commet/features/:code/can-use", {
|
|
866
910
|
method: "GET";
|
|
@@ -887,12 +931,14 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
887
931
|
};
|
|
888
932
|
};
|
|
889
933
|
}>)[];
|
|
934
|
+
} & {
|
|
935
|
+
use: any[];
|
|
890
936
|
}, _commet_node.CanUseResult | null>;
|
|
891
937
|
} | {
|
|
892
938
|
trackUsage: better_auth.StrictEndpoint<"/commet/usage/track", {
|
|
893
939
|
method: "POST";
|
|
894
940
|
body: zod.ZodObject<{
|
|
895
|
-
|
|
941
|
+
feature: zod.ZodString;
|
|
896
942
|
value: zod.ZodOptional<zod.ZodNumber>;
|
|
897
943
|
idempotencyKey: zod.ZodOptional<zod.ZodString>;
|
|
898
944
|
properties: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodString>>;
|
|
@@ -920,6 +966,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
920
966
|
};
|
|
921
967
|
};
|
|
922
968
|
}>)[];
|
|
969
|
+
} & {
|
|
970
|
+
use: any[];
|
|
923
971
|
}, _commet_node.UsageEvent | null>;
|
|
924
972
|
} | {
|
|
925
973
|
listSeats: better_auth.StrictEndpoint<"/commet/seats", {
|
|
@@ -947,6 +995,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
947
995
|
};
|
|
948
996
|
};
|
|
949
997
|
}>)[];
|
|
998
|
+
} & {
|
|
999
|
+
use: any[];
|
|
950
1000
|
}, Record<string, _commet_node.SeatBalance> | null>;
|
|
951
1001
|
addSeats: better_auth.StrictEndpoint<"/commet/seats/add", {
|
|
952
1002
|
method: "POST";
|
|
@@ -977,6 +1027,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
977
1027
|
};
|
|
978
1028
|
};
|
|
979
1029
|
}>)[];
|
|
1030
|
+
} & {
|
|
1031
|
+
use: any[];
|
|
980
1032
|
}, _commet_node.SeatEvent | null>;
|
|
981
1033
|
removeSeats: better_auth.StrictEndpoint<"/commet/seats/remove", {
|
|
982
1034
|
method: "POST";
|
|
@@ -1007,6 +1059,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
1007
1059
|
};
|
|
1008
1060
|
};
|
|
1009
1061
|
}>)[];
|
|
1062
|
+
} & {
|
|
1063
|
+
use: any[];
|
|
1010
1064
|
}, _commet_node.SeatEvent | null>;
|
|
1011
1065
|
setSeats: better_auth.StrictEndpoint<"/commet/seats/set", {
|
|
1012
1066
|
method: "POST";
|
|
@@ -1037,6 +1091,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
1037
1091
|
};
|
|
1038
1092
|
};
|
|
1039
1093
|
}>)[];
|
|
1094
|
+
} & {
|
|
1095
|
+
use: any[];
|
|
1040
1096
|
}, _commet_node.SeatEvent | null>;
|
|
1041
1097
|
setAllSeats: better_auth.StrictEndpoint<"/commet/seats/set-all", {
|
|
1042
1098
|
method: "POST";
|
|
@@ -1066,6 +1122,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
1066
1122
|
};
|
|
1067
1123
|
};
|
|
1068
1124
|
}>)[];
|
|
1125
|
+
} & {
|
|
1126
|
+
use: any[];
|
|
1069
1127
|
}, _commet_node.SeatEvent[] | null>;
|
|
1070
1128
|
} | {
|
|
1071
1129
|
commetWebhooks: better_auth.StrictEndpoint<"/commet/webhooks", {
|
|
@@ -1074,6 +1132,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
1074
1132
|
isAction: false;
|
|
1075
1133
|
};
|
|
1076
1134
|
cloneRequest: true;
|
|
1135
|
+
} & {
|
|
1136
|
+
use: any[];
|
|
1077
1137
|
}, {
|
|
1078
1138
|
received: boolean;
|
|
1079
1139
|
}>;
|
|
@@ -1116,7 +1176,7 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
1116
1176
|
* const { data: subscription } = await authClient.subscription.get();
|
|
1117
1177
|
* const { data: features } = await authClient.features.list();
|
|
1118
1178
|
* const { data: canUse } = await authClient.features.canUse("api_calls");
|
|
1119
|
-
* await authClient.usage.track({
|
|
1179
|
+
* await authClient.usage.track({ feature: "api_call", value: 1 });
|
|
1120
1180
|
* await authClient.customer.portal(); // Redirect to portal
|
|
1121
1181
|
* ```
|
|
1122
1182
|
*/
|
|
@@ -1248,7 +1308,7 @@ declare const commetClient: () => {
|
|
|
1248
1308
|
* Track a usage event for the authenticated user
|
|
1249
1309
|
*/
|
|
1250
1310
|
track: (data: {
|
|
1251
|
-
|
|
1311
|
+
feature: string;
|
|
1252
1312
|
value?: number;
|
|
1253
1313
|
idempotencyKey?: string;
|
|
1254
1314
|
properties?: Record<string, string>;
|
package/dist/index.d.ts
CHANGED
|
@@ -43,6 +43,8 @@ declare const features: (_config?: FeaturesConfig) => (commet: Commet) => {
|
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
45
|
}>)[];
|
|
46
|
+
} & {
|
|
47
|
+
use: any[];
|
|
46
48
|
}, _commet_node.FeatureAccess[] | null>;
|
|
47
49
|
getFeature: better_auth.StrictEndpoint<"/commet/features/:code", {
|
|
48
50
|
method: "GET";
|
|
@@ -69,6 +71,8 @@ declare const features: (_config?: FeaturesConfig) => (commet: Commet) => {
|
|
|
69
71
|
};
|
|
70
72
|
};
|
|
71
73
|
}>)[];
|
|
74
|
+
} & {
|
|
75
|
+
use: any[];
|
|
72
76
|
}, _commet_node.FeatureAccess | null>;
|
|
73
77
|
checkFeature: better_auth.StrictEndpoint<"/commet/features/:code/check", {
|
|
74
78
|
method: "GET";
|
|
@@ -95,6 +99,8 @@ declare const features: (_config?: FeaturesConfig) => (commet: Commet) => {
|
|
|
95
99
|
};
|
|
96
100
|
};
|
|
97
101
|
}>)[];
|
|
102
|
+
} & {
|
|
103
|
+
use: any[];
|
|
98
104
|
}, _commet_node.CheckResult | null>;
|
|
99
105
|
canUseFeature: better_auth.StrictEndpoint<"/commet/features/:code/can-use", {
|
|
100
106
|
method: "GET";
|
|
@@ -121,6 +127,8 @@ declare const features: (_config?: FeaturesConfig) => (commet: Commet) => {
|
|
|
121
127
|
};
|
|
122
128
|
};
|
|
123
129
|
}>)[];
|
|
130
|
+
} & {
|
|
131
|
+
use: any[];
|
|
124
132
|
}, _commet_node.CanUseResult | null>;
|
|
125
133
|
};
|
|
126
134
|
|
|
@@ -162,6 +170,8 @@ declare const portal: ({ returnUrl }?: PortalConfig) => (commet: Commet) => {
|
|
|
162
170
|
};
|
|
163
171
|
};
|
|
164
172
|
}>)[];
|
|
173
|
+
} & {
|
|
174
|
+
use: any[];
|
|
165
175
|
}, {
|
|
166
176
|
url: string;
|
|
167
177
|
redirect: boolean;
|
|
@@ -205,6 +215,8 @@ declare const seats: (_config?: SeatsConfig) => (commet: Commet) => {
|
|
|
205
215
|
};
|
|
206
216
|
};
|
|
207
217
|
}>)[];
|
|
218
|
+
} & {
|
|
219
|
+
use: any[];
|
|
208
220
|
}, Record<string, _commet_node.SeatBalance> | null>;
|
|
209
221
|
addSeats: better_auth.StrictEndpoint<"/commet/seats/add", {
|
|
210
222
|
method: "POST";
|
|
@@ -235,6 +247,8 @@ declare const seats: (_config?: SeatsConfig) => (commet: Commet) => {
|
|
|
235
247
|
};
|
|
236
248
|
};
|
|
237
249
|
}>)[];
|
|
250
|
+
} & {
|
|
251
|
+
use: any[];
|
|
238
252
|
}, _commet_node.SeatEvent | null>;
|
|
239
253
|
removeSeats: better_auth.StrictEndpoint<"/commet/seats/remove", {
|
|
240
254
|
method: "POST";
|
|
@@ -265,6 +279,8 @@ declare const seats: (_config?: SeatsConfig) => (commet: Commet) => {
|
|
|
265
279
|
};
|
|
266
280
|
};
|
|
267
281
|
}>)[];
|
|
282
|
+
} & {
|
|
283
|
+
use: any[];
|
|
268
284
|
}, _commet_node.SeatEvent | null>;
|
|
269
285
|
setSeats: better_auth.StrictEndpoint<"/commet/seats/set", {
|
|
270
286
|
method: "POST";
|
|
@@ -295,6 +311,8 @@ declare const seats: (_config?: SeatsConfig) => (commet: Commet) => {
|
|
|
295
311
|
};
|
|
296
312
|
};
|
|
297
313
|
}>)[];
|
|
314
|
+
} & {
|
|
315
|
+
use: any[];
|
|
298
316
|
}, _commet_node.SeatEvent | null>;
|
|
299
317
|
setAllSeats: better_auth.StrictEndpoint<"/commet/seats/set-all", {
|
|
300
318
|
method: "POST";
|
|
@@ -324,6 +342,8 @@ declare const seats: (_config?: SeatsConfig) => (commet: Commet) => {
|
|
|
324
342
|
};
|
|
325
343
|
};
|
|
326
344
|
}>)[];
|
|
345
|
+
} & {
|
|
346
|
+
use: any[];
|
|
327
347
|
}, _commet_node.SeatEvent[] | null>;
|
|
328
348
|
};
|
|
329
349
|
|
|
@@ -370,6 +390,8 @@ declare const subscriptions: (config?: SubscriptionsConfig) => (commet: Commet)
|
|
|
370
390
|
};
|
|
371
391
|
};
|
|
372
392
|
}>)[];
|
|
393
|
+
} & {
|
|
394
|
+
use: any[];
|
|
373
395
|
}, _commet_node.ActiveSubscription | null>;
|
|
374
396
|
changePlan: better_auth.StrictEndpoint<"/commet/subscription/change-plan", {
|
|
375
397
|
method: "POST";
|
|
@@ -405,6 +427,8 @@ declare const subscriptions: (config?: SubscriptionsConfig) => (commet: Commet)
|
|
|
405
427
|
};
|
|
406
428
|
};
|
|
407
429
|
}>)[];
|
|
430
|
+
} & {
|
|
431
|
+
use: any[];
|
|
408
432
|
}, _commet_node.Subscription | null>;
|
|
409
433
|
cancelSubscription: better_auth.StrictEndpoint<"/commet/subscription/cancel", {
|
|
410
434
|
method: "POST";
|
|
@@ -435,6 +459,8 @@ declare const subscriptions: (config?: SubscriptionsConfig) => (commet: Commet)
|
|
|
435
459
|
};
|
|
436
460
|
};
|
|
437
461
|
}>)[];
|
|
462
|
+
} & {
|
|
463
|
+
use: any[];
|
|
438
464
|
}, _commet_node.Subscription | null>;
|
|
439
465
|
};
|
|
440
466
|
|
|
@@ -449,7 +475,7 @@ declare const usage: (_config?: UsageConfig) => (commet: Commet) => {
|
|
|
449
475
|
trackUsage: better_auth.StrictEndpoint<"/commet/usage/track", {
|
|
450
476
|
method: "POST";
|
|
451
477
|
body: z.ZodObject<{
|
|
452
|
-
|
|
478
|
+
feature: z.ZodString;
|
|
453
479
|
value: z.ZodOptional<z.ZodNumber>;
|
|
454
480
|
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
455
481
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -477,6 +503,8 @@ declare const usage: (_config?: UsageConfig) => (commet: Commet) => {
|
|
|
477
503
|
};
|
|
478
504
|
};
|
|
479
505
|
}>)[];
|
|
506
|
+
} & {
|
|
507
|
+
use: any[];
|
|
480
508
|
}, _commet_node.UsageEvent | null>;
|
|
481
509
|
};
|
|
482
510
|
|
|
@@ -540,6 +568,8 @@ declare const webhooks: (config: WebhooksConfig) => (commet: Commet) => {
|
|
|
540
568
|
isAction: false;
|
|
541
569
|
};
|
|
542
570
|
cloneRequest: true;
|
|
571
|
+
} & {
|
|
572
|
+
use: any[];
|
|
543
573
|
}, {
|
|
544
574
|
received: boolean;
|
|
545
575
|
}>;
|
|
@@ -687,6 +717,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
687
717
|
};
|
|
688
718
|
};
|
|
689
719
|
}>)[];
|
|
720
|
+
} & {
|
|
721
|
+
use: any[];
|
|
690
722
|
}, {
|
|
691
723
|
url: string;
|
|
692
724
|
redirect: boolean;
|
|
@@ -717,6 +749,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
717
749
|
};
|
|
718
750
|
};
|
|
719
751
|
}>)[];
|
|
752
|
+
} & {
|
|
753
|
+
use: any[];
|
|
720
754
|
}, _commet_node.ActiveSubscription | null>;
|
|
721
755
|
changePlan: better_auth.StrictEndpoint<"/commet/subscription/change-plan", {
|
|
722
756
|
method: "POST";
|
|
@@ -752,6 +786,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
752
786
|
};
|
|
753
787
|
};
|
|
754
788
|
}>)[];
|
|
789
|
+
} & {
|
|
790
|
+
use: any[];
|
|
755
791
|
}, _commet_node.Subscription | null>;
|
|
756
792
|
cancelSubscription: better_auth.StrictEndpoint<"/commet/subscription/cancel", {
|
|
757
793
|
method: "POST";
|
|
@@ -782,6 +818,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
782
818
|
};
|
|
783
819
|
};
|
|
784
820
|
}>)[];
|
|
821
|
+
} & {
|
|
822
|
+
use: any[];
|
|
785
823
|
}, _commet_node.Subscription | null>;
|
|
786
824
|
} | {
|
|
787
825
|
listFeatures: better_auth.StrictEndpoint<"/commet/features", {
|
|
@@ -809,6 +847,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
809
847
|
};
|
|
810
848
|
};
|
|
811
849
|
}>)[];
|
|
850
|
+
} & {
|
|
851
|
+
use: any[];
|
|
812
852
|
}, _commet_node.FeatureAccess[] | null>;
|
|
813
853
|
getFeature: better_auth.StrictEndpoint<"/commet/features/:code", {
|
|
814
854
|
method: "GET";
|
|
@@ -835,6 +875,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
835
875
|
};
|
|
836
876
|
};
|
|
837
877
|
}>)[];
|
|
878
|
+
} & {
|
|
879
|
+
use: any[];
|
|
838
880
|
}, _commet_node.FeatureAccess | null>;
|
|
839
881
|
checkFeature: better_auth.StrictEndpoint<"/commet/features/:code/check", {
|
|
840
882
|
method: "GET";
|
|
@@ -861,6 +903,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
861
903
|
};
|
|
862
904
|
};
|
|
863
905
|
}>)[];
|
|
906
|
+
} & {
|
|
907
|
+
use: any[];
|
|
864
908
|
}, _commet_node.CheckResult | null>;
|
|
865
909
|
canUseFeature: better_auth.StrictEndpoint<"/commet/features/:code/can-use", {
|
|
866
910
|
method: "GET";
|
|
@@ -887,12 +931,14 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
887
931
|
};
|
|
888
932
|
};
|
|
889
933
|
}>)[];
|
|
934
|
+
} & {
|
|
935
|
+
use: any[];
|
|
890
936
|
}, _commet_node.CanUseResult | null>;
|
|
891
937
|
} | {
|
|
892
938
|
trackUsage: better_auth.StrictEndpoint<"/commet/usage/track", {
|
|
893
939
|
method: "POST";
|
|
894
940
|
body: zod.ZodObject<{
|
|
895
|
-
|
|
941
|
+
feature: zod.ZodString;
|
|
896
942
|
value: zod.ZodOptional<zod.ZodNumber>;
|
|
897
943
|
idempotencyKey: zod.ZodOptional<zod.ZodString>;
|
|
898
944
|
properties: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodString>>;
|
|
@@ -920,6 +966,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
920
966
|
};
|
|
921
967
|
};
|
|
922
968
|
}>)[];
|
|
969
|
+
} & {
|
|
970
|
+
use: any[];
|
|
923
971
|
}, _commet_node.UsageEvent | null>;
|
|
924
972
|
} | {
|
|
925
973
|
listSeats: better_auth.StrictEndpoint<"/commet/seats", {
|
|
@@ -947,6 +995,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
947
995
|
};
|
|
948
996
|
};
|
|
949
997
|
}>)[];
|
|
998
|
+
} & {
|
|
999
|
+
use: any[];
|
|
950
1000
|
}, Record<string, _commet_node.SeatBalance> | null>;
|
|
951
1001
|
addSeats: better_auth.StrictEndpoint<"/commet/seats/add", {
|
|
952
1002
|
method: "POST";
|
|
@@ -977,6 +1027,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
977
1027
|
};
|
|
978
1028
|
};
|
|
979
1029
|
}>)[];
|
|
1030
|
+
} & {
|
|
1031
|
+
use: any[];
|
|
980
1032
|
}, _commet_node.SeatEvent | null>;
|
|
981
1033
|
removeSeats: better_auth.StrictEndpoint<"/commet/seats/remove", {
|
|
982
1034
|
method: "POST";
|
|
@@ -1007,6 +1059,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
1007
1059
|
};
|
|
1008
1060
|
};
|
|
1009
1061
|
}>)[];
|
|
1062
|
+
} & {
|
|
1063
|
+
use: any[];
|
|
1010
1064
|
}, _commet_node.SeatEvent | null>;
|
|
1011
1065
|
setSeats: better_auth.StrictEndpoint<"/commet/seats/set", {
|
|
1012
1066
|
method: "POST";
|
|
@@ -1037,6 +1091,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
1037
1091
|
};
|
|
1038
1092
|
};
|
|
1039
1093
|
}>)[];
|
|
1094
|
+
} & {
|
|
1095
|
+
use: any[];
|
|
1040
1096
|
}, _commet_node.SeatEvent | null>;
|
|
1041
1097
|
setAllSeats: better_auth.StrictEndpoint<"/commet/seats/set-all", {
|
|
1042
1098
|
method: "POST";
|
|
@@ -1066,6 +1122,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
1066
1122
|
};
|
|
1067
1123
|
};
|
|
1068
1124
|
}>)[];
|
|
1125
|
+
} & {
|
|
1126
|
+
use: any[];
|
|
1069
1127
|
}, _commet_node.SeatEvent[] | null>;
|
|
1070
1128
|
} | {
|
|
1071
1129
|
commetWebhooks: better_auth.StrictEndpoint<"/commet/webhooks", {
|
|
@@ -1074,6 +1132,8 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
1074
1132
|
isAction: false;
|
|
1075
1133
|
};
|
|
1076
1134
|
cloneRequest: true;
|
|
1135
|
+
} & {
|
|
1136
|
+
use: any[];
|
|
1077
1137
|
}, {
|
|
1078
1138
|
received: boolean;
|
|
1079
1139
|
}>;
|
|
@@ -1116,7 +1176,7 @@ declare const commet: <O extends CommetOptions>(options: O) => {
|
|
|
1116
1176
|
* const { data: subscription } = await authClient.subscription.get();
|
|
1117
1177
|
* const { data: features } = await authClient.features.list();
|
|
1118
1178
|
* const { data: canUse } = await authClient.features.canUse("api_calls");
|
|
1119
|
-
* await authClient.usage.track({
|
|
1179
|
+
* await authClient.usage.track({ feature: "api_call", value: 1 });
|
|
1120
1180
|
* await authClient.customer.portal(); // Redirect to portal
|
|
1121
1181
|
* ```
|
|
1122
1182
|
*/
|
|
@@ -1248,7 +1308,7 @@ declare const commetClient: () => {
|
|
|
1248
1308
|
* Track a usage event for the authenticated user
|
|
1249
1309
|
*/
|
|
1250
1310
|
track: (data: {
|
|
1251
|
-
|
|
1311
|
+
feature: string;
|
|
1252
1312
|
value?: number;
|
|
1253
1313
|
idempotencyKey?: string;
|
|
1254
1314
|
properties?: Record<string, string>;
|
package/dist/index.js
CHANGED
|
@@ -687,7 +687,7 @@ import { APIError as APIError5, sessionMiddleware as sessionMiddleware4 } from "
|
|
|
687
687
|
import { createAuthEndpoint as createAuthEndpoint4 } from "better-auth/plugins";
|
|
688
688
|
import { z as z2 } from "zod";
|
|
689
689
|
var TrackEventSchema = z2.object({
|
|
690
|
-
|
|
690
|
+
feature: z2.string(),
|
|
691
691
|
value: z2.number().optional(),
|
|
692
692
|
idempotencyKey: z2.string().optional(),
|
|
693
693
|
properties: z2.record(z2.string(), z2.string()).optional()
|
|
@@ -712,7 +712,8 @@ var usage = (_config = {}) => (commet2) => {
|
|
|
712
712
|
const result = await commet2.usage.track(
|
|
713
713
|
{
|
|
714
714
|
externalId: userId,
|
|
715
|
-
|
|
715
|
+
feature: ctx.body.feature,
|
|
716
|
+
value: ctx.body.value,
|
|
716
717
|
idempotencyKey: ctx.body.idempotencyKey,
|
|
717
718
|
properties: ctx.body.properties
|
|
718
719
|
},
|