@vestcards/server-types 0.1.0
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/apps/server/src/app.d.ts +758 -0
- package/dist/apps/server/src/config/cors.d.ts +2 -0
- package/dist/apps/server/src/config/env.d.ts +12 -0
- package/dist/apps/server/src/config/redis.d.ts +2 -0
- package/dist/apps/server/src/db/index.d.ts +6 -0
- package/dist/apps/server/src/db/schema/auth.d.ts +841 -0
- package/dist/apps/server/src/db/schema/data.d.ts +99 -0
- package/dist/apps/server/src/db/schema/deck.d.ts +1208 -0
- package/dist/apps/server/src/db/schema/entity.d.ts +48 -0
- package/dist/apps/server/src/db/schema/index.d.ts +6 -0
- package/dist/apps/server/src/db/schema/marketing.d.ts +112 -0
- package/dist/apps/server/src/db/schema/payment.d.ts +548 -0
- package/dist/apps/server/src/db/types.d.ts +2 -0
- package/dist/apps/server/src/db/utils.d.ts +8 -0
- package/dist/apps/server/src/index.d.ts +2 -0
- package/dist/apps/server/src/middleware/errorHandler.d.ts +16 -0
- package/dist/apps/server/src/middleware/logger.d.ts +29 -0
- package/dist/apps/server/src/modules/auth/auth.test.d.ts +1 -0
- package/dist/apps/server/src/modules/auth/index.d.ts +358 -0
- package/dist/apps/server/src/modules/auth/lib.d.ts +324 -0
- package/dist/apps/server/src/modules/auth/permissions/entitlements.d.ts +2 -0
- package/dist/apps/server/src/modules/auth/permissions/permissions.d.ts +60 -0
- package/dist/apps/server/src/modules/auth/utils.d.ts +8 -0
- package/dist/apps/server/src/modules/deck/deck.test.d.ts +1 -0
- package/dist/apps/server/src/modules/deck/index.d.ts +473 -0
- package/dist/apps/server/src/modules/deck/model.d.ts +31 -0
- package/dist/apps/server/src/modules/deck/service.d.ts +7 -0
- package/dist/apps/server/src/modules/lead/index.d.ts +95 -0
- package/dist/apps/server/src/modules/lead/lead.test.d.ts +1 -0
- package/dist/apps/server/src/modules/lead/model.d.ts +9 -0
- package/dist/apps/server/src/modules/lead/service.d.ts +19 -0
- package/dist/apps/server/src/modules/study/index.d.ts +513 -0
- package/dist/apps/server/src/modules/study/lib/constants.d.ts +5 -0
- package/dist/apps/server/src/modules/study/lib/fsrs.d.ts +12 -0
- package/dist/apps/server/src/modules/study/model.d.ts +14 -0
- package/dist/apps/server/src/modules/study/service.d.ts +13 -0
- package/dist/apps/server/src/modules/study/study.test.d.ts +1 -0
- package/dist/apps/server/src/modules/study/utils.d.ts +14 -0
- package/dist/apps/server/src/modules/topic/index.d.ts +429 -0
- package/dist/apps/server/src/modules/topic/model.d.ts +16 -0
- package/dist/apps/server/src/modules/topic/service.d.ts +6 -0
- package/dist/apps/server/src/modules/topic/topic.test.d.ts +1 -0
- package/dist/apps/server/src/modules/user/index.d.ts +380 -0
- package/dist/apps/server/src/modules/user/model.d.ts +16 -0
- package/dist/apps/server/src/modules/user/service.d.ts +3 -0
- package/dist/apps/server/src/server.d.ts +1 -0
- package/dist/apps/server/src/tests/api.test.d.ts +1 -0
- package/dist/apps/server/src/tests/helpers/auth-helpers.d.ts +55 -0
- package/dist/apps/server/src/tests/helpers/fixtures.d.ts +144 -0
- package/dist/apps/server/src/tests/helpers/http-helpers.d.ts +33 -0
- package/dist/apps/server/src/tests/helpers/index.d.ts +3 -0
- package/dist/apps/server/src/types/study.d.ts +28 -0
- package/dist/apps/server/src/types/topic.d.ts +1 -0
- package/dist/apps/server/src/utils/alias.d.ts +631 -0
- package/dist/apps/server/src/utils/api.d.ts +31 -0
- package/dist/apps/server/src/utils/errors.d.ts +26 -0
- package/dist/apps/server/src/utils/select.d.ts +373 -0
- package/dist/apps/server/src/utils/uuid.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/packages/email-core/src/emailProvider.d.ts +24 -0
- package/dist/packages/email-core/src/emailTemplateBuilder.d.ts +4 -0
- package/dist/packages/email-core/src/templates/accountDeletion.d.ts +7 -0
- package/dist/packages/email-core/src/templates/adminPurchaseAlert.d.ts +10 -0
- package/dist/packages/email-core/src/templates/cardDemand.d.ts +8 -0
- package/dist/packages/email-core/src/templates/cardDemandAction.d.ts +9 -0
- package/dist/packages/email-core/src/templates/emailVerification.d.ts +7 -0
- package/dist/packages/email-core/src/templates/footer.d.ts +1 -0
- package/dist/packages/email-core/src/templates/forgotPassword.d.ts +7 -0
- package/dist/packages/email-core/src/templates/index.d.ts +28 -0
- package/dist/packages/email-core/src/templates/purchaseConfirmation.d.ts +9 -0
- package/dist/packages/email-core/src/templates/purchasePrePayment.d.ts +9 -0
- package/dist/packages/email-core/src/templates/purchaseRefund.d.ts +7 -0
- package/dist/packages/shared/src/date/constants.d.ts +2 -0
- package/dist/packages/shared/src/date/fns.d.ts +8 -0
- package/dist/packages/shared/src/date/format.d.ts +9 -0
- package/dist/packages/shared/src/date/helpers.d.ts +2 -0
- package/dist/packages/shared/src/date/index.d.ts +14 -0
- package/dist/packages/shared/src/date/relative.d.ts +19 -0
- package/dist/packages/shared/src/date/types.d.ts +1 -0
- package/dist/packages/shared/src/index.d.ts +5 -0
- package/dist/packages/shared/src/types/deck.d.ts +48 -0
- package/dist/packages/shared/src/types/study.d.ts +15 -0
- package/dist/packages/shared/src/types/subject.d.ts +8 -0
- package/dist/packages/shared/src/types/topic.d.ts +7 -0
- package/dist/packages/shared/src/types/user.d.ts +22 -0
- package/dist/packages/utils/src/env/index.d.ts +1 -0
- package/dist/packages/utils/src/logger/index.d.ts +2 -0
- package/dist/packages/utils/src/logger/logger.d.ts +2 -0
- package/package.json +25 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { type BetterAuthOptions } from 'better-auth';
|
|
2
|
+
import { UserRole } from '../../db';
|
|
3
|
+
import { generateId } from '../../utils/uuid';
|
|
4
|
+
export declare const auth: import("better-auth").Auth<{
|
|
5
|
+
plugins: [{
|
|
6
|
+
id: "open-api";
|
|
7
|
+
endpoints: {
|
|
8
|
+
generateOpenAPISchema: import("better-call").StrictEndpoint<"/open-api/generate-schema", {
|
|
9
|
+
method: "GET";
|
|
10
|
+
}, {
|
|
11
|
+
openapi: string;
|
|
12
|
+
info: {
|
|
13
|
+
title: string;
|
|
14
|
+
description: string;
|
|
15
|
+
version: string;
|
|
16
|
+
};
|
|
17
|
+
components: {
|
|
18
|
+
securitySchemes: {
|
|
19
|
+
apiKeyCookie: {
|
|
20
|
+
type: string;
|
|
21
|
+
in: string;
|
|
22
|
+
name: string;
|
|
23
|
+
description: string;
|
|
24
|
+
};
|
|
25
|
+
bearerAuth: {
|
|
26
|
+
type: string;
|
|
27
|
+
scheme: string;
|
|
28
|
+
description: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
schemas: {
|
|
32
|
+
[x: string]: import("better-auth/plugins").OpenAPIModelSchema;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
security: {
|
|
36
|
+
apiKeyCookie: never[];
|
|
37
|
+
bearerAuth: never[];
|
|
38
|
+
}[];
|
|
39
|
+
servers: {
|
|
40
|
+
url: string;
|
|
41
|
+
}[];
|
|
42
|
+
tags: {
|
|
43
|
+
name: string;
|
|
44
|
+
description: string;
|
|
45
|
+
}[];
|
|
46
|
+
paths: Record<string, import("better-auth/plugins").Path>;
|
|
47
|
+
}>;
|
|
48
|
+
openAPIReference: import("better-call").StrictEndpoint<"/reference", {
|
|
49
|
+
method: "GET";
|
|
50
|
+
metadata: {
|
|
51
|
+
readonly scope: "server";
|
|
52
|
+
};
|
|
53
|
+
}, Response>;
|
|
54
|
+
};
|
|
55
|
+
options: NoInfer<import("better-auth/plugins").OpenAPIOptions>;
|
|
56
|
+
}, {
|
|
57
|
+
id: "expo";
|
|
58
|
+
init: (ctx: import("better-auth").AuthContext) => {
|
|
59
|
+
options: {
|
|
60
|
+
trustedOrigins: string[];
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
onRequest(request: Request, ctx: import("better-auth").AuthContext): Promise<{
|
|
64
|
+
request: Request;
|
|
65
|
+
} | undefined>;
|
|
66
|
+
hooks: {
|
|
67
|
+
after: {
|
|
68
|
+
matcher(context: import("better-auth").HookEndpointContext): boolean;
|
|
69
|
+
handler: (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<void>;
|
|
70
|
+
}[];
|
|
71
|
+
};
|
|
72
|
+
endpoints: {
|
|
73
|
+
expoAuthorizationProxy: import("better-call").StrictEndpoint<"/expo-authorization-proxy", {
|
|
74
|
+
method: "GET";
|
|
75
|
+
query: import("better-auth").ZodObject<{
|
|
76
|
+
authorizationURL: import("better-auth").ZodString;
|
|
77
|
+
oauthState: import("better-auth").ZodOptional<import("better-auth").ZodString>;
|
|
78
|
+
}, import("better-auth").$strip>;
|
|
79
|
+
metadata: {
|
|
80
|
+
readonly scope: "server";
|
|
81
|
+
};
|
|
82
|
+
}, {
|
|
83
|
+
status: ("OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "BAD_REQUEST" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "CONFLICT" | "GONE" | "LENGTH_REQUIRED" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "URI_TOO_LONG" | "UNSUPPORTED_MEDIA_TYPE" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "TOO_MANY_REQUESTS" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED") | import("better-call").Status;
|
|
84
|
+
body: ({
|
|
85
|
+
message?: string;
|
|
86
|
+
code?: string;
|
|
87
|
+
cause?: unknown;
|
|
88
|
+
} & Record<string, any>) | undefined;
|
|
89
|
+
headers: HeadersInit;
|
|
90
|
+
statusCode: number;
|
|
91
|
+
name: string;
|
|
92
|
+
message: string;
|
|
93
|
+
stack?: string;
|
|
94
|
+
cause?: unknown;
|
|
95
|
+
}>;
|
|
96
|
+
};
|
|
97
|
+
options: import("@better-auth/expo").ExpoOptions | undefined;
|
|
98
|
+
}, {
|
|
99
|
+
id: "custom-session";
|
|
100
|
+
hooks: {
|
|
101
|
+
after: {
|
|
102
|
+
matcher: (ctx: import("better-auth").HookEndpointContext) => boolean;
|
|
103
|
+
handler: (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
104
|
+
user: {
|
|
105
|
+
id: string;
|
|
106
|
+
createdAt: Date;
|
|
107
|
+
updatedAt: Date;
|
|
108
|
+
email: string;
|
|
109
|
+
emailVerified: boolean;
|
|
110
|
+
name: string;
|
|
111
|
+
image?: string | null | undefined;
|
|
112
|
+
role: UserRole;
|
|
113
|
+
entityId?: string | null | undefined;
|
|
114
|
+
surname?: string | null | undefined;
|
|
115
|
+
};
|
|
116
|
+
session: {
|
|
117
|
+
entitlements: import("@vestcards/shared").Entitlement[];
|
|
118
|
+
id: string;
|
|
119
|
+
createdAt: Date;
|
|
120
|
+
updatedAt: Date;
|
|
121
|
+
userId: string;
|
|
122
|
+
expiresAt: Date;
|
|
123
|
+
token: string;
|
|
124
|
+
ipAddress?: string | null | undefined;
|
|
125
|
+
userAgent?: string | null | undefined;
|
|
126
|
+
};
|
|
127
|
+
}[] | undefined>;
|
|
128
|
+
}[];
|
|
129
|
+
};
|
|
130
|
+
endpoints: {
|
|
131
|
+
getSession: import("better-call").StrictEndpoint<"/get-session", {
|
|
132
|
+
method: "GET";
|
|
133
|
+
query: import("better-auth").ZodOptional<import("better-auth").ZodObject<{
|
|
134
|
+
disableCookieCache: import("better-auth").ZodOptional<import("better-auth").ZodUnion<[import("better-auth").ZodBoolean, import("better-auth").ZodPipe<import("better-auth").ZodString, import("better-auth").ZodTransform<boolean, string>>]>>;
|
|
135
|
+
disableRefresh: import("better-auth").ZodOptional<import("better-auth").ZodBoolean>;
|
|
136
|
+
}, import("better-auth").$strip>>;
|
|
137
|
+
metadata: {
|
|
138
|
+
CUSTOM_SESSION: boolean;
|
|
139
|
+
openapi: {
|
|
140
|
+
description: string;
|
|
141
|
+
responses: {
|
|
142
|
+
"200": {
|
|
143
|
+
description: string;
|
|
144
|
+
content: {
|
|
145
|
+
"application/json": {
|
|
146
|
+
schema: {
|
|
147
|
+
type: "array";
|
|
148
|
+
nullable: boolean;
|
|
149
|
+
items: {
|
|
150
|
+
$ref: string;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
requireHeaders: true;
|
|
160
|
+
}, {
|
|
161
|
+
user: {
|
|
162
|
+
id: string;
|
|
163
|
+
createdAt: Date;
|
|
164
|
+
updatedAt: Date;
|
|
165
|
+
email: string;
|
|
166
|
+
emailVerified: boolean;
|
|
167
|
+
name: string;
|
|
168
|
+
image?: string | null | undefined;
|
|
169
|
+
role: UserRole;
|
|
170
|
+
entityId?: string | null | undefined;
|
|
171
|
+
surname?: string | null | undefined;
|
|
172
|
+
};
|
|
173
|
+
session: {
|
|
174
|
+
entitlements: import("@vestcards/shared").Entitlement[];
|
|
175
|
+
id: string;
|
|
176
|
+
createdAt: Date;
|
|
177
|
+
updatedAt: Date;
|
|
178
|
+
userId: string;
|
|
179
|
+
expiresAt: Date;
|
|
180
|
+
token: string;
|
|
181
|
+
ipAddress?: string | null | undefined;
|
|
182
|
+
userAgent?: string | null | undefined;
|
|
183
|
+
};
|
|
184
|
+
} | null>;
|
|
185
|
+
};
|
|
186
|
+
$Infer: {
|
|
187
|
+
Session: {
|
|
188
|
+
user: {
|
|
189
|
+
id: string;
|
|
190
|
+
createdAt: Date;
|
|
191
|
+
updatedAt: Date;
|
|
192
|
+
email: string;
|
|
193
|
+
emailVerified: boolean;
|
|
194
|
+
name: string;
|
|
195
|
+
image?: string | null | undefined;
|
|
196
|
+
role: UserRole;
|
|
197
|
+
entityId?: string | null | undefined;
|
|
198
|
+
surname?: string | null | undefined;
|
|
199
|
+
};
|
|
200
|
+
session: {
|
|
201
|
+
entitlements: import("@vestcards/shared").Entitlement[];
|
|
202
|
+
id: string;
|
|
203
|
+
createdAt: Date;
|
|
204
|
+
updatedAt: Date;
|
|
205
|
+
userId: string;
|
|
206
|
+
expiresAt: Date;
|
|
207
|
+
token: string;
|
|
208
|
+
ipAddress?: string | null | undefined;
|
|
209
|
+
userAgent?: string | null | undefined;
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
options: import("better-auth/plugins").CustomSessionPluginOptions | undefined;
|
|
214
|
+
}];
|
|
215
|
+
baseURL: string;
|
|
216
|
+
basePath: string;
|
|
217
|
+
database: (options: BetterAuthOptions) => import("better-auth").DBAdapter<BetterAuthOptions>;
|
|
218
|
+
secondaryStorage: import("better-auth").SecondaryStorage;
|
|
219
|
+
emailAndPassword: {
|
|
220
|
+
enabled: true;
|
|
221
|
+
autoSignIn: true;
|
|
222
|
+
requireEmailVerification: boolean;
|
|
223
|
+
minPasswordLength: number;
|
|
224
|
+
maxPasswordLength: number;
|
|
225
|
+
password: {
|
|
226
|
+
hash: (p: string) => Promise<string>;
|
|
227
|
+
verify: ({ password: p, hash }: {
|
|
228
|
+
hash: string;
|
|
229
|
+
password: string;
|
|
230
|
+
}) => Promise<boolean>;
|
|
231
|
+
};
|
|
232
|
+
sendResetPassword: ((data: {
|
|
233
|
+
user: import("better-auth").User;
|
|
234
|
+
url: string;
|
|
235
|
+
token: string;
|
|
236
|
+
}, request?: Request) => Promise<void>) | undefined;
|
|
237
|
+
};
|
|
238
|
+
emailVerification: {
|
|
239
|
+
sendOnSignUp: boolean;
|
|
240
|
+
sendVerificationEmail: ((data: {
|
|
241
|
+
user: import("better-auth").User;
|
|
242
|
+
url: string;
|
|
243
|
+
token: string;
|
|
244
|
+
}, request?: Request) => Promise<void>) | undefined;
|
|
245
|
+
};
|
|
246
|
+
session: {
|
|
247
|
+
expiresIn: number;
|
|
248
|
+
cookieCache: {
|
|
249
|
+
enabled: true;
|
|
250
|
+
maxAge: number;
|
|
251
|
+
};
|
|
252
|
+
additionalFields: {
|
|
253
|
+
entitlements: {
|
|
254
|
+
type: "string[]";
|
|
255
|
+
required: false;
|
|
256
|
+
defaultValue: never[];
|
|
257
|
+
};
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
socialProviders: {
|
|
261
|
+
google: {
|
|
262
|
+
clientId: string;
|
|
263
|
+
clientSecret: string;
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
user: {
|
|
267
|
+
additionalFields: {
|
|
268
|
+
surname: {
|
|
269
|
+
type: "string";
|
|
270
|
+
required: false;
|
|
271
|
+
input: true;
|
|
272
|
+
};
|
|
273
|
+
role: {
|
|
274
|
+
type: UserRole[];
|
|
275
|
+
required: true;
|
|
276
|
+
defaultValue: UserRole;
|
|
277
|
+
};
|
|
278
|
+
entityId: {
|
|
279
|
+
type: "string";
|
|
280
|
+
required: false;
|
|
281
|
+
input: true;
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
databaseHooks: {
|
|
286
|
+
user: {
|
|
287
|
+
create: {
|
|
288
|
+
before: (user: {
|
|
289
|
+
id: string;
|
|
290
|
+
createdAt: Date;
|
|
291
|
+
updatedAt: Date;
|
|
292
|
+
email: string;
|
|
293
|
+
emailVerified: boolean;
|
|
294
|
+
name: string;
|
|
295
|
+
image?: string | null | undefined;
|
|
296
|
+
} & Record<string, unknown>) => Promise<{
|
|
297
|
+
data: {
|
|
298
|
+
entityId: string;
|
|
299
|
+
id: string;
|
|
300
|
+
createdAt: Date;
|
|
301
|
+
updatedAt: Date;
|
|
302
|
+
email: string;
|
|
303
|
+
emailVerified: boolean;
|
|
304
|
+
name: string;
|
|
305
|
+
image?: string | null | undefined;
|
|
306
|
+
};
|
|
307
|
+
}>;
|
|
308
|
+
};
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
logger: {
|
|
312
|
+
log(level: "error" | "warn" | "info" | "debug", message: string, ...args: any[]): void;
|
|
313
|
+
};
|
|
314
|
+
advanced: {
|
|
315
|
+
useSecureCookies: boolean;
|
|
316
|
+
disableOriginCheck: true;
|
|
317
|
+
cookiePrefix: string;
|
|
318
|
+
database: {
|
|
319
|
+
generateId: typeof generateId;
|
|
320
|
+
};
|
|
321
|
+
};
|
|
322
|
+
trustedOrigins: string[];
|
|
323
|
+
}>;
|
|
324
|
+
export type Auth = typeof auth;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Entitlement, UserRole } from '@vestcards-server/db';
|
|
2
|
+
declare const PERMISSIONS: {
|
|
3
|
+
readonly DECK: {
|
|
4
|
+
readonly CREATE_OWN: "deck:create:own";
|
|
5
|
+
readonly CREATE_PUBLIC: "deck:create:public";
|
|
6
|
+
readonly READ_OWN: "deck:read:own";
|
|
7
|
+
readonly READ_FREE: "deck:read:free";
|
|
8
|
+
readonly READ_PREMIUM: "deck:read:premium";
|
|
9
|
+
readonly UPDATE_OWN: "deck:update:own";
|
|
10
|
+
readonly UPDATE_PUBLIC: "deck:update:public";
|
|
11
|
+
readonly DELETE_OWN: "deck:delete:own";
|
|
12
|
+
readonly DELETE_PUBLIC: "deck:delete:public";
|
|
13
|
+
};
|
|
14
|
+
readonly CARD_DEMAND: {
|
|
15
|
+
readonly READ: "card-demand:read";
|
|
16
|
+
readonly CREATE: "card-demand:create";
|
|
17
|
+
readonly ACTION: "card-demand:action";
|
|
18
|
+
};
|
|
19
|
+
readonly USER: {
|
|
20
|
+
readonly UPDATE_OWN: "user:update:own";
|
|
21
|
+
readonly UPDATE_ALL: "user:update:*";
|
|
22
|
+
readonly DELETE_OWN: "user:delete:own";
|
|
23
|
+
readonly DELETE_ALL: "user:delete:*";
|
|
24
|
+
readonly READ_OWN: "user:read:own";
|
|
25
|
+
readonly READ_ALL: "user:read:*";
|
|
26
|
+
};
|
|
27
|
+
readonly STATS: {
|
|
28
|
+
readonly VIEW: "stats:view";
|
|
29
|
+
};
|
|
30
|
+
readonly MEMBERSHIP: {
|
|
31
|
+
readonly MANAGE: "membership:manage";
|
|
32
|
+
};
|
|
33
|
+
readonly PLAN: {
|
|
34
|
+
readonly CREATE: "plan:create";
|
|
35
|
+
readonly UPDATE: "plan:update";
|
|
36
|
+
readonly DELETE: "plan:delete";
|
|
37
|
+
};
|
|
38
|
+
readonly BLOGPOST: {
|
|
39
|
+
readonly CREATE: "blogpost:create";
|
|
40
|
+
readonly UPDATE: "blogpost:update";
|
|
41
|
+
readonly DELETE: "blogpost:delete";
|
|
42
|
+
};
|
|
43
|
+
readonly VESTY: {
|
|
44
|
+
readonly CHAT: "vesty:chat";
|
|
45
|
+
};
|
|
46
|
+
readonly STUDY: {
|
|
47
|
+
readonly READ: "study:read";
|
|
48
|
+
readonly WRITE: "study:write";
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
declare const ALL_PERMISSIONS: ("deck:create:own" | "deck:create:public" | "deck:read:own" | "deck:read:free" | "deck:read:premium" | "deck:update:own" | "deck:update:public" | "deck:delete:own" | "deck:delete:public" | "card-demand:read" | "card-demand:create" | "card-demand:action" | "user:update:own" | "user:update:*" | "user:delete:own" | "user:delete:*" | "user:read:own" | "user:read:*" | "stats:view" | "membership:manage" | "plan:create" | "plan:update" | "plan:delete" | "blogpost:create" | "blogpost:update" | "blogpost:delete" | "vesty:chat" | "study:read" | "study:write")[];
|
|
52
|
+
declare const ROLE_PERMISSIONS: Record<UserRole, Permission[]>;
|
|
53
|
+
declare const ENTITLEMENT_PERMISSIONS: Record<Entitlement, Permission[]>;
|
|
54
|
+
type ValueOf<T> = T[keyof T];
|
|
55
|
+
type Permission = ValueOf<{
|
|
56
|
+
[K in keyof typeof PERMISSIONS]: ValueOf<(typeof PERMISSIONS)[K]>;
|
|
57
|
+
}>;
|
|
58
|
+
declare const hasPermission: (required: Permission, userRole: UserRole, userEntitlements?: Entitlement[]) => boolean;
|
|
59
|
+
export { ALL_PERMISSIONS, ENTITLEMENT_PERMISSIONS, hasPermission, PERMISSIONS, ROLE_PERMISSIONS };
|
|
60
|
+
export type { Permission };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BetterAuthOptions } from 'better-auth';
|
|
2
|
+
type SendVerificationEmail = NonNullable<BetterAuthOptions['emailVerification']>['sendVerificationEmail'];
|
|
3
|
+
export declare const sendVerificationEmail: SendVerificationEmail;
|
|
4
|
+
type SendResetPassword = NonNullable<BetterAuthOptions['emailAndPassword']>['sendResetPassword'];
|
|
5
|
+
export declare const sendForgotPasswordEmail: SendResetPassword;
|
|
6
|
+
type SecondaryStorage = NonNullable<BetterAuthOptions['secondaryStorage']>;
|
|
7
|
+
export declare const secondaryStorage: SecondaryStorage;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|