@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
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ag as components } from '../workspace-3RLqaMcj.js';
|
|
2
|
+
export { A as Account, a as Activity, b as ActivityType, c as Annotation, e as ApiToken, g as ApiTokenType, f as ApiTokenWithSecret, u as ArchiveFormat, j as AuthToken, a6 as CheckHealth, k as Comment, r as ContentSegmentation, C as CreateAnnotation, h as CreateApiToken, l as CreateComment, n as CreateDocument, y as CreateIntegration, K as CreateInvite, a9 as CreateWebhook, ad as CreateWorkspace, D as Document, p as DocumentStatus, t as DownloadArchivedFilesRequest, s as DownloadMultipleFilesRequest, F as File, w as FileFormat, x as FileSortField, M as GenerateInviteCode, I as Integration, a3 as IntegrationRun, G as IntegrationStatus, E as IntegrationType, J as Invite, N as InviteCode, Q as InviteExpiration, W as InviteSortField, O as InviteStatus, v as ListFilesQuery, H as ListIntegrationsQuery, V as ListInvitesQuery, _ as ListMembersQuery, L as Login, Y as Member, $ as MemberSortField, a4 as MonitorStatus, a0 as Notification, a1 as NotificationType, a2 as Pagination, P as ProcessingStatus, R as ReplyInvite, a5 as ServiceStatus, S as Signup, X as SortOrder, T as TokenExpiration, U as UpdateAccount, d as UpdateAnnotation, i as UpdateApiToken, m as UpdateComment, o as UpdateDocument, q as UpdateFile, z as UpdateIntegration, B as UpdateIntegrationCredentials, Z as UpdateMemberRole, aa as UpdateWebhook, ae as UpdateWorkspace, a7 as Webhook, ab as WebhookStatus, a8 as WebhookWithSecret, ac as Workspace, af as WorkspaceRole } from '../workspace-3RLqaMcj.js';
|
|
3
|
+
|
|
4
|
+
type Schemas = components["schemas"];
|
|
5
|
+
type ErrorResponse = Schemas["ErrorResponse"];
|
|
6
|
+
type ValidationErrorDetail = Schemas["ValidationErrorDetail"];
|
|
7
|
+
|
|
8
|
+
export type { ErrorResponse, ValidationErrorDetail };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,255 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { b as AccountService, c as ActivitiesService, d as AnnotationsService, A as ApiClient, e as ApiTokensService, f as AuthService, C as Client, a as ClientConfig, g as CommentsService, D as DEFAULTS, h as DocumentsService, F as FilesService, I as IntegrationsService, i as InvitesService, M as MembersService, N as NotificationsService, R as RunsService, S as StatusService, V as VERSION, W as WebhooksService, j as WorkspacesService } from './client-D6GtLRbO.js';
|
|
2
|
+
export { A as Account, a as Activity, b as ActivityType, c as Annotation, e as ApiToken, g as ApiTokenType, f as ApiTokenWithSecret, u as ArchiveFormat, j as AuthToken, a6 as CheckHealth, k as Comment, r as ContentSegmentation, C as CreateAnnotation, h as CreateApiToken, l as CreateComment, n as CreateDocument, y as CreateIntegration, K as CreateInvite, a9 as CreateWebhook, ad as CreateWorkspace, D as Document, p as DocumentStatus, t as DownloadArchivedFilesRequest, s as DownloadMultipleFilesRequest, F as File, w as FileFormat, x as FileSortField, M as GenerateInviteCode, I as Integration, a3 as IntegrationRun, G as IntegrationStatus, E as IntegrationType, J as Invite, N as InviteCode, Q as InviteExpiration, W as InviteSortField, O as InviteStatus, v as ListFilesQuery, H as ListIntegrationsQuery, V as ListInvitesQuery, _ as ListMembersQuery, L as Login, Y as Member, $ as MemberSortField, a4 as MonitorStatus, a0 as Notification, a1 as NotificationType, a2 as Pagination, P as ProcessingStatus, R as ReplyInvite, a5 as ServiceStatus, S as Signup, X as SortOrder, T as TokenExpiration, U as UpdateAccount, d as UpdateAnnotation, i as UpdateApiToken, m as UpdateComment, o as UpdateDocument, q as UpdateFile, z as UpdateIntegration, B as UpdateIntegrationCredentials, Z as UpdateMemberRole, aa as UpdateWebhook, ae as UpdateWorkspace, a7 as Webhook, ab as WebhookStatus, a8 as WebhookWithSecret, ac as Workspace, af as WorkspaceRole } from './workspace-3RLqaMcj.js';
|
|
3
|
+
import { ErrorResponse } from './datatypes/index.js';
|
|
4
|
+
export { ValidationErrorDetail } from './datatypes/index.js';
|
|
3
5
|
import 'openapi-fetch';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview Error types for the Nvisy SDK.
|
|
9
|
+
*
|
|
10
|
+
* This module defines the error hierarchy used throughout the SDK:
|
|
11
|
+
* - {@link ApiError} - Errors returned by the Nvisy API (4xx/5xx responses)
|
|
12
|
+
* - {@link ConfigError} - Client configuration validation errors
|
|
13
|
+
* - {@link NetworkError} - Network connectivity and request failures
|
|
14
|
+
*
|
|
15
|
+
* All errors extend the built-in Error class and include additional context
|
|
16
|
+
* to help with debugging and error handling.
|
|
17
|
+
*
|
|
18
|
+
* @module errors
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Error thrown when the Nvisy API returns an error response.
|
|
23
|
+
*
|
|
24
|
+
* This error class wraps the API's {@link ErrorResponse} format and adds
|
|
25
|
+
* the HTTP status code. It provides helper methods to categorize errors
|
|
26
|
+
* and determine if they are retryable.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* try {
|
|
31
|
+
* await client.account.get();
|
|
32
|
+
* } catch (error) {
|
|
33
|
+
* if (error instanceof ApiError) {
|
|
34
|
+
* console.log(`API Error: ${error.message}`);
|
|
35
|
+
* console.log(`Status: ${error.statusCode}`);
|
|
36
|
+
* if (error.isRetryable()) {
|
|
37
|
+
* // Implement retry logic
|
|
38
|
+
* }
|
|
39
|
+
* }
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
declare class ApiError extends Error implements ErrorResponse {
|
|
44
|
+
/**
|
|
45
|
+
* The error type identifier (e.g., "ValidationError", "NotFoundError").
|
|
46
|
+
*/
|
|
47
|
+
readonly name: string;
|
|
48
|
+
/**
|
|
49
|
+
* Human-readable error message safe for display to end users.
|
|
50
|
+
*/
|
|
51
|
+
readonly message: string;
|
|
52
|
+
/**
|
|
53
|
+
* The resource type that the error relates to (e.g., "account", "project").
|
|
54
|
+
* May be null if the error is not resource-specific.
|
|
55
|
+
*/
|
|
56
|
+
readonly resource?: string | null;
|
|
57
|
+
/**
|
|
58
|
+
* A helpful suggestion for resolving the error.
|
|
59
|
+
* May be null if no suggestion is available.
|
|
60
|
+
*/
|
|
61
|
+
readonly suggestion?: string | null;
|
|
62
|
+
/**
|
|
63
|
+
* Field-specific validation errors.
|
|
64
|
+
* Present when the error is due to invalid input data.
|
|
65
|
+
*/
|
|
66
|
+
readonly validationErrors?: ErrorResponse["validationErrors"];
|
|
67
|
+
/**
|
|
68
|
+
* HTTP status code of the response (e.g., 400, 404, 500).
|
|
69
|
+
*/
|
|
70
|
+
readonly statusCode: number;
|
|
71
|
+
/**
|
|
72
|
+
* Creates a new ApiError from an API error response.
|
|
73
|
+
*
|
|
74
|
+
* @param response - The error response from the API
|
|
75
|
+
* @param statusCode - The HTTP status code of the response
|
|
76
|
+
*/
|
|
77
|
+
constructor(response: ErrorResponse, statusCode: number);
|
|
78
|
+
/**
|
|
79
|
+
* Checks if this is a client error (4xx status code).
|
|
80
|
+
*
|
|
81
|
+
* Client errors indicate problems with the request itself, such as
|
|
82
|
+
* invalid input, missing authentication, or accessing non-existent resources.
|
|
83
|
+
*
|
|
84
|
+
* @returns True if the status code is in the 4xx range
|
|
85
|
+
*/
|
|
86
|
+
isClientError(): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Checks if this is a server error (5xx status code).
|
|
89
|
+
*
|
|
90
|
+
* Server errors indicate problems on the API side. These are typically
|
|
91
|
+
* transient and may succeed if retried.
|
|
92
|
+
*
|
|
93
|
+
* @returns True if the status code is in the 5xx range
|
|
94
|
+
*/
|
|
95
|
+
isServerError(): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Determines if this error is safe to retry.
|
|
98
|
+
*
|
|
99
|
+
* An error is considered retryable if it's a server error (5xx),
|
|
100
|
+
* a request timeout (408), or rate limiting (429).
|
|
101
|
+
*
|
|
102
|
+
* @returns True if the request may succeed on retry
|
|
103
|
+
*/
|
|
104
|
+
isRetryable(): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Converts the error to a plain {@link ErrorResponse} object.
|
|
107
|
+
*
|
|
108
|
+
* Useful for serialization or logging.
|
|
109
|
+
*
|
|
110
|
+
* @returns A plain object representation of the error
|
|
111
|
+
*/
|
|
112
|
+
toJSON(): ErrorResponse;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Abstract base class for SDK-specific errors.
|
|
116
|
+
*
|
|
117
|
+
* This class provides common functionality for all client-side errors
|
|
118
|
+
* (as opposed to API errors). It ensures proper error naming and stack traces.
|
|
119
|
+
*
|
|
120
|
+
* @internal
|
|
121
|
+
*/
|
|
122
|
+
declare abstract class ClientError extends Error {
|
|
123
|
+
/**
|
|
124
|
+
* The error class name (e.g., "ConfigError", "NetworkError").
|
|
125
|
+
*/
|
|
126
|
+
readonly name: string;
|
|
127
|
+
/**
|
|
128
|
+
* Creates a new ClientError.
|
|
129
|
+
*
|
|
130
|
+
* @param message - The error message
|
|
131
|
+
*/
|
|
132
|
+
constructor(message: string);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Error thrown when client configuration is invalid.
|
|
136
|
+
*
|
|
137
|
+
* This error is thrown during client initialization if the provided
|
|
138
|
+
* configuration is missing required fields or contains invalid values.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```typescript
|
|
142
|
+
* try {
|
|
143
|
+
* const client = new Client().withApiToken("short");
|
|
144
|
+
* } catch (error) {
|
|
145
|
+
* if (error instanceof ConfigError) {
|
|
146
|
+
* console.log(`Config error in field '${error.field}': ${error.reason}`);
|
|
147
|
+
* }
|
|
148
|
+
* }
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
declare class ConfigError extends ClientError {
|
|
152
|
+
/**
|
|
153
|
+
* The configuration field that caused the error.
|
|
154
|
+
* May be undefined for general configuration errors.
|
|
155
|
+
*/
|
|
156
|
+
readonly field?: string;
|
|
157
|
+
/**
|
|
158
|
+
* A description of why the configuration is invalid.
|
|
159
|
+
* May be undefined for simple errors.
|
|
160
|
+
*/
|
|
161
|
+
readonly reason?: string;
|
|
162
|
+
/**
|
|
163
|
+
* Creates a new ConfigError.
|
|
164
|
+
*
|
|
165
|
+
* @param message - The error message
|
|
166
|
+
* @param options - Additional error context
|
|
167
|
+
* @param options.field - The field that caused the error
|
|
168
|
+
* @param options.reason - Why the configuration is invalid
|
|
169
|
+
*/
|
|
170
|
+
constructor(message: string, options?: {
|
|
171
|
+
field?: string;
|
|
172
|
+
reason?: string;
|
|
173
|
+
});
|
|
174
|
+
/**
|
|
175
|
+
* Creates a ConfigError for a missing API token.
|
|
176
|
+
*
|
|
177
|
+
* @returns A ConfigError indicating the API token is required
|
|
178
|
+
*
|
|
179
|
+
* @internal
|
|
180
|
+
*/
|
|
181
|
+
static missingApiToken(): ConfigError;
|
|
182
|
+
/**
|
|
183
|
+
* Creates a ConfigError for an invalid configuration field.
|
|
184
|
+
*
|
|
185
|
+
* @param field - The name of the invalid field
|
|
186
|
+
* @param reason - Why the field value is invalid
|
|
187
|
+
* @returns A ConfigError with field and reason context
|
|
188
|
+
*
|
|
189
|
+
* @internal
|
|
190
|
+
*/
|
|
191
|
+
static invalidField(field: string, reason: string): ConfigError;
|
|
192
|
+
/**
|
|
193
|
+
* Creates a ConfigError for a missing required field.
|
|
194
|
+
*
|
|
195
|
+
* @param field - The name of the missing field
|
|
196
|
+
* @returns A ConfigError indicating the field is required
|
|
197
|
+
*
|
|
198
|
+
* @internal
|
|
199
|
+
*/
|
|
200
|
+
static missingField(field: string): ConfigError;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Error thrown when a network request fails.
|
|
204
|
+
*
|
|
205
|
+
* This error wraps underlying network errors (connection failures, timeouts,
|
|
206
|
+
* aborted requests) and provides a consistent interface for handling them.
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* ```typescript
|
|
210
|
+
* try {
|
|
211
|
+
* await client.account.get();
|
|
212
|
+
* } catch (error) {
|
|
213
|
+
* if (error instanceof NetworkError) {
|
|
214
|
+
* console.log("Network error:", error.message);
|
|
215
|
+
* if (error.cause) {
|
|
216
|
+
* console.log("Caused by:", error.cause.message);
|
|
217
|
+
* }
|
|
218
|
+
* }
|
|
219
|
+
* }
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
222
|
+
declare class NetworkError extends ClientError {
|
|
223
|
+
/**
|
|
224
|
+
* The underlying error that caused this network error.
|
|
225
|
+
* May be undefined if no underlying error is available.
|
|
226
|
+
*/
|
|
227
|
+
readonly cause?: Error;
|
|
228
|
+
/**
|
|
229
|
+
* Creates a new NetworkError.
|
|
230
|
+
*
|
|
231
|
+
* @param message - The error message
|
|
232
|
+
* @param cause - The underlying error that caused this failure
|
|
233
|
+
*/
|
|
234
|
+
constructor(message: string, cause?: Error);
|
|
235
|
+
/**
|
|
236
|
+
* Creates a NetworkError for connection issues.
|
|
237
|
+
*
|
|
238
|
+
* @param message - Description of the connection problem
|
|
239
|
+
* @param cause - The underlying error
|
|
240
|
+
* @returns A NetworkError for connection failures
|
|
241
|
+
*
|
|
242
|
+
* @internal
|
|
243
|
+
*/
|
|
244
|
+
static connection(message: string, cause?: Error): NetworkError;
|
|
245
|
+
/**
|
|
246
|
+
* Creates a NetworkError for aborted requests.
|
|
247
|
+
*
|
|
248
|
+
* @returns A NetworkError indicating the request was aborted
|
|
249
|
+
*
|
|
250
|
+
* @internal
|
|
251
|
+
*/
|
|
252
|
+
static aborted(): NetworkError;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export { ApiError, ClientError, ConfigError, ErrorResponse, NetworkError };
|