@primitivedotdev/sdk 1.22.1 → 1.24.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 +12 -4
- package/dist/api/index.d.ts +4 -4
- package/dist/api/index.js +3 -3
- package/dist/{api-D18uroMD.js → api-C_OS8hb4.js} +315 -9
- package/dist/contract/index.d.ts +2 -2
- package/dist/contract/index.js +1 -1
- package/dist/{errors-BSsdMlef.d.ts → errors-BgI9FKHK.d.ts} +1 -1
- package/dist/{index-PTY8VraQ.d.ts → index-Dv1zvPCc.d.ts} +1220 -59
- package/dist/{index-x795QzI4.d.ts → index-fS1gVNuX.d.ts} +3 -3
- package/dist/index.d.ts +7 -6
- package/dist/index.js +2 -2
- package/dist/interactions/index.d.ts +132 -0
- package/dist/interactions/index.js +494 -0
- package/dist/openapi/index.js +1 -1
- package/dist/{operations.generated-CqlK_7LO.js → operations.generated-CG4ftbsn.js} +6281 -2960
- package/dist/parser/address.d.ts +1 -1
- package/dist/parser/index.d.ts +2 -2
- package/dist/payloads/index.js +1 -1
- package/dist/{payloads-CQtSsUT6.js → payloads-BfJAtqW9.js} +8 -6
- package/dist/sign-m3ZStnNw.d.ts +292 -0
- package/dist/{types-DJsEJwJ6.d.ts → types-DcXtFARL.d.ts} +1 -1
- package/dist/webhook/index.d.ts +3 -3
- package/dist/webhook/index.js +1 -1
- package/dist/{webhook-CTaEuJz2.js → webhook-BtyuJtUF.js} +1 -1
- package/dist/x402/index.d.ts +1 -290
- package/package.json +14 -9
- /package/dist/{address-parser-CJqzx713.d.ts → address-parser-B7L4E0zP.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./chunk-pbuEa-1d.js";
|
|
2
|
-
import { a as pushFile, i as pushBytes, o as loadNodeFsPromises } from "./payloads-
|
|
2
|
+
import { a as pushFile, i as pushBytes, o as loadNodeFsPromises } from "./payloads-BfJAtqW9.js";
|
|
3
3
|
import { S as formatAddress, c as WebhookVerificationError } from "./errors-Bo0f7eId.js";
|
|
4
4
|
//#region ../packages/api-core/src/api/core/bodySerializer.gen.ts
|
|
5
5
|
const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) };
|
|
@@ -606,7 +606,11 @@ const client$1 = createClient(createConfig({ baseUrl: "https://api.primitive.dev
|
|
|
606
606
|
//#region ../packages/api-core/src/api/sdk.gen.ts
|
|
607
607
|
var sdk_gen_exports = /* @__PURE__ */ __exportAll({
|
|
608
608
|
addDomain: () => addDomain,
|
|
609
|
+
awaitReply: () => awaitReply,
|
|
610
|
+
cancelSentEmail: () => cancelSentEmail,
|
|
611
|
+
checkDomainDns: () => checkDomainDns,
|
|
609
612
|
cliLogout: () => cliLogout,
|
|
613
|
+
completeWebhookEvent: () => completeWebhookEvent,
|
|
610
614
|
createAgentAccount: () => createAgentAccount,
|
|
611
615
|
createAgentClaimLink: () => createAgentClaimLink,
|
|
612
616
|
createChallenge: () => createChallenge,
|
|
@@ -637,7 +641,9 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
|
|
|
637
641
|
discardEmailContent: () => discardEmailContent,
|
|
638
642
|
downloadAttachments: () => downloadAttachments,
|
|
639
643
|
downloadDomainZoneFile: () => downloadDomainZoneFile,
|
|
644
|
+
downloadEmailAttachmentPart: () => downloadEmailAttachmentPart,
|
|
640
645
|
downloadRawEmail: () => downloadRawEmail,
|
|
646
|
+
downloadSentAttachmentPart: () => downloadSentAttachmentPart,
|
|
641
647
|
getAccount: () => getAccount,
|
|
642
648
|
getAgent: () => getAgent,
|
|
643
649
|
getChallenge: () => getChallenge,
|
|
@@ -649,6 +655,7 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
|
|
|
649
655
|
getInboxStatus: () => getInboxStatus,
|
|
650
656
|
getMemory: () => getMemory,
|
|
651
657
|
getOrgRoutingTopology: () => getOrgRoutingTopology,
|
|
658
|
+
getOutboundStatus: () => getOutboundStatus,
|
|
652
659
|
getRegistry: () => getRegistry,
|
|
653
660
|
getSendPermissions: () => getSendPermissions,
|
|
654
661
|
getSentEmail: () => getSentEmail,
|
|
@@ -683,11 +690,13 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
|
|
|
683
690
|
payChallenge: () => payChallenge,
|
|
684
691
|
pollCliLogin: () => pollCliLogin,
|
|
685
692
|
publishAgent: () => publishAgent,
|
|
693
|
+
pullWebhookEvent: () => pullWebhookEvent,
|
|
686
694
|
registerPayoutAddress: () => registerPayoutAddress,
|
|
687
695
|
reorderRoutes: () => reorderRoutes,
|
|
688
696
|
replayDelivery: () => replayDelivery,
|
|
689
697
|
replayEmailWebhooks: () => replayEmailWebhooks,
|
|
690
698
|
replyToEmail: () => replyToEmail,
|
|
699
|
+
rescheduleSentEmail: () => rescheduleSentEmail,
|
|
691
700
|
resendAgentSignupVerification: () => resendAgentSignupVerification,
|
|
692
701
|
resendCliSignupVerification: () => resendCliSignupVerification,
|
|
693
702
|
resolveRegistryHandle: () => resolveRegistryHandle,
|
|
@@ -707,6 +716,7 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
|
|
|
707
716
|
startCliLogin: () => startCliLogin,
|
|
708
717
|
startCliSignup: () => startCliSignup,
|
|
709
718
|
testEndpoint: () => testEndpoint,
|
|
719
|
+
testEndpointRules: () => testEndpointRules,
|
|
710
720
|
testFunction: () => testFunction,
|
|
711
721
|
unpublishAgent: () => unpublishAgent,
|
|
712
722
|
unsetFunctionRoute: () => unsetFunctionRoute,
|
|
@@ -1147,6 +1157,34 @@ const verifyDomain = (options) => (options.client ?? client$1).post({
|
|
|
1147
1157
|
...options
|
|
1148
1158
|
});
|
|
1149
1159
|
/**
|
|
1160
|
+
* Run an on-demand DNS health check
|
|
1161
|
+
*
|
|
1162
|
+
* Re-checks the domain's DNS records and persists the result as
|
|
1163
|
+
* the domain's current DNS health state. This is the on-demand
|
|
1164
|
+
* counterpart of the scheduled background checker: the response
|
|
1165
|
+
* mirrors what the checker records, broken down per scope
|
|
1166
|
+
* (`ownership`, `inbound`, `outbound`) with the exact records
|
|
1167
|
+
* inspected and each record's individual status.
|
|
1168
|
+
*
|
|
1169
|
+
* Unlike /domains/{id}/verify, this call never promotes an
|
|
1170
|
+
* unverified domain; it only re-evaluates and records health for
|
|
1171
|
+
* an existing claim. Managed (Primitive-operated) domains are
|
|
1172
|
+
* rejected with a validation error because their DNS is not
|
|
1173
|
+
* customer-published.
|
|
1174
|
+
*
|
|
1175
|
+
* Rate limited per organization; a `Retry-After` header
|
|
1176
|
+
* accompanies 429 responses.
|
|
1177
|
+
*
|
|
1178
|
+
*/
|
|
1179
|
+
const checkDomainDns = (options) => (options.client ?? client$1).post({
|
|
1180
|
+
security: [{
|
|
1181
|
+
scheme: "bearer",
|
|
1182
|
+
type: "http"
|
|
1183
|
+
}],
|
|
1184
|
+
url: "/domains/{id}/dns/check",
|
|
1185
|
+
...options
|
|
1186
|
+
});
|
|
1187
|
+
/**
|
|
1150
1188
|
* Download domain DNS zone file
|
|
1151
1189
|
*
|
|
1152
1190
|
* Downloads a BIND-format DNS zone file containing the DNS records
|
|
@@ -1323,6 +1361,49 @@ const downloadAttachments = (options) => (options.client ?? client$1).get({
|
|
|
1323
1361
|
...options
|
|
1324
1362
|
});
|
|
1325
1363
|
/**
|
|
1364
|
+
* Download one inbound email attachment
|
|
1365
|
+
*
|
|
1366
|
+
* Pending service release. This contract does not establish live availability.
|
|
1367
|
+
* Downloads the original bytes of one ordinary email attachment, selected by
|
|
1368
|
+
* its metadata `part_index`, not its position in an attachments array. Refresh
|
|
1369
|
+
* the email detail after `attachment_changed` before choosing an index again.
|
|
1370
|
+
* Uses bearer authentication only; signed raw-email download tokens are not accepted.
|
|
1371
|
+
* A paired-agent credential may read only a message addressed to its claimed address.
|
|
1372
|
+
* Function credentials are denied. Other bearer credentials retain their
|
|
1373
|
+
* existing email access boundaries. This endpoint serves email bytes only.
|
|
1374
|
+
*
|
|
1375
|
+
*/
|
|
1376
|
+
const downloadEmailAttachmentPart = (options) => (options.client ?? client$1).get({
|
|
1377
|
+
security: [{
|
|
1378
|
+
scheme: "bearer",
|
|
1379
|
+
type: "http"
|
|
1380
|
+
}],
|
|
1381
|
+
url: "/emails/{id}/attachments/{part_index}",
|
|
1382
|
+
...options
|
|
1383
|
+
});
|
|
1384
|
+
/**
|
|
1385
|
+
* Download one sent email attachment
|
|
1386
|
+
*
|
|
1387
|
+
* Pending service release. This contract does not establish live availability.
|
|
1388
|
+
* Downloads the original bytes of one ordinary email attachment, selected by
|
|
1389
|
+
* its metadata `part_index`, not its position in an attachments array. Refresh
|
|
1390
|
+
* the email detail after `attachment_changed` before choosing an index again.
|
|
1391
|
+
* Uses bearer authentication only; signed raw-email download tokens are not accepted.
|
|
1392
|
+
* A paired-agent credential may read only mail sent from its claimed address.
|
|
1393
|
+
* Receiving a copy does not authorize downloading another sender's sent content.
|
|
1394
|
+
* Function credentials are denied. Other bearer credentials retain their
|
|
1395
|
+
* existing email access boundaries. This endpoint serves email bytes only.
|
|
1396
|
+
*
|
|
1397
|
+
*/
|
|
1398
|
+
const downloadSentAttachmentPart = (options) => (options.client ?? client$1).get({
|
|
1399
|
+
security: [{
|
|
1400
|
+
scheme: "bearer",
|
|
1401
|
+
type: "http"
|
|
1402
|
+
}],
|
|
1403
|
+
url: "/sent-emails/{id}/attachments/{part_index}",
|
|
1404
|
+
...options
|
|
1405
|
+
});
|
|
1406
|
+
/**
|
|
1326
1407
|
* Reply to an inbound email
|
|
1327
1408
|
*
|
|
1328
1409
|
* Sends an outbound reply to the inbound email identified by `id`.
|
|
@@ -1459,6 +1540,8 @@ const listEndpoints = (options) => (options?.client ?? client$1).get({
|
|
|
1459
1540
|
* it via `POST /endpoints/{id}/test` to confirm your verifier
|
|
1460
1541
|
* accepts the signature.
|
|
1461
1542
|
*
|
|
1543
|
+
*
|
|
1544
|
+
* For local receiving, use kind=pull and a stable name, without url, function_id or domain_id. Named creation resumes the same active destination; omitted filters preserve its selection, while conflicting supplied configuration returns 409. New unfiltered destinations receive all subsequently ready eligible event types. Pull destinations do not occupy HTTP routing slots. Signing-secret setup and a test HTTP delivery are not required for pull receiving.
|
|
1462
1545
|
*/
|
|
1463
1546
|
const createEndpoint = (options) => (options.client ?? client$1).post({
|
|
1464
1547
|
security: [{
|
|
@@ -1494,6 +1577,8 @@ const deleteEndpoint = (options) => (options.client ?? client$1).delete({
|
|
|
1494
1577
|
* endpoint is deactivated and a new one is created (or an existing
|
|
1495
1578
|
* deactivated endpoint with the new URL is reactivated).
|
|
1496
1579
|
*
|
|
1580
|
+
*
|
|
1581
|
+
* Pull destinations cannot be assigned a URL, function or recipient-routing domain. Existing endpoint deletion disconnects the destination; creating a new destination does not backfill historical events.
|
|
1497
1582
|
*/
|
|
1498
1583
|
const updateEndpoint = (options) => (options.client ?? client$1).patch({
|
|
1499
1584
|
security: [{
|
|
@@ -1508,6 +1593,40 @@ const updateEndpoint = (options) => (options.client ?? client$1).patch({
|
|
|
1508
1593
|
}
|
|
1509
1594
|
});
|
|
1510
1595
|
/**
|
|
1596
|
+
* Receive a pending webhook event without a public endpoint
|
|
1597
|
+
*
|
|
1598
|
+
* Wait up to 30 seconds for one existing event. The body string preserves the exact webhook serialization; headers and canonical occurrence/type metadata travel alongside it. A fixed lease protects the attempt while a short handler accepts input. Retry may redeliver an occurrence: deduplicate event_id. Empty delivery means no offer now, not proof all input was delivered; inspect backlog and persistent gap_count/last_gap_reason. Queue retention is 24 hours and does not extend source-content retention. Disconnecting preserves pending work. Same named destination shares consumption; different destinations get independent copies.
|
|
1599
|
+
*/
|
|
1600
|
+
const pullWebhookEvent = (options) => (options.client ?? client$1).post({
|
|
1601
|
+
security: [{
|
|
1602
|
+
scheme: "bearer",
|
|
1603
|
+
type: "http"
|
|
1604
|
+
}],
|
|
1605
|
+
url: "/endpoints/{id}/pull",
|
|
1606
|
+
...options,
|
|
1607
|
+
headers: {
|
|
1608
|
+
...options.body !== void 0 && { "Content-Type": "application/json" },
|
|
1609
|
+
...options.headers
|
|
1610
|
+
}
|
|
1611
|
+
});
|
|
1612
|
+
/**
|
|
1613
|
+
* Report the outcome of a local webhook delivery attempt
|
|
1614
|
+
*
|
|
1615
|
+
* Report normalized handling evidence for the queue, attempt and lease. Required JSON fields: queue_id, delivery_id, lease_token, mode, duration_ms. For mode=exec include exit_code; stdout includes write_succeeded; http includes status_code and optional transport_error, error_code, confirmed. Supply this discriminated request with --raw-body in the generated CLI. The server classifies success and retry. Duplicate identical completion is idempotent; a stale lease cannot finish a newer attempt. Exec success means durable input acceptance, not completion of agent reasoning. Only successful HTTP handling with recognized confirmation evidence can confirm content discard. Never send arbitrary handler output or HTTP response bodies.
|
|
1616
|
+
*/
|
|
1617
|
+
const completeWebhookEvent = (options) => (options.client ?? client$1).post({
|
|
1618
|
+
security: [{
|
|
1619
|
+
scheme: "bearer",
|
|
1620
|
+
type: "http"
|
|
1621
|
+
}],
|
|
1622
|
+
url: "/endpoints/{id}/complete",
|
|
1623
|
+
...options,
|
|
1624
|
+
headers: {
|
|
1625
|
+
...options.body !== void 0 && { "Content-Type": "application/json" },
|
|
1626
|
+
...options.headers
|
|
1627
|
+
}
|
|
1628
|
+
});
|
|
1629
|
+
/**
|
|
1511
1630
|
* Send a test webhook
|
|
1512
1631
|
*
|
|
1513
1632
|
* Sends a sample `email.received` event to the endpoint. The request
|
|
@@ -1526,6 +1645,43 @@ const testEndpoint = (options) => (options.client ?? client$1).post({
|
|
|
1526
1645
|
...options
|
|
1527
1646
|
});
|
|
1528
1647
|
/**
|
|
1648
|
+
* Dry-run endpoint rules against a received email
|
|
1649
|
+
*
|
|
1650
|
+
* Evaluates the endpoint's filtering rules against an
|
|
1651
|
+
* already-received email WITHOUT delivering anything. The same
|
|
1652
|
+
* shared matcher the live delivery paths use produces the
|
|
1653
|
+
* verdict, so the response explains exactly why a webhook fired
|
|
1654
|
+
* or was suppressed for that message.
|
|
1655
|
+
*
|
|
1656
|
+
* When delivery would be suppressed, `rule` names the failing
|
|
1657
|
+
* rule and `reason` carries a human-readable explanation; both
|
|
1658
|
+
* are null when the message matches. `evaluated` echoes the
|
|
1659
|
+
* message metadata the matcher compared (size, attachments, and
|
|
1660
|
+
* the authenticated From identity versus the raw envelope
|
|
1661
|
+
* sender), so a surprising verdict can be traced to its inputs.
|
|
1662
|
+
*
|
|
1663
|
+
* Two independent gates are surfaced separately:
|
|
1664
|
+
* `subscribed_to_event` reports the endpoint's event-type
|
|
1665
|
+
* subscription (checked before message matching), and
|
|
1666
|
+
* `rules_valid` reports whether the stored rules blob parsed at
|
|
1667
|
+
* all. Delivery fails OPEN on an invalid blob (the message is
|
|
1668
|
+
* delivered as if unfiltered), so `rules_valid: false` exposes a
|
|
1669
|
+
* misconfiguration that is otherwise silent.
|
|
1670
|
+
*
|
|
1671
|
+
*/
|
|
1672
|
+
const testEndpointRules = (options) => (options.client ?? client$1).post({
|
|
1673
|
+
security: [{
|
|
1674
|
+
scheme: "bearer",
|
|
1675
|
+
type: "http"
|
|
1676
|
+
}],
|
|
1677
|
+
url: "/endpoints/{id}/rules/test",
|
|
1678
|
+
...options,
|
|
1679
|
+
headers: {
|
|
1680
|
+
...options.body !== void 0 && { "Content-Type": "application/json" },
|
|
1681
|
+
...options.headers
|
|
1682
|
+
}
|
|
1683
|
+
});
|
|
1684
|
+
/**
|
|
1529
1685
|
* List filter rules
|
|
1530
1686
|
*
|
|
1531
1687
|
* Returns all whitelist and blocklist filter rules.
|
|
@@ -1974,10 +2130,6 @@ const sendEmail = (options) => (options.client ?? client$1).post({
|
|
|
1974
2130
|
* Requires the Pro plan and the `semantic_search_enabled`
|
|
1975
2131
|
* entitlement; callers without them receive `403`.
|
|
1976
2132
|
*
|
|
1977
|
-
* Host routing: this operation is served only by the search host
|
|
1978
|
-
* (`https://api.primitive.dev/v1`). The typed SDKs route it there
|
|
1979
|
-
* automatically.
|
|
1980
|
-
*
|
|
1981
2133
|
*/
|
|
1982
2134
|
const semanticSearch = (options) => (options.client ?? client$1).post({
|
|
1983
2135
|
security: [{
|
|
@@ -1992,6 +2144,33 @@ const semanticSearch = (options) => (options.client ?? client$1).post({
|
|
|
1992
2144
|
}
|
|
1993
2145
|
});
|
|
1994
2146
|
/**
|
|
2147
|
+
* Get outbound sending readiness
|
|
2148
|
+
*
|
|
2149
|
+
* The "what can I send From?" bootstrap, the outbound mirror of
|
|
2150
|
+
* /inbox/status. Returns per-domain sending readiness for every
|
|
2151
|
+
* domain in the caller's org, plus the flat `sendable_domains`
|
|
2152
|
+
* list of From-domains the org may send from right now. That
|
|
2153
|
+
* list is the same set echoed in a `cannot_send_from_domain`
|
|
2154
|
+
* error's details, so orienting here before a send and
|
|
2155
|
+
* recovering from that error use identical data.
|
|
2156
|
+
*
|
|
2157
|
+
* Each domain's `status` collapses the sending prerequisites
|
|
2158
|
+
* into one actionable state: `sendable`, `pending_ownership`
|
|
2159
|
+
* (ownership TXT not verified), `pending_outbound_dns`
|
|
2160
|
+
* (SPF/DKIM/DMARC not verified), or `inactive` (domain
|
|
2161
|
+
* deactivated). `next_actions` lists concrete remediation steps,
|
|
2162
|
+
* each with a suggested CLI command where one exists.
|
|
2163
|
+
*
|
|
2164
|
+
*/
|
|
2165
|
+
const getOutboundStatus = (options) => (options?.client ?? client$1).get({
|
|
2166
|
+
security: [{
|
|
2167
|
+
scheme: "bearer",
|
|
2168
|
+
type: "http"
|
|
2169
|
+
}],
|
|
2170
|
+
url: "/outbound/status",
|
|
2171
|
+
...options
|
|
2172
|
+
});
|
|
2173
|
+
/**
|
|
1995
2174
|
* List outbound sent emails
|
|
1996
2175
|
*
|
|
1997
2176
|
* Returns a paginated list of OUTBOUND emails the caller's
|
|
@@ -2041,6 +2220,90 @@ const getSentEmail = (options) => (options.client ?? client$1).get({
|
|
|
2041
2220
|
...options
|
|
2042
2221
|
});
|
|
2043
2222
|
/**
|
|
2223
|
+
* Reschedule a scheduled send
|
|
2224
|
+
*
|
|
2225
|
+
* Moves a STILL-SCHEDULED send (status `scheduled`) to a new
|
|
2226
|
+
* execution time. The new `scheduled_at` must be in the future
|
|
2227
|
+
* and at most 30 days out, the same bounds as the create-time
|
|
2228
|
+
* field on /send-mail.
|
|
2229
|
+
*
|
|
2230
|
+
* The update is a compare-and-swap on `status = 'scheduled'`:
|
|
2231
|
+
* once the scheduler has claimed the row for execution, or it
|
|
2232
|
+
* was already canceled or executed, the update loses and the
|
|
2233
|
+
* call returns a 409 `not_scheduled` conflict naming the row's
|
|
2234
|
+
* current status. A due send can therefore never be moved out
|
|
2235
|
+
* from under an in-progress execution.
|
|
2236
|
+
*
|
|
2237
|
+
* Returns the full updated sent-email record on success.
|
|
2238
|
+
*
|
|
2239
|
+
*/
|
|
2240
|
+
const rescheduleSentEmail = (options) => (options.client ?? client$1).patch({
|
|
2241
|
+
security: [{
|
|
2242
|
+
scheme: "bearer",
|
|
2243
|
+
type: "http"
|
|
2244
|
+
}],
|
|
2245
|
+
url: "/sent-emails/{id}",
|
|
2246
|
+
...options,
|
|
2247
|
+
headers: {
|
|
2248
|
+
...options.body !== void 0 && { "Content-Type": "application/json" },
|
|
2249
|
+
...options.headers
|
|
2250
|
+
}
|
|
2251
|
+
});
|
|
2252
|
+
/**
|
|
2253
|
+
* Cancel a scheduled send
|
|
2254
|
+
*
|
|
2255
|
+
* Cancels a STILL-SCHEDULED send (status `scheduled`), moving it
|
|
2256
|
+
* to the terminal `canceled` status. Nothing is dispatched and
|
|
2257
|
+
* the row is kept for historical lookup with `canceled_at` set.
|
|
2258
|
+
*
|
|
2259
|
+
* Uses the same compare-and-swap guard as reschedule: once the
|
|
2260
|
+
* scheduler has claimed the row for execution, or it was already
|
|
2261
|
+
* canceled or executed, the call returns a 409 `not_scheduled`
|
|
2262
|
+
* conflict naming the row's current status. Canceling can
|
|
2263
|
+
* therefore never race an in-progress execution; a send that
|
|
2264
|
+
* reports `canceled` was never handed to the delivery path.
|
|
2265
|
+
*
|
|
2266
|
+
* Returns the full updated sent-email record on success.
|
|
2267
|
+
*
|
|
2268
|
+
*/
|
|
2269
|
+
const cancelSentEmail = (options) => (options.client ?? client$1).post({
|
|
2270
|
+
security: [{
|
|
2271
|
+
scheme: "bearer",
|
|
2272
|
+
type: "http"
|
|
2273
|
+
}],
|
|
2274
|
+
url: "/sent-emails/{id}/cancel",
|
|
2275
|
+
...options
|
|
2276
|
+
});
|
|
2277
|
+
/**
|
|
2278
|
+
* Get (or wait for) the reply to a sent email
|
|
2279
|
+
*
|
|
2280
|
+
* Returns the first threaded inbound reply to a send, keyed by
|
|
2281
|
+
* the inbound email's `reply_to_sent_email_id`. This is the
|
|
2282
|
+
* canonical "did a reply arrive for this send?" call: after
|
|
2283
|
+
* /send-mail, poll (or long-poll) here instead of hand-rolling
|
|
2284
|
+
* an /emails/search loop.
|
|
2285
|
+
*
|
|
2286
|
+
* By default the call returns immediately with `reply: null`
|
|
2287
|
+
* when nothing has arrived yet. Set `wait=true` to long-poll:
|
|
2288
|
+
* the server holds the request up to `wait_timeout_ms`
|
|
2289
|
+
* (default 10000, max 30000), returning as soon as the first
|
|
2290
|
+
* reply lands. On a wait that elapses with no reply, the
|
|
2291
|
+
* response has `reply: null` and `timed_out: true`.
|
|
2292
|
+
*
|
|
2293
|
+
* The reply object is compact (headers plus bodies); fetch
|
|
2294
|
+
* `/emails/{id}` with `reply.id` for the fully parsed record,
|
|
2295
|
+
* or `/threads/{thread_id}` for the whole back-and-forth.
|
|
2296
|
+
*
|
|
2297
|
+
*/
|
|
2298
|
+
const awaitReply = (options) => (options.client ?? client$1).get({
|
|
2299
|
+
security: [{
|
|
2300
|
+
scheme: "bearer",
|
|
2301
|
+
type: "http"
|
|
2302
|
+
}],
|
|
2303
|
+
url: "/sent-emails/{id}/reply",
|
|
2304
|
+
...options
|
|
2305
|
+
});
|
|
2306
|
+
/**
|
|
2044
2307
|
* Get a conversation thread by id
|
|
2045
2308
|
*
|
|
2046
2309
|
* Returns a conversation thread: its metadata plus the inbound
|
|
@@ -3281,6 +3544,11 @@ function validateSendInput(input) {
|
|
|
3281
3544
|
if (!Number.isInteger(input.waitTimeoutMs)) throw new TypeError("waitTimeoutMs must be an integer");
|
|
3282
3545
|
if (input.waitTimeoutMs < 1e3 || input.waitTimeoutMs > 3e4) throw new TypeError("waitTimeoutMs must be between 1000 and 30000");
|
|
3283
3546
|
}
|
|
3547
|
+
if (input.scheduledAt !== void 0) {
|
|
3548
|
+
if (Number.isNaN(Date.parse(input.scheduledAt))) throw new TypeError("scheduledAt must be an ISO 8601 date-time string");
|
|
3549
|
+
if (input.wait === true) throw new TypeError("wait cannot be combined with scheduledAt (a scheduled send resolves after this request completes)");
|
|
3550
|
+
if (input.attachments?.length || input.payloadAttachments?.length) throw new TypeError("attachments are not supported on scheduled sends yet; use an immediate send");
|
|
3551
|
+
}
|
|
3284
3552
|
}
|
|
3285
3553
|
function validateForwardInput(input) {
|
|
3286
3554
|
validateEmailAddress("to", input.to);
|
|
@@ -3685,6 +3953,41 @@ var PrimitiveClient = class extends PrimitiveApiClient {
|
|
|
3685
3953
|
if (base.endsWith("/v1")) base = base.slice(0, -3);
|
|
3686
3954
|
this.#payloadBaseUrl = base;
|
|
3687
3955
|
}
|
|
3956
|
+
/** Pending service release. Use the attachment metadata index, not its array offset. */
|
|
3957
|
+
downloadEmailAttachmentPart(id, partIndex, options) {
|
|
3958
|
+
return this.downloadAttachmentPart("inbound", id, partIndex, options);
|
|
3959
|
+
}
|
|
3960
|
+
/** Pending service release. Sent content requires access to the sending identity. */
|
|
3961
|
+
downloadSentAttachmentPart(id, partIndex, options) {
|
|
3962
|
+
return this.downloadAttachmentPart("outbound", id, partIndex, options);
|
|
3963
|
+
}
|
|
3964
|
+
async downloadAttachmentPart(direction, id, partIndex, options) {
|
|
3965
|
+
if (!/^[a-f\d]{8}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{12}$/i.test(id)) throw new TypeError("id must be an email UUID");
|
|
3966
|
+
if (!Number.isInteger(partIndex) || partIndex < 0 || partIndex > 2147483647) throw new TypeError("partIndex must be an integer from 0 to 2147483647");
|
|
3967
|
+
const result = await (direction === "inbound" ? downloadEmailAttachmentPart : downloadSentAttachmentPart)({
|
|
3968
|
+
...resolveRequestOptions(options),
|
|
3969
|
+
client: this.client,
|
|
3970
|
+
path: {
|
|
3971
|
+
id,
|
|
3972
|
+
part_index: partIndex
|
|
3973
|
+
},
|
|
3974
|
+
parseAs: "arrayBuffer",
|
|
3975
|
+
responseStyle: "fields",
|
|
3976
|
+
throwOnError: false
|
|
3977
|
+
});
|
|
3978
|
+
const data = result.data;
|
|
3979
|
+
const buffer = unwrapData({
|
|
3980
|
+
data: data instanceof ArrayBuffer ? { data } : void 0,
|
|
3981
|
+
error: result.error,
|
|
3982
|
+
response: result.response
|
|
3983
|
+
}, "attachment bytes");
|
|
3984
|
+
return {
|
|
3985
|
+
bytes: new Uint8Array(buffer),
|
|
3986
|
+
sha256: result.response?.headers.get("x-content-sha256") ?? null,
|
|
3987
|
+
contentDisposition: result.response?.headers.get("content-disposition") ?? null,
|
|
3988
|
+
cacheControl: result.response?.headers.get("cache-control") ?? null
|
|
3989
|
+
};
|
|
3990
|
+
}
|
|
3688
3991
|
async send(input, options) {
|
|
3689
3992
|
validateSendInput(input);
|
|
3690
3993
|
return unwrapSendResult(await sendEmail({
|
|
@@ -3704,7 +4007,8 @@ var PrimitiveClient = class extends PrimitiveApiClient {
|
|
|
3704
4007
|
...ref.contentType !== void 0 ? { content_type: ref.contentType } : {}
|
|
3705
4008
|
})) } : {},
|
|
3706
4009
|
...input.wait !== void 0 ? { wait: input.wait } : {},
|
|
3707
|
-
...input.waitTimeoutMs !== void 0 ? { wait_timeout_ms: input.waitTimeoutMs } : {}
|
|
4010
|
+
...input.waitTimeoutMs !== void 0 ? { wait_timeout_ms: input.waitTimeoutMs } : {},
|
|
4011
|
+
...input.scheduledAt !== void 0 ? { scheduled_at: input.scheduledAt } : {}
|
|
3708
4012
|
},
|
|
3709
4013
|
...resolveRequestOptions(options),
|
|
3710
4014
|
client: this.client,
|
|
@@ -3813,7 +4117,8 @@ var PrimitiveClient = class extends PrimitiveApiClient {
|
|
|
3813
4117
|
from: input.from ?? email.receivedBy,
|
|
3814
4118
|
to: input.to,
|
|
3815
4119
|
subject: input.subject ?? email.forwardSubject,
|
|
3816
|
-
bodyText: buildForwardText(email, input.bodyText)
|
|
4120
|
+
bodyText: buildForwardText(email, input.bodyText),
|
|
4121
|
+
...input.scheduledAt !== void 0 ? { scheduledAt: input.scheduledAt } : {}
|
|
3817
4122
|
}, options);
|
|
3818
4123
|
}
|
|
3819
4124
|
};
|
|
@@ -3872,7 +4177,8 @@ function mapSendResult(result) {
|
|
|
3872
4177
|
idempotentReplay: result.idempotent_replay ?? false,
|
|
3873
4178
|
...result.delivery_status !== void 0 ? { deliveryStatus: result.delivery_status } : {},
|
|
3874
4179
|
...result.smtp_response_code !== void 0 ? { smtpResponseCode: result.smtp_response_code } : {},
|
|
3875
|
-
...result.smtp_response_text !== void 0 ? { smtpResponseText: result.smtp_response_text } : {}
|
|
4180
|
+
...result.smtp_response_text !== void 0 ? { smtpResponseText: result.smtp_response_text } : {},
|
|
4181
|
+
...result.scheduled_at !== void 0 ? { scheduledAt: result.scheduled_at } : {}
|
|
3876
4182
|
};
|
|
3877
4183
|
}
|
|
3878
4184
|
function unwrapSemanticSearchResult(result) {
|
|
@@ -3952,4 +4258,4 @@ async function createAgent(options) {
|
|
|
3952
4258
|
};
|
|
3953
4259
|
}
|
|
3954
4260
|
//#endregion
|
|
3955
|
-
export {
|
|
4261
|
+
export { downloadRawEmail as $, rescheduleSentEmail as $t, createOrgSecret as A, updateRoute as An, listFunctionLogs as At, deleteFilter as B, listTemplates as Bt, createAgentClaimLink as C, unsetFunctionRoute as Cn, installTemplate as Ct, createFilter as D, updateFilter as Dn, listEmails as Dt, createEndpoint as E, updateEndpoint as En, listDomains as Et, decideRegistryRequest as F, verifyAgentSignup as Fn, listRegistries as Ft, deleteRegistry as G, pollCliLogin as Gt, deleteFunctionSecret as H, listWakeDispatches as Ht, defineAgent as I, verifyCliSignup as In, listRegistryAgents as It, deleteWakeSchedule as J, registerPayoutAddress as Jt, deleteRoute as K, publishAgent as Kt, deleteDomain as L, verifyDomain as Ln, listRegistryRequests as Lt, createRoute as M, updateWakeAuthorization as Mn, listFunctions as Mt, createWakeAuthorization as N, updateWakeSchedule as Nn, listOrgSecrets as Nt, createFunction as O, updateFunction as On, listEndpoints as Ot, createWakeSchedule as P, verifyAgentClaim as Pn, listPayoutAddresses as Pt, downloadEmailAttachmentPart as Q, replyToEmail as Qt, deleteEmail as R, createClient as Rn, listRoutes as Rt, createAgentAccount as S, unpublishAgent as Sn, getWebhookSecret as St, createEmailChallenge as T, updateDomain as Tn, listDeliveries as Tt, deleteMemory as U, listWakeSchedules as Ut, deleteFunction as V, listWakeAuthorizations as Vt, deleteOrgSecret as W, payChallenge as Wt, downloadAttachments as X, replayDelivery as Xt, discardEmailContent as Y, reorderRoutes as Yt, downloadDomainZoneFile as Z, replayEmailWebhooks as Zt, awaitReply as _, startCliLogin as _n, getStorageStats as _t, PrimitiveClient as a, sdk_gen_exports as an, getEmail as at, cliLogout as b, testEndpointRules as bn, getThread as bt, createPrimitiveClient as c, semanticSearch as cn, getFunctionTestRunTrace as ct, isMemoryJsonValue as d, setFunctionSecret as dn, getOrgRoutingTopology as dt, resendAgentSignupVerification as en, downloadSentAttachmentPart as et, DEFAULT_API_BASE_URL as f, setMemory as fn, getOutboundStatus as ft, addDomain as g, startAgentSignup as gn, getSpendPolicy as gt, createPrimitiveApiClient as h, startAgentClaim as hn, getSentEmail as ht, MemoriesResource as i, runWakeSchedule as in, getConversation as it, createRegistry as j, updateSpendPolicy as jn, listFunctionSecrets as jt, createFunctionSecret as k, updateRegistry as kn, listFilters as kt, PRIMITIVE_SIGNATURE_HEADER as l, sendEmail as ln, getInboxStatus as lt, PrimitiveApiError as m, simulateRoute as mn, getSendPermissions as mt, AgentResource as n, resolveRegistryHandle as nn, getAgent as nt, client as o, searchEmails as on, getFunction as ot, PrimitiveApiClient as p, setOrgSecret as pn, getRegistry as pt, deleteWakeAuthorization as q, pullWebhookEvent as qt, InboxResource as r, rotateWebhookSecret as rn, getChallenge as rt, createAgent as s, searchMemories as sn, getFunctionRouting as st, AccountResource as t, resendCliSignupVerification as tn, getAccount as tt, verifyWebhookSignature as u, setFunctionRoute as un, getMemory as ut, cancelSentEmail as v, startCliSignup as vn, getTemplate as vt, createChallenge as w, updateAccount as wn, listDeclinedPayments as wt, completeWebhookEvent as x, testFunction as xn, getWakeSchedule as xt, checkDomainDns as y, testEndpoint as yn, getTemplateInstall as yt, deleteEndpoint as z, createConfig as zn, listSentEmails as zt };
|
package/dist/contract/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as RawContentInline, E as ParsedError, I as WebhookAttachment, T as ParsedDataFailed, d as EmailAuth, f as EmailReceivedEvent, k as RawContentDownloadOnly, l as EmailAddress, u as EmailAnalysis, w as ParsedDataComplete } from "../types-
|
|
2
|
-
import { A as SignResult, M as signWebhookPayload, S as StandardWebhooksSignResult, _ as WEBHOOK_VERSION, w as signStandardWebhooksPayload } from "../index-
|
|
1
|
+
import { A as RawContentInline, E as ParsedError, I as WebhookAttachment, T as ParsedDataFailed, d as EmailAuth, f as EmailReceivedEvent, k as RawContentDownloadOnly, l as EmailAddress, u as EmailAnalysis, w as ParsedDataComplete } from "../types-DcXtFARL.js";
|
|
2
|
+
import { A as SignResult, M as signWebhookPayload, S as StandardWebhooksSignResult, _ as WEBHOOK_VERSION, w as signStandardWebhooksPayload } from "../index-fS1gVNuX.js";
|
|
3
3
|
|
|
4
4
|
//#region src/contract/contract.d.ts
|
|
5
5
|
/** Maximum raw email size for inline inclusion (256 KB). */
|
package/dist/contract/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as WEBHOOK_VERSION, v as signStandardWebhooksPayload, w as signWebhookPayload, z as validateEmailReceivedEvent } from "../webhook-
|
|
1
|
+
import { p as WEBHOOK_VERSION, v as signStandardWebhooksPayload, w as signWebhookPayload, z as validateEmailReceivedEvent } from "../webhook-BtyuJtUF.js";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
//#region src/contract/contract.ts
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as ValidateEmailAuthResult, I as WebhookAttachment, d as EmailAuth, f as EmailReceivedEvent, u as EmailAnalysis } from "./types-
|
|
1
|
+
import { F as ValidateEmailAuthResult, I as WebhookAttachment, d as EmailAuth, f as EmailReceivedEvent, u as EmailAnalysis } from "./types-DcXtFARL.js";
|
|
2
2
|
import { ErrorObject } from "ajv";
|
|
3
3
|
|
|
4
4
|
//#region src/webhook/received-email.d.ts
|