@sendora/sdk 1.2.0 → 2.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 (54) hide show
  1. package/README.md +87 -26
  2. package/dist/account.d.ts +30 -0
  3. package/dist/account.d.ts.map +1 -0
  4. package/dist/account.js +25 -0
  5. package/dist/account.js.map +1 -0
  6. package/dist/client.d.ts +9 -16
  7. package/dist/client.d.ts.map +1 -1
  8. package/dist/client.js +5 -30
  9. package/dist/client.js.map +1 -1
  10. package/dist/domains.d.ts +1 -1
  11. package/dist/domains.d.ts.map +1 -1
  12. package/dist/domains.js +1 -1
  13. package/dist/domains.js.map +1 -1
  14. package/dist/error.d.ts +5 -2
  15. package/dist/error.d.ts.map +1 -1
  16. package/dist/error.js +13 -0
  17. package/dist/error.js.map +1 -1
  18. package/dist/index.d.ts +6 -1
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +3 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/options.d.ts +20 -0
  23. package/dist/options.d.ts.map +1 -0
  24. package/dist/options.js +34 -0
  25. package/dist/options.js.map +1 -0
  26. package/dist/servers.d.ts +64 -0
  27. package/dist/servers.d.ts.map +1 -0
  28. package/dist/servers.js +133 -0
  29. package/dist/servers.js.map +1 -0
  30. package/dist/types.d.ts +40 -3
  31. package/dist/types.d.ts.map +1 -1
  32. package/dist/version.d.ts +1 -1
  33. package/dist/version.js +1 -1
  34. package/dist/webhook-verify.d.ts +7 -5
  35. package/dist/webhook-verify.d.ts.map +1 -1
  36. package/dist/webhook-verify.js +38 -17
  37. package/dist/webhook-verify.js.map +1 -1
  38. package/dist/webhooks.d.ts +13 -1
  39. package/dist/webhooks.d.ts.map +1 -1
  40. package/dist/webhooks.js +26 -0
  41. package/dist/webhooks.js.map +1 -1
  42. package/package.json +4 -4
  43. package/skills/sendora/SKILL.md +19 -9
  44. package/src/account.ts +40 -0
  45. package/src/client.ts +14 -43
  46. package/src/domains.ts +1 -1
  47. package/src/error.ts +23 -1
  48. package/src/index.ts +6 -1
  49. package/src/options.ts +51 -0
  50. package/src/servers.ts +166 -0
  51. package/src/types.ts +47 -3
  52. package/src/version.ts +1 -1
  53. package/src/webhook-verify.ts +39 -18
  54. package/src/webhooks.ts +29 -0
package/README.md CHANGED
@@ -9,9 +9,13 @@ with `require`.
9
9
  npm install @sendora/sdk
10
10
  ```
11
11
 
12
- The token is a secret. Create it in the dashboard, keep it on the server,
13
- and never ship it to a browser. The client throws at construction when the
14
- token is missing, so build it at startup.
12
+ Two clients, two kinds of key. `Sendora` takes a server key (`sk_…`) and
13
+ does everything inside one server: sending, the log, streams,
14
+ suppressions, tokens and webhooks. `SendoraAccount` takes an account key
15
+ (`ak_…`) and manages the account: its servers, their keys and its sending
16
+ domains. Both keys are secrets: keep them on the server and never ship
17
+ them to a browser. Either client throws at construction when its key is
18
+ missing, so build it at startup.
15
19
 
16
20
  ```ts
17
21
  import { Sendora } from '@sendora/sdk';
@@ -188,20 +192,25 @@ await sendora.suppressions.delete({ address: 'anna@example.com' });
188
192
 
189
193
  ## Tokens
190
194
 
191
- Every token of a server has the same rights; the value is shown once, when
192
- it is created.
195
+ The server's own keys, from its own key. Every key of a server has the
196
+ same rights; the value is shown once, when it is created; a server holds
197
+ up to two live keys, and a third is `token_limit`. The account key
198
+ manages the same keys under `account.servers.tokens`.
193
199
 
194
- | Call | Answers |
195
- | --------------------------------- | ------------------------------------------------------ |
196
- | `sendora.tokens.create({ name })` | The token with its `token` value, once |
197
- | `sendora.tokens.list()` | `{ tokens }`, revoked ones included |
198
- | `sendora.tokens.get(tokenId)` | One token, without its value |
199
- | `sendora.tokens.revoke(tokenId)` | Nothing; the last live token is refused (`last_token`) |
200
+ | Call | Answers |
201
+ | --------------------------------- | ---------------------------------------------------- |
202
+ | `sendora.tokens.create({ name })` | The token with its `token` value, once |
203
+ | `sendora.tokens.list()` | `{ tokens }`, revoked ones included |
204
+ | `sendora.tokens.get(tokenId)` | One token, without its value |
205
+ | `sendora.tokens.revoke(tokenId)` | Nothing; the last live key is refused (`last_token`) |
200
206
 
201
207
  ## Webhooks
202
208
 
203
209
  An https URL of yours that Sendora posts events to as they happen, signed
204
- with a secret shown once at creation.
210
+ with a secret shown once at creation. A webhook holds up to two live
211
+ secrets, so a new one can be rolled in beside the old one: every delivery
212
+ is then signed with each, the newest first, and the old secret is deleted
213
+ once your receiver has switched.
205
214
 
206
215
  | Call | Answers |
207
216
  | -------------------------------------------------------- | ------------------------------------------------ |
@@ -212,6 +221,8 @@ with a secret shown once at creation.
212
221
  | `sendora.webhooks.deliveries(webhookId, { status? })` | `{ deliveries, next }`, newest first |
213
222
  | `sendora.webhooks.deliveriesAll(webhookId, { status? })` | Every delivery, for `for await` |
214
223
  | `sendora.webhooks.replay(webhookId, deliveryId)` | The delivery, queued again |
224
+ | `sendora.webhooks.createSecret(webhookId)` | A second secret with its `secret` value, once |
225
+ | `sendora.webhooks.deleteSecret(webhookId, secretId)` | Nothing; the last live secret is refused |
215
226
  | `sendora.webhooks.receive(request, secret)` | The verified, typed event from a Fetch `Request` |
216
227
 
217
228
  Events: `delivered`, `bounced`, `deferred`, `spam_complaint` and
@@ -265,31 +276,72 @@ const event = await verifyWebhook({
265
276
  });
266
277
  ```
267
278
 
268
- The signature is `Sendora-Signature: t=<unix seconds>,v1=<hex>`, an
269
- HMAC-SHA256 with your secret over `<t>.<raw body>`, compared in constant
270
- time through WebCrypto. A signature older than five minutes is refused
279
+ The signature is `Sendora-Signature: t=<unix seconds>,v1=<hex>[,v1=<hex>]`,
280
+ one `v1` per live secret of the webhook, each an HMAC-SHA256 with that
281
+ secret over `<t>.<raw body>`, compared in constant time through WebCrypto;
282
+ the one your secret produces is enough. To roll a secret, create the new
283
+ one with `webhooks.createSecret`, move your receiver to it while both
284
+ sign every delivery, then delete the old one. A signature older than five minutes is refused
271
285
  (`stale_signature`; `toleranceSeconds` changes the limit), a wrong one
272
286
  throws `invalid_signature`.
273
287
 
274
- ## Domains
288
+ ## The account: servers, their keys and domains
289
+
290
+ An account key (`ak_…`) manages the account and never sends. An
291
+ administrator creates one in the dashboard under Account › API keys; the
292
+ account holds up to two live ones. `SendoraAccount` takes the same
293
+ options as `Sendora`.
294
+
295
+ ```ts
296
+ import { Sendora, SendoraAccount } from '@sendora/sdk';
297
+
298
+ const account = new SendoraAccount({ token: process.env.SENDORA_ACCOUNT_TOKEN });
299
+
300
+ const server = await account.servers.create({ name: 'Fakturering' });
301
+ const sendora = new Sendora({ token: server.token.token });
302
+ ```
303
+
304
+ A server is created with its default transactional stream and its first
305
+ key, whose value is in the answer this once. A server holds up to two
306
+ live keys and never falls below one, so rotation is create the new key,
307
+ switch to it, revoke the old one.
308
+
309
+ | Call | Answers |
310
+ | --------------------------------------------------- | ---------------------------------------------------------------------------------- |
311
+ | `account.servers.create({ name })` | The server with its first key as `token`, once; a taken name is `server_exists` |
312
+ | `account.servers.list()` | `{ servers }`, oldest first |
313
+ | `account.servers.get(serverId)` | One server |
314
+ | `account.servers.update(serverId, { name })` | The renamed server |
315
+ | `account.servers.delete(serverId)` | Nothing; `server_in_flight` while its messages are still being delivered |
316
+ | `account.servers.tokens.create(serverId, { name })` | The key with its `token` value, once; a third live key is `token_limit` with `max` |
317
+ | `account.servers.tokens.list(serverId)` | `{ tokens }`, revoked ones included |
318
+ | `account.servers.tokens.get(serverId, tokenId)` | One key, without its value |
319
+ | `account.servers.tokens.revoke(serverId, tokenId)` | Nothing; the last live key is refused (`last_token`) |
320
+
321
+ ```ts
322
+ const { token } = await account.servers.tokens.create(serverId, { name: 'Fakturasystemet' });
323
+ ```
275
324
 
276
325
  Sending domains belong to the account, and every server sends from them.
277
326
  A domain sends once both DNS records are seen.
278
327
 
279
328
  | Call | Answers |
280
329
  | ------------------------------------ | ---------------------------------------------------------------------------- |
281
- | `sendora.domains.create({ domain })` | The domain with `returnPath` (CNAME) and `dkim` (TXT) to add |
282
- | `sendora.domains.list()` | `{ domains }` |
283
- | `sendora.domains.get(domainId)` | One domain with the state of its records |
284
- | `sendora.domains.verify(domainId)` | The domain plus `check` per record: `ok`, `missing`, `mismatch`, `dns_error` |
285
- | `sendora.domains.delete(domainId)` | Nothing; mail from it is refused from then on |
330
+ | `account.domains.create({ domain })` | The domain with `returnPath` (CNAME) and `dkim` (TXT) to add |
331
+ | `account.domains.list()` | `{ domains }` |
332
+ | `account.domains.get(domainId)` | One domain with the state of its records |
333
+ | `account.domains.verify(domainId)` | The domain plus `check` per record: `ok`, `missing`, `mismatch`, `dns_error` |
334
+ | `account.domains.delete(domainId)` | Nothing; mail from it is refused from then on |
286
335
 
287
336
  ```ts
288
- const domain = await sendora.domains.create({ domain: 'example.se' });
337
+ const domain = await account.domains.create({ domain: 'example.se' });
289
338
  console.log(`${domain.returnPath.type} ${domain.returnPath.host} -> ${domain.returnPath.value}`);
290
339
  console.log(`${domain.dkim.type} ${domain.dkim.host} -> ${domain.dkim.value}`);
291
340
  ```
292
341
 
342
+ A key of the wrong kind answers `wrong_token_kind`: a server key on the
343
+ account's routes, or an account key on a server's.
344
+
293
345
  ## Errors
294
346
 
295
347
  Every failed call throws `SendoraError`. Narrow on `code`:
@@ -321,7 +373,8 @@ try {
321
373
  | --------------------------------- | ------ | ---------------------------------------------------------------------------------------------------- |
322
374
  | `invalid_request` | 400 | A field is wrong; `issues` says which. |
323
375
  | `idempotency_key_required` | 400 | A batch was sent without a key. |
324
- | `unauthorized` | 401 | The token is missing, malformed or revoked. |
376
+ | `unauthorized` | 401 | The key is missing, malformed or revoked. |
377
+ | `wrong_token_kind` | 403 | A server key where an account key is needed, or the reverse; `message` names the kind. |
325
378
  | `payment_required` | 402 | The account has no active subscription. |
326
379
  | `tenant_paused` | 403 | Sendora has paused the account. |
327
380
  | `tenant_not_active` | 403 | The account is not approved to send, or not active for an inbound stream. |
@@ -335,7 +388,14 @@ try {
335
388
  | `stream_exists` | 409 | The server already has a stream with that name; `existingId` names it. |
336
389
  | `inbound_stream_exists` | 409 | The server already has a live inbound stream; `existingId` names it. |
337
390
  | `default_stream` | 409 | The default stream cannot be archived. |
338
- | `last_token` | 409 | The only live token cannot be revoked. |
391
+ | `last_token` | 409 | The only live key cannot be revoked. |
392
+ | `last_secret` | 409 | The only live secret of a webhook cannot be deleted. |
393
+ | `secret_limit` | 409 | The webhook already holds two live secrets; `max` says how many. |
394
+ | `token_limit` | 409 | The server or the account already holds two live keys; `max` says how many. |
395
+ | `server_exists` | 409 | The account already has a server with that name. |
396
+ | `server_limit` | 409 | The account has as many servers as it may; `max` says how many. |
397
+ | `server_reserved` | 409 | The server sends Sendora's own sign-in mail and cannot be renamed or removed. |
398
+ | `server_in_flight` | 409 | Messages of the server are still being delivered; delete it later. |
339
399
  | `request_too_large` | 413 | The body exceeds 10 MB. |
340
400
  | `from_domain_not_verified` | 422 | The From domain is not a verified sending domain. |
341
401
  | `stream_not_found` | 422 | `streamId` names no stream of this server. |
@@ -360,7 +420,7 @@ try {
360
420
  | `stale_signature` | none | A webhook's signature is older than the tolerance. |
361
421
 
362
422
  `error.retryable` is true when waiting and calling again could succeed.
363
- Neither the token nor a request body is ever part of an error.
423
+ Neither the key nor a request body is ever part of an error.
364
424
 
365
425
  ## Retries
366
426
 
@@ -368,7 +428,8 @@ Lost connections, timeouts, `rate_limited`, `sending_disabled` and server
368
428
  errors are retried with jittered backoff, twice by default, honouring
369
429
  `retryAfter` when it fits within five seconds of waiting in all. A longer
370
430
  `retryAfter` is thrown at once for you to schedule. A request that creates
371
- something (`tokens.create`, `webhooks.create`, `domains.create`, `replay`)
431
+ something (`servers.create`, `servers.tokens.create`, `tokens.create`,
432
+ `webhooks.create`, `webhooks.createSecret`, `domains.create`, `replay`)
372
433
  is repeated only after a `rate_limited` or `sending_disabled` answer, never
373
434
  after a lost connection, so nothing is created twice. Nothing else is
374
435
  retried. `new Sendora({ maxRetries: 0 })` turns retries off; `timeoutMs`
@@ -0,0 +1,30 @@
1
+ import { DomainsResource } from './domains.ts';
2
+ import { type ClientOptions } from './options.ts';
3
+ import { ServersResource } from './servers.ts';
4
+ export interface SendoraAccountOptions extends ClientOptions {
5
+ /**
6
+ * An account key (`ak_…`), created by an administrator in the dashboard.
7
+ * It manages the account and never sends. Keep it on the server; never
8
+ * ship it to a browser. `undefined`, as an unset environment variable
9
+ * gives, throws at construction rather than at the first call.
10
+ */
11
+ token: string | undefined;
12
+ }
13
+ /**
14
+ * The account client: the servers, each server's keys and the sending
15
+ * domains, under an account key. Sending, the log, streams, suppressions
16
+ * and webhooks belong to a server and to `Sendora` with a server key.
17
+ *
18
+ * @example
19
+ * import { Sendora, SendoraAccount } from '@sendora/sdk';
20
+ *
21
+ * const account = new SendoraAccount({ token: process.env.SENDORA_ACCOUNT_TOKEN });
22
+ * const server = await account.servers.create({ name: 'Fakturering' });
23
+ * const sendora = new Sendora({ token: server.token.token });
24
+ */
25
+ export declare class SendoraAccount {
26
+ readonly servers: ServersResource;
27
+ readonly domains: DomainsResource;
28
+ constructor(options: SendoraAccountOptions);
29
+ }
30
+ //# sourceMappingURL=account.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,qBAAsB,SAAQ,aAAa;IAC1D;;;;;OAKG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,cAAc;IACzB,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;gBAEtB,OAAO,EAAE,qBAAqB;CAS3C"}
@@ -0,0 +1,25 @@
1
+ import { DomainsResource } from "./domains.js";
2
+ import { transportFor } from "./options.js";
3
+ import { ServersResource } from "./servers.js";
4
+ /**
5
+ * The account client: the servers, each server's keys and the sending
6
+ * domains, under an account key. Sending, the log, streams, suppressions
7
+ * and webhooks belong to a server and to `Sendora` with a server key.
8
+ *
9
+ * @example
10
+ * import { Sendora, SendoraAccount } from '@sendora/sdk';
11
+ *
12
+ * const account = new SendoraAccount({ token: process.env.SENDORA_ACCOUNT_TOKEN });
13
+ * const server = await account.servers.create({ name: 'Fakturering' });
14
+ * const sendora = new Sendora({ token: server.token.token });
15
+ */
16
+ export class SendoraAccount {
17
+ servers;
18
+ domains;
19
+ constructor(options) {
20
+ const transport = transportFor(options.token, options, 'SendoraAccount needs an account key (ak_…); an administrator creates one in the dashboard.');
21
+ this.servers = new ServersResource(transport);
22
+ this.domains = new DomainsResource(transport);
23
+ }
24
+ }
25
+ //# sourceMappingURL=account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.js","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAsB,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAY/C;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,cAAc;IAChB,OAAO,CAAkB;IACzB,OAAO,CAAkB;IAElC,YAAY,OAA8B;QACxC,MAAM,SAAS,GAAG,YAAY,CAC5B,OAAO,CAAC,KAAK,EACb,OAAO,EACP,4FAA4F,CAC7F,CAAC;QACF,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,CAAC,SAAS,CAAC,CAAC;QAC9C,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC;CACF"}
package/dist/client.d.ts CHANGED
@@ -1,32 +1,26 @@
1
- import { DomainsResource } from './domains.ts';
2
1
  import { BroadcastsResource } from './broadcasts.ts';
3
2
  import { EmailResource } from './email.ts';
4
3
  import { InboundResource } from './inbound.ts';
5
4
  import { InboundDomainsResource } from './inbound-domains.ts';
6
5
  import { MessagesResource } from './messages.ts';
6
+ import { type ClientOptions } from './options.ts';
7
7
  import { StreamsResource } from './streams.ts';
8
8
  import { SuppressionsResource } from './suppressions.ts';
9
9
  import { TokensResource } from './tokens.ts';
10
10
  import { WebhooksResource } from './webhooks.ts';
11
- export declare const DEFAULT_BASE_URL = "https://api.sendora.se";
12
- export interface SendoraOptions {
11
+ export interface SendoraOptions extends ClientOptions {
13
12
  /**
14
- * A server's API token, created in the dashboard. Keep it on the server;
15
- * never ship it to a browser. `undefined`, as an unset environment
16
- * variable gives, throws at construction rather than at the first call.
13
+ * A server key (`sk_…`), answered once when the server is created or a
14
+ * key is added to it. Keep it on the server; never ship it to a browser.
15
+ * `undefined`, as an unset environment variable gives, throws at
16
+ * construction rather than at the first call.
17
17
  */
18
18
  token: string | undefined;
19
- /** The API's origin; https://api.sendora.se unless you test against another. */
20
- baseUrl?: string | undefined;
21
- /** The fetch to use; the global one unless you need a proxy or a fake. */
22
- fetch?: typeof fetch | undefined;
23
- /** How long one attempt may take; 30 seconds by default. */
24
- timeoutMs?: number | undefined;
25
- /** How many times a failed call is repeated when repeating is safe; 2 by default, 0 turns retries off. */
26
- maxRetries?: number | undefined;
27
19
  }
28
20
  /**
29
- * The client. One instance per server token; every resource hangs off it.
21
+ * The server client. One instance per server key; every resource of the
22
+ * server hangs off it. The account's servers and sending domains are
23
+ * `SendoraAccount` with an account key.
30
24
  *
31
25
  * @example
32
26
  * import { Sendora } from '@sendora/sdk';
@@ -49,7 +43,6 @@ export declare class Sendora {
49
43
  readonly suppressions: SuppressionsResource;
50
44
  readonly tokens: TokensResource;
51
45
  readonly webhooks: WebhooksResource;
52
- readonly domains: DomainsResource;
53
46
  constructor(options: SendoraOptions);
54
47
  }
55
48
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAA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oB,CAAC;IAC5C,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;gBAExB,OAAO,EAAE,cAAc;CAgBpC"}
package/dist/client.js CHANGED
@@ -1,20 +1,17 @@
1
- import { DomainsResource } from "./domains.js";
2
1
  import { BroadcastsResource } from "./broadcasts.js";
3
2
  import { EmailResource } from "./email.js";
4
3
  import { InboundResource } from "./inbound.js";
5
4
  import { InboundDomainsResource } from "./inbound-domains.js";
6
5
  import { MessagesResource } from "./messages.js";
7
- import { DEFAULT_MAX_RETRIES } from "./retry.js";
6
+ import { transportFor } from "./options.js";
8
7
  import { StreamsResource } from "./streams.js";
9
8
  import { SuppressionsResource } from "./suppressions.js";
10
9
  import { TokensResource } from "./tokens.js";
11
- import { Transport } from "./transport.js";
12
- import { SDK_VERSION } from "./version.js";
13
10
  import { WebhooksResource } from "./webhooks.js";
14
- export const DEFAULT_BASE_URL = 'https://api.sendora.se';
15
- const DEFAULT_TIMEOUT_MS = 30_000;
16
11
  /**
17
- * The client. One instance per server token; every resource hangs off it.
12
+ * The server client. One instance per server key; every resource of the
13
+ * server hangs off it. The account's servers and sending domains are
14
+ * `SendoraAccount` with an account key.
18
15
  *
19
16
  * @example
20
17
  * import { Sendora } from '@sendora/sdk';
@@ -37,29 +34,8 @@ export class Sendora {
37
34
  suppressions;
38
35
  tokens;
39
36
  webhooks;
40
- domains;
41
37
  constructor(options) {
42
- if (options.token === undefined || options.token.trim() === '') {
43
- throw new TypeError('Sendora needs a server API token; create one in the dashboard.');
44
- }
45
- const baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;
46
- new URL(baseUrl);
47
- const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
48
- if (!(timeoutMs > 0)) {
49
- throw new TypeError('timeoutMs must be a positive number of milliseconds.');
50
- }
51
- const maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;
52
- if (!Number.isInteger(maxRetries) || maxRetries < 0) {
53
- throw new TypeError('maxRetries must be a whole number of zero or more.');
54
- }
55
- const transport = new Transport({
56
- baseUrl,
57
- token: options.token,
58
- fetch: options.fetch ?? fetch,
59
- timeoutMs,
60
- maxRetries,
61
- userAgent: `sendora-sdk/${SDK_VERSION}`,
62
- });
38
+ const transport = transportFor(options.token, options, 'Sendora needs a server key (sk_…); it is shown once when the server or the key is created.');
63
39
  this.email = new EmailResource(transport);
64
40
  this.broadcasts = new BroadcastsResource(transport);
65
41
  this.messages = new MessagesResource(transport);
@@ -69,7 +45,6 @@ export class Sendora {
69
45
  this.suppressions = new SuppressionsResource(transport);
70
46
  this.tokens = new TokensResource(transport);
71
47
  this.webhooks = new WebhooksResource(transport);
72
- this.domains = new DomainsResource(transport);
73
48
  }
74
49
  }
75
50
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,M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,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAYjD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,OAAO;IACT,KAAK,CAAgB;IACrB,UAAU,CAAqB;IAC/B,QAAQ,CAAmB;IAC3B,OAAO,CAAkB;IACzB,cAAc,CAAyB;IACvC,OAAO,CAAkB;IACzB,YAAY,CAAuB;IACnC,MAAM,CAAiB;IACvB,QAAQ,CAAmB;IAEpC,YAAY,OAAuB;QACjC,MAAM,SAAS,GAAG,YAAY,CAC5B,OAAO,CAAC,KAAK,EACb,OAAO,EACP,4FAA4F,CAC7F,CAAC;QACF,IAAI,CAAC,KAAK,GAAG,IAAI,aAAa,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAI,CAAC,UAAU,GAAG,IAAI,kBAAkB,CAAC,SAAS,CAAC,CAAC;QACpD,IAAI,CAAC,QAAQ,GAAG,IAAI,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAChD,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,CAAC,SAAS,CAAC,CAAC;QAC9C,IAAI,CAAC,cAAc,GAAG,IAAI,sBAAsB,CAAC,SAAS,CAAC,CAAC;QAC5D,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,CAAC,SAAS,CAAC,CAAC;QAC9C,IAAI,CAAC,YAAY,GAAG,IAAI,oBAAoB,CAAC,SAAS,CAAC,CAAC;QACxD,IAAI,CAAC,MAAM,GAAG,IAAI,cAAc,CAAC,SAAS,CAAC,CAAC;QAC5C,IAAI,CAAC,QAAQ,GAAG,IAAI,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAClD,CAAC;CACF"}
package/dist/domains.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Transport } from './transport.ts';
2
2
  import type { CreateDomainRequest, DomainList, RequestOptions, SendingDomain, VerifiedDomain } from './types.ts';
3
- /** The account's sending domains and the two DNS records each one needs. Any server's token manages them. */
3
+ /** The account's sending domains and the two DNS records each one needs, managed with the account key; every server sends from them. */
4
4
  export declare class DomainsResource {
5
5
  #private;
6
6
  constructor(transport: Transport);
@@ -1 +1 @@
1
- {"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../src/domains.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EACV,mBAAmB,EACnB,UAAU,EACV,cAAc,EACd,aAAa,EACb,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,6GAA6G;AAC7G,qBAAa,eAAe;;gBAGd,SAAS,EAAE,SAAS;IAIhC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,OAAO,EAAE,mBAAmB,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,aAAa,CAAC;IAU1F,2CAA2C;IAC3C,IAAI,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,UAAU,CAAC;IASvD,uDAAuD;IACvD,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,aAAa,CAAC;IAS3E;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,cAAc,CAAC;IAS/E,yFAAyF;IACzF,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;CAQtE"}
1
+ {"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../src/domains.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EACV,mBAAmB,EACnB,UAAU,EACV,cAAc,EACd,aAAa,EACb,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,wIAAwI;AACxI,qBAAa,eAAe;;gBAGd,SAAS,EAAE,SAAS;IAIhC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,OAAO,EAAE,mBAAmB,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,aAAa,CAAC;IAU1F,2CAA2C;IAC3C,IAAI,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,UAAU,CAAC;IASvD,uDAAuD;IACvD,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,aAAa,CAAC;IAS3E;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,cAAc,CAAC;IAS/E,yFAAyF;IACzF,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;CAQtE"}
package/dist/domains.js CHANGED
@@ -1,4 +1,4 @@
1
- /** The account's sending domains and the two DNS records each one needs. Any server's token manages them. */
1
+ /** The account's sending domains and the two DNS records each one needs, managed with the account key; every server sends from them. */
2
2
  export class DomainsResource {
3
3
  #transport;
4
4
  constructor(transport) {
@@ -1 +1 @@
1
- {"version":3,"file":"domains.js","sourceRoot":"","sources":["../src/domains.ts"],"names":[],"mappings":"AASA,6GAA6G;AAC7G,MAAM,OAAO,eAAe;IACjB,UAAU,CAAY;IAE/B,YAAY,SAAoB;QAC9B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAC,OAA4B,EAAE,UAA0B,EAAE;QAC/D,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAgB;YAC5C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,OAAO;YACb,UAAU,EAAE,KAAK;YACjB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;IACL,CAAC;IAED,2CAA2C;IAC3C,IAAI,CAAC,UAA0B,EAAE;QAC/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CAAC,EAAE;YACnD,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;IACL,CAAC;CACF"}
package/dist/error.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { LimitScope, SuppressedRecipient, ValidationIssue } from './types.ts';
2
- /** Every code the API answers, the three the SDK raises when it never got a proper answer, and the two of the webhook verifier. */
3
- export type SendoraErrorCode = 'invalid_request' | 'unauthorized' | 'payment_required' | 'tenant_paused' | 'tenant_not_active' | 'spam_complaint_locked' | 'unsubscribe_locked' | 'not_found' | 'domain_exists' | 'domain_reserved' | 'inbound_domain_exists' | 'webhook_exists' | 'stream_exists' | 'inbound_stream_exists' | 'default_stream' | 'last_token' | 'request_too_large' | 'from_domain_not_verified' | 'stream_not_found' | 'stream_archived' | 'stream_paused' | 'stream_not_sendable' | 'stream_not_broadcast' | 'broadcast_not_enabled' | 'broadcast_not_open' | 'substitution_missing' | 'unsubscribe_placeholder_missing' | 'list_unsubscribe_reserved' | 'content_expired' | 'content_unreadable' | 'recipient_suppressed' | 'idempotency_key_mismatch' | 'idempotency_key_required' | 'rate_limited' | 'monthly_cap_reached' | 'sending_disabled' | 'connection_failed' | 'timeout' | 'unexpected_response' | 'invalid_signature' | 'stale_signature';
2
+ /** Every code the API answers, under either kind of key, the three the SDK raises when it never got a proper answer, and the two of the webhook verifier. */
3
+ export type SendoraErrorCode = 'invalid_request' | 'unauthorized' | 'wrong_token_kind' | 'payment_required' | 'tenant_paused' | 'tenant_not_active' | 'spam_complaint_locked' | 'unsubscribe_locked' | 'not_found' | 'domain_exists' | 'domain_reserved' | 'inbound_domain_exists' | 'webhook_exists' | 'stream_exists' | 'inbound_stream_exists' | 'default_stream' | 'last_token' | 'token_limit' | 'last_secret' | 'secret_limit' | 'server_exists' | 'server_limit' | 'server_reserved' | 'server_in_flight' | 'request_too_large' | 'from_domain_not_verified' | 'stream_not_found' | 'stream_archived' | 'stream_paused' | 'stream_not_sendable' | 'stream_not_broadcast' | 'broadcast_not_enabled' | 'broadcast_not_open' | 'substitution_missing' | 'unsubscribe_placeholder_missing' | 'list_unsubscribe_reserved' | 'content_expired' | 'content_unreadable' | 'recipient_suppressed' | 'idempotency_key_mismatch' | 'idempotency_key_required' | 'rate_limited' | 'monthly_cap_reached' | 'sending_disabled' | 'connection_failed' | 'timeout' | 'unexpected_response' | 'invalid_signature' | 'stale_signature';
4
4
  export interface SendoraErrorFields {
5
5
  code: SendoraErrorCode;
6
6
  message: string;
@@ -11,6 +11,7 @@ export interface SendoraErrorFields {
11
11
  cap?: number | null;
12
12
  used?: number | null;
13
13
  resetsAt?: string | null;
14
+ max?: number | null;
14
15
  issues?: ValidationIssue[];
15
16
  suppressed?: SuppressedRecipient[];
16
17
  streamId?: string | null;
@@ -49,6 +50,8 @@ export declare class SendoraError extends Error {
49
50
  readonly used: number | null;
50
51
  /** When the month counter resets, on monthly_cap_reached. */
51
52
  readonly resetsAt: string | null;
53
+ /** Live keys the server or the account may hold, on token_limit; servers the account may have, on server_limit; live secrets a webhook may hold, on secret_limit. */
54
+ readonly max: number | null;
52
55
  /** One entry per invalid field, on invalid_request. */
53
56
  readonly issues: ValidationIssue[];
54
57
  /** The recipients the server refused, on recipient_suppressed. */
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEnF,mIAAmI;AACnI,MAAM,MAAM,gBAAgB,GACxB,iBAAiB,GACjB,cAAc,GACd,kBAAkB,GAClB,eAAe,GACf,mBAAmB,GACnB,uBAAuB,GACvB,oBAAoB,GACpB,WAAW,GACX,eAAe,GACf,iBAAiB,GACjB,uBAAuB,GACvB,gBAAgB,GAChB,eAAe,GACf,uBAAuB,GACvB,gBAAgB,GAChB,YAAY,GACZ,mBAAmB,GACnB,0BAA0B,GAC1B,kBAAkB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I,GAC9B,YAAY,CA8Bd"}
package/dist/error.js CHANGED
@@ -1,6 +1,7 @@
1
1
  const apiCodes = new Set([
2
2
  'invalid_request',
3
3
  'unauthorized',
4
+ 'wrong_token_kind',
4
5
  'payment_required',
5
6
  'tenant_paused',
6
7
  'tenant_not_active',
@@ -15,6 +16,13 @@ const apiCodes = new Set([
15
16
  'inbound_stream_exists',
16
17
  'default_stream',
17
18
  'last_token',
19
+ 'token_limit',
20
+ 'last_secret',
21
+ 'secret_limit',
22
+ 'server_exists',
23
+ 'server_limit',
24
+ 'server_reserved',
25
+ 'server_in_flight',
18
26
  'request_too_large',
19
27
  'from_domain_not_verified',
20
28
  'stream_not_found',
@@ -68,6 +76,8 @@ export class SendoraError extends Error {
68
76
  used;
69
77
  /** When the month counter resets, on monthly_cap_reached. */
70
78
  resetsAt;
79
+ /** Live keys the server or the account may hold, on token_limit; servers the account may have, on server_limit; live secrets a webhook may hold, on secret_limit. */
80
+ max;
71
81
  /** One entry per invalid field, on invalid_request. */
72
82
  issues;
73
83
  /** The recipients the server refused, on recipient_suppressed. */
@@ -86,6 +96,7 @@ export class SendoraError extends Error {
86
96
  this.cap = fields.cap ?? null;
87
97
  this.used = fields.used ?? null;
88
98
  this.resetsAt = fields.resetsAt ?? null;
99
+ this.max = fields.max ?? null;
89
100
  this.issues = fields.issues ?? [];
90
101
  this.suppressed = fields.suppressed ?? [];
91
102
  this.streamId = fields.streamId ?? null;
@@ -111,6 +122,7 @@ export class SendoraError extends Error {
111
122
  cap: this.cap,
112
123
  used: this.used,
113
124
  resetsAt: this.resetsAt,
125
+ max: this.max,
114
126
  issues: this.issues,
115
127
  suppressed: this.suppressed,
116
128
  streamId: this.streamId,
@@ -138,6 +150,7 @@ export function errorFromAnswer(status, body, retryAfterHeader) {
138
150
  cap: integerOf(answer.cap),
139
151
  used: integerOf(answer.used),
140
152
  resetsAt: typeof answer.resetsAt === 'string' ? answer.resetsAt : null,
153
+ max: integerOf(answer.max) ?? integerOf(answer.maxServers),
141
154
  issues,
142
155
  suppressed: Array.isArray(answer.suppressed) ? answer.suppressed.filter(isSuppressed) : [],
143
156
  streamId: code === 'recipient_suppressed' ? stringOf(answer.streamId) : null,
package/dist/error.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AA8CA,MAAM,QAAQ,GAAwB,IAAI,GAAG,CAAmB;IAC9D,iBAAiB;IACjB,cAAc;IACd,kBAAkB;IAClB,eAAe;IACf,mBAAmB;IACnB,uBAAuB;IACvB,oBAAoB;IACpB,WAAW;IACX,eAAe;IACf,iBAAiB;IACjB,uBAAuB;IACvB,gBAAgB;IAChB,eAAe;IACf,uBAAuB;IACvB,gBAAgB;IAChB,YAAY;IACZ,mBAAmB;IACnB,0BAA0B;IAC1B,kBAAkB;IAClB,iBAAiB;IACjB,eAAe;IACf,qBAAqB;IACrB,sBAAsB;IACtB,uBAAuB;IACvB,oBAAoB;IACpB,sBAAsB;IACtB,iCAAiC;IACjC,2BAA2B;IAC3B,iBAAiB;IACjB,oBAAoB;IACpB,sBAAsB;IACtB,0BAA0B;IAC1B,0BAA0B;IAC1B,cAAc;IACd,qBAAqB;IACrB,kBAAkB;CACnB,CAAC,CAAC;AAmBH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IACnB,IAAI,GAAG,cAAc,CAAC;IAC/B,IAAI,CAAmB;IAChC,uDAAuD;IAC9C,MAAM,CAAgB;IAC/B,iEAAiE;IACxD,UAAU,CAAgB;IACnC,yEAAyE;IAChE,KAAK,CAAoB;IAClC,iEAAiE;IACxD,KAAK,CAAgB;IAC9B,uEAAuE;IAC9D,GAAG,CAAgB;IACnB,IAAI,CAAgB;IAC7B,6DAA6D;IACpD,QAAQ,CAAgB;IACjC,uDAAuD;IAC9C,MAAM,CAAoB;IACnC,kEAAkE;IACzD,UAAU,CAAwB;IAC3C,mFAAmF;IAC1E,QAAQ,CAAgB;I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AC;IACf,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACrD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
- export { DEFAULT_BASE_URL, Sendora } from './client.ts';
1
+ export { SendoraAccount } from './account.ts';
2
+ export type { SendoraAccountOptions } from './account.ts';
3
+ export { Sendora } from './client.ts';
2
4
  export type { SendoraOptions } from './client.ts';
3
5
  export type { BroadcastsResource } from './broadcasts.ts';
4
6
  export type { DomainsResource } from './domains.ts';
@@ -8,6 +10,9 @@ export type { SendoraErrorCode } from './error.ts';
8
10
  export type { InboundResource } from './inbound.ts';
9
11
  export type { InboundDomainsResource } from './inbound-domains.ts';
10
12
  export type { MessagesResource } from './messages.ts';
13
+ export { DEFAULT_BASE_URL } from './options.ts';
14
+ export type { ClientOptions } from './options.ts';
15
+ export type { ServersResource, ServerTokensResource } from './servers.ts';
11
16
  export type { StreamsResource } from './streams.ts';
12
17
  export type { SuppressionsResource } from './suppressions.ts';
13
18
  export type { TokensResource } from './tokens.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACxD,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,YAAY,EAAE,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AAChD,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC1E,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,mBAAmB,YAAY,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,7 @@
1
- export { DEFAULT_BASE_URL, Sendora } from "./client.js";
1
+ export { SendoraAccount } from "./account.js";
2
+ export { Sendora } from "./client.js";
2
3
  export { SendoraError } from "./error.js";
4
+ export { DEFAULT_BASE_URL } from "./options.js";
3
5
  export { SDK_VERSION } from "./version.js";
4
6
  export { verifyWebhook } from "./webhook-verify.js";
5
7
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAKxD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAS1C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAKtC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAK1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAOhD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { Transport } from './transport.ts';
2
+ export declare const DEFAULT_BASE_URL = "https://api.sendora.se";
3
+ /** What both clients take besides the key. */
4
+ export interface ClientOptions {
5
+ /** The API's origin; https://api.sendora.se unless you test against another. */
6
+ baseUrl?: string | undefined;
7
+ /** The fetch to use; the global one unless you need a proxy or a fake. */
8
+ fetch?: typeof fetch | undefined;
9
+ /** How long one attempt may take; 30 seconds by default. */
10
+ timeoutMs?: number | undefined;
11
+ /** How many times a failed call is repeated when repeating is safe; 2 by default, 0 turns retries off. */
12
+ maxRetries?: number | undefined;
13
+ }
14
+ /**
15
+ * The transport a client's resources share, built once at construction so
16
+ * a missing key or a nonsense option fails at startup rather than at the
17
+ * first call.
18
+ */
19
+ export declare function transportFor(token: string | undefined, options: ClientOptions, missingKey: string): Transport;
20
+ //# sourceMappingURL=options.d.ts.map