@primitivedotdev/sdk 0.18.0 → 0.20.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 +165 -65
- package/dist/api/generated/index.js +1 -1
- package/dist/api/generated/sdk.gen.js +254 -1
- package/dist/api/index.d.ts +2 -2
- package/dist/api/index.js +39 -7
- package/dist/{api-DrAZhxS-.js → api-DNF21MDo.js} +326 -7
- package/dist/contract/index.d.ts +2 -2
- package/dist/contract/index.js +1 -1
- package/dist/{index-CHWqMBs6.d.ts → index-C6ObsYjq.d.ts} +985 -73
- package/dist/{index-CbEivn3S.d.ts → index-CDlwyxdp.d.ts} +7 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/oclif/api-command.js +59 -6
- package/dist/oclif/auth.js +168 -0
- package/dist/oclif/commands/emails-latest.js +18 -4
- package/dist/oclif/commands/functions-deploy.js +108 -0
- package/dist/oclif/commands/functions-redeploy.js +97 -0
- package/dist/oclif/commands/login.js +233 -0
- package/dist/oclif/commands/logout.js +87 -0
- package/dist/oclif/commands/send.js +29 -7
- package/dist/oclif/commands/whoami.js +18 -4
- package/dist/oclif/fish-completion.js +1 -1
- package/dist/oclif/index.js +16 -0
- package/dist/openapi/openapi.generated.js +1303 -49
- package/dist/openapi/operations.generated.js +868 -1
- package/dist/webhook/index.d.ts +1 -1
- package/dist/webhook/index.js +1 -1
- package/dist/{webhook-zkN4wUTs.js → webhook-rUjGV6Zu.js} +4 -4
- package/oclif.manifest.json +1049 -94
- package/package.json +8 -2
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, ClientOptions, CreateClientConfig, CreateEndpointData, CreateEndpointError, CreateEndpointErrors, CreateEndpointInput, CreateEndpointResponse, CreateEndpointResponses, CreateFilterData, CreateFilterError, CreateFilterErrors, CreateFilterInput, CreateFilterResponse, CreateFilterResponses, Cursor, DEFAULT_BASE_URL, DeleteDomainData, DeleteDomainError, DeleteDomainErrors, DeleteDomainResponse, DeleteDomainResponses, DeleteEmailData, DeleteEmailError, DeleteEmailErrors, DeleteEmailResponse, DeleteEmailResponses, DeleteEndpointData, DeleteEndpointError, DeleteEndpointErrors, DeleteEndpointResponse, DeleteEndpointResponses, DeleteFilterData, DeleteFilterError, DeleteFilterErrors, DeleteFilterResponse, DeleteFilterResponses, DeliveryStatus, DeliverySummary, DiscardContentResult, DiscardEmailContentData, DiscardEmailContentError, DiscardEmailContentErrors, DiscardEmailContentResponse, DiscardEmailContentResponses, Domain, DomainVerifyResult, DownloadAttachmentsData, DownloadAttachmentsError, DownloadAttachmentsErrors, DownloadAttachmentsResponse, DownloadAttachmentsResponses, DownloadRawEmailData, DownloadRawEmailError, DownloadRawEmailErrors, DownloadRawEmailResponse, DownloadRawEmailResponses, EmailDetail, EmailDetailReply, EmailStatus, EmailSummary, EmailWebhookStatus, Endpoint, ErrorResponse, Filter, ForwardInput, GateDenial, GateFix, GetAccountData, GetAccountError, GetAccountErrors, GetAccountResponse, GetAccountResponses, GetEmailData, GetEmailError, GetEmailErrors, GetEmailResponse, GetEmailResponses, 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, ListSentEmailsData, ListSentEmailsError, ListSentEmailsErrors, ListSentEmailsResponse, ListSentEmailsResponses, Options, PaginationMeta, 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, ResourceId, ResponseStyle, RotateWebhookSecretData, RotateWebhookSecretError, RotateWebhookSecretErrors, RotateWebhookSecretResponse, RotateWebhookSecretResponses, SendEmailData, SendEmailError, SendEmailErrors, SendEmailResponse, SendEmailResponses, SendInput, SendMailInput, SendMailResult, SendPermissionAddress, SendPermissionAnyRecipient, SendPermissionManagedZone, SendPermissionRule, SendPermissionYourDomain, SendPermissionsMeta, SendResult, SendThreadInput, SentEmailDetail, SentEmailStatus, SentEmailSummary, StorageStats, SuccessEnvelope, TestEndpointData, TestEndpointError, TestEndpointErrors, TestEndpointResponse, TestEndpointResponses, 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, VerifiedDomain, VerifyDomainData, VerifyDomainError, VerifyDomainErrors, VerifyDomainResponse, VerifyDomainResponses, WebhookSecret, addDomain, client, createEndpoint, createFilter, createPrimitiveApiClient, createPrimitiveClient, deleteDomain, deleteEmail, deleteEndpoint, deleteFilter, discardEmailContent, downloadAttachments, downloadRawEmail, getAccount, getEmail, getSendPermissions, getSentEmail, getStorageStats, getWebhookSecret, listDeliveries, listDomains, listEmails, listEndpoints, listFilters, listSentEmails, operations, replayDelivery, replayEmailWebhooks, replyToEmail, rotateWebhookSecret, sendEmail, testEndpoint, updateAccount, updateDomain, updateEndpoint, updateFilter, verifyDomain };
|
|
1
|
+
import { $ as rotateWebhookSecret, $a as UpdateAccountData, $i as ReplyToEmailData, $n as EmailStatus, $r as ListDomainsData, $t as CreateFunctionSecretResponses, A as deleteFunctionSecret, Aa as SetFunctionSecretResponse, Ai as ListSentEmailsData, An as DeleteFunctionSecretResponses, Ao as VerifyDomainData, Ar as GetSendPermissionsResponse, At as CreateEndpointError, B as getWebhookSecret, Ba as TestEndpointData, Bi as PollCliLoginResponse, Bn as DomainVerifyResult, Bo as Options$1, Br as GetStorageStatsResponse, Bt as CreateFilterResponses, C as createFunction, Ca as SentEmailDetail, Ci as ListFunctionSecretsResponse, Cn as DeleteFunctionErrors, Co as UpdateFunctionData, Cr as GetFunctionError, Ct as CliLogoutErrors, D as deleteEndpoint, Da as SetFunctionSecretError, Di as ListFunctionsErrors, Dn as DeleteFunctionSecretError, Do as UpdateFunctionResponse, Dr as GetSendPermissionsData, Dt as CliLogoutResult, E as deleteEmail, Ea as SetFunctionSecretData, Ei as ListFunctionsError, En as DeleteFunctionSecretData, Eo as UpdateFunctionInput, Er as GetFunctionResponses, Et as CliLogoutResponses, F as getEmail, Fa as StartCliLoginInput, Fi as PaginationMeta, Fn as DiscardEmailContentError, Fo as WebhookSecret, Fr as GetSentEmailResponse, Ft as CreateFilterData, G as listFilters, Ga as TestFunctionData, Gi as ReplayDeliveryResponse, Gn as DownloadAttachmentsResponses, Gr as GetWebhookSecretResponse, Gt as CreateFunctionResponse, H as listDomains, Ha as TestEndpointErrors, Hi as ReplayDeliveryData, Hn as DownloadAttachmentsError, Ho as RequestResult, Hr as GetWebhookSecretData, Ht as CreateFunctionError, I as getFunction, Ia as StartCliLoginResponse, Ii as PollCliLoginData, In as DiscardEmailContentErrors, Io as Client, Ir as GetSentEmailResponses, It as CreateFilterError, J as listSentEmails, Ja as TestFunctionResponse, Ji as ReplayEmailWebhooksError, Jn as DownloadRawEmailErrors, Jr as ListDeliveriesData, Jt as CreateFunctionSecretData, K as listFunctionSecrets, Ka as TestFunctionError, Ki as ReplayDeliveryResponses, Kn as DownloadRawEmailData, Kr as GetWebhookSecretResponses, Kt as CreateFunctionResponses, L as getSendPermissions, La as StartCliLoginResponses, Li as PollCliLoginError, Ln as DiscardEmailContentResponse, Lo as ClientOptions$1, Lr as GetStorageStatsData, Lt as CreateFilterErrors, M as downloadAttachments, Ma as StartCliLoginData, Mi as ListSentEmailsErrors, Mn as DeliverySummary, Mo as VerifyDomainErrors, Mr as GetSentEmailData, Mt as CreateEndpointInput, N as downloadRawEmail, Na as StartCliLoginError, Ni as ListSentEmailsResponse, Nn as DiscardContentResult, No as VerifyDomainResponse, Nr as GetSentEmailError, Nt as CreateEndpointResponse, O as deleteFilter, Oa as SetFunctionSecretErrors, Oi as ListFunctionsResponse, On as DeleteFunctionSecretErrors, Oo as UpdateFunctionResponses, Or as GetSendPermissionsError, Ot as ClientOptions, P as getAccount, Pa as StartCliLoginErrors, Pi as ListSentEmailsResponses, Pn as DiscardEmailContentData, Po as VerifyDomainResponses, Pr as GetSentEmailErrors, Pt as CreateEndpointResponses, Q as replyToEmail, Qa as UnverifiedDomain, Qi as ReplayResult, Qn as EmailDetailReply, Qr as ListDeliveriesResponses, Qt as CreateFunctionSecretResponse, R as getSentEmail, Ra as StorageStats, Ri as PollCliLoginErrors, Rn as DiscardEmailContentResponses, Ro as Config, Rr as GetStorageStatsError, Rt as CreateFilterInput, S as createFilter, Sa as SendPermissionsMeta, Si as ListFunctionSecretsErrors, Sn as DeleteFunctionError, So as UpdateFilterResponses, Sr as GetFunctionData, St as CliLogoutError, T as deleteDomain, Ta as SentEmailSummary, Ti as ListFunctionsData, Tn as DeleteFunctionResponses, To as UpdateFunctionErrors, Tr as GetFunctionResponse, Tt as CliLogoutResponse, U as listEmails, Ua as TestEndpointResponse, Ui as ReplayDeliveryError, Un as DownloadAttachmentsErrors, Uo as ResponseStyle, Ur as GetWebhookSecretError, Ut as CreateFunctionErrors, V as listDeliveries, Va as TestEndpointError, Vi as PollCliLoginResponses, Vn as DownloadAttachmentsData, Vo as RequestOptions, Vr as GetStorageStatsResponses, Vt as CreateFunctionData, W as listEndpoints, Wa as TestEndpointResponses, Wi as ReplayDeliveryErrors, Wn as DownloadAttachmentsResponse, Wo as Auth, Wr as GetWebhookSecretErrors, Wt as CreateFunctionInput, X as replayDelivery, Xa as TestInvocationResult, Xi as ReplayEmailWebhooksResponse, Xn as DownloadRawEmailResponses, Xr as ListDeliveriesErrors, Xt as CreateFunctionSecretErrors, Y as pollCliLogin, Ya as TestFunctionResponses, Yi as ReplayEmailWebhooksErrors, Yn as DownloadRawEmailResponse, Yr as ListDeliveriesError, Yt as CreateFunctionSecretError, Z as replayEmailWebhooks, Za as TestResult, Zi as ReplayEmailWebhooksResponses, Zn as EmailDetail, Zr as ListDeliveriesResponse, Zt as CreateFunctionSecretInput, _ as operations, _a as SendPermissionAddress, _i as ListFiltersErrors, _n as DeleteFilterError, _o as UpdateFilterData, _r as GetEmailData, _t as AddDomainResponse, a as PrimitiveApiError, aa as RotateWebhookSecretData, ai as ListEmailsError, an as DeleteDomainResponses, ao as UpdateDomainData, ar as FunctionDeployStatus, at as updateAccount, b as cliLogout, ba as SendPermissionRule, bi as ListFunctionSecretsData, bn as DeleteFilterResponses, bo as UpdateFilterInput, br as GetEmailResponse, bt as CliLoginStartResult, c as PrimitiveClientOptions, ca as RotateWebhookSecretResponse, ci as ListEmailsResponses, cn as DeleteEmailErrors, co as UpdateDomainInput, cr as FunctionSecretListItem, ct as updateFilter, d as SendInput, da as SendEmailError, di as ListEndpointsErrors, dn as DeleteEndpointData, do as UpdateEndpointData, dr as GateFix, dt as Account, ea as ReplyToEmailError, ei as ListDomainsError, en as Cursor, eo as UpdateAccountError, er as EmailSummary, et as sendEmail, f as SendResult, fa as SendEmailErrors, fi as ListEndpointsResponse, fn as DeleteEndpointError, fo as UpdateEndpointError, fr as GetAccountData, ft as AccountUpdated, g as createPrimitiveClient, ga as SendMailResult, gi as ListFiltersError, gn as DeleteFilterData, go as UpdateEndpointResponses, gr as GetAccountResponses, gt as AddDomainInput, h as createPrimitiveApiClient, ha as SendMailInput, hi as ListFiltersData, hn as DeleteEndpointResponses, ho as UpdateEndpointResponse, hr as GetAccountResponse, ht as AddDomainErrors, i as PrimitiveApiClientOptions, ia as ResourceId, ii as ListEmailsData, in as DeleteDomainResponse, io as UpdateAccountResponses, ir as Filter, it as testFunction, j as discardEmailContent, ja as SetFunctionSecretResponses, ji as ListSentEmailsError, jn as DeliveryStatus, jo as VerifyDomainError, jr as GetSendPermissionsResponses, jt as CreateEndpointErrors, k as deleteFunction, ka as SetFunctionSecretInput, ki as ListFunctionsResponses, kn as DeleteFunctionSecretResponse, ko as VerifiedDomain, kr as GetSendPermissionsErrors, kt as CreateEndpointData, l as ReplyInput, la as RotateWebhookSecretResponses, li as ListEndpointsData, ln as DeleteEmailResponse, lo as UpdateDomainResponse, lr as FunctionSecretWriteResult, lt as updateFunction, m as client, ma as SendEmailResponses, mi as ListEnvelope, mn as DeleteEndpointResponse, mo as UpdateEndpointInput, mr as GetAccountErrors, mt as AddDomainError, n as ForwardInput, na as ReplyToEmailResponse, ni as ListDomainsResponse, nn as DeleteDomainError, no as UpdateAccountInput, nr as Endpoint, nt as startCliLogin, o as PrimitiveApiErrorDetails, oa as RotateWebhookSecretError, oi as ListEmailsErrors, on as DeleteEmailData, oo as UpdateDomainError, or as FunctionDetail, ot as updateDomain, p as SendThreadInput, pa as SendEmailResponse, pi as ListEndpointsResponses, pn as DeleteEndpointErrors, po as UpdateEndpointErrors, pr as GetAccountError, pt as AddDomainData, q as listFunctions, qa as TestFunctionErrors, qi as ReplayEmailWebhooksData, qn as DownloadRawEmailError, qr as Limit, qt as CreateFunctionResult, r as PrimitiveApiClient, ra as ReplyToEmailResponses, ri as ListDomainsResponses, rn as DeleteDomainErrors, ro as UpdateAccountResponse, rr as ErrorResponse, rt as testEndpoint, s as PrimitiveClient, sa as RotateWebhookSecretErrors, si as ListEmailsResponse, sn as DeleteEmailError, so as UpdateDomainErrors, sr as FunctionListItem, st as updateEndpoint, t as DEFAULT_BASE_URL, ta as ReplyToEmailErrors, ti as ListDomainsErrors, tn as DeleteDomainData, to as UpdateAccountErrors, tr as EmailWebhookStatus, tt as setFunctionSecret, u as RequestOptions$1, ua as SendEmailData, ui as ListEndpointsError, un as DeleteEmailResponses, uo as UpdateDomainResponses, ur as GateDenial, ut as verifyDomain, v as Options, va as SendPermissionAnyRecipient, vi as ListFiltersResponse, vn as DeleteFilterErrors, vo as UpdateFilterError, vr as GetEmailError, vt as AddDomainResponses, w as createFunctionSecret, wa as SentEmailStatus, wi as ListFunctionSecretsResponses, wn as DeleteFunctionResponse, wo as UpdateFunctionError, wr as GetFunctionErrors, wt as CliLogoutInput, x as createEndpoint, xa as SendPermissionYourDomain, xi as ListFunctionSecretsError, xn as DeleteFunctionData, xo as UpdateFilterResponse, xr as GetEmailResponses, xt as CliLogoutData, y as addDomain, ya as SendPermissionManagedZone, yi as ListFiltersResponses, yn as DeleteFilterResponse, yo as UpdateFilterErrors, yr as GetEmailErrors, yt as CliLoginPollResult, z as getStorageStats, za as SuccessEnvelope, zi as PollCliLoginInput, zn as Domain, zo as CreateClientConfig, zr as GetStorageStatsErrors, zt as CreateFilterResponse } from "../index-C6ObsYjq.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_BASE_URL, 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, 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, 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, sendEmail, setFunctionSecret, startCliLogin, testEndpoint, testFunction, updateAccount, updateDomain, updateEndpoint, updateFilter, updateFunction, verifyDomain };
|
package/dist/api/index.js
CHANGED
|
@@ -140,6 +140,11 @@ export class PrimitiveApiError extends Error {
|
|
|
140
140
|
this.details = options.details;
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
+
function isAbortLikeError(error) {
|
|
144
|
+
if (!(error instanceof Error))
|
|
145
|
+
return false;
|
|
146
|
+
return error.name === "AbortError" || error.name === "TimeoutError";
|
|
147
|
+
}
|
|
143
148
|
function parseRetryAfterHeader(response) {
|
|
144
149
|
if (!response)
|
|
145
150
|
return undefined;
|
|
@@ -166,8 +171,33 @@ export class PrimitiveApiClient {
|
|
|
166
171
|
return this.client.setConfig(config);
|
|
167
172
|
}
|
|
168
173
|
}
|
|
174
|
+
function resolveRequestOptions(options) {
|
|
175
|
+
const signals = [];
|
|
176
|
+
if (options?.signal)
|
|
177
|
+
signals.push(options.signal);
|
|
178
|
+
if (options?.timeout !== undefined) {
|
|
179
|
+
signals.push(AbortSignal.timeout(options.timeout));
|
|
180
|
+
}
|
|
181
|
+
const signal = signals.length === 0
|
|
182
|
+
? undefined
|
|
183
|
+
: signals.length === 1
|
|
184
|
+
? signals[0]
|
|
185
|
+
: AbortSignal.any(signals);
|
|
186
|
+
const headers = {
|
|
187
|
+
...(options?.headers ?? {}),
|
|
188
|
+
...(options?.idempotencyKey
|
|
189
|
+
? { "Idempotency-Key": options.idempotencyKey }
|
|
190
|
+
: {}),
|
|
191
|
+
};
|
|
192
|
+
const resolved = {};
|
|
193
|
+
if (signal)
|
|
194
|
+
resolved.signal = signal;
|
|
195
|
+
if (Object.keys(headers).length > 0)
|
|
196
|
+
resolved.headers = headers;
|
|
197
|
+
return resolved;
|
|
198
|
+
}
|
|
169
199
|
export class PrimitiveClient extends PrimitiveApiClient {
|
|
170
|
-
async send(input) {
|
|
200
|
+
async send(input, options) {
|
|
171
201
|
validateSendInput(input);
|
|
172
202
|
const body = {
|
|
173
203
|
from: input.from,
|
|
@@ -188,9 +218,7 @@ export class PrimitiveClient extends PrimitiveApiClient {
|
|
|
188
218
|
};
|
|
189
219
|
const result = await generatedOperations.sendEmail({
|
|
190
220
|
body,
|
|
191
|
-
...(
|
|
192
|
-
? { headers: { "Idempotency-Key": input.idempotencyKey } }
|
|
193
|
-
: {}),
|
|
221
|
+
...resolveRequestOptions(options),
|
|
194
222
|
client: this.client,
|
|
195
223
|
responseStyle: "fields",
|
|
196
224
|
});
|
|
@@ -210,7 +238,7 @@ export class PrimitiveClient extends PrimitiveApiClient {
|
|
|
210
238
|
* subject match to thread, so a custom subject silently breaks the
|
|
211
239
|
* thread for half the recipient population.
|
|
212
240
|
*/
|
|
213
|
-
async reply(email, input) {
|
|
241
|
+
async reply(email, input, options) {
|
|
214
242
|
const resolved = typeof input === "string" ? { text: input } : input;
|
|
215
243
|
// Reject the subject override at runtime so a JS caller (no TS
|
|
216
244
|
// types) gets the same loud error as a TS caller. Without this,
|
|
@@ -234,19 +262,20 @@ export class PrimitiveClient extends PrimitiveApiClient {
|
|
|
234
262
|
const result = await generatedOperations.replyToEmail({
|
|
235
263
|
body,
|
|
236
264
|
path: { id: email.id },
|
|
265
|
+
...resolveRequestOptions(options),
|
|
237
266
|
client: this.client,
|
|
238
267
|
responseStyle: "fields",
|
|
239
268
|
});
|
|
240
269
|
return unwrapSendResult(result);
|
|
241
270
|
}
|
|
242
|
-
async forward(email, input) {
|
|
271
|
+
async forward(email, input, options) {
|
|
243
272
|
validateForwardInput(input);
|
|
244
273
|
return this.send({
|
|
245
274
|
from: input.from ?? email.receivedBy,
|
|
246
275
|
to: input.to,
|
|
247
276
|
subject: input.subject ?? email.forwardSubject,
|
|
248
277
|
bodyText: buildForwardText(email, input.bodyText),
|
|
249
|
-
});
|
|
278
|
+
}, options);
|
|
250
279
|
}
|
|
251
280
|
}
|
|
252
281
|
function buildForwardText(email, intro) {
|
|
@@ -276,6 +305,9 @@ function buildForwardText(email, intro) {
|
|
|
276
305
|
function unwrapSendResult(result) {
|
|
277
306
|
const response = result.response;
|
|
278
307
|
if (result.error) {
|
|
308
|
+
if (isAbortLikeError(result.error)) {
|
|
309
|
+
throw result.error;
|
|
310
|
+
}
|
|
279
311
|
const parsed = parseApiErrorPayload(result.error);
|
|
280
312
|
throw new PrimitiveApiError(parsed.message, {
|
|
281
313
|
payload: result.error,
|
|
@@ -614,17 +614,23 @@ const client$1 = createClient(createConfig({ baseUrl: "https://www.primitive.dev
|
|
|
614
614
|
//#region src/api/generated/sdk.gen.ts
|
|
615
615
|
var sdk_gen_exports = /* @__PURE__ */ __exportAll({
|
|
616
616
|
addDomain: () => addDomain,
|
|
617
|
+
cliLogout: () => cliLogout,
|
|
617
618
|
createEndpoint: () => createEndpoint,
|
|
618
619
|
createFilter: () => createFilter,
|
|
620
|
+
createFunction: () => createFunction,
|
|
621
|
+
createFunctionSecret: () => createFunctionSecret,
|
|
619
622
|
deleteDomain: () => deleteDomain,
|
|
620
623
|
deleteEmail: () => deleteEmail,
|
|
621
624
|
deleteEndpoint: () => deleteEndpoint,
|
|
622
625
|
deleteFilter: () => deleteFilter,
|
|
626
|
+
deleteFunction: () => deleteFunction,
|
|
627
|
+
deleteFunctionSecret: () => deleteFunctionSecret,
|
|
623
628
|
discardEmailContent: () => discardEmailContent,
|
|
624
629
|
downloadAttachments: () => downloadAttachments,
|
|
625
630
|
downloadRawEmail: () => downloadRawEmail,
|
|
626
631
|
getAccount: () => getAccount,
|
|
627
632
|
getEmail: () => getEmail,
|
|
633
|
+
getFunction: () => getFunction,
|
|
628
634
|
getSendPermissions: () => getSendPermissions,
|
|
629
635
|
getSentEmail: () => getSentEmail,
|
|
630
636
|
getStorageStats: () => getStorageStats,
|
|
@@ -634,20 +640,78 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
|
|
|
634
640
|
listEmails: () => listEmails,
|
|
635
641
|
listEndpoints: () => listEndpoints,
|
|
636
642
|
listFilters: () => listFilters,
|
|
643
|
+
listFunctionSecrets: () => listFunctionSecrets,
|
|
644
|
+
listFunctions: () => listFunctions,
|
|
637
645
|
listSentEmails: () => listSentEmails,
|
|
646
|
+
pollCliLogin: () => pollCliLogin,
|
|
638
647
|
replayDelivery: () => replayDelivery,
|
|
639
648
|
replayEmailWebhooks: () => replayEmailWebhooks,
|
|
640
649
|
replyToEmail: () => replyToEmail,
|
|
641
650
|
rotateWebhookSecret: () => rotateWebhookSecret,
|
|
642
651
|
sendEmail: () => sendEmail,
|
|
652
|
+
setFunctionSecret: () => setFunctionSecret,
|
|
653
|
+
startCliLogin: () => startCliLogin,
|
|
643
654
|
testEndpoint: () => testEndpoint,
|
|
655
|
+
testFunction: () => testFunction,
|
|
644
656
|
updateAccount: () => updateAccount,
|
|
645
657
|
updateDomain: () => updateDomain,
|
|
646
658
|
updateEndpoint: () => updateEndpoint,
|
|
647
659
|
updateFilter: () => updateFilter,
|
|
660
|
+
updateFunction: () => updateFunction,
|
|
648
661
|
verifyDomain: () => verifyDomain
|
|
649
662
|
});
|
|
650
663
|
/**
|
|
664
|
+
* Start CLI browser login
|
|
665
|
+
*
|
|
666
|
+
* Starts a browser-assisted CLI login session. The response includes a
|
|
667
|
+
* device code for polling and a user code that the user approves in the
|
|
668
|
+
* browser. This endpoint does not require an API key.
|
|
669
|
+
*
|
|
670
|
+
*/
|
|
671
|
+
const startCliLogin = (options) => (options?.client ?? client$1).post({
|
|
672
|
+
url: "/cli/login/start",
|
|
673
|
+
...options,
|
|
674
|
+
headers: {
|
|
675
|
+
"Content-Type": "application/json",
|
|
676
|
+
...options?.headers
|
|
677
|
+
}
|
|
678
|
+
});
|
|
679
|
+
/**
|
|
680
|
+
* Poll CLI browser login
|
|
681
|
+
*
|
|
682
|
+
* Polls a CLI login session until the browser approval either succeeds,
|
|
683
|
+
* is denied, expires, or is polled too quickly. The API key is generated
|
|
684
|
+
* only after approval and is returned exactly once.
|
|
685
|
+
*
|
|
686
|
+
*/
|
|
687
|
+
const pollCliLogin = (options) => (options.client ?? client$1).post({
|
|
688
|
+
url: "/cli/login/poll",
|
|
689
|
+
...options,
|
|
690
|
+
headers: {
|
|
691
|
+
"Content-Type": "application/json",
|
|
692
|
+
...options.headers
|
|
693
|
+
}
|
|
694
|
+
});
|
|
695
|
+
/**
|
|
696
|
+
* Revoke the current CLI API key
|
|
697
|
+
*
|
|
698
|
+
* Revokes the API key used to authenticate the request. CLI clients use
|
|
699
|
+
* this endpoint during `primitive logout` before removing local credentials.
|
|
700
|
+
*
|
|
701
|
+
*/
|
|
702
|
+
const cliLogout = (options) => (options?.client ?? client$1).post({
|
|
703
|
+
security: [{
|
|
704
|
+
scheme: "bearer",
|
|
705
|
+
type: "http"
|
|
706
|
+
}],
|
|
707
|
+
url: "/cli/logout",
|
|
708
|
+
...options,
|
|
709
|
+
headers: {
|
|
710
|
+
"Content-Type": "application/json",
|
|
711
|
+
...options?.headers
|
|
712
|
+
}
|
|
713
|
+
});
|
|
714
|
+
/**
|
|
651
715
|
* Get account info
|
|
652
716
|
*/
|
|
653
717
|
const getAccount = (options) => (options?.client ?? client$1).get({
|
|
@@ -988,7 +1052,7 @@ const replayEmailWebhooks = (options) => (options.client ?? client$1).post({
|
|
|
988
1052
|
* dashboard at Settings > Webhooks). When the toggle is off, this
|
|
989
1053
|
* endpoint returns `403` with code `discard_not_enabled` and a
|
|
990
1054
|
* message pointing the human at the dashboard. There is intentionally
|
|
991
|
-
* no API to flip this toggle
|
|
1055
|
+
* no API to flip this toggle. Opting in to a destructive,
|
|
992
1056
|
* non-reversible operation must be a deliberate human click in the
|
|
993
1057
|
* UI.
|
|
994
1058
|
*
|
|
@@ -1305,6 +1369,241 @@ const getSentEmail = (options) => (options.client ?? client$1).get({
|
|
|
1305
1369
|
url: "/sent-emails/{id}",
|
|
1306
1370
|
...options
|
|
1307
1371
|
});
|
|
1372
|
+
/**
|
|
1373
|
+
* List functions
|
|
1374
|
+
*
|
|
1375
|
+
* Returns every active (non-deleted) function in the org, newest
|
|
1376
|
+
* first. Each entry carries the deploy status and the gateway URL
|
|
1377
|
+
* that the platform's webhook delivery loop posts to. To inspect
|
|
1378
|
+
* the source code or deploy errors, use `GET /functions/{id}`.
|
|
1379
|
+
*
|
|
1380
|
+
*/
|
|
1381
|
+
const listFunctions = (options) => (options?.client ?? client$1).get({
|
|
1382
|
+
security: [{
|
|
1383
|
+
scheme: "bearer",
|
|
1384
|
+
type: "http"
|
|
1385
|
+
}],
|
|
1386
|
+
url: "/functions",
|
|
1387
|
+
...options
|
|
1388
|
+
});
|
|
1389
|
+
/**
|
|
1390
|
+
* Deploy a function
|
|
1391
|
+
*
|
|
1392
|
+
* Creates and deploys a new function. The handler must be a single
|
|
1393
|
+
* ESM module that exports a default async function receiving the
|
|
1394
|
+
* `email.received` event (see the Webhook payload section for the
|
|
1395
|
+
* full schema). Code is bundled before being uploaded; ship a
|
|
1396
|
+
* single self-contained file rather than relying on external
|
|
1397
|
+
* imports.
|
|
1398
|
+
*
|
|
1399
|
+
* **Code limits.** `code` is capped at 1 MiB UTF-8. `sourceMap`
|
|
1400
|
+
* (optional) is capped at 5 MiB UTF-8 and is stored only on the
|
|
1401
|
+
* edge runtime side; it is not persisted in Primitive's database.
|
|
1402
|
+
*
|
|
1403
|
+
* **Auto-wiring.** On successful deploy, Primitive automatically
|
|
1404
|
+
* creates a webhook endpoint that delivers inbound mail to the
|
|
1405
|
+
* function. There is nothing to configure on the Endpoints API
|
|
1406
|
+
* for this to work; the gateway URL returned here is for
|
|
1407
|
+
* reference only and is not directly callable from outside.
|
|
1408
|
+
*
|
|
1409
|
+
* **Secrets.** New functions ship with the managed secrets
|
|
1410
|
+
* (`PRIMITIVE_WEBHOOK_SECRET`, `PRIMITIVE_API_KEY`) already
|
|
1411
|
+
* bound. Add user-set secrets via
|
|
1412
|
+
* `POST /functions/{id}/secrets`; secret writes only land in the
|
|
1413
|
+
* running handler on the next redeploy.
|
|
1414
|
+
*
|
|
1415
|
+
*/
|
|
1416
|
+
const createFunction = (options) => (options.client ?? client$1).post({
|
|
1417
|
+
security: [{
|
|
1418
|
+
scheme: "bearer",
|
|
1419
|
+
type: "http"
|
|
1420
|
+
}],
|
|
1421
|
+
url: "/functions",
|
|
1422
|
+
...options,
|
|
1423
|
+
headers: {
|
|
1424
|
+
"Content-Type": "application/json",
|
|
1425
|
+
...options.headers
|
|
1426
|
+
}
|
|
1427
|
+
});
|
|
1428
|
+
/**
|
|
1429
|
+
* Delete a function
|
|
1430
|
+
*
|
|
1431
|
+
* Soft-deletes the function row, removes the script from the edge
|
|
1432
|
+
* runtime, and deactivates the auto-wired webhook endpoint so no
|
|
1433
|
+
* further inbound mail is delivered. Past deploy history,
|
|
1434
|
+
* invocations, and logs are retained.
|
|
1435
|
+
*
|
|
1436
|
+
* Returns 502 if the runtime delete fails partway; the function
|
|
1437
|
+
* row stays in place and the call is safe to retry until it
|
|
1438
|
+
* succeeds.
|
|
1439
|
+
*
|
|
1440
|
+
*/
|
|
1441
|
+
const deleteFunction = (options) => (options.client ?? client$1).delete({
|
|
1442
|
+
security: [{
|
|
1443
|
+
scheme: "bearer",
|
|
1444
|
+
type: "http"
|
|
1445
|
+
}],
|
|
1446
|
+
url: "/functions/{id}",
|
|
1447
|
+
...options
|
|
1448
|
+
});
|
|
1449
|
+
/**
|
|
1450
|
+
* Get a function
|
|
1451
|
+
*
|
|
1452
|
+
* Returns the full record for a function, including its current
|
|
1453
|
+
* source code and the deploy status / error from the most recent
|
|
1454
|
+
* deploy attempt.
|
|
1455
|
+
*
|
|
1456
|
+
*/
|
|
1457
|
+
const getFunction = (options) => (options.client ?? client$1).get({
|
|
1458
|
+
security: [{
|
|
1459
|
+
scheme: "bearer",
|
|
1460
|
+
type: "http"
|
|
1461
|
+
}],
|
|
1462
|
+
url: "/functions/{id}",
|
|
1463
|
+
...options
|
|
1464
|
+
});
|
|
1465
|
+
/**
|
|
1466
|
+
* Update and redeploy a function
|
|
1467
|
+
*
|
|
1468
|
+
* Replaces the function's source code with the body's `code` and
|
|
1469
|
+
* triggers a redeploy. Same size limits as `POST /functions`.
|
|
1470
|
+
* Use this verb to push secret writes into the running handler:
|
|
1471
|
+
* passing the same `code` re-runs the deploy and refreshes the
|
|
1472
|
+
* binding set with the latest values from the secrets table.
|
|
1473
|
+
*
|
|
1474
|
+
* On a 502 deploy failure, the previously-deployed code stays
|
|
1475
|
+
* live; the runtime never serves a half-built bundle. The
|
|
1476
|
+
* `deploy_error` field on the returned record carries the error
|
|
1477
|
+
* that came back from the runtime so you can surface it to users
|
|
1478
|
+
* without polling.
|
|
1479
|
+
*
|
|
1480
|
+
*/
|
|
1481
|
+
const updateFunction = (options) => (options.client ?? client$1).put({
|
|
1482
|
+
security: [{
|
|
1483
|
+
scheme: "bearer",
|
|
1484
|
+
type: "http"
|
|
1485
|
+
}],
|
|
1486
|
+
url: "/functions/{id}",
|
|
1487
|
+
...options,
|
|
1488
|
+
headers: {
|
|
1489
|
+
"Content-Type": "application/json",
|
|
1490
|
+
...options.headers
|
|
1491
|
+
}
|
|
1492
|
+
});
|
|
1493
|
+
/**
|
|
1494
|
+
* Send a test invocation
|
|
1495
|
+
*
|
|
1496
|
+
* Sends a real test email from a Primitive-controlled sender to a
|
|
1497
|
+
* synthetic local-part on one of the org's verified inbound
|
|
1498
|
+
* domains. The function fires through the normal MX delivery
|
|
1499
|
+
* path, so reply / send-mail calls from inside the handler
|
|
1500
|
+
* against the inbound's `email.id` work the same as in
|
|
1501
|
+
* production. Returns immediately after the send is queued; the
|
|
1502
|
+
* invocation appears on the function's invocations list within a
|
|
1503
|
+
* few seconds.
|
|
1504
|
+
*
|
|
1505
|
+
* Requires that the function is currently `deployed`. Returns 422
|
|
1506
|
+
* if the function is in `pending` or `failed` state, or if the
|
|
1507
|
+
* org has no verified inbound domain to receive the test mail.
|
|
1508
|
+
*
|
|
1509
|
+
*/
|
|
1510
|
+
const testFunction = (options) => (options.client ?? client$1).post({
|
|
1511
|
+
security: [{
|
|
1512
|
+
scheme: "bearer",
|
|
1513
|
+
type: "http"
|
|
1514
|
+
}],
|
|
1515
|
+
url: "/functions/{id}/test",
|
|
1516
|
+
...options
|
|
1517
|
+
});
|
|
1518
|
+
/**
|
|
1519
|
+
* List a function's secrets
|
|
1520
|
+
*
|
|
1521
|
+
* Returns metadata for every secret bound to the function, with
|
|
1522
|
+
* managed entries (provisioned by Primitive) listed first and
|
|
1523
|
+
* user-set entries listed alphabetically after. **Values are
|
|
1524
|
+
* never returned.** Secret writes are write-only.
|
|
1525
|
+
*
|
|
1526
|
+
* Managed entries (e.g. `PRIMITIVE_WEBHOOK_SECRET`,
|
|
1527
|
+
* `PRIMITIVE_API_KEY`) carry a `description` instead of
|
|
1528
|
+
* `created_at` / `updated_at`. They cannot be created, updated,
|
|
1529
|
+
* or deleted via this API.
|
|
1530
|
+
*
|
|
1531
|
+
*/
|
|
1532
|
+
const listFunctionSecrets = (options) => (options.client ?? client$1).get({
|
|
1533
|
+
security: [{
|
|
1534
|
+
scheme: "bearer",
|
|
1535
|
+
type: "http"
|
|
1536
|
+
}],
|
|
1537
|
+
url: "/functions/{id}/secrets",
|
|
1538
|
+
...options
|
|
1539
|
+
});
|
|
1540
|
+
/**
|
|
1541
|
+
* Create or update a secret
|
|
1542
|
+
*
|
|
1543
|
+
* Idempotent insert-or-update keyed on `(function_id, key)`.
|
|
1544
|
+
* Returns 201 the first time the key is set, 200 on subsequent
|
|
1545
|
+
* updates. Values are encrypted at rest and only become visible
|
|
1546
|
+
* to the running handler on the next deploy (`PUT /functions/{id}`
|
|
1547
|
+
* with the existing code is sufficient to refresh bindings).
|
|
1548
|
+
*
|
|
1549
|
+
* Keys must match `^[A-Z_][A-Z0-9_]*$` (uppercase letters,
|
|
1550
|
+
* digits, underscores; first character is a letter or
|
|
1551
|
+
* underscore). Values are at most 4096 UTF-8 bytes. System-
|
|
1552
|
+
* managed keys are reserved and rejected.
|
|
1553
|
+
*
|
|
1554
|
+
*/
|
|
1555
|
+
const createFunctionSecret = (options) => (options.client ?? client$1).post({
|
|
1556
|
+
security: [{
|
|
1557
|
+
scheme: "bearer",
|
|
1558
|
+
type: "http"
|
|
1559
|
+
}],
|
|
1560
|
+
url: "/functions/{id}/secrets",
|
|
1561
|
+
...options,
|
|
1562
|
+
headers: {
|
|
1563
|
+
"Content-Type": "application/json",
|
|
1564
|
+
...options.headers
|
|
1565
|
+
}
|
|
1566
|
+
});
|
|
1567
|
+
/**
|
|
1568
|
+
* Delete a secret
|
|
1569
|
+
*
|
|
1570
|
+
* Removes the secret. The binding stays live in the running
|
|
1571
|
+
* handler until the next deploy refreshes the binding set
|
|
1572
|
+
* (`PUT /functions/{id}` with the existing code is sufficient).
|
|
1573
|
+
* Returns 404 if the key did not exist. Managed system keys
|
|
1574
|
+
* cannot be deleted.
|
|
1575
|
+
*
|
|
1576
|
+
*/
|
|
1577
|
+
const deleteFunctionSecret = (options) => (options.client ?? client$1).delete({
|
|
1578
|
+
security: [{
|
|
1579
|
+
scheme: "bearer",
|
|
1580
|
+
type: "http"
|
|
1581
|
+
}],
|
|
1582
|
+
url: "/functions/{id}/secrets/{key}",
|
|
1583
|
+
...options
|
|
1584
|
+
});
|
|
1585
|
+
/**
|
|
1586
|
+
* Set a secret by key
|
|
1587
|
+
*
|
|
1588
|
+
* Path-keyed companion to `POST /functions/{id}/secrets`.
|
|
1589
|
+
* Idempotent: returns 201 the first time the key is set, 200 on
|
|
1590
|
+
* subsequent updates. Same validation rules and same write-only
|
|
1591
|
+
* guarantees as the POST verb; the new value lands in the running
|
|
1592
|
+
* handler on the next deploy.
|
|
1593
|
+
*
|
|
1594
|
+
*/
|
|
1595
|
+
const setFunctionSecret = (options) => (options.client ?? client$1).put({
|
|
1596
|
+
security: [{
|
|
1597
|
+
scheme: "bearer",
|
|
1598
|
+
type: "http"
|
|
1599
|
+
}],
|
|
1600
|
+
url: "/functions/{id}/secrets/{key}",
|
|
1601
|
+
...options,
|
|
1602
|
+
headers: {
|
|
1603
|
+
"Content-Type": "application/json",
|
|
1604
|
+
...options.headers
|
|
1605
|
+
}
|
|
1606
|
+
});
|
|
1308
1607
|
//#endregion
|
|
1309
1608
|
//#region src/api/index.ts
|
|
1310
1609
|
const DEFAULT_BASE_URL = "https://www.primitive.dev/api/v1";
|
|
@@ -1401,6 +1700,10 @@ var PrimitiveApiError = class extends Error {
|
|
|
1401
1700
|
this.details = options.details;
|
|
1402
1701
|
}
|
|
1403
1702
|
};
|
|
1703
|
+
function isAbortLikeError(error) {
|
|
1704
|
+
if (!(error instanceof Error)) return false;
|
|
1705
|
+
return error.name === "AbortError" || error.name === "TimeoutError";
|
|
1706
|
+
}
|
|
1404
1707
|
function parseRetryAfterHeader(response) {
|
|
1405
1708
|
if (!response) return void 0;
|
|
1406
1709
|
const raw = response.headers.get("retry-after");
|
|
@@ -1425,8 +1728,22 @@ var PrimitiveApiClient = class {
|
|
|
1425
1728
|
return this.client.setConfig(config);
|
|
1426
1729
|
}
|
|
1427
1730
|
};
|
|
1731
|
+
function resolveRequestOptions(options) {
|
|
1732
|
+
const signals = [];
|
|
1733
|
+
if (options?.signal) signals.push(options.signal);
|
|
1734
|
+
if (options?.timeout !== void 0) signals.push(AbortSignal.timeout(options.timeout));
|
|
1735
|
+
const signal = signals.length === 0 ? void 0 : signals.length === 1 ? signals[0] : AbortSignal.any(signals);
|
|
1736
|
+
const headers = {
|
|
1737
|
+
...options?.headers ?? {},
|
|
1738
|
+
...options?.idempotencyKey ? { "Idempotency-Key": options.idempotencyKey } : {}
|
|
1739
|
+
};
|
|
1740
|
+
const resolved = {};
|
|
1741
|
+
if (signal) resolved.signal = signal;
|
|
1742
|
+
if (Object.keys(headers).length > 0) resolved.headers = headers;
|
|
1743
|
+
return resolved;
|
|
1744
|
+
}
|
|
1428
1745
|
var PrimitiveClient = class extends PrimitiveApiClient {
|
|
1429
|
-
async send(input) {
|
|
1746
|
+
async send(input, options) {
|
|
1430
1747
|
validateSendInput(input);
|
|
1431
1748
|
return unwrapSendResult(await sendEmail({
|
|
1432
1749
|
body: {
|
|
@@ -1440,7 +1757,7 @@ var PrimitiveClient = class extends PrimitiveApiClient {
|
|
|
1440
1757
|
...input.wait !== void 0 ? { wait: input.wait } : {},
|
|
1441
1758
|
...input.waitTimeoutMs !== void 0 ? { wait_timeout_ms: input.waitTimeoutMs } : {}
|
|
1442
1759
|
},
|
|
1443
|
-
...
|
|
1760
|
+
...resolveRequestOptions(options),
|
|
1444
1761
|
client: this.client,
|
|
1445
1762
|
responseStyle: "fields"
|
|
1446
1763
|
}));
|
|
@@ -1459,7 +1776,7 @@ var PrimitiveClient = class extends PrimitiveApiClient {
|
|
|
1459
1776
|
* subject match to thread, so a custom subject silently breaks the
|
|
1460
1777
|
* thread for half the recipient population.
|
|
1461
1778
|
*/
|
|
1462
|
-
async reply(email, input) {
|
|
1779
|
+
async reply(email, input, options) {
|
|
1463
1780
|
const resolved = typeof input === "string" ? { text: input } : input;
|
|
1464
1781
|
if ("subject" in resolved) throw new TypeError("reply does not support a subject override; the server prepends 'Re:' to the parent's subject for thread continuity");
|
|
1465
1782
|
if (!resolved.text && !resolved.html) throw new TypeError("reply requires text or html");
|
|
@@ -1471,18 +1788,19 @@ var PrimitiveClient = class extends PrimitiveApiClient {
|
|
|
1471
1788
|
...resolved.wait !== void 0 ? { wait: resolved.wait } : {}
|
|
1472
1789
|
},
|
|
1473
1790
|
path: { id: email.id },
|
|
1791
|
+
...resolveRequestOptions(options),
|
|
1474
1792
|
client: this.client,
|
|
1475
1793
|
responseStyle: "fields"
|
|
1476
1794
|
}));
|
|
1477
1795
|
}
|
|
1478
|
-
async forward(email, input) {
|
|
1796
|
+
async forward(email, input, options) {
|
|
1479
1797
|
validateForwardInput(input);
|
|
1480
1798
|
return this.send({
|
|
1481
1799
|
from: input.from ?? email.receivedBy,
|
|
1482
1800
|
to: input.to,
|
|
1483
1801
|
subject: input.subject ?? email.forwardSubject,
|
|
1484
1802
|
bodyText: buildForwardText(email, input.bodyText)
|
|
1485
|
-
});
|
|
1803
|
+
}, options);
|
|
1486
1804
|
}
|
|
1487
1805
|
};
|
|
1488
1806
|
function buildForwardText(email, intro) {
|
|
@@ -1507,6 +1825,7 @@ function buildForwardText(email, intro) {
|
|
|
1507
1825
|
function unwrapSendResult(result) {
|
|
1508
1826
|
const response = result.response;
|
|
1509
1827
|
if (result.error) {
|
|
1828
|
+
if (isAbortLikeError(result.error)) throw result.error;
|
|
1510
1829
|
const parsed = parseApiErrorPayload(result.error);
|
|
1511
1830
|
throw new PrimitiveApiError(parsed.message, {
|
|
1512
1831
|
payload: result.error,
|
|
@@ -1551,4 +1870,4 @@ function client(options = {}) {
|
|
|
1551
1870
|
}
|
|
1552
1871
|
const operations = sdk_gen_exports;
|
|
1553
1872
|
//#endregion
|
|
1554
|
-
export {
|
|
1873
|
+
export { updateFunction as $, getWebhookSecret as A, replayDelivery as B, downloadRawEmail as C, getSendPermissions as D, getFunction as E, listFilters as F, setFunctionSecret as G, replyToEmail as H, listFunctionSecrets as I, testFunction as J, startCliLogin as K, listFunctions as L, listDomains as M, listEmails as N, getSentEmail as O, listEndpoints as P, updateFilter as Q, listSentEmails as R, downloadAttachments as S, getEmail as T, rotateWebhookSecret as U, replayEmailWebhooks as V, sendEmail as W, updateDomain as X, updateAccount as Y, updateEndpoint as Z, deleteEndpoint as _, client as a, deleteFunctionSecret as b, operations as c, createEndpoint as d, verifyDomain as et, createFilter as f, deleteEmail as g, deleteDomain as h, PrimitiveClient as i, listDeliveries as j, getStorageStats as k, addDomain as l, createFunctionSecret as m, PrimitiveApiClient as n, createPrimitiveApiClient as o, createFunction as p, testEndpoint as q, PrimitiveApiError as r, createPrimitiveClient as s, DEFAULT_BASE_URL as t, cliLogout as u, deleteFilter as v, getAccount as w, discardEmailContent as x, deleteFunction as y, pollCliLogin as z };
|
package/dist/contract/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { C as ParsedDataFailed, D as RawContentDownloadOnly, M as WebhookAttachment, O as RawContentInline, S as ParsedDataComplete, c as EmailAnalysis, l as EmailAuth, s as EmailAddress, u as EmailReceivedEvent, w as ParsedError } from "../types-9vXGZjPd.js";
|
|
2
|
-
import { C as signStandardWebhooksPayload, h as WEBHOOK_VERSION, j as signWebhookPayload, k as SignResult, x as StandardWebhooksSignResult } from "../index-
|
|
2
|
+
import { C as signStandardWebhooksPayload, h as WEBHOOK_VERSION, j as signWebhookPayload, k as SignResult, x as StandardWebhooksSignResult } from "../index-CDlwyxdp.js";
|
|
3
3
|
|
|
4
4
|
//#region src/contract/contract.d.ts
|
|
5
5
|
/** Maximum raw email size for inline inclusion (256 KB). */
|
|
@@ -180,7 +180,7 @@ interface BuildEventFromParsedDataOptions {
|
|
|
180
180
|
downloadExpiresAt: string;
|
|
181
181
|
/**
|
|
182
182
|
* Download URL for the attachments tarball.
|
|
183
|
-
* Must be null iff `parsed.attachments` is empty
|
|
183
|
+
* Must be null iff `parsed.attachments` is empty. Mismatch throws.
|
|
184
184
|
*/
|
|
185
185
|
attachmentsDownloadUrl: string | null;
|
|
186
186
|
/** Delivery attempt number, starting at 1. */
|
package/dist/contract/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as signStandardWebhooksPayload, L as validateEmailReceivedEvent, M as signWebhookPayload, d as WEBHOOK_VERSION } from "../webhook-
|
|
1
|
+
import { E as signStandardWebhooksPayload, L as validateEmailReceivedEvent, M as signWebhookPayload, d as WEBHOOK_VERSION } from "../webhook-rUjGV6Zu.js";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
//#region src/contract/contract.ts
|
|
4
4
|
/**
|