@getmanza/sdk 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +74 -18
  3. package/dist/client.d.ts +14 -6
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/env.d.ts +3 -0
  6. package/dist/env.d.ts.map +1 -0
  7. package/dist/errors.d.ts +15 -15
  8. package/dist/errors.d.ts.map +1 -1
  9. package/dist/index.cjs +203 -66
  10. package/dist/index.d.ts +6 -3
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +203 -66
  13. package/dist/page.d.ts +3 -3
  14. package/dist/page.d.ts.map +1 -1
  15. package/dist/resources/accounts.d.ts +3 -3
  16. package/dist/resources/accounts.d.ts.map +1 -1
  17. package/dist/resources/base.d.ts +8 -8
  18. package/dist/resources/base.d.ts.map +1 -1
  19. package/dist/resources/beneficiaries.d.ts +5 -5
  20. package/dist/resources/beneficiaries.d.ts.map +1 -1
  21. package/dist/resources/checkout_sessions.d.ts +3 -3
  22. package/dist/resources/checkout_sessions.d.ts.map +1 -1
  23. package/dist/resources/customers.d.ts +5 -5
  24. package/dist/resources/customers.d.ts.map +1 -1
  25. package/dist/resources/entity.d.ts +2 -2
  26. package/dist/resources/entity.d.ts.map +1 -1
  27. package/dist/resources/invoices.d.ts +10 -10
  28. package/dist/resources/invoices.d.ts.map +1 -1
  29. package/dist/resources/payee_trust_requests.d.ts +3 -3
  30. package/dist/resources/payee_trust_requests.d.ts.map +1 -1
  31. package/dist/resources/payment_links.d.ts +4 -4
  32. package/dist/resources/payment_links.d.ts.map +1 -1
  33. package/dist/resources/payments.d.ts +15 -0
  34. package/dist/resources/payments.d.ts.map +1 -0
  35. package/dist/resources/transfer_authorizer.d.ts +6 -0
  36. package/dist/resources/transfer_authorizer.d.ts.map +1 -0
  37. package/dist/resources/transfer_drafts.d.ts +8 -14
  38. package/dist/resources/transfer_drafts.d.ts.map +1 -1
  39. package/dist/resources/webhook_endpoints.d.ts +9 -9
  40. package/dist/resources/webhook_endpoints.d.ts.map +1 -1
  41. package/dist/response.d.ts +1 -1
  42. package/dist/response.d.ts.map +1 -1
  43. package/dist/version.d.ts +1 -1
  44. package/dist/webhook.d.ts +32 -0
  45. package/dist/webhook.d.ts.map +1 -0
  46. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -7,6 +7,63 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.1.0]
11
+
12
+ Mirrors manza-ruby 1.3.0 (with 1.2.0) and replays `cassettes-v1.3.0`.
13
+
14
+ ### Added
15
+
16
+ - `Webhook` verifies incoming webhook deliveries: `Webhook.verify` (resolves
17
+ to a boolean), `Webhook.constructEvent` (resolves to the parsed event,
18
+ rejects with `ManzaArgumentError`) and `Webhook.sign`. Reads
19
+ `X-Manza-Signature` / `X-Manza-Timestamp` in any case from a Fetch
20
+ `Headers` or a plain object (Node's `req.headers`), with the legacy
21
+ `X-Zazu-*` names as a fallback; compares in constant time and checks the
22
+ timestamp within 5 minutes (`tolerance: null` skips it, for local replay
23
+ only). Async, on Web Crypto. Passes the shared fixed vector every SDK
24
+ reuses. No new error class.
25
+ - `manza.payments` (`Payments`): `create`, `get`, `authorize` and
26
+ `decline` on the API's canonical paths, `POST /api/payments`,
27
+ `GET /api/payments/:id`, `POST /api/payments/:id/authorize` and
28
+ `POST /api/payments/:id/decline`. The API renamed transfer drafts to
29
+ payments; request and response bodies are unchanged, and so is the
30
+ `TransferAuthorization` signature input.
31
+ - `manza.transferAuthorizer.get()` (`GET /api/transfer_authorizer`): the
32
+ enrolled authorizer's `status`, `suspension_reason`, limits,
33
+ `daily_authorized_total`, `secret_expires_at` and `webhook_endpoint_id`.
34
+ Rejects with `ManzaNotFoundError` when none is enrolled.
35
+ - Documented the new pass-through fields: a draft's `authorization` carries
36
+ `refusal_reason` (status `refused` when it went to the approvers at
37
+ create time), bank accounts carry `trusted`, and the challenge webhook's
38
+ `payment.payee_trusted` says whether the payee was trusted already.
39
+ - `examples/transfer_authorizer/`: a runnable two-key transfer authorizer
40
+ on `node:http` (Bun, or Node through `tsx`): `server.ts` verifies the
41
+ webhook, checks a JSON ledger, signs and authorizes (or declines, also
42
+ for a new payee with `ALLOW_NEW_PAYEES=false`) and retries 409
43
+ `authorization_busy`; `create_transfer.ts` prints where the draft was
44
+ routed and why; `preflight.ts` checks what the API shows of each setup
45
+ step, prints the fix for each that fails and warns about what it cannot
46
+ see (key B's scope and IP allowlist, the new-payee option). Not shipped
47
+ in the npm package.
48
+ - README: "Machine-authorized transfers" with "Setup, step by step", the
49
+ webhook verifier and the signing snippet.
50
+
51
+ ### Deprecated
52
+
53
+ - `manza.transferDrafts` and `TransferDrafts`. Both keep working for all of
54
+ 1.x: the accessor is `manza.payments` itself and the export names the
55
+ same class, so the old name now calls `/api/payments` too. The server
56
+ keeps `/api/transfer_drafts` as a permanent alias.
57
+
58
+ ### Changed (cassettes)
59
+
60
+ - The replay tests pin `cassettes-v1.3.0` (was `v1.0.0`). The payment
61
+ cassettes moved from `transfer_drafts/` to `payments/`; the
62
+ `payments/create` and `beneficiaries/create` request bodies changed
63
+ (see manza-ruby's CHANGELOG at 1.2.0 and 1.3.0).
64
+
65
+ ## [1.0.0]
66
+
10
67
  Renamed from Zazu to Manza; the first release under the new name is 1.0.0.
11
68
 
12
69
  ### Changed (breaking)
package/README.md CHANGED
@@ -66,28 +66,76 @@ manza.beneficiaries.list();
66
66
  manza.beneficiaries.get(id);
67
67
  manza.beneficiaries.create({ beneficiary_type: "individual", person_name: "Jane Doe" });
68
68
  manza.beneficiaries.listExternalAccounts(beneficiaryId);
69
- manza.beneficiaries.getExternalAccount(beneficiaryId, id);
69
+ manza.beneficiaries.getExternalAccount(beneficiaryId, id); // "trusted": true once a trusted payee
70
70
  manza.beneficiaries.createExternalAccount(beneficiaryId, { account_number });
71
71
 
72
- manza.transferDrafts.create({ account_id, beneficiary_id, amount: "150.00", client_reference });
73
- manza.transferDrafts.get(id);
74
- manza.transferDrafts.authorize(id, { authorization_id, signature });
75
- manza.transferDrafts.decline(id, { authorization_id, reason });
76
-
77
72
  manza.payeeTrustRequests.create({ external_account_ids: [id] });
78
73
  manza.payeeTrustRequests.get(id);
74
+
75
+ manza.payments.create({ account_id, beneficiary_id, amount: "2500.00", client_reference });
76
+ // client_reference is unique per entity; a duplicate raises ManzaConflictError
77
+ manza.payments.get(id); // authorization: status, refusal_reason
78
+ manza.payments.authorize(id, { authorization_id, signature });
79
+ manza.payments.decline(id, { authorization_id, reason });
80
+ // manza.transferDrafts is a deprecated alias of manza.payments (same object, /api/payments)
81
+
82
+ manza.transferAuthorizer.get(); // status, suspension_reason, limits, daily_authorized_total; ManzaNotFoundError: none enrolled
83
+ ```
84
+
85
+ ## Machine-authorized transfers
86
+
87
+ A draft inside your entity's authorization envelope (trusted payee, or a new one when you allow it, within limits) is sent to your enrolled authorizer endpoint as a `payment.authorization_requested` webhook carrying an `authorization.id` and a one-time `nonce`. Your system checks it against its own ledger, signs it and authorizes it with a **different API key** from the one that created it. [`examples/transfer_authorizer/`](examples/transfer_authorizer/) runs the whole flow. The [transfer authorization docs](https://ma.manza.finance/docs/api/transfer-authorization) have the full reference.
88
+
89
+ ### Setup, step by step
90
+
91
+ 1. **Feature flags.** Ask support to enable API transfers and transfer authorization (`release_api_webhook_authorization`) on your workspace.
92
+ 2. **Two API keys.** Key A creates drafts (`transfers:write`; `beneficiaries:request_trust` for step 6; `entity:read`, `accounts:read`, `webhook_endpoints:read` and `beneficiaries:read` for the preflight in step 7). Key B answers the challenges (`transfers:authorize`). The creating key is always refused with 403 `same_key_forbidden`, so keep key B and the signing secret on the system that holds your ledger. Bind key B to an IP allowlist: authorizing from a key without one is refused with 403 `unrestricted_api_key`. Bind key A to one too if you allow new payees (step 6): a draft to a new payee from a key without an allowlist goes to your approvers (`unrestricted_api_key`).
93
+ 3. **A stable public URL.** Your authorizer needs an HTTPS URL that never changes: an enrolled endpoint's URL is locked. Use a reserved ngrok domain (`ngrok http --url=your-name.ngrok.app 4599`) or a named Cloudflare tunnel (`cloudflared tunnel create`, then `cloudflared tunnel route dns`). Never a free ngrok URL: it changes on every restart.
94
+ 4. **Create the webhook endpoint** at that URL:
95
+
96
+ ```ts
97
+ await manza.webhookEndpoints.create({ url: "https://your-name.ngrok.app/", events: ["transfer.executed"] });
98
+ ```
99
+
100
+ 5. **Enrol it in the app**: Settings → Developer → Transfer approval. Pick the endpoint, the currency and both limits, confirm with your two-factor code, and copy the signing secret: it is shown once. Enrolment is what routes the challenges: `payment.authorization_requested` goes only to the enrolled endpoint and cannot be subscribed to through `events`.
101
+ 6. **Allow new payees, or trust each payee.** Turn on *Approve transfers to new payees* at enrolment (or later, same page, with your two-factor code) and set the *Limit per transfer to a new payee*. Your authorizer may then approve a transfer to bank details your workspace never trusted, up to that limit, and its signature trusts them: the webhook's `payment.payee_trusted` is `false` for such a transfer. Bank details whose trust was revoked, or that were edited after trusting, still go to your approvers. Without the option, an approver marks the beneficiary's bank account as trusted from the Beneficiaries list, or you ask them to:
102
+
103
+ ```ts
104
+ await manza.payeeTrustRequests.create({ external_account_ids: ["01a1..."] });
105
+ ```
106
+
107
+ `trusted` on `manza.beneficiaries.getExternalAccount` says which it is. The API does not show whether the option is on.
108
+ 7. **Run the preflight, then the example** (from `examples/transfer_authorizer/`, after `bun install` at the repository root and filling in `.env`): `bun preflight.ts` checks what the API shows of steps 1–6 and prints a fix for each that fails. What it cannot see, check by hand: that key B is bound to an IP allowlist, and, for a payee not trusted yet, that *Approve transfers to new payees* is on and key A is bound to an IP allowlist too (it warns, it does not fail). Then `bun server.ts` in one terminal, `bun create_transfer.ts` in another (on Node, `npx tsx` in place of `bun`).
109
+ 8. **Troubleshooting**: a draft that goes to your approvers instead has an `authorization` with a `refusal_reason`: status `refused` when it did not qualify (`create_transfer.ts` prints the reason in words), or `expired` (`expired`), `superseded` (`stale`; or an approver finalized the draft while its challenge was open, and it executes) or `failed` (`signature_failed`, five invalid signatures) when a challenge was sent and closed without an authorize; `manza.transferAuthorizer.get()` shows a suspension and its `suspension_reason`. An authorize answered 409 `authorization_busy` (a bank-detail edit, trust or trust revocation on the same payee was in flight) is safe to retry. The reasons, and an API error's `type`, are in the [transfer authorization docs](https://ma.manza.finance/docs/api/transfer-authorization).
110
+
111
+ ### Verifying the webhook
112
+
113
+ Pass the **raw request body**, never re-serialized JSON. `Webhook.constructEvent` reads `X-Manza-Signature` and `X-Manza-Timestamp` (any case, from a Fetch `Headers` or a plain object such as Node's `req.headers`, or the legacy `X-Zazu-*` names), checks the signature in constant time and the timestamp within 5 minutes, and resolves to the parsed event. It rejects with `ManzaArgumentError` otherwise:
114
+
115
+ ```ts
116
+ import { ManzaArgumentError, Webhook } from "@getmanza/sdk";
117
+
118
+ let event: Record<string, unknown>;
119
+ try {
120
+ event = await Webhook.constructEvent({ payload: rawBody, headers: req.headers, secret: signingSecret });
121
+ } catch (err) {
122
+ if (err instanceof ManzaArgumentError) return reply(401, err.message);
123
+ throw err;
124
+ }
79
125
  ```
80
126
 
81
- ## Transfer authorization
127
+ `Webhook.verify({ payload, signature, timestamp, secret })` resolves to a boolean instead. Both accept `tolerance: null` to skip the timestamp check. Use it only to replay a captured delivery in a local tool or test, never on a live endpoint: without the check, anyone holding a captured delivery can replay it. `Webhook.sign({ payload, timestamp, secret })` signs a delivery for your tests. All three are async: they use the Web Crypto API, so they run on Node, Bun, Deno, browsers and Workers.
128
+
129
+ ### Signing the challenge
82
130
 
83
- The `payment.authorization_requested` webhook delivers an `authorization_id` and a one-time `nonce`. Build the signature input from your own record of the draft (not the webhook's `signature_input`, which is there only to compare against), sign it with the authorizer endpoint's signing secret, and pass the result to `transferDrafts.authorize`.
131
+ Sign the draft from **your own record** of it (not the webhook's `signature_input`, which is there only to compare against) with the endpoint's signing secret:
84
132
 
85
133
  ```ts
86
134
  import { Manza, TransferAuthorization } from "@getmanza/sdk";
87
135
 
88
136
  const input = TransferAuthorization.signatureInput({
89
137
  payment_id: draft.id,
90
- nonce,
138
+ nonce: webhook.data.authorization.nonce,
91
139
  amount: draft.amount, // The API's decimal string verbatim ("2500.0"), not a number.
92
140
  currency_code: draft.currency_code,
93
141
  account_id: draft.account_id,
@@ -100,15 +148,14 @@ const signature = await TransferAuthorization.sign({
100
148
  signature_input: input,
101
149
  });
102
150
 
103
- await manza.transferDrafts.authorize(draft.id, {
104
- authorization_id: authorizationId,
151
+ const authorizer = new Manza({ apiKey: process.env.MANZA_AUTHORIZER_API_KEY });
152
+ await authorizer.payments.authorize(draft.id, {
153
+ authorization_id: webhook.data.authorization.id,
105
154
  signature,
106
155
  });
107
156
  ```
108
157
 
109
- `TransferAuthorization.sign` is async — it uses the Web Crypto API so it works on Node, Bun, Deno, browsers, and Workers without a `node:crypto` import.
110
-
111
- Use a key other than the one that created the draft — otherwise 403 `same_key_forbidden`. A blank signature raises `ManzaArgumentError` locally; the server counts a missing one as a failed attempt, and five fail the challenge.
158
+ `TransferAuthorization.sign` is async for the same Web Crypto reason. A blank signature raises `ManzaArgumentError` locally and is never sent. A wrong one raises `ManzaValidationError` (`type` `invalid_signature`). Five on one challenge send the draft to your in-app approvers; five in a row suspend the authorizer.
112
159
 
113
160
  ## Errors
114
161
 
@@ -145,10 +192,19 @@ bun run fetch:cassettes
145
192
  bun test
146
193
  ```
147
194
 
148
- ## Sibling SDKs
149
-
150
- - [manza-ruby](https://github.com/getmanza/manza-ruby) — reference implementation (records the cassettes)
151
- - manza-python, manza-php, manza-go, manza-crystal, manza-elixir — coming up
195
+ ## The SDK family
196
+
197
+ | SDK | Repository | Install |
198
+ |---|---|---|
199
+ | Ruby (reference implementation, records the cassettes) | [getmanza/manza-ruby](https://github.com/getmanza/manza-ruby) | `gem "manza"` |
200
+ | TypeScript / JavaScript | [getmanza/manza-ts](https://github.com/getmanza/manza-ts) (this repo) | `npm install @getmanza/sdk` |
201
+ | Python | [getmanza/manza-python](https://github.com/getmanza/manza-python) | `pip install manza` |
202
+ | Go | [getmanza/manza-go](https://github.com/getmanza/manza-go) | `go get github.com/getmanza/manza-go` |
203
+ | PHP | [getmanza/manza-php](https://github.com/getmanza/manza-php) | `composer require manza/manza-php` |
204
+ | Rust | [getmanza/manza-rust](https://github.com/getmanza/manza-rust) | `cargo add manza` |
205
+ | Crystal | [getmanza/manza-crystal](https://github.com/getmanza/manza-crystal) | shard `manza` (`github: getmanza/manza-crystal`) |
206
+ | Elixir | [getmanza/manza-elixir](https://github.com/getmanza/manza-elixir) | `{:manza, "~> 1.0"}` |
207
+ | CLI | [getmanza/cli](https://github.com/getmanza/cli) | `npm install -g @getzazu/cli` or `brew install getmanza/tap/zazu` |
152
208
 
153
209
  ## License
154
210
 
package/dist/client.d.ts CHANGED
@@ -6,10 +6,12 @@ import { Entity } from "./resources/entity.js";
6
6
  import { Invoices } from "./resources/invoices.js";
7
7
  import { PayeeTrustRequests } from "./resources/payee_trust_requests.js";
8
8
  import { PaymentLinks } from "./resources/payment_links.js";
9
- import { TransferDrafts } from "./resources/transfer_drafts.js";
9
+ import { Payments } from "./resources/payments.js";
10
+ import { TransferAuthorizer } from "./resources/transfer_authorizer.js";
11
+ import type { TransferDrafts } from "./resources/transfer_drafts.js";
10
12
  import { WebhookEndpoints } from "./resources/webhook_endpoints.js";
11
- import { ZazuResponse } from "./response.js";
12
- export interface ZazuClientOptions {
13
+ import { ManzaResponse } from "./response.js";
14
+ export interface ManzaClientOptions {
13
15
  apiKey?: string | undefined;
14
16
  baseUrl?: string;
15
17
  apiVersion?: string | undefined;
@@ -21,7 +23,7 @@ export interface RequestOptions {
21
23
  body?: unknown;
22
24
  headers?: Record<string, string> | undefined;
23
25
  }
24
- export declare class Zazu {
26
+ export declare class Manza {
25
27
  #private;
26
28
  readonly apiKey: string;
27
29
  readonly baseUrl: string;
@@ -35,9 +37,15 @@ export declare class Zazu {
35
37
  readonly invoices: Invoices;
36
38
  readonly payeeTrustRequests: PayeeTrustRequests;
37
39
  readonly paymentLinks: PaymentLinks;
40
+ readonly payments: Payments;
41
+ readonly transferAuthorizer: TransferAuthorizer;
42
+ /**
43
+ * @deprecated Use {@link Manza.payments}. Kept for all of 1.x: it is the
44
+ * same resource, which calls `/api/payments`.
45
+ */
38
46
  readonly transferDrafts: TransferDrafts;
39
47
  readonly webhookEndpoints: WebhookEndpoints;
40
- constructor(options?: ZazuClientOptions);
41
- request<T = unknown>(method: string, path: string, options?: RequestOptions): Promise<ZazuResponse<T>>;
48
+ constructor(options?: ManzaClientOptions);
49
+ request<T = unknown>(method: string, path: string, options?: RequestOptions): Promise<ManzaResponse<T>>;
42
50
  }
43
51
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,C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EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAG3B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAChD,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAChD;;;OAGG;IACH,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;gBAEhC,OAAO,GAAE,kBAAuB;IAyBtC,OAAO,CAAC,CAAC,GAAG,OAAO,EACvB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;CAqD7B"}
package/dist/env.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export declare function readEnv(name: string): string | undefined;
2
+ export declare function resetDeprecationWarnings(): void;
3
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAiBA,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAaxD;AAGD,wBAAgB,wBAAwB,IAAI,IAAI,CAE/C"}
package/dist/errors.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export interface ZazuErrorOptions {
1
+ export interface ManzaErrorOptions {
2
2
  status?: number;
3
3
  requestId?: string | null;
4
4
  type?: string | null;
@@ -6,40 +6,40 @@ export interface ZazuErrorOptions {
6
6
  body?: unknown;
7
7
  headers?: Headers | null;
8
8
  }
9
- export declare class ZazuError extends Error {
9
+ export declare class ManzaError extends Error {
10
10
  readonly status: number | undefined;
11
11
  readonly requestId: string | null;
12
12
  readonly type: string | null;
13
13
  readonly param: string | null;
14
14
  readonly body: unknown;
15
15
  readonly headers: Headers | null;
16
- constructor(message: string, options?: ZazuErrorOptions);
16
+ constructor(message: string, options?: ManzaErrorOptions);
17
17
  }
18
- export declare class ZazuConfigurationError extends ZazuError {
18
+ export declare class ManzaConfigurationError extends ManzaError {
19
19
  }
20
- export declare class ZazuConnectionError extends ZazuError {
20
+ export declare class ManzaConnectionError extends ManzaError {
21
21
  }
22
- export declare class ZazuAuthenticationError extends ZazuError {
22
+ export declare class ManzaAuthenticationError extends ManzaError {
23
23
  }
24
- export declare class ZazuForbiddenError extends ZazuError {
24
+ export declare class ManzaForbiddenError extends ManzaError {
25
25
  }
26
- export declare class ZazuNotFoundError extends ZazuError {
26
+ export declare class ManzaNotFoundError extends ManzaError {
27
27
  }
28
- export declare class ZazuValidationError extends ZazuError {
28
+ export declare class ManzaValidationError extends ManzaError {
29
29
  }
30
- export declare class ZazuRateLimitError extends ZazuError {
30
+ export declare class ManzaRateLimitError extends ManzaError {
31
31
  readonly retryAfter: number | null;
32
- constructor(message: string, options?: ZazuErrorOptions & {
32
+ constructor(message: string, options?: ManzaErrorOptions & {
33
33
  retryAfter?: number | null;
34
34
  });
35
35
  }
36
- export declare class ZazuServerError extends ZazuError {
36
+ export declare class ManzaServerError extends ManzaError {
37
37
  }
38
- export declare class ZazuArgumentError extends ZazuError {
38
+ export declare class ManzaArgumentError extends ManzaError {
39
39
  }
40
- export declare class ZazuConflictError extends ZazuError {
40
+ export declare class ManzaConflictError extends ManzaError {
41
41
  readonly paymentId: string | null;
42
- constructor(message: string, options?: ZazuErrorOptions & {
42
+ constructor(message: string, options?: ManzaErrorOptions & {
43
43
  paymentId?: string | null;
44
44
  });
45
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IAIf,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC1B;AAED,qBAAa,SAAU,SAAQ,KAAK;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;gBAErB,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB;CAU5D;AAED,qBAAa,sBAAuB,SAAQ,SAAS;CAAG;AACxD,qBAAa,mBAAoB,SAAQ,SAAS;CAAG;AACrD,qBAAa,uBAAwB,SAAQ,SAAS;CAAG;AACzD,qBAAa,kBAAmB,SAAQ,SAAS;CAAG;AACpD,qBAAa,iBAAkB,SAAQ,SAAS;CAAG;AACnD,qBAAa,mBAAoB,SAAQ,SAAS;CAAG;AACrD,qBAAa,kBAAmB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