@sendmux/core 0.0.0-bootstrap.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # @sendmux/core
2
+
3
+ Shared runtime helpers and public types for the Sendmux TypeScript SDK packages.
4
+
5
+ Install:
6
+
7
+ ```sh
8
+ npm install @sendmux/core
9
+ ```
10
+
11
+ Use it with a surface package such as `@sendmux/sending`, `@sendmux/mailbox`, or `@sendmux/management`.
12
+
13
+ Exports include `ApiError`, `SuccessEnvelope`, `paginate`, retrying fetch helpers, API key prefix validation, idempotency headers, and conditional request helpers.
package/dist/auth.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import type { ApiKeyKind, SendmuxClientConfig } from "./types.js";
2
+ export declare function assertApiKeyKind(apiKey: string, expected?: ApiKeyKind): ApiKeyKind;
3
+ export declare function authToken(config: SendmuxClientConfig): () => string | Promise<string>;
4
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAEpB,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,UAAU,GAAG,UAAU,CAYlF;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAMrF"}
package/dist/auth.js ADDED
@@ -0,0 +1,17 @@
1
+ export function assertApiKeyKind(apiKey, expected) {
2
+ const actual = apiKey.startsWith("smx_mbx_") ? "mailbox" : apiKey.startsWith("smx_root_") ? "root" : undefined;
3
+ if (!actual) {
4
+ throw new Error("Sendmux API keys must start with smx_root_ or smx_mbx_");
5
+ }
6
+ if (expected && actual !== expected) {
7
+ throw new Error(`Expected a ${expected} API key, received a ${actual} API key`);
8
+ }
9
+ return actual;
10
+ }
11
+ export function authToken(config) {
12
+ return async () => {
13
+ const value = typeof config.apiKey === "function" ? await config.apiKey() : config.apiKey;
14
+ assertApiKeyKind(value, config.apiKeyKind);
15
+ return value;
16
+ };
17
+ }
@@ -0,0 +1,17 @@
1
+ import type { ApiError, GeneratedErrorInterceptor } from "./types.js";
2
+ export declare class SendmuxApiError extends Error {
3
+ readonly body: ApiError | undefined;
4
+ readonly code: string;
5
+ readonly requestId: string | undefined;
6
+ readonly response: Response | undefined;
7
+ readonly retryable: boolean;
8
+ readonly status: number | undefined;
9
+ constructor({ body, cause, response, }: {
10
+ body?: ApiError | undefined;
11
+ cause?: unknown;
12
+ response?: Response | undefined;
13
+ });
14
+ }
15
+ export declare function mapApiError(error: unknown, response?: Response): SendmuxApiError;
16
+ export declare function createErrorInterceptor(): GeneratedErrorInterceptor;
17
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAGtE,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;gBAExB,EACV,IAAI,EACJ,KAAK,EACL,QAAQ,GACT,EAAE;QACD,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;QAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;KACjC;CAUF;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,eAAe,CAUhF;AAED,wBAAgB,sBAAsB,IAAI,yBAAyB,CAElE"}
package/dist/errors.js ADDED
@@ -0,0 +1,42 @@
1
+ import { isRetryableStatus } from "./retry.js";
2
+ export class SendmuxApiError extends Error {
3
+ body;
4
+ code;
5
+ requestId;
6
+ response;
7
+ retryable;
8
+ status;
9
+ constructor({ body, cause, response, }) {
10
+ super(body?.error.message ?? response?.statusText ?? "Sendmux API request failed", { cause });
11
+ this.name = "SendmuxApiError";
12
+ this.body = body;
13
+ this.code = body?.error.code ?? "request_failed";
14
+ this.requestId = body?.meta.request_id;
15
+ this.response = response;
16
+ this.retryable = body?.error.retryable ?? isRetryableStatus(response?.status);
17
+ this.status = response?.status;
18
+ }
19
+ }
20
+ export function mapApiError(error, response) {
21
+ if (error instanceof SendmuxApiError) {
22
+ return error;
23
+ }
24
+ if (isApiError(error)) {
25
+ return new SendmuxApiError({ body: error, cause: error, response });
26
+ }
27
+ return new SendmuxApiError({ cause: error, response });
28
+ }
29
+ export function createErrorInterceptor() {
30
+ return (error, response) => mapApiError(error, response);
31
+ }
32
+ function isApiError(value) {
33
+ if (!value || typeof value !== "object") {
34
+ return false;
35
+ }
36
+ const candidate = value;
37
+ return (candidate.ok === false &&
38
+ typeof candidate.error?.code === "string" &&
39
+ typeof candidate.error.message === "string" &&
40
+ typeof candidate.error.retryable === "boolean" &&
41
+ typeof candidate.meta?.request_id === "string");
42
+ }
@@ -0,0 +1,3 @@
1
+ import type { ApiKeyKind, GeneratedSendmuxClient, SendmuxClientConfig } from "./types.js";
2
+ export declare function configureGeneratedClient<TClient extends GeneratedSendmuxClient>(client: TClient, config: SendmuxClientConfig, apiKeyKind: ApiKeyKind): TClient;
3
+ //# sourceMappingURL=generated-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-client.d.ts","sourceRoot":"","sources":["../src/generated-client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,UAAU,EACV,sBAAsB,EAEtB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAMpB,wBAAgB,wBAAwB,CAAC,OAAO,SAAS,sBAAsB,EAC7E,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,mBAAmB,EAC3B,UAAU,EAAE,UAAU,GACrB,OAAO,CA+BT"}
@@ -0,0 +1,41 @@
1
+ import { authToken } from "./auth.js";
2
+ import { createErrorInterceptor } from "./errors.js";
3
+ import { createRetryingFetch } from "./retry.js";
4
+ const clientsWithErrorInterceptors = new WeakSet();
5
+ const clientsWithRequestReplayInterceptors = new WeakSet();
6
+ const clientReplayBodies = new WeakMap();
7
+ export function configureGeneratedClient(client, config, apiKeyKind) {
8
+ const replayBodies = replayBodyStoreFor(client);
9
+ const nextConfig = {
10
+ auth: authToken({ ...config, apiKeyKind }),
11
+ fetch: createRetryingFetch(config.retry, config.fetch, replayBodies),
12
+ throwOnError: true,
13
+ };
14
+ if (config.baseUrl) {
15
+ nextConfig.baseUrl = config.baseUrl;
16
+ }
17
+ client.setConfig(nextConfig);
18
+ if (!clientsWithRequestReplayInterceptors.has(client)) {
19
+ client.interceptors.request.use((request, options) => {
20
+ if (typeof options.serializedBody === "string") {
21
+ replayBodies.set(request, options.serializedBody);
22
+ }
23
+ return request;
24
+ });
25
+ clientsWithRequestReplayInterceptors.add(client);
26
+ }
27
+ if (!clientsWithErrorInterceptors.has(client)) {
28
+ client.interceptors.error.use(createErrorInterceptor());
29
+ clientsWithErrorInterceptors.add(client);
30
+ }
31
+ return client;
32
+ }
33
+ function replayBodyStoreFor(client) {
34
+ const existing = clientReplayBodies.get(client);
35
+ if (existing) {
36
+ return existing;
37
+ }
38
+ const replayBodies = new WeakMap();
39
+ clientReplayBodies.set(client, replayBodies);
40
+ return replayBodies;
41
+ }
@@ -0,0 +1,5 @@
1
+ import type { ConditionalHeadersInput, ConditionalRequestHeaders, IdempotencyHeaders } from "./types.js";
2
+ export declare function conditionalHeaders(input: ConditionalHeadersInput): ConditionalRequestHeaders;
3
+ export declare function idempotencyHeaders(key?: string): IdempotencyHeaders;
4
+ export declare function responseEtag(response: Response | undefined): string | undefined;
5
+ //# sourceMappingURL=headers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../src/headers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,yBAAyB,CAY5F;AAED,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,MAA4B,GAAG,kBAAkB,CAExF;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAE/E"}
@@ -0,0 +1,17 @@
1
+ export function conditionalHeaders(input) {
2
+ const headers = {};
3
+ const ifMatch = input.ifMatch ?? input.etag;
4
+ if (ifMatch) {
5
+ headers["If-Match"] = ifMatch;
6
+ }
7
+ if (input.ifNoneMatch) {
8
+ headers["If-None-Match"] = input.ifNoneMatch;
9
+ }
10
+ return headers;
11
+ }
12
+ export function idempotencyHeaders(key = crypto.randomUUID()) {
13
+ return { "Idempotency-Key": key };
14
+ }
15
+ export function responseEtag(response) {
16
+ return response?.headers.get("ETag") ?? undefined;
17
+ }
@@ -0,0 +1,8 @@
1
+ export * from "./types.js";
2
+ export * from "./auth.js";
3
+ export * from "./headers.js";
4
+ export * from "./errors.js";
5
+ export * from "./pagination.js";
6
+ export * from "./retry.js";
7
+ export * from "./generated-client.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export * from "./types.js";
2
+ export * from "./auth.js";
3
+ export * from "./headers.js";
4
+ export * from "./errors.js";
5
+ export * from "./pagination.js";
6
+ export * from "./retry.js";
7
+ export * from "./generated-client.js";
@@ -0,0 +1,3 @@
1
+ import type { ResponseMeta, SuccessEnvelope } from "./types.js";
2
+ export declare function paginate<TItem, TMeta = ResponseMeta>(fetchPage: (cursor?: string) => Promise<SuccessEnvelope<TItem[], TMeta>>): AsyncGenerator<TItem, void, void>;
3
+ //# sourceMappingURL=pagination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EAChB,MAAM,YAAY,CAAC;AAEpB,wBAAuB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,YAAY,EACzD,SAAS,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC,GACvE,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAmBnC"}
@@ -0,0 +1,18 @@
1
+ export async function* paginate(fetchPage) {
2
+ let cursor;
3
+ do {
4
+ const page = await fetchPage(cursor);
5
+ for (const item of page.data) {
6
+ yield item;
7
+ }
8
+ if (page.pagination?.has_more) {
9
+ if (!page.pagination.next_cursor) {
10
+ throw new Error("Sendmux pagination response had has_more=true without next_cursor");
11
+ }
12
+ cursor = page.pagination.next_cursor;
13
+ }
14
+ else {
15
+ cursor = undefined;
16
+ }
17
+ } while (cursor);
18
+ }
@@ -0,0 +1,4 @@
1
+ import type { RetryConfig } from "./types.js";
2
+ export declare function createRetryingFetch(config?: RetryConfig, baseFetch?: typeof fetch, replayBodies?: WeakMap<Request, string>): typeof fetch;
3
+ export declare function isRetryableStatus(status?: number): boolean;
4
+ //# sourceMappingURL=retry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,wBAAgB,mBAAmB,CACjC,MAAM,GAAE,WAAgB,EACxB,SAAS,GAAE,OAAO,KAAwB,EAC1C,YAAY,CAAC,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,GACtC,OAAO,KAAK,CAoBd;AAED,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAE1D"}
package/dist/retry.js ADDED
@@ -0,0 +1,167 @@
1
+ export function createRetryingFetch(config = {}, baseFetch = globalThis.fetch, replayBodies) {
2
+ const maxAttempts = Math.max(1, config.maxAttempts ?? 3);
3
+ const baseDelayMs = config.baseDelayMs ?? 250;
4
+ const maxDelayMs = config.maxDelayMs ?? 5_000;
5
+ const maxReplayBodyBytes = config.maxReplayBodyBytes ?? 1_048_576;
6
+ const jitter = config.jitter ?? true;
7
+ return async (input, init) => {
8
+ const request = new Request(input, init);
9
+ const retryPlan = await createRetryPlan(request, maxReplayBodyBytes, replayBodies);
10
+ return executeRetryLoop({
11
+ baseDelayMs,
12
+ baseFetch,
13
+ jitter,
14
+ maxAttempts,
15
+ maxDelayMs,
16
+ request,
17
+ retryPlan,
18
+ });
19
+ };
20
+ }
21
+ export function isRetryableStatus(status) {
22
+ return status === 408 || status === 409 || status === 425 || status === 429 || (typeof status === "number" && status >= 500);
23
+ }
24
+ function shouldRetryResponse(response, request) {
25
+ return isRetryableRequest(request) && (response.status === 429 || isRetryableStatus(response.status));
26
+ }
27
+ function isRetryableRequest(request) {
28
+ const method = request.method.toUpperCase();
29
+ if (method === "GET" || method === "HEAD" || method === "OPTIONS") {
30
+ return true;
31
+ }
32
+ return method === "POST" && request.headers.has("Idempotency-Key") && hasReplayableRequestBody(request);
33
+ }
34
+ function hasReplayableRequestBody(request) {
35
+ if (!request.body) {
36
+ return true;
37
+ }
38
+ const contentType = request.headers.get("Content-Type")?.toLowerCase() ?? "";
39
+ return contentType.includes("application/json") || contentType.startsWith("text/");
40
+ }
41
+ function retryDelay({ attempt, baseDelayMs, headers, jitter, maxDelayMs, }) {
42
+ const retryAfter = headers?.get("Retry-After");
43
+ if (retryAfter) {
44
+ const parsed = Number(retryAfter);
45
+ if (Number.isFinite(parsed)) {
46
+ return Math.min(parsed * 1_000, maxDelayMs);
47
+ }
48
+ const dateMs = Date.parse(retryAfter);
49
+ if (Number.isFinite(dateMs)) {
50
+ return Math.min(Math.max(0, dateMs - Date.now()), maxDelayMs);
51
+ }
52
+ }
53
+ const reset = headers?.get("X-RateLimit-Reset");
54
+ if (reset) {
55
+ const resetSeconds = Number(reset);
56
+ if (Number.isFinite(resetSeconds)) {
57
+ return Math.min(Math.max(0, resetSeconds * 1_000 - Date.now()), maxDelayMs);
58
+ }
59
+ }
60
+ const exponential = Math.min(baseDelayMs * 2 ** attempt, maxDelayMs);
61
+ return jitter ? Math.floor(exponential * (0.5 + Math.random())) : exponential;
62
+ }
63
+ async function executeRetryLoop({ baseDelayMs, baseFetch, jitter, maxAttempts, maxDelayMs, request, retryPlan, }) {
64
+ let attempt = 0;
65
+ let lastError;
66
+ while (attempt < maxAttempts) {
67
+ const current = retryPlan.createRequest();
68
+ try {
69
+ const response = await baseFetch(current);
70
+ if (!retryPlan.canRetry || !shouldRetryResponse(response, request) || attempt === maxAttempts - 1) {
71
+ return response;
72
+ }
73
+ await discardResponseBody(response);
74
+ await sleep(retryDelay({ attempt, baseDelayMs, headers: response.headers, jitter, maxDelayMs }));
75
+ }
76
+ catch (error) {
77
+ lastError = error;
78
+ if (isAbortError(error, request) || !retryPlan.canRetry || attempt === maxAttempts - 1) {
79
+ throw error;
80
+ }
81
+ await sleep(retryDelay({ attempt, baseDelayMs, jitter, maxDelayMs }));
82
+ }
83
+ attempt += 1;
84
+ }
85
+ throw lastError;
86
+ }
87
+ async function createRetryPlan(request, maxReplayBodyBytes, replayBodies) {
88
+ if (!isRetryableRequest(request)) {
89
+ return singleUseRetryPlan(request, "A non-retryable request cannot be replayed");
90
+ }
91
+ if (request.method.toUpperCase() === "POST" && request.body) {
92
+ const body = replayBodies?.get(request) ?? (await readBoundedTextBody(request, maxReplayBodyBytes));
93
+ if (body === undefined) {
94
+ return singleUseRetryPlan(request, "A request body above the retry replay limit cannot be replayed");
95
+ }
96
+ return {
97
+ canRetry: true,
98
+ createRequest: () => new Request(request, { body }),
99
+ };
100
+ }
101
+ return {
102
+ canRetry: true,
103
+ createRequest: () => request.clone(),
104
+ };
105
+ }
106
+ function singleUseRetryPlan(request, replayErrorMessage) {
107
+ let used = false;
108
+ return {
109
+ canRetry: false,
110
+ createRequest: () => {
111
+ if (used) {
112
+ throw new TypeError(replayErrorMessage);
113
+ }
114
+ used = true;
115
+ return request;
116
+ },
117
+ };
118
+ }
119
+ async function readBoundedTextBody(request, maxBytes) {
120
+ const reader = request.clone().body?.getReader();
121
+ if (!reader) {
122
+ return "";
123
+ }
124
+ const chunks = [];
125
+ let total = 0;
126
+ try {
127
+ while (true) {
128
+ const { done, value } = await reader.read();
129
+ if (done) {
130
+ break;
131
+ }
132
+ total += value.byteLength;
133
+ if (total > maxBytes) {
134
+ void reader.cancel();
135
+ return undefined;
136
+ }
137
+ chunks.push(value);
138
+ }
139
+ }
140
+ finally {
141
+ reader.releaseLock();
142
+ }
143
+ return new TextDecoder().decode(concatChunks(chunks, total));
144
+ }
145
+ function concatChunks(chunks, total) {
146
+ const output = new Uint8Array(total);
147
+ let offset = 0;
148
+ for (const chunk of chunks) {
149
+ output.set(chunk, offset);
150
+ offset += chunk.byteLength;
151
+ }
152
+ return output;
153
+ }
154
+ async function discardResponseBody(response) {
155
+ try {
156
+ await response.body?.cancel();
157
+ }
158
+ catch {
159
+ // Best-effort cleanup before retrying; a locked or already-read body can be ignored.
160
+ }
161
+ }
162
+ function isAbortError(error, request) {
163
+ return request.signal.aborted || (error instanceof Error && error.name === "AbortError");
164
+ }
165
+ function sleep(ms) {
166
+ return new Promise((resolve) => setTimeout(resolve, ms));
167
+ }
@@ -0,0 +1,82 @@
1
+ export type ApiKeyKind = "root" | "mailbox";
2
+ export interface ResponseMeta {
3
+ request_id: string;
4
+ [key: string]: unknown;
5
+ }
6
+ export interface CursorPagination {
7
+ has_more: boolean;
8
+ next_cursor?: string;
9
+ }
10
+ export interface SuccessEnvelope<TData = unknown, TMeta = ResponseMeta> {
11
+ ok: true;
12
+ data: TData;
13
+ meta: TMeta;
14
+ pagination?: CursorPagination;
15
+ }
16
+ export interface ApiErrorDetail {
17
+ code: string;
18
+ field: string;
19
+ message: string;
20
+ }
21
+ export interface ApiError {
22
+ ok: false;
23
+ error: {
24
+ code: string;
25
+ doc_url?: string;
26
+ errors?: ApiErrorDetail[];
27
+ message: string;
28
+ param?: string;
29
+ retryable: boolean;
30
+ };
31
+ meta: ResponseMeta;
32
+ }
33
+ export interface RetryConfig {
34
+ maxAttempts?: number;
35
+ baseDelayMs?: number;
36
+ maxDelayMs?: number;
37
+ maxReplayBodyBytes?: number;
38
+ jitter?: boolean;
39
+ }
40
+ export interface SendmuxClientConfig {
41
+ apiKey: string | (() => string | Promise<string>);
42
+ apiKeyKind?: ApiKeyKind;
43
+ baseUrl?: string;
44
+ fetch?: typeof fetch;
45
+ retry?: RetryConfig;
46
+ }
47
+ export type SurfaceClientConfig = Omit<SendmuxClientConfig, "apiKeyKind">;
48
+ export interface GeneratedSendmuxClientConfig {
49
+ auth: () => string | Promise<string>;
50
+ baseUrl?: string;
51
+ fetch: typeof fetch;
52
+ throwOnError: true;
53
+ }
54
+ export type GeneratedErrorInterceptor = (error: unknown, response?: Response) => unknown;
55
+ export interface GeneratedRequestOptions {
56
+ serializedBody?: string;
57
+ }
58
+ export type GeneratedRequestInterceptor = (request: Request, options: GeneratedRequestOptions) => Request | Promise<Request>;
59
+ export interface GeneratedSendmuxClient<TConfig extends GeneratedSendmuxClientConfig = GeneratedSendmuxClientConfig> {
60
+ interceptors: {
61
+ error: {
62
+ use(fn: GeneratedErrorInterceptor): unknown;
63
+ };
64
+ request: {
65
+ use(fn: GeneratedRequestInterceptor): unknown;
66
+ };
67
+ };
68
+ setConfig(config: TConfig): unknown;
69
+ }
70
+ export interface ConditionalRequestHeaders {
71
+ "If-Match"?: string;
72
+ "If-None-Match"?: string;
73
+ }
74
+ export interface ConditionalHeadersInput {
75
+ etag?: string;
76
+ ifMatch?: string;
77
+ ifNoneMatch?: string;
78
+ }
79
+ export interface IdempotencyHeaders {
80
+ "Idempotency-Key": string;
81
+ }
82
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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"}
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@sendmux/core",
3
+ "version": "0.0.0-bootstrap.0",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": "./dist/index.js"
7
+ },
8
+ "types": "./dist/index.d.ts",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/Sendmux/sendmux-sdk.git",
15
+ "directory": "packages/ts/core"
16
+ },
17
+ "publishConfig": {
18
+ "access": "public",
19
+ "registry": "https://registry.npmjs.org/"
20
+ },
21
+ "scripts": {
22
+ "build": "tsc -p tsconfig.json"
23
+ }
24
+ }