@nvisy/sdk 0.1.0 → 0.2.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/CHANGELOG.md +23 -4
- package/LICENSE.txt +1 -1
- package/README.md +20 -61
- package/dist/client-D6GtLRbO.d.ts +823 -0
- package/dist/datatypes/index.d.ts +8 -0
- package/dist/datatypes/index.js +3 -0
- package/dist/datatypes/index.js.map +1 -0
- package/dist/index.d.ts +254 -2
- package/dist/index.js +1244 -361
- package/dist/index.js.map +1 -1
- package/dist/services/index.d.ts +3 -0
- package/dist/services/index.js +956 -0
- package/dist/services/index.js.map +1 -0
- package/dist/workspace-3RLqaMcj.d.ts +7055 -0
- package/package.json +33 -33
- package/dist/builder-BEUIGfoZ.d.ts +0 -138
- package/dist/builder.d.ts +0 -2
- package/dist/builder.js +0 -424
- package/dist/builder.js.map +0 -1
- package/dist/client.d.ts +0 -2
- package/dist/client.js +0 -424
- package/dist/client.js.map +0 -1
- package/dist/errors.d.ts +0 -124
- package/dist/errors.js +0 -201
- package/dist/errors.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,20 +8,38 @@ and this project adheres to
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [0.2.0] - Unreleased
|
|
12
|
+
|
|
11
13
|
### Added
|
|
12
14
|
|
|
15
|
+
- Generated OpenAPI schema types for type-safe API calls
|
|
16
|
+
- `Client.withApiToken()` method to create a new client with a different token
|
|
17
|
+
- Error middleware for automatic API error handling
|
|
18
|
+
- Full API coverage with services for all endpoints
|
|
19
|
+
- Comprehensive JSDoc documentation for all public APIs
|
|
20
|
+
|
|
13
21
|
### Changed
|
|
14
22
|
|
|
15
|
-
|
|
23
|
+
- Client now requires `apiToken` in configuration
|
|
24
|
+
- Refactored all services to use `openapi-fetch` for type-safe API calls
|
|
25
|
+
- Improved error handling with `ApiError`
|
|
26
|
+
- Services now throw `ApiError` automatically via middleware
|
|
27
|
+
- Datatypes now re-export schema types with convenient aliases
|
|
28
|
+
- Services are created on-demand via Client getters
|
|
16
29
|
|
|
17
30
|
### Removed
|
|
18
31
|
|
|
32
|
+
- `ClientBuilder` class and `Client.builder()` method
|
|
33
|
+
- `Client.fromEnvironment()` method
|
|
34
|
+
- Environment variable support (`NVISY_API_TOKEN`, `NVISY_BASE_URL`, `NVISY_USER_AGENT`)
|
|
35
|
+
- Manual type definitions in datatypes (now use schema re-exports)
|
|
36
|
+
|
|
19
37
|
## [0.1.0] - 2025-10-15
|
|
20
38
|
|
|
21
39
|
### Added
|
|
22
40
|
|
|
23
41
|
- Initial release of the Nvisy SDK
|
|
24
|
-
- `Client` class for interacting with the Nvisy document
|
|
42
|
+
- `Client` class for interacting with the Nvisy document processing API
|
|
25
43
|
- `ClientBuilder` class for fluent configuration building
|
|
26
44
|
- Comprehensive error handling with `ClientError` and other error classes
|
|
27
45
|
- Configuration management with environment variable support
|
|
@@ -45,5 +63,6 @@ and this project adheres to
|
|
|
45
63
|
- Network error handling for timeouts, DNS resolution, and connection issues
|
|
46
64
|
- Configuration validation with detailed error messages
|
|
47
65
|
|
|
48
|
-
[Unreleased]: https://github.com/nvisycom/sdk/compare/v0.
|
|
49
|
-
[0.
|
|
66
|
+
[Unreleased]: https://github.com/nvisycom/sdk-ts/compare/v0.2.0...HEAD
|
|
67
|
+
[0.2.0]: https://github.com/nvisycom/sdk-ts/compare/v0.1.0...v0.2.0
|
|
68
|
+
[0.1.0]: https://github.com/nvisycom/sdk-ts/releases/tag/v0.1.0
|
package/LICENSE.txt
CHANGED
package/README.md
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Nvisy.com SDK for TypeScript/JavaScript
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@nvisy/sdk)
|
|
4
|
-
[](https://github.com/nvisycom/sdk/actions/workflows/build.yml)
|
|
5
|
-
[](https://nodejs.org/)
|
|
6
|
-
[](https://www.typescriptlang.org/)
|
|
4
|
+
[](https://github.com/nvisycom/sdk-ts/actions/workflows/build.yml)
|
|
7
5
|
|
|
8
|
-
Official
|
|
6
|
+
Official TypeScript SDK for the Nvisy AI-powered document processing platform. Transform documents into usable data and apply intelligent edits with ease.
|
|
9
7
|
|
|
10
8
|
## Features
|
|
11
9
|
|
|
12
|
-
- Modern ES2022+ JavaScript
|
|
10
|
+
- Modern ES2022+ JavaScript target
|
|
13
11
|
- Full TypeScript support with strict typing
|
|
14
|
-
- Flexible configuration with constructor or builder pattern
|
|
15
12
|
- Built-in environment variable support
|
|
16
|
-
- Automatic retry logic with smart error handling
|
|
17
13
|
- Individual module exports for optimal bundling
|
|
18
14
|
|
|
19
15
|
## Installation
|
|
@@ -24,71 +20,34 @@ npm install @nvisy/sdk
|
|
|
24
20
|
|
|
25
21
|
## Usage
|
|
26
22
|
|
|
27
|
-
###
|
|
23
|
+
### Basic Usage
|
|
28
24
|
|
|
29
|
-
Create a client
|
|
25
|
+
Create a client with your API token:
|
|
30
26
|
|
|
31
27
|
```typescript
|
|
32
28
|
import { Client } from "@nvisy/sdk";
|
|
33
29
|
|
|
34
|
-
const client = new Client({
|
|
35
|
-
apiKey: "your-api-key", // Required: 10+ chars, alphanumeric with _ and -
|
|
36
|
-
baseUrl: "https://api.nvisy.com", // Optional: API endpoint (default shown)
|
|
37
|
-
timeout: 30000, // Optional: 1000-300000ms (default: 30000)
|
|
38
|
-
maxRetries: 3, // Optional: 0-5 attempts (default: 3)
|
|
39
|
-
headers: { // Optional: custom headers
|
|
40
|
-
"X-Custom-Header": "value",
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
```
|
|
30
|
+
const client = new Client({ apiToken: "your-api-token" });
|
|
44
31
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
Use the fluent builder API for more readable configuration:
|
|
48
|
-
|
|
49
|
-
```typescript
|
|
50
|
-
import { Client } from "@nvisy/sdk";
|
|
51
|
-
|
|
52
|
-
const client = Client.builder()
|
|
53
|
-
.withApiKey("your-api-key") // Required: 10+ chars, alphanumeric with _ and -
|
|
54
|
-
.withBaseUrl("https://api.nvisy.com") // Optional: API endpoint (default shown)
|
|
55
|
-
.withTimeout(60000) // Optional: 1000-300000ms (default: 30000)
|
|
56
|
-
.withMaxRetries(5) // Optional: 0-5 attempts (default: 3)
|
|
57
|
-
.withHeader("X-Custom-Header", "value") // Optional: single custom header
|
|
58
|
-
.withHeaders({ "X-Another": "header" }) // Optional: multiple custom headers
|
|
59
|
-
.build();
|
|
32
|
+
const account = await client.account.get();
|
|
33
|
+
const projects = await client.projects.list();
|
|
60
34
|
```
|
|
61
35
|
|
|
62
|
-
###
|
|
63
|
-
|
|
64
|
-
Load configuration from environment variables:
|
|
36
|
+
### Configuration Options
|
|
65
37
|
|
|
66
38
|
```typescript
|
|
67
|
-
import { Client
|
|
68
|
-
|
|
69
|
-
// Using builder pattern from environment (allows additional configuration)
|
|
70
|
-
const client = ClientBuilder.fromEnvironment()
|
|
71
|
-
.withTimeout(60000) // Override or add to env config
|
|
72
|
-
.build();
|
|
39
|
+
import { Client } from "@nvisy/sdk";
|
|
73
40
|
|
|
74
|
-
|
|
75
|
-
|
|
41
|
+
const client = new Client({
|
|
42
|
+
apiToken: "your-api-token", // Required
|
|
43
|
+
baseUrl: "https://api.nvisy.com", // Optional: API endpoint (default shown)
|
|
44
|
+
userAgent: "MyApp/1.0.0", // Optional: custom user agent
|
|
45
|
+
headers: { // Optional: custom headers
|
|
46
|
+
"X-Custom-Header": "value",
|
|
47
|
+
},
|
|
48
|
+
});
|
|
76
49
|
```
|
|
77
50
|
|
|
78
|
-
Set these environment variables:
|
|
79
|
-
|
|
80
|
-
| Variable | Description | Required |
|
|
81
|
-
| ------------------- | -------------------------------- | -------- |
|
|
82
|
-
| `NVISY_API_KEY` | API key for authentication | Yes |
|
|
83
|
-
| `NVISY_BASE_URL` | Custom API endpoint URL | No |
|
|
84
|
-
| `NVISY_TIMEOUT` | Request timeout in milliseconds | No |
|
|
85
|
-
| `NVISY_MAX_RETRIES` | Maximum number of retry attempts | No |
|
|
86
|
-
|
|
87
|
-
## Requirements
|
|
88
|
-
|
|
89
|
-
- Node.js 20.0.0 or higher
|
|
90
|
-
- TypeScript 5.9.0 or higher (for development)
|
|
91
|
-
|
|
92
51
|
## Changelog
|
|
93
52
|
|
|
94
53
|
See [CHANGELOG.md](CHANGELOG.md) for release notes and version history.
|
|
@@ -104,5 +63,5 @@ MIT License - see [LICENSE.txt](LICENSE.txt) for details.
|
|
|
104
63
|
## Support
|
|
105
64
|
|
|
106
65
|
- Documentation: [docs.nvisy.com](https://docs.nvisy.com)
|
|
107
|
-
- Issues: [GitHub Issues](https://github.com/nvisycom/sdk/issues)
|
|
66
|
+
- Issues: [GitHub Issues](https://github.com/nvisycom/sdk-ts/issues)
|
|
108
67
|
- Email: [support@nvisy.com](mailto:support@nvisy.com)
|