better-auth-lead 0.4.3 → 0.6.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/README.md +174 -34
- package/dist/client.d.mts +1 -1
- package/dist/index-BX1SlAVz.d.mts +472 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +246 -59
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/dist/index-P6m89iLp.d.mts +0 -251
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
import { InferOptionSchema, StandardSchemaV1 } from "better-auth";
|
|
2
|
-
|
|
3
|
-
//#region src/schema.d.ts
|
|
4
|
-
declare const lead$1: {
|
|
5
|
-
lead: {
|
|
6
|
-
fields: {
|
|
7
|
-
createdAt: {
|
|
8
|
-
type: "date";
|
|
9
|
-
defaultValue: () => Date;
|
|
10
|
-
required: true;
|
|
11
|
-
input: false;
|
|
12
|
-
};
|
|
13
|
-
updatedAt: {
|
|
14
|
-
type: "date";
|
|
15
|
-
defaultValue: () => Date;
|
|
16
|
-
onUpdate: () => Date;
|
|
17
|
-
required: true;
|
|
18
|
-
input: false;
|
|
19
|
-
};
|
|
20
|
-
email: {
|
|
21
|
-
type: "string";
|
|
22
|
-
required: true;
|
|
23
|
-
unique: true;
|
|
24
|
-
};
|
|
25
|
-
emailVerified: {
|
|
26
|
-
type: "boolean";
|
|
27
|
-
defaultValue: false;
|
|
28
|
-
required: true;
|
|
29
|
-
input: false;
|
|
30
|
-
};
|
|
31
|
-
verificationEmailSentAt: {
|
|
32
|
-
type: "date";
|
|
33
|
-
required: false;
|
|
34
|
-
input: false;
|
|
35
|
-
};
|
|
36
|
-
metadata: {
|
|
37
|
-
type: "string";
|
|
38
|
-
required: false;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region src/type.d.ts
|
|
45
|
-
interface LeadOptions {
|
|
46
|
-
/**
|
|
47
|
-
* Send a verification email
|
|
48
|
-
* @param data the data object
|
|
49
|
-
* @param request the request object
|
|
50
|
-
*/
|
|
51
|
-
sendVerificationEmail?: (
|
|
52
|
-
/**
|
|
53
|
-
* @param lead the lead to send the verification email to
|
|
54
|
-
* @param url the verification url
|
|
55
|
-
* @param token the verification token
|
|
56
|
-
* @param unsubscribeUrl the one-click unsubscribe URL (RFC 8058) to include in List-Unsubscribe headers
|
|
57
|
-
*/
|
|
58
|
-
|
|
59
|
-
data: {
|
|
60
|
-
lead: Lead;
|
|
61
|
-
url: string;
|
|
62
|
-
token: string;
|
|
63
|
-
unsubscribeUrl: string;
|
|
64
|
-
}, request?: Request) => Promise<boolean>;
|
|
65
|
-
onEmailVerified?: (
|
|
66
|
-
/**
|
|
67
|
-
* @param lead the lead that was verified
|
|
68
|
-
*/
|
|
69
|
-
|
|
70
|
-
data: {
|
|
71
|
-
lead: Lead;
|
|
72
|
-
}, request?: Request) => Promise<void>;
|
|
73
|
-
/**
|
|
74
|
-
* Number of seconds the verification token is
|
|
75
|
-
* valid for.
|
|
76
|
-
* @default 3600 seconds (1 hour)
|
|
77
|
-
*/
|
|
78
|
-
expiresIn?: number;
|
|
79
|
-
/**
|
|
80
|
-
* Number of seconds the unsubscribe token is valid for.
|
|
81
|
-
* Should be long-lived since users may click the link long
|
|
82
|
-
* after receiving the email.
|
|
83
|
-
* @default undefined (no expiry)
|
|
84
|
-
*/
|
|
85
|
-
unsubscribeExpiresIn?: number;
|
|
86
|
-
/**
|
|
87
|
-
* Rate limit configuration for /lead/subscribe and /lead/resend endpoints.
|
|
88
|
-
*/
|
|
89
|
-
rateLimit?: {
|
|
90
|
-
/**
|
|
91
|
-
* Time window in seconds for which the rate limit applies.
|
|
92
|
-
* @default 10 seconds
|
|
93
|
-
*/
|
|
94
|
-
window: number;
|
|
95
|
-
/**
|
|
96
|
-
* Maximum number of requests allowed within the time window.
|
|
97
|
-
* @default 3 requests
|
|
98
|
-
*/
|
|
99
|
-
max: number;
|
|
100
|
-
};
|
|
101
|
-
/**
|
|
102
|
-
* Schema for the lead plugin
|
|
103
|
-
*/
|
|
104
|
-
schema?: InferOptionSchema<typeof lead$1> | undefined;
|
|
105
|
-
metadata?: {
|
|
106
|
-
validationSchema?: StandardSchemaV1;
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
interface Lead {
|
|
110
|
-
/**
|
|
111
|
-
* Database identifier
|
|
112
|
-
*/
|
|
113
|
-
id: string;
|
|
114
|
-
createdAt: Date;
|
|
115
|
-
updatedAt: Date;
|
|
116
|
-
email: string;
|
|
117
|
-
emailVerified: boolean;
|
|
118
|
-
verificationEmailSentAt: Date | null;
|
|
119
|
-
metadata?: string;
|
|
120
|
-
}
|
|
121
|
-
type LeadPayload = Omit<Lead, 'id' | 'createdAt' | 'updatedAt' | 'emailVerified' | 'verificationEmailSentAt'>;
|
|
122
|
-
//#endregion
|
|
123
|
-
//#region src/index.d.ts
|
|
124
|
-
declare const lead: <O extends LeadOptions>(options?: O) => {
|
|
125
|
-
id: "lead";
|
|
126
|
-
schema: {
|
|
127
|
-
lead: {
|
|
128
|
-
fields: {
|
|
129
|
-
createdAt: {
|
|
130
|
-
type: "date";
|
|
131
|
-
defaultValue: () => Date;
|
|
132
|
-
required: true;
|
|
133
|
-
input: false;
|
|
134
|
-
};
|
|
135
|
-
updatedAt: {
|
|
136
|
-
type: "date";
|
|
137
|
-
defaultValue: () => Date;
|
|
138
|
-
onUpdate: () => Date;
|
|
139
|
-
required: true;
|
|
140
|
-
input: false;
|
|
141
|
-
};
|
|
142
|
-
email: {
|
|
143
|
-
type: "string";
|
|
144
|
-
required: true;
|
|
145
|
-
unique: true;
|
|
146
|
-
};
|
|
147
|
-
emailVerified: {
|
|
148
|
-
type: "boolean";
|
|
149
|
-
defaultValue: false;
|
|
150
|
-
required: true;
|
|
151
|
-
input: false;
|
|
152
|
-
};
|
|
153
|
-
verificationEmailSentAt: {
|
|
154
|
-
type: "date";
|
|
155
|
-
required: false;
|
|
156
|
-
input: false;
|
|
157
|
-
};
|
|
158
|
-
metadata: {
|
|
159
|
-
type: "string";
|
|
160
|
-
required: false;
|
|
161
|
-
};
|
|
162
|
-
};
|
|
163
|
-
};
|
|
164
|
-
};
|
|
165
|
-
endpoints: {
|
|
166
|
-
subscribe: import("better-auth").StrictEndpoint<"/lead/subscribe", {
|
|
167
|
-
method: "POST";
|
|
168
|
-
body: import("zod").ZodObject<{
|
|
169
|
-
email: import("zod").ZodString;
|
|
170
|
-
metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
|
|
171
|
-
}, import("better-auth").$strip>;
|
|
172
|
-
metadata: {
|
|
173
|
-
$Infer: {
|
|
174
|
-
body: {
|
|
175
|
-
email: string;
|
|
176
|
-
metadata?: (O extends {
|
|
177
|
-
metadata: {
|
|
178
|
-
validationSchema: import("better-auth").StandardSchemaV1<unknown, infer Out>;
|
|
179
|
-
};
|
|
180
|
-
} ? Out : Record<string, any>) | undefined;
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
};
|
|
184
|
-
}, {
|
|
185
|
-
status: boolean;
|
|
186
|
-
}>;
|
|
187
|
-
verify: import("better-auth").StrictEndpoint<"/lead/verify", {
|
|
188
|
-
method: "GET";
|
|
189
|
-
query: import("zod").ZodObject<{
|
|
190
|
-
token: import("zod").ZodString;
|
|
191
|
-
}, import("better-auth").$strip>;
|
|
192
|
-
}, {
|
|
193
|
-
status: boolean;
|
|
194
|
-
}>;
|
|
195
|
-
unsubscribe: import("better-auth").StrictEndpoint<"/lead/unsubscribe", {
|
|
196
|
-
method: "POST";
|
|
197
|
-
query: import("zod").ZodObject<{
|
|
198
|
-
token: import("zod").ZodString;
|
|
199
|
-
}, import("better-auth").$strip>;
|
|
200
|
-
metadata: {
|
|
201
|
-
allowedMediaTypes: never[];
|
|
202
|
-
};
|
|
203
|
-
}, {
|
|
204
|
-
status: boolean;
|
|
205
|
-
}>;
|
|
206
|
-
resend: import("better-auth").StrictEndpoint<"/lead/resend", {
|
|
207
|
-
method: "POST";
|
|
208
|
-
body: import("zod").ZodObject<{
|
|
209
|
-
email: import("zod").ZodString;
|
|
210
|
-
}, import("better-auth").$strip>;
|
|
211
|
-
}, {
|
|
212
|
-
status: boolean;
|
|
213
|
-
}>;
|
|
214
|
-
update: import("better-auth").StrictEndpoint<"/lead/update", {
|
|
215
|
-
method: "POST";
|
|
216
|
-
body: import("zod").ZodObject<{
|
|
217
|
-
id: import("zod").ZodString;
|
|
218
|
-
metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
|
|
219
|
-
}, import("better-auth").$strip>;
|
|
220
|
-
metadata: {
|
|
221
|
-
$Infer: {
|
|
222
|
-
body: {
|
|
223
|
-
id: string;
|
|
224
|
-
metadata?: (O extends {
|
|
225
|
-
metadata: {
|
|
226
|
-
validationSchema: import("better-auth").StandardSchemaV1<unknown, infer Out>;
|
|
227
|
-
};
|
|
228
|
-
} ? Out : Record<string, any>) | undefined;
|
|
229
|
-
};
|
|
230
|
-
};
|
|
231
|
-
};
|
|
232
|
-
}, {
|
|
233
|
-
status: boolean;
|
|
234
|
-
}>;
|
|
235
|
-
};
|
|
236
|
-
options: NoInfer<O>;
|
|
237
|
-
rateLimit: {
|
|
238
|
-
pathMatcher: (path: string) => boolean;
|
|
239
|
-
window: number;
|
|
240
|
-
max: number;
|
|
241
|
-
}[];
|
|
242
|
-
$ERROR_CODES: {
|
|
243
|
-
INVALID_EMAIL: import("better-auth").RawError<"INVALID_EMAIL">;
|
|
244
|
-
INVALID_TOKEN: import("better-auth").RawError<"INVALID_TOKEN">;
|
|
245
|
-
TOKEN_EXPIRED: import("better-auth").RawError<"TOKEN_EXPIRED">;
|
|
246
|
-
INVALID_METADATA: import("better-auth").RawError<"INVALID_METADATA">;
|
|
247
|
-
};
|
|
248
|
-
};
|
|
249
|
-
//#endregion
|
|
250
|
-
export { LeadPayload as i, Lead as n, LeadOptions as r, lead as t };
|
|
251
|
-
//# sourceMappingURL=index-P6m89iLp.d.mts.map
|