@wakata-dev/api-client 0.3.0 → 0.3.1
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/dist/index.cjs +3 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +877 -1832
- package/dist/index.d.ts +877 -1832
- package/dist/index.js +3 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -115,7 +115,7 @@ function generateIdempotencyKey() {
|
|
|
115
115
|
return `wak_idem_${uuid.replace(/-/g, "")}`;
|
|
116
116
|
}
|
|
117
117
|
var client = clientFetch.createClient(clientFetch.createConfig({
|
|
118
|
-
baseUrl: "https://
|
|
118
|
+
baseUrl: "https://api.wakata.ai"
|
|
119
119
|
}));
|
|
120
120
|
|
|
121
121
|
// src/generated/sdk.gen.ts
|
|
@@ -257,22 +257,6 @@ var inspectionControllerGetPublicInspection = (options) => {
|
|
|
257
257
|
...options
|
|
258
258
|
});
|
|
259
259
|
};
|
|
260
|
-
var inspectionControllerSubmitInspectionPublic = (options) => {
|
|
261
|
-
return (options.client ?? client).post({
|
|
262
|
-
security: [
|
|
263
|
-
{
|
|
264
|
-
scheme: "bearer",
|
|
265
|
-
type: "http"
|
|
266
|
-
}
|
|
267
|
-
],
|
|
268
|
-
url: "/public/inspection/submit",
|
|
269
|
-
...options,
|
|
270
|
-
headers: {
|
|
271
|
-
"Content-Type": "application/json",
|
|
272
|
-
...options?.headers
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
};
|
|
276
260
|
var issueControllerListIssues = (options) => {
|
|
277
261
|
return (options?.client ?? client).get({
|
|
278
262
|
security: [
|
|
@@ -516,7 +500,7 @@ var siteControllerUpdateSite = (options) => {
|
|
|
516
500
|
|
|
517
501
|
// src/client.ts
|
|
518
502
|
var DEFAULT_BASE_URL = "https://api.wakata.ai/api/v1";
|
|
519
|
-
var PACKAGE_VERSION = "0.3.
|
|
503
|
+
var PACKAGE_VERSION = "0.3.1";
|
|
520
504
|
function unwrap(result) {
|
|
521
505
|
if (result.data === void 0) {
|
|
522
506
|
throw new WakataApiError({
|
|
@@ -622,9 +606,6 @@ var WakataClient = class {
|
|
|
622
606
|
),
|
|
623
607
|
getDetail: async (opts) => unwrap(
|
|
624
608
|
await inspectionControllerGetPublicInspection({ ...opts, client: client2 })
|
|
625
|
-
),
|
|
626
|
-
submit: async (opts) => unwrap(
|
|
627
|
-
await inspectionControllerSubmitInspectionPublic({ ...opts, client: client2 })
|
|
628
609
|
)
|
|
629
610
|
};
|
|
630
611
|
this.issues = {
|
|
@@ -678,7 +659,7 @@ var WakataClient = class {
|
|
|
678
659
|
|
|
679
660
|
// src/index.ts
|
|
680
661
|
var PACKAGE_NAME = "@wakata-dev/api-client";
|
|
681
|
-
var PACKAGE_VERSION2 = "0.3.
|
|
662
|
+
var PACKAGE_VERSION2 = "0.3.1";
|
|
682
663
|
var DEFAULT_BASE_URL2 = "https://api.wakata.ai/api/v1";
|
|
683
664
|
|
|
684
665
|
exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL2;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors.ts","../src/idempotency.ts","../src/generated/client.gen.ts","../src/generated/sdk.gen.ts","../src/client.ts","../src/index.ts"],"names":["createClient","createConfig","formDataBodySerializer","client","PACKAGE_VERSION","DEFAULT_BASE_URL"],"mappings":";;;;;;;AAiEO,IAAM,cAAA,GAAN,cAA6B,KAAA,CAAM;AAAA,EAcjC,YAAY,IAAA,EAQhB;AACD,IAAA,KAAA,CAAM,KAAK,OAAO,CAAA;AAClB,IAAA,IAAA,CAAK,IAAA,GAAO,gBAAA;AACZ,IAAA,IAAA,CAAK,OAAO,IAAA,CAAK,IAAA;AACjB,IAAA,IAAA,CAAK,aAAa,IAAA,CAAK,UAAA;AACvB,IAAA,IAAA,CAAK,YAAY,IAAA,CAAK,SAAA;AACtB,IAAA,IAA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AAC;AAAA,UACb,MAAA,EAAAA;AAAA,SACD;AAAA,OACH;AAAA,MACF,SAAA,EAAW,OAAO,IAAA,KAChB,MAAA;AAAA,QACE,MAAM,qCAAA,CAAsC;AAAA,UAC1C,GAAI,QAAQ,EAAC;AAAA,UACb,MAAA,EAAAA;AAAA,SACD;AAAA,OACH;AAAA,MACF,OAAA,EAAS,OAAO,IAAA,KACd,MAAA,CAAO,MAAM,mCAAA,CAAoC,EAAE,GAAG,IAAA,EAAM,MAAA,EAAAA,OAAAA,EAAQ,CAAC,CAAA;AAAA,MACvE,UAAA,EAAY,OAAO,IAAA,KACjB,MAAA;AAAA,QACE,MAAM,sCAAA,CAAuC,EAAE,GAAG,IAAA,EAAM,MAAA,EAAAA,SAAQ;AAAA,OAClE;AAAA,MACF,UAAA,EAAY,OAAO,IAAA,KACjB,MAAA;AAAA,QACE,MAAM,sCAAA,CAAuC,EAAE,GAAG,IAAA,EAAM,MAAA,EAAAA,SAAQ;AAAA,OAClE;AAAA,MACF,UAAA,EAAY,OAAO,IAAA,KACjB,MAAA;AAAA,QACE,MAAM,sCAAA,CAAuC,EAAE,GAAG,IAAA,EAAM,MAAA,EAAAA,SAAQ;AAAA;AAClE,KACJ;AAAA,EACF;AACF;;;AC9iBO,IAAM,YAAA,GAAe;AACrB,IAAMC,gBAAAA,GAAkB;AAGxB,IAAMC,iBAAAA,GAAmB","file":"index.cjs","sourcesContent":["/**\n * Typed error hierarchy for the Wakata API client.\n *\n * The Wakata Public API always returns a standardized error envelope on\n * non-2xx responses (see the portal's API Quickstart page,\n * Settings → API Keys → Quickstart § 5 \"Handling errors\"):\n *\n * ```json\n * {\n * \"error\": {\n * \"code\": \"validation_error\",\n * \"message\": \"Request validation failed.\",\n * \"request_id\": \"req_01HX...\",\n * \"docs_url\": \"https://docs.wakata.ai/errors/validation_error\",\n * \"param\": \"site_id\",\n * \"details\": [ { \"field\": \"site_id\", \"code\": \"isUuid\", \"message\": \"...\" } ]\n * }\n * }\n * ```\n *\n * The client maps each non-2xx response to the most specific subclass below.\n * Use `instanceof` checks to branch on the error type ergonomically:\n *\n * ```ts\n * try {\n * const asset = await wakata.assets.get('abc-123');\n * } catch (err) {\n * if (err instanceof WakataNotFoundError) { ... }\n * if (err instanceof WakataRateLimitError) {\n * await sleep((err.retryAfterSeconds ?? 60) * 1000);\n * }\n * throw err;\n * }\n * ```\n */\n\n/**\n * A single validation detail emitted by class-validator on `400` responses.\n */\nexport interface ErrorDetail {\n field: string;\n code: string;\n message: string;\n}\n\n/**\n * Raw shape of the error envelope returned by the API.\n *\n * Mirrors {@link https://docs.wakata.ai/errors} — kept loose because new\n * canonical codes may be added without breaking the SDK.\n */\nexport interface WakataErrorEnvelope {\n code: string;\n message: string;\n request_id: string;\n docs_url?: string;\n param?: string;\n details?: ErrorDetail[];\n}\n\n/**\n * Base error class for everything thrown by the Wakata API client when the\n * server responds with a non-2xx status. Network failures and unparseable\n * responses also surface as this base class with `code === 'unknown_error'`.\n */\nexport class WakataApiError extends Error {\n /** Canonical error code from `error.code` in the response envelope. */\n public readonly code: string;\n /** HTTP status code from the response. */\n public readonly statusCode: number;\n /** Server-assigned request ID (`X-Request-Id` / `error.request_id`). */\n public readonly requestId: string;\n /** Optional URL pointing at the docs page for this error code. */\n public readonly docsUrl: string | undefined;\n /** For validation-style errors, the offending parameter name. */\n public readonly param: string | undefined;\n /** For validation-style errors, the full field-level breakdown. */\n public readonly details: ErrorDetail[] | undefined;\n\n public constructor(args: {\n code: string;\n statusCode: number;\n requestId: string;\n docsUrl?: string | undefined;\n param?: string | undefined;\n details?: ErrorDetail[] | undefined;\n message: string;\n }) {\n super(args.message);\n this.name = 'WakataApiError';\n this.code = args.code;\n this.statusCode = args.statusCode;\n this.requestId = args.requestId;\n this.docsUrl = args.docsUrl;\n this.param = args.param;\n this.details = args.details;\n // Maintain the prototype chain for `instanceof` across compiled targets.\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * 4xx with `details` (typically 400 `validation_error` from class-validator).\n * `details` is guaranteed populated.\n */\nexport class WakataValidationError extends WakataApiError {\n public override readonly name = 'WakataValidationError';\n}\n\n/** 401 — missing, malformed, revoked or expired API key. */\nexport class WakataAuthError extends WakataApiError {\n public override readonly name = 'WakataAuthError';\n}\n\n/** 403 — authenticated key lacks the required permission / role. */\nexport class WakataPermissionError extends WakataApiError {\n public override readonly name = 'WakataPermissionError';\n}\n\n/** 404 — resource not found, or not visible to this API key. */\nexport class WakataNotFoundError extends WakataApiError {\n public override readonly name = 'WakataNotFoundError';\n}\n\n/** 409 — conflict, e.g. unique constraint violation or idempotency-key reuse with a different body. */\nexport class WakataConflictError extends WakataApiError {\n public override readonly name = 'WakataConflictError';\n}\n\n/**\n * 429 — rate limited. `retryAfterSeconds` is derived from the\n * `X-RateLimit-Reset` header (seconds until the window resets) where present.\n */\nexport class WakataRateLimitError extends WakataApiError {\n public override readonly name = 'WakataRateLimitError';\n public readonly retryAfterSeconds: number | undefined;\n\n public constructor(args: {\n code: string;\n statusCode: number;\n requestId: string;\n docsUrl?: string | undefined;\n param?: string | undefined;\n details?: ErrorDetail[] | undefined;\n message: string;\n retryAfterSeconds?: number | undefined;\n }) {\n super(args);\n this.retryAfterSeconds = args.retryAfterSeconds;\n }\n}\n\n/** 5xx — server error. Safe to retry with exponential backoff. */\nexport class WakataServerError extends WakataApiError {\n public override readonly name = 'WakataServerError';\n}\n\n/**\n * Map an HTTP status + response envelope to the most specific error subclass.\n *\n * Exported so callers can build their own retry/error layers on top.\n */\nexport function mapApiError(\n statusCode: number,\n envelope: WakataErrorEnvelope | undefined,\n fallbackRequestId: string,\n retryAfterSeconds?: number,\n): WakataApiError {\n const code = envelope?.code ?? 'unknown_error';\n const message =\n envelope?.message ?? `Wakata API returned HTTP ${statusCode}`;\n const requestId = envelope?.request_id ?? fallbackRequestId;\n const docsUrl = envelope?.docs_url;\n const param = envelope?.param;\n const details = envelope?.details;\n const base = {\n code,\n statusCode,\n requestId,\n docsUrl,\n param,\n details,\n message,\n };\n\n if (statusCode === 429) {\n return new WakataRateLimitError({\n ...base,\n retryAfterSeconds,\n });\n }\n if (statusCode === 401) return new WakataAuthError(base);\n if (statusCode === 403) return new WakataPermissionError(base);\n if (statusCode === 404) return new WakataNotFoundError(base);\n if (statusCode === 409) return new WakataConflictError(base);\n if (statusCode >= 500) return new WakataServerError(base);\n if (statusCode >= 400 && details && details.length > 0) {\n return new WakataValidationError(base);\n }\n return new WakataApiError(base);\n}\n","/**\n * Idempotency helpers.\n *\n * The Wakata Public API accepts an optional `Idempotency-Key` header on every\n * `POST` and `PATCH` write endpoint. Sending the same key with the same body\n * within 24h returns the cached original response instead of re-executing the\n * write — making it safe to retry network failures.\n *\n * This SDK auto-attaches a freshly-generated key on every POST/PATCH if the\n * caller hasn't provided one. Callers who want true cross-attempt idempotency\n * (i.e. the same logical operation across multiple retry attempts) should\n * generate their own key once and pass it via `headers: { 'Idempotency-Key': ... }`.\n *\n * See the Wakata portal's API Quickstart page (Settings → API Keys →\n * Quickstart) § 7 \"Safe retries with Idempotency-Key\" for the full contract.\n */\n\n/**\n * Generate an idempotency key prefixed with `wak_idem_`. Uses Web Crypto's\n * `randomUUID` where available, falling back to a v4-style UUID built from\n * `getRandomValues` for older Node runtimes.\n */\nexport function generateIdempotencyKey(): string {\n const c: Crypto | undefined =\n typeof globalThis !== 'undefined'\n ? (globalThis as { crypto?: Crypto }).crypto\n : undefined;\n let uuid: string;\n if (c && typeof c.randomUUID === 'function') {\n uuid = c.randomUUID();\n } else if (c && typeof c.getRandomValues === 'function') {\n const bytes = new Uint8Array(16);\n c.getRandomValues(bytes);\n // RFC 4122 v4 fixups\n bytes[6] = ((bytes[6] ?? 0) & 0x0f) | 0x40;\n bytes[8] = ((bytes[8] ?? 0) & 0x3f) | 0x80;\n const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join(\n '',\n );\n uuid = `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20, 32)}`;\n } else {\n // Last-ditch fallback. Not cryptographically strong but rare enough we\n // don't bring in a dep just for this; logging the runtime helps debug.\n uuid =\n Date.now().toString(16) +\n '-' +\n Math.random().toString(16).slice(2, 14).padEnd(12, '0');\n }\n return `wak_idem_${uuid.replace(/-/g, '')}`;\n}\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { ClientOptions } from './types.gen';\nimport { type Config, type ClientOptions as DefaultClientOptions, createClient, createConfig } from '@hey-api/client-fetch';\n\n/**\n * The `createClientConfig()` function will be called on client initialization\n * and the returned object will become the client's initial configuration.\n *\n * You may want to initialize your client this way instead of calling\n * `setConfig()`. This is useful for example if you're using Next.js\n * to ensure your client always has the correct values.\n */\nexport type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>;\n\nexport const client = createClient(createConfig<ClientOptions>({\n baseUrl: 'https://dev-api.wakata.ai'\n}));","// This file is auto-generated by @hey-api/openapi-ts\n\nimport { type Options as ClientOptions, type TDataShape, type Client, formDataBodySerializer } from '@hey-api/client-fetch';\nimport type { AssetControllerCreateAssetPublicData, AssetControllerCreateAssetPublicResponse, AssetControllerCreateAssetPublicError, AssetControllerListAssetsData, AssetControllerListAssetsResponse, AssetControllerListAssetsError, AssetControllerGetAssetData, AssetControllerGetAssetResponse, AssetControllerGetAssetError, AssetControllerUpdateAssetData, AssetControllerUpdateAssetResponse, AssetControllerUpdateAssetError, UserControllerListUsersData, UserControllerListUsersResponse, UserControllerListUsersError, UserControllerGetUserData, UserControllerGetUserResponse, UserControllerGetUserError, UserControllerUpdateUserData, UserControllerUpdateUserResponse, UserControllerUpdateUserError, UserControllerCreateUserData, UserControllerCreateUserResponse, UserControllerCreateUserError, InspectionControllerListInspectionsData, InspectionControllerListInspectionsResponse, InspectionControllerListInspectionsError, InspectionControllerGetPublicInspectionData, InspectionControllerGetPublicInspectionResponse, InspectionControllerGetPublicInspectionError, InspectionControllerSubmitInspectionPublicData, InspectionControllerSubmitInspectionPublicResponse, InspectionControllerSubmitInspectionPublicError, IssueControllerListIssuesData, IssueControllerListIssuesResponse, IssueControllerListIssuesError, IssueControllerGetIssuePublicData, IssueControllerGetIssuePublicResponse, IssueControllerGetIssuePublicError, IssueControllerUpdateIssuePublicData, IssueControllerUpdateIssuePublicResponse, IssueControllerUpdateIssuePublicError, IssueControllerGetIssueHistoryPublicData, IssueControllerGetIssueHistoryPublicResponse, IssueControllerGetIssueHistoryPublicError, UserPropertyControllerDeleteUserPropertyData, UserPropertyControllerDeleteUserPropertyResponse, UserPropertyControllerDeleteUserPropertyError, UserPropertyControllerUpdateUserPropertyData, UserPropertyControllerUpdateUserPropertyResponse, UserPropertyControllerUpdateUserPropertyError, AssetPropertyControllerDeleteAssetPropertyData, AssetPropertyControllerDeleteAssetPropertyResponse, AssetPropertyControllerDeleteAssetPropertyError, AssetPropertyControllerUpdateAssetPropertyData, AssetPropertyControllerUpdateAssetPropertyResponse, AssetPropertyControllerUpdateAssetPropertyError, AssetClassControllerGetAssetClassListData, AssetClassControllerGetAssetClassListResponse, AssetClassControllerGetAssetClassListError, AssetClassControllerCreateAssetClassData, AssetClassControllerCreateAssetClassResponse, AssetClassControllerCreateAssetClassError, AssetClassControllerUpdateAssetClassData, AssetClassControllerUpdateAssetClassResponse, AssetClassControllerUpdateAssetClassError, ChecklistControllerListChecklistsData, ChecklistControllerListChecklistsResponse, ChecklistControllerListChecklistsError, ChecklistControllerGetChecklistData, ChecklistControllerGetChecklistResponse, ChecklistControllerGetChecklistError, PublicConfigControllerListConfigTablesData, PublicConfigControllerListConfigTablesResponse, PublicConfigControllerListConfigTablesError, PublicConfigControllerListConfigItemsData, PublicConfigControllerListConfigItemsResponse, PublicConfigControllerListConfigItemsError, PublicConfigControllerDeleteConfigItemData, PublicConfigControllerDeleteConfigItemResponse, PublicConfigControllerDeleteConfigItemError, PublicConfigControllerGetConfigItemData, PublicConfigControllerGetConfigItemResponse, PublicConfigControllerGetConfigItemError, PublicConfigControllerUpdateConfigItemData, PublicConfigControllerUpdateConfigItemResponse, PublicConfigControllerUpdateConfigItemError, PublicConfigControllerCreateConfigItemData, PublicConfigControllerCreateConfigItemResponse, PublicConfigControllerCreateConfigItemError, SiteControllerListSitesData, SiteControllerListSitesResponse, SiteControllerListSitesError, SiteControllerCreateSiteData, SiteControllerCreateSiteResponse, SiteControllerCreateSiteError, SiteControllerDeleteSiteData, SiteControllerDeleteSiteResponse, SiteControllerDeleteSiteError, SiteControllerUpdateSiteData, SiteControllerUpdateSiteResponse, SiteControllerUpdateSiteError } from './types.gen';\nimport { client as _heyApiClient } from './client.gen';\n\nexport type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {\n /**\n * You can provide a client instance returned by `createClient()` instead of\n * individual options. This might be also useful if you want to implement a\n * custom client.\n */\n client?: Client;\n /**\n * You can pass arbitrary values through the `meta` object. This can be\n * used to access values that aren't defined as part of the SDK function.\n */\n meta?: Record<string, unknown>;\n};\n\n/**\n * Create a new asset (Public API)\n * Creates a new asset entry in the database via public API. Requires Bearer token authentication. Validates all entity references by their public_id and ensures they belong to the authenticated company. Supports `Idempotency-Key` for safe retries.\n */\nexport const assetControllerCreateAssetPublic = <ThrowOnError extends boolean = false>(options: Options<AssetControllerCreateAssetPublicData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).post<AssetControllerCreateAssetPublicResponse, AssetControllerCreateAssetPublicError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/asset',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n};\n\n/**\n * List assets with filters\n * Returns a paginated list of assets. Supports filtering by asset_class_name, created_by (user public_id), asset_number, and site_name. Also supports sorting and pagination. Requires Bearer token authentication.\n */\nexport const assetControllerListAssets = <ThrowOnError extends boolean = false>(options?: Options<AssetControllerListAssetsData, ThrowOnError>) => {\n return (options?.client ?? _heyApiClient).get<AssetControllerListAssetsResponse, AssetControllerListAssetsError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/asset/list',\n ...options\n });\n};\n\n/**\n * Get asset by public ID\n * Retrieves an asset by its public_id. Returns complete asset information. Requires Bearer token authentication.\n */\nexport const assetControllerGetAsset = <ThrowOnError extends boolean = false>(options: Options<AssetControllerGetAssetData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<AssetControllerGetAssetResponse, AssetControllerGetAssetError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/asset/{id}',\n ...options\n });\n};\n\n/**\n * Update asset by public ID\n * Partially updates an asset by its public_id. All fields are optional. Requires Bearer token authentication with asset:update permission. Validates asset_class and site_id references by public_id and ensures they belong to the same company as the asset. Supports `Idempotency-Key` for safe retries.\n */\nexport const assetControllerUpdateAsset = <ThrowOnError extends boolean = false>(options: Options<AssetControllerUpdateAssetData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).patch<AssetControllerUpdateAssetResponse, AssetControllerUpdateAssetError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/asset/{id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n};\n\n/**\n * List users\n * Returns a paginated list of users for the authenticated company. Supports filtering by various fields and sorting. Requires Bearer token authentication with user:list permission.\n */\nexport const userControllerListUsers = <ThrowOnError extends boolean = false>(options?: Options<UserControllerListUsersData, ThrowOnError>) => {\n return (options?.client ?? _heyApiClient).get<UserControllerListUsersResponse, UserControllerListUsersError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/user/list',\n ...options\n });\n};\n\n/**\n * Get user by public ID\n * Returns detailed information about a specific user including their properties. Requires Bearer token authentication with user:read permission.\n */\nexport const userControllerGetUser = <ThrowOnError extends boolean = false>(options: Options<UserControllerGetUserData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<UserControllerGetUserResponse, UserControllerGetUserError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/user/{id}',\n ...options\n });\n};\n\n/**\n * Update user information\n * Updates user fields including first name, last name, email, contact number, and profile photo. Photo is uploaded to S3 at :company_id/user-profile-photos/:filename. Requires Bearer token authentication with user:update permission for public API. Supports `Idempotency-Key` for safe retries.\n */\nexport const userControllerUpdateUser = <ThrowOnError extends boolean = false>(options: Options<UserControllerUpdateUserData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).patch<UserControllerUpdateUserResponse, UserControllerUpdateUserError, ThrowOnError>({\n ...formDataBodySerializer,\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/user/{id}',\n ...options,\n headers: {\n 'Content-Type': null,\n ...options?.headers\n }\n });\n};\n\n/**\n * Create a new user\n * Creates a new user entry in the database along with associated relationships (user_site, user_company, user_role). Validates all entity references by their public_id. Supports optional profile photo upload. Duplicate detection: returns 409 if phone number already exists in the company (hard block) or if same name exists at the site (soft block, override with force=true). Requires Bearer token authentication with user:create permission. Supports `Idempotency-Key` for safe retries.\n */\nexport const userControllerCreateUser = <ThrowOnError extends boolean = false>(options: Options<UserControllerCreateUserData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).post<UserControllerCreateUserResponse, UserControllerCreateUserError, ThrowOnError>({\n ...formDataBodySerializer,\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/user',\n ...options,\n headers: {\n 'Content-Type': null,\n ...options?.headers\n }\n });\n};\n\n/**\n * List inspections\n * Returns a paginated list of inspections for the authenticated company. Supports filtering by various fields and sorting. Requires Bearer token authentication with inspection:read permission.\n */\nexport const inspectionControllerListInspections = <ThrowOnError extends boolean = false>(options?: Options<InspectionControllerListInspectionsData, ThrowOnError>) => {\n return (options?.client ?? _heyApiClient).get<InspectionControllerListInspectionsResponse, InspectionControllerListInspectionsError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/inspection/list',\n ...options\n });\n};\n\n/**\n * Get inspection detail with responses\n * Returns a single inspection for the authenticated company, including its responses, response options, response media (exposed as signed CloudFront URLs in `media_url`), response extra info, history, and embedded custom properties (`inspection_properties[]`). Read-only — inspections are created only by the Wakata app. Requires Bearer token authentication with inspection:read permission.\n */\nexport const inspectionControllerGetPublicInspection = <ThrowOnError extends boolean = false>(options: Options<InspectionControllerGetPublicInspectionData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<InspectionControllerGetPublicInspectionResponse, InspectionControllerGetPublicInspectionError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/inspection/{public_id}',\n ...options\n });\n};\n\n/**\n * @deprecated\n * Submit inspection with nested data (deprecated)\n * DEPRECATED — inspections are created only by the Wakata app; this public create path is being retired (WAK-00560). Do not build new integrations against it. Submits a complete inspection with nested responses, response options, extra infos, and media. Uses PostgreSQL transactions to ensure atomicity. Checks if inspection already exists by public_id to avoid duplicates. Handles nested response tree structure with left/right values. Timestamps in input are Unix epoch (milliseconds for inspection times, seconds for others). Requires Bearer token authentication. Internal tokens bypass permission check, public tokens require inspection:create permission. Supports `Idempotency-Key` for safe retries.\n */\nexport const inspectionControllerSubmitInspectionPublic = <ThrowOnError extends boolean = false>(options: Options<InspectionControllerSubmitInspectionPublicData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).post<InspectionControllerSubmitInspectionPublicResponse, InspectionControllerSubmitInspectionPublicError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/inspection/submit',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n};\n\n/**\n * List issues\n * Returns a paginated list of issues for the authenticated company. Supports filtering by various fields and sorting. Requires Bearer token authentication with issue:read permission.\n */\nexport const issueControllerListIssues = <ThrowOnError extends boolean = false>(options?: Options<IssueControllerListIssuesData, ThrowOnError>) => {\n return (options?.client ?? _heyApiClient).get<IssueControllerListIssuesResponse, IssueControllerListIssuesError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/issue/list',\n ...options\n });\n};\n\n/**\n * Get issue by public ID\n * Returns detailed information about a specific issue. Requires Bearer token authentication with issue:read permission.\n */\nexport const issueControllerGetIssuePublic = <ThrowOnError extends boolean = false>(options: Options<IssueControllerGetIssuePublicData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<IssueControllerGetIssuePublicResponse, IssueControllerGetIssuePublicError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/issue/{public_id}',\n ...options\n });\n};\n\n/**\n * Update an issue\n * Updates an issue by its public_id. Requires Bearer token authentication with issue:update permission. Supports `Idempotency-Key` for safe retries.\n */\nexport const issueControllerUpdateIssuePublic = <ThrowOnError extends boolean = false>(options: Options<IssueControllerUpdateIssuePublicData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).patch<IssueControllerUpdateIssuePublicResponse, IssueControllerUpdateIssuePublicError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/issue/{public_id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n};\n\n/**\n * Get issue history by public ID\n * Returns all history entries for an issue identified by its public_id. History entries are ordered by changed_at timestamp in descending order (most recent first). Requires Bearer token authentication with issue:read permission.\n */\nexport const issueControllerGetIssueHistoryPublic = <ThrowOnError extends boolean = false>(options: Options<IssueControllerGetIssueHistoryPublicData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<IssueControllerGetIssueHistoryPublicResponse, IssueControllerGetIssueHistoryPublicError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/issue/{public_id}/history',\n ...options\n });\n};\n\n/**\n * Delete user property by ID\n * Performs a soft delete on a user property by its ID. Sets deletedAt and deletedById fields instead of permanently removing the record. Also creates a history record of the deletion. Requires Bearer token authentication with user:update permission.\n */\nexport const userPropertyControllerDeleteUserProperty = <ThrowOnError extends boolean = false>(options: Options<UserPropertyControllerDeleteUserPropertyData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).delete<UserPropertyControllerDeleteUserPropertyResponse, UserPropertyControllerDeleteUserPropertyError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/user-property/{id}',\n ...options\n });\n};\n\n/**\n * Update user property value by ID\n * Partially updates the value of a user property by its ID. The value is stored in the appropriate column (text_value, numeric_value, or date_value) based on the property type defined in config_items. Also creates a history record of the change. Requires Bearer token authentication with user:update permission. Supports `Idempotency-Key` for safe retries.\n */\nexport const userPropertyControllerUpdateUserProperty = <ThrowOnError extends boolean = false>(options: Options<UserPropertyControllerUpdateUserPropertyData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).patch<UserPropertyControllerUpdateUserPropertyResponse, UserPropertyControllerUpdateUserPropertyError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/user-property/{id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n};\n\n/**\n * Delete asset property by ID\n * Performs a soft delete on an asset property by its ID. Sets deletedAt and deletedById fields instead of permanently removing the record. Also creates a history record of the deletion. Requires Bearer token authentication with asset:update permission.\n */\nexport const assetPropertyControllerDeleteAssetProperty = <ThrowOnError extends boolean = false>(options: Options<AssetPropertyControllerDeleteAssetPropertyData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).delete<AssetPropertyControllerDeleteAssetPropertyResponse, AssetPropertyControllerDeleteAssetPropertyError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/asset-property/{id}',\n ...options\n });\n};\n\n/**\n * Update asset property value by ID\n * Partially updates the value of an asset property by its ID. The value is stored in the appropriate column (text_value, numeric_value, or date_value) based on the property type defined in config_items. Also creates a history record of the change. Requires Bearer token authentication with asset:update permission. Supports `Idempotency-Key` for safe retries.\n */\nexport const assetPropertyControllerUpdateAssetProperty = <ThrowOnError extends boolean = false>(options: Options<AssetPropertyControllerUpdateAssetPropertyData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).patch<AssetPropertyControllerUpdateAssetPropertyResponse, AssetPropertyControllerUpdateAssetPropertyError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/asset-property/{id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n};\n\n/**\n * Get paginated list of asset classes\n * Returns a paginated list of asset classes with optional filters for asset class name (make), sub-class name (model), category, and date range. Requires Bearer token authentication with asset-class:read permission.\n */\nexport const assetClassControllerGetAssetClassList = <ThrowOnError extends boolean = false>(options?: Options<AssetClassControllerGetAssetClassListData, ThrowOnError>) => {\n return (options?.client ?? _heyApiClient).get<AssetClassControllerGetAssetClassListResponse, AssetClassControllerGetAssetClassListError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/asset-class/list',\n ...options\n });\n};\n\n/**\n * Create a new asset class\n * Creates a new asset class record. Requires Bearer token authentication with asset-class:create permission. Supports `Idempotency-Key` for safe retries.\n */\nexport const assetClassControllerCreateAssetClass = <ThrowOnError extends boolean = false>(options: Options<AssetClassControllerCreateAssetClassData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).post<AssetClassControllerCreateAssetClassResponse, AssetClassControllerCreateAssetClassError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/asset-class',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n};\n\n/**\n * Update an asset class\n * Partially updates an asset class by its public ID (UUID). Only provided fields will be updated. Requires Bearer token authentication with asset-class:update permission. Supports `Idempotency-Key` for safe retries.\n */\nexport const assetClassControllerUpdateAssetClass = <ThrowOnError extends boolean = false>(options: Options<AssetClassControllerUpdateAssetClassData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).patch<AssetClassControllerUpdateAssetClassResponse, AssetClassControllerUpdateAssetClassError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/asset-class/{id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n};\n\n/**\n * List checklists (inspection templates)\n * Returns a paginated list of the latest published version of each checklist for the authenticated company. Read-only — checklists are created in-system only. Supports incremental sync via `checklist_date_updated_from`/`_to` (the `updated_at` watermark). Requires Bearer token authentication with checklist:read permission.\n */\nexport const checklistControllerListChecklists = <ThrowOnError extends boolean = false>(options?: Options<ChecklistControllerListChecklistsData, ThrowOnError>) => {\n return (options?.client ?? _heyApiClient).get<ChecklistControllerListChecklistsResponse, ChecklistControllerListChecklistsError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/checklist/list',\n ...options\n });\n};\n\n/**\n * Get checklist detail with items\n * Returns a single published checklist for the authenticated company, including its items (the question/folder tree, with left/right nested-set bounds). Read-only — checklists are created in-system only. Checklists have no public_id; use the numeric `id` from the list. Requires Bearer token authentication with checklist:read permission.\n */\nexport const checklistControllerGetChecklist = <ThrowOnError extends boolean = false>(options: Options<ChecklistControllerGetChecklistData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<ChecklistControllerGetChecklistResponse, ChecklistControllerGetChecklistError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/checklist/{id}',\n ...options\n });\n};\n\n/**\n * List config tables (lookup groupings)\n * Read-only list of the company’s config tables (e.g. \"Asset Category\"). Use the returned id/class to list or create items in a table. Requires company:settings:tables.\n */\nexport const publicConfigControllerListConfigTables = <ThrowOnError extends boolean = false>(options?: Options<PublicConfigControllerListConfigTablesData, ThrowOnError>) => {\n return (options?.client ?? _heyApiClient).get<PublicConfigControllerListConfigTablesResponse, PublicConfigControllerListConfigTablesError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/config-table/list',\n ...options\n });\n};\n\n/**\n * List config items (lookup values)\n * Lists the company’s config items (e.g. asset categories). Filter by config_table_id or config_table_class to scope to one table. Supports incremental sync via config_item_date_updated_from/_to. Requires company:settings:tables.\n */\nexport const publicConfigControllerListConfigItems = <ThrowOnError extends boolean = false>(options?: Options<PublicConfigControllerListConfigItemsData, ThrowOnError>) => {\n return (options?.client ?? _heyApiClient).get<PublicConfigControllerListConfigItemsResponse, PublicConfigControllerListConfigItemsError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/config-item/list',\n ...options\n });\n};\n\n/**\n * Delete a config item\n * Soft-deletes a config item. Company-scoped. Requires company:settings:tables.\n */\nexport const publicConfigControllerDeleteConfigItem = <ThrowOnError extends boolean = false>(options: Options<PublicConfigControllerDeleteConfigItemData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).delete<PublicConfigControllerDeleteConfigItemResponse, PublicConfigControllerDeleteConfigItemError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/config-item/{id}',\n ...options\n });\n};\n\n/**\n * Get a config item\n * Returns a single config item for the authenticated company. Config items have no public_id; use the numeric id. Requires company:settings:tables.\n */\nexport const publicConfigControllerGetConfigItem = <ThrowOnError extends boolean = false>(options: Options<PublicConfigControllerGetConfigItemData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<PublicConfigControllerGetConfigItemResponse, PublicConfigControllerGetConfigItemError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/config-item/{id}',\n ...options\n });\n};\n\n/**\n * Update a config item\n * Updates a config item’s name/description. Company-scoped. Requires company:settings:tables. Supports `Idempotency-Key`.\n */\nexport const publicConfigControllerUpdateConfigItem = <ThrowOnError extends boolean = false>(options: Options<PublicConfigControllerUpdateConfigItemData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).patch<PublicConfigControllerUpdateConfigItemResponse, PublicConfigControllerUpdateConfigItemError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/config-item/{id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n};\n\n/**\n * Create a config item\n * Creates a config item (e.g. a new asset category) under the given config_table_id, which must belong to the authenticated company. Requires company:settings:tables. Supports `Idempotency-Key`.\n */\nexport const publicConfigControllerCreateConfigItem = <ThrowOnError extends boolean = false>(options: Options<PublicConfigControllerCreateConfigItemData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).post<PublicConfigControllerCreateConfigItemResponse, PublicConfigControllerCreateConfigItemError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/config-item',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n};\n\n/**\n * List sites\n * Returns a paginated list of sites for the authenticated company. Supports filtering by name, category, and date modified. Requires Bearer token authentication with site:read permission.\n */\nexport const siteControllerListSites = <ThrowOnError extends boolean = false>(options?: Options<SiteControllerListSitesData, ThrowOnError>) => {\n return (options?.client ?? _heyApiClient).get<SiteControllerListSitesResponse, SiteControllerListSitesError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/site/list',\n ...options\n });\n};\n\n/**\n * Create a new site\n * Creates a new site for the authenticated company. Requires Bearer token authentication with site:update permission. Supports `Idempotency-Key` for safe retries.\n */\nexport const siteControllerCreateSite = <ThrowOnError extends boolean = false>(options: Options<SiteControllerCreateSiteData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).post<SiteControllerCreateSiteResponse, SiteControllerCreateSiteError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/site',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n};\n\n/**\n * Delete site by public ID\n * Performs a soft delete on a site by its public_id (UUID). Sets deletedAt and deletedById fields instead of permanently removing the record. Requires Bearer token authentication with site:update permission.\n */\nexport const siteControllerDeleteSite = <ThrowOnError extends boolean = false>(options: Options<SiteControllerDeleteSiteData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).delete<SiteControllerDeleteSiteResponse, SiteControllerDeleteSiteError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/site/{id}',\n ...options\n });\n};\n\n/**\n * Update site by public ID\n * Updates a site by its public_id (UUID). Only provided fields will be updated. Requires Bearer token authentication with site:update permission. Supports `Idempotency-Key` for safe retries.\n */\nexport const siteControllerUpdateSite = <ThrowOnError extends boolean = false>(options: Options<SiteControllerUpdateSiteData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).patch<SiteControllerUpdateSiteResponse, SiteControllerUpdateSiteError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/site/{id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n};","/**\n * WakataClient — the hand-written ergonomic wrapper on top of the generated\n * `@hey-api/openapi-ts` output.\n *\n * Responsibilities:\n * - Hold the API key and base URL.\n * - Attach `Authorization`, `User-Agent`, and (on POST/PATCH) `Idempotency-Key`\n * headers via fetch interceptors.\n * - Map non-2xx responses to the typed error hierarchy in `./errors.ts`.\n * - Expose every generated operation under a per-tag namespace\n * (`client.assets.list(...)`, `client.users.list(...)`, etc.).\n *\n * Consumers who need the unwrapped generated operations can import them\n * directly from `@wakata-dev/api-client/generated`.\n */\nimport { createClient, createConfig, type Client } from '@hey-api/client-fetch';\n\nimport {\n mapApiError,\n WakataApiError,\n type WakataErrorEnvelope,\n} from './errors.js';\nimport { generateIdempotencyKey } from './idempotency.js';\n\nimport {\n // asset\n assetControllerCreateAssetPublic,\n assetControllerListAssets,\n assetControllerGetAsset,\n assetControllerUpdateAsset,\n // user\n userControllerListUsers,\n userControllerGetUser,\n userControllerUpdateUser,\n userControllerCreateUser,\n // inspection\n inspectionControllerListInspections,\n inspectionControllerGetPublicInspection,\n inspectionControllerSubmitInspectionPublic,\n // issue\n issueControllerListIssues,\n issueControllerGetIssuePublic,\n issueControllerUpdateIssuePublic,\n issueControllerGetIssueHistoryPublic,\n // user-property\n userPropertyControllerDeleteUserProperty,\n userPropertyControllerUpdateUserProperty,\n // site\n siteControllerListSites,\n siteControllerCreateSite,\n siteControllerDeleteSite,\n siteControllerUpdateSite,\n // checklist\n checklistControllerListChecklists,\n checklistControllerGetChecklist,\n // config\n publicConfigControllerListConfigTables,\n publicConfigControllerListConfigItems,\n publicConfigControllerGetConfigItem,\n publicConfigControllerCreateConfigItem,\n publicConfigControllerUpdateConfigItem,\n publicConfigControllerDeleteConfigItem,\n} from './generated/sdk.gen.js';\n\n/** Default base URL — production. Override for dev / sandbox. */\nconst DEFAULT_BASE_URL = 'https://api.wakata.ai/api/v1';\n\n/** Package version baked in at build time. Synced with `package.json`. */\nconst PACKAGE_VERSION = '0.3.0';\n\nexport interface WakataClientOptions {\n /** Wakata API key (`wk_...`). Required. */\n apiKey: string;\n /** Override base URL. Defaults to `https://api.wakata.ai/api/v1`. */\n baseUrl?: string;\n /**\n * Custom `fetch` implementation. Defaults to `globalThis.fetch`. Useful\n * for tests or Node <18 polyfills.\n */\n fetch?: typeof fetch;\n}\n\n/**\n * The wrapper takes Options from the generated `sdk.gen` but reshapes them so\n * the consumer doesn't have to think about the underlying client.\n *\n * We strip the generated `client` and `throwOnError` fields and tell the\n * generated function to throw via our interceptor instead.\n */\ntype WakataMethodOptions<T> = Omit<T, 'client' | 'throwOnError'>;\n\nfunction unwrap<TData>(\n result: { data: TData | undefined; error?: unknown; response: Response },\n): TData {\n // When `throwOnError: false` (our default), the result is a tagged union.\n // Our response interceptor converts non-2xx to a thrown error before this\n // point, so `data` is always defined here.\n if (result.data === undefined) {\n throw new WakataApiError({\n code: 'unknown_error',\n statusCode: result.response.status,\n requestId: result.response.headers.get('X-Request-Id') ?? '',\n message: 'Empty response body where data was expected.',\n });\n }\n return result.data;\n}\n\n/** Resource namespaces — one per OpenAPI tag, mirroring the spec. */\nexport interface AssetsResource {\n list: (\n options?: WakataMethodOptions<\n Parameters<typeof assetControllerListAssets>[0] extends infer O\n ? O\n : never\n >,\n ) => Promise<\n Awaited<ReturnType<typeof assetControllerListAssets>>['data']\n >;\n create: (\n options: WakataMethodOptions<\n Parameters<typeof assetControllerCreateAssetPublic>[0]\n >,\n ) => Promise<\n Awaited<ReturnType<typeof assetControllerCreateAssetPublic>>['data']\n >;\n get: (\n options: WakataMethodOptions<Parameters<typeof assetControllerGetAsset>[0]>,\n ) => Promise<Awaited<ReturnType<typeof assetControllerGetAsset>>['data']>;\n update: (\n options: WakataMethodOptions<\n Parameters<typeof assetControllerUpdateAsset>[0]\n >,\n ) => Promise<Awaited<ReturnType<typeof assetControllerUpdateAsset>>['data']>;\n}\n\nexport interface UsersResource {\n list: (\n options?: WakataMethodOptions<\n Parameters<typeof userControllerListUsers>[0] extends infer O ? O : never\n >,\n ) => Promise<Awaited<ReturnType<typeof userControllerListUsers>>['data']>;\n get: (\n options: WakataMethodOptions<Parameters<typeof userControllerGetUser>[0]>,\n ) => Promise<Awaited<ReturnType<typeof userControllerGetUser>>['data']>;\n create: (\n options: WakataMethodOptions<\n Parameters<typeof userControllerCreateUser>[0]\n >,\n ) => Promise<Awaited<ReturnType<typeof userControllerCreateUser>>['data']>;\n update: (\n options: WakataMethodOptions<\n Parameters<typeof userControllerUpdateUser>[0]\n >,\n ) => Promise<Awaited<ReturnType<typeof userControllerUpdateUser>>['data']>;\n}\n\nexport interface SitesResource {\n list: (\n options?: WakataMethodOptions<\n Parameters<typeof siteControllerListSites>[0] extends infer O ? O : never\n >,\n ) => Promise<Awaited<ReturnType<typeof siteControllerListSites>>['data']>;\n create: (\n options: WakataMethodOptions<\n Parameters<typeof siteControllerCreateSite>[0]\n >,\n ) => Promise<Awaited<ReturnType<typeof siteControllerCreateSite>>['data']>;\n update: (\n options: WakataMethodOptions<\n Parameters<typeof siteControllerUpdateSite>[0]\n >,\n ) => Promise<Awaited<ReturnType<typeof siteControllerUpdateSite>>['data']>;\n delete: (\n options: WakataMethodOptions<\n Parameters<typeof siteControllerDeleteSite>[0]\n >,\n ) => Promise<Awaited<ReturnType<typeof siteControllerDeleteSite>>['data']>;\n}\n\nexport interface InspectionsResource {\n list: (\n options?: WakataMethodOptions<\n Parameters<typeof inspectionControllerListInspections>[0] extends infer O\n ? O\n : never\n >,\n ) => Promise<\n Awaited<ReturnType<typeof inspectionControllerListInspections>>['data']\n >;\n getDetail: (\n options: WakataMethodOptions<\n Parameters<typeof inspectionControllerGetPublicInspection>[0]\n >,\n ) => Promise<\n Awaited<\n ReturnType<typeof inspectionControllerGetPublicInspection>\n >['data']\n >;\n submit: (\n options: WakataMethodOptions<\n Parameters<typeof inspectionControllerSubmitInspectionPublic>[0]\n >,\n ) => Promise<\n Awaited<\n ReturnType<typeof inspectionControllerSubmitInspectionPublic>\n >['data']\n >;\n}\n\nexport interface ChecklistsResource {\n list: (\n options?: WakataMethodOptions<\n Parameters<typeof checklistControllerListChecklists>[0] extends infer O\n ? O\n : never\n >,\n ) => Promise<\n Awaited<ReturnType<typeof checklistControllerListChecklists>>['data']\n >;\n get: (\n options: WakataMethodOptions<\n Parameters<typeof checklistControllerGetChecklist>[0]\n >,\n ) => Promise<\n Awaited<ReturnType<typeof checklistControllerGetChecklist>>['data']\n >;\n}\n\nexport interface ConfigResource {\n listTables: (\n options?: WakataMethodOptions<\n Parameters<typeof publicConfigControllerListConfigTables>[0] extends infer O\n ? O\n : never\n >,\n ) => Promise<\n Awaited<ReturnType<typeof publicConfigControllerListConfigTables>>['data']\n >;\n listItems: (\n options?: WakataMethodOptions<\n Parameters<typeof publicConfigControllerListConfigItems>[0] extends infer O\n ? O\n : never\n >,\n ) => Promise<\n Awaited<ReturnType<typeof publicConfigControllerListConfigItems>>['data']\n >;\n getItem: (\n options: WakataMethodOptions<\n Parameters<typeof publicConfigControllerGetConfigItem>[0]\n >,\n ) => Promise<\n Awaited<ReturnType<typeof publicConfigControllerGetConfigItem>>['data']\n >;\n createItem: (\n options: WakataMethodOptions<\n Parameters<typeof publicConfigControllerCreateConfigItem>[0]\n >,\n ) => Promise<\n Awaited<ReturnType<typeof publicConfigControllerCreateConfigItem>>['data']\n >;\n updateItem: (\n options: WakataMethodOptions<\n Parameters<typeof publicConfigControllerUpdateConfigItem>[0]\n >,\n ) => Promise<\n Awaited<ReturnType<typeof publicConfigControllerUpdateConfigItem>>['data']\n >;\n deleteItem: (\n options: WakataMethodOptions<\n Parameters<typeof publicConfigControllerDeleteConfigItem>[0]\n >,\n ) => Promise<\n Awaited<ReturnType<typeof publicConfigControllerDeleteConfigItem>>['data']\n >;\n}\n\nexport interface IssuesResource {\n list: (\n options?: WakataMethodOptions<\n Parameters<typeof issueControllerListIssues>[0] extends infer O ? O : never\n >,\n ) => Promise<Awaited<ReturnType<typeof issueControllerListIssues>>['data']>;\n get: (\n options: WakataMethodOptions<\n Parameters<typeof issueControllerGetIssuePublic>[0]\n >,\n ) => Promise<\n Awaited<ReturnType<typeof issueControllerGetIssuePublic>>['data']\n >;\n update: (\n options: WakataMethodOptions<\n Parameters<typeof issueControllerUpdateIssuePublic>[0]\n >,\n ) => Promise<\n Awaited<ReturnType<typeof issueControllerUpdateIssuePublic>>['data']\n >;\n getHistory: (\n options: WakataMethodOptions<\n Parameters<typeof issueControllerGetIssueHistoryPublic>[0]\n >,\n ) => Promise<\n Awaited<ReturnType<typeof issueControllerGetIssueHistoryPublic>>['data']\n >;\n}\n\nexport interface UserPropertiesResource {\n update: (\n options: WakataMethodOptions<\n Parameters<typeof userPropertyControllerUpdateUserProperty>[0]\n >,\n ) => Promise<\n Awaited<\n ReturnType<typeof userPropertyControllerUpdateUserProperty>\n >['data']\n >;\n delete: (\n options: WakataMethodOptions<\n Parameters<typeof userPropertyControllerDeleteUserProperty>[0]\n >,\n ) => Promise<\n Awaited<\n ReturnType<typeof userPropertyControllerDeleteUserProperty>\n >['data']\n >;\n}\n\n/**\n * The main entry point for the Wakata API client.\n *\n * ```ts\n * import { WakataClient, WakataNotFoundError } from '@wakata-dev/api-client';\n *\n * const wakata = new WakataClient({ apiKey: process.env.WAKATA_API_KEY! });\n *\n * try {\n * const { items } = await wakata.assets.list({ query: { page: 1, page_size: 50 } });\n * console.log(items);\n * } catch (err) {\n * if (err instanceof WakataNotFoundError) console.error('not found:', err.message);\n * throw err;\n * }\n * ```\n */\nexport class WakataClient {\n /** Underlying generated fetch client. Exposed for advanced customisation. */\n public readonly raw: Client;\n\n public readonly assets: AssetsResource;\n public readonly users: UsersResource;\n public readonly sites: SitesResource;\n public readonly inspections: InspectionsResource;\n public readonly issues: IssuesResource;\n public readonly userProperties: UserPropertiesResource;\n public readonly checklists: ChecklistsResource;\n public readonly config: ConfigResource;\n\n public constructor(options: WakataClientOptions) {\n if (!options.apiKey) {\n throw new Error('WakataClient: `apiKey` is required.');\n }\n\n const baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;\n\n this.raw = createClient(\n createConfig({\n baseUrl,\n // Inject the apiKey into the Authorization header via the `auth` hook\n // so the generated `security: [{ scheme: 'bearer' }]` machinery picks\n // it up on every operation.\n auth: options.apiKey,\n ...(options.fetch ? { fetch: options.fetch } : {}),\n }),\n );\n\n // ---- request interceptor: User-Agent + Idempotency-Key on POST/PATCH ----\n this.raw.interceptors.request.use((request) => {\n // User-Agent. Some browser environments forbid setting this header — if\n // so, the underlying fetch will silently drop it, which is fine.\n try {\n request.headers.set('User-Agent', `@wakata-dev/api-client/${PACKAGE_VERSION}`);\n } catch {\n // ignore — browsers may guard User-Agent.\n }\n\n const method = request.method.toUpperCase();\n if (method === 'POST' || method === 'PATCH') {\n if (!request.headers.has('Idempotency-Key')) {\n request.headers.set('Idempotency-Key', generateIdempotencyKey());\n }\n }\n return request;\n });\n\n // ---- response interceptor: map non-2xx envelopes to typed errors ----\n this.raw.interceptors.response.use(async (response) => {\n if (response.ok) return response;\n\n // Read the body once. The generated client doesn't try to consume the\n // body when we throw, so we have to clone before parsing.\n let envelope: WakataErrorEnvelope | undefined;\n try {\n const cloned = response.clone();\n const json = (await cloned.json()) as\n | { error?: WakataErrorEnvelope }\n | undefined;\n envelope = json?.error;\n } catch {\n // Body wasn't JSON (HTML 502 page, etc.) — fall through with undefined.\n }\n\n const fallbackRequestId = response.headers.get('X-Request-Id') ?? '';\n\n // 429: derive retryAfterSeconds from headers. Prefer Retry-After (RFC\n // 7231) when present, then fall back to X-RateLimit-Reset (unix epoch\n // seconds) minus now.\n let retryAfterSeconds: number | undefined;\n if (response.status === 429) {\n const retryAfter = response.headers.get('Retry-After');\n if (retryAfter) {\n const n = Number(retryAfter);\n if (Number.isFinite(n)) retryAfterSeconds = n;\n }\n if (retryAfterSeconds === undefined) {\n const reset = response.headers.get('X-RateLimit-Reset');\n if (reset) {\n const resetEpoch = Number(reset);\n if (Number.isFinite(resetEpoch)) {\n retryAfterSeconds = Math.max(\n 0,\n Math.ceil(resetEpoch - Date.now() / 1000),\n );\n }\n }\n }\n }\n\n throw mapApiError(\n response.status,\n envelope,\n fallbackRequestId,\n retryAfterSeconds,\n );\n });\n\n // ---- per-tag namespaces ------------------------------------------------\n const client = this.raw;\n\n this.assets = {\n list: async (opts) =>\n unwrap(await assetControllerListAssets({ ...(opts ?? {}), client })),\n create: async (opts) =>\n unwrap(await assetControllerCreateAssetPublic({ ...opts, client })),\n get: async (opts) =>\n unwrap(await assetControllerGetAsset({ ...opts, client })),\n update: async (opts) =>\n unwrap(await assetControllerUpdateAsset({ ...opts, client })),\n };\n\n this.users = {\n list: async (opts) =>\n unwrap(await userControllerListUsers({ ...(opts ?? {}), client })),\n get: async (opts) =>\n unwrap(await userControllerGetUser({ ...opts, client })),\n create: async (opts) =>\n unwrap(await userControllerCreateUser({ ...opts, client })),\n update: async (opts) =>\n unwrap(await userControllerUpdateUser({ ...opts, client })),\n };\n\n this.sites = {\n list: async (opts) =>\n unwrap(await siteControllerListSites({ ...(opts ?? {}), client })),\n create: async (opts) =>\n unwrap(await siteControllerCreateSite({ ...opts, client })),\n update: async (opts) =>\n unwrap(await siteControllerUpdateSite({ ...opts, client })),\n delete: async (opts) =>\n unwrap(await siteControllerDeleteSite({ ...opts, client })),\n };\n\n this.inspections = {\n list: async (opts) =>\n unwrap(\n await inspectionControllerListInspections({\n ...(opts ?? {}),\n client,\n }),\n ),\n getDetail: async (opts) =>\n unwrap(\n await inspectionControllerGetPublicInspection({ ...opts, client }),\n ),\n submit: async (opts) =>\n unwrap(\n await inspectionControllerSubmitInspectionPublic({ ...opts, client }),\n ),\n };\n\n this.issues = {\n list: async (opts) =>\n unwrap(await issueControllerListIssues({ ...(opts ?? {}), client })),\n get: async (opts) =>\n unwrap(await issueControllerGetIssuePublic({ ...opts, client })),\n update: async (opts) =>\n unwrap(await issueControllerUpdateIssuePublic({ ...opts, client })),\n getHistory: async (opts) =>\n unwrap(\n await issueControllerGetIssueHistoryPublic({ ...opts, client }),\n ),\n };\n\n this.userProperties = {\n update: async (opts) =>\n unwrap(\n await userPropertyControllerUpdateUserProperty({ ...opts, client }),\n ),\n delete: async (opts) =>\n unwrap(\n await userPropertyControllerDeleteUserProperty({ ...opts, client }),\n ),\n };\n\n this.checklists = {\n list: async (opts) =>\n unwrap(\n await checklistControllerListChecklists({ ...(opts ?? {}), client }),\n ),\n get: async (opts) =>\n unwrap(await checklistControllerGetChecklist({ ...opts, client })),\n };\n\n this.config = {\n listTables: async (opts) =>\n unwrap(\n await publicConfigControllerListConfigTables({\n ...(opts ?? {}),\n client,\n }),\n ),\n listItems: async (opts) =>\n unwrap(\n await publicConfigControllerListConfigItems({\n ...(opts ?? {}),\n client,\n }),\n ),\n getItem: async (opts) =>\n unwrap(await publicConfigControllerGetConfigItem({ ...opts, client })),\n createItem: async (opts) =>\n unwrap(\n await publicConfigControllerCreateConfigItem({ ...opts, client }),\n ),\n updateItem: async (opts) =>\n unwrap(\n await publicConfigControllerUpdateConfigItem({ ...opts, client }),\n ),\n deleteItem: async (opts) =>\n unwrap(\n await publicConfigControllerDeleteConfigItem({ ...opts, client }),\n ),\n };\n }\n}\n","/**\n * `@wakata-dev/api-client` — the official TypeScript SDK for the Wakata Public API.\n *\n * See README.md for usage.\n */\n\nexport const PACKAGE_NAME = '@wakata-dev/api-client';\nexport const PACKAGE_VERSION = '0.3.0';\n\n/** Default base URL for the Wakata Public API (production). */\nexport const DEFAULT_BASE_URL = 'https://api.wakata.ai/api/v1';\n\n// Wrapper layer — the recommended public surface.\nexport { WakataClient } from './client.js';\nexport type {\n WakataClientOptions,\n AssetsResource,\n UsersResource,\n SitesResource,\n InspectionsResource,\n IssuesResource,\n UserPropertiesResource,\n} from './client.js';\n\n// Error hierarchy.\nexport {\n WakataApiError,\n WakataValidationError,\n WakataAuthError,\n WakataPermissionError,\n WakataNotFoundError,\n WakataConflictError,\n WakataRateLimitError,\n WakataServerError,\n mapApiError,\n} from './errors.js';\nexport type { ErrorDetail, WakataErrorEnvelope } from './errors.js';\n\n// Idempotency helper — exposed in case callers want to mint keys themselves\n// (e.g. to retry the same logical operation across processes).\nexport { generateIdempotencyKey } from './idempotency.js';\n\n// Re-export the generated types + raw operations for advanced consumers who\n// want to drop down past the wrapper. Avoid collisions with the wrapper's\n// exported names.\nexport * from './generated/types.gen.js';\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts","../src/idempotency.ts","../src/generated/client.gen.ts","../src/generated/sdk.gen.ts","../src/client.ts","../src/index.ts"],"names":["createClient","createConfig","formDataBodySerializer","client","PACKAGE_VERSION","DEFAULT_BASE_URL"],"mappings":";;;;;;;AAiEO,IAAM,cAAA,GAAN,cAA6B,KAAA,CAAM;AAAA,EAcjC,YAAY,IAAA,EAQhB;AACD,IAAA,KAAA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AA,EAAAA,OAAAA,EAAQ,CAAC,CAAA;AAAA,MACvE,UAAA,EAAY,OAAO,IAAA,KACjB,MAAA;AAAA,QACE,MAAM,sCAAA,CAAuC,EAAE,GAAG,IAAA,EAAM,MAAA,EAAAA,SAAQ;AAAA,OAClE;AAAA,MACF,UAAA,EAAY,OAAO,IAAA,KACjB,MAAA;AAAA,QACE,MAAM,sCAAA,CAAuC,EAAE,GAAG,IAAA,EAAM,MAAA,EAAAA,SAAQ;AAAA,OAClE;AAAA,MACF,UAAA,EAAY,OAAO,IAAA,KACjB,MAAA;AAAA,QACE,MAAM,sCAAA,CAAuC,EAAE,GAAG,IAAA,EAAM,MAAA,EAAAA,SAAQ;AAAA;AAClE,KACJ;AAAA,EACF;AACF;;;AChiBO,IAAM,YAAA,GAAe;AACrB,IAAMC,gBAAAA,GAAkB;AAGxB,IAAMC,iBAAAA,GAAmB","file":"index.cjs","sourcesContent":["/**\n * Typed error hierarchy for the Wakata API client.\n *\n * The Wakata Public API always returns a standardized error envelope on\n * non-2xx responses (see the portal's API Quickstart page,\n * Settings → API Keys → Quickstart § 5 \"Handling errors\"):\n *\n * ```json\n * {\n * \"error\": {\n * \"code\": \"validation_error\",\n * \"message\": \"Request validation failed.\",\n * \"request_id\": \"req_01HX...\",\n * \"docs_url\": \"https://docs.wakata.ai/errors/validation_error\",\n * \"param\": \"site_id\",\n * \"details\": [ { \"field\": \"site_id\", \"code\": \"isUuid\", \"message\": \"...\" } ]\n * }\n * }\n * ```\n *\n * The client maps each non-2xx response to the most specific subclass below.\n * Use `instanceof` checks to branch on the error type ergonomically:\n *\n * ```ts\n * try {\n * const asset = await wakata.assets.get('abc-123');\n * } catch (err) {\n * if (err instanceof WakataNotFoundError) { ... }\n * if (err instanceof WakataRateLimitError) {\n * await sleep((err.retryAfterSeconds ?? 60) * 1000);\n * }\n * throw err;\n * }\n * ```\n */\n\n/**\n * A single validation detail emitted by class-validator on `400` responses.\n */\nexport interface ErrorDetail {\n field: string;\n code: string;\n message: string;\n}\n\n/**\n * Raw shape of the error envelope returned by the API.\n *\n * Mirrors {@link https://docs.wakata.ai/errors} — kept loose because new\n * canonical codes may be added without breaking the SDK.\n */\nexport interface WakataErrorEnvelope {\n code: string;\n message: string;\n request_id: string;\n docs_url?: string;\n param?: string;\n details?: ErrorDetail[];\n}\n\n/**\n * Base error class for everything thrown by the Wakata API client when the\n * server responds with a non-2xx status. Network failures and unparseable\n * responses also surface as this base class with `code === 'unknown_error'`.\n */\nexport class WakataApiError extends Error {\n /** Canonical error code from `error.code` in the response envelope. */\n public readonly code: string;\n /** HTTP status code from the response. */\n public readonly statusCode: number;\n /** Server-assigned request ID (`X-Request-Id` / `error.request_id`). */\n public readonly requestId: string;\n /** Optional URL pointing at the docs page for this error code. */\n public readonly docsUrl: string | undefined;\n /** For validation-style errors, the offending parameter name. */\n public readonly param: string | undefined;\n /** For validation-style errors, the full field-level breakdown. */\n public readonly details: ErrorDetail[] | undefined;\n\n public constructor(args: {\n code: string;\n statusCode: number;\n requestId: string;\n docsUrl?: string | undefined;\n param?: string | undefined;\n details?: ErrorDetail[] | undefined;\n message: string;\n }) {\n super(args.message);\n this.name = 'WakataApiError';\n this.code = args.code;\n this.statusCode = args.statusCode;\n this.requestId = args.requestId;\n this.docsUrl = args.docsUrl;\n this.param = args.param;\n this.details = args.details;\n // Maintain the prototype chain for `instanceof` across compiled targets.\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * 4xx with `details` (typically 400 `validation_error` from class-validator).\n * `details` is guaranteed populated.\n */\nexport class WakataValidationError extends WakataApiError {\n public override readonly name = 'WakataValidationError';\n}\n\n/** 401 — missing, malformed, revoked or expired API key. */\nexport class WakataAuthError extends WakataApiError {\n public override readonly name = 'WakataAuthError';\n}\n\n/** 403 — authenticated key lacks the required permission / role. */\nexport class WakataPermissionError extends WakataApiError {\n public override readonly name = 'WakataPermissionError';\n}\n\n/** 404 — resource not found, or not visible to this API key. */\nexport class WakataNotFoundError extends WakataApiError {\n public override readonly name = 'WakataNotFoundError';\n}\n\n/** 409 — conflict, e.g. unique constraint violation or idempotency-key reuse with a different body. */\nexport class WakataConflictError extends WakataApiError {\n public override readonly name = 'WakataConflictError';\n}\n\n/**\n * 429 — rate limited. `retryAfterSeconds` is derived from the\n * `X-RateLimit-Reset` header (seconds until the window resets) where present.\n */\nexport class WakataRateLimitError extends WakataApiError {\n public override readonly name = 'WakataRateLimitError';\n public readonly retryAfterSeconds: number | undefined;\n\n public constructor(args: {\n code: string;\n statusCode: number;\n requestId: string;\n docsUrl?: string | undefined;\n param?: string | undefined;\n details?: ErrorDetail[] | undefined;\n message: string;\n retryAfterSeconds?: number | undefined;\n }) {\n super(args);\n this.retryAfterSeconds = args.retryAfterSeconds;\n }\n}\n\n/** 5xx — server error. Safe to retry with exponential backoff. */\nexport class WakataServerError extends WakataApiError {\n public override readonly name = 'WakataServerError';\n}\n\n/**\n * Map an HTTP status + response envelope to the most specific error subclass.\n *\n * Exported so callers can build their own retry/error layers on top.\n */\nexport function mapApiError(\n statusCode: number,\n envelope: WakataErrorEnvelope | undefined,\n fallbackRequestId: string,\n retryAfterSeconds?: number,\n): WakataApiError {\n const code = envelope?.code ?? 'unknown_error';\n const message =\n envelope?.message ?? `Wakata API returned HTTP ${statusCode}`;\n const requestId = envelope?.request_id ?? fallbackRequestId;\n const docsUrl = envelope?.docs_url;\n const param = envelope?.param;\n const details = envelope?.details;\n const base = {\n code,\n statusCode,\n requestId,\n docsUrl,\n param,\n details,\n message,\n };\n\n if (statusCode === 429) {\n return new WakataRateLimitError({\n ...base,\n retryAfterSeconds,\n });\n }\n if (statusCode === 401) return new WakataAuthError(base);\n if (statusCode === 403) return new WakataPermissionError(base);\n if (statusCode === 404) return new WakataNotFoundError(base);\n if (statusCode === 409) return new WakataConflictError(base);\n if (statusCode >= 500) return new WakataServerError(base);\n if (statusCode >= 400 && details && details.length > 0) {\n return new WakataValidationError(base);\n }\n return new WakataApiError(base);\n}\n","/**\n * Idempotency helpers.\n *\n * The Wakata Public API accepts an optional `Idempotency-Key` header on every\n * `POST` and `PATCH` write endpoint. Sending the same key with the same body\n * within 24h returns the cached original response instead of re-executing the\n * write — making it safe to retry network failures.\n *\n * This SDK auto-attaches a freshly-generated key on every POST/PATCH if the\n * caller hasn't provided one. Callers who want true cross-attempt idempotency\n * (i.e. the same logical operation across multiple retry attempts) should\n * generate their own key once and pass it via `headers: { 'Idempotency-Key': ... }`.\n *\n * See the Wakata portal's API Quickstart page (Settings → API Keys →\n * Quickstart) § 7 \"Safe retries with Idempotency-Key\" for the full contract.\n */\n\n/**\n * Generate an idempotency key prefixed with `wak_idem_`. Uses Web Crypto's\n * `randomUUID` where available, falling back to a v4-style UUID built from\n * `getRandomValues` for older Node runtimes.\n */\nexport function generateIdempotencyKey(): string {\n const c: Crypto | undefined =\n typeof globalThis !== 'undefined'\n ? (globalThis as { crypto?: Crypto }).crypto\n : undefined;\n let uuid: string;\n if (c && typeof c.randomUUID === 'function') {\n uuid = c.randomUUID();\n } else if (c && typeof c.getRandomValues === 'function') {\n const bytes = new Uint8Array(16);\n c.getRandomValues(bytes);\n // RFC 4122 v4 fixups\n bytes[6] = ((bytes[6] ?? 0) & 0x0f) | 0x40;\n bytes[8] = ((bytes[8] ?? 0) & 0x3f) | 0x80;\n const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join(\n '',\n );\n uuid = `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20, 32)}`;\n } else {\n // Last-ditch fallback. Not cryptographically strong but rare enough we\n // don't bring in a dep just for this; logging the runtime helps debug.\n uuid =\n Date.now().toString(16) +\n '-' +\n Math.random().toString(16).slice(2, 14).padEnd(12, '0');\n }\n return `wak_idem_${uuid.replace(/-/g, '')}`;\n}\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { ClientOptions } from './types.gen';\nimport { type Config, type ClientOptions as DefaultClientOptions, createClient, createConfig } from '@hey-api/client-fetch';\n\n/**\n * The `createClientConfig()` function will be called on client initialization\n * and the returned object will become the client's initial configuration.\n *\n * You may want to initialize your client this way instead of calling\n * `setConfig()`. This is useful for example if you're using Next.js\n * to ensure your client always has the correct values.\n */\nexport type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>;\n\nexport const client = createClient(createConfig<ClientOptions>({\n baseUrl: 'https://api.wakata.ai'\n}));","// This file is auto-generated by @hey-api/openapi-ts\n\nimport { type Options as ClientOptions, type TDataShape, type Client, formDataBodySerializer } from '@hey-api/client-fetch';\nimport type { AssetControllerCreateAssetPublicData, AssetControllerCreateAssetPublicResponse, AssetControllerCreateAssetPublicError, AssetControllerListAssetsData, AssetControllerListAssetsResponse, AssetControllerListAssetsError, AssetControllerGetAssetData, AssetControllerGetAssetResponse, AssetControllerGetAssetError, AssetControllerUpdateAssetData, AssetControllerUpdateAssetResponse, AssetControllerUpdateAssetError, UserControllerListUsersData, UserControllerListUsersResponse, UserControllerListUsersError, UserControllerGetUserData, UserControllerGetUserResponse, UserControllerGetUserError, UserControllerUpdateUserData, UserControllerUpdateUserResponse, UserControllerUpdateUserError, UserControllerCreateUserData, UserControllerCreateUserResponse, UserControllerCreateUserError, InspectionControllerListInspectionsData, InspectionControllerListInspectionsResponse, InspectionControllerListInspectionsError, InspectionControllerGetPublicInspectionData, InspectionControllerGetPublicInspectionResponse, InspectionControllerGetPublicInspectionError, IssueControllerListIssuesData, IssueControllerListIssuesResponse, IssueControllerListIssuesError, IssueControllerGetIssuePublicData, IssueControllerGetIssuePublicResponse, IssueControllerGetIssuePublicError, IssueControllerUpdateIssuePublicData, IssueControllerUpdateIssuePublicResponse, IssueControllerUpdateIssuePublicError, IssueControllerGetIssueHistoryPublicData, IssueControllerGetIssueHistoryPublicResponse, IssueControllerGetIssueHistoryPublicError, UserPropertyControllerDeleteUserPropertyData, UserPropertyControllerDeleteUserPropertyResponse, UserPropertyControllerDeleteUserPropertyError, UserPropertyControllerUpdateUserPropertyData, UserPropertyControllerUpdateUserPropertyResponse, UserPropertyControllerUpdateUserPropertyError, AssetPropertyControllerDeleteAssetPropertyData, AssetPropertyControllerDeleteAssetPropertyResponse, AssetPropertyControllerDeleteAssetPropertyError, AssetPropertyControllerUpdateAssetPropertyData, AssetPropertyControllerUpdateAssetPropertyResponse, AssetPropertyControllerUpdateAssetPropertyError, AssetClassControllerGetAssetClassListData, AssetClassControllerGetAssetClassListResponse, AssetClassControllerGetAssetClassListError, AssetClassControllerCreateAssetClassData, AssetClassControllerCreateAssetClassResponse, AssetClassControllerCreateAssetClassError, AssetClassControllerUpdateAssetClassData, AssetClassControllerUpdateAssetClassResponse, AssetClassControllerUpdateAssetClassError, ChecklistControllerListChecklistsData, ChecklistControllerListChecklistsResponse, ChecklistControllerListChecklistsError, ChecklistControllerGetChecklistData, ChecklistControllerGetChecklistResponse, ChecklistControllerGetChecklistError, PublicConfigControllerListConfigTablesData, PublicConfigControllerListConfigTablesResponse, PublicConfigControllerListConfigTablesError, PublicConfigControllerListConfigItemsData, PublicConfigControllerListConfigItemsResponse, PublicConfigControllerListConfigItemsError, PublicConfigControllerDeleteConfigItemData, PublicConfigControllerDeleteConfigItemResponse, PublicConfigControllerDeleteConfigItemError, PublicConfigControllerGetConfigItemData, PublicConfigControllerGetConfigItemResponse, PublicConfigControllerGetConfigItemError, PublicConfigControllerUpdateConfigItemData, PublicConfigControllerUpdateConfigItemResponse, PublicConfigControllerUpdateConfigItemError, PublicConfigControllerCreateConfigItemData, PublicConfigControllerCreateConfigItemResponse, PublicConfigControllerCreateConfigItemError, SiteControllerListSitesData, SiteControllerListSitesResponse, SiteControllerListSitesError, SiteControllerCreateSiteData, SiteControllerCreateSiteResponse, SiteControllerCreateSiteError, SiteControllerDeleteSiteData, SiteControllerDeleteSiteResponse, SiteControllerDeleteSiteError, SiteControllerUpdateSiteData, SiteControllerUpdateSiteResponse, SiteControllerUpdateSiteError } from './types.gen';\nimport { client as _heyApiClient } from './client.gen';\n\nexport type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {\n /**\n * You can provide a client instance returned by `createClient()` instead of\n * individual options. This might be also useful if you want to implement a\n * custom client.\n */\n client?: Client;\n /**\n * You can pass arbitrary values through the `meta` object. This can be\n * used to access values that aren't defined as part of the SDK function.\n */\n meta?: Record<string, unknown>;\n};\n\n/**\n * Create a new asset (Public API)\n * Creates a new asset entry in the database via public API. Requires Bearer token authentication. Validates all entity references by their public_id and ensures they belong to the authenticated company. Supports `Idempotency-Key` for safe retries.\n */\nexport const assetControllerCreateAssetPublic = <ThrowOnError extends boolean = false>(options: Options<AssetControllerCreateAssetPublicData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).post<AssetControllerCreateAssetPublicResponse, AssetControllerCreateAssetPublicError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/asset',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n};\n\n/**\n * List assets with filters\n * Returns a paginated list of assets. Supports filtering by asset_class_name, created_by (user public_id), asset_number, and site_name. Also supports sorting and pagination. Requires Bearer token authentication.\n */\nexport const assetControllerListAssets = <ThrowOnError extends boolean = false>(options?: Options<AssetControllerListAssetsData, ThrowOnError>) => {\n return (options?.client ?? _heyApiClient).get<AssetControllerListAssetsResponse, AssetControllerListAssetsError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/asset/list',\n ...options\n });\n};\n\n/**\n * Get asset by public ID\n * Retrieves an asset by its public_id. Returns complete asset information. Requires Bearer token authentication.\n */\nexport const assetControllerGetAsset = <ThrowOnError extends boolean = false>(options: Options<AssetControllerGetAssetData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<AssetControllerGetAssetResponse, AssetControllerGetAssetError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/asset/{id}',\n ...options\n });\n};\n\n/**\n * Update asset by public ID\n * Partially updates an asset by its public_id. All fields are optional. Requires Bearer token authentication with asset:update permission. Validates asset_class and site_id references by public_id and ensures they belong to the same company as the asset. Supports `Idempotency-Key` for safe retries.\n */\nexport const assetControllerUpdateAsset = <ThrowOnError extends boolean = false>(options: Options<AssetControllerUpdateAssetData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).patch<AssetControllerUpdateAssetResponse, AssetControllerUpdateAssetError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/asset/{id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n};\n\n/**\n * List users\n * Returns a paginated list of users for the authenticated company. Supports filtering by various fields and sorting. Requires Bearer token authentication with user:list permission.\n */\nexport const userControllerListUsers = <ThrowOnError extends boolean = false>(options?: Options<UserControllerListUsersData, ThrowOnError>) => {\n return (options?.client ?? _heyApiClient).get<UserControllerListUsersResponse, UserControllerListUsersError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/user/list',\n ...options\n });\n};\n\n/**\n * Get user by public ID\n * Returns detailed information about a specific user including their properties. Requires Bearer token authentication with user:read permission.\n */\nexport const userControllerGetUser = <ThrowOnError extends boolean = false>(options: Options<UserControllerGetUserData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<UserControllerGetUserResponse, UserControllerGetUserError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/user/{id}',\n ...options\n });\n};\n\n/**\n * Update user information\n * Updates user fields including first name, last name, email, contact number, and profile photo. Photo is uploaded to S3 at :company_id/user-profile-photos/:filename. Requires Bearer token authentication with user:update permission for public API. Supports `Idempotency-Key` for safe retries.\n */\nexport const userControllerUpdateUser = <ThrowOnError extends boolean = false>(options: Options<UserControllerUpdateUserData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).patch<UserControllerUpdateUserResponse, UserControllerUpdateUserError, ThrowOnError>({\n ...formDataBodySerializer,\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/user/{id}',\n ...options,\n headers: {\n 'Content-Type': null,\n ...options?.headers\n }\n });\n};\n\n/**\n * Create a new user\n * Creates a new user entry in the database along with associated relationships (user_site, user_company, user_role). Validates all entity references by their public_id. Supports optional profile photo upload. Duplicate detection: returns 409 if phone number already exists in the company (hard block) or if same name exists at the site (soft block, override with force=true). Requires Bearer token authentication with user:create permission. Supports `Idempotency-Key` for safe retries.\n */\nexport const userControllerCreateUser = <ThrowOnError extends boolean = false>(options: Options<UserControllerCreateUserData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).post<UserControllerCreateUserResponse, UserControllerCreateUserError, ThrowOnError>({\n ...formDataBodySerializer,\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/user',\n ...options,\n headers: {\n 'Content-Type': null,\n ...options?.headers\n }\n });\n};\n\n/**\n * List inspections\n * Returns a paginated list of inspections for the authenticated company. Supports filtering by various fields and sorting. Requires Bearer token authentication with inspection:read permission.\n */\nexport const inspectionControllerListInspections = <ThrowOnError extends boolean = false>(options?: Options<InspectionControllerListInspectionsData, ThrowOnError>) => {\n return (options?.client ?? _heyApiClient).get<InspectionControllerListInspectionsResponse, InspectionControllerListInspectionsError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/inspection/list',\n ...options\n });\n};\n\n/**\n * Get inspection detail with responses\n * Returns a single inspection for the authenticated company, including its responses, response options, response media (exposed as signed CloudFront URLs in `media_url`), response extra info, history, and embedded custom properties (`inspection_properties[]`). Read-only — inspections are created only by the Wakata app. Requires Bearer token authentication with inspection:read permission.\n */\nexport const inspectionControllerGetPublicInspection = <ThrowOnError extends boolean = false>(options: Options<InspectionControllerGetPublicInspectionData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<InspectionControllerGetPublicInspectionResponse, InspectionControllerGetPublicInspectionError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/inspection/{public_id}',\n ...options\n });\n};\n\n/**\n * List issues\n * Returns a paginated list of issues for the authenticated company. Supports filtering by various fields and sorting. Requires Bearer token authentication with issue:read permission.\n */\nexport const issueControllerListIssues = <ThrowOnError extends boolean = false>(options?: Options<IssueControllerListIssuesData, ThrowOnError>) => {\n return (options?.client ?? _heyApiClient).get<IssueControllerListIssuesResponse, IssueControllerListIssuesError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/issue/list',\n ...options\n });\n};\n\n/**\n * Get issue by public ID\n * Returns detailed information about a specific issue. Requires Bearer token authentication with issue:read permission.\n */\nexport const issueControllerGetIssuePublic = <ThrowOnError extends boolean = false>(options: Options<IssueControllerGetIssuePublicData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<IssueControllerGetIssuePublicResponse, IssueControllerGetIssuePublicError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/issue/{public_id}',\n ...options\n });\n};\n\n/**\n * Update an issue\n * Updates an issue by its public_id. Requires Bearer token authentication with issue:update permission. Supports `Idempotency-Key` for safe retries.\n */\nexport const issueControllerUpdateIssuePublic = <ThrowOnError extends boolean = false>(options: Options<IssueControllerUpdateIssuePublicData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).patch<IssueControllerUpdateIssuePublicResponse, IssueControllerUpdateIssuePublicError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/issue/{public_id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n};\n\n/**\n * Get issue history by public ID\n * Returns all history entries for an issue identified by its public_id. History entries are ordered by changed_at timestamp in descending order (most recent first). Requires Bearer token authentication with issue:read permission.\n */\nexport const issueControllerGetIssueHistoryPublic = <ThrowOnError extends boolean = false>(options: Options<IssueControllerGetIssueHistoryPublicData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<IssueControllerGetIssueHistoryPublicResponse, IssueControllerGetIssueHistoryPublicError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/issue/{public_id}/history',\n ...options\n });\n};\n\n/**\n * Delete user property by ID\n * Performs a soft delete on a user property by its ID. Sets deletedAt and deletedById fields instead of permanently removing the record. Also creates a history record of the deletion. Requires Bearer token authentication with user:update permission.\n */\nexport const userPropertyControllerDeleteUserProperty = <ThrowOnError extends boolean = false>(options: Options<UserPropertyControllerDeleteUserPropertyData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).delete<UserPropertyControllerDeleteUserPropertyResponse, UserPropertyControllerDeleteUserPropertyError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/user-property/{id}',\n ...options\n });\n};\n\n/**\n * Update user property value by ID\n * Partially updates the value of a user property by its ID. The value is stored in the appropriate column (text_value, numeric_value, or date_value) based on the property type defined in config_items. Also creates a history record of the change. Requires Bearer token authentication with user:update permission. Supports `Idempotency-Key` for safe retries.\n */\nexport const userPropertyControllerUpdateUserProperty = <ThrowOnError extends boolean = false>(options: Options<UserPropertyControllerUpdateUserPropertyData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).patch<UserPropertyControllerUpdateUserPropertyResponse, UserPropertyControllerUpdateUserPropertyError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/user-property/{id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n};\n\n/**\n * Delete asset property by ID\n * Performs a soft delete on an asset property by its ID. Sets deletedAt and deletedById fields instead of permanently removing the record. Also creates a history record of the deletion. Requires Bearer token authentication with asset:update permission.\n */\nexport const assetPropertyControllerDeleteAssetProperty = <ThrowOnError extends boolean = false>(options: Options<AssetPropertyControllerDeleteAssetPropertyData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).delete<AssetPropertyControllerDeleteAssetPropertyResponse, AssetPropertyControllerDeleteAssetPropertyError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/asset-property/{id}',\n ...options\n });\n};\n\n/**\n * Update asset property value by ID\n * Partially updates the value of an asset property by its ID. The value is stored in the appropriate column (text_value, numeric_value, or date_value) based on the property type defined in config_items. Also creates a history record of the change. Requires Bearer token authentication with asset:update permission. Supports `Idempotency-Key` for safe retries.\n */\nexport const assetPropertyControllerUpdateAssetProperty = <ThrowOnError extends boolean = false>(options: Options<AssetPropertyControllerUpdateAssetPropertyData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).patch<AssetPropertyControllerUpdateAssetPropertyResponse, AssetPropertyControllerUpdateAssetPropertyError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/asset-property/{id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n};\n\n/**\n * Get paginated list of asset classes\n * Returns a paginated list of asset classes with optional filters for asset class name (make), sub-class name (model), category, and date range. Requires Bearer token authentication with asset-class:read permission.\n */\nexport const assetClassControllerGetAssetClassList = <ThrowOnError extends boolean = false>(options?: Options<AssetClassControllerGetAssetClassListData, ThrowOnError>) => {\n return (options?.client ?? _heyApiClient).get<AssetClassControllerGetAssetClassListResponse, AssetClassControllerGetAssetClassListError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/asset-class/list',\n ...options\n });\n};\n\n/**\n * Create a new asset class\n * Creates a new asset class record. Requires Bearer token authentication with asset-class:create permission. Supports `Idempotency-Key` for safe retries.\n */\nexport const assetClassControllerCreateAssetClass = <ThrowOnError extends boolean = false>(options: Options<AssetClassControllerCreateAssetClassData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).post<AssetClassControllerCreateAssetClassResponse, AssetClassControllerCreateAssetClassError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/asset-class',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n};\n\n/**\n * Update an asset class\n * Partially updates an asset class by its public ID (UUID). Only provided fields will be updated. Requires Bearer token authentication with asset-class:update permission. Supports `Idempotency-Key` for safe retries.\n */\nexport const assetClassControllerUpdateAssetClass = <ThrowOnError extends boolean = false>(options: Options<AssetClassControllerUpdateAssetClassData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).patch<AssetClassControllerUpdateAssetClassResponse, AssetClassControllerUpdateAssetClassError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/asset-class/{id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n};\n\n/**\n * List checklists (inspection templates)\n * Returns a paginated list of the latest published version of each checklist for the authenticated company. Read-only — checklists are created in-system only. Supports incremental sync via `checklist_date_updated_from`/`_to` (the `updated_at` watermark). Requires Bearer token authentication with checklist:read permission.\n */\nexport const checklistControllerListChecklists = <ThrowOnError extends boolean = false>(options?: Options<ChecklistControllerListChecklistsData, ThrowOnError>) => {\n return (options?.client ?? _heyApiClient).get<ChecklistControllerListChecklistsResponse, ChecklistControllerListChecklistsError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/checklist/list',\n ...options\n });\n};\n\n/**\n * Get checklist detail with items\n * Returns a single published checklist for the authenticated company, including its items (the question/folder tree, with left/right nested-set bounds). Read-only — checklists are created in-system only. Checklists have no public_id; use the numeric `id` from the list. Requires Bearer token authentication with checklist:read permission.\n */\nexport const checklistControllerGetChecklist = <ThrowOnError extends boolean = false>(options: Options<ChecklistControllerGetChecklistData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<ChecklistControllerGetChecklistResponse, ChecklistControllerGetChecklistError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/checklist/{id}',\n ...options\n });\n};\n\n/**\n * List config tables (lookup groupings)\n * Read-only list of the company’s config tables (e.g. \"Asset Category\"). Use the returned id/class to list or create items in a table. Requires company:settings:tables.\n */\nexport const publicConfigControllerListConfigTables = <ThrowOnError extends boolean = false>(options?: Options<PublicConfigControllerListConfigTablesData, ThrowOnError>) => {\n return (options?.client ?? _heyApiClient).get<PublicConfigControllerListConfigTablesResponse, PublicConfigControllerListConfigTablesError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/config-table/list',\n ...options\n });\n};\n\n/**\n * List config items (lookup values)\n * Lists the company’s config items (e.g. asset categories). Filter by config_table_id or config_table_class to scope to one table. Supports incremental sync via config_item_date_updated_from/_to. Requires company:settings:tables.\n */\nexport const publicConfigControllerListConfigItems = <ThrowOnError extends boolean = false>(options?: Options<PublicConfigControllerListConfigItemsData, ThrowOnError>) => {\n return (options?.client ?? _heyApiClient).get<PublicConfigControllerListConfigItemsResponse, PublicConfigControllerListConfigItemsError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/config-item/list',\n ...options\n });\n};\n\n/**\n * Delete a config item\n * Soft-deletes a config item. Company-scoped. Requires company:settings:tables.\n */\nexport const publicConfigControllerDeleteConfigItem = <ThrowOnError extends boolean = false>(options: Options<PublicConfigControllerDeleteConfigItemData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).delete<PublicConfigControllerDeleteConfigItemResponse, PublicConfigControllerDeleteConfigItemError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/config-item/{id}',\n ...options\n });\n};\n\n/**\n * Get a config item\n * Returns a single config item for the authenticated company. Config items have no public_id; use the numeric id. Requires company:settings:tables.\n */\nexport const publicConfigControllerGetConfigItem = <ThrowOnError extends boolean = false>(options: Options<PublicConfigControllerGetConfigItemData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<PublicConfigControllerGetConfigItemResponse, PublicConfigControllerGetConfigItemError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/config-item/{id}',\n ...options\n });\n};\n\n/**\n * Update a config item\n * Updates a config item’s name/description. Company-scoped. Requires company:settings:tables. Supports `Idempotency-Key`.\n */\nexport const publicConfigControllerUpdateConfigItem = <ThrowOnError extends boolean = false>(options: Options<PublicConfigControllerUpdateConfigItemData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).patch<PublicConfigControllerUpdateConfigItemResponse, PublicConfigControllerUpdateConfigItemError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/config-item/{id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n};\n\n/**\n * Create a config item\n * Creates a config item (e.g. a new asset category) under the given config_table_id, which must belong to the authenticated company. Requires company:settings:tables. Supports `Idempotency-Key`.\n */\nexport const publicConfigControllerCreateConfigItem = <ThrowOnError extends boolean = false>(options: Options<PublicConfigControllerCreateConfigItemData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).post<PublicConfigControllerCreateConfigItemResponse, PublicConfigControllerCreateConfigItemError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/public/config-item',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n};\n\n/**\n * List sites\n * Returns a paginated list of sites for the authenticated company. Supports filtering by name, category, and date modified. Requires Bearer token authentication with site:read permission.\n */\nexport const siteControllerListSites = <ThrowOnError extends boolean = false>(options?: Options<SiteControllerListSitesData, ThrowOnError>) => {\n return (options?.client ?? _heyApiClient).get<SiteControllerListSitesResponse, SiteControllerListSitesError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/site/list',\n ...options\n });\n};\n\n/**\n * Create a new site\n * Creates a new site for the authenticated company. Requires Bearer token authentication with site:update permission. Supports `Idempotency-Key` for safe retries.\n */\nexport const siteControllerCreateSite = <ThrowOnError extends boolean = false>(options: Options<SiteControllerCreateSiteData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).post<SiteControllerCreateSiteResponse, SiteControllerCreateSiteError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/site',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n};\n\n/**\n * Delete site by public ID\n * Performs a soft delete on a site by its public_id (UUID). Sets deletedAt and deletedById fields instead of permanently removing the record. Requires Bearer token authentication with site:update permission.\n */\nexport const siteControllerDeleteSite = <ThrowOnError extends boolean = false>(options: Options<SiteControllerDeleteSiteData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).delete<SiteControllerDeleteSiteResponse, SiteControllerDeleteSiteError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/site/{id}',\n ...options\n });\n};\n\n/**\n * Update site by public ID\n * Updates a site by its public_id (UUID). Only provided fields will be updated. Requires Bearer token authentication with site:update permission. Supports `Idempotency-Key` for safe retries.\n */\nexport const siteControllerUpdateSite = <ThrowOnError extends boolean = false>(options: Options<SiteControllerUpdateSiteData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).patch<SiteControllerUpdateSiteResponse, SiteControllerUpdateSiteError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/site/{id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n};","/**\n * WakataClient — the hand-written ergonomic wrapper on top of the generated\n * `@hey-api/openapi-ts` output.\n *\n * Responsibilities:\n * - Hold the API key and base URL.\n * - Attach `Authorization`, `User-Agent`, and (on POST/PATCH) `Idempotency-Key`\n * headers via fetch interceptors.\n * - Map non-2xx responses to the typed error hierarchy in `./errors.ts`.\n * - Expose every generated operation under a per-tag namespace\n * (`client.assets.list(...)`, `client.users.list(...)`, etc.).\n *\n * Consumers who need the unwrapped generated operations can import them\n * directly from `@wakata-dev/api-client/generated`.\n */\nimport { createClient, createConfig, type Client } from '@hey-api/client-fetch';\n\nimport {\n mapApiError,\n WakataApiError,\n type WakataErrorEnvelope,\n} from './errors.js';\nimport { generateIdempotencyKey } from './idempotency.js';\n\nimport {\n // asset\n assetControllerCreateAssetPublic,\n assetControllerListAssets,\n assetControllerGetAsset,\n assetControllerUpdateAsset,\n // user\n userControllerListUsers,\n userControllerGetUser,\n userControllerUpdateUser,\n userControllerCreateUser,\n // inspection\n inspectionControllerListInspections,\n inspectionControllerGetPublicInspection,\n // issue\n issueControllerListIssues,\n issueControllerGetIssuePublic,\n issueControllerUpdateIssuePublic,\n issueControllerGetIssueHistoryPublic,\n // user-property\n userPropertyControllerDeleteUserProperty,\n userPropertyControllerUpdateUserProperty,\n // site\n siteControllerListSites,\n siteControllerCreateSite,\n siteControllerDeleteSite,\n siteControllerUpdateSite,\n // checklist\n checklistControllerListChecklists,\n checklistControllerGetChecklist,\n // config\n publicConfigControllerListConfigTables,\n publicConfigControllerListConfigItems,\n publicConfigControllerGetConfigItem,\n publicConfigControllerCreateConfigItem,\n publicConfigControllerUpdateConfigItem,\n publicConfigControllerDeleteConfigItem,\n} from './generated/sdk.gen.js';\n\n/** Default base URL — production. Override for dev / sandbox. */\nconst DEFAULT_BASE_URL = 'https://api.wakata.ai/api/v1';\n\n/** Package version baked in at build time. Synced with `package.json`. */\nconst PACKAGE_VERSION = '0.3.1';\n\nexport interface WakataClientOptions {\n /** Wakata API key (`wk_...`). Required. */\n apiKey: string;\n /** Override base URL. Defaults to `https://api.wakata.ai/api/v1`. */\n baseUrl?: string;\n /**\n * Custom `fetch` implementation. Defaults to `globalThis.fetch`. Useful\n * for tests or Node <18 polyfills.\n */\n fetch?: typeof fetch;\n}\n\n/**\n * The wrapper takes Options from the generated `sdk.gen` but reshapes them so\n * the consumer doesn't have to think about the underlying client.\n *\n * We strip the generated `client` and `throwOnError` fields and tell the\n * generated function to throw via our interceptor instead.\n */\ntype WakataMethodOptions<T> = Omit<T, 'client' | 'throwOnError'>;\n\nfunction unwrap<TData>(\n result: { data: TData | undefined; error?: unknown; response: Response },\n): TData {\n // When `throwOnError: false` (our default), the result is a tagged union.\n // Our response interceptor converts non-2xx to a thrown error before this\n // point, so `data` is always defined here.\n if (result.data === undefined) {\n throw new WakataApiError({\n code: 'unknown_error',\n statusCode: result.response.status,\n requestId: result.response.headers.get('X-Request-Id') ?? '',\n message: 'Empty response body where data was expected.',\n });\n }\n return result.data;\n}\n\n/** Resource namespaces — one per OpenAPI tag, mirroring the spec. */\nexport interface AssetsResource {\n list: (\n options?: WakataMethodOptions<\n Parameters<typeof assetControllerListAssets>[0] extends infer O\n ? O\n : never\n >,\n ) => Promise<\n Awaited<ReturnType<typeof assetControllerListAssets>>['data']\n >;\n create: (\n options: WakataMethodOptions<\n Parameters<typeof assetControllerCreateAssetPublic>[0]\n >,\n ) => Promise<\n Awaited<ReturnType<typeof assetControllerCreateAssetPublic>>['data']\n >;\n get: (\n options: WakataMethodOptions<Parameters<typeof assetControllerGetAsset>[0]>,\n ) => Promise<Awaited<ReturnType<typeof assetControllerGetAsset>>['data']>;\n update: (\n options: WakataMethodOptions<\n Parameters<typeof assetControllerUpdateAsset>[0]\n >,\n ) => Promise<Awaited<ReturnType<typeof assetControllerUpdateAsset>>['data']>;\n}\n\nexport interface UsersResource {\n list: (\n options?: WakataMethodOptions<\n Parameters<typeof userControllerListUsers>[0] extends infer O ? O : never\n >,\n ) => Promise<Awaited<ReturnType<typeof userControllerListUsers>>['data']>;\n get: (\n options: WakataMethodOptions<Parameters<typeof userControllerGetUser>[0]>,\n ) => Promise<Awaited<ReturnType<typeof userControllerGetUser>>['data']>;\n create: (\n options: WakataMethodOptions<\n Parameters<typeof userControllerCreateUser>[0]\n >,\n ) => Promise<Awaited<ReturnType<typeof userControllerCreateUser>>['data']>;\n update: (\n options: WakataMethodOptions<\n Parameters<typeof userControllerUpdateUser>[0]\n >,\n ) => Promise<Awaited<ReturnType<typeof userControllerUpdateUser>>['data']>;\n}\n\nexport interface SitesResource {\n list: (\n options?: WakataMethodOptions<\n Parameters<typeof siteControllerListSites>[0] extends infer O ? O : never\n >,\n ) => Promise<Awaited<ReturnType<typeof siteControllerListSites>>['data']>;\n create: (\n options: WakataMethodOptions<\n Parameters<typeof siteControllerCreateSite>[0]\n >,\n ) => Promise<Awaited<ReturnType<typeof siteControllerCreateSite>>['data']>;\n update: (\n options: WakataMethodOptions<\n Parameters<typeof siteControllerUpdateSite>[0]\n >,\n ) => Promise<Awaited<ReturnType<typeof siteControllerUpdateSite>>['data']>;\n delete: (\n options: WakataMethodOptions<\n Parameters<typeof siteControllerDeleteSite>[0]\n >,\n ) => Promise<Awaited<ReturnType<typeof siteControllerDeleteSite>>['data']>;\n}\n\nexport interface InspectionsResource {\n list: (\n options?: WakataMethodOptions<\n Parameters<typeof inspectionControllerListInspections>[0] extends infer O\n ? O\n : never\n >,\n ) => Promise<\n Awaited<ReturnType<typeof inspectionControllerListInspections>>['data']\n >;\n getDetail: (\n options: WakataMethodOptions<\n Parameters<typeof inspectionControllerGetPublicInspection>[0]\n >,\n ) => Promise<\n Awaited<\n ReturnType<typeof inspectionControllerGetPublicInspection>\n >['data']\n >;\n}\n\nexport interface ChecklistsResource {\n list: (\n options?: WakataMethodOptions<\n Parameters<typeof checklistControllerListChecklists>[0] extends infer O\n ? O\n : never\n >,\n ) => Promise<\n Awaited<ReturnType<typeof checklistControllerListChecklists>>['data']\n >;\n get: (\n options: WakataMethodOptions<\n Parameters<typeof checklistControllerGetChecklist>[0]\n >,\n ) => Promise<\n Awaited<ReturnType<typeof checklistControllerGetChecklist>>['data']\n >;\n}\n\nexport interface ConfigResource {\n listTables: (\n options?: WakataMethodOptions<\n Parameters<typeof publicConfigControllerListConfigTables>[0] extends infer O\n ? O\n : never\n >,\n ) => Promise<\n Awaited<ReturnType<typeof publicConfigControllerListConfigTables>>['data']\n >;\n listItems: (\n options?: WakataMethodOptions<\n Parameters<typeof publicConfigControllerListConfigItems>[0] extends infer O\n ? O\n : never\n >,\n ) => Promise<\n Awaited<ReturnType<typeof publicConfigControllerListConfigItems>>['data']\n >;\n getItem: (\n options: WakataMethodOptions<\n Parameters<typeof publicConfigControllerGetConfigItem>[0]\n >,\n ) => Promise<\n Awaited<ReturnType<typeof publicConfigControllerGetConfigItem>>['data']\n >;\n createItem: (\n options: WakataMethodOptions<\n Parameters<typeof publicConfigControllerCreateConfigItem>[0]\n >,\n ) => Promise<\n Awaited<ReturnType<typeof publicConfigControllerCreateConfigItem>>['data']\n >;\n updateItem: (\n options: WakataMethodOptions<\n Parameters<typeof publicConfigControllerUpdateConfigItem>[0]\n >,\n ) => Promise<\n Awaited<ReturnType<typeof publicConfigControllerUpdateConfigItem>>['data']\n >;\n deleteItem: (\n options: WakataMethodOptions<\n Parameters<typeof publicConfigControllerDeleteConfigItem>[0]\n >,\n ) => Promise<\n Awaited<ReturnType<typeof publicConfigControllerDeleteConfigItem>>['data']\n >;\n}\n\nexport interface IssuesResource {\n list: (\n options?: WakataMethodOptions<\n Parameters<typeof issueControllerListIssues>[0] extends infer O ? O : never\n >,\n ) => Promise<Awaited<ReturnType<typeof issueControllerListIssues>>['data']>;\n get: (\n options: WakataMethodOptions<\n Parameters<typeof issueControllerGetIssuePublic>[0]\n >,\n ) => Promise<\n Awaited<ReturnType<typeof issueControllerGetIssuePublic>>['data']\n >;\n update: (\n options: WakataMethodOptions<\n Parameters<typeof issueControllerUpdateIssuePublic>[0]\n >,\n ) => Promise<\n Awaited<ReturnType<typeof issueControllerUpdateIssuePublic>>['data']\n >;\n getHistory: (\n options: WakataMethodOptions<\n Parameters<typeof issueControllerGetIssueHistoryPublic>[0]\n >,\n ) => Promise<\n Awaited<ReturnType<typeof issueControllerGetIssueHistoryPublic>>['data']\n >;\n}\n\nexport interface UserPropertiesResource {\n update: (\n options: WakataMethodOptions<\n Parameters<typeof userPropertyControllerUpdateUserProperty>[0]\n >,\n ) => Promise<\n Awaited<\n ReturnType<typeof userPropertyControllerUpdateUserProperty>\n >['data']\n >;\n delete: (\n options: WakataMethodOptions<\n Parameters<typeof userPropertyControllerDeleteUserProperty>[0]\n >,\n ) => Promise<\n Awaited<\n ReturnType<typeof userPropertyControllerDeleteUserProperty>\n >['data']\n >;\n}\n\n/**\n * The main entry point for the Wakata API client.\n *\n * ```ts\n * import { WakataClient, WakataNotFoundError } from '@wakata-dev/api-client';\n *\n * const wakata = new WakataClient({ apiKey: process.env.WAKATA_API_KEY! });\n *\n * try {\n * const { items } = await wakata.assets.list({ query: { page: 1, page_size: 50 } });\n * console.log(items);\n * } catch (err) {\n * if (err instanceof WakataNotFoundError) console.error('not found:', err.message);\n * throw err;\n * }\n * ```\n */\nexport class WakataClient {\n /** Underlying generated fetch client. Exposed for advanced customisation. */\n public readonly raw: Client;\n\n public readonly assets: AssetsResource;\n public readonly users: UsersResource;\n public readonly sites: SitesResource;\n public readonly inspections: InspectionsResource;\n public readonly issues: IssuesResource;\n public readonly userProperties: UserPropertiesResource;\n public readonly checklists: ChecklistsResource;\n public readonly config: ConfigResource;\n\n public constructor(options: WakataClientOptions) {\n if (!options.apiKey) {\n throw new Error('WakataClient: `apiKey` is required.');\n }\n\n const baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;\n\n this.raw = createClient(\n createConfig({\n baseUrl,\n // Inject the apiKey into the Authorization header via the `auth` hook\n // so the generated `security: [{ scheme: 'bearer' }]` machinery picks\n // it up on every operation.\n auth: options.apiKey,\n ...(options.fetch ? { fetch: options.fetch } : {}),\n }),\n );\n\n // ---- request interceptor: User-Agent + Idempotency-Key on POST/PATCH ----\n this.raw.interceptors.request.use((request) => {\n // User-Agent. Some browser environments forbid setting this header — if\n // so, the underlying fetch will silently drop it, which is fine.\n try {\n request.headers.set('User-Agent', `@wakata-dev/api-client/${PACKAGE_VERSION}`);\n } catch {\n // ignore — browsers may guard User-Agent.\n }\n\n const method = request.method.toUpperCase();\n if (method === 'POST' || method === 'PATCH') {\n if (!request.headers.has('Idempotency-Key')) {\n request.headers.set('Idempotency-Key', generateIdempotencyKey());\n }\n }\n return request;\n });\n\n // ---- response interceptor: map non-2xx envelopes to typed errors ----\n this.raw.interceptors.response.use(async (response) => {\n if (response.ok) return response;\n\n // Read the body once. The generated client doesn't try to consume the\n // body when we throw, so we have to clone before parsing.\n let envelope: WakataErrorEnvelope | undefined;\n try {\n const cloned = response.clone();\n const json = (await cloned.json()) as\n | { error?: WakataErrorEnvelope }\n | undefined;\n envelope = json?.error;\n } catch {\n // Body wasn't JSON (HTML 502 page, etc.) — fall through with undefined.\n }\n\n const fallbackRequestId = response.headers.get('X-Request-Id') ?? '';\n\n // 429: derive retryAfterSeconds from headers. Prefer Retry-After (RFC\n // 7231) when present, then fall back to X-RateLimit-Reset (unix epoch\n // seconds) minus now.\n let retryAfterSeconds: number | undefined;\n if (response.status === 429) {\n const retryAfter = response.headers.get('Retry-After');\n if (retryAfter) {\n const n = Number(retryAfter);\n if (Number.isFinite(n)) retryAfterSeconds = n;\n }\n if (retryAfterSeconds === undefined) {\n const reset = response.headers.get('X-RateLimit-Reset');\n if (reset) {\n const resetEpoch = Number(reset);\n if (Number.isFinite(resetEpoch)) {\n retryAfterSeconds = Math.max(\n 0,\n Math.ceil(resetEpoch - Date.now() / 1000),\n );\n }\n }\n }\n }\n\n throw mapApiError(\n response.status,\n envelope,\n fallbackRequestId,\n retryAfterSeconds,\n );\n });\n\n // ---- per-tag namespaces ------------------------------------------------\n const client = this.raw;\n\n this.assets = {\n list: async (opts) =>\n unwrap(await assetControllerListAssets({ ...(opts ?? {}), client })),\n create: async (opts) =>\n unwrap(await assetControllerCreateAssetPublic({ ...opts, client })),\n get: async (opts) =>\n unwrap(await assetControllerGetAsset({ ...opts, client })),\n update: async (opts) =>\n unwrap(await assetControllerUpdateAsset({ ...opts, client })),\n };\n\n this.users = {\n list: async (opts) =>\n unwrap(await userControllerListUsers({ ...(opts ?? {}), client })),\n get: async (opts) =>\n unwrap(await userControllerGetUser({ ...opts, client })),\n create: async (opts) =>\n unwrap(await userControllerCreateUser({ ...opts, client })),\n update: async (opts) =>\n unwrap(await userControllerUpdateUser({ ...opts, client })),\n };\n\n this.sites = {\n list: async (opts) =>\n unwrap(await siteControllerListSites({ ...(opts ?? {}), client })),\n create: async (opts) =>\n unwrap(await siteControllerCreateSite({ ...opts, client })),\n update: async (opts) =>\n unwrap(await siteControllerUpdateSite({ ...opts, client })),\n delete: async (opts) =>\n unwrap(await siteControllerDeleteSite({ ...opts, client })),\n };\n\n this.inspections = {\n list: async (opts) =>\n unwrap(\n await inspectionControllerListInspections({\n ...(opts ?? {}),\n client,\n }),\n ),\n getDetail: async (opts) =>\n unwrap(\n await inspectionControllerGetPublicInspection({ ...opts, client }),\n ),\n };\n\n this.issues = {\n list: async (opts) =>\n unwrap(await issueControllerListIssues({ ...(opts ?? {}), client })),\n get: async (opts) =>\n unwrap(await issueControllerGetIssuePublic({ ...opts, client })),\n update: async (opts) =>\n unwrap(await issueControllerUpdateIssuePublic({ ...opts, client })),\n getHistory: async (opts) =>\n unwrap(\n await issueControllerGetIssueHistoryPublic({ ...opts, client }),\n ),\n };\n\n this.userProperties = {\n update: async (opts) =>\n unwrap(\n await userPropertyControllerUpdateUserProperty({ ...opts, client }),\n ),\n delete: async (opts) =>\n unwrap(\n await userPropertyControllerDeleteUserProperty({ ...opts, client }),\n ),\n };\n\n this.checklists = {\n list: async (opts) =>\n unwrap(\n await checklistControllerListChecklists({ ...(opts ?? {}), client }),\n ),\n get: async (opts) =>\n unwrap(await checklistControllerGetChecklist({ ...opts, client })),\n };\n\n this.config = {\n listTables: async (opts) =>\n unwrap(\n await publicConfigControllerListConfigTables({\n ...(opts ?? {}),\n client,\n }),\n ),\n listItems: async (opts) =>\n unwrap(\n await publicConfigControllerListConfigItems({\n ...(opts ?? {}),\n client,\n }),\n ),\n getItem: async (opts) =>\n unwrap(await publicConfigControllerGetConfigItem({ ...opts, client })),\n createItem: async (opts) =>\n unwrap(\n await publicConfigControllerCreateConfigItem({ ...opts, client }),\n ),\n updateItem: async (opts) =>\n unwrap(\n await publicConfigControllerUpdateConfigItem({ ...opts, client }),\n ),\n deleteItem: async (opts) =>\n unwrap(\n await publicConfigControllerDeleteConfigItem({ ...opts, client }),\n ),\n };\n }\n}\n","/**\n * `@wakata-dev/api-client` — the official TypeScript SDK for the Wakata Public API.\n *\n * See README.md for usage.\n */\n\nexport const PACKAGE_NAME = '@wakata-dev/api-client';\nexport const PACKAGE_VERSION = '0.3.1';\n\n/** Default base URL for the Wakata Public API (production). */\nexport const DEFAULT_BASE_URL = 'https://api.wakata.ai/api/v1';\n\n// Wrapper layer — the recommended public surface.\nexport { WakataClient } from './client.js';\nexport type {\n WakataClientOptions,\n AssetsResource,\n UsersResource,\n SitesResource,\n InspectionsResource,\n IssuesResource,\n UserPropertiesResource,\n} from './client.js';\n\n// Error hierarchy.\nexport {\n WakataApiError,\n WakataValidationError,\n WakataAuthError,\n WakataPermissionError,\n WakataNotFoundError,\n WakataConflictError,\n WakataRateLimitError,\n WakataServerError,\n mapApiError,\n} from './errors.js';\nexport type { ErrorDetail, WakataErrorEnvelope } from './errors.js';\n\n// Idempotency helper — exposed in case callers want to mint keys themselves\n// (e.g. to retry the same logical operation across processes).\nexport { generateIdempotencyKey } from './idempotency.js';\n\n// Re-export the generated types + raw operations for advanced consumers who\n// want to drop down past the wrapper. Avoid collisions with the wrapper's\n// exported names.\nexport * from './generated/types.gen.js';\n"]}
|