@nerdfolio/ba-guest-list 0.0.9 → 0.1.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/dist/index.cjs CHANGED
@@ -40,10 +40,13 @@ var import_v4_mini = require("zod/v4-mini");
40
40
 
41
41
  // src/utils.ts
42
42
  var import_lodash_es = require("lodash-es");
43
- function getHostName(url) {
43
+ function parseEmailDomain(url) {
44
44
  try {
45
- const parsedUrl = new URL(url);
46
- return parsedUrl.hostname;
45
+ const { hostname } = new URL(url);
46
+ if (hostname === "localhost") {
47
+ return "localhost.example.com";
48
+ }
49
+ return hostname;
47
50
  } catch (_error) {
48
51
  return null;
49
52
  }
@@ -82,7 +85,7 @@ var guestList = (options) => {
82
85
  }),
83
86
  metadata: {
84
87
  openapi: {
85
- description: "Sign in as a guest with name only",
88
+ description: "Sign in via a guest list",
86
89
  responses: {
87
90
  200: {
88
91
  description: "Sign in as a guest successful",
@@ -91,13 +94,15 @@ var guestList = (options) => {
91
94
  schema: {
92
95
  type: "object",
93
96
  properties: {
97
+ token: {
98
+ type: "string",
99
+ description: "Session token for the authenticated session"
100
+ },
94
101
  user: {
95
102
  $ref: "#/components/schemas/User"
96
- },
97
- session: {
98
- $ref: "#/components/schemas/Session"
99
103
  }
100
- }
104
+ },
105
+ required: ["token", "user"]
101
106
  }
102
107
  }
103
108
  }
@@ -126,7 +131,7 @@ var guestList = (options) => {
126
131
  message: options?.revealNames ? `Name not on list. Try: ${JSON.stringify(Object.keys(guestLookup))}` : ERROR_CODES.NAME_NOT_ON_GUEST_LIST
127
132
  });
128
133
  }
129
- const { emailDomainName = getHostName(ctx.context.baseURL) } = options ?? {};
134
+ const { emailDomainName = parseEmailDomain(ctx.context.baseURL) } = options ?? {};
130
135
  const email = `${cleanedName.toLowerCase().replaceAll(/\s/g, "")}.onguestlist@${emailDomainName}`;
131
136
  const found = await ctx.context.internalAdapter.findUserByEmail(email);
132
137
  async function createNewUser() {
package/dist/index.d.cts CHANGED
@@ -91,13 +91,15 @@ declare const guestList: (options?: GuestListOptions) => {
91
91
  schema: {
92
92
  type: "object";
93
93
  properties: {
94
- user: {
95
- $ref: string;
94
+ token: {
95
+ type: string;
96
+ description: string;
96
97
  };
97
- session: {
98
+ user: {
98
99
  $ref: string;
99
100
  };
100
101
  };
102
+ required: string[];
101
103
  };
102
104
  };
103
105
  };
package/dist/index.d.ts CHANGED
@@ -91,13 +91,15 @@ declare const guestList: (options?: GuestListOptions) => {
91
91
  schema: {
92
92
  type: "object";
93
93
  properties: {
94
- user: {
95
- $ref: string;
94
+ token: {
95
+ type: string;
96
+ description: string;
96
97
  };
97
- session: {
98
+ user: {
98
99
  $ref: string;
99
100
  };
100
101
  };
102
+ required: string[];
101
103
  };
102
104
  };
103
105
  };
package/dist/index.mjs CHANGED
@@ -13,10 +13,13 @@ import { z } from "zod/v4-mini";
13
13
 
14
14
  // src/utils.ts
15
15
  import { capitalize } from "lodash-es";
16
- function getHostName(url) {
16
+ function parseEmailDomain(url) {
17
17
  try {
18
- const parsedUrl = new URL(url);
19
- return parsedUrl.hostname;
18
+ const { hostname } = new URL(url);
19
+ if (hostname === "localhost") {
20
+ return "localhost.example.com";
21
+ }
22
+ return hostname;
20
23
  } catch (_error) {
21
24
  return null;
22
25
  }
@@ -55,7 +58,7 @@ var guestList = (options) => {
55
58
  }),
56
59
  metadata: {
57
60
  openapi: {
58
- description: "Sign in as a guest with name only",
61
+ description: "Sign in via a guest list",
59
62
  responses: {
60
63
  200: {
61
64
  description: "Sign in as a guest successful",
@@ -64,13 +67,15 @@ var guestList = (options) => {
64
67
  schema: {
65
68
  type: "object",
66
69
  properties: {
70
+ token: {
71
+ type: "string",
72
+ description: "Session token for the authenticated session"
73
+ },
67
74
  user: {
68
75
  $ref: "#/components/schemas/User"
69
- },
70
- session: {
71
- $ref: "#/components/schemas/Session"
72
76
  }
73
- }
77
+ },
78
+ required: ["token", "user"]
74
79
  }
75
80
  }
76
81
  }
@@ -99,7 +104,7 @@ var guestList = (options) => {
99
104
  message: options?.revealNames ? `Name not on list. Try: ${JSON.stringify(Object.keys(guestLookup))}` : ERROR_CODES.NAME_NOT_ON_GUEST_LIST
100
105
  });
101
106
  }
102
- const { emailDomainName = getHostName(ctx.context.baseURL) } = options ?? {};
107
+ const { emailDomainName = parseEmailDomain(ctx.context.baseURL) } = options ?? {};
103
108
  const email = `${cleanedName.toLowerCase().replaceAll(/\s/g, "")}.onguestlist@${emailDomainName}`;
104
109
  const found = await ctx.context.internalAdapter.findUserByEmail(email);
105
110
  async function createNewUser() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nerdfolio/ba-guest-list",
3
- "version": "0.0.9",
3
+ "version": "0.1.1",
4
4
  "description": "Similar to anonymous, but with a name that must be on a guest list. Useful for testing or demo with fixed logins",
5
5
  "repository": "https://github.com/nerdfolio/better-auth-goodies",
6
6
  "type": "module",
@@ -29,10 +29,10 @@
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/lodash-es": "^4.17.12",
32
- "better-auth": "1.2.9"
32
+ "better-auth": "1.2.12"
33
33
  },
34
34
  "peerDependencies": {
35
- "better-auth": "1.2.9"
35
+ "better-auth": "1.2.12"
36
36
  },
37
37
  "dependencies": {
38
38
  "lodash-es": "^4.17.21",