sentri 5.0.1 → 5.0.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/README.md +4 -1
- package/dist/adapters/elysia/index.cjs +1 -1
- package/dist/adapters/elysia/index.d.cts +3 -2
- package/dist/adapters/elysia/index.d.ts +3 -2
- package/dist/adapters/elysia/index.js +1 -1
- package/dist/adapters/express/index.cjs +1 -1
- package/dist/adapters/express/index.d.cts +3 -2
- package/dist/adapters/express/index.d.ts +3 -2
- package/dist/adapters/express/index.js +1 -1
- package/dist/adapters/fastify/index.cjs +1 -1
- package/dist/adapters/fastify/index.d.cts +3 -2
- package/dist/adapters/fastify/index.d.ts +3 -2
- package/dist/adapters/fastify/index.js +1 -1
- package/dist/adapters/hono/index.cjs +1 -1
- package/dist/adapters/hono/index.d.cts +3 -2
- package/dist/adapters/hono/index.d.ts +3 -2
- package/dist/adapters/hono/index.js +1 -1
- package/dist/adapters/koa/index.cjs +1 -1
- package/dist/adapters/koa/index.d.cts +3 -2
- package/dist/adapters/koa/index.d.ts +3 -2
- package/dist/adapters/koa/index.js +1 -1
- package/dist/cli.cjs +9 -0
- package/dist/cli.js +9 -0
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.cts +2 -375
- package/dist/core/index.d.ts +2 -375
- package/dist/core/index.js +1 -1
- package/dist/index-CVb3-EnK.d.cts +386 -0
- package/dist/index-CVb3-EnK.d.ts +386 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import { Dialect } from 'kysely';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Discriminant codes for built-in {@link SentriError} instances.
|
|
5
|
+
*
|
|
6
|
+
* - `INVALID_CREDENTIALS` — identifier or password did not match (intentionally vague to prevent user enumeration)
|
|
7
|
+
* - `USER_NOT_FOUND` — an operation required a user that does not exist
|
|
8
|
+
* - `USER_ALREADY_EXISTS` — registration was attempted with an identifier already in the database
|
|
9
|
+
* - `IDENTIFIER_NOT_FOUND` — a referenced identifier ID does not exist or does not belong to the user
|
|
10
|
+
* - `IDENTIFIER_ALREADY_EXISTS` — the identifier value is already taken by another user
|
|
11
|
+
* - `TOKEN_EXPIRED` — the JWT was valid but its `exp` claim is in the past
|
|
12
|
+
* - `TOKEN_INVALID` — the JWT could not be verified (bad signature, malformed, wrong type)
|
|
13
|
+
* - `FORBIDDEN` — the user is authenticated but lacks the required role
|
|
14
|
+
* - `UNAUTHORIZED` — no valid access token was present on the request, or the session was revoked
|
|
15
|
+
* - `INVALID_ROLE` — a role name was used that is not in `validRoles`
|
|
16
|
+
* - `VALIDATION_ERROR` — a required field was missing or had an invalid value
|
|
17
|
+
* - `RATE_LIMIT_EXCEEDED` — too many requests were made to an endpoint (e.g. login/register limit)
|
|
18
|
+
* - `CONFIGURATION_ERROR` — `createAuth` was called with an invalid configuration
|
|
19
|
+
*
|
|
20
|
+
* When you extend {@link SentriError} for your own error types you can use any
|
|
21
|
+
* string as `code` — it does not need to be one of these built-in values.
|
|
22
|
+
*/
|
|
23
|
+
type SentriErrorCode = 'INVALID_CREDENTIALS' | 'USER_NOT_FOUND' | 'USER_ALREADY_EXISTS' | 'IDENTIFIER_NOT_FOUND' | 'IDENTIFIER_ALREADY_EXISTS' | 'TOKEN_EXPIRED' | 'TOKEN_INVALID' | 'FORBIDDEN' | 'UNAUTHORIZED' | 'INVALID_ROLE' | 'VALIDATION_ERROR' | 'CONFIGURATION_ERROR' | 'TOKEN_REUSE' | 'RATE_LIMIT_EXCEEDED';
|
|
24
|
+
/**
|
|
25
|
+
* Default HTTP status codes for built-in error codes.
|
|
26
|
+
* Custom codes not in this map default to 500.
|
|
27
|
+
*
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
declare const SENTRI_ERROR_STATUS: Record<string, number>;
|
|
31
|
+
/**
|
|
32
|
+
* Base error class for all authentication and authorization failures in sentri.
|
|
33
|
+
*
|
|
34
|
+
* Every error thrown by sentri is an instance of `SentriError`. The `code`
|
|
35
|
+
* property is a machine-readable string that lets you distinguish error
|
|
36
|
+
* types without string-matching on the message. Built-in codes are listed
|
|
37
|
+
* in {@link SentriErrorCode}; custom subclasses may use any string.
|
|
38
|
+
*
|
|
39
|
+
* The `statusCode` property holds the HTTP status that the built-in router
|
|
40
|
+
* and `auth.errorHandler()` will use in the response. For built-in codes
|
|
41
|
+
* it is derived automatically. Pass it explicitly when subclassing with a
|
|
42
|
+
* custom code.
|
|
43
|
+
*
|
|
44
|
+
* ---
|
|
45
|
+
*
|
|
46
|
+
* **Extending SentriError**
|
|
47
|
+
*
|
|
48
|
+
* You can create application-specific error classes by extending `SentriError`.
|
|
49
|
+
* Any subclass will be caught automatically by `auth.errorHandler()` because
|
|
50
|
+
* `instanceof SentriError` is `true` for all subclasses.
|
|
51
|
+
*
|
|
52
|
+
* ```typescript
|
|
53
|
+
* import { SentriError } from 'sentri';
|
|
54
|
+
*
|
|
55
|
+
* export class PaymentError extends SentriError {
|
|
56
|
+
* constructor(message: string) {
|
|
57
|
+
* super('PAYMENT_FAILED', message, 402);
|
|
58
|
+
* }
|
|
59
|
+
* }
|
|
60
|
+
*
|
|
61
|
+
* router.post('/checkout', auth.protect(), async (req, res) => {
|
|
62
|
+
* const ok = await chargeCard(req.body.cardToken);
|
|
63
|
+
* if (!ok) throw new PaymentError('Card declined');
|
|
64
|
+
* res.json({ success: true });
|
|
65
|
+
* });
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* ---
|
|
69
|
+
*
|
|
70
|
+
* **Error handling in custom routes**
|
|
71
|
+
*
|
|
72
|
+
* ```typescript
|
|
73
|
+
* app.use('/auth', auth.router());
|
|
74
|
+
* app.use('/api', apiRouter);
|
|
75
|
+
*
|
|
76
|
+
* // Mount after all routes — catches SentriError from sentri AND your subclasses
|
|
77
|
+
* app.use(auth.errorHandler());
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
declare class SentriError extends Error {
|
|
81
|
+
/**
|
|
82
|
+
* Machine-readable error code.
|
|
83
|
+
* Built-in codes are defined by {@link SentriErrorCode}.
|
|
84
|
+
* Custom subclasses may use any string.
|
|
85
|
+
*/
|
|
86
|
+
readonly code: string;
|
|
87
|
+
/**
|
|
88
|
+
* HTTP status code associated with this error.
|
|
89
|
+
* Derived automatically for built-in codes; pass it explicitly when
|
|
90
|
+
* subclassing with a custom `code`.
|
|
91
|
+
*/
|
|
92
|
+
readonly statusCode: number;
|
|
93
|
+
constructor(code: SentriErrorCode | (string & {}), message: string, statusCode?: number);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Minimal structured logger interface accepted by Sentri.
|
|
98
|
+
*
|
|
99
|
+
* Compatible out-of-the-box with **pino**, **winston**, and **console** — all
|
|
100
|
+
* three expose `info`, `warn`, and `error` methods that accept an object argument.
|
|
101
|
+
*
|
|
102
|
+
* Pass an instance via `logger` in `ServerAuthConfig` or `ClientAuthConfig`.
|
|
103
|
+
* When omitted, Sentri produces no log output (no-op default).
|
|
104
|
+
*
|
|
105
|
+
* Each call receives a plain `Record<string, unknown>` containing structured
|
|
106
|
+
* fields — never a pre-formatted string — so your logger controls serialisation,
|
|
107
|
+
* output destination, and timestamp format.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* // pino
|
|
111
|
+
* import pino from 'pino';
|
|
112
|
+
* const auth = createAuth({ ..., logger: pino() });
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* // winston
|
|
116
|
+
* import winston from 'winston';
|
|
117
|
+
* const auth = createAuth({ ..., logger: winston.createLogger({ ... }) });
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* // console (zero setup, useful for development)
|
|
121
|
+
* const auth = createAuth({ ..., logger: console });
|
|
122
|
+
*/
|
|
123
|
+
interface SentriLogger {
|
|
124
|
+
info(data: Record<string, unknown>): void;
|
|
125
|
+
warn(data: Record<string, unknown>): void;
|
|
126
|
+
error(data: Record<string, unknown>): void;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Standardized API response format returned by Sentri endpoints.
|
|
131
|
+
* @template T - The type of the data payload.
|
|
132
|
+
*/
|
|
133
|
+
interface ApiResponse<T = null> {
|
|
134
|
+
error: boolean;
|
|
135
|
+
statusCode: number;
|
|
136
|
+
message: string;
|
|
137
|
+
data: T | null;
|
|
138
|
+
}
|
|
139
|
+
/** A single identifier entry belonging to a user. */
|
|
140
|
+
interface IdentifierRecord {
|
|
141
|
+
id: string;
|
|
142
|
+
type: string;
|
|
143
|
+
value: string;
|
|
144
|
+
}
|
|
145
|
+
/** The authenticated user shape embedded in JWT payloads and middleware context. */
|
|
146
|
+
interface AuthUser<TRole extends string = string> {
|
|
147
|
+
id: string;
|
|
148
|
+
roles: TRole[];
|
|
149
|
+
/** All identifiers for this user. Only present in full user responses, not in JWT. */
|
|
150
|
+
identifiers?: IdentifierRecord[];
|
|
151
|
+
}
|
|
152
|
+
/** Input for a single identifier entry. */
|
|
153
|
+
interface IdentifierInput {
|
|
154
|
+
/** Arbitrary label such as 'email', 'username', or 'phone'. */
|
|
155
|
+
type: string;
|
|
156
|
+
/** The globally unique identifier value. */
|
|
157
|
+
value: string;
|
|
158
|
+
}
|
|
159
|
+
/** Result returned after a successful or failed registration attempt. */
|
|
160
|
+
type RegisterResult<TRole extends string = string> = {
|
|
161
|
+
success: true;
|
|
162
|
+
user: AuthUser<TRole>;
|
|
163
|
+
} | {
|
|
164
|
+
success: false;
|
|
165
|
+
error: SentriError;
|
|
166
|
+
};
|
|
167
|
+
/** Result returned after a successful or failed login attempt. */
|
|
168
|
+
type AuthResult<TRole extends string = string> = {
|
|
169
|
+
success: true;
|
|
170
|
+
accessToken: string;
|
|
171
|
+
refreshToken: string;
|
|
172
|
+
user: AuthUser<TRole>;
|
|
173
|
+
} | {
|
|
174
|
+
success: false;
|
|
175
|
+
error: SentriError;
|
|
176
|
+
};
|
|
177
|
+
/** Result returned after assigning new roles to a user. */
|
|
178
|
+
type AssignRolesResult<TRole extends string = string> = {
|
|
179
|
+
success: true;
|
|
180
|
+
user: AuthUser<TRole>;
|
|
181
|
+
} | {
|
|
182
|
+
success: false;
|
|
183
|
+
error: SentriError;
|
|
184
|
+
};
|
|
185
|
+
/** Result returned when fetching a specific user's details. */
|
|
186
|
+
type GetUserResult<TRole extends string = string> = {
|
|
187
|
+
success: true;
|
|
188
|
+
user: AuthUser<TRole>;
|
|
189
|
+
} | {
|
|
190
|
+
success: false;
|
|
191
|
+
error: SentriError;
|
|
192
|
+
};
|
|
193
|
+
/** Result returned after bulk identifier operations (create/update/delete). */
|
|
194
|
+
type BulkIdentifiersResult = {
|
|
195
|
+
success: true;
|
|
196
|
+
identifiers: IdentifierRecord[];
|
|
197
|
+
} | {
|
|
198
|
+
success: false;
|
|
199
|
+
error: SentriError;
|
|
200
|
+
};
|
|
201
|
+
/** Result returned after changing a user's password. */
|
|
202
|
+
type ChangePasswordResult = {
|
|
203
|
+
success: true;
|
|
204
|
+
} | {
|
|
205
|
+
success: false;
|
|
206
|
+
error: SentriError;
|
|
207
|
+
};
|
|
208
|
+
/** Result returned after a successful or failed session refresh. */
|
|
209
|
+
type RefreshResult<TRole extends string = string> = {
|
|
210
|
+
success: true;
|
|
211
|
+
accessToken: string;
|
|
212
|
+
refreshToken: string;
|
|
213
|
+
user: AuthUser<TRole>;
|
|
214
|
+
} | {
|
|
215
|
+
success: false;
|
|
216
|
+
error: SentriError;
|
|
217
|
+
};
|
|
218
|
+
/** Input payload required for user registration. */
|
|
219
|
+
interface RegisterInput<TRole extends string = string> {
|
|
220
|
+
/** One or more identifiers for the new user. All values must be globally unique. */
|
|
221
|
+
identifiers: IdentifierInput[];
|
|
222
|
+
password: string;
|
|
223
|
+
roles?: TRole[];
|
|
224
|
+
}
|
|
225
|
+
/** Input payload required for user login. */
|
|
226
|
+
interface LoginInput {
|
|
227
|
+
/** Any of the user's identifier values — Sentri searches all types. */
|
|
228
|
+
identifier: string;
|
|
229
|
+
password: string;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Configuration options for the HTTP-only Refresh Token cookie.
|
|
233
|
+
*/
|
|
234
|
+
interface CookieConfig {
|
|
235
|
+
name?: string;
|
|
236
|
+
httpOnly?: boolean;
|
|
237
|
+
secure?: boolean;
|
|
238
|
+
sameSite?: 'strict' | 'lax' | 'none';
|
|
239
|
+
path?: string;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Configuration options for the Access Token cookie (if used).
|
|
243
|
+
*/
|
|
244
|
+
interface AccessCookieConfig {
|
|
245
|
+
name?: string;
|
|
246
|
+
secure?: boolean;
|
|
247
|
+
sameSite?: 'strict' | 'lax' | 'none';
|
|
248
|
+
path?: string;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Lifecycle hooks for injecting custom logic during authentication flows.
|
|
252
|
+
* Helpful for sending welcome emails, tracking analytics, or logging.
|
|
253
|
+
*/
|
|
254
|
+
interface AuthHooks {
|
|
255
|
+
onRegister?: (user: AuthUser) => void | Promise<void>;
|
|
256
|
+
onLoginSuccess?: (user: AuthUser, meta: {
|
|
257
|
+
ip: string;
|
|
258
|
+
userAgent: string;
|
|
259
|
+
}) => void | Promise<void>;
|
|
260
|
+
onLoginFailed?: (identifier: string, error: SentriError, meta: {
|
|
261
|
+
ip: string;
|
|
262
|
+
}) => void | Promise<void>;
|
|
263
|
+
onPasswordChanged?: (userId: string) => void | Promise<void>;
|
|
264
|
+
onLogout?: (userId: string) => void | Promise<void>;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Configuration for rate limiting login and registration endpoints.
|
|
268
|
+
* The default time window is 15 minutes.
|
|
269
|
+
*/
|
|
270
|
+
interface RateLimitOptions {
|
|
271
|
+
/** Maximum login attempts per IP within the 15-minute window. Default is 5. */
|
|
272
|
+
maxLoginAttempts?: number;
|
|
273
|
+
/** Maximum registration attempts per IP within the 15-minute window. Default is 5. */
|
|
274
|
+
maxRegisterAttempts?: number;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Optional overrides for the core router logic.
|
|
278
|
+
* Provide custom handler functions to completely replace default endpoints behaviors.
|
|
279
|
+
*/
|
|
280
|
+
interface RouterHandlers {
|
|
281
|
+
register?: (input: RegisterInput, meta: {
|
|
282
|
+
ip: string;
|
|
283
|
+
userAgent: string;
|
|
284
|
+
}) => Promise<RegisterResult>;
|
|
285
|
+
login?: (input: LoginInput, meta: {
|
|
286
|
+
ip: string;
|
|
287
|
+
userAgent: string;
|
|
288
|
+
}) => Promise<AuthResult>;
|
|
289
|
+
refresh?: (refreshToken: string, meta: {
|
|
290
|
+
ip: string;
|
|
291
|
+
userAgent: string;
|
|
292
|
+
}) => Promise<RefreshResult>;
|
|
293
|
+
logout?: (refreshToken: string | undefined) => Promise<void>;
|
|
294
|
+
logoutAll?: (userId: string) => Promise<void>;
|
|
295
|
+
getUser?: (userId: string) => Promise<GetUserResult>;
|
|
296
|
+
assignRoles?: (userId: string, roles: string[]) => Promise<AssignRolesResult>;
|
|
297
|
+
bulkCreateIdentifiers?: (userId: string, identifiers: IdentifierInput[]) => Promise<BulkIdentifiersResult>;
|
|
298
|
+
bulkUpdateIdentifiers?: (userId: string, updates: Array<{
|
|
299
|
+
id: string;
|
|
300
|
+
type: string;
|
|
301
|
+
value: string;
|
|
302
|
+
}>) => Promise<BulkIdentifiersResult>;
|
|
303
|
+
bulkDeleteIdentifiers?: (userId: string, ids: string[]) => Promise<BulkIdentifiersResult>;
|
|
304
|
+
changePassword?: (userId: string, currentPassword: string, newPassword: string) => Promise<ChangePasswordResult>;
|
|
305
|
+
getSessions?: (userId: string) => Promise<any>;
|
|
306
|
+
revokeSession?: (userId: string, sessionId: string) => Promise<void>;
|
|
307
|
+
}
|
|
308
|
+
interface ServerAuthConfig<TRole extends string = string> {
|
|
309
|
+
/** Indicates this configuration is for a Sentri Server instance. */
|
|
310
|
+
mode: 'server';
|
|
311
|
+
/** Kysely Dialect (e.g. PostgresDialect, MysqlDialect, SqliteDialect). */
|
|
312
|
+
dialect: Dialect;
|
|
313
|
+
/**
|
|
314
|
+
* JWT signing secret.
|
|
315
|
+
* - HS256/HS384/HS512: plain string, minimum 32 characters.
|
|
316
|
+
* - RS256/RS384/RS512: RSA private key in PEM format.
|
|
317
|
+
*/
|
|
318
|
+
secret: string;
|
|
319
|
+
/**
|
|
320
|
+
* JWT signing algorithm.
|
|
321
|
+
* Use RS256/RS384/RS512 to enable the GET /keys endpoint for SSO.
|
|
322
|
+
* @default 'HS256'
|
|
323
|
+
*/
|
|
324
|
+
algorithm?: 'HS256' | 'HS384' | 'HS512' | 'RS256' | 'RS384' | 'RS512';
|
|
325
|
+
/** List of valid roles accepted by the system during registration or role assignment. */
|
|
326
|
+
validRoles: readonly TRole[];
|
|
327
|
+
/** @default ['email', 'username'] */
|
|
328
|
+
validIdentifiers?: readonly string[];
|
|
329
|
+
/** @default '15m' */
|
|
330
|
+
accessExpiresIn?: string | number;
|
|
331
|
+
/** @default '7d' */
|
|
332
|
+
refreshExpiresIn?: string | number;
|
|
333
|
+
/** @default 12 */
|
|
334
|
+
saltRounds?: number;
|
|
335
|
+
/**
|
|
336
|
+
* Optional API Key required for protected endpoints (like bulk identifier operations).
|
|
337
|
+
*/
|
|
338
|
+
apiKey?: string;
|
|
339
|
+
cookie?: CookieConfig;
|
|
340
|
+
accessCookie?: AccessCookieConfig;
|
|
341
|
+
hooks?: AuthHooks;
|
|
342
|
+
router?: RouterHandlers;
|
|
343
|
+
isTokenRevoked?: (sessionId: string) => boolean | Promise<boolean>;
|
|
344
|
+
/**
|
|
345
|
+
* Rate limiting configuration for login and registration endpoints.
|
|
346
|
+
* Set to \`false\` to completely disable rate limiting.
|
|
347
|
+
* @default { maxLoginAttempts: 5, maxRegisterAttempts: 5 }
|
|
348
|
+
*/
|
|
349
|
+
rateLimit?: RateLimitOptions | boolean;
|
|
350
|
+
/**
|
|
351
|
+
* Redis connection URL (e.g. `redis://localhost:6379`).
|
|
352
|
+
* When set, `auth.idempotencyMiddleware()` uses Redis as the cache backend
|
|
353
|
+
* instead of an in-memory Map — required for multi-process deployments.
|
|
354
|
+
*/
|
|
355
|
+
redisUrl?: string;
|
|
356
|
+
/**
|
|
357
|
+
* Structured logger instance. Compatible with pino, winston, or console.
|
|
358
|
+
* When omitted, Sentri produces no log output.
|
|
359
|
+
*/
|
|
360
|
+
logger?: SentriLogger;
|
|
361
|
+
/**
|
|
362
|
+
* Service name embedded in every log entry.
|
|
363
|
+
* @default 'sentri'
|
|
364
|
+
*/
|
|
365
|
+
loggerService?: string;
|
|
366
|
+
}
|
|
367
|
+
interface ClientAuthConfig<TRole extends string = string> {
|
|
368
|
+
mode: 'client';
|
|
369
|
+
/** URL of the auth server's public key endpoint (e.g. https://auth.myapp.com/auth/keys). */
|
|
370
|
+
keyUri: string;
|
|
371
|
+
/** Optional — only needed for TypeScript type safety on authorize(). */
|
|
372
|
+
validRoles?: readonly TRole[];
|
|
373
|
+
/**
|
|
374
|
+
* Structured logger instance. Compatible with pino, winston, or console.
|
|
375
|
+
* When omitted, Sentri produces no log output.
|
|
376
|
+
*/
|
|
377
|
+
logger?: SentriLogger;
|
|
378
|
+
/**
|
|
379
|
+
* Service name embedded in every log entry.
|
|
380
|
+
* @default 'sentri'
|
|
381
|
+
*/
|
|
382
|
+
loggerService?: string;
|
|
383
|
+
}
|
|
384
|
+
type AuthConfig<TRole extends string = string> = ServerAuthConfig<TRole> | ClientAuthConfig<TRole>;
|
|
385
|
+
|
|
386
|
+
export { type AuthUser as A, type BulkIdentifiersResult as B, type CookieConfig as C, type GetUserResult as G, type IdentifierInput as I, type LoginInput as L, type RouterHandlers as R, type SentriLogger as S, type AuthConfig as a, type ServerAuthConfig as b, type AccessCookieConfig as c, type AuthHooks as d, type RateLimitOptions as e, type RegisterInput as f, type RegisterResult as g, type AuthResult as h, type RefreshResult as i, type ChangePasswordResult as j, type AssignRolesResult as k, SENTRI_ERROR_STATUS as l, SentriError as m, type ApiResponse as n, type ClientAuthConfig as o, type IdentifierRecord as p, type SentriErrorCode as q };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var t=Object.defineProperty;var
|
|
1
|
+
'use strict';var t=Object.defineProperty;var T=(I,E)=>t(I,"name",{value:E,configurable:true});var _=Object.assign(Object.create(null),{UNAUTHORIZED:401,TOKEN_EXPIRED:401,TOKEN_INVALID:401,INVALID_CREDENTIALS:401,FORBIDDEN:403,USER_NOT_FOUND:404,IDENTIFIER_NOT_FOUND:404,USER_ALREADY_EXISTS:409,IDENTIFIER_ALREADY_EXISTS:409,INVALID_ROLE:400,VALIDATION_ERROR:400,CONFIGURATION_ERROR:500,TOKEN_REUSE:401,RATE_LIMIT_EXCEEDED:429}),R=class extends Error{static{T(this,"SentriError");}code;statusCode;constructor(E,N,O){super(N),this.name="SentriError",this.code=E,this.statusCode=O??_[E]??500;}};exports.SENTRI_ERROR_STATUS=_;exports.SentriError=R;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { AccessCookieConfig, ApiResponse, AssignRolesResult, AuthConfig, AuthHooks, AuthResult, AuthUser, BulkIdentifiersResult, ChangePasswordResult, ClientAuthConfig, CookieConfig, GetUserResult, IdentifierInput, IdentifierRecord, LoginInput, RefreshResult, RegisterInput, RegisterResult, RouterHandlers, SENTRI_ERROR_STATUS, SentriError, SentriErrorCode, SentriLogger, ServerAuthConfig } from './
|
|
1
|
+
export { c as AccessCookieConfig, n as ApiResponse, k as AssignRolesResult, a as AuthConfig, d as AuthHooks, h as AuthResult, A as AuthUser, B as BulkIdentifiersResult, j as ChangePasswordResult, o as ClientAuthConfig, C as CookieConfig, G as GetUserResult, I as IdentifierInput, p as IdentifierRecord, L as LoginInput, i as RefreshResult, f as RegisterInput, g as RegisterResult, R as RouterHandlers, l as SENTRI_ERROR_STATUS, m as SentriError, q as SentriErrorCode, S as SentriLogger, b as ServerAuthConfig } from './index-CVb3-EnK.cjs';
|
|
2
2
|
import 'kysely';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { AccessCookieConfig, ApiResponse, AssignRolesResult, AuthConfig, AuthHooks, AuthResult, AuthUser, BulkIdentifiersResult, ChangePasswordResult, ClientAuthConfig, CookieConfig, GetUserResult, IdentifierInput, IdentifierRecord, LoginInput, RefreshResult, RegisterInput, RegisterResult, RouterHandlers, SENTRI_ERROR_STATUS, SentriError, SentriErrorCode, SentriLogger, ServerAuthConfig } from './
|
|
1
|
+
export { c as AccessCookieConfig, n as ApiResponse, k as AssignRolesResult, a as AuthConfig, d as AuthHooks, h as AuthResult, A as AuthUser, B as BulkIdentifiersResult, j as ChangePasswordResult, o as ClientAuthConfig, C as CookieConfig, G as GetUserResult, I as IdentifierInput, p as IdentifierRecord, L as LoginInput, i as RefreshResult, f as RegisterInput, g as RegisterResult, R as RouterHandlers, l as SENTRI_ERROR_STATUS, m as SentriError, q as SentriErrorCode, S as SentriLogger, b as ServerAuthConfig } from './index-CVb3-EnK.js';
|
|
2
2
|
import 'kysely';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t=Object.defineProperty;var
|
|
1
|
+
var t=Object.defineProperty;var T=(I,E)=>t(I,"name",{value:E,configurable:true});var _=Object.assign(Object.create(null),{UNAUTHORIZED:401,TOKEN_EXPIRED:401,TOKEN_INVALID:401,INVALID_CREDENTIALS:401,FORBIDDEN:403,USER_NOT_FOUND:404,IDENTIFIER_NOT_FOUND:404,USER_ALREADY_EXISTS:409,IDENTIFIER_ALREADY_EXISTS:409,INVALID_ROLE:400,VALIDATION_ERROR:400,CONFIGURATION_ERROR:500,TOKEN_REUSE:401,RATE_LIMIT_EXCEEDED:429}),R=class extends Error{static{T(this,"SentriError");}code;statusCode;constructor(E,N,O){super(N),this.name="SentriError",this.code=E,this.statusCode=O??_[E]??500;}};export{_ as SENTRI_ERROR_STATUS,R as SentriError};
|