@primitivedotdev/sdk 0.13.0 → 0.15.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/dist/api/generated/index.js +1 -1
- package/dist/api/generated/sdk.gen.js +67 -1
- package/dist/api/index.d.ts +2 -2
- package/dist/{api-DvJpdOJ8.js → api-DpATn7LQ.js} +76 -2
- package/dist/{index-ChLFXxTa.d.ts → index-DEY4h3MZ.d.ts} +464 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/oclif/commands/emails-latest.js +131 -0
- package/dist/oclif/commands/send.js +10 -1
- package/dist/oclif/index.js +78 -3
- package/dist/openapi/index.d.ts +6 -0
- package/dist/openapi/openapi.generated.js +395 -47
- package/dist/openapi/operations.generated.js +2395 -98
- package/oclif.manifest.json +212 -13
- package/package.json +3 -3
|
@@ -559,7 +559,7 @@ type EmailSummary = {
|
|
|
559
559
|
message_id?: string | null;
|
|
560
560
|
domain_id?: string | null;
|
|
561
561
|
org_id?: string | null;
|
|
562
|
-
status:
|
|
562
|
+
status: EmailStatus;
|
|
563
563
|
/**
|
|
564
564
|
* SMTP envelope sender (return-path) the inbound mail server
|
|
565
565
|
* accepted. For most legitimate mail this equals the bare
|
|
@@ -580,7 +580,7 @@ type EmailSummary = {
|
|
|
580
580
|
created_at: string;
|
|
581
581
|
received_at: string;
|
|
582
582
|
raw_size_bytes?: number | null;
|
|
583
|
-
webhook_status?:
|
|
583
|
+
webhook_status?: EmailWebhookStatus;
|
|
584
584
|
webhook_attempt_count: number;
|
|
585
585
|
};
|
|
586
586
|
type EmailDetail = {
|
|
@@ -613,7 +613,7 @@ type EmailDetail = {
|
|
|
613
613
|
* HTML body parsed from the inbound MIME, matching the `email.parsed.body_html` field on the webhook payload. Null when the message had no HTML part or parsing failed.
|
|
614
614
|
*/
|
|
615
615
|
body_html?: string | null;
|
|
616
|
-
status:
|
|
616
|
+
status: EmailStatus;
|
|
617
617
|
domain: string;
|
|
618
618
|
spam_score?: number | null;
|
|
619
619
|
raw_size_bytes?: number | null;
|
|
@@ -621,7 +621,7 @@ type EmailDetail = {
|
|
|
621
621
|
created_at: string;
|
|
622
622
|
received_at: string;
|
|
623
623
|
rejection_reason?: string | null;
|
|
624
|
-
webhook_status?:
|
|
624
|
+
webhook_status?: EmailWebhookStatus;
|
|
625
625
|
webhook_attempt_count: number;
|
|
626
626
|
webhook_last_attempt_at?: string | null;
|
|
627
627
|
webhook_last_status_code?: number | null;
|
|
@@ -746,8 +746,277 @@ type SendMailInput = {
|
|
|
746
746
|
*/
|
|
747
747
|
wait_timeout_ms?: number;
|
|
748
748
|
};
|
|
749
|
-
|
|
749
|
+
/**
|
|
750
|
+
* Lifecycle status of an INBOUND email (a row in the `emails`
|
|
751
|
+
* table). Distinct from `SentEmailStatus`, which describes
|
|
752
|
+
* the OUTBOUND lifecycle (the `sent_emails` table) and uses
|
|
753
|
+
* a different vocabulary because the lifecycles differ.
|
|
754
|
+
* Possible values:
|
|
755
|
+
*
|
|
756
|
+
* - `pending`: the row was inserted at ingestion (mx_main)
|
|
757
|
+
* and has not yet completed the spam / filter / auth
|
|
758
|
+
* pipeline. Body and parsed fields are present; webhook
|
|
759
|
+
* delivery is not yet scheduled. Most rows transition out
|
|
760
|
+
* of `pending` within seconds.
|
|
761
|
+
* - `accepted`: the inbound passed the policy gates and is
|
|
762
|
+
* queued for webhook delivery. The `webhook_status` field
|
|
763
|
+
* tracks the separate webhook-delivery lifecycle from
|
|
764
|
+
* this point.
|
|
765
|
+
* - `completed`: terminal success. Webhook delivery
|
|
766
|
+
* attempted and acknowledged by every active endpoint, OR
|
|
767
|
+
* no endpoints are configured, so the row is durably
|
|
768
|
+
* archived.
|
|
769
|
+
* - `rejected`: terminal failure at ingestion (spam, blocked
|
|
770
|
+
* sender, filter rule, malformed). The body and metadata
|
|
771
|
+
* are stored for auditing but no webhook fires and the
|
|
772
|
+
* row is not repliable.
|
|
773
|
+
*
|
|
774
|
+
* See also `webhook_status` (separate enum tracking the
|
|
775
|
+
* webhook-delivery state machine) and `SentEmailStatus` (the
|
|
776
|
+
* outbound vocabulary).
|
|
777
|
+
*
|
|
778
|
+
*/
|
|
779
|
+
type EmailStatus = 'pending' | 'accepted' | 'completed' | 'rejected';
|
|
780
|
+
/**
|
|
781
|
+
* Webhook-delivery state for an inbound email. Tracks a
|
|
782
|
+
* SEPARATE lifecycle from the email's `status` field; the
|
|
783
|
+
* same row carries both. Possible values:
|
|
784
|
+
*
|
|
785
|
+
* - `pending`: ingestion is past `pending` (the email itself
|
|
786
|
+
* is `accepted`) but the webhook fan-out has not yet
|
|
787
|
+
* started for this row.
|
|
788
|
+
* - `in_flight`: at least one delivery attempt is in flight.
|
|
789
|
+
* - `fired`: terminal success. Every active endpoint
|
|
790
|
+
* acknowledged the delivery (or accepted it after retries).
|
|
791
|
+
* - `failed`: terminal partial-failure. At least one endpoint
|
|
792
|
+
* exhausted its retry budget; some endpoints may still
|
|
793
|
+
* have succeeded.
|
|
794
|
+
* - `exhausted`: terminal failure. Every endpoint exhausted
|
|
795
|
+
* its retry budget without success.
|
|
796
|
+
* - `null`: no endpoints configured, so no webhook lifecycle
|
|
797
|
+
* applies.
|
|
798
|
+
*
|
|
799
|
+
* Note that the value `pending` here does NOT mean the email
|
|
800
|
+
* is `pending`; it means the email is past ingestion but
|
|
801
|
+
* webhook delivery has not yet begun. Two overlapping uses
|
|
802
|
+
* of the word `pending` for distinct lifecycle phases.
|
|
803
|
+
*
|
|
804
|
+
*/
|
|
805
|
+
type EmailWebhookStatus = 'pending' | 'in_flight' | 'fired' | 'failed' | 'exhausted' | null;
|
|
806
|
+
/**
|
|
807
|
+
* Lifecycle status of a sent_emails row. Possible values:
|
|
808
|
+
*
|
|
809
|
+
* - `queued`: pre-call INSERT; the outbound agent has not
|
|
810
|
+
* yet replied.
|
|
811
|
+
* - `submitted_to_agent`: agent accepted; `queue_id` is set.
|
|
812
|
+
* - `agent_failed`: agent rejected; `error_code` and
|
|
813
|
+
* `error_message` carry the reason.
|
|
814
|
+
* - `gate_denied`: a recipient-scope gate denied the send;
|
|
815
|
+
* the agent was never called. The `gates` array carries
|
|
816
|
+
* the denial detail. /send-mail returns 403 in this case
|
|
817
|
+
* so callers see the denial synchronously; /sent-emails
|
|
818
|
+
* additionally records the row for historical lookup,
|
|
819
|
+
* which is when this status appears in a listing.
|
|
820
|
+
* - `unknown`: terminal indeterminate; the on-box log
|
|
821
|
+
* poller couldn't classify the receiver's response.
|
|
822
|
+
* - `delivered` / `bounced` / `deferred` / `wait_timeout`:
|
|
823
|
+
* terminal delivery outcomes (see DeliveryStatus).
|
|
824
|
+
*
|
|
825
|
+
*/
|
|
826
|
+
type SentEmailStatus = 'queued' | 'submitted_to_agent' | 'agent_failed' | 'gate_denied' | 'unknown' | 'delivered' | 'bounced' | 'deferred' | 'wait_timeout';
|
|
750
827
|
type DeliveryStatus = 'delivered' | 'bounced' | 'deferred' | 'wait_timeout';
|
|
828
|
+
/**
|
|
829
|
+
* List-row projection of a sent-email record. Drops
|
|
830
|
+
* `body_text` and `body_html` to keep paginated responses
|
|
831
|
+
* small; fetch /sent-emails/{id} for the full record with
|
|
832
|
+
* bodies.
|
|
833
|
+
*
|
|
834
|
+
*/
|
|
835
|
+
type SentEmailSummary = {
|
|
836
|
+
id: string;
|
|
837
|
+
status: SentEmailStatus;
|
|
838
|
+
/**
|
|
839
|
+
* Timestamp of the most recent status transition.
|
|
840
|
+
* Polling clients should treat `status='queued'` AND
|
|
841
|
+
* `status_changed_at` older than 5 minutes as
|
|
842
|
+
* "stuck-queued" (the post-tx UPDATE failed and the
|
|
843
|
+
* actual delivery state is recoverable from on-box logs
|
|
844
|
+
* via `queue_id` when populated, or `request_id`).
|
|
845
|
+
*
|
|
846
|
+
*/
|
|
847
|
+
status_changed_at: string;
|
|
848
|
+
created_at: string;
|
|
849
|
+
updated_at: string;
|
|
850
|
+
/**
|
|
851
|
+
* Effective idempotency key used for this send. If the
|
|
852
|
+
* caller passed the `Idempotency-Key` header, this is
|
|
853
|
+
* that value; otherwise it's a server-derived hash of
|
|
854
|
+
* the canonical request payload.
|
|
855
|
+
*
|
|
856
|
+
*/
|
|
857
|
+
client_idempotency_key?: string | null;
|
|
858
|
+
/**
|
|
859
|
+
* Stable hash of the canonical send payload.
|
|
860
|
+
*/
|
|
861
|
+
content_hash: string;
|
|
862
|
+
/**
|
|
863
|
+
* Raw `From:` header as sent on the wire, including any
|
|
864
|
+
* display name (e.g. `"Acme Support" <agent@acme.test>`).
|
|
865
|
+
*
|
|
866
|
+
*/
|
|
867
|
+
from_header: string;
|
|
868
|
+
/**
|
|
869
|
+
* Bare email address parsed from `from_header`.
|
|
870
|
+
*/
|
|
871
|
+
from_address: string;
|
|
872
|
+
/**
|
|
873
|
+
* Raw `To:` header as sent on the wire, including any
|
|
874
|
+
* display name.
|
|
875
|
+
*
|
|
876
|
+
*/
|
|
877
|
+
to_header: string;
|
|
878
|
+
/**
|
|
879
|
+
* Bare email address parsed from `to_header`.
|
|
880
|
+
*/
|
|
881
|
+
to_address: string;
|
|
882
|
+
subject: string;
|
|
883
|
+
/**
|
|
884
|
+
* Total UTF-8 byte length of `body_text` + `body_html`.
|
|
885
|
+
* Surfaced on the list endpoint so callers can see "this
|
|
886
|
+
* row has a 4MB body" without fetching it.
|
|
887
|
+
*
|
|
888
|
+
*/
|
|
889
|
+
body_size_bytes: number;
|
|
890
|
+
/**
|
|
891
|
+
* Timestamp at which the bodies were discarded by an
|
|
892
|
+
* entitlement-driven retention policy. Null when bodies
|
|
893
|
+
* are still present. The detail endpoint returns
|
|
894
|
+
* null-valued `body_text`/`body_html` for discarded rows.
|
|
895
|
+
*
|
|
896
|
+
*/
|
|
897
|
+
content_discarded_at?: string | null;
|
|
898
|
+
/**
|
|
899
|
+
* Wire-level Message-ID assigned to the outbound message
|
|
900
|
+
* (RFC 5322). Null on rows that never reached signing
|
|
901
|
+
* (queued, gate_denied, agent_failed before signing).
|
|
902
|
+
*
|
|
903
|
+
*/
|
|
904
|
+
message_id?: string | null;
|
|
905
|
+
/**
|
|
906
|
+
* Wire-level In-Reply-To header value, when this send
|
|
907
|
+
* was a reply.
|
|
908
|
+
*
|
|
909
|
+
*/
|
|
910
|
+
in_reply_to?: string | null;
|
|
911
|
+
/**
|
|
912
|
+
* Wire-level References header value, when this send
|
|
913
|
+
* was a reply.
|
|
914
|
+
*
|
|
915
|
+
*/
|
|
916
|
+
email_references?: string | null;
|
|
917
|
+
/**
|
|
918
|
+
* Reference to the inbound `emails.id` that this send
|
|
919
|
+
* replied to, when known. Populated when the caller used
|
|
920
|
+
* /emails/{id}/reply or when /send-mail's `in_reply_to`
|
|
921
|
+
* matched a stored inbound message_id in the same org.
|
|
922
|
+
*
|
|
923
|
+
*/
|
|
924
|
+
in_reply_to_email_id?: string | null;
|
|
925
|
+
/**
|
|
926
|
+
* Message identifier assigned by Primitive's outbound
|
|
927
|
+
* relay once the agent accepts the message. Null on
|
|
928
|
+
* queued, gate_denied, and agent_failed rows.
|
|
929
|
+
*
|
|
930
|
+
*/
|
|
931
|
+
queue_id?: string | null;
|
|
932
|
+
/**
|
|
933
|
+
* Receiver's 3-digit SMTP code (e.g. 250, 550, 451).
|
|
934
|
+
* Populated on terminal delivery statuses; may be null
|
|
935
|
+
* on a deferred where the agent never got an SMTP-level
|
|
936
|
+
* response (TCP refused, DNS failed, TLS handshake
|
|
937
|
+
* failed). `smtp_response_text` still carries Postfix's
|
|
938
|
+
* descriptive text in those cases.
|
|
939
|
+
*
|
|
940
|
+
*/
|
|
941
|
+
smtp_response_code?: number | null;
|
|
942
|
+
/**
|
|
943
|
+
* Free-form text portion of the receiver's SMTP
|
|
944
|
+
* response. The most useful debugging signal on a
|
|
945
|
+
* `bounced` or `deferred` row.
|
|
946
|
+
*
|
|
947
|
+
*/
|
|
948
|
+
smtp_response_text?: string | null;
|
|
949
|
+
/**
|
|
950
|
+
* RFC 3463 enhanced status code (e.g. `5.1.1` for "Bad
|
|
951
|
+
* destination mailbox address"). Distinct from
|
|
952
|
+
* `smtp_response_code`: the basic 3-digit code is coarse
|
|
953
|
+
* (550 = "permanent failure"), the enhanced code is
|
|
954
|
+
* finer-grained.
|
|
955
|
+
*
|
|
956
|
+
*/
|
|
957
|
+
smtp_enhanced_status_code?: string | null;
|
|
958
|
+
/**
|
|
959
|
+
* DKIM selector used to sign the outbound message.
|
|
960
|
+
* Public DNS data; useful for diagnosing why a downstream
|
|
961
|
+
* verifier rejected the signature.
|
|
962
|
+
*
|
|
963
|
+
*/
|
|
964
|
+
dkim_selector?: string | null;
|
|
965
|
+
/**
|
|
966
|
+
* DKIM signing domain.
|
|
967
|
+
*/
|
|
968
|
+
dkim_domain?: string | null;
|
|
969
|
+
/**
|
|
970
|
+
* Stable public error code on `agent_failed` rows. The
|
|
971
|
+
* agent's internal codes are remapped to a stable public
|
|
972
|
+
* taxonomy (see `publicAgentError` in the server) so this
|
|
973
|
+
* field is safe to branch on across agent versions.
|
|
974
|
+
*
|
|
975
|
+
*/
|
|
976
|
+
error_code?: string | null;
|
|
977
|
+
/**
|
|
978
|
+
* Free-form error message accompanying `error_code`.
|
|
979
|
+
*/
|
|
980
|
+
error_message?: string | null;
|
|
981
|
+
/**
|
|
982
|
+
* Gate-denial detail on `gate_denied` rows. Mirrors the
|
|
983
|
+
* synchronous /send-mail 403 contract so a caller's
|
|
984
|
+
* GateDenial handler is the same across live denies and
|
|
985
|
+
* historical lookups. Null on every other status.
|
|
986
|
+
*
|
|
987
|
+
*/
|
|
988
|
+
gates?: Array<GateDenial> | null;
|
|
989
|
+
/**
|
|
990
|
+
* Server-issued request identifier from the original
|
|
991
|
+
* /send-mail call. Surfaced as the `X-Request-Id`
|
|
992
|
+
* response header on the live send and recorded here
|
|
993
|
+
* for support escalation.
|
|
994
|
+
*
|
|
995
|
+
*/
|
|
996
|
+
request_id?: string | null;
|
|
997
|
+
};
|
|
998
|
+
/**
|
|
999
|
+
* Full sent-email record, including `body_text` and
|
|
1000
|
+
* `body_html`. Returned by /sent-emails/{id}.
|
|
1001
|
+
*
|
|
1002
|
+
*/
|
|
1003
|
+
type SentEmailDetail = SentEmailSummary & {
|
|
1004
|
+
/**
|
|
1005
|
+
* Plain-text body sent on the wire. Null when the
|
|
1006
|
+
* send carried only an HTML body, or when bodies have
|
|
1007
|
+
* been discarded post-send (`content_discarded_at`
|
|
1008
|
+
* set).
|
|
1009
|
+
*
|
|
1010
|
+
*/
|
|
1011
|
+
body_text?: string | null;
|
|
1012
|
+
/**
|
|
1013
|
+
* HTML body sent on the wire. Null when the send
|
|
1014
|
+
* carried only a plain-text body, or when bodies
|
|
1015
|
+
* have been discarded post-send.
|
|
1016
|
+
*
|
|
1017
|
+
*/
|
|
1018
|
+
body_html?: string | null;
|
|
1019
|
+
};
|
|
751
1020
|
/**
|
|
752
1021
|
* Body shape for `/emails/{id}/reply`. Intentionally narrow:
|
|
753
1022
|
* recipients (`to`), subject, and threading headers
|
|
@@ -792,6 +1061,21 @@ type SendMailResult = {
|
|
|
792
1061
|
*/
|
|
793
1062
|
id: string;
|
|
794
1063
|
status: SentEmailStatus;
|
|
1064
|
+
/**
|
|
1065
|
+
* Bare from-address actually written on the wire. Echoed
|
|
1066
|
+
* on every success branch so callers can confirm what
|
|
1067
|
+
* went out, particularly useful for the /emails/{id}/reply
|
|
1068
|
+
* path where `from` is server-derived from the inbound's
|
|
1069
|
+
* recipient when the caller doesn't override.
|
|
1070
|
+
*
|
|
1071
|
+
* For sends where the caller passed a from-header that
|
|
1072
|
+
* included a display name (e.g. `"Acme Support" <support@acme.test>`),
|
|
1073
|
+
* this field is the parsed bare address (`support@acme.test`).
|
|
1074
|
+
* The display name was sent on the wire intact; this field
|
|
1075
|
+
* just makes the address easy to compare against allowlists.
|
|
1076
|
+
*
|
|
1077
|
+
*/
|
|
1078
|
+
from: string;
|
|
795
1079
|
/**
|
|
796
1080
|
* Message identifier assigned by Primitive's outbound relay, when available.
|
|
797
1081
|
*/
|
|
@@ -1449,9 +1733,14 @@ type ListEmailsData = {
|
|
|
1449
1733
|
*/
|
|
1450
1734
|
domain_id?: string;
|
|
1451
1735
|
/**
|
|
1452
|
-
* Filter by
|
|
1736
|
+
* Filter inbound rows by lifecycle status. See `EmailStatus`
|
|
1737
|
+
* for what each value means. Note that the webhook delivery
|
|
1738
|
+
* state is a SEPARATE lifecycle on the same row; filter by
|
|
1739
|
+
* `webhook_status` semantics is not currently supported on
|
|
1740
|
+
* this endpoint.
|
|
1741
|
+
*
|
|
1453
1742
|
*/
|
|
1454
|
-
status?:
|
|
1743
|
+
status?: EmailStatus;
|
|
1455
1744
|
/**
|
|
1456
1745
|
* Search subject, sender, and recipient (case-insensitive)
|
|
1457
1746
|
*/
|
|
@@ -2189,8 +2478,115 @@ type SendEmailResponses = {
|
|
|
2189
2478
|
};
|
|
2190
2479
|
};
|
|
2191
2480
|
type SendEmailResponse = SendEmailResponses[keyof SendEmailResponses];
|
|
2481
|
+
type ListSentEmailsData = {
|
|
2482
|
+
body?: never;
|
|
2483
|
+
path?: never;
|
|
2484
|
+
query?: {
|
|
2485
|
+
/**
|
|
2486
|
+
* Pagination cursor from a previous response's `meta.cursor` field.
|
|
2487
|
+
* Format: `{ISO-datetime}|{id}`
|
|
2488
|
+
*
|
|
2489
|
+
*/
|
|
2490
|
+
cursor?: string;
|
|
2491
|
+
/**
|
|
2492
|
+
* Number of results per page
|
|
2493
|
+
*/
|
|
2494
|
+
limit?: number;
|
|
2495
|
+
/**
|
|
2496
|
+
* Filter to rows in this status. Useful for polling
|
|
2497
|
+
* queued rows that haven't transitioned, auditing
|
|
2498
|
+
* gate-denied attempts, or listing only successful
|
|
2499
|
+
* deliveries.
|
|
2500
|
+
*
|
|
2501
|
+
*/
|
|
2502
|
+
status?: SentEmailStatus;
|
|
2503
|
+
/**
|
|
2504
|
+
* Filter to the row matching a specific server-issued
|
|
2505
|
+
* `request_id`. The /send-mail response surfaces
|
|
2506
|
+
* `request_id` on every send; this lookup lets the
|
|
2507
|
+
* caller find the historical row for a given live call
|
|
2508
|
+
* without remembering its `id`.
|
|
2509
|
+
*
|
|
2510
|
+
*/
|
|
2511
|
+
request_id?: string;
|
|
2512
|
+
/**
|
|
2513
|
+
* Filter to rows with the given `client_idempotency_key`.
|
|
2514
|
+
* Multiple rows can share a key (a retry that hit the
|
|
2515
|
+
* idempotent-replay path returns the same row, but a
|
|
2516
|
+
* retry with a DIFFERENT canonical payload under the
|
|
2517
|
+
* same key is rejected by /send-mail before the row is
|
|
2518
|
+
* written, so duplicates are bounded).
|
|
2519
|
+
*
|
|
2520
|
+
*/
|
|
2521
|
+
idempotency_key?: string;
|
|
2522
|
+
/**
|
|
2523
|
+
* Inclusive lower bound on `created_at`.
|
|
2524
|
+
*/
|
|
2525
|
+
date_from?: string;
|
|
2526
|
+
/**
|
|
2527
|
+
* Inclusive upper bound on `created_at`.
|
|
2528
|
+
*/
|
|
2529
|
+
date_to?: string;
|
|
2530
|
+
};
|
|
2531
|
+
url: '/sent-emails';
|
|
2532
|
+
};
|
|
2533
|
+
type ListSentEmailsErrors = {
|
|
2534
|
+
/**
|
|
2535
|
+
* Invalid request parameters
|
|
2536
|
+
*/
|
|
2537
|
+
400: ErrorResponse;
|
|
2538
|
+
/**
|
|
2539
|
+
* Invalid or missing API key
|
|
2540
|
+
*/
|
|
2541
|
+
401: ErrorResponse;
|
|
2542
|
+
};
|
|
2543
|
+
type ListSentEmailsError = ListSentEmailsErrors[keyof ListSentEmailsErrors];
|
|
2544
|
+
type ListSentEmailsResponses = {
|
|
2545
|
+
/**
|
|
2546
|
+
* Page of sent-email summaries
|
|
2547
|
+
*/
|
|
2548
|
+
200: ListEnvelope & {
|
|
2549
|
+
data?: Array<SentEmailSummary>;
|
|
2550
|
+
};
|
|
2551
|
+
};
|
|
2552
|
+
type ListSentEmailsResponse = ListSentEmailsResponses[keyof ListSentEmailsResponses];
|
|
2553
|
+
type GetSentEmailData = {
|
|
2554
|
+
body?: never;
|
|
2555
|
+
path: {
|
|
2556
|
+
/**
|
|
2557
|
+
* Resource UUID
|
|
2558
|
+
*/
|
|
2559
|
+
id: string;
|
|
2560
|
+
};
|
|
2561
|
+
query?: never;
|
|
2562
|
+
url: '/sent-emails/{id}';
|
|
2563
|
+
};
|
|
2564
|
+
type GetSentEmailErrors = {
|
|
2565
|
+
/**
|
|
2566
|
+
* Invalid request parameters
|
|
2567
|
+
*/
|
|
2568
|
+
400: ErrorResponse;
|
|
2569
|
+
/**
|
|
2570
|
+
* Invalid or missing API key
|
|
2571
|
+
*/
|
|
2572
|
+
401: ErrorResponse;
|
|
2573
|
+
/**
|
|
2574
|
+
* Resource not found
|
|
2575
|
+
*/
|
|
2576
|
+
404: ErrorResponse;
|
|
2577
|
+
};
|
|
2578
|
+
type GetSentEmailError = GetSentEmailErrors[keyof GetSentEmailErrors];
|
|
2579
|
+
type GetSentEmailResponses = {
|
|
2580
|
+
/**
|
|
2581
|
+
* Sent-email detail
|
|
2582
|
+
*/
|
|
2583
|
+
200: SuccessEnvelope & {
|
|
2584
|
+
data?: SentEmailDetail;
|
|
2585
|
+
};
|
|
2586
|
+
};
|
|
2587
|
+
type GetSentEmailResponse = GetSentEmailResponses[keyof GetSentEmailResponses];
|
|
2192
2588
|
declare namespace sdk_gen_d_exports {
|
|
2193
|
-
export { Options, addDomain, createEndpoint, createFilter, deleteDomain, deleteEmail, deleteEndpoint, deleteFilter, downloadAttachments, downloadRawEmail, getAccount, getEmail, getSendPermissions, getStorageStats, getWebhookSecret, listDeliveries, listDomains, listEmails, listEndpoints, listFilters, replayDelivery, replayEmailWebhooks, replyToEmail, rotateWebhookSecret, sendEmail, testEndpoint, updateAccount, updateDomain, updateEndpoint, updateFilter, verifyDomain };
|
|
2589
|
+
export { Options, addDomain, createEndpoint, createFilter, deleteDomain, deleteEmail, deleteEndpoint, deleteFilter, downloadAttachments, downloadRawEmail, getAccount, getEmail, getSendPermissions, getSentEmail, getStorageStats, getWebhookSecret, listDeliveries, listDomains, listEmails, listEndpoints, listFilters, listSentEmails, replayDelivery, replayEmailWebhooks, replyToEmail, rotateWebhookSecret, sendEmail, testEndpoint, updateAccount, updateDomain, updateEndpoint, updateFilter, verifyDomain };
|
|
2194
2590
|
}
|
|
2195
2591
|
type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options$1<TData, ThrowOnError, TResponse> & {
|
|
2196
2592
|
/**
|
|
@@ -2292,7 +2688,30 @@ declare const listEmails: <ThrowOnError extends boolean = false>(options?: Optio
|
|
|
2292
2688
|
*/
|
|
2293
2689
|
declare const deleteEmail: <ThrowOnError extends boolean = false>(options: Options<DeleteEmailData, ThrowOnError>) => RequestResult<DeleteEmailResponses, DeleteEmailErrors, ThrowOnError, "fields">;
|
|
2294
2690
|
/**
|
|
2295
|
-
* Get email
|
|
2691
|
+
* Get inbound email by id
|
|
2692
|
+
*
|
|
2693
|
+
* Returns the full record for an inbound email received at one
|
|
2694
|
+
* of your verified domains, including the parsed text and HTML
|
|
2695
|
+
* bodies, threading metadata, SMTP envelope detail, webhook
|
|
2696
|
+
* delivery state, and a `replies` array for any outbound sends
|
|
2697
|
+
* recorded as replies to this inbound.
|
|
2698
|
+
*
|
|
2699
|
+
* For listing inbound emails (with cursor pagination, status
|
|
2700
|
+
* and date filters, and free-text search), use
|
|
2701
|
+
* `/emails`. Outbound (sent) email records are NOT returned
|
|
2702
|
+
* here; use `/sent-emails/{id}` for those.
|
|
2703
|
+
*
|
|
2704
|
+
* The response carries four sender-shaped fields whose
|
|
2705
|
+
* meanings overlap. `from_email` is the canonical "who sent
|
|
2706
|
+
* this" field for most use cases (parsed bare address from
|
|
2707
|
+
* the `From:` header, with a `sender` fallback). `from_header`
|
|
2708
|
+
* is the raw header including any display name. `sender` and
|
|
2709
|
+
* `smtp_mail_from` both carry the SMTP envelope MAIL FROM
|
|
2710
|
+
* (return-path) and are equal by construction; `sender` is
|
|
2711
|
+
* the older field name retained for compatibility. See
|
|
2712
|
+
* `primitive describe emails:get-email | jq '.responseSchema.properties'`
|
|
2713
|
+
* for per-field detail.
|
|
2714
|
+
*
|
|
2296
2715
|
*/
|
|
2297
2716
|
declare const getEmail: <ThrowOnError extends boolean = false>(options: Options<GetEmailData, ThrowOnError>) => RequestResult<GetEmailResponses, GetEmailErrors, ThrowOnError, "fields">;
|
|
2298
2717
|
/**
|
|
@@ -2473,6 +2892,41 @@ declare const getSendPermissions: <ThrowOnError extends boolean = false>(options
|
|
|
2473
2892
|
*
|
|
2474
2893
|
*/
|
|
2475
2894
|
declare const sendEmail: <ThrowOnError extends boolean = false>(options: Options<SendEmailData, ThrowOnError>) => RequestResult<SendEmailResponses, SendEmailErrors, ThrowOnError, "fields">;
|
|
2895
|
+
/**
|
|
2896
|
+
* List outbound sent emails
|
|
2897
|
+
*
|
|
2898
|
+
* Returns a paginated list of OUTBOUND emails the caller's
|
|
2899
|
+
* org has sent via /send-mail (and /emails/{id}/reply, which
|
|
2900
|
+
* forwards through /send-mail). Includes every recorded
|
|
2901
|
+
* attempt, including gate-denied attempts that the agent
|
|
2902
|
+
* never called and rows still in `queued` state.
|
|
2903
|
+
*
|
|
2904
|
+
* For inbound mail received at your verified domains, see
|
|
2905
|
+
* /emails. There is no unified send/receive history endpoint;
|
|
2906
|
+
* the two surfaces are intentionally separate because the
|
|
2907
|
+
* underlying tables, statuses, and lifecycle differ.
|
|
2908
|
+
*
|
|
2909
|
+
* Email bodies (`body_text`, `body_html`) are NOT included on
|
|
2910
|
+
* list rows so a 50-row page can't balloon into a multi-MB
|
|
2911
|
+
* response when sends are near the 5MB body cap. Use
|
|
2912
|
+
* /sent-emails/{id} to fetch a single row with bodies, or
|
|
2913
|
+
* cross-reference by `client_idempotency_key` if the caller
|
|
2914
|
+
* already has the body locally.
|
|
2915
|
+
*
|
|
2916
|
+
*/
|
|
2917
|
+
declare const listSentEmails: <ThrowOnError extends boolean = false>(options?: Options<ListSentEmailsData, ThrowOnError>) => RequestResult<ListSentEmailsResponses, ListSentEmailsErrors, ThrowOnError, "fields">;
|
|
2918
|
+
/**
|
|
2919
|
+
* Get a sent email by id
|
|
2920
|
+
*
|
|
2921
|
+
* Returns the full sent-email record by id, including
|
|
2922
|
+
* `body_text` and `body_html` (omitted from the listing
|
|
2923
|
+
* endpoint to keep paginated responses small). Use this when
|
|
2924
|
+
* diagnosing a specific send, e.g. inspecting the receiver's
|
|
2925
|
+
* SMTP response on a `bounced` row or pulling the gate
|
|
2926
|
+
* denial detail on a `gate_denied` row.
|
|
2927
|
+
*
|
|
2928
|
+
*/
|
|
2929
|
+
declare const getSentEmail: <ThrowOnError extends boolean = false>(options: Options<GetSentEmailData, ThrowOnError>) => RequestResult<GetSentEmailResponses, GetSentEmailErrors, ThrowOnError, "fields">;
|
|
2476
2930
|
//#endregion
|
|
2477
2931
|
//#region src/api/index.d.ts
|
|
2478
2932
|
declare const DEFAULT_BASE_URL = "https://www.primitive.dev/api/v1";
|
|
@@ -2600,4 +3054,4 @@ declare function createPrimitiveClient(options?: PrimitiveClientOptions): Primit
|
|
|
2600
3054
|
declare function client(options?: PrimitiveClientOptions): PrimitiveClient;
|
|
2601
3055
|
declare const operations: typeof sdk_gen_d_exports;
|
|
2602
3056
|
//#endregion
|
|
2603
|
-
export {
|
|
3057
|
+
export { AddDomainError as $, ListEmailsResponses as $n, SentEmailStatus as $r, EmailDetailReply as $t, getSentEmail as A, UpdateFilterErrors as Ai, GetStorageStatsErrors as An, ReplyToEmailErrors as Ar, DeleteEndpointErrors as At, replayEmailWebhooks as B, WebhookSecret as Bi, ListDeliveriesError as Bn, SendEmailError as Br, Domain as Bt, deleteEndpoint as C, UpdateEndpointError as Ci, GetSentEmailData as Cn, ReplayEmailWebhooksError as Cr, DeleteEmailData as Ct, getAccount as D, UpdateEndpointResponses as Di, GetSentEmailResponses as Dn, ReplayResult as Dr, DeleteEmailResponses as Dt, downloadRawEmail as E, UpdateEndpointResponse as Ei, GetSentEmailResponse as En, ReplayEmailWebhooksResponses as Er, DeleteEmailResponse as Et, listEmails as F, VerifyDomainData as Fi, GetWebhookSecretErrors as Fn, RotateWebhookSecretError as Fr, DeleteFilterErrors as Ft, updateAccount as G, Options$1 as Gi, ListDomainsError as Gn, SendMailResult as Gr, DownloadAttachmentsResponse as Gt, rotateWebhookSecret as H, ClientOptions$1 as Hi, ListDeliveriesResponse as Hn, SendEmailResponse as Hr, DownloadAttachmentsData as Ht, listEndpoints as I, VerifyDomainError as Ii, GetWebhookSecretResponse as In, RotateWebhookSecretErrors as Ir, DeleteFilterResponse as It, updateFilter as J, ResponseStyle as Ji, ListDomainsResponses as Jn, SendPermissionManagedZone as Jr, DownloadRawEmailError as Jt, updateDomain as K, RequestOptions as Ki, ListDomainsErrors as Kn, SendPermissionAddress as Kr, DownloadAttachmentsResponses as Kt, listFilters as L, VerifyDomainErrors as Li, GetWebhookSecretResponses as Ln, RotateWebhookSecretResponse as Lr, DeleteFilterResponses as Lt, getWebhookSecret as M, UpdateFilterResponse as Mi, GetStorageStatsResponses as Mn, ReplyToEmailResponses as Mr, DeleteEndpointResponses as Mt, listDeliveries as N, UpdateFilterResponses as Ni, GetWebhookSecretData as Nn, ResourceId as Nr, DeleteFilterData as Nt, getEmail as O, UpdateFilterData as Oi, GetStorageStatsData as On, ReplyToEmailData as Or, DeleteEndpointData as Ot, listDomains as P, VerifiedDomain as Pi, GetWebhookSecretError as Pn, RotateWebhookSecretData as Pr, DeleteFilterError as Pt, AddDomainData as Q, ListEmailsResponse as Qn, SentEmailDetail as Qr, EmailDetail as Qt, listSentEmails as R, VerifyDomainResponse as Ri, Limit as Rn, RotateWebhookSecretResponses as Rr, DeliveryStatus as Rt, deleteEmail as S, UpdateEndpointData as Si, GetSendPermissionsResponses as Sn, ReplayEmailWebhooksData as Sr, DeleteDomainResponses as St, downloadAttachments as T, UpdateEndpointInput as Ti, GetSentEmailErrors as Tn, ReplayEmailWebhooksResponse as Tr, DeleteEmailErrors as Tt, sendEmail as U, Config as Ui, ListDeliveriesResponses as Un, SendEmailResponses as Ur, DownloadAttachmentsError as Ut, replyToEmail as V, Client as Vi, ListDeliveriesErrors as Vn, SendEmailErrors as Vr, DomainVerifyResult as Vt, testEndpoint as W, CreateClientConfig as Wi, ListDomainsData as Wn, SendMailInput as Wr, DownloadAttachmentsErrors as Wt, Account as X, ListEmailsError as Xn, SendPermissionYourDomain as Xr, DownloadRawEmailResponse as Xt, verifyDomain as Y, Auth as Yi, ListEmailsData as Yn, SendPermissionRule as Yr, DownloadRawEmailErrors as Yt, AccountUpdated as Z, ListEmailsErrors as Zn, SendPermissionsMeta as Zr, DownloadRawEmailResponses as Zt, Options as _, UpdateDomainError as _i, GetEmailResponses as _n, ReplayDeliveryData as _r, Cursor as _t, PrimitiveApiError as a, TestEndpointErrors as ai, Filter as an, ListEnvelope as ar, CreateEndpointData as at, createFilter as b, UpdateDomainResponse as bi, GetSendPermissionsErrors as bn, ReplayDeliveryResponse as br, DeleteDomainErrors as bt, PrimitiveClientOptions as c, TestResult as ci, GetAccountData as cn, ListFiltersErrors as cr, CreateEndpointInput as ct, SendResult as d, UpdateAccountError as di, GetAccountResponse as dn, ListSentEmailsData as dr, CreateFilterData as dt, SentEmailSummary as ei, EmailStatus as en, ListEndpointsData as er, AddDomainErrors as et, SendThreadInput as f, UpdateAccountErrors as fi, GetAccountResponses as fn, ListSentEmailsError as fr, CreateFilterError as ft, operations as g, UpdateDomainData as gi, GetEmailResponse as gn, PaginationMeta as gr, CreateFilterResponses as gt, createPrimitiveClient as h, UpdateAccountResponses as hi, GetEmailErrors as hn, ListSentEmailsResponses as hr, CreateFilterResponse as ht, PrimitiveApiClientOptions as i, TestEndpointError as ii, ErrorResponse as in, ListEndpointsResponses as ir, ClientOptions as it, getStorageStats as j, UpdateFilterInput as ji, GetStorageStatsResponse as jn, ReplyToEmailResponse as jr, DeleteEndpointResponse as jt, getSendPermissions as k, UpdateFilterError as ki, GetStorageStatsError as kn, ReplyToEmailError as kr, DeleteEndpointError as kt, ReplyInput as l, UnverifiedDomain as li, GetAccountError as ln, ListFiltersResponse as lr, CreateEndpointResponse as lt, createPrimitiveApiClient as m, UpdateAccountResponse as mi, GetEmailError as mn, ListSentEmailsResponse as mr, CreateFilterInput as mt, ForwardInput as n, SuccessEnvelope as ni, EmailWebhookStatus as nn, ListEndpointsErrors as nr, AddDomainResponse as nt, PrimitiveApiErrorDetails as o, TestEndpointResponse as oi, GateDenial as on, ListFiltersData as or, CreateEndpointError as ot, client as p, UpdateAccountInput as pi, GetEmailData as pn, ListSentEmailsErrors as pr, CreateFilterErrors as pt, updateEndpoint as q, RequestResult as qi, ListDomainsResponse as qn, SendPermissionAnyRecipient as qr, DownloadRawEmailData as qt, PrimitiveApiClient as r, TestEndpointData as ri, Endpoint as rn, ListEndpointsResponse as rr, AddDomainResponses as rt, PrimitiveClient as s, TestEndpointResponses as si, GateFix as sn, ListFiltersError as sr, CreateEndpointErrors as st, DEFAULT_BASE_URL as t, StorageStats as ti, EmailSummary as tn, ListEndpointsError as tr, AddDomainInput as tt, SendInput as u, UpdateAccountData as ui, GetAccountErrors as un, ListFiltersResponses as ur, CreateEndpointResponses as ut, addDomain as v, UpdateDomainErrors as vi, GetSendPermissionsData as vn, ReplayDeliveryError as vr, DeleteDomainData as vt, deleteFilter as w, UpdateEndpointErrors as wi, GetSentEmailError as wn, ReplayEmailWebhooksErrors as wr, DeleteEmailError as wt, deleteDomain as x, UpdateDomainResponses as xi, GetSendPermissionsResponse as xn, ReplayDeliveryResponses as xr, DeleteDomainResponse as xt, createEndpoint as y, UpdateDomainInput as yi, GetSendPermissionsError as yn, ReplayDeliveryErrors as yr, DeleteDomainError as yt, replayDelivery as z, VerifyDomainResponses as zi, ListDeliveriesData as zn, SendEmailData as zr, DeliverySummary as zt };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { A as UnknownEvent, C as ParsedDataFailed, D as RawContentDownloadOnly, E as RawContent, M as WebhookAttachment, N as WebhookEvent, O as RawContentInline, S as ParsedDataComplete, T as ParsedStatus, _ as ForwardResultInline, a as DmarcPolicy, b as KnownWebhookEvent, c as EmailAnalysis, d as EventType, f as ForwardAnalysis, g as ForwardResultAttachmentSkipped, h as ForwardResultAttachmentAnalyzed, i as DkimSignature, j as ValidateEmailAuthResult, k as SpfResult, l as EmailAuth, m as ForwardResult, n as AuthVerdict, o as DmarcResult, p as ForwardOriginalSender, r as DkimResult, s as EmailAddress, t as AuthConfidence, u as EmailReceivedEvent, v as ForwardVerdict, w as ParsedError, x as ParsedData, y as ForwardVerification } from "./types-9vXGZjPd.js";
|
|
2
2
|
import { a as buildReplySubject, c as parseHeaderAddress, i as buildForwardSubject, n as ReceivedEmailAddress, o as formatAddress, r as ReceivedEmailThread, s as normalizeReceivedEmail, t as ReceivedEmail } from "./received-email-DNjpq_Wt.js";
|
|
3
|
-
import { a as PrimitiveApiError, c as PrimitiveClientOptions, d as SendResult, f as SendThreadInput, h as createPrimitiveClient, l as ReplyInput, n as ForwardInput, p as client, s as PrimitiveClient, u as SendInput } from "./index-
|
|
3
|
+
import { a as PrimitiveApiError, c as PrimitiveClientOptions, d as SendResult, f as SendThreadInput, h as createPrimitiveClient, l as ReplyInput, n as ForwardInput, p as client, s as PrimitiveClient, u as SendInput } from "./index-DEY4h3MZ.js";
|
|
4
4
|
import { A as VerifyOptions, B as PAYLOAD_ERRORS, C as signStandardWebhooksPayload, D as PRIMITIVE_CONFIRMED_HEADER, E as LEGACY_SIGNATURE_HEADER, F as VerifyDownloadTokenResult, G as VERIFICATION_ERRORS, H as RAW_EMAIL_ERRORS, I as generateDownloadToken, J as WebhookPayloadErrorCode, K as WebhookErrorCode, L as verifyDownloadToken, M as verifyWebhookSignature, N as GenerateDownloadTokenOptions, O as PRIMITIVE_SIGNATURE_HEADER, P as VerifyDownloadTokenOptions, Q as WebhookVerificationErrorCode, R as safeValidateEmailReceivedEvent, S as StandardWebhooksVerifyOptions, T as LEGACY_CONFIRMED_HEADER, U as RawEmailDecodeError, V as PrimitiveWebhookError, W as RawEmailDecodeErrorCode, X as WebhookValidationErrorCode, Y as WebhookValidationError, Z as WebhookVerificationError, _ as emailReceivedEventJsonSchema, a as confirmedHeaders, b as STANDARD_WEBHOOK_TIMESTAMP_HEADER, c as handleWebhook, d as isRawIncluded, f as parseWebhookEvent, g as validateEmailAuth, h as WEBHOOK_VERSION, i as WebhookHeaders, j as signWebhookPayload, k as SignResult, l as isDownloadExpired, m as verifyRawEmailDownload, n as HandleWebhookOptions, o as decodeRawEmail, p as receive, q as WebhookPayloadError, r as ReceiveRequestOptions, s as getDownloadTimeRemaining, t as DecodeRawEmailOptions, u as isEmailReceivedEvent, v as STANDARD_WEBHOOK_ID_HEADER, w as verifyStandardWebhooksSignature, x as StandardWebhooksSignResult, y as STANDARD_WEBHOOK_SIGNATURE_HEADER, z as validateEmailReceivedEvent } from "./index-CbEivn3S.js";
|
|
5
5
|
|
|
6
6
|
//#region src/index.d.ts
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as parseHeaderAddress, i as normalizeReceivedEmail, n as buildReplySubject, r as formatAddress, t as buildForwardSubject } from "./received-email-D6tKtWwW.js";
|
|
2
|
-
import { a as client, i as PrimitiveClient, r as PrimitiveApiError, s as createPrimitiveClient } from "./api-
|
|
2
|
+
import { a as client, i as PrimitiveClient, r as PrimitiveApiError, s as createPrimitiveClient } from "./api-DpATn7LQ.js";
|
|
3
3
|
import { A as PRIMITIVE_CONFIRMED_HEADER, B as RAW_EMAIL_ERRORS, C as STANDARD_WEBHOOK_ID_HEADER, D as verifyStandardWebhooksSignature, E as signStandardWebhooksPayload, F as verifyDownloadToken, G as WebhookVerificationError, H as VERIFICATION_ERRORS, I as safeValidateEmailReceivedEvent, L as validateEmailReceivedEvent, M as signWebhookPayload, N as verifyWebhookSignature, O as LEGACY_CONFIRMED_HEADER, P as generateDownloadToken, R as PAYLOAD_ERRORS, S as emailReceivedEventJsonSchema, T as STANDARD_WEBHOOK_TIMESTAMP_HEADER, U as WebhookPayloadError, V as RawEmailDecodeError, W as WebhookValidationError, _ as DmarcResult, a as isDownloadExpired, b as ParsedStatus, c as parseWebhookEvent, d as WEBHOOK_VERSION, f as validateEmailAuth, g as DmarcPolicy, h as DkimResult, i as handleWebhook, j as PRIMITIVE_SIGNATURE_HEADER, k as LEGACY_SIGNATURE_HEADER, l as receive, m as AuthVerdict, n as decodeRawEmail, o as isEmailReceivedEvent, p as AuthConfidence, r as getDownloadTimeRemaining, s as isRawIncluded, t as confirmedHeaders, u as verifyRawEmailDownload, v as EventType, w as STANDARD_WEBHOOK_SIGNATURE_HEADER, x as SpfResult, y as ForwardVerdict, z as PrimitiveWebhookError } from "./webhook-zkN4wUTs.js";
|
|
4
4
|
//#region src/index.ts
|
|
5
5
|
const primitive = {
|