@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 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
- ### Fixed
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 redaction API
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.1.0...HEAD
49
- [0.1.0]: https://github.com/nvisycom/sdk/releases/tag/v0.1.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
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Nvisy Redaction Software
3
+ Copyright (c) 2025 Nvisy Software
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,19 +1,15 @@
1
- # JavaScript & TypeScript SDK
1
+ # Nvisy.com SDK for TypeScript/JavaScript
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@nvisy/sdk?color=000000&style=flat-square)](https://www.npmjs.com/package/@nvisy/sdk)
4
- [![build](https://img.shields.io/github/actions/workflow/status/nvisycom/sdk/build.yml?branch=main&color=000000&style=flat-square)](https://github.com/nvisycom/sdk/actions/workflows/build.yml)
5
- [![node](https://img.shields.io/badge/node-%3E%3D20.0.0-000000?style=flat-square&logo=node.js&logoColor=white)](https://nodejs.org/)
6
- [![typescript](https://img.shields.io/badge/TypeScript-5.9+-000000?style=flat-square&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
4
+ [![build](https://img.shields.io/github/actions/workflow/status/nvisycom/sdk-ts/build.yml?branch=main&color=000000&style=flat-square)](https://github.com/nvisycom/sdk-ts/actions/workflows/build.yml)
7
5
 
8
- Official JavaScript & TypeScript SDK for the Nvisy document redaction platform.
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 with native private fields
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
- ### Direct Configuration
23
+ ### Basic Usage
28
24
 
29
- Create a client by passing configuration options directly to the constructor:
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
- ### Builder Pattern
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
- ### From Environment Variables
63
-
64
- Load configuration from environment variables:
36
+ ### Configuration Options
65
37
 
66
38
  ```typescript
67
- import { Client, ClientBuilder } from "@nvisy/sdk";
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
- // Or using Client directly
75
- const client = Client.fromEnvironment();
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)