@nvisy/sdk 0.37.0 → 0.38.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 +25 -1
- package/dist/{client-CAsJKHbv.d.ts → client-DvFWnhWc.d.ts} +2 -2
- package/dist/{client-CAsJKHbv.d.ts.map → client-DvFWnhWc.d.ts.map} +1 -1
- package/dist/{error-WivTjcX8.js → error-Bkntcqmi.js} +2 -2
- package/dist/{error-WivTjcX8.js.map → error-Bkntcqmi.js.map} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/services/index.d.ts +1 -1
- package/dist/{auth → standalone}/index.d.ts +42 -19
- package/dist/standalone/index.d.ts.map +1 -0
- package/dist/{auth → standalone}/index.js +47 -30
- package/dist/standalone/index.js.map +1 -0
- package/package.json +4 -4
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,29 @@ and this project adheres to
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [0.38.0] - 2026-08-29
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- `checkHealth()` — a standalone health check that needs neither an API token
|
|
16
|
+
nor a `Nvisy` client, for use as a pre-auth liveness probe. The health
|
|
17
|
+
endpoint is public (unauthenticated returns a cached status, authenticated a
|
|
18
|
+
real-time one), and a degraded `503` is returned as a `Health` value rather
|
|
19
|
+
than thrown. Exported from `@nvisy/sdk/standalone` with its `HealthConfig`
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- **Breaking:** the standalone `login` / `signup` functions moved from
|
|
24
|
+
`@nvisy/sdk/auth` to `@nvisy/sdk/standalone`, now sharing one module with
|
|
25
|
+
`checkHealth`:
|
|
26
|
+
|
|
27
|
+
```diff
|
|
28
|
+
- import { login, signup } from "@nvisy/sdk/auth";
|
|
29
|
+
+ import { login, signup } from "@nvisy/sdk/standalone";
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
`AuthConfig` is re-exported from the same subpath; behavior is unchanged.
|
|
33
|
+
|
|
11
34
|
## [0.37.0] - 2026-08-27
|
|
12
35
|
|
|
13
36
|
### Changed
|
|
@@ -778,7 +801,8 @@ redaction an independent resource. This release renames the SDK to match.
|
|
|
778
801
|
- Network error handling for timeouts, DNS resolution, and connection issues
|
|
779
802
|
- Configuration validation with detailed error messages
|
|
780
803
|
|
|
781
|
-
[Unreleased]: https://github.com/nvisycom/sdk-ts/compare/v0.
|
|
804
|
+
[Unreleased]: https://github.com/nvisycom/sdk-ts/compare/v0.38.0...HEAD
|
|
805
|
+
[0.38.0]: https://github.com/nvisycom/sdk-ts/compare/v0.37.0...v0.38.0
|
|
782
806
|
[0.37.0]: https://github.com/nvisycom/sdk-ts/compare/v0.36.0...v0.37.0
|
|
783
807
|
[0.36.0]: https://github.com/nvisycom/sdk-ts/compare/v0.35.0...v0.36.0
|
|
784
808
|
[0.35.0]: https://github.com/nvisycom/sdk-ts/compare/v0.34.0...v0.35.0
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as ClientConfig } from "./config-BhUEqFOg.js";
|
|
2
1
|
import { $n as ChatMessage, $t as ReplyInvite, Aa as Account$1, At as NotificationPage, Cn as PipelineDetectionsQuery, Dn as RedactionResultPage, Dr as Audit, En as RedactionResult, Fa as UpdateAccount, Fn as ConnectionSync, Ft as UnreadStatus, Gn as SyncConnection, Gt as InviteCode, Ht as CreateInvite, Ia as paths, In as ConnectionSyncPage, It as UpdateNotificationSettings, Jt as InvitePreview, Ki as ApiToken, Ln as ConnectionVerification, Lt as ListMembers, M as CreatePolicy, Mt as NotificationSettings, On as WorkspaceDetectionsQuery, Pa as PublicAccount, Pn as ConnectionPage, Pt as UnreadCountEvent, Qi as UpdateApiToken, Qn as UpdateConnection, Qt as ListInvites, Rt as Member, Sn as DetectionStatusEvent, Tt as MarkedReadStatus, Ut as GenerateInviteCode, Vt as UpdateMember, X as Policy, Xi as CreateApiToken, Xn as SyncStatus, Yi as ApiTokenWithJWT, Yt as InviteSent, _a as ActivityPage, _n as Detection, _t as PipelineSummaryPage, ar as SendChatMessage, bn as DetectionPage, bt as CursorPagination, c as WorkspacePage, cn as ListFiles, d as CreateWebhook, dn as DateWindow, dr as Signup, dt as CreatePipeline, f as TestWebhook, ft as Pipeline, ga as ActivityFilterQuery, gn as CreateDetection, h as WebhookCreated, ha as ActivityExportOptions, ht as PipelineStatus, in as File, ir as CreateChatSession, jn as Connection, lr as AuthToken, lt as UpdatePolicy, m as Webhook, na as DetectionTimeSeries, nn as Health, nr as ChatSessionPage, o as UpdateWorkspace, on as FilePage, or as LabelCatalog, p as UpdateWebhook, pa as WorkspaceAnalytics, pn as ExportQuery, qi as ApiTokenPage, qt as InvitePage, rr as ChatToken, s as Workspace, sr as RecognizerCatalog, t as CreateWorkspace, tr as ChatSession, tt as PolicySummaryPage, un as UpdateFile, ur as Login, v as WebhookPage, wn as RedactDetection, y as WebhookResult, yt as UpdatePipeline, zn as CreateConnection, zt as MemberPage } from "./index-DLovEyXI.js";
|
|
2
|
+
import { t as ClientConfig } from "./config-BhUEqFOg.js";
|
|
3
3
|
import { Client } from "openapi-fetch";
|
|
4
4
|
//#region src/services/account.d.ts
|
|
5
5
|
/**
|
|
@@ -1149,4 +1149,4 @@ declare class Nvisy {
|
|
|
1149
1149
|
}
|
|
1150
1150
|
//#endregion
|
|
1151
1151
|
export { Account as S, Catalog as _, Syncs as a, Analytics as b, Policies as c, Members as d, Invites as f, Chat as g, Connections as h, Webhooks as i, Pipelines as l, Detections as m, Nvisy as n, Status as o, Files as p, Workspaces as r, Redactions as s, ApiClient as t, Notifications as u, Auth as v, Activities as x, ApiTokens as y };
|
|
1152
|
-
//# sourceMappingURL=client-
|
|
1152
|
+
//# sourceMappingURL=client-DvFWnhWc.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-
|
|
1
|
+
{"version":3,"file":"client-DvFWnhWc.d.ts","names":[],"sources":["../src/services/account.ts","../src/services/activities.ts","../src/services/analytics.ts","../src/services/api-tokens.ts","../src/services/auth.ts","../src/services/catalog.ts","../src/services/chat.ts","../src/services/connections.ts","../src/services/detections.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/redactions.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;;;;;;;cC/E1B;;EAGA,YAAA,KAAK;;;;;;;;;EAYX,eACL,uBACA,QAAQ,sBAAsB,aAAa,mBACzC,QAAQ;;;;;;;;;EAkBL,iBACL,uBACA,QAAQ,sBAAsB,aAAa,wBACzC,QAAQ;;;;;;;cCzCC;;EAGA,YAAA,KAAK;;;;;;;EAUX,aAAa,wBAAwB,QAAQ;;;;;;;;EAiB7C,uBACL,uBACA,QAAQ,aACN,QAAQ;;;;;;;cC9BC;;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;;;;;;E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;EAiBzD,YACL,uBACA,mBACA,UAAU,cACR,QAAQ;;;;;;;cCrHC;;EAGA,YAAA,KAAK;;;;;;;EAUX,eAAe,QAAQ,mBAAmB,QAAQ;;;;;;;EAalD,aAAa,wBAAwB,QAAQ;;;;;;;EAa7C,gBAAgB,WAAW,kBAAkB,QAAQ;;;;;;;;EAcrD,gBACL,uBACA,SAAS,kBACP,QAAQ;;;;;;;EAcL,gBAAgB,wBAAwB;;;;;;;EAYxC,wBACL,wBACE,QAAQ;;;;;;;;EAiBL,2BACL,uBACA,UAAU,6BACR,QAAQ;;;;;;;;EAkBL,aAAa,uBAAuB,QAAQ,OAAO;;;;;;;EAqBnD,aAAa,wBAAwB;;;;;;;;;;KCzGhC,YAAY,OAAc;;;;;;;;;;;cAsBzB;;;;;;;;;;;;;;;;;EA4BA,YAAA,QAAQ;;;;;;;;;;;;;;;;;;;;;EAyFpB,aAAa,mBAAmB;;;;;;MAS5B;;;;;;;;;MAYA,OAAO;;;;MAOP,QAAQ;;;;MAOR,UAAU;;;;MAOV,WAAW;;;;MAOX,cAAc;;;;MAOd,aAAa;;;;MAOb,QAAQ;;;;MAOR,aAAa;;;;MAOb,eAAe;;;;MAOf,SAAS;;;;MAOT,aAAa;;;;MAOb,YAAY;;;;MAOZ,WAAW;;;;MAOX,WAAW;;;;MAOX,WAAW;;;;MAOX,iBAAiB;;;;MAOjB,cAAc;;;;MAOd,cAAc;;;;MAOd,SAAS;;;;MAOT,YAAY;;;;MAOZ,cAAc"}
|
|
@@ -7,7 +7,7 @@ import { n as NvisyError, t as NvisyApiError } from "./errors-BOLD8iC1.js";
|
|
|
7
7
|
* Injected from `package.json` at build time, so it always matches the
|
|
8
8
|
* published version. Used in the default user agent string.
|
|
9
9
|
*/
|
|
10
|
-
const VERSION = "0.
|
|
10
|
+
const VERSION = "0.38.0";
|
|
11
11
|
/**
|
|
12
12
|
* Default configuration values used when options are not explicitly provided.
|
|
13
13
|
*/
|
|
@@ -44,4 +44,4 @@ const errorMiddleware = {
|
|
|
44
44
|
|
|
45
45
|
//#endregion
|
|
46
46
|
export { DEFAULTS as n, VERSION as r, errorMiddleware as t };
|
|
47
|
-
//# sourceMappingURL=error-
|
|
47
|
+
//# sourceMappingURL=error-Bkntcqmi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-
|
|
1
|
+
{"version":3,"file":"error-Bkntcqmi.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 * 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 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":";;;;;;;;;AAsBA,MAAa;;;;AAyEb,MAAa,WAAW;;;;CAIvB,UAAU;;;;CAKV,YAAY,gBAAgB;AAC7B;;;;;;;;ACjGA,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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as DEFAULTS, r as VERSION, t as ClientConfig } from "./config-BhUEqFOg.js";
|
|
2
1
|
import { mn as ErrorResponse } from "./index-DLovEyXI.js";
|
|
3
|
-
import { n as
|
|
2
|
+
import { n as DEFAULTS, r as VERSION, t as ClientConfig } from "./config-BhUEqFOg.js";
|
|
3
|
+
import { n as Nvisy, t as ApiClient } from "./client-DvFWnhWc.js";
|
|
4
4
|
import { n as NvisyError, t as NvisyApiError } from "./errors-CqL-N7iB.js";
|
|
5
5
|
export { type ApiClient, type ClientConfig, DEFAULTS, type ErrorResponse, Nvisy, NvisyApiError, NvisyError, VERSION };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as DEFAULTS, r as VERSION, t as errorMiddleware } from "./error-
|
|
1
|
+
import { n as DEFAULTS, r as VERSION, t as errorMiddleware } from "./error-Bkntcqmi.js";
|
|
2
2
|
import { n as NvisyError, t as NvisyApiError } from "./errors-BOLD8iC1.js";
|
|
3
3
|
import { _ as ApiTokens, a as Redactions, b as Account, c as Notifications, d as Files, f as Detections, g as Auth, h as Catalog, i as Status, l as Members, m as Chat, n as Webhooks, o as Policies, p as Connections, r as Syncs, s as Pipelines, t as Workspaces, u as Invites, v as Analytics, y as Activities } from "./services-BEP_y6VO.js";
|
|
4
4
|
import createClient from "openapi-fetch";
|
package/dist/services/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { S as Account, _ as Catalog, a as Syncs, b as Analytics, c as Policies, d as Members, f as Invites, g as Chat, h as Connections, i as Webhooks, l as Pipelines, m as Detections, o as Status, p as Files, r as Workspaces, s as Redactions, u as Notifications, v as Auth, x as Activities, y as ApiTokens } from "../client-
|
|
1
|
+
import { S as Account, _ as Catalog, a as Syncs, b as Analytics, c as Policies, d as Members, f as Invites, g as Chat, h as Connections, i as Webhooks, l as Pipelines, m as Detections, o as Status, p as Files, r as Workspaces, s as Redactions, u as Notifications, v as Auth, x as Activities, y as ApiTokens } from "../client-DvFWnhWc.js";
|
|
2
2
|
export { Account, Activities, Analytics, ApiTokens, Auth, Catalog, Chat, Connections, Detections, Files, Invites, Members, Notifications, Pipelines, Policies, Redactions, Status, Syncs, Webhooks, Workspaces };
|
|
@@ -1,25 +1,33 @@
|
|
|
1
|
+
import { dr as Signup, lr as AuthToken, nn as Health, ur as Login } from "../index-DLovEyXI.js";
|
|
1
2
|
import { t as ClientConfig } from "../config-BhUEqFOg.js";
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
//#region src/standalone/http.d.ts
|
|
4
|
+
/** Config accepted by a standalone (unauthenticated) client. */
|
|
5
|
+
type PublicConfig = Omit<ClientConfig, "apiToken">;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/standalone/config.d.ts
|
|
4
8
|
/**
|
|
5
|
-
* Configuration
|
|
6
|
-
*
|
|
7
|
-
* This type omits `apiToken` from {@link ClientConfig} since auth functions
|
|
8
|
-
* are used to obtain a token in the first place.
|
|
9
|
+
* Configuration for the standalone authentication functions.
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
|
|
11
|
+
* Omits `apiToken` — these functions exist to obtain a token in the first
|
|
12
|
+
* place.
|
|
13
|
+
*/
|
|
14
|
+
type AuthConfig = PublicConfig;
|
|
15
|
+
/**
|
|
16
|
+
* Configuration for the standalone {@link checkHealth} function.
|
|
13
17
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* { baseUrl: "https://api.nvisy.com" }
|
|
17
|
-
* );
|
|
18
|
-
* ```
|
|
18
|
+
* Omits `apiToken`: the health endpoint is public. Adds the API `version`
|
|
19
|
+
* segment of the health route.
|
|
19
20
|
*/
|
|
20
|
-
type
|
|
21
|
+
type HealthConfig = PublicConfig & {
|
|
22
|
+
/**
|
|
23
|
+
* API version segment of the health route.
|
|
24
|
+
*
|
|
25
|
+
* @default "v1"
|
|
26
|
+
*/
|
|
27
|
+
version?: string;
|
|
28
|
+
};
|
|
21
29
|
//#endregion
|
|
22
|
-
//#region src/auth
|
|
30
|
+
//#region src/standalone/auth.d.ts
|
|
23
31
|
/**
|
|
24
32
|
* Login with email and password to obtain an auth token.
|
|
25
33
|
*
|
|
@@ -33,7 +41,7 @@ type AuthConfig = Omit<ClientConfig, "apiToken">;
|
|
|
33
41
|
*
|
|
34
42
|
* @example
|
|
35
43
|
* ```typescript
|
|
36
|
-
* import { login } from "@nvisy/sdk/
|
|
44
|
+
* import { login } from "@nvisy/sdk/standalone";
|
|
37
45
|
* import { Nvisy } from "@nvisy/sdk";
|
|
38
46
|
*
|
|
39
47
|
* const token = await login({
|
|
@@ -58,7 +66,7 @@ declare function login(credentials: Login, config?: AuthConfig): Promise<AuthTok
|
|
|
58
66
|
*
|
|
59
67
|
* @example
|
|
60
68
|
* ```typescript
|
|
61
|
-
* import { signup } from "@nvisy/sdk/
|
|
69
|
+
* import { signup } from "@nvisy/sdk/standalone";
|
|
62
70
|
* import { Nvisy } from "@nvisy/sdk";
|
|
63
71
|
*
|
|
64
72
|
* const token = await signup({
|
|
@@ -72,5 +80,20 @@ declare function login(credentials: Login, config?: AuthConfig): Promise<AuthTok
|
|
|
72
80
|
*/
|
|
73
81
|
declare function signup(details: Signup, config?: AuthConfig): Promise<AuthToken>;
|
|
74
82
|
//#endregion
|
|
75
|
-
|
|
83
|
+
//#region src/standalone/health.d.ts
|
|
84
|
+
/**
|
|
85
|
+
* Check the health status of the API, without an API token or a client.
|
|
86
|
+
*
|
|
87
|
+
* The health endpoint is public: an unauthenticated request returns a cached
|
|
88
|
+
* status, an authenticated one performs a real-time check. This function sends
|
|
89
|
+
* no token; pass one via `config.headers` if a real-time check is desired.
|
|
90
|
+
*
|
|
91
|
+
* @param config - Optional configuration (baseUrl, headers, userAgent, fetch,
|
|
92
|
+
* version)
|
|
93
|
+
* @returns Promise that resolves with the API health status (for both the
|
|
94
|
+
* healthy `200` and degraded `503` responses)
|
|
95
|
+
*/
|
|
96
|
+
declare function checkHealth(config?: HealthConfig): Promise<Health>;
|
|
97
|
+
//#endregion
|
|
98
|
+
export { type AuthConfig, type HealthConfig, checkHealth, login, signup };
|
|
76
99
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/standalone/http.ts","../../src/standalone/config.ts","../../src/standalone/auth.ts","../../src/standalone/health.ts"],"mappings":";;;;KAeY,eAAe,KAAK;;;;;;;;;KCApB,aAAa;;;;;;;KAQb,eAAe;;;;;;EAM1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCgCqB,MACrB,aAAa,OACb,SAAS,aACP,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiCW,OACrB,SAAS,QACT,SAAS,aACP,QAAQ;;;;;;;;;;;;;;;iBCjEW,YAAY,SAAS,eAAe,QAAQ"}
|
|
@@ -1,39 +1,24 @@
|
|
|
1
|
-
import { n as DEFAULTS, t as errorMiddleware } from "../error-
|
|
1
|
+
import { n as DEFAULTS, t as errorMiddleware } from "../error-Bkntcqmi.js";
|
|
2
2
|
import createClient from "openapi-fetch";
|
|
3
3
|
|
|
4
|
-
//#region src/
|
|
4
|
+
//#region src/standalone/http.ts
|
|
5
5
|
/**
|
|
6
|
-
* @fileoverview
|
|
6
|
+
* @fileoverview Shared openapi-fetch client factory for the SDK's standalone
|
|
7
|
+
* operations (auth, health) that run before a {@link Nvisy} client exists.
|
|
7
8
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* an authenticated {@link Client} instance.
|
|
11
|
-
*
|
|
12
|
-
* @module auth/password
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* import { login, signup } from "@nvisy/sdk/auth";
|
|
17
|
-
* import { Nvisy } from "@nvisy/sdk";
|
|
18
|
-
*
|
|
19
|
-
* // Login to get a token
|
|
20
|
-
* const token = await login({ email: "user@example.com", password: "..." });
|
|
21
|
-
*
|
|
22
|
-
* // Create authenticated client
|
|
23
|
-
* const nvisy = new Nvisy({ apiToken: token.accessToken });
|
|
24
|
-
* ```
|
|
9
|
+
* @module http
|
|
10
|
+
* @internal
|
|
25
11
|
*/
|
|
26
12
|
/**
|
|
27
|
-
*
|
|
13
|
+
* Build an unauthenticated openapi-fetch client from a {@link PublicConfig}.
|
|
28
14
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* @internal
|
|
15
|
+
* Applies the shared base URL / user-agent / header / fetch resolution used by
|
|
16
|
+
* both the auth helpers and the health check.
|
|
32
17
|
*/
|
|
33
|
-
function
|
|
18
|
+
function createPublicClient(config, { json = false, errorHandling = true } = {}) {
|
|
34
19
|
const headers = {
|
|
35
|
-
"Content-Type": "application/json",
|
|
36
20
|
"User-Agent": config?.userAgent ?? DEFAULTS.USER_AGENT,
|
|
21
|
+
...json ? { "Content-Type": "application/json" } : {},
|
|
37
22
|
...config?.headers
|
|
38
23
|
};
|
|
39
24
|
const client = createClient({
|
|
@@ -41,9 +26,22 @@ function createAuthClient(config) {
|
|
|
41
26
|
headers,
|
|
42
27
|
fetch: config?.fetch
|
|
43
28
|
});
|
|
44
|
-
client.use(errorMiddleware);
|
|
29
|
+
if (errorHandling) client.use(errorMiddleware);
|
|
45
30
|
return client;
|
|
46
31
|
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/standalone/auth.ts
|
|
35
|
+
/**
|
|
36
|
+
* Creates an unauthenticated API client for auth operations.
|
|
37
|
+
*
|
|
38
|
+
* @param config - Optional configuration options
|
|
39
|
+
* @returns A configured openapi-fetch client without authentication
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
function createAuthClient(config) {
|
|
43
|
+
return createPublicClient(config, { json: true });
|
|
44
|
+
}
|
|
47
45
|
/**
|
|
48
46
|
* Login with email and password to obtain an auth token.
|
|
49
47
|
*
|
|
@@ -57,7 +55,7 @@ function createAuthClient(config) {
|
|
|
57
55
|
*
|
|
58
56
|
* @example
|
|
59
57
|
* ```typescript
|
|
60
|
-
* import { login } from "@nvisy/sdk/
|
|
58
|
+
* import { login } from "@nvisy/sdk/standalone";
|
|
61
59
|
* import { Nvisy } from "@nvisy/sdk";
|
|
62
60
|
*
|
|
63
61
|
* const token = await login({
|
|
@@ -85,7 +83,7 @@ async function login(credentials, config) {
|
|
|
85
83
|
*
|
|
86
84
|
* @example
|
|
87
85
|
* ```typescript
|
|
88
|
-
* import { signup } from "@nvisy/sdk/
|
|
86
|
+
* import { signup } from "@nvisy/sdk/standalone";
|
|
89
87
|
* import { Nvisy } from "@nvisy/sdk";
|
|
90
88
|
*
|
|
91
89
|
* const token = await signup({
|
|
@@ -103,5 +101,24 @@ async function signup(details, config) {
|
|
|
103
101
|
}
|
|
104
102
|
|
|
105
103
|
//#endregion
|
|
106
|
-
|
|
104
|
+
//#region src/standalone/health.ts
|
|
105
|
+
/**
|
|
106
|
+
* Check the health status of the API, without an API token or a client.
|
|
107
|
+
*
|
|
108
|
+
* The health endpoint is public: an unauthenticated request returns a cached
|
|
109
|
+
* status, an authenticated one performs a real-time check. This function sends
|
|
110
|
+
* no token; pass one via `config.headers` if a real-time check is desired.
|
|
111
|
+
*
|
|
112
|
+
* @param config - Optional configuration (baseUrl, headers, userAgent, fetch,
|
|
113
|
+
* version)
|
|
114
|
+
* @returns Promise that resolves with the API health status (for both the
|
|
115
|
+
* healthy `200` and degraded `503` responses)
|
|
116
|
+
*/
|
|
117
|
+
async function checkHealth(config) {
|
|
118
|
+
const { data, error } = await createPublicClient(config, { errorHandling: false }).GET("/health/", { params: { path: { version: config?.version ?? "v1" } } });
|
|
119
|
+
return data ?? error;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
//#endregion
|
|
123
|
+
export { checkHealth, login, signup };
|
|
107
124
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/standalone/http.ts","../../src/standalone/auth.ts","../../src/standalone/health.ts"],"sourcesContent":["/**\n * @fileoverview Shared openapi-fetch client factory for the SDK's standalone\n * operations (auth, health) that run before a {@link Nvisy} client exists.\n *\n * @module http\n * @internal\n */\n\nimport createClient from \"openapi-fetch\";\nimport type { ClientConfig } from \"@/config.js\";\nimport { DEFAULTS } from \"@/config.js\";\nimport { errorMiddleware } from \"@/middleware/index.js\";\nimport type { paths } from \"@/schema/api.js\";\n\n/** Config accepted by a standalone (unauthenticated) client. */\nexport type PublicConfig = Omit<ClientConfig, \"apiToken\">;\n\ninterface PublicClientOptions {\n\t/** Send a JSON `Content-Type` header (for requests with a body). */\n\tjson?: boolean;\n\t/**\n\t * Throw {@link NvisyApiError} / {@link NvisyError} on non-2xx responses and\n\t * network failures. Off for endpoints where a non-2xx body is a valid\n\t * result (e.g. health `503`).\n\t *\n\t * @default true\n\t */\n\terrorHandling?: boolean;\n}\n\n/**\n * Build an unauthenticated openapi-fetch client from a {@link PublicConfig}.\n *\n * Applies the shared base URL / user-agent / header / fetch resolution used by\n * both the auth helpers and the health check.\n */\nexport function createPublicClient(\n\tconfig?: PublicConfig,\n\t{ json = false, errorHandling = true }: PublicClientOptions = {},\n) {\n\tconst headers: Record<string, string> = {\n\t\t\"User-Agent\": config?.userAgent ?? DEFAULTS.USER_AGENT,\n\t\t...(json ? { \"Content-Type\": \"application/json\" } : {}),\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\tif (errorHandling) client.use(errorMiddleware);\n\treturn client;\n}\n","/**\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 standalone/auth\n *\n * @example\n * ```typescript\n * import { login, signup } from \"@nvisy/sdk/standalone\";\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 type { AuthToken, Login, Signup } from \"@/datatypes/index.js\";\nimport type { AuthConfig } from \"@/standalone/config.js\";\nimport { createPublicClient } from \"@/standalone/http.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\treturn createPublicClient(config, { json: true });\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/standalone\";\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/standalone\";\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","/**\n * @fileoverview Standalone API health check.\n *\n * This module provides a `checkHealth` function that does not require an API\n * token or a {@link Nvisy} client. Use it as a pre-auth liveness probe.\n *\n * @module standalone/health\n *\n * @example\n * ```typescript\n * import { checkHealth } from \"@nvisy/sdk/standalone\";\n *\n * const health = await checkHealth();\n * if (health.status !== \"healthy\") {\n * // back off, retry, alert, ...\n * }\n * ```\n */\n\nimport type { Health } from \"@/datatypes/index.js\";\nimport type { HealthConfig } from \"@/standalone/config.js\";\nimport { createPublicClient } from \"@/standalone/http.js\";\n\n/**\n * Check the health status of the API, without an API token or a client.\n *\n * The health endpoint is public: an unauthenticated request returns a cached\n * status, an authenticated one performs a real-time check. This function sends\n * no token; pass one via `config.headers` if a real-time check is desired.\n *\n * @param config - Optional configuration (baseUrl, headers, userAgent, fetch,\n * version)\n * @returns Promise that resolves with the API health status (for both the\n * healthy `200` and degraded `503` responses)\n */\nexport async function checkHealth(config?: HealthConfig): Promise<Health> {\n\t// `errorHandling: false` — the health endpoint returns a `Health` body on\n\t// both `200` (healthy) and `503` (degraded); a degraded status is a valid\n\t// result to return, not an error to throw.\n\tconst client = createPublicClient(config, { errorHandling: false });\n\n\tconst { data, error } = await client.GET(\"/health/\", {\n\t\tparams: { path: { version: config?.version ?? \"v1\" } },\n\t});\n\t// `data` on 200, `error` on 503 — both carry a `Health` body.\n\treturn (data ?? error) as Health;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAoCA,SAAgB,mBACf,QACA,EAAE,OAAO,OAAO,gBAAgB,SAA8B,CAAC,GAC9D;CACD,MAAM,UAAkC;EACvC,cAAc,QAAQ,aAAa,SAAS;EAC5C,GAAI,OAAO,EAAE,gBAAgB,mBAAmB,IAAI,CAAC;EACrD,GAAG,QAAQ;CACZ;CAEA,MAAM,SAAS,aAAoB;EAClC,SAAS,QAAQ,WAAW,SAAS;EACrC;EAEA,OAAO,QAAQ;CAChB,CAAC;CAED,IAAI,eAAe,OAAO,IAAI,eAAe;CAC7C,OAAO;AACR;;;;;;;;;;;ACtBA,SAAS,iBAAiB,QAAqB;CAC9C,OAAO,mBAAmB,QAAQ,EAAE,MAAM,KAAK,CAAC;AACjD;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;ACvEA,eAAsB,YAAY,QAAwC;CAMzE,MAAM,EAAE,MAAM,UAAU,MAFT,mBAAmB,QAAQ,EAAE,eAAe,MAAM,CAE9B,CAAC,CAAC,IAAI,YAAY,EACpD,QAAQ,EAAE,MAAM,EAAE,SAAS,QAAQ,WAAW,KAAK,EAAE,EACtD,CAAC;CAED,OAAQ,QAAQ;AACjB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nvisy/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.0",
|
|
4
4
|
"description": "Official TypeScript SDK for Nvisy document processing platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"types": "./dist/index.d.ts",
|
|
38
38
|
"import": "./dist/index.js"
|
|
39
39
|
},
|
|
40
|
-
"./
|
|
41
|
-
"types": "./dist/
|
|
42
|
-
"import": "./dist/
|
|
40
|
+
"./standalone": {
|
|
41
|
+
"types": "./dist/standalone/index.d.ts",
|
|
42
|
+
"import": "./dist/standalone/index.js"
|
|
43
43
|
},
|
|
44
44
|
"./services": {
|
|
45
45
|
"types": "./dist/services/index.d.ts",
|
package/dist/auth/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/auth/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|