@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.
Files changed (152) hide show
  1. package/README.md +127 -5
  2. package/dist/ai/index.d.ts +14 -0
  3. package/dist/ai/index.d.ts.map +1 -0
  4. package/dist/ai/index.js +29 -0
  5. package/dist/ai/model-registry.zod.d.ts +1389 -0
  6. package/dist/ai/model-registry.zod.d.ts.map +1 -0
  7. package/dist/ai/model-registry.zod.js +164 -0
  8. package/dist/ai/nlq.zod.d.ts +1126 -0
  9. package/dist/ai/nlq.zod.d.ts.map +1 -0
  10. package/dist/ai/nlq.zod.js +246 -0
  11. package/dist/ai/rag-pipeline.zod.d.ts +1034 -0
  12. package/dist/ai/rag-pipeline.zod.d.ts.map +1 -0
  13. package/dist/ai/rag-pipeline.zod.js +244 -0
  14. package/dist/api/index.d.ts +9 -0
  15. package/dist/api/index.d.ts.map +1 -0
  16. package/dist/api/index.js +24 -0
  17. package/dist/data/filter.zod.d.ts +295 -0
  18. package/dist/data/filter.zod.d.ts.map +1 -0
  19. package/dist/data/filter.zod.js +226 -0
  20. package/dist/data/index.d.ts +21 -0
  21. package/dist/data/index.d.ts.map +1 -0
  22. package/dist/data/index.js +36 -0
  23. package/dist/data/query.zod.d.ts +386 -3
  24. package/dist/data/query.zod.d.ts.map +1 -1
  25. package/dist/data/query.zod.js +386 -3
  26. package/dist/data/validation.zod.d.ts +349 -0
  27. package/dist/data/validation.zod.d.ts.map +1 -1
  28. package/dist/data/validation.zod.js +395 -0
  29. package/dist/index.d.ts +36 -39
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +64 -47
  32. package/dist/system/auth-protocol.d.ts +175 -0
  33. package/dist/system/auth-protocol.d.ts.map +1 -0
  34. package/dist/system/auth-protocol.js +60 -0
  35. package/dist/system/auth.zod.d.ts +3319 -0
  36. package/dist/system/auth.zod.d.ts.map +1 -0
  37. package/dist/system/auth.zod.js +499 -0
  38. package/dist/system/datasource.zod.d.ts +118 -38
  39. package/dist/system/datasource.zod.d.ts.map +1 -1
  40. package/dist/system/datasource.zod.js +25 -6
  41. package/dist/system/driver.zod.d.ts +106 -0
  42. package/dist/system/driver.zod.d.ts.map +1 -1
  43. package/dist/system/driver.zod.js +47 -0
  44. package/dist/system/identity.zod.d.ts +234 -180
  45. package/dist/system/identity.zod.d.ts.map +1 -1
  46. package/dist/system/identity.zod.js +168 -51
  47. package/dist/system/index.d.ts +28 -0
  48. package/dist/system/index.d.ts.map +1 -0
  49. package/dist/system/index.js +43 -0
  50. package/dist/system/manifest.zod.d.ts +10 -10
  51. package/dist/system/organization.zod.d.ts +179 -0
  52. package/dist/system/organization.zod.d.ts.map +1 -0
  53. package/dist/system/organization.zod.js +129 -0
  54. package/dist/system/policy.zod.d.ts +10 -10
  55. package/dist/ui/action.zod.d.ts +2 -2
  56. package/dist/ui/dashboard.zod.d.ts +10 -10
  57. package/dist/ui/dashboard.zod.d.ts.map +1 -1
  58. package/dist/ui/dashboard.zod.js +3 -2
  59. package/dist/ui/index.d.ts +17 -0
  60. package/dist/ui/index.d.ts.map +1 -0
  61. package/dist/ui/index.js +32 -0
  62. package/dist/ui/report.zod.d.ts +4 -32
  63. package/dist/ui/report.zod.d.ts.map +1 -1
  64. package/dist/ui/report.zod.js +3 -8
  65. package/dist/ui/theme.zod.d.ts +6 -6
  66. package/json-schema/Account.json +87 -0
  67. package/json-schema/AccountLinkingConfig.json +27 -0
  68. package/json-schema/AuthConfig.json +841 -0
  69. package/json-schema/AuthPluginConfig.json +28 -0
  70. package/json-schema/AuthStrategy.json +17 -0
  71. package/json-schema/AuthenticationConfig.json +601 -0
  72. package/json-schema/AuthenticationProvider.json +617 -0
  73. package/json-schema/CSRFConfig.json +31 -0
  74. package/json-schema/ChunkingStrategy.json +133 -0
  75. package/json-schema/ComparisonOperator.json +56 -0
  76. package/json-schema/Dashboard.json +20 -0
  77. package/json-schema/DashboardWidget.json +20 -0
  78. package/json-schema/DatabaseAdapter.json +38 -0
  79. package/json-schema/DatabaseMapping.json +48 -0
  80. package/json-schema/Datasource.json +25 -5
  81. package/json-schema/DatasourceCapabilities.json +25 -5
  82. package/json-schema/DocumentChunk.json +97 -0
  83. package/json-schema/DocumentLoaderConfig.json +69 -0
  84. package/json-schema/DocumentMetadata.json +61 -0
  85. package/json-schema/DriverCapabilities.json +30 -0
  86. package/json-schema/DriverDefinition.json +25 -5
  87. package/json-schema/DriverInterface.json +30 -0
  88. package/json-schema/EmailPasswordConfig.json +43 -0
  89. package/json-schema/EmbeddingModel.json +57 -0
  90. package/json-schema/EnterpriseAuthConfig.json +172 -0
  91. package/json-schema/Entity.json +55 -0
  92. package/json-schema/EqualityOperator.json +14 -0
  93. package/json-schema/FieldOperators.json +108 -0
  94. package/json-schema/FieldSynonymConfig.json +39 -0
  95. package/json-schema/FilterCondition.json +28 -0
  96. package/json-schema/Invitation.json +69 -0
  97. package/json-schema/InvitationStatus.json +15 -0
  98. package/json-schema/LDAPConfig.json +22 -5
  99. package/json-schema/MagicLinkConfig.json +21 -0
  100. package/json-schema/Member.json +46 -0
  101. package/json-schema/ModelCapability.json +47 -0
  102. package/json-schema/ModelConfig.json +181 -0
  103. package/json-schema/ModelLimits.json +45 -0
  104. package/json-schema/ModelPricing.json +28 -0
  105. package/json-schema/ModelProvider.json +19 -0
  106. package/json-schema/ModelRegistry.json +427 -0
  107. package/json-schema/ModelRegistryEntry.json +239 -0
  108. package/json-schema/ModelSelectionCriteria.json +50 -0
  109. package/json-schema/NLQAnalytics.json +106 -0
  110. package/json-schema/NLQFieldMapping.json +40 -0
  111. package/json-schema/NLQModelConfig.json +78 -0
  112. package/json-schema/NLQParseResult.json +252 -0
  113. package/json-schema/NLQRequest.json +110 -0
  114. package/json-schema/NLQResponse.json +288 -0
  115. package/json-schema/NLQTrainingExample.json +120 -0
  116. package/json-schema/NormalizedFilter.json +348 -0
  117. package/json-schema/OAuthProvider.json +66 -0
  118. package/json-schema/OIDCConfig.json +18 -3
  119. package/json-schema/Organization.json +52 -0
  120. package/json-schema/PasskeyConfig.json +54 -0
  121. package/json-schema/PromptTemplate.json +163 -0
  122. package/json-schema/PromptVariable.json +56 -0
  123. package/json-schema/QueryContext.json +72 -0
  124. package/json-schema/QueryFilter.json +34 -0
  125. package/json-schema/QueryIntent.json +21 -0
  126. package/json-schema/QueryTemplate.json +81 -0
  127. package/json-schema/RAGPipelineConfig.json +552 -0
  128. package/json-schema/RAGPipelineStatus.json +66 -0
  129. package/json-schema/RAGQueryRequest.json +64 -0
  130. package/json-schema/RAGQueryResponse.json +108 -0
  131. package/json-schema/RangeOperator.json +41 -0
  132. package/json-schema/RateLimitConfig.json +36 -0
  133. package/json-schema/Report.json +20 -26
  134. package/json-schema/RerankingConfig.json +34 -0
  135. package/json-schema/RetrievalStrategy.json +121 -0
  136. package/json-schema/SAMLConfig.json +17 -3
  137. package/json-schema/Session.json +63 -0
  138. package/json-schema/SessionConfig.json +56 -0
  139. package/json-schema/SetOperator.json +18 -0
  140. package/json-schema/SpecialOperator.json +18 -0
  141. package/json-schema/StandardAuthProvider.json +857 -0
  142. package/json-schema/StringOperator.json +21 -0
  143. package/json-schema/Timeframe.json +68 -0
  144. package/json-schema/TwoFactorConfig.json +40 -0
  145. package/json-schema/User.json +51 -0
  146. package/json-schema/UserFieldMapping.json +47 -0
  147. package/json-schema/VectorStoreConfig.json +82 -0
  148. package/json-schema/VectorStoreProvider.json +21 -0
  149. package/json-schema/VerificationToken.json +36 -0
  150. package/package.json +27 -1
  151. package/json-schema/AuthProtocol.json +0 -17
  152. package/json-schema/AuthProvider.json +0 -171
@@ -1,204 +1,258 @@
1
1
  import { z } from 'zod';
2
2
  /**
3
- * Authentication Protocol
4
- * Defines supported authentication standards (OIDC, SAML, LDAP).
3
+ * Identity & User Model Specification
4
+ *
5
+ * Defines the standard user, account, and session data models for ObjectStack.
6
+ * These schemas represent "who is logged in" and their associated data.
7
+ *
8
+ * This is separate from authentication configuration (auth.zod.ts) which
9
+ * defines "how to login".
5
10
  */
6
- export declare const AuthProtocol: z.ZodEnum<["oidc", "saml", "ldap", "oauth2", "local", "mock"]>;
7
11
  /**
8
- * OIDC / OAuth2 Config (Standard)
12
+ * User Schema
13
+ * Core user identity data model
9
14
  */
10
- export declare const OIDCConfigSchema: z.ZodObject<{
11
- issuer: z.ZodString;
12
- clientId: z.ZodString;
13
- clientSecret: z.ZodString;
14
- scopes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
15
- attributeMapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
15
+ export declare const UserSchema: z.ZodObject<{
16
+ /**
17
+ * Unique user identifier
18
+ */
19
+ id: z.ZodString;
20
+ /**
21
+ * User's email address (primary identifier)
22
+ */
23
+ email: z.ZodString;
24
+ /**
25
+ * Email verification status
26
+ */
27
+ emailVerified: z.ZodDefault<z.ZodBoolean>;
28
+ /**
29
+ * User's display name
30
+ */
31
+ name: z.ZodOptional<z.ZodString>;
32
+ /**
33
+ * User's profile image URL
34
+ */
35
+ image: z.ZodOptional<z.ZodString>;
36
+ /**
37
+ * Account creation timestamp
38
+ */
39
+ createdAt: z.ZodDate;
40
+ /**
41
+ * Last update timestamp
42
+ */
43
+ updatedAt: z.ZodDate;
16
44
  }, "strip", z.ZodTypeAny, {
17
- issuer: string;
18
- clientId: string;
19
- clientSecret: string;
20
- scopes: string[];
21
- attributeMapping?: Record<string, string> | undefined;
45
+ email: string;
46
+ id: string;
47
+ emailVerified: boolean;
48
+ createdAt: Date;
49
+ updatedAt: Date;
50
+ image?: string | undefined;
51
+ name?: string | undefined;
22
52
  }, {
23
- issuer: string;
24
- clientId: string;
25
- clientSecret: string;
26
- scopes?: string[] | undefined;
27
- attributeMapping?: Record<string, string> | undefined;
53
+ email: string;
54
+ id: string;
55
+ createdAt: Date;
56
+ updatedAt: Date;
57
+ image?: string | undefined;
58
+ name?: string | undefined;
59
+ emailVerified?: boolean | undefined;
28
60
  }>;
61
+ export type User = z.infer<typeof UserSchema>;
29
62
  /**
30
- * SAML 2.0 Config (Enterprise)
63
+ * Account Schema
64
+ * Links external OAuth/OIDC/SAML accounts to a user
31
65
  */
32
- export declare const SAMLConfigSchema: z.ZodObject<{
33
- entryPoint: z.ZodString;
34
- cert: z.ZodString;
35
- issuer: z.ZodString;
36
- signatureAlgorithm: z.ZodDefault<z.ZodEnum<["sha256", "sha512"]>>;
37
- attributeMapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
66
+ export declare const AccountSchema: z.ZodObject<{
67
+ /**
68
+ * Unique account identifier
69
+ */
70
+ id: z.ZodString;
71
+ /**
72
+ * Associated user ID
73
+ */
74
+ userId: z.ZodString;
75
+ /**
76
+ * Account type/provider
77
+ */
78
+ type: z.ZodEnum<["oauth", "oidc", "email", "credentials", "saml", "ldap"]>;
79
+ /**
80
+ * Provider name (e.g., 'google', 'github', 'okta')
81
+ */
82
+ provider: z.ZodString;
83
+ /**
84
+ * Provider account ID
85
+ */
86
+ providerAccountId: z.ZodString;
87
+ /**
88
+ * OAuth refresh token
89
+ */
90
+ refreshToken: z.ZodOptional<z.ZodString>;
91
+ /**
92
+ * OAuth access token
93
+ */
94
+ accessToken: z.ZodOptional<z.ZodString>;
95
+ /**
96
+ * Token expiry timestamp
97
+ */
98
+ expiresAt: z.ZodOptional<z.ZodNumber>;
99
+ /**
100
+ * OAuth token type
101
+ */
102
+ tokenType: z.ZodOptional<z.ZodString>;
103
+ /**
104
+ * OAuth scope
105
+ */
106
+ scope: z.ZodOptional<z.ZodString>;
107
+ /**
108
+ * OAuth ID token
109
+ */
110
+ idToken: z.ZodOptional<z.ZodString>;
111
+ /**
112
+ * Session state
113
+ */
114
+ sessionState: z.ZodOptional<z.ZodString>;
115
+ /**
116
+ * Account creation timestamp
117
+ */
118
+ createdAt: z.ZodDate;
119
+ /**
120
+ * Last update timestamp
121
+ */
122
+ updatedAt: z.ZodDate;
38
123
  }, "strip", z.ZodTypeAny, {
39
- issuer: string;
40
- entryPoint: string;
41
- cert: string;
42
- signatureAlgorithm: "sha256" | "sha512";
43
- attributeMapping?: Record<string, string> | undefined;
124
+ type: "email" | "oauth" | "oidc" | "credentials" | "saml" | "ldap";
125
+ id: string;
126
+ userId: string;
127
+ createdAt: Date;
128
+ updatedAt: Date;
129
+ provider: string;
130
+ providerAccountId: string;
131
+ scope?: string | undefined;
132
+ refreshToken?: string | undefined;
133
+ accessToken?: string | undefined;
134
+ expiresAt?: number | undefined;
135
+ tokenType?: string | undefined;
136
+ idToken?: string | undefined;
137
+ sessionState?: string | undefined;
44
138
  }, {
45
- issuer: string;
46
- entryPoint: string;
47
- cert: string;
48
- attributeMapping?: Record<string, string> | undefined;
49
- signatureAlgorithm?: "sha256" | "sha512" | undefined;
139
+ type: "email" | "oauth" | "oidc" | "credentials" | "saml" | "ldap";
140
+ id: string;
141
+ userId: string;
142
+ createdAt: Date;
143
+ updatedAt: Date;
144
+ provider: string;
145
+ providerAccountId: string;
146
+ scope?: string | undefined;
147
+ refreshToken?: string | undefined;
148
+ accessToken?: string | undefined;
149
+ expiresAt?: number | undefined;
150
+ tokenType?: string | undefined;
151
+ idToken?: string | undefined;
152
+ sessionState?: string | undefined;
50
153
  }>;
154
+ export type Account = z.infer<typeof AccountSchema>;
51
155
  /**
52
- * LDAP / AD Config (On-premise)
156
+ * Session Schema
157
+ * User session data model
53
158
  */
54
- export declare const LDAPConfigSchema: z.ZodObject<{
55
- url: z.ZodString;
56
- bindDn: z.ZodString;
57
- bindCredentials: z.ZodString;
58
- searchBase: z.ZodString;
59
- searchFilter: z.ZodString;
60
- groupSearchBase: z.ZodOptional<z.ZodString>;
159
+ export declare const SessionSchema: z.ZodObject<{
160
+ /**
161
+ * Unique session identifier
162
+ */
163
+ id: z.ZodString;
164
+ /**
165
+ * Session token
166
+ */
167
+ sessionToken: z.ZodString;
168
+ /**
169
+ * Associated user ID
170
+ */
171
+ userId: z.ZodString;
172
+ /**
173
+ * Active organization ID for this session
174
+ * Used for context switching in multi-tenant applications
175
+ */
176
+ activeOrganizationId: z.ZodOptional<z.ZodString>;
177
+ /**
178
+ * Session expiry timestamp
179
+ */
180
+ expires: z.ZodDate;
181
+ /**
182
+ * Session creation timestamp
183
+ */
184
+ createdAt: z.ZodDate;
185
+ /**
186
+ * Last update timestamp
187
+ */
188
+ updatedAt: z.ZodDate;
189
+ /**
190
+ * IP address of the session
191
+ */
192
+ ipAddress: z.ZodOptional<z.ZodString>;
193
+ /**
194
+ * User agent string
195
+ */
196
+ userAgent: z.ZodOptional<z.ZodString>;
197
+ /**
198
+ * Device fingerprint
199
+ */
200
+ fingerprint: z.ZodOptional<z.ZodString>;
61
201
  }, "strip", z.ZodTypeAny, {
62
- url: string;
63
- bindDn: string;
64
- bindCredentials: string;
65
- searchBase: string;
66
- searchFilter: string;
67
- groupSearchBase?: string | undefined;
202
+ id: string;
203
+ userId: string;
204
+ createdAt: Date;
205
+ updatedAt: Date;
206
+ sessionToken: string;
207
+ expires: Date;
208
+ activeOrganizationId?: string | undefined;
209
+ ipAddress?: string | undefined;
210
+ userAgent?: string | undefined;
211
+ fingerprint?: string | undefined;
68
212
  }, {
69
- url: string;
70
- bindDn: string;
71
- bindCredentials: string;
72
- searchBase: string;
73
- searchFilter: string;
74
- groupSearchBase?: string | undefined;
213
+ id: string;
214
+ userId: string;
215
+ createdAt: Date;
216
+ updatedAt: Date;
217
+ sessionToken: string;
218
+ expires: Date;
219
+ activeOrganizationId?: string | undefined;
220
+ ipAddress?: string | undefined;
221
+ userAgent?: string | undefined;
222
+ fingerprint?: string | undefined;
75
223
  }>;
224
+ export type Session = z.infer<typeof SessionSchema>;
76
225
  /**
77
- * Identity Provider (IdP) Schema
78
- * Connects the OS to an external source of truth for identities.
226
+ * Verification Token Schema
227
+ * Email verification and password reset tokens
79
228
  */
80
- export declare const AuthProviderSchema: z.ZodObject<{
81
- name: z.ZodString;
82
- label: z.ZodString;
83
- type: z.ZodEnum<["oidc", "saml", "ldap", "oauth2", "local", "mock"]>;
84
- /** Configuration (Polymorphic based on type) */
85
- config: z.ZodUnion<[z.ZodObject<{
86
- issuer: z.ZodString;
87
- clientId: z.ZodString;
88
- clientSecret: z.ZodString;
89
- scopes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
90
- attributeMapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
91
- }, "strip", z.ZodTypeAny, {
92
- issuer: string;
93
- clientId: string;
94
- clientSecret: string;
95
- scopes: string[];
96
- attributeMapping?: Record<string, string> | undefined;
97
- }, {
98
- issuer: string;
99
- clientId: string;
100
- clientSecret: string;
101
- scopes?: string[] | undefined;
102
- attributeMapping?: Record<string, string> | undefined;
103
- }>, z.ZodObject<{
104
- entryPoint: z.ZodString;
105
- cert: z.ZodString;
106
- issuer: z.ZodString;
107
- signatureAlgorithm: z.ZodDefault<z.ZodEnum<["sha256", "sha512"]>>;
108
- attributeMapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
109
- }, "strip", z.ZodTypeAny, {
110
- issuer: string;
111
- entryPoint: string;
112
- cert: string;
113
- signatureAlgorithm: "sha256" | "sha512";
114
- attributeMapping?: Record<string, string> | undefined;
115
- }, {
116
- issuer: string;
117
- entryPoint: string;
118
- cert: string;
119
- attributeMapping?: Record<string, string> | undefined;
120
- signatureAlgorithm?: "sha256" | "sha512" | undefined;
121
- }>, z.ZodObject<{
122
- url: z.ZodString;
123
- bindDn: z.ZodString;
124
- bindCredentials: z.ZodString;
125
- searchBase: z.ZodString;
126
- searchFilter: z.ZodString;
127
- groupSearchBase: z.ZodOptional<z.ZodString>;
128
- }, "strip", z.ZodTypeAny, {
129
- url: string;
130
- bindDn: string;
131
- bindCredentials: string;
132
- searchBase: string;
133
- searchFilter: string;
134
- groupSearchBase?: string | undefined;
135
- }, {
136
- url: string;
137
- bindDn: string;
138
- bindCredentials: string;
139
- searchBase: string;
140
- searchFilter: string;
141
- groupSearchBase?: string | undefined;
142
- }>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
143
- /** Visuals */
144
- icon: z.ZodOptional<z.ZodString>;
145
- /** Policies */
146
- active: z.ZodDefault<z.ZodBoolean>;
147
- registrationEnabled: z.ZodDefault<z.ZodBoolean>;
229
+ export declare const VerificationTokenSchema: z.ZodObject<{
230
+ /**
231
+ * Token identifier (email or phone)
232
+ */
233
+ identifier: z.ZodString;
234
+ /**
235
+ * Verification token
236
+ */
237
+ token: z.ZodString;
238
+ /**
239
+ * Token expiry timestamp
240
+ */
241
+ expires: z.ZodDate;
242
+ /**
243
+ * Token creation timestamp
244
+ */
245
+ createdAt: z.ZodDate;
148
246
  }, "strip", z.ZodTypeAny, {
149
- type: "local" | "oidc" | "saml" | "ldap" | "oauth2" | "mock";
150
- label: string;
151
- name: string;
152
- active: boolean;
153
- config: Record<string, any> | {
154
- issuer: string;
155
- clientId: string;
156
- clientSecret: string;
157
- scopes: string[];
158
- attributeMapping?: Record<string, string> | undefined;
159
- } | {
160
- issuer: string;
161
- entryPoint: string;
162
- cert: string;
163
- signatureAlgorithm: "sha256" | "sha512";
164
- attributeMapping?: Record<string, string> | undefined;
165
- } | {
166
- url: string;
167
- bindDn: string;
168
- bindCredentials: string;
169
- searchBase: string;
170
- searchFilter: string;
171
- groupSearchBase?: string | undefined;
172
- };
173
- registrationEnabled: boolean;
174
- icon?: string | undefined;
247
+ createdAt: Date;
248
+ expires: Date;
249
+ identifier: string;
250
+ token: string;
175
251
  }, {
176
- type: "local" | "oidc" | "saml" | "ldap" | "oauth2" | "mock";
177
- label: string;
178
- name: string;
179
- config: Record<string, any> | {
180
- issuer: string;
181
- clientId: string;
182
- clientSecret: string;
183
- scopes?: string[] | undefined;
184
- attributeMapping?: Record<string, string> | undefined;
185
- } | {
186
- issuer: string;
187
- entryPoint: string;
188
- cert: string;
189
- attributeMapping?: Record<string, string> | undefined;
190
- signatureAlgorithm?: "sha256" | "sha512" | undefined;
191
- } | {
192
- url: string;
193
- bindDn: string;
194
- bindCredentials: string;
195
- searchBase: string;
196
- searchFilter: string;
197
- groupSearchBase?: string | undefined;
198
- };
199
- icon?: string | undefined;
200
- active?: boolean | undefined;
201
- registrationEnabled?: boolean | undefined;
252
+ createdAt: Date;
253
+ expires: Date;
254
+ identifier: string;
255
+ token: string;
202
256
  }>;
203
- export type AuthProvider = z.infer<typeof AuthProviderSchema>;
257
+ export type VerificationToken = z.infer<typeof VerificationTokenSchema>;
204
258
  //# sourceMappingURL=identity.zod.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity.zod.d.ts","sourceRoot":"","sources":["../../src/system/identity.zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,YAAY,gEAOvB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;EAM3B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;EAM3B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;EAO3B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;IAK7B,gDAAgD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAQhD,cAAc;;IAGd,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGf,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
1
+ {"version":3,"file":"identity.zod.d.ts","sourceRoot":"","sources":["../../src/system/identity.zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;GAQG;AAEH;;;GAGG;AACH,eAAO,MAAM,UAAU;IACrB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAE9C;;;GAGG;AACH,eAAO,MAAM,aAAa;IACxB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAUH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,aAAa;IACxB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;;OAGG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,uBAAuB;IAClC;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
@@ -1,68 +1,185 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AuthProviderSchema = exports.LDAPConfigSchema = exports.SAMLConfigSchema = exports.OIDCConfigSchema = exports.AuthProtocol = void 0;
3
+ exports.VerificationTokenSchema = exports.SessionSchema = exports.AccountSchema = exports.UserSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  /**
6
- * Authentication Protocol
7
- * Defines supported authentication standards (OIDC, SAML, LDAP).
6
+ * Identity & User Model Specification
7
+ *
8
+ * Defines the standard user, account, and session data models for ObjectStack.
9
+ * These schemas represent "who is logged in" and their associated data.
10
+ *
11
+ * This is separate from authentication configuration (auth.zod.ts) which
12
+ * defines "how to login".
8
13
  */
9
- exports.AuthProtocol = zod_1.z.enum([
10
- 'oidc', // OpenID Connect (Modern standard)
11
- 'saml', // SAML 2.0 (Legacy Enterprise)
12
- 'ldap', // LDAP/Active Directory (On-premise)
13
- 'oauth2', // Generic OAuth2
14
- 'local', // Database username/password
15
- 'mock' // Testing
16
- ]);
17
14
  /**
18
- * OIDC / OAuth2 Config (Standard)
15
+ * User Schema
16
+ * Core user identity data model
19
17
  */
20
- exports.OIDCConfigSchema = zod_1.z.object({
21
- issuer: zod_1.z.string().url().describe('OIDC Issuer URL (.well-known/openid-configuration)'),
22
- clientId: zod_1.z.string(),
23
- clientSecret: zod_1.z.string(), // Usually value is ENV reference
24
- scopes: zod_1.z.array(zod_1.z.string()).default(['openid', 'profile', 'email']),
25
- attributeMapping: zod_1.z.record(zod_1.z.string()).optional().describe('Map IdP claims to User fields'),
18
+ exports.UserSchema = zod_1.z.object({
19
+ /**
20
+ * Unique user identifier
21
+ */
22
+ id: zod_1.z.string().describe('Unique user identifier'),
23
+ /**
24
+ * User's email address (primary identifier)
25
+ */
26
+ email: zod_1.z.string().email().describe('User email address'),
27
+ /**
28
+ * Email verification status
29
+ */
30
+ emailVerified: zod_1.z.boolean().default(false).describe('Whether email is verified'),
31
+ /**
32
+ * User's display name
33
+ */
34
+ name: zod_1.z.string().optional().describe('User display name'),
35
+ /**
36
+ * User's profile image URL
37
+ */
38
+ image: zod_1.z.string().url().optional().describe('Profile image URL'),
39
+ /**
40
+ * Account creation timestamp
41
+ */
42
+ createdAt: zod_1.z.date().describe('Account creation timestamp'),
43
+ /**
44
+ * Last update timestamp
45
+ */
46
+ updatedAt: zod_1.z.date().describe('Last update timestamp'),
26
47
  });
27
48
  /**
28
- * SAML 2.0 Config (Enterprise)
49
+ * Account Schema
50
+ * Links external OAuth/OIDC/SAML accounts to a user
29
51
  */
30
- exports.SAMLConfigSchema = zod_1.z.object({
31
- entryPoint: zod_1.z.string().url().describe('IdP SSO URL'),
32
- cert: zod_1.z.string().describe('IdP Public Certificate'), // PEM format
33
- issuer: zod_1.z.string().describe('Entity ID of the IdP'),
34
- signatureAlgorithm: zod_1.z.enum(['sha256', 'sha512']).default('sha256'),
35
- attributeMapping: zod_1.z.record(zod_1.z.string()).optional(),
52
+ exports.AccountSchema = zod_1.z.object({
53
+ /**
54
+ * Unique account identifier
55
+ */
56
+ id: zod_1.z.string().describe('Unique account identifier'),
57
+ /**
58
+ * Associated user ID
59
+ */
60
+ userId: zod_1.z.string().describe('Associated user ID'),
61
+ /**
62
+ * Account type/provider
63
+ */
64
+ type: zod_1.z.enum([
65
+ 'oauth',
66
+ 'oidc',
67
+ 'email',
68
+ 'credentials',
69
+ 'saml',
70
+ 'ldap',
71
+ ]).describe('Account type'),
72
+ /**
73
+ * Provider name (e.g., 'google', 'github', 'okta')
74
+ */
75
+ provider: zod_1.z.string().describe('Provider name'),
76
+ /**
77
+ * Provider account ID
78
+ */
79
+ providerAccountId: zod_1.z.string().describe('Provider account ID'),
80
+ /**
81
+ * OAuth refresh token
82
+ */
83
+ refreshToken: zod_1.z.string().optional().describe('OAuth refresh token'),
84
+ /**
85
+ * OAuth access token
86
+ */
87
+ accessToken: zod_1.z.string().optional().describe('OAuth access token'),
88
+ /**
89
+ * Token expiry timestamp
90
+ */
91
+ expiresAt: zod_1.z.number().optional().describe('Token expiry timestamp (Unix)'),
92
+ /**
93
+ * OAuth token type
94
+ */
95
+ tokenType: zod_1.z.string().optional().describe('OAuth token type'),
96
+ /**
97
+ * OAuth scope
98
+ */
99
+ scope: zod_1.z.string().optional().describe('OAuth scope'),
100
+ /**
101
+ * OAuth ID token
102
+ */
103
+ idToken: zod_1.z.string().optional().describe('OAuth ID token'),
104
+ /**
105
+ * Session state
106
+ */
107
+ sessionState: zod_1.z.string().optional().describe('Session state'),
108
+ /**
109
+ * Account creation timestamp
110
+ */
111
+ createdAt: zod_1.z.date().describe('Account creation timestamp'),
112
+ /**
113
+ * Last update timestamp
114
+ */
115
+ updatedAt: zod_1.z.date().describe('Last update timestamp'),
36
116
  });
37
117
  /**
38
- * LDAP / AD Config (On-premise)
118
+ * Session Schema
119
+ * User session data model
39
120
  */
40
- exports.LDAPConfigSchema = zod_1.z.object({
41
- url: zod_1.z.string().url().describe('LDAP Server URL (ldap:// or ldaps://)'),
42
- bindDn: zod_1.z.string(),
43
- bindCredentials: zod_1.z.string(),
44
- searchBase: zod_1.z.string(),
45
- searchFilter: zod_1.z.string(),
46
- groupSearchBase: zod_1.z.string().optional(),
121
+ exports.SessionSchema = zod_1.z.object({
122
+ /**
123
+ * Unique session identifier
124
+ */
125
+ id: zod_1.z.string().describe('Unique session identifier'),
126
+ /**
127
+ * Session token
128
+ */
129
+ sessionToken: zod_1.z.string().describe('Session token'),
130
+ /**
131
+ * Associated user ID
132
+ */
133
+ userId: zod_1.z.string().describe('Associated user ID'),
134
+ /**
135
+ * Active organization ID for this session
136
+ * Used for context switching in multi-tenant applications
137
+ */
138
+ activeOrganizationId: zod_1.z.string().optional().describe('Active organization ID for context switching'),
139
+ /**
140
+ * Session expiry timestamp
141
+ */
142
+ expires: zod_1.z.date().describe('Session expiry timestamp'),
143
+ /**
144
+ * Session creation timestamp
145
+ */
146
+ createdAt: zod_1.z.date().describe('Session creation timestamp'),
147
+ /**
148
+ * Last update timestamp
149
+ */
150
+ updatedAt: zod_1.z.date().describe('Last update timestamp'),
151
+ /**
152
+ * IP address of the session
153
+ */
154
+ ipAddress: zod_1.z.string().optional().describe('IP address'),
155
+ /**
156
+ * User agent string
157
+ */
158
+ userAgent: zod_1.z.string().optional().describe('User agent string'),
159
+ /**
160
+ * Device fingerprint
161
+ */
162
+ fingerprint: zod_1.z.string().optional().describe('Device fingerprint'),
47
163
  });
48
164
  /**
49
- * Identity Provider (IdP) Schema
50
- * Connects the OS to an external source of truth for identities.
165
+ * Verification Token Schema
166
+ * Email verification and password reset tokens
51
167
  */
52
- exports.AuthProviderSchema = zod_1.z.object({
53
- name: zod_1.z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Provider ID'),
54
- label: zod_1.z.string().describe('Button Label (e.g. "Login with Okta")'),
55
- type: exports.AuthProtocol,
56
- /** Configuration (Polymorphic based on type) */
57
- config: zod_1.z.union([
58
- exports.OIDCConfigSchema,
59
- exports.SAMLConfigSchema,
60
- exports.LDAPConfigSchema,
61
- zod_1.z.record(zod_1.z.any()) // Fallback
62
- ]).describe('Provider specific configuration'),
63
- /** Visuals */
64
- icon: zod_1.z.string().optional().describe('Icon URL or helper class'),
65
- /** Policies */
66
- active: zod_1.z.boolean().default(true),
67
- registrationEnabled: zod_1.z.boolean().default(false).describe('Allow new users to sign up via this provider'),
168
+ exports.VerificationTokenSchema = zod_1.z.object({
169
+ /**
170
+ * Token identifier (email or phone)
171
+ */
172
+ identifier: zod_1.z.string().describe('Token identifier (email or phone)'),
173
+ /**
174
+ * Verification token
175
+ */
176
+ token: zod_1.z.string().describe('Verification token'),
177
+ /**
178
+ * Token expiry timestamp
179
+ */
180
+ expires: zod_1.z.date().describe('Token expiry timestamp'),
181
+ /**
182
+ * Token creation timestamp
183
+ */
184
+ createdAt: zod_1.z.date().describe('Token creation timestamp'),
68
185
  });