@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 @@
1
+ {"version":3,"file":"backoff.js","sourceRoot":"","sources":["../../../src/core/retry/backoff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAGjE;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAe,EACf,OAAqB,EACrB,SAAuB,IAAI,CAAC,MAAM;IAElC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IACpE,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IACzD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AACjE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,OAAe,EAAE,MAA+B;IACpE,IAAI,MAAM,EAAE,OAAO,KAAK,IAAI,EAAE,CAAC;QAC7B,OAAO,OAAO,CAAC,MAAM,CACnB,IAAI,cAAc,CAAC,6CAA6C,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAC5F,CAAC;IACJ,CAAC;IAED,IAAI,OAAO,IAAI,CAAC,EAAE,CAAC;QACjB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,OAAO,GAAG,GAAS,EAAE;YACzB,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAChD,CAAC,CAAC;QAEF,MAAM,OAAO,GAAG,GAAS,EAAE;YACzB,OAAO,EAAE,CAAC;YACV,MAAM,CACJ,IAAI,cAAc,CAAC,6CAA6C,EAAE;gBAChE,KAAK,EAAE,MAAM,EAAE,MAAM;aACtB,CAAC,CACH,CAAC;QACJ,CAAC,CAAC;QAEF,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,CAAC;QACZ,CAAC,EAAE,OAAO,CAAC,CAAC;QAEZ,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { WaveAbortError } from '../errors/wave-network-error.js';\nimport type { RetryOptions } from '../types/configuration.js';\n\n/**\n * Computes the delay before a retry using exponential backoff with optional full jitter.\n *\n * @param attempt - Zero-based retry index (0 for the first retry).\n * @param options - Retry configuration.\n * @param random - Random source in `[0, 1)`; injectable for deterministic tests.\n * @returns Delay in milliseconds, never above `maxDelayMs`.\n */\nexport function computeBackoffDelay(\n attempt: number,\n options: RetryOptions,\n random: () => number = Math.random,\n): number {\n const exponential = options.baseDelayMs * 2 ** Math.max(0, attempt);\n const capped = Math.min(options.maxDelayMs, exponential);\n return Math.round(options.jitter ? random() * capped : capped);\n}\n\n/**\n * Waits for a delay, rejecting immediately if the caller aborts.\n *\n * @param delayMs - Time to wait in milliseconds.\n * @param signal - Caller abort signal.\n */\nexport function delay(delayMs: number, signal: AbortSignal | undefined): Promise<void> {\n if (signal?.aborted === true) {\n return Promise.reject(\n new WaveAbortError('Wave API request was aborted by the caller.', { cause: signal.reason }),\n );\n }\n\n if (delayMs <= 0) {\n return Promise.resolve();\n }\n\n return new Promise<void>((resolve, reject) => {\n const cleanup = (): void => {\n clearTimeout(timer);\n signal?.removeEventListener('abort', onAbort);\n };\n\n const onAbort = (): void => {\n cleanup();\n reject(\n new WaveAbortError('Wave API request was aborted by the caller.', {\n cause: signal?.reason,\n }),\n );\n };\n\n const timer = setTimeout(() => {\n cleanup();\n resolve();\n }, delayMs);\n\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n}\n"]}
@@ -0,0 +1,43 @@
1
+ import type { RetryOptions } from '../types/configuration.js';
2
+ /**
3
+ * Default retry policy.
4
+ *
5
+ * Two retries with a one-second base delay and full jitter follow Wave's own guidance to wait a
6
+ * few seconds between retries of idempotent operations.
7
+ */
8
+ export declare const DEFAULT_RETRY_OPTIONS: RetryOptions;
9
+ /**
10
+ * Validates and fills a partial retry configuration.
11
+ *
12
+ * @param options - Partial retry configuration.
13
+ * @returns A complete, validated retry policy.
14
+ */
15
+ export declare function normalizeRetryOptions(options: Partial<RetryOptions>): RetryOptions;
16
+ /**
17
+ * Resolves the retry policy for one request.
18
+ *
19
+ * @param base - Client-level retry policy.
20
+ * @param override - Per-request override.
21
+ * @returns The effective policy, or `false` when retries are disabled.
22
+ */
23
+ export declare function resolveRetryOptions(base: RetryOptions | false, override: Partial<RetryOptions> | false | undefined): RetryOptions | false;
24
+ /**
25
+ * Whether a status code is safe to retry at the transport level.
26
+ *
27
+ * Wave documents retries for 408, 429 and 5xx responses; other 4xx responses are final.
28
+ *
29
+ * @param status - HTTP status code.
30
+ */
31
+ export declare function isRetryableStatus(status: number): boolean;
32
+ /**
33
+ * Parses a `Retry-After` header value.
34
+ *
35
+ * Wave's documentation does not currently describe this header, so it is honoured only when
36
+ * present.
37
+ *
38
+ * @param value - Header value, either delay seconds or an HTTP date.
39
+ * @param nowMs - Current time in milliseconds; injectable for tests.
40
+ * @returns Delay in seconds, or `undefined` when missing or invalid.
41
+ */
42
+ export declare function parseRetryAfter(value: string | undefined, nowMs?: number): number | undefined;
43
+ //# sourceMappingURL=retry-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry-policy.d.ts","sourceRoot":"","sources":["../../../src/core/retry/retry-policy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,YAKlC,CAAC;AAEH;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAclF;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,YAAY,GAAG,KAAK,EAC1B,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,KAAK,GAAG,SAAS,GAClD,YAAY,GAAG,KAAK,CAWtB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,KAAK,GAAE,MAAmB,GACzB,MAAM,GAAG,SAAS,CAoBpB"}
@@ -0,0 +1,90 @@
1
+ import { WaveConfigurationError } from '../errors/wave-error.js';
2
+ /**
3
+ * Default retry policy.
4
+ *
5
+ * Two retries with a one-second base delay and full jitter follow Wave's own guidance to wait a
6
+ * few seconds between retries of idempotent operations.
7
+ */
8
+ export const DEFAULT_RETRY_OPTIONS = Object.freeze({
9
+ maxRetries: 2,
10
+ baseDelayMs: 1000,
11
+ maxDelayMs: 30000,
12
+ jitter: true,
13
+ });
14
+ /**
15
+ * Validates and fills a partial retry configuration.
16
+ *
17
+ * @param options - Partial retry configuration.
18
+ * @returns A complete, validated retry policy.
19
+ */
20
+ export function normalizeRetryOptions(options) {
21
+ const merged = { ...DEFAULT_RETRY_OPTIONS, ...options };
22
+ if (!Number.isInteger(merged.maxRetries) || merged.maxRetries < 0) {
23
+ throw new WaveConfigurationError('retry.maxRetries must be a non-negative integer.');
24
+ }
25
+ if (!Number.isFinite(merged.baseDelayMs) || merged.baseDelayMs < 0) {
26
+ throw new WaveConfigurationError('retry.baseDelayMs must be a non-negative finite number.');
27
+ }
28
+ if (!Number.isFinite(merged.maxDelayMs) || merged.maxDelayMs < 0) {
29
+ throw new WaveConfigurationError('retry.maxDelayMs must be a non-negative finite number.');
30
+ }
31
+ return merged;
32
+ }
33
+ /**
34
+ * Resolves the retry policy for one request.
35
+ *
36
+ * @param base - Client-level retry policy.
37
+ * @param override - Per-request override.
38
+ * @returns The effective policy, or `false` when retries are disabled.
39
+ */
40
+ export function resolveRetryOptions(base, override) {
41
+ if (override === false) {
42
+ return false;
43
+ }
44
+ if (override === undefined) {
45
+ return base;
46
+ }
47
+ if (base === false) {
48
+ return normalizeRetryOptions(override);
49
+ }
50
+ return normalizeRetryOptions({ ...base, ...override });
51
+ }
52
+ /**
53
+ * Whether a status code is safe to retry at the transport level.
54
+ *
55
+ * Wave documents retries for 408, 429 and 5xx responses; other 4xx responses are final.
56
+ *
57
+ * @param status - HTTP status code.
58
+ */
59
+ export function isRetryableStatus(status) {
60
+ return status === 408 || status === 429 || status >= 500;
61
+ }
62
+ /**
63
+ * Parses a `Retry-After` header value.
64
+ *
65
+ * Wave's documentation does not currently describe this header, so it is honoured only when
66
+ * present.
67
+ *
68
+ * @param value - Header value, either delay seconds or an HTTP date.
69
+ * @param nowMs - Current time in milliseconds; injectable for tests.
70
+ * @returns Delay in seconds, or `undefined` when missing or invalid.
71
+ */
72
+ export function parseRetryAfter(value, nowMs = Date.now()) {
73
+ if (value === undefined) {
74
+ return undefined;
75
+ }
76
+ const trimmed = value.trim();
77
+ if (trimmed.length === 0) {
78
+ return undefined;
79
+ }
80
+ const seconds = Number(trimmed);
81
+ if (Number.isFinite(seconds)) {
82
+ return seconds >= 0 ? Math.ceil(seconds) : undefined;
83
+ }
84
+ const dateMs = Date.parse(trimmed);
85
+ if (Number.isNaN(dateMs)) {
86
+ return undefined;
87
+ }
88
+ return Math.max(0, Math.ceil((dateMs - nowMs) / 1000));
89
+ }
90
+ //# sourceMappingURL=retry-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry-policy.js","sourceRoot":"","sources":["../../../src/core/retry/retry-policy.ts"],"names":[],"mappings":"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","sourcesContent":["import { WaveConfigurationError } from '../errors/wave-error.js';\nimport type { RetryOptions } from '../types/configuration.js';\n\n/**\n * Default retry policy.\n *\n * Two retries with a one-second base delay and full jitter follow Wave's own guidance to wait a\n * few seconds between retries of idempotent operations.\n */\nexport const DEFAULT_RETRY_OPTIONS: RetryOptions = Object.freeze({\n maxRetries: 2,\n baseDelayMs: 1000,\n maxDelayMs: 30000,\n jitter: true,\n});\n\n/**\n * Validates and fills a partial retry configuration.\n *\n * @param options - Partial retry configuration.\n * @returns A complete, validated retry policy.\n */\nexport function normalizeRetryOptions(options: Partial<RetryOptions>): RetryOptions {\n const merged: RetryOptions = { ...DEFAULT_RETRY_OPTIONS, ...options };\n\n if (!Number.isInteger(merged.maxRetries) || merged.maxRetries < 0) {\n throw new WaveConfigurationError('retry.maxRetries must be a non-negative integer.');\n }\n if (!Number.isFinite(merged.baseDelayMs) || merged.baseDelayMs < 0) {\n throw new WaveConfigurationError('retry.baseDelayMs must be a non-negative finite number.');\n }\n if (!Number.isFinite(merged.maxDelayMs) || merged.maxDelayMs < 0) {\n throw new WaveConfigurationError('retry.maxDelayMs must be a non-negative finite number.');\n }\n\n return merged;\n}\n\n/**\n * Resolves the retry policy for one request.\n *\n * @param base - Client-level retry policy.\n * @param override - Per-request override.\n * @returns The effective policy, or `false` when retries are disabled.\n */\nexport function resolveRetryOptions(\n base: RetryOptions | false,\n override: Partial<RetryOptions> | false | undefined,\n): RetryOptions | false {\n if (override === false) {\n return false;\n }\n if (override === undefined) {\n return base;\n }\n if (base === false) {\n return normalizeRetryOptions(override);\n }\n return normalizeRetryOptions({ ...base, ...override });\n}\n\n/**\n * Whether a status code is safe to retry at the transport level.\n *\n * Wave documents retries for 408, 429 and 5xx responses; other 4xx responses are final.\n *\n * @param status - HTTP status code.\n */\nexport function isRetryableStatus(status: number): boolean {\n return status === 408 || status === 429 || status >= 500;\n}\n\n/**\n * Parses a `Retry-After` header value.\n *\n * Wave's documentation does not currently describe this header, so it is honoured only when\n * present.\n *\n * @param value - Header value, either delay seconds or an HTTP date.\n * @param nowMs - Current time in milliseconds; injectable for tests.\n * @returns Delay in seconds, or `undefined` when missing or invalid.\n */\nexport function parseRetryAfter(\n value: string | undefined,\n nowMs: number = Date.now(),\n): number | undefined {\n if (value === undefined) {\n return undefined;\n }\n\n const trimmed = value.trim();\n if (trimmed.length === 0) {\n return undefined;\n }\n\n const seconds = Number(trimmed);\n if (Number.isFinite(seconds)) {\n return seconds >= 0 ? Math.ceil(seconds) : undefined;\n }\n\n const dateMs = Date.parse(trimmed);\n if (Number.isNaN(dateMs)) {\n return undefined;\n }\n return Math.max(0, Math.ceil((dateMs - nowMs) / 1000));\n}\n"]}
@@ -0,0 +1,59 @@
1
+ import type { JsonObject } from './json.js';
2
+ /**
3
+ * A monetary amount.
4
+ *
5
+ * Wave serializes amounts as strings to preserve precision; the SDK keeps that representation
6
+ * unchanged. The Payout API requires whole numbers, while the Balance and Checkout APIs allow up to
7
+ * two decimal places depending on the currency (XOF does not allow decimals).
8
+ */
9
+ export type Amount = string;
10
+ /**
11
+ * A currency identifier.
12
+ *
13
+ * Wave uses ISO 4217 three-letter uppercase codes, for example `XOF` for the West African Franc.
14
+ */
15
+ export type CurrencyCode = string;
16
+ /**
17
+ * A timestamp.
18
+ *
19
+ * Wave returns ISO 8601 UTC timestamps with second precision, for example `2022-06-20T17:17:11Z`.
20
+ */
21
+ export type Timestamp = string;
22
+ /**
23
+ * A phone number in E.164 format, including the leading `+` country code.
24
+ */
25
+ export type PhoneNumber = string;
26
+ /**
27
+ * Pagination information returned by cursor-paginated Wave endpoints.
28
+ */
29
+ export interface PageInfo {
30
+ /** Whether another page of results exists after the current one. */
31
+ readonly has_next_page: boolean;
32
+ /** Opaque cursor to pass as `after` on the next request, or `null` when unavailable. */
33
+ readonly end_cursor: string | null;
34
+ }
35
+ /**
36
+ * A cursor-paginated Wave response.
37
+ *
38
+ * @typeParam TItem - The item type returned by the endpoint; this varies per API.
39
+ */
40
+ export interface PaginatedResponse<TItem> {
41
+ /** Pagination state for the current page. */
42
+ readonly page_info: PageInfo;
43
+ /** Items in the current page. */
44
+ readonly items: readonly TItem[];
45
+ }
46
+ /**
47
+ * A single field-level validation error returned in a documented error envelope.
48
+ */
49
+ export interface ValidationErrorDetail {
50
+ /** Location of the offending value, for example `['currency']` or `['payments', 1, 'mobile']`. */
51
+ readonly loc: readonly (string | number)[];
52
+ /** Human-readable description of the validation problem. */
53
+ readonly msg: string;
54
+ /** Machine-readable validation error type, when provided. */
55
+ readonly type?: string;
56
+ /** Additional validation context, when provided. */
57
+ readonly ctx?: JsonObject;
58
+ }
59
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/core/types/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAE5B;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAElC;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AAEjC;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,oEAAoE;IACpE,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,wFAAwF;IACxF,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB,CAAC,KAAK;IACtC,6CAA6C;IAC7C,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;IAC7B,iCAAiC;IACjC,QAAQ,CAAC,KAAK,EAAE,SAAS,KAAK,EAAE,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,kGAAkG;IAClG,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC3C,4DAA4D;IAC5D,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,oDAAoD;IACpD,QAAQ,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC;CAC3B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/core/types/common.ts"],"names":[],"mappings":"","sourcesContent":["import type { JsonObject } from './json.js';\n\n/**\n * A monetary amount.\n *\n * Wave serializes amounts as strings to preserve precision; the SDK keeps that representation\n * unchanged. The Payout API requires whole numbers, while the Balance and Checkout APIs allow up to\n * two decimal places depending on the currency (XOF does not allow decimals).\n */\nexport type Amount = string;\n\n/**\n * A currency identifier.\n *\n * Wave uses ISO 4217 three-letter uppercase codes, for example `XOF` for the West African Franc.\n */\nexport type CurrencyCode = string;\n\n/**\n * A timestamp.\n *\n * Wave returns ISO 8601 UTC timestamps with second precision, for example `2022-06-20T17:17:11Z`.\n */\nexport type Timestamp = string;\n\n/**\n * A phone number in E.164 format, including the leading `+` country code.\n */\nexport type PhoneNumber = string;\n\n/**\n * Pagination information returned by cursor-paginated Wave endpoints.\n */\nexport interface PageInfo {\n /** Whether another page of results exists after the current one. */\n readonly has_next_page: boolean;\n /** Opaque cursor to pass as `after` on the next request, or `null` when unavailable. */\n readonly end_cursor: string | null;\n}\n\n/**\n * A cursor-paginated Wave response.\n *\n * @typeParam TItem - The item type returned by the endpoint; this varies per API.\n */\nexport interface PaginatedResponse<TItem> {\n /** Pagination state for the current page. */\n readonly page_info: PageInfo;\n /** Items in the current page. */\n readonly items: readonly TItem[];\n}\n\n/**\n * A single field-level validation error returned in a documented error envelope.\n */\nexport interface ValidationErrorDetail {\n /** Location of the offending value, for example `['currency']` or `['payments', 1, 'mobile']`. */\n readonly loc: readonly (string | number)[];\n /** Human-readable description of the validation problem. */\n readonly msg: string;\n /** Machine-readable validation error type, when provided. */\n readonly type?: string;\n /** Additional validation context, when provided. */\n readonly ctx?: JsonObject;\n}\n"]}
@@ -0,0 +1,82 @@
1
+ import type { WaveTransport } from '../http/transport.js';
2
+ /**
3
+ * Retry policy configuration.
4
+ */
5
+ export interface RetryOptions {
6
+ /** Maximum number of retries after the initial attempt. */
7
+ readonly maxRetries: number;
8
+ /** Base delay before the first retry, in milliseconds. */
9
+ readonly baseDelayMs: number;
10
+ /** Upper bound for any single backoff delay, in milliseconds. */
11
+ readonly maxDelayMs: number;
12
+ /** Whether to apply full jitter to computed delays. */
13
+ readonly jitter: boolean;
14
+ }
15
+ /**
16
+ * Structured logger used for request diagnostics.
17
+ *
18
+ * The SDK only passes request metadata (method, path, status, attempt, duration). It never passes
19
+ * headers, bodies, API keys, signing secrets or webhook secrets.
20
+ */
21
+ export interface WaveLogger {
22
+ /** Diagnostic detail useful while integrating. */
23
+ debug?(message: string, meta?: Readonly<Record<string, unknown>>): void;
24
+ /** Non-fatal information, such as a scheduled retry. */
25
+ info?(message: string, meta?: Readonly<Record<string, unknown>>): void;
26
+ /** Recoverable problem, such as a retry after a server error. */
27
+ warn?(message: string, meta?: Readonly<Record<string, unknown>>): void;
28
+ /** Fatal problem for a single request. */
29
+ error?(message: string, meta?: Readonly<Record<string, unknown>>): void;
30
+ }
31
+ /**
32
+ * Configuration for {@link WaveClient}.
33
+ */
34
+ export interface WaveClientOptions {
35
+ /**
36
+ * Wave Business API key, sent as `Authorization: Bearer <apiKey>`.
37
+ *
38
+ * The SDK is intended for trusted server-side environments; never expose this key in browser or
39
+ * mobile bundles.
40
+ */
41
+ readonly apiKey: string;
42
+ /**
43
+ * Signing secret configured on the API key, used to send `Wave-Signature` on every request.
44
+ *
45
+ * When omitted, no signature header is generated.
46
+ */
47
+ readonly signingSecret?: string;
48
+ /** Base URL of the API; defaults to `https://api.wave.com`. */
49
+ readonly baseUrl?: string;
50
+ /** Per-request timeout in milliseconds; defaults to 30000. */
51
+ readonly timeoutMs?: number;
52
+ /** Retry policy, or `false` to disable retries. Defaults to two retries. */
53
+ readonly retry?: Partial<RetryOptions> | false;
54
+ /** Custom transport; defaults to a global-fetch transport. */
55
+ readonly transport?: WaveTransport;
56
+ /** Optional diagnostics logger that never receives secrets. */
57
+ readonly logger?: WaveLogger;
58
+ }
59
+ /**
60
+ * Per-request overrides.
61
+ */
62
+ export interface RequestOptions {
63
+ /** Timeout for this request in milliseconds. */
64
+ readonly timeoutMs?: number;
65
+ /** Caller abort signal; aborting rejects with `WaveAbortError`. */
66
+ readonly signal?: AbortSignal;
67
+ /**
68
+ * Idempotency key for this logical operation.
69
+ *
70
+ * When omitted, the SDK generates a random UUID for operations that require one and reuses that
71
+ * key for every retry of the same call.
72
+ */
73
+ readonly idempotencyKey?: string;
74
+ /**
75
+ * Retry overrides for this request.
76
+ *
77
+ * Passing a value for a non-idempotent operation asserts that retrying is safe; the SDK does not
78
+ * make that judgement for you.
79
+ */
80
+ readonly retry?: Partial<RetryOptions> | false;
81
+ }
82
+ //# sourceMappingURL=configuration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../src/core/types/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,2DAA2D;IAC3D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,0DAA0D;IAC1D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,uDAAuD;IACvD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,kDAAkD;IAClD,KAAK,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IACxE,wDAAwD;IACxD,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IACvE,iEAAiE;IACjE,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IACvE,0CAA0C;IAC1C,KAAK,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;CACzE;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,8DAA8D;IAC9D,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC;IAC/C,8DAA8D;IAC9D,QAAQ,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC;IACnC,+DAA+D;IAC/D,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,gDAAgD;IAChD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,mEAAmE;IACnE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC;CAChD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=configuration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../src/core/types/configuration.ts"],"names":[],"mappings":"","sourcesContent":["import type { WaveTransport } from '../http/transport.js';\n\n/**\n * Retry policy configuration.\n */\nexport interface RetryOptions {\n /** Maximum number of retries after the initial attempt. */\n readonly maxRetries: number;\n /** Base delay before the first retry, in milliseconds. */\n readonly baseDelayMs: number;\n /** Upper bound for any single backoff delay, in milliseconds. */\n readonly maxDelayMs: number;\n /** Whether to apply full jitter to computed delays. */\n readonly jitter: boolean;\n}\n\n/**\n * Structured logger used for request diagnostics.\n *\n * The SDK only passes request metadata (method, path, status, attempt, duration). It never passes\n * headers, bodies, API keys, signing secrets or webhook secrets.\n */\nexport interface WaveLogger {\n /** Diagnostic detail useful while integrating. */\n debug?(message: string, meta?: Readonly<Record<string, unknown>>): void;\n /** Non-fatal information, such as a scheduled retry. */\n info?(message: string, meta?: Readonly<Record<string, unknown>>): void;\n /** Recoverable problem, such as a retry after a server error. */\n warn?(message: string, meta?: Readonly<Record<string, unknown>>): void;\n /** Fatal problem for a single request. */\n error?(message: string, meta?: Readonly<Record<string, unknown>>): void;\n}\n\n/**\n * Configuration for {@link WaveClient}.\n */\nexport interface WaveClientOptions {\n /**\n * Wave Business API key, sent as `Authorization: Bearer <apiKey>`.\n *\n * The SDK is intended for trusted server-side environments; never expose this key in browser or\n * mobile bundles.\n */\n readonly apiKey: string;\n /**\n * Signing secret configured on the API key, used to send `Wave-Signature` on every request.\n *\n * When omitted, no signature header is generated.\n */\n readonly signingSecret?: string;\n /** Base URL of the API; defaults to `https://api.wave.com`. */\n readonly baseUrl?: string;\n /** Per-request timeout in milliseconds; defaults to 30000. */\n readonly timeoutMs?: number;\n /** Retry policy, or `false` to disable retries. Defaults to two retries. */\n readonly retry?: Partial<RetryOptions> | false;\n /** Custom transport; defaults to a global-fetch transport. */\n readonly transport?: WaveTransport;\n /** Optional diagnostics logger that never receives secrets. */\n readonly logger?: WaveLogger;\n}\n\n/**\n * Per-request overrides.\n */\nexport interface RequestOptions {\n /** Timeout for this request in milliseconds. */\n readonly timeoutMs?: number;\n /** Caller abort signal; aborting rejects with `WaveAbortError`. */\n readonly signal?: AbortSignal;\n /**\n * Idempotency key for this logical operation.\n *\n * When omitted, the SDK generates a random UUID for operations that require one and reuses that\n * key for every retry of the same call.\n */\n readonly idempotencyKey?: string;\n /**\n * Retry overrides for this request.\n *\n * Passing a value for a non-idempotent operation asserts that retrying is safe; the SDK does not\n * make that judgement for you.\n */\n readonly retry?: Partial<RetryOptions> | false;\n}\n"]}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * A JSON primitive value.
3
+ */
4
+ export type JsonPrimitive = string | number | boolean | null;
5
+ /**
6
+ * Any value representable in JSON.
7
+ */
8
+ export type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
9
+ /**
10
+ * A JSON object with string keys.
11
+ */
12
+ export interface JsonObject {
13
+ readonly [key: string]: JsonValue;
14
+ }
15
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../src/core/types/json.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAE7D;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,UAAU,GAAG,SAAS,EAAE,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/core/types/json.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A JSON primitive value.\n */\nexport type JsonPrimitive = string | number | boolean | null;\n\n/**\n * Any value representable in JSON.\n */\nexport type JsonValue = JsonPrimitive | JsonObject | JsonValue[];\n\n/**\n * A JSON object with string keys.\n */\nexport interface JsonObject {\n readonly [key: string]: JsonValue;\n}\n"]}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Unified, strongly typed SDK for the Wave Business APIs.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ export { WaveClient } from './client/wave-client.js';
7
+ export type { RetryOptions, RequestOptions, WaveClientOptions, WaveLogger, } from './core/types/configuration.js';
8
+ export type { Amount, CurrencyCode, PageInfo, PaginatedResponse, PhoneNumber, Timestamp, ValidationErrorDetail, } from './core/types/common.js';
9
+ export type { JsonObject, JsonPrimitive, JsonValue } from './core/types/json.js';
10
+ export type { FetchLike } from './core/http/fetch-transport.js';
11
+ export { FetchTransport } from './core/http/fetch-transport.js';
12
+ export type { TransportRequest, TransportResponse, WaveTransport } from './core/http/transport.js';
13
+ export { DEFAULT_BASE_URL, DEFAULT_TIMEOUT_MS } from './core/http/http-client.js';
14
+ export { WaveConfigurationError, WaveError } from './core/errors/wave-error.js';
15
+ export type { WaveErrorOptions } from './core/errors/wave-error.js';
16
+ export { WaveApiError, WaveAuthenticationError, WaveAuthorizationError, WaveConflictError, WaveNotFoundError, WaveRateLimitError, WaveServerError, WaveValidationError, } from './core/errors/wave-api-error.js';
17
+ export type { WaveApiErrorOptions, WaveRateLimitErrorOptions, } from './core/errors/wave-api-error.js';
18
+ export { WaveAbortError, WaveNetworkError, WaveTimeoutError, } from './core/errors/wave-network-error.js';
19
+ export { WaveWebhookVerificationError } from './core/errors/wave-webhook-verification-error.js';
20
+ export type { WebhookVerificationFailureReason } from './core/errors/wave-webhook-verification-error.js';
21
+ export { REDACTED, redactSecrets } from './core/errors/redact.js';
22
+ export { DEFAULT_RETRY_OPTIONS } from './core/retry/retry-policy.js';
23
+ export { MAX_IDEMPOTENCY_KEY_LENGTH, generateIdempotencyKey, } from './core/idempotency/idempotency.js';
24
+ export { PayoutsResource } from './resources/payouts/payouts.js';
25
+ export type { CreatePayoutBatchRequest, CreatePayoutBatchResponse, CreatePayoutRequest, NameMatch, NationalIdMatch, Payout, PayoutBatch, PayoutBatchStatus, PayoutError, PayoutStatus, RecipientVerification, SearchPayoutsQuery, SearchPayoutsResponse, VerifyRecipientRequest, } from './resources/payouts/payout-types.js';
26
+ export { PayoutBatchesResource } from './resources/payout-batches/payout-batches.js';
27
+ export { BalanceResource } from './resources/balance/balance.js';
28
+ export type { Balance, RetrieveBalanceQuery } from './resources/balance/balance-types.js';
29
+ export { ReconciliationResource } from './resources/reconciliation/reconciliation.js';
30
+ export type { ListTransactionsQuery, Transaction, TransactionPage, TransactionType, } from './resources/reconciliation/reconciliation-types.js';
31
+ export { CheckoutResource } from './resources/checkout/checkout.js';
32
+ export type { CheckoutPaymentError, CheckoutSession, CheckoutStatus, CreateCheckoutSessionRequest, PaymentStatus, SearchCheckoutSessionsQuery, SearchCheckoutSessionsResponse, } from './resources/checkout/checkout-types.js';
33
+ export { AggregatedMerchantsResource } from './resources/aggregated-merchants/aggregated-merchants.js';
34
+ export type { AggregatedMerchant, AggregatedMerchantRequest, AggregatedMerchantsPage, BusinessType, FeeStructure, ListAggregatedMerchantsQuery, } from './resources/aggregated-merchants/aggregated-merchant-types.js';
35
+ export { DEFAULT_WEBHOOK_TOLERANCE_SECONDS, WaveWebhooks, computeWebhookSignature, constructWaveWebhookEvent, parseWebhookSignatureHeader, verifyWaveWebhookSharedSecret, verifyWaveWebhookSignature, } from './resources/webhooks/webhook-verifier.js';
36
+ export type { VerifySharedSecretInput, VerifyWebhookSignatureInput, } from './resources/webhooks/webhook-verifier.js';
37
+ export { isKnownWebhookEventType, toKnownWebhookEvent, } from './resources/webhooks/webhook-types.js';
38
+ export type { B2BPaymentFailedEvent, B2BPaymentReceivedEvent, B2BPaymentReceivedEventData, CheckoutSessionCompletedEvent, CheckoutSessionCompletedEventData, CheckoutSessionPaymentFailedEvent, CheckoutSessionPaymentFailedEventData, KnownWebhookEvent, KnownWebhookEventType, MerchantPaymentReceivedEvent, MerchantPaymentReceivedEventData, RemittanceDeliveredEvent, RemittanceReversedEvent, TestWebhookEvent, WebhookEvent, } from './resources/webhooks/webhook-types.js';
39
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
package/dist/index.js ADDED
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Unified, strongly typed SDK for the Wave Business APIs.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ export { WaveClient } from './client/wave-client.js';
7
+ export { FetchTransport } from './core/http/fetch-transport.js';
8
+ export { DEFAULT_BASE_URL, DEFAULT_TIMEOUT_MS } from './core/http/http-client.js';
9
+ export { WaveConfigurationError, WaveError } from './core/errors/wave-error.js';
10
+ export { WaveApiError, WaveAuthenticationError, WaveAuthorizationError, WaveConflictError, WaveNotFoundError, WaveRateLimitError, WaveServerError, WaveValidationError, } from './core/errors/wave-api-error.js';
11
+ export { WaveAbortError, WaveNetworkError, WaveTimeoutError, } from './core/errors/wave-network-error.js';
12
+ export { WaveWebhookVerificationError } from './core/errors/wave-webhook-verification-error.js';
13
+ export { REDACTED, redactSecrets } from './core/errors/redact.js';
14
+ export { DEFAULT_RETRY_OPTIONS } from './core/retry/retry-policy.js';
15
+ export { MAX_IDEMPOTENCY_KEY_LENGTH, generateIdempotencyKey, } from './core/idempotency/idempotency.js';
16
+ export { PayoutsResource } from './resources/payouts/payouts.js';
17
+ export { PayoutBatchesResource } from './resources/payout-batches/payout-batches.js';
18
+ export { BalanceResource } from './resources/balance/balance.js';
19
+ export { ReconciliationResource } from './resources/reconciliation/reconciliation.js';
20
+ export { CheckoutResource } from './resources/checkout/checkout.js';
21
+ export { AggregatedMerchantsResource } from './resources/aggregated-merchants/aggregated-merchants.js';
22
+ export { DEFAULT_WEBHOOK_TOLERANCE_SECONDS, WaveWebhooks, computeWebhookSignature, constructWaveWebhookEvent, parseWebhookSignatureHeader, verifyWaveWebhookSharedSecret, verifyWaveWebhookSignature, } from './resources/webhooks/webhook-verifier.js';
23
+ export { isKnownWebhookEventType, toKnownWebhookEvent, } from './resources/webhooks/webhook-types.js';
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAoBrD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAElF,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAEhF,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AAKzC,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,4BAA4B,EAAE,MAAM,kDAAkD,CAAC;AAEhG,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAiBjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAErF,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAGjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAQtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAWpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,0DAA0D,CAAC;AAUvG,OAAO,EACL,iCAAiC,EACjC,YAAY,EACZ,uBAAuB,EACvB,yBAAyB,EACzB,2BAA2B,EAC3B,6BAA6B,EAC7B,0BAA0B,GAC3B,MAAM,0CAA0C,CAAC;AAKlD,OAAO,EACL,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,uCAAuC,CAAC","sourcesContent":["/**\n * Unified, strongly typed SDK for the Wave Business APIs.\n *\n * @packageDocumentation\n */\n\nexport { WaveClient } from './client/wave-client.js';\n\nexport type {\n RetryOptions,\n RequestOptions,\n WaveClientOptions,\n WaveLogger,\n} from './core/types/configuration.js';\nexport type {\n Amount,\n CurrencyCode,\n PageInfo,\n PaginatedResponse,\n PhoneNumber,\n Timestamp,\n ValidationErrorDetail,\n} from './core/types/common.js';\nexport type { JsonObject, JsonPrimitive, JsonValue } from './core/types/json.js';\n\nexport type { FetchLike } from './core/http/fetch-transport.js';\nexport { FetchTransport } from './core/http/fetch-transport.js';\nexport type { TransportRequest, TransportResponse, WaveTransport } from './core/http/transport.js';\nexport { DEFAULT_BASE_URL, DEFAULT_TIMEOUT_MS } from './core/http/http-client.js';\n\nexport { WaveConfigurationError, WaveError } from './core/errors/wave-error.js';\nexport type { WaveErrorOptions } from './core/errors/wave-error.js';\nexport {\n WaveApiError,\n WaveAuthenticationError,\n WaveAuthorizationError,\n WaveConflictError,\n WaveNotFoundError,\n WaveRateLimitError,\n WaveServerError,\n WaveValidationError,\n} from './core/errors/wave-api-error.js';\nexport type {\n WaveApiErrorOptions,\n WaveRateLimitErrorOptions,\n} from './core/errors/wave-api-error.js';\nexport {\n WaveAbortError,\n WaveNetworkError,\n WaveTimeoutError,\n} from './core/errors/wave-network-error.js';\nexport { WaveWebhookVerificationError } from './core/errors/wave-webhook-verification-error.js';\nexport type { WebhookVerificationFailureReason } from './core/errors/wave-webhook-verification-error.js';\nexport { REDACTED, redactSecrets } from './core/errors/redact.js';\n\nexport { DEFAULT_RETRY_OPTIONS } from './core/retry/retry-policy.js';\nexport {\n MAX_IDEMPOTENCY_KEY_LENGTH,\n generateIdempotencyKey,\n} from './core/idempotency/idempotency.js';\n\nexport { PayoutsResource } from './resources/payouts/payouts.js';\nexport type {\n CreatePayoutBatchRequest,\n CreatePayoutBatchResponse,\n CreatePayoutRequest,\n NameMatch,\n NationalIdMatch,\n Payout,\n PayoutBatch,\n PayoutBatchStatus,\n PayoutError,\n PayoutStatus,\n RecipientVerification,\n SearchPayoutsQuery,\n SearchPayoutsResponse,\n VerifyRecipientRequest,\n} from './resources/payouts/payout-types.js';\nexport { PayoutBatchesResource } from './resources/payout-batches/payout-batches.js';\n\nexport { BalanceResource } from './resources/balance/balance.js';\nexport type { Balance, RetrieveBalanceQuery } from './resources/balance/balance-types.js';\n\nexport { ReconciliationResource } from './resources/reconciliation/reconciliation.js';\nexport type {\n ListTransactionsQuery,\n Transaction,\n TransactionPage,\n TransactionType,\n} from './resources/reconciliation/reconciliation-types.js';\n\nexport { CheckoutResource } from './resources/checkout/checkout.js';\nexport type {\n CheckoutPaymentError,\n CheckoutSession,\n CheckoutStatus,\n CreateCheckoutSessionRequest,\n PaymentStatus,\n SearchCheckoutSessionsQuery,\n SearchCheckoutSessionsResponse,\n} from './resources/checkout/checkout-types.js';\n\nexport { AggregatedMerchantsResource } from './resources/aggregated-merchants/aggregated-merchants.js';\nexport type {\n AggregatedMerchant,\n AggregatedMerchantRequest,\n AggregatedMerchantsPage,\n BusinessType,\n FeeStructure,\n ListAggregatedMerchantsQuery,\n} from './resources/aggregated-merchants/aggregated-merchant-types.js';\n\nexport {\n DEFAULT_WEBHOOK_TOLERANCE_SECONDS,\n WaveWebhooks,\n computeWebhookSignature,\n constructWaveWebhookEvent,\n parseWebhookSignatureHeader,\n verifyWaveWebhookSharedSecret,\n verifyWaveWebhookSignature,\n} from './resources/webhooks/webhook-verifier.js';\nexport type {\n VerifySharedSecretInput,\n VerifyWebhookSignatureInput,\n} from './resources/webhooks/webhook-verifier.js';\nexport {\n isKnownWebhookEventType,\n toKnownWebhookEvent,\n} from './resources/webhooks/webhook-types.js';\nexport type {\n B2BPaymentFailedEvent,\n B2BPaymentReceivedEvent,\n B2BPaymentReceivedEventData,\n CheckoutSessionCompletedEvent,\n CheckoutSessionCompletedEventData,\n CheckoutSessionPaymentFailedEvent,\n CheckoutSessionPaymentFailedEventData,\n KnownWebhookEvent,\n KnownWebhookEventType,\n MerchantPaymentReceivedEvent,\n MerchantPaymentReceivedEventData,\n RemittanceDeliveredEvent,\n RemittanceReversedEvent,\n TestWebhookEvent,\n WebhookEvent,\n} from './resources/webhooks/webhook-types.js';\n"]}
@@ -0,0 +1,82 @@
1
+ import type { PaginatedResponse, Timestamp } from '../../core/types/common.js';
2
+ /**
3
+ * Documented aggregated merchant business types.
4
+ */
5
+ export type BusinessType = 'fintech' | 'other';
6
+ /**
7
+ * Documented aggregated merchant fee structures.
8
+ */
9
+ export type FeeStructure = 'one_percent' | 'one_fifty_bps' | 'two_percent';
10
+ /**
11
+ * Request body for creating or updating an aggregated merchant.
12
+ */
13
+ export interface AggregatedMerchantRequest {
14
+ /** Unique merchant name, up to 255 characters. */
15
+ readonly name: string;
16
+ /** Asserted business type. */
17
+ readonly business_type: BusinessType;
18
+ /** Description of the business. */
19
+ readonly business_description: string;
20
+ /** Business registration information, up to 255 characters. */
21
+ readonly business_registration_identifier?: string;
22
+ /** Free-form business sector, up to 255 characters. */
23
+ readonly business_sector?: string;
24
+ /** Website URL, up to 2083 characters. */
25
+ readonly website_url?: string;
26
+ /** Name of the business manager. */
27
+ readonly manager_name?: string;
28
+ }
29
+ /**
30
+ * An aggregated merchant returned by the API.
31
+ */
32
+ export interface AggregatedMerchant {
33
+ /** Unique identifier, up to 20 characters. */
34
+ readonly id: string;
35
+ /** Merchant name. */
36
+ readonly name: string;
37
+ /** Asserted business type. */
38
+ readonly business_type: BusinessType;
39
+ /** Description of the business. */
40
+ readonly business_description: string;
41
+ /** Fee structure used for payouts. */
42
+ readonly payout_fee_structure_name: FeeStructure;
43
+ /** Fee structure used for checkouts. */
44
+ readonly checkout_fee_structure_name: FeeStructure;
45
+ /** Whether Wave locked further updates to this merchant. */
46
+ readonly is_locked: boolean;
47
+ /** When the merchant was created. */
48
+ readonly when_created: Timestamp;
49
+ /**
50
+ * Business registration identifier.
51
+ *
52
+ * Wave's response table names this field `business_registration_id`, while its examples return
53
+ * `business_registration_identifier`. Both are typed as optional so either shape is accepted.
54
+ */
55
+ readonly business_registration_id?: string;
56
+ /**
57
+ * Business registration identifier as returned by Wave's examples.
58
+ *
59
+ * @see business_registration_id
60
+ */
61
+ readonly business_registration_identifier?: string;
62
+ /** Free-form business sector; can be `null` when not provided. */
63
+ readonly business_sector?: string | null;
64
+ /** Website URL, when provided. */
65
+ readonly website_url?: string;
66
+ /** Business manager name, when provided. */
67
+ readonly manager_name?: string;
68
+ }
69
+ /**
70
+ * Cursor-paginated aggregated merchant response.
71
+ */
72
+ export type AggregatedMerchantsPage = PaginatedResponse<AggregatedMerchant>;
73
+ /**
74
+ * Query parameters for `GET /v1/aggregated_merchants`.
75
+ */
76
+ export interface ListAggregatedMerchantsQuery {
77
+ /** Maximum number of items to retrieve. */
78
+ readonly first?: number;
79
+ /** Opaque cursor from the previous page. */
80
+ readonly after?: string;
81
+ }
82
+ //# sourceMappingURL=aggregated-merchant-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregated-merchant-types.d.ts","sourceRoot":"","sources":["../../../src/resources/aggregated-merchants/aggregated-merchant-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE/E;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,CAAC;AAE/C;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,eAAe,GAAG,aAAa,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,kDAAkD;IAClD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,8BAA8B;IAC9B,QAAQ,CAAC,aAAa,EAAE,YAAY,CAAC;IACrC,mCAAmC;IACnC,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,+DAA+D;IAC/D,QAAQ,CAAC,gCAAgC,CAAC,EAAE,MAAM,CAAC;IACnD,uDAAuD;IACvD,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,0CAA0C;IAC1C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,oCAAoC;IACpC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,qBAAqB;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,8BAA8B;IAC9B,QAAQ,CAAC,aAAa,EAAE,YAAY,CAAC;IACrC,mCAAmC;IACnC,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,sCAAsC;IACtC,QAAQ,CAAC,yBAAyB,EAAE,YAAY,CAAC;IACjD,wCAAwC;IACxC,QAAQ,CAAC,2BAA2B,EAAE,YAAY,CAAC;IACnD,4DAA4D;IAC5D,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,qCAAqC;IACrC,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAC;IACjC;;;;;OAKG;IACH,QAAQ,CAAC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,gCAAgC,CAAC,EAAE,MAAM,CAAC;IACnD,kEAAkE;IAClE,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,kCAAkC;IAClC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,4CAA4C;IAC5C,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,2CAA2C;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,4CAA4C;IAC5C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=aggregated-merchant-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregated-merchant-types.js","sourceRoot":"","sources":["../../../src/resources/aggregated-merchants/aggregated-merchant-types.ts"],"names":[],"mappings":"","sourcesContent":["import type { PaginatedResponse, Timestamp } from '../../core/types/common.js';\n\n/**\n * Documented aggregated merchant business types.\n */\nexport type BusinessType = 'fintech' | 'other';\n\n/**\n * Documented aggregated merchant fee structures.\n */\nexport type FeeStructure = 'one_percent' | 'one_fifty_bps' | 'two_percent';\n\n/**\n * Request body for creating or updating an aggregated merchant.\n */\nexport interface AggregatedMerchantRequest {\n /** Unique merchant name, up to 255 characters. */\n readonly name: string;\n /** Asserted business type. */\n readonly business_type: BusinessType;\n /** Description of the business. */\n readonly business_description: string;\n /** Business registration information, up to 255 characters. */\n readonly business_registration_identifier?: string;\n /** Free-form business sector, up to 255 characters. */\n readonly business_sector?: string;\n /** Website URL, up to 2083 characters. */\n readonly website_url?: string;\n /** Name of the business manager. */\n readonly manager_name?: string;\n}\n\n/**\n * An aggregated merchant returned by the API.\n */\nexport interface AggregatedMerchant {\n /** Unique identifier, up to 20 characters. */\n readonly id: string;\n /** Merchant name. */\n readonly name: string;\n /** Asserted business type. */\n readonly business_type: BusinessType;\n /** Description of the business. */\n readonly business_description: string;\n /** Fee structure used for payouts. */\n readonly payout_fee_structure_name: FeeStructure;\n /** Fee structure used for checkouts. */\n readonly checkout_fee_structure_name: FeeStructure;\n /** Whether Wave locked further updates to this merchant. */\n readonly is_locked: boolean;\n /** When the merchant was created. */\n readonly when_created: Timestamp;\n /**\n * Business registration identifier.\n *\n * Wave's response table names this field `business_registration_id`, while its examples return\n * `business_registration_identifier`. Both are typed as optional so either shape is accepted.\n */\n readonly business_registration_id?: string;\n /**\n * Business registration identifier as returned by Wave's examples.\n *\n * @see business_registration_id\n */\n readonly business_registration_identifier?: string;\n /** Free-form business sector; can be `null` when not provided. */\n readonly business_sector?: string | null;\n /** Website URL, when provided. */\n readonly website_url?: string;\n /** Business manager name, when provided. */\n readonly manager_name?: string;\n}\n\n/**\n * Cursor-paginated aggregated merchant response.\n */\nexport type AggregatedMerchantsPage = PaginatedResponse<AggregatedMerchant>;\n\n/**\n * Query parameters for `GET /v1/aggregated_merchants`.\n */\nexport interface ListAggregatedMerchantsQuery {\n /** Maximum number of items to retrieve. */\n readonly first?: number;\n /** Opaque cursor from the previous page. */\n readonly after?: string;\n}\n"]}
@@ -0,0 +1,67 @@
1
+ import type { HttpClient } from '../../core/http/http-client.js';
2
+ import type { RequestOptions } from '../../core/types/configuration.js';
3
+ import type { AggregatedMerchant, AggregatedMerchantRequest, AggregatedMerchantsPage, ListAggregatedMerchantsQuery } from './aggregated-merchant-types.js';
4
+ /**
5
+ * Aggregated Merchants API operations.
6
+ */
7
+ export declare class AggregatedMerchantsResource {
8
+ #private;
9
+ /** @param http - Shared HTTP pipeline. */
10
+ constructor(http: HttpClient);
11
+ /**
12
+ * Retrieves a page of aggregated merchants available to the account.
13
+ *
14
+ * @param query - Cursor pagination parameters.
15
+ * @param options - Per-request overrides.
16
+ * @returns One page of aggregated merchants.
17
+ */
18
+ list(query?: ListAggregatedMerchantsQuery, options?: RequestOptions): Promise<AggregatedMerchantsPage>;
19
+ /**
20
+ * Iterates every aggregated merchant, following pagination cursors.
21
+ *
22
+ * @param query - Cursor and page-size options; `after` is managed automatically.
23
+ * @param options - Per-request overrides applied to every page request.
24
+ * @yields Each aggregated merchant.
25
+ */
26
+ iterate(query?: ListAggregatedMerchantsQuery, options?: RequestOptions): AsyncGenerator<AggregatedMerchant, void, undefined>;
27
+ /**
28
+ * Creates an aggregated merchant.
29
+ *
30
+ * Merchant names must be unique. Wave does not document an idempotency mechanism for this
31
+ * endpoint, so the SDK never retries it automatically.
32
+ *
33
+ * @param request - Merchant details.
34
+ * @param options - Per-request overrides.
35
+ * @returns The created merchant.
36
+ */
37
+ create(request: AggregatedMerchantRequest, options?: RequestOptions): Promise<AggregatedMerchant>;
38
+ /**
39
+ * Retrieves a single aggregated merchant.
40
+ *
41
+ * @param merchantId - Merchant identifier starting with `am-`.
42
+ * @param options - Per-request overrides.
43
+ * @returns The aggregated merchant.
44
+ */
45
+ retrieve(merchantId: string, options?: RequestOptions): Promise<AggregatedMerchant>;
46
+ /**
47
+ * Updates an aggregated merchant.
48
+ *
49
+ * Wave returns HTTP 403 with `record-locked` once the merchant is locked after review.
50
+ *
51
+ * @param merchantId - Merchant identifier starting with `am-`.
52
+ * @param request - Replacement merchant details.
53
+ * @param options - Per-request overrides.
54
+ * @returns The updated merchant.
55
+ */
56
+ update(merchantId: string, request: AggregatedMerchantRequest, options?: RequestOptions): Promise<AggregatedMerchant>;
57
+ /**
58
+ * Deletes an aggregated merchant.
59
+ *
60
+ * Wave returns HTTP 204 with no body on success.
61
+ *
62
+ * @param merchantId - Merchant identifier starting with `am-`.
63
+ * @param options - Per-request overrides.
64
+ */
65
+ delete(merchantId: string, options?: RequestOptions): Promise<void>;
66
+ }
67
+ //# sourceMappingURL=aggregated-merchants.d.ts.map