@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.
- package/dist/api/generated/index.js +1 -1
- package/dist/api/generated/sdk.gen.js +30 -0
- package/dist/api/index.d.ts +2 -2
- package/dist/api/index.js +40 -5
- package/dist/{api-DNF21MDo.js → api-BjzvA2Fy.js} +63 -6
- package/dist/{index-C6ObsYjq.d.ts → index-QTYQpSFt.d.ts} +215 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/oclif/api-command.js +74 -13
- package/dist/oclif/auth.js +65 -10
- package/dist/oclif/commands/emails-latest.js +23 -12
- package/dist/oclif/commands/emails-poll.js +121 -0
- package/dist/oclif/commands/emails-wait.js +171 -0
- package/dist/oclif/commands/emails-watch.js +165 -0
- package/dist/oclif/commands/functions-deploy.js +15 -6
- package/dist/oclif/commands/functions-redeploy.js +15 -6
- package/dist/oclif/commands/login.js +18 -14
- package/dist/oclif/commands/logout.js +9 -8
- package/dist/oclif/commands/send.js +21 -7
- package/dist/oclif/commands/whoami.js +15 -6
- package/dist/oclif/fish-completion.js +1 -1
- package/dist/oclif/index.js +6 -0
- package/dist/openapi/openapi.generated.js +397 -2
- package/dist/openapi/operations.generated.js +305 -1
- package/oclif.manifest.json +1327 -281
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
-
export { addDomain, cliLogout, createEndpoint, createFilter, createFunction, createFunctionSecret, deleteDomain, deleteEmail, deleteEndpoint, deleteFilter, deleteFunction, deleteFunctionSecret, discardEmailContent, downloadAttachments, downloadRawEmail, getAccount, getEmail, getFunction, getSendPermissions, getSentEmail, getStorageStats, getWebhookSecret, listDeliveries, listDomains, listEmails, listEndpoints, listFilters, listFunctions, listFunctionSecrets, listSentEmails, pollCliLogin, replayDelivery, replayEmailWebhooks, replyToEmail, rotateWebhookSecret, sendEmail, setFunctionSecret, startCliLogin, testEndpoint, testFunction, updateAccount, updateDomain, updateEndpoint, updateFilter, updateFunction, verifyDomain } from './sdk.gen.js';
|
|
2
|
+
export { addDomain, cliLogout, createEndpoint, createFilter, createFunction, createFunctionSecret, deleteDomain, deleteEmail, deleteEndpoint, deleteFilter, deleteFunction, deleteFunctionSecret, discardEmailContent, downloadAttachments, downloadRawEmail, getAccount, getEmail, getFunction, getSendPermissions, getSentEmail, getStorageStats, getWebhookSecret, listDeliveries, listDomains, listEmails, listEndpoints, listFilters, listFunctions, listFunctionSecrets, listSentEmails, pollCliLogin, replayDelivery, replayEmailWebhooks, replyToEmail, rotateWebhookSecret, searchEmails, sendEmail, setFunctionSecret, startCliLogin, testEndpoint, testFunction, updateAccount, updateDomain, updateEndpoint, updateFilter, updateFunction, verifyDomain } from './sdk.gen.js';
|
|
@@ -211,6 +211,27 @@ export const listEmails = (options) => (options?.client ?? client).get({
|
|
|
211
211
|
url: '/emails',
|
|
212
212
|
...options
|
|
213
213
|
});
|
|
214
|
+
/**
|
|
215
|
+
* Search inbound emails
|
|
216
|
+
*
|
|
217
|
+
* Searches inbound emails with structured filters and optional
|
|
218
|
+
* full-text matching across parsed email fields. This endpoint is
|
|
219
|
+
* optimized for filtered inbox views and CLI polling workflows:
|
|
220
|
+
* callers that only need new accepted mail can pass
|
|
221
|
+
* `sort=received_at_asc`, `snippet=false`, `include_facets=false`,
|
|
222
|
+
* and a `date_from` timestamp.
|
|
223
|
+
*
|
|
224
|
+
* `q`, `subject`, and `body` use the same English full-text index
|
|
225
|
+
* as the web inbox search. Structured filters such as `from`, `to`,
|
|
226
|
+
* `domain_id`, status, attachment presence, and spam score bounds
|
|
227
|
+
* are combined with the text query.
|
|
228
|
+
*
|
|
229
|
+
*/
|
|
230
|
+
export const searchEmails = (options) => (options?.client ?? client).get({
|
|
231
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
232
|
+
url: '/emails/search',
|
|
233
|
+
...options
|
|
234
|
+
});
|
|
214
235
|
/**
|
|
215
236
|
* Delete an email
|
|
216
237
|
*/
|
|
@@ -554,6 +575,15 @@ export const getSendPermissions = (options) => (options?.client ?? client).get({
|
|
|
554
575
|
* the request returns once the relay accepts the message for delivery.
|
|
555
576
|
* Set `wait: true` to wait for the first downstream SMTP delivery outcome.
|
|
556
577
|
*
|
|
578
|
+
* **Host routing.** /send-mail is served by the attachments-
|
|
579
|
+
* supporting host (`https://api.primitive.dev/v1`) so the
|
|
580
|
+
* request body can carry inline attachments up to ~30 MiB raw.
|
|
581
|
+
* The primary host (`https://www.primitive.dev/api/v1`) also
|
|
582
|
+
* accepts /send-mail for attachment-free sends; sends WITH
|
|
583
|
+
* attachments to the primary host return 413
|
|
584
|
+
* `attachments_unsupported_on_this_endpoint`. The typed SDKs
|
|
585
|
+
* route /send-mail to the attachments host automatically.
|
|
586
|
+
*
|
|
557
587
|
*/
|
|
558
588
|
export const sendEmail = (options) => (options.client ?? client).post({
|
|
559
589
|
security: [{ scheme: 'bearer', type: 'http' }],
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { Account, AccountUpdated, AddDomainData, AddDomainError, AddDomainErrors, AddDomainInput, AddDomainResponse, AddDomainResponses, Auth, CliLoginPollResult, CliLoginStartResult, CliLogoutData, CliLogoutError, CliLogoutErrors, CliLogoutInput, CliLogoutResponse, CliLogoutResponses, CliLogoutResult, ClientOptions, CreateClientConfig, CreateEndpointData, CreateEndpointError, CreateEndpointErrors, CreateEndpointInput, CreateEndpointResponse, CreateEndpointResponses, CreateFilterData, CreateFilterError, CreateFilterErrors, CreateFilterInput, CreateFilterResponse, CreateFilterResponses, CreateFunctionData, CreateFunctionError, CreateFunctionErrors, CreateFunctionInput, CreateFunctionResponse, CreateFunctionResponses, CreateFunctionResult, CreateFunctionSecretData, CreateFunctionSecretError, CreateFunctionSecretErrors, CreateFunctionSecretInput, CreateFunctionSecretResponse, CreateFunctionSecretResponses, Cursor,
|
|
1
|
+
import { $ as replyToEmail, $a as TestEndpointError, $i as ReplayDeliveryResponses, $n as EmailDetail, $o as RequestOptions, $r as GetWebhookSecretResponses, $t as CreateFunctionSecretInput, A as deleteFunction, Aa as SendPermissionAnyRecipient, Ai as ListFunctionSecretsResponse, An as DeleteFunctionSecretErrors, Ao as UpdateFilterError, Ar as GetFunctionError, At as ClientOptions, B as getStorageStats, Ba as SetFunctionSecretErrors, Bi as ListSentEmailsResponse, Bn as DiscardEmailContentResponses, Bo as UpdateFunctionResponses, Br as GetSentEmailError, Bt as CreateFilterInput, C as createFilter, Ca as SendEmailError, Ci as ListFiltersError, Cn as DeleteFunctionData, Co as UpdateEndpointData, Cr as GetAccountResponses, Ct as CliLogoutData, D as deleteEmail, Da as SendMailInput, Di as ListFunctionSecretsData, Dn as DeleteFunctionResponses, Do as UpdateEndpointResponse, Dr as GetEmailResponse, Dt as CliLogoutResponse, E as deleteDomain, Ea as SendEmailResponses, Ei as ListFiltersResponses, En as DeleteFunctionResponse, Eo as UpdateEndpointInput, Er as GetEmailErrors, Et as CliLogoutInput, F as getAccount, Fa as SentEmailDetail, Fi as ListFunctionsResponse, Fn as DiscardContentResult, Fo as UpdateFunctionData, Fr as GetSendPermissionsError, Ft as CreateEndpointResponse, G as listEndpoints, Ga as StartCliLoginError, Gi as PollCliLoginErrors, Gn as DownloadAttachmentsErrors, Go as VerifyDomainResponse, Gr as GetStorageStatsError, Gt as CreateFunctionErrors, H as listDeliveries, Ha as SetFunctionSecretResponse, Hi as PaginationMeta, Hn as DomainVerifyResult, Ho as VerifyDomainData, Hr as GetSentEmailResponse, Ht as CreateFilterResponses, I as getEmail, Ia as SentEmailStatus, Ii as ListFunctionsResponses, In as DiscardEmailContentData, Io as UpdateFunctionError, Ir as GetSendPermissionsErrors, It as CreateEndpointResponses, J as listFunctions, Ja as StartCliLoginResponse, Ji as PollCliLoginResponses, Jn as DownloadRawEmailData, Jo as Client, Jr as GetStorageStatsResponses, Jt as CreateFunctionResponses, K as listFilters, Ka as StartCliLoginErrors, Ki as PollCliLoginInput, Kn as DownloadAttachmentsResponse, Ko as VerifyDomainResponses, Kr as GetStorageStatsErrors, Kt as CreateFunctionInput, L as getFunction, La as SentEmailSummary, Li as ListSentEmailsData, Ln as DiscardEmailContentError, Lo as UpdateFunctionErrors, Lr as GetSendPermissionsResponse, Lt as CreateFilterData, M as discardEmailContent, Ma as SendPermissionRule, Mi as ListFunctionsData, Mn as DeleteFunctionSecretResponses, Mo as UpdateFilterInput, Mr as GetFunctionResponse, Mt as CreateEndpointError, N as downloadAttachments, Na as SendPermissionYourDomain, Ni as ListFunctionsError, Nn as DeliveryStatus, No as UpdateFilterResponse, Nr as GetFunctionResponses, Nt as CreateEndpointErrors, O as deleteEndpoint, Oa as SendMailResult, Oi as ListFunctionSecretsError, On as DeleteFunctionSecretData, Oo as UpdateEndpointResponses, Or as GetEmailResponses, Ot as CliLogoutResponses, P as downloadRawEmail, Pa as SendPermissionsMeta, Pi as ListFunctionsErrors, Pn as DeliverySummary, Po as UpdateFilterResponses, Pr as GetSendPermissionsData, Pt as CreateEndpointInput, Q as replayEmailWebhooks, Qa as TestEndpointData, Qi as ReplayDeliveryResponse, Qn as DownloadRawEmailResponses, Qo as Options$1, Qr as GetWebhookSecretResponse, Qt as CreateFunctionSecretErrors, R as getSendPermissions, Ra as SetFunctionSecretData, Ri as ListSentEmailsError, Rn as DiscardEmailContentErrors, Ro as UpdateFunctionInput, Rr as GetSendPermissionsResponses, Rt as CreateFilterError, S as createEndpoint, Sa as SendEmailData, Si as ListFiltersData, Sn as DeleteFilterResponses, So as UpdateDomainResponses, Sr as GetAccountResponse, St as CliLoginStartResult, T as createFunctionSecret, Ta as SendEmailResponse, Ti as ListFiltersResponse, Tn as DeleteFunctionErrors, To as UpdateEndpointErrors, Tr as GetEmailError, Tt as CliLogoutErrors, U as listDomains, Ua as SetFunctionSecretResponses, Ui as PollCliLoginData, Un as DownloadAttachmentsData, Uo as VerifyDomainError, Ur as GetSentEmailResponses, Ut as CreateFunctionData, V as getWebhookSecret, Va as SetFunctionSecretInput, Vi as ListSentEmailsResponses, Vn as Domain, Vo as VerifiedDomain, Vr as GetSentEmailErrors, Vt as CreateFilterResponse, W as listEmails, Wa as StartCliLoginData, Wi as PollCliLoginError, Wn as DownloadAttachmentsError, Wo as VerifyDomainErrors, Wr as GetStorageStatsData, Wt as CreateFunctionError, X as pollCliLogin, Xa as StorageStats, Xi as ReplayDeliveryError, Xn as DownloadRawEmailErrors, Xo as Config, Xr as GetWebhookSecretError, Xt as CreateFunctionSecretData, Y as listSentEmails, Ya as StartCliLoginResponses, Yi as ReplayDeliveryData, Yn as DownloadRawEmailError, Yo as ClientOptions$1, Yr as GetWebhookSecretData, Yt as CreateFunctionResult, Z as replayDelivery, Za as SuccessEnvelope, Zi as ReplayDeliveryErrors, Zn as DownloadRawEmailResponse, Zo as CreateClientConfig, Zr as GetWebhookSecretErrors, Zt as CreateFunctionSecretError, _ as createPrimitiveClient, _a as SearchEmailsData, _i as ListEndpointsError, _n as DeleteEndpointResponses, _o as UpdateDomainData, _r as GateDenial, _t as AddDomainErrors, a as PrimitiveApiClientOptions, aa as ReplayResult, ai as ListDeliveriesResponses, an as DeleteDomainErrors, ao as TestFunctionErrors, ar as EmailSearchResult, at as testEndpoint, b as addDomain, ba as SearchEmailsResponse, bi as ListEndpointsResponses, bn as DeleteFilterErrors, bo as UpdateDomainInput, br as GetAccountError, bt as AddDomainResponses, c as PrimitiveClient, ca as ReplyToEmailErrors, ci as ListDomainsErrors, cn as DeleteEmailData, co as TestInvocationResult, cr as EmailWebhookStatus, ct as updateDomain, d as RequestOptions$1, da as ResourceId, di as ListEmailsData, dn as DeleteEmailResponse, do as UpdateAccountData, dr as Filter, dt as updateFunction, ea as ReplayEmailWebhooksData, ei as Limit, en as CreateFunctionSecretResponse, eo as TestEndpointErrors, er as EmailDetailReply, es as RequestResult, et as rotateWebhookSecret, f as SendInput, fa as RotateWebhookSecretData, fi as ListEmailsError, fn as DeleteEmailResponses, fo as UpdateAccountError, fr as FunctionDeployStatus, ft as verifyDomain, g as createPrimitiveApiClient, ga as RotateWebhookSecretResponses, gi as ListEndpointsData, gn as DeleteEndpointResponse, go as UpdateAccountResponses, gr as FunctionSecretWriteResult, gt as AddDomainError, h as client, ha as RotateWebhookSecretResponse, hi as ListEmailsResponses, hn as DeleteEndpointErrors, ho as UpdateAccountResponse, hr as FunctionSecretListItem, ht as AddDomainData, i as PrimitiveApiClient, ia as ReplayEmailWebhooksResponses, ii as ListDeliveriesResponse, in as DeleteDomainError, io as TestFunctionError, ir as EmailSearchMeta, it as startCliLogin, j as deleteFunctionSecret, ja as SendPermissionManagedZone, ji as ListFunctionSecretsResponses, jn as DeleteFunctionSecretResponse, jo as UpdateFilterErrors, jr as GetFunctionErrors, jt as CreateEndpointData, k as deleteFilter, ka as SendPermissionAddress, ki as ListFunctionSecretsErrors, kn as DeleteFunctionSecretError, ko as UpdateFilterData, kr as GetFunctionData, kt as CliLogoutResult, l as PrimitiveClientOptions, la as ReplyToEmailResponse, li as ListDomainsResponse, ln as DeleteEmailError, lo as TestResult, lr as Endpoint, lt as updateEndpoint, m as SendThreadInput, ma as RotateWebhookSecretErrors, mi as ListEmailsResponse, mn as DeleteEndpointError, mo as UpdateAccountInput, mr as FunctionListItem, mt as AccountUpdated, n as DEFAULT_API_BASE_URL_2, na as ReplayEmailWebhooksErrors, ni as ListDeliveriesError, nn as Cursor, no as TestEndpointResponses, nr as EmailSearchFacets, ns as Auth, nt as sendEmail, o as PrimitiveApiError, oa as ReplyToEmailData, oi as ListDomainsData, on as DeleteDomainResponse, oo as TestFunctionResponse, or as EmailStatus, ot as testFunction, p as SendResult, pa as RotateWebhookSecretError, pi as ListEmailsErrors, pn as DeleteEndpointData, po as UpdateAccountErrors, pr as FunctionDetail, pt as Account, q as listFunctionSecrets, qa as StartCliLoginInput, qi as PollCliLoginResponse, qn as DownloadAttachmentsResponses, qo as WebhookSecret, qr as GetStorageStatsResponse, qt as CreateFunctionResponse, r as ForwardInput, ra as ReplayEmailWebhooksResponse, ri as ListDeliveriesErrors, rn as DeleteDomainData, ro as TestFunctionData, rr as EmailSearchHighlights, rt as setFunctionSecret, s as PrimitiveApiErrorDetails, sa as ReplyToEmailError, si as ListDomainsError, sn as DeleteDomainResponses, so as TestFunctionResponses, sr as EmailSummary, st as updateAccount, t as DEFAULT_API_BASE_URL_1, ta as ReplayEmailWebhooksError, ti as ListDeliveriesData, tn as CreateFunctionSecretResponses, to as TestEndpointResponse, tr as EmailSearchFacetBucket, ts as ResponseStyle, tt as searchEmails, u as ReplyInput, ua as ReplyToEmailResponses, ui as ListDomainsResponses, un as DeleteEmailErrors, uo as UnverifiedDomain, ur as ErrorResponse, ut as updateFilter, v as operations, va as SearchEmailsError, vi as ListEndpointsErrors, vn as DeleteFilterData, vo as UpdateDomainError, vr as GateFix, vt as AddDomainInput, w as createFunction, wa as SendEmailErrors, wi as ListFiltersErrors, wn as DeleteFunctionError, wo as UpdateEndpointError, wr as GetEmailData, wt as CliLogoutError, x as cliLogout, xa as SearchEmailsResponses, xi as ListEnvelope, xn as DeleteFilterResponse, xo as UpdateDomainResponse, xr as GetAccountErrors, xt as CliLoginPollResult, y as Options, ya as SearchEmailsErrors, yi as ListEndpointsResponse, yn as DeleteFilterError, yo as UpdateDomainErrors, yr as GetAccountData, yt as AddDomainResponse, z as getSentEmail, za as SetFunctionSecretError, zi as ListSentEmailsErrors, zn as DiscardEmailContentResponse, zo as UpdateFunctionResponse, zr as GetSentEmailData, zt as CreateFilterErrors } from "../index-QTYQpSFt.js";
|
|
2
|
+
export { Account, AccountUpdated, AddDomainData, AddDomainError, AddDomainErrors, AddDomainInput, AddDomainResponse, AddDomainResponses, Auth, CliLoginPollResult, CliLoginStartResult, CliLogoutData, CliLogoutError, CliLogoutErrors, CliLogoutInput, CliLogoutResponse, CliLogoutResponses, CliLogoutResult, ClientOptions, CreateClientConfig, CreateEndpointData, CreateEndpointError, CreateEndpointErrors, CreateEndpointInput, CreateEndpointResponse, CreateEndpointResponses, CreateFilterData, CreateFilterError, CreateFilterErrors, CreateFilterInput, CreateFilterResponse, CreateFilterResponses, CreateFunctionData, CreateFunctionError, CreateFunctionErrors, CreateFunctionInput, CreateFunctionResponse, CreateFunctionResponses, CreateFunctionResult, CreateFunctionSecretData, CreateFunctionSecretError, CreateFunctionSecretErrors, CreateFunctionSecretInput, CreateFunctionSecretResponse, CreateFunctionSecretResponses, Cursor, DEFAULT_API_BASE_URL_1, DEFAULT_API_BASE_URL_2, DeleteDomainData, DeleteDomainError, DeleteDomainErrors, DeleteDomainResponse, DeleteDomainResponses, DeleteEmailData, DeleteEmailError, DeleteEmailErrors, DeleteEmailResponse, DeleteEmailResponses, DeleteEndpointData, DeleteEndpointError, DeleteEndpointErrors, DeleteEndpointResponse, DeleteEndpointResponses, DeleteFilterData, DeleteFilterError, DeleteFilterErrors, DeleteFilterResponse, DeleteFilterResponses, DeleteFunctionData, DeleteFunctionError, DeleteFunctionErrors, DeleteFunctionResponse, DeleteFunctionResponses, DeleteFunctionSecretData, DeleteFunctionSecretError, DeleteFunctionSecretErrors, DeleteFunctionSecretResponse, DeleteFunctionSecretResponses, DeliveryStatus, DeliverySummary, DiscardContentResult, DiscardEmailContentData, DiscardEmailContentError, DiscardEmailContentErrors, DiscardEmailContentResponse, DiscardEmailContentResponses, Domain, DomainVerifyResult, DownloadAttachmentsData, DownloadAttachmentsError, DownloadAttachmentsErrors, DownloadAttachmentsResponse, DownloadAttachmentsResponses, DownloadRawEmailData, DownloadRawEmailError, DownloadRawEmailErrors, DownloadRawEmailResponse, DownloadRawEmailResponses, EmailDetail, EmailDetailReply, EmailSearchFacetBucket, EmailSearchFacets, EmailSearchHighlights, EmailSearchMeta, EmailSearchResult, EmailStatus, EmailSummary, EmailWebhookStatus, Endpoint, ErrorResponse, Filter, ForwardInput, FunctionDeployStatus, FunctionDetail, FunctionListItem, FunctionSecretListItem, FunctionSecretWriteResult, GateDenial, GateFix, GetAccountData, GetAccountError, GetAccountErrors, GetAccountResponse, GetAccountResponses, GetEmailData, GetEmailError, GetEmailErrors, GetEmailResponse, GetEmailResponses, GetFunctionData, GetFunctionError, GetFunctionErrors, GetFunctionResponse, GetFunctionResponses, GetSendPermissionsData, GetSendPermissionsError, GetSendPermissionsErrors, GetSendPermissionsResponse, GetSendPermissionsResponses, GetSentEmailData, GetSentEmailError, GetSentEmailErrors, GetSentEmailResponse, GetSentEmailResponses, GetStorageStatsData, GetStorageStatsError, GetStorageStatsErrors, GetStorageStatsResponse, GetStorageStatsResponses, GetWebhookSecretData, GetWebhookSecretError, GetWebhookSecretErrors, GetWebhookSecretResponse, GetWebhookSecretResponses, Limit, ListDeliveriesData, ListDeliveriesError, ListDeliveriesErrors, ListDeliveriesResponse, ListDeliveriesResponses, ListDomainsData, ListDomainsError, ListDomainsErrors, ListDomainsResponse, ListDomainsResponses, ListEmailsData, ListEmailsError, ListEmailsErrors, ListEmailsResponse, ListEmailsResponses, ListEndpointsData, ListEndpointsError, ListEndpointsErrors, ListEndpointsResponse, ListEndpointsResponses, ListEnvelope, ListFiltersData, ListFiltersError, ListFiltersErrors, ListFiltersResponse, ListFiltersResponses, ListFunctionSecretsData, ListFunctionSecretsError, ListFunctionSecretsErrors, ListFunctionSecretsResponse, ListFunctionSecretsResponses, ListFunctionsData, ListFunctionsError, ListFunctionsErrors, ListFunctionsResponse, ListFunctionsResponses, ListSentEmailsData, ListSentEmailsError, ListSentEmailsErrors, ListSentEmailsResponse, ListSentEmailsResponses, Options, PaginationMeta, PollCliLoginData, PollCliLoginError, PollCliLoginErrors, PollCliLoginInput, PollCliLoginResponse, PollCliLoginResponses, PrimitiveApiClient, PrimitiveApiClientOptions, PrimitiveApiError, PrimitiveApiErrorDetails, PrimitiveClient, PrimitiveClientOptions, Client as PrimitiveGeneratedApiClient, ClientOptions$1 as PrimitiveGeneratedApiClientOptions, Config as PrimitiveGeneratedApiConfig, Options$1 as PrimitiveGeneratedApiOptions, RequestOptions as PrimitiveGeneratedApiRequestOptions, RequestResult as PrimitiveGeneratedApiRequestResult, ReplayDeliveryData, ReplayDeliveryError, ReplayDeliveryErrors, ReplayDeliveryResponse, ReplayDeliveryResponses, ReplayEmailWebhooksData, ReplayEmailWebhooksError, ReplayEmailWebhooksErrors, ReplayEmailWebhooksResponse, ReplayEmailWebhooksResponses, ReplayResult, ReplyInput, ReplyToEmailData, ReplyToEmailError, ReplyToEmailErrors, ReplyToEmailResponse, ReplyToEmailResponses, RequestOptions$1 as RequestOptions, ResourceId, ResponseStyle, RotateWebhookSecretData, RotateWebhookSecretError, RotateWebhookSecretErrors, RotateWebhookSecretResponse, RotateWebhookSecretResponses, SearchEmailsData, SearchEmailsError, SearchEmailsErrors, SearchEmailsResponse, SearchEmailsResponses, SendEmailData, SendEmailError, SendEmailErrors, SendEmailResponse, SendEmailResponses, SendInput, SendMailInput, SendMailResult, SendPermissionAddress, SendPermissionAnyRecipient, SendPermissionManagedZone, SendPermissionRule, SendPermissionYourDomain, SendPermissionsMeta, SendResult, SendThreadInput, SentEmailDetail, SentEmailStatus, SentEmailSummary, SetFunctionSecretData, SetFunctionSecretError, SetFunctionSecretErrors, SetFunctionSecretInput, SetFunctionSecretResponse, SetFunctionSecretResponses, StartCliLoginData, StartCliLoginError, StartCliLoginErrors, StartCliLoginInput, StartCliLoginResponse, StartCliLoginResponses, StorageStats, SuccessEnvelope, TestEndpointData, TestEndpointError, TestEndpointErrors, TestEndpointResponse, TestEndpointResponses, TestFunctionData, TestFunctionError, TestFunctionErrors, TestFunctionResponse, TestFunctionResponses, TestInvocationResult, TestResult, UnverifiedDomain, UpdateAccountData, UpdateAccountError, UpdateAccountErrors, UpdateAccountInput, UpdateAccountResponse, UpdateAccountResponses, UpdateDomainData, UpdateDomainError, UpdateDomainErrors, UpdateDomainInput, UpdateDomainResponse, UpdateDomainResponses, UpdateEndpointData, UpdateEndpointError, UpdateEndpointErrors, UpdateEndpointInput, UpdateEndpointResponse, UpdateEndpointResponses, UpdateFilterData, UpdateFilterError, UpdateFilterErrors, UpdateFilterInput, UpdateFilterResponse, UpdateFilterResponses, UpdateFunctionData, UpdateFunctionError, UpdateFunctionErrors, UpdateFunctionInput, UpdateFunctionResponse, UpdateFunctionResponses, VerifiedDomain, VerifyDomainData, VerifyDomainError, VerifyDomainErrors, VerifyDomainResponse, VerifyDomainResponses, WebhookSecret, addDomain, cliLogout, client, createEndpoint, createFilter, createFunction, createFunctionSecret, createPrimitiveApiClient, createPrimitiveClient, deleteDomain, deleteEmail, deleteEndpoint, deleteFilter, deleteFunction, deleteFunctionSecret, discardEmailContent, downloadAttachments, downloadRawEmail, getAccount, getEmail, getFunction, getSendPermissions, getSentEmail, getStorageStats, getWebhookSecret, listDeliveries, listDomains, listEmails, listEndpoints, listFilters, listFunctionSecrets, listFunctions, listSentEmails, operations, pollCliLogin, replayDelivery, replayEmailWebhooks, replyToEmail, rotateWebhookSecret, searchEmails, sendEmail, setFunctionSecret, startCliLogin, testEndpoint, testFunction, updateAccount, updateDomain, updateEndpoint, updateFilter, updateFunction, verifyDomain };
|
package/dist/api/index.js
CHANGED
|
@@ -7,7 +7,17 @@
|
|
|
7
7
|
import { formatAddress } from "../webhook/received-email.js";
|
|
8
8
|
import { createClient, createConfig, } from "./generated/client/index.js";
|
|
9
9
|
import * as generatedOperations from "./generated/sdk.gen.js";
|
|
10
|
-
|
|
10
|
+
// Default production hosts. Two-host split exists because /send-mail
|
|
11
|
+
// needs a larger body cap than Vercel allows; host 2 is a Cloudflare
|
|
12
|
+
// Worker that accepts ~30 MiB raw. Host 1 carries everything else.
|
|
13
|
+
// Customers don't see this split: PrimitiveClient.send() always routes
|
|
14
|
+
// to host 2 internally, every other operation routes to host 1.
|
|
15
|
+
//
|
|
16
|
+
// Both base URLs are independently overridable via constructor options.
|
|
17
|
+
// Override is for internal staging/local testing; not part of the
|
|
18
|
+
// publicly-supported surface.
|
|
19
|
+
export const DEFAULT_API_BASE_URL_1 = "https://www.primitive.dev/api/v1";
|
|
20
|
+
export const DEFAULT_API_BASE_URL_2 = "https://api.primitive.dev/v1";
|
|
11
21
|
const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
12
22
|
const MAX_THREAD_REFERENCES = 100;
|
|
13
23
|
const MAX_THREAD_HEADER_BYTES = 8 * 1024;
|
|
@@ -155,13 +165,35 @@ function parseRetryAfterHeader(response) {
|
|
|
155
165
|
return Number.isFinite(seconds) ? seconds : undefined;
|
|
156
166
|
}
|
|
157
167
|
export class PrimitiveApiClient {
|
|
168
|
+
/**
|
|
169
|
+
* Generated client targeting the primary API host (apiBaseUrl1). Use
|
|
170
|
+
* this when passing `client: ...` to a generated operation function
|
|
171
|
+
* for every endpoint EXCEPT /send-mail. The hand-written
|
|
172
|
+
* PrimitiveClient.send / .reply / .forward methods on the subclass
|
|
173
|
+
* route /send-mail to the host-2 client internally.
|
|
174
|
+
*/
|
|
158
175
|
client;
|
|
176
|
+
/**
|
|
177
|
+
* @internal Generated client targeting the attachments-supporting
|
|
178
|
+
* send host (apiBaseUrl2). Used by PrimitiveClient.send() under the
|
|
179
|
+
* hood. Exposed for the CLI's hand-rolled send command, which calls
|
|
180
|
+
* the generated sendEmail directly; not part of the publicly-
|
|
181
|
+
* documented SDK surface. Customer code should call .send() on the
|
|
182
|
+
* subclass instead.
|
|
183
|
+
*/
|
|
184
|
+
_sendClient;
|
|
159
185
|
constructor(options = {}) {
|
|
160
|
-
const { apiKey, auth,
|
|
186
|
+
const { apiKey, auth, apiBaseUrl1 = DEFAULT_API_BASE_URL_1, apiBaseUrl2 = DEFAULT_API_BASE_URL_2, ...config } = options;
|
|
187
|
+
const resolvedAuth = auth ?? createDefaultAuth(apiKey);
|
|
161
188
|
this.client = createClient(createConfig({
|
|
162
189
|
...config,
|
|
163
|
-
auth:
|
|
164
|
-
baseUrl,
|
|
190
|
+
auth: resolvedAuth,
|
|
191
|
+
baseUrl: apiBaseUrl1,
|
|
192
|
+
}));
|
|
193
|
+
this._sendClient = createClient(createConfig({
|
|
194
|
+
...config,
|
|
195
|
+
auth: resolvedAuth,
|
|
196
|
+
baseUrl: apiBaseUrl2,
|
|
165
197
|
}));
|
|
166
198
|
}
|
|
167
199
|
getConfig() {
|
|
@@ -219,7 +251,10 @@ export class PrimitiveClient extends PrimitiveApiClient {
|
|
|
219
251
|
const result = await generatedOperations.sendEmail({
|
|
220
252
|
body,
|
|
221
253
|
...resolveRequestOptions(options),
|
|
222
|
-
|
|
254
|
+
// /send-mail goes to the host that supports attachments. Same
|
|
255
|
+
// request body shape on both hosts; the host swap is the only
|
|
256
|
+
// difference. Callers don't see or configure this.
|
|
257
|
+
client: this._sendClient,
|
|
223
258
|
responseStyle: "fields",
|
|
224
259
|
});
|
|
225
260
|
return unwrapSendResult(result);
|
|
@@ -648,6 +648,7 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
|
|
|
648
648
|
replayEmailWebhooks: () => replayEmailWebhooks,
|
|
649
649
|
replyToEmail: () => replyToEmail,
|
|
650
650
|
rotateWebhookSecret: () => rotateWebhookSecret,
|
|
651
|
+
searchEmails: () => searchEmails,
|
|
651
652
|
sendEmail: () => sendEmail,
|
|
652
653
|
setFunctionSecret: () => setFunctionSecret,
|
|
653
654
|
startCliLogin: () => startCliLogin,
|
|
@@ -908,6 +909,30 @@ const listEmails = (options) => (options?.client ?? client$1).get({
|
|
|
908
909
|
...options
|
|
909
910
|
});
|
|
910
911
|
/**
|
|
912
|
+
* Search inbound emails
|
|
913
|
+
*
|
|
914
|
+
* Searches inbound emails with structured filters and optional
|
|
915
|
+
* full-text matching across parsed email fields. This endpoint is
|
|
916
|
+
* optimized for filtered inbox views and CLI polling workflows:
|
|
917
|
+
* callers that only need new accepted mail can pass
|
|
918
|
+
* `sort=received_at_asc`, `snippet=false`, `include_facets=false`,
|
|
919
|
+
* and a `date_from` timestamp.
|
|
920
|
+
*
|
|
921
|
+
* `q`, `subject`, and `body` use the same English full-text index
|
|
922
|
+
* as the web inbox search. Structured filters such as `from`, `to`,
|
|
923
|
+
* `domain_id`, status, attachment presence, and spam score bounds
|
|
924
|
+
* are combined with the text query.
|
|
925
|
+
*
|
|
926
|
+
*/
|
|
927
|
+
const searchEmails = (options) => (options?.client ?? client$1).get({
|
|
928
|
+
security: [{
|
|
929
|
+
scheme: "bearer",
|
|
930
|
+
type: "http"
|
|
931
|
+
}],
|
|
932
|
+
url: "/emails/search",
|
|
933
|
+
...options
|
|
934
|
+
});
|
|
935
|
+
/**
|
|
911
936
|
* Delete an email
|
|
912
937
|
*/
|
|
913
938
|
const deleteEmail = (options) => (options.client ?? client$1).delete({
|
|
@@ -1307,6 +1332,15 @@ const getSendPermissions = (options) => (options?.client ?? client$1).get({
|
|
|
1307
1332
|
* the request returns once the relay accepts the message for delivery.
|
|
1308
1333
|
* Set `wait: true` to wait for the first downstream SMTP delivery outcome.
|
|
1309
1334
|
*
|
|
1335
|
+
* **Host routing.** /send-mail is served by the attachments-
|
|
1336
|
+
* supporting host (`https://api.primitive.dev/v1`) so the
|
|
1337
|
+
* request body can carry inline attachments up to ~30 MiB raw.
|
|
1338
|
+
* The primary host (`https://www.primitive.dev/api/v1`) also
|
|
1339
|
+
* accepts /send-mail for attachment-free sends; sends WITH
|
|
1340
|
+
* attachments to the primary host return 413
|
|
1341
|
+
* `attachments_unsupported_on_this_endpoint`. The typed SDKs
|
|
1342
|
+
* route /send-mail to the attachments host automatically.
|
|
1343
|
+
*
|
|
1310
1344
|
*/
|
|
1311
1345
|
const sendEmail = (options) => (options.client ?? client$1).post({
|
|
1312
1346
|
security: [{
|
|
@@ -1606,7 +1640,8 @@ const setFunctionSecret = (options) => (options.client ?? client$1).put({
|
|
|
1606
1640
|
});
|
|
1607
1641
|
//#endregion
|
|
1608
1642
|
//#region src/api/index.ts
|
|
1609
|
-
const
|
|
1643
|
+
const DEFAULT_API_BASE_URL_1 = "https://www.primitive.dev/api/v1";
|
|
1644
|
+
const DEFAULT_API_BASE_URL_2 = "https://api.primitive.dev/v1";
|
|
1610
1645
|
const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
1611
1646
|
const MAX_THREAD_REFERENCES = 100;
|
|
1612
1647
|
const MAX_THREAD_HEADER_BYTES = 8 * 1024;
|
|
@@ -1712,13 +1747,35 @@ function parseRetryAfterHeader(response) {
|
|
|
1712
1747
|
return Number.isFinite(seconds) ? seconds : void 0;
|
|
1713
1748
|
}
|
|
1714
1749
|
var PrimitiveApiClient = class {
|
|
1750
|
+
/**
|
|
1751
|
+
* Generated client targeting the primary API host (apiBaseUrl1). Use
|
|
1752
|
+
* this when passing `client: ...` to a generated operation function
|
|
1753
|
+
* for every endpoint EXCEPT /send-mail. The hand-written
|
|
1754
|
+
* PrimitiveClient.send / .reply / .forward methods on the subclass
|
|
1755
|
+
* route /send-mail to the host-2 client internally.
|
|
1756
|
+
*/
|
|
1715
1757
|
client;
|
|
1758
|
+
/**
|
|
1759
|
+
* @internal Generated client targeting the attachments-supporting
|
|
1760
|
+
* send host (apiBaseUrl2). Used by PrimitiveClient.send() under the
|
|
1761
|
+
* hood. Exposed for the CLI's hand-rolled send command, which calls
|
|
1762
|
+
* the generated sendEmail directly; not part of the publicly-
|
|
1763
|
+
* documented SDK surface. Customer code should call .send() on the
|
|
1764
|
+
* subclass instead.
|
|
1765
|
+
*/
|
|
1766
|
+
_sendClient;
|
|
1716
1767
|
constructor(options = {}) {
|
|
1717
|
-
const { apiKey, auth,
|
|
1768
|
+
const { apiKey, auth, apiBaseUrl1 = DEFAULT_API_BASE_URL_1, apiBaseUrl2 = DEFAULT_API_BASE_URL_2, ...config } = options;
|
|
1769
|
+
const resolvedAuth = auth ?? createDefaultAuth(apiKey);
|
|
1718
1770
|
this.client = createClient(createConfig({
|
|
1719
1771
|
...config,
|
|
1720
|
-
auth:
|
|
1721
|
-
baseUrl
|
|
1772
|
+
auth: resolvedAuth,
|
|
1773
|
+
baseUrl: apiBaseUrl1
|
|
1774
|
+
}));
|
|
1775
|
+
this._sendClient = createClient(createConfig({
|
|
1776
|
+
...config,
|
|
1777
|
+
auth: resolvedAuth,
|
|
1778
|
+
baseUrl: apiBaseUrl2
|
|
1722
1779
|
}));
|
|
1723
1780
|
}
|
|
1724
1781
|
getConfig() {
|
|
@@ -1758,7 +1815,7 @@ var PrimitiveClient = class extends PrimitiveApiClient {
|
|
|
1758
1815
|
...input.waitTimeoutMs !== void 0 ? { wait_timeout_ms: input.waitTimeoutMs } : {}
|
|
1759
1816
|
},
|
|
1760
1817
|
...resolveRequestOptions(options),
|
|
1761
|
-
client: this.
|
|
1818
|
+
client: this._sendClient,
|
|
1762
1819
|
responseStyle: "fields"
|
|
1763
1820
|
}));
|
|
1764
1821
|
}
|
|
@@ -1870,4 +1927,4 @@ function client(options = {}) {
|
|
|
1870
1927
|
}
|
|
1871
1928
|
const operations = sdk_gen_exports;
|
|
1872
1929
|
//#endregion
|
|
1873
|
-
export {
|
|
1930
|
+
export { updateEndpoint as $, getStorageStats as A, pollCliLogin as B, downloadAttachments as C, getFunction as D, getEmail as E, listEndpoints as F, searchEmails as G, replayEmailWebhooks as H, listFilters as I, startCliLogin as J, sendEmail as K, listFunctionSecrets as L, listDeliveries as M, listDomains as N, getSendPermissions as O, listEmails as P, updateDomain as Q, listFunctions as R, discardEmailContent as S, getAccount as T, replyToEmail as U, replayDelivery as V, rotateWebhookSecret as W, testFunction as X, testEndpoint as Y, updateAccount as Z, deleteEmail as _, PrimitiveClient as a, deleteFunction as b, createPrimitiveClient as c, cliLogout as d, updateFilter as et, createEndpoint as f, deleteDomain as g, createFunctionSecret as h, PrimitiveApiError as i, getWebhookSecret as j, getSentEmail as k, operations as l, createFunction as m, DEFAULT_API_BASE_URL_2 as n, verifyDomain as nt, client as o, createFilter as p, setFunctionSecret as q, PrimitiveApiClient as r, createPrimitiveApiClient as s, DEFAULT_API_BASE_URL_1 as t, updateFunction as tt, addDomain as u, deleteEndpoint as v, downloadRawEmail as w, deleteFunctionSecret as x, deleteFilter as y, listSentEmails as z };
|