@primitivedotdev/sdk 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{address-parser-CfPHs3mE.js → address-parser-BYn8oW5r.js} +1 -3
- package/dist/api/index.d.ts +1 -3
- package/dist/{api-BH8PnmHs.js → api-COSr-Fqm.js} +56 -83
- package/dist/chunk-pbuEa-1d.js +13 -0
- package/dist/contract/index.d.ts +6 -9
- package/dist/contract/index.js +28 -17
- package/dist/{index-CuuP1JkG.d.ts → index-CbEivn3S.d.ts} +7 -31
- package/dist/{index-D9lanVFt.d.ts → index-DVow4Fjd.d.ts} +49 -54
- package/dist/index.d.ts +7 -7
- package/dist/index.js +4 -8
- package/dist/oclif/api-command.js +89 -1
- package/dist/openapi/index.d.ts +8 -3
- package/dist/openapi/openapi.generated.js +1 -2
- package/dist/openapi/operations.generated.js +239 -0
- package/dist/parser/index.d.ts +4 -19
- package/dist/parser/index.js +7 -18
- package/dist/{received-email-Q6Cha3wc.js → received-email-D6tKtWwW.js} +2 -4
- package/dist/{received-email-C67Z7Dha.d.ts → received-email-DNjpq_Wt.d.ts} +4 -3
- package/dist/{types-CIOzt1FY.d.ts → types-9vXGZjPd.d.ts} +3 -19
- package/dist/webhook/index.d.ts +3 -3
- package/dist/webhook/index.js +3 -5
- package/dist/{webhook-2TALcBQz.js → webhook-zkN4wUTs.js} +107 -84
- package/oclif.manifest.json +9 -9
- package/package.json +2 -2
- package/dist/chunk-Cl8Af3a2.js +0 -11
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ReceivedEmail } from "./received-email-C67Z7Dha.js";
|
|
1
|
+
import { t as ReceivedEmail } from "./received-email-DNjpq_Wt.js";
|
|
3
2
|
|
|
4
3
|
//#region src/api/generated/core/auth.gen.d.ts
|
|
5
4
|
type AuthToken = string | undefined;
|
|
@@ -18,7 +17,8 @@ interface Auth {
|
|
|
18
17
|
name?: string;
|
|
19
18
|
scheme?: 'basic' | 'bearer';
|
|
20
19
|
type: 'apiKey' | 'http';
|
|
21
|
-
}
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
22
|
//#region src/api/generated/core/pathSerializer.gen.d.ts
|
|
23
23
|
interface SerializerOptions<T> {
|
|
24
24
|
/**
|
|
@@ -28,7 +28,8 @@ interface SerializerOptions<T> {
|
|
|
28
28
|
style: T;
|
|
29
29
|
}
|
|
30
30
|
type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
|
|
31
|
-
type ObjectStyle = 'form' | 'deepObject';
|
|
31
|
+
type ObjectStyle = 'form' | 'deepObject';
|
|
32
|
+
//#endregion
|
|
32
33
|
//#region src/api/generated/core/bodySerializer.gen.d.ts
|
|
33
34
|
type QuerySerializer = (query: Record<string, unknown>) => string;
|
|
34
35
|
type BodySerializer = (body: unknown) => unknown;
|
|
@@ -44,7 +45,6 @@ type QuerySerializerOptions = QuerySerializerOptionsObject & {
|
|
|
44
45
|
*/
|
|
45
46
|
parameters?: Record<string, QuerySerializerOptionsObject>;
|
|
46
47
|
};
|
|
47
|
-
|
|
48
48
|
//#endregion
|
|
49
49
|
//#region src/api/generated/core/types.gen.d.ts
|
|
50
50
|
type HttpMethod = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
|
|
@@ -53,9 +53,9 @@ type Client$1<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn
|
|
|
53
53
|
* Returns the final request URL.
|
|
54
54
|
*/
|
|
55
55
|
buildUrl: BuildUrlFn;
|
|
56
|
-
getConfig: () => Config
|
|
56
|
+
getConfig: () => Config;
|
|
57
57
|
request: RequestFn;
|
|
58
|
-
setConfig: (config: Config
|
|
58
|
+
setConfig: (config: Config) => Config;
|
|
59
59
|
} & { [K in HttpMethod]: MethodFn } & ([SseFn] extends [never] ? {
|
|
60
60
|
sse?: never;
|
|
61
61
|
} : {
|
|
@@ -113,7 +113,8 @@ interface Config$1 {
|
|
|
113
113
|
* the transformers and returned to the user.
|
|
114
114
|
*/
|
|
115
115
|
responseValidator?: (data: unknown) => Promise<unknown>;
|
|
116
|
-
}
|
|
116
|
+
}
|
|
117
|
+
//#endregion
|
|
117
118
|
//#region src/api/generated/core/serverSentEvents.gen.d.ts
|
|
118
119
|
type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, 'method'> & Pick<Config$1, 'method' | 'responseTransformer' | 'responseValidator'> & {
|
|
119
120
|
/**
|
|
@@ -184,7 +185,6 @@ interface StreamEvent<TData = unknown> {
|
|
|
184
185
|
type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
|
|
185
186
|
stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
|
|
186
187
|
};
|
|
187
|
-
|
|
188
188
|
//#endregion
|
|
189
189
|
//#region src/api/generated/client/utils.gen.d.ts
|
|
190
190
|
type ErrInterceptor<Err, Res, Req, Options> = (error: Err, response: Res, request: Req, options: Options) => Err | Promise<Err>;
|
|
@@ -204,7 +204,6 @@ interface Middleware<Req, Res, Err, Options> {
|
|
|
204
204
|
request: Interceptors<ReqInterceptor<Req, Options>>;
|
|
205
205
|
response: Interceptors<ResInterceptor<Res, Req, Options>>;
|
|
206
206
|
}
|
|
207
|
-
|
|
208
207
|
//#endregion
|
|
209
208
|
//#region src/api/generated/client/types.gen.d.ts
|
|
210
209
|
type ResponseStyle = 'data' | 'fields';
|
|
@@ -289,16 +288,16 @@ interface ClientOptions$1 {
|
|
|
289
288
|
responseStyle?: ResponseStyle;
|
|
290
289
|
throwOnError?: boolean;
|
|
291
290
|
}
|
|
292
|
-
type MethodFn
|
|
293
|
-
type SseFn
|
|
294
|
-
type RequestFn
|
|
295
|
-
type BuildUrlFn
|
|
291
|
+
type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
292
|
+
type SseFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData, TError>>;
|
|
293
|
+
type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> & Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
294
|
+
type BuildUrlFn = <TData extends {
|
|
296
295
|
body?: unknown;
|
|
297
296
|
path?: Record<string, unknown>;
|
|
298
297
|
query?: Record<string, unknown>;
|
|
299
298
|
url: string;
|
|
300
|
-
}>(options: TData & Options$
|
|
301
|
-
type Client = Client$1<RequestFn
|
|
299
|
+
}>(options: TData & Options$1<TData>) => string;
|
|
300
|
+
type Client = Client$1<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
|
|
302
301
|
interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
|
|
303
302
|
};
|
|
304
303
|
/**
|
|
@@ -318,8 +317,7 @@ interface TDataShape {
|
|
|
318
317
|
url: string;
|
|
319
318
|
}
|
|
320
319
|
type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
|
|
321
|
-
type Options$
|
|
322
|
-
|
|
320
|
+
type Options$1<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown, TResponseStyle extends ResponseStyle = 'fields'> = OmitKeys<RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
|
|
323
321
|
//#endregion
|
|
324
322
|
//#region src/api/generated/types.gen.d.ts
|
|
325
323
|
type ClientOptions = {
|
|
@@ -349,7 +347,7 @@ type PaginationMeta = {
|
|
|
349
347
|
type ErrorResponse = {
|
|
350
348
|
success: boolean;
|
|
351
349
|
error: {
|
|
352
|
-
code: 'unauthorized' | 'forbidden' | 'not_found' | 'validation_error' | 'rate_limit_exceeded' | 'internal_error' | 'conflict' | 'mx_conflict' | '
|
|
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';
|
|
353
351
|
message: string;
|
|
354
352
|
/**
|
|
355
353
|
* Optional structured data that callers can inspect to recover
|
|
@@ -1829,12 +1827,11 @@ type SendEmailResponses = {
|
|
|
1829
1827
|
data?: SendMailResult;
|
|
1830
1828
|
};
|
|
1831
1829
|
};
|
|
1832
|
-
type SendEmailResponse = SendEmailResponses[keyof SendEmailResponses];
|
|
1833
|
-
//#region src/api/generated/sdk.gen.d.ts
|
|
1830
|
+
type SendEmailResponse = SendEmailResponses[keyof SendEmailResponses];
|
|
1834
1831
|
declare namespace sdk_gen_d_exports {
|
|
1835
|
-
export { Options
|
|
1832
|
+
export { Options, addDomain, createEndpoint, createFilter, deleteDomain, deleteEmail, deleteEndpoint, deleteFilter, downloadAttachments, downloadRawEmail, getAccount, getEmail, getStorageStats, getWebhookSecret, listDeliveries, listDomains, listEmails, listEndpoints, listFilters, replayDelivery, replayEmailWebhooks, rotateWebhookSecret, sendEmail, testEndpoint, updateAccount, updateDomain, updateEndpoint, updateFilter, verifyDomain };
|
|
1836
1833
|
}
|
|
1837
|
-
type Options
|
|
1834
|
+
type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options$1<TData, ThrowOnError, TResponse> & {
|
|
1838
1835
|
/**
|
|
1839
1836
|
* You can provide a client instance returned by `createClient()` instead of
|
|
1840
1837
|
* individual options. This might be also useful if you want to implement a
|
|
@@ -1850,15 +1847,15 @@ type Options$1<TData extends TDataShape = TDataShape, ThrowOnError extends boole
|
|
|
1850
1847
|
/**
|
|
1851
1848
|
* Get account info
|
|
1852
1849
|
*/
|
|
1853
|
-
declare const getAccount: <ThrowOnError extends boolean = false>(options?: Options
|
|
1850
|
+
declare const getAccount: <ThrowOnError extends boolean = false>(options?: Options<GetAccountData, ThrowOnError>) => RequestResult<GetAccountResponses, GetAccountErrors, ThrowOnError, "fields">;
|
|
1854
1851
|
/**
|
|
1855
1852
|
* Update account settings
|
|
1856
1853
|
*/
|
|
1857
|
-
declare const updateAccount: <ThrowOnError extends boolean = false>(options: Options
|
|
1854
|
+
declare const updateAccount: <ThrowOnError extends boolean = false>(options: Options<UpdateAccountData, ThrowOnError>) => RequestResult<UpdateAccountResponses, UpdateAccountErrors, ThrowOnError, "fields">;
|
|
1858
1855
|
/**
|
|
1859
1856
|
* Get storage usage
|
|
1860
1857
|
*/
|
|
1861
|
-
declare const getStorageStats: <ThrowOnError extends boolean = false>(options?: Options
|
|
1858
|
+
declare const getStorageStats: <ThrowOnError extends boolean = false>(options?: Options<GetStorageStatsData, ThrowOnError>) => RequestResult<GetStorageStatsResponses, GetStorageStatsErrors, ThrowOnError, "fields">;
|
|
1862
1859
|
/**
|
|
1863
1860
|
* Get webhook signing secret
|
|
1864
1861
|
*
|
|
@@ -1866,7 +1863,7 @@ declare const getStorageStats: <ThrowOnError extends boolean = false>(options?:
|
|
|
1866
1863
|
* exists yet, one is generated automatically on first access.
|
|
1867
1864
|
*
|
|
1868
1865
|
*/
|
|
1869
|
-
declare const getWebhookSecret: <ThrowOnError extends boolean = false>(options?: Options
|
|
1866
|
+
declare const getWebhookSecret: <ThrowOnError extends boolean = false>(options?: Options<GetWebhookSecretData, ThrowOnError>) => RequestResult<GetWebhookSecretResponses, GetWebhookSecretErrors, ThrowOnError, "fields">;
|
|
1870
1867
|
/**
|
|
1871
1868
|
* Rotate webhook signing secret
|
|
1872
1869
|
*
|
|
@@ -1874,7 +1871,7 @@ declare const getWebhookSecret: <ThrowOnError extends boolean = false>(options?:
|
|
|
1874
1871
|
* Rate limited to once per 60 minutes.
|
|
1875
1872
|
*
|
|
1876
1873
|
*/
|
|
1877
|
-
declare const rotateWebhookSecret: <ThrowOnError extends boolean = false>(options?: Options
|
|
1874
|
+
declare const rotateWebhookSecret: <ThrowOnError extends boolean = false>(options?: Options<RotateWebhookSecretData, ThrowOnError>) => RequestResult<RotateWebhookSecretResponses, RotateWebhookSecretErrors, ThrowOnError, "fields">;
|
|
1878
1875
|
/**
|
|
1879
1876
|
* List all domains
|
|
1880
1877
|
*
|
|
@@ -1883,7 +1880,7 @@ declare const rotateWebhookSecret: <ThrowOnError extends boolean = false>(option
|
|
|
1883
1880
|
* `verified` boolean to distinguish between the two states.
|
|
1884
1881
|
*
|
|
1885
1882
|
*/
|
|
1886
|
-
declare const listDomains: <ThrowOnError extends boolean = false>(options?: Options
|
|
1883
|
+
declare const listDomains: <ThrowOnError extends boolean = false>(options?: Options<ListDomainsData, ThrowOnError>) => RequestResult<ListDomainsResponses, ListDomainsErrors, ThrowOnError, "fields">;
|
|
1887
1884
|
/**
|
|
1888
1885
|
* Claim a new domain
|
|
1889
1886
|
*
|
|
@@ -1892,13 +1889,13 @@ declare const listDomains: <ThrowOnError extends boolean = false>(options?: Opti
|
|
|
1892
1889
|
* calling the verify endpoint.
|
|
1893
1890
|
*
|
|
1894
1891
|
*/
|
|
1895
|
-
declare const addDomain: <ThrowOnError extends boolean = false>(options: Options
|
|
1892
|
+
declare const addDomain: <ThrowOnError extends boolean = false>(options: Options<AddDomainData, ThrowOnError>) => RequestResult<AddDomainResponses, AddDomainErrors, ThrowOnError, "fields">;
|
|
1896
1893
|
/**
|
|
1897
1894
|
* Delete a domain
|
|
1898
1895
|
*
|
|
1899
1896
|
* Deletes a verified or unverified domain claim.
|
|
1900
1897
|
*/
|
|
1901
|
-
declare const deleteDomain: <ThrowOnError extends boolean = false>(options: Options
|
|
1898
|
+
declare const deleteDomain: <ThrowOnError extends boolean = false>(options: Options<DeleteDomainData, ThrowOnError>) => RequestResult<DeleteDomainResponses, DeleteDomainErrors, ThrowOnError, "fields">;
|
|
1902
1899
|
/**
|
|
1903
1900
|
* Update domain settings
|
|
1904
1901
|
*
|
|
@@ -1906,7 +1903,7 @@ declare const deleteDomain: <ThrowOnError extends boolean = false>(options: Opti
|
|
|
1906
1903
|
* updated. Per-domain spam thresholds require a Pro plan.
|
|
1907
1904
|
*
|
|
1908
1905
|
*/
|
|
1909
|
-
declare const updateDomain: <ThrowOnError extends boolean = false>(options: Options
|
|
1906
|
+
declare const updateDomain: <ThrowOnError extends boolean = false>(options: Options<UpdateDomainData, ThrowOnError>) => RequestResult<UpdateDomainResponses, UpdateDomainErrors, ThrowOnError, "fields">;
|
|
1910
1907
|
/**
|
|
1911
1908
|
* Verify domain ownership
|
|
1912
1909
|
*
|
|
@@ -1915,7 +1912,7 @@ declare const updateDomain: <ThrowOnError extends boolean = false>(options: Opti
|
|
|
1915
1912
|
* On failure, returns which checks passed and which failed.
|
|
1916
1913
|
*
|
|
1917
1914
|
*/
|
|
1918
|
-
declare const verifyDomain: <ThrowOnError extends boolean = false>(options: Options
|
|
1915
|
+
declare const verifyDomain: <ThrowOnError extends boolean = false>(options: Options<VerifyDomainData, ThrowOnError>) => RequestResult<VerifyDomainResponses, VerifyDomainErrors, ThrowOnError, "fields">;
|
|
1919
1916
|
/**
|
|
1920
1917
|
* List emails
|
|
1921
1918
|
*
|
|
@@ -1924,15 +1921,15 @@ declare const verifyDomain: <ThrowOnError extends boolean = false>(options: Opti
|
|
|
1924
1921
|
* sender, and recipient fields.
|
|
1925
1922
|
*
|
|
1926
1923
|
*/
|
|
1927
|
-
declare const listEmails: <ThrowOnError extends boolean = false>(options?: Options
|
|
1924
|
+
declare const listEmails: <ThrowOnError extends boolean = false>(options?: Options<ListEmailsData, ThrowOnError>) => RequestResult<ListEmailsResponses, ListEmailsErrors, ThrowOnError, "fields">;
|
|
1928
1925
|
/**
|
|
1929
1926
|
* Delete an email
|
|
1930
1927
|
*/
|
|
1931
|
-
declare const deleteEmail: <ThrowOnError extends boolean = false>(options: Options
|
|
1928
|
+
declare const deleteEmail: <ThrowOnError extends boolean = false>(options: Options<DeleteEmailData, ThrowOnError>) => RequestResult<DeleteEmailResponses, DeleteEmailErrors, ThrowOnError, "fields">;
|
|
1932
1929
|
/**
|
|
1933
1930
|
* Get email details
|
|
1934
1931
|
*/
|
|
1935
|
-
declare const getEmail: <ThrowOnError extends boolean = false>(options: Options
|
|
1932
|
+
declare const getEmail: <ThrowOnError extends boolean = false>(options: Options<GetEmailData, ThrowOnError>) => RequestResult<GetEmailResponses, GetEmailErrors, ThrowOnError, "fields">;
|
|
1936
1933
|
/**
|
|
1937
1934
|
* Download raw email
|
|
1938
1935
|
*
|
|
@@ -1941,7 +1938,7 @@ declare const getEmail: <ThrowOnError extends boolean = false>(options: Options$
|
|
|
1941
1938
|
* valid session.
|
|
1942
1939
|
*
|
|
1943
1940
|
*/
|
|
1944
|
-
declare const downloadRawEmail: <ThrowOnError extends boolean = false>(options: Options
|
|
1941
|
+
declare const downloadRawEmail: <ThrowOnError extends boolean = false>(options: Options<DownloadRawEmailData, ThrowOnError>) => RequestResult<DownloadRawEmailResponses, DownloadRawEmailErrors, ThrowOnError, "fields">;
|
|
1945
1942
|
/**
|
|
1946
1943
|
* Download email attachments
|
|
1947
1944
|
*
|
|
@@ -1950,7 +1947,7 @@ declare const downloadRawEmail: <ThrowOnError extends boolean = false>(options:
|
|
|
1950
1947
|
* payloads) or a valid session.
|
|
1951
1948
|
*
|
|
1952
1949
|
*/
|
|
1953
|
-
declare const downloadAttachments: <ThrowOnError extends boolean = false>(options: Options
|
|
1950
|
+
declare const downloadAttachments: <ThrowOnError extends boolean = false>(options: Options<DownloadAttachmentsData, ThrowOnError>) => RequestResult<DownloadAttachmentsResponses, DownloadAttachmentsErrors, ThrowOnError, "fields">;
|
|
1954
1951
|
/**
|
|
1955
1952
|
* Replay email webhooks
|
|
1956
1953
|
*
|
|
@@ -1961,13 +1958,13 @@ declare const downloadAttachments: <ThrowOnError extends boolean = false>(option
|
|
|
1961
1958
|
* budget with delivery replays.
|
|
1962
1959
|
*
|
|
1963
1960
|
*/
|
|
1964
|
-
declare const replayEmailWebhooks: <ThrowOnError extends boolean = false>(options: Options
|
|
1961
|
+
declare const replayEmailWebhooks: <ThrowOnError extends boolean = false>(options: Options<ReplayEmailWebhooksData, ThrowOnError>) => RequestResult<ReplayEmailWebhooksResponses, ReplayEmailWebhooksErrors, ThrowOnError, "fields">;
|
|
1965
1962
|
/**
|
|
1966
1963
|
* List webhook endpoints
|
|
1967
1964
|
*
|
|
1968
1965
|
* Returns all active (non-deleted) webhook endpoints.
|
|
1969
1966
|
*/
|
|
1970
|
-
declare const listEndpoints: <ThrowOnError extends boolean = false>(options?: Options
|
|
1967
|
+
declare const listEndpoints: <ThrowOnError extends boolean = false>(options?: Options<ListEndpointsData, ThrowOnError>) => RequestResult<ListEndpointsResponses, ListEndpointsErrors, ThrowOnError, "fields">;
|
|
1971
1968
|
/**
|
|
1972
1969
|
* Create a webhook endpoint
|
|
1973
1970
|
*
|
|
@@ -1976,7 +1973,7 @@ declare const listEndpoints: <ThrowOnError extends boolean = false>(options?: Op
|
|
|
1976
1973
|
* Subject to plan limits on the number of active endpoints.
|
|
1977
1974
|
*
|
|
1978
1975
|
*/
|
|
1979
|
-
declare const createEndpoint: <ThrowOnError extends boolean = false>(options: Options
|
|
1976
|
+
declare const createEndpoint: <ThrowOnError extends boolean = false>(options: Options<CreateEndpointData, ThrowOnError>) => RequestResult<CreateEndpointResponses, CreateEndpointErrors, ThrowOnError, "fields">;
|
|
1980
1977
|
/**
|
|
1981
1978
|
* Delete a webhook endpoint
|
|
1982
1979
|
*
|
|
@@ -1984,7 +1981,7 @@ declare const createEndpoint: <ThrowOnError extends boolean = false>(options: Op
|
|
|
1984
1981
|
* receive webhook deliveries.
|
|
1985
1982
|
*
|
|
1986
1983
|
*/
|
|
1987
|
-
declare const deleteEndpoint: <ThrowOnError extends boolean = false>(options: Options
|
|
1984
|
+
declare const deleteEndpoint: <ThrowOnError extends boolean = false>(options: Options<DeleteEndpointData, ThrowOnError>) => RequestResult<DeleteEndpointResponses, DeleteEndpointErrors, ThrowOnError, "fields">;
|
|
1988
1985
|
/**
|
|
1989
1986
|
* Update a webhook endpoint
|
|
1990
1987
|
*
|
|
@@ -1993,7 +1990,7 @@ declare const deleteEndpoint: <ThrowOnError extends boolean = false>(options: Op
|
|
|
1993
1990
|
* deactivated endpoint with the new URL is reactivated).
|
|
1994
1991
|
*
|
|
1995
1992
|
*/
|
|
1996
|
-
declare const updateEndpoint: <ThrowOnError extends boolean = false>(options: Options
|
|
1993
|
+
declare const updateEndpoint: <ThrowOnError extends boolean = false>(options: Options<UpdateEndpointData, ThrowOnError>) => RequestResult<UpdateEndpointResponses, UpdateEndpointErrors, ThrowOnError, "fields">;
|
|
1997
1994
|
/**
|
|
1998
1995
|
* Send a test webhook
|
|
1999
1996
|
*
|
|
@@ -2004,13 +2001,13 @@ declare const updateEndpoint: <ThrowOnError extends boolean = false>(options: Op
|
|
|
2004
2001
|
* from the rate limit.
|
|
2005
2002
|
*
|
|
2006
2003
|
*/
|
|
2007
|
-
declare const testEndpoint: <ThrowOnError extends boolean = false>(options: Options
|
|
2004
|
+
declare const testEndpoint: <ThrowOnError extends boolean = false>(options: Options<TestEndpointData, ThrowOnError>) => RequestResult<TestEndpointResponses, TestEndpointErrors, ThrowOnError, "fields">;
|
|
2008
2005
|
/**
|
|
2009
2006
|
* List filter rules
|
|
2010
2007
|
*
|
|
2011
2008
|
* Returns all whitelist and blocklist filter rules.
|
|
2012
2009
|
*/
|
|
2013
|
-
declare const listFilters: <ThrowOnError extends boolean = false>(options?: Options
|
|
2010
|
+
declare const listFilters: <ThrowOnError extends boolean = false>(options?: Options<ListFiltersData, ThrowOnError>) => RequestResult<ListFiltersResponses, ListFiltersErrors, ThrowOnError, "fields">;
|
|
2014
2011
|
/**
|
|
2015
2012
|
* Create a filter rule
|
|
2016
2013
|
*
|
|
@@ -2018,17 +2015,17 @@ declare const listFilters: <ThrowOnError extends boolean = false>(options?: Opti
|
|
|
2018
2015
|
* require a Pro plan. Patterns are stored as lowercase.
|
|
2019
2016
|
*
|
|
2020
2017
|
*/
|
|
2021
|
-
declare const createFilter: <ThrowOnError extends boolean = false>(options: Options
|
|
2018
|
+
declare const createFilter: <ThrowOnError extends boolean = false>(options: Options<CreateFilterData, ThrowOnError>) => RequestResult<CreateFilterResponses, CreateFilterErrors, ThrowOnError, "fields">;
|
|
2022
2019
|
/**
|
|
2023
2020
|
* Delete a filter rule
|
|
2024
2021
|
*/
|
|
2025
|
-
declare const deleteFilter: <ThrowOnError extends boolean = false>(options: Options
|
|
2022
|
+
declare const deleteFilter: <ThrowOnError extends boolean = false>(options: Options<DeleteFilterData, ThrowOnError>) => RequestResult<DeleteFilterResponses, DeleteFilterErrors, ThrowOnError, "fields">;
|
|
2026
2023
|
/**
|
|
2027
2024
|
* Update a filter rule
|
|
2028
2025
|
*
|
|
2029
2026
|
* Toggle a filter's enabled state.
|
|
2030
2027
|
*/
|
|
2031
|
-
declare const updateFilter: <ThrowOnError extends boolean = false>(options: Options
|
|
2028
|
+
declare const updateFilter: <ThrowOnError extends boolean = false>(options: Options<UpdateFilterData, ThrowOnError>) => RequestResult<UpdateFilterResponses, UpdateFilterErrors, ThrowOnError, "fields">;
|
|
2032
2029
|
/**
|
|
2033
2030
|
* List webhook deliveries
|
|
2034
2031
|
*
|
|
@@ -2036,7 +2033,7 @@ declare const updateFilter: <ThrowOnError extends boolean = false>(options: Opti
|
|
|
2036
2033
|
* includes a nested `email` object with sender, recipient, and subject.
|
|
2037
2034
|
*
|
|
2038
2035
|
*/
|
|
2039
|
-
declare const listDeliveries: <ThrowOnError extends boolean = false>(options?: Options
|
|
2036
|
+
declare const listDeliveries: <ThrowOnError extends boolean = false>(options?: Options<ListDeliveriesData, ThrowOnError>) => RequestResult<ListDeliveriesResponses, ListDeliveriesErrors, ThrowOnError, "fields">;
|
|
2040
2037
|
/**
|
|
2041
2038
|
* Replay a webhook delivery
|
|
2042
2039
|
*
|
|
@@ -2047,7 +2044,7 @@ declare const listDeliveries: <ThrowOnError extends boolean = false>(options?: O
|
|
|
2047
2044
|
* sharing an org-wide budget with email replays.
|
|
2048
2045
|
*
|
|
2049
2046
|
*/
|
|
2050
|
-
declare const replayDelivery: <ThrowOnError extends boolean = false>(options: Options
|
|
2047
|
+
declare const replayDelivery: <ThrowOnError extends boolean = false>(options: Options<ReplayDeliveryData, ThrowOnError>) => RequestResult<ReplayDeliveryResponses, ReplayDeliveryErrors, ThrowOnError, "fields">;
|
|
2051
2048
|
/**
|
|
2052
2049
|
* Send outbound email
|
|
2053
2050
|
*
|
|
@@ -2056,8 +2053,7 @@ declare const replayDelivery: <ThrowOnError extends boolean = false>(options: Op
|
|
|
2056
2053
|
* Set `wait: true` to wait for the first downstream SMTP delivery outcome.
|
|
2057
2054
|
*
|
|
2058
2055
|
*/
|
|
2059
|
-
declare const sendEmail: <ThrowOnError extends boolean = false>(options: Options
|
|
2060
|
-
|
|
2056
|
+
declare const sendEmail: <ThrowOnError extends boolean = false>(options: Options<SendEmailData, ThrowOnError>) => RequestResult<SendEmailResponses, SendEmailErrors, ThrowOnError, "fields">;
|
|
2061
2057
|
//#endregion
|
|
2062
2058
|
//#region src/api/index.d.ts
|
|
2063
2059
|
declare const DEFAULT_BASE_URL = "https://www.primitive.dev/api/v1";
|
|
@@ -2140,6 +2136,5 @@ declare function createPrimitiveApiClient(options?: PrimitiveApiClientOptions):
|
|
|
2140
2136
|
declare function createPrimitiveClient(options?: PrimitiveClientOptions): PrimitiveClient;
|
|
2141
2137
|
declare function client(options?: PrimitiveClientOptions): PrimitiveClient;
|
|
2142
2138
|
declare const operations: typeof sdk_gen_d_exports;
|
|
2143
|
-
|
|
2144
2139
|
//#endregion
|
|
2145
|
-
export {
|
|
2140
|
+
export { AddDomainResponses as $, ReplayDeliveryResponses as $n, VerifiedDomain as $r, GateDenial as $t, getWebhookSecret as A, ListDomainsResponse as An, UpdateAccountError as Ar, DeleteFilterError as At, testEndpoint as B, ListEndpointsResponse as Bn, UpdateDomainResponses as Br, DownloadAttachmentsErrors as Bt, deleteEndpoint as C, ListDeliveriesError as Cn, TestEndpointError as Cr, DeleteEmailResponses as Ct, getAccount as D, ListDomainsData as Dn, TestResult as Dr, DeleteEndpointResponse as Dt, downloadRawEmail as E, ListDeliveriesResponses as En, TestEndpointResponses as Er, DeleteEndpointErrors as Et, listFilters as F, ListEmailsResponse as Fn, UpdateDomainData as Fr, DeliverySummary as Ft, verifyDomain as G, ListFiltersErrors as Gn, UpdateEndpointResponse as Gr, DownloadRawEmailErrors as Gt, updateDomain as H, ListEnvelope as Hn, UpdateEndpointError as Hr, DownloadAttachmentsResponses as Ht, replayDelivery as I, ListEmailsResponses as In, UpdateDomainError as Ir, Domain as It, AddDomainData as J, PaginationMeta as Jn, UpdateFilterError as Jr, EmailDetail as Jt, Account as K, ListFiltersResponse as Kn, UpdateEndpointResponses as Kr, DownloadRawEmailResponse as Kt, replayEmailWebhooks as L, ListEndpointsData as Ln, UpdateDomainErrors as Lr, DomainVerifyResult as Lt, listDomains as M, ListEmailsData as Mn, UpdateAccountInput as Mr, DeleteFilterResponse as Mt, listEmails as N, ListEmailsError as Nn, UpdateAccountResponse as Nr, DeleteFilterResponses as Nt, getEmail as O, ListDomainsError as On, UnverifiedDomain as Or, DeleteEndpointResponses as Ot, listEndpoints as P, ListEmailsErrors as Pn, UpdateAccountResponses as Pr, DeliveryStatus as Pt, AddDomainResponse as Q, ReplayDeliveryResponse as Qn, UpdateFilterResponses as Qr, Filter as Qt, rotateWebhookSecret as R, ListEndpointsError as Rn, UpdateDomainInput as Rr, DownloadAttachmentsData as Rt, deleteEmail as S, ListDeliveriesData as Sn, TestEndpointData as Sr, DeleteEmailResponse as St, downloadAttachments as T, ListDeliveriesResponse as Tn, TestEndpointResponse as Tr, DeleteEndpointError as Tt, updateEndpoint as U, ListFiltersData as Un, UpdateEndpointErrors as Ur, DownloadRawEmailData as Ut, updateAccount as V, ListEndpointsResponses as Vn, UpdateEndpointData as Vr, DownloadAttachmentsResponse as Vt, updateFilter as W, ListFiltersError as Wn, UpdateEndpointInput as Wr, DownloadRawEmailError as Wt, AddDomainErrors as X, ReplayDeliveryError as Xn, UpdateFilterInput as Xr, Endpoint as Xt, AddDomainError as Y, ReplayDeliveryData as Yn, UpdateFilterErrors as Yr, EmailSummary as Yt, AddDomainInput as Z, ReplayDeliveryErrors as Zn, UpdateFilterResponse as Zr, ErrorResponse as Zt, Options as _, GetWebhookSecretError as _n, SendMailInput as _r, DeleteDomainResponse as _t, PrimitiveApiError as a, WebhookSecret as ai, GetAccountResponses as an, ReplayResult as ar, CreateEndpointResponse as at, createFilter as b, GetWebhookSecretResponses as bn, StorageStats as br, DeleteEmailError as bt, PrimitiveClientOptions as c, Config as ci, GetEmailErrors as cn, RotateWebhookSecretError as cr, CreateFilterError as ct, SendResult as d, RequestOptions as di, GetStorageStatsData as dn, RotateWebhookSecretResponses as dr, CreateFilterResponse as dt, VerifyDomainData as ei, GateFix as en, ReplayEmailWebhooksData as er, ClientOptions as et, SendThreadInput as f, RequestResult as fi, GetStorageStatsError as fn, SendEmailData as fr, CreateFilterResponses as ft, operations as g, GetWebhookSecretData as gn, SendEmailResponses as gr, DeleteDomainErrors as gt, createPrimitiveClient as h, GetStorageStatsResponses as hn, SendEmailResponse as hr, DeleteDomainError as ht, PrimitiveApiClientOptions as i, VerifyDomainResponses as ii, GetAccountResponse as in, ReplayEmailWebhooksResponses as ir, CreateEndpointInput as it, listDeliveries as j, ListDomainsResponses as jn, UpdateAccountErrors as jr, DeleteFilterErrors as jt, getStorageStats as k, ListDomainsErrors as kn, UpdateAccountData as kr, DeleteFilterData as kt, ReplyInput as l, CreateClientConfig as li, GetEmailResponse as ln, RotateWebhookSecretErrors as lr, CreateFilterErrors as lt, createPrimitiveApiClient as m, Auth as mi, GetStorageStatsResponse as mn, SendEmailErrors as mr, DeleteDomainData as mt, ForwardInput as n, VerifyDomainErrors as ni, GetAccountError as nn, ReplayEmailWebhooksErrors as nr, CreateEndpointError as nt, PrimitiveApiErrorDetails as o, Client as oi, GetEmailData as on, ResourceId as or, CreateEndpointResponses as ot, client as p, ResponseStyle as pi, GetStorageStatsErrors as pn, SendEmailError as pr, Cursor as pt, AccountUpdated as q, ListFiltersResponses as qn, UpdateFilterData as qr, DownloadRawEmailResponses as qt, PrimitiveApiClient as r, VerifyDomainResponse as ri, GetAccountErrors as rn, ReplayEmailWebhooksResponse as rr, CreateEndpointErrors as rt, PrimitiveClient as s, ClientOptions$1 as si, GetEmailError as sn, RotateWebhookSecretData as sr, CreateFilterData as st, DEFAULT_BASE_URL as t, VerifyDomainError as ti, GetAccountData as tn, ReplayEmailWebhooksError as tr, CreateEndpointData as tt, SendInput as u, Options$1 as ui, GetEmailResponses as un, RotateWebhookSecretResponse as ur, CreateFilterInput as ut, addDomain as v, GetWebhookSecretErrors as vn, SendMailResult as vr, DeleteDomainResponses as vt, deleteFilter as w, ListDeliveriesErrors as wn, TestEndpointErrors as wr, DeleteEndpointData as wt, deleteDomain as x, Limit as xn, SuccessEnvelope as xr, DeleteEmailErrors as xt, createEndpoint as y, GetWebhookSecretResponse as yn, SentEmailStatus as yr, DeleteEmailData as yt, sendEmail as z, ListEndpointsErrors as zn, UpdateDomainResponse as zr, DownloadAttachmentsError as zt };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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
|
+
import { a as buildReplySubject, c as parseHeaderAddress, i as buildForwardSubject, n as ReceivedEmailAddress, o as formatAddress, r as ReceivedEmailThread, s as normalizeReceivedEmail, t as ReceivedEmail } from "./received-email-DNjpq_Wt.js";
|
|
3
|
+
import { a as PrimitiveApiError, c as PrimitiveClientOptions, d as SendResult, f as SendThreadInput, h as createPrimitiveClient, l as ReplyInput, n as ForwardInput, p as client, s as PrimitiveClient, u as SendInput } from "./index-DVow4Fjd.js";
|
|
4
|
+
import { A as VerifyOptions, B as PAYLOAD_ERRORS, C as signStandardWebhooksPayload, D as PRIMITIVE_CONFIRMED_HEADER, E as LEGACY_SIGNATURE_HEADER, F as VerifyDownloadTokenResult, G as VERIFICATION_ERRORS, H as RAW_EMAIL_ERRORS, I as generateDownloadToken, J as WebhookPayloadErrorCode, K as WebhookErrorCode, L as verifyDownloadToken, M as verifyWebhookSignature, N as GenerateDownloadTokenOptions, O as PRIMITIVE_SIGNATURE_HEADER, P as VerifyDownloadTokenOptions, Q as WebhookVerificationErrorCode, R as safeValidateEmailReceivedEvent, S as StandardWebhooksVerifyOptions, T as LEGACY_CONFIRMED_HEADER, U as RawEmailDecodeError, V as PrimitiveWebhookError, W as RawEmailDecodeErrorCode, X as WebhookValidationErrorCode, Y as WebhookValidationError, Z as WebhookVerificationError, _ as emailReceivedEventJsonSchema, a as confirmedHeaders, b as STANDARD_WEBHOOK_TIMESTAMP_HEADER, c as handleWebhook, d as isRawIncluded, f as parseWebhookEvent, g as validateEmailAuth, h as WEBHOOK_VERSION, i as WebhookHeaders, j as signWebhookPayload, k as SignResult, l as isDownloadExpired, m as verifyRawEmailDownload, n as HandleWebhookOptions, o as decodeRawEmail, p as receive, q as WebhookPayloadError, r as ReceiveRequestOptions, s as getDownloadTimeRemaining, t as DecodeRawEmailOptions, u as isEmailReceivedEvent, v as STANDARD_WEBHOOK_ID_HEADER, w as verifyStandardWebhooksSignature, x as StandardWebhooksSignResult, y as STANDARD_WEBHOOK_SIGNATURE_HEADER, z as validateEmailReceivedEvent } from "./index-CbEivn3S.js";
|
|
5
5
|
|
|
6
6
|
//#region src/index.d.ts
|
|
7
|
-
|
|
8
7
|
declare const primitive: {
|
|
9
8
|
client: typeof client;
|
|
10
9
|
receive: typeof receive;
|
|
11
|
-
};
|
|
12
|
-
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { AuthConfidence, AuthVerdict, DecodeRawEmailOptions, DkimResult, DkimSignature, DmarcPolicy, DmarcResult, EmailAddress, EmailAnalysis, EmailAuth, EmailReceivedEvent, EventType, ForwardAnalysis, type ForwardInput, ForwardOriginalSender, ForwardResult, ForwardResultAttachmentAnalyzed, ForwardResultAttachmentSkipped, ForwardResultInline, ForwardVerdict, ForwardVerification, GenerateDownloadTokenOptions, HandleWebhookOptions, KnownWebhookEvent, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedData, ParsedDataComplete, ParsedDataFailed, ParsedError, ParsedStatus, PrimitiveApiError, PrimitiveClient, type PrimitiveClientOptions, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawContent, RawContentDownloadOnly, RawContentInline, RawEmailDecodeError, RawEmailDecodeErrorCode, ReceiveRequestOptions, ReceivedEmail, ReceivedEmailAddress, ReceivedEmailThread, type ReplyInput, STANDARD_WEBHOOK_ID_HEADER, STANDARD_WEBHOOK_SIGNATURE_HEADER, STANDARD_WEBHOOK_TIMESTAMP_HEADER, type SendInput, type SendResult, type SendThreadInput, SignResult, SpfResult, StandardWebhooksSignResult, StandardWebhooksVerifyOptions, UnknownEvent, VERIFICATION_ERRORS, ValidateEmailAuthResult, VerifyDownloadTokenOptions, VerifyDownloadTokenResult, VerifyOptions, WEBHOOK_VERSION, WebhookAttachment, WebhookErrorCode, WebhookEvent, WebhookHeaders, WebhookPayloadError, WebhookPayloadErrorCode, WebhookValidationError, WebhookValidationErrorCode, WebhookVerificationError, WebhookVerificationErrorCode, buildForwardSubject, buildReplySubject, client, confirmedHeaders, createPrimitiveClient, decodeRawEmail, primitive as default, emailReceivedEventJsonSchema, formatAddress, generateDownloadToken, getDownloadTimeRemaining, handleWebhook, isDownloadExpired, isEmailReceivedEvent, isRawIncluded, normalizeReceivedEmail, parseHeaderAddress, parseWebhookEvent, receive, safeValidateEmailReceivedEvent, signStandardWebhooksPayload, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyDownloadToken, verifyRawEmailDownload, verifyStandardWebhooksSignature, verifyWebhookSignature };
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { AuthConfidence, AuthVerdict, DkimResult, DmarcPolicy, DmarcResult, EventType, ForwardVerdict, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedStatus, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawEmailDecodeError, STANDARD_WEBHOOK_ID_HEADER, STANDARD_WEBHOOK_SIGNATURE_HEADER, STANDARD_WEBHOOK_TIMESTAMP_HEADER, SpfResult, VERIFICATION_ERRORS, WEBHOOK_VERSION, WebhookPayloadError, WebhookValidationError, WebhookVerificationError, confirmedHeaders, decodeRawEmail, emailReceivedEventJsonSchema, generateDownloadToken, getDownloadTimeRemaining, handleWebhook, isDownloadExpired, isEmailReceivedEvent, isRawIncluded, parseWebhookEvent, receive, safeValidateEmailReceivedEvent, signStandardWebhooksPayload, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyDownloadToken, verifyRawEmailDownload, verifyStandardWebhooksSignature, verifyWebhookSignature } from "./webhook-2TALcBQz.js";
|
|
5
|
-
|
|
1
|
+
import { a as parseHeaderAddress, i as normalizeReceivedEmail, n as buildReplySubject, r as formatAddress, t as buildForwardSubject } from "./received-email-D6tKtWwW.js";
|
|
2
|
+
import { a as client, i as PrimitiveClient, r as PrimitiveApiError, s as createPrimitiveClient } from "./api-COSr-Fqm.js";
|
|
3
|
+
import { A as PRIMITIVE_CONFIRMED_HEADER, B as RAW_EMAIL_ERRORS, C as STANDARD_WEBHOOK_ID_HEADER, D as verifyStandardWebhooksSignature, E as signStandardWebhooksPayload, F as verifyDownloadToken, G as WebhookVerificationError, H as VERIFICATION_ERRORS, I as safeValidateEmailReceivedEvent, L as validateEmailReceivedEvent, M as signWebhookPayload, N as verifyWebhookSignature, O as LEGACY_CONFIRMED_HEADER, P as generateDownloadToken, R as PAYLOAD_ERRORS, S as emailReceivedEventJsonSchema, T as STANDARD_WEBHOOK_TIMESTAMP_HEADER, U as WebhookPayloadError, V as RawEmailDecodeError, W as WebhookValidationError, _ as DmarcResult, a as isDownloadExpired, b as ParsedStatus, c as parseWebhookEvent, d as WEBHOOK_VERSION, f as validateEmailAuth, g as DmarcPolicy, h as DkimResult, i as handleWebhook, j as PRIMITIVE_SIGNATURE_HEADER, k as LEGACY_SIGNATURE_HEADER, l as receive, m as AuthVerdict, n as decodeRawEmail, o as isEmailReceivedEvent, p as AuthConfidence, r as getDownloadTimeRemaining, s as isRawIncluded, t as confirmedHeaders, u as verifyRawEmailDownload, v as EventType, w as STANDARD_WEBHOOK_SIGNATURE_HEADER, x as SpfResult, y as ForwardVerdict, z as PrimitiveWebhookError } from "./webhook-zkN4wUTs.js";
|
|
6
4
|
//#region src/index.ts
|
|
7
5
|
const primitive = {
|
|
8
6
|
client,
|
|
9
7
|
receive
|
|
10
8
|
};
|
|
11
|
-
var src_default = primitive;
|
|
12
|
-
|
|
13
9
|
//#endregion
|
|
14
|
-
export { AuthConfidence, AuthVerdict, DkimResult, DmarcPolicy, DmarcResult, EventType, ForwardVerdict, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedStatus, PrimitiveApiError, PrimitiveClient, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawEmailDecodeError, STANDARD_WEBHOOK_ID_HEADER, STANDARD_WEBHOOK_SIGNATURE_HEADER, STANDARD_WEBHOOK_TIMESTAMP_HEADER, SpfResult, VERIFICATION_ERRORS, WEBHOOK_VERSION, WebhookPayloadError, WebhookValidationError, WebhookVerificationError, buildForwardSubject, buildReplySubject, client, confirmedHeaders, createPrimitiveClient, decodeRawEmail,
|
|
10
|
+
export { AuthConfidence, AuthVerdict, DkimResult, DmarcPolicy, DmarcResult, EventType, ForwardVerdict, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedStatus, PrimitiveApiError, PrimitiveClient, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawEmailDecodeError, STANDARD_WEBHOOK_ID_HEADER, STANDARD_WEBHOOK_SIGNATURE_HEADER, STANDARD_WEBHOOK_TIMESTAMP_HEADER, SpfResult, VERIFICATION_ERRORS, WEBHOOK_VERSION, WebhookPayloadError, WebhookValidationError, WebhookVerificationError, buildForwardSubject, buildReplySubject, client, confirmedHeaders, createPrimitiveClient, decodeRawEmail, primitive as default, emailReceivedEventJsonSchema, formatAddress, generateDownloadToken, getDownloadTimeRemaining, handleWebhook, isDownloadExpired, isEmailReceivedEvent, isRawIncluded, normalizeReceivedEmail, parseHeaderAddress, parseWebhookEvent, receive, safeValidateEmailReceivedEvent, signStandardWebhooksPayload, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyDownloadToken, verifyRawEmailDownload, verifyStandardWebhooksSignature, verifyWebhookSignature };
|
|
@@ -7,6 +7,82 @@ function flagName(parameterName) {
|
|
|
7
7
|
function flagDescription(parameter) {
|
|
8
8
|
return parameter.description ?? parameter.name;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Render a one-shot description of a JSON Schema's top-level
|
|
12
|
+
* properties so an agent reading `<command> --help` can build a
|
|
13
|
+
* valid `--body` payload without probing the server. Pulled from
|
|
14
|
+
* the resolved request schema embedded on the manifest.
|
|
15
|
+
*
|
|
16
|
+
* Format prioritizes scanability over completeness: required
|
|
17
|
+
* fields first, each line is `<name> <type> [- description]`
|
|
18
|
+
* truncated to a reasonable width. Callers who need the full
|
|
19
|
+
* schema can run `primitive list-operations | jq` and read
|
|
20
|
+
* `requestSchema` directly.
|
|
21
|
+
*/
|
|
22
|
+
function renderRequestSchemaSummary(schema) {
|
|
23
|
+
if (!schema || typeof schema !== "object")
|
|
24
|
+
return null;
|
|
25
|
+
const properties = schema.properties;
|
|
26
|
+
if (!properties || typeof properties !== "object")
|
|
27
|
+
return null;
|
|
28
|
+
const requiredArr = Array.isArray(schema.required)
|
|
29
|
+
? schema.required.filter((k) => typeof k === "string")
|
|
30
|
+
: [];
|
|
31
|
+
const required = new Set(requiredArr);
|
|
32
|
+
const entries = Object.entries(properties)
|
|
33
|
+
.map(([name, raw]) => {
|
|
34
|
+
const propSchema = raw && typeof raw === "object" ? raw : {};
|
|
35
|
+
let type = "any";
|
|
36
|
+
const t = propSchema.type;
|
|
37
|
+
if (typeof t === "string") {
|
|
38
|
+
type = t;
|
|
39
|
+
if (type === "array") {
|
|
40
|
+
const items = propSchema.items;
|
|
41
|
+
if (items && typeof items === "object") {
|
|
42
|
+
const itemType = items.type;
|
|
43
|
+
if (typeof itemType === "string") {
|
|
44
|
+
type = `array<${itemType}>`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else if (Array.isArray(t)) {
|
|
50
|
+
// Nullable shorthand the codegen normalizes to e.g. ["string","null"].
|
|
51
|
+
const nonNull = t.filter((s) => s !== "null");
|
|
52
|
+
type = nonNull.length === 1 ? `${nonNull[0]}?` : nonNull.join("|");
|
|
53
|
+
}
|
|
54
|
+
const description = typeof propSchema.description === "string"
|
|
55
|
+
? propSchema.description.split("\n")[0].trim()
|
|
56
|
+
: "";
|
|
57
|
+
return {
|
|
58
|
+
name,
|
|
59
|
+
type,
|
|
60
|
+
description,
|
|
61
|
+
required: required.has(name),
|
|
62
|
+
};
|
|
63
|
+
})
|
|
64
|
+
.sort((a, b) => {
|
|
65
|
+
if (a.required !== b.required)
|
|
66
|
+
return a.required ? -1 : 1;
|
|
67
|
+
return a.name.localeCompare(b.name);
|
|
68
|
+
});
|
|
69
|
+
if (entries.length === 0)
|
|
70
|
+
return null;
|
|
71
|
+
const nameWidth = Math.min(24, Math.max(...entries.map((e) => e.name.length)));
|
|
72
|
+
const lines = ["Body fields (JSON --body):"];
|
|
73
|
+
const descMax = 78;
|
|
74
|
+
for (const e of entries) {
|
|
75
|
+
const flag = e.required ? " *" : " ";
|
|
76
|
+
const padName = e.name.padEnd(nameWidth);
|
|
77
|
+
const trimmedDesc = e.description.length > descMax
|
|
78
|
+
? `${e.description.slice(0, descMax - 3)}...`
|
|
79
|
+
: e.description;
|
|
80
|
+
const desc = trimmedDesc ? ` ${trimmedDesc}` : "";
|
|
81
|
+
lines.push(`${flag} ${padName} ${e.type}${desc}`);
|
|
82
|
+
}
|
|
83
|
+
lines.push("(* = required)");
|
|
84
|
+
return lines.join("\n");
|
|
85
|
+
}
|
|
10
86
|
export function flagForParameter(parameter) {
|
|
11
87
|
const common = {
|
|
12
88
|
description: flagDescription(parameter),
|
|
@@ -159,8 +235,20 @@ function collectValues(parameters, flags) {
|
|
|
159
235
|
}
|
|
160
236
|
export function createOperationCommand(operation) {
|
|
161
237
|
const flags = buildFlags(operation);
|
|
238
|
+
// Append a "Body fields" summary to the description so agents
|
|
239
|
+
// running `<command> --help` learn the JSON shape immediately.
|
|
240
|
+
// Without this, `--help` only said "JSON request body" and agents
|
|
241
|
+
// had to probe the server with malformed payloads to discover
|
|
242
|
+
// required fields. (CLI agent walkthrough surfaced this.)
|
|
243
|
+
const baseDescription = operation.description ?? `${operation.method} ${operation.path}`;
|
|
244
|
+
const schemaSummary = operation.hasJsonBody
|
|
245
|
+
? renderRequestSchemaSummary(operation.requestSchema)
|
|
246
|
+
: null;
|
|
247
|
+
const fullDescription = schemaSummary
|
|
248
|
+
? `${baseDescription}\n\n${schemaSummary}`
|
|
249
|
+
: baseDescription;
|
|
162
250
|
class OperationCommand extends Command {
|
|
163
|
-
static description =
|
|
251
|
+
static description = fullDescription;
|
|
164
252
|
static flags = flags;
|
|
165
253
|
static summary = operation.summary ?? `${operation.method} ${operation.path}`;
|
|
166
254
|
async run() {
|
package/dist/openapi/index.d.ts
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* Run `pnpm generate:openapi` to regenerate.
|
|
7
7
|
*/
|
|
8
8
|
declare const openapiDocument: Record<string, unknown>;
|
|
9
|
-
|
|
10
9
|
//#endregion
|
|
11
10
|
//#region src/openapi/operations.generated.d.ts
|
|
12
11
|
/**
|
|
@@ -33,10 +32,16 @@ type PrimitiveOperationManifest = {
|
|
|
33
32
|
path: string;
|
|
34
33
|
pathParams: PrimitiveParameterManifest[];
|
|
35
34
|
queryParams: PrimitiveParameterManifest[];
|
|
35
|
+
/**
|
|
36
|
+
* Resolved JSON Schema for the request body when `hasJsonBody` is
|
|
37
|
+
* true. `$ref`s into the OpenAPI components are inlined.
|
|
38
|
+
*/
|
|
39
|
+
requestSchema: Record<string, unknown> | null;
|
|
36
40
|
sdkName: string;
|
|
37
41
|
summary: string | null;
|
|
38
42
|
tag: string;
|
|
39
43
|
tagCommand: string;
|
|
40
44
|
};
|
|
41
|
-
declare const operationManifest: PrimitiveOperationManifest[];
|
|
42
|
-
|
|
45
|
+
declare const operationManifest: PrimitiveOperationManifest[];
|
|
46
|
+
//#endregion
|
|
47
|
+
export { type PrimitiveOperationManifest, type PrimitiveParameterManifest, openapiDocument, operationManifest };
|
|
@@ -1661,7 +1661,7 @@ export const openapiDocument = {
|
|
|
1661
1661
|
"example": {
|
|
1662
1662
|
"success": false,
|
|
1663
1663
|
"error": {
|
|
1664
|
-
"code": "
|
|
1664
|
+
"code": "outbound_unreachable",
|
|
1665
1665
|
"message": "Outbound SMTP service request failed"
|
|
1666
1666
|
}
|
|
1667
1667
|
}
|
|
@@ -1811,7 +1811,6 @@ export const openapiDocument = {
|
|
|
1811
1811
|
"internal_error",
|
|
1812
1812
|
"conflict",
|
|
1813
1813
|
"mx_conflict",
|
|
1814
|
-
"bad_gateway",
|
|
1815
1814
|
"outbound_disabled",
|
|
1816
1815
|
"cannot_send_from_domain",
|
|
1817
1816
|
"recipient_not_allowed",
|