@nvisy/sdk 0.1.0 → 0.3.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 +68 -4
- package/LICENSE.txt +1 -1
- package/README.md +16 -68
- package/dist/auth/index.d.ts +105 -0
- package/dist/auth/index.js +184 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth-CncOz2vx.d.ts +7420 -0
- package/dist/client-DQRisDAK.d.ts +808 -0
- package/dist/config-L7FKq_q5.d.ts +81 -0
- package/dist/datatypes/index.d.ts +9 -0
- package/dist/datatypes/index.js +3 -0
- package/dist/datatypes/index.js.map +1 -0
- package/dist/index.d.ts +140 -2
- package/dist/index.js +1303 -378
- package/dist/index.js.map +1 -1
- package/dist/services/index.d.ts +5 -0
- package/dist/services/index.js +1067 -0
- package/dist/services/index.js.map +1 -0
- package/dist/workspace-BjdbMWsa.d.ts +118 -0
- package/package.json +38 -32
- 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,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Configuration types and constants for the Nvisy SDK.
|
|
3
|
+
*
|
|
4
|
+
* This module provides configuration interfaces, default values, and environment
|
|
5
|
+
* variable names used throughout the SDK.
|
|
6
|
+
*
|
|
7
|
+
* @module config
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Current SDK version.
|
|
11
|
+
*
|
|
12
|
+
* Used in the default user agent string and for version tracking.
|
|
13
|
+
*/
|
|
14
|
+
declare const VERSION = "0.3.0";
|
|
15
|
+
/**
|
|
16
|
+
* Configuration options for creating a Nvisy client.
|
|
17
|
+
*
|
|
18
|
+
* The `apiToken` field is required for authentication. All other fields are optional
|
|
19
|
+
* and will use sensible defaults when omitted.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const config: ClientConfig = {
|
|
24
|
+
* apiToken: "your-api-token",
|
|
25
|
+
* baseUrl: "https://api.nvisy.com",
|
|
26
|
+
* headers: { "X-Custom-Header": "value" },
|
|
27
|
+
* };
|
|
28
|
+
* const client = new Client(config);
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
interface ClientConfig {
|
|
32
|
+
/**
|
|
33
|
+
* API token for authentication.
|
|
34
|
+
*
|
|
35
|
+
* Tokens can be obtained from the Nvisy dashboard or via the auth endpoints.
|
|
36
|
+
*/
|
|
37
|
+
apiToken: string;
|
|
38
|
+
/**
|
|
39
|
+
* Base URL for the Nvisy API.
|
|
40
|
+
*
|
|
41
|
+
* @default "https://api.nvisy.com"
|
|
42
|
+
*/
|
|
43
|
+
baseUrl?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Custom headers to include with every request.
|
|
46
|
+
*
|
|
47
|
+
* These headers are merged with the default headers (Content-Type, User-Agent,
|
|
48
|
+
* and Authorization). Custom headers take precedence over defaults if there
|
|
49
|
+
* are conflicts.
|
|
50
|
+
*/
|
|
51
|
+
headers?: Record<string, string>;
|
|
52
|
+
/**
|
|
53
|
+
* Custom user agent string to identify your application.
|
|
54
|
+
*
|
|
55
|
+
* @default "@nvisy/sdk v.{version}"
|
|
56
|
+
*/
|
|
57
|
+
userAgent?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Enable logging for requests and responses.
|
|
60
|
+
*
|
|
61
|
+
* When enabled, logs request method, URL, status, and timing to console.
|
|
62
|
+
*
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
withLogging?: boolean;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Default configuration values used when options are not explicitly provided.
|
|
69
|
+
*/
|
|
70
|
+
declare const DEFAULTS: {
|
|
71
|
+
/**
|
|
72
|
+
* Default base URL for the Nvisy API.
|
|
73
|
+
*/
|
|
74
|
+
readonly BASE_URL: "https://api.nvisy.com";
|
|
75
|
+
/**
|
|
76
|
+
* Default user agent string.
|
|
77
|
+
*/
|
|
78
|
+
readonly USER_AGENT: "@nvisy/sdk v.0.3.0";
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export { type ClientConfig as C, DEFAULTS as D, VERSION as V };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { A as Account, c as ActivitiesPage, a as Activity, b as ActivityType, d as Annotation, f as AnnotationsPage, g as ApiToken, i as ApiTokenType, h as ApiTokenWithJWT, l as ApiTokensPage, x as ArchiveFormat, af as CheckHealth, m as Comment, p as CommentsPage, u as ContentSegmentation, C as CreateAnnotation, j as CreateApiToken, n as CreateComment, q as CreateDocument, B as CreateIntegration, N as CreateInvite, ah as CreateWebhook, ap as CreateWorkspace, aa as CursorPagination, w as DeleteFiles, D as Document, s as DocumentsPage, v as DownloadFiles, F as File, y as FileFormat, z as FilesPage, O as GenerateInviteCode, I as Integration, ab as IntegrationRun, ac as IntegrationRunsPage, J as IntegrationStatus, H as IntegrationType, K as IntegrationsPage, M as Invite, Q as InviteCode, V as InviteExpiration, Z as InvitePreview, X as InviteSortField, S as InviteStatus, _ as InvitesPage, L as ListFiles, W as ListInvites, a1 as ListMembers, $ as Member, a2 as MemberSortField, a3 as MembersPage, ad as MonitorStatus, a4 as Notification, a5 as NotificationEvent, a6 as NotificationSettings, a9 as NotificationsPage, P as ProcessingStatus, R as ReplyInvite, ae as ServiceStatus, Y as SortOrder, aj as TestWebhook, T as TokenExpiration, a8 as UnreadStatus, U as UpdateAccount, e as UpdateAnnotation, k as UpdateApiToken, o as UpdateComment, r as UpdateDocument, t as UpdateFile, E as UpdateIntegration, G as UpdateIntegrationCredentials, a0 as UpdateMember, a7 as UpdateNotificationSettings, ai as UpdateWebhook, aq as UpdateWorkspace, ag as Webhook, am as WebhookEvent, ak as WebhookResult, al as WebhookStatus, an as WebhooksPage, ao as Workspace, ar as WorkspaceRole, as as WorkspacesPage } from '../workspace-BjdbMWsa.js';
|
|
2
|
+
import { c as components } from '../auth-CncOz2vx.js';
|
|
3
|
+
export { A as AuthToken, L as Login, S as Signup } from '../auth-CncOz2vx.js';
|
|
4
|
+
|
|
5
|
+
type Schemas = components["schemas"];
|
|
6
|
+
type ErrorResponse = Schemas["ErrorResponse"];
|
|
7
|
+
type ValidationErrorDetail = Schemas["ValidationErrorDetail"];
|
|
8
|
+
|
|
9
|
+
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,141 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { A as ApiClient, N as Nvisy } from './client-DQRisDAK.js';
|
|
2
|
+
export { C as ClientConfig, D as DEFAULTS, V as VERSION } from './config-L7FKq_q5.js';
|
|
3
|
+
import { ErrorResponse } from './datatypes/index.js';
|
|
3
4
|
import 'openapi-fetch';
|
|
5
|
+
import './auth-CncOz2vx.js';
|
|
6
|
+
import './workspace-BjdbMWsa.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @fileoverview Error types for the Nvisy SDK.
|
|
10
|
+
*
|
|
11
|
+
* This module defines the error hierarchy used throughout the SDK:
|
|
12
|
+
* - {@link NvisyError} - Base error class for all SDK errors
|
|
13
|
+
* - {@link NvisyApiError} - Errors returned by the Nvisy API (4xx/5xx responses)
|
|
14
|
+
*
|
|
15
|
+
* @module errors
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Base error class for all Nvisy SDK errors.
|
|
20
|
+
*
|
|
21
|
+
* This class provides common functionality for all SDK errors.
|
|
22
|
+
* It ensures proper error naming and stack traces.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* try {
|
|
27
|
+
* const client = new Client({ apiToken: "" });
|
|
28
|
+
* } catch (error) {
|
|
29
|
+
* if (error instanceof NvisyError) {
|
|
30
|
+
* console.log("SDK error:", error.message);
|
|
31
|
+
* }
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare class NvisyError extends Error {
|
|
36
|
+
/**
|
|
37
|
+
* The error class name.
|
|
38
|
+
*/
|
|
39
|
+
readonly name: string;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a new NvisyError.
|
|
42
|
+
*
|
|
43
|
+
* @param message - The error message
|
|
44
|
+
*/
|
|
45
|
+
constructor(message: string);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Error thrown when the Nvisy API returns an error response.
|
|
49
|
+
*
|
|
50
|
+
* This error class wraps the API's {@link ErrorResponse} format and adds
|
|
51
|
+
* the HTTP status code. It provides helper methods to categorize errors
|
|
52
|
+
* and determine if they are retryable.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* try {
|
|
57
|
+
* await client.account.getAccount();
|
|
58
|
+
* } catch (error) {
|
|
59
|
+
* if (error instanceof NvisyApiError) {
|
|
60
|
+
* console.log(`API Error: ${error.message}`);
|
|
61
|
+
* console.log(`Status: ${error.statusCode}`);
|
|
62
|
+
* if (error.isRetryable()) {
|
|
63
|
+
* // Implement retry logic
|
|
64
|
+
* }
|
|
65
|
+
* }
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
declare class NvisyApiError extends NvisyError implements ErrorResponse {
|
|
70
|
+
/**
|
|
71
|
+
* The error type identifier (e.g., "ValidationError", "NotFoundError").
|
|
72
|
+
*/
|
|
73
|
+
readonly name: string;
|
|
74
|
+
/**
|
|
75
|
+
* Human-readable error message safe for display to end users.
|
|
76
|
+
*/
|
|
77
|
+
readonly message: string;
|
|
78
|
+
/**
|
|
79
|
+
* The resource type that the error relates to (e.g., "account", "project").
|
|
80
|
+
* May be null if the error is not resource-specific.
|
|
81
|
+
*/
|
|
82
|
+
readonly resource?: string | null;
|
|
83
|
+
/**
|
|
84
|
+
* A helpful suggestion for resolving the error.
|
|
85
|
+
* May be null if no suggestion is available.
|
|
86
|
+
*/
|
|
87
|
+
readonly suggestion?: string | null;
|
|
88
|
+
/**
|
|
89
|
+
* Field-specific validation errors.
|
|
90
|
+
* Present when the error is due to invalid input data.
|
|
91
|
+
*/
|
|
92
|
+
readonly validation?: ErrorResponse["validation"];
|
|
93
|
+
/**
|
|
94
|
+
* HTTP status code of the response (e.g., 400, 404, 500).
|
|
95
|
+
*/
|
|
96
|
+
readonly statusCode: number;
|
|
97
|
+
/**
|
|
98
|
+
* Creates a new NvisyApiError from an API error response.
|
|
99
|
+
*
|
|
100
|
+
* @param response - The error response from the API
|
|
101
|
+
* @param statusCode - The HTTP status code of the response
|
|
102
|
+
*/
|
|
103
|
+
constructor(response: ErrorResponse, statusCode: number);
|
|
104
|
+
/**
|
|
105
|
+
* Checks if this is a client error (4xx status code).
|
|
106
|
+
*
|
|
107
|
+
* Client errors indicate problems with the request itself, such as
|
|
108
|
+
* invalid input, missing authentication, or accessing non-existent resources.
|
|
109
|
+
*
|
|
110
|
+
* @returns True if the status code is in the 4xx range
|
|
111
|
+
*/
|
|
112
|
+
isClientError(): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Checks if this is a server error (5xx status code).
|
|
115
|
+
*
|
|
116
|
+
* Server errors indicate problems on the API side. These are typically
|
|
117
|
+
* transient and may succeed if retried.
|
|
118
|
+
*
|
|
119
|
+
* @returns True if the status code is in the 5xx range
|
|
120
|
+
*/
|
|
121
|
+
isServerError(): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Determines if this error is safe to retry.
|
|
124
|
+
*
|
|
125
|
+
* An error is considered retryable if it's a server error (5xx),
|
|
126
|
+
* a request timeout (408), or rate limiting (429).
|
|
127
|
+
*
|
|
128
|
+
* @returns True if the request may succeed on retry
|
|
129
|
+
*/
|
|
130
|
+
isRetryable(): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Converts the error to a plain {@link ErrorResponse} object.
|
|
133
|
+
*
|
|
134
|
+
* Useful for serialization or logging.
|
|
135
|
+
*
|
|
136
|
+
* @returns A plain object representation of the error
|
|
137
|
+
*/
|
|
138
|
+
toJSON(): ErrorResponse;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export { ErrorResponse, NvisyApiError, NvisyError };
|