@primitivedotdev/sdk 0.19.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -321,7 +321,7 @@ type Options$1<TData extends TDataShape = TDataShape, ThrowOnError extends boole
321
321
  //#endregion
322
322
  //#region src/api/generated/types.gen.d.ts
323
323
  type ClientOptions = {
324
- baseUrl: 'https://www.primitive.dev/api/v1' | (string & {});
324
+ baseUrl: 'https://www.primitive.dev/api/v1' | 'https://api.primitive.dev/v1' | 'https://api.primitive.dev/v1' | 'https://www.primitive.dev/api/v1' | (string & {});
325
325
  };
326
326
  type SuccessEnvelope = {
327
327
  success: boolean;
@@ -347,7 +347,7 @@ type PaginationMeta = {
347
347
  type ErrorResponse = {
348
348
  success: boolean;
349
349
  error: {
350
- code: 'unauthorized' | 'forbidden' | 'not_found' | 'validation_error' | 'rate_limit_exceeded' | 'internal_error' | 'conflict' | 'mx_conflict' | 'outbound_disabled' | 'cannot_send_from_domain' | 'recipient_not_allowed' | 'outbound_key_missing' | 'outbound_unreachable' | 'outbound_key_invalid' | 'outbound_capacity_exhausted' | 'outbound_response_malformed' | 'outbound_relay_failed' | 'discard_not_enabled' | 'inbound_not_repliable' | 'authorization_pending' | 'slow_down' | 'access_denied' | 'expired_token' | 'invalid_device_code';
350
+ code: 'unauthorized' | 'forbidden' | 'not_found' | 'validation_error' | 'rate_limit_exceeded' | 'internal_error' | 'conflict' | 'mx_conflict' | 'outbound_disabled' | 'cannot_send_from_domain' | 'recipient_not_allowed' | 'outbound_key_missing' | 'outbound_unreachable' | 'outbound_key_invalid' | 'outbound_capacity_exhausted' | 'outbound_response_malformed' | 'outbound_relay_failed' | 'discard_not_enabled' | 'inbound_not_repliable' | 'search_timeout' | 'authorization_pending' | 'slow_down' | 'access_denied' | 'expired_token' | 'invalid_device_code';
351
351
  message: string;
352
352
  /**
353
353
  * Optional structured data that callers can inspect to recover
@@ -644,6 +644,66 @@ type EmailSummary = {
644
644
  webhook_status?: EmailWebhookStatus;
645
645
  webhook_attempt_count: number;
646
646
  };
647
+ type EmailSearchHighlights = {
648
+ /**
649
+ * Subject snippets with matching terms highlighted.
650
+ */
651
+ subject: Array<string>;
652
+ /**
653
+ * Body snippets with matching terms highlighted.
654
+ */
655
+ body: Array<string>;
656
+ };
657
+ type EmailSearchResult = EmailSummary & {
658
+ /**
659
+ * Number of parsed attachments on the email.
660
+ */
661
+ attachment_count: number;
662
+ /**
663
+ * Whether the parsed From address is known to this org from prior authenticated inbound mail.
664
+ */
665
+ from_known_address: boolean;
666
+ /**
667
+ * Relevance score. Present only when sorting by relevance.
668
+ */
669
+ score?: number;
670
+ highlights?: EmailSearchHighlights;
671
+ };
672
+ type EmailSearchMeta = {
673
+ /**
674
+ * Total number of matching records, capped when `total_capped` is true.
675
+ */
676
+ total: number;
677
+ /**
678
+ * Whether `total` was capped instead of counted exactly.
679
+ */
680
+ total_capped: boolean;
681
+ /**
682
+ * Page size used for this request.
683
+ */
684
+ limit: number;
685
+ /**
686
+ * Cursor for the next search page, or null if no more results.
687
+ */
688
+ cursor: string | null;
689
+ /**
690
+ * Sort mode used for the result page.
691
+ */
692
+ sort: 'relevance' | 'received_at_desc' | 'received_at_asc';
693
+ };
694
+ type EmailSearchFacetBucket = {
695
+ value: string | null;
696
+ count: number;
697
+ };
698
+ type EmailSearchFacets = {
699
+ by_sender: Array<EmailSearchFacetBucket>;
700
+ by_domain: Array<EmailSearchFacetBucket>;
701
+ by_status: Array<EmailSearchFacetBucket>;
702
+ has_attachment: {
703
+ true: number;
704
+ false: number;
705
+ };
706
+ };
647
707
  type EmailDetail = {
648
708
  id: string;
649
709
  message_id?: string | null;
@@ -1500,6 +1560,221 @@ type DiscardContentResult = {
1500
1560
  */
1501
1561
  already_discarded: boolean;
1502
1562
  };
1563
+ /**
1564
+ * Lifecycle state of the latest deploy attempt:
1565
+ * * `pending` — deploy in flight; the runtime has not yet
1566
+ * confirmed the new bundle is live.
1567
+ * * `deployed` — the running edge handler is the latest code.
1568
+ * * `failed` — the most recent deploy attempt failed; the
1569
+ * previously-live code (if any) is still running. The
1570
+ * `deploy_error` field carries the error message.
1571
+ *
1572
+ */
1573
+ type FunctionDeployStatus = 'pending' | 'deployed' | 'failed';
1574
+ /**
1575
+ * One row from the function listing.
1576
+ */
1577
+ type FunctionListItem = {
1578
+ /**
1579
+ * Function id, also the script name in the edge runtime.
1580
+ */
1581
+ id: string;
1582
+ /**
1583
+ * Slug-style name set on creation. Stable; cannot be changed.
1584
+ */
1585
+ name: string;
1586
+ deploy_status: FunctionDeployStatus;
1587
+ /**
1588
+ * Timestamp of the most recent successful deploy. Null until the first deploy succeeds.
1589
+ */
1590
+ deployed_at?: string | null;
1591
+ /**
1592
+ * URL the platform's webhook delivery loop posts to in order
1593
+ * to invoke the function. Reference only; not directly
1594
+ * callable from outside.
1595
+ *
1596
+ */
1597
+ gateway_url: string;
1598
+ created_at: string;
1599
+ updated_at: string;
1600
+ };
1601
+ /**
1602
+ * Full function record returned by GET / PUT.
1603
+ */
1604
+ type FunctionDetail = {
1605
+ id: string;
1606
+ name: string;
1607
+ /**
1608
+ * The bundled handler source. UTF-8 string up to 1 MiB. The
1609
+ * same value most recently passed as `code` to POST or PUT.
1610
+ *
1611
+ */
1612
+ code: string;
1613
+ deploy_status: FunctionDeployStatus;
1614
+ /**
1615
+ * Error message from the most recent failed deploy, or null
1616
+ * after a successful deploy. Surface this to users to explain
1617
+ * a `failed` status without polling.
1618
+ *
1619
+ */
1620
+ deploy_error?: string | null;
1621
+ deployed_at?: string | null;
1622
+ gateway_url: string;
1623
+ created_at: string;
1624
+ updated_at: string;
1625
+ };
1626
+ type CreateFunctionInput = {
1627
+ /**
1628
+ * Slug-style name. Lowercase letters, digits, hyphens, and
1629
+ * underscores. 1 to 64 characters. Must be unique within the
1630
+ * org; a 409 is returned on collision.
1631
+ *
1632
+ */
1633
+ name: string;
1634
+ /**
1635
+ * Bundled handler as a single ESM module. Up to 1 MiB UTF-8.
1636
+ * Must export a default `{ async fetch(req, env, ctx) { ... } }`
1637
+ * object.
1638
+ *
1639
+ */
1640
+ code: string;
1641
+ /**
1642
+ * Optional source map for the bundle. Up to 5 MiB UTF-8.
1643
+ * Stored only on the runtime side (not in Primitive's
1644
+ * database) and used to symbolicate stack traces in the
1645
+ * function's logs.
1646
+ *
1647
+ */
1648
+ sourceMap?: string;
1649
+ };
1650
+ /**
1651
+ * Returned by POST /functions on a successful deploy.
1652
+ */
1653
+ type CreateFunctionResult = {
1654
+ id: string;
1655
+ name: string;
1656
+ deploy_status: FunctionDeployStatus;
1657
+ gateway_url: string;
1658
+ };
1659
+ type UpdateFunctionInput = {
1660
+ /**
1661
+ * New bundled handler. Same rules as CreateFunctionInput.code.
1662
+ */
1663
+ code: string;
1664
+ sourceMap?: string;
1665
+ };
1666
+ /**
1667
+ * Metadata returned by POST /functions/{id}/test. The send is
1668
+ * queued; the actual invocation lands on the function's
1669
+ * invocations list a few seconds later as the inbound mail
1670
+ * traverses the MX path.
1671
+ *
1672
+ */
1673
+ type TestInvocationResult = {
1674
+ /**
1675
+ * Verified inbound domain the test email was sent to.
1676
+ */
1677
+ inbound_domain: string;
1678
+ /**
1679
+ * Synthetic local-part plus inbound_domain. Visible in the org's inbox.
1680
+ */
1681
+ to: string;
1682
+ /**
1683
+ * Primitive-controlled outbound sender used for the test.
1684
+ */
1685
+ from: string;
1686
+ /**
1687
+ * Outbound message id from the underlying send. NOT the
1688
+ * inbound email's id; the inbound id is created when the
1689
+ * email arrives via MX and lands on the function's
1690
+ * invocations list.
1691
+ *
1692
+ */
1693
+ send_id: string;
1694
+ /**
1695
+ * Subject placed on the test email so it can be located in the inbox.
1696
+ */
1697
+ subject: string;
1698
+ /**
1699
+ * ISO timestamp suitable as a `since` lower bound when
1700
+ * polling /emails for the inbound's arrival. Captured
1701
+ * slightly before the send to absorb light clock skew.
1702
+ *
1703
+ */
1704
+ poll_since: string;
1705
+ /**
1706
+ * Function detail page where invocations show up live.
1707
+ */
1708
+ watch_url: string;
1709
+ };
1710
+ /**
1711
+ * One row from GET /functions/{id}/secrets. Discriminate on the
1712
+ * `managed` field:
1713
+ * * `managed = true` — system secret provisioned by Primitive.
1714
+ * `description` is set; `created_at` / `updated_at` are
1715
+ * null because the row is virtual (resolved at deploy time
1716
+ * from the managed registry, not stored in the secrets
1717
+ * table).
1718
+ * * `managed = false` — secret the user set via the API.
1719
+ * `created_at` / `updated_at` are set; `description` is
1720
+ * null.
1721
+ *
1722
+ */
1723
+ type FunctionSecretListItem = {
1724
+ key: string;
1725
+ /**
1726
+ * True for managed system secrets, false for user-set entries.
1727
+ */
1728
+ managed: boolean;
1729
+ /**
1730
+ * Set on managed entries only; null on user-set entries.
1731
+ */
1732
+ description?: string | null;
1733
+ /**
1734
+ * Set on user-set entries only; null on managed entries.
1735
+ */
1736
+ created_at?: string | null;
1737
+ /**
1738
+ * Set on user-set entries only; null on managed entries.
1739
+ */
1740
+ updated_at?: string | null;
1741
+ };
1742
+ /**
1743
+ * Body for POST /functions/{id}/secrets.
1744
+ */
1745
+ type CreateFunctionSecretInput = {
1746
+ /**
1747
+ * Uppercase letters, digits, and underscores. Must start with
1748
+ * a letter or underscore. System-managed keys (e.g.
1749
+ * PRIMITIVE_WEBHOOK_SECRET) are reserved.
1750
+ *
1751
+ */
1752
+ key: string;
1753
+ /**
1754
+ * Secret value, up to 4096 UTF-8 bytes. Encrypted at rest.
1755
+ * Never returned by any read endpoint.
1756
+ *
1757
+ */
1758
+ value: string;
1759
+ };
1760
+ /**
1761
+ * Body for PUT /functions/{id}/secrets/{key}. Key comes from the path.
1762
+ */
1763
+ type SetFunctionSecretInput = {
1764
+ value: string;
1765
+ };
1766
+ /**
1767
+ * Returned by POST and PUT secret routes.
1768
+ */
1769
+ type FunctionSecretWriteResult = {
1770
+ key: string;
1771
+ created_at: string;
1772
+ updated_at: string;
1773
+ /**
1774
+ * True if this call inserted a new row, false if it updated an existing one.
1775
+ */
1776
+ created: boolean;
1777
+ };
1503
1778
  /**
1504
1779
  * Resource UUID
1505
1780
  */
@@ -1971,6 +2246,109 @@ type ListEmailsResponses = {
1971
2246
  };
1972
2247
  };
1973
2248
  type ListEmailsResponse = ListEmailsResponses[keyof ListEmailsResponses];
2249
+ type SearchEmailsData = {
2250
+ body?: never;
2251
+ path?: never;
2252
+ query?: {
2253
+ /**
2254
+ * Full-text search DSL query.
2255
+ */
2256
+ q?: string;
2257
+ /**
2258
+ * Filter by sender address or sender domain.
2259
+ */
2260
+ from?: string;
2261
+ /**
2262
+ * Filter by recipient address or recipient domain.
2263
+ */
2264
+ to?: string;
2265
+ /**
2266
+ * Full-text search restricted to the subject field.
2267
+ */
2268
+ subject?: string;
2269
+ /**
2270
+ * Full-text search restricted to the parsed text body.
2271
+ */
2272
+ body?: string;
2273
+ /**
2274
+ * Filter by domain ID.
2275
+ */
2276
+ domain_id?: string;
2277
+ /**
2278
+ * Filter by inbound email lifecycle status.
2279
+ */
2280
+ status?: EmailStatus;
2281
+ /**
2282
+ * Filter emails received on or after this timestamp.
2283
+ */
2284
+ date_from?: string;
2285
+ /**
2286
+ * Filter emails received on or before this timestamp.
2287
+ */
2288
+ date_to?: string;
2289
+ /**
2290
+ * Filter by whether the email has one or more attachments.
2291
+ */
2292
+ has_attachment?: 'true' | 'false';
2293
+ /**
2294
+ * Filter to emails with spam score below this value.
2295
+ */
2296
+ spam_score_lt?: number;
2297
+ /**
2298
+ * Filter to emails with spam score greater than or equal to this value.
2299
+ */
2300
+ spam_score_gte?: number;
2301
+ /**
2302
+ * Sort mode. Defaults to relevance when a text query is present,
2303
+ * otherwise `received_at_desc`.
2304
+ *
2305
+ */
2306
+ sort?: 'relevance' | 'received_at_desc' | 'received_at_asc';
2307
+ /**
2308
+ * Opaque pagination cursor from a previous search response.
2309
+ */
2310
+ cursor?: string;
2311
+ /**
2312
+ * Number of results per page
2313
+ */
2314
+ limit?: number;
2315
+ /**
2316
+ * Include subject/body highlight snippets when text search is active.
2317
+ */
2318
+ snippet?: 'true' | 'false';
2319
+ /**
2320
+ * Include facet counts for sender, domain, status, and attachment presence.
2321
+ */
2322
+ include_facets?: 'true' | 'false';
2323
+ };
2324
+ url: '/emails/search';
2325
+ };
2326
+ type SearchEmailsErrors = {
2327
+ /**
2328
+ * Invalid request parameters
2329
+ */
2330
+ 400: ErrorResponse;
2331
+ /**
2332
+ * Invalid or missing API key
2333
+ */
2334
+ 401: ErrorResponse;
2335
+ /**
2336
+ * Search query timed out
2337
+ */
2338
+ 504: ErrorResponse;
2339
+ };
2340
+ type SearchEmailsError = SearchEmailsErrors[keyof SearchEmailsErrors];
2341
+ type SearchEmailsResponses = {
2342
+ /**
2343
+ * Search results
2344
+ */
2345
+ 200: SuccessEnvelope & {
2346
+ data: Array<EmailSearchResult>;
2347
+ meta: EmailSearchMeta;
2348
+ facets?: EmailSearchFacets;
2349
+ };
2350
+ };
2351
+ type SearchEmailsResponse = SearchEmailsResponses[keyof SearchEmailsResponses];
1974
2352
  type DeleteEmailData = {
1975
2353
  body?: never;
1976
2354
  path: {
@@ -2827,66 +3205,432 @@ type GetSentEmailResponses = {
2827
3205
  };
2828
3206
  };
2829
3207
  type GetSentEmailResponse = GetSentEmailResponses[keyof GetSentEmailResponses];
2830
- declare namespace sdk_gen_d_exports {
2831
- export { Options, addDomain, cliLogout, createEndpoint, createFilter, deleteDomain, deleteEmail, deleteEndpoint, deleteFilter, discardEmailContent, downloadAttachments, downloadRawEmail, getAccount, getEmail, getSendPermissions, getSentEmail, getStorageStats, getWebhookSecret, listDeliveries, listDomains, listEmails, listEndpoints, listFilters, listSentEmails, pollCliLogin, replayDelivery, replayEmailWebhooks, replyToEmail, rotateWebhookSecret, sendEmail, startCliLogin, testEndpoint, updateAccount, updateDomain, updateEndpoint, updateFilter, verifyDomain };
2832
- }
2833
- type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options$1<TData, ThrowOnError, TResponse> & {
3208
+ type ListFunctionsData = {
3209
+ body?: never;
3210
+ path?: never;
3211
+ query?: never;
3212
+ url: '/functions';
3213
+ };
3214
+ type ListFunctionsErrors = {
2834
3215
  /**
2835
- * You can provide a client instance returned by `createClient()` instead of
2836
- * individual options. This might be also useful if you want to implement a
2837
- * custom client.
3216
+ * Invalid or missing API key
2838
3217
  */
2839
- client?: Client;
3218
+ 401: ErrorResponse;
3219
+ };
3220
+ type ListFunctionsError = ListFunctionsErrors[keyof ListFunctionsErrors];
3221
+ type ListFunctionsResponses = {
2840
3222
  /**
2841
- * You can pass arbitrary values through the `meta` object. This can be
2842
- * used to access values that aren't defined as part of the SDK function.
3223
+ * List of functions
2843
3224
  */
2844
- meta?: Record<string, unknown>;
3225
+ 200: SuccessEnvelope & {
3226
+ data?: Array<FunctionListItem>;
3227
+ };
2845
3228
  };
2846
- /**
2847
- * Start CLI browser login
2848
- *
2849
- * Starts a browser-assisted CLI login session. The response includes a
2850
- * device code for polling and a user code that the user approves in the
2851
- * browser. This endpoint does not require an API key.
2852
- *
2853
- */
2854
- declare const startCliLogin: <ThrowOnError extends boolean = false>(options?: Options<StartCliLoginData, ThrowOnError>) => RequestResult<StartCliLoginResponses, StartCliLoginErrors, ThrowOnError, "fields">;
2855
- /**
2856
- * Poll CLI browser login
2857
- *
2858
- * Polls a CLI login session until the browser approval either succeeds,
2859
- * is denied, expires, or is polled too quickly. The API key is generated
2860
- * only after approval and is returned exactly once.
2861
- *
2862
- */
2863
- declare const pollCliLogin: <ThrowOnError extends boolean = false>(options: Options<PollCliLoginData, ThrowOnError>) => RequestResult<PollCliLoginResponses, PollCliLoginErrors, ThrowOnError, "fields">;
2864
- /**
2865
- * Revoke the current CLI API key
2866
- *
2867
- * Revokes the API key used to authenticate the request. CLI clients use
2868
- * this endpoint during `primitive logout` before removing local credentials.
2869
- *
2870
- */
2871
- declare const cliLogout: <ThrowOnError extends boolean = false>(options?: Options<CliLogoutData, ThrowOnError>) => RequestResult<CliLogoutResponses, CliLogoutErrors, ThrowOnError, "fields">;
2872
- /**
2873
- * Get account info
2874
- */
2875
- declare const getAccount: <ThrowOnError extends boolean = false>(options?: Options<GetAccountData, ThrowOnError>) => RequestResult<GetAccountResponses, GetAccountErrors, ThrowOnError, "fields">;
2876
- /**
2877
- * Update account settings
2878
- */
2879
- declare const updateAccount: <ThrowOnError extends boolean = false>(options: Options<UpdateAccountData, ThrowOnError>) => RequestResult<UpdateAccountResponses, UpdateAccountErrors, ThrowOnError, "fields">;
2880
- /**
2881
- * Get storage usage
2882
- */
2883
- declare const getStorageStats: <ThrowOnError extends boolean = false>(options?: Options<GetStorageStatsData, ThrowOnError>) => RequestResult<GetStorageStatsResponses, GetStorageStatsErrors, ThrowOnError, "fields">;
2884
- /**
2885
- * Get webhook signing secret
2886
- *
2887
- * Returns the webhook signing secret for your account. If no
2888
- * secret exists yet, one is generated automatically on first
2889
- * access.
3229
+ type ListFunctionsResponse = ListFunctionsResponses[keyof ListFunctionsResponses];
3230
+ type CreateFunctionData = {
3231
+ body: CreateFunctionInput;
3232
+ path?: never;
3233
+ query?: never;
3234
+ url: '/functions';
3235
+ };
3236
+ type CreateFunctionErrors = {
3237
+ /**
3238
+ * Invalid request parameters
3239
+ */
3240
+ 400: ErrorResponse;
3241
+ /**
3242
+ * Invalid or missing API key
3243
+ */
3244
+ 401: ErrorResponse;
3245
+ /**
3246
+ * A function with this name already exists in the org
3247
+ */
3248
+ 409: ErrorResponse;
3249
+ /**
3250
+ * Primitive could not complete the downstream SMTP request
3251
+ */
3252
+ 502: ErrorResponse;
3253
+ };
3254
+ type CreateFunctionError = CreateFunctionErrors[keyof CreateFunctionErrors];
3255
+ type CreateFunctionResponses = {
3256
+ /**
3257
+ * Function created and deployed
3258
+ */
3259
+ 201: SuccessEnvelope & {
3260
+ data?: CreateFunctionResult;
3261
+ };
3262
+ };
3263
+ type CreateFunctionResponse = CreateFunctionResponses[keyof CreateFunctionResponses];
3264
+ type DeleteFunctionData = {
3265
+ body?: never;
3266
+ path: {
3267
+ /**
3268
+ * Resource UUID
3269
+ */
3270
+ id: string;
3271
+ };
3272
+ query?: never;
3273
+ url: '/functions/{id}';
3274
+ };
3275
+ type DeleteFunctionErrors = {
3276
+ /**
3277
+ * Invalid or missing API key
3278
+ */
3279
+ 401: ErrorResponse;
3280
+ /**
3281
+ * Resource not found
3282
+ */
3283
+ 404: ErrorResponse;
3284
+ /**
3285
+ * Primitive could not complete the downstream SMTP request
3286
+ */
3287
+ 502: ErrorResponse;
3288
+ };
3289
+ type DeleteFunctionError = DeleteFunctionErrors[keyof DeleteFunctionErrors];
3290
+ type DeleteFunctionResponses = {
3291
+ /**
3292
+ * Resource deleted
3293
+ */
3294
+ 200: SuccessEnvelope & {
3295
+ data?: {
3296
+ deleted: boolean;
3297
+ };
3298
+ };
3299
+ };
3300
+ type DeleteFunctionResponse = DeleteFunctionResponses[keyof DeleteFunctionResponses];
3301
+ type GetFunctionData = {
3302
+ body?: never;
3303
+ path: {
3304
+ /**
3305
+ * Resource UUID
3306
+ */
3307
+ id: string;
3308
+ };
3309
+ query?: never;
3310
+ url: '/functions/{id}';
3311
+ };
3312
+ type GetFunctionErrors = {
3313
+ /**
3314
+ * Invalid or missing API key
3315
+ */
3316
+ 401: ErrorResponse;
3317
+ /**
3318
+ * Resource not found
3319
+ */
3320
+ 404: ErrorResponse;
3321
+ };
3322
+ type GetFunctionError = GetFunctionErrors[keyof GetFunctionErrors];
3323
+ type GetFunctionResponses = {
3324
+ /**
3325
+ * Function record
3326
+ */
3327
+ 200: SuccessEnvelope & {
3328
+ data?: FunctionDetail;
3329
+ };
3330
+ };
3331
+ type GetFunctionResponse = GetFunctionResponses[keyof GetFunctionResponses];
3332
+ type UpdateFunctionData = {
3333
+ body: UpdateFunctionInput;
3334
+ path: {
3335
+ /**
3336
+ * Resource UUID
3337
+ */
3338
+ id: string;
3339
+ };
3340
+ query?: never;
3341
+ url: '/functions/{id}';
3342
+ };
3343
+ type UpdateFunctionErrors = {
3344
+ /**
3345
+ * Invalid request parameters
3346
+ */
3347
+ 400: ErrorResponse;
3348
+ /**
3349
+ * Invalid or missing API key
3350
+ */
3351
+ 401: ErrorResponse;
3352
+ /**
3353
+ * Resource not found
3354
+ */
3355
+ 404: ErrorResponse;
3356
+ /**
3357
+ * Primitive could not complete the downstream SMTP request
3358
+ */
3359
+ 502: ErrorResponse;
3360
+ };
3361
+ type UpdateFunctionError = UpdateFunctionErrors[keyof UpdateFunctionErrors];
3362
+ type UpdateFunctionResponses = {
3363
+ /**
3364
+ * Updated function
3365
+ */
3366
+ 200: SuccessEnvelope & {
3367
+ data?: FunctionDetail;
3368
+ };
3369
+ };
3370
+ type UpdateFunctionResponse = UpdateFunctionResponses[keyof UpdateFunctionResponses];
3371
+ type TestFunctionData = {
3372
+ body?: never;
3373
+ path: {
3374
+ /**
3375
+ * Resource UUID
3376
+ */
3377
+ id: string;
3378
+ };
3379
+ query?: never;
3380
+ url: '/functions/{id}/test';
3381
+ };
3382
+ type TestFunctionErrors = {
3383
+ /**
3384
+ * Invalid request parameters
3385
+ */
3386
+ 400: ErrorResponse;
3387
+ /**
3388
+ * Invalid or missing API key
3389
+ */
3390
+ 401: ErrorResponse;
3391
+ /**
3392
+ * Resource not found
3393
+ */
3394
+ 404: ErrorResponse;
3395
+ /**
3396
+ * Function not in a state that can be invoked, or no inbound domain configured
3397
+ */
3398
+ 422: ErrorResponse;
3399
+ /**
3400
+ * Primitive could not complete the downstream SMTP request
3401
+ */
3402
+ 502: ErrorResponse;
3403
+ /**
3404
+ * Sending agent misconfigured
3405
+ */
3406
+ 503: ErrorResponse;
3407
+ };
3408
+ type TestFunctionError = TestFunctionErrors[keyof TestFunctionErrors];
3409
+ type TestFunctionResponses = {
3410
+ /**
3411
+ * Test send queued
3412
+ */
3413
+ 200: SuccessEnvelope & {
3414
+ data?: TestInvocationResult;
3415
+ };
3416
+ };
3417
+ type TestFunctionResponse = TestFunctionResponses[keyof TestFunctionResponses];
3418
+ type ListFunctionSecretsData = {
3419
+ body?: never;
3420
+ path: {
3421
+ /**
3422
+ * Resource UUID
3423
+ */
3424
+ id: string;
3425
+ };
3426
+ query?: never;
3427
+ url: '/functions/{id}/secrets';
3428
+ };
3429
+ type ListFunctionSecretsErrors = {
3430
+ /**
3431
+ * Invalid or missing API key
3432
+ */
3433
+ 401: ErrorResponse;
3434
+ /**
3435
+ * Resource not found
3436
+ */
3437
+ 404: ErrorResponse;
3438
+ };
3439
+ type ListFunctionSecretsError = ListFunctionSecretsErrors[keyof ListFunctionSecretsErrors];
3440
+ type ListFunctionSecretsResponses = {
3441
+ /**
3442
+ * List of secrets (metadata only, no values)
3443
+ */
3444
+ 200: SuccessEnvelope & {
3445
+ data?: {
3446
+ items: Array<FunctionSecretListItem>;
3447
+ };
3448
+ };
3449
+ };
3450
+ type ListFunctionSecretsResponse = ListFunctionSecretsResponses[keyof ListFunctionSecretsResponses];
3451
+ type CreateFunctionSecretData = {
3452
+ body: CreateFunctionSecretInput;
3453
+ path: {
3454
+ /**
3455
+ * Resource UUID
3456
+ */
3457
+ id: string;
3458
+ };
3459
+ query?: never;
3460
+ url: '/functions/{id}/secrets';
3461
+ };
3462
+ type CreateFunctionSecretErrors = {
3463
+ /**
3464
+ * Invalid request parameters
3465
+ */
3466
+ 400: ErrorResponse;
3467
+ /**
3468
+ * Invalid or missing API key
3469
+ */
3470
+ 401: ErrorResponse;
3471
+ /**
3472
+ * Resource not found
3473
+ */
3474
+ 404: ErrorResponse;
3475
+ };
3476
+ type CreateFunctionSecretError = CreateFunctionSecretErrors[keyof CreateFunctionSecretErrors];
3477
+ type CreateFunctionSecretResponses = {
3478
+ /**
3479
+ * Secret updated
3480
+ */
3481
+ 200: SuccessEnvelope & {
3482
+ data?: FunctionSecretWriteResult;
3483
+ };
3484
+ /**
3485
+ * Secret created
3486
+ */
3487
+ 201: SuccessEnvelope & {
3488
+ data?: FunctionSecretWriteResult;
3489
+ };
3490
+ };
3491
+ type CreateFunctionSecretResponse = CreateFunctionSecretResponses[keyof CreateFunctionSecretResponses];
3492
+ type DeleteFunctionSecretData = {
3493
+ body?: never;
3494
+ path: {
3495
+ /**
3496
+ * Resource UUID
3497
+ */
3498
+ id: string;
3499
+ /**
3500
+ * Secret key. Must match `^[A-Z_][A-Z0-9_]*$`.
3501
+ */
3502
+ key: string;
3503
+ };
3504
+ query?: never;
3505
+ url: '/functions/{id}/secrets/{key}';
3506
+ };
3507
+ type DeleteFunctionSecretErrors = {
3508
+ /**
3509
+ * Invalid request parameters
3510
+ */
3511
+ 400: ErrorResponse;
3512
+ /**
3513
+ * Invalid or missing API key
3514
+ */
3515
+ 401: ErrorResponse;
3516
+ /**
3517
+ * Resource not found
3518
+ */
3519
+ 404: ErrorResponse;
3520
+ };
3521
+ type DeleteFunctionSecretError = DeleteFunctionSecretErrors[keyof DeleteFunctionSecretErrors];
3522
+ type DeleteFunctionSecretResponses = {
3523
+ /**
3524
+ * Secret deleted
3525
+ */
3526
+ 204: void;
3527
+ };
3528
+ type DeleteFunctionSecretResponse = DeleteFunctionSecretResponses[keyof DeleteFunctionSecretResponses];
3529
+ type SetFunctionSecretData = {
3530
+ body: SetFunctionSecretInput;
3531
+ path: {
3532
+ /**
3533
+ * Resource UUID
3534
+ */
3535
+ id: string;
3536
+ /**
3537
+ * Secret key. Must match `^[A-Z_][A-Z0-9_]*$`.
3538
+ */
3539
+ key: string;
3540
+ };
3541
+ query?: never;
3542
+ url: '/functions/{id}/secrets/{key}';
3543
+ };
3544
+ type SetFunctionSecretErrors = {
3545
+ /**
3546
+ * Invalid request parameters
3547
+ */
3548
+ 400: ErrorResponse;
3549
+ /**
3550
+ * Invalid or missing API key
3551
+ */
3552
+ 401: ErrorResponse;
3553
+ /**
3554
+ * Resource not found
3555
+ */
3556
+ 404: ErrorResponse;
3557
+ };
3558
+ type SetFunctionSecretError = SetFunctionSecretErrors[keyof SetFunctionSecretErrors];
3559
+ type SetFunctionSecretResponses = {
3560
+ /**
3561
+ * Secret updated
3562
+ */
3563
+ 200: SuccessEnvelope & {
3564
+ data?: FunctionSecretWriteResult;
3565
+ };
3566
+ /**
3567
+ * Secret created
3568
+ */
3569
+ 201: SuccessEnvelope & {
3570
+ data?: FunctionSecretWriteResult;
3571
+ };
3572
+ };
3573
+ type SetFunctionSecretResponse = SetFunctionSecretResponses[keyof SetFunctionSecretResponses];
3574
+ declare namespace sdk_gen_d_exports {
3575
+ export { Options, addDomain, cliLogout, createEndpoint, createFilter, createFunction, createFunctionSecret, deleteDomain, deleteEmail, deleteEndpoint, deleteFilter, deleteFunction, deleteFunctionSecret, discardEmailContent, downloadAttachments, downloadRawEmail, getAccount, getEmail, getFunction, getSendPermissions, getSentEmail, getStorageStats, getWebhookSecret, listDeliveries, listDomains, listEmails, listEndpoints, listFilters, listFunctionSecrets, listFunctions, listSentEmails, pollCliLogin, replayDelivery, replayEmailWebhooks, replyToEmail, rotateWebhookSecret, searchEmails, sendEmail, setFunctionSecret, startCliLogin, testEndpoint, testFunction, updateAccount, updateDomain, updateEndpoint, updateFilter, updateFunction, verifyDomain };
3576
+ }
3577
+ type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options$1<TData, ThrowOnError, TResponse> & {
3578
+ /**
3579
+ * You can provide a client instance returned by `createClient()` instead of
3580
+ * individual options. This might be also useful if you want to implement a
3581
+ * custom client.
3582
+ */
3583
+ client?: Client;
3584
+ /**
3585
+ * You can pass arbitrary values through the `meta` object. This can be
3586
+ * used to access values that aren't defined as part of the SDK function.
3587
+ */
3588
+ meta?: Record<string, unknown>;
3589
+ };
3590
+ /**
3591
+ * Start CLI browser login
3592
+ *
3593
+ * Starts a browser-assisted CLI login session. The response includes a
3594
+ * device code for polling and a user code that the user approves in the
3595
+ * browser. This endpoint does not require an API key.
3596
+ *
3597
+ */
3598
+ declare const startCliLogin: <ThrowOnError extends boolean = false>(options?: Options<StartCliLoginData, ThrowOnError>) => RequestResult<StartCliLoginResponses, StartCliLoginErrors, ThrowOnError, "fields">;
3599
+ /**
3600
+ * Poll CLI browser login
3601
+ *
3602
+ * Polls a CLI login session until the browser approval either succeeds,
3603
+ * is denied, expires, or is polled too quickly. The API key is generated
3604
+ * only after approval and is returned exactly once.
3605
+ *
3606
+ */
3607
+ declare const pollCliLogin: <ThrowOnError extends boolean = false>(options: Options<PollCliLoginData, ThrowOnError>) => RequestResult<PollCliLoginResponses, PollCliLoginErrors, ThrowOnError, "fields">;
3608
+ /**
3609
+ * Revoke the current CLI API key
3610
+ *
3611
+ * Revokes the API key used to authenticate the request. CLI clients use
3612
+ * this endpoint during `primitive logout` before removing local credentials.
3613
+ *
3614
+ */
3615
+ declare const cliLogout: <ThrowOnError extends boolean = false>(options?: Options<CliLogoutData, ThrowOnError>) => RequestResult<CliLogoutResponses, CliLogoutErrors, ThrowOnError, "fields">;
3616
+ /**
3617
+ * Get account info
3618
+ */
3619
+ declare const getAccount: <ThrowOnError extends boolean = false>(options?: Options<GetAccountData, ThrowOnError>) => RequestResult<GetAccountResponses, GetAccountErrors, ThrowOnError, "fields">;
3620
+ /**
3621
+ * Update account settings
3622
+ */
3623
+ declare const updateAccount: <ThrowOnError extends boolean = false>(options: Options<UpdateAccountData, ThrowOnError>) => RequestResult<UpdateAccountResponses, UpdateAccountErrors, ThrowOnError, "fields">;
3624
+ /**
3625
+ * Get storage usage
3626
+ */
3627
+ declare const getStorageStats: <ThrowOnError extends boolean = false>(options?: Options<GetStorageStatsData, ThrowOnError>) => RequestResult<GetStorageStatsResponses, GetStorageStatsErrors, ThrowOnError, "fields">;
3628
+ /**
3629
+ * Get webhook signing secret
3630
+ *
3631
+ * Returns the webhook signing secret for your account. If no
3632
+ * secret exists yet, one is generated automatically on first
3633
+ * access.
2890
3634
  *
2891
3635
  * Signing is account-scoped, not per-endpoint. Every webhook
2892
3636
  * delivery from any of your registered endpoints is signed
@@ -2976,6 +3720,23 @@ declare const verifyDomain: <ThrowOnError extends boolean = false>(options: Opti
2976
3720
  *
2977
3721
  */
2978
3722
  declare const listEmails: <ThrowOnError extends boolean = false>(options?: Options<ListEmailsData, ThrowOnError>) => RequestResult<ListEmailsResponses, ListEmailsErrors, ThrowOnError, "fields">;
3723
+ /**
3724
+ * Search inbound emails
3725
+ *
3726
+ * Searches inbound emails with structured filters and optional
3727
+ * full-text matching across parsed email fields. This endpoint is
3728
+ * optimized for filtered inbox views and CLI polling workflows:
3729
+ * callers that only need new accepted mail can pass
3730
+ * `sort=received_at_asc`, `snippet=false`, `include_facets=false`,
3731
+ * and a `date_from` timestamp.
3732
+ *
3733
+ * `q`, `subject`, and `body` use the same English full-text index
3734
+ * as the web inbox search. Structured filters such as `from`, `to`,
3735
+ * `domain_id`, status, attachment presence, and spam score bounds
3736
+ * are combined with the text query.
3737
+ *
3738
+ */
3739
+ declare const searchEmails: <ThrowOnError extends boolean = false>(options?: Options<SearchEmailsData, ThrowOnError>) => RequestResult<SearchEmailsResponses, SearchEmailsErrors, ThrowOnError, "fields">;
2979
3740
  /**
2980
3741
  * Delete an email
2981
3742
  */
@@ -3215,6 +3976,15 @@ declare const getSendPermissions: <ThrowOnError extends boolean = false>(options
3215
3976
  * the request returns once the relay accepts the message for delivery.
3216
3977
  * Set `wait: true` to wait for the first downstream SMTP delivery outcome.
3217
3978
  *
3979
+ * **Host routing.** /send-mail is served by the attachments-
3980
+ * supporting host (`https://api.primitive.dev/v1`) so the
3981
+ * request body can carry inline attachments up to ~30 MiB raw.
3982
+ * The primary host (`https://www.primitive.dev/api/v1`) also
3983
+ * accepts /send-mail for attachment-free sends; sends WITH
3984
+ * attachments to the primary host return 413
3985
+ * `attachments_unsupported_on_this_endpoint`. The typed SDKs
3986
+ * route /send-mail to the attachments host automatically.
3987
+ *
3218
3988
  */
3219
3989
  declare const sendEmail: <ThrowOnError extends boolean = false>(options: Options<SendEmailData, ThrowOnError>) => RequestResult<SendEmailResponses, SendEmailErrors, ThrowOnError, "fields">;
3220
3990
  /**
@@ -3252,13 +4022,166 @@ declare const listSentEmails: <ThrowOnError extends boolean = false>(options?: O
3252
4022
  *
3253
4023
  */
3254
4024
  declare const getSentEmail: <ThrowOnError extends boolean = false>(options: Options<GetSentEmailData, ThrowOnError>) => RequestResult<GetSentEmailResponses, GetSentEmailErrors, ThrowOnError, "fields">;
4025
+ /**
4026
+ * List functions
4027
+ *
4028
+ * Returns every active (non-deleted) function in the org, newest
4029
+ * first. Each entry carries the deploy status and the gateway URL
4030
+ * that the platform's webhook delivery loop posts to. To inspect
4031
+ * the source code or deploy errors, use `GET /functions/{id}`.
4032
+ *
4033
+ */
4034
+ declare const listFunctions: <ThrowOnError extends boolean = false>(options?: Options<ListFunctionsData, ThrowOnError>) => RequestResult<ListFunctionsResponses, ListFunctionsErrors, ThrowOnError, "fields">;
4035
+ /**
4036
+ * Deploy a function
4037
+ *
4038
+ * Creates and deploys a new function. The handler must be a single
4039
+ * ESM module that exports a default async function receiving the
4040
+ * `email.received` event (see the Webhook payload section for the
4041
+ * full schema). Code is bundled before being uploaded; ship a
4042
+ * single self-contained file rather than relying on external
4043
+ * imports.
4044
+ *
4045
+ * **Code limits.** `code` is capped at 1 MiB UTF-8. `sourceMap`
4046
+ * (optional) is capped at 5 MiB UTF-8 and is stored only on the
4047
+ * edge runtime side; it is not persisted in Primitive's database.
4048
+ *
4049
+ * **Auto-wiring.** On successful deploy, Primitive automatically
4050
+ * creates a webhook endpoint that delivers inbound mail to the
4051
+ * function. There is nothing to configure on the Endpoints API
4052
+ * for this to work; the gateway URL returned here is for
4053
+ * reference only and is not directly callable from outside.
4054
+ *
4055
+ * **Secrets.** New functions ship with the managed secrets
4056
+ * (`PRIMITIVE_WEBHOOK_SECRET`, `PRIMITIVE_API_KEY`) already
4057
+ * bound. Add user-set secrets via
4058
+ * `POST /functions/{id}/secrets`; secret writes only land in the
4059
+ * running handler on the next redeploy.
4060
+ *
4061
+ */
4062
+ declare const createFunction: <ThrowOnError extends boolean = false>(options: Options<CreateFunctionData, ThrowOnError>) => RequestResult<CreateFunctionResponses, CreateFunctionErrors, ThrowOnError, "fields">;
4063
+ /**
4064
+ * Delete a function
4065
+ *
4066
+ * Soft-deletes the function row, removes the script from the edge
4067
+ * runtime, and deactivates the auto-wired webhook endpoint so no
4068
+ * further inbound mail is delivered. Past deploy history,
4069
+ * invocations, and logs are retained.
4070
+ *
4071
+ * Returns 502 if the runtime delete fails partway; the function
4072
+ * row stays in place and the call is safe to retry until it
4073
+ * succeeds.
4074
+ *
4075
+ */
4076
+ declare const deleteFunction: <ThrowOnError extends boolean = false>(options: Options<DeleteFunctionData, ThrowOnError>) => RequestResult<DeleteFunctionResponses, DeleteFunctionErrors, ThrowOnError, "fields">;
4077
+ /**
4078
+ * Get a function
4079
+ *
4080
+ * Returns the full record for a function, including its current
4081
+ * source code and the deploy status / error from the most recent
4082
+ * deploy attempt.
4083
+ *
4084
+ */
4085
+ declare const getFunction: <ThrowOnError extends boolean = false>(options: Options<GetFunctionData, ThrowOnError>) => RequestResult<GetFunctionResponses, GetFunctionErrors, ThrowOnError, "fields">;
4086
+ /**
4087
+ * Update and redeploy a function
4088
+ *
4089
+ * Replaces the function's source code with the body's `code` and
4090
+ * triggers a redeploy. Same size limits as `POST /functions`.
4091
+ * Use this verb to push secret writes into the running handler:
4092
+ * passing the same `code` re-runs the deploy and refreshes the
4093
+ * binding set with the latest values from the secrets table.
4094
+ *
4095
+ * On a 502 deploy failure, the previously-deployed code stays
4096
+ * live; the runtime never serves a half-built bundle. The
4097
+ * `deploy_error` field on the returned record carries the error
4098
+ * that came back from the runtime so you can surface it to users
4099
+ * without polling.
4100
+ *
4101
+ */
4102
+ declare const updateFunction: <ThrowOnError extends boolean = false>(options: Options<UpdateFunctionData, ThrowOnError>) => RequestResult<UpdateFunctionResponses, UpdateFunctionErrors, ThrowOnError, "fields">;
4103
+ /**
4104
+ * Send a test invocation
4105
+ *
4106
+ * Sends a real test email from a Primitive-controlled sender to a
4107
+ * synthetic local-part on one of the org's verified inbound
4108
+ * domains. The function fires through the normal MX delivery
4109
+ * path, so reply / send-mail calls from inside the handler
4110
+ * against the inbound's `email.id` work the same as in
4111
+ * production. Returns immediately after the send is queued; the
4112
+ * invocation appears on the function's invocations list within a
4113
+ * few seconds.
4114
+ *
4115
+ * Requires that the function is currently `deployed`. Returns 422
4116
+ * if the function is in `pending` or `failed` state, or if the
4117
+ * org has no verified inbound domain to receive the test mail.
4118
+ *
4119
+ */
4120
+ declare const testFunction: <ThrowOnError extends boolean = false>(options: Options<TestFunctionData, ThrowOnError>) => RequestResult<TestFunctionResponses, TestFunctionErrors, ThrowOnError, "fields">;
4121
+ /**
4122
+ * List a function's secrets
4123
+ *
4124
+ * Returns metadata for every secret bound to the function, with
4125
+ * managed entries (provisioned by Primitive) listed first and
4126
+ * user-set entries listed alphabetically after. **Values are
4127
+ * never returned.** Secret writes are write-only.
4128
+ *
4129
+ * Managed entries (e.g. `PRIMITIVE_WEBHOOK_SECRET`,
4130
+ * `PRIMITIVE_API_KEY`) carry a `description` instead of
4131
+ * `created_at` / `updated_at`. They cannot be created, updated,
4132
+ * or deleted via this API.
4133
+ *
4134
+ */
4135
+ declare const listFunctionSecrets: <ThrowOnError extends boolean = false>(options: Options<ListFunctionSecretsData, ThrowOnError>) => RequestResult<ListFunctionSecretsResponses, ListFunctionSecretsErrors, ThrowOnError, "fields">;
4136
+ /**
4137
+ * Create or update a secret
4138
+ *
4139
+ * Idempotent insert-or-update keyed on `(function_id, key)`.
4140
+ * Returns 201 the first time the key is set, 200 on subsequent
4141
+ * updates. Values are encrypted at rest and only become visible
4142
+ * to the running handler on the next deploy (`PUT /functions/{id}`
4143
+ * with the existing code is sufficient to refresh bindings).
4144
+ *
4145
+ * Keys must match `^[A-Z_][A-Z0-9_]*$` (uppercase letters,
4146
+ * digits, underscores; first character is a letter or
4147
+ * underscore). Values are at most 4096 UTF-8 bytes. System-
4148
+ * managed keys are reserved and rejected.
4149
+ *
4150
+ */
4151
+ declare const createFunctionSecret: <ThrowOnError extends boolean = false>(options: Options<CreateFunctionSecretData, ThrowOnError>) => RequestResult<CreateFunctionSecretResponses, CreateFunctionSecretErrors, ThrowOnError, "fields">;
4152
+ /**
4153
+ * Delete a secret
4154
+ *
4155
+ * Removes the secret. The binding stays live in the running
4156
+ * handler until the next deploy refreshes the binding set
4157
+ * (`PUT /functions/{id}` with the existing code is sufficient).
4158
+ * Returns 404 if the key did not exist. Managed system keys
4159
+ * cannot be deleted.
4160
+ *
4161
+ */
4162
+ declare const deleteFunctionSecret: <ThrowOnError extends boolean = false>(options: Options<DeleteFunctionSecretData, ThrowOnError>) => RequestResult<DeleteFunctionSecretResponses, DeleteFunctionSecretErrors, ThrowOnError, "fields">;
4163
+ /**
4164
+ * Set a secret by key
4165
+ *
4166
+ * Path-keyed companion to `POST /functions/{id}/secrets`.
4167
+ * Idempotent: returns 201 the first time the key is set, 200 on
4168
+ * subsequent updates. Same validation rules and same write-only
4169
+ * guarantees as the POST verb; the new value lands in the running
4170
+ * handler on the next deploy.
4171
+ *
4172
+ */
4173
+ declare const setFunctionSecret: <ThrowOnError extends boolean = false>(options: Options<SetFunctionSecretData, ThrowOnError>) => RequestResult<SetFunctionSecretResponses, SetFunctionSecretErrors, ThrowOnError, "fields">;
3255
4174
  //#endregion
3256
4175
  //#region src/api/index.d.ts
3257
- declare const DEFAULT_BASE_URL = "https://www.primitive.dev/api/v1";
4176
+ declare const DEFAULT_API_BASE_URL_1 = "https://www.primitive.dev/api/v1";
4177
+ declare const DEFAULT_API_BASE_URL_2 = "https://api.primitive.dev/v1";
3258
4178
  interface PrimitiveApiClientOptions extends Omit<Config, "auth" | "baseUrl"> {
3259
4179
  apiKey?: string;
3260
4180
  auth?: Config["auth"];
3261
- baseUrl?: string;
4181
+ /** @internal Override for the primary API host. Production default is correct; this exists for staging/local testing only. */
4182
+ apiBaseUrl1?: string;
4183
+ /** @internal Override for the attachments-supporting send host. Production default is correct; this exists for staging/local testing only. */
4184
+ apiBaseUrl2?: string;
3262
4185
  }
3263
4186
  interface SendThreadInput {
3264
4187
  inReplyTo?: string;
@@ -3358,7 +4281,23 @@ declare class PrimitiveApiError extends Error {
3358
4281
  });
3359
4282
  }
3360
4283
  declare class PrimitiveApiClient {
4284
+ /**
4285
+ * Generated client targeting the primary API host (apiBaseUrl1). Use
4286
+ * this when passing `client: ...` to a generated operation function
4287
+ * for every endpoint EXCEPT /send-mail. The hand-written
4288
+ * PrimitiveClient.send / .reply / .forward methods on the subclass
4289
+ * route /send-mail to the host-2 client internally.
4290
+ */
3361
4291
  readonly client: Client;
4292
+ /**
4293
+ * @internal Generated client targeting the attachments-supporting
4294
+ * send host (apiBaseUrl2). Used by PrimitiveClient.send() under the
4295
+ * hood. Exposed for the CLI's hand-rolled send command, which calls
4296
+ * the generated sendEmail directly; not part of the publicly-
4297
+ * documented SDK surface. Customer code should call .send() on the
4298
+ * subclass instead.
4299
+ */
4300
+ readonly _sendClient: Client;
3362
4301
  constructor(options?: PrimitiveApiClientOptions);
3363
4302
  getConfig(): Config<ClientOptions$1>;
3364
4303
  setConfig(config: Config): Config<ClientOptions$1>;
@@ -3388,4 +4327,4 @@ declare function createPrimitiveClient(options?: PrimitiveClientOptions): Primit
3388
4327
  declare function client(options?: PrimitiveClientOptions): PrimitiveClient;
3389
4328
  declare const operations: typeof sdk_gen_d_exports;
3390
4329
  //#endregion
3391
- export { updateFilter as $, UpdateDomainResponses as $i, GetWebhookSecretData as $n, ReplayResult as $r, DeliverySummary as $t, getAccount as A, StartCliLoginInput as Ai, GetAccountErrors as An, ListFiltersResponses as Ar, CreateFilterResponses as At, listFilters as B, TestResult as Bi, GetSendPermissionsErrors as Bn, PollCliLoginInput as Br, DeleteEmailResponse as Bt, deleteDomain as C, Options$1 as Ca, SendPermissionsMeta as Ci, Endpoint as Cn, ListEndpointsResponse as Cr, CreateEndpointResponse as Ct, discardEmailContent as D, Auth as Da, StartCliLoginData as Di, GateFix as Dn, ListFiltersError as Dr, CreateFilterErrors as Dt, deleteFilter as E, ResponseStyle as Ea, SentEmailSummary as Ei, GateDenial as En, ListFiltersData as Er, CreateFilterError as Et, getWebhookSecret as F, TestEndpointData as Fi, GetEmailErrors as Fn, ListSentEmailsResponses as Fr, DeleteDomainResponse as Ft, replyToEmail as G, UpdateAccountInput as Gi, GetSentEmailErrors as Gn, ReplayDeliveryErrors as Gr, DeleteEndpointResponse as Gt, pollCliLogin as H, UpdateAccountData as Hi, GetSendPermissionsResponses as Hn, PollCliLoginResponses as Hr, DeleteEndpointData as Ht, listDeliveries as I, TestEndpointError as Ii, GetEmailResponse as In, PaginationMeta as Ir, DeleteDomainResponses as It, startCliLogin as J, UpdateDomainData as Ji, GetStorageStatsData as Jn, ReplayEmailWebhooksData as Jr, DeleteFilterError as Jt, rotateWebhookSecret as K, UpdateAccountResponse as Ki, GetSentEmailResponse as Kn, ReplayDeliveryResponse as Kr, DeleteEndpointResponses as Kt, listDomains as L, TestEndpointErrors as Li, GetEmailResponses as Ln, PollCliLoginData as Lr, DeleteEmailData as Lt, getSendPermissions as M, StartCliLoginResponses as Mi, GetAccountResponses as Mn, ListSentEmailsError as Mr, DeleteDomainData as Mt, getSentEmail as N, StorageStats as Ni, GetEmailData as Nn, ListSentEmailsErrors as Nr, DeleteDomainError as Nt, downloadAttachments as O, StartCliLoginError as Oi, GetAccountData as On, ListFiltersErrors as Or, CreateFilterInput as Ot, getStorageStats as P, SuccessEnvelope as Pi, GetEmailError as Pn, ListSentEmailsResponse as Pr, DeleteDomainErrors as Pt, updateEndpoint as Q, UpdateDomainResponse as Qi, GetStorageStatsResponses as Qn, ReplayEmailWebhooksResponses as Qr, DeliveryStatus as Qt, listEmails as R, TestEndpointResponse as Ri, GetSendPermissionsData as Rn, PollCliLoginError as Rr, DeleteEmailError as Rt, createFilter as S, CreateClientConfig as Sa, SendPermissionYourDomain as Si, EmailWebhookStatus as Sn, ListEndpointsErrors as Sr, CreateEndpointInput as St, deleteEndpoint as T, RequestResult as Ta, SentEmailStatus as Ti, Filter as Tn, ListEnvelope as Tr, CreateFilterData as Tt, replayDelivery as U, UpdateAccountError as Ui, GetSentEmailData as Un, ReplayDeliveryData as Ur, DeleteEndpointError as Ut, listSentEmails as V, UnverifiedDomain as Vi, GetSendPermissionsResponse as Vn, PollCliLoginResponse as Vr, DeleteEmailResponses as Vt, replayEmailWebhooks as W, UpdateAccountErrors as Wi, GetSentEmailError as Wn, ReplayDeliveryError as Wr, DeleteEndpointErrors as Wt, updateAccount as X, UpdateDomainErrors as Xi, GetStorageStatsErrors as Xn, ReplayEmailWebhooksErrors as Xr, DeleteFilterResponse as Xt, testEndpoint as Y, UpdateDomainError as Yi, GetStorageStatsError as Yn, ReplayEmailWebhooksError as Yr, DeleteFilterErrors as Yt, updateDomain as Z, UpdateDomainInput as Zi, GetStorageStatsResponse as Zn, ReplayEmailWebhooksResponse as Zr, DeleteFilterResponses as Zt, operations as _, VerifyDomainResponses as _a, SendMailResult as _i, DownloadRawEmailResponses as _n, ListEmailsErrors as _r, CliLogoutResult as _t, PrimitiveApiError as a, UpdateEndpointResponses as aa, ResourceId as ai, DiscardEmailContentResponses as an, ListDeliveriesData as ar, AddDomainErrors as at, cliLogout as b, ClientOptions$1 as ba, SendPermissionManagedZone as bi, EmailStatus as bn, ListEndpointsData as br, CreateEndpointError as bt, PrimitiveClientOptions as c, UpdateFilterErrors as ca, RotateWebhookSecretErrors as ci, DownloadAttachmentsData as cn, ListDeliveriesResponse as cr, AddDomainResponses as ct, SendInput as d, UpdateFilterResponses as da, SendEmailData as di, DownloadAttachmentsResponse as dn, ListDomainsError as dr, CliLogoutData as dt, UpdateEndpointData as ea, ReplyToEmailData as ei, DiscardContentResult as en, GetWebhookSecretError as er, verifyDomain as et, SendResult as f, VerifiedDomain as fa, SendEmailError as fi, DownloadAttachmentsResponses as fn, ListDomainsErrors as fr, CliLogoutError as ft, createPrimitiveClient as g, VerifyDomainResponse as ga, SendMailInput as gi, DownloadRawEmailResponse as gn, ListEmailsError as gr, CliLogoutResponses as gt, createPrimitiveApiClient as h, VerifyDomainErrors as ha, SendEmailResponses as hi, DownloadRawEmailErrors as hn, ListEmailsData as hr, CliLogoutResponse as ht, PrimitiveApiClientOptions as i, UpdateEndpointResponse as ia, ReplyToEmailResponses as ii, DiscardEmailContentResponse as in, Limit as ir, AddDomainError as it, getEmail as j, StartCliLoginResponse as ji, GetAccountResponse as jn, ListSentEmailsData as jr, Cursor as jt, downloadRawEmail as k, StartCliLoginErrors as ki, GetAccountError as kn, ListFiltersResponse as kr, CreateFilterResponse as kt, ReplyInput as l, UpdateFilterInput as la, RotateWebhookSecretResponse as li, DownloadAttachmentsError as ln, ListDeliveriesResponses as lr, CliLoginPollResult as lt, client as m, VerifyDomainError as ma, SendEmailResponse as mi, DownloadRawEmailError as mn, ListDomainsResponses as mr, CliLogoutInput as mt, ForwardInput as n, UpdateEndpointErrors as na, ReplyToEmailErrors as ni, DiscardEmailContentError as nn, GetWebhookSecretResponse as nr, AccountUpdated as nt, PrimitiveApiErrorDetails as o, UpdateFilterData as oa, RotateWebhookSecretData as oi, Domain as on, ListDeliveriesError as or, AddDomainInput as ot, SendThreadInput as p, VerifyDomainData as pa, SendEmailErrors as pi, DownloadRawEmailData as pn, ListDomainsResponse as pr, CliLogoutErrors as pt, sendEmail as q, UpdateAccountResponses as qi, GetSentEmailResponses as qn, ReplayDeliveryResponses as qr, DeleteFilterData as qt, PrimitiveApiClient as r, UpdateEndpointInput as ra, ReplyToEmailResponse as ri, DiscardEmailContentErrors as rn, GetWebhookSecretResponses as rr, AddDomainData as rt, PrimitiveClient as s, UpdateFilterError as sa, RotateWebhookSecretError as si, DomainVerifyResult as sn, ListDeliveriesErrors as sr, AddDomainResponse as st, DEFAULT_BASE_URL as t, UpdateEndpointError as ta, ReplyToEmailError as ti, DiscardEmailContentData as tn, GetWebhookSecretErrors as tr, Account as tt, RequestOptions as u, UpdateFilterResponse as ua, RotateWebhookSecretResponses as ui, DownloadAttachmentsErrors as un, ListDomainsData as ur, CliLoginStartResult as ut, Options as v, WebhookSecret as va, SendPermissionAddress as vi, EmailDetail as vn, ListEmailsResponse as vr, ClientOptions as vt, deleteEmail as w, RequestOptions$1 as wa, SentEmailDetail as wi, ErrorResponse as wn, ListEndpointsResponses as wr, CreateEndpointResponses as wt, createEndpoint as x, Config as xa, SendPermissionRule as xi, EmailSummary as xn, ListEndpointsError as xr, CreateEndpointErrors as xt, addDomain as y, Client as ya, SendPermissionAnyRecipient as yi, EmailDetailReply as yn, ListEmailsResponses as yr, CreateEndpointData as yt, listEndpoints as z, TestEndpointResponses as zi, GetSendPermissionsError as zn, PollCliLoginErrors as zr, DeleteEmailErrors as zt };
4330
+ export { replyToEmail as $, TestEndpointError as $a, ReplayDeliveryResponses as $i, EmailDetail as $n, RequestOptions$1 as $o, GetWebhookSecretResponses as $r, CreateFunctionSecretInput as $t, deleteFunction as A, SendPermissionAnyRecipient as Aa, ListFunctionSecretsResponse as Ai, DeleteFunctionSecretErrors as An, UpdateFilterError as Ao, GetFunctionError as Ar, ClientOptions as At, getStorageStats as B, SetFunctionSecretErrors as Ba, ListSentEmailsResponse as Bi, DiscardEmailContentResponses as Bn, UpdateFunctionResponses as Bo, GetSentEmailError as Br, CreateFilterInput as Bt, createFilter as C, SendEmailError as Ca, ListFiltersError as Ci, DeleteFunctionData as Cn, UpdateEndpointData as Co, GetAccountResponses as Cr, CliLogoutData as Ct, deleteEmail as D, SendMailInput as Da, ListFunctionSecretsData as Di, DeleteFunctionResponses as Dn, UpdateEndpointResponse as Do, GetEmailResponse as Dr, CliLogoutResponse as Dt, deleteDomain as E, SendEmailResponses as Ea, ListFiltersResponses as Ei, DeleteFunctionResponse as En, UpdateEndpointInput as Eo, GetEmailErrors as Er, CliLogoutInput as Et, getAccount as F, SentEmailDetail as Fa, ListFunctionsResponse as Fi, DiscardContentResult as Fn, UpdateFunctionData as Fo, GetSendPermissionsError as Fr, CreateEndpointResponse as Ft, listEndpoints as G, StartCliLoginError as Ga, PollCliLoginErrors as Gi, DownloadAttachmentsErrors as Gn, VerifyDomainResponse as Go, GetStorageStatsError as Gr, CreateFunctionErrors as Gt, listDeliveries as H, SetFunctionSecretResponse as Ha, PaginationMeta as Hi, DomainVerifyResult as Hn, VerifyDomainData as Ho, GetSentEmailResponse as Hr, CreateFilterResponses as Ht, getEmail as I, SentEmailStatus as Ia, ListFunctionsResponses as Ii, DiscardEmailContentData as In, UpdateFunctionError as Io, GetSendPermissionsErrors as Ir, CreateEndpointResponses as It, listFunctions as J, StartCliLoginResponse as Ja, PollCliLoginResponses as Ji, DownloadRawEmailData as Jn, Client as Jo, GetStorageStatsResponses as Jr, CreateFunctionResponses as Jt, listFilters as K, StartCliLoginErrors as Ka, PollCliLoginInput as Ki, DownloadAttachmentsResponse as Kn, VerifyDomainResponses as Ko, GetStorageStatsErrors as Kr, CreateFunctionInput as Kt, getFunction as L, SentEmailSummary as La, ListSentEmailsData as Li, DiscardEmailContentError as Ln, UpdateFunctionErrors as Lo, GetSendPermissionsResponse as Lr, CreateFilterData as Lt, discardEmailContent as M, SendPermissionRule as Ma, ListFunctionsData as Mi, DeleteFunctionSecretResponses as Mn, UpdateFilterInput as Mo, GetFunctionResponse as Mr, CreateEndpointError as Mt, downloadAttachments as N, SendPermissionYourDomain as Na, ListFunctionsError as Ni, DeliveryStatus as Nn, UpdateFilterResponse as No, GetFunctionResponses as Nr, CreateEndpointErrors as Nt, deleteEndpoint as O, SendMailResult as Oa, ListFunctionSecretsError as Oi, DeleteFunctionSecretData as On, UpdateEndpointResponses as Oo, GetEmailResponses as Or, CliLogoutResponses as Ot, downloadRawEmail as P, SendPermissionsMeta as Pa, ListFunctionsErrors as Pi, DeliverySummary as Pn, UpdateFilterResponses as Po, GetSendPermissionsData as Pr, CreateEndpointInput as Pt, replayEmailWebhooks as Q, TestEndpointData as Qa, ReplayDeliveryResponse as Qi, DownloadRawEmailResponses as Qn, Options$1 as Qo, GetWebhookSecretResponse as Qr, CreateFunctionSecretErrors as Qt, getSendPermissions as R, SetFunctionSecretData as Ra, ListSentEmailsError as Ri, DiscardEmailContentErrors as Rn, UpdateFunctionInput as Ro, GetSendPermissionsResponses as Rr, CreateFilterError as Rt, createEndpoint as S, SendEmailData as Sa, ListFiltersData as Si, DeleteFilterResponses as Sn, UpdateDomainResponses as So, GetAccountResponse as Sr, CliLoginStartResult as St, createFunctionSecret as T, SendEmailResponse as Ta, ListFiltersResponse as Ti, DeleteFunctionErrors as Tn, UpdateEndpointErrors as To, GetEmailError as Tr, CliLogoutErrors as Tt, listDomains as U, SetFunctionSecretResponses as Ua, PollCliLoginData as Ui, DownloadAttachmentsData as Un, VerifyDomainError as Uo, GetSentEmailResponses as Ur, CreateFunctionData as Ut, getWebhookSecret as V, SetFunctionSecretInput as Va, ListSentEmailsResponses as Vi, Domain as Vn, VerifiedDomain as Vo, GetSentEmailErrors as Vr, CreateFilterResponse as Vt, listEmails as W, StartCliLoginData as Wa, PollCliLoginError as Wi, DownloadAttachmentsError as Wn, VerifyDomainErrors as Wo, GetStorageStatsData as Wr, CreateFunctionError as Wt, pollCliLogin as X, StorageStats as Xa, ReplayDeliveryError as Xi, DownloadRawEmailErrors as Xn, Config as Xo, GetWebhookSecretError as Xr, CreateFunctionSecretData as Xt, listSentEmails as Y, StartCliLoginResponses as Ya, ReplayDeliveryData as Yi, DownloadRawEmailError as Yn, ClientOptions$1 as Yo, GetWebhookSecretData as Yr, CreateFunctionResult as Yt, replayDelivery as Z, SuccessEnvelope as Za, ReplayDeliveryErrors as Zi, DownloadRawEmailResponse as Zn, CreateClientConfig as Zo, GetWebhookSecretErrors as Zr, CreateFunctionSecretError as Zt, createPrimitiveClient as _, SearchEmailsData as _a, ListEndpointsError as _i, DeleteEndpointResponses as _n, UpdateDomainData as _o, GateDenial as _r, AddDomainErrors as _t, PrimitiveApiClientOptions as a, ReplayResult as aa, ListDeliveriesResponses as ai, DeleteDomainErrors as an, TestFunctionErrors as ao, EmailSearchResult as ar, testEndpoint as at, addDomain as b, SearchEmailsResponse as ba, ListEndpointsResponses as bi, DeleteFilterErrors as bn, UpdateDomainInput as bo, GetAccountError as br, AddDomainResponses as bt, PrimitiveClient as c, ReplyToEmailErrors as ca, ListDomainsErrors as ci, DeleteEmailData as cn, TestInvocationResult as co, EmailWebhookStatus as cr, updateDomain as ct, RequestOptions as d, ResourceId as da, ListEmailsData as di, DeleteEmailResponse as dn, UpdateAccountData as do, Filter as dr, updateFunction as dt, ReplayEmailWebhooksData as ea, Limit as ei, CreateFunctionSecretResponse as en, TestEndpointErrors as eo, EmailDetailReply as er, RequestResult as es, rotateWebhookSecret as et, SendInput as f, RotateWebhookSecretData as fa, ListEmailsError as fi, DeleteEmailResponses as fn, UpdateAccountError as fo, FunctionDeployStatus as fr, verifyDomain as ft, createPrimitiveApiClient as g, RotateWebhookSecretResponses as ga, ListEndpointsData as gi, DeleteEndpointResponse as gn, UpdateAccountResponses as go, FunctionSecretWriteResult as gr, AddDomainError as gt, client as h, RotateWebhookSecretResponse as ha, ListEmailsResponses as hi, DeleteEndpointErrors as hn, UpdateAccountResponse as ho, FunctionSecretListItem as hr, AddDomainData as ht, PrimitiveApiClient as i, ReplayEmailWebhooksResponses as ia, ListDeliveriesResponse as ii, DeleteDomainError as in, TestFunctionError as io, EmailSearchMeta as ir, startCliLogin as it, deleteFunctionSecret as j, SendPermissionManagedZone as ja, ListFunctionSecretsResponses as ji, DeleteFunctionSecretResponse as jn, UpdateFilterErrors as jo, GetFunctionErrors as jr, CreateEndpointData as jt, deleteFilter as k, SendPermissionAddress as ka, ListFunctionSecretsErrors as ki, DeleteFunctionSecretError as kn, UpdateFilterData as ko, GetFunctionData as kr, CliLogoutResult as kt, PrimitiveClientOptions as l, ReplyToEmailResponse as la, ListDomainsResponse as li, DeleteEmailError as ln, TestResult as lo, Endpoint as lr, updateEndpoint as lt, SendThreadInput as m, RotateWebhookSecretErrors as ma, ListEmailsResponse as mi, DeleteEndpointError as mn, UpdateAccountInput as mo, FunctionListItem as mr, AccountUpdated as mt, DEFAULT_API_BASE_URL_2 as n, ReplayEmailWebhooksErrors as na, ListDeliveriesError as ni, Cursor as nn, TestEndpointResponses as no, EmailSearchFacets as nr, Auth as ns, sendEmail as nt, PrimitiveApiError as o, ReplyToEmailData as oa, ListDomainsData as oi, DeleteDomainResponse as on, TestFunctionResponse as oo, EmailStatus as or, testFunction as ot, SendResult as p, RotateWebhookSecretError as pa, ListEmailsErrors as pi, DeleteEndpointData as pn, UpdateAccountErrors as po, FunctionDetail as pr, Account as pt, listFunctionSecrets as q, StartCliLoginInput as qa, PollCliLoginResponse as qi, DownloadAttachmentsResponses as qn, WebhookSecret as qo, GetStorageStatsResponse as qr, CreateFunctionResponse as qt, ForwardInput as r, ReplayEmailWebhooksResponse as ra, ListDeliveriesErrors as ri, DeleteDomainData as rn, TestFunctionData as ro, EmailSearchHighlights as rr, setFunctionSecret as rt, PrimitiveApiErrorDetails as s, ReplyToEmailError as sa, ListDomainsError as si, DeleteDomainResponses as sn, TestFunctionResponses as so, EmailSummary as sr, updateAccount as st, DEFAULT_API_BASE_URL_1 as t, ReplayEmailWebhooksError as ta, ListDeliveriesData as ti, CreateFunctionSecretResponses as tn, TestEndpointResponse as to, EmailSearchFacetBucket as tr, ResponseStyle as ts, searchEmails as tt, ReplyInput as u, ReplyToEmailResponses as ua, ListDomainsResponses as ui, DeleteEmailErrors as un, UnverifiedDomain as uo, ErrorResponse as ur, updateFilter as ut, operations as v, SearchEmailsError as va, ListEndpointsErrors as vi, DeleteFilterData as vn, UpdateDomainError as vo, GateFix as vr, AddDomainInput as vt, createFunction as w, SendEmailErrors as wa, ListFiltersErrors as wi, DeleteFunctionError as wn, UpdateEndpointError as wo, GetEmailData as wr, CliLogoutError as wt, cliLogout as x, SearchEmailsResponses as xa, ListEnvelope as xi, DeleteFilterResponse as xn, UpdateDomainResponse as xo, GetAccountErrors as xr, CliLoginPollResult as xt, Options as y, SearchEmailsErrors as ya, ListEndpointsResponse as yi, DeleteFilterError as yn, UpdateDomainErrors as yo, GetAccountData as yr, AddDomainResponse as yt, getSentEmail as z, SetFunctionSecretError as za, ListSentEmailsErrors as zi, DiscardEmailContentResponse as zn, UpdateFunctionResponse as zo, GetSentEmailData as zr, CreateFilterErrors as zt };