@dymo-api/better-auth 1.2.17 → 1.2.19

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Official Dymo API Library for Better-Auth.
2
2
 
3
- You can see the library documentation by clicking [here](https://docs.tpeoficial.com/docs/dymo-api/getting-started/libraries?ch-pg=r-dm-node).
3
+ You can see the library documentation by clicking [here](https://docs.tpeoficial.com/docs/dymo-api/getting-started/libraries?ch-pg=r-dm-better-auth).
4
4
 
5
5
  #### Installation
6
6
 
@@ -20,7 +20,7 @@ yarn add @dymo-api/better-auth
20
20
 
21
21
  #### Authenticating ourselves on the client with the API Key
22
22
 
23
- [Get my free API Key](https://tpe.li/new-api-key?ch-pg=gh-dmapi-node-rd-step)
23
+ [Get my free API Key](https://tpe.li/new-api-key?ch-pg=gh-dmapi-better-auth-rd-step)
24
24
 
25
25
  #### Email Validation
26
26
 
@@ -1,46 +1,5 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.dymoEmailPlugin = void 0;
7
- const api_1 = require("better-auth/api");
8
- const dymo_api_1 = __importDefault(require("dymo-api"));
9
- const dymoEmailPlugin = ({ apiKey, emailRules }) => {
10
- const defaultRules = {
11
- deny: ["FRAUD", "INVALID", "NO_MX_RECORDS", "NO_REPLY_EMAIL"]
12
- };
13
- const dymoClient = new dymo_api_1.default({
14
- apiKey,
15
- rules: {
16
- email: {
17
- deny: emailRules?.deny ?? defaultRules.deny
18
- }
19
- }
20
- });
21
- return {
22
- id: "dymoEmailPlugin",
23
- hooks: {
24
- before: [
25
- {
26
- matcher: (context) => context.path.startsWith("/sign-up/email"),
27
- handler: (0, api_1.createAuthMiddleware)(async (ctx) => {
28
- const { email } = ctx.body;
29
- if (typeof email !== "string")
30
- throw new api_1.APIError("BAD_REQUEST", { message: "Email must be a string." });
31
- const decision = await dymoClient.isValidEmail(email);
32
- if (!decision.allow) {
33
- throw new api_1.APIError("BAD_REQUEST", {
34
- message: "Email is invalid or blocked.",
35
- reasons: decision.reasons
36
- });
37
- }
38
- ctx.dymoEmail = decision.response;
39
- return { context: ctx };
40
- })
41
- }
42
- ]
43
- }
44
- };
45
- };
46
- exports.dymoEmailPlugin = dymoEmailPlugin;
4
+ var emailValidation_1 = require("./plugins/emailValidation/index.cjs");
5
+ Object.defineProperty(exports, "dymoEmailPlugin", { enumerable: true, get: function () { return emailValidation_1.dymoEmailPlugin; } });
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.dymoEmailPlugin = void 0;
7
+ const api_1 = require("better-auth/api");
8
+ const dymo_api_1 = __importDefault(require("dymo-api"));
9
+ const dymoEmailPlugin = ({ apiKey, emailRules }) => {
10
+ const defaultRules = {
11
+ deny: ["FRAUD", "INVALID", "NO_MX_RECORDS", "NO_REPLY_EMAIL"]
12
+ };
13
+ const dymoClient = new dymo_api_1.default({
14
+ apiKey,
15
+ rules: {
16
+ email: {
17
+ deny: emailRules?.deny ?? defaultRules.deny
18
+ }
19
+ }
20
+ });
21
+ return {
22
+ id: "dymoEmailPlugin",
23
+ hooks: {
24
+ before: [
25
+ {
26
+ matcher: (context) => context.path.startsWith("/sign-up/email"),
27
+ handler: (0, api_1.createAuthMiddleware)(async (ctx) => {
28
+ const { email } = ctx.body;
29
+ if (typeof email !== "string")
30
+ throw new api_1.APIError("BAD_REQUEST", { message: "Email must be a string." });
31
+ const decision = await dymoClient.isValidEmail(email);
32
+ if (!decision.allow) {
33
+ throw new api_1.APIError("BAD_REQUEST", {
34
+ message: "Email is invalid or blocked.",
35
+ reasons: decision.reasons
36
+ });
37
+ }
38
+ ctx.body.email = decision.email;
39
+ ctx.dymoEmail = decision.response;
40
+ return { context: ctx };
41
+ })
42
+ }
43
+ ]
44
+ }
45
+ };
46
+ };
47
+ exports.dymoEmailPlugin = dymoEmailPlugin;
package/dist/esm/index.js CHANGED
@@ -1,39 +1 @@
1
- import { APIError, createAuthMiddleware } from "better-auth/api";
2
- import DymoAPI from "dymo-api";
3
- export const dymoEmailPlugin = ({ apiKey, emailRules }) => {
4
- const defaultRules = {
5
- deny: ["FRAUD", "INVALID", "NO_MX_RECORDS", "NO_REPLY_EMAIL"]
6
- };
7
- const dymoClient = new DymoAPI({
8
- apiKey,
9
- rules: {
10
- email: {
11
- deny: emailRules?.deny ?? defaultRules.deny
12
- }
13
- }
14
- });
15
- return {
16
- id: "dymoEmailPlugin",
17
- hooks: {
18
- before: [
19
- {
20
- matcher: (context) => context.path.startsWith("/sign-up/email"),
21
- handler: createAuthMiddleware(async (ctx) => {
22
- const { email } = ctx.body;
23
- if (typeof email !== "string")
24
- throw new APIError("BAD_REQUEST", { message: "Email must be a string." });
25
- const decision = await dymoClient.isValidEmail(email);
26
- if (!decision.allow) {
27
- throw new APIError("BAD_REQUEST", {
28
- message: "Email is invalid or blocked.",
29
- reasons: decision.reasons
30
- });
31
- }
32
- ctx.dymoEmail = decision.response;
33
- return { context: ctx };
34
- })
35
- }
36
- ]
37
- }
38
- };
39
- };
1
+ export { dymoEmailPlugin } from "./plugins/emailValidation";
@@ -0,0 +1,40 @@
1
+ import { APIError, createAuthMiddleware } from "better-auth/api";
2
+ import DymoAPI from "dymo-api";
3
+ export const dymoEmailPlugin = ({ apiKey, emailRules }) => {
4
+ const defaultRules = {
5
+ deny: ["FRAUD", "INVALID", "NO_MX_RECORDS", "NO_REPLY_EMAIL"]
6
+ };
7
+ const dymoClient = new DymoAPI({
8
+ apiKey,
9
+ rules: {
10
+ email: {
11
+ deny: emailRules?.deny ?? defaultRules.deny
12
+ }
13
+ }
14
+ });
15
+ return {
16
+ id: "dymoEmailPlugin",
17
+ hooks: {
18
+ before: [
19
+ {
20
+ matcher: (context) => context.path.startsWith("/sign-up/email"),
21
+ handler: createAuthMiddleware(async (ctx) => {
22
+ const { email } = ctx.body;
23
+ if (typeof email !== "string")
24
+ throw new APIError("BAD_REQUEST", { message: "Email must be a string." });
25
+ const decision = await dymoClient.isValidEmail(email);
26
+ if (!decision.allow) {
27
+ throw new APIError("BAD_REQUEST", {
28
+ message: "Email is invalid or blocked.",
29
+ reasons: decision.reasons
30
+ });
31
+ }
32
+ ctx.body.email = decision.email;
33
+ ctx.dymoEmail = decision.response;
34
+ return { context: ctx };
35
+ })
36
+ }
37
+ ]
38
+ }
39
+ };
40
+ };
@@ -1,17 +1 @@
1
- import { EmailValidatorRules } from "dymo-api";
2
- interface DymoEmailPluginOptions {
3
- apiKey: string;
4
- emailRules?: Partial<EmailValidatorRules>;
5
- }
6
- export declare const dymoEmailPlugin: ({ apiKey, emailRules }: DymoEmailPluginOptions) => {
7
- id: "dymoEmailPlugin";
8
- hooks: {
9
- before: {
10
- matcher: (context: any) => any;
11
- handler: (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
12
- context: any;
13
- }>;
14
- }[];
15
- };
16
- };
17
- export {};
1
+ export { dymoEmailPlugin } from "./plugins/emailValidation";
@@ -0,0 +1,17 @@
1
+ import { EmailValidatorRules } from "dymo-api";
2
+ interface DymoEmailPluginOptions {
3
+ apiKey: string;
4
+ emailRules?: Partial<EmailValidatorRules>;
5
+ }
6
+ export declare const dymoEmailPlugin: ({ apiKey, emailRules }: DymoEmailPluginOptions) => {
7
+ id: "dymoEmailPlugin";
8
+ hooks: {
9
+ before: {
10
+ matcher: (context: any) => any;
11
+ handler: (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
12
+ context: any;
13
+ }>;
14
+ }[];
15
+ };
16
+ };
17
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dymo-api/better-auth",
3
- "version": "1.2.17",
3
+ "version": "1.2.19",
4
4
  "description": "Flow system for Dymo API.",
5
5
  "main": "dist/cjs/dymo-api.js",
6
6
  "module": "dist/esm/dymo-api.js",
@@ -48,7 +48,7 @@
48
48
  "homepage": "https://dymo.tpeoficial.com",
49
49
  "dependencies": {
50
50
  "better-auth": "^1.3.23",
51
- "dymo-api": "^1.2.15",
51
+ "dymo-api": "^1.2.17",
52
52
  "path": "^0.12.7"
53
53
  },
54
54
  "contributors": [