@mailfn/cli 0.1.0 → 0.1.1
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/README.md +17 -6
- package/package.json +44 -10
package/README.md
CHANGED
|
@@ -2,12 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
Least-privilege MailFn CLI built with `@clifn/core`.
|
|
4
4
|
|
|
5
|
+
The following shell example requires `jq`; it captures the explicitly revealed credential without printing it and uses the inbox-scoped token for subsequent calls.
|
|
6
|
+
|
|
5
7
|
```sh
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
set -eu
|
|
9
|
+
export MAILFN_URL=https://mail.example.com
|
|
10
|
+
# MAILFN_PROJECT_TOKEN must already contain a project token allowed to create inboxes.
|
|
11
|
+
# Use one idempotency key per logical run; reuse it only when retrying that same run.
|
|
12
|
+
run_id="run-$(date +%s)-$$"
|
|
13
|
+
started_at=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
14
|
+
created=$(MAILFN_TOKEN="$MAILFN_PROJECT_TOKEN" mailfn inbox create --expires 3600 --idempotency-key "$run_id" --json --show-secrets)
|
|
15
|
+
MAILFN_TOKEN=$(printf '%s' "$created" | jq -er '.credential.token')
|
|
16
|
+
export MAILFN_TOKEN
|
|
17
|
+
inbox_id=$(printf '%s' "$created" | jq -er '.inbox.id')
|
|
18
|
+
unset created
|
|
19
|
+
waited=$(mailfn message wait "$inbox_id" --sender-domain example.com --subject Verify --after "$started_at" --timeout 30000 --json)
|
|
20
|
+
message_id=$(printf '%s' "$waited" | jq -er 'select(.status == "matched") | .messages[0].id')
|
|
21
|
+
mailfn message extract "$inbox_id" "$message_id"
|
|
11
22
|
```
|
|
12
23
|
|
|
13
|
-
Commands cover inbox create/list/get/delete, message list/read/wait/extract, token revoke, domain create/verify, and operations. Text and `--json` output pass through the same command-aware sanitizer. Message bodies, raw data, credentials, webhook secrets, and verification values are redacted by default. `message extract` is an explicit content action; `--show-content` explicitly opts into message content and `--show-secrets` explicitly reveals one-time credentials.
|
|
24
|
+
Commands cover inbox create/list/get/delete, message list/read/attachments/wait/extract, token revoke, domain create/verify, and operations. Text and `--json` output pass through the same command-aware sanitizer. Message bodies, raw data, credentials, webhook secrets, and verification values are redacted by default. `message extract` is an explicit content action; `--show-content` explicitly opts into message content and `--show-secrets` explicitly reveals one-time credentials. Pass `--link` to `message extract` for a verification link instead of an OTP. `token revoke` requires a credential with `token:manage`, which inbox-scoped credentials do not have; revoke with the project credential.
|
package/package.json
CHANGED
|
@@ -1,19 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailfn/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Least-privilege command-line interface for MailFn",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"bin": {
|
|
6
|
+
"bin": {
|
|
7
|
+
"mailfn": "./dist/cli.js"
|
|
8
|
+
},
|
|
7
9
|
"main": "./dist/index.js",
|
|
8
10
|
"types": "./dist/index.d.ts",
|
|
9
|
-
"exports": {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc",
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"typecheck": "tsc --noEmit",
|
|
25
|
+
"lint": "tsc --noEmit",
|
|
26
|
+
"clean": "rm -rf dist"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"mailfn",
|
|
30
|
+
"email",
|
|
31
|
+
"cli"
|
|
32
|
+
],
|
|
13
33
|
"author": "21n",
|
|
14
34
|
"license": "MIT",
|
|
15
|
-
"repository": {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "git+https://github.com/21nCo/superfunctions.git",
|
|
38
|
+
"directory": "mailfn/cli"
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@clifn/core": "0.1.1",
|
|
45
|
+
"@mailfn/client": "0.1.1"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^22.0.0",
|
|
49
|
+
"typescript": "^5.6.0",
|
|
50
|
+
"vitest": "3.2.4"
|
|
51
|
+
},
|
|
52
|
+
"gitHead": "699d9d09932199d660333c57fe7bc646492ea3bf"
|
|
19
53
|
}
|