zudello-chat-sdk 0.1.1
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 +325 -0
- package/dist/cjs/client.js +124 -0
- package/dist/cjs/client.js.map +1 -0
- package/dist/cjs/constants.js +578 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/errors.js +195 -0
- package/dist/cjs/errors.js.map +1 -0
- package/dist/cjs/http/client.js +218 -0
- package/dist/cjs/http/client.js.map +1 -0
- package/dist/cjs/index.js +80 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/modules/approvals.js +90 -0
- package/dist/cjs/modules/approvals.js.map +1 -0
- package/dist/cjs/modules/automation.js +110 -0
- package/dist/cjs/modules/automation.js.map +1 -0
- package/dist/cjs/modules/config.js +264 -0
- package/dist/cjs/modules/config.js.map +1 -0
- package/dist/cjs/modules/datasets.js +103 -0
- package/dist/cjs/modules/datasets.js.map +1 -0
- package/dist/cjs/modules/exports.js +126 -0
- package/dist/cjs/modules/exports.js.map +1 -0
- package/dist/cjs/modules/inboxes.js +99 -0
- package/dist/cjs/modules/inboxes.js.map +1 -0
- package/dist/cjs/modules/models.js +105 -0
- package/dist/cjs/modules/models.js.map +1 -0
- package/dist/cjs/modules/org.js +335 -0
- package/dist/cjs/modules/org.js.map +1 -0
- package/dist/cjs/modules/quick-actions.js +71 -0
- package/dist/cjs/modules/quick-actions.js.map +1 -0
- package/dist/cjs/modules/resources.js +236 -0
- package/dist/cjs/modules/resources.js.map +1 -0
- package/dist/cjs/modules/search.js +188 -0
- package/dist/cjs/modules/search.js.map +1 -0
- package/dist/cjs/modules/sentences.js +155 -0
- package/dist/cjs/modules/sentences.js.map +1 -0
- package/dist/cjs/modules/users.js +120 -0
- package/dist/cjs/modules/users.js.map +1 -0
- package/dist/cjs/types.js +8 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/client.js +120 -0
- package/dist/esm/client.js.map +1 -0
- package/dist/esm/constants.js +565 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/errors.js +183 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/http/client.js +214 -0
- package/dist/esm/http/client.js.map +1 -0
- package/dist/esm/index.js +49 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/modules/approvals.js +86 -0
- package/dist/esm/modules/approvals.js.map +1 -0
- package/dist/esm/modules/automation.js +106 -0
- package/dist/esm/modules/automation.js.map +1 -0
- package/dist/esm/modules/config.js +260 -0
- package/dist/esm/modules/config.js.map +1 -0
- package/dist/esm/modules/datasets.js +99 -0
- package/dist/esm/modules/datasets.js.map +1 -0
- package/dist/esm/modules/exports.js +122 -0
- package/dist/esm/modules/exports.js.map +1 -0
- package/dist/esm/modules/inboxes.js +95 -0
- package/dist/esm/modules/inboxes.js.map +1 -0
- package/dist/esm/modules/models.js +101 -0
- package/dist/esm/modules/models.js.map +1 -0
- package/dist/esm/modules/org.js +331 -0
- package/dist/esm/modules/org.js.map +1 -0
- package/dist/esm/modules/quick-actions.js +67 -0
- package/dist/esm/modules/quick-actions.js.map +1 -0
- package/dist/esm/modules/resources.js +232 -0
- package/dist/esm/modules/resources.js.map +1 -0
- package/dist/esm/modules/search.js +184 -0
- package/dist/esm/modules/search.js.map +1 -0
- package/dist/esm/modules/sentences.js +151 -0
- package/dist/esm/modules/sentences.js.map +1 -0
- package/dist/esm/modules/users.js +116 -0
- package/dist/esm/modules/users.js.map +1 -0
- package/dist/esm/types.js +7 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/types/client.d.ts +105 -0
- package/dist/types/client.d.ts.map +1 -0
- package/dist/types/constants.d.ts +505 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/errors.d.ts +143 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/http/client.d.ts +42 -0
- package/dist/types/http/client.d.ts.map +1 -0
- package/dist/types/index.d.ts +37 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/modules/approvals.d.ts +62 -0
- package/dist/types/modules/approvals.d.ts.map +1 -0
- package/dist/types/modules/automation.d.ts +79 -0
- package/dist/types/modules/automation.d.ts.map +1 -0
- package/dist/types/modules/config.d.ts +173 -0
- package/dist/types/modules/config.d.ts.map +1 -0
- package/dist/types/modules/datasets.d.ts +55 -0
- package/dist/types/modules/datasets.d.ts.map +1 -0
- package/dist/types/modules/exports.d.ts +76 -0
- package/dist/types/modules/exports.d.ts.map +1 -0
- package/dist/types/modules/inboxes.d.ts +91 -0
- package/dist/types/modules/inboxes.d.ts.map +1 -0
- package/dist/types/modules/models.d.ts +91 -0
- package/dist/types/modules/models.d.ts.map +1 -0
- package/dist/types/modules/org.d.ts +122 -0
- package/dist/types/modules/org.d.ts.map +1 -0
- package/dist/types/modules/quick-actions.d.ts +58 -0
- package/dist/types/modules/quick-actions.d.ts.map +1 -0
- package/dist/types/modules/resources.d.ts +111 -0
- package/dist/types/modules/resources.d.ts.map +1 -0
- package/dist/types/modules/search.d.ts +72 -0
- package/dist/types/modules/search.d.ts.map +1 -0
- package/dist/types/modules/sentences.d.ts +105 -0
- package/dist/types/modules/sentences.d.ts.map +1 -0
- package/dist/types/modules/users.d.ts +65 -0
- package/dist/types/modules/users.d.ts.map +1 -0
- package/dist/types/types.d.ts +2056 -0
- package/dist/types/types.d.ts.map +1 -0
- package/package.json +67 -0
package/README.md
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
# zudello-chat-sdk
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for the Zudello API, designed for AI agent code execution in E2B sandboxes.
|
|
4
|
+
|
|
5
|
+
## Setup Instructions
|
|
6
|
+
|
|
7
|
+
Follow these steps to publish the SDK and rebuild the E2B template.
|
|
8
|
+
|
|
9
|
+
**Prerequisites:**
|
|
10
|
+
- Node.js 20+
|
|
11
|
+
- npm account (for publishing)
|
|
12
|
+
- E2B account and API key
|
|
13
|
+
|
|
14
|
+
### 1. Build the SDK
|
|
15
|
+
|
|
16
|
+
From this directory (`zudello-sdk`):
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install
|
|
20
|
+
npm run build
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Verify the build completed successfully (check `dist/` folder).
|
|
24
|
+
|
|
25
|
+
### 2. Publish to npm
|
|
26
|
+
|
|
27
|
+
Make sure you're logged into npm:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm login
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Bump version and publish:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# For patch version bump (0.1.0 -> 0.1.1)
|
|
37
|
+
npm version patch
|
|
38
|
+
|
|
39
|
+
# Or for minor version bump (0.1.0 -> 0.2.0)
|
|
40
|
+
npm version minor
|
|
41
|
+
|
|
42
|
+
# Publish to npm
|
|
43
|
+
npm publish
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 3. Rebuild the E2B Template
|
|
47
|
+
|
|
48
|
+
The E2B template needs to be rebuilt to include the latest SDK version:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Navigate to the E2B template directory (sibling to this repo)
|
|
52
|
+
cd ../e2b-zudello-template
|
|
53
|
+
|
|
54
|
+
# Install E2B CLI if not already installed
|
|
55
|
+
npm install -g @e2b/cli
|
|
56
|
+
|
|
57
|
+
# Login to E2B (if not already)
|
|
58
|
+
e2b auth login
|
|
59
|
+
|
|
60
|
+
# Build the template (this takes a few minutes)
|
|
61
|
+
e2b template build
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Note the template ID after building (should be `zudello-chat-sandbox`).
|
|
65
|
+
|
|
66
|
+
### 4. Verify E2B Template
|
|
67
|
+
|
|
68
|
+
Check your E2B dashboard or run:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
e2b template list
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
You should see `zudello-chat-sandbox` with an updated timestamp.
|
|
75
|
+
|
|
76
|
+
### 5. Update inapp-chat (if needed)
|
|
77
|
+
|
|
78
|
+
If the template ID changed, update it in:
|
|
79
|
+
- `../inapp-chat/src/lib/services/code-execution.ts`
|
|
80
|
+
|
|
81
|
+
Look for `ZUDELLO_TEMPLATE_ID` or similar constant.
|
|
82
|
+
|
|
83
|
+
### 6. Test the Integration
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
cd ../inapp-chat
|
|
87
|
+
npm run dev
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Then test with the Zudello agent by asking it to execute TypeScript code that uses the SDK.
|
|
91
|
+
|
|
92
|
+
**Example test prompt:**
|
|
93
|
+
> "Use code execution to list all pending invoices and their totals"
|
|
94
|
+
|
|
95
|
+
### Troubleshooting
|
|
96
|
+
|
|
97
|
+
**Build errors:**
|
|
98
|
+
- Run `npm run typecheck` to see type errors
|
|
99
|
+
- Check `tsconfig.json` paths
|
|
100
|
+
|
|
101
|
+
**npm publish fails:**
|
|
102
|
+
- Ensure you're logged in: `npm whoami`
|
|
103
|
+
- Check package name isn't taken
|
|
104
|
+
- Verify version was bumped
|
|
105
|
+
|
|
106
|
+
**E2B template build fails:**
|
|
107
|
+
- Check E2B API key is set: `e2b auth status`
|
|
108
|
+
- Review `e2b.Dockerfile` for errors
|
|
109
|
+
- Check E2B logs: `e2b template logs <template-id>`
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Installation
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
npm install zudello-chat-sdk
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Quick Start
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
import { ZudelloClient, MODELS, MODULES, SUBMODULES } from 'zudello-chat-sdk';
|
|
123
|
+
|
|
124
|
+
// Zero-config: reads from environment variables
|
|
125
|
+
const client = new ZudelloClient();
|
|
126
|
+
|
|
127
|
+
// Search for pending invoices
|
|
128
|
+
const invoices = await client.search.query({
|
|
129
|
+
model: MODELS.Transaction,
|
|
130
|
+
module: MODULES.PURCHASING,
|
|
131
|
+
submodule: SUBMODULES.INVOICE,
|
|
132
|
+
filter: { status: 'REVIEW', total__gt: 1000 },
|
|
133
|
+
select: ['uuid', 'document_number', 'total', 'status']
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
console.log(`Found ${invoices.metadata?.count} invoices`);
|
|
137
|
+
for (const invoice of invoices.data ?? []) {
|
|
138
|
+
console.log(`${invoice.document_number}: $${invoice.total}`);
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Environment Variables
|
|
143
|
+
|
|
144
|
+
The SDK reads configuration from environment variables by default:
|
|
145
|
+
|
|
146
|
+
| Variable | Required | Description |
|
|
147
|
+
|----------|----------|-------------|
|
|
148
|
+
| `ZUDELLO_TOKEN` | Yes | Authentication token |
|
|
149
|
+
| `ZUDELLO_ORG_ID` | Yes | Organization UUID |
|
|
150
|
+
| `ZUDELLO_TEAM_ID` | Yes | Team UUID |
|
|
151
|
+
| `ZUDELLO_CLUSTER_URL` | Yes | API cluster URL (e.g., `api.1.global.zudello.io`) |
|
|
152
|
+
| `ZUDELLO_AUTH_API_BASE` | Yes | Auth API base URL |
|
|
153
|
+
| `ZUDELLO_USER_ID` | No | User UUID |
|
|
154
|
+
| `ZUDELLO_USER_EMAIL` | No | User email |
|
|
155
|
+
|
|
156
|
+
## Core Operations
|
|
157
|
+
|
|
158
|
+
### Search
|
|
159
|
+
|
|
160
|
+
Search for resources with filtering and pagination:
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
const invoices = await client.search.query({
|
|
164
|
+
model: 'Transaction',
|
|
165
|
+
module: 'PURCHASING',
|
|
166
|
+
submodule: 'INVOICE',
|
|
167
|
+
filter: {
|
|
168
|
+
status__in: ['REVIEW', 'APPROVAL'],
|
|
169
|
+
total__gt: 1000,
|
|
170
|
+
supplier__trading_name__icontains: 'acme'
|
|
171
|
+
},
|
|
172
|
+
select: ['uuid', 'document_number', 'total', 'date_due'],
|
|
173
|
+
order_by: ['-total', 'date_due'],
|
|
174
|
+
limit: 50
|
|
175
|
+
});
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Auto-Pagination with Async Iterators
|
|
179
|
+
|
|
180
|
+
Iterate over all matching records automatically:
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
let totalValue = 0;
|
|
184
|
+
|
|
185
|
+
for await (const invoice of client.search.list({
|
|
186
|
+
model: 'Transaction',
|
|
187
|
+
module: 'PURCHASING',
|
|
188
|
+
submodule: 'INVOICE',
|
|
189
|
+
filter: { status: 'APPROVAL' },
|
|
190
|
+
select: ['uuid', 'document_number', 'total', 'status']
|
|
191
|
+
})) {
|
|
192
|
+
totalValue += invoice.total;
|
|
193
|
+
console.log(`${invoice.document_number}: $${invoice.total}`);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
console.log(`Total pending approval: $${totalValue}`);
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Fetch Single Resource
|
|
200
|
+
|
|
201
|
+
```typescript
|
|
202
|
+
const supplier = await client.search.fetch('Supplier', { uuid: 'supplier-uuid-123' });
|
|
203
|
+
console.log(supplier.data?.trading_name);
|
|
204
|
+
|
|
205
|
+
// With related data
|
|
206
|
+
const invoice = await client.search.fetch('Transaction', { uuid: 'invoice-uuid' }, {
|
|
207
|
+
includeModels: 'supplier,lines,attachments'
|
|
208
|
+
});
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Create Resource
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
const newPO = await client.resources.create({
|
|
215
|
+
model: 'Transaction',
|
|
216
|
+
module: 'PURCHASING',
|
|
217
|
+
submodule: 'ORDER',
|
|
218
|
+
data: {
|
|
219
|
+
supplier: 'supplier-uuid',
|
|
220
|
+
lines: [
|
|
221
|
+
{ description: 'Item 1', quantity: 10, unit_price: 99.99 }
|
|
222
|
+
]
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Update Resource
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
const updated = await client.resources.update({
|
|
231
|
+
model: 'Transaction',
|
|
232
|
+
uuid: 'invoice-uuid',
|
|
233
|
+
data: { status: 'READY' }
|
|
234
|
+
});
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Filter Operators
|
|
238
|
+
|
|
239
|
+
Append these suffixes to field names:
|
|
240
|
+
|
|
241
|
+
- `__in` - Value in list: `status__in: ['REVIEW', 'APPROVAL']`
|
|
242
|
+
- `__gt`, `__gte` - Greater than (or equal): `total__gt: 1000`
|
|
243
|
+
- `__lt`, `__lte` - Less than (or equal): `total__lt: 5000`
|
|
244
|
+
- `__range` - Value in range: `total__range: [1000, 5000]`
|
|
245
|
+
- `__icontains` - Case-insensitive contains: `trading_name__icontains: 'acme'`
|
|
246
|
+
- `__startswith` - Starts with: `document_number__startswith: 'INV'`
|
|
247
|
+
- `__isnull` - Is null check: `supplier__isnull: false`
|
|
248
|
+
|
|
249
|
+
## Error Handling
|
|
250
|
+
|
|
251
|
+
```typescript
|
|
252
|
+
import {
|
|
253
|
+
ZudelloClient,
|
|
254
|
+
ZudelloAuthenticationError,
|
|
255
|
+
ZudelloValidationError,
|
|
256
|
+
ZudelloAPIError
|
|
257
|
+
} from 'zudello-chat-sdk';
|
|
258
|
+
|
|
259
|
+
try {
|
|
260
|
+
const result = await client.search.query({ model: 'Transaction' });
|
|
261
|
+
} catch (error) {
|
|
262
|
+
if (error instanceof ZudelloAuthenticationError) {
|
|
263
|
+
console.log('Token expired or invalid');
|
|
264
|
+
} else if (error instanceof ZudelloValidationError) {
|
|
265
|
+
console.log('Invalid request:', error.message);
|
|
266
|
+
} else if (error instanceof ZudelloAPIError) {
|
|
267
|
+
console.log(`API error ${error.statusCode}:`, error.message);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## Model Introspection
|
|
273
|
+
|
|
274
|
+
```typescript
|
|
275
|
+
// List all available models
|
|
276
|
+
const models = await client.models.list();
|
|
277
|
+
|
|
278
|
+
// Get schema for a model
|
|
279
|
+
const schema = await client.models.getSchema('Transaction');
|
|
280
|
+
console.log('Fields:', Object.keys(schema.fields ?? {}));
|
|
281
|
+
|
|
282
|
+
// Get field metadata
|
|
283
|
+
const fields = await client.models.getFieldMetadata({
|
|
284
|
+
module: 'PURCHASING',
|
|
285
|
+
submodule: 'INVOICE',
|
|
286
|
+
section: 'filters'
|
|
287
|
+
});
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## Type-Safe Constants
|
|
291
|
+
|
|
292
|
+
Use exported constants for type safety:
|
|
293
|
+
|
|
294
|
+
```typescript
|
|
295
|
+
import { MODELS, MODULES, SUBMODULES, STATUS_KEYS } from 'zudello-chat-sdk';
|
|
296
|
+
|
|
297
|
+
const invoices = await client.search.query({
|
|
298
|
+
model: MODELS.Transaction,
|
|
299
|
+
module: MODULES.PURCHASING,
|
|
300
|
+
submodule: SUBMODULES.INVOICE,
|
|
301
|
+
filter: { status: STATUS_KEYS.REVIEW }
|
|
302
|
+
});
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## E2B Sandbox Usage
|
|
306
|
+
|
|
307
|
+
This SDK is designed for use in E2B sandboxes. Environment variables are automatically injected:
|
|
308
|
+
|
|
309
|
+
```typescript
|
|
310
|
+
// In E2B sandbox - just create the client
|
|
311
|
+
import { ZudelloClient } from 'zudello-chat-sdk';
|
|
312
|
+
|
|
313
|
+
const client = new ZudelloClient(); // Auto-configured from env vars
|
|
314
|
+
|
|
315
|
+
// All Zudello operations now available
|
|
316
|
+
const invoices = await client.search.query({
|
|
317
|
+
model: 'Transaction',
|
|
318
|
+
module: 'PURCHASING',
|
|
319
|
+
submodule: 'INVOICE'
|
|
320
|
+
});
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
## License
|
|
324
|
+
|
|
325
|
+
MIT
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Zudello SDK Client
|
|
4
|
+
*
|
|
5
|
+
* Main client class for interacting with the Zudello API.
|
|
6
|
+
* Designed for use in E2B sandboxes with environment variable configuration.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* import { ZudelloClient } from 'zudello-chat-sdk';
|
|
10
|
+
*
|
|
11
|
+
* // Zero-config: reads from environment variables
|
|
12
|
+
* const client = new ZudelloClient();
|
|
13
|
+
*
|
|
14
|
+
* // Search for pending invoices
|
|
15
|
+
* const invoices = await client.search.query({
|
|
16
|
+
* model: 'Transaction',
|
|
17
|
+
* module: 'PURCHASING',
|
|
18
|
+
* submodule: 'INVOICE',
|
|
19
|
+
* filter: { status: 'REVIEW' }
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* // Auto-pagination with async iterators
|
|
23
|
+
* for await (const invoice of client.search.list({ model: 'Transaction', module: 'PURCHASING' })) {
|
|
24
|
+
* console.log(invoice.document_number);
|
|
25
|
+
* }
|
|
26
|
+
*
|
|
27
|
+
* // Create resources
|
|
28
|
+
* await client.resources.create({
|
|
29
|
+
* model: 'Supplier',
|
|
30
|
+
* data: { trading_name: 'ACME Corp', code: 'SUP-001' }
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* // Organisation-level admin (requires privileges)
|
|
34
|
+
* const users = await client.org.listUsers();
|
|
35
|
+
*/
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.ZudelloClient = void 0;
|
|
38
|
+
const client_1 = require("./http/client");
|
|
39
|
+
const search_1 = require("./modules/search");
|
|
40
|
+
const resources_1 = require("./modules/resources");
|
|
41
|
+
const models_1 = require("./modules/models");
|
|
42
|
+
const config_1 = require("./modules/config");
|
|
43
|
+
const sentences_1 = require("./modules/sentences");
|
|
44
|
+
const automation_1 = require("./modules/automation");
|
|
45
|
+
const approvals_1 = require("./modules/approvals");
|
|
46
|
+
const users_1 = require("./modules/users");
|
|
47
|
+
const org_1 = require("./modules/org");
|
|
48
|
+
const datasets_1 = require("./modules/datasets");
|
|
49
|
+
const exports_1 = require("./modules/exports");
|
|
50
|
+
const quick_actions_1 = require("./modules/quick-actions");
|
|
51
|
+
const inboxes_1 = require("./modules/inboxes");
|
|
52
|
+
/**
|
|
53
|
+
* Main client for the Zudello API.
|
|
54
|
+
*
|
|
55
|
+
* Configuration is read from environment variables by default:
|
|
56
|
+
* - `ZUDELLO_TOKEN`: Authentication token (required)
|
|
57
|
+
* - `ZUDELLO_ORG_ID`: Organization UUID (required)
|
|
58
|
+
* - `ZUDELLO_TEAM_ID`: Team UUID (required)
|
|
59
|
+
* - `ZUDELLO_CLUSTER_URL`: API cluster URL (required)
|
|
60
|
+
* - `ZUDELLO_AUTH_API_BASE`: Auth API base URL (required)
|
|
61
|
+
* - `ZUDELLO_USER_ID`: User UUID (optional)
|
|
62
|
+
* - `ZUDELLO_USER_EMAIL`: User email (optional)
|
|
63
|
+
*
|
|
64
|
+
* @throws {ZudelloConfigurationError} If required configuration is missing
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* // Auto-configured from environment
|
|
68
|
+
* const client = new ZudelloClient();
|
|
69
|
+
*
|
|
70
|
+
* // Or explicit configuration
|
|
71
|
+
* const client = new ZudelloClient({
|
|
72
|
+
* token: 'your-token',
|
|
73
|
+
* organizationId: 'org-uuid',
|
|
74
|
+
* teamId: 'team-uuid',
|
|
75
|
+
* clusterUrl: 'api.1.global.zudello.io',
|
|
76
|
+
* authApiBase: 'https://auth.zudello.io'
|
|
77
|
+
* });
|
|
78
|
+
*/
|
|
79
|
+
class ZudelloClient {
|
|
80
|
+
/** Search and fetch operations */
|
|
81
|
+
search;
|
|
82
|
+
/** Resource CRUD and batch operations */
|
|
83
|
+
resources;
|
|
84
|
+
/** Model introspection */
|
|
85
|
+
models;
|
|
86
|
+
/** Configuration, field settings, statuses, document types */
|
|
87
|
+
config;
|
|
88
|
+
/** Sentences (automation rules) */
|
|
89
|
+
sentences;
|
|
90
|
+
/** Scripts, triggers, and execution logs */
|
|
91
|
+
automation;
|
|
92
|
+
/** Approval workflows and bulk operations */
|
|
93
|
+
approvals;
|
|
94
|
+
/** Team users, notifications, language settings */
|
|
95
|
+
users;
|
|
96
|
+
/** Organisation-level admin (requires privileges) */
|
|
97
|
+
org;
|
|
98
|
+
/** Datasets (lookup tables, DOAs) */
|
|
99
|
+
datasets;
|
|
100
|
+
/** Export templates and data exports */
|
|
101
|
+
exports;
|
|
102
|
+
/** Quick actions */
|
|
103
|
+
quickActions;
|
|
104
|
+
/** Inboxes, budgets, contracts, messages */
|
|
105
|
+
inboxes;
|
|
106
|
+
constructor(config) {
|
|
107
|
+
const http = new client_1.HttpClient(config);
|
|
108
|
+
this.search = new search_1.SearchModule(http);
|
|
109
|
+
this.resources = new resources_1.ResourcesModule(http);
|
|
110
|
+
this.models = new models_1.ModelsModule(http);
|
|
111
|
+
this.config = new config_1.ConfigModule(http);
|
|
112
|
+
this.sentences = new sentences_1.SentencesModule(http);
|
|
113
|
+
this.automation = new automation_1.AutomationModule(http);
|
|
114
|
+
this.approvals = new approvals_1.ApprovalsModule(http);
|
|
115
|
+
this.users = new users_1.UsersModule(http);
|
|
116
|
+
this.org = new org_1.OrgModule(http);
|
|
117
|
+
this.datasets = new datasets_1.DatasetsModule(http);
|
|
118
|
+
this.exports = new exports_1.ExportsModule(http);
|
|
119
|
+
this.quickActions = new quick_actions_1.QuickActionsModule(http);
|
|
120
|
+
this.inboxes = new inboxes_1.InboxesModule(http);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
exports.ZudelloClient = ZudelloClient;
|
|
124
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;;;AAEH,0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