@formless63/purelymail-client 0.0.0-stage → 0.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.
- package/LICENSE +21 -0
- package/README.md +66 -2
- package/dist/.tsbuildinfo +1 -0
- package/dist/index.d.ts +111 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +219 -0
- package/dist/index.js.map +1 -0
- package/dist/model.d.ts +55 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +30 -0
- package/dist/model.js.map +1 -0
- package/dist/operations.d.ts +44 -0
- package/dist/operations.d.ts.map +1 -0
- package/dist/operations.js +45 -0
- package/dist/operations.js.map +1 -0
- package/dist/records.d.ts +67 -0
- package/dist/records.d.ts.map +1 -0
- package/dist/records.js +42 -0
- package/dist/records.js.map +1 -0
- package/package.json +44 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 formless63
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,67 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @formless63/purelymail-client
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A typed client for the [Purelymail](https://purelymail.com) API (domains, mailboxes, routing rules, credit),
|
|
4
|
+
and the DNS records a Purelymail domain needs as [`dns-plan`](../dns-plan) records.
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { createPurelymailClient, purelymailDnsRecords } from '@formless63/purelymail-client';
|
|
8
|
+
import { diffRecords, planOperations } from '@formless63/dns-plan';
|
|
9
|
+
|
|
10
|
+
const mail = createPurelymailClient({ apiToken });
|
|
11
|
+
const ownershipCode = await mail.getOwnershipCode(); // one per account
|
|
12
|
+
const desired = purelymailDnsRecords({ domain: 'example.com', ownershipCode });
|
|
13
|
+
await dns.apply(zone, planOperations(diffRecords(desired, await dns.listRecords(zone))));
|
|
14
|
+
await mail.addDomain('example.com'); // after the ownership TXT resolves
|
|
15
|
+
await mail.createUser({ userName: 'postmaster', domainName: 'example.com', password });
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
- Domains: `getOwnershipCode`, `addDomain`, `listDomains({ includeShared })`, `findDomain`, `recheckDomainDns`.
|
|
21
|
+
- Mailboxes: `createUser` (local part plus domain), `deleteUser` (full address; `purelymailAddress` joins
|
|
22
|
+
them), `listUsers`.
|
|
23
|
+
- Routing (aliases, catch-alls): `listRoutingRules`, `createRoutingRule`, `deleteRoutingRule`.
|
|
24
|
+
- `checkAccountCredit` returns Purelymail's decimal string untouched; `probe()` reports whether the token works.
|
|
25
|
+
- `PURELYMAIL_OPERATIONS` lists all nineteen API operations; `purelymailPath` gives the path of one.
|
|
26
|
+
|
|
27
|
+
**Creates are not idempotent**, and `createUser` is billable: after an ambiguous failure, read `listUsers`,
|
|
28
|
+
`listDomains` or `listRoutingRules` back before trying again.
|
|
29
|
+
|
|
30
|
+
## DNS records
|
|
31
|
+
|
|
32
|
+
`purelymailDnsRecords({ domain, zone?, ownershipCode? })` returns MX (`mailserver.purelymail.com`, priority 50),
|
|
33
|
+
SPF, three DKIM CNAMEs, DMARC as a CNAME to `dmarcroot.purelymail.com`, and the ownership TXT when you have the
|
|
34
|
+
code. Names are relative to `zone` (default: the domain itself), so `mail.example.com` in `example.com` gets
|
|
35
|
+
`_dmarc.mail`. Every record is unproxied with the provider's default TTL. Checked against
|
|
36
|
+
[Purelymail's setup page](https://purelymail.com/docs/domainDocs) on 2026-11-26.
|
|
37
|
+
|
|
38
|
+
If the zone already has an SPF record, `dns-plan` pairs the two by version tag and would replace it: merge
|
|
39
|
+
the `include:` yourself when the domain sends mail from elsewhere too.
|
|
40
|
+
|
|
41
|
+
## Errors
|
|
42
|
+
|
|
43
|
+
Every failure is a `PurelymailError` (a `ProviderError`) with `kind`, `status`, `operation` (e.g. `user.create`)
|
|
44
|
+
and `providerCode` (Purelymail's code, e.g. `invalidToken`).
|
|
45
|
+
|
|
46
|
+
- Purelymail reports most failures at **HTTP 200** in a `{type: "error"}` envelope, so the envelope is checked on
|
|
47
|
+
every answer. `invalidToken` is `unauthorized`; any other refusal is `invalid_request`, which will not
|
|
48
|
+
succeed on retry.
|
|
49
|
+
- A wrong operation name answers 404 with HTML: `not_found` with `detail.notEnvelope`.
|
|
50
|
+
- A successful answer missing a field is `invalid_response` with `detail.field`.
|
|
51
|
+
- A local rate-budget refusal is `rate_limited` with `detail.source: 'local_rate_budget'`, before any request.
|
|
52
|
+
|
|
53
|
+
## Credential safety
|
|
54
|
+
|
|
55
|
+
The token is sent only in the `Purelymail-Api-Token` header: never in a URL or body. Redirects are refused and
|
|
56
|
+
https is required (loopback http with `allowLoopbackHttp`). Errors hold no headers, URLs or bodies; provider text
|
|
57
|
+
in them has the token and, for `createUser`, the mailbox password removed. The password is write-only:
|
|
58
|
+
`createUser` returns nothing.
|
|
59
|
+
|
|
60
|
+
## Limitations
|
|
61
|
+
|
|
62
|
+
- `listUsers` cannot page and Purelymail returns at most 1000 addresses, so a list of 1000 or more is an error
|
|
63
|
+
rather than possibly incomplete.
|
|
64
|
+
- Routing rule ids are int64 in the API and read as JavaScript numbers; ids above 2^53 would lose precision.
|
|
65
|
+
- Not called: domain deletion, user changes, password-reset methods and app passwords.
|
|
66
|
+
- Error codes other than `invalidToken` (`noSuchUser`, `noSuchDomain`) are unconfirmed.
|
|
67
|
+
- Operation names and bodies follow Purelymail's OpenAPI document; verified against stubs, not a live account.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":"7.0.2","root":[[164,165],[169,170]],"packageJsons":["../../../node_modules/.bun/zod@4.6.7/node_modules/zod/package.json","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/classic/package.json","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/package.json","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/package.json","../../dns-plan/package.json","../../provider-http/package.json","../package.json"],"fileNames":["lib.es5.d.ts","lib.es2015.d.ts","lib.es2016.d.ts","lib.es2017.d.ts","lib.es2018.d.ts","lib.es2019.d.ts","lib.es2020.d.ts","lib.es2021.d.ts","lib.es2022.d.ts","lib.es2023.d.ts","lib.dom.d.ts","lib.dom.iterable.d.ts","lib.es2015.core.d.ts","lib.es2015.collection.d.ts","lib.es2015.generator.d.ts","lib.es2015.iterable.d.ts","lib.es2015.promise.d.ts","lib.es2015.proxy.d.ts","lib.es2015.reflect.d.ts","lib.es2015.symbol.d.ts","lib.es2015.symbol.wellknown.d.ts","lib.es2016.array.include.d.ts","lib.es2016.intl.d.ts","lib.es2017.arraybuffer.d.ts","lib.es2017.date.d.ts","lib.es2017.object.d.ts","lib.es2017.sharedmemory.d.ts","lib.es2017.string.d.ts","lib.es2017.intl.d.ts","lib.es2017.typedarrays.d.ts","lib.es2018.asyncgenerator.d.ts","lib.es2018.asynciterable.d.ts","lib.es2018.intl.d.ts","lib.es2018.promise.d.ts","lib.es2018.regexp.d.ts","lib.es2019.array.d.ts","lib.es2019.object.d.ts","lib.es2019.string.d.ts","lib.es2019.symbol.d.ts","lib.es2019.intl.d.ts","lib.es2020.bigint.d.ts","lib.es2020.date.d.ts","lib.es2020.promise.d.ts","lib.es2020.sharedmemory.d.ts","lib.es2020.string.d.ts","lib.es2020.symbol.wellknown.d.ts","lib.es2020.intl.d.ts","lib.es2020.number.d.ts","lib.es2021.promise.d.ts","lib.es2021.string.d.ts","lib.es2021.weakref.d.ts","lib.es2021.intl.d.ts","lib.es2022.array.d.ts","lib.es2022.error.d.ts","lib.es2022.intl.d.ts","lib.es2022.object.d.ts","lib.es2022.string.d.ts","lib.es2022.regexp.d.ts","lib.es2023.array.d.ts","lib.es2023.collection.d.ts","lib.es2023.intl.d.ts","lib.decorators.d.ts","lib.decorators.legacy.d.ts","../../provider-http/dist/errors.d.ts","../../provider-http/dist/url.d.ts","../../provider-http/dist/rate-budget.d.ts","../../provider-http/dist/client.d.ts","../../provider-http/dist/index.d.ts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/json-schema.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/standard-schema.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/registries.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/to-json-schema.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/util.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/versions.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/schemas.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/checks.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/errors.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/core.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/parse.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/memoizer.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/regexes.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/ar.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/az.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/be.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/bg.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/bn.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/ca.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/ckb.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/cs.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/da.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/de.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/el.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/en.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/eo.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/es.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/fa.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/fi.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/fr.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/fr-CA.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/gu.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/he.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/hi.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/hr.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/hu.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/hy.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/id.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/is.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/it.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/ja.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/ka.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/kh.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/km.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/kn.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/ko.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/lt.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/mk.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/ms.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/ne.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/nl.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/nn.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/no.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/ota.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/ps.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/pl.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/pt.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/pt-BR.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/ro.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/ru.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/sk.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/sl.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/sv.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/ta.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/tg.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/th.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/tk.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/tr.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/ua.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/uk.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/ur.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/uz.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/vi.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/zh-CN.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/zh-TW.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/yo.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/index.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/doc.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/compile.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/api.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/json-schema-processors.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/json-schema-generator.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/index.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/classic/errors.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/classic/parse.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/classic/schemas.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/classic/checks.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/classic/compat.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/classic/from-json-schema.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/classic/deep-partial.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/classic/in-out.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/classic/iso.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/classic/coerce.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/classic/external.d.cts","../../../node_modules/.bun/zod@4.6.7/node_modules/zod/index.d.cts","../src/model.ts","../src/operations.ts","../../dns-plan/dist/records.d.ts","../../dns-plan/dist/diff.d.ts","../../dns-plan/dist/index.d.ts","../src/records.ts","../src/index.ts"],"fileInfos":[{"version":"16934abaab7026ac114da441aabea1a0","affectsGlobalScope":true,"impliedNodeFormat":1},"d4306fb2e47f74835e8674ffac07d76f","e437c5c1302869326c3bb93da85bbbcf","e4324975a566567b21d350615f1fc6ac","333b1b9a2a9ac3b8497dba5c63b5ba50","6cffacd662b6eb5fa7a36aa2ea366bfa","b4c34f9c23304dbef2d23698637ed638","e5cb86a5fc491796ecd1d2dd348d208f","feb6c6fb19cdb246a5d8acb36a6901c7","9443a7f109277ffaa79d893ed2549995",{"version":"aae8996e8b5684814785a42cbbefcd79","affectsGlobalScope":true,"impliedNodeFormat":1},"abad6dd56cc8caf095c165df8124d237",{"version":"926204c28cd3d073865348473ae28d2e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"f25e42c801b2cb3cf2b39792006a9beb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6344b55f26a4e81d9608777dbfb877dd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3c0ed28e53d3695b363e256ec1c023fd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4c2761daba7f17141c25baa0821ac5da","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b87656acabd63e69379ff6ffcfe52fc7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"597469522da047a5af5222cc6989f405","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1708ea4d34dc37fadadc63ca01127e80","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"55d97a8c6fbf34a30450a7b1e5f7a298","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0ee05eb59426d33e374226d8dcfa708b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e347c14030993906efcfbb88915b6a05","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b0231263857c9b6a03641acdc9280ceb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3b15c4a83b598cacb4067676e6f0abed","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b417d97b7934cef63b1889abec0bbfbf","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"09a6cf4032ebba60ce22a501e663f881","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2b056277dd138e8f5650fc04e20eaa8d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e22cc07e3f3cc242ba52fa3f8ea1fc58","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2c45da767a1bfbb220848df1bc4029e4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b44c3e0fbaf2130cdcf6ac38b120ffa1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b612fb5cf8e5d964b92063a75207632a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"02705151a5e1551b9162a9ed8ab763f7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"41025e398be9215d32e4337335da8f0b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"52684c2b1f353a5538e4f275182a54cd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6dedb6a4f90d1df3a6fbe5693e44886c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ca3f36fe3562c07e0f0d71c2bebd3f6d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"409974d6129befbb8226ddd1c6558568","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4d9cfde2a1ae1b4925f1f9bc10848e5d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7e1daecc66dd564144e3bb1a0266b5fd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a8e1d9bb35fd0637f2f9fd2b2a54f2ec","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4f168501772a6543182765bfd5f2fbfe","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a19c80aad1b2162103496f5ba293a732","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b69afa63cd5d059851c78adb2856ee09","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ae2fc5d954e9b0f5feee3d481b953c27","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1cfd3091a071d8b6feec15277643bafe","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1da2c1f258970fd3cc91184f69e91a9d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a0d87491913d843139e0c993650a3235","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ef72aa378127e7b7abba915b0110b1e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3ec74c6a7d4463f0254db3a74cf75646","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"84c2bdfa470d075526cce6322d81b0b6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0b3844c2b8c73e4e1ab91431411cad11","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4fc71cf4a15b8d99675a31df77f26e07","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d1b49564ddaeca3df5b6dbae925d2242","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6a25be566d60ccfc2d6e8b7bfdeefa83","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8a20e27646985dfd58c57ca6566553dd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9969f02ad3cdcbf4f709405cda44167f","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9c9be4792a7a4f42c15ae7360bf28779","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8cf777fe00349b71ee9c4b6f3fe7fd19","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"74f96bc192530c9723f572bfff3d3078","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1df91c56b25955c56387426f378173c5","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"f64453cbf9671f28158677fa5c43967a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"33f317af5428801f944a478d2c1e38e5","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"40112008f54af29a122b8c1c211518cd","impliedNodeFormat":99},{"version":"096ceeab656d4254e0ee2c0284967509","impliedNodeFormat":99},{"version":"5329af4f0e42403b027f713a8f4b228f","impliedNodeFormat":99},{"version":"6ab21e3a1f4a3503a936962d24c55683","impliedNodeFormat":99},{"version":"2e03a6dfeb80cdf1faa70ea849a568e8","impliedNodeFormat":99},"46adab8b8b66b08b5e7c0e8fab6a1ca6","a9fe29dcdd4288cacf574947747a4572","daada721cfdc43aa8e7c2e2d14d760de","1875116298cba1325500d3f1eac8bbf9","5b3b46f5321315ed981271ff40658eb5","5d253feb3ce379964ce328df2e292f33","0c8ef3f924ccfad86a3010130f77d9c8","4ef66462d69c6b7504ef14011caac866","2f9112269cc3c45d1fb3d62f3ccb7097","ffb6ed8d47df8ca98044478684c0af40","cbc1f06fbfe43eb20a752fa368855819","2de5baa83f63307a4dd74d7aa2dd5254","3eeffcd208fa163e66f8769b350f0445","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","ee9981834b9f6f6958887811182849e8","5175ffa851d494a5195ffdebf8ed7285","89cf60624d459ce663be118a626d5fdc","1d1bc42979730b680201df62a3c1ac22","cb5ffae433c93a1431c0000260c7d0c3","9bb07208f876b5e95d56a3d2e9b9a427","0b02ecd3af1ccccee2f5c605903848f8","7454a3a8b97184f2d9432fa08bea4550","5ec4d3086f21642d2aeae2133b49ceeb","8318e3c39365fe3a3cfb375f5c29ab04","9e29bd130ef2dafefc736f6ab792a301","cde3fe3c0bfe6e037b07e7251fb1c3d3","c5a965bdb35a433f7fb044dcb56d485c","96b06af537c71de0a80e9ed880958afd","3008879c54fc6e5b56c202a9d7b09211","1339976f87e671ebf4b5ff1f36594612","0a95994056ab784c17e3331cd56bff1c","a9356de7c324c6f49c15587032b1f65f","f763a0656991aee48818a73fe218b09c","1904e67dd51f8bf1517f05edbfada0ea",{"version":"70ed7c2f2403f5f5e56533d914889103","signature":"7e7ad15d26bb486cd83b8bcf5e4d58f5","impliedNodeFormat":99},{"version":"0344ce4d2f7f3474c927ba680e386c9b","signature":"200aad6d12d81895bc8b6d2f4b79407c","impliedNodeFormat":99},{"version":"d28ffc584885b8b95a552239f06bd54e","impliedNodeFormat":99},{"version":"d5e647471d27727d52291de40ff1c086","impliedNodeFormat":99},{"version":"7fcf6c70353815a59b1e60489a4f9d59","impliedNodeFormat":99},{"version":"58d4eff8c88fb0e4dbcef7a4fca8abcd","signature":"c739a5b613cf169d30124e84a1a8684a","impliedNodeFormat":99},{"version":"a24405937709a760e2bc397e4cbf6974","signature":"5edbd65ff14bc9f4ba7f49450f9c44b3","impliedNodeFormat":99}],"fileIdsList":[[162],[151],[151,154],[73,145,149,151,152,153,154,155,156,157,158,159,160,161],[69,71,154],[151,152],[70,76,151,153],[71,73,75,76,77,78],[73,75,77,78],[75,78],[73,75,77],[70,73,75,76,78],[69,71,72,73,74,75,76,77,78,79,80,81,145,146,147,148,149,150],[69,71,72,75],[71,72,75],[75],[69,70,72,73,74,76,77,78],[69,70,71,75,151],[75,76,77,78],[77],[82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144],[166],[166,167],[64,65,66],[64,65,66,67],[68,163,164,165,169],[163],[168]],"options":{"allowImportingTsExtensions":true,"composite":true,"declaration":true,"declarationMap":true,"erasableSyntaxOnly":true,"exactOptionalPropertyTypes":true,"module":199,"noUncheckedIndexedAccess":true,"outDir":"./","rewriteRelativeImportExtensions":true,"rootDir":"../src","skipLibCheck":true,"strict":true,"sourceMap":true,"target":10,"tsBuildInfoFile":"./.tsbuildinfo","verbatimModuleSyntax":true},"referencedMap":[[163,1],[155,2],[161,3],[156,3],[158,3],[152,2],[162,4],[157,5],[159,3],[160,3],[153,6],[154,7],[148,8],[76,9],[147,10],[78,11],[77,12],[151,13],[150,14],[149,15],[80,16],[79,9],[71,10],[75,17],[72,18],[73,19],[82,20],[83,20],[84,20],[85,20],[86,20],[87,20],[88,20],[89,20],[90,20],[91,20],[92,20],[93,20],[94,20],[95,20],[96,20],[97,20],[99,20],[98,20],[100,20],[101,20],[102,20],[103,20],[104,20],[105,20],[106,20],[145,21],[107,20],[108,20],[109,20],[110,20],[111,20],[112,20],[113,20],[114,20],[115,20],[116,20],[117,20],[118,20],[119,20],[120,20],[121,20],[122,20],[124,20],[123,20],[126,20],[125,20],[127,20],[128,20],[129,20],[130,20],[131,20],[132,20],[133,20],[134,20],[135,20],[136,20],[137,20],[138,20],[139,20],[140,20],[141,20],[144,20],[142,20],[143,20],[167,22],[168,23],[67,24],[68,25],[170,26],[164,27],[169,28]],"latestChangedDtsFile":"./index.d.ts"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { ProviderError, type FetchLike, type ProviderErrorKind, type ProviderErrorOptions, type RateBudget } from '@formless63/provider-http';
|
|
2
|
+
import { type PurelymailDomain, type PurelymailRoutingRule } from './model.ts';
|
|
3
|
+
export * from './model.ts';
|
|
4
|
+
export * from './operations.ts';
|
|
5
|
+
export * from './records.ts';
|
|
6
|
+
export declare class PurelymailError extends ProviderError {
|
|
7
|
+
constructor(options: Omit<ProviderErrorOptions, 'provider'>);
|
|
8
|
+
}
|
|
9
|
+
export declare const PURELYMAIL_DEFAULT_BASE_URL = "https://purelymail.com";
|
|
10
|
+
export declare const PURELYMAIL_TOKEN_HEADER = "Purelymail-Api-Token";
|
|
11
|
+
/** `listUser` returns at most this many addresses and cannot page. */
|
|
12
|
+
export declare const PURELYMAIL_LIST_USER_LIMIT = 1000;
|
|
13
|
+
/**
|
|
14
|
+
* Envelope codes this client classifies. Purelymail publishes no code table.
|
|
15
|
+
* `invalidToken` has been observed (for a wrong and for a missing token, both
|
|
16
|
+
* at HTTP 200); the absence codes are unconfirmed and only refine
|
|
17
|
+
* `invalid_request` to `not_found`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const PURELYMAIL_AUTH_ERROR_CODES: ReadonlySet<string>;
|
|
20
|
+
export declare const PURELYMAIL_NOT_FOUND_ERROR_CODES: ReadonlySet<string>;
|
|
21
|
+
/**
|
|
22
|
+
* The response envelope: `{type: "success", result}` or
|
|
23
|
+
* `{type: "error", code, message}`, usually at HTTP 200. `type` is null for a
|
|
24
|
+
* body that is not an envelope (an HTML page, an empty body). A body with
|
|
25
|
+
* `result` and no `type`, the shape the OpenAPI document describes, is a
|
|
26
|
+
* success.
|
|
27
|
+
*/
|
|
28
|
+
export interface PurelymailEnvelope {
|
|
29
|
+
type: 'success' | 'error' | null;
|
|
30
|
+
code: string | null;
|
|
31
|
+
message: string | null;
|
|
32
|
+
result: unknown;
|
|
33
|
+
}
|
|
34
|
+
export declare function readPurelymailEnvelope(body: unknown): PurelymailEnvelope;
|
|
35
|
+
/**
|
|
36
|
+
* Classifies a failed answer: a known envelope code first, then a decisive
|
|
37
|
+
* status (401, 403, 404, 429), then an envelope refusal (`invalid_request`,
|
|
38
|
+
* never transient), then any other error status. A 2xx that is not an
|
|
39
|
+
* envelope is `invalid_response`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function purelymailErrorKind(httpStatus: number, envelope: PurelymailEnvelope): ProviderErrorKind;
|
|
42
|
+
export interface PurelymailOptions {
|
|
43
|
+
apiToken: string;
|
|
44
|
+
/** Default `https://purelymail.com`. Another origin (a proxy) may carry a path. */
|
|
45
|
+
baseUrl?: string;
|
|
46
|
+
fetch?: FetchLike;
|
|
47
|
+
/** Default 20 000. */
|
|
48
|
+
timeoutMs?: number;
|
|
49
|
+
maxResponseBytes?: number;
|
|
50
|
+
/** Default 6 burst, 1 per second; Purelymail publishes no limit. */
|
|
51
|
+
rateBudget?: RateBudget;
|
|
52
|
+
allowLoopbackHttp?: boolean;
|
|
53
|
+
}
|
|
54
|
+
export interface RequestOptions {
|
|
55
|
+
signal?: AbortSignal;
|
|
56
|
+
}
|
|
57
|
+
export interface CreateUserInput {
|
|
58
|
+
/** The local part only: `postmaster`, not `postmaster@example.com`. */
|
|
59
|
+
userName: string;
|
|
60
|
+
domainName: string;
|
|
61
|
+
/** Write-only: sent in the body, removed from any error text, never returned. */
|
|
62
|
+
password: string;
|
|
63
|
+
/** Omitted unless given, so Purelymail's defaults apply. */
|
|
64
|
+
enablePasswordReset?: boolean;
|
|
65
|
+
enableSearchIndexing?: boolean;
|
|
66
|
+
sendWelcomeEmail?: boolean;
|
|
67
|
+
}
|
|
68
|
+
export interface CreateRoutingRuleInput {
|
|
69
|
+
domainName: string;
|
|
70
|
+
/** Local part to match; empty with `catchall` for everything else. */
|
|
71
|
+
matchUser: string;
|
|
72
|
+
targetAddresses: readonly string[];
|
|
73
|
+
/** Default false. */
|
|
74
|
+
prefix?: boolean;
|
|
75
|
+
/** Default false. */
|
|
76
|
+
catchall?: boolean;
|
|
77
|
+
}
|
|
78
|
+
export interface PurelymailProbe {
|
|
79
|
+
authenticated: boolean;
|
|
80
|
+
}
|
|
81
|
+
export interface PurelymailClient {
|
|
82
|
+
/** Calls `checkAccountCredit`. Rejects unless the failure is a refused token. */
|
|
83
|
+
probe(options?: RequestOptions): Promise<PurelymailProbe>;
|
|
84
|
+
/** The account's ownership code, published as a TXT record on every domain. */
|
|
85
|
+
getOwnershipCode(options?: RequestOptions): Promise<string>;
|
|
86
|
+
/** Fails until the ownership TXT record resolves publicly. */
|
|
87
|
+
addDomain(domainName: string, options?: RequestOptions): Promise<void>;
|
|
88
|
+
listDomains(options?: RequestOptions & {
|
|
89
|
+
includeShared?: boolean;
|
|
90
|
+
}): Promise<PurelymailDomain[]>;
|
|
91
|
+
/** By name, ignoring case and a trailing dot; a subdomain does not match. */
|
|
92
|
+
findDomain(name: string, options?: RequestOptions): Promise<PurelymailDomain | null>;
|
|
93
|
+
/** Asks Purelymail to check the domain's DNS again. Changes no other setting. */
|
|
94
|
+
recheckDomainDns(domainName: string, options?: RequestOptions): Promise<void>;
|
|
95
|
+
/** Billable and not idempotent: read `listUsers` back before repeating a failed call. */
|
|
96
|
+
createUser(input: CreateUserInput, options?: RequestOptions): Promise<void>;
|
|
97
|
+
/** Takes the full address. Deletes the mailbox and its mail. */
|
|
98
|
+
deleteUser(address: string, options?: RequestOptions): Promise<void>;
|
|
99
|
+
/** Every address on the account. Rejects when the answer reaches the 1000-user ceiling. */
|
|
100
|
+
listUsers(options?: RequestOptions): Promise<string[]>;
|
|
101
|
+
listRoutingRules(options?: RequestOptions): Promise<PurelymailRoutingRule[]>;
|
|
102
|
+
/** Not idempotent. */
|
|
103
|
+
createRoutingRule(input: CreateRoutingRuleInput, options?: RequestOptions): Promise<void>;
|
|
104
|
+
deleteRoutingRule(routingRuleId: number, options?: RequestOptions): Promise<void>;
|
|
105
|
+
/** The provider's own decimal string, never a number. */
|
|
106
|
+
checkAccountCredit(options?: RequestOptions): Promise<string>;
|
|
107
|
+
}
|
|
108
|
+
/** `local@domain`, the form every user operation except `createUser` takes. */
|
|
109
|
+
export declare function purelymailAddress(localPart: string, domainName: string): string;
|
|
110
|
+
export declare function createPurelymailClient(options: PurelymailOptions): PurelymailClient;
|
|
111
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,aAAa,EAEb,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,UAAU,EAChB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAA6C,KAAK,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAG1H,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAE7B,qBAAa,eAAgB,SAAQ,aAAa;IAChD,YAAY,OAAO,EAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,EAE1D;CACF;AAED,eAAO,MAAM,2BAA2B,2BAA2B,CAAC;AACpE,eAAO,MAAM,uBAAuB,yBAAyB,CAAC;AAC9D,sEAAsE;AACtE,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAE,WAAW,CAAC,MAAM,CAA6B,CAAC;AAC1F,eAAO,MAAM,gCAAgC,EAAE,WAAW,CAAC,MAAM,CAA2C,CAAC;AAE7G;;;;;;GAMG;AACH,MAAM,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AG,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC;IAC7E,sBAAsB;IACtB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1F,iBAAiB,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClF,yDAAyD;IACzD,kBAAkB,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC/D;AAED,+EAA+E;AAC/E,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAE/E;AAKD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,CAgMnF"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { assertHeaderSafe, createHttpClient, createRateBudget, kindFromStatus, ProviderError, safeProviderText } from '@formless63/provider-http';
|
|
2
|
+
import { domainSchema, routingRuleSchema, toDomain } from './model.js';
|
|
3
|
+
import { purelymailPath } from './operations.js';
|
|
4
|
+
export * from './model.js';
|
|
5
|
+
export * from './operations.js';
|
|
6
|
+
export * from './records.js';
|
|
7
|
+
export class PurelymailError extends ProviderError {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
super({ ...options, provider: 'Purelymail' });
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export const PURELYMAIL_DEFAULT_BASE_URL = 'https://purelymail.com';
|
|
13
|
+
export const PURELYMAIL_TOKEN_HEADER = 'Purelymail-Api-Token';
|
|
14
|
+
/** `listUser` returns at most this many addresses and cannot page. */
|
|
15
|
+
export const PURELYMAIL_LIST_USER_LIMIT = 1000;
|
|
16
|
+
/**
|
|
17
|
+
* Envelope codes this client classifies. Purelymail publishes no code table.
|
|
18
|
+
* `invalidToken` has been observed (for a wrong and for a missing token, both
|
|
19
|
+
* at HTTP 200); the absence codes are unconfirmed and only refine
|
|
20
|
+
* `invalid_request` to `not_found`.
|
|
21
|
+
*/
|
|
22
|
+
export const PURELYMAIL_AUTH_ERROR_CODES = new Set(['invalidToken']);
|
|
23
|
+
export const PURELYMAIL_NOT_FOUND_ERROR_CODES = new Set(['noSuchUser', 'noSuchDomain']);
|
|
24
|
+
export function readPurelymailEnvelope(body) {
|
|
25
|
+
if (typeof body !== 'object' || body === null || Array.isArray(body)) {
|
|
26
|
+
return { type: null, code: null, message: null, result: null };
|
|
27
|
+
}
|
|
28
|
+
const record = body;
|
|
29
|
+
const hasResult = Object.hasOwn(record, 'result');
|
|
30
|
+
const { type, code, message } = record;
|
|
31
|
+
return {
|
|
32
|
+
type: type === 'success' || type === 'error' ? type : type === undefined && hasResult ? 'success' : null,
|
|
33
|
+
code: typeof code === 'string' ? code : null,
|
|
34
|
+
message: typeof message === 'string' ? message : null,
|
|
35
|
+
result: hasResult ? record['result'] : null
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Classifies a failed answer: a known envelope code first, then a decisive
|
|
40
|
+
* status (401, 403, 404, 429), then an envelope refusal (`invalid_request`,
|
|
41
|
+
* never transient), then any other error status. A 2xx that is not an
|
|
42
|
+
* envelope is `invalid_response`.
|
|
43
|
+
*/
|
|
44
|
+
export function purelymailErrorKind(httpStatus, envelope) {
|
|
45
|
+
if (envelope.code !== null && PURELYMAIL_AUTH_ERROR_CODES.has(envelope.code))
|
|
46
|
+
return 'unauthorized';
|
|
47
|
+
if (envelope.code !== null && PURELYMAIL_NOT_FOUND_ERROR_CODES.has(envelope.code))
|
|
48
|
+
return 'not_found';
|
|
49
|
+
if ([401, 403, 404, 429].includes(httpStatus))
|
|
50
|
+
return kindFromStatus(httpStatus);
|
|
51
|
+
if (envelope.type === 'error')
|
|
52
|
+
return 'invalid_request';
|
|
53
|
+
return httpStatus >= 400 ? kindFromStatus(httpStatus) : 'invalid_response';
|
|
54
|
+
}
|
|
55
|
+
/** `local@domain`, the form every user operation except `createUser` takes. */
|
|
56
|
+
export function purelymailAddress(localPart, domainName) {
|
|
57
|
+
return `${localPart}@${domainName}`;
|
|
58
|
+
}
|
|
59
|
+
const sameDomain = (a, b) => a.trim().toLowerCase().replace(/\.$/, '') === b.trim().toLowerCase().replace(/\.$/, '');
|
|
60
|
+
export function createPurelymailClient(options) {
|
|
61
|
+
let token;
|
|
62
|
+
let http;
|
|
63
|
+
try {
|
|
64
|
+
token = assertHeaderSafe('Purelymail', 'API token', options.apiToken);
|
|
65
|
+
http = createHttpClient({
|
|
66
|
+
provider: 'Purelymail',
|
|
67
|
+
baseUrl: options.baseUrl ?? PURELYMAIL_DEFAULT_BASE_URL,
|
|
68
|
+
allowLoopbackHttp: options.allowLoopbackHttp ?? false,
|
|
69
|
+
headers: { accept: 'application/json', [PURELYMAIL_TOKEN_HEADER]: token },
|
|
70
|
+
secrets: [token],
|
|
71
|
+
rateBudget: options.rateBudget ?? createRateBudget({ provider: 'Purelymail', capacity: 6, refillPerSecond: 1 }),
|
|
72
|
+
createError: (input) => new PurelymailError(input),
|
|
73
|
+
...(options.fetch ? { fetch: options.fetch } : {}),
|
|
74
|
+
...(options.timeoutMs === undefined ? {} : { timeoutMs: options.timeoutMs }),
|
|
75
|
+
...(options.maxResponseBytes === undefined ? {} : { maxResponseBytes: options.maxResponseBytes })
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
if (error instanceof ProviderError && !(error instanceof PurelymailError)) {
|
|
80
|
+
throw new PurelymailError({ kind: error.kind, message: error.message });
|
|
81
|
+
}
|
|
82
|
+
throw error;
|
|
83
|
+
}
|
|
84
|
+
/** The one call every operation makes. Returns the envelope's `result`. */
|
|
85
|
+
async function call(operation, json, { signal } = {}, secrets = []) {
|
|
86
|
+
const result = await http.request({
|
|
87
|
+
operation,
|
|
88
|
+
method: 'POST',
|
|
89
|
+
path: purelymailPath(operation),
|
|
90
|
+
// Argument-less operations take `{}`, not an empty body.
|
|
91
|
+
json,
|
|
92
|
+
...(signal ? { signal } : {})
|
|
93
|
+
});
|
|
94
|
+
let body = null;
|
|
95
|
+
try {
|
|
96
|
+
body = JSON.parse(result.text);
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
// Not JSON: reported below as not being an envelope.
|
|
100
|
+
}
|
|
101
|
+
const envelope = readPurelymailEnvelope(body);
|
|
102
|
+
const ok = result.status >= 200 && result.status < 300;
|
|
103
|
+
// HTTP 200 proves nothing here: a refused token arrives as a 200 error envelope.
|
|
104
|
+
if (ok && envelope.type === 'success')
|
|
105
|
+
return envelope.result;
|
|
106
|
+
const text = envelope.message === null ? '' : safeProviderText(envelope.message, [token, ...secrets]);
|
|
107
|
+
throw new PurelymailError({
|
|
108
|
+
kind: purelymailErrorKind(result.status, envelope),
|
|
109
|
+
message: envelope.type === null
|
|
110
|
+
? `Purelymail answered ${operation} (HTTP ${result.status}) with something that is not an API response`
|
|
111
|
+
: `Purelymail refused ${operation} (HTTP ${result.status}${envelope.code ? `, ${envelope.code}` : ''})${text ? `: ${text}` : ''}`,
|
|
112
|
+
status: result.status,
|
|
113
|
+
operation,
|
|
114
|
+
providerCode: envelope.code === null ? null : safeProviderText(envelope.code, [token, ...secrets], 64),
|
|
115
|
+
retryAfterMs: result.retryAfterMs,
|
|
116
|
+
detail: envelope.type === null ? { notEnvelope: true } : {}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
const unreadable = (operation, field) => new PurelymailError({
|
|
120
|
+
kind: 'invalid_response',
|
|
121
|
+
message: `Purelymail answered ${operation} without a usable "${field}"`,
|
|
122
|
+
operation,
|
|
123
|
+
detail: { field }
|
|
124
|
+
});
|
|
125
|
+
const field = (result, key) => typeof result === 'object' && result !== null && !Array.isArray(result)
|
|
126
|
+
? result[key]
|
|
127
|
+
: undefined;
|
|
128
|
+
function string(result, key, operation) {
|
|
129
|
+
const value = field(result, key);
|
|
130
|
+
if (typeof value !== 'string' || value === '')
|
|
131
|
+
throw unreadable(operation, key);
|
|
132
|
+
return value;
|
|
133
|
+
}
|
|
134
|
+
function rows(result, key, schema, operation) {
|
|
135
|
+
const list = field(result, key);
|
|
136
|
+
if (!Array.isArray(list))
|
|
137
|
+
throw unreadable(operation, key);
|
|
138
|
+
// One unreadable row fails the list: these are read-backs, and a gap would read as absence.
|
|
139
|
+
return list.map((row) => {
|
|
140
|
+
const parsed = schema.safeParse(row);
|
|
141
|
+
if (!parsed.success)
|
|
142
|
+
throw unreadable(operation, String(parsed.error.issues[0]?.path[0] ?? key));
|
|
143
|
+
return parsed.data;
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
const listDomains = async ({ includeShared = false, ...request } = {}) => rows(await call('domain.list', { includeShared }, request), 'domains', domainSchema, 'domain.list').map(toDomain);
|
|
147
|
+
const checkAccountCredit = async (request) => string(await call('account.credit', {}, request), 'credit', 'account.credit');
|
|
148
|
+
return {
|
|
149
|
+
async probe(request) {
|
|
150
|
+
try {
|
|
151
|
+
await checkAccountCredit(request);
|
|
152
|
+
return { authenticated: true };
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
if (error instanceof PurelymailError && (error.kind === 'unauthorized' || error.kind === 'forbidden')) {
|
|
156
|
+
return { authenticated: false };
|
|
157
|
+
}
|
|
158
|
+
throw error;
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
getOwnershipCode: async (request) => string(await call('domain.ownershipCode', {}, request), 'code', 'domain.ownershipCode'),
|
|
162
|
+
async addDomain(domainName, request) {
|
|
163
|
+
await call('domain.add', { domainName }, request);
|
|
164
|
+
},
|
|
165
|
+
listDomains,
|
|
166
|
+
// Purelymail has no single-domain read; absence is read from the list.
|
|
167
|
+
findDomain: async (name, request) => (await listDomains(request)).find((domain) => sameDomain(domain.name, name)) ?? null,
|
|
168
|
+
async recheckDomainDns(domainName, request) {
|
|
169
|
+
// Only these two fields: the same call can change account-reset settings.
|
|
170
|
+
await call('domain.updateSettings', { name: domainName, recheckDns: true }, request);
|
|
171
|
+
},
|
|
172
|
+
async createUser(input, request) {
|
|
173
|
+
await call('user.create', {
|
|
174
|
+
userName: input.userName,
|
|
175
|
+
domainName: input.domainName,
|
|
176
|
+
password: input.password,
|
|
177
|
+
...(input.enablePasswordReset === undefined ? {} : { enablePasswordReset: input.enablePasswordReset }),
|
|
178
|
+
...(input.enableSearchIndexing === undefined ? {} : { enableSearchIndexing: input.enableSearchIndexing }),
|
|
179
|
+
...(input.sendWelcomeEmail === undefined ? {} : { sendWelcomeEmail: input.sendWelcomeEmail })
|
|
180
|
+
}, request, [input.password]);
|
|
181
|
+
},
|
|
182
|
+
async deleteUser(address, request) {
|
|
183
|
+
await call('user.delete', { userName: address }, request);
|
|
184
|
+
},
|
|
185
|
+
async listUsers(request) {
|
|
186
|
+
const list = field(await call('user.list', {}, request), 'users');
|
|
187
|
+
if (!Array.isArray(list))
|
|
188
|
+
throw unreadable('user.list', 'users');
|
|
189
|
+
if (list.length >= PURELYMAIL_LIST_USER_LIMIT) {
|
|
190
|
+
throw new PurelymailError({
|
|
191
|
+
kind: 'invalid_response',
|
|
192
|
+
message: `Purelymail listed ${list.length} users, its ceiling, so the list may be incomplete`,
|
|
193
|
+
operation: 'user.list',
|
|
194
|
+
detail: { count: list.length }
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
return list.filter((entry) => typeof entry === 'string');
|
|
198
|
+
},
|
|
199
|
+
listRoutingRules: async (request) => rows(await call('routing.list', {}, request), 'rules', routingRuleSchema, 'routing.list'),
|
|
200
|
+
async createRoutingRule(input, request) {
|
|
201
|
+
await call('routing.create', {
|
|
202
|
+
domainName: input.domainName,
|
|
203
|
+
// Required by the API even when false.
|
|
204
|
+
prefix: input.prefix ?? false,
|
|
205
|
+
matchUser: input.matchUser,
|
|
206
|
+
targetAddresses: [...input.targetAddresses],
|
|
207
|
+
catchall: input.catchall ?? false
|
|
208
|
+
}, request);
|
|
209
|
+
},
|
|
210
|
+
async deleteRoutingRule(routingRuleId, request) {
|
|
211
|
+
if (!Number.isSafeInteger(routingRuleId)) {
|
|
212
|
+
throw new PurelymailError({ kind: 'invalid_input', message: 'a routing rule id must be an integer' });
|
|
213
|
+
}
|
|
214
|
+
await call('routing.delete', { routingRuleId }, request);
|
|
215
|
+
},
|
|
216
|
+
checkAccountCredit
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,gBAAgB,EAKjB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,QAAQ,EAAqD,MAAM,YAAY,CAAC;AAC1H,OAAO,EAAE,cAAc,EAA4B,MAAM,iBAAiB,CAAC;AAE3E,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAE7B,MAAM,OAAO,eAAgB,SAAQ,aAAa;IAChD,YAAY,OAA+C;QACzD,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC;IAChD,CAAC;CACF;AAED,MAAM,CAAC,MAAM,2BAA2B,GAAG,wBAAwB,CAAC;AACpE,MAAM,CAAC,MAAM,uBAAuB,GAAG,sBAAsB,CAAC;AAC9D,sEAAsE;AACtE,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAwB,IAAI,GAAG,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC;AAC1F,MAAM,CAAC,MAAM,gCAAgC,GAAwB,IAAI,GAAG,CAAC,CAAC,YAAY,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,QAAQ,CAAC,CAAC;QAC5E,CAAC;QAED,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,CAClC,IAAI,CAAC,MAAM,IAAI,CAAC,cAAc,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,cAAc,CAAC;QAE3F,KAAK,CAAC,iBAAiB,CAAC,KAAK,EAAE,OAAO;YACpC,MAAM,IAAI,CACR,gBAAgB,EAChB;gBACE,UAAU,EAAE,KAAK,CAAC,UAAU;gBAC5B,uCAAuC;gBACvC,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,KAAK;gBAC7B,SAAS,EAAE,KAAK,CAAC,SAAS;gBAC1B,eAAe,EAAE,CAAC,GAAG,KAAK,CAAC,eAAe,CAAC;gBAC3C,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,KAAK;aAClC,EACD,OAAO,CACR,CAAC;QACJ,CAAC;QAED,KAAK,CAAC,iBAAiB,CAAC,aAAa,EAAE,OAAO;YAC5C,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE,CAAC;gBACzC,MAAM,IAAI,eAAe,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,sCAAsC,EAAE,CAAC,CAAC;YACxG,CAAC;YACD,MAAM,IAAI,CAAC,gBAAgB,EAAE,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC,CAAC;QAC3D,CAAC;QAED,kBAAkB;KACnB,CAAC;AACJ,CAAC"}
|
package/dist/model.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Purelymail's own check of a domain's DNS. Absent or non-boolean values are false. */
|
|
3
|
+
export interface PurelymailDnsSummary {
|
|
4
|
+
passesMx: boolean;
|
|
5
|
+
passesSpf: boolean;
|
|
6
|
+
passesDkim: boolean;
|
|
7
|
+
passesDmarc: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface PurelymailDomain {
|
|
10
|
+
name: string;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the domain can reset the account's admin password. Purelymail warns
|
|
13
|
+
* that anyone controlling the domain's DNS could then take over the account.
|
|
14
|
+
*/
|
|
15
|
+
allowAccountReset: boolean;
|
|
16
|
+
symbolicSubaddressing: boolean;
|
|
17
|
+
/** A Purelymail-owned shared domain. */
|
|
18
|
+
isShared: boolean;
|
|
19
|
+
dns: PurelymailDnsSummary;
|
|
20
|
+
}
|
|
21
|
+
/** How an alias or catch-all is expressed. */
|
|
22
|
+
export interface PurelymailRoutingRule {
|
|
23
|
+
/** An int64 in the API; the only argument `deleteRoutingRule` takes. */
|
|
24
|
+
id: number;
|
|
25
|
+
domainName: string;
|
|
26
|
+
/** `matchUser` is a prefix rather than the whole local part. */
|
|
27
|
+
prefix: boolean;
|
|
28
|
+
/** Local part, e.g. `abuse`; empty for a catch-all. */
|
|
29
|
+
matchUser: string;
|
|
30
|
+
targetAddresses: string[];
|
|
31
|
+
/** Does not fire when the address belongs to a real user. */
|
|
32
|
+
catchall: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare const domainSchema: z.ZodObject<{
|
|
35
|
+
name: z.ZodString;
|
|
36
|
+
allowAccountReset: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<boolean, unknown>>;
|
|
37
|
+
symbolicSubaddressing: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<boolean, unknown>>;
|
|
38
|
+
isShared: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<boolean, unknown>>;
|
|
39
|
+
dnsSummary: z.ZodPipe<z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<object, unknown>>, z.ZodObject<{
|
|
40
|
+
passesMx: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<boolean, unknown>>;
|
|
41
|
+
passesSpf: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<boolean, unknown>>;
|
|
42
|
+
passesDkim: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<boolean, unknown>>;
|
|
43
|
+
passesDmarc: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<boolean, unknown>>;
|
|
44
|
+
}, z.core.$strip>>;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
export declare const routingRuleSchema: z.ZodObject<{
|
|
47
|
+
id: z.ZodNumber;
|
|
48
|
+
domainName: z.ZodString;
|
|
49
|
+
prefix: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<boolean, unknown>>;
|
|
50
|
+
matchUser: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<string, unknown>>;
|
|
51
|
+
targetAddresses: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<string[], unknown>>;
|
|
52
|
+
catchall: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<boolean, unknown>>;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
export declare function toDomain(row: z.infer<typeof domainSchema>): PurelymailDomain;
|
|
55
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wFAAwF;AACxF,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,iBAAiB,EAAE,OAAO,CAAC;IAC3B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,wCAAwC;IACxC,QAAQ,EAAE,OAAO,CAAC;IAClB,GAAG,EAAE,oBAAoB,CAAC;CAC3B;AAED,8CAA8C;AAC9C,MAAM,WAAW,qBAAqB;IACpC,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,MAAM,EAAE,OAAO,CAAC;IAChB,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,6DAA6D;IAC7D,QAAQ,EAAE,OAAO,CAAC;CACnB;AAKD,eAAO,MAAM,YAAY;;;;;;;;;;;iBAUvB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;iBAU5B,CAAC;AAEH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,GAAG,gBAAgB,CAG5E"}
|
package/dist/model.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const flag = z.unknown().optional().transform((value) => value === true);
|
|
3
|
+
const name = z.string().min(1);
|
|
4
|
+
export const domainSchema = z.object({
|
|
5
|
+
name,
|
|
6
|
+
allowAccountReset: flag,
|
|
7
|
+
symbolicSubaddressing: flag,
|
|
8
|
+
isShared: flag,
|
|
9
|
+
dnsSummary: z
|
|
10
|
+
.unknown()
|
|
11
|
+
.optional()
|
|
12
|
+
.transform((value) => (typeof value === 'object' && value !== null && !Array.isArray(value) ? value : {}))
|
|
13
|
+
.pipe(z.object({ passesMx: flag, passesSpf: flag, passesDkim: flag, passesDmarc: flag }))
|
|
14
|
+
});
|
|
15
|
+
export const routingRuleSchema = z.object({
|
|
16
|
+
id: z.number().refine(Number.isFinite),
|
|
17
|
+
domainName: name,
|
|
18
|
+
prefix: flag,
|
|
19
|
+
matchUser: z.unknown().optional().transform((value) => (typeof value === 'string' ? value : '')),
|
|
20
|
+
targetAddresses: z
|
|
21
|
+
.unknown()
|
|
22
|
+
.optional()
|
|
23
|
+
.transform((value) => (Array.isArray(value) ? value.filter((entry) => typeof entry === 'string') : [])),
|
|
24
|
+
catchall: flag
|
|
25
|
+
});
|
|
26
|
+
export function toDomain(row) {
|
|
27
|
+
const { dnsSummary, ...rest } = row;
|
|
28
|
+
return { ...rest, dns: dnsSummary };
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqCxB,MAAM,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC;AACzE,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAE/B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,IAAI;IACJ,iBAAiB,EAAE,IAAI;IACvB,qBAAqB,EAAE,IAAI;IAC3B,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,CAAC;SACV,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SACzG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;CAC5F,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;IACtC,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE,IAAI;IACZ,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAChG,eAAe,EAAE,CAAC;SACf,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC1H,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC;AAEH,MAAM,UAAU,QAAQ,CAAC,GAAiC;IACxD,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,CAAC;IACpC,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every Purelymail API operation. The API is RPC-shaped: each operation is a
|
|
3
|
+
* `POST` to `/api/v0/<name>` with a JSON object body; there are no path
|
|
4
|
+
* parameters, query strings or other verbs. A wrong name answers HTTP 404 with
|
|
5
|
+
* an HTML page.
|
|
6
|
+
*
|
|
7
|
+
* Transcribed from the provider's OpenAPI document (`info.version` "0.0.1",
|
|
8
|
+
* nineteen paths), loaded by the API reference at
|
|
9
|
+
* https://news.purelymail.com/api/index.html. Keys are this package's labels,
|
|
10
|
+
* used as `operation` on errors; values are the provider's names. Operations
|
|
11
|
+
* the client does not call are listed so that the surface is complete.
|
|
12
|
+
*/
|
|
13
|
+
export declare const PURELYMAIL_OPERATIONS: {
|
|
14
|
+
readonly 'domain.add': 'addDomain';
|
|
15
|
+
/** Takes `{}`: the code belongs to the account, not to a domain. */
|
|
16
|
+
readonly 'domain.ownershipCode': 'getOwnershipCode';
|
|
17
|
+
readonly 'domain.list': 'listDomains';
|
|
18
|
+
/** The one operation whose domain field is `name`, not `domainName`. */
|
|
19
|
+
readonly 'domain.updateSettings': 'updateDomainSettings';
|
|
20
|
+
readonly 'domain.delete': 'deleteDomain';
|
|
21
|
+
/** `userName` is the local part here, and the full address everywhere else. */
|
|
22
|
+
readonly 'user.create': 'createUser';
|
|
23
|
+
readonly 'user.delete': 'deleteUser';
|
|
24
|
+
/** Singular, unlike the other list operations. At most 1000 users, no paging. */
|
|
25
|
+
readonly 'user.list': 'listUser';
|
|
26
|
+
readonly 'user.modify': 'modifyUser';
|
|
27
|
+
readonly 'user.get': 'getUser';
|
|
28
|
+
readonly 'passwordReset.upsert': 'upsertPasswordReset';
|
|
29
|
+
readonly 'passwordReset.delete': 'deletePasswordReset';
|
|
30
|
+
readonly 'passwordReset.list': 'listPasswordReset';
|
|
31
|
+
readonly 'routing.create': 'createRoutingRule';
|
|
32
|
+
readonly 'routing.delete': 'deleteRoutingRule';
|
|
33
|
+
readonly 'routing.list': 'listRoutingRules';
|
|
34
|
+
/** Returns a credential. Not called by this client. */
|
|
35
|
+
readonly 'appPassword.create': 'createAppPassword';
|
|
36
|
+
readonly 'appPassword.delete': 'deleteAppPassword';
|
|
37
|
+
/** Returns `{credit}` as a string. The cheapest authenticated read. */
|
|
38
|
+
readonly 'account.credit': 'checkAccountCredit';
|
|
39
|
+
};
|
|
40
|
+
export type PurelymailOperation = keyof typeof PURELYMAIL_OPERATIONS;
|
|
41
|
+
export declare const PURELYMAIL_API_PREFIX = "/api/v0";
|
|
42
|
+
/** `/api/v0/<name>` for an operation label. */
|
|
43
|
+
export declare function purelymailPath(operation: PurelymailOperation): string;
|
|
44
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB;aAChC,YAAY,EAAE,WAAW;IACzB,oEAAoE;aACpE,sBAAsB,EAAE,kBAAkB;aAC1C,aAAa,EAAE,aAAa;IAC5B,wEAAwE;aACxE,uBAAuB,EAAE,sBAAsB;aAC/C,eAAe,EAAE,cAAc;IAC/B,+EAA+E;aAC/E,aAAa,EAAE,YAAY;aAC3B,aAAa,EAAE,YAAY;IAC3B,iFAAiF;aACjF,WAAW,EAAE,UAAU;aACvB,aAAa,EAAE,YAAY;aAC3B,UAAU,EAAE,SAAS;aACrB,sBAAsB,EAAE,qBAAqB;aAC7C,sBAAsB,EAAE,qBAAqB;aAC7C,oBAAoB,EAAE,mBAAmB;aACzC,gBAAgB,EAAE,mBAAmB;aACrC,gBAAgB,EAAE,mBAAmB;aACrC,cAAc,EAAE,kBAAkB;IAClC,uDAAuD;aACvD,oBAAoB,EAAE,mBAAmB;aACzC,oBAAoB,EAAE,mBAAmB;IACzC,uEAAuE;aACvE,gBAAgB,EAAE,oBAAoB;CAC9B,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,qBAAqB,CAAC;AAErE,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAE/C,+CAA+C;AAC/C,wBAAgB,cAAc,CAAC,SAAS,EAAE,mBAAmB,GAAG,MAAM,CAErE"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every Purelymail API operation. The API is RPC-shaped: each operation is a
|
|
3
|
+
* `POST` to `/api/v0/<name>` with a JSON object body; there are no path
|
|
4
|
+
* parameters, query strings or other verbs. A wrong name answers HTTP 404 with
|
|
5
|
+
* an HTML page.
|
|
6
|
+
*
|
|
7
|
+
* Transcribed from the provider's OpenAPI document (`info.version` "0.0.1",
|
|
8
|
+
* nineteen paths), loaded by the API reference at
|
|
9
|
+
* https://news.purelymail.com/api/index.html. Keys are this package's labels,
|
|
10
|
+
* used as `operation` on errors; values are the provider's names. Operations
|
|
11
|
+
* the client does not call are listed so that the surface is complete.
|
|
12
|
+
*/
|
|
13
|
+
export const PURELYMAIL_OPERATIONS = {
|
|
14
|
+
'domain.add': 'addDomain',
|
|
15
|
+
/** Takes `{}`: the code belongs to the account, not to a domain. */
|
|
16
|
+
'domain.ownershipCode': 'getOwnershipCode',
|
|
17
|
+
'domain.list': 'listDomains',
|
|
18
|
+
/** The one operation whose domain field is `name`, not `domainName`. */
|
|
19
|
+
'domain.updateSettings': 'updateDomainSettings',
|
|
20
|
+
'domain.delete': 'deleteDomain',
|
|
21
|
+
/** `userName` is the local part here, and the full address everywhere else. */
|
|
22
|
+
'user.create': 'createUser',
|
|
23
|
+
'user.delete': 'deleteUser',
|
|
24
|
+
/** Singular, unlike the other list operations. At most 1000 users, no paging. */
|
|
25
|
+
'user.list': 'listUser',
|
|
26
|
+
'user.modify': 'modifyUser',
|
|
27
|
+
'user.get': 'getUser',
|
|
28
|
+
'passwordReset.upsert': 'upsertPasswordReset',
|
|
29
|
+
'passwordReset.delete': 'deletePasswordReset',
|
|
30
|
+
'passwordReset.list': 'listPasswordReset',
|
|
31
|
+
'routing.create': 'createRoutingRule',
|
|
32
|
+
'routing.delete': 'deleteRoutingRule',
|
|
33
|
+
'routing.list': 'listRoutingRules',
|
|
34
|
+
/** Returns a credential. Not called by this client. */
|
|
35
|
+
'appPassword.create': 'createAppPassword',
|
|
36
|
+
'appPassword.delete': 'deleteAppPassword',
|
|
37
|
+
/** Returns `{credit}` as a string. The cheapest authenticated read. */
|
|
38
|
+
'account.credit': 'checkAccountCredit'
|
|
39
|
+
};
|
|
40
|
+
export const PURELYMAIL_API_PREFIX = '/api/v0';
|
|
41
|
+
/** `/api/v0/<name>` for an operation label. */
|
|
42
|
+
export function purelymailPath(operation) {
|
|
43
|
+
return `${PURELYMAIL_API_PREFIX}/${PURELYMAIL_OPERATIONS[operation]}`;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,YAAY,EAAE,WAAW;IACzB,oEAAoE;IACpE,sBAAsB,EAAE,kBAAkB;IAC1C,aAAa,EAAE,aAAa;IAC5B,wEAAwE;IACxE,uBAAuB,EAAE,sBAAsB;IAC/C,eAAe,EAAE,cAAc;IAC/B,+EAA+E;IAC/E,aAAa,EAAE,YAAY;IAC3B,aAAa,EAAE,YAAY;IAC3B,iFAAiF;IACjF,WAAW,EAAE,UAAU;IACvB,aAAa,EAAE,YAAY;IAC3B,UAAU,EAAE,SAAS;IACrB,sBAAsB,EAAE,qBAAqB;IAC7C,sBAAsB,EAAE,qBAAqB;IAC7C,oBAAoB,EAAE,mBAAmB;IACzC,gBAAgB,EAAE,mBAAmB;IACrC,gBAAgB,EAAE,mBAAmB;IACrC,cAAc,EAAE,kBAAkB;IAClC,uDAAuD;IACvD,oBAAoB,EAAE,mBAAmB;IACzC,oBAAoB,EAAE,mBAAmB;IACzC,uEAAuE;IACvE,gBAAgB,EAAE,oBAAoB;CAC9B,CAAC;AAIX,MAAM,CAAC,MAAM,qBAAqB,GAAG,SAAS,CAAC;AAE/C,+CAA+C;AAC/C,MAAM,UAAU,cAAc,CAAC,SAA8B;IAC3D,OAAO,GAAG,qBAAqB,IAAI,qBAAqB,CAAC,SAAS,CAAC,EAAE,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type DnsRecord } from '@formless63/dns-plan';
|
|
2
|
+
/**
|
|
3
|
+
* The DNS records Purelymail requires for a custom domain.
|
|
4
|
+
*
|
|
5
|
+
* Source: https://purelymail.com/docs/domainDocs ("Custom Domain Setup"),
|
|
6
|
+
* checked 2026-11-26. Its numbering is kept:
|
|
7
|
+
*
|
|
8
|
+
* ```text
|
|
9
|
+
* #1 MX @ mailserver.purelymail.com priority 50
|
|
10
|
+
* #2 TXT @ v=spf1 include:_spf.purelymail.com ~all
|
|
11
|
+
* #3 TXT @ <ownership code> one per account
|
|
12
|
+
* #4 CNAME purelymail1._domainkey key1.dkimroot.purelymail.com
|
|
13
|
+
* #5 CNAME purelymail2._domainkey key2.dkimroot.purelymail.com
|
|
14
|
+
* #6 CNAME purelymail3._domainkey key3.dkimroot.purelymail.com
|
|
15
|
+
* #7 CNAME _dmarc dmarcroot.purelymail.com
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* - DMARC is a CNAME that delegates the policy to Purelymail, not a TXT policy.
|
|
19
|
+
* - There are three DKIM keys because Purelymail rotates between them;
|
|
20
|
+
* publishing one makes two thirds of mail fail DKIM.
|
|
21
|
+
* - The CNAMEs must not be proxied ("set it as DNS only (this is very
|
|
22
|
+
* important)"), so every record here has `proxied: false`.
|
|
23
|
+
* - TTLs "can generally be left to their defaults": `ttlSeconds` is null.
|
|
24
|
+
* - The ownership code is published verbatim; it has no prefix.
|
|
25
|
+
*/
|
|
26
|
+
export type PurelymailRecordPurpose = 'mx' | 'spf' | 'ownership' | 'dkim' | 'dmarc';
|
|
27
|
+
/** A `dns-plan` record, labelled with what it is for. */
|
|
28
|
+
export interface PurelymailDnsRecord extends DnsRecord {
|
|
29
|
+
type: 'MX' | 'TXT' | 'CNAME';
|
|
30
|
+
purpose: PurelymailRecordPurpose;
|
|
31
|
+
}
|
|
32
|
+
export declare const PURELYMAIL_MX_HOST = "mailserver.purelymail.com";
|
|
33
|
+
export declare const PURELYMAIL_MX_PRIORITY = 50;
|
|
34
|
+
export declare const PURELYMAIL_SPF_CONTENT = "v=spf1 include:_spf.purelymail.com ~all";
|
|
35
|
+
export declare const PURELYMAIL_DKIM_SELECTORS: readonly (Readonly<{
|
|
36
|
+
name: "purelymail1._domainkey";
|
|
37
|
+
content: "key1.dkimroot.purelymail.com";
|
|
38
|
+
}> | Readonly<{
|
|
39
|
+
name: "purelymail2._domainkey";
|
|
40
|
+
content: "key2.dkimroot.purelymail.com";
|
|
41
|
+
}> | Readonly<{
|
|
42
|
+
name: "purelymail3._domainkey";
|
|
43
|
+
content: "key3.dkimroot.purelymail.com";
|
|
44
|
+
}>)[];
|
|
45
|
+
export declare const PURELYMAIL_DMARC_NAME = "_dmarc";
|
|
46
|
+
export declare const PURELYMAIL_DMARC_CONTENT = "dmarcroot.purelymail.com";
|
|
47
|
+
/** Records in a fully published domain. */
|
|
48
|
+
export declare const PURELYMAIL_RECORD_COUNT = 7;
|
|
49
|
+
export interface PurelymailRecordsInput {
|
|
50
|
+
/** The mail domain, e.g. `example.com` or `mail.example.com`. */
|
|
51
|
+
domain: string;
|
|
52
|
+
/** The zone the names are relative to. Default: `domain` itself. */
|
|
53
|
+
zone?: string;
|
|
54
|
+
/** From `getOwnershipCode()`. Null or empty leaves the ownership record out. */
|
|
55
|
+
ownershipCode?: string | null;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The records a domain needs, named relative to `zone`: `@`, `_dmarc` and
|
|
59
|
+
* `purelymail1._domainkey` for the zone's own apex, `mail`,
|
|
60
|
+
* `_dmarc.mail` and so on for `mail.example.com` in `example.com`.
|
|
61
|
+
*
|
|
62
|
+
* Without an ownership code the six other records are returned; they can be
|
|
63
|
+
* published while the code is fetched. The ownership record comes last. Each
|
|
64
|
+
* call returns new objects.
|
|
65
|
+
*/
|
|
66
|
+
export declare function purelymailDnsRecords(input: PurelymailRecordsInput): PurelymailDnsRecord[];
|
|
67
|
+
//# sourceMappingURL=records.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../src/records.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,MAAM,uBAAuB,GAAG,IAAI,GAAG,KAAK,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC;AAEpF,yDAAyD;AACzD,MAAM,WAAW,mBAAoB,SAAQ,SAAS;IACpD,IAAI,EAAE,IAAI,GAAG,KAAK,GAAG,OAAO,CAAC;IAC7B,OAAO,EAAE,uBAAuB,CAAC;CAClC;AAED,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;AAC9D,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,eAAO,MAAM,sBAAsB,4CAA4C,CAAC;AAChF,eAAO,MAAM,yBAAyB;;;;;;;;;KAIpC,CAAC;AACH,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAC9C,eAAO,MAAM,wBAAwB,6BAA6B,CAAC;AACnE,2CAA2C;AAC3C,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,MAAM,WAAW,sBAAsB;IACrC,iEAAiE;IACjE,MAAM,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gFAAgF;IAChF,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAUD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,sBAAsB,GAAG,mBAAmB,EAAE,CAkBzF"}
|
package/dist/records.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { toFqdn, toRelativeName } from '@formless63/dns-plan';
|
|
2
|
+
export const PURELYMAIL_MX_HOST = 'mailserver.purelymail.com';
|
|
3
|
+
export const PURELYMAIL_MX_PRIORITY = 50;
|
|
4
|
+
export const PURELYMAIL_SPF_CONTENT = 'v=spf1 include:_spf.purelymail.com ~all';
|
|
5
|
+
export const PURELYMAIL_DKIM_SELECTORS = Object.freeze([
|
|
6
|
+
Object.freeze({ name: 'purelymail1._domainkey', content: 'key1.dkimroot.purelymail.com' }),
|
|
7
|
+
Object.freeze({ name: 'purelymail2._domainkey', content: 'key2.dkimroot.purelymail.com' }),
|
|
8
|
+
Object.freeze({ name: 'purelymail3._domainkey', content: 'key3.dkimroot.purelymail.com' })
|
|
9
|
+
]);
|
|
10
|
+
export const PURELYMAIL_DMARC_NAME = '_dmarc';
|
|
11
|
+
export const PURELYMAIL_DMARC_CONTENT = 'dmarcroot.purelymail.com';
|
|
12
|
+
/** Records in a fully published domain. */
|
|
13
|
+
export const PURELYMAIL_RECORD_COUNT = 7;
|
|
14
|
+
const record = (type, name, content, purpose, priority = null) => ({ type, name, content, ttlSeconds: null, priority, proxied: false, purpose });
|
|
15
|
+
/**
|
|
16
|
+
* The records a domain needs, named relative to `zone`: `@`, `_dmarc` and
|
|
17
|
+
* `purelymail1._domainkey` for the zone's own apex, `mail`,
|
|
18
|
+
* `_dmarc.mail` and so on for `mail.example.com` in `example.com`.
|
|
19
|
+
*
|
|
20
|
+
* Without an ownership code the six other records are returned; they can be
|
|
21
|
+
* published while the code is fetched. The ownership record comes last. Each
|
|
22
|
+
* call returns new objects.
|
|
23
|
+
*/
|
|
24
|
+
export function purelymailDnsRecords(input) {
|
|
25
|
+
const domain = toFqdn(input.domain, input.domain);
|
|
26
|
+
const zone = toFqdn(input.zone ?? domain, input.zone ?? domain);
|
|
27
|
+
if (domain === '' || (domain !== zone && !domain.endsWith(`.${zone}`))) {
|
|
28
|
+
throw new RangeError(`${input.domain} is not inside the zone ${input.zone ?? ''}`);
|
|
29
|
+
}
|
|
30
|
+
const at = (label) => toRelativeName(label === null ? domain : `${label}.${domain}`, zone);
|
|
31
|
+
const records = [
|
|
32
|
+
record('MX', at(null), PURELYMAIL_MX_HOST, 'mx', PURELYMAIL_MX_PRIORITY),
|
|
33
|
+
record('TXT', at(null), PURELYMAIL_SPF_CONTENT, 'spf'),
|
|
34
|
+
...PURELYMAIL_DKIM_SELECTORS.map((selector) => record('CNAME', at(selector.name), selector.content, 'dkim')),
|
|
35
|
+
record('CNAME', at(PURELYMAIL_DMARC_NAME), PURELYMAIL_DMARC_CONTENT, 'dmarc')
|
|
36
|
+
];
|
|
37
|
+
if (input.ownershipCode !== undefined && input.ownershipCode !== null && input.ownershipCode !== '') {
|
|
38
|
+
records.push(record('TXT', at(null), input.ownershipCode, 'ownership'));
|
|
39
|
+
}
|
|
40
|
+
return records;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=records.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"records.js","sourceRoot":"","sources":["../src/records.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAkB,MAAM,sBAAsB,CAAC;AAmC9E,MAAM,CAAC,MAAM,kBAAkB,GAAG,2BAA2B,CAAC;AAC9D,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AACzC,MAAM,CAAC,MAAM,sBAAsB,GAAG,yCAAyC,CAAC;AAChF,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC;IACrD,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,wBAAwB,EAAE,OAAO,EAAE,8BAA8B,EAAE,CAAC;IAC1F,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,wBAAwB,EAAE,OAAO,EAAE,8BAA8B,EAAE,CAAC;IAC1F,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,wBAAwB,EAAE,OAAO,EAAE,8BAA8B,EAAE,CAAC;CAC3F,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,QAAQ,CAAC;AAC9C,MAAM,CAAC,MAAM,wBAAwB,GAAG,0BAA0B,CAAC;AACnE,2CAA2C;AAC3C,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CA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AAE,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC5G,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,qBAAqB,CAAC,EAAE,wBAAwB,EAAE,OAAO,CAAC;KAC9E,CAAC;IACF,IAAI,KAAK,CAAC,aAAa,KAAK,SAAS,IAAI,KAAK,CAAC,aAAa,KAAK,IAAI,IAAI,KAAK,CAAC,aAAa,KAAK,EAAE,EAAE,CAAC;QACpG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formless63/purelymail-client",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Typed client for the Purelymail mail-hosting API, and the DNS records a Purelymail domain needs.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"purelymail",
|
|
7
|
+
"email",
|
|
8
|
+
"mail-hosting",
|
|
9
|
+
"dns"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/formless63/netlibs.git",
|
|
15
|
+
"directory": "packages/purelymail-client"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/formless63/netlibs/tree/main/packages/purelymail-client#readme",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/formless63/netlibs/issues"
|
|
20
|
+
},
|
|
21
|
+
"type": "module",
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=22"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"LICENSE",
|
|
29
|
+
"README.md"
|
|
30
|
+
],
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"default": "./dist/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./package.json": "./package.json"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@formless63/dns-plan": "^0.1.0",
|
|
40
|
+
"@formless63/provider-http": "^0.1.0",
|
|
41
|
+
"zod": "^4.6.0"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
}
|
|
46
|
+
}
|