@banata-auth/shared 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.
@@ -0,0 +1,1204 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * ID prefixes for all Banata Auth resources.
5
+ * Each resource type gets a unique prefix for type-safety and debuggability.
6
+ * Follows the WorkOS pattern of prefixed identifiers.
7
+ */
8
+ declare const ID_PREFIXES: {
9
+ readonly user: "usr";
10
+ readonly session: "ses";
11
+ readonly account: "acc";
12
+ readonly organization: "org";
13
+ readonly organizationMember: "mem";
14
+ readonly organizationInvitation: "inv";
15
+ readonly team: "team";
16
+ readonly ssoConnection: "conn";
17
+ readonly ssoProfile: "prof";
18
+ readonly directory: "dir";
19
+ readonly directoryUser: "diru";
20
+ readonly directoryGroup: "dirg";
21
+ readonly auditEvent: "evt";
22
+ readonly event: "event";
23
+ readonly webhookEndpoint: "wh";
24
+ readonly webhookDelivery: "whd";
25
+ readonly apiKey: "ak";
26
+ readonly role: "role";
27
+ readonly vaultSecret: "vsec";
28
+ readonly domainVerification: "dv";
29
+ readonly fgaTuple: "fga";
30
+ readonly radarEvent: "radar";
31
+ readonly project: "proj";
32
+ readonly environment: "env";
33
+ readonly emailTemplate: "etpl";
34
+ };
35
+ type ResourceType = keyof typeof ID_PREFIXES;
36
+ type IdPrefix = (typeof ID_PREFIXES)[ResourceType];
37
+ /**
38
+ * Default rate limits per endpoint category (requests per minute).
39
+ */
40
+ declare const RATE_LIMITS: {
41
+ readonly general: 600;
42
+ readonly signIn: 30;
43
+ readonly signUp: 10;
44
+ readonly passwordReset: 10;
45
+ readonly emailOperations: 10;
46
+ readonly scim: 100;
47
+ readonly admin: 120;
48
+ readonly webhookDelivery: 0;
49
+ };
50
+ /**
51
+ * Default token/session lifetimes in seconds.
52
+ */
53
+ declare const TOKEN_LIFETIMES: {
54
+ /** JWT access token: 15 minutes */
55
+ readonly accessToken: number;
56
+ /** Session record: 7 days */
57
+ readonly session: number;
58
+ /** Session absolute max: 30 days */
59
+ readonly sessionAbsoluteMax: number;
60
+ /** Password reset token: 1 hour */
61
+ readonly passwordReset: number;
62
+ /** Email verification token: 24 hours */
63
+ readonly emailVerification: number;
64
+ /** Magic link: 10 minutes */
65
+ readonly magicLink: number;
66
+ /** Email OTP: 10 minutes */
67
+ readonly emailOtp: number;
68
+ /** Admin portal link (short-lived): 5 minutes */
69
+ readonly adminPortalShort: number;
70
+ /** Admin portal link (long-lived): 30 days */
71
+ readonly adminPortalLong: number;
72
+ /** Organization invitation: 7 days */
73
+ readonly invitation: number;
74
+ /** JWKS key rotation: 90 days */
75
+ readonly jwksRotation: number;
76
+ };
77
+ /**
78
+ * Size limits.
79
+ */
80
+ declare const SIZE_LIMITS: {
81
+ /** Max custom metadata size in bytes */
82
+ readonly metadataMaxBytes: number;
83
+ /** Max SAML response size in bytes */
84
+ readonly samlMaxBytes: number;
85
+ /** Max SAML XML depth */
86
+ readonly samlMaxDepth: 50;
87
+ /** Max webhook payload size in bytes */
88
+ readonly webhookMaxBytes: number;
89
+ /** Max webhook response body stored (bytes) */
90
+ readonly webhookResponseMaxBytes: number;
91
+ /** Max SCIM request body size in bytes */
92
+ readonly scimMaxBytes: number;
93
+ /** Max password length */
94
+ readonly passwordMaxLength: 128;
95
+ /** Min password length */
96
+ readonly passwordMinLength: 8;
97
+ /** Max FGA hierarchy depth */
98
+ readonly fgaMaxDepth: 10;
99
+ };
100
+ /**
101
+ * Webhook retry delays in milliseconds.
102
+ */
103
+ declare const WEBHOOK_RETRY_DELAYS: readonly [0, number, number, number, number];
104
+ /**
105
+ * Max consecutive webhook failures before auto-disabling endpoint.
106
+ */
107
+ declare const WEBHOOK_MAX_CONSECUTIVE_FAILURES = 3;
108
+ /**
109
+ * Max number of webhook retry attempts.
110
+ */
111
+ declare const WEBHOOK_MAX_ATTEMPTS = 5;
112
+
113
+ /**
114
+ * Generate a ULID (Universally Unique Lexicographically Sortable Identifier).
115
+ */
116
+ declare function ulid(): string;
117
+ /**
118
+ * Generate a prefixed ID for a given resource type.
119
+ *
120
+ * @example
121
+ * ```ts
122
+ * generateId("user"); // "usr_01H9GBQN5WP3FVJKZ0JGMH3RXE"
123
+ * generateId("organization"); // "org_01H9GBQN5WP3FVJKZ0JGMH3RXE"
124
+ * generateId("ssoConnection"); // "conn_01H9GBQN5WP3FVJKZ0JGMH3RXE"
125
+ * ```
126
+ */
127
+ declare function generateId(resourceType: ResourceType): string;
128
+ /**
129
+ * Extract the resource type from a prefixed ID.
130
+ *
131
+ * @returns The resource type, or null if the prefix is unrecognized.
132
+ *
133
+ * @example
134
+ * ```ts
135
+ * getResourceType("usr_01H9GBQN5WP3FVJKZ0JGMH3RXE"); // "user"
136
+ * getResourceType("org_01H9GBQN5WP3FVJKZ0JGMH3RXE"); // "organization"
137
+ * getResourceType("invalid"); // null
138
+ * ```
139
+ */
140
+ declare function getResourceType(id: string): ResourceType | null;
141
+ /**
142
+ * Validate that an ID has the expected prefix for a resource type.
143
+ *
144
+ * @example
145
+ * ```ts
146
+ * validateId("usr_01H9...", "user"); // true
147
+ * validateId("org_01H9...", "user"); // false
148
+ * ```
149
+ */
150
+ declare function validateId(id: string, expectedType: ResourceType): boolean;
151
+ /**
152
+ * Generate a cryptographically random string of the specified byte length,
153
+ * encoded as URL-safe base64.
154
+ */
155
+ declare function generateRandomToken(byteLength?: number): string;
156
+ /**
157
+ * Generate a random 6-digit numeric OTP.
158
+ */
159
+ declare function generateOtp(length?: number): string;
160
+
161
+ /**
162
+ * Base error class for all Banata Auth errors.
163
+ * Matches WorkOS SDK error patterns with status, code, and requestId.
164
+ */
165
+ declare class BanataAuthError extends Error {
166
+ readonly status: number;
167
+ readonly code: string;
168
+ readonly requestId: string;
169
+ readonly retryable: boolean;
170
+ constructor(options: {
171
+ message: string;
172
+ status: number;
173
+ code: string;
174
+ requestId?: string;
175
+ retryable?: boolean;
176
+ });
177
+ toJSON(): {
178
+ name: string;
179
+ message: string;
180
+ status: number;
181
+ code: string;
182
+ requestId: string;
183
+ };
184
+ }
185
+ /**
186
+ * 401 - Missing or invalid API key / session.
187
+ */
188
+ declare class AuthenticationError extends BanataAuthError {
189
+ constructor(options?: {
190
+ message?: string;
191
+ requestId?: string;
192
+ });
193
+ }
194
+ /**
195
+ * 403 - Valid credentials but insufficient permissions.
196
+ */
197
+ declare class ForbiddenError extends BanataAuthError {
198
+ constructor(options?: {
199
+ message?: string;
200
+ requestId?: string;
201
+ });
202
+ }
203
+ /**
204
+ * 404 - Resource not found.
205
+ */
206
+ declare class NotFoundError extends BanataAuthError {
207
+ constructor(options?: {
208
+ message?: string;
209
+ resource?: string;
210
+ requestId?: string;
211
+ });
212
+ }
213
+ /**
214
+ * 409 - Conflict (duplicate resource, etc.)
215
+ */
216
+ declare class ConflictError extends BanataAuthError {
217
+ constructor(options?: {
218
+ message?: string;
219
+ requestId?: string;
220
+ });
221
+ }
222
+ /**
223
+ * Individual field validation error.
224
+ */
225
+ interface FieldError {
226
+ field: string;
227
+ message: string;
228
+ code: string;
229
+ }
230
+ /**
231
+ * 422 - Validation error with field-level details.
232
+ */
233
+ declare class ValidationError extends BanataAuthError {
234
+ readonly errors: FieldError[];
235
+ constructor(options: {
236
+ message?: string;
237
+ errors: FieldError[];
238
+ requestId?: string;
239
+ });
240
+ toJSON(): {
241
+ errors: FieldError[];
242
+ name: string;
243
+ message: string;
244
+ status: number;
245
+ code: string;
246
+ requestId: string;
247
+ };
248
+ }
249
+ /**
250
+ * 429 - Rate limited.
251
+ */
252
+ declare class RateLimitError extends BanataAuthError {
253
+ readonly retryAfter: number;
254
+ constructor(options: {
255
+ retryAfter: number;
256
+ requestId?: string;
257
+ });
258
+ }
259
+ /**
260
+ * 500 - Internal server error.
261
+ */
262
+ declare class InternalError extends BanataAuthError {
263
+ constructor(options?: {
264
+ message?: string;
265
+ requestId?: string;
266
+ });
267
+ }
268
+ /**
269
+ * Maps an HTTP status code to the appropriate error class.
270
+ */
271
+ declare function createErrorFromStatus(status: number, body: {
272
+ message?: string;
273
+ code?: string;
274
+ errors?: FieldError[];
275
+ }, requestId?: string): BanataAuthError;
276
+
277
+ declare const emailSchema: z.ZodString;
278
+ declare const passwordSchema: z.ZodString;
279
+ declare const nameSchema: z.ZodString;
280
+ declare const slugSchema: z.ZodString;
281
+ declare const urlSchema: z.ZodString;
282
+ declare const httpsUrlSchema: z.ZodEffects<z.ZodString, string, string>;
283
+ declare const metadataSchema: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnknown>, Record<string, unknown>, Record<string, unknown>>>;
284
+ declare const domainSchema: z.ZodString;
285
+ declare const paginationSchema: z.ZodObject<{
286
+ limit: z.ZodDefault<z.ZodNumber>;
287
+ before: z.ZodOptional<z.ZodString>;
288
+ after: z.ZodOptional<z.ZodString>;
289
+ order: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
290
+ }, "strip", z.ZodTypeAny, {
291
+ limit: number;
292
+ order: "asc" | "desc";
293
+ before?: string | undefined;
294
+ after?: string | undefined;
295
+ }, {
296
+ limit?: number | undefined;
297
+ before?: string | undefined;
298
+ after?: string | undefined;
299
+ order?: "asc" | "desc" | undefined;
300
+ }>;
301
+ type PaginationOptions = z.infer<typeof paginationSchema>;
302
+ declare const createUserSchema: z.ZodObject<{
303
+ email: z.ZodString;
304
+ password: z.ZodOptional<z.ZodString>;
305
+ name: z.ZodString;
306
+ image: z.ZodOptional<z.ZodString>;
307
+ username: z.ZodOptional<z.ZodString>;
308
+ phoneNumber: z.ZodOptional<z.ZodString>;
309
+ emailVerified: z.ZodDefault<z.ZodBoolean>;
310
+ role: z.ZodDefault<z.ZodEnum<["user", "admin"]>>;
311
+ metadata: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnknown>, Record<string, unknown>, Record<string, unknown>>>;
312
+ }, "strip", z.ZodTypeAny, {
313
+ role: "user" | "admin";
314
+ email: string;
315
+ name: string;
316
+ emailVerified: boolean;
317
+ password?: string | undefined;
318
+ image?: string | undefined;
319
+ username?: string | undefined;
320
+ phoneNumber?: string | undefined;
321
+ metadata?: Record<string, unknown> | undefined;
322
+ }, {
323
+ email: string;
324
+ name: string;
325
+ role?: "user" | "admin" | undefined;
326
+ password?: string | undefined;
327
+ image?: string | undefined;
328
+ username?: string | undefined;
329
+ phoneNumber?: string | undefined;
330
+ emailVerified?: boolean | undefined;
331
+ metadata?: Record<string, unknown> | undefined;
332
+ }>;
333
+ type CreateUserInput = z.infer<typeof createUserSchema>;
334
+ declare const updateUserSchema: z.ZodObject<{
335
+ name: z.ZodOptional<z.ZodString>;
336
+ image: z.ZodNullable<z.ZodOptional<z.ZodString>>;
337
+ username: z.ZodOptional<z.ZodString>;
338
+ phoneNumber: z.ZodNullable<z.ZodOptional<z.ZodString>>;
339
+ metadata: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnknown>, Record<string, unknown>, Record<string, unknown>>>;
340
+ }, "strip", z.ZodTypeAny, {
341
+ name?: string | undefined;
342
+ image?: string | null | undefined;
343
+ username?: string | undefined;
344
+ phoneNumber?: string | null | undefined;
345
+ metadata?: Record<string, unknown> | undefined;
346
+ }, {
347
+ name?: string | undefined;
348
+ image?: string | null | undefined;
349
+ username?: string | undefined;
350
+ phoneNumber?: string | null | undefined;
351
+ metadata?: Record<string, unknown> | undefined;
352
+ }>;
353
+ type UpdateUserInput = z.infer<typeof updateUserSchema>;
354
+ declare const createOrganizationSchema: z.ZodObject<{
355
+ name: z.ZodString;
356
+ slug: z.ZodOptional<z.ZodString>;
357
+ logo: z.ZodOptional<z.ZodString>;
358
+ metadata: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnknown>, Record<string, unknown>, Record<string, unknown>>>;
359
+ requireMfa: z.ZodDefault<z.ZodBoolean>;
360
+ allowedEmailDomains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
361
+ maxMembers: z.ZodOptional<z.ZodNumber>;
362
+ }, "strip", z.ZodTypeAny, {
363
+ name: string;
364
+ requireMfa: boolean;
365
+ metadata?: Record<string, unknown> | undefined;
366
+ slug?: string | undefined;
367
+ logo?: string | undefined;
368
+ allowedEmailDomains?: string[] | undefined;
369
+ maxMembers?: number | undefined;
370
+ }, {
371
+ name: string;
372
+ metadata?: Record<string, unknown> | undefined;
373
+ slug?: string | undefined;
374
+ logo?: string | undefined;
375
+ requireMfa?: boolean | undefined;
376
+ allowedEmailDomains?: string[] | undefined;
377
+ maxMembers?: number | undefined;
378
+ }>;
379
+ type CreateOrganizationInput = z.infer<typeof createOrganizationSchema>;
380
+ declare const updateOrganizationSchema: z.ZodObject<{
381
+ name: z.ZodOptional<z.ZodString>;
382
+ slug: z.ZodOptional<z.ZodString>;
383
+ logo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
384
+ metadata: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnknown>, Record<string, unknown>, Record<string, unknown>>>;
385
+ requireMfa: z.ZodOptional<z.ZodBoolean>;
386
+ ssoEnforced: z.ZodOptional<z.ZodBoolean>;
387
+ allowedEmailDomains: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
388
+ maxMembers: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
389
+ }, "strip", z.ZodTypeAny, {
390
+ name?: string | undefined;
391
+ metadata?: Record<string, unknown> | undefined;
392
+ slug?: string | undefined;
393
+ logo?: string | null | undefined;
394
+ requireMfa?: boolean | undefined;
395
+ allowedEmailDomains?: string[] | null | undefined;
396
+ maxMembers?: number | null | undefined;
397
+ ssoEnforced?: boolean | undefined;
398
+ }, {
399
+ name?: string | undefined;
400
+ metadata?: Record<string, unknown> | undefined;
401
+ slug?: string | undefined;
402
+ logo?: string | null | undefined;
403
+ requireMfa?: boolean | undefined;
404
+ allowedEmailDomains?: string[] | null | undefined;
405
+ maxMembers?: number | null | undefined;
406
+ ssoEnforced?: boolean | undefined;
407
+ }>;
408
+ type UpdateOrganizationInput = z.infer<typeof updateOrganizationSchema>;
409
+ declare const inviteMemberSchema: z.ZodObject<{
410
+ email: z.ZodString;
411
+ role: z.ZodString;
412
+ }, "strip", z.ZodTypeAny, {
413
+ role: string;
414
+ email: string;
415
+ }, {
416
+ role: string;
417
+ email: string;
418
+ }>;
419
+ type InviteMemberInput = z.infer<typeof inviteMemberSchema>;
420
+ declare const createSsoConnectionSchema: z.ZodObject<{
421
+ organizationId: z.ZodString;
422
+ type: z.ZodEnum<["saml", "oidc"]>;
423
+ name: z.ZodString;
424
+ domains: z.ZodArray<z.ZodString, "many">;
425
+ samlConfig: z.ZodOptional<z.ZodObject<{
426
+ idpEntityId: z.ZodString;
427
+ idpSsoUrl: z.ZodString;
428
+ idpCertificate: z.ZodString;
429
+ nameIdFormat: z.ZodOptional<z.ZodString>;
430
+ signRequest: z.ZodDefault<z.ZodBoolean>;
431
+ allowIdpInitiated: z.ZodDefault<z.ZodBoolean>;
432
+ attributeMapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
433
+ }, "strip", z.ZodTypeAny, {
434
+ idpEntityId: string;
435
+ idpSsoUrl: string;
436
+ idpCertificate: string;
437
+ signRequest: boolean;
438
+ allowIdpInitiated: boolean;
439
+ nameIdFormat?: string | undefined;
440
+ attributeMapping?: Record<string, string> | undefined;
441
+ }, {
442
+ idpEntityId: string;
443
+ idpSsoUrl: string;
444
+ idpCertificate: string;
445
+ nameIdFormat?: string | undefined;
446
+ signRequest?: boolean | undefined;
447
+ allowIdpInitiated?: boolean | undefined;
448
+ attributeMapping?: Record<string, string> | undefined;
449
+ }>>;
450
+ oidcConfig: z.ZodOptional<z.ZodObject<{
451
+ issuer: z.ZodString;
452
+ clientId: z.ZodString;
453
+ clientSecret: z.ZodString;
454
+ scopes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
455
+ }, "strip", z.ZodTypeAny, {
456
+ issuer: string;
457
+ clientId: string;
458
+ clientSecret: string;
459
+ scopes: string[];
460
+ }, {
461
+ issuer: string;
462
+ clientId: string;
463
+ clientSecret: string;
464
+ scopes?: string[] | undefined;
465
+ }>>;
466
+ }, "strip", z.ZodTypeAny, {
467
+ type: "saml" | "oidc";
468
+ name: string;
469
+ organizationId: string;
470
+ domains: string[];
471
+ samlConfig?: {
472
+ idpEntityId: string;
473
+ idpSsoUrl: string;
474
+ idpCertificate: string;
475
+ signRequest: boolean;
476
+ allowIdpInitiated: boolean;
477
+ nameIdFormat?: string | undefined;
478
+ attributeMapping?: Record<string, string> | undefined;
479
+ } | undefined;
480
+ oidcConfig?: {
481
+ issuer: string;
482
+ clientId: string;
483
+ clientSecret: string;
484
+ scopes: string[];
485
+ } | undefined;
486
+ }, {
487
+ type: "saml" | "oidc";
488
+ name: string;
489
+ organizationId: string;
490
+ domains: string[];
491
+ samlConfig?: {
492
+ idpEntityId: string;
493
+ idpSsoUrl: string;
494
+ idpCertificate: string;
495
+ nameIdFormat?: string | undefined;
496
+ signRequest?: boolean | undefined;
497
+ allowIdpInitiated?: boolean | undefined;
498
+ attributeMapping?: Record<string, string> | undefined;
499
+ } | undefined;
500
+ oidcConfig?: {
501
+ issuer: string;
502
+ clientId: string;
503
+ clientSecret: string;
504
+ scopes?: string[] | undefined;
505
+ } | undefined;
506
+ }>;
507
+ type CreateSsoConnectionInput = z.infer<typeof createSsoConnectionSchema>;
508
+ declare const createWebhookEndpointSchema: z.ZodObject<{
509
+ url: z.ZodEffects<z.ZodString, string, string>;
510
+ eventTypes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
511
+ enabled: z.ZodDefault<z.ZodBoolean>;
512
+ }, "strip", z.ZodTypeAny, {
513
+ url: string;
514
+ eventTypes: string[];
515
+ enabled: boolean;
516
+ }, {
517
+ url: string;
518
+ eventTypes?: string[] | undefined;
519
+ enabled?: boolean | undefined;
520
+ }>;
521
+ type CreateWebhookEndpointInput = z.infer<typeof createWebhookEndpointSchema>;
522
+ declare const createAuditEventSchema: z.ZodObject<{
523
+ action: z.ZodString;
524
+ actor: z.ZodObject<{
525
+ type: z.ZodEnum<["user", "admin", "system", "api_key", "scim"]>;
526
+ id: z.ZodString;
527
+ name: z.ZodOptional<z.ZodString>;
528
+ email: z.ZodOptional<z.ZodString>;
529
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
530
+ }, "strip", z.ZodTypeAny, {
531
+ type: "user" | "admin" | "system" | "api_key" | "scim";
532
+ id: string;
533
+ email?: string | undefined;
534
+ name?: string | undefined;
535
+ metadata?: Record<string, string> | undefined;
536
+ }, {
537
+ type: "user" | "admin" | "system" | "api_key" | "scim";
538
+ id: string;
539
+ email?: string | undefined;
540
+ name?: string | undefined;
541
+ metadata?: Record<string, string> | undefined;
542
+ }>;
543
+ targets: z.ZodDefault<z.ZodArray<z.ZodObject<{
544
+ type: z.ZodString;
545
+ id: z.ZodString;
546
+ name: z.ZodOptional<z.ZodString>;
547
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
548
+ }, "strip", z.ZodTypeAny, {
549
+ type: string;
550
+ id: string;
551
+ name?: string | undefined;
552
+ metadata?: Record<string, string> | undefined;
553
+ }, {
554
+ type: string;
555
+ id: string;
556
+ name?: string | undefined;
557
+ metadata?: Record<string, string> | undefined;
558
+ }>, "many">>;
559
+ context: z.ZodDefault<z.ZodObject<{
560
+ organizationId: z.ZodOptional<z.ZodString>;
561
+ ipAddress: z.ZodOptional<z.ZodString>;
562
+ userAgent: z.ZodOptional<z.ZodString>;
563
+ requestId: z.ZodOptional<z.ZodString>;
564
+ }, "strip", z.ZodTypeAny, {
565
+ requestId?: string | undefined;
566
+ organizationId?: string | undefined;
567
+ ipAddress?: string | undefined;
568
+ userAgent?: string | undefined;
569
+ }, {
570
+ requestId?: string | undefined;
571
+ organizationId?: string | undefined;
572
+ ipAddress?: string | undefined;
573
+ userAgent?: string | undefined;
574
+ }>>;
575
+ changes: z.ZodOptional<z.ZodObject<{
576
+ before: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
577
+ after: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
578
+ }, "strip", z.ZodTypeAny, {
579
+ before?: Record<string, unknown> | undefined;
580
+ after?: Record<string, unknown> | undefined;
581
+ }, {
582
+ before?: Record<string, unknown> | undefined;
583
+ after?: Record<string, unknown> | undefined;
584
+ }>>;
585
+ idempotencyKey: z.ZodOptional<z.ZodString>;
586
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
587
+ occurredAt: z.ZodOptional<z.ZodNumber>;
588
+ }, "strip", z.ZodTypeAny, {
589
+ action: string;
590
+ actor: {
591
+ type: "user" | "admin" | "system" | "api_key" | "scim";
592
+ id: string;
593
+ email?: string | undefined;
594
+ name?: string | undefined;
595
+ metadata?: Record<string, string> | undefined;
596
+ };
597
+ targets: {
598
+ type: string;
599
+ id: string;
600
+ name?: string | undefined;
601
+ metadata?: Record<string, string> | undefined;
602
+ }[];
603
+ context: {
604
+ requestId?: string | undefined;
605
+ organizationId?: string | undefined;
606
+ ipAddress?: string | undefined;
607
+ userAgent?: string | undefined;
608
+ };
609
+ metadata?: Record<string, string> | undefined;
610
+ changes?: {
611
+ before?: Record<string, unknown> | undefined;
612
+ after?: Record<string, unknown> | undefined;
613
+ } | undefined;
614
+ idempotencyKey?: string | undefined;
615
+ occurredAt?: number | undefined;
616
+ }, {
617
+ action: string;
618
+ actor: {
619
+ type: "user" | "admin" | "system" | "api_key" | "scim";
620
+ id: string;
621
+ email?: string | undefined;
622
+ name?: string | undefined;
623
+ metadata?: Record<string, string> | undefined;
624
+ };
625
+ metadata?: Record<string, string> | undefined;
626
+ targets?: {
627
+ type: string;
628
+ id: string;
629
+ name?: string | undefined;
630
+ metadata?: Record<string, string> | undefined;
631
+ }[] | undefined;
632
+ context?: {
633
+ requestId?: string | undefined;
634
+ organizationId?: string | undefined;
635
+ ipAddress?: string | undefined;
636
+ userAgent?: string | undefined;
637
+ } | undefined;
638
+ changes?: {
639
+ before?: Record<string, unknown> | undefined;
640
+ after?: Record<string, unknown> | undefined;
641
+ } | undefined;
642
+ idempotencyKey?: string | undefined;
643
+ occurredAt?: number | undefined;
644
+ }>;
645
+ type CreateAuditEventInput = z.infer<typeof createAuditEventSchema>;
646
+
647
+ /**
648
+ * Core type definitions for Banata Auth.
649
+ * These are the SDK-facing types (camelCase).
650
+ * Wire types (snake_case) are separate and serializers convert between them.
651
+ */
652
+ interface ListMetadata {
653
+ before: string | null;
654
+ after: string | null;
655
+ }
656
+ interface PaginatedResult<T> {
657
+ data: T[];
658
+ listMetadata: ListMetadata;
659
+ }
660
+ interface User {
661
+ id: string;
662
+ email: string;
663
+ emailVerified: boolean;
664
+ name: string;
665
+ image: string | null;
666
+ username: string | null;
667
+ phoneNumber: string | null;
668
+ phoneNumberVerified: boolean;
669
+ role: "user" | "admin";
670
+ banned: boolean;
671
+ banReason: string | null;
672
+ banExpires: Date | null;
673
+ twoFactorEnabled: boolean;
674
+ metadata: Record<string, unknown> | null;
675
+ createdAt: Date;
676
+ updatedAt: Date;
677
+ }
678
+ interface Session {
679
+ id: string;
680
+ userId: string;
681
+ token: string;
682
+ expiresAt: Date;
683
+ ipAddress: string | null;
684
+ userAgent: string | null;
685
+ activeOrganizationId: string | null;
686
+ impersonatedBy: string | null;
687
+ createdAt: Date;
688
+ updatedAt: Date;
689
+ }
690
+ interface Account {
691
+ id: string;
692
+ userId: string;
693
+ accountId: string;
694
+ providerId: string;
695
+ createdAt: Date;
696
+ updatedAt: Date;
697
+ }
698
+ interface Organization {
699
+ id: string;
700
+ name: string;
701
+ slug: string;
702
+ logo: string | null;
703
+ metadata: Record<string, unknown> | null;
704
+ requireMfa: boolean;
705
+ ssoEnforced: boolean;
706
+ allowedEmailDomains: string[] | null;
707
+ maxMembers: number | null;
708
+ createdAt: Date;
709
+ updatedAt: Date;
710
+ }
711
+ interface OrganizationMember {
712
+ id: string;
713
+ organizationId: string;
714
+ userId: string;
715
+ role: string;
716
+ source: "manual" | "invitation" | "sso" | "scim" | "api";
717
+ teamIds: string[];
718
+ createdAt: Date;
719
+ updatedAt: Date;
720
+ }
721
+ interface OrganizationInvitation {
722
+ id: string;
723
+ organizationId: string;
724
+ email: string;
725
+ role: string;
726
+ inviterId: string;
727
+ status: "pending" | "accepted" | "expired" | "revoked";
728
+ expiresAt: Date;
729
+ createdAt: Date;
730
+ }
731
+ interface Team {
732
+ id: string;
733
+ organizationId: string;
734
+ name: string;
735
+ description: string | null;
736
+ metadata: Record<string, unknown> | null;
737
+ createdAt: Date;
738
+ updatedAt: Date;
739
+ }
740
+ type SsoConnectionType = "saml" | "oidc";
741
+ type SsoConnectionState = "draft" | "active" | "inactive" | "validating";
742
+ interface SsoConnection {
743
+ id: string;
744
+ organizationId: string;
745
+ type: SsoConnectionType;
746
+ state: SsoConnectionState;
747
+ name: string;
748
+ domains: string[];
749
+ samlConfig: SamlConfig | null;
750
+ oidcConfig: OidcConfig | null;
751
+ domainVerified?: boolean;
752
+ spMetadataUrl?: string | null;
753
+ projectId?: string | null;
754
+ createdAt: Date;
755
+ updatedAt: Date;
756
+ }
757
+ interface SamlConfig {
758
+ idpEntityId: string;
759
+ idpSsoUrl: string;
760
+ idpSloUrl: string | null;
761
+ idpCertificate: string;
762
+ idpCertificateExpiresAt: Date | null;
763
+ spEntityId: string;
764
+ spAcsUrl: string;
765
+ spMetadataUrl: string;
766
+ nameIdFormat: string;
767
+ signatureAlgorithm: "RSA-SHA256" | "RSA-SHA384" | "RSA-SHA512";
768
+ digestAlgorithm: "SHA256" | "SHA384" | "SHA512";
769
+ signRequest: boolean;
770
+ allowIdpInitiated: boolean;
771
+ attributeMapping: Record<string, string>;
772
+ }
773
+ interface OidcConfig {
774
+ issuer: string;
775
+ clientId: string;
776
+ discoveryUrl: string;
777
+ authorizationUrl: string;
778
+ tokenUrl: string;
779
+ userinfoUrl: string;
780
+ jwksUrl: string;
781
+ scopes: string[];
782
+ responseType: "code";
783
+ tokenEndpointAuthMethod: "client_secret_post" | "client_secret_basic";
784
+ claimMapping: Record<string, string>;
785
+ }
786
+ interface SsoProfile {
787
+ id: string;
788
+ connectionId: string;
789
+ connectionType: SsoConnectionType;
790
+ organizationId: string;
791
+ userId: string;
792
+ idpId: string;
793
+ email: string;
794
+ firstName: string | null;
795
+ lastName: string | null;
796
+ displayName: string | null;
797
+ groups: string[];
798
+ rawAttributes: Record<string, string>;
799
+ lastLoginAt: Date;
800
+ createdAt: Date;
801
+ }
802
+ type DirectoryProvider = "okta" | "azure_scim_v2" | "google_workspace" | "onelogin" | "jumpcloud" | "pingfederate" | "generic_scim_v2";
803
+ type DirectoryState = "linked" | "unlinked" | "invalid_credentials";
804
+ interface Directory {
805
+ id: string;
806
+ organizationId: string;
807
+ type: "scim";
808
+ state: DirectoryState;
809
+ name: string;
810
+ provider: DirectoryProvider;
811
+ userCount: number;
812
+ groupCount: number;
813
+ lastSyncAt: Date | null;
814
+ lastSyncStatus: "success" | "partial" | "failed" | null;
815
+ scimConfig?: {
816
+ baseUrl: string;
817
+ bearerToken: string;
818
+ };
819
+ projectId?: string | null;
820
+ createdAt: Date;
821
+ updatedAt: Date;
822
+ }
823
+ interface DirectoryUser {
824
+ id: string;
825
+ directoryId: string;
826
+ organizationId: string;
827
+ userId: string | null;
828
+ externalId: string;
829
+ userName: string;
830
+ emails: Array<{
831
+ value: string;
832
+ type: string;
833
+ primary: boolean;
834
+ }>;
835
+ name: {
836
+ givenName: string;
837
+ familyName: string;
838
+ formatted?: string;
839
+ };
840
+ displayName: string;
841
+ active: boolean;
842
+ title: string | null;
843
+ department: string | null;
844
+ groups: Array<{
845
+ id: string;
846
+ name: string;
847
+ }>;
848
+ state: "active" | "suspended" | "deprovisioned";
849
+ createdAt: Date;
850
+ updatedAt: Date;
851
+ }
852
+ interface DirectoryGroup {
853
+ id: string;
854
+ directoryId: string;
855
+ organizationId: string;
856
+ externalId: string;
857
+ name: string;
858
+ displayName: string;
859
+ memberCount: number;
860
+ createdAt: Date;
861
+ updatedAt: Date;
862
+ }
863
+ interface AuditEvent {
864
+ id: string;
865
+ action: string;
866
+ version: number;
867
+ actor: {
868
+ type: "user" | "admin" | "system" | "api_key" | "scim";
869
+ id: string;
870
+ name?: string;
871
+ email?: string;
872
+ metadata?: Record<string, string>;
873
+ };
874
+ targets: Array<{
875
+ type: string;
876
+ id: string;
877
+ name?: string;
878
+ metadata?: Record<string, string>;
879
+ }>;
880
+ context: {
881
+ organizationId?: string;
882
+ ipAddress?: string;
883
+ userAgent?: string;
884
+ location?: {
885
+ city?: string;
886
+ country?: string;
887
+ countryCode?: string;
888
+ };
889
+ requestId?: string;
890
+ };
891
+ changes?: {
892
+ before?: Record<string, unknown>;
893
+ after?: Record<string, unknown>;
894
+ };
895
+ idempotencyKey?: string;
896
+ metadata?: Record<string, string>;
897
+ occurredAt: Date;
898
+ createdAt: Date;
899
+ }
900
+ interface WebhookEndpoint {
901
+ id: string;
902
+ url: string;
903
+ eventTypes: string[];
904
+ enabled: boolean;
905
+ successCount: number;
906
+ failureCount: number;
907
+ lastDeliveryAt: Date | null;
908
+ lastDeliveryStatus: "success" | "failure" | null;
909
+ createdAt: Date;
910
+ updatedAt: Date;
911
+ }
912
+ interface WebhookEvent {
913
+ id: string;
914
+ type: string;
915
+ data: Record<string, unknown>;
916
+ createdAt: Date;
917
+ }
918
+ interface VaultSecret {
919
+ id: string;
920
+ name: string;
921
+ context: string | null;
922
+ organizationId: string | null;
923
+ metadata: Record<string, string> | null;
924
+ createdAt: Date;
925
+ updatedAt: Date;
926
+ }
927
+ type PortalIntent = "sso" | "dsync" | "domain_verification" | "audit_logs" | "log_streams" | "users";
928
+ interface PortalSession {
929
+ link: string;
930
+ sessionId: string;
931
+ intent: PortalIntent;
932
+ organizationId: string;
933
+ expiresAt: string;
934
+ }
935
+ type DomainVerificationState = "pending" | "verified" | "failed" | "expired";
936
+ interface DomainVerification {
937
+ id: string;
938
+ organizationId: string;
939
+ domain: string;
940
+ state: DomainVerificationState;
941
+ method: "dns_txt";
942
+ txtRecord: {
943
+ name: string;
944
+ value: string;
945
+ };
946
+ verifiedAt: Date | null;
947
+ expiresAt: Date | null;
948
+ lastCheckedAt: Date | null;
949
+ checkCount: number;
950
+ createdAt: Date;
951
+ updatedAt: Date;
952
+ }
953
+ interface ApiKey {
954
+ id: string;
955
+ name: string;
956
+ prefix: string;
957
+ organizationId: string | null;
958
+ permissions: string[];
959
+ expiresAt: Date | null;
960
+ lastUsedAt: Date | null;
961
+ createdAt: Date;
962
+ }
963
+ /**
964
+ * A project represents a fully isolated auth tenant.
965
+ * Each product/app powered by Banata Auth is a separate project
966
+ * with its own users, sessions, organizations, branding, etc.
967
+ */
968
+ interface Project {
969
+ id: string;
970
+ name: string;
971
+ slug: string;
972
+ description: string | null;
973
+ logoUrl: string | null;
974
+ ownerId: string;
975
+ createdAt: Date;
976
+ updatedAt: Date;
977
+ }
978
+
979
+ interface RuntimeAuthMethods {
980
+ sso: boolean;
981
+ emailPassword: boolean;
982
+ passkey: boolean;
983
+ magicLink: boolean;
984
+ emailOtp: boolean;
985
+ twoFactor: boolean;
986
+ organization: boolean;
987
+ anonymous: boolean;
988
+ username: boolean;
989
+ }
990
+ interface RuntimeSocialProviderStatus {
991
+ enabled: boolean;
992
+ demo: boolean;
993
+ }
994
+ interface RuntimeAuthFeatures {
995
+ hostedUi: boolean;
996
+ signUp: boolean;
997
+ mfa: boolean;
998
+ localization: boolean;
999
+ }
1000
+ interface RuntimeAuthSessions {
1001
+ maxSessionLength: string;
1002
+ accessTokenDuration: string;
1003
+ inactivityTimeout: string;
1004
+ corsOrigins: string[];
1005
+ }
1006
+ interface RuntimeAuthConfig {
1007
+ authMethods: RuntimeAuthMethods;
1008
+ socialProviders: Record<string, RuntimeSocialProviderStatus>;
1009
+ features: RuntimeAuthFeatures;
1010
+ sessions: RuntimeAuthSessions;
1011
+ }
1012
+ declare function listEnabledSocialProviderIds(config: Pick<RuntimeAuthConfig, "socialProviders"> | null | undefined): string[];
1013
+
1014
+ /**
1015
+ * Email template block types for the block-based email editor.
1016
+ *
1017
+ * Each email template is stored as an ordered array of typed blocks.
1018
+ * These blocks map 1:1 to React Email components and are rendered
1019
+ * at design time in the dashboard (live preview) and at send time
1020
+ * via `@react-email/render` to produce final HTML.
1021
+ *
1022
+ * The block schema is the single source of truth shared across:
1023
+ * - Dashboard editor (visual editing)
1024
+ * - SDK (programmatic template CRUD)
1025
+ * - Convex backend (storage + send-time rendering)
1026
+ */
1027
+ /** Common inline style properties for email blocks. */
1028
+ interface EmailBlockStyle {
1029
+ color?: string;
1030
+ backgroundColor?: string;
1031
+ fontSize?: number;
1032
+ fontWeight?: "normal" | "bold" | "600" | "700";
1033
+ fontStyle?: "normal" | "italic";
1034
+ textAlign?: "left" | "center" | "right";
1035
+ lineHeight?: number | string;
1036
+ padding?: string;
1037
+ margin?: string;
1038
+ borderRadius?: number;
1039
+ width?: string;
1040
+ maxWidth?: string;
1041
+ }
1042
+ /** Base properties shared by all blocks. */
1043
+ interface BaseBlock {
1044
+ /** Unique block ID (UUID). */
1045
+ id: string;
1046
+ /** Display label for the editor sidebar (optional override). */
1047
+ label?: string;
1048
+ }
1049
+ /** Heading block — maps to React Email `<Heading>`. */
1050
+ interface HeadingBlock extends BaseBlock {
1051
+ type: "heading";
1052
+ /** Heading level: h1–h6. */
1053
+ as: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
1054
+ /** The heading text. Supports {{variable}} interpolation. */
1055
+ text: string;
1056
+ style?: EmailBlockStyle;
1057
+ }
1058
+ /** Text/paragraph block — maps to React Email `<Text>`. */
1059
+ interface TextBlock extends BaseBlock {
1060
+ type: "text";
1061
+ /** The paragraph text. Supports {{variable}} interpolation and basic HTML. */
1062
+ text: string;
1063
+ style?: EmailBlockStyle;
1064
+ }
1065
+ /** Button (CTA) block — maps to React Email `<Button>`. */
1066
+ interface ButtonBlock extends BaseBlock {
1067
+ type: "button";
1068
+ /** Button label text. */
1069
+ text: string;
1070
+ /** URL the button links to. Supports {{variable}} interpolation. */
1071
+ href: string;
1072
+ /** Variant style. */
1073
+ variant?: "primary" | "secondary" | "outline";
1074
+ style?: EmailBlockStyle;
1075
+ }
1076
+ /** Image block — maps to React Email `<Img>`. */
1077
+ interface ImageBlock extends BaseBlock {
1078
+ type: "image";
1079
+ /** Image source URL. */
1080
+ src: string;
1081
+ /** Alt text for accessibility. */
1082
+ alt: string;
1083
+ /** Width in pixels. */
1084
+ width?: number;
1085
+ /** Height in pixels. */
1086
+ height?: number;
1087
+ style?: EmailBlockStyle;
1088
+ }
1089
+ /** Divider/horizontal rule — maps to React Email `<Hr>`. */
1090
+ interface DividerBlock extends BaseBlock {
1091
+ type: "divider";
1092
+ style?: EmailBlockStyle;
1093
+ }
1094
+ /** Spacer block — empty space with configurable height. */
1095
+ interface SpacerBlock extends BaseBlock {
1096
+ type: "spacer";
1097
+ /** Height in pixels. */
1098
+ height: number;
1099
+ }
1100
+ /** Link block — maps to React Email `<Link>`. */
1101
+ interface LinkBlock extends BaseBlock {
1102
+ type: "link";
1103
+ /** Link text. */
1104
+ text: string;
1105
+ /** URL. Supports {{variable}} interpolation. */
1106
+ href: string;
1107
+ style?: EmailBlockStyle;
1108
+ }
1109
+ /** Code block — styled monospace text for OTPs, tokens, etc. */
1110
+ interface CodeBlock extends BaseBlock {
1111
+ type: "code";
1112
+ /** The code/OTP text. Supports {{variable}} interpolation. */
1113
+ text: string;
1114
+ style?: EmailBlockStyle;
1115
+ }
1116
+ /** Column definition inside a columns block. */
1117
+ interface ColumnDef {
1118
+ /** Width as CSS value (e.g. "50%", "200px"). */
1119
+ width?: string;
1120
+ /** Blocks nested inside this column. */
1121
+ blocks: EmailBlock[];
1122
+ }
1123
+ /** Columns (multi-column layout) — maps to React Email `<Row>` + `<Column>`. */
1124
+ interface ColumnsBlock extends BaseBlock {
1125
+ type: "columns";
1126
+ /** Column definitions (2–4 columns). */
1127
+ columns: ColumnDef[];
1128
+ }
1129
+ /** Any email block. Discriminated union on `type`. */
1130
+ type EmailBlock = HeadingBlock | TextBlock | ButtonBlock | ImageBlock | DividerBlock | SpacerBlock | LinkBlock | CodeBlock | ColumnsBlock;
1131
+ /** All possible block type strings. */
1132
+ type EmailBlockType = EmailBlock["type"];
1133
+ /** Category for organizing templates. */
1134
+ type EmailTemplateCategory = "auth" | "marketing" | "transactional" | "onboarding" | "notification" | "custom";
1135
+ /**
1136
+ * A complete email template definition.
1137
+ * Stored as JSON in the database and editable through the dashboard.
1138
+ */
1139
+ interface EmailTemplateDefinition {
1140
+ /** Unique template ID (generated). */
1141
+ id: string;
1142
+ /** Human-readable template name (e.g. "Welcome Email", "Marketing Blast"). */
1143
+ name: string;
1144
+ /** URL-safe slug for SDK usage (e.g. "welcome-email", "marketing-blast"). */
1145
+ slug: string;
1146
+ /** Email subject line. Supports {{variable}} interpolation. */
1147
+ subject: string;
1148
+ /** Preview text shown in inbox (optional). */
1149
+ previewText?: string;
1150
+ /** Template category for organization. */
1151
+ category: EmailTemplateCategory;
1152
+ /** Description of what this template is for. */
1153
+ description?: string;
1154
+ /** The ordered array of content blocks. */
1155
+ blocks: EmailBlock[];
1156
+ /** Variables this template expects (for documentation / SDK hints). */
1157
+ variables?: EmailTemplateVariable[];
1158
+ /** Whether this is a built-in auth template (not deletable). */
1159
+ builtIn?: boolean;
1160
+ /** The built-in email type this template overrides (if any). */
1161
+ builtInType?: "verification" | "password-reset" | "magic-link" | "email-otp" | "invitation" | "welcome";
1162
+ /** Timestamps. */
1163
+ createdAt: number;
1164
+ updatedAt: number;
1165
+ }
1166
+ /** Variable definition for template documentation. */
1167
+ interface EmailTemplateVariable {
1168
+ /** Variable name (without braces, e.g. "userName"). */
1169
+ name: string;
1170
+ /** Human-readable description. */
1171
+ description?: string;
1172
+ /** Default value for previews. */
1173
+ defaultValue?: string;
1174
+ /** Whether this variable is required. */
1175
+ required?: boolean;
1176
+ }
1177
+ /** Metadata for the editor's block palette (drag source). */
1178
+ interface BlockPaletteMeta {
1179
+ type: EmailBlockType;
1180
+ label: string;
1181
+ description: string;
1182
+ icon: string;
1183
+ }
1184
+ /** Default palette entries for the editor sidebar. */
1185
+ declare const BLOCK_PALETTE: BlockPaletteMeta[];
1186
+ /** Create a default block of the given type. */
1187
+ declare function createDefaultBlock(type: EmailBlockType): EmailBlock;
1188
+ /**
1189
+ * Replace `{{variableName}}` placeholders in a string with values from a map.
1190
+ * Unmatched variables are left as-is.
1191
+ */
1192
+ declare function interpolateVariables(text: string, variables: Record<string, string>): string;
1193
+ /**
1194
+ * Extract all `{{variableName}}` references from an array of blocks.
1195
+ * Returns a deduplicated list of variable names.
1196
+ */
1197
+ declare function extractVariables(blocks: EmailBlock[]): string[];
1198
+ /**
1199
+ * Default block definitions for the 6 built-in auth email templates.
1200
+ * These serve as starting points that users can customize.
1201
+ */
1202
+ declare function getBuiltInTemplateBlocks(type: "verification" | "password-reset" | "magic-link" | "email-otp" | "invitation" | "welcome"): EmailBlock[];
1203
+
1204
+ export { type Account, type ApiKey, type AuditEvent, AuthenticationError, BLOCK_PALETTE, BanataAuthError, type BlockPaletteMeta, type ButtonBlock, type CodeBlock, type ColumnDef, type ColumnsBlock, ConflictError, type CreateAuditEventInput, type CreateOrganizationInput, type CreateSsoConnectionInput, type CreateUserInput, type CreateWebhookEndpointInput, type Directory, type DirectoryGroup, type DirectoryProvider, type DirectoryState, type DirectoryUser, type DividerBlock, type DomainVerification, type DomainVerificationState, type EmailBlock, type EmailBlockStyle, type EmailBlockType, type EmailTemplateCategory, type EmailTemplateDefinition, type EmailTemplateVariable, type FieldError, ForbiddenError, type HeadingBlock, ID_PREFIXES, type IdPrefix, type ImageBlock, InternalError, type InviteMemberInput, type LinkBlock, type ListMetadata, NotFoundError, type OidcConfig, type Organization, type OrganizationInvitation, type OrganizationMember, type PaginatedResult, type PaginationOptions, type PortalIntent, type PortalSession, type Project, RATE_LIMITS, RateLimitError, type ResourceType, type RuntimeAuthConfig, type RuntimeAuthFeatures, type RuntimeAuthMethods, type RuntimeAuthSessions, type RuntimeSocialProviderStatus, SIZE_LIMITS, type SamlConfig, type Session, type SpacerBlock, type SsoConnection, type SsoConnectionState, type SsoConnectionType, type SsoProfile, TOKEN_LIFETIMES, type Team, type TextBlock, type UpdateOrganizationInput, type UpdateUserInput, type User, ValidationError, type VaultSecret, WEBHOOK_MAX_ATTEMPTS, WEBHOOK_MAX_CONSECUTIVE_FAILURES, WEBHOOK_RETRY_DELAYS, type WebhookEndpoint, type WebhookEvent, createAuditEventSchema, createDefaultBlock, createErrorFromStatus, createOrganizationSchema, createSsoConnectionSchema, createUserSchema, createWebhookEndpointSchema, domainSchema, emailSchema, extractVariables, generateId, generateOtp, generateRandomToken, getBuiltInTemplateBlocks, getResourceType, httpsUrlSchema, interpolateVariables, inviteMemberSchema, listEnabledSocialProviderIds, metadataSchema, nameSchema, paginationSchema, passwordSchema, slugSchema, ulid, updateOrganizationSchema, updateUserSchema, urlSchema, validateId };