@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
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Authentication Wire Protocol & Constants
3
+ *
4
+ * Defines the API contract and constants for authentication communication.
5
+ * These constants ensure consistent behavior across all ObjectStack implementations.
6
+ */
7
+ /**
8
+ * Authentication Constants
9
+ * Standard headers, prefixes, and identifiers for auth communication
10
+ */
11
+ export declare const AUTH_CONSTANTS: {
12
+ /**
13
+ * HTTP header key for authentication tokens
14
+ */
15
+ readonly HEADER_KEY: "Authorization";
16
+ /**
17
+ * Token prefix for Bearer authentication
18
+ */
19
+ readonly TOKEN_PREFIX: "Bearer ";
20
+ /**
21
+ * Cookie prefix for ObjectStack auth cookies
22
+ */
23
+ readonly COOKIE_PREFIX: "os_";
24
+ /**
25
+ * CSRF token header name
26
+ */
27
+ readonly CSRF_HEADER: "x-os-csrf-token";
28
+ /**
29
+ * Default session cookie name
30
+ */
31
+ readonly SESSION_COOKIE: "os_session_token";
32
+ /**
33
+ * Default CSRF cookie name
34
+ */
35
+ readonly CSRF_COOKIE: "os_csrf_token";
36
+ /**
37
+ * Refresh token cookie name
38
+ */
39
+ readonly REFRESH_TOKEN_COOKIE: "os_refresh_token";
40
+ };
41
+ /**
42
+ * Authentication Headers Interface
43
+ * Standard headers used in authenticated requests
44
+ */
45
+ export interface AuthHeaders {
46
+ /**
47
+ * Authorization header with Bearer token
48
+ * @example "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
49
+ */
50
+ Authorization?: string;
51
+ /**
52
+ * CSRF token header
53
+ * @example "x-os-csrf-token: abc123def456..."
54
+ */
55
+ 'x-os-csrf-token'?: string;
56
+ /**
57
+ * Session ID header (alternative to cookie)
58
+ * @example "x-os-session-id: session_abc123..."
59
+ */
60
+ 'x-os-session-id'?: string;
61
+ /**
62
+ * API key header (for service-to-service auth)
63
+ * @example "x-os-api-key: sk_live_abc123..."
64
+ */
65
+ 'x-os-api-key'?: string;
66
+ }
67
+ /**
68
+ * Authentication Response Interface
69
+ * Standard response format for authentication operations
70
+ */
71
+ export interface AuthResponse {
72
+ /**
73
+ * Access token (JWT or opaque token)
74
+ */
75
+ accessToken: string;
76
+ /**
77
+ * Refresh token (for token renewal)
78
+ */
79
+ refreshToken?: string;
80
+ /**
81
+ * Token type (usually "Bearer")
82
+ */
83
+ tokenType: string;
84
+ /**
85
+ * Token expiry in seconds
86
+ */
87
+ expiresIn: number;
88
+ /**
89
+ * User information
90
+ */
91
+ user: {
92
+ id: string;
93
+ email: string;
94
+ name?: string;
95
+ image?: string;
96
+ };
97
+ /**
98
+ * Session ID
99
+ */
100
+ sessionId?: string;
101
+ }
102
+ /**
103
+ * Authentication Error Codes
104
+ * Standard error codes for authentication failures
105
+ */
106
+ export declare const AUTH_ERROR_CODES: {
107
+ readonly INVALID_CREDENTIALS: "invalid_credentials";
108
+ readonly INVALID_TOKEN: "invalid_token";
109
+ readonly TOKEN_EXPIRED: "token_expired";
110
+ readonly INSUFFICIENT_PERMISSIONS: "insufficient_permissions";
111
+ readonly ACCOUNT_LOCKED: "account_locked";
112
+ readonly ACCOUNT_NOT_VERIFIED: "account_not_verified";
113
+ readonly TOO_MANY_REQUESTS: "too_many_requests";
114
+ readonly INVALID_CSRF_TOKEN: "invalid_csrf_token";
115
+ readonly SESSION_EXPIRED: "session_expired";
116
+ readonly OAUTH_ERROR: "oauth_error";
117
+ readonly PROVIDER_ERROR: "provider_error";
118
+ };
119
+ /**
120
+ * Authentication Error Interface
121
+ * Standard error response format
122
+ */
123
+ export interface AuthError {
124
+ /**
125
+ * Error code from AUTH_ERROR_CODES
126
+ */
127
+ code: typeof AUTH_ERROR_CODES[keyof typeof AUTH_ERROR_CODES];
128
+ /**
129
+ * Human-readable error message
130
+ */
131
+ message: string;
132
+ /**
133
+ * Additional error details
134
+ */
135
+ details?: Record<string, any>;
136
+ }
137
+ /**
138
+ * Token Payload Interface
139
+ * Standard JWT payload structure
140
+ */
141
+ export interface TokenPayload {
142
+ /**
143
+ * Subject (user ID)
144
+ */
145
+ sub: string;
146
+ /**
147
+ * Issued at timestamp
148
+ */
149
+ iat: number;
150
+ /**
151
+ * Expiration timestamp
152
+ */
153
+ exp: number;
154
+ /**
155
+ * Session ID
156
+ */
157
+ sid?: string;
158
+ /**
159
+ * User email
160
+ */
161
+ email?: string;
162
+ /**
163
+ * User roles
164
+ */
165
+ roles?: string[];
166
+ /**
167
+ * User permissions
168
+ */
169
+ permissions?: string[];
170
+ /**
171
+ * Additional custom claims
172
+ */
173
+ [key: string]: any;
174
+ }
175
+ //# sourceMappingURL=auth-protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-protocol.d.ts","sourceRoot":"","sources":["../../src/system/auth-protocol.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,eAAO,MAAM,cAAc;IACzB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEK,CAAC;AAEX;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IAEF;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;CAYnB,CAAC;AAEX;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,IAAI,EAAE,OAAO,gBAAgB,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;IAE7D;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IAEjB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAEvB;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB"}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ /**
3
+ * Authentication Wire Protocol & Constants
4
+ *
5
+ * Defines the API contract and constants for authentication communication.
6
+ * These constants ensure consistent behavior across all ObjectStack implementations.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.AUTH_ERROR_CODES = exports.AUTH_CONSTANTS = void 0;
10
+ /**
11
+ * Authentication Constants
12
+ * Standard headers, prefixes, and identifiers for auth communication
13
+ */
14
+ exports.AUTH_CONSTANTS = {
15
+ /**
16
+ * HTTP header key for authentication tokens
17
+ */
18
+ HEADER_KEY: 'Authorization',
19
+ /**
20
+ * Token prefix for Bearer authentication
21
+ */
22
+ TOKEN_PREFIX: 'Bearer ',
23
+ /**
24
+ * Cookie prefix for ObjectStack auth cookies
25
+ */
26
+ COOKIE_PREFIX: 'os_',
27
+ /**
28
+ * CSRF token header name
29
+ */
30
+ CSRF_HEADER: 'x-os-csrf-token',
31
+ /**
32
+ * Default session cookie name
33
+ */
34
+ SESSION_COOKIE: 'os_session_token',
35
+ /**
36
+ * Default CSRF cookie name
37
+ */
38
+ CSRF_COOKIE: 'os_csrf_token',
39
+ /**
40
+ * Refresh token cookie name
41
+ */
42
+ REFRESH_TOKEN_COOKIE: 'os_refresh_token',
43
+ };
44
+ /**
45
+ * Authentication Error Codes
46
+ * Standard error codes for authentication failures
47
+ */
48
+ exports.AUTH_ERROR_CODES = {
49
+ INVALID_CREDENTIALS: 'invalid_credentials',
50
+ INVALID_TOKEN: 'invalid_token',
51
+ TOKEN_EXPIRED: 'token_expired',
52
+ INSUFFICIENT_PERMISSIONS: 'insufficient_permissions',
53
+ ACCOUNT_LOCKED: 'account_locked',
54
+ ACCOUNT_NOT_VERIFIED: 'account_not_verified',
55
+ TOO_MANY_REQUESTS: 'too_many_requests',
56
+ INVALID_CSRF_TOKEN: 'invalid_csrf_token',
57
+ SESSION_EXPIRED: 'session_expired',
58
+ OAUTH_ERROR: 'oauth_error',
59
+ PROVIDER_ERROR: 'provider_error',
60
+ };