@nerdfolio/ba-guest-list 0.0.4 → 0.0.6

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.
Files changed (2) hide show
  1. package/README.md +9 -11
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Plugin to provide fixed guest list login functionality for [better-auth](https://www.better-auth.com).
4
4
 
5
- Intended use is for development testing and possibly demos with known login names, e.g. login as "Alice" or "Bob". You can use it with a single-input form or binding a name to a submit button. Names are case insensitive.
5
+ Intended use is for development testing and possibly demos with known login names, e.g. login as "Alice" or "Bob". You can use it with a single-input form or binding a name to a submit button. Names are single-word and case-insensitive.
6
6
 
7
7
  The fixed guest list is defined on the server-side with optional roles so this plugin can also be used for testing roles.
8
8
  You can optionally reveal the server guest list to the client (useful for demo login scenarios).
@@ -13,7 +13,7 @@ THIS IS NOT MEANT FOR SECURE PRODUCTION APP!
13
13
 
14
14
  This plugin does not add any field to the schema as its intended use is temporary for testing and demos.
15
15
 
16
- Internally, the guest name is transformed into an email via a fixed template, e.g. `tom.onguestlist@emaildomain` and that is the way that user will be looked up. For simplicity, the guest names are restricted to be 1-word names.
16
+ Internally, the guest name is transformed into an email via a fixed template, e.g. `tom.onguestlist@emaildomain` and that is the way users will be looked up.
17
17
 
18
18
 
19
19
  # Installation
@@ -24,8 +24,6 @@ pnpm add @nerdfolio/ba-guest-list
24
24
 
25
25
  ```
26
26
 
27
- # Usage
28
-
29
27
  ## Server-side setup
30
28
 
31
29
  ```typescript
@@ -39,12 +37,13 @@ export const auth = betterAuth({
39
37
  ...otherPlugins,
40
38
  guestList({
41
39
  allowGuests: [
42
- // can be array of names or array of {name: string, role?: comma-separated-string}
40
+ // required: can be array of names or array of {name: string, role?: comma-separated-string}
43
41
  { name: "Alice", role: "admin" },
44
42
  { name: "Bob", role: "user" },
45
43
  { name: "Charlie", role: "user" },
46
44
  ],
47
- revealNames: true // whether the client can see this list (useful for demos)
45
+ // optional; whether the client can see this list (useful for demos)
46
+ revealNames: true
48
47
  })
49
48
  ],
50
49
  })
@@ -74,22 +73,21 @@ export const authClient = createAuthClient({
74
73
 
75
74
  ```
76
75
 
77
- ## Signin
76
+ # Usage
78
77
 
79
78
  ```typescript
80
79
 
81
- // authClient is the better-auth client as defined in client-side setup
82
80
  // GUEST_NAME has to be in the list of names defined in server-side setup, otherwise login will fail
83
81
  authClient.signIn.guestList({
84
82
  name: GUEST_NAME
85
83
  })
86
84
  ```
87
85
 
88
- If you have enabled `revealNames` in your server-side setup, you can retrieve that list of names on the client side. This may be useful for creating demos with a fixed list of login names. The plugin will
89
- call a special fetch endpoint and returns either `null` or an array of name strings. When `revealNames` is undefined or false, it returns `null`.
86
+ If you have enabled `revealNames` in your server-side setup, you can retrieve that list of names on the client side via `signIn.guestList.reveal()`. This may be useful for creating demos with a fixed list of login names as client-side hints.
90
87
 
91
88
  ```typescript
92
- // just an async so you'll need to use it according to the way your frontend framework andles async
89
+ // just an async so you'll need to use it according to the way
90
+ // your frontend framework handles async
93
91
 
94
92
  const guestNames = await authClient.signIn.guestList.reveal()
95
93
  .then(({ data, error: _e }) => data?.join(", "))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nerdfolio/ba-guest-list",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
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
  "type": "module",
6
6
  "exports": {