@primitivedotdev/sdk 0.20.0 → 0.21.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.
@@ -1459,6 +1459,310 @@ export const operationManifest = [
1459
1459
  "tag": "Emails",
1460
1460
  "tagCommand": "emails"
1461
1461
  },
1462
+ {
1463
+ "binaryResponse": false,
1464
+ "bodyRequired": false,
1465
+ "command": "search-emails",
1466
+ "description": "Searches inbound emails with structured filters and optional\nfull-text matching across parsed email fields. This endpoint is\noptimized for filtered inbox views and CLI polling workflows:\ncallers that only need new accepted mail can pass\n`sort=received_at_asc`, `snippet=false`, `include_facets=false`,\nand a `date_from` timestamp.\n\n`q`, `subject`, and `body` use the same English full-text index\nas the web inbox search. Structured filters such as `from`, `to`,\n`domain_id`, status, attachment presence, and spam score bounds\nare combined with the text query.\n",
1467
+ "hasJsonBody": false,
1468
+ "method": "GET",
1469
+ "operationId": "searchEmails",
1470
+ "path": "/emails/search",
1471
+ "pathParams": [],
1472
+ "queryParams": [
1473
+ {
1474
+ "description": "Full-text search DSL query.",
1475
+ "enum": null,
1476
+ "name": "q",
1477
+ "required": false,
1478
+ "type": "string"
1479
+ },
1480
+ {
1481
+ "description": "Filter by sender address or sender domain.",
1482
+ "enum": null,
1483
+ "name": "from",
1484
+ "required": false,
1485
+ "type": "string"
1486
+ },
1487
+ {
1488
+ "description": "Filter by recipient address or recipient domain.",
1489
+ "enum": null,
1490
+ "name": "to",
1491
+ "required": false,
1492
+ "type": "string"
1493
+ },
1494
+ {
1495
+ "description": "Full-text search restricted to the subject field.",
1496
+ "enum": null,
1497
+ "name": "subject",
1498
+ "required": false,
1499
+ "type": "string"
1500
+ },
1501
+ {
1502
+ "description": "Full-text search restricted to the parsed text body.",
1503
+ "enum": null,
1504
+ "name": "body",
1505
+ "required": false,
1506
+ "type": "string"
1507
+ },
1508
+ {
1509
+ "description": "Filter by domain ID.",
1510
+ "enum": null,
1511
+ "name": "domain_id",
1512
+ "required": false,
1513
+ "type": "string"
1514
+ },
1515
+ {
1516
+ "description": "Filter by inbound email lifecycle status.",
1517
+ "enum": null,
1518
+ "name": "status",
1519
+ "required": false,
1520
+ "type": "string"
1521
+ },
1522
+ {
1523
+ "description": "Filter emails received on or after this timestamp.",
1524
+ "enum": null,
1525
+ "name": "date_from",
1526
+ "required": false,
1527
+ "type": "string"
1528
+ },
1529
+ {
1530
+ "description": "Filter emails received on or before this timestamp.",
1531
+ "enum": null,
1532
+ "name": "date_to",
1533
+ "required": false,
1534
+ "type": "string"
1535
+ },
1536
+ {
1537
+ "description": "Filter by whether the email has one or more attachments.",
1538
+ "enum": [
1539
+ "true",
1540
+ "false"
1541
+ ],
1542
+ "name": "has_attachment",
1543
+ "required": false,
1544
+ "type": "string"
1545
+ },
1546
+ {
1547
+ "description": "Filter to emails with spam score below this value.",
1548
+ "enum": null,
1549
+ "name": "spam_score_lt",
1550
+ "required": false,
1551
+ "type": "number"
1552
+ },
1553
+ {
1554
+ "description": "Filter to emails with spam score greater than or equal to this value.",
1555
+ "enum": null,
1556
+ "name": "spam_score_gte",
1557
+ "required": false,
1558
+ "type": "number"
1559
+ },
1560
+ {
1561
+ "description": "Sort mode. Defaults to relevance when a text query is present,\notherwise `received_at_desc`.\n",
1562
+ "enum": [
1563
+ "relevance",
1564
+ "received_at_desc",
1565
+ "received_at_asc"
1566
+ ],
1567
+ "name": "sort",
1568
+ "required": false,
1569
+ "type": "string"
1570
+ },
1571
+ {
1572
+ "description": "Opaque pagination cursor from a previous search response.",
1573
+ "enum": null,
1574
+ "name": "cursor",
1575
+ "required": false,
1576
+ "type": "string"
1577
+ },
1578
+ {
1579
+ "description": "Number of results per page",
1580
+ "enum": null,
1581
+ "name": "limit",
1582
+ "required": false,
1583
+ "type": "integer"
1584
+ },
1585
+ {
1586
+ "description": "Include subject/body highlight snippets when text search is active.",
1587
+ "enum": [
1588
+ "true",
1589
+ "false"
1590
+ ],
1591
+ "name": "snippet",
1592
+ "required": false,
1593
+ "type": "string"
1594
+ },
1595
+ {
1596
+ "description": "Include facet counts for sender, domain, status, and attachment presence.",
1597
+ "enum": [
1598
+ "true",
1599
+ "false"
1600
+ ],
1601
+ "name": "include_facets",
1602
+ "required": false,
1603
+ "type": "string"
1604
+ }
1605
+ ],
1606
+ "requestSchema": null,
1607
+ "responseSchema": {
1608
+ "type": "array",
1609
+ "items": {
1610
+ "allOf": [
1611
+ {
1612
+ "type": "object",
1613
+ "properties": {
1614
+ "id": {
1615
+ "type": "string",
1616
+ "format": "uuid"
1617
+ },
1618
+ "message_id": {
1619
+ "type": [
1620
+ "string",
1621
+ "null"
1622
+ ]
1623
+ },
1624
+ "domain_id": {
1625
+ "type": [
1626
+ "string",
1627
+ "null"
1628
+ ],
1629
+ "format": "uuid"
1630
+ },
1631
+ "org_id": {
1632
+ "type": [
1633
+ "string",
1634
+ "null"
1635
+ ],
1636
+ "format": "uuid"
1637
+ },
1638
+ "status": {
1639
+ "type": "string",
1640
+ "description": "Lifecycle status of an INBOUND email (a row in the `emails`\ntable). Distinct from `SentEmailStatus`, which describes\nthe OUTBOUND lifecycle (the `sent_emails` table) and uses\na different vocabulary because the lifecycles differ.\nPossible values:\n\n - `pending`: the row was inserted at ingestion (mx_main)\n and has not yet completed the spam / filter / auth\n pipeline. Body and parsed fields are present; webhook\n delivery is not yet scheduled. Most rows transition out\n of `pending` within seconds.\n - `accepted`: the inbound passed the policy gates and is\n queued for webhook delivery. The `webhook_status` field\n tracks the separate webhook-delivery lifecycle from\n this point.\n - `completed`: terminal success. Webhook delivery\n attempted and acknowledged by every active endpoint, OR\n no endpoints are configured, so the row is durably\n archived.\n - `rejected`: terminal failure at ingestion (spam, blocked\n sender, filter rule, malformed). The body and metadata\n are stored for auditing but no webhook fires and the\n row is not repliable.\n\nSee also `webhook_status` (separate enum tracking the\nwebhook-delivery state machine) and `SentEmailStatus` (the\noutbound vocabulary).\n",
1641
+ "enum": [
1642
+ "pending",
1643
+ "accepted",
1644
+ "completed",
1645
+ "rejected"
1646
+ ]
1647
+ },
1648
+ "sender": {
1649
+ "type": "string",
1650
+ "description": "SMTP envelope sender (return-path) the inbound mail server\naccepted. For most legitimate mail this equals the bare\naddress in the From header; for mailing lists, bounce\nhandlers, and forwarders it is typically the bounce address\nrather than the human-visible sender.\n\nFor the parsed From-header value (with display name handling\nand a sender-fallback when the header is unparseable), GET\nthe email by id and use `from_email`.\n"
1651
+ },
1652
+ "recipient": {
1653
+ "type": "string"
1654
+ },
1655
+ "subject": {
1656
+ "type": [
1657
+ "string",
1658
+ "null"
1659
+ ]
1660
+ },
1661
+ "domain": {
1662
+ "type": "string"
1663
+ },
1664
+ "spam_score": {
1665
+ "type": [
1666
+ "number",
1667
+ "null"
1668
+ ]
1669
+ },
1670
+ "created_at": {
1671
+ "type": "string",
1672
+ "format": "date-time"
1673
+ },
1674
+ "received_at": {
1675
+ "type": "string",
1676
+ "format": "date-time"
1677
+ },
1678
+ "raw_size_bytes": {
1679
+ "type": [
1680
+ "integer",
1681
+ "null"
1682
+ ]
1683
+ },
1684
+ "webhook_status": {
1685
+ "type": [
1686
+ "string",
1687
+ "null"
1688
+ ],
1689
+ "description": "Webhook-delivery state for an inbound email. Tracks a\nSEPARATE lifecycle from the email's `status` field; the\nsame row carries both. Possible values:\n\n - `pending`: ingestion is past `pending` (the email itself\n is `accepted`) but the webhook fan-out has not yet\n started for this row.\n - `in_flight`: at least one delivery attempt is in flight.\n - `fired`: terminal success. Every active endpoint\n acknowledged the delivery (or accepted it after retries).\n - `failed`: terminal partial-failure. At least one endpoint\n exhausted its retry budget; some endpoints may still\n have succeeded.\n - `exhausted`: terminal failure. Every endpoint exhausted\n its retry budget without success.\n - `null`: no endpoints configured, so no webhook lifecycle\n applies.\n\nNote that the value `pending` here does NOT mean the email\nis `pending`; it means the email is past ingestion but\nwebhook delivery has not yet begun. Two overlapping uses\nof the word `pending` for distinct lifecycle phases.\n",
1690
+ "enum": [
1691
+ "pending",
1692
+ "in_flight",
1693
+ "fired",
1694
+ "failed",
1695
+ "exhausted",
1696
+ null
1697
+ ]
1698
+ },
1699
+ "webhook_attempt_count": {
1700
+ "type": "integer"
1701
+ }
1702
+ },
1703
+ "required": [
1704
+ "id",
1705
+ "status",
1706
+ "sender",
1707
+ "recipient",
1708
+ "domain",
1709
+ "created_at",
1710
+ "received_at",
1711
+ "webhook_attempt_count"
1712
+ ]
1713
+ },
1714
+ {
1715
+ "type": "object",
1716
+ "properties": {
1717
+ "attachment_count": {
1718
+ "type": "integer",
1719
+ "description": "Number of parsed attachments on the email."
1720
+ },
1721
+ "from_known_address": {
1722
+ "type": "boolean",
1723
+ "description": "Whether the parsed From address is known to this org from prior authenticated inbound mail."
1724
+ },
1725
+ "score": {
1726
+ "type": "number",
1727
+ "description": "Relevance score. Present only when sorting by relevance."
1728
+ },
1729
+ "highlights": {
1730
+ "type": "object",
1731
+ "properties": {
1732
+ "subject": {
1733
+ "type": "array",
1734
+ "items": {
1735
+ "type": "string"
1736
+ },
1737
+ "description": "Subject snippets with matching terms highlighted."
1738
+ },
1739
+ "body": {
1740
+ "type": "array",
1741
+ "items": {
1742
+ "type": "string"
1743
+ },
1744
+ "description": "Body snippets with matching terms highlighted."
1745
+ }
1746
+ },
1747
+ "required": [
1748
+ "subject",
1749
+ "body"
1750
+ ]
1751
+ }
1752
+ },
1753
+ "required": [
1754
+ "attachment_count",
1755
+ "from_known_address"
1756
+ ]
1757
+ }
1758
+ ]
1759
+ }
1760
+ },
1761
+ "sdkName": "searchEmails",
1762
+ "summary": "Search inbound emails",
1763
+ "tag": "Emails",
1764
+ "tagCommand": "emails"
1765
+ },
1462
1766
  {
1463
1767
  "binaryResponse": false,
1464
1768
  "bodyRequired": true,
@@ -3821,7 +4125,7 @@ export const operationManifest = [
3821
4125
  "binaryResponse": false,
3822
4126
  "bodyRequired": true,
3823
4127
  "command": "send-email",
3824
- "description": "Sends an outbound email through Primitive's outbound relay. By default\nthe request returns once the relay accepts the message for delivery.\nSet `wait: true` to wait for the first downstream SMTP delivery outcome.\n",
4128
+ "description": "Sends an outbound email through Primitive's outbound relay. By default\nthe request returns once the relay accepts the message for delivery.\nSet `wait: true` to wait for the first downstream SMTP delivery outcome.\n\n**Host routing.** /send-mail is served by the attachments-\nsupporting host (`https://api.primitive.dev/v1`) so the\nrequest body can carry inline attachments up to ~30 MiB raw.\nThe primary host (`https://www.primitive.dev/api/v1`) also\naccepts /send-mail for attachment-free sends; sends WITH\nattachments to the primary host return 413\n`attachments_unsupported_on_this_endpoint`. The typed SDKs\nroute /send-mail to the attachments host automatically.\n",
3825
4129
  "hasJsonBody": true,
3826
4130
  "method": "POST",
3827
4131
  "operationId": "sendEmail",