@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.
Files changed (2) hide show
  1. package/README.md +17 -6
  2. 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
- MAILFN_URL=https://mail.example.com MAILFN_TOKEN=... mailfn inbox create --expires 3600 --idempotency-key run-123
7
- mailfn message wait inb_123 --sender-domain example.com --subject Verify --timeout 30000
8
- mailfn message extract inb_123 msg_123
9
- mailfn operations --json
10
- mailfn inbox create --json --show-secrets # explicit one-time credential reveal
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.0",
3
+ "version": "0.1.1",
4
4
  "description": "Least-privilege command-line interface for MailFn",
5
5
  "type": "module",
6
- "bin": { "mailfn": "./dist/cli.js" },
6
+ "bin": {
7
+ "mailfn": "./dist/cli.js"
8
+ },
7
9
  "main": "./dist/index.js",
8
10
  "types": "./dist/index.d.ts",
9
- "exports": { ".": { "types": "./dist/index.d.ts", "default": "./dist/index.js" } },
10
- "files": ["dist", "README.md"],
11
- "scripts": { "build": "tsc", "test": "vitest run", "typecheck": "tsc --noEmit", "lint": "tsc --noEmit", "clean": "rm -rf dist" },
12
- "keywords": ["mailfn", "email", "cli"],
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": { "type": "git", "url": "git+https://github.com/21nCo/super-functions.git", "directory": "mailfn/cli" },
16
- "publishConfig": { "access": "public" },
17
- "dependencies": { "@clifn/core": "0.1.0", "@mailfn/client": "0.1.0" },
18
- "devDependencies": { "@types/node": "^22.0.0", "typescript": "^5.6.0", "vitest": "3.2.4" }
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
  }