@wakata-dev/api-client 0.1.0 → 0.1.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/README.md CHANGED
@@ -57,7 +57,7 @@ Each method takes the operation's `body`, `path`, `query`, and `headers` in a si
57
57
 
58
58
  ## Error handling
59
59
 
60
- The Wakata API always returns a standardized error envelope on non-2xx responses (see `apps/api/docs/QUICKSTART.md` § 7). The SDK maps each response to the most specific subclass of `WakataApiError`:
60
+ The Wakata API always returns a standardized error envelope on non-2xx responses (see the portal's API Quickstart page, Settings → API Keys → Quickstart § 5 "Handling errors"). The SDK maps each response to the most specific subclass of `WakataApiError`:
61
61
 
62
62
  ```ts
63
63
  import {
package/dist/index.cjs CHANGED
@@ -400,7 +400,7 @@ var siteControllerUpdateSite = (options) => {
400
400
 
401
401
  // src/client.ts
402
402
  var DEFAULT_BASE_URL = "https://api.wakata.ai/api/v1";
403
- var PACKAGE_VERSION = "0.1.0";
403
+ var PACKAGE_VERSION = "0.1.1";
404
404
  function unwrap(result) {
405
405
  if (result.data === void 0) {
406
406
  throw new WakataApiError({
@@ -529,7 +529,7 @@ var WakataClient = class {
529
529
 
530
530
  // src/index.ts
531
531
  var PACKAGE_NAME = "@wakata-dev/api-client";
532
- var PACKAGE_VERSION2 = "0.1.0";
532
+ var PACKAGE_VERSION2 = "0.1.1";
533
533
  var DEFAULT_BASE_URL2 = "https://api.wakata.ai/api/v1";
534
534
 
535
535
  exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL2;
@@ -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":";;;;;;;AAgEO,IAAM,cAAA,GAAN,cAA6B,KAAA,CAAM;AAAA,EAcjC,YAAY,IAAA,EAQhB;AACD,IAAA,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AA,KACjB,MAAA;AAAA,QACE,MAAM,oCAAA,CAAqC,EAAE,GAAG,IAAA,EAAM,MAAA,EAAAA,SAAQ;AAAA;AAChE,KACJ;AAEA,IAAA,IAAA,CAAK,cAAA,GAAiB;AAAA,MACpB,MAAA,EAAQ,OAAO,IAAA,KACb,MAAA;AAAA,QACE,MAAM,wCAAA,CAAyC,EAAE,GAAG,IAAA,EAAM,MAAA,EAAAA,SAAQ;AAAA,OACpE;AAAA,MACF,MAAA,EAAQ,OAAO,IAAA,KACb,MAAA;AAAA,QACE,MAAM,wCAAA,CAAyC,EAAE,GAAG,IAAA,EAAM,MAAA,EAAAA,SAAQ;AAAA;AACpE,KACJ;AAAA,EACF;AACF;;;ACxaO,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 `apps/api/docs/QUICKSTART.md`):\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 `apps/api/docs/QUICKSTART.md` § 9.\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://lrfq4vihdi.execute-api.ap-southeast-2.amazonaws.com'\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, 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, 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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/public/inspection/list',\n ...options\n });\n};\n\n/**\n * Submit inspection with nested data\n * 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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/asset-class/{id}',\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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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 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} 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.1.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 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 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\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 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}\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.1.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,CAAM,KAAK,OAAO,CAAA;AAClB,IAAA,IAAA,CAAK,IAAA,GAAO,gBAAA;AACZ,IAAA,IAAA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AAAA;AAChE,KACJ;AAEA,IAAA,IAAA,CAAK,cAAA,GAAiB;AAAA,MACpB,MAAA,EAAQ,OAAO,IAAA,KACb,MAAA;AAAA,QACE,MAAM,wCAAA,CAAyC,EAAE,GAAG,IAAA,EAAM,MAAA,EAAAA,SAAQ;AAAA,OACpE;AAAA,MACF,MAAA,EAAQ,OAAO,IAAA,KACb,MAAA;AAAA,QACE,MAAM,wCAAA,CAAyC,EAAE,GAAG,IAAA,EAAM,MAAA,EAAAA,SAAQ;AAAA;AACpE,KACJ;AAAA,EACF;AACF;;;ACxaO,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://lrfq4vihdi.execute-api.ap-southeast-2.amazonaws.com'\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, 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, 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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/public/inspection/list',\n ...options\n });\n};\n\n/**\n * Submit inspection with nested data\n * 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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/asset-class/{id}',\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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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 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} 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.1.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 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 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\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 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}\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.1.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"]}
package/dist/index.d.cts CHANGED
@@ -191,6 +191,54 @@ type TokenResponseDto = {
191
191
  */
192
192
  company: TokenCompanyDto;
193
193
  };
194
+ type EmbeddedAssetPropertyDto = {
195
+ /**
196
+ * Custom field-definition ID (config_items.id — which field, e.g. "Voyage"). Serialized as a string in public API responses (BigInt-safe).
197
+ */
198
+ property_id: string;
199
+ /**
200
+ * The asset_properties value-row ID. Pass this to PATCH/DELETE /asset-property/:id to update or remove the value. Serialized as a string in public API responses (BigInt-safe).
201
+ */
202
+ asset_property_id: string;
203
+ /**
204
+ * Property name from config_items
205
+ */
206
+ property_name: string;
207
+ /**
208
+ * Text value (if property type is text)
209
+ */
210
+ text_value: {
211
+ [key: string]: unknown;
212
+ } | null;
213
+ /**
214
+ * Numeric value (if property type is numeric)
215
+ */
216
+ numeric_value: {
217
+ [key: string]: unknown;
218
+ } | null;
219
+ /**
220
+ * Date value (if property type is date)
221
+ */
222
+ date_value: {
223
+ [key: string]: unknown;
224
+ } | null;
225
+ /**
226
+ * Timestamp the property value was last updated
227
+ */
228
+ updated_at: string;
229
+ /**
230
+ * Public ID (UUID) of the user who last updated this value
231
+ */
232
+ updated_by: {
233
+ [key: string]: unknown;
234
+ } | null;
235
+ /**
236
+ * Name of the user who last updated this value
237
+ */
238
+ updated_by_name: {
239
+ [key: string]: unknown;
240
+ } | null;
241
+ };
194
242
  type CreateAssetDto = {
195
243
  /**
196
244
  * Device ID for authentication (optional for API key auth)
@@ -2165,6 +2213,14 @@ type AssetControllerCreateAssetPublicResponses = {
2165
2213
  updatedAt?: string;
2166
2214
  deletedAt?: string | null;
2167
2215
  deletedById?: string | null;
2216
+ /**
2217
+ * Project location the asset is currently assigned to, or null. String (BigInt-safe).
2218
+ */
2219
+ currentProjectLocationId?: string | null;
2220
+ /**
2221
+ * Custom asset property values. Each entry exposes property_id (the field definition) and asset_property_id (the value row, for round-tripping into PATCH/DELETE /asset-property/:id). Empty when the asset has no custom properties.
2222
+ */
2223
+ asset_properties?: Array<EmbeddedAssetPropertyDto>;
2168
2224
  };
2169
2225
  };
2170
2226
  type AssetControllerCreateAssetPublicResponse = AssetControllerCreateAssetPublicResponses[keyof AssetControllerCreateAssetPublicResponses];
@@ -2256,6 +2312,14 @@ type AssetControllerListAssetsResponses = {
2256
2312
  updatedAt?: string;
2257
2313
  deletedAt?: string | null;
2258
2314
  deletedById?: string | null;
2315
+ /**
2316
+ * Project location the asset is currently assigned to, or null. String (BigInt-safe).
2317
+ */
2318
+ currentProjectLocationId?: string | null;
2319
+ /**
2320
+ * Custom asset property values. Each entry exposes property_id (the field definition) and asset_property_id (the value row, for round-tripping into PATCH/DELETE /asset-property/:id). Empty when the asset has no custom properties.
2321
+ */
2322
+ asset_properties?: Array<EmbeddedAssetPropertyDto>;
2259
2323
  }>;
2260
2324
  pagination?: {
2261
2325
  page?: number;
@@ -2318,6 +2382,14 @@ type AssetControllerGetAssetResponses = {
2318
2382
  updatedAt?: string;
2319
2383
  deletedAt?: string | null;
2320
2384
  deletedById?: string | null;
2385
+ /**
2386
+ * Project location the asset is currently assigned to, or null. String (BigInt-safe).
2387
+ */
2388
+ currentProjectLocationId?: string | null;
2389
+ /**
2390
+ * Custom asset property values. Each entry exposes property_id (the field definition) and asset_property_id (the value row, for round-tripping into PATCH/DELETE /asset-property/:id). Empty when the asset has no custom properties.
2391
+ */
2392
+ asset_properties?: Array<EmbeddedAssetPropertyDto>;
2321
2393
  };
2322
2394
  };
2323
2395
  type AssetControllerGetAssetResponse = AssetControllerGetAssetResponses[keyof AssetControllerGetAssetResponses];
@@ -2390,6 +2462,14 @@ type AssetControllerUpdateAssetResponses = {
2390
2462
  updatedAt?: string;
2391
2463
  deletedAt?: string | null;
2392
2464
  deletedById?: string | null;
2465
+ /**
2466
+ * Project location the asset is currently assigned to, or null. String (BigInt-safe).
2467
+ */
2468
+ currentProjectLocationId?: string | null;
2469
+ /**
2470
+ * Custom asset property values. Each entry exposes property_id (the field definition) and asset_property_id (the value row, for round-tripping into PATCH/DELETE /asset-property/:id). Empty when the asset has no custom properties.
2471
+ */
2472
+ asset_properties?: Array<EmbeddedAssetPropertyDto>;
2393
2473
  };
2394
2474
  };
2395
2475
  type AssetControllerUpdateAssetResponse = AssetControllerUpdateAssetResponses[keyof AssetControllerUpdateAssetResponses];
@@ -3823,6 +3903,8 @@ declare const assetControllerCreateAssetPublic: <ThrowOnError extends boolean =
3823
3903
  updatedAt?: string;
3824
3904
  deletedAt?: string | null;
3825
3905
  deletedById?: string | null;
3906
+ currentProjectLocationId?: string | null;
3907
+ asset_properties?: Array<EmbeddedAssetPropertyDto>;
3826
3908
  }, ApiErrorResponse, ThrowOnError>;
3827
3909
  /**
3828
3910
  * List assets with filters
@@ -3846,6 +3928,8 @@ declare const assetControllerListAssets: <ThrowOnError extends boolean = false>(
3846
3928
  updatedAt?: string;
3847
3929
  deletedAt?: string | null;
3848
3930
  deletedById?: string | null;
3931
+ currentProjectLocationId?: string | null;
3932
+ asset_properties?: Array<EmbeddedAssetPropertyDto>;
3849
3933
  }>;
3850
3934
  pagination?: {
3851
3935
  page?: number;
@@ -3875,6 +3959,8 @@ declare const assetControllerGetAsset: <ThrowOnError extends boolean = false>(op
3875
3959
  updatedAt?: string;
3876
3960
  deletedAt?: string | null;
3877
3961
  deletedById?: string | null;
3962
+ currentProjectLocationId?: string | null;
3963
+ asset_properties?: Array<EmbeddedAssetPropertyDto>;
3878
3964
  }, ApiErrorResponse, ThrowOnError>;
3879
3965
  /**
3880
3966
  * Update asset by public ID
@@ -3897,6 +3983,8 @@ declare const assetControllerUpdateAsset: <ThrowOnError extends boolean = false>
3897
3983
  updatedAt?: string;
3898
3984
  deletedAt?: string | null;
3899
3985
  deletedById?: string | null;
3986
+ currentProjectLocationId?: string | null;
3987
+ asset_properties?: Array<EmbeddedAssetPropertyDto>;
3900
3988
  }, ApiErrorResponse, ThrowOnError>;
3901
3989
  /**
3902
3990
  * List users
@@ -4166,7 +4254,8 @@ declare class WakataClient {
4166
4254
  * Typed error hierarchy for the Wakata API client.
4167
4255
  *
4168
4256
  * The Wakata Public API always returns a standardized error envelope on
4169
- * non-2xx responses (see `apps/api/docs/QUICKSTART.md`):
4257
+ * non-2xx responses (see the portal's API Quickstart page,
4258
+ * Settings → API Keys → Quickstart § 5 "Handling errors"):
4170
4259
  *
4171
4260
  * ```json
4172
4261
  * {
@@ -4311,7 +4400,8 @@ declare function mapApiError(statusCode: number, envelope: WakataErrorEnvelope |
4311
4400
  * (i.e. the same logical operation across multiple retry attempts) should
4312
4401
  * generate their own key once and pass it via `headers: { 'Idempotency-Key': ... }`.
4313
4402
  *
4314
- * See `apps/api/docs/QUICKSTART.md` § 9.
4403
+ * See the Wakata portal's API Quickstart page (Settings → API Keys →
4404
+ * Quickstart) § 7 "Safe retries with Idempotency-Key" for the full contract.
4315
4405
  */
4316
4406
  /**
4317
4407
  * Generate an idempotency key prefixed with `wak_idem_`. Uses Web Crypto's
@@ -4326,8 +4416,8 @@ declare function generateIdempotencyKey(): string;
4326
4416
  * See README.md for usage.
4327
4417
  */
4328
4418
  declare const PACKAGE_NAME = "@wakata-dev/api-client";
4329
- declare const PACKAGE_VERSION = "0.1.0";
4419
+ declare const PACKAGE_VERSION = "0.1.1";
4330
4420
  /** Default base URL for the Wakata Public API (production). */
4331
4421
  declare const DEFAULT_BASE_URL = "https://api.wakata.ai/api/v1";
4332
4422
 
4333
- export { type ApiErrorBody, type ApiErrorDetail, type ApiErrorResponse, type AssetClassControllerCreateAssetClassData, type AssetClassControllerCreateAssetClassError, type AssetClassControllerCreateAssetClassErrors, type AssetClassControllerCreateAssetClassResponse, type AssetClassControllerCreateAssetClassResponses, type AssetClassControllerGetAssetClassListData, type AssetClassControllerGetAssetClassListError, type AssetClassControllerGetAssetClassListErrors, type AssetClassControllerGetAssetClassListResponse, type AssetClassControllerGetAssetClassListResponses, type AssetClassControllerUpdateAssetClassData, type AssetClassControllerUpdateAssetClassError, type AssetClassControllerUpdateAssetClassErrors, type AssetClassControllerUpdateAssetClassResponse, type AssetClassControllerUpdateAssetClassResponses, type AssetClassListResponseDto, type AssetClassResponseDto, type AssetControllerCreateAssetPublicData, type AssetControllerCreateAssetPublicError, type AssetControllerCreateAssetPublicErrors, type AssetControllerCreateAssetPublicResponse, type AssetControllerCreateAssetPublicResponses, type AssetControllerGetAssetData, type AssetControllerGetAssetError, type AssetControllerGetAssetErrors, type AssetControllerGetAssetResponse, type AssetControllerGetAssetResponses, type AssetControllerListAssetsData, type AssetControllerListAssetsError, type AssetControllerListAssetsErrors, type AssetControllerListAssetsResponse, type AssetControllerListAssetsResponses, type AssetControllerUpdateAssetData, type AssetControllerUpdateAssetError, type AssetControllerUpdateAssetErrors, type AssetControllerUpdateAssetResponse, type AssetControllerUpdateAssetResponses, type AssetPropertyControllerDeleteAssetPropertyData, type AssetPropertyControllerDeleteAssetPropertyError, type AssetPropertyControllerDeleteAssetPropertyErrors, type AssetPropertyControllerDeleteAssetPropertyResponse, type AssetPropertyControllerDeleteAssetPropertyResponses, type AssetPropertyControllerUpdateAssetPropertyData, type AssetPropertyControllerUpdateAssetPropertyError, type AssetPropertyControllerUpdateAssetPropertyErrors, type AssetPropertyControllerUpdateAssetPropertyResponse, type AssetPropertyControllerUpdateAssetPropertyResponses, type AssetPropertyResponseDto, type AssetsResource, type ChangePinDto, type ClientOptions, type CreateAssetClassDto, type CreateAssetDto, type CreateInspectionDto, type CreateIssueMediaDto, type CreateSiteDto, type CreateTokenDto, DEFAULT_BASE_URL, type DeleteAssetPropertyResponseDto, type DeleteInspectionDto, type DeleteSiteResponseDto, type DeleteUserPropertyResponseDto, type DownloadResponseDto, type EmbeddedUserPropertyDto, type ErrorDetail, type ExtraInfoDto, type InspectionControllerListInspectionsData, type InspectionControllerListInspectionsError, type InspectionControllerListInspectionsErrors, type InspectionControllerListInspectionsResponse, type InspectionControllerListInspectionsResponses, type InspectionControllerSubmitInspectionPublicData, type InspectionControllerSubmitInspectionPublicError, type InspectionControllerSubmitInspectionPublicErrors, type InspectionControllerSubmitInspectionPublicResponse, type InspectionControllerSubmitInspectionPublicResponses, type InspectionResponseDto, type InspectionsResource, type IssueControllerGetIssueHistoryPublicData, type IssueControllerGetIssueHistoryPublicError, type IssueControllerGetIssueHistoryPublicErrors, type IssueControllerGetIssueHistoryPublicResponse, type IssueControllerGetIssueHistoryPublicResponses, type IssueControllerGetIssuePublicData, type IssueControllerGetIssuePublicError, type IssueControllerGetIssuePublicErrors, type IssueControllerGetIssuePublicResponse, type IssueControllerGetIssuePublicResponses, type IssueControllerListIssuesData, type IssueControllerListIssuesError, type IssueControllerListIssuesErrors, type IssueControllerListIssuesResponse, type IssueControllerListIssuesResponses, type IssueControllerUpdateIssuePublicData, type IssueControllerUpdateIssuePublicError, type IssueControllerUpdateIssuePublicErrors, type IssueControllerUpdateIssuePublicResponse, type IssueControllerUpdateIssuePublicResponses, type IssueHistoryDto, type IssueHistoryResponseDto, type IssueMediaResponseDto, type IssueResponseDto, type IssuesResource, type ListInspectionsResponseDto, type ListIssuesResponseDto, type ListSitesResponseDto, type MediaDto, PACKAGE_NAME, PACKAGE_VERSION, type PublicCreateAssetDto, type RegisterDeviceDto, type RegisterDeviceResponseDto, type RepeatInspectionDto, type RequestDownloadDto, type RequestLogUploadDto, type RequestUploadDto, type ResponseDto, type ResponseOptionDto, type ResumeInspectionDto, type SendCredentialsDto, type SiteControllerCreateSiteData, type SiteControllerCreateSiteError, type SiteControllerCreateSiteErrors, type SiteControllerCreateSiteResponse, type SiteControllerCreateSiteResponses, type SiteControllerDeleteSiteData, type SiteControllerDeleteSiteError, type SiteControllerDeleteSiteErrors, type SiteControllerDeleteSiteResponse, type SiteControllerDeleteSiteResponses, type SiteControllerListSitesData, type SiteControllerListSitesError, type SiteControllerListSitesErrors, type SiteControllerListSitesResponse, type SiteControllerListSitesResponses, type SiteControllerUpdateSiteData, type SiteControllerUpdateSiteError, type SiteControllerUpdateSiteErrors, type SiteControllerUpdateSiteResponse, type SiteControllerUpdateSiteResponses, type SiteResponseDto, type SitesResource, type SubmitInspectionDto, type TokenCompanyDto, type TokenResponseDto, type TokenUserDto, type UpdateAssetClassDto, type UpdateAssetDto, type UpdateAssetPropertyDto, type UpdateInspectionDto, type UpdateIssueDto, type UpdateSiteDto, type UpdateUserPropertyDto, type UploadCredentialsResponseDto, type UserControllerCreateUserData, type UserControllerCreateUserError, type UserControllerCreateUserErrors, type UserControllerCreateUserResponse, type UserControllerCreateUserResponses, type UserControllerGetUserData, type UserControllerGetUserError, type UserControllerGetUserErrors, type UserControllerGetUserResponse, type UserControllerGetUserResponses, type UserControllerListUsersData, type UserControllerListUsersError, type UserControllerListUsersErrors, type UserControllerListUsersResponse, type UserControllerListUsersResponses, type UserControllerUpdateUserData, type UserControllerUpdateUserError, type UserControllerUpdateUserErrors, type UserControllerUpdateUserResponse, type UserControllerUpdateUserResponses, type UserPropertiesResource, type UserPropertyControllerDeleteUserPropertyData, type UserPropertyControllerDeleteUserPropertyError, type UserPropertyControllerDeleteUserPropertyErrors, type UserPropertyControllerDeleteUserPropertyResponse, type UserPropertyControllerDeleteUserPropertyResponses, type UserPropertyControllerUpdateUserPropertyData, type UserPropertyControllerUpdateUserPropertyError, type UserPropertyControllerUpdateUserPropertyErrors, type UserPropertyControllerUpdateUserPropertyResponse, type UserPropertyControllerUpdateUserPropertyResponses, type UserPropertyResponseDto, type UserResponseDto, type UsersResource, WakataApiError, WakataAuthError, WakataClient, type WakataClientOptions, WakataConflictError, type WakataErrorEnvelope, WakataNotFoundError, WakataPermissionError, WakataRateLimitError, WakataServerError, WakataValidationError, generateIdempotencyKey, mapApiError };
4423
+ export { type ApiErrorBody, type ApiErrorDetail, type ApiErrorResponse, type AssetClassControllerCreateAssetClassData, type AssetClassControllerCreateAssetClassError, type AssetClassControllerCreateAssetClassErrors, type AssetClassControllerCreateAssetClassResponse, type AssetClassControllerCreateAssetClassResponses, type AssetClassControllerGetAssetClassListData, type AssetClassControllerGetAssetClassListError, type AssetClassControllerGetAssetClassListErrors, type AssetClassControllerGetAssetClassListResponse, type AssetClassControllerGetAssetClassListResponses, type AssetClassControllerUpdateAssetClassData, type AssetClassControllerUpdateAssetClassError, type AssetClassControllerUpdateAssetClassErrors, type AssetClassControllerUpdateAssetClassResponse, type AssetClassControllerUpdateAssetClassResponses, type AssetClassListResponseDto, type AssetClassResponseDto, type AssetControllerCreateAssetPublicData, type AssetControllerCreateAssetPublicError, type AssetControllerCreateAssetPublicErrors, type AssetControllerCreateAssetPublicResponse, type AssetControllerCreateAssetPublicResponses, type AssetControllerGetAssetData, type AssetControllerGetAssetError, type AssetControllerGetAssetErrors, type AssetControllerGetAssetResponse, type AssetControllerGetAssetResponses, type AssetControllerListAssetsData, type AssetControllerListAssetsError, type AssetControllerListAssetsErrors, type AssetControllerListAssetsResponse, type AssetControllerListAssetsResponses, type AssetControllerUpdateAssetData, type AssetControllerUpdateAssetError, type AssetControllerUpdateAssetErrors, type AssetControllerUpdateAssetResponse, type AssetControllerUpdateAssetResponses, type AssetPropertyControllerDeleteAssetPropertyData, type AssetPropertyControllerDeleteAssetPropertyError, type AssetPropertyControllerDeleteAssetPropertyErrors, type AssetPropertyControllerDeleteAssetPropertyResponse, type AssetPropertyControllerDeleteAssetPropertyResponses, type AssetPropertyControllerUpdateAssetPropertyData, type AssetPropertyControllerUpdateAssetPropertyError, type AssetPropertyControllerUpdateAssetPropertyErrors, type AssetPropertyControllerUpdateAssetPropertyResponse, type AssetPropertyControllerUpdateAssetPropertyResponses, type AssetPropertyResponseDto, type AssetsResource, type ChangePinDto, type ClientOptions, type CreateAssetClassDto, type CreateAssetDto, type CreateInspectionDto, type CreateIssueMediaDto, type CreateSiteDto, type CreateTokenDto, DEFAULT_BASE_URL, type DeleteAssetPropertyResponseDto, type DeleteInspectionDto, type DeleteSiteResponseDto, type DeleteUserPropertyResponseDto, type DownloadResponseDto, type EmbeddedAssetPropertyDto, type EmbeddedUserPropertyDto, type ErrorDetail, type ExtraInfoDto, type InspectionControllerListInspectionsData, type InspectionControllerListInspectionsError, type InspectionControllerListInspectionsErrors, type InspectionControllerListInspectionsResponse, type InspectionControllerListInspectionsResponses, type InspectionControllerSubmitInspectionPublicData, type InspectionControllerSubmitInspectionPublicError, type InspectionControllerSubmitInspectionPublicErrors, type InspectionControllerSubmitInspectionPublicResponse, type InspectionControllerSubmitInspectionPublicResponses, type InspectionResponseDto, type InspectionsResource, type IssueControllerGetIssueHistoryPublicData, type IssueControllerGetIssueHistoryPublicError, type IssueControllerGetIssueHistoryPublicErrors, type IssueControllerGetIssueHistoryPublicResponse, type IssueControllerGetIssueHistoryPublicResponses, type IssueControllerGetIssuePublicData, type IssueControllerGetIssuePublicError, type IssueControllerGetIssuePublicErrors, type IssueControllerGetIssuePublicResponse, type IssueControllerGetIssuePublicResponses, type IssueControllerListIssuesData, type IssueControllerListIssuesError, type IssueControllerListIssuesErrors, type IssueControllerListIssuesResponse, type IssueControllerListIssuesResponses, type IssueControllerUpdateIssuePublicData, type IssueControllerUpdateIssuePublicError, type IssueControllerUpdateIssuePublicErrors, type IssueControllerUpdateIssuePublicResponse, type IssueControllerUpdateIssuePublicResponses, type IssueHistoryDto, type IssueHistoryResponseDto, type IssueMediaResponseDto, type IssueResponseDto, type IssuesResource, type ListInspectionsResponseDto, type ListIssuesResponseDto, type ListSitesResponseDto, type MediaDto, PACKAGE_NAME, PACKAGE_VERSION, type PublicCreateAssetDto, type RegisterDeviceDto, type RegisterDeviceResponseDto, type RepeatInspectionDto, type RequestDownloadDto, type RequestLogUploadDto, type RequestUploadDto, type ResponseDto, type ResponseOptionDto, type ResumeInspectionDto, type SendCredentialsDto, type SiteControllerCreateSiteData, type SiteControllerCreateSiteError, type SiteControllerCreateSiteErrors, type SiteControllerCreateSiteResponse, type SiteControllerCreateSiteResponses, type SiteControllerDeleteSiteData, type SiteControllerDeleteSiteError, type SiteControllerDeleteSiteErrors, type SiteControllerDeleteSiteResponse, type SiteControllerDeleteSiteResponses, type SiteControllerListSitesData, type SiteControllerListSitesError, type SiteControllerListSitesErrors, type SiteControllerListSitesResponse, type SiteControllerListSitesResponses, type SiteControllerUpdateSiteData, type SiteControllerUpdateSiteError, type SiteControllerUpdateSiteErrors, type SiteControllerUpdateSiteResponse, type SiteControllerUpdateSiteResponses, type SiteResponseDto, type SitesResource, type SubmitInspectionDto, type TokenCompanyDto, type TokenResponseDto, type TokenUserDto, type UpdateAssetClassDto, type UpdateAssetDto, type UpdateAssetPropertyDto, type UpdateInspectionDto, type UpdateIssueDto, type UpdateSiteDto, type UpdateUserPropertyDto, type UploadCredentialsResponseDto, type UserControllerCreateUserData, type UserControllerCreateUserError, type UserControllerCreateUserErrors, type UserControllerCreateUserResponse, type UserControllerCreateUserResponses, type UserControllerGetUserData, type UserControllerGetUserError, type UserControllerGetUserErrors, type UserControllerGetUserResponse, type UserControllerGetUserResponses, type UserControllerListUsersData, type UserControllerListUsersError, type UserControllerListUsersErrors, type UserControllerListUsersResponse, type UserControllerListUsersResponses, type UserControllerUpdateUserData, type UserControllerUpdateUserError, type UserControllerUpdateUserErrors, type UserControllerUpdateUserResponse, type UserControllerUpdateUserResponses, type UserPropertiesResource, type UserPropertyControllerDeleteUserPropertyData, type UserPropertyControllerDeleteUserPropertyError, type UserPropertyControllerDeleteUserPropertyErrors, type UserPropertyControllerDeleteUserPropertyResponse, type UserPropertyControllerDeleteUserPropertyResponses, type UserPropertyControllerUpdateUserPropertyData, type UserPropertyControllerUpdateUserPropertyError, type UserPropertyControllerUpdateUserPropertyErrors, type UserPropertyControllerUpdateUserPropertyResponse, type UserPropertyControllerUpdateUserPropertyResponses, type UserPropertyResponseDto, type UserResponseDto, type UsersResource, WakataApiError, WakataAuthError, WakataClient, type WakataClientOptions, WakataConflictError, type WakataErrorEnvelope, WakataNotFoundError, WakataPermissionError, WakataRateLimitError, WakataServerError, WakataValidationError, generateIdempotencyKey, mapApiError };
package/dist/index.d.ts CHANGED
@@ -191,6 +191,54 @@ type TokenResponseDto = {
191
191
  */
192
192
  company: TokenCompanyDto;
193
193
  };
194
+ type EmbeddedAssetPropertyDto = {
195
+ /**
196
+ * Custom field-definition ID (config_items.id — which field, e.g. "Voyage"). Serialized as a string in public API responses (BigInt-safe).
197
+ */
198
+ property_id: string;
199
+ /**
200
+ * The asset_properties value-row ID. Pass this to PATCH/DELETE /asset-property/:id to update or remove the value. Serialized as a string in public API responses (BigInt-safe).
201
+ */
202
+ asset_property_id: string;
203
+ /**
204
+ * Property name from config_items
205
+ */
206
+ property_name: string;
207
+ /**
208
+ * Text value (if property type is text)
209
+ */
210
+ text_value: {
211
+ [key: string]: unknown;
212
+ } | null;
213
+ /**
214
+ * Numeric value (if property type is numeric)
215
+ */
216
+ numeric_value: {
217
+ [key: string]: unknown;
218
+ } | null;
219
+ /**
220
+ * Date value (if property type is date)
221
+ */
222
+ date_value: {
223
+ [key: string]: unknown;
224
+ } | null;
225
+ /**
226
+ * Timestamp the property value was last updated
227
+ */
228
+ updated_at: string;
229
+ /**
230
+ * Public ID (UUID) of the user who last updated this value
231
+ */
232
+ updated_by: {
233
+ [key: string]: unknown;
234
+ } | null;
235
+ /**
236
+ * Name of the user who last updated this value
237
+ */
238
+ updated_by_name: {
239
+ [key: string]: unknown;
240
+ } | null;
241
+ };
194
242
  type CreateAssetDto = {
195
243
  /**
196
244
  * Device ID for authentication (optional for API key auth)
@@ -2165,6 +2213,14 @@ type AssetControllerCreateAssetPublicResponses = {
2165
2213
  updatedAt?: string;
2166
2214
  deletedAt?: string | null;
2167
2215
  deletedById?: string | null;
2216
+ /**
2217
+ * Project location the asset is currently assigned to, or null. String (BigInt-safe).
2218
+ */
2219
+ currentProjectLocationId?: string | null;
2220
+ /**
2221
+ * Custom asset property values. Each entry exposes property_id (the field definition) and asset_property_id (the value row, for round-tripping into PATCH/DELETE /asset-property/:id). Empty when the asset has no custom properties.
2222
+ */
2223
+ asset_properties?: Array<EmbeddedAssetPropertyDto>;
2168
2224
  };
2169
2225
  };
2170
2226
  type AssetControllerCreateAssetPublicResponse = AssetControllerCreateAssetPublicResponses[keyof AssetControllerCreateAssetPublicResponses];
@@ -2256,6 +2312,14 @@ type AssetControllerListAssetsResponses = {
2256
2312
  updatedAt?: string;
2257
2313
  deletedAt?: string | null;
2258
2314
  deletedById?: string | null;
2315
+ /**
2316
+ * Project location the asset is currently assigned to, or null. String (BigInt-safe).
2317
+ */
2318
+ currentProjectLocationId?: string | null;
2319
+ /**
2320
+ * Custom asset property values. Each entry exposes property_id (the field definition) and asset_property_id (the value row, for round-tripping into PATCH/DELETE /asset-property/:id). Empty when the asset has no custom properties.
2321
+ */
2322
+ asset_properties?: Array<EmbeddedAssetPropertyDto>;
2259
2323
  }>;
2260
2324
  pagination?: {
2261
2325
  page?: number;
@@ -2318,6 +2382,14 @@ type AssetControllerGetAssetResponses = {
2318
2382
  updatedAt?: string;
2319
2383
  deletedAt?: string | null;
2320
2384
  deletedById?: string | null;
2385
+ /**
2386
+ * Project location the asset is currently assigned to, or null. String (BigInt-safe).
2387
+ */
2388
+ currentProjectLocationId?: string | null;
2389
+ /**
2390
+ * Custom asset property values. Each entry exposes property_id (the field definition) and asset_property_id (the value row, for round-tripping into PATCH/DELETE /asset-property/:id). Empty when the asset has no custom properties.
2391
+ */
2392
+ asset_properties?: Array<EmbeddedAssetPropertyDto>;
2321
2393
  };
2322
2394
  };
2323
2395
  type AssetControllerGetAssetResponse = AssetControllerGetAssetResponses[keyof AssetControllerGetAssetResponses];
@@ -2390,6 +2462,14 @@ type AssetControllerUpdateAssetResponses = {
2390
2462
  updatedAt?: string;
2391
2463
  deletedAt?: string | null;
2392
2464
  deletedById?: string | null;
2465
+ /**
2466
+ * Project location the asset is currently assigned to, or null. String (BigInt-safe).
2467
+ */
2468
+ currentProjectLocationId?: string | null;
2469
+ /**
2470
+ * Custom asset property values. Each entry exposes property_id (the field definition) and asset_property_id (the value row, for round-tripping into PATCH/DELETE /asset-property/:id). Empty when the asset has no custom properties.
2471
+ */
2472
+ asset_properties?: Array<EmbeddedAssetPropertyDto>;
2393
2473
  };
2394
2474
  };
2395
2475
  type AssetControllerUpdateAssetResponse = AssetControllerUpdateAssetResponses[keyof AssetControllerUpdateAssetResponses];
@@ -3823,6 +3903,8 @@ declare const assetControllerCreateAssetPublic: <ThrowOnError extends boolean =
3823
3903
  updatedAt?: string;
3824
3904
  deletedAt?: string | null;
3825
3905
  deletedById?: string | null;
3906
+ currentProjectLocationId?: string | null;
3907
+ asset_properties?: Array<EmbeddedAssetPropertyDto>;
3826
3908
  }, ApiErrorResponse, ThrowOnError>;
3827
3909
  /**
3828
3910
  * List assets with filters
@@ -3846,6 +3928,8 @@ declare const assetControllerListAssets: <ThrowOnError extends boolean = false>(
3846
3928
  updatedAt?: string;
3847
3929
  deletedAt?: string | null;
3848
3930
  deletedById?: string | null;
3931
+ currentProjectLocationId?: string | null;
3932
+ asset_properties?: Array<EmbeddedAssetPropertyDto>;
3849
3933
  }>;
3850
3934
  pagination?: {
3851
3935
  page?: number;
@@ -3875,6 +3959,8 @@ declare const assetControllerGetAsset: <ThrowOnError extends boolean = false>(op
3875
3959
  updatedAt?: string;
3876
3960
  deletedAt?: string | null;
3877
3961
  deletedById?: string | null;
3962
+ currentProjectLocationId?: string | null;
3963
+ asset_properties?: Array<EmbeddedAssetPropertyDto>;
3878
3964
  }, ApiErrorResponse, ThrowOnError>;
3879
3965
  /**
3880
3966
  * Update asset by public ID
@@ -3897,6 +3983,8 @@ declare const assetControllerUpdateAsset: <ThrowOnError extends boolean = false>
3897
3983
  updatedAt?: string;
3898
3984
  deletedAt?: string | null;
3899
3985
  deletedById?: string | null;
3986
+ currentProjectLocationId?: string | null;
3987
+ asset_properties?: Array<EmbeddedAssetPropertyDto>;
3900
3988
  }, ApiErrorResponse, ThrowOnError>;
3901
3989
  /**
3902
3990
  * List users
@@ -4166,7 +4254,8 @@ declare class WakataClient {
4166
4254
  * Typed error hierarchy for the Wakata API client.
4167
4255
  *
4168
4256
  * The Wakata Public API always returns a standardized error envelope on
4169
- * non-2xx responses (see `apps/api/docs/QUICKSTART.md`):
4257
+ * non-2xx responses (see the portal's API Quickstart page,
4258
+ * Settings → API Keys → Quickstart § 5 "Handling errors"):
4170
4259
  *
4171
4260
  * ```json
4172
4261
  * {
@@ -4311,7 +4400,8 @@ declare function mapApiError(statusCode: number, envelope: WakataErrorEnvelope |
4311
4400
  * (i.e. the same logical operation across multiple retry attempts) should
4312
4401
  * generate their own key once and pass it via `headers: { 'Idempotency-Key': ... }`.
4313
4402
  *
4314
- * See `apps/api/docs/QUICKSTART.md` § 9.
4403
+ * See the Wakata portal's API Quickstart page (Settings → API Keys →
4404
+ * Quickstart) § 7 "Safe retries with Idempotency-Key" for the full contract.
4315
4405
  */
4316
4406
  /**
4317
4407
  * Generate an idempotency key prefixed with `wak_idem_`. Uses Web Crypto's
@@ -4326,8 +4416,8 @@ declare function generateIdempotencyKey(): string;
4326
4416
  * See README.md for usage.
4327
4417
  */
4328
4418
  declare const PACKAGE_NAME = "@wakata-dev/api-client";
4329
- declare const PACKAGE_VERSION = "0.1.0";
4419
+ declare const PACKAGE_VERSION = "0.1.1";
4330
4420
  /** Default base URL for the Wakata Public API (production). */
4331
4421
  declare const DEFAULT_BASE_URL = "https://api.wakata.ai/api/v1";
4332
4422
 
4333
- export { type ApiErrorBody, type ApiErrorDetail, type ApiErrorResponse, type AssetClassControllerCreateAssetClassData, type AssetClassControllerCreateAssetClassError, type AssetClassControllerCreateAssetClassErrors, type AssetClassControllerCreateAssetClassResponse, type AssetClassControllerCreateAssetClassResponses, type AssetClassControllerGetAssetClassListData, type AssetClassControllerGetAssetClassListError, type AssetClassControllerGetAssetClassListErrors, type AssetClassControllerGetAssetClassListResponse, type AssetClassControllerGetAssetClassListResponses, type AssetClassControllerUpdateAssetClassData, type AssetClassControllerUpdateAssetClassError, type AssetClassControllerUpdateAssetClassErrors, type AssetClassControllerUpdateAssetClassResponse, type AssetClassControllerUpdateAssetClassResponses, type AssetClassListResponseDto, type AssetClassResponseDto, type AssetControllerCreateAssetPublicData, type AssetControllerCreateAssetPublicError, type AssetControllerCreateAssetPublicErrors, type AssetControllerCreateAssetPublicResponse, type AssetControllerCreateAssetPublicResponses, type AssetControllerGetAssetData, type AssetControllerGetAssetError, type AssetControllerGetAssetErrors, type AssetControllerGetAssetResponse, type AssetControllerGetAssetResponses, type AssetControllerListAssetsData, type AssetControllerListAssetsError, type AssetControllerListAssetsErrors, type AssetControllerListAssetsResponse, type AssetControllerListAssetsResponses, type AssetControllerUpdateAssetData, type AssetControllerUpdateAssetError, type AssetControllerUpdateAssetErrors, type AssetControllerUpdateAssetResponse, type AssetControllerUpdateAssetResponses, type AssetPropertyControllerDeleteAssetPropertyData, type AssetPropertyControllerDeleteAssetPropertyError, type AssetPropertyControllerDeleteAssetPropertyErrors, type AssetPropertyControllerDeleteAssetPropertyResponse, type AssetPropertyControllerDeleteAssetPropertyResponses, type AssetPropertyControllerUpdateAssetPropertyData, type AssetPropertyControllerUpdateAssetPropertyError, type AssetPropertyControllerUpdateAssetPropertyErrors, type AssetPropertyControllerUpdateAssetPropertyResponse, type AssetPropertyControllerUpdateAssetPropertyResponses, type AssetPropertyResponseDto, type AssetsResource, type ChangePinDto, type ClientOptions, type CreateAssetClassDto, type CreateAssetDto, type CreateInspectionDto, type CreateIssueMediaDto, type CreateSiteDto, type CreateTokenDto, DEFAULT_BASE_URL, type DeleteAssetPropertyResponseDto, type DeleteInspectionDto, type DeleteSiteResponseDto, type DeleteUserPropertyResponseDto, type DownloadResponseDto, type EmbeddedUserPropertyDto, type ErrorDetail, type ExtraInfoDto, type InspectionControllerListInspectionsData, type InspectionControllerListInspectionsError, type InspectionControllerListInspectionsErrors, type InspectionControllerListInspectionsResponse, type InspectionControllerListInspectionsResponses, type InspectionControllerSubmitInspectionPublicData, type InspectionControllerSubmitInspectionPublicError, type InspectionControllerSubmitInspectionPublicErrors, type InspectionControllerSubmitInspectionPublicResponse, type InspectionControllerSubmitInspectionPublicResponses, type InspectionResponseDto, type InspectionsResource, type IssueControllerGetIssueHistoryPublicData, type IssueControllerGetIssueHistoryPublicError, type IssueControllerGetIssueHistoryPublicErrors, type IssueControllerGetIssueHistoryPublicResponse, type IssueControllerGetIssueHistoryPublicResponses, type IssueControllerGetIssuePublicData, type IssueControllerGetIssuePublicError, type IssueControllerGetIssuePublicErrors, type IssueControllerGetIssuePublicResponse, type IssueControllerGetIssuePublicResponses, type IssueControllerListIssuesData, type IssueControllerListIssuesError, type IssueControllerListIssuesErrors, type IssueControllerListIssuesResponse, type IssueControllerListIssuesResponses, type IssueControllerUpdateIssuePublicData, type IssueControllerUpdateIssuePublicError, type IssueControllerUpdateIssuePublicErrors, type IssueControllerUpdateIssuePublicResponse, type IssueControllerUpdateIssuePublicResponses, type IssueHistoryDto, type IssueHistoryResponseDto, type IssueMediaResponseDto, type IssueResponseDto, type IssuesResource, type ListInspectionsResponseDto, type ListIssuesResponseDto, type ListSitesResponseDto, type MediaDto, PACKAGE_NAME, PACKAGE_VERSION, type PublicCreateAssetDto, type RegisterDeviceDto, type RegisterDeviceResponseDto, type RepeatInspectionDto, type RequestDownloadDto, type RequestLogUploadDto, type RequestUploadDto, type ResponseDto, type ResponseOptionDto, type ResumeInspectionDto, type SendCredentialsDto, type SiteControllerCreateSiteData, type SiteControllerCreateSiteError, type SiteControllerCreateSiteErrors, type SiteControllerCreateSiteResponse, type SiteControllerCreateSiteResponses, type SiteControllerDeleteSiteData, type SiteControllerDeleteSiteError, type SiteControllerDeleteSiteErrors, type SiteControllerDeleteSiteResponse, type SiteControllerDeleteSiteResponses, type SiteControllerListSitesData, type SiteControllerListSitesError, type SiteControllerListSitesErrors, type SiteControllerListSitesResponse, type SiteControllerListSitesResponses, type SiteControllerUpdateSiteData, type SiteControllerUpdateSiteError, type SiteControllerUpdateSiteErrors, type SiteControllerUpdateSiteResponse, type SiteControllerUpdateSiteResponses, type SiteResponseDto, type SitesResource, type SubmitInspectionDto, type TokenCompanyDto, type TokenResponseDto, type TokenUserDto, type UpdateAssetClassDto, type UpdateAssetDto, type UpdateAssetPropertyDto, type UpdateInspectionDto, type UpdateIssueDto, type UpdateSiteDto, type UpdateUserPropertyDto, type UploadCredentialsResponseDto, type UserControllerCreateUserData, type UserControllerCreateUserError, type UserControllerCreateUserErrors, type UserControllerCreateUserResponse, type UserControllerCreateUserResponses, type UserControllerGetUserData, type UserControllerGetUserError, type UserControllerGetUserErrors, type UserControllerGetUserResponse, type UserControllerGetUserResponses, type UserControllerListUsersData, type UserControllerListUsersError, type UserControllerListUsersErrors, type UserControllerListUsersResponse, type UserControllerListUsersResponses, type UserControllerUpdateUserData, type UserControllerUpdateUserError, type UserControllerUpdateUserErrors, type UserControllerUpdateUserResponse, type UserControllerUpdateUserResponses, type UserPropertiesResource, type UserPropertyControllerDeleteUserPropertyData, type UserPropertyControllerDeleteUserPropertyError, type UserPropertyControllerDeleteUserPropertyErrors, type UserPropertyControllerDeleteUserPropertyResponse, type UserPropertyControllerDeleteUserPropertyResponses, type UserPropertyControllerUpdateUserPropertyData, type UserPropertyControllerUpdateUserPropertyError, type UserPropertyControllerUpdateUserPropertyErrors, type UserPropertyControllerUpdateUserPropertyResponse, type UserPropertyControllerUpdateUserPropertyResponses, type UserPropertyResponseDto, type UserResponseDto, type UsersResource, WakataApiError, WakataAuthError, WakataClient, type WakataClientOptions, WakataConflictError, type WakataErrorEnvelope, WakataNotFoundError, WakataPermissionError, WakataRateLimitError, WakataServerError, WakataValidationError, generateIdempotencyKey, mapApiError };
4423
+ export { type ApiErrorBody, type ApiErrorDetail, type ApiErrorResponse, type AssetClassControllerCreateAssetClassData, type AssetClassControllerCreateAssetClassError, type AssetClassControllerCreateAssetClassErrors, type AssetClassControllerCreateAssetClassResponse, type AssetClassControllerCreateAssetClassResponses, type AssetClassControllerGetAssetClassListData, type AssetClassControllerGetAssetClassListError, type AssetClassControllerGetAssetClassListErrors, type AssetClassControllerGetAssetClassListResponse, type AssetClassControllerGetAssetClassListResponses, type AssetClassControllerUpdateAssetClassData, type AssetClassControllerUpdateAssetClassError, type AssetClassControllerUpdateAssetClassErrors, type AssetClassControllerUpdateAssetClassResponse, type AssetClassControllerUpdateAssetClassResponses, type AssetClassListResponseDto, type AssetClassResponseDto, type AssetControllerCreateAssetPublicData, type AssetControllerCreateAssetPublicError, type AssetControllerCreateAssetPublicErrors, type AssetControllerCreateAssetPublicResponse, type AssetControllerCreateAssetPublicResponses, type AssetControllerGetAssetData, type AssetControllerGetAssetError, type AssetControllerGetAssetErrors, type AssetControllerGetAssetResponse, type AssetControllerGetAssetResponses, type AssetControllerListAssetsData, type AssetControllerListAssetsError, type AssetControllerListAssetsErrors, type AssetControllerListAssetsResponse, type AssetControllerListAssetsResponses, type AssetControllerUpdateAssetData, type AssetControllerUpdateAssetError, type AssetControllerUpdateAssetErrors, type AssetControllerUpdateAssetResponse, type AssetControllerUpdateAssetResponses, type AssetPropertyControllerDeleteAssetPropertyData, type AssetPropertyControllerDeleteAssetPropertyError, type AssetPropertyControllerDeleteAssetPropertyErrors, type AssetPropertyControllerDeleteAssetPropertyResponse, type AssetPropertyControllerDeleteAssetPropertyResponses, type AssetPropertyControllerUpdateAssetPropertyData, type AssetPropertyControllerUpdateAssetPropertyError, type AssetPropertyControllerUpdateAssetPropertyErrors, type AssetPropertyControllerUpdateAssetPropertyResponse, type AssetPropertyControllerUpdateAssetPropertyResponses, type AssetPropertyResponseDto, type AssetsResource, type ChangePinDto, type ClientOptions, type CreateAssetClassDto, type CreateAssetDto, type CreateInspectionDto, type CreateIssueMediaDto, type CreateSiteDto, type CreateTokenDto, DEFAULT_BASE_URL, type DeleteAssetPropertyResponseDto, type DeleteInspectionDto, type DeleteSiteResponseDto, type DeleteUserPropertyResponseDto, type DownloadResponseDto, type EmbeddedAssetPropertyDto, type EmbeddedUserPropertyDto, type ErrorDetail, type ExtraInfoDto, type InspectionControllerListInspectionsData, type InspectionControllerListInspectionsError, type InspectionControllerListInspectionsErrors, type InspectionControllerListInspectionsResponse, type InspectionControllerListInspectionsResponses, type InspectionControllerSubmitInspectionPublicData, type InspectionControllerSubmitInspectionPublicError, type InspectionControllerSubmitInspectionPublicErrors, type InspectionControllerSubmitInspectionPublicResponse, type InspectionControllerSubmitInspectionPublicResponses, type InspectionResponseDto, type InspectionsResource, type IssueControllerGetIssueHistoryPublicData, type IssueControllerGetIssueHistoryPublicError, type IssueControllerGetIssueHistoryPublicErrors, type IssueControllerGetIssueHistoryPublicResponse, type IssueControllerGetIssueHistoryPublicResponses, type IssueControllerGetIssuePublicData, type IssueControllerGetIssuePublicError, type IssueControllerGetIssuePublicErrors, type IssueControllerGetIssuePublicResponse, type IssueControllerGetIssuePublicResponses, type IssueControllerListIssuesData, type IssueControllerListIssuesError, type IssueControllerListIssuesErrors, type IssueControllerListIssuesResponse, type IssueControllerListIssuesResponses, type IssueControllerUpdateIssuePublicData, type IssueControllerUpdateIssuePublicError, type IssueControllerUpdateIssuePublicErrors, type IssueControllerUpdateIssuePublicResponse, type IssueControllerUpdateIssuePublicResponses, type IssueHistoryDto, type IssueHistoryResponseDto, type IssueMediaResponseDto, type IssueResponseDto, type IssuesResource, type ListInspectionsResponseDto, type ListIssuesResponseDto, type ListSitesResponseDto, type MediaDto, PACKAGE_NAME, PACKAGE_VERSION, type PublicCreateAssetDto, type RegisterDeviceDto, type RegisterDeviceResponseDto, type RepeatInspectionDto, type RequestDownloadDto, type RequestLogUploadDto, type RequestUploadDto, type ResponseDto, type ResponseOptionDto, type ResumeInspectionDto, type SendCredentialsDto, type SiteControllerCreateSiteData, type SiteControllerCreateSiteError, type SiteControllerCreateSiteErrors, type SiteControllerCreateSiteResponse, type SiteControllerCreateSiteResponses, type SiteControllerDeleteSiteData, type SiteControllerDeleteSiteError, type SiteControllerDeleteSiteErrors, type SiteControllerDeleteSiteResponse, type SiteControllerDeleteSiteResponses, type SiteControllerListSitesData, type SiteControllerListSitesError, type SiteControllerListSitesErrors, type SiteControllerListSitesResponse, type SiteControllerListSitesResponses, type SiteControllerUpdateSiteData, type SiteControllerUpdateSiteError, type SiteControllerUpdateSiteErrors, type SiteControllerUpdateSiteResponse, type SiteControllerUpdateSiteResponses, type SiteResponseDto, type SitesResource, type SubmitInspectionDto, type TokenCompanyDto, type TokenResponseDto, type TokenUserDto, type UpdateAssetClassDto, type UpdateAssetDto, type UpdateAssetPropertyDto, type UpdateInspectionDto, type UpdateIssueDto, type UpdateSiteDto, type UpdateUserPropertyDto, type UploadCredentialsResponseDto, type UserControllerCreateUserData, type UserControllerCreateUserError, type UserControllerCreateUserErrors, type UserControllerCreateUserResponse, type UserControllerCreateUserResponses, type UserControllerGetUserData, type UserControllerGetUserError, type UserControllerGetUserErrors, type UserControllerGetUserResponse, type UserControllerGetUserResponses, type UserControllerListUsersData, type UserControllerListUsersError, type UserControllerListUsersErrors, type UserControllerListUsersResponse, type UserControllerListUsersResponses, type UserControllerUpdateUserData, type UserControllerUpdateUserError, type UserControllerUpdateUserErrors, type UserControllerUpdateUserResponse, type UserControllerUpdateUserResponses, type UserPropertiesResource, type UserPropertyControllerDeleteUserPropertyData, type UserPropertyControllerDeleteUserPropertyError, type UserPropertyControllerDeleteUserPropertyErrors, type UserPropertyControllerDeleteUserPropertyResponse, type UserPropertyControllerDeleteUserPropertyResponses, type UserPropertyControllerUpdateUserPropertyData, type UserPropertyControllerUpdateUserPropertyError, type UserPropertyControllerUpdateUserPropertyErrors, type UserPropertyControllerUpdateUserPropertyResponse, type UserPropertyControllerUpdateUserPropertyResponses, type UserPropertyResponseDto, type UserResponseDto, type UsersResource, WakataApiError, WakataAuthError, WakataClient, type WakataClientOptions, WakataConflictError, type WakataErrorEnvelope, WakataNotFoundError, WakataPermissionError, WakataRateLimitError, WakataServerError, WakataValidationError, generateIdempotencyKey, mapApiError };
package/dist/index.js CHANGED
@@ -398,7 +398,7 @@ var siteControllerUpdateSite = (options) => {
398
398
 
399
399
  // src/client.ts
400
400
  var DEFAULT_BASE_URL = "https://api.wakata.ai/api/v1";
401
- var PACKAGE_VERSION = "0.1.0";
401
+ var PACKAGE_VERSION = "0.1.1";
402
402
  function unwrap(result) {
403
403
  if (result.data === void 0) {
404
404
  throw new WakataApiError({
@@ -527,7 +527,7 @@ var WakataClient = class {
527
527
 
528
528
  // src/index.ts
529
529
  var PACKAGE_NAME = "@wakata-dev/api-client";
530
- var PACKAGE_VERSION2 = "0.1.0";
530
+ var PACKAGE_VERSION2 = "0.1.1";
531
531
  var DEFAULT_BASE_URL2 = "https://api.wakata.ai/api/v1";
532
532
 
533
533
  export { DEFAULT_BASE_URL2 as DEFAULT_BASE_URL, PACKAGE_NAME, PACKAGE_VERSION2 as PACKAGE_VERSION, WakataApiError, WakataAuthError, WakataClient, WakataConflictError, WakataNotFoundError, WakataPermissionError, WakataRateLimitError, WakataServerError, WakataValidationError, generateIdempotencyKey, mapApiError };
package/dist/index.js.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","client","PACKAGE_VERSION","DEFAULT_BASE_URL"],"mappings":";;;;;AAgEO,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,IAAA,CAAK,UAAU,IAAA,CAAK,OAAA;AACpB,IAAA,IAAA,CAAK,QAAQ,IAAA,CAAK,KAAA;AAClB,IAAA,IAAA,CAAK,UAAU,IAAA,CAAK,OAAA;AAEpB,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,GAAA,CAAA,MAAA,CAAW,SAAS,CAAA;AAAA,EAClD;AACF;AAMO,IAAM,qBAAA,GAAN,cAAoC,cAAA,CAAe;AAAA,EAAnD,WAAA,GAAA;AAAA,IAAA,KAAA,CAAA,GAAA,SAAA,CAAA;AACL,IAAA,IAAA,CAAyB,IAAA,GAAO,uBAAA;AAAA,EAAA;AAClC;AAGO,IAAM,eAAA,GAAN,cAA8B,cAAA,CAAe;AAAA,EAA7C,WAAA,GAAA;AAAA,IAAA,KAAA,CAAA,GAAA,SAAA,CAAA;AACL,IAAA,IAAA,CAAyB,IAAA,GAAO,iBAAA;AAAA,EAAA;AAClC;AAGO,IAAM,qBAAA,GAAN,cAAoC,cAAA,CAAe;AAAA,EAAnD,WAAA,GAAA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AA,EAAAA,OAAAA,EAAQ,CAAC,CAAA;AAAA,MACrE,GAAA,EAAK,OAAO,IAAA,KACV,MAAA,CAAO,MAAM,6BAAA,CAA8B,EAAE,GAAG,IAAA,EAAM,MAAA,EAAAA,OAAAA,EAAQ,CAAC,CAAA;AAAA,MACjE,MAAA,EAAQ,OAAO,IAAA,KACb,MAAA,CAAO,MAAM,gCAAA,CAAiC,EAAE,GAAG,IAAA,EAAM,MAAA,EAAAA,OAAAA,EAAQ,CAAC,CAAA;AAAA,MACpE,UAAA,EAAY,OAAO,IAAA,KACjB,MAAA;AAAA,QACE,MAAM,oCAAA,CAAqC,EAAE,GAAG,IAAA,EAAM,MAAA,EAAAA,SAAQ;AAAA;AAChE,KACJ;AAEA,IAAA,IAAA,CAAK,cAAA,GAAiB;AAAA,MACpB,MAAA,EAAQ,OAAO,IAAA,KACb,MAAA;AAAA,QACE,MAAM,wCAAA,CAAyC,EAAE,GAAG,IAAA,EAAM,MAAA,EAAAA,SAAQ;AAAA,OACpE;AAAA,MACF,MAAA,EAAQ,OAAO,IAAA,KACb,MAAA;AAAA,QACE,MAAM,wCAAA,CAAyC,EAAE,GAAG,IAAA,EAAM,MAAA,EAAAA,SAAQ;AAAA;AACpE,KACJ;AAAA,EACF;AACF;;;ACxaO,IAAM,YAAA,GAAe;AACrB,IAAMC,gBAAAA,GAAkB;AAGxB,IAAMC,iBAAAA,GAAmB","file":"index.js","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 `apps/api/docs/QUICKSTART.md`):\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 `apps/api/docs/QUICKSTART.md` § 9.\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://lrfq4vihdi.execute-api.ap-southeast-2.amazonaws.com'\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, 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, 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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/public/inspection/list',\n ...options\n });\n};\n\n/**\n * Submit inspection with nested data\n * 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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/asset-class/{id}',\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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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 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} 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.1.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 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 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\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 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}\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.1.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","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,IAAA,CAAK,UAAU,IAAA,CAAK,OAAA;AACpB,IAAA,IAAA,CAAK,QAAQ,IAAA,CAAK,KAAA;AAClB,IAAA,IAAA,CAAK,UAAU,IAAA,CAAK,OAAA;AAEpB,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,GAAA,CAAA,MAAA,CAAW,SAAS,CAAA;AAAA,EAClD;AACF;AAMO,IAAM,qBAAA,GAAN,cAAoC,cAAA,CAAe;AAAA,EAAnD,WAAA,GAAA;AAAA,IAAA,KAAA,CAAA,GAAA,SAAA,CAAA;AACL,IAAA,IAAA,CAAyB,IAAA,GAAO,uBAAA;AAAA,EAAA;AAClC;AAGO,IAAM,eAAA,GAAN,cAA8B,cAAA,CAAe;AAAA,EAA7C,WAAA,GAAA;AAAA,IAAA,KAAA,CAAA,GAAA,SAAA,CAAA;AACL,IAAA,IAAA,CAAyB,IAAA,GAAO,iBAAA;AAAA,EAAA;AAClC;AAGO,IAAM,qBAAA,GAAN,cAAoC,cAAA,CAAe;AAAA,EAAnD,WAAA,GAAA;AAAA,IAAA,KAAA,CAAA,GAAA,SAAA,CAAA;AACL,IAAA,IAAA,CAAyB,IAAA,GAAO,uBAAA;AAAA,EAAA;AAClC;AAGO,IAA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,GAAG,IAAA,EAAM,MAAA,EAAAA,OAAAA,EAAQ,CAAC,CAAA;AAAA,MACjE,MAAA,EAAQ,OAAO,IAAA,KACb,MAAA,CAAO,MAAM,gCAAA,CAAiC,EAAE,GAAG,IAAA,EAAM,MAAA,EAAAA,OAAAA,EAAQ,CAAC,CAAA;AAAA,MACpE,UAAA,EAAY,OAAO,IAAA,KACjB,MAAA;AAAA,QACE,MAAM,oCAAA,CAAqC,EAAE,GAAG,IAAA,EAAM,MAAA,EAAAA,SAAQ;AAAA;AAChE,KACJ;AAEA,IAAA,IAAA,CAAK,cAAA,GAAiB;AAAA,MACpB,MAAA,EAAQ,OAAO,IAAA,KACb,MAAA;AAAA,QACE,MAAM,wCAAA,CAAyC,EAAE,GAAG,IAAA,EAAM,MAAA,EAAAA,SAAQ;AAAA,OACpE;AAAA,MACF,MAAA,EAAQ,OAAO,IAAA,KACb,MAAA;AAAA,QACE,MAAM,wCAAA,CAAyC,EAAE,GAAG,IAAA,EAAM,MAAA,EAAAA,SAAQ;AAAA;AACpE,KACJ;AAAA,EACF;AACF;;;ACxaO,IAAM,YAAA,GAAe;AACrB,IAAMC,gBAAAA,GAAkB;AAGxB,IAAMC,iBAAAA,GAAmB","file":"index.js","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://lrfq4vihdi.execute-api.ap-southeast-2.amazonaws.com'\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, 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, 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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/public/inspection/list',\n ...options\n });\n};\n\n/**\n * Submit inspection with nested data\n * 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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/asset-class/{id}',\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: '/api/v1/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: '/api/v1/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: '/api/v1/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: '/api/v1/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 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} 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.1.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 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 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\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 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}\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.1.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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wakata-dev/api-client",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Official TypeScript SDK for the Wakata Public API",
5
5
  "license": "Apache-2.0",
6
6
  "private": false,