@kadoa/node-sdk 0.0.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/README.md +137 -0
- package/dist/index.d.mts +879 -0
- package/dist/index.d.ts +879 -0
- package/dist/index.js +2255 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2242 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Kadoa SDK for Node.js
|
|
2
|
+
|
|
3
|
+
Official Node.js/TypeScript SDK for the Kadoa API, providing easy integration with Kadoa's web data extraction platform.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @kadoa/sdk
|
|
9
|
+
# or
|
|
10
|
+
yarn add @kadoa/sdk
|
|
11
|
+
# or
|
|
12
|
+
pnpm add @kadoa/sdk
|
|
13
|
+
# or
|
|
14
|
+
bun add @kadoa/sdk
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { initializeApp, runExtraction } from '@kadoa/sdk';
|
|
21
|
+
|
|
22
|
+
// Initialize the SDK
|
|
23
|
+
const app = initializeApp({
|
|
24
|
+
apiKey: 'your-api-key',
|
|
25
|
+
baseUrl: 'https://api.kadoa.com' // optional, defaults to production
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// Run an extraction
|
|
29
|
+
const result = await runExtraction(app, {
|
|
30
|
+
urls: ['https://example.com'],
|
|
31
|
+
name: 'My Extraction Workflow'
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
if (result) {
|
|
35
|
+
console.log(`Workflow created with ID: ${result.workflowId}`);
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Configuration
|
|
40
|
+
|
|
41
|
+
The SDK can be configured using environment variables or directly in code:
|
|
42
|
+
|
|
43
|
+
### Environment Variables
|
|
44
|
+
|
|
45
|
+
Create a `.env` file:
|
|
46
|
+
```env
|
|
47
|
+
KADOA_API_KEY=your-api-key
|
|
48
|
+
KADOA_API_URL=https://api.kadoa.com
|
|
49
|
+
KADOA_TIMEOUT=30000
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Then load them in your code:
|
|
53
|
+
```typescript
|
|
54
|
+
import { initializeApp } from '@kadoa/sdk';
|
|
55
|
+
import { config } from 'dotenv';
|
|
56
|
+
|
|
57
|
+
config();
|
|
58
|
+
|
|
59
|
+
const app = initializeApp({
|
|
60
|
+
apiKey: process.env.KADOA_API_KEY!,
|
|
61
|
+
baseUrl: process.env.KADOA_API_URL || 'https://api.kadoa.com',
|
|
62
|
+
timeout: parseInt(process.env.KADOA_TIMEOUT || '30000')
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Development
|
|
67
|
+
|
|
68
|
+
### Project Structure
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
sdks/node/
|
|
72
|
+
├── src/
|
|
73
|
+
│ ├── index.ts # Public API exports
|
|
74
|
+
│ ├── app.ts # Application initialization
|
|
75
|
+
│ ├── extraction/ # Extraction module
|
|
76
|
+
│ │ ├── index.ts # Extraction logic
|
|
77
|
+
│ │ └── client.ts # API client helpers
|
|
78
|
+
│ └── generated/ # Auto-generated API client
|
|
79
|
+
├── test/
|
|
80
|
+
│ └── e2e/
|
|
81
|
+
│ └── runExtraction.test.ts
|
|
82
|
+
├── examples/
|
|
83
|
+
│ └── src/
|
|
84
|
+
│ └── run-extraction.ts
|
|
85
|
+
├── package.json
|
|
86
|
+
└── tsup.config.ts
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Running Tests
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Run all tests
|
|
93
|
+
npm test
|
|
94
|
+
|
|
95
|
+
# Run E2E tests
|
|
96
|
+
npm run test:e2e
|
|
97
|
+
|
|
98
|
+
# Run with coverage
|
|
99
|
+
npm run test:coverage
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Building
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Build the SDK
|
|
106
|
+
npm run build
|
|
107
|
+
|
|
108
|
+
# Watch mode for development
|
|
109
|
+
npm run dev
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Generating API Client
|
|
113
|
+
|
|
114
|
+
From the repository root:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
cd tools/codegen
|
|
118
|
+
bun run generate:node
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Requirements
|
|
122
|
+
|
|
123
|
+
- Node.js 18+
|
|
124
|
+
- TypeScript 5+ (for TypeScript projects)
|
|
125
|
+
|
|
126
|
+
## Dependencies
|
|
127
|
+
|
|
128
|
+
- `axios` - HTTP client
|
|
129
|
+
- Auto-generated API client code
|
|
130
|
+
|
|
131
|
+
## License
|
|
132
|
+
|
|
133
|
+
MIT
|
|
134
|
+
|
|
135
|
+
## Support
|
|
136
|
+
|
|
137
|
+
For support, please visit [Kadoa Support](https://support.kadoa.com) or contact support@kadoa.com.
|