@primitivedotdev/sdk 0.23.0 → 0.25.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 +11 -46
- package/bin/run.js +15 -0
- package/dist/api/generated/sdk.gen.js +29 -17
- package/dist/api/index.d.ts +1 -1
- package/dist/{api-BjzvA2Fy.js → api-C3X14uId.js} +29 -17
- package/dist/{index-QTYQpSFt.d.ts → index-jLAAV6Sq.d.ts} +23 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/oclif/commands/functions-deploy.js +7 -0
- package/dist/oclif/commands/functions-redeploy.js +7 -0
- package/dist/oclif/lint/raw-send-mail-fetch.js +98 -0
- package/dist/openapi/openapi.generated.js +21 -1
- package/dist/openapi/operations.generated.js +15 -3
- package/oclif.manifest.json +23 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
# `@primitivedotdev/sdk`
|
|
2
2
|
|
|
3
|
-
The official Node.js
|
|
3
|
+
The official Node.js library for [Primitive](https://primitive.dev), an email API for sending and receiving programmatic mail. Typed client for receiving and verifying inbound webhooks, sending mail, parsing raw MIME, and calling the full HTTP API.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Looking for the CLI?
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- A **typed Node library** for programmatic integration in app code. Receives and verifies inbound webhooks, sends mail, parses raw MIME, and exposes the full HTTP API as generated functions.
|
|
7
|
+
The `primitive` CLI now ships as a separate package, [`@primitivedotdev/cli`](https://www.npmjs.com/package/@primitivedotdev/cli). Install it with:
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @primitivedotdev/cli
|
|
11
|
+
# or, no-install:
|
|
12
|
+
npx @primitivedotdev/cli@latest <command>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This package retains the CLI for a few minor releases for backward compatibility (`npx @primitivedotdev/sdk@latest <command>` still works and prints a one-line migration banner). The retained CLI snapshot will be removed in a future minor release.
|
|
11
16
|
|
|
12
17
|
## Install
|
|
13
18
|
|
|
@@ -15,56 +20,16 @@ Pick whichever fits the call site. The two share the same auth (`PRIMITIVE_API_K
|
|
|
15
20
|
npm install @primitivedotdev/sdk
|
|
16
21
|
```
|
|
17
22
|
|
|
18
|
-
For one-off CLI use, `npx @primitivedotdev/sdk@latest <command>` works without installing.
|
|
19
|
-
|
|
20
23
|
Requires Node.js 22 or newer.
|
|
21
24
|
|
|
22
25
|
## Set your API key
|
|
23
26
|
|
|
24
|
-
Get a key from your [dashboard](https://primitive.dev) and export it.
|
|
27
|
+
Get a key from your [dashboard](https://primitive.dev) and export it. The library defaults to reading `PRIMITIVE_API_KEY` from the environment.
|
|
25
28
|
|
|
26
29
|
```bash
|
|
27
30
|
export PRIMITIVE_API_KEY=prim_...
|
|
28
31
|
```
|
|
29
32
|
|
|
30
|
-
## Command line
|
|
31
|
-
|
|
32
|
-
Everything below assumes `PRIMITIVE_API_KEY` is set. Each command also accepts `--api-key <value>` if you want to pass it explicitly.
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
# Confirm the key is live and see which account it authenticates.
|
|
36
|
-
primitive whoami
|
|
37
|
-
|
|
38
|
-
# Send an email. --wait blocks until the receiving MTA returns a delivery
|
|
39
|
-
# outcome (a synchronous SMTP 250 from Gmail, etc.); without it, the call
|
|
40
|
-
# returns once Primitive has accepted the message for delivery.
|
|
41
|
-
primitive send --to alice@example.com --body "Hi Alice!" --wait
|
|
42
|
-
|
|
43
|
-
# See the most recent inbound emails as a compact text table.
|
|
44
|
-
# IDs are full UUIDs when piped, truncated for interactive terminals.
|
|
45
|
-
primitive emails:latest --limit 5
|
|
46
|
-
|
|
47
|
-
# Read one inbound's full record (body, headers, threading metadata).
|
|
48
|
-
primitive emails:get-email --id <uuid>
|
|
49
|
-
|
|
50
|
-
# Reply to an inbound. Threading and the "Re:" subject are derived
|
|
51
|
-
# server-side from the parent message; you supply only the body.
|
|
52
|
-
primitive sending:reply-to-email --id <inbound-id> --body-text "..."
|
|
53
|
-
|
|
54
|
-
# See where you are allowed to send. Returns a typed list of
|
|
55
|
-
# permission rules (managed-zone wildcards, your own verified domains,
|
|
56
|
-
# specific addresses with grants). The send-mail call enforces these
|
|
57
|
-
# at request time.
|
|
58
|
-
primitive sending:get-send-permissions
|
|
59
|
-
|
|
60
|
-
# Look up an operation's request/response schema, including per-field
|
|
61
|
-
# descriptions sourced from the OpenAPI spec.
|
|
62
|
-
primitive describe emails:get-email
|
|
63
|
-
primitive describe sending:send-email
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Run `primitive --help` for the full topic list and `primitive <topic> --help` for the commands within each. Every command accepts `--help`, and the descriptions are detailed enough that the CLI is self-documenting for most workflows.
|
|
67
|
-
|
|
68
33
|
## Library
|
|
69
34
|
|
|
70
35
|
The default root import is intentionally small and centered on the two most common app-code use cases: receiving inbound webhook deliveries and sending mail.
|
package/bin/run.js
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
// The CLI moved to @primitivedotdev/cli. This bin is retained on
|
|
4
|
+
// @primitivedotdev/sdk for a few minor versions so existing scripts
|
|
5
|
+
// and agent prompts that invoke `npx @primitivedotdev/sdk@latest
|
|
6
|
+
// <command>` keep working. Every invocation prints a one-line stderr
|
|
7
|
+
// banner with the migration command; the actual oclif runtime runs
|
|
8
|
+
// unchanged after that. The CLI surface will be removed from
|
|
9
|
+
// @primitivedotdev/sdk in a future minor release; until then this
|
|
10
|
+
// shipped snapshot is frozen against the 0.23.0 command set.
|
|
3
11
|
import { execute } from "@oclif/core";
|
|
4
12
|
|
|
13
|
+
process.stderr.write(
|
|
14
|
+
"[@primitivedotdev/sdk] Heads up: the CLI moved to @primitivedotdev/cli. " +
|
|
15
|
+
"Switch to `npx @primitivedotdev/cli@latest <command>` " +
|
|
16
|
+
"(or `npm install -g @primitivedotdev/cli`). " +
|
|
17
|
+
"The CLI surface will be removed from @primitivedotdev/sdk in a future minor release.\n",
|
|
18
|
+
);
|
|
19
|
+
|
|
5
20
|
await execute({ dir: import.meta.url });
|
|
@@ -28,7 +28,7 @@ export const pollCliLogin = (options) => (options.client ?? client).post({
|
|
|
28
28
|
url: '/cli/login/poll',
|
|
29
29
|
...options,
|
|
30
30
|
headers: {
|
|
31
|
-
'Content-Type': 'application/json',
|
|
31
|
+
...(options.body !== undefined && { 'Content-Type': 'application/json' }),
|
|
32
32
|
...options.headers
|
|
33
33
|
}
|
|
34
34
|
});
|
|
@@ -64,7 +64,7 @@ export const updateAccount = (options) => (options.client ?? client).patch({
|
|
|
64
64
|
url: '/account',
|
|
65
65
|
...options,
|
|
66
66
|
headers: {
|
|
67
|
-
'Content-Type': 'application/json',
|
|
67
|
+
...(options.body !== undefined && { 'Content-Type': 'application/json' }),
|
|
68
68
|
...options.headers
|
|
69
69
|
}
|
|
70
70
|
});
|
|
@@ -143,7 +143,7 @@ export const addDomain = (options) => (options.client ?? client).post({
|
|
|
143
143
|
url: '/domains',
|
|
144
144
|
...options,
|
|
145
145
|
headers: {
|
|
146
|
-
'Content-Type': 'application/json',
|
|
146
|
+
...(options.body !== undefined && { 'Content-Type': 'application/json' }),
|
|
147
147
|
...options.headers
|
|
148
148
|
}
|
|
149
149
|
});
|
|
@@ -169,7 +169,7 @@ export const updateDomain = (options) => (options.client ?? client).patch({
|
|
|
169
169
|
url: '/domains/{id}',
|
|
170
170
|
...options,
|
|
171
171
|
headers: {
|
|
172
|
-
'Content-Type': 'application/json',
|
|
172
|
+
...(options.body !== undefined && { 'Content-Type': 'application/json' }),
|
|
173
173
|
...options.headers
|
|
174
174
|
}
|
|
175
175
|
});
|
|
@@ -327,7 +327,7 @@ export const replyToEmail = (options) => (options.client ?? client).post({
|
|
|
327
327
|
url: '/emails/{id}/reply',
|
|
328
328
|
...options,
|
|
329
329
|
headers: {
|
|
330
|
-
'Content-Type': 'application/json',
|
|
330
|
+
...(options.body !== undefined && { 'Content-Type': 'application/json' }),
|
|
331
331
|
...options.headers
|
|
332
332
|
}
|
|
333
333
|
});
|
|
@@ -405,7 +405,7 @@ export const createEndpoint = (options) => (options.client ?? client).post({
|
|
|
405
405
|
url: '/endpoints',
|
|
406
406
|
...options,
|
|
407
407
|
headers: {
|
|
408
|
-
'Content-Type': 'application/json',
|
|
408
|
+
...(options.body !== undefined && { 'Content-Type': 'application/json' }),
|
|
409
409
|
...options.headers
|
|
410
410
|
}
|
|
411
411
|
});
|
|
@@ -434,7 +434,7 @@ export const updateEndpoint = (options) => (options.client ?? client).patch({
|
|
|
434
434
|
url: '/endpoints/{id}',
|
|
435
435
|
...options,
|
|
436
436
|
headers: {
|
|
437
|
-
'Content-Type': 'application/json',
|
|
437
|
+
...(options.body !== undefined && { 'Content-Type': 'application/json' }),
|
|
438
438
|
...options.headers
|
|
439
439
|
}
|
|
440
440
|
});
|
|
@@ -475,7 +475,7 @@ export const createFilter = (options) => (options.client ?? client).post({
|
|
|
475
475
|
url: '/filters',
|
|
476
476
|
...options,
|
|
477
477
|
headers: {
|
|
478
|
-
'Content-Type': 'application/json',
|
|
478
|
+
...(options.body !== undefined && { 'Content-Type': 'application/json' }),
|
|
479
479
|
...options.headers
|
|
480
480
|
}
|
|
481
481
|
});
|
|
@@ -497,7 +497,7 @@ export const updateFilter = (options) => (options.client ?? client).patch({
|
|
|
497
497
|
url: '/filters/{id}',
|
|
498
498
|
...options,
|
|
499
499
|
headers: {
|
|
500
|
-
'Content-Type': 'application/json',
|
|
500
|
+
...(options.body !== undefined && { 'Content-Type': 'application/json' }),
|
|
501
501
|
...options.headers
|
|
502
502
|
}
|
|
503
503
|
});
|
|
@@ -590,7 +590,7 @@ export const sendEmail = (options) => (options.client ?? client).post({
|
|
|
590
590
|
url: '/send-mail',
|
|
591
591
|
...options,
|
|
592
592
|
headers: {
|
|
593
|
-
'Content-Type': 'application/json',
|
|
593
|
+
...(options.body !== undefined && { 'Content-Type': 'application/json' }),
|
|
594
594
|
...options.headers
|
|
595
595
|
}
|
|
596
596
|
});
|
|
@@ -683,7 +683,7 @@ export const createFunction = (options) => (options.client ?? client).post({
|
|
|
683
683
|
url: '/functions',
|
|
684
684
|
...options,
|
|
685
685
|
headers: {
|
|
686
|
-
'Content-Type': 'application/json',
|
|
686
|
+
...(options.body !== undefined && { 'Content-Type': 'application/json' }),
|
|
687
687
|
...options.headers
|
|
688
688
|
}
|
|
689
689
|
});
|
|
@@ -739,7 +739,7 @@ export const updateFunction = (options) => (options.client ?? client).put({
|
|
|
739
739
|
url: '/functions/{id}',
|
|
740
740
|
...options,
|
|
741
741
|
headers: {
|
|
742
|
-
'Content-Type': 'application/json',
|
|
742
|
+
...(options.body !== undefined && { 'Content-Type': 'application/json' }),
|
|
743
743
|
...options.headers
|
|
744
744
|
}
|
|
745
745
|
});
|
|
@@ -747,8 +747,14 @@ export const updateFunction = (options) => (options.client ?? client).put({
|
|
|
747
747
|
* Send a test invocation
|
|
748
748
|
*
|
|
749
749
|
* Sends a real test email from a Primitive-controlled sender to a
|
|
750
|
-
*
|
|
751
|
-
*
|
|
750
|
+
* local-part on one of the org's verified inbound domains. By
|
|
751
|
+
* default the recipient is a synthetic
|
|
752
|
+
* `__primitive_function_test+<random>@<domain>` address that
|
|
753
|
+
* every handler's catch-all routing receives identically; pass
|
|
754
|
+
* `local_part` to override and exercise routing logic that
|
|
755
|
+
* branches on a specific recipient (the common pattern when one
|
|
756
|
+
* function handles multiple inboxes like `summarize@` and
|
|
757
|
+
* `action@`). The function fires through the normal MX delivery
|
|
752
758
|
* path, so reply / send-mail calls from inside the handler
|
|
753
759
|
* against the inbound's `email.id` work the same as in
|
|
754
760
|
* production. Returns immediately after the send is queued; the
|
|
@@ -758,12 +764,18 @@ export const updateFunction = (options) => (options.client ?? client).put({
|
|
|
758
764
|
* Requires that the function is currently `deployed`. Returns 422
|
|
759
765
|
* if the function is in `pending` or `failed` state, or if the
|
|
760
766
|
* org has no verified inbound domain to receive the test mail.
|
|
767
|
+
* Returns 400 if `local_part` is set to a value that does not
|
|
768
|
+
* match the local-part character set.
|
|
761
769
|
*
|
|
762
770
|
*/
|
|
763
771
|
export const testFunction = (options) => (options.client ?? client).post({
|
|
764
772
|
security: [{ scheme: 'bearer', type: 'http' }],
|
|
765
773
|
url: '/functions/{id}/test',
|
|
766
|
-
...options
|
|
774
|
+
...options,
|
|
775
|
+
headers: {
|
|
776
|
+
...(options.body !== undefined && { 'Content-Type': 'application/json' }),
|
|
777
|
+
...options.headers
|
|
778
|
+
}
|
|
767
779
|
});
|
|
768
780
|
/**
|
|
769
781
|
* List a function's secrets
|
|
@@ -804,7 +816,7 @@ export const createFunctionSecret = (options) => (options.client ?? client).post
|
|
|
804
816
|
url: '/functions/{id}/secrets',
|
|
805
817
|
...options,
|
|
806
818
|
headers: {
|
|
807
|
-
'Content-Type': 'application/json',
|
|
819
|
+
...(options.body !== undefined && { 'Content-Type': 'application/json' }),
|
|
808
820
|
...options.headers
|
|
809
821
|
}
|
|
810
822
|
});
|
|
@@ -838,7 +850,7 @@ export const setFunctionSecret = (options) => (options.client ?? client).put({
|
|
|
838
850
|
url: '/functions/{id}/secrets/{key}',
|
|
839
851
|
...options,
|
|
840
852
|
headers: {
|
|
841
|
-
'Content-Type': 'application/json',
|
|
853
|
+
...(options.body !== undefined && { 'Content-Type': 'application/json' }),
|
|
842
854
|
...options.headers
|
|
843
855
|
}
|
|
844
856
|
});
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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-
|
|
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-jLAAV6Sq.js";
|
|
2
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 };
|
|
@@ -689,7 +689,7 @@ const pollCliLogin = (options) => (options.client ?? client$1).post({
|
|
|
689
689
|
url: "/cli/login/poll",
|
|
690
690
|
...options,
|
|
691
691
|
headers: {
|
|
692
|
-
"Content-Type": "application/json",
|
|
692
|
+
...options.body !== void 0 && { "Content-Type": "application/json" },
|
|
693
693
|
...options.headers
|
|
694
694
|
}
|
|
695
695
|
});
|
|
@@ -734,7 +734,7 @@ const updateAccount = (options) => (options.client ?? client$1).patch({
|
|
|
734
734
|
url: "/account",
|
|
735
735
|
...options,
|
|
736
736
|
headers: {
|
|
737
|
-
"Content-Type": "application/json",
|
|
737
|
+
...options.body !== void 0 && { "Content-Type": "application/json" },
|
|
738
738
|
...options.headers
|
|
739
739
|
}
|
|
740
740
|
});
|
|
@@ -828,7 +828,7 @@ const addDomain = (options) => (options.client ?? client$1).post({
|
|
|
828
828
|
url: "/domains",
|
|
829
829
|
...options,
|
|
830
830
|
headers: {
|
|
831
|
-
"Content-Type": "application/json",
|
|
831
|
+
...options.body !== void 0 && { "Content-Type": "application/json" },
|
|
832
832
|
...options.headers
|
|
833
833
|
}
|
|
834
834
|
});
|
|
@@ -860,7 +860,7 @@ const updateDomain = (options) => (options.client ?? client$1).patch({
|
|
|
860
860
|
url: "/domains/{id}",
|
|
861
861
|
...options,
|
|
862
862
|
headers: {
|
|
863
|
-
"Content-Type": "application/json",
|
|
863
|
+
...options.body !== void 0 && { "Content-Type": "application/json" },
|
|
864
864
|
...options.headers
|
|
865
865
|
}
|
|
866
866
|
});
|
|
@@ -1042,7 +1042,7 @@ const replyToEmail = (options) => (options.client ?? client$1).post({
|
|
|
1042
1042
|
url: "/emails/{id}/reply",
|
|
1043
1043
|
...options,
|
|
1044
1044
|
headers: {
|
|
1045
|
-
"Content-Type": "application/json",
|
|
1045
|
+
...options.body !== void 0 && { "Content-Type": "application/json" },
|
|
1046
1046
|
...options.headers
|
|
1047
1047
|
}
|
|
1048
1048
|
});
|
|
@@ -1132,7 +1132,7 @@ const createEndpoint = (options) => (options.client ?? client$1).post({
|
|
|
1132
1132
|
url: "/endpoints",
|
|
1133
1133
|
...options,
|
|
1134
1134
|
headers: {
|
|
1135
|
-
"Content-Type": "application/json",
|
|
1135
|
+
...options.body !== void 0 && { "Content-Type": "application/json" },
|
|
1136
1136
|
...options.headers
|
|
1137
1137
|
}
|
|
1138
1138
|
});
|
|
@@ -1167,7 +1167,7 @@ const updateEndpoint = (options) => (options.client ?? client$1).patch({
|
|
|
1167
1167
|
url: "/endpoints/{id}",
|
|
1168
1168
|
...options,
|
|
1169
1169
|
headers: {
|
|
1170
|
-
"Content-Type": "application/json",
|
|
1170
|
+
...options.body !== void 0 && { "Content-Type": "application/json" },
|
|
1171
1171
|
...options.headers
|
|
1172
1172
|
}
|
|
1173
1173
|
});
|
|
@@ -1217,7 +1217,7 @@ const createFilter = (options) => (options.client ?? client$1).post({
|
|
|
1217
1217
|
url: "/filters",
|
|
1218
1218
|
...options,
|
|
1219
1219
|
headers: {
|
|
1220
|
-
"Content-Type": "application/json",
|
|
1220
|
+
...options.body !== void 0 && { "Content-Type": "application/json" },
|
|
1221
1221
|
...options.headers
|
|
1222
1222
|
}
|
|
1223
1223
|
});
|
|
@@ -1245,7 +1245,7 @@ const updateFilter = (options) => (options.client ?? client$1).patch({
|
|
|
1245
1245
|
url: "/filters/{id}",
|
|
1246
1246
|
...options,
|
|
1247
1247
|
headers: {
|
|
1248
|
-
"Content-Type": "application/json",
|
|
1248
|
+
...options.body !== void 0 && { "Content-Type": "application/json" },
|
|
1249
1249
|
...options.headers
|
|
1250
1250
|
}
|
|
1251
1251
|
});
|
|
@@ -1350,7 +1350,7 @@ const sendEmail = (options) => (options.client ?? client$1).post({
|
|
|
1350
1350
|
url: "/send-mail",
|
|
1351
1351
|
...options,
|
|
1352
1352
|
headers: {
|
|
1353
|
-
"Content-Type": "application/json",
|
|
1353
|
+
...options.body !== void 0 && { "Content-Type": "application/json" },
|
|
1354
1354
|
...options.headers
|
|
1355
1355
|
}
|
|
1356
1356
|
});
|
|
@@ -1455,7 +1455,7 @@ const createFunction = (options) => (options.client ?? client$1).post({
|
|
|
1455
1455
|
url: "/functions",
|
|
1456
1456
|
...options,
|
|
1457
1457
|
headers: {
|
|
1458
|
-
"Content-Type": "application/json",
|
|
1458
|
+
...options.body !== void 0 && { "Content-Type": "application/json" },
|
|
1459
1459
|
...options.headers
|
|
1460
1460
|
}
|
|
1461
1461
|
});
|
|
@@ -1520,7 +1520,7 @@ const updateFunction = (options) => (options.client ?? client$1).put({
|
|
|
1520
1520
|
url: "/functions/{id}",
|
|
1521
1521
|
...options,
|
|
1522
1522
|
headers: {
|
|
1523
|
-
"Content-Type": "application/json",
|
|
1523
|
+
...options.body !== void 0 && { "Content-Type": "application/json" },
|
|
1524
1524
|
...options.headers
|
|
1525
1525
|
}
|
|
1526
1526
|
});
|
|
@@ -1528,8 +1528,14 @@ const updateFunction = (options) => (options.client ?? client$1).put({
|
|
|
1528
1528
|
* Send a test invocation
|
|
1529
1529
|
*
|
|
1530
1530
|
* Sends a real test email from a Primitive-controlled sender to a
|
|
1531
|
-
*
|
|
1532
|
-
*
|
|
1531
|
+
* local-part on one of the org's verified inbound domains. By
|
|
1532
|
+
* default the recipient is a synthetic
|
|
1533
|
+
* `__primitive_function_test+<random>@<domain>` address that
|
|
1534
|
+
* every handler's catch-all routing receives identically; pass
|
|
1535
|
+
* `local_part` to override and exercise routing logic that
|
|
1536
|
+
* branches on a specific recipient (the common pattern when one
|
|
1537
|
+
* function handles multiple inboxes like `summarize@` and
|
|
1538
|
+
* `action@`). The function fires through the normal MX delivery
|
|
1533
1539
|
* path, so reply / send-mail calls from inside the handler
|
|
1534
1540
|
* against the inbound's `email.id` work the same as in
|
|
1535
1541
|
* production. Returns immediately after the send is queued; the
|
|
@@ -1539,6 +1545,8 @@ const updateFunction = (options) => (options.client ?? client$1).put({
|
|
|
1539
1545
|
* Requires that the function is currently `deployed`. Returns 422
|
|
1540
1546
|
* if the function is in `pending` or `failed` state, or if the
|
|
1541
1547
|
* org has no verified inbound domain to receive the test mail.
|
|
1548
|
+
* Returns 400 if `local_part` is set to a value that does not
|
|
1549
|
+
* match the local-part character set.
|
|
1542
1550
|
*
|
|
1543
1551
|
*/
|
|
1544
1552
|
const testFunction = (options) => (options.client ?? client$1).post({
|
|
@@ -1547,7 +1555,11 @@ const testFunction = (options) => (options.client ?? client$1).post({
|
|
|
1547
1555
|
type: "http"
|
|
1548
1556
|
}],
|
|
1549
1557
|
url: "/functions/{id}/test",
|
|
1550
|
-
...options
|
|
1558
|
+
...options,
|
|
1559
|
+
headers: {
|
|
1560
|
+
...options.body !== void 0 && { "Content-Type": "application/json" },
|
|
1561
|
+
...options.headers
|
|
1562
|
+
}
|
|
1551
1563
|
});
|
|
1552
1564
|
/**
|
|
1553
1565
|
* List a function's secrets
|
|
@@ -1594,7 +1606,7 @@ const createFunctionSecret = (options) => (options.client ?? client$1).post({
|
|
|
1594
1606
|
url: "/functions/{id}/secrets",
|
|
1595
1607
|
...options,
|
|
1596
1608
|
headers: {
|
|
1597
|
-
"Content-Type": "application/json",
|
|
1609
|
+
...options.body !== void 0 && { "Content-Type": "application/json" },
|
|
1598
1610
|
...options.headers
|
|
1599
1611
|
}
|
|
1600
1612
|
});
|
|
@@ -1634,7 +1646,7 @@ const setFunctionSecret = (options) => (options.client ?? client$1).put({
|
|
|
1634
1646
|
url: "/functions/{id}/secrets/{key}",
|
|
1635
1647
|
...options,
|
|
1636
1648
|
headers: {
|
|
1637
|
-
"Content-Type": "application/json",
|
|
1649
|
+
...options.body !== void 0 && { "Content-Type": "application/json" },
|
|
1638
1650
|
...options.headers
|
|
1639
1651
|
}
|
|
1640
1652
|
});
|
|
@@ -3369,7 +3369,19 @@ type UpdateFunctionResponses = {
|
|
|
3369
3369
|
};
|
|
3370
3370
|
type UpdateFunctionResponse = UpdateFunctionResponses[keyof UpdateFunctionResponses];
|
|
3371
3371
|
type TestFunctionData = {
|
|
3372
|
-
body?:
|
|
3372
|
+
body?: {
|
|
3373
|
+
/**
|
|
3374
|
+
* Override the synthetic local-part. When set, the
|
|
3375
|
+
* test email is sent to `<local_part>@<picked-domain>`
|
|
3376
|
+
* instead of the default
|
|
3377
|
+
* `__primitive_function_test+<random>@<picked-domain>`.
|
|
3378
|
+
* Must start with an alphanumeric and contain only
|
|
3379
|
+
* letters, digits, dots, plus signs, hyphens, or
|
|
3380
|
+
* underscores; 1-64 characters total.
|
|
3381
|
+
*
|
|
3382
|
+
*/
|
|
3383
|
+
local_part?: string;
|
|
3384
|
+
};
|
|
3373
3385
|
path: {
|
|
3374
3386
|
/**
|
|
3375
3387
|
* Resource UUID
|
|
@@ -4104,8 +4116,14 @@ declare const updateFunction: <ThrowOnError extends boolean = false>(options: Op
|
|
|
4104
4116
|
* Send a test invocation
|
|
4105
4117
|
*
|
|
4106
4118
|
* Sends a real test email from a Primitive-controlled sender to a
|
|
4107
|
-
*
|
|
4108
|
-
*
|
|
4119
|
+
* local-part on one of the org's verified inbound domains. By
|
|
4120
|
+
* default the recipient is a synthetic
|
|
4121
|
+
* `__primitive_function_test+<random>@<domain>` address that
|
|
4122
|
+
* every handler's catch-all routing receives identically; pass
|
|
4123
|
+
* `local_part` to override and exercise routing logic that
|
|
4124
|
+
* branches on a specific recipient (the common pattern when one
|
|
4125
|
+
* function handles multiple inboxes like `summarize@` and
|
|
4126
|
+
* `action@`). The function fires through the normal MX delivery
|
|
4109
4127
|
* path, so reply / send-mail calls from inside the handler
|
|
4110
4128
|
* against the inbound's `email.id` work the same as in
|
|
4111
4129
|
* production. Returns immediately after the send is queued; the
|
|
@@ -4115,6 +4133,8 @@ declare const updateFunction: <ThrowOnError extends boolean = false>(options: Op
|
|
|
4115
4133
|
* Requires that the function is currently `deployed`. Returns 422
|
|
4116
4134
|
* if the function is in `pending` or `failed` state, or if the
|
|
4117
4135
|
* org has no verified inbound domain to receive the test mail.
|
|
4136
|
+
* Returns 400 if `local_part` is set to a value that does not
|
|
4137
|
+
* match the local-part character set.
|
|
4118
4138
|
*
|
|
4119
4139
|
*/
|
|
4120
4140
|
declare const testFunction: <ThrowOnError extends boolean = false>(options: Options<TestFunctionData, ThrowOnError>) => RequestResult<TestFunctionResponses, TestFunctionErrors, ThrowOnError, "fields">;
|
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 { _ as createPrimitiveClient, c as PrimitiveClient, f as SendInput, h as client, l as PrimitiveClientOptions, m as SendThreadInput, o as PrimitiveApiError, p as SendResult, r as ForwardInput, u as ReplyInput } from "./index-
|
|
3
|
+
import { _ as createPrimitiveClient, c as PrimitiveClient, f as SendInput, h as client, l as PrimitiveClientOptions, m as SendThreadInput, o as PrimitiveApiError, p as SendResult, r as ForwardInput, u as ReplyInput } from "./index-jLAAV6Sq.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-CDlwyxdp.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 PrimitiveClient, c as createPrimitiveClient, i as PrimitiveApiError, o as client } from "./api-
|
|
2
|
+
import { a as PrimitiveClient, c as createPrimitiveClient, i as PrimitiveApiError, o as client } from "./api-C3X14uId.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-rUjGV6Zu.js";
|
|
4
4
|
//#region src/index.ts
|
|
5
5
|
const primitive = {
|
|
@@ -3,6 +3,7 @@ import { createFunction } from "../../api/generated/sdk.gen.js";
|
|
|
3
3
|
import { PrimitiveApiClient } from "../../api/index.js";
|
|
4
4
|
import { extractErrorPayload, readTextFileFlag, removeStaleSavedCredentialOnUnauthorized, runWithTiming, TIME_FLAG_DESCRIPTION, writeErrorWithHints, } from "../api-command.js";
|
|
5
5
|
import { resolveCliAuth } from "../auth.js";
|
|
6
|
+
import { emitRawSendMailFetchWarning } from "../lint/raw-send-mail-fetch.js";
|
|
6
7
|
// `primitive functions:deploy` is the agent-grade shortcut for
|
|
7
8
|
// `functions:create-function`. The underlying operation takes `code`
|
|
8
9
|
// as a string in the JSON body, which is awkward at the CLI for
|
|
@@ -72,6 +73,12 @@ class FunctionsDeployCommand extends Command {
|
|
|
72
73
|
const sourceMap = flags["source-map-file"]
|
|
73
74
|
? readTextFileFlag(flags["source-map-file"], "--source-map-file")
|
|
74
75
|
: undefined;
|
|
76
|
+
// Non-blocking deploy-time lint: if the bundle has a raw
|
|
77
|
+
// fetch(...) call against /send-mail, nudge the author toward
|
|
78
|
+
// `createPrimitiveClient` from `@primitivedotdev/sdk/api`.
|
|
79
|
+
// The warning lands on stderr so it never contaminates the
|
|
80
|
+
// JSON stdout the caller may pipe into jq.
|
|
81
|
+
emitRawSendMailFetchWarning(code, (chunk) => process.stderr.write(chunk));
|
|
75
82
|
const baseUrlOverridden = flags["api-base-url-1"] !== undefined ||
|
|
76
83
|
flags["api-base-url-2"] !== undefined;
|
|
77
84
|
const auth = resolveCliAuth({
|
|
@@ -3,6 +3,7 @@ import { updateFunction } from "../../api/generated/sdk.gen.js";
|
|
|
3
3
|
import { PrimitiveApiClient } from "../../api/index.js";
|
|
4
4
|
import { extractErrorPayload, readTextFileFlag, removeStaleSavedCredentialOnUnauthorized, runWithTiming, TIME_FLAG_DESCRIPTION, writeErrorWithHints, } from "../api-command.js";
|
|
5
5
|
import { resolveCliAuth } from "../auth.js";
|
|
6
|
+
import { emitRawSendMailFetchWarning } from "../lint/raw-send-mail-fetch.js";
|
|
6
7
|
// `primitive functions:redeploy` is the agent-grade shortcut for
|
|
7
8
|
// `functions:update-function`. Same file-reading ergonomic as
|
|
8
9
|
// functions:deploy but for an existing function. Use this to push a
|
|
@@ -61,6 +62,12 @@ class FunctionsRedeployCommand extends Command {
|
|
|
61
62
|
const sourceMap = flags["source-map-file"]
|
|
62
63
|
? readTextFileFlag(flags["source-map-file"], "--source-map-file")
|
|
63
64
|
: undefined;
|
|
65
|
+
// Non-blocking deploy-time lint: if the bundle has a raw
|
|
66
|
+
// fetch(...) call against /send-mail, nudge the author toward
|
|
67
|
+
// `createPrimitiveClient` from `@primitivedotdev/sdk/api`.
|
|
68
|
+
// Same check as functions:deploy; warning goes to stderr and
|
|
69
|
+
// the deploy continues regardless.
|
|
70
|
+
emitRawSendMailFetchWarning(code, (chunk) => process.stderr.write(chunk));
|
|
64
71
|
const baseUrlOverridden = flags["api-base-url-1"] !== undefined ||
|
|
65
72
|
flags["api-base-url-2"] !== undefined;
|
|
66
73
|
const auth = resolveCliAuth({
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// Deploy-time lint for `functions:deploy --file <bundle>` and
|
|
2
|
+
// `functions:redeploy --file <bundle>`. Looks for a raw
|
|
3
|
+
// `fetch("...primitive.dev/.../send-mail", ...)` call in the bundle
|
|
4
|
+
// text and, on a match, emits a stderr warning telling the author
|
|
5
|
+
// to prefer `createPrimitiveClient` from `@primitivedotdev/sdk/api`.
|
|
6
|
+
//
|
|
7
|
+
// Why: a recurring pattern in agent-assisted Function deploys is to
|
|
8
|
+
// copy the REST snippet from the docs and call `fetch` directly
|
|
9
|
+
// against the Primitive send-mail endpoint, even after the docs
|
|
10
|
+
// switched to leading with the SDK and `functions:init` ships a
|
|
11
|
+
// scaffold that uses `createPrimitiveClient`. The SDK already
|
|
12
|
+
// handles dual-host routing, error envelopes, and send-permission
|
|
13
|
+
// gate denials; raw `fetch` re-discovers each of those by hand. The
|
|
14
|
+
// warning is the catch-net at deploy time: the deploy still
|
|
15
|
+
// proceeds.
|
|
16
|
+
//
|
|
17
|
+
// Scope by design:
|
|
18
|
+
// - We only flag the empirically observed footgun: `/send-mail`.
|
|
19
|
+
// Not arbitrary calls to api.primitive.dev. Other endpoints have
|
|
20
|
+
// not surfaced the same pattern.
|
|
21
|
+
// - We require the URL string literal to immediately follow the
|
|
22
|
+
// `fetch(` token (allowing whitespace) so we don't trip on a
|
|
23
|
+
// comment that merely mentions the URL. esbuild strips most
|
|
24
|
+
// comments anyway, but anchoring on `fetch(` keeps the rule
|
|
25
|
+
// honest without trying to parse JS.
|
|
26
|
+
// - We only look at the bundle text passed in. Source maps and
|
|
27
|
+
// sibling files are not scanned.
|
|
28
|
+
// - Variable-URL cases (`fetch(url, ...)` where `url` was assembled
|
|
29
|
+
// elsewhere) are accepted false negatives. The value here is
|
|
30
|
+
// catching the obvious inline-literal case, not full taint
|
|
31
|
+
// analysis.
|
|
32
|
+
// Match `fetch(` then a string literal (single, double, or backtick)
|
|
33
|
+
// whose contents include `primitive.dev` and end with `/send-mail`
|
|
34
|
+
// (optionally with a query string or trailing path boundary). Examples
|
|
35
|
+
// matched:
|
|
36
|
+
// fetch("https://api.primitive.dev/v1/send-mail", {...})
|
|
37
|
+
// fetch(`https://www.primitive.dev/api/v1/send-mail`, {...})
|
|
38
|
+
// fetch('https://primitive.dev/api/v1/send-mail?wait=1')
|
|
39
|
+
//
|
|
40
|
+
// The `[^`'"]*` inside the literal forbids the closing quote
|
|
41
|
+
// character itself so we can't accidentally span across two adjacent
|
|
42
|
+
// string literals. The trailing `(?![A-Za-z0-9_-])` forbids any
|
|
43
|
+
// letter, digit, underscore, or hyphen immediately after `send-mail`
|
|
44
|
+
// so `/send-mail-template-preview` does not trip the rule. (Plain
|
|
45
|
+
// `\b` does not help here because `-` is itself a non-word character,
|
|
46
|
+
// so `mail\b` still matches `mail-...`.)
|
|
47
|
+
const RAW_SEND_MAIL_FETCH_REGEX = /fetch\s*\(\s*[`'"][^`'"]*primitive\.dev[^`'"]*\/send-mail(?![A-Za-z0-9_-])/g;
|
|
48
|
+
// How much surrounding text to include on either side of the match
|
|
49
|
+
// when building the sample snippet. Kept short on purpose: bundles
|
|
50
|
+
// are minified and a 120-char window is enough to spot the call
|
|
51
|
+
// without flooding stderr.
|
|
52
|
+
const SNIPPET_PADDING = 60;
|
|
53
|
+
export function detectRawSendMailFetch(bundleText) {
|
|
54
|
+
// Reset lastIndex defensively: this regex is module-scoped with
|
|
55
|
+
// the /g flag, so a prior call's state would skip the next match.
|
|
56
|
+
RAW_SEND_MAIL_FETCH_REGEX.lastIndex = 0;
|
|
57
|
+
const match = RAW_SEND_MAIL_FETCH_REGEX.exec(bundleText);
|
|
58
|
+
if (!match) {
|
|
59
|
+
return { found: false, sampleSnippet: null };
|
|
60
|
+
}
|
|
61
|
+
const start = Math.max(0, match.index - SNIPPET_PADDING);
|
|
62
|
+
const end = Math.min(bundleText.length, match.index + match[0].length + SNIPPET_PADDING);
|
|
63
|
+
const raw = bundleText.slice(start, end);
|
|
64
|
+
// Collapse newlines and runs of whitespace so the snippet is one
|
|
65
|
+
// readable line on stderr regardless of how the bundle was
|
|
66
|
+
// formatted.
|
|
67
|
+
const sampleSnippet = raw.replace(/\s+/g, " ").trim();
|
|
68
|
+
return { found: true, sampleSnippet };
|
|
69
|
+
}
|
|
70
|
+
// The stderr warning copy. Three beats: name the issue, name the
|
|
71
|
+
// SDK alternative, link the docs. Plus a one-line "deploy proceeds"
|
|
72
|
+
// reassurance. Kept punctuation simple (commas, periods, line
|
|
73
|
+
// breaks) so it doesn't trip the no-em-dashes hook and so the lines
|
|
74
|
+
// wrap predictably in a terminal.
|
|
75
|
+
export const RAW_SEND_MAIL_FETCH_WARNING_LINES = [
|
|
76
|
+
"warning: this bundle calls fetch(...) against /send-mail directly.",
|
|
77
|
+
"The Primitive SDK exposes createPrimitiveClient from",
|
|
78
|
+
"@primitivedotdev/sdk/api which handles host routing, error envelopes,",
|
|
79
|
+
"and gate denials for you. See https://www.primitive.dev/docs/functions",
|
|
80
|
+
"for the recommended in-handler pattern. Continuing with deploy.",
|
|
81
|
+
];
|
|
82
|
+
export function formatRawSendMailFetchWarning(finding) {
|
|
83
|
+
const lines = [...RAW_SEND_MAIL_FETCH_WARNING_LINES];
|
|
84
|
+
if (finding.sampleSnippet) {
|
|
85
|
+
lines.push(` found: ${finding.sampleSnippet}`);
|
|
86
|
+
}
|
|
87
|
+
return `${lines.join("\n")}\n`;
|
|
88
|
+
}
|
|
89
|
+
// Convenience: run the detector and, on a match, write the warning
|
|
90
|
+
// to a stderr-shaped writer. Pulled out so both deploy and redeploy
|
|
91
|
+
// share one code path and so the unit tests can pass a fake writer.
|
|
92
|
+
export function emitRawSendMailFetchWarning(bundleText, write) {
|
|
93
|
+
const finding = detectRawSendMailFetch(bundleText);
|
|
94
|
+
if (finding.found) {
|
|
95
|
+
write(formatRawSendMailFetchWarning(finding));
|
|
96
|
+
}
|
|
97
|
+
return finding;
|
|
98
|
+
}
|
|
@@ -2569,10 +2569,30 @@ export const openapiDocument = {
|
|
|
2569
2569
|
"post": {
|
|
2570
2570
|
"operationId": "testFunction",
|
|
2571
2571
|
"summary": "Send a test invocation",
|
|
2572
|
-
"description": "Sends a real test email from a Primitive-controlled sender to a\
|
|
2572
|
+
"description": "Sends a real test email from a Primitive-controlled sender to a\nlocal-part on one of the org's verified inbound domains. By\ndefault the recipient is a synthetic\n`__primitive_function_test+<random>@<domain>` address that\nevery handler's catch-all routing receives identically; pass\n`local_part` to override and exercise routing logic that\nbranches on a specific recipient (the common pattern when one\nfunction handles multiple inboxes like `summarize@` and\n`action@`). The function fires through the normal MX delivery\npath, so reply / send-mail calls from inside the handler\nagainst the inbound's `email.id` work the same as in\nproduction. Returns immediately after the send is queued; the\ninvocation appears on the function's invocations list within a\nfew seconds.\n\nRequires that the function is currently `deployed`. Returns 422\nif the function is in `pending` or `failed` state, or if the\norg has no verified inbound domain to receive the test mail.\nReturns 400 if `local_part` is set to a value that does not\nmatch the local-part character set.\n",
|
|
2573
2573
|
"tags": [
|
|
2574
2574
|
"Functions"
|
|
2575
2575
|
],
|
|
2576
|
+
"requestBody": {
|
|
2577
|
+
"required": false,
|
|
2578
|
+
"content": {
|
|
2579
|
+
"application/json": {
|
|
2580
|
+
"schema": {
|
|
2581
|
+
"type": "object",
|
|
2582
|
+
"properties": {
|
|
2583
|
+
"local_part": {
|
|
2584
|
+
"type": "string",
|
|
2585
|
+
"description": "Override the synthetic local-part. When set, the\ntest email is sent to `<local_part>@<picked-domain>`\ninstead of the default\n`__primitive_function_test+<random>@<picked-domain>`.\nMust start with an alphanumeric and contain only\nletters, digits, dots, plus signs, hyphens, or\nunderscores; 1-64 characters total.\n",
|
|
2586
|
+
"minLength": 1,
|
|
2587
|
+
"maxLength": 64,
|
|
2588
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$",
|
|
2589
|
+
"example": "summarize"
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
},
|
|
2576
2596
|
"responses": {
|
|
2577
2597
|
"200": {
|
|
2578
2598
|
"description": "Test send queued",
|
|
@@ -3034,8 +3034,8 @@ export const operationManifest = [
|
|
|
3034
3034
|
"binaryResponse": false,
|
|
3035
3035
|
"bodyRequired": false,
|
|
3036
3036
|
"command": "test-function",
|
|
3037
|
-
"description": "Sends a real test email from a Primitive-controlled sender to a\
|
|
3038
|
-
"hasJsonBody":
|
|
3037
|
+
"description": "Sends a real test email from a Primitive-controlled sender to a\nlocal-part on one of the org's verified inbound domains. By\ndefault the recipient is a synthetic\n`__primitive_function_test+<random>@<domain>` address that\nevery handler's catch-all routing receives identically; pass\n`local_part` to override and exercise routing logic that\nbranches on a specific recipient (the common pattern when one\nfunction handles multiple inboxes like `summarize@` and\n`action@`). The function fires through the normal MX delivery\npath, so reply / send-mail calls from inside the handler\nagainst the inbound's `email.id` work the same as in\nproduction. Returns immediately after the send is queued; the\ninvocation appears on the function's invocations list within a\nfew seconds.\n\nRequires that the function is currently `deployed`. Returns 422\nif the function is in `pending` or `failed` state, or if the\norg has no verified inbound domain to receive the test mail.\nReturns 400 if `local_part` is set to a value that does not\nmatch the local-part character set.\n",
|
|
3038
|
+
"hasJsonBody": true,
|
|
3039
3039
|
"method": "POST",
|
|
3040
3040
|
"operationId": "testFunction",
|
|
3041
3041
|
"path": "/functions/{id}/test",
|
|
@@ -3049,7 +3049,19 @@ export const operationManifest = [
|
|
|
3049
3049
|
}
|
|
3050
3050
|
],
|
|
3051
3051
|
"queryParams": [],
|
|
3052
|
-
"requestSchema":
|
|
3052
|
+
"requestSchema": {
|
|
3053
|
+
"type": "object",
|
|
3054
|
+
"properties": {
|
|
3055
|
+
"local_part": {
|
|
3056
|
+
"type": "string",
|
|
3057
|
+
"description": "Override the synthetic local-part. When set, the\ntest email is sent to `<local_part>@<picked-domain>`\ninstead of the default\n`__primitive_function_test+<random>@<picked-domain>`.\nMust start with an alphanumeric and contain only\nletters, digits, dots, plus signs, hyphens, or\nunderscores; 1-64 characters total.\n",
|
|
3058
|
+
"minLength": 1,
|
|
3059
|
+
"maxLength": 64,
|
|
3060
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$",
|
|
3061
|
+
"example": "summarize"
|
|
3062
|
+
}
|
|
3063
|
+
}
|
|
3064
|
+
},
|
|
3053
3065
|
"responseSchema": {
|
|
3054
3066
|
"type": "object",
|
|
3055
3067
|
"description": "Metadata returned by POST /functions/{id}/test. The send is\nqueued; the actual invocation lands on the function's\ninvocations list a few seconds later as the inbound mail\ntraverses the MX path.\n",
|
package/oclif.manifest.json
CHANGED
|
@@ -3565,7 +3565,7 @@
|
|
|
3565
3565
|
"functions:test-function": {
|
|
3566
3566
|
"aliases": [],
|
|
3567
3567
|
"args": {},
|
|
3568
|
-
"description": "Sends a real test email from a Primitive-controlled sender to a\
|
|
3568
|
+
"description": "Sends a real test email from a Primitive-controlled sender to a\nlocal-part on one of the org's verified inbound domains. By\ndefault the recipient is a synthetic\n`__primitive_function_test+<random>@<domain>` address that\nevery handler's catch-all routing receives identically; pass\n`local_part` to override and exercise routing logic that\nbranches on a specific recipient (the common pattern when one\nfunction handles multiple inboxes like `summarize@` and\n`action@`). The function fires through the normal MX delivery\npath, so reply / send-mail calls from inside the handler\nagainst the inbound's `email.id` work the same as in\nproduction. Returns immediately after the send is queued; the\ninvocation appears on the function's invocations list within a\nfew seconds.\n\nRequires that the function is currently `deployed`. Returns 422\nif the function is in `pending` or `failed` state, or if the\norg has no verified inbound domain to receive the test mail.\nReturns 400 if `local_part` is set to a value that does not\nmatch the local-part character set.\n",
|
|
3569
3569
|
"flags": {
|
|
3570
3570
|
"api-key": {
|
|
3571
3571
|
"description": "Primitive API key (defaults to PRIMITIVE_API_KEY or saved `primitive login` credentials)",
|
|
@@ -3606,6 +3606,27 @@
|
|
|
3606
3606
|
"hasDynamicHelp": false,
|
|
3607
3607
|
"multiple": false,
|
|
3608
3608
|
"type": "option"
|
|
3609
|
+
},
|
|
3610
|
+
"raw-body": {
|
|
3611
|
+
"description": "Full request body as raw JSON. Escape hatch for nested or complex fields (e.g. arrays); prefer per-field flags (e.g. --to, --from, --body-text) when available.",
|
|
3612
|
+
"name": "raw-body",
|
|
3613
|
+
"hasDynamicHelp": false,
|
|
3614
|
+
"multiple": false,
|
|
3615
|
+
"type": "option"
|
|
3616
|
+
},
|
|
3617
|
+
"body-file": {
|
|
3618
|
+
"description": "Path to a JSON file used as the request body. Same role as --raw-body for callers passing a saved payload.",
|
|
3619
|
+
"name": "body-file",
|
|
3620
|
+
"hasDynamicHelp": false,
|
|
3621
|
+
"multiple": false,
|
|
3622
|
+
"type": "option"
|
|
3623
|
+
},
|
|
3624
|
+
"local-part": {
|
|
3625
|
+
"description": "Override the synthetic local-part. When set, the test email is sent to `<local_part>@<picked-domain>` instead of the default `__primitive_function_test+<random>@<picked-domain>`. Must start with an alphanumeric and contain only letters, digits, dots, plus signs, hyphens, or underscores; 1-64 characters total.",
|
|
3626
|
+
"name": "local-part",
|
|
3627
|
+
"hasDynamicHelp": false,
|
|
3628
|
+
"multiple": false,
|
|
3629
|
+
"type": "option"
|
|
3609
3630
|
}
|
|
3610
3631
|
},
|
|
3611
3632
|
"hasDynamicHelp": false,
|
|
@@ -4283,5 +4304,5 @@
|
|
|
4283
4304
|
"enableJsonFlag": false
|
|
4284
4305
|
}
|
|
4285
4306
|
},
|
|
4286
|
-
"version": "0.
|
|
4307
|
+
"version": "0.25.0"
|
|
4287
4308
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primitivedotdev/sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Official Primitive Node.js SDK: webhook, api, openapi, contract, and parser modules",
|
|
3
|
+
"version": "0.25.0",
|
|
4
|
+
"description": "Official Primitive Node.js SDK: webhook, api, openapi, contract, and parser runtime modules. The CLI moved to @primitivedotdev/cli; this package retains the CLI as a deprecated alias for a few minor releases.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|