resend-cli 1.0.3 → 1.2.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/.claude/settings.local.json +5 -0
- package/.claude/worktrees/emails-list/.claude/settings.local.json +5 -0
- package/.claude/worktrees/emails-list/.github/scripts/pr-title-check.js +34 -0
- package/.claude/worktrees/emails-list/.github/workflows/ci.yml +32 -0
- package/.claude/worktrees/emails-list/.github/workflows/pr-title-check.yml +13 -0
- package/.claude/worktrees/emails-list/.github/workflows/release.yml +93 -0
- package/.claude/worktrees/emails-list/CHANGELOG.md +31 -0
- package/.claude/worktrees/emails-list/LICENSE +21 -0
- package/.claude/worktrees/emails-list/README.md +424 -0
- package/.claude/worktrees/emails-list/biome.json +36 -0
- package/.claude/worktrees/emails-list/bun.lock +76 -0
- package/.claude/worktrees/emails-list/bunfig.toml +2 -0
- package/.claude/worktrees/emails-list/install.ps1 +140 -0
- package/.claude/worktrees/emails-list/install.sh +301 -0
- package/.claude/worktrees/emails-list/package.json +43 -0
- package/.claude/worktrees/emails-list/renovate.json +6 -0
- package/.claude/worktrees/emails-list/src/cli.ts +74 -0
- package/.claude/worktrees/emails-list/src/commands/api-keys/create.ts +114 -0
- package/.claude/worktrees/emails-list/src/commands/api-keys/delete.ts +47 -0
- package/.claude/worktrees/emails-list/src/commands/api-keys/index.ts +26 -0
- package/.claude/worktrees/emails-list/src/commands/api-keys/list.ts +35 -0
- package/.claude/worktrees/emails-list/src/commands/api-keys/utils.ts +8 -0
- package/.claude/worktrees/emails-list/src/commands/auth/index.ts +20 -0
- package/.claude/worktrees/emails-list/src/commands/auth/login.ts +207 -0
- package/.claude/worktrees/emails-list/src/commands/auth/logout.ts +105 -0
- package/.claude/worktrees/emails-list/src/commands/broadcasts/create.ts +196 -0
- package/.claude/worktrees/emails-list/src/commands/broadcasts/delete.ts +46 -0
- package/.claude/worktrees/emails-list/src/commands/broadcasts/get.ts +59 -0
- package/.claude/worktrees/emails-list/src/commands/broadcasts/index.ts +43 -0
- package/.claude/worktrees/emails-list/src/commands/broadcasts/list.ts +60 -0
- package/.claude/worktrees/emails-list/src/commands/broadcasts/send.ts +56 -0
- package/.claude/worktrees/emails-list/src/commands/broadcasts/update.ts +95 -0
- package/.claude/worktrees/emails-list/src/commands/broadcasts/utils.ts +35 -0
- package/.claude/worktrees/emails-list/src/commands/contact-properties/create.ts +118 -0
- package/.claude/worktrees/emails-list/src/commands/contact-properties/delete.ts +48 -0
- package/.claude/worktrees/emails-list/src/commands/contact-properties/get.ts +46 -0
- package/.claude/worktrees/emails-list/src/commands/contact-properties/index.ts +48 -0
- package/.claude/worktrees/emails-list/src/commands/contact-properties/list.ts +68 -0
- package/.claude/worktrees/emails-list/src/commands/contact-properties/update.ts +88 -0
- package/.claude/worktrees/emails-list/src/commands/contact-properties/utils.ts +17 -0
- package/.claude/worktrees/emails-list/src/commands/contacts/add-segment.ts +78 -0
- package/.claude/worktrees/emails-list/src/commands/contacts/create.ts +122 -0
- package/.claude/worktrees/emails-list/src/commands/contacts/delete.ts +49 -0
- package/.claude/worktrees/emails-list/src/commands/contacts/get.ts +53 -0
- package/.claude/worktrees/emails-list/src/commands/contacts/index.ts +58 -0
- package/.claude/worktrees/emails-list/src/commands/contacts/list.ts +57 -0
- package/.claude/worktrees/emails-list/src/commands/contacts/remove-segment.ts +48 -0
- package/.claude/worktrees/emails-list/src/commands/contacts/segments.ts +39 -0
- package/.claude/worktrees/emails-list/src/commands/contacts/topics.ts +45 -0
- package/.claude/worktrees/emails-list/src/commands/contacts/update-topics.ts +90 -0
- package/.claude/worktrees/emails-list/src/commands/contacts/update.ts +77 -0
- package/.claude/worktrees/emails-list/src/commands/contacts/utils.ts +119 -0
- package/.claude/worktrees/emails-list/src/commands/doctor.ts +298 -0
- package/.claude/worktrees/emails-list/src/commands/domains/create.ts +83 -0
- package/.claude/worktrees/emails-list/src/commands/domains/delete.ts +42 -0
- package/.claude/worktrees/emails-list/src/commands/domains/get.ts +47 -0
- package/.claude/worktrees/emails-list/src/commands/domains/index.ts +35 -0
- package/.claude/worktrees/emails-list/src/commands/domains/list.ts +53 -0
- package/.claude/worktrees/emails-list/src/commands/domains/update.ts +75 -0
- package/.claude/worktrees/emails-list/src/commands/domains/utils.ts +44 -0
- package/.claude/worktrees/emails-list/src/commands/domains/verify.ts +38 -0
- package/.claude/worktrees/emails-list/src/commands/emails/batch.ts +140 -0
- package/.claude/worktrees/emails-list/src/commands/emails/index.ts +28 -0
- package/.claude/worktrees/emails-list/src/commands/emails/list.ts +73 -0
- package/.claude/worktrees/emails-list/src/commands/emails/receiving/attachment.ts +55 -0
- package/.claude/worktrees/emails-list/src/commands/emails/receiving/attachments.ts +68 -0
- package/.claude/worktrees/emails-list/src/commands/emails/receiving/get.ts +58 -0
- package/.claude/worktrees/emails-list/src/commands/emails/receiving/index.ts +28 -0
- package/.claude/worktrees/emails-list/src/commands/emails/receiving/list.ts +59 -0
- package/.claude/worktrees/emails-list/src/commands/emails/receiving/utils.ts +38 -0
- package/.claude/worktrees/emails-list/src/commands/emails/send.ts +189 -0
- package/.claude/worktrees/emails-list/src/commands/open.ts +24 -0
- package/.claude/worktrees/emails-list/src/commands/segments/create.ts +50 -0
- package/.claude/worktrees/emails-list/src/commands/segments/delete.ts +47 -0
- package/.claude/worktrees/emails-list/src/commands/segments/get.ts +38 -0
- package/.claude/worktrees/emails-list/src/commands/segments/index.ts +36 -0
- package/.claude/worktrees/emails-list/src/commands/segments/list.ts +58 -0
- package/.claude/worktrees/emails-list/src/commands/segments/utils.ts +7 -0
- package/.claude/worktrees/emails-list/src/commands/teams/index.ts +10 -0
- package/.claude/worktrees/emails-list/src/commands/teams/list.ts +35 -0
- package/.claude/worktrees/emails-list/src/commands/teams/remove.ts +83 -0
- package/.claude/worktrees/emails-list/src/commands/teams/switch.ts +73 -0
- package/.claude/worktrees/emails-list/src/commands/topics/create.ts +73 -0
- package/.claude/worktrees/emails-list/src/commands/topics/delete.ts +47 -0
- package/.claude/worktrees/emails-list/src/commands/topics/get.ts +42 -0
- package/.claude/worktrees/emails-list/src/commands/topics/index.ts +42 -0
- package/.claude/worktrees/emails-list/src/commands/topics/list.ts +34 -0
- package/.claude/worktrees/emails-list/src/commands/topics/update.ts +59 -0
- package/.claude/worktrees/emails-list/src/commands/topics/utils.ts +16 -0
- package/.claude/worktrees/emails-list/src/commands/webhooks/create.ts +128 -0
- package/.claude/worktrees/emails-list/src/commands/webhooks/delete.ts +49 -0
- package/.claude/worktrees/emails-list/src/commands/webhooks/get.ts +42 -0
- package/.claude/worktrees/emails-list/src/commands/webhooks/index.ts +44 -0
- package/.claude/worktrees/emails-list/src/commands/webhooks/list.ts +55 -0
- package/.claude/worktrees/emails-list/src/commands/webhooks/update.ts +83 -0
- package/.claude/worktrees/emails-list/src/commands/webhooks/utils.ts +36 -0
- package/.claude/worktrees/emails-list/src/commands/whoami.ts +71 -0
- package/.claude/worktrees/emails-list/src/lib/actions.ts +157 -0
- package/.claude/worktrees/emails-list/src/lib/client.ts +34 -0
- package/.claude/worktrees/emails-list/src/lib/config.ts +211 -0
- package/.claude/worktrees/emails-list/src/lib/files.ts +15 -0
- package/.claude/worktrees/emails-list/src/lib/help-text.ts +38 -0
- package/.claude/worktrees/emails-list/src/lib/output.ts +54 -0
- package/.claude/worktrees/emails-list/src/lib/pagination.ts +36 -0
- package/.claude/worktrees/emails-list/src/lib/prompts.ts +149 -0
- package/.claude/worktrees/emails-list/src/lib/spinner.ts +93 -0
- package/.claude/worktrees/emails-list/src/lib/table.ts +57 -0
- package/.claude/worktrees/emails-list/src/lib/tty.ts +28 -0
- package/.claude/worktrees/emails-list/src/lib/version.ts +4 -0
- package/.claude/worktrees/emails-list/tests/commands/api-keys/create.test.ts +195 -0
- package/.claude/worktrees/emails-list/tests/commands/api-keys/delete.test.ts +156 -0
- package/.claude/worktrees/emails-list/tests/commands/api-keys/list.test.ts +133 -0
- package/.claude/worktrees/emails-list/tests/commands/auth/login.test.ts +119 -0
- package/.claude/worktrees/emails-list/tests/commands/auth/logout.test.ts +146 -0
- package/.claude/worktrees/emails-list/tests/commands/broadcasts/create.test.ts +447 -0
- package/.claude/worktrees/emails-list/tests/commands/broadcasts/delete.test.ts +182 -0
- package/.claude/worktrees/emails-list/tests/commands/broadcasts/get.test.ts +146 -0
- package/.claude/worktrees/emails-list/tests/commands/broadcasts/list.test.ts +196 -0
- package/.claude/worktrees/emails-list/tests/commands/broadcasts/send.test.ts +161 -0
- package/.claude/worktrees/emails-list/tests/commands/broadcasts/update.test.ts +283 -0
- package/.claude/worktrees/emails-list/tests/commands/contact-properties/create.test.ts +250 -0
- package/.claude/worktrees/emails-list/tests/commands/contact-properties/delete.test.ts +183 -0
- package/.claude/worktrees/emails-list/tests/commands/contact-properties/get.test.ts +144 -0
- package/.claude/worktrees/emails-list/tests/commands/contact-properties/list.test.ts +180 -0
- package/.claude/worktrees/emails-list/tests/commands/contact-properties/update.test.ts +216 -0
- package/.claude/worktrees/emails-list/tests/commands/contacts/add-segment.test.ts +188 -0
- package/.claude/worktrees/emails-list/tests/commands/contacts/create.test.ts +270 -0
- package/.claude/worktrees/emails-list/tests/commands/contacts/delete.test.ts +192 -0
- package/.claude/worktrees/emails-list/tests/commands/contacts/get.test.ts +148 -0
- package/.claude/worktrees/emails-list/tests/commands/contacts/list.test.ts +175 -0
- package/.claude/worktrees/emails-list/tests/commands/contacts/remove-segment.test.ts +166 -0
- package/.claude/worktrees/emails-list/tests/commands/contacts/segments.test.ts +167 -0
- package/.claude/worktrees/emails-list/tests/commands/contacts/topics.test.ts +163 -0
- package/.claude/worktrees/emails-list/tests/commands/contacts/update-topics.test.ts +247 -0
- package/.claude/worktrees/emails-list/tests/commands/contacts/update.test.ts +205 -0
- package/.claude/worktrees/emails-list/tests/commands/doctor.test.ts +165 -0
- package/.claude/worktrees/emails-list/tests/commands/domains/create.test.ts +192 -0
- package/.claude/worktrees/emails-list/tests/commands/domains/delete.test.ts +156 -0
- package/.claude/worktrees/emails-list/tests/commands/domains/get.test.ts +137 -0
- package/.claude/worktrees/emails-list/tests/commands/domains/list.test.ts +164 -0
- package/.claude/worktrees/emails-list/tests/commands/domains/update.test.ts +223 -0
- package/.claude/worktrees/emails-list/tests/commands/domains/verify.test.ts +117 -0
- package/.claude/worktrees/emails-list/tests/commands/emails/batch.test.ts +313 -0
- package/.claude/worktrees/emails-list/tests/commands/emails/list.test.ts +196 -0
- package/.claude/worktrees/emails-list/tests/commands/emails/receiving/attachment.test.ts +140 -0
- package/.claude/worktrees/emails-list/tests/commands/emails/receiving/attachments.test.ts +168 -0
- package/.claude/worktrees/emails-list/tests/commands/emails/receiving/get.test.ts +140 -0
- package/.claude/worktrees/emails-list/tests/commands/emails/receiving/list.test.ts +181 -0
- package/.claude/worktrees/emails-list/tests/commands/emails/send.test.ts +309 -0
- package/.claude/worktrees/emails-list/tests/commands/segments/create.test.ts +163 -0
- package/.claude/worktrees/emails-list/tests/commands/segments/delete.test.ts +182 -0
- package/.claude/worktrees/emails-list/tests/commands/segments/get.test.ts +137 -0
- package/.claude/worktrees/emails-list/tests/commands/segments/list.test.ts +173 -0
- package/.claude/worktrees/emails-list/tests/commands/teams/list.test.ts +63 -0
- package/.claude/worktrees/emails-list/tests/commands/teams/remove.test.ts +103 -0
- package/.claude/worktrees/emails-list/tests/commands/teams/switch.test.ts +96 -0
- package/.claude/worktrees/emails-list/tests/commands/topics/create.test.ts +191 -0
- package/.claude/worktrees/emails-list/tests/commands/topics/delete.test.ts +156 -0
- package/.claude/worktrees/emails-list/tests/commands/topics/get.test.ts +125 -0
- package/.claude/worktrees/emails-list/tests/commands/topics/list.test.ts +124 -0
- package/.claude/worktrees/emails-list/tests/commands/topics/update.test.ts +177 -0
- package/.claude/worktrees/emails-list/tests/commands/webhooks/create.test.ts +224 -0
- package/.claude/worktrees/emails-list/tests/commands/webhooks/delete.test.ts +156 -0
- package/.claude/worktrees/emails-list/tests/commands/webhooks/get.test.ts +125 -0
- package/.claude/worktrees/emails-list/tests/commands/webhooks/list.test.ts +177 -0
- package/.claude/worktrees/emails-list/tests/commands/webhooks/update.test.ts +206 -0
- package/.claude/worktrees/emails-list/tests/commands/whoami.test.ts +99 -0
- package/.claude/worktrees/emails-list/tests/helpers.ts +93 -0
- package/.claude/worktrees/emails-list/tests/lib/client.test.ts +71 -0
- package/.claude/worktrees/emails-list/tests/lib/config.test.ts +414 -0
- package/.claude/worktrees/emails-list/tests/lib/files.test.ts +65 -0
- package/.claude/worktrees/emails-list/tests/lib/help-text.test.ts +97 -0
- package/.claude/worktrees/emails-list/tests/lib/output.test.ts +127 -0
- package/.claude/worktrees/emails-list/tests/lib/prompts.test.ts +178 -0
- package/.claude/worktrees/emails-list/tests/lib/spinner.test.ts +146 -0
- package/.claude/worktrees/emails-list/tests/lib/table.test.ts +63 -0
- package/.claude/worktrees/emails-list/tests/lib/tty.test.ts +85 -0
- package/.claude/worktrees/emails-list/tsconfig.json +14 -0
- package/.github/scripts/pr-title-check.js +34 -0
- package/.github/workflows/ci.yml +32 -0
- package/.github/workflows/pr-title-check.yml +13 -0
- package/.github/workflows/release.yml +93 -0
- package/.github/workflows/test-build-windows.yml +44 -0
- package/.github/workflows/test-install-windows.yml +48 -0
- package/CHANGELOG.md +31 -0
- package/LICENSE +21 -21
- package/README.md +424 -19
- package/biome.json +36 -0
- package/bun.lock +76 -0
- package/bunfig.toml +2 -0
- package/docs/agent-dx-gaps.md +167 -0
- package/docs/missing-commands.md +58 -0
- package/docs/production-readiness.md +99 -0
- package/docs/secure-key-storage.md +174 -0
- package/install.ps1 +141 -0
- package/install.sh +301 -0
- package/package.json +43 -22
- package/renovate.json +4 -0
- package/src/cli.ts +74 -0
- package/src/commands/api-keys/create.ts +114 -0
- package/src/commands/api-keys/delete.ts +47 -0
- package/src/commands/api-keys/index.ts +26 -0
- package/src/commands/api-keys/list.ts +35 -0
- package/src/commands/api-keys/utils.ts +8 -0
- package/src/commands/auth/index.ts +20 -0
- package/src/commands/auth/login.ts +232 -0
- package/src/commands/auth/logout.ts +105 -0
- package/src/commands/broadcasts/create.ts +196 -0
- package/src/commands/broadcasts/delete.ts +46 -0
- package/src/commands/broadcasts/get.ts +59 -0
- package/src/commands/broadcasts/index.ts +43 -0
- package/src/commands/broadcasts/list.ts +60 -0
- package/src/commands/broadcasts/send.ts +56 -0
- package/src/commands/broadcasts/update.ts +95 -0
- package/src/commands/broadcasts/utils.ts +35 -0
- package/src/commands/contact-properties/create.ts +118 -0
- package/src/commands/contact-properties/delete.ts +48 -0
- package/src/commands/contact-properties/get.ts +46 -0
- package/src/commands/contact-properties/index.ts +48 -0
- package/src/commands/contact-properties/list.ts +68 -0
- package/src/commands/contact-properties/update.ts +88 -0
- package/src/commands/contact-properties/utils.ts +17 -0
- package/src/commands/contacts/add-segment.ts +78 -0
- package/src/commands/contacts/create.ts +122 -0
- package/src/commands/contacts/delete.ts +49 -0
- package/src/commands/contacts/get.ts +53 -0
- package/src/commands/contacts/index.ts +58 -0
- package/src/commands/contacts/list.ts +57 -0
- package/src/commands/contacts/remove-segment.ts +48 -0
- package/src/commands/contacts/segments.ts +39 -0
- package/src/commands/contacts/topics.ts +45 -0
- package/src/commands/contacts/update-topics.ts +90 -0
- package/src/commands/contacts/update.ts +77 -0
- package/src/commands/contacts/utils.ts +119 -0
- package/src/commands/doctor.ts +298 -0
- package/src/commands/domains/create.ts +83 -0
- package/src/commands/domains/delete.ts +42 -0
- package/src/commands/domains/get.ts +47 -0
- package/src/commands/domains/index.ts +35 -0
- package/src/commands/domains/list.ts +53 -0
- package/src/commands/domains/update.ts +75 -0
- package/src/commands/domains/utils.ts +44 -0
- package/src/commands/domains/verify.ts +38 -0
- package/src/commands/emails/batch.ts +140 -0
- package/src/commands/emails/index.ts +24 -0
- package/src/commands/emails/receiving/attachment.ts +55 -0
- package/src/commands/emails/receiving/attachments.ts +68 -0
- package/src/commands/emails/receiving/get.ts +58 -0
- package/src/commands/emails/receiving/index.ts +28 -0
- package/src/commands/emails/receiving/list.ts +59 -0
- package/src/commands/emails/receiving/utils.ts +38 -0
- package/src/commands/emails/send.ts +189 -0
- package/src/commands/open.ts +24 -0
- package/src/commands/segments/create.ts +50 -0
- package/src/commands/segments/delete.ts +47 -0
- package/src/commands/segments/get.ts +38 -0
- package/src/commands/segments/index.ts +36 -0
- package/src/commands/segments/list.ts +58 -0
- package/src/commands/segments/utils.ts +7 -0
- package/src/commands/teams/index.ts +10 -0
- package/src/commands/teams/list.ts +35 -0
- package/src/commands/teams/remove.ts +86 -0
- package/src/commands/teams/switch.ts +76 -0
- package/src/commands/topics/create.ts +73 -0
- package/src/commands/topics/delete.ts +47 -0
- package/src/commands/topics/get.ts +42 -0
- package/src/commands/topics/index.ts +42 -0
- package/src/commands/topics/list.ts +34 -0
- package/src/commands/topics/update.ts +59 -0
- package/src/commands/topics/utils.ts +16 -0
- package/src/commands/webhooks/create.ts +128 -0
- package/src/commands/webhooks/delete.ts +49 -0
- package/src/commands/webhooks/get.ts +42 -0
- package/src/commands/webhooks/index.ts +44 -0
- package/src/commands/webhooks/list.ts +55 -0
- package/src/commands/webhooks/update.ts +83 -0
- package/src/commands/webhooks/utils.ts +36 -0
- package/src/commands/whoami.ts +71 -0
- package/src/lib/actions.ts +157 -0
- package/src/lib/client.ts +34 -0
- package/src/lib/config.ts +218 -0
- package/src/lib/files.ts +15 -0
- package/src/lib/help-text.ts +38 -0
- package/src/lib/output.ts +54 -0
- package/src/lib/pagination.ts +36 -0
- package/src/lib/prompts.ts +149 -0
- package/src/lib/spinner.ts +93 -0
- package/src/lib/table.ts +57 -0
- package/src/lib/tty.ts +28 -0
- package/src/lib/version.ts +4 -0
- package/tests/commands/api-keys/create.test.ts +195 -0
- package/tests/commands/api-keys/delete.test.ts +156 -0
- package/tests/commands/api-keys/list.test.ts +133 -0
- package/tests/commands/auth/login.test.ts +154 -0
- package/tests/commands/auth/logout.test.ts +146 -0
- package/tests/commands/broadcasts/create.test.ts +447 -0
- package/tests/commands/broadcasts/delete.test.ts +182 -0
- package/tests/commands/broadcasts/get.test.ts +146 -0
- package/tests/commands/broadcasts/list.test.ts +196 -0
- package/tests/commands/broadcasts/send.test.ts +161 -0
- package/tests/commands/broadcasts/update.test.ts +283 -0
- package/tests/commands/contact-properties/create.test.ts +250 -0
- package/tests/commands/contact-properties/delete.test.ts +183 -0
- package/tests/commands/contact-properties/get.test.ts +144 -0
- package/tests/commands/contact-properties/list.test.ts +180 -0
- package/tests/commands/contact-properties/update.test.ts +216 -0
- package/tests/commands/contacts/add-segment.test.ts +188 -0
- package/tests/commands/contacts/create.test.ts +270 -0
- package/tests/commands/contacts/delete.test.ts +192 -0
- package/tests/commands/contacts/get.test.ts +148 -0
- package/tests/commands/contacts/list.test.ts +175 -0
- package/tests/commands/contacts/remove-segment.test.ts +166 -0
- package/tests/commands/contacts/segments.test.ts +167 -0
- package/tests/commands/contacts/topics.test.ts +163 -0
- package/tests/commands/contacts/update-topics.test.ts +247 -0
- package/tests/commands/contacts/update.test.ts +205 -0
- package/tests/commands/doctor.test.ts +165 -0
- package/tests/commands/domains/create.test.ts +192 -0
- package/tests/commands/domains/delete.test.ts +156 -0
- package/tests/commands/domains/get.test.ts +137 -0
- package/tests/commands/domains/list.test.ts +164 -0
- package/tests/commands/domains/update.test.ts +223 -0
- package/tests/commands/domains/verify.test.ts +117 -0
- package/tests/commands/emails/batch.test.ts +313 -0
- package/tests/commands/emails/receiving/attachment.test.ts +140 -0
- package/tests/commands/emails/receiving/attachments.test.ts +168 -0
- package/tests/commands/emails/receiving/get.test.ts +140 -0
- package/tests/commands/emails/receiving/list.test.ts +181 -0
- package/tests/commands/emails/send.test.ts +309 -0
- package/tests/commands/segments/create.test.ts +163 -0
- package/tests/commands/segments/delete.test.ts +182 -0
- package/tests/commands/segments/get.test.ts +137 -0
- package/tests/commands/segments/list.test.ts +173 -0
- package/tests/commands/teams/list.test.ts +63 -0
- package/tests/commands/teams/remove.test.ts +103 -0
- package/tests/commands/teams/switch.test.ts +96 -0
- package/tests/commands/topics/create.test.ts +191 -0
- package/tests/commands/topics/delete.test.ts +156 -0
- package/tests/commands/topics/get.test.ts +125 -0
- package/tests/commands/topics/list.test.ts +124 -0
- package/tests/commands/topics/update.test.ts +177 -0
- package/tests/commands/webhooks/create.test.ts +224 -0
- package/tests/commands/webhooks/delete.test.ts +156 -0
- package/tests/commands/webhooks/get.test.ts +125 -0
- package/tests/commands/webhooks/list.test.ts +177 -0
- package/tests/commands/webhooks/update.test.ts +206 -0
- package/tests/commands/whoami.test.ts +99 -0
- package/tests/helpers.ts +93 -0
- package/tests/lib/client.test.ts +71 -0
- package/tests/lib/config.test.ts +447 -0
- package/tests/lib/files.test.ts +65 -0
- package/tests/lib/help-text.test.ts +97 -0
- package/tests/lib/output.test.ts +127 -0
- package/tests/lib/prompts.test.ts +178 -0
- package/tests/lib/spinner.test.ts +146 -0
- package/tests/lib/table.test.ts +63 -0
- package/tests/lib/tty.test.ts +85 -0
- package/tsconfig.json +14 -0
- package/src/index.js +0 -72
- package/src/routes.js +0 -37
- package/src/sections/apikeys.js +0 -99
- package/src/sections/audiences.js +0 -84
- package/src/sections/contacts.js +0 -177
- package/src/sections/domain.js +0 -195
- package/src/sections/email.js +0 -132
package/src/routes.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import enquirer from "enquirer";
|
|
2
|
-
import email from "./sections/email.js";
|
|
3
|
-
import domain from "./sections/domain.js";
|
|
4
|
-
import apikeys from "./sections/apikeys.js";
|
|
5
|
-
import audiences from "./sections/audiences.js";
|
|
6
|
-
import contacts from "./sections/contacts.js";
|
|
7
|
-
|
|
8
|
-
export default async ({resend, apiKey, config}) => {
|
|
9
|
-
const prompt = new enquirer.Select({
|
|
10
|
-
message: "Choose a section",
|
|
11
|
-
choices: [
|
|
12
|
-
{name: "email", message: "Emails"},
|
|
13
|
-
{name: "domain", message: "Domains"},
|
|
14
|
-
{name: "apiKeys", message: "API Keys"},
|
|
15
|
-
{name: "audiences", message: "Audiences"},
|
|
16
|
-
{name: "contacts", message: "Contacts"},
|
|
17
|
-
]
|
|
18
|
-
})
|
|
19
|
-
const answer = await prompt.run()
|
|
20
|
-
switch (answer) {
|
|
21
|
-
case "email":
|
|
22
|
-
await email({resend, apiKey, config})
|
|
23
|
-
break
|
|
24
|
-
case "domain":
|
|
25
|
-
await domain({resend, apiKey, config})
|
|
26
|
-
break
|
|
27
|
-
case "apiKeys":
|
|
28
|
-
await apikeys({resend, apiKey, config})
|
|
29
|
-
break
|
|
30
|
-
case "audiences":
|
|
31
|
-
await audiences({resend, apiKey, config})
|
|
32
|
-
break
|
|
33
|
-
case "contacts":
|
|
34
|
-
await contacts({resend, apiKey, config})
|
|
35
|
-
break
|
|
36
|
-
}
|
|
37
|
-
}
|
package/src/sections/apikeys.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import ora from "ora"
|
|
2
|
-
import enquirer from "enquirer";
|
|
3
|
-
|
|
4
|
-
const logAPIKey = (apiKey) => {
|
|
5
|
-
console.log("- ID: " + apiKey.id)
|
|
6
|
-
if (apiKey.token) {
|
|
7
|
-
console.log("- API Key: " + apiKey.token)
|
|
8
|
-
}
|
|
9
|
-
if (apiKey.name) {
|
|
10
|
-
console.log("- Name: " + apiKey.name)
|
|
11
|
-
}
|
|
12
|
-
if (apiKey.created_at) {
|
|
13
|
-
console.log("- Created At: " + apiKey.created_at)
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default async function({resend}, apiKey) {
|
|
18
|
-
const prompt = new enquirer.Select({
|
|
19
|
-
message: "Choose an action",
|
|
20
|
-
choices: [
|
|
21
|
-
{name: "create", message: "Create API Key"},
|
|
22
|
-
{name: "list", message: "List API Keys"},
|
|
23
|
-
{name: "delete", message: "Delete API Key"},
|
|
24
|
-
]
|
|
25
|
-
})
|
|
26
|
-
const answer = await prompt.run()
|
|
27
|
-
switch (answer) {
|
|
28
|
-
case "create":
|
|
29
|
-
{
|
|
30
|
-
let form = new enquirer.Form({
|
|
31
|
-
name: "createApiKey",
|
|
32
|
-
message: "Create an API Key.\nPossible values for permission: full, sending.",
|
|
33
|
-
choices: [
|
|
34
|
-
{name: "name", message: "Name", initial: "My API Key"},
|
|
35
|
-
{name: "permission", message: "Permission", initial: "full"}
|
|
36
|
-
]
|
|
37
|
-
})
|
|
38
|
-
form = await form.run()
|
|
39
|
-
const name = form.name
|
|
40
|
-
const permission = form.permission === "sending" ? "sending_access" : "full_access"
|
|
41
|
-
const spinner = ora({text: "Creating API Key...", spinner: "toggle9"}).start()
|
|
42
|
-
const apiKey = await resend.apiKeys.create({name, permission})
|
|
43
|
-
spinner.stop()
|
|
44
|
-
console.log("IMPORTANT! Save this API key in a safe place. It will not be shown again.")
|
|
45
|
-
logAPIKey(apiKey.data)
|
|
46
|
-
}
|
|
47
|
-
break;
|
|
48
|
-
case "list":
|
|
49
|
-
{
|
|
50
|
-
const spinner2 = ora({text: "Fetching API Keys...", spinner: "toggle9"}).start()
|
|
51
|
-
const listApiKeysResponse = await resend.apiKeys.list()
|
|
52
|
-
spinner2.stop()
|
|
53
|
-
const choices = listApiKeysResponse.data.data.map((apiKey) => {
|
|
54
|
-
return {message: apiKey.name, name: apiKey.id}
|
|
55
|
-
})
|
|
56
|
-
//console.log(choices)
|
|
57
|
-
let answer = new enquirer.Select({
|
|
58
|
-
name: "listApiKeys",
|
|
59
|
-
message: "Choose an API Key to view info on",
|
|
60
|
-
choices
|
|
61
|
-
})
|
|
62
|
-
answer = await answer.run()
|
|
63
|
-
for (let apiKey of listApiKeysResponse.data.data) {
|
|
64
|
-
if (apiKey.id === answer) {
|
|
65
|
-
logAPIKey(apiKey)
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
break
|
|
70
|
-
case "delete":
|
|
71
|
-
{
|
|
72
|
-
const spinner3 = ora({text: "Fetching API Keys...", spinner: "toggle9"}).start()
|
|
73
|
-
const listApiKeysResponse2 = await resend.apiKeys.list()
|
|
74
|
-
spinner3.stop()
|
|
75
|
-
const choices2 = listApiKeysResponse2.data.data.map((apiKey) => {return {message: apiKey.name, name: apiKey.id}})
|
|
76
|
-
let answer2 = new enquirer.Select({
|
|
77
|
-
name: "deleteApiKey",
|
|
78
|
-
message: "Choose an API Key to delete",
|
|
79
|
-
choices: choices2
|
|
80
|
-
})
|
|
81
|
-
answer2 = await answer2.run()
|
|
82
|
-
console.log(answer2)
|
|
83
|
-
let confirmDelete = new enquirer.Confirm({
|
|
84
|
-
message: "If this API Key is the one you make resend-cli with, you will not be able to use resend-cli anymore with the same key. This action is IRREVERSIBLE!!"
|
|
85
|
-
})
|
|
86
|
-
confirmDelete = await confirmDelete.run()
|
|
87
|
-
if (!confirmDelete) {
|
|
88
|
-
console.log("Aborting...")
|
|
89
|
-
process.exit(0)
|
|
90
|
-
}
|
|
91
|
-
const spinner4 = ora({text: "Deleting API Key...", spinner: "toggle9"}).start()
|
|
92
|
-
await resend.apiKeys.remove(answer2)
|
|
93
|
-
spinner4.stop()
|
|
94
|
-
console.log("API Key deleted.")
|
|
95
|
-
}
|
|
96
|
-
break
|
|
97
|
-
}
|
|
98
|
-
process.exit(0)
|
|
99
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import ora from "ora"
|
|
2
|
-
import enquirer from "enquirer";
|
|
3
|
-
|
|
4
|
-
const logAudience = (audience) => {
|
|
5
|
-
console.log(`- ID: ${audience.id}`)
|
|
6
|
-
console.log(`- Name: ${audience.name}`)
|
|
7
|
-
if (audience.created_at) {
|
|
8
|
-
console.log(`- Created At: ${audience.created_at}`)
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default async function({resend, apiKey}) {
|
|
13
|
-
let mainForm = new enquirer.Select({
|
|
14
|
-
message: "Choose an action",
|
|
15
|
-
choices: [
|
|
16
|
-
{name: "add", message: "Add Audience"},
|
|
17
|
-
{name: "retrieve", message: "List/Retrieve Audience"},
|
|
18
|
-
{name: "delete", message: "Delete Audience"},
|
|
19
|
-
]
|
|
20
|
-
})
|
|
21
|
-
mainForm = await mainForm.run()
|
|
22
|
-
|
|
23
|
-
switch (mainForm) {
|
|
24
|
-
case "add":
|
|
25
|
-
{
|
|
26
|
-
let form = new enquirer.Form({
|
|
27
|
-
name: "createAudience",
|
|
28
|
-
message: "Create an audience",
|
|
29
|
-
choices: [
|
|
30
|
-
{name: "name", message: "Name", initial: "My Audience"},
|
|
31
|
-
]
|
|
32
|
-
})
|
|
33
|
-
form = await form.run()
|
|
34
|
-
const spinner = ora({text: "Creating audience...", spinner: "toggle9"}).start()
|
|
35
|
-
const audience = await resend.audiences.create({name: form.name})
|
|
36
|
-
spinner.stop()
|
|
37
|
-
console.log(`Audience created.`)
|
|
38
|
-
logAudience(audience.data)
|
|
39
|
-
}
|
|
40
|
-
break
|
|
41
|
-
case "retrieve":
|
|
42
|
-
{
|
|
43
|
-
const audienceId = await selectAudience({resend}, "Choose an audience")
|
|
44
|
-
const spinner = ora({text: "Retrieving audience...", spinner: "toggle9"}).start()
|
|
45
|
-
const audience = await resend.audiences.get(audienceId)
|
|
46
|
-
spinner.stop()
|
|
47
|
-
console.log(`Audience '${audience.data.name}' retrieved.`)
|
|
48
|
-
logAudience(audience.data)
|
|
49
|
-
}
|
|
50
|
-
break
|
|
51
|
-
case "delete":
|
|
52
|
-
{
|
|
53
|
-
const audienceId = await selectAudience({resend}, "Choose an audience")
|
|
54
|
-
let confirmation = new enquirer.Confirm({
|
|
55
|
-
message: "Are you sure you want to delete this audience?",
|
|
56
|
-
initial: false
|
|
57
|
-
})
|
|
58
|
-
confirmation = await confirmation.run()
|
|
59
|
-
if (!confirmation) {
|
|
60
|
-
console.log("Cancelled.")
|
|
61
|
-
process.exit(0)
|
|
62
|
-
}
|
|
63
|
-
const spinner = ora({text: "Deleting audience...", spinner: "toggle9"}).start()
|
|
64
|
-
await resend.audiences.remove(audienceId)
|
|
65
|
-
spinner.stop()
|
|
66
|
-
console.log("Audience deleted.")
|
|
67
|
-
}
|
|
68
|
-
break
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export async function selectAudience({resend}, message) {
|
|
73
|
-
const spinner = ora({text: "Fetching audiences...", spinner: "toggle9"}).start()
|
|
74
|
-
const audiences = await resend.audiences.list()
|
|
75
|
-
spinner.stop()
|
|
76
|
-
const choices = audiences.data.data.map((audience) => {return {message: audience.name, name: audience.id}})
|
|
77
|
-
let answer = new enquirer.Select({
|
|
78
|
-
name: "listAudiences",
|
|
79
|
-
message: message ?? "Choose an audience",
|
|
80
|
-
choices
|
|
81
|
-
})
|
|
82
|
-
answer = await answer.run()
|
|
83
|
-
return answer
|
|
84
|
-
}
|
package/src/sections/contacts.js
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import ora from "ora"
|
|
2
|
-
import enquirer from "enquirer";
|
|
3
|
-
import {selectAudience} from "./audiences.js";
|
|
4
|
-
|
|
5
|
-
const logContact = (contact) => {
|
|
6
|
-
console.log("- ID: " + contact.id)
|
|
7
|
-
console.log("- Email: " + contact.email)
|
|
8
|
-
console.log("- First Name: " + (contact.first_name ?? "N/A"))
|
|
9
|
-
console.log("- Last Name: " + (contact.last_name ?? "N/A"))
|
|
10
|
-
console.log("- Created At: " + contact.created_at)
|
|
11
|
-
console.log("- Unsubscribed: " + contact.unsubscribed)
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default async function({resend, apiKey}) {
|
|
16
|
-
const mainForm = new enquirer.Select({
|
|
17
|
-
message: "Choose an action",
|
|
18
|
-
choices: [
|
|
19
|
-
{name: "add", message: "Add Contact"},
|
|
20
|
-
{name: "retrieve", message: "Retrieve Contact"},
|
|
21
|
-
{name: "update", message: "Update Contact"},
|
|
22
|
-
{name: "delete", message: "Delete Contact"},
|
|
23
|
-
{name: "list", message: "List Contacts"},
|
|
24
|
-
]
|
|
25
|
-
})
|
|
26
|
-
const mainFormResponse = await mainForm.run()
|
|
27
|
-
switch (mainFormResponse) {
|
|
28
|
-
case "add":
|
|
29
|
-
{
|
|
30
|
-
const audienceID = await selectAudience({resend}, "Choose an audience to add a contact to")
|
|
31
|
-
let form = new enquirer.Form({
|
|
32
|
-
name: "createContact",
|
|
33
|
-
message: "Add a contact",
|
|
34
|
-
choices: [
|
|
35
|
-
{name: "email", message: "Email"},
|
|
36
|
-
{name: "firstName", message: "First Name", initial: ""},
|
|
37
|
-
{name: "lastName", message: "Last Name", initial: ""},
|
|
38
|
-
]
|
|
39
|
-
})
|
|
40
|
-
form = await form.run()
|
|
41
|
-
const spin = ora({text: "Adding contact...", spinner: "toggle9"}).start()
|
|
42
|
-
const contact = await resend.contacts.create({
|
|
43
|
-
audienceId: audienceID,
|
|
44
|
-
email: form.email,
|
|
45
|
-
firstName: form.firstName,
|
|
46
|
-
lastName: form.lastName
|
|
47
|
-
})
|
|
48
|
-
spin.stop()
|
|
49
|
-
//console.log(contact)
|
|
50
|
-
console.log(`Contact with ID ${contact.data.id} added.`)
|
|
51
|
-
}
|
|
52
|
-
break
|
|
53
|
-
case "retrieve":
|
|
54
|
-
{
|
|
55
|
-
const audienceId = await selectAudience({resend}, "Choose an audience")
|
|
56
|
-
let form = new enquirer.Form({
|
|
57
|
-
name: "retrieveContact",
|
|
58
|
-
message: "Retrieve a contact",
|
|
59
|
-
choices: [
|
|
60
|
-
{name: "emailOrID", message: "Email or Contact ID"},
|
|
61
|
-
]
|
|
62
|
-
})
|
|
63
|
-
form = await form.run()
|
|
64
|
-
if (form.emailOrID.includes("@")) {
|
|
65
|
-
// we need to list contacts and find the contact with the email
|
|
66
|
-
const spin = ora({text: "Retrieving contact...", spinner: "toggle9"}).start()
|
|
67
|
-
const contacts = await resend.contacts.list({audienceId})
|
|
68
|
-
for (let contact of contacts.data.data) {
|
|
69
|
-
if (contact.email === form.emailOrID) {
|
|
70
|
-
spin.stop()
|
|
71
|
-
logContact(contact)
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
} else {
|
|
75
|
-
const spin = ora({text: "Retrieving contact...", spinner: "toggle9"}).start()
|
|
76
|
-
const contact = await resend.contacts.get({id: form.emailOrID, audienceId})
|
|
77
|
-
spin.stop()
|
|
78
|
-
console.log("- Email: " + contact.data.email)
|
|
79
|
-
console.log("- First Name: " + (contact.data.first_name ?? "N/A"))
|
|
80
|
-
console.log("- Last Name: " + (contact.data.last_name ?? "N/A"))
|
|
81
|
-
console.log("- Created At: " + contact.data.created_at)
|
|
82
|
-
console.log("- Unsubscribed: " + contact.data.unsubscribed)
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
break
|
|
86
|
-
case "update":
|
|
87
|
-
{
|
|
88
|
-
const audienceId = await selectAudience({resend}, "Choose an audience")
|
|
89
|
-
let form = new enquirer.Form({
|
|
90
|
-
name: "updateContact",
|
|
91
|
-
message: "Update a contact",
|
|
92
|
-
choices: [
|
|
93
|
-
{name: "emailOrID", message: "Email or Contact ID"},
|
|
94
|
-
{name: "firstName", message: "First Name", initial: ""},
|
|
95
|
-
{name: "lastName", message: "Last Name", initial: ""},
|
|
96
|
-
{name: "unsubscribed", message: "Unsubscribed (either true or false)"}
|
|
97
|
-
]
|
|
98
|
-
})
|
|
99
|
-
form = await form.run()
|
|
100
|
-
if (form.emailOrID.includes("@")) {
|
|
101
|
-
// we need to list contacts and find the contact with the email
|
|
102
|
-
const spin = ora({text: "Updating contact...", spinner: "toggle9"}).start()
|
|
103
|
-
const contacts = await resend.contacts.list({audienceId})
|
|
104
|
-
for (let contact of contacts.data.data) {
|
|
105
|
-
if (contact.email === form.emailOrID) {
|
|
106
|
-
const contactUpdate = await resend.contacts.update({
|
|
107
|
-
id: contact.id,
|
|
108
|
-
audienceId,
|
|
109
|
-
firstName: form.firstName,
|
|
110
|
-
lastName: form.lastName,
|
|
111
|
-
unsubscribed: form.unsubscribed
|
|
112
|
-
})
|
|
113
|
-
spin.stop()
|
|
114
|
-
console.log(`Contact with ID ${contactUpdate.data.id} updated.`)
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
} else {
|
|
118
|
-
const spin = ora({text: "Updating contact...", spinner: "toggle9"}).start()
|
|
119
|
-
const contactUpdate = await resend.contacts.update({
|
|
120
|
-
id: form.emailOrID,
|
|
121
|
-
audienceId,
|
|
122
|
-
firstName: form.firstName,
|
|
123
|
-
lastName: form.lastName,
|
|
124
|
-
unsubscribed: form.unsubscribed
|
|
125
|
-
})
|
|
126
|
-
spin.stop()
|
|
127
|
-
console.log(`Contact with ID ${contactUpdate.data.id} updated.`)
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
break
|
|
131
|
-
case "delete":
|
|
132
|
-
{
|
|
133
|
-
const audienceId = await selectAudience({resend}, "Choose an audience")
|
|
134
|
-
let form = new enquirer.Form({
|
|
135
|
-
name: "deleteContact",
|
|
136
|
-
message: "Delete a contact",
|
|
137
|
-
choices: [
|
|
138
|
-
{name: "emailOrID", message: "Email or Contact ID"},
|
|
139
|
-
]
|
|
140
|
-
})
|
|
141
|
-
form = await form.run()
|
|
142
|
-
if (form.emailOrID.includes("@")) {
|
|
143
|
-
const spin = ora({text: "Deleting contact...", spinner: "toggle9"}).start()
|
|
144
|
-
const contactDelete = await resend.contacts.remove({email: form.emailOrID, audienceId})
|
|
145
|
-
spin.stop()
|
|
146
|
-
console.log(`Contact with ID ${form.emailOrID} deleted.`)
|
|
147
|
-
} else {
|
|
148
|
-
const spin = ora({text: "Deleting contact...", spinner: "toggle9"}).start()
|
|
149
|
-
const contactDelete = await resend.contacts.remove({id: form.emailOrID, audienceId})
|
|
150
|
-
spin.stop()
|
|
151
|
-
console.log(`Contact with ID ${form.emailOrID} deleted.`)
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
break
|
|
155
|
-
case "list":
|
|
156
|
-
{
|
|
157
|
-
const audienceId = await selectAudience({resend}, "Choose an audience")
|
|
158
|
-
const spin = ora({text: "Fetching contacts...", spinner: "toggle9"}).start()
|
|
159
|
-
const contacts = await resend.contacts.list({audienceId})
|
|
160
|
-
spin.stop()
|
|
161
|
-
//show a select with contact names
|
|
162
|
-
const choices = contacts.data.data.map((contact) => {return {message: contact.email, name: contact.id}})
|
|
163
|
-
let answer = new enquirer.Select({
|
|
164
|
-
name: "listContacts",
|
|
165
|
-
message: "Choose a contact to view info on",
|
|
166
|
-
choices
|
|
167
|
-
})
|
|
168
|
-
answer = await answer.run()
|
|
169
|
-
for (let contact of contacts.data.data) {
|
|
170
|
-
if (contact.id === answer) {
|
|
171
|
-
logContact(contact)
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
process.exit(0)
|
|
177
|
-
}
|
package/src/sections/domain.js
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import ora from "ora"
|
|
2
|
-
import enquirer from "enquirer";
|
|
3
|
-
|
|
4
|
-
const logDomain = (domain) => {
|
|
5
|
-
console.log(`ID: ${domain.data.id}`)
|
|
6
|
-
console.log(`Name: ${domain.data.name}`)
|
|
7
|
-
console.log(`Region: ${domain.data.region}`)
|
|
8
|
-
console.log(`Status: ${domain.data.status}`)
|
|
9
|
-
console.log(`Created At: ${domain.data.created_at}`)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default async function({resend}) {
|
|
13
|
-
let mainForm = new enquirer.Select({
|
|
14
|
-
message: "Choose an action",
|
|
15
|
-
choices: [
|
|
16
|
-
{name: "add", message: "Add Domain"},
|
|
17
|
-
{name: "retrieve", message: "Retrieve Domain"},
|
|
18
|
-
{name: "verify", message: "Verify Domain"},
|
|
19
|
-
{name: "update", message: "Update Domain"},
|
|
20
|
-
{name: "list", message: "List Domains"},
|
|
21
|
-
{name: "delete", message: "Delete Domain"},
|
|
22
|
-
]
|
|
23
|
-
})
|
|
24
|
-
mainForm = await mainForm.run()
|
|
25
|
-
switch (mainForm) {
|
|
26
|
-
case "add":
|
|
27
|
-
{
|
|
28
|
-
let form = new enquirer.Form({
|
|
29
|
-
name: "createDomain",
|
|
30
|
-
message: "Add a domain",
|
|
31
|
-
choices: [
|
|
32
|
-
{name: "name", message: "Domain/subdomain without http"},
|
|
33
|
-
{name: "region", message: "Region (possible values: us-east-1, eu-west-1, sa-east-1, ap-northeast-1)", initial: "us-east-1"},
|
|
34
|
-
]
|
|
35
|
-
})
|
|
36
|
-
form = await form.run()
|
|
37
|
-
const spin = ora({text: "Adding domain...", spinner: "toggle9"}).start()
|
|
38
|
-
const domain = await resend.domains.create({
|
|
39
|
-
name: form.name,
|
|
40
|
-
region: form.region
|
|
41
|
-
})
|
|
42
|
-
if (domain.error) {
|
|
43
|
-
spin.stop()
|
|
44
|
-
console.error(domain.error.message)
|
|
45
|
-
process.exit(1)
|
|
46
|
-
}
|
|
47
|
-
spin.stop()
|
|
48
|
-
console.log(`Domain with ID ${domain.data.id} added.`)
|
|
49
|
-
|
|
50
|
-
const choices = domain.data.records.map((record, i) => { return {name: i, message: `Record #${i+1}`} })
|
|
51
|
-
|
|
52
|
-
const records = new enquirer.Select({
|
|
53
|
-
name: "createRecords",
|
|
54
|
-
message: "Add all of the following records to your DNS provider",
|
|
55
|
-
choices
|
|
56
|
-
})
|
|
57
|
-
let recordsResult
|
|
58
|
-
async function iterateRecords() {
|
|
59
|
-
recordsResult = await records.run()
|
|
60
|
-
let record = domain.data.records[recordsResult]
|
|
61
|
-
console.log("Add the following record to your DNS provider:")
|
|
62
|
-
console.log(`- Type: ${record.type}`)
|
|
63
|
-
console.log(`- Value: ${record.value}`)
|
|
64
|
-
if (record.priority) {
|
|
65
|
-
console.log(`- Priority: ${record.priority}`)
|
|
66
|
-
}
|
|
67
|
-
if (record.ttl) {
|
|
68
|
-
console.log(`- TTL: ${record.ttl}`)
|
|
69
|
-
}
|
|
70
|
-
console.log("Once you have finished adding the records, run resend-cli and navigate to Domains -> Verify Domain.")
|
|
71
|
-
await iterateRecords()
|
|
72
|
-
}
|
|
73
|
-
await iterateRecords()
|
|
74
|
-
}
|
|
75
|
-
break
|
|
76
|
-
case "retrieve":
|
|
77
|
-
{
|
|
78
|
-
let form = new enquirer.Form({
|
|
79
|
-
name: "retrieveDomain",
|
|
80
|
-
message: "Retrieve a domain",
|
|
81
|
-
choices: [{name: "id", message: "Domain ID"},]
|
|
82
|
-
})
|
|
83
|
-
form = await form.run()
|
|
84
|
-
const spin = ora({text: "Retrieving domain...", spinner: "toggle9"}).start()
|
|
85
|
-
const domain = await resend.domains.get(form.id)
|
|
86
|
-
if (domain.error) {
|
|
87
|
-
spin.stop()
|
|
88
|
-
console.error(domain.error.message)
|
|
89
|
-
process.exit(1)
|
|
90
|
-
}
|
|
91
|
-
spin.stop()
|
|
92
|
-
logDomain(domain)
|
|
93
|
-
}
|
|
94
|
-
break
|
|
95
|
-
case "verify":
|
|
96
|
-
{
|
|
97
|
-
let form = new enquirer.Form({
|
|
98
|
-
name: "verifyDomain",
|
|
99
|
-
message: "Verify a domain",
|
|
100
|
-
choices: [{name: "id", message: "Domain ID"},]
|
|
101
|
-
})
|
|
102
|
-
form = await form.run()
|
|
103
|
-
const spin = ora({text: "Submitting request...", spinner: "toggle9"}).start()
|
|
104
|
-
const domain = await resend.domains.verify(form.id)
|
|
105
|
-
if (domain.error) {
|
|
106
|
-
spin.stop()
|
|
107
|
-
console.error(domain.error.message)
|
|
108
|
-
process.exit(1)
|
|
109
|
-
}
|
|
110
|
-
spin.stop()
|
|
111
|
-
console.log(`Domain with ID ${domain.data.id} submitted for verification.`)
|
|
112
|
-
}
|
|
113
|
-
break
|
|
114
|
-
case "update":
|
|
115
|
-
{
|
|
116
|
-
let id = new enquirer.Input({
|
|
117
|
-
message: "Enter the ID of the domain you want to update"
|
|
118
|
-
})
|
|
119
|
-
id = await id.run()
|
|
120
|
-
let confirm1 = new enquirer.Confirm({
|
|
121
|
-
message: "Enable click tracking?",
|
|
122
|
-
initial: false
|
|
123
|
-
})
|
|
124
|
-
confirm1 = await confirm1.run()
|
|
125
|
-
let confirm2 = new enquirer.Confirm({
|
|
126
|
-
message: "Enable open tracking?",
|
|
127
|
-
initial: false
|
|
128
|
-
})
|
|
129
|
-
confirm2 = await confirm2.run()
|
|
130
|
-
|
|
131
|
-
const spin = ora({text: "Updating domain...", spinner: "toggle9"}).start()
|
|
132
|
-
const domain = await resend.domains.update({
|
|
133
|
-
id,
|
|
134
|
-
clickTracking: confirm1,
|
|
135
|
-
openTracking: confirm2
|
|
136
|
-
})
|
|
137
|
-
if (domain.error) {
|
|
138
|
-
spin.stop()
|
|
139
|
-
console.error(domain.error.message)
|
|
140
|
-
process.exit(1)
|
|
141
|
-
}
|
|
142
|
-
spin.stop()
|
|
143
|
-
console.log(`Domain with ID ${domain.data.id} updated.`)
|
|
144
|
-
}
|
|
145
|
-
break
|
|
146
|
-
case "list":
|
|
147
|
-
{
|
|
148
|
-
const spin = ora({text: "Fetching domains...", spinner: "toggle9"}).start()
|
|
149
|
-
const domains = await resend.domains.list()
|
|
150
|
-
if (domains.error) {
|
|
151
|
-
spin.stop()
|
|
152
|
-
console.error(domains.error.message)
|
|
153
|
-
process.exit(1)
|
|
154
|
-
}
|
|
155
|
-
spin.stop()
|
|
156
|
-
const choices = domains.data.data.map((domain) => {return {message: domain.name, name: domain.id}})
|
|
157
|
-
let answer = new enquirer.Select({
|
|
158
|
-
name: "listDomains",
|
|
159
|
-
message: "Choose a domain",
|
|
160
|
-
choices
|
|
161
|
-
})
|
|
162
|
-
answer = await answer.run()
|
|
163
|
-
const domain = await resend.domains.get(answer)
|
|
164
|
-
logDomain(domain)
|
|
165
|
-
}
|
|
166
|
-
break
|
|
167
|
-
case "delete":
|
|
168
|
-
{
|
|
169
|
-
let form = new enquirer.Form({
|
|
170
|
-
name: "deleteDomain",
|
|
171
|
-
message: "Delete a domain",
|
|
172
|
-
choices: [{name: "id", message: "Domain ID"},]
|
|
173
|
-
})
|
|
174
|
-
form = await form.run()
|
|
175
|
-
let confirm = new enquirer.Confirm({
|
|
176
|
-
message: "Are you sure you want to delete this domain?",
|
|
177
|
-
initial: false
|
|
178
|
-
})
|
|
179
|
-
confirm = await confirm.run()
|
|
180
|
-
if (!confirm) {
|
|
181
|
-
console.log("Cancelled.")
|
|
182
|
-
process.exit(0)
|
|
183
|
-
}
|
|
184
|
-
const spin = ora({text: "Deleting domain...", spinner: "toggle9"}).start()
|
|
185
|
-
const domain = await resend.domains.remove(form.id)
|
|
186
|
-
if (domain.error) {
|
|
187
|
-
spin.stop()
|
|
188
|
-
console.error(domain.error.message)
|
|
189
|
-
process.exit(1)
|
|
190
|
-
}
|
|
191
|
-
spin.stop()
|
|
192
|
-
console.log(`Domain with ID ${form.id} deleted.`)
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|