@lukadriel/wave-sdk 0.0.0-stage → 0.1.2

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.
Files changed (185) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +2 -0
  4. package/README.md +523 -2
  5. package/dist/client/wave-client-options.d.ts +29 -0
  6. package/dist/client/wave-client-options.d.ts.map +1 -0
  7. package/dist/client/wave-client-options.js +58 -0
  8. package/dist/client/wave-client-options.js.map +1 -0
  9. package/dist/client/wave-client.d.ts +47 -0
  10. package/dist/client/wave-client.d.ts.map +1 -0
  11. package/dist/client/wave-client.js +66 -0
  12. package/dist/client/wave-client.js.map +1 -0
  13. package/dist/core/auth/authentication.d.ts +8 -0
  14. package/dist/core/auth/authentication.d.ts.map +1 -0
  15. package/dist/core/auth/authentication.js +10 -0
  16. package/dist/core/auth/authentication.js.map +1 -0
  17. package/dist/core/auth/request-signer.d.ts +26 -0
  18. package/dist/core/auth/request-signer.d.ts.map +1 -0
  19. package/dist/core/auth/request-signer.js +39 -0
  20. package/dist/core/auth/request-signer.js.map +1 -0
  21. package/dist/core/errors/error-parser.d.ts +25 -0
  22. package/dist/core/errors/error-parser.d.ts.map +1 -0
  23. package/dist/core/errors/error-parser.js +198 -0
  24. package/dist/core/errors/error-parser.js.map +1 -0
  25. package/dist/core/errors/redact.d.ts +11 -0
  26. package/dist/core/errors/redact.d.ts.map +1 -0
  27. package/dist/core/errors/redact.js +20 -0
  28. package/dist/core/errors/redact.js.map +1 -0
  29. package/dist/core/errors/wave-api-error.d.ts +116 -0
  30. package/dist/core/errors/wave-api-error.d.ts.map +1 -0
  31. package/dist/core/errors/wave-api-error.js +114 -0
  32. package/dist/core/errors/wave-api-error.js.map +1 -0
  33. package/dist/core/errors/wave-error.d.ts +27 -0
  34. package/dist/core/errors/wave-error.d.ts.map +1 -0
  35. package/dist/core/errors/wave-error.js +22 -0
  36. package/dist/core/errors/wave-error.js.map +1 -0
  37. package/dist/core/errors/wave-network-error.d.ts +24 -0
  38. package/dist/core/errors/wave-network-error.d.ts.map +1 -0
  39. package/dist/core/errors/wave-network-error.js +24 -0
  40. package/dist/core/errors/wave-network-error.js.map +1 -0
  41. package/dist/core/errors/wave-webhook-verification-error.d.ts +18 -0
  42. package/dist/core/errors/wave-webhook-verification-error.d.ts.map +1 -0
  43. package/dist/core/errors/wave-webhook-verification-error.js +17 -0
  44. package/dist/core/errors/wave-webhook-verification-error.js.map +1 -0
  45. package/dist/core/http/fetch-transport.d.ts +23 -0
  46. package/dist/core/http/fetch-transport.d.ts.map +1 -0
  47. package/dist/core/http/fetch-transport.js +34 -0
  48. package/dist/core/http/fetch-transport.js.map +1 -0
  49. package/dist/core/http/http-client.d.ts +57 -0
  50. package/dist/core/http/http-client.d.ts.map +1 -0
  51. package/dist/core/http/http-client.js +254 -0
  52. package/dist/core/http/http-client.js.map +1 -0
  53. package/dist/core/http/http-request.d.ts +35 -0
  54. package/dist/core/http/http-request.d.ts.map +1 -0
  55. package/dist/core/http/http-request.js +2 -0
  56. package/dist/core/http/http-request.js.map +1 -0
  57. package/dist/core/http/http-response.d.ts +26 -0
  58. package/dist/core/http/http-response.d.ts.map +1 -0
  59. package/dist/core/http/http-response.js +23 -0
  60. package/dist/core/http/http-response.js.map +1 -0
  61. package/dist/core/http/query.d.ts +14 -0
  62. package/dist/core/http/query.d.ts.map +1 -0
  63. package/dist/core/http/query.js +23 -0
  64. package/dist/core/http/query.js.map +1 -0
  65. package/dist/core/http/transport.d.ts +44 -0
  66. package/dist/core/http/transport.d.ts.map +1 -0
  67. package/dist/core/http/transport.js +2 -0
  68. package/dist/core/http/transport.js.map +1 -0
  69. package/dist/core/idempotency/idempotency.d.ts +16 -0
  70. package/dist/core/idempotency/idempotency.d.ts.map +1 -0
  71. package/dist/core/idempotency/idempotency.js +27 -0
  72. package/dist/core/idempotency/idempotency.js.map +1 -0
  73. package/dist/core/retry/backoff.d.ts +18 -0
  74. package/dist/core/retry/backoff.d.ts.map +1 -0
  75. package/dist/core/retry/backoff.js +46 -0
  76. package/dist/core/retry/backoff.js.map +1 -0
  77. package/dist/core/retry/retry-policy.d.ts +43 -0
  78. package/dist/core/retry/retry-policy.d.ts.map +1 -0
  79. package/dist/core/retry/retry-policy.js +90 -0
  80. package/dist/core/retry/retry-policy.js.map +1 -0
  81. package/dist/core/types/common.d.ts +59 -0
  82. package/dist/core/types/common.d.ts.map +1 -0
  83. package/dist/core/types/common.js +2 -0
  84. package/dist/core/types/common.js.map +1 -0
  85. package/dist/core/types/configuration.d.ts +82 -0
  86. package/dist/core/types/configuration.d.ts.map +1 -0
  87. package/dist/core/types/configuration.js +2 -0
  88. package/dist/core/types/configuration.js.map +1 -0
  89. package/dist/core/types/json.d.ts +15 -0
  90. package/dist/core/types/json.d.ts.map +1 -0
  91. package/dist/core/types/json.js +2 -0
  92. package/dist/core/types/json.js.map +1 -0
  93. package/dist/index.d.ts +39 -0
  94. package/dist/index.d.ts.map +1 -0
  95. package/dist/index.js +24 -0
  96. package/dist/index.js.map +1 -0
  97. package/dist/resources/aggregated-merchants/aggregated-merchant-types.d.ts +82 -0
  98. package/dist/resources/aggregated-merchants/aggregated-merchant-types.d.ts.map +1 -0
  99. package/dist/resources/aggregated-merchants/aggregated-merchant-types.js +2 -0
  100. package/dist/resources/aggregated-merchants/aggregated-merchant-types.js.map +1 -0
  101. package/dist/resources/aggregated-merchants/aggregated-merchants.d.ts +67 -0
  102. package/dist/resources/aggregated-merchants/aggregated-merchants.d.ts.map +1 -0
  103. package/dist/resources/aggregated-merchants/aggregated-merchants.js +111 -0
  104. package/dist/resources/aggregated-merchants/aggregated-merchants.js.map +1 -0
  105. package/dist/resources/balance/balance-types.d.ts +18 -0
  106. package/dist/resources/balance/balance-types.d.ts.map +1 -0
  107. package/dist/resources/balance/balance-types.js +2 -0
  108. package/dist/resources/balance/balance-types.js.map +1 -0
  109. package/dist/resources/balance/balance.d.ts +20 -0
  110. package/dist/resources/balance/balance.d.ts.map +1 -0
  111. package/dist/resources/balance/balance.js +28 -0
  112. package/dist/resources/balance/balance.js.map +1 -0
  113. package/dist/resources/checkout/checkout-types.d.ts +96 -0
  114. package/dist/resources/checkout/checkout-types.d.ts.map +1 -0
  115. package/dist/resources/checkout/checkout-types.js +2 -0
  116. package/dist/resources/checkout/checkout-types.js.map +1 -0
  117. package/dist/resources/checkout/checkout.d.ts +66 -0
  118. package/dist/resources/checkout/checkout.d.ts.map +1 -0
  119. package/dist/resources/checkout/checkout.js +95 -0
  120. package/dist/resources/checkout/checkout.js.map +1 -0
  121. package/dist/resources/payout-batches/payout-batches.d.ts +31 -0
  122. package/dist/resources/payout-batches/payout-batches.d.ts.map +1 -0
  123. package/dist/resources/payout-batches/payout-batches.js +36 -0
  124. package/dist/resources/payout-batches/payout-batches.js.map +1 -0
  125. package/dist/resources/payouts/payout-types.d.ts +158 -0
  126. package/dist/resources/payouts/payout-types.d.ts.map +1 -0
  127. package/dist/resources/payouts/payout-types.js +2 -0
  128. package/dist/resources/payouts/payout-types.js.map +1 -0
  129. package/dist/resources/payouts/payouts.d.ts +63 -0
  130. package/dist/resources/payouts/payouts.d.ts.map +1 -0
  131. package/dist/resources/payouts/payouts.js +80 -0
  132. package/dist/resources/payouts/payouts.js.map +1 -0
  133. package/dist/resources/reconciliation/reconciliation-types.d.ts +86 -0
  134. package/dist/resources/reconciliation/reconciliation-types.d.ts.map +1 -0
  135. package/dist/resources/reconciliation/reconciliation-types.js +2 -0
  136. package/dist/resources/reconciliation/reconciliation-types.js.map +1 -0
  137. package/dist/resources/reconciliation/reconciliation.d.ts +41 -0
  138. package/dist/resources/reconciliation/reconciliation.d.ts.map +1 -0
  139. package/dist/resources/reconciliation/reconciliation.js +81 -0
  140. package/dist/resources/reconciliation/reconciliation.js.map +1 -0
  141. package/dist/resources/webhooks/webhook-types.d.ts +159 -0
  142. package/dist/resources/webhooks/webhook-types.d.ts.map +1 -0
  143. package/dist/resources/webhooks/webhook-types.js +36 -0
  144. package/dist/resources/webhooks/webhook-types.js.map +1 -0
  145. package/dist/resources/webhooks/webhook-verifier.d.ts +104 -0
  146. package/dist/resources/webhooks/webhook-verifier.d.ts.map +1 -0
  147. package/dist/resources/webhooks/webhook-verifier.js +188 -0
  148. package/dist/resources/webhooks/webhook-verifier.js.map +1 -0
  149. package/package.json +70 -4
  150. package/src/client/wave-client-options.ts +91 -0
  151. package/src/client/wave-client.ts +70 -0
  152. package/src/core/auth/authentication.ts +9 -0
  153. package/src/core/auth/request-signer.ts +42 -0
  154. package/src/core/errors/error-parser.ts +258 -0
  155. package/src/core/errors/redact.ts +20 -0
  156. package/src/core/errors/wave-api-error.ts +148 -0
  157. package/src/core/errors/wave-error.ts +32 -0
  158. package/src/core/errors/wave-network-error.ts +24 -0
  159. package/src/core/errors/wave-webhook-verification-error.ts +28 -0
  160. package/src/core/http/fetch-transport.ts +48 -0
  161. package/src/core/http/http-client.ts +352 -0
  162. package/src/core/http/http-request.ts +37 -0
  163. package/src/core/http/http-response.ts +37 -0
  164. package/src/core/http/query.ts +31 -0
  165. package/src/core/http/transport.ts +45 -0
  166. package/src/core/idempotency/idempotency.ts +31 -0
  167. package/src/core/retry/backoff.ts +61 -0
  168. package/src/core/retry/retry-policy.ts +106 -0
  169. package/src/core/types/common.ts +65 -0
  170. package/src/core/types/configuration.ts +85 -0
  171. package/src/core/types/json.ts +16 -0
  172. package/src/index.ts +146 -0
  173. package/src/resources/aggregated-merchants/aggregated-merchant-types.ts +87 -0
  174. package/src/resources/aggregated-merchants/aggregated-merchants.ts +171 -0
  175. package/src/resources/balance/balance-types.ts +19 -0
  176. package/src/resources/balance/balance.ts +39 -0
  177. package/src/resources/checkout/checkout-types.ts +102 -0
  178. package/src/resources/checkout/checkout.ts +144 -0
  179. package/src/resources/payout-batches/payout-batches.ts +58 -0
  180. package/src/resources/payouts/payout-types.ts +171 -0
  181. package/src/resources/payouts/payouts.ts +120 -0
  182. package/src/resources/reconciliation/reconciliation-types.ts +102 -0
  183. package/src/resources/reconciliation/reconciliation.ts +116 -0
  184. package/src/resources/webhooks/webhook-types.ts +222 -0
  185. package/src/resources/webhooks/webhook-verifier.ts +297 -0
@@ -0,0 +1,66 @@
1
+ import { HttpClient } from '../core/http/http-client.js';
2
+ import { AggregatedMerchantsResource } from '../resources/aggregated-merchants/aggregated-merchants.js';
3
+ import { BalanceResource } from '../resources/balance/balance.js';
4
+ import { CheckoutResource } from '../resources/checkout/checkout.js';
5
+ import { PayoutBatchesResource } from '../resources/payout-batches/payout-batches.js';
6
+ import { PayoutsResource } from '../resources/payouts/payouts.js';
7
+ import { ReconciliationResource } from '../resources/reconciliation/reconciliation.js';
8
+ import { WaveWebhooks } from '../resources/webhooks/webhook-verifier.js';
9
+ import { resolveClientOptions } from './wave-client-options.js';
10
+ /**
11
+ * Unified entry point for the Wave Business APIs.
12
+ *
13
+ * The client is intended for trusted server-side environments. It never persists credentials and
14
+ * never exposes them through errors or logs.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const wave = new WaveClient({ apiKey: process.env.WAVE_API_KEY! });
19
+ * const payout = await wave.payouts.create({
20
+ * currency: 'XOF',
21
+ * receive_amount: '5000',
22
+ * name: 'John Doe',
23
+ * mobile: '+2250700000000',
24
+ * });
25
+ * ```
26
+ */
27
+ export class WaveClient {
28
+ /** Payout API operations. */
29
+ payouts;
30
+ /** Payout batch operations. */
31
+ payoutBatches;
32
+ /** Balance API operations. */
33
+ balance;
34
+ /** Transaction listing and refund operations. */
35
+ reconciliation;
36
+ /** Checkout API operations. */
37
+ checkout;
38
+ /** Aggregated Merchants API operations. */
39
+ aggregatedMerchants;
40
+ /** Local webhook signature verification helpers; no HTTP calls are made. */
41
+ webhooks;
42
+ /**
43
+ * @param options - API credentials and transport configuration.
44
+ * @throws WaveConfigurationError when required options are missing or invalid.
45
+ */
46
+ constructor(options) {
47
+ const resolved = resolveClientOptions(options);
48
+ const http = new HttpClient({
49
+ baseUrl: resolved.baseUrl,
50
+ apiKey: resolved.apiKey,
51
+ signingSecret: resolved.signingSecret,
52
+ transport: resolved.transport,
53
+ timeoutMs: resolved.timeoutMs,
54
+ retry: resolved.retry,
55
+ logger: resolved.logger,
56
+ });
57
+ this.payouts = new PayoutsResource(http);
58
+ this.payoutBatches = new PayoutBatchesResource(http);
59
+ this.balance = new BalanceResource(http);
60
+ this.reconciliation = new ReconciliationResource(http);
61
+ this.checkout = new CheckoutResource(http);
62
+ this.aggregatedMerchants = new AggregatedMerchantsResource(http);
63
+ this.webhooks = new WaveWebhooks();
64
+ }
65
+ }
66
+ //# sourceMappingURL=wave-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wave-client.js","sourceRoot":"","sources":["../../src/client/wave-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,2DAA2D,CAAC;AACxG,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,UAAU;IACrB,6BAA6B;IACpB,OAAO,CAAkB;IAClC,+BAA+B;IACtB,aAAa,CAAwB;IAC9C,8BAA8B;IACrB,OAAO,CAAkB;IAClC,iDAAiD;IACxC,cAAc,CAAyB;IAChD,+BAA+B;IACtB,QAAQ,CAAmB;IACpC,2CAA2C;IAClC,mBAAmB,CAA8B;IAC1D,4EAA4E;IACnE,QAAQ,CAAe;IAEhC;;;OAGG;IACH,YAAY,OAA0B;QACpC,MAAM,QAAQ,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAE/C,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC;YAC1B,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,aAAa,EAAE,QAAQ,CAAC,aAAa;YACrC,SAAS,EAAE,QAAQ,CAAC,SAAS;YAC7B,SAAS,EAAE,QAAQ,CAAC,SAAS;YAC7B,KAAK,EAAE,QAAQ,CAAC,KAAK;YACrB,MAAM,EAAE,QAAQ,CAAC,MAAM;SACxB,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,aAAa,GAAG,IAAI,qBAAqB,CAAC,IAAI,CAAC,CAAC;QACrD,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,cAAc,GAAG,IAAI,sBAAsB,CAAC,IAAI,CAAC,CAAC;QACvD,IAAI,CAAC,QAAQ,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,mBAAmB,GAAG,IAAI,2BAA2B,CAAC,IAAI,CAAC,CAAC;QACjE,IAAI,CAAC,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;IACrC,CAAC;CACF","sourcesContent":["import { HttpClient } from '../core/http/http-client.js';\nimport type { WaveClientOptions } from '../core/types/configuration.js';\nimport { AggregatedMerchantsResource } from '../resources/aggregated-merchants/aggregated-merchants.js';\nimport { BalanceResource } from '../resources/balance/balance.js';\nimport { CheckoutResource } from '../resources/checkout/checkout.js';\nimport { PayoutBatchesResource } from '../resources/payout-batches/payout-batches.js';\nimport { PayoutsResource } from '../resources/payouts/payouts.js';\nimport { ReconciliationResource } from '../resources/reconciliation/reconciliation.js';\nimport { WaveWebhooks } from '../resources/webhooks/webhook-verifier.js';\nimport { resolveClientOptions } from './wave-client-options.js';\n\n/**\n * Unified entry point for the Wave Business APIs.\n *\n * The client is intended for trusted server-side environments. It never persists credentials and\n * never exposes them through errors or logs.\n *\n * @example\n * ```ts\n * const wave = new WaveClient({ apiKey: process.env.WAVE_API_KEY! });\n * const payout = await wave.payouts.create({\n * currency: 'XOF',\n * receive_amount: '5000',\n * name: 'John Doe',\n * mobile: '+2250700000000',\n * });\n * ```\n */\nexport class WaveClient {\n /** Payout API operations. */\n readonly payouts: PayoutsResource;\n /** Payout batch operations. */\n readonly payoutBatches: PayoutBatchesResource;\n /** Balance API operations. */\n readonly balance: BalanceResource;\n /** Transaction listing and refund operations. */\n readonly reconciliation: ReconciliationResource;\n /** Checkout API operations. */\n readonly checkout: CheckoutResource;\n /** Aggregated Merchants API operations. */\n readonly aggregatedMerchants: AggregatedMerchantsResource;\n /** Local webhook signature verification helpers; no HTTP calls are made. */\n readonly webhooks: WaveWebhooks;\n\n /**\n * @param options - API credentials and transport configuration.\n * @throws WaveConfigurationError when required options are missing or invalid.\n */\n constructor(options: WaveClientOptions) {\n const resolved = resolveClientOptions(options);\n\n const http = new HttpClient({\n baseUrl: resolved.baseUrl,\n apiKey: resolved.apiKey,\n signingSecret: resolved.signingSecret,\n transport: resolved.transport,\n timeoutMs: resolved.timeoutMs,\n retry: resolved.retry,\n logger: resolved.logger,\n });\n\n this.payouts = new PayoutsResource(http);\n this.payoutBatches = new PayoutBatchesResource(http);\n this.balance = new BalanceResource(http);\n this.reconciliation = new ReconciliationResource(http);\n this.checkout = new CheckoutResource(http);\n this.aggregatedMerchants = new AggregatedMerchantsResource(http);\n this.webhooks = new WaveWebhooks();\n }\n}\n"]}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Builds the documented bearer authorization header.
3
+ *
4
+ * @param apiKey - Wave Business API key.
5
+ * @returns The header value, for example `Bearer wave_sn_prod_...`.
6
+ */
7
+ export declare function buildAuthorizationHeader(apiKey: string): string;
8
+ //# sourceMappingURL=authentication.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../../src/core/auth/authentication.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE/D"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Builds the documented bearer authorization header.
3
+ *
4
+ * @param apiKey - Wave Business API key.
5
+ * @returns The header value, for example `Bearer wave_sn_prod_...`.
6
+ */
7
+ export function buildAuthorizationHeader(apiKey) {
8
+ return `Bearer ${apiKey}`;
9
+ }
10
+ //# sourceMappingURL=authentication.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../../src/core/auth/authentication.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAc;IACrD,OAAO,UAAU,MAAM,EAAE,CAAC;AAC5B,CAAC","sourcesContent":["/**\n * Builds the documented bearer authorization header.\n *\n * @param apiKey - Wave Business API key.\n * @returns The header value, for example `Bearer wave_sn_prod_...`.\n */\nexport function buildAuthorizationHeader(apiKey: string): string {\n return `Bearer ${apiKey}`;\n}\n"]}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Header carrying the request signature.
3
+ */
4
+ export declare const SIGNATURE_HEADER = "Wave-Signature";
5
+ /**
6
+ * Signs outgoing requests with Wave's documented HMAC-SHA256 algorithm.
7
+ *
8
+ * The payload is the Unix timestamp in seconds concatenated with the exact request body. For GET
9
+ * requests without a body, the payload is the timestamp alone.
10
+ */
11
+ export declare class RequestSigner {
12
+ #private;
13
+ /**
14
+ * @param signingSecret - Signing secret configured on the API key.
15
+ */
16
+ constructor(signingSecret: string);
17
+ /**
18
+ * Produces the `Wave-Signature` header value.
19
+ *
20
+ * @param body - Exact serialized request body; use an empty string for GET requests.
21
+ * @param timestampSeconds - Unix timestamp in seconds; a fresh value must be used per attempt.
22
+ * @returns Header value in the documented `t={timestamp},v1={signature}` form.
23
+ */
24
+ sign(body: string, timestampSeconds?: number): string;
25
+ }
26
+ //# sourceMappingURL=request-signer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-signer.d.ts","sourceRoot":"","sources":["../../../src/core/auth/request-signer.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,gBAAgB,mBAAmB,CAAC;AAEjD;;;;;GAKG;AACH,qBAAa,aAAa;;IAGxB;;OAEG;gBACS,aAAa,EAAE,MAAM;IAOjC;;;;;;OAMG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,GAAE,MAAsC,GAAG,MAAM;CAOrF"}
@@ -0,0 +1,39 @@
1
+ import { createHmac } from 'node:crypto';
2
+ import { WaveConfigurationError } from '../errors/wave-error.js';
3
+ /**
4
+ * Header carrying the request signature.
5
+ */
6
+ export const SIGNATURE_HEADER = 'Wave-Signature';
7
+ /**
8
+ * Signs outgoing requests with Wave's documented HMAC-SHA256 algorithm.
9
+ *
10
+ * The payload is the Unix timestamp in seconds concatenated with the exact request body. For GET
11
+ * requests without a body, the payload is the timestamp alone.
12
+ */
13
+ export class RequestSigner {
14
+ #secret;
15
+ /**
16
+ * @param signingSecret - Signing secret configured on the API key.
17
+ */
18
+ constructor(signingSecret) {
19
+ if (typeof signingSecret !== 'string' || signingSecret.length === 0) {
20
+ throw new WaveConfigurationError('signingSecret must be a non-empty string when provided.');
21
+ }
22
+ this.#secret = signingSecret;
23
+ }
24
+ /**
25
+ * Produces the `Wave-Signature` header value.
26
+ *
27
+ * @param body - Exact serialized request body; use an empty string for GET requests.
28
+ * @param timestampSeconds - Unix timestamp in seconds; a fresh value must be used per attempt.
29
+ * @returns Header value in the documented `t={timestamp},v1={signature}` form.
30
+ */
31
+ sign(body, timestampSeconds = Math.floor(Date.now() / 1000)) {
32
+ const signature = createHmac('sha256', this.#secret)
33
+ .update(String(timestampSeconds), 'utf8')
34
+ .update(body, 'utf8')
35
+ .digest('hex');
36
+ return `t=${timestampSeconds},v1=${signature}`;
37
+ }
38
+ }
39
+ //# sourceMappingURL=request-signer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-signer.js","sourceRoot":"","sources":["../../../src/core/auth/request-signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IACf,OAAO,CAAS;IAEzB;;OAEG;IACH,YAAY,aAAqB;QAC/B,IAAI,OAAO,aAAa,KAAK,QAAQ,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACpE,MAAM,IAAI,sBAAsB,CAAC,yDAAyD,CAAC,CAAC;QAC9F,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,aAAa,CAAC;IAC/B,CAAC;IAED;;;;;;OAMG;IACH,IAAI,CAAC,IAAY,EAAE,mBAA2B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;QACzE,MAAM,SAAS,GAAG,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC;aACjD,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;aACxC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC;aACpB,MAAM,CAAC,KAAK,CAAC,CAAC;QACjB,OAAO,KAAK,gBAAgB,OAAO,SAAS,EAAE,CAAC;IACjD,CAAC;CACF","sourcesContent":["import { createHmac } from 'node:crypto';\nimport { WaveConfigurationError } from '../errors/wave-error.js';\n\n/**\n * Header carrying the request signature.\n */\nexport const SIGNATURE_HEADER = 'Wave-Signature';\n\n/**\n * Signs outgoing requests with Wave's documented HMAC-SHA256 algorithm.\n *\n * The payload is the Unix timestamp in seconds concatenated with the exact request body. For GET\n * requests without a body, the payload is the timestamp alone.\n */\nexport class RequestSigner {\n readonly #secret: string;\n\n /**\n * @param signingSecret - Signing secret configured on the API key.\n */\n constructor(signingSecret: string) {\n if (typeof signingSecret !== 'string' || signingSecret.length === 0) {\n throw new WaveConfigurationError('signingSecret must be a non-empty string when provided.');\n }\n this.#secret = signingSecret;\n }\n\n /**\n * Produces the `Wave-Signature` header value.\n *\n * @param body - Exact serialized request body; use an empty string for GET requests.\n * @param timestampSeconds - Unix timestamp in seconds; a fresh value must be used per attempt.\n * @returns Header value in the documented `t={timestamp},v1={signature}` form.\n */\n sign(body: string, timestampSeconds: number = Math.floor(Date.now() / 1000)): string {\n const signature = createHmac('sha256', this.#secret)\n .update(String(timestampSeconds), 'utf8')\n .update(body, 'utf8')\n .digest('hex');\n return `t=${timestampSeconds},v1=${signature}`;\n }\n}\n"]}
@@ -0,0 +1,25 @@
1
+ import { WaveApiError } from './wave-api-error.js';
2
+ /**
3
+ * Raw inputs used to construct an API error.
4
+ */
5
+ export interface ParseApiErrorInput {
6
+ /** HTTP status code returned by Wave. */
7
+ readonly statusCode: number;
8
+ /** Raw response body. */
9
+ readonly bodyText: string;
10
+ /** Response headers with lowercase names. */
11
+ readonly headers: Readonly<Record<string, string>>;
12
+ /** Credential values that must never appear in the resulting message. */
13
+ readonly secrets: readonly string[];
14
+ }
15
+ /**
16
+ * Parses a documented Wave error response into the matching error class.
17
+ *
18
+ * Wave documents several envelopes (`code`/`message`/`details`, `error_code`/`error_message`, and a
19
+ * legacy `error` field), so all of them are accepted.
20
+ *
21
+ * @param input - Status, body, headers and secrets to redact.
22
+ * @returns The matching {@link WaveApiError} subclass.
23
+ */
24
+ export declare function parseApiError(input: ParseApiErrorInput): WaveApiError;
25
+ //# sourceMappingURL=error-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-parser.d.ts","sourceRoot":"","sources":["../../../src/core/errors/error-parser.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,YAAY,EASb,MAAM,qBAAqB,CAAC;AAG7B;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,yCAAyC;IACzC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,yBAAyB;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,6CAA6C;IAC7C,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAQD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,YAAY,CAuCrE"}
@@ -0,0 +1,198 @@
1
+ import { parseRetryAfter } from '../retry/retry-policy.js';
2
+ import { WaveApiError, WaveAuthenticationError, WaveAuthorizationError, WaveConflictError, WaveNotFoundError, WaveRateLimitError, WaveServerError, WaveValidationError, } from './wave-api-error.js';
3
+ import { redactSecrets } from './redact.js';
4
+ /**
5
+ * Parses a documented Wave error response into the matching error class.
6
+ *
7
+ * Wave documents several envelopes (`code`/`message`/`details`, `error_code`/`error_message`, and a
8
+ * legacy `error` field), so all of them are accepted.
9
+ *
10
+ * @param input - Status, body, headers and secrets to redact.
11
+ * @returns The matching {@link WaveApiError} subclass.
12
+ */
13
+ export function parseApiError(input) {
14
+ const envelope = parseEnvelope(input.bodyText);
15
+ const fallbackMessage = `Wave API request failed with HTTP ${input.statusCode}.`;
16
+ const message = redactSecrets(envelope.message ?? fallbackMessage, input.secrets);
17
+ const options = {
18
+ rawBody: redactSecrets(input.bodyText, input.secrets),
19
+ responseHeaders: redactHeaderValues(input.headers, input.secrets),
20
+ ...(envelope.code === undefined ? {} : { code: envelope.code }),
21
+ ...(envelope.details === undefined
22
+ ? {}
23
+ : { details: envelope.details.map((detail) => redactDetail(detail, input.secrets)) }),
24
+ };
25
+ switch (input.statusCode) {
26
+ case 401:
27
+ return new WaveAuthenticationError(message, options);
28
+ case 403:
29
+ return new WaveAuthorizationError(message, options);
30
+ case 404:
31
+ return new WaveNotFoundError(message, options);
32
+ case 400:
33
+ case 422:
34
+ return new WaveValidationError(message, { ...options, statusCode: input.statusCode });
35
+ case 409:
36
+ return new WaveConflictError(message, options);
37
+ case 429: {
38
+ const retryAfterSeconds = parseRetryAfter(input.headers['retry-after']);
39
+ return new WaveRateLimitError(message, {
40
+ ...options,
41
+ ...(retryAfterSeconds === undefined ? {} : { retryAfterSeconds }),
42
+ });
43
+ }
44
+ default:
45
+ if (input.statusCode >= 500) {
46
+ return new WaveServerError(message, { ...options, statusCode: input.statusCode });
47
+ }
48
+ return new WaveApiError(message, { ...options, statusCode: input.statusCode });
49
+ }
50
+ }
51
+ function parseEnvelope(bodyText) {
52
+ const parsed = tryParseJson(bodyText);
53
+ if (!isRecord(parsed)) {
54
+ return { code: undefined, message: undefined, details: undefined };
55
+ }
56
+ const code = firstString(parsed['code'], parsed['error'], parsed['error_code']);
57
+ const message = firstString(parsed['message'], parsed['error_message']);
58
+ const details = parseDetails(parsed['details']);
59
+ return { code, message, details };
60
+ }
61
+ function parseDetails(value) {
62
+ if (!Array.isArray(value)) {
63
+ return undefined;
64
+ }
65
+ const details = [];
66
+ for (const item of value) {
67
+ const detail = parseDetail(item);
68
+ if (detail !== undefined) {
69
+ details.push(detail);
70
+ }
71
+ }
72
+ return details.length > 0 ? details : undefined;
73
+ }
74
+ function parseDetail(value) {
75
+ if (!isRecord(value)) {
76
+ return undefined;
77
+ }
78
+ const loc = value['loc'];
79
+ const msg = value['msg'];
80
+ if (!Array.isArray(loc) || typeof msg !== 'string') {
81
+ return undefined;
82
+ }
83
+ const location = [];
84
+ for (const segment of loc) {
85
+ if (typeof segment === 'string' || typeof segment === 'number') {
86
+ location.push(segment);
87
+ }
88
+ }
89
+ const type = value['type'];
90
+ const ctx = toJsonObject(value['ctx']);
91
+ return {
92
+ loc: location,
93
+ msg,
94
+ ...(typeof type === 'string' ? { type } : {}),
95
+ ...(ctx === undefined ? {} : { ctx }),
96
+ };
97
+ }
98
+ function toJsonObject(value) {
99
+ const parsed = toJsonValue(value);
100
+ if (parsed === undefined ||
101
+ parsed === null ||
102
+ Array.isArray(parsed) ||
103
+ typeof parsed !== 'object') {
104
+ return undefined;
105
+ }
106
+ return parsed;
107
+ }
108
+ function toJsonValue(value) {
109
+ if (value === null || typeof value === 'string' || typeof value === 'boolean') {
110
+ return value;
111
+ }
112
+ if (typeof value === 'number') {
113
+ return Number.isFinite(value) ? value : undefined;
114
+ }
115
+ if (Array.isArray(value)) {
116
+ const items = [];
117
+ for (const item of value) {
118
+ const parsed = toJsonValue(item);
119
+ if (parsed === undefined) {
120
+ return undefined;
121
+ }
122
+ items.push(parsed);
123
+ }
124
+ return items;
125
+ }
126
+ if (isRecord(value)) {
127
+ const result = {};
128
+ for (const [key, item] of Object.entries(value)) {
129
+ const parsed = toJsonValue(item);
130
+ if (parsed === undefined) {
131
+ return undefined;
132
+ }
133
+ result[key] = parsed;
134
+ }
135
+ return result;
136
+ }
137
+ return undefined;
138
+ }
139
+ function redactHeaderValues(headers, secrets) {
140
+ const redacted = {};
141
+ for (const [name, value] of Object.entries(headers)) {
142
+ redacted[name] = redactSecrets(value, secrets);
143
+ }
144
+ return redacted;
145
+ }
146
+ function redactDetail(detail, secrets) {
147
+ return {
148
+ ...detail,
149
+ msg: redactSecrets(detail.msg, secrets),
150
+ ...(detail.ctx === undefined ? {} : { ctx: redactJsonObject(detail.ctx, secrets) }),
151
+ };
152
+ }
153
+ function redactJsonObject(value, secrets) {
154
+ const result = {};
155
+ for (const [key, item] of Object.entries(value)) {
156
+ result[key] = redactJson(item, secrets);
157
+ }
158
+ return result;
159
+ }
160
+ function redactJson(value, secrets) {
161
+ if (typeof value === 'string') {
162
+ return redactSecrets(value, secrets);
163
+ }
164
+ if (Array.isArray(value)) {
165
+ return value.map((item) => redactJson(item, secrets));
166
+ }
167
+ if (value !== null && typeof value === 'object') {
168
+ const result = {};
169
+ for (const [key, item] of Object.entries(value)) {
170
+ result[key] = redactJson(item, secrets);
171
+ }
172
+ return result;
173
+ }
174
+ return value;
175
+ }
176
+ function tryParseJson(value) {
177
+ if (value.trim().length === 0) {
178
+ return undefined;
179
+ }
180
+ try {
181
+ return JSON.parse(value);
182
+ }
183
+ catch {
184
+ return undefined;
185
+ }
186
+ }
187
+ function isRecord(value) {
188
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
189
+ }
190
+ function firstString(...values) {
191
+ for (const value of values) {
192
+ if (typeof value === 'string' && value.length > 0) {
193
+ return value;
194
+ }
195
+ }
196
+ return undefined;
197
+ }
198
+ //# sourceMappingURL=error-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-parser.js","sourceRoot":"","sources":["../../../src/core/errors/error-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAG3D,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,GAEpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAsB5C;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,MAAM,QAAQ,GAAG,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC/C,MAAM,eAAe,GAAG,qCAAqC,KAAK,CAAC,UAAU,GAAG,CAAC;IACjF,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,OAAO,IAAI,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAElF,MAAM,OAAO,GAA4C;QACvD,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC;QACrD,e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KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClD,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import { parseRetryAfter } from '../retry/retry-policy.js';\nimport type { ValidationErrorDetail } from '../types/common.js';\nimport type { JsonObject, JsonValue } from '../types/json.js';\nimport {\n WaveApiError,\n WaveAuthenticationError,\n WaveAuthorizationError,\n WaveConflictError,\n WaveNotFoundError,\n WaveRateLimitError,\n WaveServerError,\n WaveValidationError,\n type WaveApiErrorOptions,\n} from './wave-api-error.js';\nimport { redactSecrets } from './redact.js';\n\n/**\n * Raw inputs used to construct an API error.\n */\nexport interface ParseApiErrorInput {\n /** HTTP status code returned by Wave. */\n readonly statusCode: number;\n /** Raw response body. */\n readonly bodyText: string;\n /** Response headers with lowercase names. */\n readonly headers: Readonly<Record<string, string>>;\n /** Credential values that must never appear in the resulting message. */\n readonly secrets: readonly string[];\n}\n\ninterface ErrorEnvelope {\n readonly code: string | undefined;\n readonly message: string | undefined;\n readonly details: readonly ValidationErrorDetail[] | undefined;\n}\n\n/**\n * Parses a documented Wave error response into the matching error class.\n *\n * Wave documents several envelopes (`code`/`message`/`details`, `error_code`/`error_message`, and a\n * legacy `error` field), so all of them are accepted.\n *\n * @param input - Status, body, headers and secrets to redact.\n * @returns The matching {@link WaveApiError} subclass.\n */\nexport function parseApiError(input: ParseApiErrorInput): WaveApiError {\n const envelope = parseEnvelope(input.bodyText);\n const fallbackMessage = `Wave API request failed with HTTP ${input.statusCode}.`;\n const message = redactSecrets(envelope.message ?? fallbackMessage, input.secrets);\n\n const options: Omit<WaveApiErrorOptions, 'statusCode'> = {\n rawBody: redactSecrets(input.bodyText, input.secrets),\n responseHeaders: redactHeaderValues(input.headers, input.secrets),\n ...(envelope.code === undefined ? {} : { code: envelope.code }),\n ...(envelope.details === undefined\n ? {}\n : { details: envelope.details.map((detail) => redactDetail(detail, input.secrets)) }),\n };\n\n switch (input.statusCode) {\n case 401:\n return new WaveAuthenticationError(message, options);\n case 403:\n return new WaveAuthorizationError(message, options);\n case 404:\n return new WaveNotFoundError(message, options);\n case 400:\n case 422:\n return new WaveValidationError(message, { ...options, statusCode: input.statusCode });\n case 409:\n return new WaveConflictError(message, options);\n case 429: {\n const retryAfterSeconds = parseRetryAfter(input.headers['retry-after']);\n return new WaveRateLimitError(message, {\n ...options,\n ...(retryAfterSeconds === undefined ? {} : { retryAfterSeconds }),\n });\n }\n default:\n if (input.statusCode >= 500) {\n return new WaveServerError(message, { ...options, statusCode: input.statusCode });\n }\n return new WaveApiError(message, { ...options, statusCode: input.statusCode });\n }\n}\n\nfunction parseEnvelope(bodyText: string): ErrorEnvelope {\n const parsed = tryParseJson(bodyText);\n if (!isRecord(parsed)) {\n return { code: undefined, message: undefined, details: undefined };\n }\n\n const code = firstString(parsed['code'], parsed['error'], parsed['error_code']);\n const message = firstString(parsed['message'], parsed['error_message']);\n const details = parseDetails(parsed['details']);\n\n return { code, message, details };\n}\n\nfunction parseDetails(value: unknown): readonly ValidationErrorDetail[] | undefined {\n if (!Array.isArray(value)) {\n return undefined;\n }\n\n const details: ValidationErrorDetail[] = [];\n for (const item of value) {\n const detail = parseDetail(item);\n if (detail !== undefined) {\n details.push(detail);\n }\n }\n return details.length > 0 ? details : undefined;\n}\n\nfunction parseDetail(value: unknown): ValidationErrorDetail | undefined {\n if (!isRecord(value)) {\n return undefined;\n }\n\n const loc = value['loc'];\n const msg = value['msg'];\n if (!Array.isArray(loc) || typeof msg !== 'string') {\n return undefined;\n }\n\n const location: (string | number)[] = [];\n for (const segment of loc) {\n if (typeof segment === 'string' || typeof segment === 'number') {\n location.push(segment);\n }\n }\n\n const type = value['type'];\n const ctx = toJsonObject(value['ctx']);\n\n return {\n loc: location,\n msg,\n ...(typeof type === 'string' ? { type } : {}),\n ...(ctx === undefined ? {} : { ctx }),\n };\n}\n\nfunction toJsonObject(value: unknown): JsonObject | undefined {\n const parsed = toJsonValue(value);\n if (\n parsed === undefined ||\n parsed === null ||\n Array.isArray(parsed) ||\n typeof parsed !== 'object'\n ) {\n return undefined;\n }\n return parsed;\n}\n\nfunction toJsonValue(value: unknown): JsonValue | undefined {\n if (value === null || typeof value === 'string' || typeof value === 'boolean') {\n return value;\n }\n if (typeof value === 'number') {\n return Number.isFinite(value) ? value : undefined;\n }\n if (Array.isArray(value)) {\n const items: JsonValue[] = [];\n for (const item of value) {\n const parsed = toJsonValue(item);\n if (parsed === undefined) {\n return undefined;\n }\n items.push(parsed);\n }\n return items;\n }\n if (isRecord(value)) {\n const result: Record<string, JsonValue> = {};\n for (const [key, item] of Object.entries(value)) {\n const parsed = toJsonValue(item);\n if (parsed === undefined) {\n return undefined;\n }\n result[key] = parsed;\n }\n return result;\n }\n return undefined;\n}\n\nfunction redactHeaderValues(\n headers: Readonly<Record<string, string>>,\n secrets: readonly string[],\n): Readonly<Record<string, string>> {\n const redacted: Record<string, string> = {};\n for (const [name, value] of Object.entries(headers)) {\n redacted[name] = redactSecrets(value, secrets);\n }\n return redacted;\n}\n\nfunction redactDetail(\n detail: ValidationErrorDetail,\n secrets: readonly string[],\n): ValidationErrorDetail {\n return {\n ...detail,\n msg: redactSecrets(detail.msg, secrets),\n ...(detail.ctx === undefined ? {} : { ctx: redactJsonObject(detail.ctx, secrets) }),\n };\n}\n\nfunction redactJsonObject(value: JsonObject, secrets: readonly string[]): JsonObject {\n const result: Record<string, JsonValue> = {};\n for (const [key, item] of Object.entries(value)) {\n result[key] = redactJson(item, secrets);\n }\n return result;\n}\n\nfunction redactJson(value: JsonValue, secrets: readonly string[]): JsonValue {\n if (typeof value === 'string') {\n return redactSecrets(value, secrets);\n }\n if (Array.isArray(value)) {\n return value.map((item) => redactJson(item, secrets));\n }\n if (value !== null && typeof value === 'object') {\n const result: Record<string, JsonValue> = {};\n for (const [key, item] of Object.entries(value)) {\n result[key] = redactJson(item, secrets);\n }\n return result;\n }\n return value;\n}\n\nfunction tryParseJson(value: string): unknown {\n if (value.trim().length === 0) {\n return undefined;\n }\n try {\n return JSON.parse(value) as unknown;\n } catch {\n return undefined;\n }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction firstString(...values: unknown[]): string | undefined {\n for (const value of values) {\n if (typeof value === 'string' && value.length > 0) {\n return value;\n }\n }\n return undefined;\n}\n"]}
@@ -0,0 +1,11 @@
1
+ /** Replacement text used when a credential would otherwise appear in output. */
2
+ export declare const REDACTED = "[REDACTED]";
3
+ /**
4
+ * Removes known secrets from a string.
5
+ *
6
+ * @param value - Text that may contain a credential.
7
+ * @param secrets - Credential values to remove; empty entries are ignored.
8
+ * @returns The text with every occurrence of each secret replaced by `[REDACTED]`.
9
+ */
10
+ export declare function redactSecrets(value: string, secrets: readonly string[]): string;
11
+ //# sourceMappingURL=redact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../../../src/core/errors/redact.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,eAAO,MAAM,QAAQ,eAAe,CAAC;AAErC;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAS/E"}
@@ -0,0 +1,20 @@
1
+ /** Replacement text used when a credential would otherwise appear in output. */
2
+ export const REDACTED = '[REDACTED]';
3
+ /**
4
+ * Removes known secrets from a string.
5
+ *
6
+ * @param value - Text that may contain a credential.
7
+ * @param secrets - Credential values to remove; empty entries are ignored.
8
+ * @returns The text with every occurrence of each secret replaced by `[REDACTED]`.
9
+ */
10
+ export function redactSecrets(value, secrets) {
11
+ let result = value;
12
+ for (const secret of secrets) {
13
+ if (secret.length === 0 || result.length === 0) {
14
+ continue;
15
+ }
16
+ result = result.split(secret).join(REDACTED);
17
+ }
18
+ return result;
19
+ }
20
+ //# sourceMappingURL=redact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redact.js","sourceRoot":"","sources":["../../../src/core/errors/redact.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,CAAC,MAAM,QAAQ,GAAG,YAAY,CAAC;AAErC;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa,EAAE,OAA0B;IACrE,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/C,SAAS;QACX,CAAC;QACD,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/** Replacement text used when a credential would otherwise appear in output. */\nexport const REDACTED = '[REDACTED]';\n\n/**\n * Removes known secrets from a string.\n *\n * @param value - Text that may contain a credential.\n * @param secrets - Credential values to remove; empty entries are ignored.\n * @returns The text with every occurrence of each secret replaced by `[REDACTED]`.\n */\nexport function redactSecrets(value: string, secrets: readonly string[]): string {\n let result = value;\n for (const secret of secrets) {\n if (secret.length === 0 || result.length === 0) {\n continue;\n }\n result = result.split(secret).join(REDACTED);\n }\n return result;\n}\n"]}
@@ -0,0 +1,116 @@
1
+ import type { ValidationErrorDetail } from '../types/common.js';
2
+ import { WaveError } from './wave-error.js';
3
+ /**
4
+ * Options for API errors.
5
+ */
6
+ export interface WaveApiErrorOptions {
7
+ /** HTTP status code returned by Wave. */
8
+ readonly statusCode: number;
9
+ /** Wave error code, preserved verbatim. */
10
+ readonly code?: string;
11
+ /** Field-level validation details, when documented. */
12
+ readonly details?: readonly ValidationErrorDetail[];
13
+ /** Raw response body, preserved for diagnostics. */
14
+ readonly rawBody?: string;
15
+ /** Response headers with lowercase names. */
16
+ readonly responseHeaders?: Readonly<Record<string, string>>;
17
+ }
18
+ /**
19
+ * Base class for errors returned by the Wave API.
20
+ */
21
+ export declare class WaveApiError extends WaveError {
22
+ /** HTTP status code returned by Wave. */
23
+ readonly statusCode: number;
24
+ /** Field-level validation details, when documented. */
25
+ readonly details: readonly ValidationErrorDetail[] | undefined;
26
+ /** Raw response body preserved for diagnostics, with known credentials redacted. */
27
+ readonly rawBody: string | undefined;
28
+ /** Response headers with lowercase names. */
29
+ readonly responseHeaders: Readonly<Record<string, string>> | undefined;
30
+ /**
31
+ * @param message - Human-readable description that never contains credentials.
32
+ * @param options - Status code and preserved API error metadata.
33
+ */
34
+ constructor(message: string, options: WaveApiErrorOptions);
35
+ }
36
+ /**
37
+ * Error returned when the API key or request signature is rejected (HTTP 401).
38
+ */
39
+ export declare class WaveAuthenticationError extends WaveApiError {
40
+ /**
41
+ * @param message - Human-readable description.
42
+ * @param options - Preserved API error metadata.
43
+ */
44
+ constructor(message: string, options: Omit<WaveApiErrorOptions, 'statusCode'>);
45
+ }
46
+ /**
47
+ * Error returned when the key lacks permission for the request, the wallet cannot use the API, or
48
+ * the source IP is not allowlisted (HTTP 403).
49
+ */
50
+ export declare class WaveAuthorizationError extends WaveApiError {
51
+ /**
52
+ * @param message - Human-readable description.
53
+ * @param options - Preserved API error metadata.
54
+ */
55
+ constructor(message: string, options: Omit<WaveApiErrorOptions, 'statusCode'>);
56
+ }
57
+ /**
58
+ * Error returned when the requested resource does not exist (HTTP 404).
59
+ */
60
+ export declare class WaveNotFoundError extends WaveApiError {
61
+ /**
62
+ * @param message - Human-readable description.
63
+ * @param options - Preserved API error metadata.
64
+ */
65
+ constructor(message: string, options: Omit<WaveApiErrorOptions, 'statusCode'>);
66
+ }
67
+ /**
68
+ * Error returned for a malformed or semantically invalid request (HTTP 400 or 422).
69
+ */
70
+ export declare class WaveValidationError extends WaveApiError {
71
+ /**
72
+ * @param message - Human-readable description.
73
+ * @param options - Preserved API error metadata.
74
+ */
75
+ constructor(message: string, options: WaveApiErrorOptions);
76
+ }
77
+ /**
78
+ * Error returned when the request conflicts with the current resource state (HTTP 409).
79
+ */
80
+ export declare class WaveConflictError extends WaveApiError {
81
+ /**
82
+ * @param message - Human-readable description.
83
+ * @param options - Preserved API error metadata.
84
+ */
85
+ constructor(message: string, options: Omit<WaveApiErrorOptions, 'statusCode'>);
86
+ }
87
+ /**
88
+ * Options for rate-limit errors.
89
+ */
90
+ export interface WaveRateLimitErrorOptions extends Omit<WaveApiErrorOptions, 'statusCode'> {
91
+ /** Retry delay parsed from a `Retry-After` response header, when present. */
92
+ readonly retryAfterSeconds?: number;
93
+ }
94
+ /**
95
+ * Error returned when the rate limit is exceeded (HTTP 429).
96
+ */
97
+ export declare class WaveRateLimitError extends WaveApiError {
98
+ /** Retry delay parsed from `Retry-After`, when Wave provides one. */
99
+ readonly retryAfterSeconds: number | undefined;
100
+ /**
101
+ * @param message - Human-readable description.
102
+ * @param options - Preserved API error metadata and optional retry delay.
103
+ */
104
+ constructor(message: string, options: WaveRateLimitErrorOptions);
105
+ }
106
+ /**
107
+ * Error returned when Wave fails to process a valid request (HTTP 5xx).
108
+ */
109
+ export declare class WaveServerError extends WaveApiError {
110
+ /**
111
+ * @param message - Human-readable description.
112
+ * @param options - Preserved API error metadata.
113
+ */
114
+ constructor(message: string, options: WaveApiErrorOptions);
115
+ }
116
+ //# sourceMappingURL=wave-api-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wave-api-error.d.ts","sourceRoot":"","sources":["../../../src/core/errors/wave-api-error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,yCAAyC;IACzC,QAAQ,CAAC,UAAU,EAAE,MAA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