@nerdfolio/ba-guest-list 0.1.1 → 0.1.2
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 +15 -6
- package/dist/index.d.cts +51 -122
- package/dist/index.d.ts +51 -122
- package/dist/index.mjs +3 -4
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
@@ -36,7 +46,7 @@ var guestListClient = () => {
|
|
|
36
46
|
// src/server.ts
|
|
37
47
|
var import_api = require("better-auth/api");
|
|
38
48
|
var import_cookies = require("better-auth/cookies");
|
|
39
|
-
var
|
|
49
|
+
var z = __toESM(require("zod/mini"), 1);
|
|
40
50
|
|
|
41
51
|
// src/utils.ts
|
|
42
52
|
var import_lodash_es = require("lodash-es");
|
|
@@ -80,8 +90,8 @@ var guestList = (options) => {
|
|
|
80
90
|
"/sign-in/guest-list",
|
|
81
91
|
{
|
|
82
92
|
method: "POST",
|
|
83
|
-
body:
|
|
84
|
-
name:
|
|
93
|
+
body: z.object({
|
|
94
|
+
name: z.string()
|
|
85
95
|
}),
|
|
86
96
|
metadata: {
|
|
87
97
|
openapi: {
|
|
@@ -143,8 +153,7 @@ var guestList = (options) => {
|
|
|
143
153
|
role: guestLookup[cleanedName].role,
|
|
144
154
|
createdAt: /* @__PURE__ */ new Date(),
|
|
145
155
|
updatedAt: /* @__PURE__ */ new Date()
|
|
146
|
-
}
|
|
147
|
-
ctx
|
|
156
|
+
}
|
|
148
157
|
);
|
|
149
158
|
if (!newUser) {
|
|
150
159
|
throw ctx.error("INTERNAL_SERVER_ERROR", {
|
|
@@ -154,7 +163,7 @@ var guestList = (options) => {
|
|
|
154
163
|
return newUser;
|
|
155
164
|
}
|
|
156
165
|
const user = found ? found.user : await createNewUser();
|
|
157
|
-
const session = await ctx.context.internalAdapter.createSession(user.id,
|
|
166
|
+
const session = await ctx.context.internalAdapter.createSession(user.id, true);
|
|
158
167
|
if (!session) {
|
|
159
168
|
return ctx.json(null, {
|
|
160
169
|
status: 400,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as better_auth from 'better-auth';
|
|
2
|
-
import
|
|
2
|
+
import * as z from 'zod/mini';
|
|
3
3
|
|
|
4
4
|
type GuestWithRole = {
|
|
5
5
|
name: string;
|
|
@@ -26,132 +26,64 @@ interface GuestListOptions {
|
|
|
26
26
|
declare const guestList: (options?: GuestListOptions) => {
|
|
27
27
|
id: "guest-list";
|
|
28
28
|
endpoints: {
|
|
29
|
-
signInGuestList: {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
returnHeaders?: ReturnHeaders | undefined;
|
|
52
|
-
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
53
|
-
headers: Headers;
|
|
54
|
-
response: {
|
|
55
|
-
token: string;
|
|
56
|
-
user: {
|
|
57
|
-
id: string;
|
|
58
|
-
name: string;
|
|
59
|
-
emailVerified: boolean;
|
|
60
|
-
email: string;
|
|
61
|
-
createdAt: Date;
|
|
62
|
-
updatedAt: Date;
|
|
63
|
-
image?: string | null | undefined;
|
|
64
|
-
};
|
|
65
|
-
} | null;
|
|
66
|
-
} : {
|
|
67
|
-
token: string;
|
|
68
|
-
user: {
|
|
69
|
-
id: string;
|
|
70
|
-
name: string;
|
|
71
|
-
emailVerified: boolean;
|
|
72
|
-
email: string;
|
|
73
|
-
createdAt: Date;
|
|
74
|
-
updatedAt: Date;
|
|
75
|
-
image?: string | null | undefined;
|
|
76
|
-
};
|
|
77
|
-
} | null>;
|
|
78
|
-
options: {
|
|
79
|
-
method: "POST";
|
|
80
|
-
body: z.ZodMiniObject<{
|
|
81
|
-
name: z.ZodMiniString<string>;
|
|
82
|
-
}, z.core.$strip>;
|
|
83
|
-
metadata: {
|
|
84
|
-
openapi: {
|
|
85
|
-
description: string;
|
|
86
|
-
responses: {
|
|
87
|
-
200: {
|
|
88
|
-
description: string;
|
|
89
|
-
content: {
|
|
90
|
-
"application/json": {
|
|
91
|
-
schema: {
|
|
92
|
-
type: "object";
|
|
93
|
-
properties: {
|
|
94
|
-
token: {
|
|
95
|
-
type: string;
|
|
96
|
-
description: string;
|
|
97
|
-
};
|
|
98
|
-
user: {
|
|
99
|
-
$ref: string;
|
|
100
|
-
};
|
|
29
|
+
signInGuestList: better_auth.StrictEndpoint<"/sign-in/guest-list", {
|
|
30
|
+
method: "POST";
|
|
31
|
+
body: z.ZodMiniObject<{
|
|
32
|
+
name: z.ZodMiniString<string>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
metadata: {
|
|
35
|
+
openapi: {
|
|
36
|
+
description: string;
|
|
37
|
+
responses: {
|
|
38
|
+
200: {
|
|
39
|
+
description: string;
|
|
40
|
+
content: {
|
|
41
|
+
"application/json": {
|
|
42
|
+
schema: {
|
|
43
|
+
type: "object";
|
|
44
|
+
properties: {
|
|
45
|
+
token: {
|
|
46
|
+
type: string;
|
|
47
|
+
description: string;
|
|
48
|
+
};
|
|
49
|
+
user: {
|
|
50
|
+
$ref: string;
|
|
101
51
|
};
|
|
102
|
-
required: string[];
|
|
103
52
|
};
|
|
53
|
+
required: string[];
|
|
104
54
|
};
|
|
105
55
|
};
|
|
106
56
|
};
|
|
107
57
|
};
|
|
108
58
|
};
|
|
109
59
|
};
|
|
110
|
-
} & {
|
|
111
|
-
use: any[];
|
|
112
60
|
};
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
} : string[]>;
|
|
140
|
-
options: {
|
|
141
|
-
method: "GET";
|
|
142
|
-
metadata: {
|
|
143
|
-
openapi: {
|
|
144
|
-
description: string;
|
|
145
|
-
responses: {
|
|
146
|
-
200: {
|
|
147
|
-
description: string;
|
|
148
|
-
content: {
|
|
149
|
-
"application/json": {
|
|
150
|
-
schema: {
|
|
151
|
-
type: "array";
|
|
152
|
-
items: {
|
|
153
|
-
type: string;
|
|
154
|
-
};
|
|
61
|
+
}, {
|
|
62
|
+
token: string;
|
|
63
|
+
user: {
|
|
64
|
+
id: string;
|
|
65
|
+
createdAt: Date;
|
|
66
|
+
updatedAt: Date;
|
|
67
|
+
email: string;
|
|
68
|
+
emailVerified: boolean;
|
|
69
|
+
name: string;
|
|
70
|
+
image?: string | null | undefined;
|
|
71
|
+
};
|
|
72
|
+
} | null>;
|
|
73
|
+
revealGuestList: better_auth.StrictEndpoint<"/sign-in/guest-list/reveal", {
|
|
74
|
+
method: "GET";
|
|
75
|
+
metadata: {
|
|
76
|
+
openapi: {
|
|
77
|
+
description: string;
|
|
78
|
+
responses: {
|
|
79
|
+
200: {
|
|
80
|
+
description: string;
|
|
81
|
+
content: {
|
|
82
|
+
"application/json": {
|
|
83
|
+
schema: {
|
|
84
|
+
type: "array";
|
|
85
|
+
items: {
|
|
86
|
+
type: string;
|
|
155
87
|
};
|
|
156
88
|
};
|
|
157
89
|
};
|
|
@@ -159,11 +91,8 @@ declare const guestList: (options?: GuestListOptions) => {
|
|
|
159
91
|
};
|
|
160
92
|
};
|
|
161
93
|
};
|
|
162
|
-
} & {
|
|
163
|
-
use: any[];
|
|
164
94
|
};
|
|
165
|
-
|
|
166
|
-
};
|
|
95
|
+
}, string[]>;
|
|
167
96
|
};
|
|
168
97
|
$ERROR_CODES: {
|
|
169
98
|
readonly NAME_NOT_PROVIDED: "Guest name not provided";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as better_auth from 'better-auth';
|
|
2
|
-
import
|
|
2
|
+
import * as z from 'zod/mini';
|
|
3
3
|
|
|
4
4
|
type GuestWithRole = {
|
|
5
5
|
name: string;
|
|
@@ -26,132 +26,64 @@ interface GuestListOptions {
|
|
|
26
26
|
declare const guestList: (options?: GuestListOptions) => {
|
|
27
27
|
id: "guest-list";
|
|
28
28
|
endpoints: {
|
|
29
|
-
signInGuestList: {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
returnHeaders?: ReturnHeaders | undefined;
|
|
52
|
-
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
53
|
-
headers: Headers;
|
|
54
|
-
response: {
|
|
55
|
-
token: string;
|
|
56
|
-
user: {
|
|
57
|
-
id: string;
|
|
58
|
-
name: string;
|
|
59
|
-
emailVerified: boolean;
|
|
60
|
-
email: string;
|
|
61
|
-
createdAt: Date;
|
|
62
|
-
updatedAt: Date;
|
|
63
|
-
image?: string | null | undefined;
|
|
64
|
-
};
|
|
65
|
-
} | null;
|
|
66
|
-
} : {
|
|
67
|
-
token: string;
|
|
68
|
-
user: {
|
|
69
|
-
id: string;
|
|
70
|
-
name: string;
|
|
71
|
-
emailVerified: boolean;
|
|
72
|
-
email: string;
|
|
73
|
-
createdAt: Date;
|
|
74
|
-
updatedAt: Date;
|
|
75
|
-
image?: string | null | undefined;
|
|
76
|
-
};
|
|
77
|
-
} | null>;
|
|
78
|
-
options: {
|
|
79
|
-
method: "POST";
|
|
80
|
-
body: z.ZodMiniObject<{
|
|
81
|
-
name: z.ZodMiniString<string>;
|
|
82
|
-
}, z.core.$strip>;
|
|
83
|
-
metadata: {
|
|
84
|
-
openapi: {
|
|
85
|
-
description: string;
|
|
86
|
-
responses: {
|
|
87
|
-
200: {
|
|
88
|
-
description: string;
|
|
89
|
-
content: {
|
|
90
|
-
"application/json": {
|
|
91
|
-
schema: {
|
|
92
|
-
type: "object";
|
|
93
|
-
properties: {
|
|
94
|
-
token: {
|
|
95
|
-
type: string;
|
|
96
|
-
description: string;
|
|
97
|
-
};
|
|
98
|
-
user: {
|
|
99
|
-
$ref: string;
|
|
100
|
-
};
|
|
29
|
+
signInGuestList: better_auth.StrictEndpoint<"/sign-in/guest-list", {
|
|
30
|
+
method: "POST";
|
|
31
|
+
body: z.ZodMiniObject<{
|
|
32
|
+
name: z.ZodMiniString<string>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
metadata: {
|
|
35
|
+
openapi: {
|
|
36
|
+
description: string;
|
|
37
|
+
responses: {
|
|
38
|
+
200: {
|
|
39
|
+
description: string;
|
|
40
|
+
content: {
|
|
41
|
+
"application/json": {
|
|
42
|
+
schema: {
|
|
43
|
+
type: "object";
|
|
44
|
+
properties: {
|
|
45
|
+
token: {
|
|
46
|
+
type: string;
|
|
47
|
+
description: string;
|
|
48
|
+
};
|
|
49
|
+
user: {
|
|
50
|
+
$ref: string;
|
|
101
51
|
};
|
|
102
|
-
required: string[];
|
|
103
52
|
};
|
|
53
|
+
required: string[];
|
|
104
54
|
};
|
|
105
55
|
};
|
|
106
56
|
};
|
|
107
57
|
};
|
|
108
58
|
};
|
|
109
59
|
};
|
|
110
|
-
} & {
|
|
111
|
-
use: any[];
|
|
112
60
|
};
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
} : string[]>;
|
|
140
|
-
options: {
|
|
141
|
-
method: "GET";
|
|
142
|
-
metadata: {
|
|
143
|
-
openapi: {
|
|
144
|
-
description: string;
|
|
145
|
-
responses: {
|
|
146
|
-
200: {
|
|
147
|
-
description: string;
|
|
148
|
-
content: {
|
|
149
|
-
"application/json": {
|
|
150
|
-
schema: {
|
|
151
|
-
type: "array";
|
|
152
|
-
items: {
|
|
153
|
-
type: string;
|
|
154
|
-
};
|
|
61
|
+
}, {
|
|
62
|
+
token: string;
|
|
63
|
+
user: {
|
|
64
|
+
id: string;
|
|
65
|
+
createdAt: Date;
|
|
66
|
+
updatedAt: Date;
|
|
67
|
+
email: string;
|
|
68
|
+
emailVerified: boolean;
|
|
69
|
+
name: string;
|
|
70
|
+
image?: string | null | undefined;
|
|
71
|
+
};
|
|
72
|
+
} | null>;
|
|
73
|
+
revealGuestList: better_auth.StrictEndpoint<"/sign-in/guest-list/reveal", {
|
|
74
|
+
method: "GET";
|
|
75
|
+
metadata: {
|
|
76
|
+
openapi: {
|
|
77
|
+
description: string;
|
|
78
|
+
responses: {
|
|
79
|
+
200: {
|
|
80
|
+
description: string;
|
|
81
|
+
content: {
|
|
82
|
+
"application/json": {
|
|
83
|
+
schema: {
|
|
84
|
+
type: "array";
|
|
85
|
+
items: {
|
|
86
|
+
type: string;
|
|
155
87
|
};
|
|
156
88
|
};
|
|
157
89
|
};
|
|
@@ -159,11 +91,8 @@ declare const guestList: (options?: GuestListOptions) => {
|
|
|
159
91
|
};
|
|
160
92
|
};
|
|
161
93
|
};
|
|
162
|
-
} & {
|
|
163
|
-
use: any[];
|
|
164
94
|
};
|
|
165
|
-
|
|
166
|
-
};
|
|
95
|
+
}, string[]>;
|
|
167
96
|
};
|
|
168
97
|
$ERROR_CODES: {
|
|
169
98
|
readonly NAME_NOT_PROVIDED: "Guest name not provided";
|
package/dist/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ var guestListClient = () => {
|
|
|
9
9
|
// src/server.ts
|
|
10
10
|
import { APIError, createAuthEndpoint } from "better-auth/api";
|
|
11
11
|
import { setSessionCookie } from "better-auth/cookies";
|
|
12
|
-
import
|
|
12
|
+
import * as z from "zod/mini";
|
|
13
13
|
|
|
14
14
|
// src/utils.ts
|
|
15
15
|
import { capitalize } from "lodash-es";
|
|
@@ -116,8 +116,7 @@ var guestList = (options) => {
|
|
|
116
116
|
role: guestLookup[cleanedName].role,
|
|
117
117
|
createdAt: /* @__PURE__ */ new Date(),
|
|
118
118
|
updatedAt: /* @__PURE__ */ new Date()
|
|
119
|
-
}
|
|
120
|
-
ctx
|
|
119
|
+
}
|
|
121
120
|
);
|
|
122
121
|
if (!newUser) {
|
|
123
122
|
throw ctx.error("INTERNAL_SERVER_ERROR", {
|
|
@@ -127,7 +126,7 @@ var guestList = (options) => {
|
|
|
127
126
|
return newUser;
|
|
128
127
|
}
|
|
129
128
|
const user = found ? found.user : await createNewUser();
|
|
130
|
-
const session = await ctx.context.internalAdapter.createSession(user.id,
|
|
129
|
+
const session = await ctx.context.internalAdapter.createSession(user.id, true);
|
|
131
130
|
if (!session) {
|
|
132
131
|
return ctx.json(null, {
|
|
133
132
|
status: 400,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nerdfolio/ba-guest-list",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
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,14 +29,14 @@
|
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/lodash-es": "^4.17.12",
|
|
32
|
-
"better-auth": "1.
|
|
32
|
+
"better-auth": "^1.4.9"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"better-auth": "1.
|
|
35
|
+
"better-auth": "^1.4.9"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"lodash-es": "^4.17.
|
|
39
|
-
"zod": "^
|
|
38
|
+
"lodash-es": "^4.17.22",
|
|
39
|
+
"zod": "^4.2.1"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"test": "echo \"Error: no test specified\" && exit 1",
|