@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
package/README.md CHANGED
@@ -44,12 +44,115 @@ The specification is divided into three protocols:
44
44
 
45
45
  ## 📚 Usage
46
46
 
47
+ ### Import Styles
48
+
49
+ **Important:** This package does NOT export types at the root level to prevent naming conflicts. You must use one of the following import styles:
50
+
51
+ #### 1. Namespace Imports from Root
52
+
53
+ Import protocol namespaces from the package root:
54
+
55
+ ```typescript
56
+ import { Data, UI, System, AI, API } from '@objectstack/spec';
57
+
58
+ const field: Data.Field = {
59
+ name: 'task_name',
60
+ type: 'text',
61
+ label: 'Task Name',
62
+ };
63
+
64
+ const user: System.User = {
65
+ id: 'user_123',
66
+ email: 'user@example.com',
67
+ // ...
68
+ };
69
+
70
+ const agent: AI.Agent = {
71
+ name: 'sales_assistant',
72
+ // ...
73
+ };
74
+ ```
75
+
76
+ **Pros:**
77
+ - Single import line for multiple protocols
78
+ - Clear namespace boundaries
79
+ - No naming conflicts
80
+
81
+ #### 2. Namespace Imports via Subpath
82
+
83
+ Import protocol domains individually:
84
+
85
+ ```typescript
86
+ import * as Data from '@objectstack/spec/data';
87
+ import * as UI from '@objectstack/spec/ui';
88
+ import * as System from '@objectstack/spec/system';
89
+ import * as AI from '@objectstack/spec/ai';
90
+ import * as API from '@objectstack/spec/api';
91
+
92
+ const field: Data.Field = {
93
+ name: 'task_name',
94
+ type: 'text',
95
+ label: 'Task Name',
96
+ };
97
+
98
+ const user: System.User = {
99
+ id: 'user_123',
100
+ email: 'user@example.com',
101
+ // ...
102
+ };
103
+ ```
104
+
105
+ **Pros:**
106
+ - Explicit about which protocols are used
107
+ - Better tree-shaking (only imports needed protocols)
108
+ - Clear namespace boundaries
109
+
110
+ #### 3. Direct Subpath Imports
111
+
112
+ Import specific types from subpaths:
113
+
114
+ ```typescript
115
+ import { Field, FieldType, ObjectSchema } from '@objectstack/spec/data';
116
+ import { User, Session } from '@objectstack/spec/system';
117
+ import { App, View } from '@objectstack/spec/ui';
118
+
119
+ const field: Field = {
120
+ name: 'task_name',
121
+ type: 'text',
122
+ label: 'Task Name',
123
+ };
124
+
125
+ const user: User = {
126
+ id: 'user_123',
127
+ email: 'user@example.com',
128
+ // ...
129
+ };
130
+ ```
131
+
132
+ **Pros:**
133
+ - Most concise syntax
134
+ - Good for importing specific types
135
+ - No namespace prefix needed
136
+
137
+ **Cons:**
138
+ - Need to know which subpath contains each type
139
+ - Multiple import statements for different protocols
140
+
47
141
  ### Validation (Runtime)
48
142
 
49
143
  ```typescript
50
- import { ObjectSchema } from '@objectstack/spec';
144
+ // Style 1: Namespace from root
145
+ import { Data } from '@objectstack/spec';
146
+ const result = Data.ObjectSchema.safeParse(userConfig);
147
+
148
+ // Style 2: Namespace via subpath
149
+ import * as Data from '@objectstack/spec/data';
150
+ const result = Data.ObjectSchema.safeParse(userConfig);
51
151
 
152
+ // Style 3: Direct subpath import
153
+ import { ObjectSchema } from '@objectstack/spec/data';
52
154
  const result = ObjectSchema.safeParse(userConfig);
155
+
53
156
  if (!result.success) {
54
157
  console.error("Invalid Object definition", result.error);
55
158
  }
@@ -58,14 +161,33 @@ if (!result.success) {
58
161
  ### Type Definitions (Compile Time)
59
162
 
60
163
  ```typescript
61
- import type { Object, Field } from '@objectstack/spec';
164
+ // Style 1: Namespace from root
165
+ import type { Data } from '@objectstack/spec';
166
+ const myField: Data.Field = {
167
+ name: "task_name",
168
+ type: "text",
169
+ label: "Task Name"
170
+ };
62
171
 
63
- const myObject: Object = {
64
- name: "project_task",
65
- fields: { ... }
172
+ // Style 2: Direct subpath import
173
+ import type { Field } from '@objectstack/spec/data';
174
+ const myField: Field = {
175
+ name: "task_name",
176
+ type: "text",
177
+ label: "Task Name"
66
178
  };
67
179
  ```
68
180
 
181
+ Using namespace imports for multiple protocols:
182
+
183
+ ```typescript
184
+ import type * as Data from '@objectstack/spec/data';
185
+ import type * as System from '@objectstack/spec/system';
186
+
187
+ const field: Data.Field = { /* ... */ };
188
+ const user: System.User = { /* ... */ };
189
+ ```
190
+
69
191
  ### JSON Schema (Tooling)
70
192
  The package includes valid JSON Schemas in the `/json-schema` directory.
71
193
  These can be used with:
@@ -0,0 +1,14 @@
1
+ /**
2
+ * AI Protocol Exports
3
+ *
4
+ * AI/ML Capabilities
5
+ * - Agent Configuration
6
+ * - Model Registry & Selection
7
+ * - RAG Pipeline
8
+ * - Natural Language Query (NLQ)
9
+ */
10
+ export * from './agent.zod';
11
+ export * from './model-registry.zod';
12
+ export * from './rag-pipeline.zod';
13
+ export * from './nlq.zod';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ai/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ /**
3
+ * AI Protocol Exports
4
+ *
5
+ * AI/ML Capabilities
6
+ * - Agent Configuration
7
+ * - Model Registry & Selection
8
+ * - RAG Pipeline
9
+ * - Natural Language Query (NLQ)
10
+ */
11
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ var desc = Object.getOwnPropertyDescriptor(m, k);
14
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
15
+ desc = { enumerable: true, get: function() { return m[k]; } };
16
+ }
17
+ Object.defineProperty(o, k2, desc);
18
+ }) : (function(o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ o[k2] = m[k];
21
+ }));
22
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
23
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ __exportStar(require("./agent.zod"), exports);
27
+ __exportStar(require("./model-registry.zod"), exports);
28
+ __exportStar(require("./rag-pipeline.zod"), exports);
29
+ __exportStar(require("./nlq.zod"), exports);