@nvisy/sdk 0.54.0 → 0.55.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,21 @@ and this project adheres to
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [0.55.0] - 2026-09-15
12
+
13
+ ### Changed
14
+
15
+ - **Breaking:** the authenticated `Nvisy` client now authenticates explicitly
16
+ with either `apiToken` or `session: true` (mutually exclusive at the type
17
+ level). `session: true` uses the browser cookie session established by the
18
+ guest client's login / signup and sends credentialed requests automatically
19
+ (`credentials: "include"`). This restores driving the full authenticated API
20
+ from a browser session, which the 0.54.0 apiToken-required change had removed
21
+ - **Breaking:** the client config types are renamed for consistency:
22
+ `ClientConfig` / `NvisyConfig` → `NvisyOptions` (the authenticated client) and
23
+ `NvisyGuestOptions` (the guest client, transport-only). The `GuestConfig` alias
24
+ is removed — `NvisyGuest` takes `NvisyGuestOptions`
25
+
11
26
  ## [0.54.0] - 2026-09-15
12
27
 
13
28
  ### Added
@@ -1186,7 +1201,8 @@ redaction an independent resource. This release renames the SDK to match.
1186
1201
  - Network error handling for timeouts, DNS resolution, and connection issues
1187
1202
  - Configuration validation with detailed error messages
1188
1203
 
1189
- [Unreleased]: https://github.com/nvisycom/sdk-ts/compare/v0.54.0...HEAD
1204
+ [Unreleased]: https://github.com/nvisycom/sdk-ts/compare/v0.55.0...HEAD
1205
+ [0.55.0]: https://github.com/nvisycom/sdk-ts/compare/v0.54.0...v0.55.0
1190
1206
  [0.54.0]: https://github.com/nvisycom/sdk-ts/compare/v0.53.0...v0.54.0
1191
1207
  [0.53.0]: https://github.com/nvisycom/sdk-ts/compare/v0.52.0...v0.53.0
1192
1208
  [0.52.0]: https://github.com/nvisycom/sdk-ts/compare/v0.51.0...v0.52.0
@@ -1,14 +1,11 @@
1
- import { D as ClientConfig, E as ApiClient, a as Status, h as GuestAuth, m as GuestCapabilities } from "../index-DFbHT_eq.js";
1
+ import { E as ApiClient, O as NvisyGuestOptions, a as Status, h as GuestAuth, m as GuestCapabilities } from "../index-CuKzO8Ly.js";
2
2
  //#region src/guest/client.d.ts
3
- /**
4
- * Configuration for {@link NvisyGuest}. Same as {@link ClientConfig} but without
5
- * `apiToken` — a guest client never authenticates with a bearer token. Pass
6
- * `credentials: "include"` to send the session cookies set by login / signup.
7
- */
8
- type GuestConfig = Omit<ClientConfig, "apiToken">;
9
3
  /**
10
4
  * Pre-auth Nvisy client. Wraps a token-less {@link ApiClient} and exposes the
11
- * public surface: {@link GuestAuth}, {@link Capabilities}, and {@link Status}.
5
+ * public surface: {@link GuestAuth}, {@link GuestCapabilities}, and
6
+ * {@link Status}. Configured with the shared {@link NvisyGuestOptions} (no auth); a
7
+ * guest client never sends a token. Pass `credentials: "include"` to send the
8
+ * session cookies set by login / signup on a cross-origin app.
12
9
  */
13
10
  export declare class NvisyGuest {
14
11
  #private;
@@ -18,7 +15,7 @@ export declare class NvisyGuest {
18
15
  * @param config - Optional configuration (baseUrl, credentials, headers,
19
16
  * userAgent, fetch)
20
17
  */
21
- constructor(config?: GuestConfig);
18
+ constructor(config?: NvisyGuestOptions);
22
19
  /** The base URL used for API requests. */
23
20
  get baseUrl(): string;
24
21
  /** The underlying openapi-fetch client for direct API access. */
@@ -34,5 +31,5 @@ export declare class NvisyGuest {
34
31
  get health(): Status;
35
32
  }
36
33
  //#endregion
37
- export type { GuestConfig };
34
+ export type { NvisyGuestOptions };
38
35
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/guest/client.ts"],"mappings":";;;;;;;KA6BY,cAAc,KAAK;;;;;qBAMlB;;;;;;;;EAaA,YAAA,SAAQ;;MAWhB;;MAKA,OAAO;;MAKP,QAAQ;;;;;MAQR,gBAAgB;;MAKhB,UAAU"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/guest/client.ts"],"mappings":";;;;;;;;;qBA+Ba;;;;;;;;EAaA,YAAA,SAAQ;;MAWhB;;MAKA,OAAO;;MAKP,QAAQ;;;;;MAQR,gBAAgB;;MAKhB,UAAU"}
@@ -1,10 +1,13 @@
1
- import { n as resolveDefaults, t as createApiClient } from "../http-BexRclA5.js";
1
+ import { n as resolveDefaults, t as createApiClient } from "../http-BRaKBzAA.js";
2
2
  import { a as Status, h as GuestAuth, m as GuestCapabilities } from "../services-BMmcawiT.js";
3
3
 
4
4
  //#region src/guest/client.ts
5
5
  /**
6
6
  * Pre-auth Nvisy client. Wraps a token-less {@link ApiClient} and exposes the
7
- * public surface: {@link GuestAuth}, {@link Capabilities}, and {@link Status}.
7
+ * public surface: {@link GuestAuth}, {@link GuestCapabilities}, and
8
+ * {@link Status}. Configured with the shared {@link NvisyGuestOptions} (no auth); a
9
+ * guest client never sends a token. Pass `credentials: "include"` to send the
10
+ * session cookies set by login / signup on a cross-origin app.
8
11
  */
9
12
  var NvisyGuest = class {
10
13
  /** The resolved base URL. @internal */
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/guest/client.ts"],"sourcesContent":["/**\n * @fileoverview The pre-auth (\"guest\") Nvisy client.\n *\n * {@link NvisyGuest} exposes only the endpoints that work without an API token:\n * sign-in (login / signup / OIDC start), the deployment's auth capabilities, and\n * health checks. Use it to power a login screen before anyone has authenticated;\n * for the authenticated API, use {@link Nvisy} from `@nvisy/sdk`.\n *\n * @module guest\n *\n * @example\n * ```typescript\n * import { NvisyGuest } from \"@nvisy/sdk/guest\";\n *\n * const guest = new NvisyGuest({ baseUrl: \"https://api.nvisy.com\" });\n * const auth = await guest.capabilities.getAuthCapabilities();\n * await guest.auth.loginAccount({ identifier: \"user@example.com\", password: \"...\" });\n * ```\n */\n\nimport type { ClientConfig } from \"@/config.js\";\nimport { type ApiClient, createApiClient, resolveDefaults } from \"@/http.js\";\nimport { GuestAuth, GuestCapabilities, Status } from \"@/services/index.js\";\n\n/**\n * Configuration for {@link NvisyGuest}. Same as {@link ClientConfig} but without\n * `apiToken` a guest client never authenticates with a bearer token. Pass\n * `credentials: \"include\"` to send the session cookies set by login / signup.\n */\nexport type GuestConfig = Omit<ClientConfig, \"apiToken\">;\n\n/**\n * Pre-auth Nvisy client. Wraps a token-less {@link ApiClient} and exposes the\n * public surface: {@link GuestAuth}, {@link Capabilities}, and {@link Status}.\n */\nexport class NvisyGuest {\n\t/** The resolved base URL. @internal */\n\treadonly #baseUrl: string;\n\n\t/** The underlying openapi-fetch client instance. @internal */\n\treadonly #api: ApiClient;\n\n\t/**\n\t * Creates a new pre-auth Nvisy client (no API token).\n\t *\n\t * @param config - Optional configuration (baseUrl, credentials, headers,\n\t * userAgent, fetch)\n\t */\n\tconstructor(config: GuestConfig = {}) {\n\t\tconst resolved = resolveDefaults(config);\n\t\tthis.#baseUrl = resolved.baseUrl;\n\t\tthis.#api = createApiClient({\n\t\t\tcredentials: config.credentials,\n\t\t\tfetch: config.fetch,\n\t\t\t...resolved,\n\t\t});\n\t}\n\n\t/** The base URL used for API requests. */\n\tget baseUrl(): string {\n\t\treturn this.#baseUrl;\n\t}\n\n\t/** The underlying openapi-fetch client for direct API access. */\n\tget api(): ApiClient {\n\t\treturn this.#api;\n\t}\n\n\t/** Pre-auth sign-in: login, signup, and OIDC start. */\n\tget auth(): GuestAuth {\n\t\treturn new GuestAuth(this.#api);\n\t}\n\n\t/**\n\t * The pre-auth capabilities read: `getAuthCapabilities()`. The label /\n\t * recognizer / connector reads require an authenticated {@link Nvisy} client.\n\t */\n\tget capabilities(): GuestCapabilities {\n\t\treturn new GuestCapabilities(this.#api);\n\t}\n\n\t/** Health checks (liveness / readiness). */\n\tget health(): Status {\n\t\treturn new Status(this.#api);\n\t}\n}\n"],"mappings":";;;;;;;;AAmCA,IAAa,aAAb,MAAwB;;CAEvB,AAAS;;CAGT,AAAS;;;;;;;CAQT,YAAY,SAAsB,CAAC,GAAG;EACrC,MAAM,WAAW,gBAAgB,MAAM;EACvC,KAAK,WAAW,SAAS;EACzB,KAAK,OAAO,gBAAgB;GAC3B,aAAa,OAAO;GACpB,OAAO,OAAO;GACd,GAAG;EACJ,CAAC;CACF;;CAGA,IAAI,UAAkB;EACrB,OAAO,KAAK;CACb;;CAGA,IAAI,MAAiB;EACpB,OAAO,KAAK;CACb;;CAGA,IAAI,OAAkB;EACrB,OAAO,IAAI,UAAU,KAAK,IAAI;CAC/B;;;;;CAMA,IAAI,eAAkC;EACrC,OAAO,IAAI,kBAAkB,KAAK,IAAI;CACvC;;CAGA,IAAI,SAAiB;EACpB,OAAO,IAAI,OAAO,KAAK,IAAI;CAC5B;AACD"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/guest/client.ts"],"sourcesContent":["/**\n * @fileoverview The pre-auth (\"guest\") Nvisy client.\n *\n * {@link NvisyGuest} exposes only the endpoints that work without an API token:\n * sign-in (login / signup / OIDC start), the deployment's auth capabilities, and\n * health checks. Use it to power a login screen before anyone has authenticated;\n * for the authenticated API, use {@link Nvisy} from `@nvisy/sdk`.\n *\n * @module guest\n *\n * @example\n * ```typescript\n * import { NvisyGuest } from \"@nvisy/sdk/guest\";\n *\n * const guest = new NvisyGuest({ baseUrl: \"https://api.nvisy.com\" });\n * const auth = await guest.capabilities.getAuthCapabilities();\n * await guest.auth.loginAccount({ identifier: \"user@example.com\", password: \"...\" });\n * ```\n */\n\nimport type { NvisyGuestOptions } from \"@/config.js\";\nimport { type ApiClient, createApiClient, resolveDefaults } from \"@/http.js\";\nimport { GuestAuth, GuestCapabilities, Status } from \"@/services/index.js\";\n\n/**\n * Pre-auth Nvisy client. Wraps a token-less {@link ApiClient} and exposes the\n * public surface: {@link GuestAuth}, {@link GuestCapabilities}, and\n * {@link Status}. Configured with the shared {@link NvisyGuestOptions} (no auth); a\n * guest client never sends a token. Pass `credentials: \"include\"` to send the\n * session cookies set by login / signup on a cross-origin app.\n */\nexport class NvisyGuest {\n\t/** The resolved base URL. @internal */\n\treadonly #baseUrl: string;\n\n\t/** The underlying openapi-fetch client instance. @internal */\n\treadonly #api: ApiClient;\n\n\t/**\n\t * Creates a new pre-auth Nvisy client (no API token).\n\t *\n\t * @param config - Optional configuration (baseUrl, credentials, headers,\n\t * userAgent, fetch)\n\t */\n\tconstructor(config: NvisyGuestOptions = {}) {\n\t\tconst resolved = resolveDefaults(config);\n\t\tthis.#baseUrl = resolved.baseUrl;\n\t\tthis.#api = createApiClient({\n\t\t\tcredentials: config.credentials,\n\t\t\tfetch: config.fetch,\n\t\t\t...resolved,\n\t\t});\n\t}\n\n\t/** The base URL used for API requests. */\n\tget baseUrl(): string {\n\t\treturn this.#baseUrl;\n\t}\n\n\t/** The underlying openapi-fetch client for direct API access. */\n\tget api(): ApiClient {\n\t\treturn this.#api;\n\t}\n\n\t/** Pre-auth sign-in: login, signup, and OIDC start. */\n\tget auth(): GuestAuth {\n\t\treturn new GuestAuth(this.#api);\n\t}\n\n\t/**\n\t * The pre-auth capabilities read: `getAuthCapabilities()`. The label /\n\t * recognizer / connector reads require an authenticated {@link Nvisy} client.\n\t */\n\tget capabilities(): GuestCapabilities {\n\t\treturn new GuestCapabilities(this.#api);\n\t}\n\n\t/** Health checks (liveness / readiness). */\n\tget health(): Status {\n\t\treturn new Status(this.#api);\n\t}\n}\n"],"mappings":";;;;;;;;;;;AA+BA,IAAa,aAAb,MAAwB;;CAEvB,AAAS;;CAGT,AAAS;;;;;;;CAQT,YAAY,SAA4B,CAAC,GAAG;EAC3C,MAAM,WAAW,gBAAgB,MAAM;EACvC,KAAK,WAAW,SAAS;EACzB,KAAK,OAAO,gBAAgB;GAC3B,aAAa,OAAO;GACpB,OAAO,OAAO;GACd,GAAG;EACJ,CAAC;CACF;;CAGA,IAAI,UAAkB;EACrB,OAAO,KAAK;CACb;;CAGA,IAAI,MAAiB;EACpB,OAAO,KAAK;CACb;;CAGA,IAAI,OAAkB;EACrB,OAAO,IAAI,UAAU,KAAK,IAAI;CAC/B;;;;;CAMA,IAAI,eAAkC;EACrC,OAAO,IAAI,kBAAkB,KAAK,IAAI;CACvC;;CAGA,IAAI,SAAiB;EACpB,OAAO,IAAI,OAAO,KAAK,IAAI;CAC5B;AACD"}
@@ -8,7 +8,7 @@ import createClient from "openapi-fetch";
8
8
  * Injected from `package.json` at build time, so it always matches the
9
9
  * published version. Used in the default user agent string.
10
10
  */
11
- const VERSION = "0.54.0";
11
+ const VERSION = "0.55.0";
12
12
  /**
13
13
  * Default configuration values used when options are not explicitly provided.
14
14
  */
@@ -125,4 +125,4 @@ function resolveDefaults(config) {
125
125
 
126
126
  //#endregion
127
127
  export { VERSION as i, resolveDefaults as n, DEFAULTS as r, createApiClient as t };
128
- //# sourceMappingURL=http-BexRclA5.js.map
128
+ //# sourceMappingURL=http-BRaKBzAA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-BRaKBzAA.js","names":[],"sources":["../src/config.ts","../src/middleware/error.ts","../src/middleware/logging.ts","../src/http.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 * Compile-time version token, replaced with the `package.json` version by the\n * build (see `tsdown.config.ts`). Declared so it type-checks; the `typeof`\n * guard below keeps it safe when the define isn't applied (tests, direct `tsc`).\n */\ndeclare const __SDK_VERSION__: string | undefined;\n\n/**\n * Current SDK version.\n *\n * Injected from `package.json` at build time, so it always matches the\n * published version. Used in the default user agent string.\n */\nexport const VERSION =\n\ttypeof __SDK_VERSION__ === \"string\" ? __SDK_VERSION__ : \"0.0.0-dev\";\n\n/**\n * Options for the pre-auth {@link NvisyGuest} client — the transport settings\n * shared by every client, with no authentication. All fields are optional and\n * use sensible defaults.\n */\nexport interface NvisyGuestOptions {\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 * Merged over the default headers (Content-Type, User-Agent, and, for token\n\t * auth, Authorization). Custom headers take precedence on conflict.\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 * Credentials mode forwarded to `fetch`. Session auth sets this to\n\t * `\"include\"` automatically; set it here only to override the transport\n\t * behaviour (e.g. a same-origin app that wants a different mode).\n\t */\n\tcredentials?: RequestCredentials;\n\n\t/**\n\t * Enable logging for requests and responses.\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 * Configuration for the authenticated {@link Nvisy} client. Authenticate one of\n * two ways, chosen explicitly:\n *\n * - `apiToken` — send an API token as `Authorization: Bearer <token>`.\n * - `session: true` — use the browser cookie session established by the guest\n * client's `login` / `signup`; requests are sent credentialed\n * (`credentials: \"include\"`).\n *\n * The two are mutually exclusive.\n *\n * @example\n * ```typescript\n * // API token\n * new Nvisy({ apiToken: \"your-api-token\" });\n *\n * // Browser cookie session (after the guest client logged in)\n * new Nvisy({ session: true });\n * ```\n */\nexport type NvisyOptions = NvisyGuestOptions &\n\t({ apiToken: string; session?: never } | { session: true; apiToken?: never });\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","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 Shared openapi-fetch client factory used by both the\n * authenticated {@link Nvisy} client and the pre-auth {@link NvisyGuest} client.\n *\n * @module http\n * @internal\n */\n\nimport createClient, { type Client as OpenApiClient } from \"openapi-fetch\";\nimport { DEFAULTS } from \"@/config.js\";\nimport {\n\tcreateLoggingMiddleware,\n\terrorMiddleware,\n} from \"@/middleware/index.js\";\nimport type { paths } from \"@/schema/api.js\";\n\n/** Typed openapi-fetch client for the Nvisy API. */\nexport type ApiClient = OpenApiClient<paths>;\n\n/** Resolved options for building an {@link ApiClient}. */\nexport interface ApiClientOptions {\n\t/** Bearer token to send as `Authorization`; omit for an unauthenticated client. */\n\tapiToken?: string;\n\t/** Base URL for the API. */\n\tbaseUrl: string;\n\t/** Custom headers merged over the defaults. */\n\theaders: Record<string, string>;\n\t/** User-agent string. */\n\tuserAgent: string;\n\t/** Credentials mode forwarded to `fetch` (e.g. `\"include\"` for cookies). */\n\tcredentials?: RequestCredentials;\n\t/** Whether to log requests/responses. */\n\twithLogging: boolean;\n\t/** Custom fetch implementation; `undefined` uses the global fetch. */\n\tfetch?: typeof globalThis.fetch;\n}\n\n/**\n * Build a configured openapi-fetch client. A bearer `Authorization` header is\n * sent only when `apiToken` is provided, so the same factory serves the\n * authenticated and guest clients.\n */\nexport function createApiClient(options: ApiClientOptions): ApiClient {\n\tconst headers: Record<string, string> = {\n\t\t\"Content-Type\": \"application/json\",\n\t\t\"User-Agent\": options.userAgent,\n\t\t// Send a bearer token only when configured; a guest client authenticates\n\t\t// with cookies (or not at all) instead.\n\t\t...(options.apiToken\n\t\t\t? { Authorization: `Bearer ${options.apiToken}` }\n\t\t\t: {}),\n\t\t...options.headers,\n\t};\n\n\tconst api = createClient<paths>({\n\t\tbaseUrl: options.baseUrl,\n\t\theaders,\n\t\t// `undefined` falls back to the global fetch inside openapi-fetch.\n\t\tfetch: options.fetch,\n\t\t// Omitted `credentials` uses the platform default.\n\t\t...(options.credentials ? { credentials: options.credentials } : {}),\n\t});\n\n\tif (options.withLogging) {\n\t\tapi.use(createLoggingMiddleware());\n\t}\n\n\tapi.use(errorMiddleware);\n\treturn api;\n}\n\n/** Apply the shared defaults (base URL, user agent) to a config's optionals. */\nexport function resolveDefaults<\n\tT extends {\n\t\tbaseUrl?: string;\n\t\theaders?: Record<string, string>;\n\t\tuserAgent?: string;\n\t\twithLogging?: boolean;\n\t},\n>(config: T) {\n\treturn {\n\t\tbaseUrl: config.baseUrl ?? DEFAULTS.BASE_URL,\n\t\theaders: config.headers ?? {},\n\t\tuserAgent: config.userAgent ?? DEFAULTS.USER_AGENT,\n\t\twithLogging: config.withLogging ?? false,\n\t};\n}\n"],"mappings":";;;;;;;;;;AAsBA,MAAa;;;;AAkFb,MAAa,WAAW;;;;CAIvB,UAAU;;;;CAKV,YAAY,gBAAgB;AAC7B;;;;;;;;AC1GA,MAAa,kBAA8B;CAC1C,MAAM,WAAW,EAAE,YAAY;EAC9B,IAAI,CAAC,SAAS,IAAI;GACjB,MAAM,QAAS,MAAM,SAAS,MAAM,CAAC,CAAC,KAAK;GAC3C,MAAM,IAAI,cAAc,OAAO,SAAS,MAAM;EAC/C;EACA,OAAO;CACR;CAEA,QAAQ,EAAE,SAAS;EAElB,IAAI,iBAAiB,OACpB,MAAM,IAAI,WAAW,MAAM,OAAO;EAEnC,MAAM,IAAI,WAAW,mCAAmC;CACzD;AACD;;;;;;;;;ACjBA,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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Ae;CACvB,OAAO;AACR;;AAGA,SAAgB,gBAOd,QAAW;CACZ,OAAO;EACN,SAAS,OAAO,WAAW,SAAS;EACpC,SAAS,OAAO,WAAW,CAAC;EAC5B,WAAW,OAAO,aAAa,SAAS;EACxC,aAAa,OAAO,eAAe;CACpC;AACD"}
@@ -17,34 +17,11 @@ import { Client } from "openapi-fetch";
17
17
  */
18
18
  declare const VERSION: string;
19
19
  /**
20
- * Configuration for a Nvisy client. The authenticated {@link Nvisy} client
21
- * requires `apiToken`; the pre-auth `NvisyGuest` client (`@nvisy/sdk/guest`)
22
- * uses the same fields minus `apiToken`. All other fields are optional and use
23
- * sensible defaults.
24
- *
25
- * @example
26
- * ```typescript
27
- * const nvisy = new Nvisy({ apiToken: "your-api-token" });
28
- * ```
20
+ * Options for the pre-auth {@link NvisyGuest} client — the transport settings
21
+ * shared by every client, with no authentication. All fields are optional and
22
+ * use sensible defaults.
29
23
  */
30
- interface ClientConfig {
31
- /**
32
- * API token for authentication, sent as `Authorization: Bearer <token>`.
33
- *
34
- * Tokens can be obtained from the Nvisy dashboard or the api-tokens endpoint.
35
- * Required by the authenticated {@link Nvisy} client; omitted by the guest
36
- * client (which authenticates with a cookie session, if any — see
37
- * `credentials`).
38
- */
39
- apiToken?: string;
40
- /**
41
- * Credentials mode for every request, forwarded to `fetch`.
42
- *
43
- * Set to `"include"` to send the session cookies established by the guest
44
- * client's `login` / `signup` (needed for cross-origin browser sessions).
45
- * Defaults to the platform's `fetch` default when omitted.
46
- */
47
- credentials?: RequestCredentials;
24
+ interface NvisyGuestOptions {
48
25
  /**
49
26
  * Base URL for the Nvisy API.
50
27
  *
@@ -54,9 +31,8 @@ interface ClientConfig {
54
31
  /**
55
32
  * Custom headers to include with every request.
56
33
  *
57
- * These headers are merged with the default headers (Content-Type, User-Agent,
58
- * and Authorization). Custom headers take precedence over defaults if there
59
- * are conflicts.
34
+ * Merged over the default headers (Content-Type, User-Agent, and, for token
35
+ * auth, Authorization). Custom headers take precedence on conflict.
60
36
  */
61
37
  headers?: Record<string, string>;
62
38
  /**
@@ -65,11 +41,15 @@ interface ClientConfig {
65
41
  * @default "@nvisy/sdk v.{version}"
66
42
  */
67
43
  userAgent?: string;
44
+ /**
45
+ * Credentials mode forwarded to `fetch`. Session auth sets this to
46
+ * `"include"` automatically; set it here only to override the transport
47
+ * behaviour (e.g. a same-origin app that wants a different mode).
48
+ */
49
+ credentials?: RequestCredentials;
68
50
  /**
69
51
  * Enable logging for requests and responses.
70
52
  *
71
- * When enabled, logs request method, URL, status, and timing to console.
72
- *
73
53
  * @default false
74
54
  */
75
55
  withLogging?: boolean;
@@ -84,12 +64,32 @@ interface ClientConfig {
84
64
  fetch?: typeof globalThis.fetch;
85
65
  }
86
66
  /**
87
- * Configuration for the authenticated {@link Nvisy} client: {@link ClientConfig}
88
- * with a required `apiToken`.
67
+ * Configuration for the authenticated {@link Nvisy} client. Authenticate one of
68
+ * two ways, chosen explicitly:
69
+ *
70
+ * - `apiToken` — send an API token as `Authorization: Bearer <token>`.
71
+ * - `session: true` — use the browser cookie session established by the guest
72
+ * client's `login` / `signup`; requests are sent credentialed
73
+ * (`credentials: "include"`).
74
+ *
75
+ * The two are mutually exclusive.
76
+ *
77
+ * @example
78
+ * ```typescript
79
+ * // API token
80
+ * new Nvisy({ apiToken: "your-api-token" });
81
+ *
82
+ * // Browser cookie session (after the guest client logged in)
83
+ * new Nvisy({ session: true });
84
+ * ```
89
85
  */
90
- type NvisyConfig = ClientConfig & {
86
+ type NvisyOptions = NvisyGuestOptions & ({
91
87
  apiToken: string;
92
- };
88
+ session?: never;
89
+ } | {
90
+ session: true;
91
+ apiToken?: never;
92
+ });
93
93
  /**
94
94
  * Default configuration values used when options are not explicitly provided.
95
95
  */
@@ -124,20 +124,22 @@ declare class Nvisy {
124
124
  /**
125
125
  * Creates a new authenticated Nvisy client.
126
126
  *
127
- * Requires an `apiToken` (sent as `Authorization: Bearer <token>`). For the
127
+ * Authenticate with an `apiToken` (bearer) or `session: true` (the browser
128
+ * cookie session established by the guest client's login / signup). For the
128
129
  * pre-auth surface (login / signup / OIDC start, auth capabilities, health),
129
130
  * use {@link NvisyGuest} from `@nvisy/sdk/guest`.
130
131
  *
131
- * @param config - Configuration options with a required `apiToken`
132
- * @throws {NvisyError} If the API token is missing or invalid
132
+ * @param config - Configuration; provide either `apiToken` or `session: true`
133
+ * @throws {NvisyError} If an `apiToken` is provided but invalid
133
134
  *
134
135
  * @example
135
136
  * ```typescript
136
137
  * const nvisy = new Nvisy({ apiToken: "your-api-token" });
137
- * const account = await nvisy.account.getAccount();
138
+ * // or, after a browser login:
139
+ * const nvisy = new Nvisy({ session: true });
138
140
  * ```
139
141
  */
140
- constructor(config: NvisyConfig);
142
+ constructor(config: NvisyOptions);
141
143
  /**
142
144
  * Creates a new client with a different API token.
143
145
  *
@@ -1723,5 +1725,5 @@ declare class Workspaces {
1723
1725
  deleteAvatar(workspaceId: string): Promise<void>;
1724
1726
  }
1725
1727
  //#endregion
1726
- export { Activities as C, ClientConfig as D, ApiClient as E, DEFAULTS as O, Analytics as S, Nvisy as T, Detections as _, Status as a, Auth as b, Providers as c, Notifications as d, Members as f, Documents as g, GuestAuth as h, Syncs as i, VERSION as k, Policies as l, GuestCapabilities as m, Webhooks as n, Reviews as o, Invites as p, Threads as r, Redactions as s, Workspaces as t, Pipelines as u, Connections as v, Account as w, ApiTokens as x, Capabilities as y };
1727
- //# sourceMappingURL=index-DFbHT_eq.d.ts.map
1728
+ export { VERSION as A, Activities as C, DEFAULTS as D, ApiClient as E, NvisyGuestOptions as O, Analytics as S, Nvisy as T, Detections as _, Status as a, Auth as b, Providers as c, Notifications as d, Members as f, Documents as g, GuestAuth as h, Syncs as i, NvisyOptions as k, Policies as l, GuestCapabilities as m, Webhooks as n, Reviews as o, Invites as p, Threads as r, Redactions as s, Workspaces as t, Pipelines as u, Connections as v, Account as w, ApiTokens as x, Capabilities as y };
1729
+ //# sourceMappingURL=index-CuKzO8Ly.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CuKzO8Ly.d.ts","names":[],"sources":["../src/config.ts","../src/http.ts","../src/client.ts","../src/services/account.ts","../src/services/activities.ts","../src/services/analytics.ts","../src/services/api-tokens.ts","../src/services/auth.ts","../src/services/capabilities.ts","../src/services/connections.ts","../src/services/detections.ts","../src/services/documents.ts","../src/services/guest-auth.ts","../src/services/guest-capabilities.ts","../src/services/invites.ts","../src/services/members.ts","../src/services/notifications.ts","../src/services/pipelines.ts","../src/services/policies.ts","../src/services/providers.ts","../src/services/redactions.ts","../src/services/reviews.ts","../src/services/status.ts","../src/services/syncs.ts","../src/services/threads.ts","../src/services/webhooks.ts","../src/services/workspaces.ts"],"mappings":";;;;;;;;;;;;;;;;;cAsBa;;;;;;UAQI;;;;;;EAMhB;;;;;;;EAQA,UAAU;;;;;;EAOV;;;;;;EAOA,cAAc;;;;;;EAOd;;;;;;;;;EAUA,eAAe,WAAW;;;;;;;;;;;;;;;;;;;;;;KAuBf,eAAe;EACvB;EAAkB;;EAAsB;EAAe;;;;;cAK9C;;;;WAAA;;;;WAAA;;;;;KCvFD,YAAY,OAAc;;;;;;;;;;;;;cC0CzB;;;;;;;;;;;;;;;;;;;;EA+BA,YAAA,QAAQ;;;;;;;;;;;;;;;;;;;;;EAiEpB,aAAa,mBAAmB;;;;;;MAmB5B;;;;;;;;;MAYA,OAAO;;;;;MAQP,QAAQ;;;;MAOR,UAAU;;;;MAOV,WAAW;;;;MAOX,cAAc;;;;MAOd,aAAa;;;;MAOb,aAAa;;;;MAOb,eAAe;;;;MAOf,aAAa;;;;MAOb,WAAW;;;;MAOX,aAAa;;;;MAOb,YAAY;;;;MAOZ,aAAa;;;;;MAQb,gBAAgB;;;;MAOhB,WAAW;;;;MAOX,WAAW;;;;MAOX,iBAAiB;;;;MAOjB,cAAc;;;;MAOd,cAAc;;;;MAOd,WAAW;;;;MAOX,SAAS;;;;MAOT,YAAY;;;;MAOZ,cAAc;;;;;;;cCxUN;;EAGA,YA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A,SAAS,yBACP,QAAQ;;;;;;;;;EAmBL,cACL,qBACA,mBACA,SAAS,yBACP,QAAQ;;;;;;;;EAkBL,cAAc,qBAAqB,oBAAoB;;;;;;;cCnMjD;;EAGA,YAAA,KAAK;;;;;;;;EAWX,aACL,qBACA,QAAQ,mBACN,QAAQ;;;;;;;;EAcL,cACL,qBACA,SAAS,yBACP,QAAQ;;;;;;;;EAkBL,WACL,qBACA,oBACE,QAAQ;;;;;;;;;EAkBL,cACL,qBACA,mBACA,SAAS,yBACP,QAAQ;;;;;;;;EAkBL,cAAc,qBAAqB,oBAAoB;;;;;;;;;EAcvD,YACL,qBACA,mBACA,UAAU,uBACR,QAAQ;;;;;;;cClHC;;EAGA,YAAA,KAAK;;;;;;;EAUX,eAAe,QAAQ,mBAAmB,QAAQ;;;;;;;EAalD,aAAa,sBAAsB,QAAQ;;;;;;;EAa3C,gBAAgB,WAAW,kBAAkB,QAAQ;;;;;;;;EAcrD,gBACL,qBACA,SAAS,kBACP,QAAQ;;;;;;;EAcL,gBAAgB,sBAAsB;;;;;;;EAYtC,wBACL,sBACE,QAAQ;;;;;;;;EAiBL,2BACL,qBACA,UAAU,sCACR,QAAQ;;;;;;;;EAkBL,aAAa,qBAAqB,QAAQ,OAAO;;;;;;;EAqBjD,aAAa,sBAAsB"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { zn as ErrorResponse } from "./index-DzEtj1r2.js";
2
- import { D as ClientConfig, E as ApiClient, O as DEFAULTS, T as Nvisy, k as VERSION } from "./index-DFbHT_eq.js";
2
+ import { A as VERSION, D as DEFAULTS, E as ApiClient, O as NvisyGuestOptions, T as Nvisy, k as NvisyOptions } from "./index-CuKzO8Ly.js";
3
3
  import { n as NvisyError, t as NvisyApiError } from "./errors-DShmkdjS.js";
4
- export { type ApiClient, type ClientConfig, DEFAULTS, type ErrorResponse, Nvisy, NvisyApiError, NvisyError, VERSION };
4
+ export { type ApiClient, DEFAULTS, type ErrorResponse, Nvisy, NvisyApiError, NvisyError, type NvisyGuestOptions, type NvisyOptions, VERSION };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as NvisyError, t as NvisyApiError } from "./errors-ChRSBkhj.js";
2
- import { i as VERSION, n as resolveDefaults, r as DEFAULTS, t as createApiClient } from "./http-BexRclA5.js";
2
+ import { i as VERSION, n as resolveDefaults, r as DEFAULTS, t as createApiClient } from "./http-BRaKBzAA.js";
3
3
  import { C as Activities, S as Analytics, _ as Detections, a as Status, b as Auth, c as Providers, d as Notifications, f as Members, g as Documents, i as Syncs, l as Policies, n as Webhooks, o as Reviews, p as Invites, r as Threads, s as Redactions, t as Workspaces, u as Pipelines, v as Connections, w as Account, x as ApiTokens, y as Capabilities } from "./services-BMmcawiT.js";
4
4
 
5
5
  //#region src/client.ts
@@ -26,26 +26,29 @@ var Nvisy = class Nvisy {
26
26
  /**
27
27
  * Creates a new authenticated Nvisy client.
28
28
  *
29
- * Requires an `apiToken` (sent as `Authorization: Bearer <token>`). For the
29
+ * Authenticate with an `apiToken` (bearer) or `session: true` (the browser
30
+ * cookie session established by the guest client's login / signup). For the
30
31
  * pre-auth surface (login / signup / OIDC start, auth capabilities, health),
31
32
  * use {@link NvisyGuest} from `@nvisy/sdk/guest`.
32
33
  *
33
- * @param config - Configuration options with a required `apiToken`
34
- * @throws {NvisyError} If the API token is missing or invalid
34
+ * @param config - Configuration; provide either `apiToken` or `session: true`
35
+ * @throws {NvisyError} If an `apiToken` is provided but invalid
35
36
  *
36
37
  * @example
37
38
  * ```typescript
38
39
  * const nvisy = new Nvisy({ apiToken: "your-api-token" });
39
- * const account = await nvisy.account.getAccount();
40
+ * // or, after a browser login:
41
+ * const nvisy = new Nvisy({ session: true });
40
42
  * ```
41
43
  */
42
44
  constructor(config) {
43
45
  this.#config = config;
44
46
  const resolved = resolveDefaults(config);
45
47
  this.#baseUrl = resolved.baseUrl;
48
+ const usesSession = config.session === true;
46
49
  this.#api = createApiClient({
47
- apiToken: this.#validateApiToken(config.apiToken),
48
- credentials: config.credentials,
50
+ apiToken: usesSession ? void 0 : this.#validateApiToken(config.apiToken),
51
+ credentials: usesSession ? config.credentials ?? "include" : config.credentials,
49
52
  fetch: config.fetch,
50
53
  ...resolved
51
54
  });
@@ -86,9 +89,15 @@ var Nvisy = class Nvisy {
86
89
  * ```
87
90
  */
88
91
  withApiToken(apiToken) {
92
+ const { baseUrl, headers, userAgent, credentials, withLogging, fetch } = this.#config;
89
93
  return new Nvisy({
90
- ...this.#config,
91
- apiToken
94
+ apiToken,
95
+ baseUrl,
96
+ headers,
97
+ userAgent,
98
+ credentials,
99
+ withLogging,
100
+ fetch
92
101
  });
93
102
  }
94
103
  /**
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/client.ts"],"sourcesContent":["/**\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 type { NvisyConfig } from \"@/config.js\";\nimport { NvisyError } from \"@/errors.js\";\nimport { type ApiClient, createApiClient, resolveDefaults } from \"@/http.js\";\nimport {\n\tAccount,\n\tActivities,\n\tAnalytics,\n\tApiTokens,\n\tAuth,\n\tCapabilities,\n\tConnections,\n\tDetections,\n\tDocuments,\n\tInvites,\n\tMembers,\n\tNotifications,\n\tPipelines,\n\tPolicies,\n\tProviders,\n\tRedactions,\n\tReviews,\n\tStatus,\n\tSyncs,\n\tThreads,\n\tWebhooks,\n\tWorkspaces,\n} from \"@/services/index.js\";\n\n/**\n * Typed openapi-fetch client for the Nvisy API. Exposed via {@link Nvisy.api}\n * for advanced use cases requiring direct API access.\n */\nexport type { ApiClient } from \"@/http.js\";\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/** The config this client was built from (for {@link withApiToken}). @internal */\n\treadonly #config: NvisyConfig;\n\n\t/** The resolved base URL. @internal */\n\treadonly #baseUrl: string;\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 authenticated Nvisy client.\n\t *\n\t * Requires an `apiToken` (sent as `Authorization: Bearer <token>`). For the\n\t * pre-auth surface (login / signup / OIDC start, auth capabilities, health),\n\t * use {@link NvisyGuest} from `@nvisy/sdk/guest`.\n\t *\n\t * @param config - Configuration options with a required `apiToken`\n\t * @throws {NvisyError} If the API token is missing or invalid\n\t *\n\t * @example\n\t * ```typescript\n\t * const nvisy = new Nvisy({ apiToken: \"your-api-token\" });\n\t * const account = await nvisy.account.getAccount();\n\t * ```\n\t */\n\tconstructor(config: NvisyConfig) {\n\t\tthis.#config = config;\n\t\tconst resolved = resolveDefaults(config);\n\t\tthis.#baseUrl = resolved.baseUrl;\n\t\tthis.#api = createApiClient({\n\t\t\tapiToken: this.#validateApiToken(config.apiToken),\n\t\t\tcredentials: config.credentials,\n\t\t\tfetch: config.fetch,\n\t\t\t...resolved,\n\t\t});\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.#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 authenticated auth operations (logout, desktop token). Pre-auth\n\t * sign-in lives on {@link NvisyGuest}.\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 workspace analytics.\n\t */\n\tget analytics(): Analytics {\n\t\treturn new Analytics(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 document operations (upload, download, delete, review).\n\t */\n\tget documents(): Documents {\n\t\treturn new Documents(this.#api);\n\t}\n\n\t/**\n\t * Service for discussion threads and comments.\n\t */\n\tget threads(): Threads {\n\t\treturn new Threads(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 managing a workspace's inference providers.\n\t */\n\tget providers(): Providers {\n\t\treturn new Providers(this.#api);\n\t}\n\n\t/**\n\t * Service for reading the deployment's capabilities (labels, recognizers,\n\t * connectors, auth methods).\n\t */\n\tget capabilities(): Capabilities {\n\t\treturn new Capabilities(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 pipeline detections and their redactions.\n\t */\n\tget detections(): Detections {\n\t\treturn new Detections(this.#api);\n\t}\n\n\t/**\n\t * Service for workspace redactions.\n\t */\n\tget redactions(): Redactions {\n\t\treturn new Redactions(this.#api);\n\t}\n\n\t/**\n\t * Service for document reviews (assigning documents to reviewers).\n\t */\n\tget reviews(): Reviews {\n\t\treturn new Reviews(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":";;;;;;;;;;;;;;;AA2DA,IAAa,QAAb,MAAa,MAAM;;CAElB,AAAS;;CAGT,AAAS;;;;;CAMT,AAAS;;;;;;;;;;;;;;;;;CAkBT,YAAY,QAAqB;EAChC,KAAK,UAAU;EACf,MAAM,WAAW,gBAAgB,MAAM;EACvC,KAAK,WAAW,SAAS;EACzB,KAAK,OAAO,gBAAgB;GAC3B,UAAU,KAAK,kBAAkB,OAAO,QAAQ;GAChD,aAAa,OAAO;GACpB,OAAO,OAAO;GACd,GAAG;EACJ,CAAC;CACF;;;;;;;;;CAUA,kBAAkB,UAA0B;EAC3C,IAAI,OAAO,aAAa,YAAY,SAAS,KAAK,CAAC,CAAC,WAAW,GAC9D,MAAM,IAAI,WAAW,sCAAsC;EAG5D,MAAM,eAAe,SAAS,KAAK;EACnC,IAAI,aAAa,SAAS,IACzB,MAAM,IAAI,WAAW,0CAA0C;EAGhE,IAAI,CAAC,oBAAoB,KAAK,YAAY,GACzC,MAAM,IAAI,WAAW,uCAAuC;EAG7D,OAAO;CACR;;;;;;;;;;;;;;;;;;;;;CAsBA,aAAa,UAAyB;EACrC,OAAO,IAAI,MAAM;GAAE,GAAG,KAAK;GAAS;EAAS,CAAC;CAC/C;;;;;;CAOA,IAAI,UAAkB;EACrB,OAAO,KAAK;CACb;;;;;;;;;CAUA,IAAI,MAAiB;EACpB,OAAO,KAAK;CACb;;;;;CAMA,IAAI,OAAa;EAChB,OAAO,IAAI,KAAK,KAAK,IAAI;CAC1B;;;;CAKA,IAAI,SAAiB;EACpB,OAAO,IAAI,OAAO,KAAK,IAAI;CAC5B;;;;CAKA,IAAI,UAAmB;EACtB,OAAO,IAAI,QAAQ,KAAK,IAAI;C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C5B,OAAO,IAAI,WAAW,KAAK,IAAI;CAChC;AACD"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/client.ts"],"sourcesContent":["/**\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 type { NvisyOptions } from \"@/config.js\";\nimport { NvisyError } from \"@/errors.js\";\nimport { type ApiClient, createApiClient, resolveDefaults } from \"@/http.js\";\nimport {\n\tAccount,\n\tActivities,\n\tAnalytics,\n\tApiTokens,\n\tAuth,\n\tCapabilities,\n\tConnections,\n\tDetections,\n\tDocuments,\n\tInvites,\n\tMembers,\n\tNotifications,\n\tPipelines,\n\tPolicies,\n\tProviders,\n\tRedactions,\n\tReviews,\n\tStatus,\n\tSyncs,\n\tThreads,\n\tWebhooks,\n\tWorkspaces,\n} from \"@/services/index.js\";\n\n/**\n * Typed openapi-fetch client for the Nvisy API. Exposed via {@link Nvisy.api}\n * for advanced use cases requiring direct API access.\n */\nexport type { ApiClient } from \"@/http.js\";\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/** The config this client was built from (for {@link withApiToken}). @internal */\n\treadonly #config: NvisyOptions;\n\n\t/** The resolved base URL. @internal */\n\treadonly #baseUrl: string;\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 authenticated Nvisy client.\n\t *\n\t * Authenticate with an `apiToken` (bearer) or `session: true` (the browser\n\t * cookie session established by the guest client's login / signup). For the\n\t * pre-auth surface (login / signup / OIDC start, auth capabilities, health),\n\t * use {@link NvisyGuest} from `@nvisy/sdk/guest`.\n\t *\n\t * @param config - Configuration; provide either `apiToken` or `session: true`\n\t * @throws {NvisyError} If an `apiToken` is provided but invalid\n\t *\n\t * @example\n\t * ```typescript\n\t * const nvisy = new Nvisy({ apiToken: \"your-api-token\" });\n\t * // or, after a browser login:\n\t * const nvisy = new Nvisy({ session: true });\n\t * ```\n\t */\n\tconstructor(config: NvisyOptions) {\n\t\tthis.#config = config;\n\t\tconst resolved = resolveDefaults(config);\n\t\tthis.#baseUrl = resolved.baseUrl;\n\n\t\tconst usesSession = config.session === true;\n\t\tthis.#api = createApiClient({\n\t\t\tapiToken: usesSession\n\t\t\t\t? undefined\n\t\t\t\t: this.#validateApiToken(config.apiToken),\n\t\t\t// Session auth sends cookies; default to \"include\" unless the caller\n\t\t\t// overrode `credentials` explicitly.\n\t\t\tcredentials: usesSession\n\t\t\t\t? (config.credentials ?? \"include\")\n\t\t\t\t: config.credentials,\n\t\t\tfetch: config.fetch,\n\t\t\t...resolved,\n\t\t});\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 | undefined): 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\tconst { baseUrl, headers, userAgent, credentials, withLogging, fetch } =\n\t\t\tthis.#config;\n\t\treturn new Nvisy({\n\t\t\tapiToken,\n\t\t\tbaseUrl,\n\t\t\theaders,\n\t\t\tuserAgent,\n\t\t\tcredentials,\n\t\t\twithLogging,\n\t\t\tfetch,\n\t\t});\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.#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 authenticated auth operations (logout, desktop token). Pre-auth\n\t * sign-in lives on {@link NvisyGuest}.\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 workspace analytics.\n\t */\n\tget analytics(): Analytics {\n\t\treturn new Analytics(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 document operations (upload, download, delete, review).\n\t */\n\tget documents(): Documents {\n\t\treturn new Documents(this.#api);\n\t}\n\n\t/**\n\t * Service for discussion threads and comments.\n\t */\n\tget threads(): Threads {\n\t\treturn new Threads(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 managing a workspace's inference providers.\n\t */\n\tget providers(): Providers {\n\t\treturn new Providers(this.#api);\n\t}\n\n\t/**\n\t * Service for reading the deployment's capabilities (labels, recognizers,\n\t * connectors, auth methods).\n\t */\n\tget capabilities(): Capabilities {\n\t\treturn new Capabilities(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 pipeline detections and their redactions.\n\t */\n\tget detections(): Detections {\n\t\treturn new Detections(this.#api);\n\t}\n\n\t/**\n\t * Service for workspace redactions.\n\t */\n\tget redactions(): Redactions {\n\t\treturn new Redactions(this.#api);\n\t}\n\n\t/**\n\t * Service for document reviews (assigning documents to reviewers).\n\t */\n\tget reviews(): Reviews {\n\t\treturn new Reviews(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":";;;;;;;;;;;;;;;AA2DA,IAAa,QAAb,MAAa,MAAM;;CAElB,AAAS;;CAGT,AAAS;;;;;CAMT,AAAS;;;;;;;;;;;;;;;;;;;CAoBT,YAAY,QAAsB;EACjC,KAAK,UAAU;EACf,MAAM,WAAW,gBAAgB,MAAM;EACvC,KAAK,WAAW,SAAS;EAEzB,MAAM,cAAc,OAAO,YAAY;EACvC,KAAK,OAAO,gBAAgB;GAC3B,UAAU,cACP,SACA,KAAK,kBAAkB,OAAO,QAAQ;GAGzC,aAAa,cACT,OAAO,eAAe,YACvB,OAAO;GACV,OAAO,OAAO;GACd,GAAG;EACJ,CAAC;CACF;;;;;;;;;CAUA,kBAAkB,UAAsC;EACvD,IAAI,OAAO,aAAa,YAAY,SAAS,KAAK,CAAC,CAAC,WAAW,GAC9D,MAAM,IAAI,WAAW,sCAAsC;EAG5D,MAAM,eAAe,SAAS,KAAK;EACnC,IAAI,aAAa,SAAS,IACzB,MAAM,IAAI,WAAW,0CAA0C;EAGhE,IAAI,CAAC,oBAAoB,KAAK,YAAY,GACzC,MAAM,IAAI,WAAW,uCAAuC;EAG7D,OAAO;CACR;;;;;;;;;;;;;;;;;;;;;CAsBA,aAAa,UAAyB;EACrC,MAAM,EAAE,SAAS,SAAS,WAAW,aAAa,aAAa,UAC9D,KAAK;EACN,OAAO,IAAI,MAAM;GAChB;GACA;GACA;GACA;GACA;GACA;GACA;EACD,CAAC;CACF;;;;;;CAOA,IAAI,UAAkB;EACrB,OAAO,KAAK;CACb;;;;;;;;;CAUA,IAAI,MAAiB;EACpB,OAAO,KAAK;CACb;;;;;CAMA,IAAI,OAAa;EAChB,OAAO,IAAI,KAAK,KAAK,IAAI;CAC1B;;;;CAKA,IAAI,S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KAAK,IAAI;CAC3B;;;;CAKA,IAAI,WAAqB;EACxB,OAAO,IAAI,SAAS,KAAK,IAAI;CAC9B;;;;CAKA,IAAI,aAAyB;EAC5B,OAAO,IAAI,WAAW,KAAK,IAAI;CAChC;AACD"}
@@ -1,2 +1,2 @@
1
- import { C as Activities, S as Analytics, _ as Detections, a as Status, b as Auth, c as Providers, d as Notifications, f as Members, g as Documents, h as GuestAuth, i as Syncs, l as Policies, m as GuestCapabilities, n as Webhooks, o as Reviews, p as Invites, r as Threads, s as Redactions, t as Workspaces, u as Pipelines, v as Connections, w as Account, x as ApiTokens, y as Capabilities } from "../index-DFbHT_eq.js";
1
+ import { C as Activities, S as Analytics, _ as Detections, a as Status, b as Auth, c as Providers, d as Notifications, f as Members, g as Documents, h as GuestAuth, i as Syncs, l as Policies, m as GuestCapabilities, n as Webhooks, o as Reviews, p as Invites, r as Threads, s as Redactions, t as Workspaces, u as Pipelines, v as Connections, w as Account, x as ApiTokens, y as Capabilities } from "../index-CuKzO8Ly.js";
2
2
  export { Account, Activities, Analytics, ApiTokens, Auth, Capabilities, Connections, Detections, Documents, GuestAuth, GuestCapabilities, Invites, Members, Notifications, Pipelines, Policies, Providers, Redactions, Reviews, Status, Syncs, Threads, Webhooks, Workspaces };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nvisy/sdk",
3
- "version": "0.54.0",
3
+ "version": "0.55.0",
4
4
  "description": "Official TypeScript SDK for Nvisy document processing platform",
5
5
  "type": "module",
6
6
  "private": false,
@@ -1 +0,0 @@
1
- {"version":3,"file":"http-BexRclA5.js","names":[],"sources":["../src/config.ts","../src/middleware/error.ts","../src/middleware/logging.ts","../src/http.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 * Compile-time version token, replaced with the `package.json` version by the\n * build (see `tsdown.config.ts`). Declared so it type-checks; the `typeof`\n * guard below keeps it safe when the define isn't applied (tests, direct `tsc`).\n */\ndeclare const __SDK_VERSION__: string | undefined;\n\n/**\n * Current SDK version.\n *\n * Injected from `package.json` at build time, so it always matches the\n * published version. Used in the default user agent string.\n */\nexport const VERSION =\n\ttypeof __SDK_VERSION__ === \"string\" ? __SDK_VERSION__ : \"0.0.0-dev\";\n\n/**\n * Configuration for a Nvisy client. The authenticated {@link Nvisy} client\n * requires `apiToken`; the pre-auth `NvisyGuest` client (`@nvisy/sdk/guest`)\n * uses the same fields minus `apiToken`. All other fields are optional and use\n * sensible defaults.\n *\n * @example\n * ```typescript\n * const nvisy = new Nvisy({ apiToken: \"your-api-token\" });\n * ```\n */\nexport interface ClientConfig {\n\t/**\n\t * API token for authentication, sent as `Authorization: Bearer <token>`.\n\t *\n\t * Tokens can be obtained from the Nvisy dashboard or the api-tokens endpoint.\n\t * Required by the authenticated {@link Nvisy} client; omitted by the guest\n\t * client (which authenticates with a cookie session, if any — see\n\t * `credentials`).\n\t */\n\tapiToken?: string;\n\n\t/**\n\t * Credentials mode for every request, forwarded to `fetch`.\n\t *\n\t * Set to `\"include\"` to send the session cookies established by the guest\n\t * client's `login` / `signup` (needed for cross-origin browser sessions).\n\t * Defaults to the platform's `fetch` default when omitted.\n\t */\n\tcredentials?: RequestCredentials;\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 * Configuration for the authenticated {@link Nvisy} client: {@link ClientConfig}\n * with a required `apiToken`.\n */\nexport type NvisyConfig = ClientConfig & { apiToken: string };\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","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 Shared openapi-fetch client factory used by both the\n * authenticated {@link Nvisy} client and the pre-auth {@link NvisyGuest} client.\n *\n * @module http\n * @internal\n */\n\nimport createClient, { type Client as OpenApiClient } from \"openapi-fetch\";\nimport { DEFAULTS } from \"@/config.js\";\nimport {\n\tcreateLoggingMiddleware,\n\terrorMiddleware,\n} from \"@/middleware/index.js\";\nimport type { paths } from \"@/schema/api.js\";\n\n/** Typed openapi-fetch client for the Nvisy API. */\nexport type ApiClient = OpenApiClient<paths>;\n\n/** Resolved options for building an {@link ApiClient}. */\nexport interface ApiClientOptions {\n\t/** Bearer token to send as `Authorization`; omit for an unauthenticated client. */\n\tapiToken?: string;\n\t/** Base URL for the API. */\n\tbaseUrl: string;\n\t/** Custom headers merged over the defaults. */\n\theaders: Record<string, string>;\n\t/** User-agent string. */\n\tuserAgent: string;\n\t/** Credentials mode forwarded to `fetch` (e.g. `\"include\"` for cookies). */\n\tcredentials?: RequestCredentials;\n\t/** Whether to log requests/responses. */\n\twithLogging: boolean;\n\t/** Custom fetch implementation; `undefined` uses the global fetch. */\n\tfetch?: typeof globalThis.fetch;\n}\n\n/**\n * Build a configured openapi-fetch client. A bearer `Authorization` header is\n * sent only when `apiToken` is provided, so the same factory serves the\n * authenticated and guest clients.\n */\nexport function createApiClient(options: ApiClientOptions): ApiClient {\n\tconst headers: Record<string, string> = {\n\t\t\"Content-Type\": \"application/json\",\n\t\t\"User-Agent\": options.userAgent,\n\t\t// Send a bearer token only when configured; a guest client authenticates\n\t\t// with cookies (or not at all) instead.\n\t\t...(options.apiToken\n\t\t\t? { Authorization: `Bearer ${options.apiToken}` }\n\t\t\t: {}),\n\t\t...options.headers,\n\t};\n\n\tconst api = createClient<paths>({\n\t\tbaseUrl: options.baseUrl,\n\t\theaders,\n\t\t// `undefined` falls back to the global fetch inside openapi-fetch.\n\t\tfetch: options.fetch,\n\t\t// Omitted `credentials` uses the platform default.\n\t\t...(options.credentials ? { credentials: options.credentials } : {}),\n\t});\n\n\tif (options.withLogging) {\n\t\tapi.use(createLoggingMiddleware());\n\t}\n\n\tapi.use(errorMiddleware);\n\treturn api;\n}\n\n/** Apply the shared defaults (base URL, user agent) to a config's optionals. */\nexport function resolveDefaults<\n\tT extends {\n\t\tbaseUrl?: string;\n\t\theaders?: Record<string, string>;\n\t\tuserAgent?: string;\n\t\twithLogging?: boolean;\n\t},\n>(config: T) {\n\treturn {\n\t\tbaseUrl: config.baseUrl ?? DEFAULTS.BASE_URL,\n\t\theaders: config.headers ?? {},\n\t\tuserAgent: config.userAgent ?? DEFAULTS.USER_AGENT,\n\t\twithLogging: config.withLogging ?? false,\n\t};\n}\n"],"mappings":";;;;;;;;;;A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IAAI,IAAI,KAAK;GACrD,MAAM,MAAM,IAAI,IAAI,QAAQ,GAAG;GAE/B,QAAQ,MACP,WAAW,QAAQ,OAAO,GAAG,IAAI,SAAS,UAAU,SAAS,OAC7D,iBAAiB,QAAQ,MAAM,UAAU,KAC1C;EACD;CACD;AACD;;;;;;;;;;;;;;;;ACXA,SAAgB,gBAAgB,SAAsC;CACrE,MAAM,UAAkC;EACvC,gBAAgB;EAChB,cAAc,QAAQ;EAGtB,GAAI,QAAQ,WACT,EAAE,eAAe,UAAU,QAAQ,WAAW,IAC9C,CAAC;EACJ,GAAG,QAAQ;CACZ;CAEA,MAAM,MAAM,aAAoB;EAC/B,SAAS,QAAQ;EACjB;EAEA,OAAO,QAAQ;EAEf,GAAI,QAAQ,cAAc,EAAE,aAAa,QAAQ,YAAY,IAAI,CAAC;CACnE,CAAC;CAED,IAAI,QAAQ,aACX,IAAI,IAAI,wBAAwB,CAAC;CAGlC,IAAI,IAAI,eAAe;CACvB,OAAO;AACR;;AAGA,SAAgB,gBAOd,QAAW;CACZ,OAAO;EACN,SAAS,OAAO,WAAW,SAAS;EACpC,SAAS,OAAO,WAAW,CAAC;EAC5B,WAAW,OAAO,aAAa,SAAS;EACxC,aAAa,OAAO,eAAe;CACpC;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-DFbHT_eq.d.ts","names":[],"sources":["../src/config.ts","../src/http.ts","../src/client.ts","../src/services/account.ts","../src/services/activities.ts","../src/services/analytics.ts","../src/services/api-tokens.ts","../src/services/auth.ts","../src/services/capabilities.ts","../src/services/connections.ts","../src/services/detections.ts","../src/services/documents.ts","../src/services/guest-auth.ts","../src/services/guest-capabilities.ts","../src/services/invites.ts","../src/services/members.ts","../src/services/notifications.ts","../src/services/pipelines.ts","../src/services/policies.ts","../src/services/providers.ts","../src/services/redactions.ts","../src/services/reviews.ts","../src/services/status.ts","../src/services/syncs.ts","../src/services/threads.ts","../src/services/webhooks.ts","../src/services/workspaces.ts"],"mappings":";;;;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