shipmail 0.5.10 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -89,7 +89,6 @@ const shipmail = new ShipmailClient({
89
89
  timeout: 30_000,
90
90
  fetch: customFetch,
91
91
  defaultHeaders: { "x-app-name": "my-app" },
92
- organizationId: "00000000-0000-4000-8000-000000000123",
93
92
  });
94
93
  ```
95
94
 
@@ -101,7 +100,6 @@ const shipmail = new ShipmailClient({
101
100
  | `timeout` | `number` | `30_000` | Per-request timeout in ms. |
102
101
  | `fetch` | `typeof fetch` | `globalThis.fetch` | Custom fetch implementation. |
103
102
  | `defaultHeaders` | `Record<string, string>` | `{}` | Headers added to every request. |
104
- | `organizationId` | `string` | none | Delegated child organization for approved infrastructure calls. |
105
103
 
106
104
  ## Domains
107
105
 
@@ -393,6 +391,12 @@ org.reputation_warning
393
391
  org.sending_throttled
394
392
  org.sending_suspended
395
393
  org.reputation_recovered
394
+ reply.overdue
395
+ conversation.needs_action
396
+ calendar.event_starting
397
+ booking.created
398
+ subscriber.added
399
+ newsletter.sent
396
400
  ```
397
401
 
398
402
  ## Suppressions
@@ -507,50 +511,6 @@ sanitized inline HTML. Use `<p>` and `<br>` for line breaks. Allowed tags are
507
511
  Concurrent newsletter updates can throw `ConflictError` (409). Fetch the latest
508
512
  newsletter, merge your changes, and retry the update.
509
513
 
510
- ## Partner beta
511
-
512
- Approved partner accounts can create isolated operator-owned organizations and read consolidated
513
- usage:
514
-
515
- ```ts
516
- const child = await shipmail.partner.createOrganization(
517
- {
518
- name: "Operator",
519
- external_reference: "operator_123",
520
- owner_email: "owner@example.com",
521
- mailbox_limit: 3,
522
- data_classification: "internal_test",
523
- },
524
- { idempotencyKey: "operator-123" },
525
- );
526
-
527
- const delegated = new ShipmailClient({
528
- apiKey: process.env.SHIPMAIL_API_KEY!,
529
- organizationId: child.organization_id,
530
- });
531
-
532
- await delegated.domains.list();
533
- await delegated.mailboxes.create({
534
- domain_id: "dom_...",
535
- address: "support",
536
- generate_password: true,
537
- });
538
- const grants = await shipmail.partner.listMailboxCredentialGrants();
539
- const credential = await shipmail.partner.consumeMailboxCredentialGrant(grants.data[0]!.id, {
540
- name: "Embedded webmail",
541
- });
542
- await shipmail.partner.usage();
543
- ```
544
-
545
- Use a separate client for delegated infrastructure. Partner target context is not accepted by
546
- message, thread, calendar, contacts, export, suppression, billing, or password endpoints. The beta
547
- requires Shipmail approval and externally owned domains. Delegated mailbox creation must use
548
- `generate_password: true`; the generated primary password is never returned to the partner.
549
- The operator creates a one-time credential grant. Consuming it requires the exact
550
- `partner:mailbox_credentials:issue` scope and returns the app-password secret once. App-password
551
- creation and grant consumption do not accept idempotency keys because their plaintext response must
552
- never be cached.
553
-
554
514
  ## Status
555
515
 
556
516
  ```ts
@@ -641,7 +601,6 @@ type MethodOptions = {
641
601
  signal?: AbortSignal;
642
602
  headers?: Record<string, string>;
643
603
  idempotencyKey?: string;
644
- organizationId?: string;
645
604
  };
646
605
  ```
647
606
 
@@ -34,15 +34,10 @@ var API_KEY_SCOPES = [
34
34
  "webhooks:read",
35
35
  "webhooks:write",
36
36
  "suppressions:read",
37
- "suppressions:write",
38
- "partner:organizations:read",
39
- "partner:organizations:write",
40
- "partner:organizations:access",
41
- "partner:mailbox_credentials:issue",
42
- "partner:usage:read"
37
+ "suppressions:write"
43
38
  ];
44
39
  var API_KEY_SCOPE_DESCRIPTIONS = {
45
- "*": "All non-partner API endpoints in this organization.",
40
+ "*": "All API endpoints in this organization.",
46
41
  "audiences:read": "List and retrieve newsletter audiences and their subscribers.",
47
42
  "audiences:write": "Create audiences and add, update, or remove their subscribers.",
48
43
  "automations:read": "List and retrieve assistant automations.",
@@ -74,19 +69,13 @@ var API_KEY_SCOPE_DESCRIPTIONS = {
74
69
  "webhooks:read": "List webhooks, retrieve webhooks, and list deliveries.",
75
70
  "webhooks:write": "Create, update, delete, test, and rotate webhooks.",
76
71
  "suppressions:read": "List suppressed recipient addresses.",
77
- "suppressions:write": "Remove addresses from the suppression list.",
78
- "partner:organizations:read": "List and retrieve this partner's child organizations.",
79
- "partner:organizations:write": "Create and manage this partner's child organizations.",
80
- "partner:organizations:access": "Act on an active child using the delegated organization header.",
81
- "partner:mailbox_credentials:issue": "List and consume operator-approved grants for embedded-webmail credentials.",
82
- "partner:usage:read": "Read consolidated child and mailbox usage for this partner."
72
+ "suppressions:write": "Remove addresses from the suppression list."
83
73
  };
84
74
  function isApiKeyScope(value) {
85
75
  return API_KEY_SCOPES.some((scope) => scope === value);
86
76
  }
87
77
  function apiKeyScopesGrant(grantedScopes, requiredScope) {
88
78
  if (requiredScope === "public") return true;
89
- if (requiredScope.startsWith("partner:")) return grantedScopes.includes(requiredScope);
90
79
  return grantedScopes.includes("*") || grantedScopes.includes(requiredScope);
91
80
  }
92
81
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api-key-scopes.ts"],"names":[],"mappings":";;;AAAO,IAAM,cAAA,GAAiB;AAAA,EAC5B,GAAA;AAAA,EACA,gBAAA;AAAA,EACA,iBAAA;AAAA,EACA,kBAAA;AAAA,EACA,mBAAA;AAAA,EACA,oBAAA;AAAA,EACA,qBAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,cAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,kBAAA;AAAA,EACA,iBAAA;AAAA,EACA,0BAAA;AAAA,EACA,2BAAA;AAAA,EACA,yBAAA;AAAA,EACA,0BAAA;AAAA,EACA,oBAAA;AAAA,EACA,qBAAA;AAAA,EACA,cAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,cAAA;AAAA,EACA,gBAAA;AAAA,EACA,eAAA;AAAA,EACA,kBAAA;AAAA,EACA,mBAAA;AAAA,EACA,cAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,mBAAA;AAAA,EACA,oBAAA;AAAA,EACA,4BAAA;AAAA,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6BAAA,EAA+B,uDAAA;AAAA,EAC/B,8BAAA,EAAgC,iEAAA;AAAA,EAChC,mCAAA,EACE,6EAAA;AAAA,EACF,oBAAA,EAAsB;AACxB;AAEO,SAAS,cAAc,KAAA,EAAqC;AACjE,EAAA,OAAO,cAAA,CAAe,IAAA,CAAK,CAAC,KAAA,KAAU,UAAU,KAAK,CAAA;AACvD;AAEO,SAAS,iBAAA,CACd,eACA,aAAA,EACS;AACT,EAAA,IAAI,aAAA,KAAkB,UAAU,OAAO,IAAA;AACvC,EAAA,IAAI,cAAc,UAAA,CAAW,UAAU,GAAG,OAAO,aAAA,CAAc,SAAS,aAAa,CAAA;AACrF,EAAA,OAAO,cAAc,QAAA,CAAS,GAAG,CAAA,IAAK,aAAA,CAAc,SAAS,aAAa,CAAA;AAC5E","file":"api-key-scopes.cjs","sourcesContent":["export const API_KEY_SCOPES = [\n \"*\",\n \"audiences:read\",\n \"audiences:write\",\n \"automations:read\",\n \"automations:write\",\n \"booking_pages:read\",\n \"booking_pages:write\",\n \"calendar:read\",\n \"calendar:write\",\n \"domains:read\",\n \"domains:write\",\n \"mailboxes:read\",\n \"mailboxes:export\",\n \"mailboxes:write\",\n \"mailbox_credentials:read\",\n \"mailbox_credentials:write\",\n \"mailbox_forwarding:read\",\n \"mailbox_forwarding:write\",\n \"mailbox_rules:read\",\n \"mailbox_rules:write\",\n \"members:read\",\n \"messages:read\",\n \"messages:write\",\n \"drafts:write\",\n \"drafts:compose\",\n \"messages:send\",\n \"newsletters:read\",\n \"newsletters:write\",\n \"threads:read\",\n \"webhooks:read\",\n \"webhooks:write\",\n \"suppressions:read\",\n \"suppressions:write\",\n \"partner:organizations:read\",\n \"partner:organizations:write\",\n \"partner:organizations:access\",\n \"partner:mailbox_credentials:issue\",\n \"partner:usage:read\",\n] as const;\n\nexport type ApiKeyScope = (typeof API_KEY_SCOPES)[number];\n\nexport const API_KEY_SCOPE_DESCRIPTIONS: Readonly<Record<ApiKeyScope, string>> = {\n \"*\": \"All non-partner API endpoints in this organization.\",\n \"audiences:read\": \"List and retrieve newsletter audiences and their subscribers.\",\n \"audiences:write\": \"Create audiences and add, update, or remove their subscribers.\",\n \"automations:read\": \"List and retrieve assistant automations.\",\n \"automations:write\": \"Create, update, and manually run assistant automations.\",\n \"booking_pages:read\": \"List and retrieve booking pages.\",\n \"booking_pages:write\": \"Create, update, and delete booking pages.\",\n \"calendar:read\": \"List and retrieve calendar events and open availability.\",\n \"calendar:write\": \"Create, update, and delete calendar events.\",\n \"domains:read\": \"List, retrieve, and verify domains.\",\n \"domains:write\": \"Create, update, and delete domains.\",\n \"mailboxes:read\": \"List and retrieve mailboxes.\",\n \"mailboxes:export\": \"Create and download mailbox content exports.\",\n \"mailboxes:write\":\n \"Create, update, suspend, resume, and delete mailboxes. Does not include setting mailbox passwords.\",\n \"mailbox_credentials:read\": \"List revocable app passwords for allowed mailboxes.\",\n \"mailbox_credentials:write\":\n \"Set primary mailbox passwords and create and revoke app passwords for allowed mailboxes.\",\n \"mailbox_forwarding:read\": \"List forwarding destinations for allowed mailboxes.\",\n \"mailbox_forwarding:write\": \"Create and remove forwarding destinations for allowed mailboxes.\",\n \"mailbox_rules:read\": \"List deterministic server-side rules for allowed mailboxes.\",\n \"mailbox_rules:write\": \"Create, replace, and remove deterministic rules for allowed mailboxes.\",\n \"members:read\": \"List and retrieve organization members.\",\n \"messages:read\": \"List and retrieve messages.\",\n \"messages:write\": \"Update, move, delete, and inject sandbox messages.\",\n \"drafts:write\": \"Create agent-safe reply drafts with server-derived recipients.\",\n \"drafts:compose\": \"Save new-message drafts to a mailbox's Drafts folder for review. Cannot send.\",\n \"messages:send\": \"Send messages, replies, and approved reply drafts.\",\n \"newsletters:read\": \"List and retrieve newsletter drafts and campaigns.\",\n \"newsletters:write\": \"Create, update, test, schedule, cancel, and resume newsletters.\",\n \"threads:read\": \"List threads and retrieve thread messages.\",\n \"webhooks:read\": \"List webhooks, retrieve webhooks, and list deliveries.\",\n \"webhooks:write\": \"Create, update, delete, test, and rotate webhooks.\",\n \"suppressions:read\": \"List suppressed recipient addresses.\",\n \"suppressions:write\": \"Remove addresses from the suppression list.\",\n \"partner:organizations:read\": \"List and retrieve this partner's child organizations.\",\n \"partner:organizations:write\": \"Create and manage this partner's child organizations.\",\n \"partner:organizations:access\": \"Act on an active child using the delegated organization header.\",\n \"partner:mailbox_credentials:issue\":\n \"List and consume operator-approved grants for embedded-webmail credentials.\",\n \"partner:usage:read\": \"Read consolidated child and mailbox usage for this partner.\",\n};\n\nexport function isApiKeyScope(value: string): value is ApiKeyScope {\n return API_KEY_SCOPES.some((scope) => scope === value);\n}\n\nexport function apiKeyScopesGrant(\n grantedScopes: readonly string[],\n requiredScope: ApiKeyScope | \"public\",\n): boolean {\n if (requiredScope === \"public\") return true;\n if (requiredScope.startsWith(\"partner:\")) return grantedScopes.includes(requiredScope);\n return grantedScopes.includes(\"*\") || grantedScopes.includes(requiredScope);\n}\n"]}
1
+ {"version":3,"sources":["../src/api-key-scopes.ts"],"names":[],"mappings":";;;AAAO,IAAM,cAAA,GAAiB;AAAA,EAC5B,GAAA;AAAA,EACA,gBAAA;AAAA,EACA,iBAAA;AAAA,EACA,kBAAA;AAAA,EACA,mBAAA;AAAA,EACA,oBAAA;AAAA,EACA,qBAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,cAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,kBAAA;AAAA,EACA,iBAAA;AAAA,EACA,0BAAA;AAAA,EACA,2BAAA;AAAA,EACA,yBAAA;AAAA,EACA,0BAAA;AAAA,EACA,oBAAA;AAAA,EACA,qBAAA;AAAA,EACA,cAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,cAAA;AAAA,EACA,gBAAA;AAAA,EACA,eAAA;AAAA,EACA,kBAAA;AAAA,EACA,mBAAA;AAAA,EACA,cAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,mBAAA;A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KAAK,CAAA;AACvD;AAEO,SAAS,iBAAA,CACd,eACA,aAAA,EACS;AACT,EAAA,IAAI,aAAA,KAAkB,UAAU,OAAO,IAAA;AACvC,EAAA,OAAO,cAAc,QAAA,CAAS,GAAG,CAAA,IAAK,aAAA,CAAc,SAAS,aAAa,CAAA;AAC5E","file":"api-key-scopes.cjs","sourcesContent":["export const API_KEY_SCOPES = [\n \"*\",\n \"audiences:read\",\n \"audiences:write\",\n \"automations:read\",\n \"automations:write\",\n \"booking_pages:read\",\n \"booking_pages:write\",\n \"calendar:read\",\n \"calendar:write\",\n \"domains:read\",\n \"domains:write\",\n \"mailboxes:read\",\n \"mailboxes:export\",\n \"mailboxes:write\",\n \"mailbox_credentials:read\",\n \"mailbox_credentials:write\",\n \"mailbox_forwarding:read\",\n \"mailbox_forwarding:write\",\n \"mailbox_rules:read\",\n \"mailbox_rules:write\",\n \"members:read\",\n \"messages:read\",\n \"messages:write\",\n \"drafts:write\",\n \"drafts:compose\",\n \"messages:send\",\n \"newsletters:read\",\n \"newsletters:write\",\n \"threads:read\",\n \"webhooks:read\",\n \"webhooks:write\",\n \"suppressions:read\",\n \"suppressions:write\",\n] as const;\n\nexport type ApiKeyScope = (typeof API_KEY_SCOPES)[number];\n\nexport const API_KEY_SCOPE_DESCRIPTIONS: Readonly<Record<ApiKeyScope, string>> = {\n \"*\": \"All API endpoints in this organization.\",\n \"audiences:read\": \"List and retrieve newsletter audiences and their subscribers.\",\n \"audiences:write\": \"Create audiences and add, update, or remove their subscribers.\",\n \"automations:read\": \"List and retrieve assistant automations.\",\n \"automations:write\": \"Create, update, and manually run assistant automations.\",\n \"booking_pages:read\": \"List and retrieve booking pages.\",\n \"booking_pages:write\": \"Create, update, and delete booking pages.\",\n \"calendar:read\": \"List and retrieve calendar events and open availability.\",\n \"calendar:write\": \"Create, update, and delete calendar events.\",\n \"domains:read\": \"List, retrieve, and verify domains.\",\n \"domains:write\": \"Create, update, and delete domains.\",\n \"mailboxes:read\": \"List and retrieve mailboxes.\",\n \"mailboxes:export\": \"Create and download mailbox content exports.\",\n \"mailboxes:write\":\n \"Create, update, suspend, resume, and delete mailboxes. Does not include setting mailbox passwords.\",\n \"mailbox_credentials:read\": \"List revocable app passwords for allowed mailboxes.\",\n \"mailbox_credentials:write\":\n \"Set primary mailbox passwords and create and revoke app passwords for allowed mailboxes.\",\n \"mailbox_forwarding:read\": \"List forwarding destinations for allowed mailboxes.\",\n \"mailbox_forwarding:write\": \"Create and remove forwarding destinations for allowed mailboxes.\",\n \"mailbox_rules:read\": \"List deterministic server-side rules for allowed mailboxes.\",\n \"mailbox_rules:write\": \"Create, replace, and remove deterministic rules for allowed mailboxes.\",\n \"members:read\": \"List and retrieve organization members.\",\n \"messages:read\": \"List and retrieve messages.\",\n \"messages:write\": \"Update, move, delete, and inject sandbox messages.\",\n \"drafts:write\": \"Create agent-safe reply drafts with server-derived recipients.\",\n \"drafts:compose\": \"Save new-message drafts to a mailbox's Drafts folder for review. Cannot send.\",\n \"messages:send\": \"Send messages, replies, and approved reply drafts.\",\n \"newsletters:read\": \"List and retrieve newsletter drafts and campaigns.\",\n \"newsletters:write\": \"Create, update, test, schedule, cancel, and resume newsletters.\",\n \"threads:read\": \"List threads and retrieve thread messages.\",\n \"webhooks:read\": \"List webhooks, retrieve webhooks, and list deliveries.\",\n \"webhooks:write\": \"Create, update, delete, test, and rotate webhooks.\",\n \"suppressions:read\": \"List suppressed recipient addresses.\",\n \"suppressions:write\": \"Remove addresses from the suppression list.\",\n};\n\nexport function isApiKeyScope(value: string): value is ApiKeyScope {\n return API_KEY_SCOPES.some((scope) => scope === value);\n}\n\nexport function apiKeyScopesGrant(\n grantedScopes: readonly string[],\n requiredScope: ApiKeyScope | \"public\",\n): boolean {\n if (requiredScope === \"public\") return true;\n return grantedScopes.includes(\"*\") || grantedScopes.includes(requiredScope);\n}\n"]}
@@ -1,4 +1,4 @@
1
- declare const API_KEY_SCOPES: readonly ["*", "audiences:read", "audiences:write", "automations:read", "automations:write", "booking_pages:read", "booking_pages:write", "calendar:read", "calendar:write", "domains:read", "domains:write", "mailboxes:read", "mailboxes:export", "mailboxes:write", "mailbox_credentials:read", "mailbox_credentials:write", "mailbox_forwarding:read", "mailbox_forwarding:write", "mailbox_rules:read", "mailbox_rules:write", "members:read", "messages:read", "messages:write", "drafts:write", "drafts:compose", "messages:send", "newsletters:read", "newsletters:write", "threads:read", "webhooks:read", "webhooks:write", "suppressions:read", "suppressions:write", "partner:organizations:read", "partner:organizations:write", "partner:organizations:access", "partner:mailbox_credentials:issue", "partner:usage:read"];
1
+ declare const API_KEY_SCOPES: readonly ["*", "audiences:read", "audiences:write", "automations:read", "automations:write", "booking_pages:read", "booking_pages:write", "calendar:read", "calendar:write", "domains:read", "domains:write", "mailboxes:read", "mailboxes:export", "mailboxes:write", "mailbox_credentials:read", "mailbox_credentials:write", "mailbox_forwarding:read", "mailbox_forwarding:write", "mailbox_rules:read", "mailbox_rules:write", "members:read", "messages:read", "messages:write", "drafts:write", "drafts:compose", "messages:send", "newsletters:read", "newsletters:write", "threads:read", "webhooks:read", "webhooks:write", "suppressions:read", "suppressions:write"];
2
2
  type ApiKeyScope = (typeof API_KEY_SCOPES)[number];
3
3
  declare const API_KEY_SCOPE_DESCRIPTIONS: Readonly<Record<ApiKeyScope, string>>;
4
4
  declare function isApiKeyScope(value: string): value is ApiKeyScope;
@@ -1,4 +1,4 @@
1
- declare const API_KEY_SCOPES: readonly ["*", "audiences:read", "audiences:write", "automations:read", "automations:write", "booking_pages:read", "booking_pages:write", "calendar:read", "calendar:write", "domains:read", "domains:write", "mailboxes:read", "mailboxes:export", "mailboxes:write", "mailbox_credentials:read", "mailbox_credentials:write", "mailbox_forwarding:read", "mailbox_forwarding:write", "mailbox_rules:read", "mailbox_rules:write", "members:read", "messages:read", "messages:write", "drafts:write", "drafts:compose", "messages:send", "newsletters:read", "newsletters:write", "threads:read", "webhooks:read", "webhooks:write", "suppressions:read", "suppressions:write", "partner:organizations:read", "partner:organizations:write", "partner:organizations:access", "partner:mailbox_credentials:issue", "partner:usage:read"];
1
+ declare const API_KEY_SCOPES: readonly ["*", "audiences:read", "audiences:write", "automations:read", "automations:write", "booking_pages:read", "booking_pages:write", "calendar:read", "calendar:write", "domains:read", "domains:write", "mailboxes:read", "mailboxes:export", "mailboxes:write", "mailbox_credentials:read", "mailbox_credentials:write", "mailbox_forwarding:read", "mailbox_forwarding:write", "mailbox_rules:read", "mailbox_rules:write", "members:read", "messages:read", "messages:write", "drafts:write", "drafts:compose", "messages:send", "newsletters:read", "newsletters:write", "threads:read", "webhooks:read", "webhooks:write", "suppressions:read", "suppressions:write"];
2
2
  type ApiKeyScope = (typeof API_KEY_SCOPES)[number];
3
3
  declare const API_KEY_SCOPE_DESCRIPTIONS: Readonly<Record<ApiKeyScope, string>>;
4
4
  declare function isApiKeyScope(value: string): value is ApiKeyScope;
@@ -32,15 +32,10 @@ var API_KEY_SCOPES = [
32
32
  "webhooks:read",
33
33
  "webhooks:write",
34
34
  "suppressions:read",
35
- "suppressions:write",
36
- "partner:organizations:read",
37
- "partner:organizations:write",
38
- "partner:organizations:access",
39
- "partner:mailbox_credentials:issue",
40
- "partner:usage:read"
35
+ "suppressions:write"
41
36
  ];
42
37
  var API_KEY_SCOPE_DESCRIPTIONS = {
43
- "*": "All non-partner API endpoints in this organization.",
38
+ "*": "All API endpoints in this organization.",
44
39
  "audiences:read": "List and retrieve newsletter audiences and their subscribers.",
45
40
  "audiences:write": "Create audiences and add, update, or remove their subscribers.",
46
41
  "automations:read": "List and retrieve assistant automations.",
@@ -72,19 +67,13 @@ var API_KEY_SCOPE_DESCRIPTIONS = {
72
67
  "webhooks:read": "List webhooks, retrieve webhooks, and list deliveries.",
73
68
  "webhooks:write": "Create, update, delete, test, and rotate webhooks.",
74
69
  "suppressions:read": "List suppressed recipient addresses.",
75
- "suppressions:write": "Remove addresses from the suppression list.",
76
- "partner:organizations:read": "List and retrieve this partner's child organizations.",
77
- "partner:organizations:write": "Create and manage this partner's child organizations.",
78
- "partner:organizations:access": "Act on an active child using the delegated organization header.",
79
- "partner:mailbox_credentials:issue": "List and consume operator-approved grants for embedded-webmail credentials.",
80
- "partner:usage:read": "Read consolidated child and mailbox usage for this partner."
70
+ "suppressions:write": "Remove addresses from the suppression list."
81
71
  };
82
72
  function isApiKeyScope(value) {
83
73
  return API_KEY_SCOPES.some((scope) => scope === value);
84
74
  }
85
75
  function apiKeyScopesGrant(grantedScopes, requiredScope) {
86
76
  if (requiredScope === "public") return true;
87
- if (requiredScope.startsWith("partner:")) return grantedScopes.includes(requiredScope);
88
77
  return grantedScopes.includes("*") || grantedScopes.includes(requiredScope);
89
78
  }
90
79
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api-key-scopes.ts"],"names":[],"mappings":";AAAO,IAAM,cAAA,GAAiB;AAAA,EAC5B,GAAA;AAAA,EACA,gBAAA;AAAA,EACA,iBAAA;AAAA,EACA,kBAAA;AAAA,EACA,mBAAA;AAAA,EACA,oBAAA;AAAA,EACA,qBAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,cAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,kBAAA;AAAA,EACA,iBAAA;AAAA,EACA,0BAAA;AAAA,EACA,2BAAA;AAAA,EACA,yBAAA;AAAA,EACA,0BAAA;AAAA,EACA,oBAAA;AAAA,EACA,qBAAA;AAAA,EACA,cAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,cAAA;AAAA,EACA,gBAAA;AAAA,EACA,eAAA;AAAA,EACA,kBAAA;AAAA,EACA,mBAAA;AAAA,EACA,cAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,mBAAA;AAAA,EACA,oBAAA;AAAA,EACA,4BAAA;AAAA,EACA,6BAAA;AAAA,EACA,8BAAA;AAAA,EACA,mCAAA;AAAA,EACA;AACF;AAIO,IAAM,0BAAA,GAAoE;AAAA,EAC/E,GAAA,EAAK,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xB;AAEO,SAAS,cAAc,KAAA,EAAqC;AACjE,EAAA,OAAO,cAAA,CAAe,IAAA,CAAK,CAAC,KAAA,KAAU,UAAU,KAAK,CAAA;AACvD;AAEO,SAAS,iBAAA,CACd,eACA,aAAA,EACS;AACT,EAAA,IAAI,aAAA,KAAkB,UAAU,OAAO,IAAA;AACvC,EAAA,IAAI,cAAc,UAAA,CAAW,UAAU,GAAG,OAAO,aAAA,CAAc,SAAS,aAAa,CAAA;AACrF,EAAA,OAAO,cAAc,QAAA,CAAS,GAAG,CAAA,IAAK,aAAA,CAAc,SAAS,aAAa,CAAA;AAC5E","file":"api-key-scopes.js","sourcesContent":["export const API_KEY_SCOPES = [\n \"*\",\n \"audiences:read\",\n \"audiences:write\",\n \"automations:read\",\n \"automations:write\",\n \"booking_pages:read\",\n \"booking_pages:write\",\n \"calendar:read\",\n \"calendar:write\",\n \"domains:read\",\n \"domains:write\",\n \"mailboxes:read\",\n \"mailboxes:export\",\n \"mailboxes:write\",\n \"mailbox_credentials:read\",\n \"mailbox_credentials:write\",\n \"mailbox_forwarding:read\",\n \"mailbox_forwarding:write\",\n \"mailbox_rules:read\",\n \"mailbox_rules:write\",\n \"members:read\",\n \"messages:read\",\n \"messages:write\",\n \"drafts:write\",\n \"drafts:compose\",\n \"messages:send\",\n \"newsletters:read\",\n \"newsletters:write\",\n \"threads:read\",\n \"webhooks:read\",\n \"webhooks:write\",\n \"suppressions:read\",\n \"suppressions:write\",\n \"partner:organizations:read\",\n \"partner:organizations:write\",\n \"partner:organizations:access\",\n \"partner:mailbox_credentials:issue\",\n \"partner:usage:read\",\n] as const;\n\nexport type ApiKeyScope = (typeof API_KEY_SCOPES)[number];\n\nexport const API_KEY_SCOPE_DESCRIPTIONS: Readonly<Record<ApiKeyScope, string>> = {\n \"*\": \"All non-partner API endpoints in this organization.\",\n \"audiences:read\": \"List and retrieve newsletter audiences and their subscribers.\",\n \"audiences:write\": \"Create audiences and add, update, or remove their subscribers.\",\n \"automations:read\": \"List and retrieve assistant automations.\",\n \"automations:write\": \"Create, update, and manually run assistant automations.\",\n \"booking_pages:read\": \"List and retrieve booking pages.\",\n \"booking_pages:write\": \"Create, update, and delete booking pages.\",\n \"calendar:read\": \"List and retrieve calendar events and open availability.\",\n \"calendar:write\": \"Create, update, and delete calendar events.\",\n \"domains:read\": \"List, retrieve, and verify domains.\",\n \"domains:write\": \"Create, update, and delete domains.\",\n \"mailboxes:read\": \"List and retrieve mailboxes.\",\n \"mailboxes:export\": \"Create and download mailbox content exports.\",\n \"mailboxes:write\":\n \"Create, update, suspend, resume, and delete mailboxes. Does not include setting mailbox passwords.\",\n \"mailbox_credentials:read\": \"List revocable app passwords for allowed mailboxes.\",\n \"mailbox_credentials:write\":\n \"Set primary mailbox passwords and create and revoke app passwords for allowed mailboxes.\",\n \"mailbox_forwarding:read\": \"List forwarding destinations for allowed mailboxes.\",\n \"mailbox_forwarding:write\": \"Create and remove forwarding destinations for allowed mailboxes.\",\n \"mailbox_rules:read\": \"List deterministic server-side rules for allowed mailboxes.\",\n \"mailbox_rules:write\": \"Create, replace, and remove deterministic rules for allowed mailboxes.\",\n \"members:read\": \"List and retrieve organization members.\",\n \"messages:read\": \"List and retrieve messages.\",\n \"messages:write\": \"Update, move, delete, and inject sandbox messages.\",\n \"drafts:write\": \"Create agent-safe reply drafts with server-derived recipients.\",\n \"drafts:compose\": \"Save new-message drafts to a mailbox's Drafts folder for review. Cannot send.\",\n \"messages:send\": \"Send messages, replies, and approved reply drafts.\",\n \"newsletters:read\": \"List and retrieve newsletter drafts and campaigns.\",\n \"newsletters:write\": \"Create, update, test, schedule, cancel, and resume newsletters.\",\n \"threads:read\": \"List threads and retrieve thread messages.\",\n \"webhooks:read\": \"List webhooks, retrieve webhooks, and list deliveries.\",\n \"webhooks:write\": \"Create, update, delete, test, and rotate webhooks.\",\n \"suppressions:read\": \"List suppressed recipient addresses.\",\n \"suppressions:write\": \"Remove addresses from the suppression list.\",\n \"partner:organizations:read\": \"List and retrieve this partner's child organizations.\",\n \"partner:organizations:write\": \"Create and manage this partner's child organizations.\",\n \"partner:organizations:access\": \"Act on an active child using the delegated organization header.\",\n \"partner:mailbox_credentials:issue\":\n \"List and consume operator-approved grants for embedded-webmail credentials.\",\n \"partner:usage:read\": \"Read consolidated child and mailbox usage for this partner.\",\n};\n\nexport function isApiKeyScope(value: string): value is ApiKeyScope {\n return API_KEY_SCOPES.some((scope) => scope === value);\n}\n\nexport function apiKeyScopesGrant(\n grantedScopes: readonly string[],\n requiredScope: ApiKeyScope | \"public\",\n): boolean {\n if (requiredScope === \"public\") return true;\n if (requiredScope.startsWith(\"partner:\")) return grantedScopes.includes(requiredScope);\n return grantedScopes.includes(\"*\") || grantedScopes.includes(requiredScope);\n}\n"]}
1
+ {"version":3,"sources":["../src/api-key-scopes.ts"],"names":[],"mappings":";AAAO,IAAM,cAAA,GAAiB;AAAA,EAC5B,GAAA;AAAA,EACA,gBAAA;AAAA,EACA,iBAAA;AAAA,EACA,kBAAA;AAAA,EACA,mBAAA;AAAA,EACA,oBAAA;AAAA,EACA,qBAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,cAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,kBAAA;AAAA,EACA,iBAAA;AAAA,EACA,0BAAA;AAAA,EACA,2BAAA;AAAA,EACA,yBAAA;AAAA,EACA,0BAAA;AAAA,EACA,oBAAA;AAAA,EACA,qBAAA;AAAA,EACA,cAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,cAAA;AAAA,EACA,gBAAA;AAAA,EACA,eAAA;AAAA,EACA,kBAAA;AAAA,EACA,mBAAA;AAAA,EACA,cAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,mBAAA;AAAA,EACA;AACF;AAIO,IAAM,0BAAA,GAAoE;AAAA,EAC/E,GAAA,EAAK,yCAAA;AAAA,EACL,gBAAA,EAAkB,+DAAA;AAAA,EAClB,iB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AO,cAAc,QAAA,CAAS,GAAG,CAAA,IAAK,aAAA,CAAc,SAAS,aAAa,CAAA;AAC5E","file":"api-key-scopes.js","sourcesContent":["export const API_KEY_SCOPES = [\n \"*\",\n \"audiences:read\",\n \"audiences:write\",\n \"automations:read\",\n \"automations:write\",\n \"booking_pages:read\",\n \"booking_pages:write\",\n \"calendar:read\",\n \"calendar:write\",\n \"domains:read\",\n \"domains:write\",\n \"mailboxes:read\",\n \"mailboxes:export\",\n \"mailboxes:write\",\n \"mailbox_credentials:read\",\n \"mailbox_credentials:write\",\n \"mailbox_forwarding:read\",\n \"mailbox_forwarding:write\",\n \"mailbox_rules:read\",\n \"mailbox_rules:write\",\n \"members:read\",\n \"messages:read\",\n \"messages:write\",\n \"drafts:write\",\n \"drafts:compose\",\n \"messages:send\",\n \"newsletters:read\",\n \"newsletters:write\",\n \"threads:read\",\n \"webhooks:read\",\n \"webhooks:write\",\n \"suppressions:read\",\n \"suppressions:write\",\n] as const;\n\nexport type ApiKeyScope = (typeof API_KEY_SCOPES)[number];\n\nexport const API_KEY_SCOPE_DESCRIPTIONS: Readonly<Record<ApiKeyScope, string>> = {\n \"*\": \"All API endpoints in this organization.\",\n \"audiences:read\": \"List and retrieve newsletter audiences and their subscribers.\",\n \"audiences:write\": \"Create audiences and add, update, or remove their subscribers.\",\n \"automations:read\": \"List and retrieve assistant automations.\",\n \"automations:write\": \"Create, update, and manually run assistant automations.\",\n \"booking_pages:read\": \"List and retrieve booking pages.\",\n \"booking_pages:write\": \"Create, update, and delete booking pages.\",\n \"calendar:read\": \"List and retrieve calendar events and open availability.\",\n \"calendar:write\": \"Create, update, and delete calendar events.\",\n \"domains:read\": \"List, retrieve, and verify domains.\",\n \"domains:write\": \"Create, update, and delete domains.\",\n \"mailboxes:read\": \"List and retrieve mailboxes.\",\n \"mailboxes:export\": \"Create and download mailbox content exports.\",\n \"mailboxes:write\":\n \"Create, update, suspend, resume, and delete mailboxes. Does not include setting mailbox passwords.\",\n \"mailbox_credentials:read\": \"List revocable app passwords for allowed mailboxes.\",\n \"mailbox_credentials:write\":\n \"Set primary mailbox passwords and create and revoke app passwords for allowed mailboxes.\",\n \"mailbox_forwarding:read\": \"List forwarding destinations for allowed mailboxes.\",\n \"mailbox_forwarding:write\": \"Create and remove forwarding destinations for allowed mailboxes.\",\n \"mailbox_rules:read\": \"List deterministic server-side rules for allowed mailboxes.\",\n \"mailbox_rules:write\": \"Create, replace, and remove deterministic rules for allowed mailboxes.\",\n \"members:read\": \"List and retrieve organization members.\",\n \"messages:read\": \"List and retrieve messages.\",\n \"messages:write\": \"Update, move, delete, and inject sandbox messages.\",\n \"drafts:write\": \"Create agent-safe reply drafts with server-derived recipients.\",\n \"drafts:compose\": \"Save new-message drafts to a mailbox's Drafts folder for review. Cannot send.\",\n \"messages:send\": \"Send messages, replies, and approved reply drafts.\",\n \"newsletters:read\": \"List and retrieve newsletter drafts and campaigns.\",\n \"newsletters:write\": \"Create, update, test, schedule, cancel, and resume newsletters.\",\n \"threads:read\": \"List threads and retrieve thread messages.\",\n \"webhooks:read\": \"List webhooks, retrieve webhooks, and list deliveries.\",\n \"webhooks:write\": \"Create, update, delete, test, and rotate webhooks.\",\n \"suppressions:read\": \"List suppressed recipient addresses.\",\n \"suppressions:write\": \"Remove addresses from the suppression list.\",\n};\n\nexport function isApiKeyScope(value: string): value is ApiKeyScope {\n return API_KEY_SCOPES.some((scope) => scope === value);\n}\n\nexport function apiKeyScopesGrant(\n grantedScopes: readonly string[],\n requiredScope: ApiKeyScope | \"public\",\n): boolean {\n if (requiredScope === \"public\") return true;\n return grantedScopes.includes(\"*\") || grantedScopes.includes(requiredScope);\n}\n"]}
package/dist/index.cjs CHANGED
@@ -36,15 +36,10 @@ var API_KEY_SCOPES = [
36
36
  "webhooks:read",
37
37
  "webhooks:write",
38
38
  "suppressions:read",
39
- "suppressions:write",
40
- "partner:organizations:read",
41
- "partner:organizations:write",
42
- "partner:organizations:access",
43
- "partner:mailbox_credentials:issue",
44
- "partner:usage:read"
39
+ "suppressions:write"
45
40
  ];
46
41
  var API_KEY_SCOPE_DESCRIPTIONS = {
47
- "*": "All non-partner API endpoints in this organization.",
42
+ "*": "All API endpoints in this organization.",
48
43
  "audiences:read": "List and retrieve newsletter audiences and their subscribers.",
49
44
  "audiences:write": "Create audiences and add, update, or remove their subscribers.",
50
45
  "automations:read": "List and retrieve assistant automations.",
@@ -76,19 +71,13 @@ var API_KEY_SCOPE_DESCRIPTIONS = {
76
71
  "webhooks:read": "List webhooks, retrieve webhooks, and list deliveries.",
77
72
  "webhooks:write": "Create, update, delete, test, and rotate webhooks.",
78
73
  "suppressions:read": "List suppressed recipient addresses.",
79
- "suppressions:write": "Remove addresses from the suppression list.",
80
- "partner:organizations:read": "List and retrieve this partner's child organizations.",
81
- "partner:organizations:write": "Create and manage this partner's child organizations.",
82
- "partner:organizations:access": "Act on an active child using the delegated organization header.",
83
- "partner:mailbox_credentials:issue": "List and consume operator-approved grants for embedded-webmail credentials.",
84
- "partner:usage:read": "Read consolidated child and mailbox usage for this partner."
74
+ "suppressions:write": "Remove addresses from the suppression list."
85
75
  };
86
76
  function isApiKeyScope(value) {
87
77
  return API_KEY_SCOPES.some((scope) => scope === value);
88
78
  }
89
79
  function apiKeyScopesGrant(grantedScopes, requiredScope) {
90
80
  if (requiredScope === "public") return true;
91
- if (requiredScope.startsWith("partner:")) return grantedScopes.includes(requiredScope);
92
81
  return grantedScopes.includes("*") || grantedScopes.includes(requiredScope);
93
82
  }
94
83
 
@@ -1381,87 +1370,6 @@ var Newsletters = class extends ApiResource {
1381
1370
  }
1382
1371
  };
1383
1372
 
1384
- // src/resources/partner.ts
1385
- var Partner = class extends ApiResource {
1386
- listOrganizations(options) {
1387
- return this.client.request({
1388
- method: "GET",
1389
- path: "/partner/organizations",
1390
- methodOptions: options
1391
- });
1392
- }
1393
- createOrganization(params, options) {
1394
- return this.client.request({
1395
- method: "POST",
1396
- path: "/partner/organizations",
1397
- body: params,
1398
- methodOptions: options
1399
- });
1400
- }
1401
- getOrganization(id, options) {
1402
- return this.client.request({
1403
- method: "GET",
1404
- path: `/partner/organizations/${encodeURIComponent(id)}`,
1405
- methodOptions: options
1406
- });
1407
- }
1408
- updateOrganization(id, params, options) {
1409
- return this.client.request({
1410
- method: "PATCH",
1411
- path: `/partner/organizations/${encodeURIComponent(id)}`,
1412
- body: params,
1413
- methodOptions: options
1414
- });
1415
- }
1416
- resendOwnershipInvitation(id, params = {}, options) {
1417
- return this.client.request({
1418
- method: "POST",
1419
- path: `/partner/organizations/${encodeURIComponent(id)}/ownership-invitations`,
1420
- body: params,
1421
- methodOptions: options
1422
- });
1423
- }
1424
- suspendOrganization(id, options) {
1425
- return this.client.request({
1426
- method: "POST",
1427
- path: `/partner/organizations/${encodeURIComponent(id)}/suspend`,
1428
- methodOptions: options
1429
- });
1430
- }
1431
- resumeOrganization(id, options) {
1432
- return this.client.request({
1433
- method: "POST",
1434
- path: `/partner/organizations/${encodeURIComponent(id)}/resume`,
1435
- methodOptions: options
1436
- });
1437
- }
1438
- offboardOrganization(id, options) {
1439
- return this.client.request({
1440
- method: "DELETE",
1441
- path: `/partner/organizations/${encodeURIComponent(id)}`,
1442
- methodOptions: options
1443
- });
1444
- }
1445
- listMailboxCredentialGrants(options) {
1446
- return this.client.request({
1447
- method: "GET",
1448
- path: "/partner/mailbox-credential-grants",
1449
- methodOptions: options
1450
- });
1451
- }
1452
- consumeMailboxCredentialGrant(grantId, params = {}, options) {
1453
- return this.client.request({
1454
- method: "POST",
1455
- path: `/partner/mailbox-credential-grants/${encodeURIComponent(grantId)}/consume`,
1456
- body: params,
1457
- methodOptions: options
1458
- });
1459
- }
1460
- usage(options) {
1461
- return this.client.request({ method: "GET", path: "/partner/usage", methodOptions: options });
1462
- }
1463
- };
1464
-
1465
1373
  // src/resources/reply-scans.ts
1466
1374
  var ReplyScans = class extends ApiResource {
1467
1375
  create(params, options) {
@@ -1710,7 +1618,7 @@ var Webhooks = class extends ApiResource {
1710
1618
  };
1711
1619
 
1712
1620
  // src/version.ts
1713
- var VERSION = "0.5.10";
1621
+ var VERSION = "0.6.1";
1714
1622
 
1715
1623
  // src/client.ts
1716
1624
  var DEFAULT_BASE_URL = "https://shipmail.to/api/v1";
@@ -1762,7 +1670,6 @@ var ShipmailClient = class {
1762
1670
  this.timeout = DEFAULT_TIMEOUT;
1763
1671
  this.fetchFn = globalThis.fetch;
1764
1672
  this.defaultHeaders = {};
1765
- this.organizationId = void 0;
1766
1673
  } else {
1767
1674
  this.apiKey = config.apiKey;
1768
1675
  this.baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;
@@ -1770,7 +1677,6 @@ var ShipmailClient = class {
1770
1677
  this.timeout = config.timeout ?? DEFAULT_TIMEOUT;
1771
1678
  this.fetchFn = config.fetch ?? globalThis.fetch;
1772
1679
  this.defaultHeaders = config.defaultHeaders ? { ...config.defaultHeaders } : {};
1773
- this.organizationId = config.organizationId;
1774
1680
  }
1775
1681
  if (!Number.isSafeInteger(this.maxRetries) || this.maxRetries < 0) {
1776
1682
  throw new RangeError("maxRetries must be a non-negative safe integer");
@@ -1785,7 +1691,6 @@ var ShipmailClient = class {
1785
1691
  this.members = new Members(this);
1786
1692
  this.messages = new Messages(this);
1787
1693
  this.newsletters = new Newsletters(this);
1788
- this.partner = new Partner(this);
1789
1694
  this.replyScans = new ReplyScans(this);
1790
1695
  this.scheduledMessages = new ScheduledMessages(this);
1791
1696
  this.suppressions = new Suppressions(this);
@@ -1832,10 +1737,6 @@ var ShipmailClient = class {
1832
1737
  if (methodOpts?.idempotencyKey) {
1833
1738
  headers["Idempotency-Key"] = methodOpts.idempotencyKey;
1834
1739
  }
1835
- const targetOrganizationId = methodOpts?.organizationId ?? this.organizationId;
1836
- if (targetOrganizationId) {
1837
- headers["X-Shipmail-Organization-Id"] = targetOrganizationId;
1838
- }
1839
1740
  let body = null;
1840
1741
  if (options.rawBody !== void 0) {
1841
1742
  headers["Content-Type"] = options.contentType ?? "application/octet-stream";
@@ -1921,7 +1822,13 @@ var WEBHOOK_EVENT_TYPES = [
1921
1822
  "org.reputation_warning",
1922
1823
  "org.sending_throttled",
1923
1824
  "org.sending_suspended",
1924
- "org.reputation_recovered"
1825
+ "org.reputation_recovered",
1826
+ "reply.overdue",
1827
+ "conversation.needs_action",
1828
+ "calendar.event_starting",
1829
+ "booking.created",
1830
+ "subscriber.added",
1831
+ "newsletter.sent"
1925
1832
  ];
1926
1833
  var WEBHOOK_DELIVERY_EVENT_TYPES = ["webhook.test", ...WEBHOOK_EVENT_TYPES];
1927
1834
  var DOMAIN_STATUSES = ["pending", "verifying", "verified", "degraded", "failed"];