@nerdfolio/ba-guest-list 0.0.5 → 0.0.7
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 +8 -10
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nerdfolio/ba-guest-list",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
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
|
+
"repository": "https://github.com/nerdfolio/better-auth-goodies",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"exports": {
|
|
7
8
|
".": {
|