@parsrun/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/index.js ADDED
@@ -0,0 +1,1109 @@
1
+ import { type } from 'arktype';
2
+ export { type } from 'arktype';
3
+
4
+ // src/index.ts
5
+ var uuid = type("string.uuid");
6
+ var timestamp = type("string.date.iso");
7
+ var email = type("string.email");
8
+ var url = type("string.url");
9
+ var nonEmptyString = type("string >= 1");
10
+ var positiveInt = type("number.integer > 0");
11
+ var nonNegativeInt = type("number.integer >= 0");
12
+ var status = type("'active' | 'inactive' | 'suspended' | 'deleted'");
13
+ var sessionStatus = type("'active' | 'expired' | 'revoked'");
14
+ var pagination = type({
15
+ page: "number >= 1",
16
+ limit: "number >= 1",
17
+ "orderBy?": "string",
18
+ "orderDirection?": "'asc' | 'desc'"
19
+ });
20
+ var paginationMeta = type({
21
+ page: "number",
22
+ limit: "number",
23
+ total: "number",
24
+ totalPages: "number",
25
+ hasNext: "boolean",
26
+ hasPrev: "boolean"
27
+ });
28
+ var cursorPagination = type({
29
+ "cursor?": "string",
30
+ limit: "number >= 1",
31
+ "direction?": "'forward' | 'backward'"
32
+ });
33
+ var cursorPaginationMeta = type({
34
+ "cursor?": "string",
35
+ "nextCursor?": "string",
36
+ "prevCursor?": "string",
37
+ hasMore: "boolean",
38
+ limit: "number"
39
+ });
40
+ var successResponse = (dataSchema) => type({
41
+ success: "'true'",
42
+ data: dataSchema,
43
+ "message?": "string"
44
+ });
45
+ var errorResponse = type({
46
+ success: "'false'",
47
+ error: {
48
+ code: "string",
49
+ message: "string",
50
+ "details?": "unknown"
51
+ },
52
+ "message?": "string"
53
+ });
54
+ var paginatedResponse = (dataSchema) => type({
55
+ success: "boolean",
56
+ data: dataSchema,
57
+ pagination: paginationMeta,
58
+ "message?": "string"
59
+ });
60
+ var cursorPaginatedResponse = (dataSchema) => type({
61
+ success: "boolean",
62
+ data: dataSchema,
63
+ pagination: cursorPaginationMeta,
64
+ "message?": "string"
65
+ });
66
+ var parsError = type({
67
+ message: "string",
68
+ statusCode: "number >= 100",
69
+ "code?": "string",
70
+ "details?": "unknown"
71
+ });
72
+ var validationErrorDetail = type({
73
+ path: "string",
74
+ message: "string",
75
+ "expected?": "string",
76
+ "received?": "unknown"
77
+ });
78
+ var user = type({
79
+ id: uuid,
80
+ "displayName?": "string",
81
+ twoFactorEnabled: "boolean",
82
+ "twoFactorSecret?": "string",
83
+ status,
84
+ insertedAt: timestamp,
85
+ updatedAt: timestamp,
86
+ "deletedAt?": timestamp
87
+ });
88
+ var authMethod = type({
89
+ id: uuid,
90
+ userId: uuid,
91
+ provider: "'email' | 'phone' | 'google' | 'github' | 'microsoft' | 'apple'",
92
+ providerId: "string >= 1",
93
+ verified: "boolean",
94
+ "metadata?": "object",
95
+ insertedAt: timestamp,
96
+ updatedAt: timestamp,
97
+ "deletedAt?": timestamp
98
+ });
99
+ var session = type({
100
+ id: uuid,
101
+ userId: uuid,
102
+ "authMethodId?": uuid,
103
+ "currentTenantId?": uuid,
104
+ "refreshTokenHash?": "string",
105
+ csrfTokenHash: "string",
106
+ expiresAt: timestamp,
107
+ "refreshExpiresAt?": timestamp,
108
+ "deviceType?": "'mobile' | 'desktop' | 'tablet' | 'api'",
109
+ "deviceName?": "string",
110
+ "userAgent?": "string",
111
+ "ipAddress?": "string",
112
+ "locationData?": "object",
113
+ "deviceFingerprint?": "string",
114
+ status: sessionStatus,
115
+ lastActivityAt: timestamp,
116
+ "revokedAt?": timestamp,
117
+ "revokedReason?": "'user_logout' | 'admin_revoke' | 'security_breach' | 'suspicious_activity'",
118
+ insertedAt: timestamp,
119
+ updatedAt: timestamp,
120
+ "deletedAt?": timestamp
121
+ });
122
+ var tenantMembership = type({
123
+ id: uuid,
124
+ userId: uuid,
125
+ tenantId: uuid,
126
+ roleId: uuid,
127
+ status: "'active' | 'inactive' | 'invited' | 'suspended'",
128
+ permissions: "object",
129
+ accessLevel: "'full' | 'limited' | 'read_only'",
130
+ resourceRestrictions: "object",
131
+ "ipRestrictions?": "object",
132
+ "timeRestrictions?": "object",
133
+ "expiresAt?": timestamp,
134
+ "invitedBy?": uuid,
135
+ "invitedAt?": timestamp,
136
+ "joinedAt?": timestamp,
137
+ "lastLoginAt?": timestamp,
138
+ insertedAt: timestamp,
139
+ updatedAt: timestamp,
140
+ "deletedAt?": timestamp
141
+ });
142
+ var requestOTPRequest = type({
143
+ "email?": "string.email",
144
+ "phone?": "string >= 10",
145
+ "tenantId?": uuid
146
+ });
147
+ var requestOTPResponse = type({
148
+ success: "boolean",
149
+ message: "string",
150
+ "expiresAt?": timestamp,
151
+ "requiresTenantSelection?": "boolean",
152
+ "isNewUser?": "boolean",
153
+ "defaultTenantId?": uuid,
154
+ "defaultTenantName?": "string",
155
+ "selectedTenantId?": uuid,
156
+ "selectedTenantName?": "string",
157
+ "tenants?": type({
158
+ id: uuid,
159
+ name: "string",
160
+ role: "string"
161
+ }).array()
162
+ });
163
+ var verifyOTPRequest = type({
164
+ "email?": "string.email",
165
+ "phone?": "string >= 10",
166
+ code: "string >= 6",
167
+ "tenantId?": uuid
168
+ });
169
+ var resendOTPRequest = type({
170
+ "email?": "string.email",
171
+ "phone?": "string >= 10"
172
+ });
173
+ var loginResponseData = type({
174
+ user,
175
+ session: {
176
+ accessToken: "string",
177
+ expiresAt: timestamp,
178
+ csrfToken: "string"
179
+ },
180
+ "refreshToken?": "string",
181
+ authMethod: {
182
+ id: uuid,
183
+ provider: "'email' | 'phone' | 'google' | 'github' | 'microsoft' | 'apple'",
184
+ providerId: "string >= 1",
185
+ verified: "boolean",
186
+ "metadata?": "object"
187
+ },
188
+ "tenantMemberships?": tenantMembership.array(),
189
+ isNewUser: "boolean"
190
+ });
191
+ var loginResponse = type({
192
+ success: "boolean",
193
+ data: loginResponseData,
194
+ "message?": "string"
195
+ });
196
+ var currentUserResponseData = type({
197
+ user,
198
+ "authMethod?": {
199
+ id: uuid,
200
+ provider: "'email' | 'phone' | 'google' | 'github' | 'microsoft' | 'apple'",
201
+ providerId: "string >= 1",
202
+ verified: "boolean",
203
+ "metadata?": "object"
204
+ },
205
+ tenantMemberships: tenantMembership.array(),
206
+ roles: type({
207
+ id: uuid,
208
+ name: "string",
209
+ "description?": "string"
210
+ }).array(),
211
+ permissions: "string[]",
212
+ currentTenant: uuid
213
+ });
214
+ var currentUserResponse = type({
215
+ success: "boolean",
216
+ data: currentUserResponseData,
217
+ "message?": "string"
218
+ });
219
+ var refreshTokenRequest = type({
220
+ refreshToken: "string"
221
+ });
222
+ var tokenInfo = type({
223
+ accessToken: "string",
224
+ "refreshToken?": "string",
225
+ expiresAt: "Date",
226
+ csrfToken: "string",
227
+ "tenantId?": uuid
228
+ });
229
+ var jwtPayload = type({
230
+ sub: uuid,
231
+ tenantId: uuid,
232
+ "sessionId?": uuid,
233
+ "roles?": "string[]",
234
+ "permissions?": "string[]",
235
+ iat: "number",
236
+ exp: "number",
237
+ "aud?": "string",
238
+ "iss?": "string"
239
+ });
240
+ var permission = type({
241
+ id: uuid,
242
+ name: "string >= 1",
243
+ "description?": "string",
244
+ resource: "string >= 1",
245
+ action: "'create' | 'read' | 'update' | 'delete' | 'list' | 'manage'",
246
+ scope: "'tenant' | 'global' | 'own'",
247
+ isSystem: "boolean",
248
+ insertedAt: timestamp,
249
+ updatedAt: timestamp
250
+ });
251
+ var role = type({
252
+ id: uuid,
253
+ tenantId: uuid,
254
+ name: "string >= 1",
255
+ "description?": "string",
256
+ isSystem: "boolean",
257
+ isActive: "boolean",
258
+ "color?": "string",
259
+ insertedAt: timestamp,
260
+ updatedAt: timestamp,
261
+ "deletedAt?": timestamp
262
+ });
263
+ var permissionCheck = type({
264
+ resource: "string >= 1",
265
+ action: "string >= 1",
266
+ "scope?": "'tenant' | 'global' | 'own'",
267
+ "resourceId?": "string"
268
+ });
269
+ var logoutRequest = type({
270
+ "refreshToken?": "string",
271
+ allDevices: "boolean"
272
+ });
273
+ var revokeSessionRequest = type({
274
+ "reason?": "'user_logout' | 'admin_revoke' | 'security_breach' | 'suspicious_activity'"
275
+ });
276
+ var revokeAllSessionsRequest = type({
277
+ "reason?": "'user_logout' | 'admin_revoke' | 'security_breach' | 'suspicious_activity'",
278
+ "excludeCurrent?": "boolean"
279
+ });
280
+ var revokeAllSessionsResponse = type({
281
+ success: "boolean",
282
+ message: "string",
283
+ revokedCount: "number"
284
+ });
285
+ var sendVerificationEmailRequest = type({
286
+ email: "string.email"
287
+ });
288
+ var verifyEmailRequest = type({
289
+ token: "string >= 1"
290
+ });
291
+ var checkVerificationStatusRequest = type({
292
+ email: "string.email"
293
+ });
294
+ var checkVerificationStatusResponse = type({
295
+ success: "boolean",
296
+ verified: "boolean",
297
+ message: "string",
298
+ "sentAt?": timestamp,
299
+ "expiresAt?": timestamp
300
+ });
301
+ var csrfTokenRequest = type({
302
+ csrfToken: "string >= 1"
303
+ });
304
+ var sessionConfig = type({
305
+ "accessTokenExpiry?": "number > 0",
306
+ "refreshTokenExpiry?": "number > 0",
307
+ "slidingWindow?": "boolean",
308
+ "maxSessions?": "number > 0",
309
+ "invalidateOnPasswordChange?": "boolean"
310
+ });
311
+ var jwtConfig = type({
312
+ "algorithm?": "'HS256' | 'HS384' | 'HS512' | 'RS256' | 'RS384' | 'RS512' | 'ES256' | 'ES384' | 'ES512'",
313
+ "issuer?": "string",
314
+ "audience?": "string | string[]"
315
+ });
316
+ var cookieConfig = type({
317
+ "prefix?": "string",
318
+ "domain?": "string",
319
+ "path?": "string",
320
+ "secure?": "boolean",
321
+ "sameSite?": "'strict' | 'lax' | 'none'",
322
+ "httpOnly?": "boolean"
323
+ });
324
+ var csrfConfig = type({
325
+ "enabled?": "boolean",
326
+ "headerName?": "string",
327
+ "cookieName?": "string"
328
+ });
329
+ var rateLimitConfig = type({
330
+ "enabled?": "boolean",
331
+ "loginAttempts?": "number > 0",
332
+ "windowSize?": "number > 0"
333
+ });
334
+ var lockoutConfig = type({
335
+ "enabled?": "boolean",
336
+ "maxAttempts?": "number > 0",
337
+ "duration?": "number > 0"
338
+ });
339
+ var securityConfig = type({
340
+ "rateLimit?": rateLimitConfig,
341
+ "lockout?": lockoutConfig,
342
+ "csrf?": csrfConfig
343
+ });
344
+ var tenantConfig = type({
345
+ "enabled?": "boolean",
346
+ "strategy?": "'subdomain' | 'header' | 'path' | 'query' | 'custom'",
347
+ "headerName?": "string",
348
+ "resolver?": "Function"
349
+ });
350
+ var oauthProviderConfig = type({
351
+ "enabled?": "boolean",
352
+ clientId: "string",
353
+ clientSecret: "string",
354
+ "scopes?": "string[]",
355
+ "callbackUrl?": "string"
356
+ });
357
+ var otpEmailConfig = type({
358
+ "enabled?": "boolean",
359
+ "expiresIn?": "number > 0",
360
+ "length?": "number >= 4",
361
+ "maxAttempts?": "number > 0",
362
+ "rateLimit?": "number > 0",
363
+ "rateLimitWindow?": "number > 0",
364
+ send: "Function"
365
+ });
366
+ var otpSmsConfig = type({
367
+ "enabled?": "boolean",
368
+ "expiresIn?": "number > 0",
369
+ "length?": "number >= 4",
370
+ "maxAttempts?": "number > 0",
371
+ "rateLimit?": "number > 0",
372
+ "rateLimitWindow?": "number > 0",
373
+ send: "Function"
374
+ });
375
+ var otpConfig = type({
376
+ "enabled?": "boolean",
377
+ "email?": otpEmailConfig,
378
+ "sms?": otpSmsConfig
379
+ });
380
+ var magicLinkConfig = type({
381
+ "enabled?": "boolean",
382
+ "expiresIn?": "number > 0",
383
+ send: "Function"
384
+ });
385
+ var totpConfig = type({
386
+ "enabled?": "boolean",
387
+ "issuer?": "string",
388
+ "backupCodesCount?": "number > 0"
389
+ });
390
+ var webauthnConfig = type({
391
+ "enabled?": "boolean",
392
+ rpName: "string",
393
+ rpId: "string",
394
+ "origins?": "string[]"
395
+ });
396
+ var passwordConfig = type({
397
+ "enabled?": "boolean",
398
+ "minLength?": "number >= 6",
399
+ "requireUppercase?": "boolean",
400
+ "requireLowercase?": "boolean",
401
+ "requireNumbers?": "boolean",
402
+ "requireSymbols?": "boolean",
403
+ "checkCommonPasswords?": "boolean"
404
+ });
405
+ var oauthProvidersConfig = type({
406
+ "google?": oauthProviderConfig,
407
+ "github?": oauthProviderConfig,
408
+ "microsoft?": oauthProviderConfig,
409
+ "apple?": oauthProviderConfig,
410
+ "custom?": type("Record<string, unknown>")
411
+ });
412
+ var providersConfig = type({
413
+ "otp?": otpConfig,
414
+ "magicLink?": magicLinkConfig,
415
+ "oauth?": oauthProvidersConfig,
416
+ "totp?": totpConfig,
417
+ "webauthn?": webauthnConfig,
418
+ "password?": passwordConfig
419
+ });
420
+ var storageConfig = type({
421
+ "type?": "'memory' | 'redis' | 'upstash' | 'cloudflare-kv' | 'deno-kv' | 'custom'",
422
+ "redis?": "object",
423
+ "upstash?": "object",
424
+ "cloudflareKv?": "object",
425
+ "denoKv?": "object",
426
+ "custom?": "object"
427
+ });
428
+ var parsAuthConfig = type({
429
+ secret: "string >= 32",
430
+ "baseUrl?": "string",
431
+ "storage?": storageConfig,
432
+ "providers?": providersConfig,
433
+ "session?": sessionConfig,
434
+ "jwt?": jwtConfig,
435
+ "cookies?": cookieConfig,
436
+ "security?": securityConfig,
437
+ "tenant?": tenantConfig,
438
+ adapter: "object",
439
+ "callbacks?": "object"
440
+ });
441
+ var tenant = type({
442
+ id: uuid,
443
+ name: "string >= 1",
444
+ "slug?": "string",
445
+ "description?": "string",
446
+ status,
447
+ "settings?": "object",
448
+ "metadata?": "object",
449
+ "logoUrl?": "string",
450
+ "primaryColor?": "string",
451
+ "timezone?": "string",
452
+ "locale?": "string",
453
+ "currency?": "string",
454
+ insertedAt: timestamp,
455
+ updatedAt: timestamp,
456
+ "deletedAt?": timestamp
457
+ });
458
+ var createTenantRequest = type({
459
+ name: "string >= 1",
460
+ "slug?": "string",
461
+ "description?": "string",
462
+ "settings?": "object",
463
+ "logoUrl?": "string",
464
+ "primaryColor?": "string",
465
+ "timezone?": "string",
466
+ "locale?": "string",
467
+ "currency?": "string"
468
+ });
469
+ var updateTenantRequest = type({
470
+ "name?": "string >= 1",
471
+ "slug?": "string",
472
+ "description?": "string",
473
+ "settings?": "object",
474
+ "logoUrl?": "string",
475
+ "primaryColor?": "string",
476
+ "timezone?": "string",
477
+ "locale?": "string",
478
+ "currency?": "string",
479
+ "status?": status
480
+ });
481
+ var inviteTenantMemberRequest = type({
482
+ email: "string.email",
483
+ roleId: uuid,
484
+ "accessLevel?": "'full' | 'limited' | 'read_only'",
485
+ "expiresAt?": timestamp,
486
+ "message?": "string"
487
+ });
488
+ var tenantMemberListQuery = type({
489
+ "page?": "number >= 1",
490
+ "limit?": "number >= 1",
491
+ "status?": "'active' | 'inactive' | 'invited' | 'suspended'",
492
+ "roleId?": uuid,
493
+ "search?": "string"
494
+ });
495
+ var switchTenantRequest = type({
496
+ tenantId: uuid
497
+ });
498
+ var emailAddress = type({
499
+ email: "string.email",
500
+ "name?": "string"
501
+ });
502
+ var emailRecipient = type("string.email | object");
503
+ var emailAttachment = type({
504
+ filename: "string >= 1",
505
+ content: "string | object",
506
+ "contentType?": "string",
507
+ "encoding?": "'base64' | 'utf-8' | 'binary'",
508
+ "contentId?": "string",
509
+ "disposition?": "'attachment' | 'inline'"
510
+ });
511
+ var sendEmailOptions = type({
512
+ to: "string.email | string.email[] | object | object[]",
513
+ "cc?": "string.email | string.email[] | object | object[]",
514
+ "bcc?": "string.email | string.email[] | object | object[]",
515
+ "from?": "string.email | object",
516
+ "replyTo?": "string.email | object",
517
+ subject: "string >= 1",
518
+ "text?": "string",
519
+ "html?": "string",
520
+ "attachments?": emailAttachment.array(),
521
+ "headers?": "object",
522
+ "priority?": "'high' | 'normal' | 'low'",
523
+ "tags?": "string[]",
524
+ "metadata?": "object"
525
+ });
526
+ var sendTemplateEmailOptions = type({
527
+ to: "string.email | string.email[] | object | object[]",
528
+ "cc?": "string.email | string.email[] | object | object[]",
529
+ "bcc?": "string.email | string.email[] | object | object[]",
530
+ "from?": "string.email | object",
531
+ "replyTo?": "string.email | object",
532
+ template: "string >= 1",
533
+ "data?": "object",
534
+ "attachments?": emailAttachment.array(),
535
+ "headers?": "object",
536
+ "priority?": "'high' | 'normal' | 'low'",
537
+ "tags?": "string[]",
538
+ "metadata?": "object"
539
+ });
540
+ var emailSendResult = type({
541
+ success: "boolean",
542
+ messageId: "string",
543
+ "accepted?": "string[]",
544
+ "rejected?": "string[]",
545
+ "pending?": "string[]"
546
+ });
547
+ var smtpConfig = type({
548
+ host: "string >= 1",
549
+ port: "number > 0",
550
+ "secure?": "boolean",
551
+ "auth?": {
552
+ user: "string",
553
+ pass: "string"
554
+ },
555
+ "tls?": "object"
556
+ });
557
+ var resendConfig = type({
558
+ apiKey: "string >= 1",
559
+ "domain?": "string"
560
+ });
561
+ var sendgridConfig = type({
562
+ apiKey: "string >= 1"
563
+ });
564
+ var sesConfig = type({
565
+ region: "string >= 1",
566
+ "accessKeyId?": "string",
567
+ "secretAccessKey?": "string",
568
+ "endpoint?": "string"
569
+ });
570
+ var postmarkConfig = type({
571
+ serverToken: "string >= 1"
572
+ });
573
+ var emailConfig = type({
574
+ provider: "'smtp' | 'resend' | 'sendgrid' | 'ses' | 'postmark' | 'mailgun'",
575
+ "from?": "string.email | object",
576
+ "replyTo?": "string.email | object",
577
+ "smtp?": smtpConfig,
578
+ "resend?": resendConfig,
579
+ "sendgrid?": sendgridConfig,
580
+ "ses?": sesConfig,
581
+ "postmark?": postmarkConfig,
582
+ "templates?": "object"
583
+ });
584
+ var fileMetadata = type({
585
+ id: uuid,
586
+ filename: "string >= 1",
587
+ originalName: "string >= 1",
588
+ mimeType: "string",
589
+ size: "number >= 0",
590
+ "path?": "string",
591
+ "url?": "string",
592
+ bucket: "string",
593
+ "etag?": "string",
594
+ "metadata?": "object",
595
+ "uploadedBy?": uuid,
596
+ "tenantId?": uuid,
597
+ insertedAt: timestamp,
598
+ updatedAt: timestamp,
599
+ "deletedAt?": timestamp
600
+ });
601
+ var uploadOptions = type({
602
+ "path?": "string",
603
+ "filename?": "string",
604
+ "contentType?": "string",
605
+ "metadata?": "object",
606
+ "acl?": "'private' | 'public-read' | 'authenticated-read'",
607
+ "cacheControl?": "string",
608
+ "contentDisposition?": "string"
609
+ });
610
+ var signedUrlOptions = type({
611
+ "expiresIn?": "number > 0",
612
+ "method?": "'GET' | 'PUT'",
613
+ "contentType?": "string",
614
+ "responseContentType?": "string",
615
+ "responseContentDisposition?": "string"
616
+ });
617
+ var listFilesOptions = type({
618
+ "prefix?": "string",
619
+ "limit?": "number >= 1",
620
+ "cursor?": "string",
621
+ "delimiter?": "string"
622
+ });
623
+ var listFilesResult = type({
624
+ files: fileMetadata.array(),
625
+ "nextCursor?": "string",
626
+ hasMore: "boolean"
627
+ });
628
+ var localStorageConfig = type({
629
+ basePath: "string >= 1",
630
+ "baseUrl?": "string",
631
+ "permissions?": "number"
632
+ });
633
+ var s3StorageConfig = type({
634
+ bucket: "string >= 1",
635
+ region: "string >= 1",
636
+ "endpoint?": "string",
637
+ "accessKeyId?": "string",
638
+ "secretAccessKey?": "string",
639
+ "forcePathStyle?": "boolean",
640
+ "acl?": "'private' | 'public-read' | 'authenticated-read'"
641
+ });
642
+ var r2StorageConfig = type({
643
+ accountId: "string >= 1",
644
+ bucket: "string >= 1",
645
+ accessKeyId: "string >= 1",
646
+ secretAccessKey: "string >= 1",
647
+ "publicUrl?": "string"
648
+ });
649
+ var gcsStorageConfig = type({
650
+ bucket: "string >= 1",
651
+ "projectId?": "string",
652
+ "credentials?": "object",
653
+ "keyFilename?": "string"
654
+ });
655
+ var storageProviderConfig = type({
656
+ provider: "'local' | 's3' | 'r2' | 'gcs' | 'azure'",
657
+ "defaultBucket?": "string",
658
+ "local?": localStorageConfig,
659
+ "s3?": s3StorageConfig,
660
+ "r2?": r2StorageConfig,
661
+ "gcs?": gcsStorageConfig
662
+ });
663
+ var jobStatus = type(
664
+ "'pending' | 'active' | 'completed' | 'failed' | 'delayed' | 'paused'"
665
+ );
666
+ var job = type({
667
+ id: uuid,
668
+ queue: "string >= 1",
669
+ name: "string >= 1",
670
+ data: "unknown",
671
+ "result?": "unknown",
672
+ "error?": "string",
673
+ status: jobStatus,
674
+ attempts: "number >= 0",
675
+ maxAttempts: "number >= 1",
676
+ "priority?": "number",
677
+ "delay?": "number >= 0",
678
+ "progress?": "number >= 0",
679
+ "startedAt?": timestamp,
680
+ "completedAt?": timestamp,
681
+ "failedAt?": timestamp,
682
+ "processedBy?": "string",
683
+ insertedAt: timestamp,
684
+ updatedAt: timestamp
685
+ });
686
+ var jobOptions = type({
687
+ "priority?": "number",
688
+ "delay?": "number >= 0",
689
+ "attempts?": "number >= 1",
690
+ "backoff?": {
691
+ type: "'fixed' | 'exponential'",
692
+ "delay?": "number >= 0"
693
+ },
694
+ "timeout?": "number > 0",
695
+ "removeOnComplete?": "boolean | number",
696
+ "removeOnFail?": "boolean | number",
697
+ "repeat?": {
698
+ "pattern?": "string",
699
+ "every?": "number > 0",
700
+ "limit?": "number >= 1",
701
+ "tz?": "string"
702
+ }
703
+ });
704
+ var addJobRequest = type({
705
+ name: "string >= 1",
706
+ data: "unknown",
707
+ "options?": jobOptions
708
+ });
709
+ var jobProgressUpdate = type({
710
+ progress: "number >= 0",
711
+ "message?": "string",
712
+ "data?": "unknown"
713
+ });
714
+ var queueStats = type({
715
+ name: "string",
716
+ pending: "number >= 0",
717
+ active: "number >= 0",
718
+ completed: "number >= 0",
719
+ failed: "number >= 0",
720
+ delayed: "number >= 0",
721
+ paused: "boolean"
722
+ });
723
+ var queueListOptions = type({
724
+ "status?": jobStatus,
725
+ "start?": "number >= 0",
726
+ "end?": "number",
727
+ "order?": "'asc' | 'desc'"
728
+ });
729
+ var redisQueueConfig = type({
730
+ "host?": "string",
731
+ "port?": "number > 0",
732
+ "password?": "string",
733
+ "db?": "number >= 0",
734
+ "url?": "string",
735
+ "tls?": "boolean | object"
736
+ });
737
+ var workerOptions = type({
738
+ "concurrency?": "number >= 1",
739
+ "limiter?": {
740
+ max: "number >= 1",
741
+ duration: "number > 0"
742
+ },
743
+ "lockDuration?": "number > 0",
744
+ "lockRenewTime?": "number > 0",
745
+ "stalledInterval?": "number > 0",
746
+ "maxStalledCount?": "number >= 0"
747
+ });
748
+ var queueConfig = type({
749
+ provider: "'bullmq' | 'sqs' | 'rabbitmq' | 'memory'",
750
+ "defaultJobOptions?": jobOptions,
751
+ "redis?": redisQueueConfig,
752
+ "prefix?": "string",
753
+ "worker?": workerOptions
754
+ });
755
+ var cacheSetOptions = type({
756
+ "ttl?": "number > 0",
757
+ "tags?": "string[]",
758
+ "metadata?": "object"
759
+ });
760
+ var cacheGetResult = type({
761
+ value: "unknown",
762
+ "ttl?": "number",
763
+ "createdAt?": "number",
764
+ "tags?": "string[]"
765
+ });
766
+ var cacheStats = type({
767
+ hits: "number >= 0",
768
+ misses: "number >= 0",
769
+ keys: "number >= 0",
770
+ "memory?": "number >= 0"
771
+ });
772
+ var memoryCacheConfig = type({
773
+ "maxSize?": "number > 0",
774
+ "ttl?": "number > 0",
775
+ "checkInterval?": "number > 0",
776
+ "stale?": "boolean"
777
+ });
778
+ var redisCacheConfig = type({
779
+ "host?": "string",
780
+ "port?": "number > 0",
781
+ "password?": "string",
782
+ "db?": "number >= 0",
783
+ "url?": "string",
784
+ "tls?": "boolean | object",
785
+ "keyPrefix?": "string",
786
+ "ttl?": "number > 0"
787
+ });
788
+ var upstashCacheConfig = type({
789
+ url: "string >= 1",
790
+ token: "string >= 1",
791
+ "keyPrefix?": "string",
792
+ "ttl?": "number > 0"
793
+ });
794
+ var cloudflareKvConfig = type({
795
+ namespaceId: "string >= 1",
796
+ "accountId?": "string",
797
+ "apiToken?": "string",
798
+ "keyPrefix?": "string"
799
+ });
800
+ var multiTierCacheConfig = type({
801
+ tiers: type({
802
+ type: "'memory' | 'redis' | 'upstash' | 'cloudflare-kv'",
803
+ "priority?": "number",
804
+ "ttl?": "number > 0",
805
+ "config?": "object"
806
+ }).array(),
807
+ "writeThrough?": "boolean",
808
+ "readThrough?": "boolean"
809
+ });
810
+ var cacheConfig = type({
811
+ provider: "'memory' | 'redis' | 'upstash' | 'cloudflare-kv' | 'multi-tier'",
812
+ "ttl?": "number > 0",
813
+ "keyPrefix?": "string",
814
+ "memory?": memoryCacheConfig,
815
+ "redis?": redisCacheConfig,
816
+ "upstash?": upstashCacheConfig,
817
+ "cloudflareKv?": cloudflareKvConfig,
818
+ "multiTier?": multiTierCacheConfig
819
+ });
820
+ var currencyCode = type("string >= 3");
821
+ var money = type({
822
+ amount: "number",
823
+ currency: currencyCode
824
+ });
825
+ var paymentCustomer = type({
826
+ id: uuid,
827
+ "externalId?": "string",
828
+ email: "string.email",
829
+ "name?": "string",
830
+ "phone?": "string",
831
+ "metadata?": "object",
832
+ insertedAt: timestamp,
833
+ updatedAt: timestamp
834
+ });
835
+ var createCustomerRequest = type({
836
+ email: "string.email",
837
+ "name?": "string",
838
+ "phone?": "string",
839
+ "metadata?": "object"
840
+ });
841
+ var cardDetails = type({
842
+ brand: "string",
843
+ last4: "string",
844
+ expMonth: "number >= 1",
845
+ expYear: "number >= 2000",
846
+ "fingerprint?": "string"
847
+ });
848
+ var paymentMethod = type({
849
+ id: uuid,
850
+ "externalId?": "string",
851
+ customerId: uuid,
852
+ type: "'card' | 'bank_account' | 'paypal' | 'crypto' | 'other'",
853
+ "card?": cardDetails,
854
+ isDefault: "boolean",
855
+ "metadata?": "object",
856
+ insertedAt: timestamp,
857
+ updatedAt: timestamp
858
+ });
859
+ var paymentIntentStatus = type(
860
+ "'created' | 'processing' | 'requires_action' | 'succeeded' | 'failed' | 'canceled'"
861
+ );
862
+ var paymentIntent = type({
863
+ id: uuid,
864
+ "externalId?": "string",
865
+ customerId: uuid,
866
+ "paymentMethodId?": uuid,
867
+ amount: "number > 0",
868
+ currency: currencyCode,
869
+ status: paymentIntentStatus,
870
+ "description?": "string",
871
+ "metadata?": "object",
872
+ "clientSecret?": "string",
873
+ "failureReason?": "string",
874
+ insertedAt: timestamp,
875
+ updatedAt: timestamp
876
+ });
877
+ var createPaymentIntentRequest = type({
878
+ customerId: uuid,
879
+ amount: "number > 0",
880
+ currency: currencyCode,
881
+ "paymentMethodId?": uuid,
882
+ "description?": "string",
883
+ "metadata?": "object",
884
+ "confirm?": "boolean",
885
+ "returnUrl?": "string"
886
+ });
887
+ var subscriptionStatus = type(
888
+ "'active' | 'past_due' | 'canceled' | 'incomplete' | 'incomplete_expired' | 'trialing' | 'paused'"
889
+ );
890
+ var priceInterval = type("'day' | 'week' | 'month' | 'year'");
891
+ var price = type({
892
+ id: uuid,
893
+ "externalId?": "string",
894
+ productId: uuid,
895
+ amount: "number >= 0",
896
+ currency: currencyCode,
897
+ interval: priceInterval,
898
+ "intervalCount?": "number >= 1",
899
+ "trialDays?": "number >= 0",
900
+ isActive: "boolean",
901
+ "metadata?": "object"
902
+ });
903
+ var subscription = type({
904
+ id: uuid,
905
+ "externalId?": "string",
906
+ customerId: uuid,
907
+ priceId: uuid,
908
+ status: subscriptionStatus,
909
+ currentPeriodStart: timestamp,
910
+ currentPeriodEnd: timestamp,
911
+ "cancelAt?": timestamp,
912
+ "canceledAt?": timestamp,
913
+ "trialStart?": timestamp,
914
+ "trialEnd?": timestamp,
915
+ "metadata?": "object",
916
+ insertedAt: timestamp,
917
+ updatedAt: timestamp
918
+ });
919
+ var createSubscriptionRequest = type({
920
+ customerId: uuid,
921
+ priceId: uuid,
922
+ "paymentMethodId?": uuid,
923
+ "trialDays?": "number >= 0",
924
+ "metadata?": "object"
925
+ });
926
+ var refundStatus = type("'pending' | 'succeeded' | 'failed' | 'canceled'");
927
+ var refund = type({
928
+ id: uuid,
929
+ "externalId?": "string",
930
+ paymentIntentId: uuid,
931
+ amount: "number > 0",
932
+ currency: currencyCode,
933
+ status: refundStatus,
934
+ "reason?": "string",
935
+ "metadata?": "object",
936
+ insertedAt: timestamp,
937
+ updatedAt: timestamp
938
+ });
939
+ var createRefundRequest = type({
940
+ paymentIntentId: uuid,
941
+ "amount?": "number > 0",
942
+ "reason?": "string",
943
+ "metadata?": "object"
944
+ });
945
+ var webhookEventType = type(
946
+ "'payment.succeeded' | 'payment.failed' | 'subscription.created' | 'subscription.updated' | 'subscription.canceled' | 'refund.created' | 'customer.created' | 'customer.updated'"
947
+ );
948
+ var webhookEvent = type({
949
+ id: uuid,
950
+ type: webhookEventType,
951
+ data: "object",
952
+ "livemode?": "boolean",
953
+ "apiVersion?": "string",
954
+ createdAt: timestamp
955
+ });
956
+ var stripeConfig = type({
957
+ secretKey: "string >= 1",
958
+ "publishableKey?": "string",
959
+ "webhookSecret?": "string",
960
+ "apiVersion?": "string"
961
+ });
962
+ var paddleConfig = type({
963
+ vendorId: "string >= 1",
964
+ vendorAuthCode: "string >= 1",
965
+ "publicKey?": "string",
966
+ "webhookSecret?": "string",
967
+ "sandbox?": "boolean"
968
+ });
969
+ var iyzicoConfig = type({
970
+ apiKey: "string >= 1",
971
+ secretKey: "string >= 1",
972
+ baseUrl: "string >= 1",
973
+ "sandbox?": "boolean"
974
+ });
975
+ var paymentsConfig = type({
976
+ provider: "'stripe' | 'paddle' | 'iyzico'",
977
+ "currency?": currencyCode,
978
+ "stripe?": stripeConfig,
979
+ "paddle?": paddleConfig,
980
+ "iyzico?": iyzicoConfig,
981
+ "webhookPath?": "string"
982
+ });
983
+ var uuidParam = type({
984
+ id: uuid
985
+ });
986
+ var paginationQuery = type({
987
+ "page?": "string",
988
+ "limit?": "string",
989
+ "orderBy?": "string",
990
+ "orderDirection?": "'asc' | 'desc'"
991
+ });
992
+ var cursorPaginationQuery = type({
993
+ "cursor?": "string",
994
+ "limit?": "string",
995
+ "direction?": "'forward' | 'backward'"
996
+ });
997
+ var searchQuery = type({
998
+ "q?": "string",
999
+ "search?": "string",
1000
+ "filter?": "string"
1001
+ });
1002
+ var dateRangeQuery = type({
1003
+ "startDate?": "string.date.iso",
1004
+ "endDate?": "string.date.iso"
1005
+ });
1006
+ var healthResponse = type({
1007
+ status: "'healthy' | 'degraded' | 'unhealthy'",
1008
+ timestamp: "string",
1009
+ "version?": "string",
1010
+ "uptime?": "number",
1011
+ checks: type({
1012
+ name: "string",
1013
+ status: "'healthy' | 'degraded' | 'unhealthy'",
1014
+ "message?": "string",
1015
+ "latency?": "number"
1016
+ }).array()
1017
+ });
1018
+ var apiInfoResponse = type({
1019
+ name: "string",
1020
+ version: "string",
1021
+ "description?": "string",
1022
+ "environment?": "string",
1023
+ "documentation?": "string"
1024
+ });
1025
+ var corsConfig = type({
1026
+ "origin?": "string | string[] | boolean | Function",
1027
+ "methods?": "string[]",
1028
+ "allowedHeaders?": "string[]",
1029
+ "exposedHeaders?": "string[]",
1030
+ "credentials?": "boolean",
1031
+ "maxAge?": "number"
1032
+ });
1033
+ var serverRateLimitConfig = type({
1034
+ "enabled?": "boolean",
1035
+ "windowMs?": "number > 0",
1036
+ "max?": "number > 0",
1037
+ "keyGenerator?": "Function",
1038
+ "skip?": "Function",
1039
+ "message?": "string"
1040
+ });
1041
+ var loggerConfig = type({
1042
+ "level?": "'debug' | 'info' | 'warn' | 'error'",
1043
+ "format?": "'json' | 'pretty' | 'combined' | 'short'",
1044
+ "redact?": "string[]",
1045
+ "timestamp?": "boolean"
1046
+ });
1047
+ var serverConfig = type({
1048
+ "port?": "number > 0",
1049
+ "host?": "string",
1050
+ "basePath?": "string",
1051
+ "cors?": corsConfig,
1052
+ "rateLimit?": serverRateLimitConfig,
1053
+ "logger?": loggerConfig,
1054
+ "trustProxy?": "boolean",
1055
+ "strictRouting?": "boolean",
1056
+ "caseSensitiveRouting?": "boolean"
1057
+ });
1058
+ var authContext = type({
1059
+ userId: uuid,
1060
+ "tenantId?": uuid,
1061
+ "sessionId?": uuid,
1062
+ "roles?": "string[]",
1063
+ "permissions?": "string[]"
1064
+ });
1065
+ var requestContext = type({
1066
+ requestId: "string",
1067
+ "startTime?": "number",
1068
+ "ip?": "string",
1069
+ "userAgent?": "string",
1070
+ "auth?": authContext
1071
+ });
1072
+ function validateWithSchema(schema, data) {
1073
+ const result = schema(data);
1074
+ if (result instanceof type.errors) {
1075
+ const errors = result.map((e) => `${String(e.path)}: ${e.message}`).join("\n");
1076
+ throw new Error(`Validation failed:
1077
+ ${errors}`);
1078
+ }
1079
+ return result;
1080
+ }
1081
+ function safeValidate(schema, data) {
1082
+ const result = schema(data);
1083
+ if (result instanceof type.errors) {
1084
+ return {
1085
+ success: false,
1086
+ errors: result.map((e) => `${String(e.path)}: ${e.message}`)
1087
+ };
1088
+ }
1089
+ return {
1090
+ success: true,
1091
+ data: result
1092
+ };
1093
+ }
1094
+ function isValid(schema, data) {
1095
+ const result = schema(data);
1096
+ return !(result instanceof type.errors);
1097
+ }
1098
+ function formatErrors(errors) {
1099
+ const formatted = {};
1100
+ for (const error of errors) {
1101
+ const path = String(error.path) || "root";
1102
+ formatted[path] = error.message;
1103
+ }
1104
+ return formatted;
1105
+ }
1106
+
1107
+ export { addJobRequest, apiInfoResponse, authContext, authMethod, cacheConfig, cacheGetResult, cacheSetOptions, cacheStats, cardDetails, checkVerificationStatusRequest, checkVerificationStatusResponse, cloudflareKvConfig, cookieConfig, corsConfig, createCustomerRequest, createPaymentIntentRequest, createRefundRequest, createSubscriptionRequest, createTenantRequest, csrfConfig, csrfTokenRequest, currencyCode, currentUserResponse, currentUserResponseData, cursorPaginatedResponse, cursorPagination, cursorPaginationMeta, cursorPaginationQuery, dateRangeQuery, email, emailAddress, emailAttachment, emailConfig, emailRecipient, emailSendResult, errorResponse, fileMetadata, formatErrors, gcsStorageConfig, healthResponse, inviteTenantMemberRequest, isValid, iyzicoConfig, job, jobOptions, jobProgressUpdate, jobStatus, jwtConfig, jwtPayload, listFilesOptions, listFilesResult, localStorageConfig, lockoutConfig, loggerConfig, loginResponse, loginResponseData, logoutRequest, magicLinkConfig, memoryCacheConfig, money, multiTierCacheConfig, nonEmptyString, nonNegativeInt, oauthProviderConfig, oauthProvidersConfig, otpConfig, otpEmailConfig, otpSmsConfig, paddleConfig, paginatedResponse, pagination, paginationMeta, paginationQuery, parsAuthConfig, parsError, passwordConfig, paymentCustomer, paymentIntent, paymentIntentStatus, paymentMethod, paymentsConfig, permission, permissionCheck, positiveInt, postmarkConfig, price, priceInterval, providersConfig, queueConfig, queueListOptions, queueStats, r2StorageConfig, rateLimitConfig, redisCacheConfig, redisQueueConfig, refreshTokenRequest, refund, refundStatus, requestContext, requestOTPRequest, requestOTPResponse, resendConfig, resendOTPRequest, revokeAllSessionsRequest, revokeAllSessionsResponse, revokeSessionRequest, role, s3StorageConfig, safeValidate, searchQuery, securityConfig, sendEmailOptions, sendTemplateEmailOptions, sendVerificationEmailRequest, sendgridConfig, serverConfig, serverRateLimitConfig, sesConfig, session, sessionConfig, sessionStatus, signedUrlOptions, smtpConfig, status, storageConfig, storageProviderConfig, stripeConfig, subscription, subscriptionStatus, successResponse, switchTenantRequest, tenant, tenantConfig, tenantMemberListQuery, tenantMembership, timestamp, tokenInfo, totpConfig, updateTenantRequest, uploadOptions, upstashCacheConfig, url, user, uuid, uuidParam, validateWithSchema, validationErrorDetail, verifyEmailRequest, verifyOTPRequest, webauthnConfig, webhookEvent, webhookEventType, workerOptions };
1108
+ //# sourceMappingURL=index.js.map
1109
+ //# sourceMappingURL=index.js.map