@objectstack/spec 0.2.0 → 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/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 -41
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +64 -49
- 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 +1097 -65
- package/dist/system/auth.zod.d.ts.map +1 -1
- package/dist/system/auth.zod.js +135 -1
- 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/ui/action.zod.d.ts +2 -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/theme.zod.d.ts +6 -6
- package/json-schema/Account.json +87 -0
- package/json-schema/AuthConfig.json +235 -0
- package/json-schema/ChunkingStrategy.json +133 -0
- package/json-schema/DatabaseMapping.json +48 -0
- package/json-schema/DocumentChunk.json +97 -0
- package/json-schema/DocumentLoaderConfig.json +69 -0
- package/json-schema/DocumentMetadata.json +61 -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/FieldSynonymConfig.json +39 -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/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/OIDCConfig.json +18 -3
- package/json-schema/Organization.json +52 -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/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/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/StandardAuthProvider.json +235 -0
- package/json-schema/Timeframe.json +68 -0
- package/json-schema/User.json +51 -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
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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"}
|
package/dist/ai/index.js
ADDED
|
@@ -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);
|