@objectstack/spec 0.1.2 → 0.2.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.
Files changed (58) hide show
  1. package/dist/data/filter.zod.d.ts +295 -0
  2. package/dist/data/filter.zod.d.ts.map +1 -0
  3. package/dist/data/filter.zod.js +226 -0
  4. package/dist/index.d.ts +2 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +2 -0
  7. package/dist/system/auth.zod.d.ts +2287 -0
  8. package/dist/system/auth.zod.d.ts.map +1 -0
  9. package/dist/system/auth.zod.js +365 -0
  10. package/dist/system/datasource.zod.d.ts +118 -38
  11. package/dist/system/datasource.zod.d.ts.map +1 -1
  12. package/dist/system/datasource.zod.js +25 -6
  13. package/dist/system/driver.zod.d.ts +106 -0
  14. package/dist/system/driver.zod.d.ts.map +1 -1
  15. package/dist/system/driver.zod.js +47 -0
  16. package/dist/system/policy.zod.d.ts +10 -10
  17. package/dist/ui/dashboard.zod.d.ts +10 -10
  18. package/dist/ui/dashboard.zod.d.ts.map +1 -1
  19. package/dist/ui/dashboard.zod.js +3 -2
  20. package/dist/ui/report.zod.d.ts +4 -32
  21. package/dist/ui/report.zod.d.ts.map +1 -1
  22. package/dist/ui/report.zod.js +3 -8
  23. package/json-schema/AccountLinkingConfig.json +27 -0
  24. package/json-schema/AuthConfig.json +606 -0
  25. package/json-schema/AuthPluginConfig.json +28 -0
  26. package/json-schema/AuthStrategy.json +17 -0
  27. package/json-schema/AuthenticationConfig.json +601 -0
  28. package/json-schema/AuthenticationProvider.json +617 -0
  29. package/json-schema/CSRFConfig.json +31 -0
  30. package/json-schema/ComparisonOperator.json +56 -0
  31. package/json-schema/Dashboard.json +20 -0
  32. package/json-schema/DashboardWidget.json +20 -0
  33. package/json-schema/DatabaseAdapter.json +38 -0
  34. package/json-schema/Datasource.json +25 -5
  35. package/json-schema/DatasourceCapabilities.json +25 -5
  36. package/json-schema/DriverCapabilities.json +30 -0
  37. package/json-schema/DriverDefinition.json +25 -5
  38. package/json-schema/DriverInterface.json +30 -0
  39. package/json-schema/EmailPasswordConfig.json +43 -0
  40. package/json-schema/EqualityOperator.json +14 -0
  41. package/json-schema/FieldOperators.json +108 -0
  42. package/json-schema/FilterCondition.json +28 -0
  43. package/json-schema/MagicLinkConfig.json +21 -0
  44. package/json-schema/NormalizedFilter.json +348 -0
  45. package/json-schema/OAuthProvider.json +66 -0
  46. package/json-schema/PasskeyConfig.json +54 -0
  47. package/json-schema/QueryFilter.json +34 -0
  48. package/json-schema/RangeOperator.json +41 -0
  49. package/json-schema/RateLimitConfig.json +36 -0
  50. package/json-schema/Report.json +20 -26
  51. package/json-schema/SessionConfig.json +56 -0
  52. package/json-schema/SetOperator.json +18 -0
  53. package/json-schema/SpecialOperator.json +18 -0
  54. package/json-schema/StandardAuthProvider.json +622 -0
  55. package/json-schema/StringOperator.json +21 -0
  56. package/json-schema/TwoFactorConfig.json +40 -0
  57. package/json-schema/UserFieldMapping.json +47 -0
  58. package/package.json +1 -1
@@ -0,0 +1,18 @@
1
+ {
2
+ "$ref": "#/definitions/SetOperator",
3
+ "definitions": {
4
+ "SetOperator": {
5
+ "type": "object",
6
+ "properties": {
7
+ "$in": {
8
+ "type": "array"
9
+ },
10
+ "$nin": {
11
+ "type": "array"
12
+ }
13
+ },
14
+ "additionalProperties": false
15
+ }
16
+ },
17
+ "$schema": "http://json-schema.org/draft-07/schema#"
18
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$ref": "#/definitions/SpecialOperator",
3
+ "definitions": {
4
+ "SpecialOperator": {
5
+ "type": "object",
6
+ "properties": {
7
+ "$null": {
8
+ "type": "boolean"
9
+ },
10
+ "$exist": {
11
+ "type": "boolean"
12
+ }
13
+ },
14
+ "additionalProperties": false
15
+ }
16
+ },
17
+ "$schema": "http://json-schema.org/draft-07/schema#"
18
+ }
@@ -0,0 +1,622 @@
1
+ {
2
+ "$ref": "#/definitions/StandardAuthProvider",
3
+ "definitions": {
4
+ "StandardAuthProvider": {
5
+ "type": "object",
6
+ "properties": {
7
+ "type": {
8
+ "type": "string",
9
+ "const": "standard_auth",
10
+ "description": "Provider type identifier"
11
+ },
12
+ "config": {
13
+ "type": "object",
14
+ "properties": {
15
+ "name": {
16
+ "type": "string",
17
+ "pattern": "^[a-z_][a-z0-9_]*$",
18
+ "description": "Configuration name (snake_case)"
19
+ },
20
+ "label": {
21
+ "type": "string",
22
+ "description": "Display label"
23
+ },
24
+ "driver": {
25
+ "type": "string",
26
+ "default": "better-auth",
27
+ "description": "The underlying authentication implementation driver"
28
+ },
29
+ "strategies": {
30
+ "type": "array",
31
+ "items": {
32
+ "type": "string",
33
+ "enum": [
34
+ "email_password",
35
+ "magic_link",
36
+ "oauth",
37
+ "passkey",
38
+ "otp",
39
+ "anonymous"
40
+ ]
41
+ },
42
+ "minItems": 1,
43
+ "description": "Enabled authentication strategies"
44
+ },
45
+ "baseUrl": {
46
+ "type": "string",
47
+ "format": "uri",
48
+ "description": "Application base URL"
49
+ },
50
+ "secret": {
51
+ "type": "string",
52
+ "minLength": 32,
53
+ "description": "Secret key for signing (min 32 chars)"
54
+ },
55
+ "emailPassword": {
56
+ "type": "object",
57
+ "properties": {
58
+ "enabled": {
59
+ "type": "boolean",
60
+ "default": true
61
+ },
62
+ "requireEmailVerification": {
63
+ "type": "boolean",
64
+ "default": true,
65
+ "description": "Require email verification before login"
66
+ },
67
+ "minPasswordLength": {
68
+ "type": "number",
69
+ "minimum": 6,
70
+ "maximum": 128,
71
+ "default": 8,
72
+ "description": "Minimum password length"
73
+ },
74
+ "requirePasswordComplexity": {
75
+ "type": "boolean",
76
+ "default": true,
77
+ "description": "Require uppercase, lowercase, numbers, symbols"
78
+ },
79
+ "allowPasswordReset": {
80
+ "type": "boolean",
81
+ "default": true,
82
+ "description": "Enable password reset functionality"
83
+ },
84
+ "passwordResetExpiry": {
85
+ "type": "number",
86
+ "default": 3600,
87
+ "description": "Password reset token expiry in seconds"
88
+ }
89
+ },
90
+ "additionalProperties": false
91
+ },
92
+ "magicLink": {
93
+ "type": "object",
94
+ "properties": {
95
+ "enabled": {
96
+ "type": "boolean",
97
+ "default": true
98
+ },
99
+ "expiryTime": {
100
+ "type": "number",
101
+ "default": 900,
102
+ "description": "Magic link expiry time in seconds (default 15 min)"
103
+ }
104
+ },
105
+ "additionalProperties": false
106
+ },
107
+ "passkey": {
108
+ "type": "object",
109
+ "properties": {
110
+ "enabled": {
111
+ "type": "boolean",
112
+ "default": false
113
+ },
114
+ "rpName": {
115
+ "type": "string",
116
+ "description": "Relying Party name"
117
+ },
118
+ "rpId": {
119
+ "type": "string",
120
+ "description": "Relying Party ID (defaults to domain)"
121
+ },
122
+ "allowedOrigins": {
123
+ "type": "array",
124
+ "items": {
125
+ "type": "string",
126
+ "format": "uri"
127
+ },
128
+ "description": "Allowed origins for WebAuthn"
129
+ },
130
+ "userVerification": {
131
+ "type": "string",
132
+ "enum": [
133
+ "required",
134
+ "preferred",
135
+ "discouraged"
136
+ ],
137
+ "default": "preferred"
138
+ },
139
+ "attestation": {
140
+ "type": "string",
141
+ "enum": [
142
+ "none",
143
+ "indirect",
144
+ "direct",
145
+ "enterprise"
146
+ ],
147
+ "default": "none"
148
+ }
149
+ },
150
+ "required": [
151
+ "rpName"
152
+ ],
153
+ "additionalProperties": false
154
+ },
155
+ "oauth": {
156
+ "type": "object",
157
+ "properties": {
158
+ "providers": {
159
+ "type": "array",
160
+ "items": {
161
+ "type": "object",
162
+ "properties": {
163
+ "provider": {
164
+ "type": "string",
165
+ "enum": [
166
+ "google",
167
+ "github",
168
+ "facebook",
169
+ "twitter",
170
+ "linkedin",
171
+ "microsoft",
172
+ "apple",
173
+ "discord",
174
+ "gitlab",
175
+ "custom"
176
+ ],
177
+ "description": "OAuth provider type"
178
+ },
179
+ "clientId": {
180
+ "type": "string",
181
+ "description": "OAuth client ID"
182
+ },
183
+ "clientSecret": {
184
+ "type": "string",
185
+ "description": "OAuth client secret (typically from ENV)"
186
+ },
187
+ "scopes": {
188
+ "type": "array",
189
+ "items": {
190
+ "type": "string"
191
+ },
192
+ "description": "Requested OAuth scopes"
193
+ },
194
+ "redirectUri": {
195
+ "type": "string",
196
+ "format": "uri",
197
+ "description": "OAuth callback URL"
198
+ },
199
+ "enabled": {
200
+ "type": "boolean",
201
+ "default": true,
202
+ "description": "Whether this provider is enabled"
203
+ },
204
+ "displayName": {
205
+ "type": "string",
206
+ "description": "Display name for the provider button"
207
+ },
208
+ "icon": {
209
+ "type": "string",
210
+ "description": "Icon URL or identifier"
211
+ }
212
+ },
213
+ "required": [
214
+ "provider",
215
+ "clientId",
216
+ "clientSecret"
217
+ ],
218
+ "additionalProperties": false
219
+ },
220
+ "minItems": 1
221
+ }
222
+ },
223
+ "required": [
224
+ "providers"
225
+ ],
226
+ "additionalProperties": false
227
+ },
228
+ "session": {
229
+ "type": "object",
230
+ "properties": {
231
+ "expiresIn": {
232
+ "type": "number",
233
+ "default": 604800,
234
+ "description": "Session expiry in seconds (default 7 days)"
235
+ },
236
+ "updateAge": {
237
+ "type": "number",
238
+ "default": 86400,
239
+ "description": "Session update interval in seconds (default 1 day)"
240
+ },
241
+ "cookieName": {
242
+ "type": "string",
243
+ "default": "session_token",
244
+ "description": "Session cookie name"
245
+ },
246
+ "cookieSecure": {
247
+ "type": "boolean",
248
+ "default": true,
249
+ "description": "Use secure cookies (HTTPS only)"
250
+ },
251
+ "cookieSameSite": {
252
+ "type": "string",
253
+ "enum": [
254
+ "strict",
255
+ "lax",
256
+ "none"
257
+ ],
258
+ "default": "lax",
259
+ "description": "SameSite cookie attribute"
260
+ },
261
+ "cookieDomain": {
262
+ "type": "string",
263
+ "description": "Cookie domain"
264
+ },
265
+ "cookiePath": {
266
+ "type": "string",
267
+ "default": "/",
268
+ "description": "Cookie path"
269
+ },
270
+ "cookieHttpOnly": {
271
+ "type": "boolean",
272
+ "default": true,
273
+ "description": "HttpOnly cookie attribute"
274
+ }
275
+ },
276
+ "additionalProperties": false,
277
+ "default": {}
278
+ },
279
+ "rateLimit": {
280
+ "type": "object",
281
+ "properties": {
282
+ "enabled": {
283
+ "type": "boolean",
284
+ "default": true
285
+ },
286
+ "maxAttempts": {
287
+ "type": "number",
288
+ "default": 5,
289
+ "description": "Maximum login attempts"
290
+ },
291
+ "windowMs": {
292
+ "type": "number",
293
+ "default": 900000,
294
+ "description": "Time window in milliseconds (default 15 min)"
295
+ },
296
+ "blockDuration": {
297
+ "type": "number",
298
+ "default": 900000,
299
+ "description": "Block duration after max attempts in ms"
300
+ },
301
+ "skipSuccessfulRequests": {
302
+ "type": "boolean",
303
+ "default": false,
304
+ "description": "Only count failed requests"
305
+ }
306
+ },
307
+ "additionalProperties": false,
308
+ "default": {}
309
+ },
310
+ "csrf": {
311
+ "type": "object",
312
+ "properties": {
313
+ "enabled": {
314
+ "type": "boolean",
315
+ "default": true
316
+ },
317
+ "tokenLength": {
318
+ "type": "number",
319
+ "default": 32,
320
+ "description": "CSRF token length"
321
+ },
322
+ "cookieName": {
323
+ "type": "string",
324
+ "default": "csrf_token",
325
+ "description": "CSRF cookie name"
326
+ },
327
+ "headerName": {
328
+ "type": "string",
329
+ "default": "X-CSRF-Token",
330
+ "description": "CSRF header name"
331
+ }
332
+ },
333
+ "additionalProperties": false,
334
+ "default": {}
335
+ },
336
+ "accountLinking": {
337
+ "type": "object",
338
+ "properties": {
339
+ "enabled": {
340
+ "type": "boolean",
341
+ "default": true,
342
+ "description": "Allow account linking"
343
+ },
344
+ "autoLink": {
345
+ "type": "boolean",
346
+ "default": false,
347
+ "description": "Automatically link accounts with same email"
348
+ },
349
+ "requireVerification": {
350
+ "type": "boolean",
351
+ "default": true,
352
+ "description": "Require email verification before linking"
353
+ }
354
+ },
355
+ "additionalProperties": false,
356
+ "default": {}
357
+ },
358
+ "twoFactor": {
359
+ "type": "object",
360
+ "properties": {
361
+ "enabled": {
362
+ "type": "boolean",
363
+ "default": false
364
+ },
365
+ "issuer": {
366
+ "type": "string",
367
+ "description": "TOTP issuer name"
368
+ },
369
+ "qrCodeSize": {
370
+ "type": "number",
371
+ "default": 200,
372
+ "description": "QR code size in pixels"
373
+ },
374
+ "backupCodes": {
375
+ "type": "object",
376
+ "properties": {
377
+ "enabled": {
378
+ "type": "boolean",
379
+ "default": true
380
+ },
381
+ "count": {
382
+ "type": "number",
383
+ "default": 10,
384
+ "description": "Number of backup codes to generate"
385
+ }
386
+ },
387
+ "additionalProperties": false
388
+ }
389
+ },
390
+ "additionalProperties": false
391
+ },
392
+ "userFieldMapping": {
393
+ "type": "object",
394
+ "properties": {
395
+ "id": {
396
+ "type": "string",
397
+ "default": "id",
398
+ "description": "User ID field"
399
+ },
400
+ "email": {
401
+ "type": "string",
402
+ "default": "email",
403
+ "description": "Email field"
404
+ },
405
+ "name": {
406
+ "type": "string",
407
+ "default": "name",
408
+ "description": "Name field"
409
+ },
410
+ "image": {
411
+ "type": "string",
412
+ "default": "image",
413
+ "description": "Profile image field"
414
+ },
415
+ "emailVerified": {
416
+ "type": "string",
417
+ "default": "email_verified",
418
+ "description": "Email verification status field"
419
+ },
420
+ "createdAt": {
421
+ "type": "string",
422
+ "default": "created_at",
423
+ "description": "Created timestamp field"
424
+ },
425
+ "updatedAt": {
426
+ "type": "string",
427
+ "default": "updated_at",
428
+ "description": "Updated timestamp field"
429
+ }
430
+ },
431
+ "additionalProperties": false,
432
+ "default": {}
433
+ },
434
+ "database": {
435
+ "type": "object",
436
+ "properties": {
437
+ "type": {
438
+ "type": "string",
439
+ "enum": [
440
+ "prisma",
441
+ "drizzle",
442
+ "kysely",
443
+ "custom"
444
+ ],
445
+ "description": "Database adapter type"
446
+ },
447
+ "connectionString": {
448
+ "type": "string",
449
+ "description": "Database connection string"
450
+ },
451
+ "tablePrefix": {
452
+ "type": "string",
453
+ "default": "auth_",
454
+ "description": "Prefix for auth tables"
455
+ },
456
+ "schema": {
457
+ "type": "string",
458
+ "description": "Database schema name"
459
+ }
460
+ },
461
+ "required": [
462
+ "type"
463
+ ],
464
+ "additionalProperties": false
465
+ },
466
+ "plugins": {
467
+ "type": "array",
468
+ "items": {
469
+ "type": "object",
470
+ "properties": {
471
+ "name": {
472
+ "type": "string",
473
+ "description": "Plugin name"
474
+ },
475
+ "enabled": {
476
+ "type": "boolean",
477
+ "default": true
478
+ },
479
+ "options": {
480
+ "type": "object",
481
+ "additionalProperties": {},
482
+ "description": "Plugin-specific options"
483
+ }
484
+ },
485
+ "required": [
486
+ "name"
487
+ ],
488
+ "additionalProperties": false
489
+ },
490
+ "default": []
491
+ },
492
+ "hooks": {
493
+ "type": "object",
494
+ "properties": {},
495
+ "additionalProperties": false,
496
+ "description": "Authentication lifecycle hooks"
497
+ },
498
+ "security": {
499
+ "type": "object",
500
+ "properties": {
501
+ "allowedOrigins": {
502
+ "type": "array",
503
+ "items": {
504
+ "type": "string"
505
+ },
506
+ "description": "CORS allowed origins"
507
+ },
508
+ "trustProxy": {
509
+ "type": "boolean",
510
+ "default": false,
511
+ "description": "Trust proxy headers"
512
+ },
513
+ "ipRateLimiting": {
514
+ "type": "boolean",
515
+ "default": true,
516
+ "description": "Enable IP-based rate limiting"
517
+ },
518
+ "sessionFingerprinting": {
519
+ "type": "boolean",
520
+ "default": true,
521
+ "description": "Enable session fingerprinting"
522
+ },
523
+ "maxSessions": {
524
+ "type": "number",
525
+ "default": 5,
526
+ "description": "Maximum concurrent sessions per user"
527
+ }
528
+ },
529
+ "additionalProperties": false,
530
+ "description": "Advanced security settings"
531
+ },
532
+ "email": {
533
+ "type": "object",
534
+ "properties": {
535
+ "from": {
536
+ "type": "string",
537
+ "format": "email",
538
+ "description": "From email address"
539
+ },
540
+ "fromName": {
541
+ "type": "string",
542
+ "description": "From name"
543
+ },
544
+ "provider": {
545
+ "type": "string",
546
+ "enum": [
547
+ "smtp",
548
+ "sendgrid",
549
+ "mailgun",
550
+ "ses",
551
+ "resend",
552
+ "custom"
553
+ ],
554
+ "description": "Email provider"
555
+ },
556
+ "config": {
557
+ "type": "object",
558
+ "additionalProperties": {},
559
+ "description": "Provider-specific configuration"
560
+ }
561
+ },
562
+ "required": [
563
+ "from",
564
+ "provider"
565
+ ],
566
+ "additionalProperties": false,
567
+ "description": "Email configuration"
568
+ },
569
+ "ui": {
570
+ "type": "object",
571
+ "properties": {
572
+ "brandName": {
573
+ "type": "string",
574
+ "description": "Brand name displayed in auth UI"
575
+ },
576
+ "logo": {
577
+ "type": "string",
578
+ "description": "Logo URL"
579
+ },
580
+ "primaryColor": {
581
+ "type": "string",
582
+ "description": "Primary brand color (hex)"
583
+ },
584
+ "customCss": {
585
+ "type": "string",
586
+ "description": "Custom CSS for auth pages"
587
+ }
588
+ },
589
+ "additionalProperties": false,
590
+ "description": "UI customization"
591
+ },
592
+ "active": {
593
+ "type": "boolean",
594
+ "default": true,
595
+ "description": "Whether this provider is active"
596
+ },
597
+ "allowRegistration": {
598
+ "type": "boolean",
599
+ "default": true,
600
+ "description": "Allow new user registration"
601
+ }
602
+ },
603
+ "required": [
604
+ "name",
605
+ "label",
606
+ "strategies",
607
+ "baseUrl",
608
+ "secret"
609
+ ],
610
+ "additionalProperties": false,
611
+ "description": "Standard authentication configuration"
612
+ }
613
+ },
614
+ "required": [
615
+ "type",
616
+ "config"
617
+ ],
618
+ "additionalProperties": false
619
+ }
620
+ },
621
+ "$schema": "http://json-schema.org/draft-07/schema#"
622
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "$ref": "#/definitions/StringOperator",
3
+ "definitions": {
4
+ "StringOperator": {
5
+ "type": "object",
6
+ "properties": {
7
+ "$contains": {
8
+ "type": "string"
9
+ },
10
+ "$startsWith": {
11
+ "type": "string"
12
+ },
13
+ "$endsWith": {
14
+ "type": "string"
15
+ }
16
+ },
17
+ "additionalProperties": false
18
+ }
19
+ },
20
+ "$schema": "http://json-schema.org/draft-07/schema#"
21
+ }