@objectstack/spec 0.1.2 → 0.3.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/README.md +127 -5
- package/dist/ai/index.d.ts +14 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +29 -0
- package/dist/ai/model-registry.zod.d.ts +1389 -0
- package/dist/ai/model-registry.zod.d.ts.map +1 -0
- package/dist/ai/model-registry.zod.js +164 -0
- package/dist/ai/nlq.zod.d.ts +1126 -0
- package/dist/ai/nlq.zod.d.ts.map +1 -0
- package/dist/ai/nlq.zod.js +246 -0
- package/dist/ai/rag-pipeline.zod.d.ts +1034 -0
- package/dist/ai/rag-pipeline.zod.d.ts.map +1 -0
- package/dist/ai/rag-pipeline.zod.js +244 -0
- package/dist/api/index.d.ts +9 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +24 -0
- package/dist/data/filter.zod.d.ts +295 -0
- package/dist/data/filter.zod.d.ts.map +1 -0
- package/dist/data/filter.zod.js +226 -0
- package/dist/data/index.d.ts +21 -0
- package/dist/data/index.d.ts.map +1 -0
- package/dist/data/index.js +36 -0
- package/dist/data/query.zod.d.ts +386 -3
- package/dist/data/query.zod.d.ts.map +1 -1
- package/dist/data/query.zod.js +386 -3
- package/dist/data/validation.zod.d.ts +349 -0
- package/dist/data/validation.zod.d.ts.map +1 -1
- package/dist/data/validation.zod.js +395 -0
- package/dist/index.d.ts +36 -39
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +64 -47
- package/dist/system/auth-protocol.d.ts +175 -0
- package/dist/system/auth-protocol.d.ts.map +1 -0
- package/dist/system/auth-protocol.js +60 -0
- package/dist/system/auth.zod.d.ts +3319 -0
- package/dist/system/auth.zod.d.ts.map +1 -0
- package/dist/system/auth.zod.js +499 -0
- package/dist/system/datasource.zod.d.ts +118 -38
- package/dist/system/datasource.zod.d.ts.map +1 -1
- package/dist/system/datasource.zod.js +25 -6
- package/dist/system/driver.zod.d.ts +106 -0
- package/dist/system/driver.zod.d.ts.map +1 -1
- package/dist/system/driver.zod.js +47 -0
- package/dist/system/identity.zod.d.ts +234 -180
- package/dist/system/identity.zod.d.ts.map +1 -1
- package/dist/system/identity.zod.js +168 -51
- package/dist/system/index.d.ts +28 -0
- package/dist/system/index.d.ts.map +1 -0
- package/dist/system/index.js +43 -0
- package/dist/system/manifest.zod.d.ts +10 -10
- package/dist/system/organization.zod.d.ts +179 -0
- package/dist/system/organization.zod.d.ts.map +1 -0
- package/dist/system/organization.zod.js +129 -0
- package/dist/system/policy.zod.d.ts +10 -10
- package/dist/ui/action.zod.d.ts +2 -2
- package/dist/ui/dashboard.zod.d.ts +10 -10
- package/dist/ui/dashboard.zod.d.ts.map +1 -1
- package/dist/ui/dashboard.zod.js +3 -2
- package/dist/ui/index.d.ts +17 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +32 -0
- package/dist/ui/report.zod.d.ts +4 -32
- package/dist/ui/report.zod.d.ts.map +1 -1
- package/dist/ui/report.zod.js +3 -8
- package/dist/ui/theme.zod.d.ts +6 -6
- package/json-schema/Account.json +87 -0
- package/json-schema/AccountLinkingConfig.json +27 -0
- package/json-schema/AuthConfig.json +841 -0
- package/json-schema/AuthPluginConfig.json +28 -0
- package/json-schema/AuthStrategy.json +17 -0
- package/json-schema/AuthenticationConfig.json +601 -0
- package/json-schema/AuthenticationProvider.json +617 -0
- package/json-schema/CSRFConfig.json +31 -0
- package/json-schema/ChunkingStrategy.json +133 -0
- package/json-schema/ComparisonOperator.json +56 -0
- package/json-schema/Dashboard.json +20 -0
- package/json-schema/DashboardWidget.json +20 -0
- package/json-schema/DatabaseAdapter.json +38 -0
- package/json-schema/DatabaseMapping.json +48 -0
- package/json-schema/Datasource.json +25 -5
- package/json-schema/DatasourceCapabilities.json +25 -5
- package/json-schema/DocumentChunk.json +97 -0
- package/json-schema/DocumentLoaderConfig.json +69 -0
- package/json-schema/DocumentMetadata.json +61 -0
- package/json-schema/DriverCapabilities.json +30 -0
- package/json-schema/DriverDefinition.json +25 -5
- package/json-schema/DriverInterface.json +30 -0
- package/json-schema/EmailPasswordConfig.json +43 -0
- package/json-schema/EmbeddingModel.json +57 -0
- package/json-schema/EnterpriseAuthConfig.json +172 -0
- package/json-schema/Entity.json +55 -0
- package/json-schema/EqualityOperator.json +14 -0
- package/json-schema/FieldOperators.json +108 -0
- package/json-schema/FieldSynonymConfig.json +39 -0
- package/json-schema/FilterCondition.json +28 -0
- package/json-schema/Invitation.json +69 -0
- package/json-schema/InvitationStatus.json +15 -0
- package/json-schema/LDAPConfig.json +22 -5
- package/json-schema/MagicLinkConfig.json +21 -0
- package/json-schema/Member.json +46 -0
- package/json-schema/ModelCapability.json +47 -0
- package/json-schema/ModelConfig.json +181 -0
- package/json-schema/ModelLimits.json +45 -0
- package/json-schema/ModelPricing.json +28 -0
- package/json-schema/ModelProvider.json +19 -0
- package/json-schema/ModelRegistry.json +427 -0
- package/json-schema/ModelRegistryEntry.json +239 -0
- package/json-schema/ModelSelectionCriteria.json +50 -0
- package/json-schema/NLQAnalytics.json +106 -0
- package/json-schema/NLQFieldMapping.json +40 -0
- package/json-schema/NLQModelConfig.json +78 -0
- package/json-schema/NLQParseResult.json +252 -0
- package/json-schema/NLQRequest.json +110 -0
- package/json-schema/NLQResponse.json +288 -0
- package/json-schema/NLQTrainingExample.json +120 -0
- package/json-schema/NormalizedFilter.json +348 -0
- package/json-schema/OAuthProvider.json +66 -0
- package/json-schema/OIDCConfig.json +18 -3
- package/json-schema/Organization.json +52 -0
- package/json-schema/PasskeyConfig.json +54 -0
- package/json-schema/PromptTemplate.json +163 -0
- package/json-schema/PromptVariable.json +56 -0
- package/json-schema/QueryContext.json +72 -0
- package/json-schema/QueryFilter.json +34 -0
- package/json-schema/QueryIntent.json +21 -0
- package/json-schema/QueryTemplate.json +81 -0
- package/json-schema/RAGPipelineConfig.json +552 -0
- package/json-schema/RAGPipelineStatus.json +66 -0
- package/json-schema/RAGQueryRequest.json +64 -0
- package/json-schema/RAGQueryResponse.json +108 -0
- package/json-schema/RangeOperator.json +41 -0
- package/json-schema/RateLimitConfig.json +36 -0
- package/json-schema/Report.json +20 -26
- package/json-schema/RerankingConfig.json +34 -0
- package/json-schema/RetrievalStrategy.json +121 -0
- package/json-schema/SAMLConfig.json +17 -3
- package/json-schema/Session.json +63 -0
- package/json-schema/SessionConfig.json +56 -0
- package/json-schema/SetOperator.json +18 -0
- package/json-schema/SpecialOperator.json +18 -0
- package/json-schema/StandardAuthProvider.json +857 -0
- package/json-schema/StringOperator.json +21 -0
- package/json-schema/Timeframe.json +68 -0
- package/json-schema/TwoFactorConfig.json +40 -0
- package/json-schema/User.json +51 -0
- package/json-schema/UserFieldMapping.json +47 -0
- package/json-schema/VectorStoreConfig.json +82 -0
- package/json-schema/VectorStoreProvider.json +21 -0
- package/json-schema/VerificationToken.json +36 -0
- package/package.json +27 -1
- package/json-schema/AuthProtocol.json +0 -17
- package/json-schema/AuthProvider.json +0 -171
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.zod.d.ts","sourceRoot":"","sources":["../../src/system/auth.zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;GASG;AAEH;;GAEG;AACH,eAAO,MAAM,YAAY,qFAOvB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0B9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;EAYpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBH,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
|
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StandardAuthProviderSchema = exports.AuthConfigSchema = exports.AuthPluginConfigSchema = exports.DatabaseMappingSchema = exports.BETTER_AUTH_FIELD_MAPPINGS = exports.DatabaseAdapterSchema = exports.UserFieldMappingSchema = exports.EnterpriseAuthConfigSchema = exports.LDAPConfigSchema = exports.SAMLConfigSchema = exports.OIDCConfigSchema = exports.TwoFactorConfigSchema = exports.AccountLinkingConfigSchema = exports.CSRFConfigSchema = exports.RateLimitConfigSchema = exports.SessionConfigSchema = exports.PasskeyConfigSchema = exports.MagicLinkConfigSchema = exports.EmailPasswordConfigSchema = exports.OAuthProviderSchema = exports.AuthStrategy = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Authentication Protocol
|
|
7
|
+
*
|
|
8
|
+
* Defines the standard authentication specification for the ObjectStack ecosystem.
|
|
9
|
+
* This protocol supports multiple authentication strategies, session management,
|
|
10
|
+
* and comprehensive security features.
|
|
11
|
+
*
|
|
12
|
+
* This is a framework-agnostic specification that can be implemented with any
|
|
13
|
+
* authentication library (better-auth, Auth.js, Passport, etc.)
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Supported authentication strategies
|
|
17
|
+
*/
|
|
18
|
+
exports.AuthStrategy = zod_1.z.enum([
|
|
19
|
+
'email_password', // Traditional email & password authentication
|
|
20
|
+
'magic_link', // Passwordless email magic link
|
|
21
|
+
'oauth', // OAuth2 providers (Google, GitHub, etc.)
|
|
22
|
+
'passkey', // WebAuthn / FIDO2 passkeys
|
|
23
|
+
'otp', // One-time password (SMS, Email)
|
|
24
|
+
'anonymous', // Anonymous/guest sessions
|
|
25
|
+
]);
|
|
26
|
+
/**
|
|
27
|
+
* OAuth Provider Configuration
|
|
28
|
+
* Supports popular OAuth2 providers
|
|
29
|
+
*/
|
|
30
|
+
exports.OAuthProviderSchema = zod_1.z.object({
|
|
31
|
+
provider: zod_1.z.enum([
|
|
32
|
+
'google',
|
|
33
|
+
'github',
|
|
34
|
+
'facebook',
|
|
35
|
+
'twitter',
|
|
36
|
+
'linkedin',
|
|
37
|
+
'microsoft',
|
|
38
|
+
'apple',
|
|
39
|
+
'discord',
|
|
40
|
+
'gitlab',
|
|
41
|
+
'custom',
|
|
42
|
+
]).describe('OAuth provider type'),
|
|
43
|
+
clientId: zod_1.z.string().describe('OAuth client ID'),
|
|
44
|
+
clientSecret: zod_1.z.string().describe('OAuth client secret (typically from ENV)'),
|
|
45
|
+
scopes: zod_1.z.array(zod_1.z.string()).optional().describe('Requested OAuth scopes'),
|
|
46
|
+
redirectUri: zod_1.z.string().url().optional().describe('OAuth callback URL'),
|
|
47
|
+
enabled: zod_1.z.boolean().default(true).describe('Whether this provider is enabled'),
|
|
48
|
+
displayName: zod_1.z.string().optional().describe('Display name for the provider button'),
|
|
49
|
+
icon: zod_1.z.string().optional().describe('Icon URL or identifier'),
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* Email & Password Strategy Configuration
|
|
53
|
+
*/
|
|
54
|
+
exports.EmailPasswordConfigSchema = zod_1.z.object({
|
|
55
|
+
enabled: zod_1.z.boolean().default(true),
|
|
56
|
+
requireEmailVerification: zod_1.z.boolean().default(true).describe('Require email verification before login'),
|
|
57
|
+
minPasswordLength: zod_1.z.number().min(6).max(128).default(8).describe('Minimum password length'),
|
|
58
|
+
requirePasswordComplexity: zod_1.z.boolean().default(true).describe('Require uppercase, lowercase, numbers, symbols'),
|
|
59
|
+
allowPasswordReset: zod_1.z.boolean().default(true).describe('Enable password reset functionality'),
|
|
60
|
+
passwordResetExpiry: zod_1.z.number().default(3600).describe('Password reset token expiry in seconds'),
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* Magic Link Strategy Configuration
|
|
64
|
+
*/
|
|
65
|
+
exports.MagicLinkConfigSchema = zod_1.z.object({
|
|
66
|
+
enabled: zod_1.z.boolean().default(true),
|
|
67
|
+
expiryTime: zod_1.z.number().default(900).describe('Magic link expiry time in seconds (default 15 min)'),
|
|
68
|
+
sendEmail: zod_1.z.function()
|
|
69
|
+
.args(zod_1.z.object({
|
|
70
|
+
to: zod_1.z.string().email(),
|
|
71
|
+
link: zod_1.z.string().url(),
|
|
72
|
+
token: zod_1.z.string(),
|
|
73
|
+
}))
|
|
74
|
+
.returns(zod_1.z.promise(zod_1.z.void()))
|
|
75
|
+
.optional()
|
|
76
|
+
.describe('Custom email sending function'),
|
|
77
|
+
});
|
|
78
|
+
/**
|
|
79
|
+
* Passkey (WebAuthn) Strategy Configuration
|
|
80
|
+
*/
|
|
81
|
+
exports.PasskeyConfigSchema = zod_1.z.object({
|
|
82
|
+
enabled: zod_1.z.boolean().default(false),
|
|
83
|
+
rpName: zod_1.z.string().describe('Relying Party name'),
|
|
84
|
+
rpId: zod_1.z.string().optional().describe('Relying Party ID (defaults to domain)'),
|
|
85
|
+
allowedOrigins: zod_1.z.array(zod_1.z.string().url()).optional().describe('Allowed origins for WebAuthn'),
|
|
86
|
+
userVerification: zod_1.z.enum(['required', 'preferred', 'discouraged']).default('preferred'),
|
|
87
|
+
attestation: zod_1.z.enum(['none', 'indirect', 'direct', 'enterprise']).default('none'),
|
|
88
|
+
});
|
|
89
|
+
/**
|
|
90
|
+
* Session Configuration
|
|
91
|
+
*/
|
|
92
|
+
exports.SessionConfigSchema = zod_1.z.object({
|
|
93
|
+
expiresIn: zod_1.z.number().default(86400 * 7).describe('Session expiry in seconds (default 7 days)'),
|
|
94
|
+
updateAge: zod_1.z.number().default(86400).describe('Session update interval in seconds (default 1 day)'),
|
|
95
|
+
cookieName: zod_1.z.string().default('session_token').describe('Session cookie name'),
|
|
96
|
+
cookieSecure: zod_1.z.boolean().default(true).describe('Use secure cookies (HTTPS only)'),
|
|
97
|
+
cookieSameSite: zod_1.z.enum(['strict', 'lax', 'none']).default('lax').describe('SameSite cookie attribute'),
|
|
98
|
+
cookieDomain: zod_1.z.string().optional().describe('Cookie domain'),
|
|
99
|
+
cookiePath: zod_1.z.string().default('/').describe('Cookie path'),
|
|
100
|
+
cookieHttpOnly: zod_1.z.boolean().default(true).describe('HttpOnly cookie attribute'),
|
|
101
|
+
});
|
|
102
|
+
/**
|
|
103
|
+
* Rate Limiting Configuration
|
|
104
|
+
*/
|
|
105
|
+
exports.RateLimitConfigSchema = zod_1.z.object({
|
|
106
|
+
enabled: zod_1.z.boolean().default(true),
|
|
107
|
+
maxAttempts: zod_1.z.number().default(5).describe('Maximum login attempts'),
|
|
108
|
+
windowMs: zod_1.z.number().default(900000).describe('Time window in milliseconds (default 15 min)'),
|
|
109
|
+
blockDuration: zod_1.z.number().default(900000).describe('Block duration after max attempts in ms'),
|
|
110
|
+
skipSuccessfulRequests: zod_1.z.boolean().default(false).describe('Only count failed requests'),
|
|
111
|
+
});
|
|
112
|
+
/**
|
|
113
|
+
* CSRF Protection Configuration
|
|
114
|
+
*/
|
|
115
|
+
exports.CSRFConfigSchema = zod_1.z.object({
|
|
116
|
+
enabled: zod_1.z.boolean().default(true),
|
|
117
|
+
tokenLength: zod_1.z.number().default(32).describe('CSRF token length'),
|
|
118
|
+
cookieName: zod_1.z.string().default('csrf_token').describe('CSRF cookie name'),
|
|
119
|
+
headerName: zod_1.z.string().default('X-CSRF-Token').describe('CSRF header name'),
|
|
120
|
+
});
|
|
121
|
+
/**
|
|
122
|
+
* Account Linking Configuration
|
|
123
|
+
* Allows linking multiple auth methods to a single user account
|
|
124
|
+
*/
|
|
125
|
+
exports.AccountLinkingConfigSchema = zod_1.z.object({
|
|
126
|
+
enabled: zod_1.z.boolean().default(true).describe('Allow account linking'),
|
|
127
|
+
autoLink: zod_1.z.boolean().default(false).describe('Automatically link accounts with same email'),
|
|
128
|
+
requireVerification: zod_1.z.boolean().default(true).describe('Require email verification before linking'),
|
|
129
|
+
});
|
|
130
|
+
/**
|
|
131
|
+
* Two-Factor Authentication (2FA) Configuration
|
|
132
|
+
*/
|
|
133
|
+
exports.TwoFactorConfigSchema = zod_1.z.object({
|
|
134
|
+
enabled: zod_1.z.boolean().default(false),
|
|
135
|
+
issuer: zod_1.z.string().optional().describe('TOTP issuer name'),
|
|
136
|
+
qrCodeSize: zod_1.z.number().default(200).describe('QR code size in pixels'),
|
|
137
|
+
backupCodes: zod_1.z.object({
|
|
138
|
+
enabled: zod_1.z.boolean().default(true),
|
|
139
|
+
count: zod_1.z.number().default(10).describe('Number of backup codes to generate'),
|
|
140
|
+
}).optional(),
|
|
141
|
+
});
|
|
142
|
+
/**
|
|
143
|
+
* OIDC / OAuth2 Enterprise Configuration
|
|
144
|
+
* OpenID Connect configuration for enterprise SSO
|
|
145
|
+
*/
|
|
146
|
+
exports.OIDCConfigSchema = zod_1.z.object({
|
|
147
|
+
enabled: zod_1.z.boolean().default(false),
|
|
148
|
+
issuer: zod_1.z.string().url().describe('OIDC Issuer URL (.well-known/openid-configuration)'),
|
|
149
|
+
clientId: zod_1.z.string().describe('OIDC client ID'),
|
|
150
|
+
clientSecret: zod_1.z.string().describe('OIDC client secret'),
|
|
151
|
+
scopes: zod_1.z.array(zod_1.z.string()).default(['openid', 'profile', 'email']).describe('OIDC scopes'),
|
|
152
|
+
attributeMapping: zod_1.z.record(zod_1.z.string()).optional().describe('Map IdP claims to User fields'),
|
|
153
|
+
displayName: zod_1.z.string().optional().describe('Display name for the provider button'),
|
|
154
|
+
icon: zod_1.z.string().optional().describe('Icon URL or identifier'),
|
|
155
|
+
});
|
|
156
|
+
/**
|
|
157
|
+
* SAML 2.0 Enterprise Configuration
|
|
158
|
+
* SAML configuration for legacy enterprise SSO
|
|
159
|
+
*/
|
|
160
|
+
exports.SAMLConfigSchema = zod_1.z.object({
|
|
161
|
+
enabled: zod_1.z.boolean().default(false),
|
|
162
|
+
entryPoint: zod_1.z.string().url().describe('IdP SSO URL'),
|
|
163
|
+
cert: zod_1.z.string().describe('IdP Public Certificate (PEM format)'),
|
|
164
|
+
issuer: zod_1.z.string().describe('Entity ID of the IdP'),
|
|
165
|
+
signatureAlgorithm: zod_1.z.enum(['sha256', 'sha512']).default('sha256').describe('Signature algorithm'),
|
|
166
|
+
attributeMapping: zod_1.z.record(zod_1.z.string()).optional().describe('Map SAML attributes to User fields'),
|
|
167
|
+
displayName: zod_1.z.string().optional().describe('Display name for the provider button'),
|
|
168
|
+
icon: zod_1.z.string().optional().describe('Icon URL or identifier'),
|
|
169
|
+
});
|
|
170
|
+
/**
|
|
171
|
+
* LDAP / Active Directory Enterprise Configuration
|
|
172
|
+
* LDAP configuration for on-premise directory services
|
|
173
|
+
*/
|
|
174
|
+
exports.LDAPConfigSchema = zod_1.z.object({
|
|
175
|
+
enabled: zod_1.z.boolean().default(false),
|
|
176
|
+
url: zod_1.z.string().url().describe('LDAP Server URL (ldap:// or ldaps://)'),
|
|
177
|
+
bindDn: zod_1.z.string().describe('Bind DN for LDAP authentication'),
|
|
178
|
+
bindCredentials: zod_1.z.string().describe('Bind credentials'),
|
|
179
|
+
searchBase: zod_1.z.string().describe('Search base DN'),
|
|
180
|
+
searchFilter: zod_1.z.string().describe('Search filter'),
|
|
181
|
+
groupSearchBase: zod_1.z.string().optional().describe('Group search base DN'),
|
|
182
|
+
displayName: zod_1.z.string().optional().describe('Display name for the provider button'),
|
|
183
|
+
icon: zod_1.z.string().optional().describe('Icon URL or identifier'),
|
|
184
|
+
});
|
|
185
|
+
/**
|
|
186
|
+
* Enterprise Authentication Configuration
|
|
187
|
+
* Combines SAML, LDAP, and OIDC configurations for enterprise SSO
|
|
188
|
+
*/
|
|
189
|
+
exports.EnterpriseAuthConfigSchema = zod_1.z.object({
|
|
190
|
+
oidc: exports.OIDCConfigSchema.optional().describe('OpenID Connect configuration'),
|
|
191
|
+
saml: exports.SAMLConfigSchema.optional().describe('SAML 2.0 configuration'),
|
|
192
|
+
ldap: exports.LDAPConfigSchema.optional().describe('LDAP/Active Directory configuration'),
|
|
193
|
+
});
|
|
194
|
+
/**
|
|
195
|
+
* User Field Mapping Configuration
|
|
196
|
+
* Maps authentication user fields to ObjectStack user object fields
|
|
197
|
+
*/
|
|
198
|
+
exports.UserFieldMappingSchema = zod_1.z.object({
|
|
199
|
+
id: zod_1.z.string().default('id').describe('User ID field'),
|
|
200
|
+
email: zod_1.z.string().default('email').describe('Email field'),
|
|
201
|
+
name: zod_1.z.string().default('name').describe('Name field'),
|
|
202
|
+
image: zod_1.z.string().default('image').optional().describe('Profile image field'),
|
|
203
|
+
emailVerified: zod_1.z.string().default('email_verified').describe('Email verification status field'),
|
|
204
|
+
createdAt: zod_1.z.string().default('created_at').describe('Created timestamp field'),
|
|
205
|
+
updatedAt: zod_1.z.string().default('updated_at').describe('Updated timestamp field'),
|
|
206
|
+
});
|
|
207
|
+
/**
|
|
208
|
+
* Database Adapter Configuration
|
|
209
|
+
*/
|
|
210
|
+
exports.DatabaseAdapterSchema = zod_1.z.object({
|
|
211
|
+
type: zod_1.z.enum(['prisma', 'drizzle', 'kysely', 'custom']).describe('Database adapter type'),
|
|
212
|
+
connectionString: zod_1.z.string().optional().describe('Database connection string'),
|
|
213
|
+
tablePrefix: zod_1.z.string().default('auth_').describe('Prefix for auth tables'),
|
|
214
|
+
schema: zod_1.z.string().optional().describe('Database schema name'),
|
|
215
|
+
});
|
|
216
|
+
/**
|
|
217
|
+
* Default field mappings for better-auth compatibility
|
|
218
|
+
* These mappings bridge the gap between ObjectStack standard (Auth.js conventions)
|
|
219
|
+
* and better-auth's field naming conventions
|
|
220
|
+
*/
|
|
221
|
+
exports.BETTER_AUTH_FIELD_MAPPINGS = {
|
|
222
|
+
session: {
|
|
223
|
+
sessionToken: 'token',
|
|
224
|
+
expires: 'expiresAt',
|
|
225
|
+
},
|
|
226
|
+
account: {
|
|
227
|
+
providerAccountId: 'accountId',
|
|
228
|
+
provider: 'providerId',
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* Database Field Mapping Configuration
|
|
233
|
+
* Maps ObjectStack standard field names to driver-specific field names.
|
|
234
|
+
*
|
|
235
|
+
* Useful when the underlying authentication driver (e.g., better-auth) uses
|
|
236
|
+
* different column names than the ObjectStack standard schemas (which follow
|
|
237
|
+
* Auth.js conventions).
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```typescript
|
|
241
|
+
* mapping: {
|
|
242
|
+
* session: {
|
|
243
|
+
* sessionToken: 'token', // better-auth uses 'token'
|
|
244
|
+
* expires: 'expiresAt' // better-auth uses 'expiresAt'
|
|
245
|
+
* },
|
|
246
|
+
* account: {
|
|
247
|
+
* providerAccountId: 'accountId', // better-auth uses 'accountId'
|
|
248
|
+
* provider: 'providerId' // better-auth uses 'providerId'
|
|
249
|
+
* }
|
|
250
|
+
* }
|
|
251
|
+
* ```
|
|
252
|
+
*/
|
|
253
|
+
exports.DatabaseMappingSchema = zod_1.z.object({
|
|
254
|
+
/**
|
|
255
|
+
* User model field mapping
|
|
256
|
+
* Maps ObjectStack User fields to driver fields
|
|
257
|
+
*/
|
|
258
|
+
user: zod_1.z.record(zod_1.z.string()).optional().describe('User field mapping (e.g., { "emailVerified": "email_verified" })'),
|
|
259
|
+
/**
|
|
260
|
+
* Session model field mapping
|
|
261
|
+
* Maps ObjectStack Session fields to driver fields
|
|
262
|
+
*/
|
|
263
|
+
session: zod_1.z.record(zod_1.z.string()).default(exports.BETTER_AUTH_FIELD_MAPPINGS.session).describe('Session field mapping'),
|
|
264
|
+
/**
|
|
265
|
+
* Account model field mapping
|
|
266
|
+
* Maps ObjectStack Account fields to driver fields
|
|
267
|
+
*/
|
|
268
|
+
account: zod_1.z.record(zod_1.z.string()).default(exports.BETTER_AUTH_FIELD_MAPPINGS.account).describe('Account field mapping'),
|
|
269
|
+
/**
|
|
270
|
+
* Verification token field mapping
|
|
271
|
+
* Maps ObjectStack VerificationToken fields to driver fields
|
|
272
|
+
*/
|
|
273
|
+
verificationToken: zod_1.z.record(zod_1.z.string()).optional().describe('VerificationToken field mapping'),
|
|
274
|
+
});
|
|
275
|
+
/**
|
|
276
|
+
* Authentication Plugin Configuration
|
|
277
|
+
* Extends authentication with additional features
|
|
278
|
+
*/
|
|
279
|
+
exports.AuthPluginConfigSchema = zod_1.z.object({
|
|
280
|
+
name: zod_1.z.string().describe('Plugin name'),
|
|
281
|
+
enabled: zod_1.z.boolean().default(true),
|
|
282
|
+
options: zod_1.z.record(zod_1.z.any()).optional().describe('Plugin-specific options'),
|
|
283
|
+
});
|
|
284
|
+
/**
|
|
285
|
+
* Complete Authentication Configuration Schema
|
|
286
|
+
*
|
|
287
|
+
* This is the main configuration object for authentication
|
|
288
|
+
* in an ObjectStack application.
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* ```typescript
|
|
292
|
+
* const authConfig: AuthConfig = {
|
|
293
|
+
* name: 'main_auth',
|
|
294
|
+
* label: 'Main Authentication',
|
|
295
|
+
* strategies: ['email_password', 'oauth'],
|
|
296
|
+
* baseUrl: 'https://app.example.com',
|
|
297
|
+
* secret: process.env.AUTH_SECRET,
|
|
298
|
+
* driver: 'better-auth', // Optional, defaults to 'better-auth'
|
|
299
|
+
* emailPassword: {
|
|
300
|
+
* enabled: true,
|
|
301
|
+
* minPasswordLength: 8,
|
|
302
|
+
* },
|
|
303
|
+
* oauth: {
|
|
304
|
+
* providers: [{
|
|
305
|
+
* provider: 'google',
|
|
306
|
+
* clientId: process.env.GOOGLE_CLIENT_ID,
|
|
307
|
+
* clientSecret: process.env.GOOGLE_CLIENT_SECRET,
|
|
308
|
+
* }],
|
|
309
|
+
* },
|
|
310
|
+
* session: {
|
|
311
|
+
* expiresIn: 604800, // 7 days
|
|
312
|
+
* },
|
|
313
|
+
* };
|
|
314
|
+
* ```
|
|
315
|
+
*/
|
|
316
|
+
exports.AuthConfigSchema = zod_1.z.object({
|
|
317
|
+
/**
|
|
318
|
+
* Unique identifier for this auth configuration
|
|
319
|
+
* Must be in snake_case following ObjectStack conventions
|
|
320
|
+
*/
|
|
321
|
+
name: zod_1.z.string()
|
|
322
|
+
.regex(/^[a-z_][a-z0-9_]*$/)
|
|
323
|
+
.describe('Configuration name (snake_case)'),
|
|
324
|
+
/**
|
|
325
|
+
* Human-readable label
|
|
326
|
+
*/
|
|
327
|
+
label: zod_1.z.string().describe('Display label'),
|
|
328
|
+
/**
|
|
329
|
+
* The underlying authentication implementation driver
|
|
330
|
+
* Default: 'better-auth' (the reference implementation)
|
|
331
|
+
* Can be: 'better-auth', 'auth-js', 'passport', or custom driver name
|
|
332
|
+
*/
|
|
333
|
+
driver: zod_1.z.string().default('better-auth').describe('The underlying authentication implementation driver'),
|
|
334
|
+
/**
|
|
335
|
+
* Enabled authentication strategies
|
|
336
|
+
*/
|
|
337
|
+
strategies: zod_1.z.array(exports.AuthStrategy).min(1).describe('Enabled authentication strategies'),
|
|
338
|
+
/**
|
|
339
|
+
* Base URL for the application
|
|
340
|
+
*/
|
|
341
|
+
baseUrl: zod_1.z.string().url().describe('Application base URL'),
|
|
342
|
+
/**
|
|
343
|
+
* Secret key for signing tokens and cookies
|
|
344
|
+
* Should be loaded from environment variables
|
|
345
|
+
*/
|
|
346
|
+
secret: zod_1.z.string().min(32).describe('Secret key for signing (min 32 chars)'),
|
|
347
|
+
/**
|
|
348
|
+
* Email & Password configuration
|
|
349
|
+
*/
|
|
350
|
+
emailPassword: exports.EmailPasswordConfigSchema.optional(),
|
|
351
|
+
/**
|
|
352
|
+
* Magic Link configuration
|
|
353
|
+
*/
|
|
354
|
+
magicLink: exports.MagicLinkConfigSchema.optional(),
|
|
355
|
+
/**
|
|
356
|
+
* Passkey (WebAuthn) configuration
|
|
357
|
+
*/
|
|
358
|
+
passkey: exports.PasskeyConfigSchema.optional(),
|
|
359
|
+
/**
|
|
360
|
+
* OAuth configuration
|
|
361
|
+
*/
|
|
362
|
+
oauth: zod_1.z.object({
|
|
363
|
+
providers: zod_1.z.array(exports.OAuthProviderSchema).min(1),
|
|
364
|
+
}).optional(),
|
|
365
|
+
/**
|
|
366
|
+
* Session configuration
|
|
367
|
+
*/
|
|
368
|
+
session: exports.SessionConfigSchema.default({}),
|
|
369
|
+
/**
|
|
370
|
+
* Rate limiting configuration
|
|
371
|
+
*/
|
|
372
|
+
rateLimit: exports.RateLimitConfigSchema.default({}),
|
|
373
|
+
/**
|
|
374
|
+
* CSRF protection configuration
|
|
375
|
+
*/
|
|
376
|
+
csrf: exports.CSRFConfigSchema.default({}),
|
|
377
|
+
/**
|
|
378
|
+
* Account linking configuration
|
|
379
|
+
*/
|
|
380
|
+
accountLinking: exports.AccountLinkingConfigSchema.default({}),
|
|
381
|
+
/**
|
|
382
|
+
* Two-factor authentication configuration
|
|
383
|
+
*/
|
|
384
|
+
twoFactor: exports.TwoFactorConfigSchema.optional(),
|
|
385
|
+
/**
|
|
386
|
+
* Organization (Multi-tenant) configuration
|
|
387
|
+
* Enables B2B SaaS scenarios where users belong to multiple teams/workspaces
|
|
388
|
+
*/
|
|
389
|
+
organization: zod_1.z.object({
|
|
390
|
+
enabled: zod_1.z.boolean().default(false).describe('Enable organization/multi-tenant features'),
|
|
391
|
+
allowUserToCreateOrg: zod_1.z.boolean().default(true).describe('Allow users to create organizations'),
|
|
392
|
+
defaultRole: zod_1.z.string().default('member').describe('Default role for new members'),
|
|
393
|
+
creatorRole: zod_1.z.string().default('owner').describe('Role assigned to organization creator'),
|
|
394
|
+
}).optional().describe('Organization/multi-tenant configuration'),
|
|
395
|
+
/**
|
|
396
|
+
* Enterprise authentication configuration (SAML, LDAP, OIDC)
|
|
397
|
+
*/
|
|
398
|
+
enterprise: exports.EnterpriseAuthConfigSchema.optional(),
|
|
399
|
+
/**
|
|
400
|
+
* User field mapping
|
|
401
|
+
*/
|
|
402
|
+
userFieldMapping: exports.UserFieldMappingSchema.default({}),
|
|
403
|
+
/**
|
|
404
|
+
* Database adapter configuration
|
|
405
|
+
*/
|
|
406
|
+
database: exports.DatabaseAdapterSchema.optional(),
|
|
407
|
+
/**
|
|
408
|
+
* Database field mapping configuration
|
|
409
|
+
* Maps ObjectStack standard field names to driver-specific field names.
|
|
410
|
+
*
|
|
411
|
+
* This is distinct from the database adapter configuration and provides
|
|
412
|
+
* instructions for the driver to map our standard schema fields to the
|
|
413
|
+
* underlying engine's fields (e.g., better-auth uses 'token' instead of 'sessionToken').
|
|
414
|
+
*/
|
|
415
|
+
mapping: exports.DatabaseMappingSchema.optional(),
|
|
416
|
+
/**
|
|
417
|
+
* Additional authentication plugins
|
|
418
|
+
*/
|
|
419
|
+
plugins: zod_1.z.array(exports.AuthPluginConfigSchema).default([]),
|
|
420
|
+
/**
|
|
421
|
+
* Custom hooks for authentication events
|
|
422
|
+
*/
|
|
423
|
+
hooks: zod_1.z.object({
|
|
424
|
+
beforeSignIn: zod_1.z.function()
|
|
425
|
+
.args(zod_1.z.object({ email: zod_1.z.string() }))
|
|
426
|
+
.returns(zod_1.z.promise(zod_1.z.void()))
|
|
427
|
+
.optional()
|
|
428
|
+
.describe('Called before user sign in'),
|
|
429
|
+
afterSignIn: zod_1.z.function()
|
|
430
|
+
.args(zod_1.z.object({ user: zod_1.z.any(), session: zod_1.z.any() }))
|
|
431
|
+
.returns(zod_1.z.promise(zod_1.z.void()))
|
|
432
|
+
.optional()
|
|
433
|
+
.describe('Called after user sign in'),
|
|
434
|
+
beforeSignUp: zod_1.z.function()
|
|
435
|
+
.args(zod_1.z.object({ email: zod_1.z.string(), name: zod_1.z.string().optional() }))
|
|
436
|
+
.returns(zod_1.z.promise(zod_1.z.void()))
|
|
437
|
+
.optional()
|
|
438
|
+
.describe('Called before user registration'),
|
|
439
|
+
afterSignUp: zod_1.z.function()
|
|
440
|
+
.args(zod_1.z.object({ user: zod_1.z.any() }))
|
|
441
|
+
.returns(zod_1.z.promise(zod_1.z.void()))
|
|
442
|
+
.optional()
|
|
443
|
+
.describe('Called after user registration'),
|
|
444
|
+
beforeSignOut: zod_1.z.function()
|
|
445
|
+
.args(zod_1.z.object({ sessionId: zod_1.z.string() }))
|
|
446
|
+
.returns(zod_1.z.promise(zod_1.z.void()))
|
|
447
|
+
.optional()
|
|
448
|
+
.describe('Called before user sign out'),
|
|
449
|
+
afterSignOut: zod_1.z.function()
|
|
450
|
+
.args(zod_1.z.object({ sessionId: zod_1.z.string() }))
|
|
451
|
+
.returns(zod_1.z.promise(zod_1.z.void()))
|
|
452
|
+
.optional()
|
|
453
|
+
.describe('Called after user sign out'),
|
|
454
|
+
}).optional().describe('Authentication lifecycle hooks'),
|
|
455
|
+
/**
|
|
456
|
+
* Advanced security settings
|
|
457
|
+
*/
|
|
458
|
+
security: zod_1.z.object({
|
|
459
|
+
allowedOrigins: zod_1.z.array(zod_1.z.string()).optional().describe('CORS allowed origins'),
|
|
460
|
+
trustProxy: zod_1.z.boolean().default(false).describe('Trust proxy headers'),
|
|
461
|
+
ipRateLimiting: zod_1.z.boolean().default(true).describe('Enable IP-based rate limiting'),
|
|
462
|
+
sessionFingerprinting: zod_1.z.boolean().default(true).describe('Enable session fingerprinting'),
|
|
463
|
+
maxSessions: zod_1.z.number().default(5).describe('Maximum concurrent sessions per user'),
|
|
464
|
+
}).optional().describe('Advanced security settings'),
|
|
465
|
+
/**
|
|
466
|
+
* Email configuration for transactional emails
|
|
467
|
+
*/
|
|
468
|
+
email: zod_1.z.object({
|
|
469
|
+
from: zod_1.z.string().email().describe('From email address'),
|
|
470
|
+
fromName: zod_1.z.string().optional().describe('From name'),
|
|
471
|
+
provider: zod_1.z.enum(['smtp', 'sendgrid', 'mailgun', 'ses', 'resend', 'custom']).describe('Email provider'),
|
|
472
|
+
config: zod_1.z.record(zod_1.z.any()).optional().describe('Provider-specific configuration'),
|
|
473
|
+
}).optional().describe('Email configuration'),
|
|
474
|
+
/**
|
|
475
|
+
* UI customization options
|
|
476
|
+
*/
|
|
477
|
+
ui: zod_1.z.object({
|
|
478
|
+
brandName: zod_1.z.string().optional().describe('Brand name displayed in auth UI'),
|
|
479
|
+
logo: zod_1.z.string().optional().describe('Logo URL'),
|
|
480
|
+
primaryColor: zod_1.z.string().optional().describe('Primary brand color (hex)'),
|
|
481
|
+
customCss: zod_1.z.string().optional().describe('Custom CSS for auth pages'),
|
|
482
|
+
}).optional().describe('UI customization'),
|
|
483
|
+
/**
|
|
484
|
+
* Whether this auth provider is active
|
|
485
|
+
*/
|
|
486
|
+
active: zod_1.z.boolean().default(true).describe('Whether this provider is active'),
|
|
487
|
+
/**
|
|
488
|
+
* Whether to allow new user registration
|
|
489
|
+
*/
|
|
490
|
+
allowRegistration: zod_1.z.boolean().default(true).describe('Allow new user registration'),
|
|
491
|
+
});
|
|
492
|
+
/**
|
|
493
|
+
* Standard Authentication Provider Schema
|
|
494
|
+
* Wraps the configuration for use in the identity system
|
|
495
|
+
*/
|
|
496
|
+
exports.StandardAuthProviderSchema = zod_1.z.object({
|
|
497
|
+
type: zod_1.z.literal('standard_auth').describe('Provider type identifier'),
|
|
498
|
+
config: exports.AuthConfigSchema.describe('Standard authentication configuration'),
|
|
499
|
+
});
|