resend-cli 1.2.1 → 1.3.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/README.md +25 -10
- package/dist/cli.cjs +539 -0
- package/package.json +31 -13
- package/.claude/settings.local.json +0 -5
- package/.claude/worktrees/emails-list/.claude/settings.local.json +0 -5
- package/.claude/worktrees/emails-list/.github/scripts/pr-title-check.js +0 -34
- package/.claude/worktrees/emails-list/.github/workflows/ci.yml +0 -32
- package/.claude/worktrees/emails-list/.github/workflows/pr-title-check.yml +0 -13
- package/.claude/worktrees/emails-list/.github/workflows/release.yml +0 -93
- package/.claude/worktrees/emails-list/CHANGELOG.md +0 -31
- package/.claude/worktrees/emails-list/LICENSE +0 -21
- package/.claude/worktrees/emails-list/README.md +0 -424
- package/.claude/worktrees/emails-list/biome.json +0 -36
- package/.claude/worktrees/emails-list/bun.lock +0 -76
- package/.claude/worktrees/emails-list/bunfig.toml +0 -2
- package/.claude/worktrees/emails-list/install.ps1 +0 -140
- package/.claude/worktrees/emails-list/install.sh +0 -301
- package/.claude/worktrees/emails-list/package.json +0 -43
- package/.claude/worktrees/emails-list/renovate.json +0 -6
- package/.claude/worktrees/emails-list/src/cli.ts +0 -74
- package/.claude/worktrees/emails-list/src/commands/api-keys/create.ts +0 -114
- package/.claude/worktrees/emails-list/src/commands/api-keys/delete.ts +0 -47
- package/.claude/worktrees/emails-list/src/commands/api-keys/index.ts +0 -26
- package/.claude/worktrees/emails-list/src/commands/api-keys/list.ts +0 -35
- package/.claude/worktrees/emails-list/src/commands/api-keys/utils.ts +0 -8
- package/.claude/worktrees/emails-list/src/commands/auth/index.ts +0 -20
- package/.claude/worktrees/emails-list/src/commands/auth/login.ts +0 -207
- package/.claude/worktrees/emails-list/src/commands/auth/logout.ts +0 -105
- package/.claude/worktrees/emails-list/src/commands/broadcasts/create.ts +0 -196
- package/.claude/worktrees/emails-list/src/commands/broadcasts/delete.ts +0 -46
- package/.claude/worktrees/emails-list/src/commands/broadcasts/get.ts +0 -59
- package/.claude/worktrees/emails-list/src/commands/broadcasts/index.ts +0 -43
- package/.claude/worktrees/emails-list/src/commands/broadcasts/list.ts +0 -60
- package/.claude/worktrees/emails-list/src/commands/broadcasts/send.ts +0 -56
- package/.claude/worktrees/emails-list/src/commands/broadcasts/update.ts +0 -95
- package/.claude/worktrees/emails-list/src/commands/broadcasts/utils.ts +0 -35
- package/.claude/worktrees/emails-list/src/commands/contact-properties/create.ts +0 -118
- package/.claude/worktrees/emails-list/src/commands/contact-properties/delete.ts +0 -48
- package/.claude/worktrees/emails-list/src/commands/contact-properties/get.ts +0 -46
- package/.claude/worktrees/emails-list/src/commands/contact-properties/index.ts +0 -48
- package/.claude/worktrees/emails-list/src/commands/contact-properties/list.ts +0 -68
- package/.claude/worktrees/emails-list/src/commands/contact-properties/update.ts +0 -88
- package/.claude/worktrees/emails-list/src/commands/contact-properties/utils.ts +0 -17
- package/.claude/worktrees/emails-list/src/commands/contacts/add-segment.ts +0 -78
- package/.claude/worktrees/emails-list/src/commands/contacts/create.ts +0 -122
- package/.claude/worktrees/emails-list/src/commands/contacts/delete.ts +0 -49
- package/.claude/worktrees/emails-list/src/commands/contacts/get.ts +0 -53
- package/.claude/worktrees/emails-list/src/commands/contacts/index.ts +0 -58
- package/.claude/worktrees/emails-list/src/commands/contacts/list.ts +0 -57
- package/.claude/worktrees/emails-list/src/commands/contacts/remove-segment.ts +0 -48
- package/.claude/worktrees/emails-list/src/commands/contacts/segments.ts +0 -39
- package/.claude/worktrees/emails-list/src/commands/contacts/topics.ts +0 -45
- package/.claude/worktrees/emails-list/src/commands/contacts/update-topics.ts +0 -90
- package/.claude/worktrees/emails-list/src/commands/contacts/update.ts +0 -77
- package/.claude/worktrees/emails-list/src/commands/contacts/utils.ts +0 -119
- package/.claude/worktrees/emails-list/src/commands/doctor.ts +0 -298
- package/.claude/worktrees/emails-list/src/commands/domains/create.ts +0 -83
- package/.claude/worktrees/emails-list/src/commands/domains/delete.ts +0 -42
- package/.claude/worktrees/emails-list/src/commands/domains/get.ts +0 -47
- package/.claude/worktrees/emails-list/src/commands/domains/index.ts +0 -35
- package/.claude/worktrees/emails-list/src/commands/domains/list.ts +0 -53
- package/.claude/worktrees/emails-list/src/commands/domains/update.ts +0 -75
- package/.claude/worktrees/emails-list/src/commands/domains/utils.ts +0 -44
- package/.claude/worktrees/emails-list/src/commands/domains/verify.ts +0 -38
- package/.claude/worktrees/emails-list/src/commands/emails/batch.ts +0 -140
- package/.claude/worktrees/emails-list/src/commands/emails/index.ts +0 -28
- package/.claude/worktrees/emails-list/src/commands/emails/list.ts +0 -73
- package/.claude/worktrees/emails-list/src/commands/emails/receiving/attachment.ts +0 -55
- package/.claude/worktrees/emails-list/src/commands/emails/receiving/attachments.ts +0 -68
- package/.claude/worktrees/emails-list/src/commands/emails/receiving/get.ts +0 -58
- package/.claude/worktrees/emails-list/src/commands/emails/receiving/index.ts +0 -28
- package/.claude/worktrees/emails-list/src/commands/emails/receiving/list.ts +0 -59
- package/.claude/worktrees/emails-list/src/commands/emails/receiving/utils.ts +0 -38
- package/.claude/worktrees/emails-list/src/commands/emails/send.ts +0 -189
- package/.claude/worktrees/emails-list/src/commands/open.ts +0 -24
- package/.claude/worktrees/emails-list/src/commands/segments/create.ts +0 -50
- package/.claude/worktrees/emails-list/src/commands/segments/delete.ts +0 -47
- package/.claude/worktrees/emails-list/src/commands/segments/get.ts +0 -38
- package/.claude/worktrees/emails-list/src/commands/segments/index.ts +0 -36
- package/.claude/worktrees/emails-list/src/commands/segments/list.ts +0 -58
- package/.claude/worktrees/emails-list/src/commands/segments/utils.ts +0 -7
- package/.claude/worktrees/emails-list/src/commands/teams/index.ts +0 -10
- package/.claude/worktrees/emails-list/src/commands/teams/list.ts +0 -35
- package/.claude/worktrees/emails-list/src/commands/teams/remove.ts +0 -83
- package/.claude/worktrees/emails-list/src/commands/teams/switch.ts +0 -73
- package/.claude/worktrees/emails-list/src/commands/topics/create.ts +0 -73
- package/.claude/worktrees/emails-list/src/commands/topics/delete.ts +0 -47
- package/.claude/worktrees/emails-list/src/commands/topics/get.ts +0 -42
- package/.claude/worktrees/emails-list/src/commands/topics/index.ts +0 -42
- package/.claude/worktrees/emails-list/src/commands/topics/list.ts +0 -34
- package/.claude/worktrees/emails-list/src/commands/topics/update.ts +0 -59
- package/.claude/worktrees/emails-list/src/commands/topics/utils.ts +0 -16
- package/.claude/worktrees/emails-list/src/commands/webhooks/create.ts +0 -128
- package/.claude/worktrees/emails-list/src/commands/webhooks/delete.ts +0 -49
- package/.claude/worktrees/emails-list/src/commands/webhooks/get.ts +0 -42
- package/.claude/worktrees/emails-list/src/commands/webhooks/index.ts +0 -44
- package/.claude/worktrees/emails-list/src/commands/webhooks/list.ts +0 -55
- package/.claude/worktrees/emails-list/src/commands/webhooks/update.ts +0 -83
- package/.claude/worktrees/emails-list/src/commands/webhooks/utils.ts +0 -36
- package/.claude/worktrees/emails-list/src/commands/whoami.ts +0 -71
- package/.claude/worktrees/emails-list/src/lib/actions.ts +0 -157
- package/.claude/worktrees/emails-list/src/lib/client.ts +0 -34
- package/.claude/worktrees/emails-list/src/lib/config.ts +0 -211
- package/.claude/worktrees/emails-list/src/lib/files.ts +0 -15
- package/.claude/worktrees/emails-list/src/lib/help-text.ts +0 -38
- package/.claude/worktrees/emails-list/src/lib/output.ts +0 -54
- package/.claude/worktrees/emails-list/src/lib/pagination.ts +0 -36
- package/.claude/worktrees/emails-list/src/lib/prompts.ts +0 -149
- package/.claude/worktrees/emails-list/src/lib/spinner.ts +0 -93
- package/.claude/worktrees/emails-list/src/lib/table.ts +0 -57
- package/.claude/worktrees/emails-list/src/lib/tty.ts +0 -28
- package/.claude/worktrees/emails-list/src/lib/version.ts +0 -4
- package/.claude/worktrees/emails-list/tests/commands/api-keys/create.test.ts +0 -195
- package/.claude/worktrees/emails-list/tests/commands/api-keys/delete.test.ts +0 -156
- package/.claude/worktrees/emails-list/tests/commands/api-keys/list.test.ts +0 -133
- package/.claude/worktrees/emails-list/tests/commands/auth/login.test.ts +0 -119
- package/.claude/worktrees/emails-list/tests/commands/auth/logout.test.ts +0 -146
- package/.claude/worktrees/emails-list/tests/commands/broadcasts/create.test.ts +0 -447
- package/.claude/worktrees/emails-list/tests/commands/broadcasts/delete.test.ts +0 -182
- package/.claude/worktrees/emails-list/tests/commands/broadcasts/get.test.ts +0 -146
- package/.claude/worktrees/emails-list/tests/commands/broadcasts/list.test.ts +0 -196
- package/.claude/worktrees/emails-list/tests/commands/broadcasts/send.test.ts +0 -161
- package/.claude/worktrees/emails-list/tests/commands/broadcasts/update.test.ts +0 -283
- package/.claude/worktrees/emails-list/tests/commands/contact-properties/create.test.ts +0 -250
- package/.claude/worktrees/emails-list/tests/commands/contact-properties/delete.test.ts +0 -183
- package/.claude/worktrees/emails-list/tests/commands/contact-properties/get.test.ts +0 -144
- package/.claude/worktrees/emails-list/tests/commands/contact-properties/list.test.ts +0 -180
- package/.claude/worktrees/emails-list/tests/commands/contact-properties/update.test.ts +0 -216
- package/.claude/worktrees/emails-list/tests/commands/contacts/add-segment.test.ts +0 -188
- package/.claude/worktrees/emails-list/tests/commands/contacts/create.test.ts +0 -270
- package/.claude/worktrees/emails-list/tests/commands/contacts/delete.test.ts +0 -192
- package/.claude/worktrees/emails-list/tests/commands/contacts/get.test.ts +0 -148
- package/.claude/worktrees/emails-list/tests/commands/contacts/list.test.ts +0 -175
- package/.claude/worktrees/emails-list/tests/commands/contacts/remove-segment.test.ts +0 -166
- package/.claude/worktrees/emails-list/tests/commands/contacts/segments.test.ts +0 -167
- package/.claude/worktrees/emails-list/tests/commands/contacts/topics.test.ts +0 -163
- package/.claude/worktrees/emails-list/tests/commands/contacts/update-topics.test.ts +0 -247
- package/.claude/worktrees/emails-list/tests/commands/contacts/update.test.ts +0 -205
- package/.claude/worktrees/emails-list/tests/commands/doctor.test.ts +0 -165
- package/.claude/worktrees/emails-list/tests/commands/domains/create.test.ts +0 -192
- package/.claude/worktrees/emails-list/tests/commands/domains/delete.test.ts +0 -156
- package/.claude/worktrees/emails-list/tests/commands/domains/get.test.ts +0 -137
- package/.claude/worktrees/emails-list/tests/commands/domains/list.test.ts +0 -164
- package/.claude/worktrees/emails-list/tests/commands/domains/update.test.ts +0 -223
- package/.claude/worktrees/emails-list/tests/commands/domains/verify.test.ts +0 -117
- package/.claude/worktrees/emails-list/tests/commands/emails/batch.test.ts +0 -313
- package/.claude/worktrees/emails-list/tests/commands/emails/list.test.ts +0 -196
- package/.claude/worktrees/emails-list/tests/commands/emails/receiving/attachment.test.ts +0 -140
- package/.claude/worktrees/emails-list/tests/commands/emails/receiving/attachments.test.ts +0 -168
- package/.claude/worktrees/emails-list/tests/commands/emails/receiving/get.test.ts +0 -140
- package/.claude/worktrees/emails-list/tests/commands/emails/receiving/list.test.ts +0 -181
- package/.claude/worktrees/emails-list/tests/commands/emails/send.test.ts +0 -309
- package/.claude/worktrees/emails-list/tests/commands/segments/create.test.ts +0 -163
- package/.claude/worktrees/emails-list/tests/commands/segments/delete.test.ts +0 -182
- package/.claude/worktrees/emails-list/tests/commands/segments/get.test.ts +0 -137
- package/.claude/worktrees/emails-list/tests/commands/segments/list.test.ts +0 -173
- package/.claude/worktrees/emails-list/tests/commands/teams/list.test.ts +0 -63
- package/.claude/worktrees/emails-list/tests/commands/teams/remove.test.ts +0 -103
- package/.claude/worktrees/emails-list/tests/commands/teams/switch.test.ts +0 -96
- package/.claude/worktrees/emails-list/tests/commands/topics/create.test.ts +0 -191
- package/.claude/worktrees/emails-list/tests/commands/topics/delete.test.ts +0 -156
- package/.claude/worktrees/emails-list/tests/commands/topics/get.test.ts +0 -125
- package/.claude/worktrees/emails-list/tests/commands/topics/list.test.ts +0 -124
- package/.claude/worktrees/emails-list/tests/commands/topics/update.test.ts +0 -177
- package/.claude/worktrees/emails-list/tests/commands/webhooks/create.test.ts +0 -224
- package/.claude/worktrees/emails-list/tests/commands/webhooks/delete.test.ts +0 -156
- package/.claude/worktrees/emails-list/tests/commands/webhooks/get.test.ts +0 -125
- package/.claude/worktrees/emails-list/tests/commands/webhooks/list.test.ts +0 -177
- package/.claude/worktrees/emails-list/tests/commands/webhooks/update.test.ts +0 -206
- package/.claude/worktrees/emails-list/tests/commands/whoami.test.ts +0 -99
- package/.claude/worktrees/emails-list/tests/helpers.ts +0 -93
- package/.claude/worktrees/emails-list/tests/lib/client.test.ts +0 -71
- package/.claude/worktrees/emails-list/tests/lib/config.test.ts +0 -414
- package/.claude/worktrees/emails-list/tests/lib/files.test.ts +0 -65
- package/.claude/worktrees/emails-list/tests/lib/help-text.test.ts +0 -97
- package/.claude/worktrees/emails-list/tests/lib/output.test.ts +0 -127
- package/.claude/worktrees/emails-list/tests/lib/prompts.test.ts +0 -178
- package/.claude/worktrees/emails-list/tests/lib/spinner.test.ts +0 -146
- package/.claude/worktrees/emails-list/tests/lib/table.test.ts +0 -63
- package/.claude/worktrees/emails-list/tests/lib/tty.test.ts +0 -85
- package/.claude/worktrees/emails-list/tsconfig.json +0 -14
- package/.github/scripts/pr-title-check.js +0 -34
- package/.github/workflows/ci.yml +0 -32
- package/.github/workflows/pr-title-check.yml +0 -13
- package/.github/workflows/release.yml +0 -120
- package/.github/workflows/test-install-windows.yml +0 -48
- package/CHANGELOG.md +0 -31
- package/biome.json +0 -36
- package/bun.lock +0 -76
- package/bunfig.toml +0 -2
- package/docs/agent-dx-gaps.md +0 -167
- package/docs/missing-commands.md +0 -58
- package/docs/production-readiness.md +0 -99
- package/docs/secure-key-storage.md +0 -174
- package/install.ps1 +0 -141
- package/install.sh +0 -301
- package/renovate.json +0 -4
- package/src/cli.ts +0 -82
- package/src/commands/api-keys/create.ts +0 -114
- package/src/commands/api-keys/delete.ts +0 -47
- package/src/commands/api-keys/index.ts +0 -26
- package/src/commands/api-keys/list.ts +0 -35
- package/src/commands/api-keys/utils.ts +0 -8
- package/src/commands/auth/index.ts +0 -20
- package/src/commands/auth/login.ts +0 -207
- package/src/commands/auth/logout.ts +0 -105
- package/src/commands/broadcasts/create.ts +0 -196
- package/src/commands/broadcasts/delete.ts +0 -46
- package/src/commands/broadcasts/get.ts +0 -59
- package/src/commands/broadcasts/index.ts +0 -43
- package/src/commands/broadcasts/list.ts +0 -60
- package/src/commands/broadcasts/send.ts +0 -56
- package/src/commands/broadcasts/update.ts +0 -95
- package/src/commands/broadcasts/utils.ts +0 -35
- package/src/commands/contact-properties/create.ts +0 -118
- package/src/commands/contact-properties/delete.ts +0 -48
- package/src/commands/contact-properties/get.ts +0 -46
- package/src/commands/contact-properties/index.ts +0 -48
- package/src/commands/contact-properties/list.ts +0 -68
- package/src/commands/contact-properties/update.ts +0 -88
- package/src/commands/contact-properties/utils.ts +0 -17
- package/src/commands/contacts/add-segment.ts +0 -78
- package/src/commands/contacts/create.ts +0 -122
- package/src/commands/contacts/delete.ts +0 -49
- package/src/commands/contacts/get.ts +0 -53
- package/src/commands/contacts/index.ts +0 -58
- package/src/commands/contacts/list.ts +0 -57
- package/src/commands/contacts/remove-segment.ts +0 -48
- package/src/commands/contacts/segments.ts +0 -39
- package/src/commands/contacts/topics.ts +0 -45
- package/src/commands/contacts/update-topics.ts +0 -90
- package/src/commands/contacts/update.ts +0 -77
- package/src/commands/contacts/utils.ts +0 -119
- package/src/commands/doctor.ts +0 -298
- package/src/commands/domains/create.ts +0 -83
- package/src/commands/domains/delete.ts +0 -42
- package/src/commands/domains/get.ts +0 -47
- package/src/commands/domains/index.ts +0 -35
- package/src/commands/domains/list.ts +0 -53
- package/src/commands/domains/update.ts +0 -75
- package/src/commands/domains/utils.ts +0 -44
- package/src/commands/domains/verify.ts +0 -38
- package/src/commands/emails/batch.ts +0 -140
- package/src/commands/emails/index.ts +0 -24
- package/src/commands/emails/receiving/attachment.ts +0 -55
- package/src/commands/emails/receiving/attachments.ts +0 -68
- package/src/commands/emails/receiving/get.ts +0 -58
- package/src/commands/emails/receiving/index.ts +0 -28
- package/src/commands/emails/receiving/list.ts +0 -59
- package/src/commands/emails/receiving/utils.ts +0 -38
- package/src/commands/emails/send.ts +0 -189
- package/src/commands/open.ts +0 -24
- package/src/commands/segments/create.ts +0 -50
- package/src/commands/segments/delete.ts +0 -47
- package/src/commands/segments/get.ts +0 -38
- package/src/commands/segments/index.ts +0 -36
- package/src/commands/segments/list.ts +0 -58
- package/src/commands/segments/utils.ts +0 -7
- package/src/commands/teams/index.ts +0 -10
- package/src/commands/teams/list.ts +0 -35
- package/src/commands/teams/remove.ts +0 -83
- package/src/commands/teams/switch.ts +0 -73
- package/src/commands/topics/create.ts +0 -73
- package/src/commands/topics/delete.ts +0 -47
- package/src/commands/topics/get.ts +0 -42
- package/src/commands/topics/index.ts +0 -42
- package/src/commands/topics/list.ts +0 -34
- package/src/commands/topics/update.ts +0 -59
- package/src/commands/topics/utils.ts +0 -16
- package/src/commands/webhooks/create.ts +0 -128
- package/src/commands/webhooks/delete.ts +0 -49
- package/src/commands/webhooks/get.ts +0 -42
- package/src/commands/webhooks/index.ts +0 -44
- package/src/commands/webhooks/list.ts +0 -55
- package/src/commands/webhooks/update.ts +0 -83
- package/src/commands/webhooks/utils.ts +0 -36
- package/src/commands/whoami.ts +0 -71
- package/src/lib/actions.ts +0 -157
- package/src/lib/client.ts +0 -37
- package/src/lib/config.ts +0 -211
- package/src/lib/files.ts +0 -15
- package/src/lib/help-text.ts +0 -38
- package/src/lib/output.ts +0 -54
- package/src/lib/pagination.ts +0 -36
- package/src/lib/prompts.ts +0 -149
- package/src/lib/spinner.ts +0 -93
- package/src/lib/table.ts +0 -57
- package/src/lib/tty.ts +0 -28
- package/src/lib/version.ts +0 -4
- package/tests/commands/api-keys/create.test.ts +0 -195
- package/tests/commands/api-keys/delete.test.ts +0 -156
- package/tests/commands/api-keys/list.test.ts +0 -133
- package/tests/commands/auth/login.test.ts +0 -119
- package/tests/commands/auth/logout.test.ts +0 -146
- package/tests/commands/broadcasts/create.test.ts +0 -447
- package/tests/commands/broadcasts/delete.test.ts +0 -182
- package/tests/commands/broadcasts/get.test.ts +0 -146
- package/tests/commands/broadcasts/list.test.ts +0 -196
- package/tests/commands/broadcasts/send.test.ts +0 -161
- package/tests/commands/broadcasts/update.test.ts +0 -283
- package/tests/commands/contact-properties/create.test.ts +0 -250
- package/tests/commands/contact-properties/delete.test.ts +0 -183
- package/tests/commands/contact-properties/get.test.ts +0 -144
- package/tests/commands/contact-properties/list.test.ts +0 -180
- package/tests/commands/contact-properties/update.test.ts +0 -216
- package/tests/commands/contacts/add-segment.test.ts +0 -188
- package/tests/commands/contacts/create.test.ts +0 -270
- package/tests/commands/contacts/delete.test.ts +0 -192
- package/tests/commands/contacts/get.test.ts +0 -148
- package/tests/commands/contacts/list.test.ts +0 -175
- package/tests/commands/contacts/remove-segment.test.ts +0 -166
- package/tests/commands/contacts/segments.test.ts +0 -167
- package/tests/commands/contacts/topics.test.ts +0 -163
- package/tests/commands/contacts/update-topics.test.ts +0 -247
- package/tests/commands/contacts/update.test.ts +0 -205
- package/tests/commands/doctor.test.ts +0 -165
- package/tests/commands/domains/create.test.ts +0 -192
- package/tests/commands/domains/delete.test.ts +0 -156
- package/tests/commands/domains/get.test.ts +0 -137
- package/tests/commands/domains/list.test.ts +0 -164
- package/tests/commands/domains/update.test.ts +0 -223
- package/tests/commands/domains/verify.test.ts +0 -117
- package/tests/commands/emails/batch.test.ts +0 -313
- package/tests/commands/emails/receiving/attachment.test.ts +0 -140
- package/tests/commands/emails/receiving/attachments.test.ts +0 -168
- package/tests/commands/emails/receiving/get.test.ts +0 -140
- package/tests/commands/emails/receiving/list.test.ts +0 -181
- package/tests/commands/emails/send.test.ts +0 -309
- package/tests/commands/segments/create.test.ts +0 -163
- package/tests/commands/segments/delete.test.ts +0 -182
- package/tests/commands/segments/get.test.ts +0 -137
- package/tests/commands/segments/list.test.ts +0 -173
- package/tests/commands/teams/list.test.ts +0 -63
- package/tests/commands/teams/remove.test.ts +0 -103
- package/tests/commands/teams/switch.test.ts +0 -96
- package/tests/commands/topics/create.test.ts +0 -191
- package/tests/commands/topics/delete.test.ts +0 -156
- package/tests/commands/topics/get.test.ts +0 -125
- package/tests/commands/topics/list.test.ts +0 -124
- package/tests/commands/topics/update.test.ts +0 -177
- package/tests/commands/webhooks/create.test.ts +0 -224
- package/tests/commands/webhooks/delete.test.ts +0 -156
- package/tests/commands/webhooks/get.test.ts +0 -125
- package/tests/commands/webhooks/list.test.ts +0 -177
- package/tests/commands/webhooks/update.test.ts +0 -206
- package/tests/commands/whoami.test.ts +0 -99
- package/tests/helpers.ts +0 -93
- package/tests/lib/client.test.ts +0 -71
- package/tests/lib/config.test.ts +0 -414
- package/tests/lib/files.test.ts +0 -65
- package/tests/lib/help-text.test.ts +0 -97
- package/tests/lib/output.test.ts +0 -127
- package/tests/lib/prompts.test.ts +0 -178
- package/tests/lib/spinner.test.ts +0 -146
- package/tests/lib/table.test.ts +0 -63
- package/tests/lib/tty.test.ts +0 -85
- package/tsconfig.json +0 -14
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { execFile } from 'node:child_process';
|
|
2
|
-
import * as p from '@clack/prompts';
|
|
3
|
-
import { Command } from '@commander-js/extra-typings';
|
|
4
|
-
import { Resend } from 'resend';
|
|
5
|
-
import type { GlobalOpts } from '../../lib/client';
|
|
6
|
-
import { listTeams, resolveApiKey, storeApiKey } from '../../lib/config';
|
|
7
|
-
import { buildHelpText } from '../../lib/help-text';
|
|
8
|
-
import { errorMessage, outputError, outputResult } from '../../lib/output';
|
|
9
|
-
import { cancelAndExit } from '../../lib/prompts';
|
|
10
|
-
import { createSpinner } from '../../lib/spinner';
|
|
11
|
-
import { isInteractive } from '../../lib/tty';
|
|
12
|
-
|
|
13
|
-
const RESEND_API_KEYS_URL = 'https://resend.com/api-keys?new=true';
|
|
14
|
-
|
|
15
|
-
function openInBrowser(url: string): Promise<boolean> {
|
|
16
|
-
return new Promise((resolve) => {
|
|
17
|
-
// `start` on Windows is a shell built-in, not an executable.
|
|
18
|
-
// Must invoke via `cmd.exe /c start <url>`.
|
|
19
|
-
const cmd =
|
|
20
|
-
process.platform === 'win32'
|
|
21
|
-
? 'cmd.exe'
|
|
22
|
-
: process.platform === 'darwin'
|
|
23
|
-
? 'open'
|
|
24
|
-
: 'xdg-open';
|
|
25
|
-
const args =
|
|
26
|
-
process.platform === 'win32' ? ['/c', 'start', '""', url] : [url];
|
|
27
|
-
execFile(cmd, args, { timeout: 5000 }, (err) => resolve(!err));
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const loginCommand = new Command('login')
|
|
32
|
-
.description('Save a Resend API key to the local credentials file')
|
|
33
|
-
.option('--key <key>', 'API key to store (required in non-interactive mode)')
|
|
34
|
-
.addHelpText(
|
|
35
|
-
'after',
|
|
36
|
-
buildHelpText({
|
|
37
|
-
setup: true,
|
|
38
|
-
context:
|
|
39
|
-
'Non-interactive: --key is required (no prompts will appear when stdin/stdout is not a TTY).',
|
|
40
|
-
output: ` {"success":true,"config_path":"<path>"}`,
|
|
41
|
-
errorCodes: ['missing_key', 'invalid_key_format', 'validation_failed'],
|
|
42
|
-
examples: [
|
|
43
|
-
'resend login --key re_123456789',
|
|
44
|
-
'resend login (interactive — prompts and opens browser)',
|
|
45
|
-
'RESEND_API_KEY=re_123 resend emails send ... (skip login; use env var directly)',
|
|
46
|
-
],
|
|
47
|
-
}),
|
|
48
|
-
)
|
|
49
|
-
.action(async (opts, cmd) => {
|
|
50
|
-
const globalOpts = cmd.optsWithGlobals() as GlobalOpts;
|
|
51
|
-
let apiKey = opts.key;
|
|
52
|
-
|
|
53
|
-
if (!apiKey) {
|
|
54
|
-
if (!isInteractive()) {
|
|
55
|
-
outputError(
|
|
56
|
-
{
|
|
57
|
-
message:
|
|
58
|
-
'Missing --key flag. Provide your API key in non-interactive mode.',
|
|
59
|
-
code: 'missing_key',
|
|
60
|
-
},
|
|
61
|
-
{ json: globalOpts.json },
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
p.intro('Resend Authentication');
|
|
66
|
-
|
|
67
|
-
const existing = resolveApiKey();
|
|
68
|
-
if (existing) {
|
|
69
|
-
p.log.info(
|
|
70
|
-
`Existing API key found (source: ${existing.source}). Enter a new key to replace it.`,
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const method = await p.select({
|
|
75
|
-
message: 'How would you like to get your API key?',
|
|
76
|
-
options: [
|
|
77
|
-
{
|
|
78
|
-
value: 'browser' as const,
|
|
79
|
-
label: 'Open resend.com/api-keys in browser',
|
|
80
|
-
},
|
|
81
|
-
{ value: 'manual' as const, label: 'Enter API key manually' },
|
|
82
|
-
],
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
if (p.isCancel(method)) {
|
|
86
|
-
cancelAndExit('Login cancelled.');
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (method === 'browser') {
|
|
90
|
-
const opened = await openInBrowser(RESEND_API_KEYS_URL);
|
|
91
|
-
if (opened) {
|
|
92
|
-
p.log.info(`Opened ${RESEND_API_KEYS_URL}`);
|
|
93
|
-
} else {
|
|
94
|
-
p.log.warn(
|
|
95
|
-
`Could not open browser. Visit ${RESEND_API_KEYS_URL} manually.`,
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const result = await p.password({
|
|
101
|
-
message: 'Enter your Resend API key:',
|
|
102
|
-
validate: (value) => {
|
|
103
|
-
if (!value) {
|
|
104
|
-
return 'API key is required';
|
|
105
|
-
}
|
|
106
|
-
if (!value.startsWith('re_')) {
|
|
107
|
-
return 'API key must start with re_';
|
|
108
|
-
}
|
|
109
|
-
return undefined;
|
|
110
|
-
},
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
if (p.isCancel(result)) {
|
|
114
|
-
cancelAndExit('Login cancelled.');
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
apiKey = result;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (!apiKey.startsWith('re_')) {
|
|
121
|
-
outputError(
|
|
122
|
-
{
|
|
123
|
-
message: 'Invalid API key format. Key must start with re_',
|
|
124
|
-
code: 'invalid_key_format',
|
|
125
|
-
},
|
|
126
|
-
{ json: globalOpts.json },
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const spinner = createSpinner(
|
|
131
|
-
'Validating API key...',
|
|
132
|
-
'braille',
|
|
133
|
-
globalOpts.quiet,
|
|
134
|
-
);
|
|
135
|
-
|
|
136
|
-
try {
|
|
137
|
-
const resend = new Resend(apiKey);
|
|
138
|
-
await resend.domains.list();
|
|
139
|
-
spinner.stop('API key is valid');
|
|
140
|
-
} catch (err) {
|
|
141
|
-
spinner.fail('API key validation failed');
|
|
142
|
-
outputError(
|
|
143
|
-
{
|
|
144
|
-
message: errorMessage(err, 'Failed to validate API key'),
|
|
145
|
-
code: 'validation_failed',
|
|
146
|
-
},
|
|
147
|
-
{ json: globalOpts.json },
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
let teamName = globalOpts.team;
|
|
152
|
-
|
|
153
|
-
if (!teamName && isInteractive()) {
|
|
154
|
-
const existingTeams = listTeams();
|
|
155
|
-
if (existingTeams.length > 0) {
|
|
156
|
-
const options = [
|
|
157
|
-
...existingTeams.map((t) => ({
|
|
158
|
-
value: t.name,
|
|
159
|
-
label: `${t.name} (overwrite)`,
|
|
160
|
-
})),
|
|
161
|
-
{ value: '__new__' as const, label: '+ Create new team' },
|
|
162
|
-
];
|
|
163
|
-
|
|
164
|
-
const choice = await p.select({
|
|
165
|
-
message: 'Save API key to which team?',
|
|
166
|
-
options,
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
if (p.isCancel(choice)) {
|
|
170
|
-
cancelAndExit('Login cancelled.');
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (choice === '__new__') {
|
|
174
|
-
const newName = await p.text({
|
|
175
|
-
message: 'Enter a name for the new team:',
|
|
176
|
-
validate: (v) =>
|
|
177
|
-
!v || v.length === 0 ? 'Team name is required' : undefined,
|
|
178
|
-
});
|
|
179
|
-
if (p.isCancel(newName)) {
|
|
180
|
-
cancelAndExit('Login cancelled.');
|
|
181
|
-
}
|
|
182
|
-
teamName = newName;
|
|
183
|
-
} else {
|
|
184
|
-
teamName = choice;
|
|
185
|
-
}
|
|
186
|
-
} else {
|
|
187
|
-
teamName = 'default';
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
const configPath = storeApiKey(apiKey, teamName);
|
|
192
|
-
const teamLabel = teamName || 'default';
|
|
193
|
-
|
|
194
|
-
if (globalOpts.json) {
|
|
195
|
-
outputResult(
|
|
196
|
-
{ success: true, config_path: configPath, team: teamLabel },
|
|
197
|
-
{ json: true },
|
|
198
|
-
);
|
|
199
|
-
} else {
|
|
200
|
-
const msg = `API key stored for team '${teamLabel}' at ${configPath}`;
|
|
201
|
-
if (isInteractive()) {
|
|
202
|
-
p.outro(msg);
|
|
203
|
-
} else {
|
|
204
|
-
console.log(msg);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
});
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import * as p from '@clack/prompts';
|
|
4
|
-
import { Command } from '@commander-js/extra-typings';
|
|
5
|
-
import type { GlobalOpts } from '../../lib/client';
|
|
6
|
-
import {
|
|
7
|
-
getConfigDir,
|
|
8
|
-
removeAllApiKeys,
|
|
9
|
-
removeApiKey,
|
|
10
|
-
resolveTeamName,
|
|
11
|
-
} from '../../lib/config';
|
|
12
|
-
import { buildHelpText } from '../../lib/help-text';
|
|
13
|
-
import { errorMessage, outputError, outputResult } from '../../lib/output';
|
|
14
|
-
import { cancelAndExit } from '../../lib/prompts';
|
|
15
|
-
import { isInteractive } from '../../lib/tty';
|
|
16
|
-
|
|
17
|
-
export const logoutCommand = new Command('logout')
|
|
18
|
-
.description(
|
|
19
|
-
'Remove the saved Resend API key from the local credentials file',
|
|
20
|
-
)
|
|
21
|
-
.addHelpText(
|
|
22
|
-
'after',
|
|
23
|
-
buildHelpText({
|
|
24
|
-
setup: true,
|
|
25
|
-
context: `Removes the saved API key from ~/.config/resend/credentials.json.
|
|
26
|
-
(Linux: $XDG_CONFIG_HOME/resend/credentials.json)
|
|
27
|
-
(Windows: %APPDATA%\\resend\\credentials.json)
|
|
28
|
-
|
|
29
|
-
When --team is specified, only that team's entry is removed.
|
|
30
|
-
When no team is specified, all teams are removed.
|
|
31
|
-
|
|
32
|
-
If no credentials file exists, exits cleanly with no error.`,
|
|
33
|
-
output: ` {"success":true,"config_path":"<path>"}`,
|
|
34
|
-
errorCodes: ['remove_failed'],
|
|
35
|
-
examples: [
|
|
36
|
-
'resend logout',
|
|
37
|
-
'resend logout --team staging',
|
|
38
|
-
'resend logout --json',
|
|
39
|
-
],
|
|
40
|
-
}),
|
|
41
|
-
)
|
|
42
|
-
.action(async (_opts, cmd) => {
|
|
43
|
-
const globalOpts = cmd.optsWithGlobals() as GlobalOpts;
|
|
44
|
-
|
|
45
|
-
const configPath = join(getConfigDir(), 'credentials.json');
|
|
46
|
-
|
|
47
|
-
if (!existsSync(configPath)) {
|
|
48
|
-
if (!globalOpts.json && isInteractive()) {
|
|
49
|
-
console.log('No saved credentials found. Nothing to remove.');
|
|
50
|
-
} else {
|
|
51
|
-
outputResult(
|
|
52
|
-
{ success: true, already_logged_out: true },
|
|
53
|
-
{ json: globalOpts.json },
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const logoutAll = !globalOpts.team;
|
|
60
|
-
const teamLabel = globalOpts.team || resolveTeamName();
|
|
61
|
-
|
|
62
|
-
if (!globalOpts.json && isInteractive()) {
|
|
63
|
-
const message = logoutAll
|
|
64
|
-
? `Remove all saved API keys at ${configPath}?`
|
|
65
|
-
: `Remove saved API key for team '${teamLabel}'?`;
|
|
66
|
-
|
|
67
|
-
const confirmed = await p.confirm({ message });
|
|
68
|
-
|
|
69
|
-
if (p.isCancel(confirmed) || !confirmed) {
|
|
70
|
-
cancelAndExit('Logout cancelled.');
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
try {
|
|
75
|
-
if (logoutAll) {
|
|
76
|
-
removeAllApiKeys();
|
|
77
|
-
} else {
|
|
78
|
-
removeApiKey(teamLabel);
|
|
79
|
-
}
|
|
80
|
-
} catch (err) {
|
|
81
|
-
outputError(
|
|
82
|
-
{
|
|
83
|
-
message: errorMessage(err, 'Failed to remove credentials'),
|
|
84
|
-
code: 'remove_failed',
|
|
85
|
-
},
|
|
86
|
-
{ json: globalOpts.json },
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (!globalOpts.json && isInteractive()) {
|
|
91
|
-
const msg = logoutAll
|
|
92
|
-
? 'Logged out. All API keys removed.'
|
|
93
|
-
: `Logged out. API key removed for team '${teamLabel}'.`;
|
|
94
|
-
p.outro(msg);
|
|
95
|
-
} else {
|
|
96
|
-
outputResult(
|
|
97
|
-
{
|
|
98
|
-
success: true,
|
|
99
|
-
config_path: configPath,
|
|
100
|
-
team: logoutAll ? 'all' : teamLabel,
|
|
101
|
-
},
|
|
102
|
-
{ json: globalOpts.json },
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import * as p from '@clack/prompts';
|
|
2
|
-
import { Command } from '@commander-js/extra-typings';
|
|
3
|
-
import type { CreateBroadcastOptions } from 'resend';
|
|
4
|
-
import { runCreate } from '../../lib/actions';
|
|
5
|
-
import type { GlobalOpts } from '../../lib/client';
|
|
6
|
-
import { readFile } from '../../lib/files';
|
|
7
|
-
import { buildHelpText } from '../../lib/help-text';
|
|
8
|
-
import { outputError } from '../../lib/output';
|
|
9
|
-
import { cancelAndExit } from '../../lib/prompts';
|
|
10
|
-
import { isInteractive } from '../../lib/tty';
|
|
11
|
-
|
|
12
|
-
export const createBroadcastCommand = new Command('create')
|
|
13
|
-
.description('Create a broadcast draft (or send immediately with --send)')
|
|
14
|
-
.option('--from <address>', 'Sender address — required')
|
|
15
|
-
.option('--subject <subject>', 'Email subject — required')
|
|
16
|
-
.option('--segment-id <id>', 'Target segment ID — required')
|
|
17
|
-
.option(
|
|
18
|
-
'--html <html>',
|
|
19
|
-
'HTML body (supports {{{FIRST_NAME|fallback}}} triple-brace variable interpolation)',
|
|
20
|
-
)
|
|
21
|
-
.option(
|
|
22
|
-
'--html-file <path>',
|
|
23
|
-
'Path to an HTML file for the body (supports {{{FIRST_NAME|fallback}}} variable interpolation)',
|
|
24
|
-
)
|
|
25
|
-
.option('--text <text>', 'Plain-text body')
|
|
26
|
-
.option('--name <name>', 'Internal label for the broadcast (optional)')
|
|
27
|
-
.option('--reply-to <address>', 'Reply-to address (optional)')
|
|
28
|
-
.option(
|
|
29
|
-
'--preview-text <text>',
|
|
30
|
-
'Preview text shown in inbox below the subject line (optional)',
|
|
31
|
-
)
|
|
32
|
-
.option(
|
|
33
|
-
'--topic-id <id>',
|
|
34
|
-
'Associate with a topic for subscription filtering (optional)',
|
|
35
|
-
)
|
|
36
|
-
.option('--send', 'Send immediately on create instead of saving as draft')
|
|
37
|
-
.option(
|
|
38
|
-
'--scheduled-at <datetime>',
|
|
39
|
-
'Schedule delivery — ISO 8601 or natural language e.g. "in 1 hour", "tomorrow at 9am ET" (only valid with --send)',
|
|
40
|
-
)
|
|
41
|
-
.addHelpText(
|
|
42
|
-
'after',
|
|
43
|
-
buildHelpText({
|
|
44
|
-
context: `Non-interactive: --from, --subject, and --segment-id are required.
|
|
45
|
-
Body: provide exactly one of --html, --html-file, or --text.
|
|
46
|
-
|
|
47
|
-
Variable interpolation:
|
|
48
|
-
HTML bodies support triple-brace syntax for contact properties.
|
|
49
|
-
Example: {{{FIRST_NAME|Friend}}} — uses FIRST_NAME or falls back to "Friend".
|
|
50
|
-
|
|
51
|
-
Scheduling:
|
|
52
|
-
Use --scheduled-at with --send to schedule delivery.
|
|
53
|
-
Accepts ISO 8601 (e.g. 2026-08-05T11:52:01Z) or natural language (e.g. "in 1 hour").
|
|
54
|
-
--scheduled-at without --send is ignored.`,
|
|
55
|
-
output: ` {"id":"<broadcast-id>"}`,
|
|
56
|
-
errorCodes: [
|
|
57
|
-
'auth_error',
|
|
58
|
-
'missing_from',
|
|
59
|
-
'missing_subject',
|
|
60
|
-
'missing_segment',
|
|
61
|
-
'missing_body',
|
|
62
|
-
'file_read_error',
|
|
63
|
-
'create_error',
|
|
64
|
-
],
|
|
65
|
-
examples: [
|
|
66
|
-
'resend broadcasts create --from hello@domain.com --subject "Weekly Update" --segment-id 7b1e0a3d-4c5f-4e8a-9b2d-1a3c5e7f9b2d --html "<p>Hello {{{FIRST_NAME|there}}}</p>"',
|
|
67
|
-
'resend broadcasts create --from hello@domain.com --subject "Launch" --segment-id 7b1e0a3d-4c5f-4e8a-9b2d-1a3c5e7f9b2d --html-file ./email.html --send',
|
|
68
|
-
'resend broadcasts create --from hello@domain.com --subject "Launch" --segment-id 7b1e0a3d-4c5f-4e8a-9b2d-1a3c5e7f9b2d --text "Hello!" --send --scheduled-at "tomorrow at 9am ET"',
|
|
69
|
-
'resend broadcasts create --from hello@domain.com --subject "News" --segment-id 7b1e0a3d-4c5f-4e8a-9b2d-1a3c5e7f9b2d --html "<p>Hi</p>" --json',
|
|
70
|
-
],
|
|
71
|
-
}),
|
|
72
|
-
)
|
|
73
|
-
.action(async (opts, cmd) => {
|
|
74
|
-
const globalOpts = cmd.optsWithGlobals() as GlobalOpts;
|
|
75
|
-
|
|
76
|
-
let from = opts.from;
|
|
77
|
-
let subject = opts.subject;
|
|
78
|
-
let segmentId = opts.segmentId;
|
|
79
|
-
|
|
80
|
-
if (!from) {
|
|
81
|
-
if (!isInteractive()) {
|
|
82
|
-
outputError(
|
|
83
|
-
{ message: 'Missing --from flag.', code: 'missing_from' },
|
|
84
|
-
{ json: globalOpts.json },
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
const result = await p.text({
|
|
88
|
-
message: 'From address',
|
|
89
|
-
placeholder: 'hello@domain.com',
|
|
90
|
-
validate: (v) => (!v ? 'Required' : undefined),
|
|
91
|
-
});
|
|
92
|
-
if (p.isCancel(result)) {
|
|
93
|
-
cancelAndExit('Cancelled.');
|
|
94
|
-
}
|
|
95
|
-
from = result;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (!subject) {
|
|
99
|
-
if (!isInteractive()) {
|
|
100
|
-
outputError(
|
|
101
|
-
{ message: 'Missing --subject flag.', code: 'missing_subject' },
|
|
102
|
-
{ json: globalOpts.json },
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
const result = await p.text({
|
|
106
|
-
message: 'Subject',
|
|
107
|
-
placeholder: 'Weekly Newsletter',
|
|
108
|
-
validate: (v) => (!v ? 'Required' : undefined),
|
|
109
|
-
});
|
|
110
|
-
if (p.isCancel(result)) {
|
|
111
|
-
cancelAndExit('Cancelled.');
|
|
112
|
-
}
|
|
113
|
-
subject = result;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (!segmentId) {
|
|
117
|
-
if (!isInteractive()) {
|
|
118
|
-
outputError(
|
|
119
|
-
{ message: 'Missing --segment-id flag.', code: 'missing_segment' },
|
|
120
|
-
{ json: globalOpts.json },
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
const result = await p.text({
|
|
124
|
-
message: 'Segment ID',
|
|
125
|
-
placeholder: '7b1e0a3d-4c5f-4e8a-9b2d-1a3c5e7f9b2d',
|
|
126
|
-
validate: (v) => (!v ? 'Required' : undefined),
|
|
127
|
-
});
|
|
128
|
-
if (p.isCancel(result)) {
|
|
129
|
-
cancelAndExit('Cancelled.');
|
|
130
|
-
}
|
|
131
|
-
segmentId = result;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
let html = opts.html;
|
|
135
|
-
let text = opts.text;
|
|
136
|
-
|
|
137
|
-
if (opts.htmlFile) {
|
|
138
|
-
html = readFile(opts.htmlFile, globalOpts);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (!html && !text) {
|
|
142
|
-
if (!isInteractive()) {
|
|
143
|
-
outputError(
|
|
144
|
-
{
|
|
145
|
-
message: 'Missing body. Provide --html, --html-file, or --text.',
|
|
146
|
-
code: 'missing_body',
|
|
147
|
-
},
|
|
148
|
-
{ json: globalOpts.json },
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
const result = await p.text({
|
|
152
|
-
message: 'Body (plain text)',
|
|
153
|
-
placeholder: 'Hello {{{FIRST_NAME|there}}}!',
|
|
154
|
-
validate: (v) => (!v ? 'Required' : undefined),
|
|
155
|
-
});
|
|
156
|
-
if (p.isCancel(result)) {
|
|
157
|
-
cancelAndExit('Cancelled.');
|
|
158
|
-
}
|
|
159
|
-
text = result;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
await runCreate(
|
|
163
|
-
{
|
|
164
|
-
spinner: {
|
|
165
|
-
loading: 'Creating broadcast...',
|
|
166
|
-
success: opts.send ? 'Broadcast sent' : 'Broadcast created',
|
|
167
|
-
fail: 'Failed to create broadcast',
|
|
168
|
-
},
|
|
169
|
-
sdkCall: (resend) =>
|
|
170
|
-
resend.broadcasts.create({
|
|
171
|
-
from,
|
|
172
|
-
subject,
|
|
173
|
-
segmentId,
|
|
174
|
-
...(html && { html }),
|
|
175
|
-
...(text && { text }),
|
|
176
|
-
...(opts.name && { name: opts.name }),
|
|
177
|
-
...(opts.replyTo && { replyTo: opts.replyTo }),
|
|
178
|
-
...(opts.previewText && { previewText: opts.previewText }),
|
|
179
|
-
...(opts.topicId && { topicId: opts.topicId }),
|
|
180
|
-
...(opts.send && { send: true as const }),
|
|
181
|
-
...(opts.send &&
|
|
182
|
-
opts.scheduledAt && { scheduledAt: opts.scheduledAt }),
|
|
183
|
-
} as CreateBroadcastOptions),
|
|
184
|
-
onInteractive: (d) => {
|
|
185
|
-
if (opts.send) {
|
|
186
|
-
console.log(`\nBroadcast sent: ${d.id}`);
|
|
187
|
-
} else {
|
|
188
|
-
console.log(`\nBroadcast created: ${d.id}`);
|
|
189
|
-
console.log('Status: draft');
|
|
190
|
-
console.log(`\nSend it with: resend broadcasts send ${d.id}`);
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
globalOpts,
|
|
195
|
-
);
|
|
196
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { Command } from '@commander-js/extra-typings';
|
|
2
|
-
import { runDelete } from '../../lib/actions';
|
|
3
|
-
import type { GlobalOpts } from '../../lib/client';
|
|
4
|
-
import { buildHelpText } from '../../lib/help-text';
|
|
5
|
-
|
|
6
|
-
export const deleteBroadcastCommand = new Command('delete')
|
|
7
|
-
.alias('rm')
|
|
8
|
-
.description(
|
|
9
|
-
'Delete a broadcast — draft broadcasts are removed; scheduled broadcasts are cancelled before delivery',
|
|
10
|
-
)
|
|
11
|
-
.argument('<id>', 'Broadcast ID')
|
|
12
|
-
.option('--yes', 'Skip confirmation prompt')
|
|
13
|
-
.addHelpText(
|
|
14
|
-
'after',
|
|
15
|
-
buildHelpText({
|
|
16
|
-
context: `Warning: Deleting a scheduled broadcast cancels its delivery immediately.
|
|
17
|
-
Only draft and scheduled broadcasts can be deleted; sent broadcasts cannot.
|
|
18
|
-
|
|
19
|
-
Non-interactive: --yes is required to confirm deletion when stdin/stdout is not a TTY.`,
|
|
20
|
-
output: ` {"object":"broadcast","id":"<id>","deleted":true}`,
|
|
21
|
-
errorCodes: ['auth_error', 'confirmation_required', 'delete_error'],
|
|
22
|
-
examples: [
|
|
23
|
-
'resend broadcasts delete d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --yes',
|
|
24
|
-
'resend broadcasts delete d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --yes --json',
|
|
25
|
-
],
|
|
26
|
-
}),
|
|
27
|
-
)
|
|
28
|
-
.action(async (id, opts, cmd) => {
|
|
29
|
-
const globalOpts = cmd.optsWithGlobals() as GlobalOpts;
|
|
30
|
-
await runDelete(
|
|
31
|
-
id,
|
|
32
|
-
!!opts.yes,
|
|
33
|
-
{
|
|
34
|
-
confirmMessage: `Delete broadcast ${id}?\nIf scheduled, delivery will be cancelled.`,
|
|
35
|
-
spinner: {
|
|
36
|
-
loading: 'Deleting broadcast...',
|
|
37
|
-
success: 'Broadcast deleted',
|
|
38
|
-
fail: 'Failed to delete broadcast',
|
|
39
|
-
},
|
|
40
|
-
object: 'broadcast',
|
|
41
|
-
successMsg: 'Broadcast deleted.',
|
|
42
|
-
sdkCall: (resend) => resend.broadcasts.remove(id),
|
|
43
|
-
},
|
|
44
|
-
globalOpts,
|
|
45
|
-
);
|
|
46
|
-
});
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Command } from '@commander-js/extra-typings';
|
|
2
|
-
import { runGet } from '../../lib/actions';
|
|
3
|
-
import type { GlobalOpts } from '../../lib/client';
|
|
4
|
-
import { buildHelpText } from '../../lib/help-text';
|
|
5
|
-
import { broadcastStatusIndicator } from './utils';
|
|
6
|
-
|
|
7
|
-
export const getBroadcastCommand = new Command('get')
|
|
8
|
-
.description(
|
|
9
|
-
'Retrieve full details for a broadcast including HTML body, status, and delivery times',
|
|
10
|
-
)
|
|
11
|
-
.argument('<id>', 'Broadcast ID')
|
|
12
|
-
.addHelpText(
|
|
13
|
-
'after',
|
|
14
|
-
buildHelpText({
|
|
15
|
-
context: `Note: The list command returns summary objects without html/text/from/subject.
|
|
16
|
-
Use this command to retrieve the full broadcast payload.`,
|
|
17
|
-
output: ` {"id":"...","object":"broadcast","name":"...","segment_id":"...","from":"...","subject":"...","status":"draft|queued|sent","created_at":"...","scheduled_at":null,"sent_at":null}`,
|
|
18
|
-
errorCodes: ['auth_error', 'fetch_error'],
|
|
19
|
-
examples: [
|
|
20
|
-
'resend broadcasts get d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6',
|
|
21
|
-
'resend broadcasts get d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --json',
|
|
22
|
-
],
|
|
23
|
-
}),
|
|
24
|
-
)
|
|
25
|
-
.action(async (id, _opts, cmd) => {
|
|
26
|
-
const globalOpts = cmd.optsWithGlobals() as GlobalOpts;
|
|
27
|
-
await runGet(
|
|
28
|
-
{
|
|
29
|
-
spinner: {
|
|
30
|
-
loading: 'Fetching broadcast...',
|
|
31
|
-
success: 'Broadcast fetched',
|
|
32
|
-
fail: 'Failed to fetch broadcast',
|
|
33
|
-
},
|
|
34
|
-
sdkCall: (resend) => resend.broadcasts.get(id),
|
|
35
|
-
onInteractive: (b) => {
|
|
36
|
-
console.log(`\nBroadcast: ${b.id}`);
|
|
37
|
-
console.log(` Status: ${broadcastStatusIndicator(b.status)}`);
|
|
38
|
-
console.log(` Name: ${b.name ?? '(untitled)'}`);
|
|
39
|
-
console.log(` From: ${b.from ?? '—'}`);
|
|
40
|
-
console.log(` Subject: ${b.subject ?? '—'}`);
|
|
41
|
-
console.log(` Segment: ${b.segment_id ?? '—'}`);
|
|
42
|
-
if (b.preview_text) {
|
|
43
|
-
console.log(` Preview: ${b.preview_text}`);
|
|
44
|
-
}
|
|
45
|
-
if (b.topic_id) {
|
|
46
|
-
console.log(` Topic: ${b.topic_id}`);
|
|
47
|
-
}
|
|
48
|
-
console.log(` Created: ${b.created_at}`);
|
|
49
|
-
if (b.scheduled_at) {
|
|
50
|
-
console.log(` Scheduled: ${b.scheduled_at}`);
|
|
51
|
-
}
|
|
52
|
-
if (b.sent_at) {
|
|
53
|
-
console.log(` Sent: ${b.sent_at}`);
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
globalOpts,
|
|
58
|
-
);
|
|
59
|
-
});
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Command } from '@commander-js/extra-typings';
|
|
2
|
-
import { buildHelpText } from '../../lib/help-text';
|
|
3
|
-
import { createBroadcastCommand } from './create';
|
|
4
|
-
import { deleteBroadcastCommand } from './delete';
|
|
5
|
-
import { getBroadcastCommand } from './get';
|
|
6
|
-
import { listBroadcastsCommand } from './list';
|
|
7
|
-
import { sendBroadcastCommand } from './send';
|
|
8
|
-
import { updateBroadcastCommand } from './update';
|
|
9
|
-
|
|
10
|
-
export const broadcastsCommand = new Command('broadcasts')
|
|
11
|
-
.description('Manage broadcasts — bulk email to a segment of contacts')
|
|
12
|
-
.addHelpText(
|
|
13
|
-
'after',
|
|
14
|
-
buildHelpText({
|
|
15
|
-
context: `Lifecycle:
|
|
16
|
-
Broadcasts follow a draft → send flow:
|
|
17
|
-
1. create — creates a draft (or sends immediately with --send)
|
|
18
|
-
2. send — sends an API-created draft (dashboard broadcasts cannot be sent via API)
|
|
19
|
-
Scheduled broadcasts can be deleted to cancel delivery; sent broadcasts are immutable.
|
|
20
|
-
|
|
21
|
-
Template variables:
|
|
22
|
-
HTML bodies support triple-brace interpolation for contact properties.
|
|
23
|
-
Example: {{{FIRST_NAME|Friend}}} — uses FIRST_NAME or falls back to "Friend".
|
|
24
|
-
|
|
25
|
-
Scheduling:
|
|
26
|
-
--scheduled-at accepts ISO 8601 or natural language e.g. "in 1 hour", "tomorrow at 9am ET".`,
|
|
27
|
-
examples: [
|
|
28
|
-
'resend broadcasts list',
|
|
29
|
-
'resend broadcasts create --from hello@domain.com --subject "Launch" --segment-id 7b1e0a3d-4c5f-4e8a-9b2d-1a3c5e7f9b2d --html "<p>Hi {{{FIRST_NAME|there}}}</p>"',
|
|
30
|
-
'resend broadcasts send d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6',
|
|
31
|
-
'resend broadcasts send d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --scheduled-at "in 1 hour"',
|
|
32
|
-
'resend broadcasts get d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6',
|
|
33
|
-
'resend broadcasts update d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --subject "Updated Subject"',
|
|
34
|
-
'resend broadcasts delete d1c2b3a4-5e6f-7a8b-9c0d-e1f2a3b4c5d6 --yes',
|
|
35
|
-
],
|
|
36
|
-
}),
|
|
37
|
-
)
|
|
38
|
-
.addCommand(createBroadcastCommand)
|
|
39
|
-
.addCommand(sendBroadcastCommand)
|
|
40
|
-
.addCommand(getBroadcastCommand)
|
|
41
|
-
.addCommand(listBroadcastsCommand, { isDefault: true })
|
|
42
|
-
.addCommand(updateBroadcastCommand)
|
|
43
|
-
.addCommand(deleteBroadcastCommand);
|