triqai 0.2.8 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -135,10 +135,18 @@ type components = {
135
135
  /** @enum {boolean} */
136
136
  success: true;
137
137
  };
138
+ /**
139
+ * @description Category path from the most specific category up to its top-level category.
140
+ * For example, a parking payment has `primary` Parking, `secondary` Vehicle Services
141
+ * and `tertiary` Transportation.
142
+ */
138
143
  CategoryStructure: {
139
144
  confidence: components["schemas"]["ConfidenceWithReasons"];
145
+ /** @description The most specific category assigned. */
140
146
  primary: components["schemas"]["Category"];
147
+ /** @description Parent of `primary`, or `null` when `primary` is a top-level category. */
141
148
  secondary: components["schemas"]["Category"] | null;
149
+ /** @description Parent of `secondary`, or `null` when the category is fewer than three levels deep. */
142
150
  tertiary: components["schemas"]["Category"] | null;
143
151
  };
144
152
  ClientDisconnectedErrorResponse: {
@@ -176,6 +184,11 @@ type components = {
176
184
  /** @enum {string} */
177
185
  code: "DUPLICATE_REQUEST";
178
186
  details: {
187
+ /**
188
+ * @description Present when the key was already used for a different request (`state=completed`). The stored result is not returned.
189
+ * @enum {string}
190
+ */
191
+ reason?: "payload_mismatch";
179
192
  requestId: string;
180
193
  retryAfterSeconds?: number;
181
194
  /** @enum {string} */
@@ -264,9 +277,18 @@ type components = {
264
277
  /** @enum {boolean} */
265
278
  success: true;
266
279
  };
267
- EntityResult: {
280
+ /** @description An entity linked to the transaction. `type` selects the shape of `data`. */
281
+ EntityResult: components["schemas"]["MerchantEntityResult"] | components["schemas"]["LocationEntityResult"] | components["schemas"]["IntermediaryEntityResult"] | components["schemas"]["PersonEntityResult"];
282
+ EntityResultBase: {
268
283
  confidence: components["schemas"]["ConfidenceWithReasons"];
269
- data: components["schemas"]["MerchantEntityData"] | components["schemas"]["LocationData"] | components["schemas"]["IntermediaryData"] | components["schemas"]["PersonData"];
284
+ /**
285
+ * @description Short AI-written explanation of why this entity was linked to the transaction.
286
+ * Use it for display or debugging only: the wording varies, so don't parse it.
287
+ * Optional and never `null`. It's returned when a stored explanation exists, for
288
+ * example on `GET /v1/transactions`, `GET /v1/transactions/{id}` and enrichment
289
+ * results reused from an earlier request, and omitted otherwise.
290
+ */
291
+ reasoning?: string;
270
292
  role: string;
271
293
  /** @enum {string} */
272
294
  type: "merchant" | "location" | "intermediary" | "person";
@@ -310,6 +332,25 @@ type components = {
310
332
  name: string;
311
333
  website: string | null;
312
334
  };
335
+ IntermediaryEntityData: components["schemas"]["IntermediaryData"] & {
336
+ /**
337
+ * @description Category of a recognized platform, such as a food delivery app. Returned for
338
+ * those platforms on `GET /v1/transactions` and `GET /v1/transactions/{id}`;
339
+ * enrichment responses may omit it. Absent for other intermediaries.
340
+ */
341
+ category?: components["schemas"]["CategoryStructure"];
342
+ };
343
+ IntermediaryEntityResult: components["schemas"]["EntityResultBase"] & {
344
+ data: components["schemas"]["IntermediaryEntityData"];
345
+ /** @enum {string} */
346
+ type: "intermediary";
347
+ } & {
348
+ /**
349
+ * @description discriminator enum property added by openapi-typescript
350
+ * @enum {string}
351
+ */
352
+ type: "intermediary";
353
+ };
313
354
  IntermediaryRecord: components["schemas"]["IntermediaryData"] & {
314
355
  role: string;
315
356
  };
@@ -368,6 +409,17 @@ type components = {
368
409
  /** @description Location-specific website URL. May be absent. */
369
410
  website?: string | null;
370
411
  };
412
+ LocationEntityResult: components["schemas"]["EntityResultBase"] & {
413
+ data: components["schemas"]["LocationData"];
414
+ /** @enum {string} */
415
+ type: "location";
416
+ } & {
417
+ /**
418
+ * @description discriminator enum property added by openapi-typescript
419
+ * @enum {string}
420
+ */
421
+ type: "location";
422
+ };
371
423
  LocationRating: {
372
424
  average: number;
373
425
  count: number;
@@ -411,6 +463,17 @@ type components = {
411
463
  name: string;
412
464
  website: string | null;
413
465
  };
466
+ MerchantEntityResult: components["schemas"]["EntityResultBase"] & {
467
+ data: components["schemas"]["MerchantEntityData"];
468
+ /** @enum {string} */
469
+ type: "merchant";
470
+ } & {
471
+ /**
472
+ * @description discriminator enum property added by openapi-typescript
473
+ * @enum {string}
474
+ */
475
+ type: "merchant";
476
+ };
414
477
  MerchantResponse: {
415
478
  data: {
416
479
  merchant: components["schemas"]["MerchantData"];
@@ -428,6 +491,17 @@ type components = {
428
491
  PersonData: {
429
492
  displayName: string;
430
493
  };
494
+ PersonEntityResult: components["schemas"]["EntityResultBase"] & {
495
+ data: components["schemas"]["PersonData"];
496
+ /** @enum {string} */
497
+ type: "person";
498
+ } & {
499
+ /**
500
+ * @description discriminator enum property added by openapi-typescript
501
+ * @enum {string}
502
+ */
503
+ type: "person";
504
+ };
431
505
  /**
432
506
  * @description Supply known intermediary (payment processor) data.
433
507
  * When `id` is provided, the intermediary is resolved by primary key (returns 422 if not found).
@@ -658,7 +732,12 @@ type components = {
658
732
  "application/json": components["schemas"]["ErrorResponse"];
659
733
  };
660
734
  };
661
- /** @description Rate limit exceeded */
735
+ /**
736
+ * @description Rate limit exceeded. Organization limits send the `X-RateLimit-*` headers.
737
+ * Requests with a missing or malformed API key, and repeated API key lookups from
738
+ * one IP address, have separate limits whose 429s send only `Retry-After`, without
739
+ * any `X-RateLimit-*` header.
740
+ */
662
741
  RateLimited: {
663
742
  headers: {
664
743
  /** @description Seconds until retry is allowed */
@@ -667,13 +746,20 @@ type components = {
667
746
  "X-RateLimit-Concurrency-Limit"?: number;
668
747
  /** @description Remaining concurrent request slots */
669
748
  "X-RateLimit-Concurrency-Remaining"?: number;
670
- /** @description Requests per second (sustained rate) */
749
+ /**
750
+ * @description Limit named by `X-RateLimit-Scope`. For `rps`, the sustained requests per second.
751
+ * For `concurrency`, the maximum concurrent in-flight requests.
752
+ */
671
753
  "X-RateLimit-Limit"?: number;
672
- /** @description Current token-bucket capacity available */
754
+ /**
755
+ * @description Remaining capacity for the limit named by `X-RateLimit-Scope`. For `rps`, the
756
+ * token-bucket requests left (0 when throttled). For `concurrency`, the free
757
+ * concurrent request slots.
758
+ */
673
759
  "X-RateLimit-Remaining"?: number;
674
- /** @description Timestamp when token bucket refills */
760
+ /** @description Time when the limit named by `X-RateLimit-Scope` is expected to admit a new request. */
675
761
  "X-RateLimit-Reset"?: string;
676
- /** @description Active limiting dimension */
762
+ /** @description Limit that rejected the request. */
677
763
  "X-RateLimit-Scope"?: "rps" | "concurrency";
678
764
  [name: string]: unknown;
679
765
  };
@@ -695,7 +781,10 @@ type components = {
695
781
  "application/json": components["schemas"]["ErrorResponse"];
696
782
  };
697
783
  };
698
- /** @description Service temporarily unavailable */
784
+ /**
785
+ * @description Service temporarily unavailable, for example when authentication or the rate-limit
786
+ * and credit check can't complete. Retry after `Retry-After` seconds.
787
+ */
699
788
  ServiceUnavailable: {
700
789
  headers: {
701
790
  /** @description Seconds until retry is allowed */
@@ -729,7 +818,10 @@ type components = {
729
818
  "application/json": components["schemas"]["ErrorResponse"];
730
819
  };
731
820
  };
732
- /** @description Request validation failed */
821
+ /**
822
+ * @description Request validation failed. Every endpoint returns this for a malformed `Idempotency-Key`
823
+ * or `X-Idempotency-Key` header, or when both headers are sent with different values.
824
+ */
733
825
  ValidationError: {
734
826
  headers: {
735
827
  [name: string]: unknown;
@@ -786,6 +878,7 @@ interface operations {
786
878
  "application/json": components["schemas"]["HealthResponse"];
787
879
  };
788
880
  };
881
+ 422: components["responses"]["ValidationError"];
789
882
  };
790
883
  };
791
884
  getHealth: {
@@ -806,6 +899,7 @@ interface operations {
806
899
  "application/json": components["schemas"]["HealthResponse"];
807
900
  };
808
901
  };
902
+ 422: components["responses"]["ValidationError"];
809
903
  };
810
904
  };
811
905
  getApiInfo: {
@@ -828,6 +922,10 @@ interface operations {
828
922
  };
829
923
  401: components["responses"]["Unauthorized"];
830
924
  403: components["responses"]["Forbidden"];
925
+ 422: components["responses"]["ValidationError"];
926
+ 429: components["responses"]["RateLimited"];
927
+ 500: components["responses"]["InternalError"];
928
+ 503: components["responses"]["ServiceUnavailable"];
831
929
  };
832
930
  };
833
931
  searchBanks: {
@@ -866,6 +964,7 @@ interface operations {
866
964
  422: components["responses"]["ValidationError"];
867
965
  429: components["responses"]["RateLimited"];
868
966
  500: components["responses"]["InternalError"];
967
+ 503: components["responses"]["ServiceUnavailable"];
869
968
  };
870
969
  };
871
970
  getBank: {
@@ -894,6 +993,7 @@ interface operations {
894
993
  422: components["responses"]["ValidationError"];
895
994
  429: components["responses"]["RateLimited"];
896
995
  500: components["responses"]["InternalError"];
996
+ 503: components["responses"]["ServiceUnavailable"];
897
997
  };
898
998
  };
899
999
  listCategories: {
@@ -916,8 +1016,10 @@ interface operations {
916
1016
  };
917
1017
  401: components["responses"]["Unauthorized"];
918
1018
  403: components["responses"]["Forbidden"];
1019
+ 422: components["responses"]["ValidationError"];
919
1020
  429: components["responses"]["RateLimited"];
920
1021
  500: components["responses"]["InternalError"];
1022
+ 503: components["responses"]["ServiceUnavailable"];
921
1023
  };
922
1024
  };
923
1025
  getIntermediary: {
@@ -946,6 +1048,7 @@ interface operations {
946
1048
  422: components["responses"]["ValidationError"];
947
1049
  429: components["responses"]["RateLimited"];
948
1050
  500: components["responses"]["InternalError"];
1051
+ 503: components["responses"]["ServiceUnavailable"];
949
1052
  };
950
1053
  };
951
1054
  getLocation: {
@@ -974,6 +1077,7 @@ interface operations {
974
1077
  422: components["responses"]["ValidationError"];
975
1078
  429: components["responses"]["RateLimited"];
976
1079
  500: components["responses"]["InternalError"];
1080
+ 503: components["responses"]["ServiceUnavailable"];
977
1081
  };
978
1082
  };
979
1083
  getMerchant: {
@@ -1002,12 +1106,15 @@ interface operations {
1002
1106
  422: components["responses"]["ValidationError"];
1003
1107
  429: components["responses"]["RateLimited"];
1004
1108
  500: components["responses"]["InternalError"];
1109
+ 503: components["responses"]["ServiceUnavailable"];
1005
1110
  };
1006
1111
  };
1007
1112
  listIssueReports: {
1008
1113
  parameters: {
1009
1114
  query?: {
1115
+ /** @description Page number, at most 10000. Values below 1 are treated as 1. */
1010
1116
  page?: number;
1117
+ /** @description Page size, at most 100. Larger values are capped at 100 instead of being rejected, and values below 1 are treated as 1. */
1011
1118
  size?: number;
1012
1119
  status?: components["schemas"]["IssueReportStatus"];
1013
1120
  transaction_id?: string;
@@ -1032,6 +1139,7 @@ interface operations {
1032
1139
  422: components["responses"]["ValidationError"];
1033
1140
  429: components["responses"]["RateLimited"];
1034
1141
  500: components["responses"]["InternalError"];
1142
+ 503: components["responses"]["ServiceUnavailable"];
1035
1143
  };
1036
1144
  };
1037
1145
  createIssueReport: {
@@ -1041,6 +1149,7 @@ interface operations {
1041
1149
  path?: never;
1042
1150
  cookie?: never;
1043
1151
  };
1152
+ /** @description The request body must not exceed 32,768 bytes. */
1044
1153
  requestBody: {
1045
1154
  content: {
1046
1155
  "application/json": components["schemas"]["ReportIssueRequest"];
@@ -1062,6 +1171,7 @@ interface operations {
1062
1171
  422: components["responses"]["ValidationError"];
1063
1172
  429: components["responses"]["RateLimited"];
1064
1173
  500: components["responses"]["InternalError"];
1174
+ 503: components["responses"]["ServiceUnavailable"];
1065
1175
  };
1066
1176
  };
1067
1177
  getIssueReport: {
@@ -1090,16 +1200,18 @@ interface operations {
1090
1200
  422: components["responses"]["ValidationError"];
1091
1201
  429: components["responses"]["RateLimited"];
1092
1202
  500: components["responses"]["InternalError"];
1203
+ 503: components["responses"]["ServiceUnavailable"];
1093
1204
  };
1094
1205
  };
1095
1206
  listTransactions: {
1096
1207
  parameters: {
1097
1208
  query?: {
1098
- /** @description Inclusive upper bound (ISO 8601 timestamp) */
1209
+ /** @description Inclusive upper bound (ISO 8601 date or timestamp between 0001-01-01 and 9999-12-31 UTC). */
1099
1210
  endDate?: string;
1211
+ /** @description Page number, at most 10000. */
1100
1212
  page?: number;
1101
1213
  size?: number;
1102
- /** @description Inclusive lower bound (ISO 8601 timestamp) */
1214
+ /** @description Inclusive lower bound (ISO 8601 date or timestamp between 0001-01-01 and 9999-12-31 UTC). */
1103
1215
  startDate?: string;
1104
1216
  };
1105
1217
  header?: never;
@@ -1122,6 +1234,7 @@ interface operations {
1122
1234
  422: components["responses"]["ValidationError"];
1123
1235
  429: components["responses"]["RateLimited"];
1124
1236
  500: components["responses"]["InternalError"];
1237
+ 503: components["responses"]["ServiceUnavailable"];
1125
1238
  };
1126
1239
  };
1127
1240
  getTransaction: {
@@ -1150,6 +1263,7 @@ interface operations {
1150
1263
  422: components["responses"]["ValidationError"];
1151
1264
  429: components["responses"]["RateLimited"];
1152
1265
  500: components["responses"]["InternalError"];
1266
+ 503: components["responses"]["ServiceUnavailable"];
1153
1267
  };
1154
1268
  };
1155
1269
  deleteTransaction: {
@@ -1214,7 +1328,7 @@ interface operations {
1214
1328
  countTransactions: {
1215
1329
  parameters: {
1216
1330
  query?: {
1217
- /** @description Only count transactions created on or after this ISO 8601 timestamp. */
1331
+ /** @description Only count transactions created on or after this ISO 8601 date or timestamp (between 0001-01-01 and 9999-12-31 UTC). */
1218
1332
  afterDate?: string;
1219
1333
  };
1220
1334
  header?: never;
@@ -1237,14 +1351,15 @@ interface operations {
1237
1351
  422: components["responses"]["ValidationError"];
1238
1352
  429: components["responses"]["RateLimited"];
1239
1353
  500: components["responses"]["InternalError"];
1354
+ 503: components["responses"]["ServiceUnavailable"];
1240
1355
  };
1241
1356
  };
1242
1357
  enrichTransaction: {
1243
1358
  parameters: {
1244
1359
  query?: never;
1245
- header: {
1246
- /** @description Required retry identity. `X-Idempotency-Key` is also accepted and must match when both are sent. */
1247
- "Idempotency-Key": string;
1360
+ header?: {
1361
+ /** @description Optional. One key per bank transaction, used only for that request. A retry of the same request with this key returns the stored result without a charge; a different request with it returns `409` with `details.reason=payload_mismatch`. Without a key, every request is a new, charged enrichment. `X-Idempotency-Key` is also accepted and must match when both are sent. */
1362
+ "Idempotency-Key"?: string;
1248
1363
  };
1249
1364
  path?: never;
1250
1365
  cookie?: never;
@@ -1319,6 +1434,9 @@ type TransactionPagination = components["schemas"]["TransactionPagination"];
1319
1434
  type TransactionListResponse = components["schemas"]["TransactionListResponse"];
1320
1435
  type TransactionDetailResponse = components["schemas"]["TransactionDetailResponse"];
1321
1436
  type DeleteTransactionResponse = components["schemas"]["DeleteTransactionResponse"];
1437
+ type TransactionCountResponse = components["schemas"]["TransactionCountResponse"];
1438
+ type BatchDeleteRequest = components["schemas"]["BatchDeleteRequest"];
1439
+ type BatchDeleteResponse = components["schemas"]["BatchDeleteResponse"];
1322
1440
  type CategoryStructure = components["schemas"]["CategoryStructure"];
1323
1441
  type Category = components["schemas"]["Category"];
1324
1442
  type CategoryCode = components["schemas"]["CategoryCode"];
@@ -1375,6 +1493,41 @@ interface TriqaiConfig {
1375
1493
  onRequest?: (request: RequestInfo) => void;
1376
1494
  /** Called after every HTTP response. Useful for logging/debugging. */
1377
1495
  onResponse?: (response: ResponseInfo) => void;
1496
+ /**
1497
+ * Client-side pacing: calls on this client wait their turn within the API's
1498
+ * rate and concurrency limits instead of being refused with 429. On by
1499
+ * default in Node.js and Bun; off by default elsewhere, such as Cloudflare
1500
+ * Workers, Deno and browsers. Pass `true` or an object to turn it on, or
1501
+ * `false` to send every request immediately.
1502
+ */
1503
+ pacing?: boolean | PacingOptions;
1504
+ }
1505
+ /** Options accepted by every request method. */
1506
+ interface RequestOptions {
1507
+ /**
1508
+ * Cancels the call, including while it waits its turn or between retries.
1509
+ * The call then rejects with the signal's reason, as `fetch` does.
1510
+ */
1511
+ signal?: AbortSignal;
1512
+ }
1513
+ interface PacingOptions {
1514
+ /**
1515
+ * Most enrichment requests this client keeps in flight. The API's
1516
+ * concurrency limit applies when it is lower. Until the API has reported
1517
+ * its limit, at most 5 are in flight unless you set this.
1518
+ */
1519
+ maxConcurrency?: number;
1520
+ /**
1521
+ * Most requests per second this client sends, retries included. The API's
1522
+ * rate limit applies when it is lower.
1523
+ */
1524
+ requestsPerSecond?: number;
1525
+ /**
1526
+ * Longest time in milliseconds a call waits for its turn before its first
1527
+ * attempt. It then rejects with `PacingTimeoutError` without being sent.
1528
+ * Defaults to `maxRetryTime`.
1529
+ */
1530
+ maxWait?: number;
1378
1531
  }
1379
1532
  interface RequestInfo {
1380
1533
  method: string;
@@ -1398,8 +1551,13 @@ interface RateLimitInfo {
1398
1551
  concurrencyRemaining?: number;
1399
1552
  retryAfter?: number;
1400
1553
  }
1401
- interface EnrichOptions {
1402
- /** Bypass cached result. */
1554
+ interface EnrichOptions extends RequestOptions {
1555
+ /**
1556
+ * @deprecated Has no effect. The API never supported a cache bypass: the
1557
+ * public contract defines no `force` parameter and no endpoint reads one.
1558
+ * The SDK no longer sends it. The option remains only so existing code
1559
+ * still compiles, and may be removed in a future major version.
1560
+ */
1403
1561
  force?: boolean;
1404
1562
  /** Defaults to a UUID per enrich call, reused across automatic retries. Supply a stable key to retry across calls. Must match ^[a-zA-Z0-9_-]{1,64}$. */
1405
1563
  idempotencyKey?: string;
@@ -1412,6 +1570,17 @@ interface ListTransactionsParams {
1412
1570
  /** Inclusive upper bound (ISO 8601 timestamp or Date). */
1413
1571
  endDate?: string | Date;
1414
1572
  }
1573
+ interface CountTransactionsParams {
1574
+ /** Count only transactions created on or after this ISO 8601 timestamp or Date. */
1575
+ afterDate?: string | Date;
1576
+ }
1577
+ /**
1578
+ * Exactly one of `{ all: true }`, `{ afterDate }`, or `{ ids }` (at most 1000 UUIDs).
1579
+ * `afterDate` also accepts a Date.
1580
+ */
1581
+ type BatchDeleteTransactionsParams = BatchDeleteRequest | {
1582
+ afterDate: Date;
1583
+ };
1415
1584
  interface ListIssueReportsParams {
1416
1585
  page?: number;
1417
1586
  size?: number;
@@ -1436,17 +1605,24 @@ declare class HttpClient {
1436
1605
  private readonly defaultHeaders;
1437
1606
  private readonly onRequest?;
1438
1607
  private readonly onResponse?;
1608
+ private readonly pacer?;
1439
1609
  constructor(apiKey: string, config?: TriqaiConfig);
1440
- get<T>(path: string, query?: Record<string, unknown>): Promise<HttpResponse<T>>;
1441
- post<T>(path: string, body?: unknown): Promise<HttpResponse<T>>;
1442
- delete<T>(path: string): Promise<HttpResponse<T>>;
1610
+ get<T>(path: string, query?: Record<string, unknown>, options?: RequestOptions): Promise<HttpResponse<T>>;
1611
+ post<T>(path: string, body?: unknown, options?: RequestOptions): Promise<HttpResponse<T>>;
1612
+ delete<T>(path: string, body?: unknown, options?: RequestOptions): Promise<HttpResponse<T>>;
1443
1613
  private request;
1444
1614
  /**
1445
1615
  * Variant that injects custom headers (used by resources for Idempotency-Key etc.).
1446
1616
  */
1447
- postWithHeaders<T>(path: string, body: unknown, headers: Record<string, string>, query?: Record<string, unknown>): Promise<HttpResponse<T>>;
1617
+ postWithHeaders<T>(path: string, body: unknown, headers: Record<string, string>, query?: Record<string, unknown>, options?: RequestOptions): Promise<HttpResponse<T>>;
1448
1618
  private buildUrl;
1449
1619
  private calculateDelay;
1620
+ /**
1621
+ * The wait after a 429. Without Retry-After, the limit's reset time is used
1622
+ * when it is near, measured against the response's Date header so the
1623
+ * client's clock does not matter; otherwise the normal backoff.
1624
+ */
1625
+ private rateLimitDelay;
1450
1626
  private canRetry;
1451
1627
  private mapError;
1452
1628
  }
@@ -1455,9 +1631,9 @@ declare class Banks {
1455
1631
  private readonly http;
1456
1632
  constructor(http: HttpClient);
1457
1633
  /** Exact, case-insensitive name lookup with an optional country of origin. Costs zero credits. */
1458
- search(params: BankSearchParams): Promise<BankSearchResponse["data"]>;
1634
+ search(params: BankSearchParams, options?: RequestOptions): Promise<BankSearchResponse["data"]>;
1459
1635
  /** Retrieve stored bank details by UUID. */
1460
- get(id: string): Promise<BankData>;
1636
+ get(id: string, options?: RequestOptions): Promise<BankData>;
1461
1637
  }
1462
1638
 
1463
1639
  declare class Categories {
@@ -1469,6 +1645,7 @@ declare class Categories {
1469
1645
  * Returns the full category tree used for transaction classification,
1470
1646
  * including MCC, SIC, and NAICS codes.
1471
1647
  *
1648
+ * @param options - Optional `signal` to cancel the call.
1472
1649
  * @returns Array of category info objects and the total count.
1473
1650
  *
1474
1651
  * @example
@@ -1477,7 +1654,7 @@ declare class Categories {
1477
1654
  * console.log(`${total} categories available`);
1478
1655
  * ```
1479
1656
  */
1480
- list(): Promise<{
1657
+ list(options?: RequestOptions): Promise<{
1481
1658
  categories: CategoryInfo[];
1482
1659
  total: number;
1483
1660
  categoryVersion: string;
@@ -1491,6 +1668,7 @@ declare class Intermediaries {
1491
1668
  * Get an intermediary (payment processor / platform) by ID.
1492
1669
  *
1493
1670
  * @param id - Intermediary UUID.
1671
+ * @param options - Optional `signal` to cancel the call.
1494
1672
  * @returns The intermediary data (name, icon, description, website, domain, etc.).
1495
1673
  *
1496
1674
  * @example
@@ -1499,7 +1677,7 @@ declare class Intermediaries {
1499
1677
  * console.log(intermediary.name); // "PayPal", "Square", etc.
1500
1678
  * ```
1501
1679
  */
1502
- get(id: string): Promise<IntermediaryData>;
1680
+ get(id: string, options?: RequestOptions): Promise<IntermediaryData>;
1503
1681
  }
1504
1682
 
1505
1683
  /**
@@ -1567,7 +1745,7 @@ declare class IssueReports {
1567
1745
  * console.log(report.id, report.status);
1568
1746
  * ```
1569
1747
  */
1570
- create(params: CreateIssueReportParams): Promise<IssueReport>;
1748
+ create(params: CreateIssueReportParams, options?: RequestOptions): Promise<IssueReport>;
1571
1749
  /**
1572
1750
  * List issue reports with pagination.
1573
1751
  *
@@ -1582,14 +1760,15 @@ declare class IssueReports {
1582
1760
  * }
1583
1761
  * ```
1584
1762
  */
1585
- list(params?: ListIssueReportsParams): Promise<Page<IssueReport>>;
1763
+ list(params?: ListIssueReportsParams, options?: RequestOptions): Promise<Page<IssueReport>>;
1586
1764
  /**
1587
1765
  * Get a single issue report by ID.
1588
1766
  *
1589
1767
  * @param id - Issue report UUID.
1768
+ * @param options - Optional `signal` to cancel the call.
1590
1769
  * @returns The issue report details.
1591
1770
  */
1592
- get(id: string): Promise<IssueReport>;
1771
+ get(id: string, options?: RequestOptions): Promise<IssueReport>;
1593
1772
  }
1594
1773
 
1595
1774
  declare class Locations {
@@ -1599,6 +1778,7 @@ declare class Locations {
1599
1778
  * Get a location by ID.
1600
1779
  *
1601
1780
  * @param id - Location UUID.
1781
+ * @param options - Optional `signal` to cancel the call.
1602
1782
  * @returns The location data (name, formatted address, coordinates, phone, rating, etc.).
1603
1783
  *
1604
1784
  * @example
@@ -1607,7 +1787,7 @@ declare class Locations {
1607
1787
  * console.log(location.formatted, location.structured.city);
1608
1788
  * ```
1609
1789
  */
1610
- get(id: string): Promise<LocationData>;
1790
+ get(id: string, options?: RequestOptions): Promise<LocationData>;
1611
1791
  }
1612
1792
 
1613
1793
  declare class Merchants {
@@ -1617,6 +1797,7 @@ declare class Merchants {
1617
1797
  * Get a merchant by ID.
1618
1798
  *
1619
1799
  * @param id - Merchant UUID.
1800
+ * @param options - Optional `signal` to cancel the call.
1620
1801
  * @returns The merchant data (name, icon, website, domain, aliases, etc.).
1621
1802
  *
1622
1803
  * @example
@@ -1625,7 +1806,7 @@ declare class Merchants {
1625
1806
  * console.log(merchant.name, merchant.website);
1626
1807
  * ```
1627
1808
  */
1628
- get(id: string): Promise<MerchantData>;
1809
+ get(id: string, options?: RequestOptions): Promise<MerchantData>;
1629
1810
  }
1630
1811
 
1631
1812
  declare class Transactions {
@@ -1635,7 +1816,7 @@ declare class Transactions {
1635
1816
  * Enrich a transaction with merchant, category, location, and entity data.
1636
1817
  *
1637
1818
  * @param request - The transaction to enrich (title, country, type, and optional options).
1638
- * @param options - Optional enrichment controls (force bypass cache, idempotency key).
1819
+ * @param options - Optional idempotency key and `signal` to cancel the call.
1639
1820
  * @returns The enriched transaction data.
1640
1821
  *
1641
1822
  * @example
@@ -1666,24 +1847,58 @@ declare class Transactions {
1666
1847
  * }
1667
1848
  * ```
1668
1849
  */
1669
- list(params?: ListTransactionsParams): Promise<Page<EnrichedTransaction>>;
1850
+ list(params?: ListTransactionsParams, options?: RequestOptions): Promise<Page<EnrichedTransaction>>;
1851
+ /**
1852
+ * Count your organization's transactions.
1853
+ *
1854
+ * @param params - Optional `afterDate` to count only transactions created on or after it.
1855
+ * @returns The number of matching transactions.
1856
+ *
1857
+ * @example
1858
+ * ```ts
1859
+ * const { count } = await triqai.transactions.count({ afterDate: "2026-01-01T00:00:00Z" });
1860
+ * ```
1861
+ */
1862
+ count(params?: CountTransactionsParams, options?: RequestOptions): Promise<TransactionCountResponse["data"]>;
1670
1863
  /**
1671
1864
  * Get a single transaction by ID.
1672
1865
  *
1673
1866
  * @param id - Transaction UUID.
1867
+ * @param options - Optional `signal` to cancel the call.
1674
1868
  * @returns The enriched transaction record.
1675
1869
  */
1676
- get(id: string): Promise<EnrichedTransaction>;
1870
+ get(id: string, options?: RequestOptions): Promise<EnrichedTransaction>;
1677
1871
  /**
1678
1872
  * Delete a transaction by ID.
1679
1873
  *
1680
1874
  * @param id - Transaction UUID.
1875
+ * @param options - Optional `signal` to cancel the call.
1681
1876
  * @returns Confirmation with the deleted transaction ID.
1682
1877
  */
1683
- delete(id: string): Promise<{
1878
+ delete(id: string, options?: RequestOptions): Promise<{
1684
1879
  deleted: true;
1685
1880
  transactionId: string;
1686
1881
  }>;
1882
+ /**
1883
+ * Delete many transactions in one request.
1884
+ *
1885
+ * Pass exactly one of `all: true` (every transaction in your organization),
1886
+ * `afterDate` (transactions created on or after it), or `ids` (at most 1000
1887
+ * UUIDs). The API rejects any other combination with a 422 `ValidationError`.
1888
+ * A 503 means cleanup is incomplete; like other DELETE requests, it is retried
1889
+ * automatically, and `count` then covers only the final attempt.
1890
+ *
1891
+ * @param request - The single selection mode.
1892
+ * @returns Confirmation with the number of transactions deleted.
1893
+ *
1894
+ * @example
1895
+ * ```ts
1896
+ * const { count } = await triqai.transactions.batchDelete({
1897
+ * ids: ["550e8400-e29b-41d4-a716-446655440000"],
1898
+ * });
1899
+ * ```
1900
+ */
1901
+ batchDelete(request: BatchDeleteTransactionsParams, options?: RequestOptions): Promise<BatchDeleteResponse["data"]>;
1687
1902
  }
1688
1903
 
1689
1904
  /**
@@ -1703,7 +1918,7 @@ declare class Transactions {
1703
1918
  * ```
1704
1919
  */
1705
1920
  declare class Triqai {
1706
- /** Enrich, list, get, and delete transactions. */
1921
+ /** Enrich, list, count, get, and delete transactions. */
1707
1922
  readonly transactions: Transactions;
1708
1923
  /** List the full category taxonomy. */
1709
1924
  readonly categories: Categories;
@@ -1737,7 +1952,7 @@ declare class Triqai {
1737
1952
  * console.log(health.data.version); // "1.1.9"
1738
1953
  * ```
1739
1954
  */
1740
- health(): Promise<HealthResponse>;
1955
+ health(options?: RequestOptions): Promise<HealthResponse>;
1741
1956
  /**
1742
1957
  * Get API version and endpoint directory.
1743
1958
  *
@@ -1750,33 +1965,36 @@ declare class Triqai {
1750
1965
  * console.log(info.data.endpoints);
1751
1966
  * ```
1752
1967
  */
1753
- apiInfo(): Promise<ApiInfoResponse>;
1968
+ apiInfo(options?: RequestOptions): Promise<ApiInfoResponse>;
1754
1969
  /**
1755
1970
  * Make a raw GET request to any API path.
1756
1971
  * Useful for accessing endpoints not yet covered by a resource class.
1757
1972
  *
1758
1973
  * @param path - API path (e.g. "/v1/some-endpoint").
1759
1974
  * @param query - Optional query parameters.
1975
+ * @param options - Optional `signal` to cancel the call.
1760
1976
  * @returns The full HTTP response including headers and rate limit info.
1761
1977
  */
1762
- rawGet<T = unknown>(path: string, query?: Record<string, unknown>): Promise<HttpResponse<T>>;
1978
+ rawGet<T = unknown>(path: string, query?: Record<string, unknown>, options?: RequestOptions): Promise<HttpResponse<T>>;
1763
1979
  /**
1764
1980
  * Make a raw POST request to any API path.
1765
1981
  * Useful for accessing endpoints not yet covered by a resource class.
1766
1982
  *
1767
1983
  * @param path - API path (e.g. "/v1/some-endpoint").
1768
1984
  * @param body - Request body.
1985
+ * @param options - Optional `signal` to cancel the call.
1769
1986
  * @returns The full HTTP response including headers and rate limit info.
1770
1987
  */
1771
- rawPost<T = unknown>(path: string, body?: unknown): Promise<HttpResponse<T>>;
1988
+ rawPost<T = unknown>(path: string, body?: unknown, options?: RequestOptions): Promise<HttpResponse<T>>;
1772
1989
  /**
1773
1990
  * Make a raw DELETE request to any API path.
1774
1991
  * Useful for accessing endpoints not yet covered by a resource class.
1775
1992
  *
1776
1993
  * @param path - API path (e.g. "/v1/some-resource/uuid").
1994
+ * @param options - Optional `signal` to cancel the call.
1777
1995
  * @returns The full HTTP response including headers and rate limit info.
1778
1996
  */
1779
- rawDelete<T = unknown>(path: string): Promise<HttpResponse<T>>;
1997
+ rawDelete<T = unknown>(path: string, options?: RequestOptions): Promise<HttpResponse<T>>;
1780
1998
  }
1781
1999
 
1782
2000
  interface RawErrorObject {
@@ -1829,14 +2047,25 @@ declare class ClientDisconnectedError extends TriqaiError {
1829
2047
  }
1830
2048
  declare class DuplicateRequestError extends TriqaiError {
1831
2049
  readonly state: "in_progress" | "completed" | undefined;
2050
+ /** `payload_mismatch` when the key was already used for a different request. */
2051
+ readonly reason: string | undefined;
1832
2052
  readonly duplicateRequestId: string | undefined;
1833
2053
  readonly retryAfter: number | undefined;
1834
2054
  constructor(message: string, opts?: ConstructorParameters<typeof TriqaiError>[2] & {
1835
2055
  state?: "in_progress" | "completed";
2056
+ reason?: string;
1836
2057
  duplicateRequestId?: string;
1837
2058
  retryAfter?: number;
1838
2059
  });
1839
2060
  }
2061
+ /**
2062
+ * The enrichment cannot be stored because the transaction's data was erased
2063
+ * or the organization is inactive. Terminal: the SDK never retries it, and
2064
+ * callers should not either.
2065
+ */
2066
+ declare class GoneError extends TriqaiError {
2067
+ constructor(message: string, opts?: ConstructorParameters<typeof TriqaiError>[2]);
2068
+ }
1840
2069
  declare class RateLimitError extends TriqaiError {
1841
2070
  readonly rateLimitInfo: RateLimitInfo;
1842
2071
  constructor(message: string, rateLimitInfo: RateLimitInfo, opts?: ConstructorParameters<typeof TriqaiError>[2]);
@@ -1855,7 +2084,16 @@ declare class ConnectionError extends TriqaiError {
1855
2084
  constructor(message: string);
1856
2085
  }
1857
2086
  declare class TimeoutError extends TriqaiError {
2087
+ constructor(message: string, opts?: {
2088
+ code?: string;
2089
+ });
2090
+ }
2091
+ /**
2092
+ * The call waited longer than `pacing.maxWait` for its turn and was never
2093
+ * sent, so nothing was charged. Safe to call again.
2094
+ */
2095
+ declare class PacingTimeoutError extends TimeoutError {
1858
2096
  constructor(message: string);
1859
2097
  }
1860
2098
 
1861
- export { type ApiInfoResponse, AuthenticationError, AuthorizationError, type BankData, type BankResponse, type BankSearchParams, type BankSearchResponse, type Category, type CategoryCode, type CategoryInfo, type CategoryListResponse, type CategoryStructure, ClientDisconnectedError, type ClientDisconnectedErrorResponse, type ConfidenceWithReasons, ConnectionError, type Coordinates, type CreateIssueReportParams, type DeleteTransactionResponse, DuplicateRequestError, type DuplicateRequestErrorResponse, type EnrichMeta, type EnrichOptions, type EnrichRequest, type EnrichRequestOptions, type EnrichSuccessResponse, type EnrichedTransaction, type EnrichmentData, type EnrichmentErrorCode, type EnrichmentFieldPath, type EnrichmentFilterOptions, type EntityResult, type ErrorObject, type ErrorResponse, GatewayTimeoutError, type HealthResponse, type HttpResponse, InsufficientCreditsError, type IntermediaryData, type IntermediaryRecord, type IntermediaryResponse, InternalServerError, type IssueReport, type IssueReportListResponse, type IssueReportResponse, type IssueReportStatus, type ListIssueReportsParams, type ListTransactionsParams, type LocationData, type LocationRating, type LocationResponse, type MerchantData, type MerchantResponse, NotFoundError, Page, type PageInfo, type PaginationMeta, type PersonData, type PrefilledIntermediary, type PrefilledLocation, type PrefilledMerchant, RateLimitError, type RateLimitInfo, type RawErrorObject, type RawResponseMeta, type ReportIssueRequest, type RequestInfo, type ResponseInfo, type ResponseMeta, ServiceUnavailableError, type StructuredAddress, TimeoutError, type TransactionData, type TransactionDetailResponse, type TransactionListResponse, type TransactionPagination, type TransactionRecord, type TransactionType, Triqai, type TriqaiConfig, TriqaiError, ValidationError, Triqai as default };
2099
+ export { type ApiInfoResponse, AuthenticationError, AuthorizationError, type BankData, type BankResponse, type BankSearchParams, type BankSearchResponse, type BatchDeleteRequest, type BatchDeleteResponse, type BatchDeleteTransactionsParams, type Category, type CategoryCode, type CategoryInfo, type CategoryListResponse, type CategoryStructure, ClientDisconnectedError, type ClientDisconnectedErrorResponse, type ConfidenceWithReasons, ConnectionError, type Coordinates, type CountTransactionsParams, type CreateIssueReportParams, type DeleteTransactionResponse, DuplicateRequestError, type DuplicateRequestErrorResponse, type EnrichMeta, type EnrichOptions, type EnrichRequest, type EnrichRequestOptions, type EnrichSuccessResponse, type EnrichedTransaction, type EnrichmentData, type EnrichmentErrorCode, type EnrichmentFieldPath, type EnrichmentFilterOptions, type EntityResult, type ErrorObject, type ErrorResponse, GatewayTimeoutError, GoneError, type HealthResponse, type HttpResponse, InsufficientCreditsError, type IntermediaryData, type IntermediaryRecord, type IntermediaryResponse, InternalServerError, type IssueReport, type IssueReportListResponse, type IssueReportResponse, type IssueReportStatus, type ListIssueReportsParams, type ListTransactionsParams, type LocationData, type LocationRating, type LocationResponse, type MerchantData, type MerchantResponse, NotFoundError, type PacingOptions, PacingTimeoutError, Page, type PageInfo, type PaginationMeta, type PersonData, type PrefilledIntermediary, type PrefilledLocation, type PrefilledMerchant, RateLimitError, type RateLimitInfo, type RawErrorObject, type RawResponseMeta, type ReportIssueRequest, type RequestInfo, type RequestOptions, type ResponseInfo, type ResponseMeta, ServiceUnavailableError, type StructuredAddress, TimeoutError, type TransactionCountResponse, type TransactionData, type TransactionDetailResponse, type TransactionListResponse, type TransactionPagination, type TransactionRecord, type TransactionType, Triqai, type TriqaiConfig, TriqaiError, ValidationError, Triqai as default };