@checodo/better-auth-blocklist 0.0.0-stage → 0.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @checodo/better-auth-blocklist
2
+
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5f427b0: First release: block disposable email domains, reserved usernames, and unwanted organization and team names, with ready-made lists.
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Clas Heinemeyer
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,53 @@
1
- # Temporary Holding Version
1
+ # @checodo/better-auth-blocklist
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Block disallowed emails, usernames, and organization and team names in [better-auth](https://better-auth.com): disposable email domains, reserved usernames, your own rules, and rules admins manage at runtime.
4
+
5
+ A community plugin, not made by the better-auth team. It looks and works
6
+ like better-auth's own plugins: a server plugin, a typed client plugin,
7
+ error codes, and database tables.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install @checodo/better-auth-blocklist
13
+ ```
14
+
15
+ Requires `better-auth` and `@better-auth/core` 1.7.20 or a later 1.x
16
+ release (peer dependencies). ESM only.
17
+
18
+ ## Usage
19
+
20
+ ```ts
21
+ // auth.ts
22
+ import { betterAuth } from "better-auth";
23
+ import { blocklist } from "@checodo/better-auth-blocklist";
24
+ import { disposableEmailDomains, reservedUsernames } from "@checodo/better-auth-blocklist/lists";
25
+
26
+ export const auth = betterAuth({
27
+ plugins: [
28
+ blocklist({
29
+ email: { domains: disposableEmailDomains },
30
+ username: { values: reservedUsernames },
31
+ }),
32
+ ],
33
+ });
34
+ ```
35
+
36
+ ```ts
37
+ // auth-client.ts
38
+ import { createAuthClient } from "better-auth/client";
39
+ import { blocklistClient } from "@checodo/better-auth-blocklist/client";
40
+
41
+ export const authClient = createAuthClient({ plugins: [blocklistClient()] });
42
+ ```
43
+
44
+ Create the plugin's tables with the better-auth CLI:
45
+
46
+ ```bash
47
+ npx auth@latest migrate
48
+ ```
49
+
50
+ ## Documentation
51
+
52
+ Every option, endpoint, error code, and table:
53
+ [docs](https://github.com/checodo/better-auth-plugins/blob/main/apps/docs/content/docs/blocklist.mdx).
@@ -0,0 +1,255 @@
1
+ # Third-party notices
2
+
3
+ `@checodo/better-auth-blocklist/lists` includes data from the projects
4
+ below, or uses them to filter that data. Generated by
5
+ `scripts/update-lists.ts`; do not edit by hand.
6
+
7
+ ## disposable-email-domains/disposable-email-domains
8
+
9
+ Used for `disposableEmailDomains`.
10
+ https://github.com/disposable-email-domains/disposable-email-domains/tree/ba992a0b4c867db3ff39605696bb7de9fbb2e11f (CC0-1.0)
11
+
12
+ ```text
13
+ CC0 1.0 Universal (CC0 1.0)
14
+ Public Domain Dedication
15
+
16
+ No Copyright
17
+
18
+ The person who associated a work with this deed has dedicated
19
+ the work to the public domain by waiving all of his or her rights
20
+ to the work worldwide under copyright law, including all related
21
+ and neighboring rights, to the extent allowed by law.
22
+
23
+ You can copy, modify, distribute and perform the work, even
24
+ for commercial purposes, all without asking permission.
25
+
26
+ Details: https://creativecommons.org/publicdomain/zero/1.0/legalcode
27
+ ```
28
+
29
+ ## wesbos/burner-email-providers
30
+
31
+ Used for `disposableEmailDomains`.
32
+ https://github.com/wesbos/burner-email-providers/tree/d676e736ceca59de826b1457878661d7f899c97e (MIT)
33
+
34
+ ```text
35
+ Copyright 2018 Wes Bos
36
+
37
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
38
+
39
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
40
+
41
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42
+ ```
43
+
44
+ ## FGRibreau/mailchecker
45
+
46
+ Used for `disposableEmailDomains`.
47
+ https://github.com/FGRibreau/mailchecker/tree/6c48ff1d282ab758bd9dfa0e2d7524fe712146eb (MIT)
48
+
49
+ ```text
50
+ Copyright (c) 2013 Francois-Guillaume Ribreau
51
+
52
+ Permission is hereby granted, free of charge, to any person
53
+ obtaining a copy of this software and associated documentation
54
+ files (the "Software"), to deal in the Software without
55
+ restriction, including without limitation the rights to use,
56
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
57
+ copies of the Software, and to permit persons to whom the
58
+ Software is furnished to do so, subject to the following
59
+ conditions:
60
+
61
+ The above copyright notice and this permission notice shall be
62
+ included in all copies or substantial portions of the Software.
63
+
64
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
65
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
66
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
67
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
68
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
69
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
70
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
71
+ OTHER DEALINGS IN THE SOFTWARE.
72
+ ```
73
+
74
+ ## 7c/fakefilter
75
+
76
+ Used for `disposableEmailDomains`.
77
+ https://github.com/7c/fakefilter/tree/811262c6cc5cb93e78fe76d408826464f5240a09 (BSD-3-Clause)
78
+
79
+ ```text
80
+ BSD 3-Clause License
81
+
82
+ Copyright (c) 2022, 7c
83
+ All rights reserved.
84
+
85
+ Redistribution and use in source and binary forms, with or without
86
+ modification, are permitted provided that the following conditions are met:
87
+
88
+ 1. Redistributions of source code must retain the above copyright notice, this
89
+ list of conditions and the following disclaimer.
90
+
91
+ 2. Redistributions in binary form must reproduce the above copyright notice,
92
+ this list of conditions and the following disclaimer in the documentation
93
+ and/or other materials provided with the distribution.
94
+
95
+ 3. Neither the name of the copyright holder nor the names of its
96
+ contributors may be used to endorse or promote products derived from
97
+ this software without specific prior written permission.
98
+
99
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
100
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
101
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
102
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
103
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
104
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
105
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
106
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
107
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
108
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
109
+ ```
110
+
111
+ ## unkn0w/disposable-email-domain-list
112
+
113
+ Used for `disposableEmailDomains`.
114
+ https://github.com/unkn0w/disposable-email-domain-list/tree/0d69034714617cc3acab158b27e68d0180815459 (MIT)
115
+
116
+ ```text
117
+ MIT License
118
+
119
+ Copyright (c) 2022 Jakub 'unknow' Mrugalski
120
+
121
+ Permission is hereby granted, free of charge, to any person obtaining a copy
122
+ of this software and associated documentation files (the "Software"), to deal
123
+ in the Software without restriction, including without limitation the rights
124
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
125
+ copies of the Software, and to permit persons to whom the Software is
126
+ furnished to do so, subject to the following conditions:
127
+
128
+ The above copyright notice and this permission notice shall be included in all
129
+ copies or substantial portions of the Software.
130
+
131
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
132
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
133
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
134
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
135
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
136
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
137
+ SOFTWARE.
138
+ ```
139
+
140
+ ## castle/disposable-email-domains
141
+
142
+ Used for `disposableEmailDomains`.
143
+ https://github.com/castle/disposable-email-domains/tree/700182f690be69ea203b077cbec90e59727a8344 (MIT)
144
+
145
+ ```text
146
+ MIT License
147
+
148
+ Copyright (c) 2026 Castle
149
+
150
+ Permission is hereby granted, free of charge, to any person obtaining a copy
151
+ of this software and associated documentation files (the "Software"), to deal
152
+ in the Software without restriction, including without limitation the rights
153
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
154
+ copies of the Software, and to permit persons to whom the Software is
155
+ furnished to do so, subject to the following conditions:
156
+
157
+ The above copyright notice and this permission notice shall be included in all
158
+ copies or substantial portions of the Software.
159
+
160
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
161
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
162
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
163
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
164
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
165
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
166
+ SOFTWARE.
167
+ ```
168
+
169
+ ## daisy1754/jp-disposable-emails
170
+
171
+ Used for `disposableEmailDomains`.
172
+ https://github.com/daisy1754/jp-disposable-emails/tree/6dbb46d762741caf7122d88920a1f62ad761565b (MIT)
173
+
174
+ ```text
175
+ MIT License
176
+
177
+ Copyright (c) 2021 Kazuki Nishiura
178
+
179
+ Permission is hereby granted, free of charge, to any person obtaining a copy
180
+ of this software and associated documentation files (the "Software"), to deal
181
+ in the Software without restriction, including without limitation the rights
182
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
183
+ copies of the Software, and to permit persons to whom the Software is
184
+ furnished to do so, subject to the following conditions:
185
+
186
+ The above copyright notice and this permission notice shall be included in all
187
+ copies or substantial portions of the Software.
188
+
189
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
190
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
191
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
192
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
193
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
194
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
195
+ SOFTWARE.
196
+ ```
197
+
198
+ ## disposable/disposable
199
+
200
+ Used to remove legitimate entries from `disposableEmailDomains`; none of its data ships.
201
+ https://github.com/disposable/disposable/tree/dd075f91b5ee0f0e25fcd420d1da9e5b893b8e6d (MIT)
202
+
203
+ ```text
204
+ MIT License
205
+
206
+ Copyright (c) 2017 Andrei Simionescu
207
+ Copyright (c) 2017 Stefan Meinecke, greenSec GmbH
208
+
209
+ Permission is hereby granted, free of charge, to any person obtaining a copy
210
+ of this software and associated documentation files (the "Software"), to deal
211
+ in the Software without restriction, including without limitation the rights
212
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
213
+ copies of the Software, and to permit persons to whom the Software is
214
+ furnished to do so, subject to the following conditions:
215
+
216
+ The above copyright notice and this permission notice shall be included in all
217
+ copies or substantial portions of the Software.
218
+
219
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
220
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
221
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
222
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
223
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
224
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
225
+ SOFTWARE.
226
+ ```
227
+
228
+ ## jmitchel3/The-Big-Username-Blacklist
229
+
230
+ Used for `reservedUsernames`.
231
+ https://github.com/jmitchel3/The-Big-Username-Blacklist/tree/669ca49e0c0c72fed546566db3e1558ad8d5aa02 (MIT)
232
+
233
+ ```text
234
+ The MIT License (MIT)
235
+
236
+ Copyright (c) 2015-2017 Martin Sandström
237
+
238
+ Permission is hereby granted, free of charge, to any person obtaining a copy
239
+ of this software and associated documentation files (the "Software"), to deal
240
+ in the Software without restriction, including without limitation the rights
241
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
242
+ copies of the Software, and to permit persons to whom the Software is
243
+ furnished to do so, subject to the following conditions:
244
+
245
+ The above copyright notice and this permission notice shall be included in all
246
+ copies or substantial portions of the Software.
247
+
248
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
249
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
250
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
251
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
252
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
253
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
254
+ SOFTWARE.
255
+ ```
@@ -0,0 +1,41 @@
1
+ import { r as BLOCKLIST_ERROR_CODES, t as BlocklistPlugin } from "./index-CaZWacnb.js";
2
+ /**
3
+ * Client companion to `blocklist()`. Adds `authClient.blocklist.listRules`,
4
+ * `createRule`, and `deleteRule`, typed from the server plugin.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * import { createAuthClient } from "better-auth/client";
9
+ * import { blocklistClient } from "@checodo/better-auth-blocklist/client";
10
+ *
11
+ * export const authClient = createAuthClient({
12
+ * plugins: [blocklistClient()],
13
+ * });
14
+ * ```
15
+ */
16
+ export declare const blocklistClient: () => {
17
+ id: "blocklist";
18
+ $InferServerPlugin: BlocklistPlugin;
19
+ pathMethods: {
20
+ "/blocklist/list-rules": "GET";
21
+ "/blocklist/create-rule": "POST";
22
+ "/blocklist/delete-rule": "POST";
23
+ };
24
+ $ERROR_CODES: {
25
+ EMAIL_NOT_ALLOWED: import("better-auth").RawError<"EMAIL_NOT_ALLOWED">;
26
+ USERNAME_NOT_ALLOWED: import("better-auth").RawError<"USERNAME_NOT_ALLOWED">;
27
+ ORGANIZATION_NAME_NOT_ALLOWED: import("better-auth").RawError<"ORGANIZATION_NAME_NOT_ALLOWED">;
28
+ TEAM_NAME_NOT_ALLOWED: import("better-auth").RawError<"TEAM_NAME_NOT_ALLOWED">;
29
+ VALUE_NOT_ALLOWED: import("better-auth").RawError<"VALUE_NOT_ALLOWED">;
30
+ YOU_ARE_NOT_ALLOWED_TO_MANAGE_BLOCKLIST_RULES: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_MANAGE_BLOCKLIST_RULES">;
31
+ RULE_ALREADY_EXISTS: import("better-auth").RawError<"RULE_ALREADY_EXISTS">;
32
+ RULE_NOT_FOUND: import("better-auth").RawError<"RULE_NOT_FOUND">;
33
+ INVALID_REGEX_RULE: import("better-auth").RawError<"INVALID_REGEX_RULE">;
34
+ DOMAIN_RULE_ONLY_FOR_EMAIL: import("better-auth").RawError<"DOMAIN_RULE_ONLY_FOR_EMAIL">;
35
+ DATABASE_RULES_DISABLED_FOR_TARGET: import("better-auth").RawError<"DATABASE_RULES_DISABLED_FOR_TARGET">;
36
+ REGEX_RULE_MUST_BE_LOWERCASE: import("better-auth").RawError<"REGEX_RULE_MUST_BE_LOWERCASE">;
37
+ RULE_VALUE_TOO_LONG: import("better-auth").RawError<"RULE_VALUE_TOO_LONG">;
38
+ };
39
+ };
40
+ export { BLOCKLIST_ERROR_CODES };
41
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","names":[],"sources":["../src/client.ts"],"mappings":";;;;;;;;;;;;;;;qBAkBa;;EAGiB,oBAAA"}
package/dist/client.js ADDED
@@ -0,0 +1,31 @@
1
+ import { t as BLOCKLIST_ERROR_CODES } from "./error-codes-B5eL-QZV.js";
2
+ // src/client.ts
3
+ /**
4
+ * Client companion to `blocklist()`. Adds `authClient.blocklist.listRules`,
5
+ * `createRule`, and `deleteRule`, typed from the server plugin.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { createAuthClient } from "better-auth/client";
10
+ * import { blocklistClient } from "@checodo/better-auth-blocklist/client";
11
+ *
12
+ * export const authClient = createAuthClient({
13
+ * plugins: [blocklistClient()],
14
+ * });
15
+ * ```
16
+ */
17
+ const blocklistClient = () => {
18
+ return {
19
+ id: "blocklist",
20
+ $InferServerPlugin: {},
21
+ pathMethods: {
22
+ "/blocklist/list-rules": "GET",
23
+ "/blocklist/create-rule": "POST",
24
+ "/blocklist/delete-rule": "POST"
25
+ },
26
+ $ERROR_CODES: BLOCKLIST_ERROR_CODES
27
+ };
28
+ };
29
+ export { BLOCKLIST_ERROR_CODES, blocklistClient };
30
+
31
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","names":[],"sources":["../src/client.ts"],"sourcesContent":["import type { BetterAuthClientPlugin } from \"better-auth/client\";\nimport { BLOCKLIST_ERROR_CODES } from \"./error-codes\";\nimport type { BlocklistPlugin } from \"./index\";\n\n/**\n * Client companion to `blocklist()`. Adds `authClient.blocklist.listRules`,\n * `createRule`, and `deleteRule`, typed from the server plugin.\n *\n * @example\n * ```ts\n * import { createAuthClient } from \"better-auth/client\";\n * import { blocklistClient } from \"@checodo/better-auth-blocklist/client\";\n *\n * export const authClient = createAuthClient({\n * plugins: [blocklistClient()],\n * });\n * ```\n */\nexport const blocklistClient = () => {\n return {\n id: \"blocklist\",\n $InferServerPlugin: {} as BlocklistPlugin,\n pathMethods: {\n \"/blocklist/list-rules\": \"GET\",\n \"/blocklist/create-rule\": \"POST\",\n \"/blocklist/delete-rule\": \"POST\",\n },\n $ERROR_CODES: BLOCKLIST_ERROR_CODES,\n } satisfies BetterAuthClientPlugin;\n};\n\nexport { BLOCKLIST_ERROR_CODES } from \"./error-codes\";\n"],"mappings":";;;;;;;;;;;;;;;;AAkBA,MAAa,wBAAwB;CACnC,OAAO;EACL,IAAI;EACJ,oBAAoB,CAAC;EACrB,aAAa;GACX,yBAAyB;GACzB,0BAA0B;GAC1B,0BAA0B;EAC5B;EACA,cAAc;CAChB;AACF"}
@@ -0,0 +1,20 @@
1
+ import { defineErrorCodes } from "@better-auth/core/utils/error-codes";
2
+ // src/error-codes.ts
3
+ const BLOCKLIST_ERROR_CODES = defineErrorCodes({
4
+ EMAIL_NOT_ALLOWED: "This email address is not allowed",
5
+ USERNAME_NOT_ALLOWED: "This username is not allowed",
6
+ ORGANIZATION_NAME_NOT_ALLOWED: "This organization name is not allowed",
7
+ TEAM_NAME_NOT_ALLOWED: "This team name is not allowed",
8
+ VALUE_NOT_ALLOWED: "This value is not allowed",
9
+ YOU_ARE_NOT_ALLOWED_TO_MANAGE_BLOCKLIST_RULES: "You are not allowed to manage blocklist rules",
10
+ RULE_ALREADY_EXISTS: "A rule with this target, type, and value already exists",
11
+ RULE_NOT_FOUND: "No rule was found with this id",
12
+ INVALID_REGEX_RULE: "The regular expression is invalid, too long, or potentially slow",
13
+ DOMAIN_RULE_ONLY_FOR_EMAIL: "Domain rules are only supported for the email target",
14
+ DATABASE_RULES_DISABLED_FOR_TARGET: "Database rules are disabled for this target",
15
+ REGEX_RULE_MUST_BE_LOWERCASE: "The regular expression contains uppercase letters, which never match normalized values",
16
+ RULE_VALUE_TOO_LONG: "The rule value is too long"
17
+ });
18
+ export { BLOCKLIST_ERROR_CODES as t };
19
+
20
+ //# sourceMappingURL=error-codes-B5eL-QZV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-codes-B5eL-QZV.js","names":[],"sources":["../src/error-codes.ts"],"sourcesContent":["import { defineErrorCodes } from \"@better-auth/core/utils/error-codes\";\n\nexport const BLOCKLIST_ERROR_CODES = defineErrorCodes({\n EMAIL_NOT_ALLOWED: \"This email address is not allowed\",\n USERNAME_NOT_ALLOWED: \"This username is not allowed\",\n ORGANIZATION_NAME_NOT_ALLOWED: \"This organization name is not allowed\",\n TEAM_NAME_NOT_ALLOWED: \"This team name is not allowed\",\n VALUE_NOT_ALLOWED: \"This value is not allowed\",\n YOU_ARE_NOT_ALLOWED_TO_MANAGE_BLOCKLIST_RULES: \"You are not allowed to manage blocklist rules\",\n RULE_ALREADY_EXISTS: \"A rule with this target, type, and value already exists\",\n RULE_NOT_FOUND: \"No rule was found with this id\",\n INVALID_REGEX_RULE: \"The regular expression is invalid, too long, or potentially slow\",\n DOMAIN_RULE_ONLY_FOR_EMAIL: \"Domain rules are only supported for the email target\",\n DATABASE_RULES_DISABLED_FOR_TARGET: \"Database rules are disabled for this target\",\n REGEX_RULE_MUST_BE_LOWERCASE:\n \"The regular expression contains uppercase letters, which never match normalized values\",\n RULE_VALUE_TOO_LONG: \"The rule value is too long\",\n});\n\nexport type BlocklistErrorCode = keyof typeof BLOCKLIST_ERROR_CODES;\n"],"mappings":";;AAEA,MAAa,wBAAwB,iBAAiB;CACpD,mBAAmB;CACnB,sBAAsB;CACtB,+BAA+B;CAC/B,uBAAuB;CACvB,mBAAmB;CACnB,+CAA+C;CAC/C,qBAAqB;CACrB,gBAAgB;CAChB,oBAAoB;CACpB,4BAA4B;CAC5B,oCAAoC;CACpC,8BACE;CACF,qBAAqB;AACvB,CAAC"}