@nvisy/sdk 0.29.0 → 0.30.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,6 +8,16 @@ and this project adheres to
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [0.30.0] - 2026-08-18
12
+
13
+ ### Added
14
+
15
+ - `fetch` option on the client config and the standalone auth helpers, letting
16
+ a host swap in a custom `fetch` implementation for every request. Defaults to
17
+ the global `fetch`, so existing callers are unaffected. Useful for a desktop
18
+ (Tauri) app passing `@tauri-apps/plugin-http`'s `fetch`, which performs the
19
+ request in the native process and so is not subject to browser CORS
20
+
11
21
  ## [0.29.0] - 2026-08-14
12
22
 
13
23
  ### Added
@@ -614,7 +624,8 @@ and this project adheres to
614
624
  - Network error handling for timeouts, DNS resolution, and connection issues
615
625
  - Configuration validation with detailed error messages
616
626
 
617
- [Unreleased]: https://github.com/nvisycom/sdk-ts/compare/v0.29.0...HEAD
627
+ [Unreleased]: https://github.com/nvisycom/sdk-ts/compare/v0.30.0...HEAD
628
+ [0.30.0]: https://github.com/nvisycom/sdk-ts/compare/v0.29.0...v0.30.0
618
629
  [0.29.0]: https://github.com/nvisycom/sdk-ts/compare/v0.28.0...v0.29.0
619
630
  [0.28.0]: https://github.com/nvisycom/sdk-ts/compare/v0.27.0...v0.28.0
620
631
  [0.27.0]: https://github.com/nvisycom/sdk-ts/compare/v0.26.0...v0.27.0
package/README.md CHANGED
@@ -37,6 +37,7 @@ const client = new Nvisy({
37
37
  headers: { // Optional
38
38
  "X-Custom-Header": "value",
39
39
  },
40
+ fetch: customFetch, // Optional, defaults to global fetch
40
41
  });
41
42
  ```
42
43
 
@@ -1,4 +1,4 @@
1
- import { t as ClientConfig } from "../config-BRQp8Cat.js";
1
+ import { t as ClientConfig } from "../config-BwallLvT.js";
2
2
  import { $n as Login, Qn as AuthToken, er as Signup } from "../index-4U5Gmd2p.js";
3
3
  //#region src/auth/config.d.ts
4
4
  /**
@@ -27,7 +27,7 @@ type AuthConfig = Omit<ClientConfig, "apiToken">;
27
27
  * instance. Use the returned token to create an authenticated client.
28
28
  *
29
29
  * @param credentials - Login credentials (email and password)
30
- * @param config - Optional configuration (baseUrl, headers, userAgent)
30
+ * @param config - Optional configuration (baseUrl, headers, userAgent, fetch)
31
31
  * @returns Promise that resolves with the auth token
32
32
  * @throws {ApiError} If the credentials are invalid or the request fails
33
33
  *
@@ -52,7 +52,7 @@ declare function login(credentials: Login, config?: AuthConfig): Promise<AuthTok
52
52
  * instance. Use the returned token to create an authenticated client.
53
53
  *
54
54
  * @param details - Signup details (name, email, password, etc.)
55
- * @param config - Optional configuration (baseUrl, headers, userAgent)
55
+ * @param config - Optional configuration (baseUrl, headers, userAgent, fetch)
56
56
  * @returns Promise that resolves with the auth token
57
57
  * @throws {ApiError} If the signup fails (e.g., email already exists)
58
58
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/auth/config.ts","../../src/auth/password.ts"],"mappings":";;;;;;;;;;;;;;;;;;;KA2BY,aAAa,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCiDR,MACrB,aAAa,OACb,SAAS,aACP,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiCW,OACrB,SAAS,QACT,SAAS,aACP,QAAQ"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/auth/config.ts","../../src/auth/password.ts"],"mappings":";;;;;;;;;;;;;;;;;;;KA2BY,aAAa,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCmDR,MACrB,aAAa,OACb,SAAS,aACP,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiCW,OACrB,SAAS,QACT,SAAS,aACP,QAAQ"}
@@ -38,7 +38,8 @@ function createAuthClient(config) {
38
38
  };
39
39
  const client = createClient({
40
40
  baseUrl: config?.baseUrl ?? DEFAULTS.BASE_URL,
41
- headers
41
+ headers,
42
+ fetch: config?.fetch
42
43
  });
43
44
  client.use(errorMiddleware);
44
45
  return client;
@@ -50,7 +51,7 @@ function createAuthClient(config) {
50
51
  * instance. Use the returned token to create an authenticated client.
51
52
  *
52
53
  * @param credentials - Login credentials (email and password)
53
- * @param config - Optional configuration (baseUrl, headers, userAgent)
54
+ * @param config - Optional configuration (baseUrl, headers, userAgent, fetch)
54
55
  * @returns Promise that resolves with the auth token
55
56
  * @throws {ApiError} If the credentials are invalid or the request fails
56
57
  *
@@ -78,7 +79,7 @@ async function login(credentials, config) {
78
79
  * instance. Use the returned token to create an authenticated client.
79
80
  *
80
81
  * @param details - Signup details (name, email, password, etc.)
81
- * @param config - Optional configuration (baseUrl, headers, userAgent)
82
+ * @param config - Optional configuration (baseUrl, headers, userAgent, fetch)
82
83
  * @returns Promise that resolves with the auth token
83
84
  * @throws {ApiError} If the signup fails (e.g., email already exists)
84
85
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/auth/password.ts"],"sourcesContent":["/**\n * @fileoverview Standalone password-based authentication functions.\n *\n * This module provides functions for login and signup that don't require\n * an existing API token. Use these to obtain an auth token, then create\n * an authenticated {@link Client} instance.\n *\n * @module auth/password\n *\n * @example\n * ```typescript\n * import { login, signup } from \"@nvisy/sdk/auth\";\n * import { Nvisy } from \"@nvisy/sdk\";\n *\n * // Login to get a token\n * const token = await login({ email: \"user@example.com\", password: \"...\" });\n *\n * // Create authenticated client\n * const nvisy = new Nvisy({ apiToken: token.accessToken });\n * ```\n */\n\nimport createClient from \"openapi-fetch\";\nimport type { AuthConfig } from \"@/auth/config.js\";\nimport { DEFAULTS } from \"@/config.js\";\nimport type { AuthToken, Login, Signup } from \"@/datatypes/index.js\";\nimport { errorMiddleware } from \"@/middleware/index.js\";\nimport type { paths } from \"@/schema/api.js\";\n\n/**\n * Creates an unauthenticated API client for auth operations.\n *\n * @param config - Optional configuration options\n * @returns A configured openapi-fetch client without authentication\n * @internal\n */\nfunction createAuthClient(config?: AuthConfig) {\n\tconst headers: Record<string, string> = {\n\t\t\"Content-Type\": \"application/json\",\n\t\t\"User-Agent\": config?.userAgent ?? DEFAULTS.USER_AGENT,\n\t\t...config?.headers,\n\t};\n\n\tconst client = createClient<paths>({\n\t\tbaseUrl: config?.baseUrl ?? DEFAULTS.BASE_URL,\n\t\theaders,\n\t});\n\n\tclient.use(errorMiddleware);\n\treturn client;\n}\n\n/**\n * Login with email and password to obtain an auth token.\n *\n * This is a standalone function that doesn't require an existing {@link Client}\n * instance. Use the returned token to create an authenticated client.\n *\n * @param credentials - Login credentials (email and password)\n * @param config - Optional configuration (baseUrl, headers, userAgent)\n * @returns Promise that resolves with the auth token\n * @throws {ApiError} If the credentials are invalid or the request fails\n *\n * @example\n * ```typescript\n * import { login } from \"@nvisy/sdk/auth\";\n * import { Nvisy } from \"@nvisy/sdk\";\n *\n * const token = await login({\n * email: \"user@example.com\",\n * password: \"your-password\",\n * });\n *\n * const nvisy = new Nvisy({ apiToken: token.accessToken });\n * ```\n */\nexport async function login(\n\tcredentials: Login,\n\tconfig?: AuthConfig,\n): Promise<AuthToken> {\n\tconst client = createAuthClient(config);\n\tconst { data } = await client.POST(\"/auth/login/\", {\n\t\tbody: credentials,\n\t});\n\treturn data!;\n}\n\n/**\n * Sign up a new account to obtain an auth token.\n *\n * This is a standalone function that doesn't require an existing {@link Client}\n * instance. Use the returned token to create an authenticated client.\n *\n * @param details - Signup details (name, email, password, etc.)\n * @param config - Optional configuration (baseUrl, headers, userAgent)\n * @returns Promise that resolves with the auth token\n * @throws {ApiError} If the signup fails (e.g., email already exists)\n *\n * @example\n * ```typescript\n * import { signup } from \"@nvisy/sdk/auth\";\n * import { Nvisy } from \"@nvisy/sdk\";\n *\n * const token = await signup({\n * name: \"John Doe\",\n * email: \"john@example.com\",\n * password: \"secure-password\",\n * });\n *\n * const nvisy = new Nvisy({ apiToken: token.accessToken });\n * ```\n */\nexport async function signup(\n\tdetails: Signup,\n\tconfig?: AuthConfig,\n): Promise<AuthToken> {\n\tconst client = createAuthClient(config);\n\tconst { data } = await client.POST(\"/auth/signup/\", {\n\t\tbody: details,\n\t});\n\treturn data!;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAS,iBAAiB,QAAqB;CAC9C,MAAM,UAAkC;EACvC,gBAAgB;EAChB,cAAc,QAAQ,aAAa,SAAS;EAC5C,GAAG,QAAQ;CACZ;CAEA,MAAM,SAAS,aAAoB;EAClC,SAAS,QAAQ,WAAW,SAAS;EACrC;CACD,CAAC;CAED,OAAO,IAAI,eAAe;CAC1B,OAAO;AACR;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,eAAsB,MACrB,aACA,QACqB;CAErB,MAAM,EAAE,SAAS,MADF,iBAAiB,MACJ,CAAC,CAAC,KAAK,gBAAgB,EAClD,MAAM,YACP,CAAC;CACD,OAAO;AACR;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,eAAsB,OACrB,SACA,QACqB;CAErB,MAAM,EAAE,SAAS,MADF,iBAAiB,MACJ,CAAC,CAAC,KAAK,iBAAiB,EACnD,MAAM,QACP,CAAC;CACD,OAAO;AACR"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/auth/password.ts"],"sourcesContent":["/**\n * @fileoverview Standalone password-based authentication functions.\n *\n * This module provides functions for login and signup that don't require\n * an existing API token. Use these to obtain an auth token, then create\n * an authenticated {@link Client} instance.\n *\n * @module auth/password\n *\n * @example\n * ```typescript\n * import { login, signup } from \"@nvisy/sdk/auth\";\n * import { Nvisy } from \"@nvisy/sdk\";\n *\n * // Login to get a token\n * const token = await login({ email: \"user@example.com\", password: \"...\" });\n *\n * // Create authenticated client\n * const nvisy = new Nvisy({ apiToken: token.accessToken });\n * ```\n */\n\nimport createClient from \"openapi-fetch\";\nimport type { AuthConfig } from \"@/auth/config.js\";\nimport { DEFAULTS } from \"@/config.js\";\nimport type { AuthToken, Login, Signup } from \"@/datatypes/index.js\";\nimport { errorMiddleware } from \"@/middleware/index.js\";\nimport type { paths } from \"@/schema/api.js\";\n\n/**\n * Creates an unauthenticated API client for auth operations.\n *\n * @param config - Optional configuration options\n * @returns A configured openapi-fetch client without authentication\n * @internal\n */\nfunction createAuthClient(config?: AuthConfig) {\n\tconst headers: Record<string, string> = {\n\t\t\"Content-Type\": \"application/json\",\n\t\t\"User-Agent\": config?.userAgent ?? DEFAULTS.USER_AGENT,\n\t\t...config?.headers,\n\t};\n\n\tconst client = createClient<paths>({\n\t\tbaseUrl: config?.baseUrl ?? DEFAULTS.BASE_URL,\n\t\theaders,\n\t\t// `undefined` falls back to the global fetch inside openapi-fetch.\n\t\tfetch: config?.fetch,\n\t});\n\n\tclient.use(errorMiddleware);\n\treturn client;\n}\n\n/**\n * Login with email and password to obtain an auth token.\n *\n * This is a standalone function that doesn't require an existing {@link Client}\n * instance. Use the returned token to create an authenticated client.\n *\n * @param credentials - Login credentials (email and password)\n * @param config - Optional configuration (baseUrl, headers, userAgent, fetch)\n * @returns Promise that resolves with the auth token\n * @throws {ApiError} If the credentials are invalid or the request fails\n *\n * @example\n * ```typescript\n * import { login } from \"@nvisy/sdk/auth\";\n * import { Nvisy } from \"@nvisy/sdk\";\n *\n * const token = await login({\n * email: \"user@example.com\",\n * password: \"your-password\",\n * });\n *\n * const nvisy = new Nvisy({ apiToken: token.accessToken });\n * ```\n */\nexport async function login(\n\tcredentials: Login,\n\tconfig?: AuthConfig,\n): Promise<AuthToken> {\n\tconst client = createAuthClient(config);\n\tconst { data } = await client.POST(\"/auth/login/\", {\n\t\tbody: credentials,\n\t});\n\treturn data!;\n}\n\n/**\n * Sign up a new account to obtain an auth token.\n *\n * This is a standalone function that doesn't require an existing {@link Client}\n * instance. Use the returned token to create an authenticated client.\n *\n * @param details - Signup details (name, email, password, etc.)\n * @param config - Optional configuration (baseUrl, headers, userAgent, fetch)\n * @returns Promise that resolves with the auth token\n * @throws {ApiError} If the signup fails (e.g., email already exists)\n *\n * @example\n * ```typescript\n * import { signup } from \"@nvisy/sdk/auth\";\n * import { Nvisy } from \"@nvisy/sdk\";\n *\n * const token = await signup({\n * name: \"John Doe\",\n * email: \"john@example.com\",\n * password: \"secure-password\",\n * });\n *\n * const nvisy = new Nvisy({ apiToken: token.accessToken });\n * ```\n */\nexport async function signup(\n\tdetails: Signup,\n\tconfig?: AuthConfig,\n): Promise<AuthToken> {\n\tconst client = createAuthClient(config);\n\tconst { data } = await client.POST(\"/auth/signup/\", {\n\t\tbody: details,\n\t});\n\treturn data!;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAS,iBAAiB,QAAqB;CAC9C,MAAM,UAAkC;EACvC,gBAAgB;EAChB,cAAc,QAAQ,aAAa,SAAS;EAC5C,GAAG,QAAQ;CACZ;CAEA,MAAM,SAAS,aAAoB;EAClC,SAAS,QAAQ,WAAW,SAAS;EACrC;EAEA,OAAO,QAAQ;CAChB,CAAC;CAED,OAAO,IAAI,eAAe;CAC1B,OAAO;AACR;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,eAAsB,MACrB,aACA,QACqB;CAErB,MAAM,EAAE,SAAS,MADF,iBAAiB,MACJ,CAAC,CAAC,KAAK,gBAAgB,EAClD,MAAM,YACP,CAAC;CACD,OAAO;AACR;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,eAAsB,OACrB,SACA,QACqB;CAErB,MAAM,EAAE,SAAS,MADF,iBAAiB,MACJ,CAAC,CAAC,KAAK,iBAAiB,EACnD,MAAM,QACP,CAAC;CACD,OAAO;AACR"}
@@ -1,4 +1,4 @@
1
- import { t as ClientConfig } from "./config-BRQp8Cat.js";
1
+ import { t as ClientConfig } from "./config-BwallLvT.js";
2
2
  import { $n as Login, $t as UpdateMember, A as CreatePipelineRun, An as ConnectionPage, At as CursorPagination, Bt as NotificationSettings, Ci as UpdateAccount, Dn as Connection, Dt as PipelineSummaryPage, Fn as CreateConnection, H as CreatePolicy, Jn as UpdateConnection, Jt as UpdateNotificationSettings, Kn as SyncStatus, Kt as UnreadCountEvent, L as RunStatusEvent, M as PipelineRunPage, Mn as ConnectionSyncPage, Nn as ConnectionVerification, Nt as MarkedReadStatus, P as PipelineRunsQuery, Qn as AuthToken, Rt as NotificationPage, Si as PublicAccount, Sn as UpdateFile, St as Pipeline, Tt as PipelineStatus, Vn as SyncConnection, Xn as RecognizerCatalog, Xt as Member, Yn as LabelCatalog, Yt as ListMembers, Zt as MemberPage, an as InvitePage, bn as ListFiles, c as WorkspacePage, ci as ActivityPage, d as CreateWebhook, dn as ReplyInvite, dt as PolicySummaryPage, ei as ApiToken, en as CreateInvite, er as Signup, f as TestWebhook, gn as File, h as WebhookCreated, ii as CreateApiToken, j as PipelineRun, jn as ConnectionSync, k as Audit, kt as UpdatePipeline, m as Webhook, mn as Health, o as UpdateWorkspace, oi as UpdateApiToken, on as InvitePreview, ot as Policy, p as UpdateWebhook, qt as UnreadStatus, ri as ApiTokenWithJWT, rn as InviteCode, s as Workspace, sn as InviteSent, t as CreateWorkspace, ti as ApiTokenPage, tn as GenerateInviteCode, un as ListInvites, v as WebhookPage, vn as FilePage, wi as paths, xt as CreatePipeline, y as WebhookResult, yi as Account$1, yt as UpdatePolicy } from "./index-4U5Gmd2p.js";
3
3
  import { Client } from "openapi-fetch";
4
4
  //#region src/services/account.d.ts
@@ -1011,4 +1011,4 @@ declare class Nvisy {
1011
1011
  }
1012
1012
  //#endregion
1013
1013
  export { ApiTokens as _, Syncs as a, Policies as c, Members as d, Invites as f, Auth as g, Catalog as h, Webhooks as i, Pipelines as l, Connections as m, Nvisy as n, Status as o, Files as p, Workspaces as r, Runs as s, ApiClient as t, Notifications as u, Activities as v, Account as y };
1014
- //# sourceMappingURL=client-CHOXZ85T.d.ts.map
1014
+ //# sourceMappingURL=client-Cf7RgQwY.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client-CHOXZ85T.d.ts","names":[],"sources":["../src/services/account.ts","../src/services/activities.ts","../src/services/api-tokens.ts","../src/services/auth.ts","../src/services/catalog.ts","../src/services/connections.ts","../src/services/files.ts","../src/services/invites.ts","../src/services/members.ts","../src/services/notifications.ts","../src/services/pipelines.ts","../src/services/policies.ts","../src/services/runs.ts","../src/services/status.ts","../src/services/syncs.ts","../src/services/webhooks.ts","../src/services/workspaces.ts","../src/client.ts"],"mappings":";;;;;;;cAUa;;EAGA,YAAA,KAAK;;;;;;EASX,cAAc,QAAQ;;;;;;;EAWtB,cAAc,SAAS,gBAAgB,QAAQ;;;;;;EAY/C,iBAAiB;;;;;;;EAUjB,iBAAiB,mBAAmB,QAAQ;;;;;;;;EAc5C,aAAa,kBAAkB,QAAQ,OAAO,QAAQ;;;;;;;EAsBtD,aAAa,mBAAmB;;;;;;;cCrF1B;;EAGA,YAAA,KAAK;;;;;;;;EAWX,eACL,uBACA,QAAQ,mBACN,QAAQ;;;;;;;cCVC;;EAGA,YAAA,KAAK;;;;;;;EAUX,cAAc,QAAQ,mBAAmB,QAAQ;;;;;;;EAajD,YAAY,kBAAkB,QAAQ;;;;;;;EAatC,eAAe,OAAO,iBAAiB,QAAQ;;;;;;;;EAc/C,eACL,iBACA,SAAS,iBACP,QAAQ;;;;;;;EAcL,eAAe,kBAAkB;;;;;;;cC7E3B;;EAGA,YAAA,KAAK;;;;;;;EAUX,aAAa,aAAa,QAAQ,QAAQ;;;;;;;EAa1C,cAAc,aAAa,SAAS,QAAQ;;;;;;EAY5C,iBAAiB;;;;;;;;cCrCX;;EAGA,YAAA,KAAK;;;;;EAQX,cAAc,QAAQ;;;;;EAStB,mBAAmB,QAAQ;;;;;;;cCdrB;;EAGA,YAAA,KAAK;;;;;;;;EAWX,gBACL,uBACA,QAAQ;IAAqB;MAC3B,QAAQ;;;;;;;;EAiBL,iBACL,uBACA,YAAY,mBACV,QAAQ;;;;;;;;EAkBL,cACL,uBACA,uBACE,QAAQ;;;;;;;;;EAkBL,iBACL,uBACA,sBACA,SAAS,mBACP,QAAQ;;;;;;;;EAkBL,iBACL,uBACA,u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;;;;MAOX,WAAW;;;;MAOX,iBAAiB;;;;MAOjB,QAAQ;;;;MAOR,SAAS;;;;MAOT,YAAY;;;;MAOZ,cAAc"}
1
+ {"version":3,"file":"client-Cf7RgQwY.d.ts","names":[],"sources":["../src/services/account.ts","../src/services/activities.ts","../src/services/api-tokens.ts","../src/services/auth.ts","../src/services/catalog.ts","../src/services/connections.ts","../src/services/files.ts","../src/services/invites.ts","../src/services/members.ts","../src/services/notifications.ts","../src/services/pipelines.ts","../src/services/policies.ts","../src/services/runs.ts","../src/services/status.ts","../src/services/syncs.ts","../src/services/webhooks.ts","../src/services/workspaces.ts","../src/client.ts"],"mappings":";;;;;;;cAUa;;EAGA,YAAA,KAAK;;;;;;EASX,cAAc,QAAQ;;;;;;;EAWtB,cAAc,SAAS,gBAAgB,QAAQ;;;;;;EAY/C,iBAAiB;;;;;;;EAUjB,iBAAiB,mBAAmB,QAAQ;;;;;;;;EAc5C,aAAa,kBAAkB,QAAQ,OAAO,QAAQ;;;;;;;EAsBtD,aAAa,mBAAmB;;;;;;;cCrF1B;;EAGA,YAAA,KAAK;;;;;;;;EAWX,eACL,uBACA,QAAQ,mBACN,QAAQ;;;;;;;cCVC;;EAGA,YAAA,KAAK;;;;;;;EAUX,cAAc,QAAQ,mBAAmB,QAAQ;;;;;;;EAajD,YAAY,kBAAkB,QAAQ;;;;;;;EAatC,eAAe,OAAO,iBAAiB,QAAQ;;;;;;;;EAc/C,eACL,iBACA,SAAS,iBACP,QAAQ;;;;;;;EAcL,eAAe,kBAAkB;;;;;;;cC7E3B;;EAGA,YAAA,KAAK;;;;;;;EAUX,aAAa,aAAa,QAAQ,QAAQ;;;;;;;EAa1C,cAAc,aAAa,SAAS,QAAQ;;;;;;EAY5C,iBAAiB;;;;;;;;cCrCX;;EAGA,YAAA,KAAK;;;;;EAQX,cAAc,QAAQ;;;;;EAStB,mBAAmB,QAAQ;;;;;;;cCdrB;;EAGA,YAAA,KAAK;;;;;;;;EAWX,gBACL,uBACA,QA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;;;;;;;;;MAYA,OAAO;;;;MAOP,QAAQ;;;;MAOR,UAAU;;;;MAOV,WAAW;;;;MAOX,cAAc;;;;MAOd,aAAa;;;;MAOb,eAAe;;;;MAOf,SAAS;;;;MAOT,aAAa;;;;MAOb,YAAY;;;;MAOZ,WAAW;;;;MAOX,WAAW;;;;MAOX,WAAW;;;;MAOX,iBAAiB;;;;MAOjB,QAAQ;;;;MAOR,SAAS;;;;MAOT,YAAY;;;;MAOZ,cAAc"}
@@ -64,6 +64,15 @@ interface ClientConfig {
64
64
  * @default false
65
65
  */
66
66
  withLogging?: boolean;
67
+ /**
68
+ * Custom fetch implementation used for every request. Must match the WHATWG
69
+ * `fetch` signature. Defaults to the global `fetch`.
70
+ *
71
+ * Lets a host swap in a non-browser transport — e.g. a desktop (Tauri) app
72
+ * passing `@tauri-apps/plugin-http`'s `fetch`, which performs the request in
73
+ * the native process and so is not subject to browser CORS.
74
+ */
75
+ fetch?: typeof globalThis.fetch;
67
76
  }
68
77
  /**
69
78
  * Default configuration values used when options are not explicitly provided.
@@ -80,4 +89,4 @@ declare const DEFAULTS: {
80
89
  };
81
90
  //#endregion
82
91
  export { DEFAULTS as n, VERSION as r, ClientConfig as t };
83
- //# sourceMappingURL=config-BRQp8Cat.d.ts.map
92
+ //# sourceMappingURL=config-BwallLvT.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-BRQp8Cat.d.ts","names":[],"sources":["../src/config.ts"],"mappings":";;;;;;;;;;;;;;cAca;;;;;;;;;;;;;;;;;UAkBI;;;;;;EAMhB;;;;;;EAOA;;;;;;;;EASA,UAAU;;;;;;EAOV;;;;;;;;EASA;;;;;cAMY;;;;WAAA;;;;WAAA"}
1
+ {"version":3,"file":"config-BwallLvT.d.ts","names":[],"sources":["../src/config.ts"],"mappings":";;;;;;;;;;;;;;cAca;;;;;;;;;;;;;;;;;UAkBI;;;;;;EAMhB;;;;;;EAOA;;;;;;;;EASA,UAAU;;;;;;EAOV;;;;;;;;EASA;;;;;;;;;EAUA,eAAe,WAAW;;;;;cAMd;;;;WAAA;;;;WAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"error-C_RvXw4Z.js","names":[],"sources":["../src/config.ts","../src/middleware/error.ts"],"sourcesContent":["/**\n * @fileoverview Configuration types and constants for the Nvisy SDK.\n *\n * This module provides configuration interfaces, default values, and environment\n * variable names used throughout the SDK.\n *\n * @module config\n */\n\n/**\n * Current SDK version.\n *\n * Used in the default user agent string and for version tracking.\n */\nexport const VERSION = \"0.3.0\";\n\n/**\n * Configuration options for creating a Nvisy client.\n *\n * The `apiToken` field is required for authentication. All other fields are optional\n * and will use sensible defaults when omitted.\n *\n * @example\n * ```typescript\n * const config: ClientConfig = {\n * apiToken: \"your-api-token\",\n * baseUrl: \"https://api.nvisy.com\",\n * headers: { \"X-Custom-Header\": \"value\" },\n * };\n * const client = new Client(config);\n * ```\n */\nexport interface ClientConfig {\n\t/**\n\t * API token for authentication.\n\t *\n\t * Tokens can be obtained from the Nvisy dashboard or via the auth endpoints.\n\t */\n\tapiToken: string;\n\n\t/**\n\t * Base URL for the Nvisy API.\n\t *\n\t * @default \"https://api.nvisy.com\"\n\t */\n\tbaseUrl?: string;\n\n\t/**\n\t * Custom headers to include with every request.\n\t *\n\t * These headers are merged with the default headers (Content-Type, User-Agent,\n\t * and Authorization). Custom headers take precedence over defaults if there\n\t * are conflicts.\n\t */\n\theaders?: Record<string, string>;\n\n\t/**\n\t * Custom user agent string to identify your application.\n\t *\n\t * @default \"@nvisy/sdk v.{version}\"\n\t */\n\tuserAgent?: string;\n\n\t/**\n\t * Enable logging for requests and responses.\n\t *\n\t * When enabled, logs request method, URL, status, and timing to console.\n\t *\n\t * @default false\n\t */\n\twithLogging?: boolean;\n}\n\n/**\n * Default configuration values used when options are not explicitly provided.\n */\nexport const DEFAULTS = {\n\t/**\n\t * Default base URL for the Nvisy API.\n\t */\n\tBASE_URL: \"https://api.nvisy.com\",\n\n\t/**\n\t * Default user agent string.\n\t */\n\tUSER_AGENT: `@nvisy/sdk v.${VERSION}`,\n} as const;\n","import type { Middleware } from \"openapi-fetch\";\nimport type { ErrorResponse } from \"@/datatypes/index.js\";\nimport { NvisyApiError, NvisyError } from \"@/errors.js\";\n\n/**\n * Middleware that automatically throws NvisyApiError for error responses.\n * This replaces the need for manual checks in services.\n */\nexport const errorMiddleware: Middleware = {\n\tasync onResponse({ response }) {\n\t\tif (!response.ok) {\n\t\t\tconst error = (await response.clone().json()) as ErrorResponse;\n\t\t\tthrow new NvisyApiError(error, response.status);\n\t\t}\n\t\treturn response;\n\t},\n\n\tonError({ error }) {\n\t\t// Wrap fetch errors (network failures, CORS, etc.) in NvisyError\n\t\tif (error instanceof Error) {\n\t\t\tthrow new NvisyError(error.message);\n\t\t}\n\t\tthrow new NvisyError(\"An unknown network error occurred\");\n\t},\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAcA,MAAa,UAAU;;;;AA8DvB,MAAa,WAAW;;;;CAIvB,UAAU;;;;CAKV,YAAY,gBAAgB;AAC7B;;;;;;;;AC9EA,MAAa,kBAA8B;CAC1C,MAAM,WAAW,EAAE,YAAY;EAC9B,IAAI,CAAC,SAAS,IAEb,MAAM,IAAI,cAAc,MADH,SAAS,MAAM,CAAC,CAAC,KAAK,GACZ,SAAS,MAAM;EAE/C,OAAO;CACR;CAEA,QAAQ,EAAE,SAAS;EAElB,IAAI,iBAAiB,OACpB,MAAM,IAAI,WAAW,MAAM,OAAO;EAEnC,MAAM,IAAI,WAAW,mCAAmC;CACzD;AACD"}
1
+ {"version":3,"file":"error-C_RvXw4Z.js","names":[],"sources":["../src/config.ts","../src/middleware/error.ts"],"sourcesContent":["/**\n * @fileoverview Configuration types and constants for the Nvisy SDK.\n *\n * This module provides configuration interfaces, default values, and environment\n * variable names used throughout the SDK.\n *\n * @module config\n */\n\n/**\n * Current SDK version.\n *\n * Used in the default user agent string and for version tracking.\n */\nexport const VERSION = \"0.3.0\";\n\n/**\n * Configuration options for creating a Nvisy client.\n *\n * The `apiToken` field is required for authentication. All other fields are optional\n * and will use sensible defaults when omitted.\n *\n * @example\n * ```typescript\n * const config: ClientConfig = {\n * apiToken: \"your-api-token\",\n * baseUrl: \"https://api.nvisy.com\",\n * headers: { \"X-Custom-Header\": \"value\" },\n * };\n * const client = new Client(config);\n * ```\n */\nexport interface ClientConfig {\n\t/**\n\t * API token for authentication.\n\t *\n\t * Tokens can be obtained from the Nvisy dashboard or via the auth endpoints.\n\t */\n\tapiToken: string;\n\n\t/**\n\t * Base URL for the Nvisy API.\n\t *\n\t * @default \"https://api.nvisy.com\"\n\t */\n\tbaseUrl?: string;\n\n\t/**\n\t * Custom headers to include with every request.\n\t *\n\t * These headers are merged with the default headers (Content-Type, User-Agent,\n\t * and Authorization). Custom headers take precedence over defaults if there\n\t * are conflicts.\n\t */\n\theaders?: Record<string, string>;\n\n\t/**\n\t * Custom user agent string to identify your application.\n\t *\n\t * @default \"@nvisy/sdk v.{version}\"\n\t */\n\tuserAgent?: string;\n\n\t/**\n\t * Enable logging for requests and responses.\n\t *\n\t * When enabled, logs request method, URL, status, and timing to console.\n\t *\n\t * @default false\n\t */\n\twithLogging?: boolean;\n\n\t/**\n\t * Custom fetch implementation used for every request. Must match the WHATWG\n\t * `fetch` signature. Defaults to the global `fetch`.\n\t *\n\t * Lets a host swap in a non-browser transport — e.g. a desktop (Tauri) app\n\t * passing `@tauri-apps/plugin-http`'s `fetch`, which performs the request in\n\t * the native process and so is not subject to browser CORS.\n\t */\n\tfetch?: typeof globalThis.fetch;\n}\n\n/**\n * Default configuration values used when options are not explicitly provided.\n */\nexport const DEFAULTS = {\n\t/**\n\t * Default base URL for the Nvisy API.\n\t */\n\tBASE_URL: \"https://api.nvisy.com\",\n\n\t/**\n\t * Default user agent string.\n\t */\n\tUSER_AGENT: `@nvisy/sdk v.${VERSION}`,\n} as const;\n","import type { Middleware } from \"openapi-fetch\";\nimport type { ErrorResponse } from \"@/datatypes/index.js\";\nimport { NvisyApiError, NvisyError } from \"@/errors.js\";\n\n/**\n * Middleware that automatically throws NvisyApiError for error responses.\n * This replaces the need for manual checks in services.\n */\nexport const errorMiddleware: Middleware = {\n\tasync onResponse({ response }) {\n\t\tif (!response.ok) {\n\t\t\tconst error = (await response.clone().json()) as ErrorResponse;\n\t\t\tthrow new NvisyApiError(error, response.status);\n\t\t}\n\t\treturn response;\n\t},\n\n\tonError({ error }) {\n\t\t// Wrap fetch errors (network failures, CORS, etc.) in NvisyError\n\t\tif (error instanceof Error) {\n\t\t\tthrow new NvisyError(error.message);\n\t\t}\n\t\tthrow new NvisyError(\"An unknown network error occurred\");\n\t},\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAcA,MAAa,UAAU;;;;AAwEvB,MAAa,WAAW;;;;CAIvB,UAAU;;;;CAKV,YAAY,gBAAgB;AAC7B;;;;;;;;ACxFA,MAAa,kBAA8B;CAC1C,MAAM,WAAW,EAAE,YAAY;EAC9B,IAAI,CAAC,SAAS,IAEb,MAAM,IAAI,cAAc,MADH,SAAS,MAAM,CAAC,CAAC,KAAK,GACZ,SAAS,MAAM;EAE/C,OAAO;CACR;CAEA,QAAQ,EAAE,SAAS;EAElB,IAAI,iBAAiB,OACpB,MAAM,IAAI,WAAW,MAAM,OAAO;EAEnC,MAAM,IAAI,WAAW,mCAAmC;CACzD;AACD"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { n as DEFAULTS, r as VERSION, t as ClientConfig } from "./config-BRQp8Cat.js";
1
+ import { n as DEFAULTS, r as VERSION, t as ClientConfig } from "./config-BwallLvT.js";
2
2
  import { Cn as ErrorResponse } from "./index-4U5Gmd2p.js";
3
- import { n as Nvisy, t as ApiClient } from "./client-CHOXZ85T.js";
3
+ import { n as Nvisy, t as ApiClient } from "./client-Cf7RgQwY.js";
4
4
  import { n as NvisyError, t as NvisyApiError } from "./errors-ztO85t_k.js";
5
5
  export { type ApiClient, type ClientConfig, DEFAULTS, type ErrorResponse, Nvisy, NvisyApiError, NvisyError, VERSION };
package/dist/index.js CHANGED
@@ -100,7 +100,8 @@ var Nvisy = class Nvisy {
100
100
  baseUrl: config.baseUrl ?? DEFAULTS.BASE_URL,
101
101
  headers: config.headers ?? {},
102
102
  userAgent: config.userAgent ?? DEFAULTS.USER_AGENT,
103
- withLogging: config.withLogging ?? false
103
+ withLogging: config.withLogging ?? false,
104
+ fetch: config.fetch
104
105
  };
105
106
  this.#api = this.#createApiClient();
106
107
  }
@@ -119,7 +120,8 @@ var Nvisy = class Nvisy {
119
120
  };
120
121
  const api = createClient({
121
122
  baseUrl: this.#config.baseUrl,
122
- headers
123
+ headers,
124
+ fetch: this.#config.fetch
123
125
  });
124
126
  if (this.#config.withLogging) api.use(createLoggingMiddleware());
125
127
  api.use(errorMiddleware);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["#config","#api","#validateApiToken","#createApiClient"],"sources":["../src/middleware/logging.ts","../src/client.ts"],"sourcesContent":["import type { Middleware } from \"openapi-fetch\";\n\n/**\n * Creates a logging middleware for debugging requests and responses.\n *\n * Logs request method, URL, response status, and timing to console.\n */\nexport function createLoggingMiddleware(): Middleware {\n\treturn {\n\t\tasync onRequest({ request }) {\n\t\t\tconst start = performance.now();\n\t\t\t(request as Request & { _startTime?: number })._startTime = start;\n\t\t\treturn request;\n\t\t},\n\n\t\tasync onResponse({ request, response }) {\n\t\t\tconst start =\n\t\t\t\t(request as Request & { _startTime?: number })._startTime ??\n\t\t\t\tperformance.now();\n\t\t\tconst duration = Math.round(performance.now() - start);\n\t\t\tconst url = new URL(request.url);\n\n\t\t\tconsole.log(\n\t\t\t\t`[nvisy] ${request.method} ${url.pathname} ${response.status} (${duration}ms)`,\n\t\t\t);\n\n\t\t\tif (!response.ok) {\n\t\t\t\tconst cloned = response.clone();\n\t\t\t\ttry {\n\t\t\t\t\tconst body = await cloned.json();\n\t\t\t\t\tconsole.error(\"[nvisy] Response:\", JSON.stringify(body, null, 2));\n\t\t\t\t} catch {\n\t\t\t\t\tconst text = await cloned.text();\n\t\t\t\t\tif (text) console.error(\"[nvisy] Response:\", text);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn response;\n\t\t},\n\n\t\tonError({ request, error }) {\n\t\t\tconst start =\n\t\t\t\t(request as Request & { _startTime?: number })._startTime ??\n\t\t\t\tperformance.now();\n\t\t\tconst duration = Math.round(performance.now() - start);\n\t\t\tconst url = new URL(request.url);\n\n\t\t\tconsole.error(\n\t\t\t\t`[nvisy] ${request.method} ${url.pathname} ERROR (${duration}ms):`,\n\t\t\t\terror instanceof Error ? error.message : error,\n\t\t\t);\n\t\t},\n\t};\n}\n","/**\n * @fileoverview Main client for the Nvisy SDK.\n *\n * This module exports the {@link Nvisy} class, which is the primary entry point\n * for interacting with the Nvisy document processing API.\n *\n * @module client\n *\n * @example\n * ```typescript\n * const nvisy = new Nvisy({ apiToken: \"your-api-token\" });\n * const account = await nvisy.account.getAccount();\n * ```\n */\n\nimport createClient, { type Client as OpenApiClient } from \"openapi-fetch\";\nimport { type ClientConfig, DEFAULTS } from \"@/config.js\";\nimport { NvisyError } from \"@/errors.js\";\nimport {\n\tcreateLoggingMiddleware,\n\terrorMiddleware,\n} from \"@/middleware/index.js\";\nimport type { paths } from \"@/schema/api.js\";\nimport {\n\tAccount,\n\tActivities,\n\tApiTokens,\n\tAuth,\n\tCatalog,\n\tConnections,\n\tFiles,\n\tInvites,\n\tMembers,\n\tNotifications,\n\tPipelines,\n\tPolicies,\n\tRuns,\n\tStatus,\n\tSyncs,\n\tWebhooks,\n\tWorkspaces,\n} from \"@/services/index.js\";\n\n/**\n * Typed openapi-fetch client for the Nvisy API.\n *\n * This type represents the low-level HTTP client configured with the Nvisy API schema.\n * It's exposed via {@link Nvisy.api} for advanced use cases requiring direct API access.\n */\nexport type ApiClient = OpenApiClient<paths>;\n\n/**\n * Internal configuration state for the client with all fields resolved.\n *\n * @internal\n */\ntype ResolvedConfig = Required<ClientConfig>;\n\n/**\n * Main client class for interacting with the Nvisy document processing API.\n *\n * @example\n * ```typescript\n * const nvisy = new Nvisy({ apiToken: \"your-api-token\" });\n * const account = await nvisy.account.getAccount();\n * const workspaces = await nvisy.workspaces.listWorkspaces();\n * ```\n */\nexport class Nvisy {\n\t/**\n\t * The resolved client configuration with defaults applied.\n\t * @internal\n\t */\n\treadonly #config: ResolvedConfig;\n\n\t/**\n\t * The underlying openapi-fetch client instance.\n\t * @internal\n\t */\n\treadonly #api: ApiClient;\n\n\t/**\n\t * Creates a new Nvisy client instance.\n\t *\n\t * @param config - Configuration options with required `apiToken`\n\t * @throws {NvisyError} If the API token is invalid\n\t *\n\t * @example\n\t * ```typescript\n\t * const nvisy = new Nvisy({\n\t * apiToken: \"your-api-token\",\n\t * baseUrl: \"https://custom.api.nvisy.com\",\n\t * });\n\t * const account = await nvisy.account.getAccount();\n\t * ```\n\t */\n\tconstructor(config: ClientConfig) {\n\t\tconst validatedToken = this.#validateApiToken(config.apiToken);\n\n\t\tthis.#config = {\n\t\t\tapiToken: validatedToken,\n\t\t\tbaseUrl: config.baseUrl ?? DEFAULTS.BASE_URL,\n\t\t\theaders: config.headers ?? {},\n\t\t\tuserAgent: config.userAgent ?? DEFAULTS.USER_AGENT,\n\t\t\twithLogging: config.withLogging ?? false,\n\t\t};\n\n\t\tthis.#api = this.#createApiClient();\n\t}\n\n\t/**\n\t * Creates and configures the underlying openapi-fetch client.\n\t *\n\t * @returns A configured ApiClient instance\n\t * @internal\n\t */\n\t#createApiClient(): ApiClient {\n\t\tconst headers: Record<string, string> = {\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\"User-Agent\": this.#config.userAgent,\n\t\t\tAuthorization: `Bearer ${this.#config.apiToken}`,\n\t\t\t...this.#config.headers,\n\t\t};\n\n\t\tconst api = createClient<paths>({\n\t\t\tbaseUrl: this.#config.baseUrl,\n\t\t\theaders,\n\t\t});\n\n\t\tif (this.#config.withLogging) {\n\t\t\tapi.use(createLoggingMiddleware());\n\t\t}\n\n\t\tapi.use(errorMiddleware);\n\t\treturn api;\n\t}\n\n\t/**\n\t * Validates an API token format.\n\t *\n\t * @param apiToken - The API token to validate\n\t * @returns The trimmed API token if valid\n\t * @throws {NvisyError} If the API token is invalid\n\t * @internal\n\t */\n\t#validateApiToken(apiToken: string): string {\n\t\tif (typeof apiToken !== \"string\" || apiToken.trim().length === 0) {\n\t\t\tthrow new NvisyError(\"API token must be a non-empty string\");\n\t\t}\n\n\t\tconst trimmedToken = apiToken.trim();\n\t\tif (trimmedToken.length < 10) {\n\t\t\tthrow new NvisyError(\"API token must be at least 10 characters\");\n\t\t}\n\n\t\tif (!/^[a-zA-Z0-9_.-]+$/.test(trimmedToken)) {\n\t\t\tthrow new NvisyError(\"API token contains invalid characters\");\n\t\t}\n\n\t\treturn trimmedToken;\n\t}\n\n\t/**\n\t * Creates a new client with a different API token.\n\t *\n\t * Returns a new client instance with the new token. The original client\n\t * remains unchanged. All other configuration (base URL, headers, etc.)\n\t * is preserved in the new client.\n\t *\n\t * @param apiToken - The new API token\n\t * @returns A new Nvisy instance with the new token\n\t * @throws {NvisyError} If the API token is invalid\n\t *\n\t * @example\n\t * ```typescript\n\t * const nvisy = new Nvisy({ apiToken: \"original-token\" });\n\t * const newNvisy = nvisy.withApiToken(\"new-token\");\n\t *\n\t * // newNvisy uses the new token\n\t * // nvisy still uses the original token\n\t * ```\n\t */\n\twithApiToken(apiToken: string): Nvisy {\n\t\treturn new Nvisy({ ...this.#config, apiToken });\n\t}\n\n\t/**\n\t * The base URL used for API requests.\n\t *\n\t * @returns The configured base URL\n\t */\n\tget baseUrl(): string {\n\t\treturn this.#config.baseUrl;\n\t}\n\n\t/**\n\t * The underlying openapi-fetch client for direct API access.\n\t *\n\t * Use this for advanced scenarios where you need direct access to the\n\t * HTTP client, such as calling endpoints not covered by the service classes.\n\t *\n\t * @returns The configured ApiClient instance\n\t */\n\tget api(): ApiClient {\n\t\treturn this.#api;\n\t}\n\n\t/**\n\t * Service for authentication operations (login, signup, logout).\n\t */\n\tget auth(): Auth {\n\t\treturn new Auth(this.#api);\n\t}\n\n\t/**\n\t * Service for API status and health checks.\n\t */\n\tget status(): Status {\n\t\treturn new Status(this.#api);\n\t}\n\n\t/**\n\t * Service for managing the authenticated user's account.\n\t */\n\tget account(): Account {\n\t\treturn new Account(this.#api);\n\t}\n\n\t/**\n\t * Service for viewing workspace activities.\n\t */\n\tget activities(): Activities {\n\t\treturn new Activities(this.#api);\n\t}\n\n\t/**\n\t * Service for managing API tokens.\n\t */\n\tget apiTokens(): ApiTokens {\n\t\treturn new ApiTokens(this.#api);\n\t}\n\n\t/**\n\t * Service for managing connections.\n\t */\n\tget connections(): Connections {\n\t\treturn new Connections(this.#api);\n\t}\n\n\t/**\n\t * Service for file operations (upload, download, delete).\n\t */\n\tget files(): Files {\n\t\treturn new Files(this.#api);\n\t}\n\n\t/**\n\t * Service for managing pipelines.\n\t */\n\tget pipelines(): Pipelines {\n\t\treturn new Pipelines(this.#api);\n\t}\n\n\t/**\n\t * Service for managing policies.\n\t */\n\tget policies(): Policies {\n\t\treturn new Policies(this.#api);\n\t}\n\n\t/**\n\t * Service for reading the deployment's label and recognizer catalogs.\n\t */\n\tget catalog(): Catalog {\n\t\treturn new Catalog(this.#api);\n\t}\n\n\t/**\n\t * Service for managing workspace invitations.\n\t */\n\tget invites(): Invites {\n\t\treturn new Invites(this.#api);\n\t}\n\n\t/**\n\t * Service for managing workspace members.\n\t */\n\tget members(): Members {\n\t\treturn new Members(this.#api);\n\t}\n\n\t/**\n\t * Service for managing notifications.\n\t */\n\tget notifications(): Notifications {\n\t\treturn new Notifications(this.#api);\n\t}\n\n\t/**\n\t * Service for managing pipeline runs.\n\t */\n\tget runs(): Runs {\n\t\treturn new Runs(this.#api);\n\t}\n\n\t/**\n\t * Service for managing connection syncs.\n\t */\n\tget syncs(): Syncs {\n\t\treturn new Syncs(this.#api);\n\t}\n\n\t/**\n\t * Service for managing webhooks.\n\t */\n\tget webhooks(): Webhooks {\n\t\treturn new Webhooks(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5B;;;;CAKA,IAAI,UAAmB;EACtB,OAAO,IAAI,QAAQ,KAAKA,IAAI;CAC7B;;;;CAKA,IAAI,aAAyB;EAC5B,OAAO,IAAI,WAAW,KAAKA,IAAI;CAChC;;;;CAKA,IAAI,YAAuB;EAC1B,OAAO,IAAI,UAAU,KAAKA,IAAI;CAC/B;;;;CAKA,IAAI,cAA2B;EAC9B,OAAO,IAAI,YAAY,KAAKA,IAAI;CACjC;;;;CAKA,IAAI,QAAe;EAClB,OAAO,IAAI,MAAM,KAAKA,IAAI;CAC3B;;;;CAKA,IAAI,YAAuB;EAC1B,OAAO,IAAI,UAAU,KAAKA,IAAI;CAC/B;;;;CAKA,IAAI,WAAqB;EACxB,OAAO,IAAI,SAAS,KAAKA,IAAI;CAC9B;;;;CAKA,IAAI,UAAmB;EACtB,OAAO,IAAI,QAAQ,KAAKA,IAAI;CAC7B;;;;CAKA,IAAI,UAAmB;EACtB,OAAO,IAAI,QAAQ,KAAKA,IAAI;CAC7B;;;;CAKA,IAAI,UAAmB;EACtB,OAAO,IAAI,QAAQ,KAAKA,IAAI;CAC7B;;;;CAKA,IAAI,gBAA+B;EAClC,OAAO,IAAI,cAAc,KAAKA,IAAI;CACnC;;;;CAKA,IAAI,OAAa;EAChB,OAAO,IAAI,KAAK,KAAKA,IAAI;CAC1B;;;;CAKA,IAAI,QAAe;EAClB,OAAO,IAAI,MAAM,KAAKA,IAAI;CAC3B;;;;CAKA,IAAI,WAAqB;EACxB,OAAO,IAAI,SAAS,KAAKA,IAAI;CAC9B;;;;CAKA,IAAI,aAAyB;EAC5B,OAAO,IAAI,WAAW,KAAKA,IAAI;CAChC;AACD"}
1
+ {"version":3,"file":"index.js","names":["#config","#api","#validateApiToken","#createApiClient"],"sources":["../src/middleware/logging.ts","../src/client.ts"],"sourcesContent":["import type { Middleware } from \"openapi-fetch\";\n\n/**\n * Creates a logging middleware for debugging requests and responses.\n *\n * Logs request method, URL, response status, and timing to console.\n */\nexport function createLoggingMiddleware(): Middleware {\n\treturn {\n\t\tasync onRequest({ request }) {\n\t\t\tconst start = performance.now();\n\t\t\t(request as Request & { _startTime?: number })._startTime = start;\n\t\t\treturn request;\n\t\t},\n\n\t\tasync onResponse({ request, response }) {\n\t\t\tconst start =\n\t\t\t\t(request as Request & { _startTime?: number })._startTime ??\n\t\t\t\tperformance.now();\n\t\t\tconst duration = Math.round(performance.now() - start);\n\t\t\tconst url = new URL(request.url);\n\n\t\t\tconsole.log(\n\t\t\t\t`[nvisy] ${request.method} ${url.pathname} ${response.status} (${duration}ms)`,\n\t\t\t);\n\n\t\t\tif (!response.ok) {\n\t\t\t\tconst cloned = response.clone();\n\t\t\t\ttry {\n\t\t\t\t\tconst body = await cloned.json();\n\t\t\t\t\tconsole.error(\"[nvisy] Response:\", JSON.stringify(body, null, 2));\n\t\t\t\t} catch {\n\t\t\t\t\tconst text = await cloned.text();\n\t\t\t\t\tif (text) console.error(\"[nvisy] Response:\", text);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn response;\n\t\t},\n\n\t\tonError({ request, error }) {\n\t\t\tconst start =\n\t\t\t\t(request as Request & { _startTime?: number })._startTime ??\n\t\t\t\tperformance.now();\n\t\t\tconst duration = Math.round(performance.now() - start);\n\t\t\tconst url = new URL(request.url);\n\n\t\t\tconsole.error(\n\t\t\t\t`[nvisy] ${request.method} ${url.pathname} ERROR (${duration}ms):`,\n\t\t\t\terror instanceof Error ? error.message : error,\n\t\t\t);\n\t\t},\n\t};\n}\n","/**\n * @fileoverview Main client for the Nvisy SDK.\n *\n * This module exports the {@link Nvisy} class, which is the primary entry point\n * for interacting with the Nvisy document processing API.\n *\n * @module client\n *\n * @example\n * ```typescript\n * const nvisy = new Nvisy({ apiToken: \"your-api-token\" });\n * const account = await nvisy.account.getAccount();\n * ```\n */\n\nimport createClient, { type Client as OpenApiClient } from \"openapi-fetch\";\nimport { type ClientConfig, DEFAULTS } from \"@/config.js\";\nimport { NvisyError } from \"@/errors.js\";\nimport {\n\tcreateLoggingMiddleware,\n\terrorMiddleware,\n} from \"@/middleware/index.js\";\nimport type { paths } from \"@/schema/api.js\";\nimport {\n\tAccount,\n\tActivities,\n\tApiTokens,\n\tAuth,\n\tCatalog,\n\tConnections,\n\tFiles,\n\tInvites,\n\tMembers,\n\tNotifications,\n\tPipelines,\n\tPolicies,\n\tRuns,\n\tStatus,\n\tSyncs,\n\tWebhooks,\n\tWorkspaces,\n} from \"@/services/index.js\";\n\n/**\n * Typed openapi-fetch client for the Nvisy API.\n *\n * This type represents the low-level HTTP client configured with the Nvisy API schema.\n * It's exposed via {@link Nvisy.api} for advanced use cases requiring direct API access.\n */\nexport type ApiClient = OpenApiClient<paths>;\n\n/**\n * Internal configuration state for the client with all fields resolved.\n *\n * @internal\n */\n// `fetch` stays optional after resolution — an omitted value means \"use the\n// global fetch\", which openapi-fetch handles when `fetch: undefined` is passed.\ntype ResolvedConfig = Required<Omit<ClientConfig, \"fetch\">> &\n\tPick<ClientConfig, \"fetch\">;\n\n/**\n * Main client class for interacting with the Nvisy document processing API.\n *\n * @example\n * ```typescript\n * const nvisy = new Nvisy({ apiToken: \"your-api-token\" });\n * const account = await nvisy.account.getAccount();\n * const workspaces = await nvisy.workspaces.listWorkspaces();\n * ```\n */\nexport class Nvisy {\n\t/**\n\t * The resolved client configuration with defaults applied.\n\t * @internal\n\t */\n\treadonly #config: ResolvedConfig;\n\n\t/**\n\t * The underlying openapi-fetch client instance.\n\t * @internal\n\t */\n\treadonly #api: ApiClient;\n\n\t/**\n\t * Creates a new Nvisy client instance.\n\t *\n\t * @param config - Configuration options with required `apiToken`\n\t * @throws {NvisyError} If the API token is invalid\n\t *\n\t * @example\n\t * ```typescript\n\t * const nvisy = new Nvisy({\n\t * apiToken: \"your-api-token\",\n\t * baseUrl: \"https://custom.api.nvisy.com\",\n\t * });\n\t * const account = await nvisy.account.getAccount();\n\t * ```\n\t */\n\tconstructor(config: ClientConfig) {\n\t\tconst validatedToken = this.#validateApiToken(config.apiToken);\n\n\t\tthis.#config = {\n\t\t\tapiToken: validatedToken,\n\t\t\tbaseUrl: config.baseUrl ?? DEFAULTS.BASE_URL,\n\t\t\theaders: config.headers ?? {},\n\t\t\tuserAgent: config.userAgent ?? DEFAULTS.USER_AGENT,\n\t\t\twithLogging: config.withLogging ?? false,\n\t\t\tfetch: config.fetch,\n\t\t};\n\n\t\tthis.#api = this.#createApiClient();\n\t}\n\n\t/**\n\t * Creates and configures the underlying openapi-fetch client.\n\t *\n\t * @returns A configured ApiClient instance\n\t * @internal\n\t */\n\t#createApiClient(): ApiClient {\n\t\tconst headers: Record<string, string> = {\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\"User-Agent\": this.#config.userAgent,\n\t\t\tAuthorization: `Bearer ${this.#config.apiToken}`,\n\t\t\t...this.#config.headers,\n\t\t};\n\n\t\tconst api = createClient<paths>({\n\t\t\tbaseUrl: this.#config.baseUrl,\n\t\t\theaders,\n\t\t\t// `undefined` falls back to the global fetch inside openapi-fetch.\n\t\t\tfetch: this.#config.fetch,\n\t\t});\n\n\t\tif (this.#config.withLogging) {\n\t\t\tapi.use(createLoggingMiddleware());\n\t\t}\n\n\t\tapi.use(errorMiddleware);\n\t\treturn api;\n\t}\n\n\t/**\n\t * Validates an API token format.\n\t *\n\t * @param apiToken - The API token to validate\n\t * @returns The trimmed API token if valid\n\t * @throws {NvisyError} If the API token is invalid\n\t * @internal\n\t */\n\t#validateApiToken(apiToken: string): string {\n\t\tif (typeof apiToken !== \"string\" || apiToken.trim().length === 0) {\n\t\t\tthrow new NvisyError(\"API token must be a non-empty string\");\n\t\t}\n\n\t\tconst trimmedToken = apiToken.trim();\n\t\tif (trimmedToken.length < 10) {\n\t\t\tthrow new NvisyError(\"API token must be at least 10 characters\");\n\t\t}\n\n\t\tif (!/^[a-zA-Z0-9_.-]+$/.test(trimmedToken)) {\n\t\t\tthrow new NvisyError(\"API token contains invalid characters\");\n\t\t}\n\n\t\treturn trimmedToken;\n\t}\n\n\t/**\n\t * Creates a new client with a different API token.\n\t *\n\t * Returns a new client instance with the new token. The original client\n\t * remains unchanged. All other configuration (base URL, headers, etc.)\n\t * is preserved in the new client.\n\t *\n\t * @param apiToken - The new API token\n\t * @returns A new Nvisy instance with the new token\n\t * @throws {NvisyError} If the API token is invalid\n\t *\n\t * @example\n\t * ```typescript\n\t * const nvisy = new Nvisy({ apiToken: \"original-token\" });\n\t * const newNvisy = nvisy.withApiToken(\"new-token\");\n\t *\n\t * // newNvisy uses the new token\n\t * // nvisy still uses the original token\n\t * ```\n\t */\n\twithApiToken(apiToken: string): Nvisy {\n\t\treturn new Nvisy({ ...this.#config, apiToken });\n\t}\n\n\t/**\n\t * The base URL used for API requests.\n\t *\n\t * @returns The configured base URL\n\t */\n\tget baseUrl(): string {\n\t\treturn this.#config.baseUrl;\n\t}\n\n\t/**\n\t * The underlying openapi-fetch client for direct API access.\n\t *\n\t * Use this for advanced scenarios where you need direct access to the\n\t * HTTP client, such as calling endpoints not covered by the service classes.\n\t *\n\t * @returns The configured ApiClient instance\n\t */\n\tget api(): ApiClient {\n\t\treturn this.#api;\n\t}\n\n\t/**\n\t * Service for authentication operations (login, signup, logout).\n\t */\n\tget auth(): Auth {\n\t\treturn new Auth(this.#api);\n\t}\n\n\t/**\n\t * Service for API status and health checks.\n\t */\n\tget status(): Status {\n\t\treturn new Status(this.#api);\n\t}\n\n\t/**\n\t * Service for managing the authenticated user's account.\n\t */\n\tget account(): Account {\n\t\treturn new Account(this.#api);\n\t}\n\n\t/**\n\t * Service for viewing workspace activities.\n\t */\n\tget activities(): Activities {\n\t\treturn new Activities(this.#api);\n\t}\n\n\t/**\n\t * Service for managing API tokens.\n\t */\n\tget apiTokens(): ApiTokens {\n\t\treturn new ApiTokens(this.#api);\n\t}\n\n\t/**\n\t * Service for managing connections.\n\t */\n\tget connections(): Connections {\n\t\treturn new Connections(this.#api);\n\t}\n\n\t/**\n\t * Service for file operations (upload, download, delete).\n\t */\n\tget files(): Files {\n\t\treturn new Files(this.#api);\n\t}\n\n\t/**\n\t * Service for managing pipelines.\n\t */\n\tget pipelines(): Pipelines {\n\t\treturn new Pipelines(this.#api);\n\t}\n\n\t/**\n\t * Service for managing policies.\n\t */\n\tget policies(): Policies {\n\t\treturn new Policies(this.#api);\n\t}\n\n\t/**\n\t * Service for reading the deployment's label and recognizer catalogs.\n\t */\n\tget catalog(): Catalog {\n\t\treturn new Catalog(this.#api);\n\t}\n\n\t/**\n\t * Service for managing workspace invitations.\n\t */\n\tget invites(): Invites {\n\t\treturn new Invites(this.#api);\n\t}\n\n\t/**\n\t * Service for managing workspace members.\n\t */\n\tget members(): Members {\n\t\treturn new Members(this.#api);\n\t}\n\n\t/**\n\t * Service for managing notifications.\n\t */\n\tget notifications(): Notifications {\n\t\treturn new Notifications(this.#api);\n\t}\n\n\t/**\n\t * Service for managing pipeline runs.\n\t */\n\tget runs(): Runs {\n\t\treturn new Runs(this.#api);\n\t}\n\n\t/**\n\t * Service for managing connection syncs.\n\t */\n\tget syncs(): Syncs {\n\t\treturn new Syncs(this.#api);\n\t}\n\n\t/**\n\t * Service for managing webhooks.\n\t */\n\tget webhooks(): Webhooks {\n\t\treturn new Webhooks(this.#api);\n\t}\n\n\t/**\n\t * Service for managing workspaces.\n\t */\n\tget workspaces(): Workspaces {\n\t\treturn new Workspaces(this.#api);\n\t}\n}\n"],"mappings":";;;;;;;;;;;AAOA,SAAgB,0BAAsC;CACrD,OAAO;EACN,MAAM,UAAU,EAAE,WAAW;GAE5B,AAAC,QAA8C,aADjC,YAAY,IACsC;GAChE,OAAO;EACR;EAEA,MAAM,WAAW,EAAE,SAAS,YAAY;GACvC,MAAM,QACJ,QAA8C,cAC/C,YAAY,IAAI;GACjB,MAAM,WAAW,KAAK,MAAM,YAAY,IAAI,IAAI,KAAK;GACrD,MAAM,MAAM,IAAI,IAAI,QAAQ,GAAG;GAE/B,QAAQ,IACP,WAAW,QAAQ,OAAO,GAAG,IAAI,SAAS,GAAG,SAAS,OAAO,IAAI,SAAS,I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A,IAAI;CAC9B;;;;CAKA,IAAI,UAAmB;EACtB,OAAO,IAAI,QAAQ,KAAKA,IAAI;CAC7B;;;;CAKA,IAAI,UAAmB;EACtB,OAAO,IAAI,QAAQ,KAAKA,IAAI;CAC7B;;;;CAKA,IAAI,UAAmB;EACtB,OAAO,IAAI,QAAQ,KAAKA,IAAI;CAC7B;;;;CAKA,IAAI,gBAA+B;EAClC,OAAO,IAAI,cAAc,KAAKA,IAAI;CACnC;;;;CAKA,IAAI,OAAa;EAChB,OAAO,IAAI,KAAK,KAAKA,IAAI;CAC1B;;;;CAKA,IAAI,QAAe;EAClB,OAAO,IAAI,MAAM,KAAKA,IAAI;CAC3B;;;;CAKA,IAAI,WAAqB;EACxB,OAAO,IAAI,SAAS,KAAKA,IAAI;CAC9B;;;;CAKA,IAAI,aAAyB;EAC5B,OAAO,IAAI,WAAW,KAAKA,IAAI;CAChC;AACD"}
@@ -1,2 +1,2 @@
1
- import { _ as ApiTokens, a as Syncs, c as Policies, d as Members, f as Invites, g as Auth, h as Catalog, i as Webhooks, l as Pipelines, m as Connections, o as Status, p as Files, r as Workspaces, s as Runs, u as Notifications, v as Activities, y as Account } from "../client-CHOXZ85T.js";
1
+ import { _ as ApiTokens, a as Syncs, c as Policies, d as Members, f as Invites, g as Auth, h as Catalog, i as Webhooks, l as Pipelines, m as Connections, o as Status, p as Files, r as Workspaces, s as Runs, u as Notifications, v as Activities, y as Account } from "../client-Cf7RgQwY.js";
2
2
  export { Account, Activities, ApiTokens, Auth, Catalog, Connections, Files, Invites, Members, Notifications, Pipelines, Policies, Runs, Status, Syncs, Webhooks, Workspaces };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nvisy/sdk",
3
- "version": "0.29.0",
3
+ "version": "0.30.0",
4
4
  "description": "Official TypeScript SDK for Nvisy document processing platform",
5
5
  "type": "module",
6
6
  "private": false,