shipmail 0.4.2 → 0.4.3
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 +17 -0
- package/dist/api-key-scopes.cjs +4 -0
- package/dist/api-key-scopes.cjs.map +1 -1
- package/dist/api-key-scopes.d.cts +1 -1
- package/dist/api-key-scopes.d.ts +1 -1
- package/dist/api-key-scopes.js +4 -0
- package/dist/api-key-scopes.js.map +1 -1
- package/dist/index.cjs +21 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -3
- package/dist/index.d.ts +65 -3
- package/dist/index.js +21 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -160,6 +160,22 @@ const folder = await shipmail.mailboxes.createFolder("mbx_...", {
|
|
|
160
160
|
await shipmail.mailboxes.updateFolder("mbx_...", folder.id, { name: "VIP Clients" });
|
|
161
161
|
await shipmail.mailboxes.deleteFolder("mbx_...", folder.id);
|
|
162
162
|
const identities = await shipmail.mailboxes.listIdentities("mbx_...");
|
|
163
|
+
const currentRules = await shipmail.mailboxes.getRules("mbx_...");
|
|
164
|
+
const updatedRules = await shipmail.mailboxes.updateRules("mbx_...", {
|
|
165
|
+
rules: [
|
|
166
|
+
...currentRules.rules,
|
|
167
|
+
{
|
|
168
|
+
id: crypto.randomUUID(),
|
|
169
|
+
name: "Flag invoices",
|
|
170
|
+
enabled: true,
|
|
171
|
+
position: currentRules.rules.length,
|
|
172
|
+
match_mode: "all",
|
|
173
|
+
stop: false,
|
|
174
|
+
conditions: [{ type: "subject_contains", value: "invoice" }],
|
|
175
|
+
actions: [{ type: "star" }, { type: "send_webhook" }],
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
});
|
|
163
179
|
await shipmail.mailboxes.updateSpamFilter("mbx_...", { threshold: 8 });
|
|
164
180
|
await shipmail.mailboxes.delete("mbx_...");
|
|
165
181
|
|
|
@@ -357,6 +373,7 @@ message.delivered
|
|
|
357
373
|
message.bounced
|
|
358
374
|
message.complained
|
|
359
375
|
thread.needs_reply
|
|
376
|
+
mailbox.rule_matched
|
|
360
377
|
domain.verified
|
|
361
378
|
domain.verification_failed
|
|
362
379
|
domain.degraded
|
package/dist/api-key-scopes.cjs
CHANGED
|
@@ -18,6 +18,8 @@ var API_KEY_SCOPES = [
|
|
|
18
18
|
"mailbox_credentials:write",
|
|
19
19
|
"mailbox_forwarding:read",
|
|
20
20
|
"mailbox_forwarding:write",
|
|
21
|
+
"mailbox_rules:read",
|
|
22
|
+
"mailbox_rules:write",
|
|
21
23
|
"messages:read",
|
|
22
24
|
"messages:write",
|
|
23
25
|
"drafts:write",
|
|
@@ -52,6 +54,8 @@ var API_KEY_SCOPE_DESCRIPTIONS = {
|
|
|
52
54
|
"mailbox_credentials:write": "Create and revoke app passwords for allowed mailboxes.",
|
|
53
55
|
"mailbox_forwarding:read": "List forwarding destinations for allowed mailboxes.",
|
|
54
56
|
"mailbox_forwarding:write": "Create and remove forwarding destinations for allowed mailboxes.",
|
|
57
|
+
"mailbox_rules:read": "List deterministic server-side rules for allowed mailboxes.",
|
|
58
|
+
"mailbox_rules:write": "Create, replace, and remove deterministic rules for allowed mailboxes.",
|
|
55
59
|
"messages:read": "List and retrieve messages.",
|
|
56
60
|
"messages:write": "Update, move, delete, and inject sandbox messages.",
|
|
57
61
|
"drafts:write": "Create agent-safe reply drafts with server-derived recipients.",
|
|
@@ -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,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,2B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AA,EAAsB,6CAAA;AAAA,EACtB,4BAAA,EAA8B,uDAAA;AAAA,EAC9B,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 \"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 \"messages:read\",\n \"messages:write\",\n \"drafts:write\",\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 \"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\": \"Create, update, suspend, resume, and delete mailboxes.\",\n \"mailbox_credentials:read\": \"List revocable app passwords for allowed mailboxes.\",\n \"mailbox_credentials:write\": \"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 \"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 \"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,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,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,cAAA;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,qDAAA;AAAA,EACL,gBAAA,EAAkB,+DAAA;AAAA,EAClB,iBAAA,EAAmB,gEAAA;AAAA,EACnB,oBAAA,EAAsB,kCAAA;AAAA,EACtB,qBAAA,EAAuB,2CAAA;AAAA,EACvB,eAAA,EAAiB,0DAAA;AAAA,EACjB,gBAAA,EAAkB,6CAAA;AAAA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A,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 \"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 \"messages:read\",\n \"messages:write\",\n \"drafts:write\",\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 \"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\": \"Create, update, suspend, resume, and delete mailboxes.\",\n \"mailbox_credentials:read\": \"List revocable app passwords for allowed mailboxes.\",\n \"mailbox_credentials:write\": \"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 \"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 \"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,4 +1,4 @@
|
|
|
1
|
-
declare const API_KEY_SCOPES: readonly ["*", "audiences:read", "audiences: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", "messages:read", "messages:write", "drafts:write", "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", "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", "messages:read", "messages:write", "drafts:write", "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"];
|
|
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;
|
package/dist/api-key-scopes.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const API_KEY_SCOPES: readonly ["*", "audiences:read", "audiences: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", "messages:read", "messages:write", "drafts:write", "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", "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", "messages:read", "messages:write", "drafts:write", "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"];
|
|
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;
|
package/dist/api-key-scopes.js
CHANGED
|
@@ -16,6 +16,8 @@ var API_KEY_SCOPES = [
|
|
|
16
16
|
"mailbox_credentials:write",
|
|
17
17
|
"mailbox_forwarding:read",
|
|
18
18
|
"mailbox_forwarding:write",
|
|
19
|
+
"mailbox_rules:read",
|
|
20
|
+
"mailbox_rules:write",
|
|
19
21
|
"messages:read",
|
|
20
22
|
"messages:write",
|
|
21
23
|
"drafts:write",
|
|
@@ -50,6 +52,8 @@ var API_KEY_SCOPE_DESCRIPTIONS = {
|
|
|
50
52
|
"mailbox_credentials:write": "Create and revoke app passwords for allowed mailboxes.",
|
|
51
53
|
"mailbox_forwarding:read": "List forwarding destinations for allowed mailboxes.",
|
|
52
54
|
"mailbox_forwarding:write": "Create and remove forwarding destinations for allowed mailboxes.",
|
|
55
|
+
"mailbox_rules:read": "List deterministic server-side rules for allowed mailboxes.",
|
|
56
|
+
"mailbox_rules:write": "Create, replace, and remove deterministic rules for allowed mailboxes.",
|
|
53
57
|
"messages:read": "List and retrieve messages.",
|
|
54
58
|
"messages:write": "Update, move, delete, and inject sandbox messages.",
|
|
55
59
|
"drafts:write": "Create agent-safe reply drafts with server-derived recipients.",
|
|
@@ -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,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,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,cAAA;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,qDAAA;AAAA,EACL,gBAAA,EAAkB,+DAAA;AAAA,EAClB,iBAAA,EAAmB,gEAAA;AAAA,EACnB,oBAAA,EAAsB,kCAAA;AAAA,EACtB,qBAAA,EAAuB,2CAAA;AAAA,EACvB,eAAA,EAAiB,0DAAA;AAAA,EACjB,gBAAA,EAAkB,6CAAA;AAAA,EAClB,cAAA,EAAgB,qCAAA;AAAA,EAChB,eAAA,EAAiB,qCAAA;AAAA,EACjB,gBAAA,EAAkB,8BAAA;AAAA,EAClB,kBAAA,EAAoB,8CAAA;AAAA,EACpB,iBAAA,EAAmB,wDAAA;AAAA,EACnB,0BAAA,EAA4B,qDAAA;AAAA,EAC5B,2BAAA,EAA6B,wDAAA;AAAA,EAC7B,yBAAA,EAA2B,qDAAA;AAAA,EAC3B,0BAAA,EAA4B,kEAAA;AAAA,EAC5B,eAAA,EAAiB,6BAAA;AAAA,EACjB,gBAAA,EAAkB,oDAAA;AAAA,EAClB,cAAA,EAAgB,gEAAA;AAAA,EAChB,eAAA,EAAiB,oDAAA;AAAA,EACjB,kBAAA,EAAoB,oDAAA;AAAA,EACpB,mBAAA,EAAqB,iEAAA;AAAA,EACrB,cAAA,EAAgB,4CAAA;AAAA,EAChB,eAAA,EAAiB,wDAAA;AAAA,EACjB,gBAAA,EAAkB,oDAAA;AAAA,EAClB,mBAAA,EAAqB,sCAAA;AAAA,EACrB,oBAAA,EAAsB,6CAAA;AAAA,EACtB,4BAAA,EAA8B,uDAAA;AAAA,EAC9B,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.js","sourcesContent":["export const API_KEY_SCOPES = [\n \"*\",\n \"audiences:read\",\n \"audiences: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 \"messages:read\",\n \"messages:write\",\n \"drafts:write\",\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 \"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\": \"Create, update, suspend, resume, and delete mailboxes.\",\n \"mailbox_credentials:read\": \"List revocable app passwords for allowed mailboxes.\",\n \"mailbox_credentials:write\": \"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 \"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 \"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,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,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,cAAA;AAAA,EACA,eAAA;AAAA,EACA,kBAAA;AAAA,EACA,mBAAA;AAAA,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A;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.js","sourcesContent":["export const API_KEY_SCOPES = [\n \"*\",\n \"audiences:read\",\n \"audiences: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 \"messages:read\",\n \"messages:write\",\n \"drafts:write\",\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 \"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\": \"Create, update, suspend, resume, and delete mailboxes.\",\n \"mailbox_credentials:read\": \"List revocable app passwords for allowed mailboxes.\",\n \"mailbox_credentials:write\": \"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 \"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 \"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"]}
|
package/dist/index.cjs
CHANGED
|
@@ -20,6 +20,8 @@ var API_KEY_SCOPES = [
|
|
|
20
20
|
"mailbox_credentials:write",
|
|
21
21
|
"mailbox_forwarding:read",
|
|
22
22
|
"mailbox_forwarding:write",
|
|
23
|
+
"mailbox_rules:read",
|
|
24
|
+
"mailbox_rules:write",
|
|
23
25
|
"messages:read",
|
|
24
26
|
"messages:write",
|
|
25
27
|
"drafts:write",
|
|
@@ -54,6 +56,8 @@ var API_KEY_SCOPE_DESCRIPTIONS = {
|
|
|
54
56
|
"mailbox_credentials:write": "Create and revoke app passwords for allowed mailboxes.",
|
|
55
57
|
"mailbox_forwarding:read": "List forwarding destinations for allowed mailboxes.",
|
|
56
58
|
"mailbox_forwarding:write": "Create and remove forwarding destinations for allowed mailboxes.",
|
|
59
|
+
"mailbox_rules:read": "List deterministic server-side rules for allowed mailboxes.",
|
|
60
|
+
"mailbox_rules:write": "Create, replace, and remove deterministic rules for allowed mailboxes.",
|
|
57
61
|
"messages:read": "List and retrieve messages.",
|
|
58
62
|
"messages:write": "Update, move, delete, and inject sandbox messages.",
|
|
59
63
|
"drafts:write": "Create agent-safe reply drafts with server-derived recipients.",
|
|
@@ -874,6 +878,21 @@ var Mailboxes = class extends ApiResource {
|
|
|
874
878
|
methodOptions: options
|
|
875
879
|
});
|
|
876
880
|
}
|
|
881
|
+
getRules(id, options) {
|
|
882
|
+
return this.client.request({
|
|
883
|
+
method: "GET",
|
|
884
|
+
path: `/mailboxes/${encodeURIComponent(id)}/rules`,
|
|
885
|
+
methodOptions: options
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
updateRules(id, params, options) {
|
|
889
|
+
return this.client.request({
|
|
890
|
+
method: "PUT",
|
|
891
|
+
path: `/mailboxes/${encodeURIComponent(id)}/rules`,
|
|
892
|
+
body: params,
|
|
893
|
+
methodOptions: options
|
|
894
|
+
});
|
|
895
|
+
}
|
|
877
896
|
listForwarding(id, options) {
|
|
878
897
|
return this.client.request({
|
|
879
898
|
method: "GET",
|
|
@@ -1485,7 +1504,7 @@ var Webhooks = class extends ApiResource {
|
|
|
1485
1504
|
};
|
|
1486
1505
|
|
|
1487
1506
|
// src/version.ts
|
|
1488
|
-
var VERSION = "0.4.
|
|
1507
|
+
var VERSION = "0.4.3";
|
|
1489
1508
|
|
|
1490
1509
|
// src/client.ts
|
|
1491
1510
|
var DEFAULT_BASE_URL = "https://shipmail.to/api/v1";
|
|
@@ -1660,6 +1679,7 @@ var WEBHOOK_EVENT_TYPES = [
|
|
|
1660
1679
|
"message.bounced",
|
|
1661
1680
|
"message.complained",
|
|
1662
1681
|
"thread.needs_reply",
|
|
1682
|
+
"mailbox.rule_matched",
|
|
1663
1683
|
"domain.verified",
|
|
1664
1684
|
"domain.verification_failed",
|
|
1665
1685
|
"domain.degraded",
|