@objectstack/client 0.9.0 → 0.9.2
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/CHANGELOG.md +17 -0
- package/README.md +55 -6
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @objectstack/client
|
|
2
2
|
|
|
3
|
+
## 0.9.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @objectstack/spec@0.9.2
|
|
9
|
+
- @objectstack/core@0.9.2
|
|
10
|
+
|
|
11
|
+
## 0.9.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Patch release for maintenance and stability improvements. All packages updated with unified versioning.
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @objectstack/spec@0.9.1
|
|
18
|
+
- @objectstack/core@0.9.1
|
|
19
|
+
|
|
3
20
|
## 0.8.2
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -12,6 +12,17 @@ The official TypeScript client for ObjectStack.
|
|
|
12
12
|
- **View Storage**: Save, load, and share custom UI view configurations.
|
|
13
13
|
- **Standardized Errors**: Machine-readable error codes with retry guidance.
|
|
14
14
|
|
|
15
|
+
## 🤖 AI Development Context
|
|
16
|
+
|
|
17
|
+
**Role**: Browser/Node Client SDK
|
|
18
|
+
**Usage**:
|
|
19
|
+
- Use this in Frontend Apps (React, etc.) or external Node scripts.
|
|
20
|
+
- Interacts with `packages/runtime` over HTTP.
|
|
21
|
+
|
|
22
|
+
**Key namespaces**:
|
|
23
|
+
- `client.meta`: Metadata operations.
|
|
24
|
+
- `client.data`: Data operations.
|
|
25
|
+
|
|
15
26
|
## Installation
|
|
16
27
|
|
|
17
28
|
```bash
|
|
@@ -157,10 +168,48 @@ try {
|
|
|
157
168
|
}
|
|
158
169
|
```
|
|
159
170
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
171
|
+
### Error Code Reference
|
|
172
|
+
|
|
173
|
+
#### Client Errors (4xx)
|
|
174
|
+
|
|
175
|
+
| Error Code | HTTP Status | Retryable | Description |
|
|
176
|
+
|------------|-------------|-----------|-------------|
|
|
177
|
+
| `validation_error` | 400 | No | Input validation failed. Check error.details for field-specific errors |
|
|
178
|
+
| `unauthenticated` | 401 | No | Authentication required. Provide valid token |
|
|
179
|
+
| `permission_denied` | 403 | No | Insufficient permissions for this operation |
|
|
180
|
+
| `resource_not_found` | 404 | No | Resource does not exist. Verify object name or record ID |
|
|
181
|
+
| `conflict` | 409 | No | Resource conflict (e.g., duplicate unique field) |
|
|
182
|
+
| `rate_limit_exceeded` | 429 | Yes | Too many requests. Wait before retrying |
|
|
183
|
+
|
|
184
|
+
#### Server Errors (5xx)
|
|
185
|
+
|
|
186
|
+
| Error Code | HTTP Status | Retryable | Description |
|
|
187
|
+
|------------|-------------|-----------|-------------|
|
|
188
|
+
| `internal_error` | 500 | Yes | Server encountered an error. Retry with backoff |
|
|
189
|
+
| `service_unavailable` | 503 | Yes | Service temporarily unavailable. Retry later |
|
|
190
|
+
| `gateway_timeout` | 504 | Yes | Request timeout. Consider increasing timeout or retrying |
|
|
191
|
+
|
|
192
|
+
**Retry Strategy Example:**
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
async function retryableRequest<T>(fn: () => Promise<T>, maxRetries = 3): Promise<T> {
|
|
196
|
+
for (let i = 0; i < maxRetries; i++) {
|
|
197
|
+
try {
|
|
198
|
+
return await fn();
|
|
199
|
+
} catch (error: any) {
|
|
200
|
+
if (!error.retryable || i === maxRetries - 1) {
|
|
201
|
+
throw error;
|
|
202
|
+
}
|
|
203
|
+
// Exponential backoff
|
|
204
|
+
await new Promise(resolve => setTimeout(resolve, Math.pow(2, i) * 1000));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
throw new Error('Max retries exceeded');
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Usage
|
|
211
|
+
const data = await retryableRequest(() =>
|
|
212
|
+
client.data.create('todo_task', { subject: 'Task' })
|
|
213
|
+
);
|
|
214
|
+
```
|
|
166
215
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@objectstack/client",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Official Client SDK for ObjectStack Protocol",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@objectstack/spec": "0.9.
|
|
9
|
-
"@objectstack/core": "0.9.
|
|
8
|
+
"@objectstack/spec": "0.9.2",
|
|
9
|
+
"@objectstack/core": "0.9.2"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"typescript": "^5.0.0",
|