@flitt/api 1.0.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.
Files changed (69) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/LICENSE +21 -0
  3. package/README.md +277 -0
  4. package/SECURITY.md +15 -0
  5. package/dist/cjs/client.d.ts +243 -0
  6. package/dist/cjs/client.d.ts.map +1 -0
  7. package/dist/cjs/client.js +470 -0
  8. package/dist/cjs/client.js.map +1 -0
  9. package/dist/cjs/errors.d.ts +71 -0
  10. package/dist/cjs/errors.d.ts.map +1 -0
  11. package/dist/cjs/errors.js +107 -0
  12. package/dist/cjs/errors.js.map +1 -0
  13. package/dist/cjs/http.d.ts +53 -0
  14. package/dist/cjs/http.d.ts.map +1 -0
  15. package/dist/cjs/http.js +322 -0
  16. package/dist/cjs/http.js.map +1 -0
  17. package/dist/cjs/index.d.ts +13 -0
  18. package/dist/cjs/index.d.ts.map +1 -0
  19. package/dist/cjs/index.js +31 -0
  20. package/dist/cjs/index.js.map +1 -0
  21. package/dist/cjs/package.json +3 -0
  22. package/dist/cjs/types.d.ts +406 -0
  23. package/dist/cjs/types.d.ts.map +1 -0
  24. package/dist/cjs/types.js +7 -0
  25. package/dist/cjs/types.js.map +1 -0
  26. package/dist/cjs/version.d.ts +3 -0
  27. package/dist/cjs/version.d.ts.map +1 -0
  28. package/dist/cjs/version.js +6 -0
  29. package/dist/cjs/version.js.map +1 -0
  30. package/dist/cjs/webhooks.d.ts +40 -0
  31. package/dist/cjs/webhooks.d.ts.map +1 -0
  32. package/dist/cjs/webhooks.js +98 -0
  33. package/dist/cjs/webhooks.js.map +1 -0
  34. package/dist/esm/client.d.ts +243 -0
  35. package/dist/esm/client.d.ts.map +1 -0
  36. package/dist/esm/client.js +465 -0
  37. package/dist/esm/client.js.map +1 -0
  38. package/dist/esm/errors.d.ts +71 -0
  39. package/dist/esm/errors.d.ts.map +1 -0
  40. package/dist/esm/errors.js +90 -0
  41. package/dist/esm/errors.js.map +1 -0
  42. package/dist/esm/http.d.ts +53 -0
  43. package/dist/esm/http.d.ts.map +1 -0
  44. package/dist/esm/http.js +310 -0
  45. package/dist/esm/http.js.map +1 -0
  46. package/dist/esm/index.d.ts +13 -0
  47. package/dist/esm/index.d.ts.map +1 -0
  48. package/dist/esm/index.js +9 -0
  49. package/dist/esm/index.js.map +1 -0
  50. package/dist/esm/types.d.ts +406 -0
  51. package/dist/esm/types.d.ts.map +1 -0
  52. package/dist/esm/types.js +6 -0
  53. package/dist/esm/types.js.map +1 -0
  54. package/dist/esm/version.d.ts +3 -0
  55. package/dist/esm/version.d.ts.map +1 -0
  56. package/dist/esm/version.js +3 -0
  57. package/dist/esm/version.js.map +1 -0
  58. package/dist/esm/webhooks.d.ts +40 -0
  59. package/dist/esm/webhooks.d.ts.map +1 -0
  60. package/dist/esm/webhooks.js +93 -0
  61. package/dist/esm/webhooks.js.map +1 -0
  62. package/package.json +67 -0
  63. package/src/client.ts +576 -0
  64. package/src/errors.ts +92 -0
  65. package/src/http.ts +353 -0
  66. package/src/index.ts +26 -0
  67. package/src/types.ts +390 -0
  68. package/src/version.ts +2 -0
  69. package/src/webhooks.ts +115 -0
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FlittServerError = exports.FlittRateLimitError = exports.FlittConflictError = exports.FlittNotFoundError = exports.FlittPermissionError = exports.FlittAuthenticationError = exports.FlittValidationError = exports.FlittAPIError = exports.FlittAbortError = exports.FlittTimeoutError = exports.FlittConnectionError = exports.FlittConfigError = exports.FlittError = void 0;
4
+ exports.apiErrorFor = apiErrorFor;
5
+ /** Base class of every error thrown by this package. */
6
+ class FlittError extends Error {
7
+ constructor(message, options) {
8
+ super(message);
9
+ this.name = new.target.name;
10
+ if (options && "cause" in options) {
11
+ Object.defineProperty(this, "cause", { value: options.cause, enumerable: false, configurable: true, writable: true });
12
+ }
13
+ }
14
+ }
15
+ exports.FlittError = FlittError;
16
+ /** Invalid options or arguments, detected before any request is sent. */
17
+ class FlittConfigError extends FlittError {
18
+ }
19
+ exports.FlittConfigError = FlittConfigError;
20
+ /** The request never got an HTTP response (DNS, TLS, connection reset…). */
21
+ class FlittConnectionError extends FlittError {
22
+ }
23
+ exports.FlittConnectionError = FlittConnectionError;
24
+ /** No response within `timeoutMs`. */
25
+ class FlittTimeoutError extends FlittConnectionError {
26
+ }
27
+ exports.FlittTimeoutError = FlittTimeoutError;
28
+ /** The caller aborted the request with its AbortSignal. */
29
+ class FlittAbortError extends FlittError {
30
+ }
31
+ exports.FlittAbortError = FlittAbortError;
32
+ /** The API answered with an error status. Never contains your API key. */
33
+ class FlittAPIError extends FlittError {
34
+ /** HTTP status code. */
35
+ status;
36
+ /** Machine-readable code, e.g. `NOT_FOUND`, `PLAN_LIMIT`, `RATE_LIMITED`. */
37
+ code;
38
+ /** Extra fields sent by the API, if any. */
39
+ details;
40
+ /** HTTP method of the failed request. */
41
+ method;
42
+ /** Path of the failed request, relative to the base URL (query string removed). */
43
+ path;
44
+ /** Quota headers of the failed response, when present. */
45
+ rateLimit;
46
+ /** Delay suggested by the API before retrying (Retry-After), in ms. */
47
+ retryAfterMs;
48
+ constructor(init) {
49
+ super(`${init.status} ${init.code}: ${init.message}`);
50
+ this.status = init.status;
51
+ this.code = init.code;
52
+ this.details = init.details;
53
+ this.method = init.method;
54
+ this.path = init.path;
55
+ this.rateLimit = init.rateLimit ?? null;
56
+ this.retryAfterMs = init.retryAfterMs ?? null;
57
+ }
58
+ }
59
+ exports.FlittAPIError = FlittAPIError;
60
+ /** 400: missing, invalid or duplicated parameter. */
61
+ class FlittValidationError extends FlittAPIError {
62
+ }
63
+ exports.FlittValidationError = FlittValidationError;
64
+ /** 401: missing, invalid or revoked API key / vote token. */
65
+ class FlittAuthenticationError extends FlittAPIError {
66
+ }
67
+ exports.FlittAuthenticationError = FlittAuthenticationError;
68
+ /** 403: your plan or your role on the server does not allow this. */
69
+ class FlittPermissionError extends FlittAPIError {
70
+ }
71
+ exports.FlittPermissionError = FlittPermissionError;
72
+ /** 404: the resource does not exist or does not belong to you. */
73
+ class FlittNotFoundError extends FlittAPIError {
74
+ }
75
+ exports.FlittNotFoundError = FlittNotFoundError;
76
+ /** 409: conflict (rule already exists, server inactive…). */
77
+ class FlittConflictError extends FlittAPIError {
78
+ }
79
+ exports.FlittConflictError = FlittConflictError;
80
+ /** 429: quota or rate limit reached. See `retryAfterMs` and `rateLimit.reset`. */
81
+ class FlittRateLimitError extends FlittAPIError {
82
+ }
83
+ exports.FlittRateLimitError = FlittRateLimitError;
84
+ /** 5xx: temporary error on Flitt's side. Safe to retry later. */
85
+ class FlittServerError extends FlittAPIError {
86
+ }
87
+ exports.FlittServerError = FlittServerError;
88
+ /** Builds the most specific error class for a status code. */
89
+ function apiErrorFor(init) {
90
+ const s = init.status;
91
+ if (s === 400 || s === 422)
92
+ return new FlittValidationError(init);
93
+ if (s === 401)
94
+ return new FlittAuthenticationError(init);
95
+ if (s === 403)
96
+ return new FlittPermissionError(init);
97
+ if (s === 404)
98
+ return new FlittNotFoundError(init);
99
+ if (s === 409)
100
+ return new FlittConflictError(init);
101
+ if (s === 429)
102
+ return new FlittRateLimitError(init);
103
+ if (s >= 500)
104
+ return new FlittServerError(init);
105
+ return new FlittAPIError(init);
106
+ }
107
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":";;;AAiFA,kCAUC;AAzFD,wDAAwD;AACxD,MAAa,UAAW,SAAQ,KAAK;IACnC,YAAY,OAAe,EAAE,OAA6B;QACxD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;QAC5B,IAAI,OAAO,IAAI,OAAO,IAAI,OAAO,EAAE,CAAC;YAClC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE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AI,CAAC,CAAC;IAChD,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC"}
@@ -0,0 +1,53 @@
1
+ import type { RateLimit } from "./types.js";
2
+ export type FetchLike = (input: string, init: RequestInit) => Promise<Response>;
3
+ export type Query = Record<string, string | number | boolean | Date | null | undefined>;
4
+ export type RequestOptions = {
5
+ /** Abort the request (and its retries). */
6
+ signal?: AbortSignal;
7
+ /** Overrides the client timeout for this request, in ms. */
8
+ timeoutMs?: number;
9
+ /** Overrides the client retry count for this request. */
10
+ maxRetries?: number;
11
+ };
12
+ export type TransportOptions = {
13
+ baseUrl: string;
14
+ token: string;
15
+ timeoutMs: number;
16
+ maxRetries: number;
17
+ maxRetryDelayMs: number;
18
+ fetch: FetchLike;
19
+ userAgent?: string;
20
+ headers?: Record<string, string>;
21
+ /** Vote API wraps payloads in { ok, data }. */
22
+ unwrapData: boolean;
23
+ onRateLimit?: (rateLimit: RateLimit) => void;
24
+ };
25
+ type Call = RequestOptions & {
26
+ query?: Query;
27
+ body?: unknown;
28
+ /** Makes a POST safe to retry (the API deduplicates on it). */
29
+ idempotencyKey?: string;
30
+ };
31
+ export declare function isBrowserLike(): boolean;
32
+ /** Validates and normalises a base URL: HTTPS only (HTTP allowed for localhost during development). */
33
+ export declare function normalizeBaseUrl(raw: string): string;
34
+ /** One path segment, URL-encoded. Rejects empty values and dot segments. */
35
+ export declare function segment(value: string, name: string): string;
36
+ /** X-RateLimit-* headers. Reset is an ISO date (Public API) or unix seconds (Vote API). */
37
+ export declare function parseRateLimit(headers: Headers): RateLimit | null;
38
+ /** Retry-After in ms (seconds or HTTP date), null if absent or invalid. */
39
+ export declare function parseRetryAfter(headers: Headers, now?: number): number | null;
40
+ /** Full-jitter exponential backoff: random in [0, min(cap, 500 ms * 2^attempt)]. */
41
+ export declare function backoffMs(attempt: number, capMs: number): number;
42
+ export declare class Transport {
43
+ private readonly opts;
44
+ /** Quota state from the last response carrying X-RateLimit-* headers. */
45
+ lastRateLimit: RateLimit | null;
46
+ constructor(opts: TransportOptions);
47
+ request<T>(method: string, path: string, call?: Call): Promise<T>;
48
+ }
49
+ /** Random idempotency key (UUID v4 when available). */
50
+ export declare function randomKey(): string;
51
+ export declare function resolveFetch(custom?: FetchLike): FetchLike;
52
+ export {};
53
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/http.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG5C,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEhF,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;AAExF,MAAM,MAAM,cAAc,GAAG;IAC3B,2CAA2C;IAC3C,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,+CAA+C;IAC/C,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;CAC9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+ exports.normalizeBaseUrl = normalizeBaseUrl;
6
+ exports.segment = segment;
7
+ exports.parseRateLimit = parseRateLimit;
8
+ exports.parseRetryAfter = parseRetryAfter;
9
+ exports.backoffMs = backoffMs;
10
+ exports.randomKey = randomKey;
11
+ exports.resolveFetch = resolveFetch;
12
+ const errors_js_1 = require("./errors.js");
13
+ const version_js_1 = require("./version.js");
14
+ const RETRYABLE_STATUS = new Set([408, 425, 429, 500, 502, 503, 504]);
15
+ const MAX_ERROR_TEXT = 300;
16
+ /** Responses above this size are refused (a sane API response is far smaller). */
17
+ const MAX_RESPONSE_BYTES = 32 * 1024 * 1024;
18
+ function isBrowserLike() {
19
+ const g = globalThis;
20
+ return typeof g.window !== "undefined" && typeof g.window.document !== "undefined";
21
+ }
22
+ /** Validates and normalises a base URL: HTTPS only (HTTP allowed for localhost during development). */
23
+ function normalizeBaseUrl(raw) {
24
+ let url;
25
+ try {
26
+ url = new URL(raw);
27
+ }
28
+ catch {
29
+ throw new errors_js_1.FlittConfigError(`Invalid baseUrl: ${JSON.stringify(raw)}`);
30
+ }
31
+ const local = ["localhost", "127.0.0.1", "[::1]", "::1"].includes(url.hostname);
32
+ if (url.protocol !== "https:" && !(url.protocol === "http:" && local)) {
33
+ throw new errors_js_1.FlittConfigError("baseUrl must use https:// (your API key would travel in clear otherwise).");
34
+ }
35
+ if (url.username || url.password)
36
+ throw new errors_js_1.FlittConfigError("baseUrl must not contain credentials.");
37
+ if (url.search || url.hash)
38
+ throw new errors_js_1.FlittConfigError("baseUrl must not contain a query string or a fragment.");
39
+ return url.toString().replace(/\/+$/, "");
40
+ }
41
+ /** One path segment, URL-encoded. Rejects empty values and dot segments. */
42
+ function segment(value, name) {
43
+ const v = String(value ?? "").trim();
44
+ if (!v)
45
+ throw new errors_js_1.FlittConfigError(`${name} is required.`);
46
+ if (v === "." || v === "..")
47
+ throw new errors_js_1.FlittConfigError(`${name} is invalid.`);
48
+ if (v.length > 256)
49
+ throw new errors_js_1.FlittConfigError(`${name} is too long.`);
50
+ return encodeURIComponent(v);
51
+ }
52
+ function buildQuery(query) {
53
+ if (!query)
54
+ return "";
55
+ const params = new URLSearchParams();
56
+ for (const [key, value] of Object.entries(query)) {
57
+ if (value === undefined || value === null || value === "")
58
+ continue;
59
+ params.set(key, value instanceof Date ? value.toISOString() : String(value));
60
+ }
61
+ const s = params.toString();
62
+ return s ? `?${s}` : "";
63
+ }
64
+ function parseCount(raw) {
65
+ if (!raw || raw.toLowerCase() === "unlimited")
66
+ return null;
67
+ const n = Number(raw);
68
+ return Number.isFinite(n) ? n : null;
69
+ }
70
+ /** X-RateLimit-* headers. Reset is an ISO date (Public API) or unix seconds (Vote API). */
71
+ function parseRateLimit(headers) {
72
+ const limit = headers.get("x-ratelimit-limit");
73
+ const remaining = headers.get("x-ratelimit-remaining");
74
+ const reset = headers.get("x-ratelimit-reset");
75
+ if (limit === null && remaining === null && reset === null)
76
+ return null;
77
+ let resetAt = null;
78
+ if (reset) {
79
+ const asNumber = /^\d+(\.\d+)?$/.test(reset) ? Number(reset) : NaN;
80
+ const d = Number.isFinite(asNumber) ? new Date(asNumber < 1e12 ? asNumber * 1000 : asNumber) : new Date(reset);
81
+ resetAt = Number.isNaN(d.getTime()) ? null : d;
82
+ }
83
+ return { limit: parseCount(limit), remaining: parseCount(remaining), reset: resetAt };
84
+ }
85
+ /** Retry-After in ms (seconds or HTTP date), null if absent or invalid. */
86
+ function parseRetryAfter(headers, now = Date.now()) {
87
+ const raw = headers.get("retry-after");
88
+ if (!raw)
89
+ return null;
90
+ if (/^\d+(\.\d+)?$/.test(raw.trim()))
91
+ return Math.max(0, Math.round(Number(raw) * 1000));
92
+ const date = Date.parse(raw);
93
+ return Number.isNaN(date) ? null : Math.max(0, date - now);
94
+ }
95
+ function sleep(ms, signal) {
96
+ return new Promise((resolve, reject) => {
97
+ if (signal?.aborted)
98
+ return reject(new errors_js_1.FlittAbortError("Request aborted."));
99
+ const timer = setTimeout(() => {
100
+ signal?.removeEventListener("abort", onAbort);
101
+ resolve();
102
+ }, ms);
103
+ const onAbort = () => {
104
+ clearTimeout(timer);
105
+ reject(new errors_js_1.FlittAbortError("Request aborted."));
106
+ };
107
+ signal?.addEventListener("abort", onAbort, { once: true });
108
+ });
109
+ }
110
+ /** Full-jitter exponential backoff: random in [0, min(cap, 500 ms * 2^attempt)]. */
111
+ function backoffMs(attempt, capMs) {
112
+ const ceiling = Math.min(capMs, 500 * 2 ** attempt);
113
+ return Math.floor(Math.random() * ceiling);
114
+ }
115
+ function stripText(text) {
116
+ return text
117
+ .replace(/<[^>]*>/g, " ")
118
+ .replace(/\s+/g, " ")
119
+ .trim()
120
+ .slice(0, MAX_ERROR_TEXT);
121
+ }
122
+ const DEFAULT_CODES = {
123
+ 400: "BAD_REQUEST",
124
+ 401: "UNAUTHORIZED",
125
+ 403: "FORBIDDEN",
126
+ 404: "NOT_FOUND",
127
+ 409: "CONFLICT",
128
+ 429: "RATE_LIMITED",
129
+ 500: "INTERNAL",
130
+ 502: "BAD_GATEWAY",
131
+ 503: "UNAVAILABLE",
132
+ 504: "GATEWAY_TIMEOUT",
133
+ };
134
+ /**
135
+ * The API uses three error shapes; they are all turned into one error type:
136
+ * { error: { code, message, details } } (Public API)
137
+ * { ok: false, error: { code, message } } (Vote API)
138
+ * { error: "Unauthorized", message: "..." } (authentication layer)
139
+ */
140
+ function describeError(status, statusText, body, text) {
141
+ const fallbackCode = DEFAULT_CODES[status] ?? `HTTP_${status}`;
142
+ if (body && typeof body === "object") {
143
+ const b = body;
144
+ if (b.error && typeof b.error === "object") {
145
+ const e = b.error;
146
+ return {
147
+ code: typeof e.code === "string" && e.code ? e.code : fallbackCode,
148
+ message: typeof e.message === "string" && e.message ? e.message : statusText || "Request failed",
149
+ details: e.details,
150
+ };
151
+ }
152
+ const { error: _e, message: _m, ...rest } = b;
153
+ return {
154
+ code: fallbackCode,
155
+ message: typeof b.message === "string" && b.message ? b.message : typeof b.error === "string" ? b.error : statusText || "Request failed",
156
+ details: Object.keys(rest).length ? rest : undefined,
157
+ };
158
+ }
159
+ return { code: fallbackCode, message: stripText(text) || statusText || "Request failed", details: undefined };
160
+ }
161
+ class Transport {
162
+ opts;
163
+ /** Quota state from the last response carrying X-RateLimit-* headers. */
164
+ lastRateLimit = null;
165
+ constructor(opts) {
166
+ this.opts = opts;
167
+ }
168
+ async request(method, path, call = {}) {
169
+ const url = `${this.opts.baseUrl}${path}${buildQuery(call.query)}`;
170
+ const retryable = method === "GET" || method === "HEAD" || method === "DELETE" || Boolean(call.idempotencyKey);
171
+ const maxRetries = Math.max(0, Math.min(10, call.maxRetries ?? this.opts.maxRetries));
172
+ const timeoutMs = Math.max(1, call.timeoutMs ?? this.opts.timeoutMs);
173
+ const headers = {
174
+ Accept: "application/json",
175
+ ...this.opts.headers,
176
+ Authorization: `Bearer ${this.opts.token}`,
177
+ };
178
+ // Browsers forbid setting User-Agent; elsewhere it identifies the SDK in our logs.
179
+ if (!isBrowserLike())
180
+ headers["User-Agent"] = this.opts.userAgent ?? `flitt-api-js/${version_js_1.VERSION}`;
181
+ let payload;
182
+ if (call.body !== undefined) {
183
+ headers["Content-Type"] = "application/json";
184
+ payload = JSON.stringify(call.body);
185
+ }
186
+ if (call.idempotencyKey)
187
+ headers["Idempotency-Key"] = call.idempotencyKey;
188
+ for (let attempt = 0;; attempt++) {
189
+ if (call.signal?.aborted)
190
+ throw new errors_js_1.FlittAbortError("Request aborted.");
191
+ const controller = new AbortController();
192
+ const onAbort = () => controller.abort();
193
+ call.signal?.addEventListener("abort", onAbort, { once: true });
194
+ let timedOut = false;
195
+ const timer = setTimeout(() => {
196
+ timedOut = true;
197
+ controller.abort();
198
+ }, timeoutMs);
199
+ let response;
200
+ try {
201
+ response = await this.opts.fetch(url, {
202
+ method,
203
+ headers,
204
+ body: payload,
205
+ signal: controller.signal,
206
+ // Never follow a redirect with the Authorization header attached.
207
+ // (No `cache` / `credentials` options: Cloudflare Workers reject them,
208
+ // and cross-origin requests do not carry cookies by default.)
209
+ redirect: "error",
210
+ });
211
+ }
212
+ catch (err) {
213
+ clearTimeout(timer);
214
+ call.signal?.removeEventListener("abort", onAbort);
215
+ if (call.signal?.aborted)
216
+ throw new errors_js_1.FlittAbortError("Request aborted.", { cause: err });
217
+ const error = timedOut
218
+ ? new errors_js_1.FlittTimeoutError(`No response from Flitt within ${timeoutMs} ms (${method} ${path}).`, { cause: err })
219
+ : new errors_js_1.FlittConnectionError(`Could not reach Flitt (${method} ${path}): ${err?.message ?? err}`, { cause: err });
220
+ if (retryable && attempt < maxRetries) {
221
+ await sleep(backoffMs(attempt, this.opts.maxRetryDelayMs), call.signal);
222
+ continue;
223
+ }
224
+ throw error;
225
+ }
226
+ let text;
227
+ try {
228
+ const declared = Number(response.headers.get("content-length") ?? "0");
229
+ if (declared > MAX_RESPONSE_BYTES)
230
+ throw new errors_js_1.FlittConnectionError(`Response too large (${declared} bytes).`);
231
+ text = await response.text();
232
+ }
233
+ catch (err) {
234
+ clearTimeout(timer);
235
+ call.signal?.removeEventListener("abort", onAbort);
236
+ if (err instanceof errors_js_1.FlittConnectionError)
237
+ throw err;
238
+ if (call.signal?.aborted)
239
+ throw new errors_js_1.FlittAbortError("Request aborted.", { cause: err });
240
+ const error = timedOut
241
+ ? new errors_js_1.FlittTimeoutError(`Flitt response not received within ${timeoutMs} ms (${method} ${path}).`, { cause: err })
242
+ : new errors_js_1.FlittConnectionError(`Connection lost while reading the response (${method} ${path}).`, { cause: err });
243
+ if (retryable && attempt < maxRetries) {
244
+ await sleep(backoffMs(attempt, this.opts.maxRetryDelayMs), call.signal);
245
+ continue;
246
+ }
247
+ throw error;
248
+ }
249
+ finally {
250
+ clearTimeout(timer);
251
+ call.signal?.removeEventListener("abort", onAbort);
252
+ }
253
+ const rateLimit = parseRateLimit(response.headers);
254
+ if (rateLimit) {
255
+ this.lastRateLimit = rateLimit;
256
+ this.opts.onRateLimit?.(rateLimit);
257
+ }
258
+ let body = undefined;
259
+ if (text) {
260
+ try {
261
+ body = JSON.parse(text);
262
+ }
263
+ catch {
264
+ body = undefined;
265
+ }
266
+ }
267
+ if (response.ok) {
268
+ if (body === undefined && text) {
269
+ throw (0, errors_js_1.apiErrorFor)({ status: 502, code: "INVALID_RESPONSE", message: `Expected JSON, got: ${stripText(text)}`, method, path });
270
+ }
271
+ if (this.opts.unwrapData && body && typeof body === "object" && "ok" in body) {
272
+ return body.data;
273
+ }
274
+ return body;
275
+ }
276
+ const retryAfterMs = parseRetryAfter(response.headers);
277
+ const described = describeError(response.status, response.statusText, body, text);
278
+ const error = (0, errors_js_1.apiErrorFor)({
279
+ status: response.status,
280
+ ...described,
281
+ method,
282
+ path,
283
+ rateLimit,
284
+ retryAfterMs: retryAfterMs ??
285
+ (response.status === 429 && rateLimit?.reset ? Math.max(0, rateLimit.reset.getTime() - Date.now()) : null),
286
+ });
287
+ // 429 is retried only when the wait is short (per-minute limits), never
288
+ // for a monthly quota. Non-idempotent calls are retried only on 429:
289
+ // the API refused them before doing anything.
290
+ const canRetry429 = response.status === 429 && error.retryAfterMs !== null && error.retryAfterMs <= this.opts.maxRetryDelayMs;
291
+ const canRetry = response.status === 429 ? canRetry429 : retryable && RETRYABLE_STATUS.has(response.status);
292
+ if (canRetry && attempt < maxRetries) {
293
+ const wait = error.retryAfterMs ?? backoffMs(attempt, this.opts.maxRetryDelayMs);
294
+ await sleep(Math.min(wait, this.opts.maxRetryDelayMs), call.signal);
295
+ continue;
296
+ }
297
+ throw error;
298
+ }
299
+ }
300
+ }
301
+ exports.Transport = Transport;
302
+ /** Random idempotency key (UUID v4 when available). */
303
+ function randomKey() {
304
+ const c = globalThis.crypto;
305
+ if (c?.randomUUID)
306
+ return c.randomUUID();
307
+ if (c?.getRandomValues) {
308
+ const bytes = c.getRandomValues(new Uint8Array(16));
309
+ return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
310
+ }
311
+ throw new errors_js_1.FlittConfigError("No secure random source (globalThis.crypto) available: pass an idempotencyKey.");
312
+ }
313
+ function resolveFetch(custom) {
314
+ if (custom)
315
+ return custom;
316
+ const f = globalThis.fetch;
317
+ if (typeof f !== "function") {
318
+ throw new errors_js_1.FlittConfigError("No global fetch found: use Node.js 18+ or pass the `fetch` option.");
319
+ }
320
+ return f.bind(globalThis);
321
+ }
322
+ //# sourceMappingURL=http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/http.ts"],"names":[],"mappings":";;;AAkDA,sCAGC;AAGD,4CAcC;AAGD,0BAMC;AAoBD,wCAYC;AAGD,0CAMC;AAkBD,8BAGC;AAkMD,8BAQC;AAED,oCAOC;AAhWD,2CAOqB;AAErB,6CAAuC;AAoCvC,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AACtE,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,kFAAkF;AAClF,MAAM,kBAAkB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,SAAgB,aAAa;IAC3B,MAAM,CAAC,GAAG,UAA0E,CAAC;IACrF,OAAO,OAAO,CAAC,CAAC,MAAM,KAAK,WAAW,IAAI,OAAO,CAAC,CAAC,MAAM,CAAC,QAAQ,KAAK,WAAW,CAAC;AACrF,CAAC;AAED,uGAAuG;AACvG,SAAgB,gBAAgB,CAAC,GAAW;IAC1C,IAAI,GAAQ,CAAC;IACb,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,4BAAgB,CAAC,oBAAoB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACxE,CAAC;IACD,MAAM,KAAK,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,QAAQ,C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C,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;QACpD,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5E,CAAC;IACD,MAAM,IAAI,4BAAgB,CAAC,gFAAgF,CAAC,CAAC;AAC/G,CAAC;AAED,SAAgB,YAAY,CAAC,MAAkB;IAC7C,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAC1B,MAAM,CAAC,GAAI,UAAoC,CAAC,KAAK,CAAC;IACtD,IAAI,OAAO,CAAC,KAAK,UAAU,EAAE,CAAC;QAC5B,MAAM,IAAI,4BAAgB,CAAC,oEAAoE,CAAC,CAAC;IACnG,CAAC;IACD,OAAO,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @flitt/api — official client of the Flitt Public API and Vote API.
3
+ * https://flitt.me/docs/public-api
4
+ */
5
+ export { Flitt, FlittVotes, DEFAULT_BASE_URL } from "./client.js";
6
+ export type { ClientOptions, FlittOptions, FlittVotesOptions } from "./client.js";
7
+ export type { FetchLike, RequestOptions } from "./http.js";
8
+ export { verifyWebhook, FlittWebhookError } from "./webhooks.js";
9
+ export type { VerifyWebhookOptions, HeaderSource } from "./webhooks.js";
10
+ export { FlittError, FlittConfigError, FlittConnectionError, FlittTimeoutError, FlittAbortError, FlittAPIError, FlittValidationError, FlittAuthenticationError, FlittPermissionError, FlittNotFoundError, FlittConflictError, FlittRateLimitError, FlittServerError, } from "./errors.js";
11
+ export { VERSION } from "./version.js";
12
+ export type * from "./types.js";
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAClE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAClF,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACjE,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,mBAAmB,YAAY,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VERSION = exports.FlittServerError = exports.FlittRateLimitError = exports.FlittConflictError = exports.FlittNotFoundError = exports.FlittPermissionError = exports.FlittAuthenticationError = exports.FlittValidationError = exports.FlittAPIError = exports.FlittAbortError = exports.FlittTimeoutError = exports.FlittConnectionError = exports.FlittConfigError = exports.FlittError = exports.FlittWebhookError = exports.verifyWebhook = exports.DEFAULT_BASE_URL = exports.FlittVotes = exports.Flitt = void 0;
4
+ /**
5
+ * @flitt/api — official client of the Flitt Public API and Vote API.
6
+ * https://flitt.me/docs/public-api
7
+ */
8
+ var client_js_1 = require("./client.js");
9
+ Object.defineProperty(exports, "Flitt", { enumerable: true, get: function () { return client_js_1.Flitt; } });
10
+ Object.defineProperty(exports, "FlittVotes", { enumerable: true, get: function () { return client_js_1.FlittVotes; } });
11
+ Object.defineProperty(exports, "DEFAULT_BASE_URL", { enumerable: true, get: function () { return client_js_1.DEFAULT_BASE_URL; } });
12
+ var webhooks_js_1 = require("./webhooks.js");
13
+ Object.defineProperty(exports, "verifyWebhook", { enumerable: true, get: function () { return webhooks_js_1.verifyWebhook; } });
14
+ Object.defineProperty(exports, "FlittWebhookError", { enumerable: true, get: function () { return webhooks_js_1.FlittWebhookError; } });
15
+ var errors_js_1 = require("./errors.js");
16
+ Object.defineProperty(exports, "FlittError", { enumerable: true, get: function () { return errors_js_1.FlittError; } });
17
+ Object.defineProperty(exports, "FlittConfigError", { enumerable: true, get: function () { return errors_js_1.FlittConfigError; } });
18
+ Object.defineProperty(exports, "FlittConnectionError", { enumerable: true, get: function () { return errors_js_1.FlittConnectionError; } });
19
+ Object.defineProperty(exports, "FlittTimeoutError", { enumerable: true, get: function () { return errors_js_1.FlittTimeoutError; } });
20
+ Object.defineProperty(exports, "FlittAbortError", { enumerable: true, get: function () { return errors_js_1.FlittAbortError; } });
21
+ Object.defineProperty(exports, "FlittAPIError", { enumerable: true, get: function () { return errors_js_1.FlittAPIError; } });
22
+ Object.defineProperty(exports, "FlittValidationError", { enumerable: true, get: function () { return errors_js_1.FlittValidationError; } });
23
+ Object.defineProperty(exports, "FlittAuthenticationError", { enumerable: true, get: function () { return errors_js_1.FlittAuthenticationError; } });
24
+ Object.defineProperty(exports, "FlittPermissionError", { enumerable: true, get: function () { return errors_js_1.FlittPermissionError; } });
25
+ Object.defineProperty(exports, "FlittNotFoundError", { enumerable: true, get: function () { return errors_js_1.FlittNotFoundError; } });
26
+ Object.defineProperty(exports, "FlittConflictError", { enumerable: true, get: function () { return errors_js_1.FlittConflictError; } });
27
+ Object.defineProperty(exports, "FlittRateLimitError", { enumerable: true, get: function () { return errors_js_1.FlittRateLimitError; } });
28
+ Object.defineProperty(exports, "FlittServerError", { enumerable: true, get: function () { return errors_js_1.FlittServerError; } });
29
+ var version_js_1 = require("./version.js");
30
+ Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_js_1.VERSION; } });
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,yCAAkE;AAAzD,kGAAA,KAAK,OAAA;AAAE,uGAAA,UAAU,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AAG5C,6CAAiE;AAAxD,4GAAA,aAAa,OAAA;AAAE,gHAAA,iBAAiB,OAAA;AAEzC,yCAcqB;AAbnB,uGAAA,UAAU,OAAA;AACV,6GAAA,gBAAgB,OAAA;AAChB,iHAAA,oBAAoB,OAAA;AACpB,8GAAA,iBAAiB,OAAA;AACjB,4GAAA,eAAe,OAAA;AACf,0GAAA,aAAa,OAAA;AACb,iHAAA,oBAAoB,OAAA;AACpB,qHAAA,wBAAwB,OAAA;AACxB,iHAAA,oBAAoB,OAAA;AACpB,+GAAA,kBAAkB,OAAA;AAClB,+GAAA,kBAAkB,OAAA;AAClB,gHAAA,mBAAmB,OAAA;AACnB,6GAAA,gBAAgB,OAAA;AAElB,2CAAuC;AAA9B,qGAAA,OAAO,OAAA"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }