@kadoa/node-sdk 0.15.0 → 0.16.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 +81 -0
- package/dist/browser/index.global.js +17 -17
- package/dist/browser/index.global.js.map +1 -1
- package/dist/index.d.mts +709 -829
- package/dist/index.d.ts +709 -829
- package/dist/index.js +831 -919
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +834 -923
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -137,6 +137,59 @@ Reuse a previously defined schema:
|
|
|
137
137
|
extraction: builder => builder.useSchema('schema-id-123')
|
|
138
138
|
```
|
|
139
139
|
|
|
140
|
+
### Real-time Monitoring
|
|
141
|
+
|
|
142
|
+
Monitor websites continuously and receive live updates when data changes.
|
|
143
|
+
|
|
144
|
+
**Setup:**
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
// Enable real-time with team API key
|
|
148
|
+
const client = new KadoaClient({
|
|
149
|
+
apiKey: 'tk-your-team-api-key',
|
|
150
|
+
enableRealtime: true
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
// Verify connection
|
|
154
|
+
if (client.isRealtimeConnected()) {
|
|
155
|
+
console.log('Connected to real-time updates');
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**Create a monitor:**
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
const monitor = await client
|
|
163
|
+
.extract({
|
|
164
|
+
urls: ['https://example.com/products'],
|
|
165
|
+
name: 'Price Monitor',
|
|
166
|
+
extraction: schema =>
|
|
167
|
+
schema
|
|
168
|
+
.entity('Product')
|
|
169
|
+
.field('name', 'Product name', 'STRING')
|
|
170
|
+
.field('price', 'Current price', 'MONEY'),
|
|
171
|
+
})
|
|
172
|
+
.setInterval({ interval: 'REAL_TIME' })
|
|
173
|
+
.create();
|
|
174
|
+
|
|
175
|
+
// Wait for monitor to start
|
|
176
|
+
await monitor.waitForReady();
|
|
177
|
+
|
|
178
|
+
// Handle updates
|
|
179
|
+
client.realtime?.onEvent((event) => {
|
|
180
|
+
if (event.workflowId === monitor.workflowId) {
|
|
181
|
+
console.log('Update:', event.data);
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**Requirements:**
|
|
187
|
+
- Team API key (starts with `tk-`)
|
|
188
|
+
- `enableRealtime: true` in client configuration
|
|
189
|
+
- Notifications enabled for at least one channel ( Webhook, Email, or Slack)
|
|
190
|
+
|
|
191
|
+
**When to use:** Price tracking, inventory monitoring, live content updates.
|
|
192
|
+
|
|
140
193
|
### Working with Results
|
|
141
194
|
|
|
142
195
|
**Fetch Specific Page**
|
|
@@ -341,6 +394,34 @@ See the [examples directory](https://github.com/kadoa-org/kadoa-sdks/tree/main/e
|
|
|
341
394
|
- Integration patterns
|
|
342
395
|
- Advanced validation workflows
|
|
343
396
|
|
|
397
|
+
## Workflow Management
|
|
398
|
+
|
|
399
|
+
Use the workflows domain to inspect or modify existing workflows without leaving your application.
|
|
400
|
+
|
|
401
|
+
### Update Workflow Metadata
|
|
402
|
+
|
|
403
|
+
Wraps `PUT /v4/workflows/{workflowId}/metadata` so you can adjust limits, schedules, tags, schema, monitoring, etc.
|
|
404
|
+
|
|
405
|
+
```typescript
|
|
406
|
+
const result = await client.workflow.update("workflow-id", {
|
|
407
|
+
limit: 1000,
|
|
408
|
+
monitoring: { enabled: true },
|
|
409
|
+
tags: ["weekly-report"],
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
console.log(result);
|
|
413
|
+
// { success: true, message: "Workflow metadata updated successfully" }
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### Delete a Workflow
|
|
417
|
+
|
|
418
|
+
```typescript
|
|
419
|
+
await client.workflow.delete("workflow-id");
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
> [!NOTE]
|
|
423
|
+
> `client.workflow.cancel(id)` still calls the delete endpoint for backward compatibility, but it now logs a deprecation warning. Use `client.workflow.delete(id)` going forward.
|
|
424
|
+
|
|
344
425
|
## Requirements
|
|
345
426
|
|
|
346
427
|
- Node.js 22+
|