carlyemail 0.6.3 → 0.6.4

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/carlyemail.js CHANGED
@@ -18,7 +18,7 @@ import { basename, extname, join } from "node:path";
18
18
  import { fileURLToPath } from "node:url";
19
19
  import { randomBytes } from "node:crypto";
20
20
 
21
- export const VERSION = "0.6.3";
21
+ export const VERSION = "0.6.4";
22
22
 
23
23
  const DEFAULT_API = "https://api.carlyemail.com";
24
24
  const CONFIG_DIR = join(homedir(), ".carlyemail");
@@ -275,7 +275,7 @@ const FLAGS = {
275
275
  signin: ["human-email"],
276
276
  verify: ["code"],
277
277
  create: ["username", "domain", "display-name"],
278
- delete: ["yes"],
278
+ delete: ["yes", "force"],
279
279
  send: ["from", "to", "cc", "bcc", "reply-to", "subject", "text", "html", "attach"],
280
280
  search: ["query"],
281
281
  reply: ["last", "text", "html", "all"],
@@ -524,7 +524,7 @@ define(
524
524
  }
525
525
  );
526
526
 
527
- define("delete", "Delete an inbox and its mail", "carlyemail delete support@carlyemail.com", async (ctx) => {
527
+ define("delete", "Delete an inbox and its mail", "carlyemail delete support@carlyemail.com --yes", async (ctx) => {
528
528
  const inbox = ctx.positional[0];
529
529
  if (!inbox) throw new UsageError("which inbox? carlyemail delete <inbox>");
530
530
  if (!ctx.flags.yes) {
@@ -532,7 +532,19 @@ define("delete", "Delete an inbox and its mail", "carlyemail delete support@carl
532
532
  `this deletes ${inbox} and every message in it. Re-run with --yes to confirm.`
533
533
  );
534
534
  }
535
- await request(ctx.config, "DELETE", `/v0/inboxes/${encodeURIComponent(inbox)}`);
535
+ // An inbox that sent mail or whose key was used in the last 30 days is
536
+ // refused with `inbox_in_use`, and the API's fix names its own parameter.
537
+ // Here the answer is a flag, so say that instead.
538
+ const force = ctx.flags.force === true;
539
+ const path = `/v0/inboxes/${encodeURIComponent(inbox)}${force ? "?force=true" : ""}`;
540
+ try {
541
+ await request(ctx.config, "DELETE", path);
542
+ } catch (error) {
543
+ if (error instanceof ApiError && error.code === "inbox_in_use") {
544
+ error.fix = "Check nothing still sends from it. To delete it anyway, re-run with --force.";
545
+ }
546
+ throw error;
547
+ }
536
548
  ctx.print(ok(`deleted ${inbox}`));
537
549
  });
538
550
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carlyemail",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "description": "Real email inboxes your agent can send, receive and reply from. SDK and CLI.",
5
5
  "keywords": [
6
6
  "email",
package/sdk.d.ts CHANGED
@@ -576,6 +576,7 @@ export interface UpdateInboxRequest {
576
576
 
577
577
  export interface UpdateInboxWebhookRequest {
578
578
  event_types?: Array<string> | null;
579
+ enabled?: boolean | null;
579
580
  }
580
581
 
581
582
  export interface UpdateMessageRequest {
@@ -605,6 +606,7 @@ export interface UpdateWebhookHeadersRequest {
605
606
 
606
607
  export interface UpdateWebhookRequest {
607
608
  event_types?: Array<string> | null;
609
+ enabled?: boolean | null;
608
610
  add_inbox_ids?: Array<string> | null;
609
611
  remove_inbox_ids?: Array<string> | null;
610
612
  add_pod_ids?: Array<string> | null;
@@ -652,6 +654,9 @@ export interface WebhookOut {
652
654
  inbox_ids?: Array<string>;
653
655
  secret?: string | null;
654
656
  enabled?: boolean;
657
+ disabled_reason?: string | null;
658
+ disabled_at?: string | null;
659
+ failing_since?: string | null;
655
660
  client_id?: string | null;
656
661
  updated_at: string;
657
662
  created_at: string;
@@ -697,7 +702,7 @@ export declare class Inboxes {
697
702
  create(body: CreateInboxRequest): Promise<InboxOut>;
698
703
  get(inboxId: string): Promise<InboxOut>;
699
704
  update(inboxId: string, body: UpdateInboxRequest): Promise<InboxOut>;
700
- delete(inboxId: string): Promise<void>;
705
+ delete(inboxId: string, query?: { force?: boolean }): Promise<void>;
701
706
  }
702
707
 
703
708
  export declare class Messages {
@@ -794,7 +799,7 @@ export declare class Pods {
794
799
  createInbox(podId: string, body: CreateInboxRequest): Promise<InboxOut>;
795
800
  getInbox(inboxId: string, podId: string): Promise<InboxOut>;
796
801
  updateInbox(inboxId: string, podId: string, body: UpdateInboxRequest): Promise<InboxOut>;
797
- deleteInbox(inboxId: string, podId: string): Promise<void>;
802
+ deleteInbox(inboxId: string, podId: string, query?: { force?: boolean }): Promise<void>;
798
803
  listThreads(podId: string, query?: { limit?: number | null; pageToken?: string | null; labels?: Array<string> | null; before?: string | null; after?: string | null; ascending?: boolean; includeSpam?: boolean; includeBlocked?: boolean; includeUnauthenticated?: boolean; includeTrash?: boolean; senders?: Array<string> | null; recipients?: Array<string> | null; subject?: string | null }): Promise<ListThreadsResponse>;
799
804
  searchThreads(podId: string, query?: { q?: string; limit?: number | null; pageToken?: string | null; before?: string | null; after?: string | null }): Promise<ListThreadsResponse>;
800
805
  getThread(threadId: string, podId: string): Promise<ThreadOut>;
package/sdk.js CHANGED
@@ -163,8 +163,8 @@ class Inboxes {
163
163
  }
164
164
 
165
165
  /** Delete Inbox */
166
- delete(inboxId) {
167
- return this.$.request("DELETE", `/v0/inboxes/${encode(inboxId)}`);
166
+ delete(inboxId, query = {}) {
167
+ return this.$.request("DELETE", `/v0/inboxes/${encode(inboxId)}`, { query: { "force": query.force } });
168
168
  }
169
169
  }
170
170
 
@@ -567,8 +567,8 @@ class Pods {
567
567
  }
568
568
 
569
569
  /** Delete Inbox */
570
- deleteInbox(inboxId, podId) {
571
- return this.$.request("DELETE", `/v0/pods/${encode(podId)}/inboxes/${encode(inboxId)}`);
570
+ deleteInbox(inboxId, podId, query = {}) {
571
+ return this.$.request("DELETE", `/v0/pods/${encode(podId)}/inboxes/${encode(inboxId)}`, { query: { "force": query.force } });
572
572
  }
573
573
 
574
574
  /** List Threads */