bannerify-js 0.0.28 → 0.1.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/index.cjs +199 -162
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +714 -440
- package/dist/index.d.ts +714 -440
- package/dist/index.js +196 -159
- package/dist/index.js.map +1 -1
- package/package.json +17 -18
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../node_modules/.pnpm/ky@1.1.3/node_modules/ky/source/errors/HTTPError.ts","../node_modules/.pnpm/ky@1.1.3/node_modules/ky/source/errors/TimeoutError.ts","../node_modules/.pnpm/ky@1.1.3/node_modules/ky/source/utils/is.ts","../node_modules/.pnpm/ky@1.1.3/node_modules/ky/source/utils/merge.ts","../node_modules/.pnpm/ky@1.1.3/node_modules/ky/source/core/constants.ts","../node_modules/.pnpm/ky@1.1.3/node_modules/ky/source/utils/normalize.ts","../node_modules/.pnpm/ky@1.1.3/node_modules/ky/source/utils/timeout.ts","../node_modules/.pnpm/ky@1.1.3/node_modules/ky/source/utils/delay.ts","../node_modules/.pnpm/ky@1.1.3/node_modules/ky/source/utils/options.ts","../node_modules/.pnpm/ky@1.1.3/node_modules/ky/source/core/Ky.ts","../node_modules/.pnpm/ky@1.1.3/node_modules/ky/source/index.ts","../package.json","../src/telemetry.ts","../src/types.ts","../src/client.ts"],"sourcesContent":["import type {NormalizedOptions} from '../types/options.js';\n\n// eslint-lint-disable-next-line @typescript-eslint/naming-convention\nexport class HTTPError extends Error {\n\tpublic response: Response;\n\tpublic request: Request;\n\tpublic options: NormalizedOptions;\n\n\tconstructor(response: Response, request: Request, options: NormalizedOptions) {\n\t\tconst code = (response.status || response.status === 0) ? response.status : '';\n\t\tconst title = response.statusText || '';\n\t\tconst status = `${code} ${title}`.trim();\n\t\tconst reason = status ? `status code ${status}` : 'an unknown error';\n\n\t\tsuper(`Request failed with ${reason}`);\n\n\t\tthis.name = 'HTTPError';\n\t\tthis.response = response;\n\t\tthis.request = request;\n\t\tthis.options = options;\n\t}\n}\n","export class TimeoutError extends Error {\n\tpublic request: Request;\n\n\tconstructor(request: Request) {\n\t\tsuper('Request timed out');\n\t\tthis.name = 'TimeoutError';\n\t\tthis.request = request;\n\t}\n}\n","// eslint-disable-next-line @typescript-eslint/ban-types\nexport const isObject = (value: unknown): value is object => value !== null && typeof value === 'object';\n","import type {KyHeadersInit, Options} from '../types/options.js';\nimport {isObject} from './is.js';\n\nexport const validateAndMerge = (...sources: Array<Partial<Options> | undefined>): Partial<Options> => {\n\tfor (const source of sources) {\n\t\tif ((!isObject(source) || Array.isArray(source)) && source !== undefined) {\n\t\t\tthrow new TypeError('The `options` argument must be an object');\n\t\t}\n\t}\n\n\treturn deepMerge({}, ...sources);\n};\n\nexport const mergeHeaders = (source1: KyHeadersInit = {}, source2: KyHeadersInit = {}) => {\n\tconst result = new globalThis.Headers(source1 as HeadersInit);\n\tconst isHeadersInstance = source2 instanceof globalThis.Headers;\n\tconst source = new globalThis.Headers(source2 as HeadersInit);\n\n\tfor (const [key, value] of source.entries()) {\n\t\tif ((isHeadersInstance && value === 'undefined') || value === undefined) {\n\t\t\tresult.delete(key);\n\t\t} else {\n\t\t\tresult.set(key, value);\n\t\t}\n\t}\n\n\treturn result;\n};\n\n// TODO: Make this strongly-typed (no `any`).\nexport const deepMerge = <T>(...sources: Array<Partial<T> | undefined>): T => {\n\tlet returnValue: any = {};\n\tlet headers = {};\n\n\tfor (const source of sources) {\n\t\tif (Array.isArray(source)) {\n\t\t\tif (!Array.isArray(returnValue)) {\n\t\t\t\treturnValue = [];\n\t\t\t}\n\n\t\t\treturnValue = [...returnValue, ...source];\n\t\t} else if (isObject(source)) {\n\t\t\tfor (let [key, value] of Object.entries(source)) {\n\t\t\t\tif (isObject(value) && key in returnValue) {\n\t\t\t\t\tvalue = deepMerge(returnValue[key], value);\n\t\t\t\t}\n\n\t\t\t\treturnValue = {...returnValue, [key]: value};\n\t\t\t}\n\n\t\t\tif (isObject((source as any).headers)) {\n\t\t\t\theaders = mergeHeaders(headers, (source as any).headers);\n\t\t\t\treturnValue.headers = headers;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn returnValue;\n};\n","import type {Expect, Equal} from '@type-challenges/utils';\nimport {type HttpMethod, type KyOptionsRegistry} from '../types/options.js';\nimport {type RequestInitRegistry} from '../types/request.js';\n\nexport const supportsRequestStreams = (() => {\n\tlet duplexAccessed = false;\n\tlet hasContentType = false;\n\tconst supportsReadableStream = typeof globalThis.ReadableStream === 'function';\n\tconst supportsRequest = typeof globalThis.Request === 'function';\n\n\tif (supportsReadableStream && supportsRequest) {\n\t\thasContentType = new globalThis.Request('https://empty.invalid', {\n\t\t\tbody: new globalThis.ReadableStream(),\n\t\t\tmethod: 'POST',\n\t\t\t// @ts-expect-error - Types are outdated.\n\t\t\tget duplex() {\n\t\t\t\tduplexAccessed = true;\n\t\t\t\treturn 'half';\n\t\t\t},\n\t\t}).headers.has('Content-Type');\n\t}\n\n\treturn duplexAccessed && !hasContentType;\n})();\n\nexport const supportsAbortController = typeof globalThis.AbortController === 'function';\nexport const supportsResponseStreams = typeof globalThis.ReadableStream === 'function';\nexport const supportsFormData = typeof globalThis.FormData === 'function';\n\nexport const requestMethods = ['get', 'post', 'put', 'patch', 'head', 'delete'] as const;\n\nconst validate = <T extends Array<true>>() => undefined as unknown as T;\nvalidate<[\n\tExpect<Equal<typeof requestMethods[number], HttpMethod>>,\n]>();\n\nexport const responseTypes = {\n\tjson: 'application/json',\n\ttext: 'text/*',\n\tformData: 'multipart/form-data',\n\tarrayBuffer: '*/*',\n\tblob: '*/*',\n} as const;\n\n// The maximum value of a 32bit int (see issue #117)\nexport const maxSafeTimeout = 2_147_483_647;\n\nexport const stop = Symbol('stop');\n\nexport const kyOptionKeys: KyOptionsRegistry = {\n\tjson: true,\n\tparseJson: true,\n\tsearchParams: true,\n\tprefixUrl: true,\n\tretry: true,\n\ttimeout: true,\n\thooks: true,\n\tthrowHttpErrors: true,\n\tonDownloadProgress: true,\n\tfetch: true,\n};\n\nexport const requestOptionsRegistry: RequestInitRegistry = {\n\tmethod: true,\n\theaders: true,\n\tbody: true,\n\tmode: true,\n\tcredentials: true,\n\tcache: true,\n\tredirect: true,\n\treferrer: true,\n\treferrerPolicy: true,\n\tintegrity: true,\n\tkeepalive: true,\n\tsignal: true,\n\twindow: true,\n\tdispatcher: true,\n\tduplex: true,\n};\n","import {requestMethods} from '../core/constants.js';\nimport type {HttpMethod} from '../types/options.js';\nimport type {RetryOptions} from '../types/retry.js';\n\nexport const normalizeRequestMethod = (input: string): string =>\n\trequestMethods.includes(input as HttpMethod) ? input.toUpperCase() : input;\n\nconst retryMethods = ['get', 'put', 'head', 'delete', 'options', 'trace'];\n\nconst retryStatusCodes = [408, 413, 429, 500, 502, 503, 504];\n\nconst retryAfterStatusCodes = [413, 429, 503];\n\nconst defaultRetryOptions: Required<RetryOptions> = {\n\tlimit: 2,\n\tmethods: retryMethods,\n\tstatusCodes: retryStatusCodes,\n\tafterStatusCodes: retryAfterStatusCodes,\n\tmaxRetryAfter: Number.POSITIVE_INFINITY,\n\tbackoffLimit: Number.POSITIVE_INFINITY,\n\tdelay: attemptCount => 0.3 * (2 ** (attemptCount - 1)) * 1000,\n};\n\nexport const normalizeRetryOptions = (retry: number | RetryOptions = {}): Required<RetryOptions> => {\n\tif (typeof retry === 'number') {\n\t\treturn {\n\t\t\t...defaultRetryOptions,\n\t\t\tlimit: retry,\n\t\t};\n\t}\n\n\tif (retry.methods && !Array.isArray(retry.methods)) {\n\t\tthrow new Error('retry.methods must be an array');\n\t}\n\n\tif (retry.statusCodes && !Array.isArray(retry.statusCodes)) {\n\t\tthrow new Error('retry.statusCodes must be an array');\n\t}\n\n\treturn {\n\t\t...defaultRetryOptions,\n\t\t...retry,\n\t\tafterStatusCodes: retryAfterStatusCodes,\n\t};\n};\n","import {TimeoutError} from '../errors/TimeoutError.js';\n\nexport type TimeoutOptions = {\n\ttimeout: number;\n\tfetch: typeof fetch;\n};\n\n// `Promise.race()` workaround (#91)\nexport default async function timeout(\n\trequest: Request,\n\tinit: RequestInit,\n\tabortController: AbortController | undefined,\n\toptions: TimeoutOptions,\n): Promise<Response> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst timeoutId = setTimeout(() => {\n\t\t\tif (abortController) {\n\t\t\t\tabortController.abort();\n\t\t\t}\n\n\t\t\treject(new TimeoutError(request));\n\t\t}, options.timeout);\n\n\t\tvoid options\n\t\t\t.fetch(request, init)\n\t\t\t.then(resolve)\n\t\t\t.catch(reject)\n\t\t\t.then(() => {\n\t\t\t\tclearTimeout(timeoutId);\n\t\t\t});\n\t});\n}\n","// https://github.com/sindresorhus/delay/tree/ab98ae8dfcb38e1593286c94d934e70d14a4e111\n\nimport {type InternalOptions} from '../types/options.js';\n\nexport type DelayOptions = {\n\tsignal?: InternalOptions['signal'];\n};\n\nexport default async function delay(\n\tms: number,\n\t{signal}: DelayOptions,\n): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tif (signal) {\n\t\t\tsignal.throwIfAborted();\n\t\t\tsignal.addEventListener('abort', abortHandler, {once: true});\n\t\t}\n\n\t\tfunction abortHandler() {\n\t\t\tclearTimeout(timeoutId);\n\t\t\treject(signal!.reason);\n\t\t}\n\n\t\tconst timeoutId = setTimeout(() => {\n\t\t\tsignal?.removeEventListener('abort', abortHandler);\n\t\t\tresolve();\n\t\t}, ms);\n\t});\n}\n","import {kyOptionKeys, requestOptionsRegistry} from '../core/constants.js';\n\nexport const findUnknownOptions = (\n\trequest: Request,\n\toptions: Record<string, unknown>,\n): Record<string, unknown> => {\n\tconst unknownOptions: Record<string, unknown> = {};\n\n\tfor (const key in options) {\n\t\tif (!(key in requestOptionsRegistry) && !(key in kyOptionKeys) && !(key in request)) {\n\t\t\tunknownOptions[key] = options[key];\n\t\t}\n\t}\n\n\treturn unknownOptions;\n};\n","import {HTTPError} from '../errors/HTTPError.js';\nimport {TimeoutError} from '../errors/TimeoutError.js';\nimport type {Hooks} from '../types/hooks.js';\nimport type {Input, InternalOptions, NormalizedOptions, Options, SearchParamsInit} from '../types/options.js';\nimport {type ResponsePromise} from '../types/ResponsePromise.js';\nimport {deepMerge, mergeHeaders} from '../utils/merge.js';\nimport {normalizeRequestMethod, normalizeRetryOptions} from '../utils/normalize.js';\nimport timeout, {type TimeoutOptions} from '../utils/timeout.js';\nimport delay from '../utils/delay.js';\nimport {type ObjectEntries} from '../utils/types.js';\nimport {findUnknownOptions} from '../utils/options.js';\nimport {\n\tmaxSafeTimeout,\n\tresponseTypes,\n\tstop,\n\tsupportsAbortController,\n\tsupportsFormData,\n\tsupportsResponseStreams,\n\tsupportsRequestStreams,\n} from './constants.js';\n\nexport class Ky {\n\tstatic create(input: Input, options: Options): ResponsePromise {\n\t\tconst ky = new Ky(input, options);\n\n\t\tconst fn = async (): Promise<Response> => {\n\t\t\tif (typeof ky._options.timeout === 'number' && ky._options.timeout > maxSafeTimeout) {\n\t\t\t\tthrow new RangeError(`The \\`timeout\\` option cannot be greater than ${maxSafeTimeout}`);\n\t\t\t}\n\n\t\t\t// Delay the fetch so that body method shortcuts can set the Accept header\n\t\t\tawait Promise.resolve();\n\t\t\tlet response = await ky._fetch();\n\n\t\t\tfor (const hook of ky._options.hooks.afterResponse) {\n\t\t\t\t// eslint-disable-next-line no-await-in-loop\n\t\t\t\tconst modifiedResponse = await hook(\n\t\t\t\t\tky.request,\n\t\t\t\t\tky._options as NormalizedOptions,\n\t\t\t\t\tky._decorateResponse(response.clone()),\n\t\t\t\t);\n\n\t\t\t\tif (modifiedResponse instanceof globalThis.Response) {\n\t\t\t\t\tresponse = modifiedResponse;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tky._decorateResponse(response);\n\n\t\t\tif (!response.ok && ky._options.throwHttpErrors) {\n\t\t\t\tlet error = new HTTPError(response, ky.request, (ky._options as unknown) as NormalizedOptions);\n\n\t\t\t\tfor (const hook of ky._options.hooks.beforeError) {\n\t\t\t\t\t// eslint-disable-next-line no-await-in-loop\n\t\t\t\t\terror = await hook(error);\n\t\t\t\t}\n\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\t// If `onDownloadProgress` is passed, it uses the stream API internally\n\t\t\t/* istanbul ignore next */\n\t\t\tif (ky._options.onDownloadProgress) {\n\t\t\t\tif (typeof ky._options.onDownloadProgress !== 'function') {\n\t\t\t\t\tthrow new TypeError('The `onDownloadProgress` option must be a function');\n\t\t\t\t}\n\n\t\t\t\tif (!supportsResponseStreams) {\n\t\t\t\t\tthrow new Error('Streams are not supported in your environment. `ReadableStream` is missing.');\n\t\t\t\t}\n\n\t\t\t\treturn ky._stream(response.clone(), ky._options.onDownloadProgress);\n\t\t\t}\n\n\t\t\treturn response;\n\t\t};\n\n\t\tconst isRetriableMethod = ky._options.retry.methods.includes(ky.request.method.toLowerCase());\n\t\tconst result = (isRetriableMethod ? ky._retry(fn) : fn()) as ResponsePromise;\n\n\t\tfor (const [type, mimeType] of Object.entries(responseTypes) as ObjectEntries<typeof responseTypes>) {\n\t\t\tresult[type] = async () => {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n\t\t\t\tky.request.headers.set('accept', ky.request.headers.get('accept') || mimeType);\n\n\t\t\t\tconst awaitedResult = await result;\n\t\t\t\tconst response = awaitedResult.clone();\n\n\t\t\t\tif (type === 'json') {\n\t\t\t\t\tif (response.status === 204) {\n\t\t\t\t\t\treturn '';\n\t\t\t\t\t}\n\n\t\t\t\t\tconst arrayBuffer = await response.clone().arrayBuffer();\n\t\t\t\t\tconst responseSize = arrayBuffer.byteLength;\n\t\t\t\t\tif (responseSize === 0) {\n\t\t\t\t\t\treturn '';\n\t\t\t\t\t}\n\n\t\t\t\t\tif (options.parseJson) {\n\t\t\t\t\t\treturn options.parseJson(await response.text());\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn response[type]();\n\t\t\t};\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tpublic request: Request;\n\tprotected abortController?: AbortController;\n\tprotected _retryCount = 0;\n\tprotected _input: Input;\n\tprotected _options: InternalOptions;\n\n\t// eslint-disable-next-line complexity\n\tconstructor(input: Input, options: Options = {}) {\n\t\tthis._input = input;\n\t\tthis._options = {\n\t\t\t// TODO: credentials can be removed when the spec change is implemented in all browsers. Context: https://www.chromestatus.com/feature/4539473312350208\n\t\t\tcredentials: (this._input as Request).credentials || 'same-origin',\n\t\t\t...options,\n\t\t\theaders: mergeHeaders((this._input as Request).headers, options.headers),\n\t\t\thooks: deepMerge<Required<Hooks>>(\n\t\t\t\t{\n\t\t\t\t\tbeforeRequest: [],\n\t\t\t\t\tbeforeRetry: [],\n\t\t\t\t\tbeforeError: [],\n\t\t\t\t\tafterResponse: [],\n\t\t\t\t},\n\t\t\t\toptions.hooks,\n\t\t\t),\n\t\t\tmethod: normalizeRequestMethod(options.method ?? (this._input as Request).method),\n\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n\t\t\tprefixUrl: String(options.prefixUrl || ''),\n\t\t\tretry: normalizeRetryOptions(options.retry),\n\t\t\tthrowHttpErrors: options.throwHttpErrors !== false,\n\t\t\ttimeout: options.timeout ?? 10_000,\n\t\t\tfetch: options.fetch ?? globalThis.fetch.bind(globalThis),\n\t\t};\n\n\t\tif (typeof this._input !== 'string' && !(this._input instanceof URL || this._input instanceof globalThis.Request)) {\n\t\t\tthrow new TypeError('`input` must be a string, URL, or Request');\n\t\t}\n\n\t\tif (this._options.prefixUrl && typeof this._input === 'string') {\n\t\t\tif (this._input.startsWith('/')) {\n\t\t\t\tthrow new Error('`input` must not begin with a slash when using `prefixUrl`');\n\t\t\t}\n\n\t\t\tif (!this._options.prefixUrl.endsWith('/')) {\n\t\t\t\tthis._options.prefixUrl += '/';\n\t\t\t}\n\n\t\t\tthis._input = this._options.prefixUrl + this._input;\n\t\t}\n\n\t\tif (supportsAbortController) {\n\t\t\tthis.abortController = new globalThis.AbortController();\n\t\t\tif (this._options.signal) {\n\t\t\t\tconst originalSignal = this._options.signal;\n\n\t\t\t\tthis._options.signal.addEventListener('abort', () => {\n\t\t\t\t\tthis.abortController!.abort(originalSignal.reason);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tthis._options.signal = this.abortController.signal;\n\t\t}\n\n\t\tif (supportsRequestStreams) {\n\t\t\t// @ts-expect-error - Types are outdated.\n\t\t\tthis._options.duplex = 'half';\n\t\t}\n\n\t\tthis.request = new globalThis.Request(this._input as RequestInfo, this._options as RequestInit);\n\n\t\tif (this._options.searchParams) {\n\t\t\t// eslint-disable-next-line unicorn/prevent-abbreviations\n\t\t\tconst textSearchParams = typeof this._options.searchParams === 'string'\n\t\t\t\t? this._options.searchParams.replace(/^\\?/, '')\n\t\t\t\t: new URLSearchParams(this._options.searchParams as unknown as SearchParamsInit).toString();\n\t\t\t// eslint-disable-next-line unicorn/prevent-abbreviations\n\t\t\tconst searchParams = '?' + textSearchParams;\n\t\t\tconst url = this.request.url.replace(/(?:\\?.*?)?(?=#|$)/, searchParams);\n\n\t\t\t// To provide correct form boundary, Content-Type header should be deleted each time when new Request instantiated from another one\n\t\t\tif (\n\t\t\t\t((supportsFormData && this._options.body instanceof globalThis.FormData)\n\t\t\t\t\t|| this._options.body instanceof URLSearchParams) && !(this._options.headers && (this._options.headers as Record<string, string>)['content-type'])\n\t\t\t) {\n\t\t\t\tthis.request.headers.delete('content-type');\n\t\t\t}\n\n\t\t\t// The spread of `this.request` is required as otherwise it misses the `duplex` option for some reason and throws.\n\t\t\tthis.request = new globalThis.Request(new globalThis.Request(url, {...this.request}), this._options as RequestInit);\n\t\t}\n\n\t\tif (this._options.json !== undefined) {\n\t\t\tthis._options.body = JSON.stringify(this._options.json);\n\t\t\tthis.request.headers.set('content-type', this._options.headers.get('content-type') ?? 'application/json');\n\t\t\tthis.request = new globalThis.Request(this.request, {body: this._options.body});\n\t\t}\n\t}\n\n\tprotected _calculateRetryDelay(error: unknown) {\n\t\tthis._retryCount++;\n\n\t\tif (this._retryCount < this._options.retry.limit && !(error instanceof TimeoutError)) {\n\t\t\tif (error instanceof HTTPError) {\n\t\t\t\tif (!this._options.retry.statusCodes.includes(error.response.status)) {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\n\t\t\t\tconst retryAfter = error.response.headers.get('Retry-After');\n\t\t\t\tif (retryAfter && this._options.retry.afterStatusCodes.includes(error.response.status)) {\n\t\t\t\t\tlet after = Number(retryAfter);\n\t\t\t\t\tif (Number.isNaN(after)) {\n\t\t\t\t\t\tafter = Date.parse(retryAfter) - Date.now();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tafter *= 1000;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this._options.retry.maxRetryAfter !== undefined && after > this._options.retry.maxRetryAfter) {\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn after;\n\t\t\t\t}\n\n\t\t\t\tif (error.response.status === 413) {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst retryDelay = this._options.retry.delay(this._retryCount);\n\t\t\treturn Math.min(this._options.retry.backoffLimit, retryDelay);\n\t\t}\n\n\t\treturn 0;\n\t}\n\n\tprotected _decorateResponse(response: Response): Response {\n\t\tif (this._options.parseJson) {\n\t\t\tresponse.json = async () => this._options.parseJson!(await response.text());\n\t\t}\n\n\t\treturn response;\n\t}\n\n\tprotected async _retry<T extends (...args: any) => Promise<any>>(fn: T): Promise<ReturnType<T> | void> {\n\t\ttry {\n\t\t\treturn await fn();\n\t\t} catch (error) {\n\t\t\tconst ms = Math.min(this._calculateRetryDelay(error), maxSafeTimeout);\n\t\t\tif (ms !== 0 && this._retryCount > 0) {\n\t\t\t\tawait delay(ms, {signal: this._options.signal});\n\n\t\t\t\tfor (const hook of this._options.hooks.beforeRetry) {\n\t\t\t\t\t// eslint-disable-next-line no-await-in-loop\n\t\t\t\t\tconst hookResult = await hook({\n\t\t\t\t\t\trequest: this.request,\n\t\t\t\t\t\toptions: (this._options as unknown) as NormalizedOptions,\n\t\t\t\t\t\terror: error as Error,\n\t\t\t\t\t\tretryCount: this._retryCount,\n\t\t\t\t\t});\n\n\t\t\t\t\t// If `stop` is returned from the hook, the retry process is stopped\n\t\t\t\t\tif (hookResult === stop) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn this._retry(fn);\n\t\t\t}\n\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tprotected async _fetch(): Promise<Response> {\n\t\tfor (const hook of this._options.hooks.beforeRequest) {\n\t\t\t// eslint-disable-next-line no-await-in-loop\n\t\t\tconst result = await hook(this.request, (this._options as unknown) as NormalizedOptions);\n\n\t\t\tif (result instanceof Request) {\n\t\t\t\tthis.request = result;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (result instanceof Response) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\n\t\tconst nonRequestOptions = findUnknownOptions(this.request, this._options);\n\n\t\tif (this._options.timeout === false) {\n\t\t\treturn this._options.fetch(this.request.clone(), nonRequestOptions);\n\t\t}\n\n\t\treturn timeout(this.request.clone(), nonRequestOptions, this.abortController, this._options as TimeoutOptions);\n\t}\n\n\t/* istanbul ignore next */\n\tprotected _stream(response: Response, onDownloadProgress: Options['onDownloadProgress']) {\n\t\tconst totalBytes = Number(response.headers.get('content-length')) || 0;\n\t\tlet transferredBytes = 0;\n\n\t\tif (response.status === 204) {\n\t\t\tif (onDownloadProgress) {\n\t\t\t\tonDownloadProgress({percent: 1, totalBytes, transferredBytes}, new Uint8Array());\n\t\t\t}\n\n\t\t\treturn new globalThis.Response(\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\tstatus: response.status,\n\t\t\t\t\tstatusText: response.statusText,\n\t\t\t\t\theaders: response.headers,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\treturn new globalThis.Response(\n\t\t\tnew globalThis.ReadableStream({\n\t\t\t\tasync start(controller) {\n\t\t\t\t\tconst reader = response.body!.getReader();\n\n\t\t\t\t\tif (onDownloadProgress) {\n\t\t\t\t\t\tonDownloadProgress({percent: 0, transferredBytes: 0, totalBytes}, new Uint8Array());\n\t\t\t\t\t}\n\n\t\t\t\t\tasync function read() {\n\t\t\t\t\t\tconst {done, value} = await reader.read();\n\t\t\t\t\t\tif (done) {\n\t\t\t\t\t\t\tcontroller.close();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (onDownloadProgress) {\n\t\t\t\t\t\t\ttransferredBytes += value.byteLength;\n\t\t\t\t\t\t\tconst percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;\n\t\t\t\t\t\t\tonDownloadProgress({percent, transferredBytes, totalBytes}, value);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcontroller.enqueue(value);\n\t\t\t\t\t\tawait read();\n\t\t\t\t\t}\n\n\t\t\t\t\tawait read();\n\t\t\t\t},\n\t\t\t}),\n\t\t\t{\n\t\t\t\tstatus: response.status,\n\t\t\t\tstatusText: response.statusText,\n\t\t\t\theaders: response.headers,\n\t\t\t},\n\t\t);\n\t}\n}\n","/*! MIT License © Sindre Sorhus */\n\nimport {Ky} from './core/Ky.js';\nimport {requestMethods, stop} from './core/constants.js';\nimport type {KyInstance} from './types/ky.js';\nimport type {Input, Options} from './types/options.js';\nimport {validateAndMerge} from './utils/merge.js';\nimport {type Mutable} from './utils/types.js';\n\nconst createInstance = (defaults?: Partial<Options>): KyInstance => {\n\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\tconst ky: Partial<Mutable<KyInstance>> = (input: Input, options?: Options) => Ky.create(input, validateAndMerge(defaults, options));\n\n\tfor (const method of requestMethods) {\n\t\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\t\tky[method] = (input: Input, options?: Options) => Ky.create(input, validateAndMerge(defaults, options, {method}));\n\t}\n\n\tky.create = (newDefaults?: Partial<Options>) => createInstance(validateAndMerge(newDefaults));\n\tky.extend = (newDefaults?: Partial<Options>) => createInstance(validateAndMerge(defaults, newDefaults));\n\tky.stop = stop;\n\n\treturn ky as KyInstance;\n};\n\nconst ky = createInstance();\n\nexport default ky;\n\nexport type {KyInstance} from './types/ky.js';\n\nexport type {\n\tOptions,\n\tNormalizedOptions,\n\tRetryOptions,\n\tSearchParamsOption,\n\tDownloadProgress,\n} from './types/options.js';\n\nexport type {\n\tHooks,\n\tBeforeRequestHook,\n\tBeforeRetryHook,\n\tBeforeRetryState,\n\tBeforeErrorHook,\n\tAfterResponseHook,\n} from './types/hooks.js';\n\nexport type {ResponsePromise} from './types/ResponsePromise.js';\nexport type {KyResponse} from './types/response.js';\nexport {HTTPError} from './errors/HTTPError.js';\nexport {TimeoutError} from './errors/TimeoutError.js';\n","{\n \"name\": \"bannerify-js\",\n \"version\": \"0.0.28\",\n \"description\": \"\",\n \"type\": \"module\",\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"scripts\": {\n \"test\": \"bun test\",\n \"play\": \"tsx playground/test.ts\",\n \"openapi\": \"openapi-typescript https://api.bannerify.co/openapi -o ./src/openapi.d.ts\",\n \"openapi-local\": \"openapi-typescript http://127.0.0.1:5173/api/openapi -o ./src/openapi.d.ts\",\n \"build:watch\": \"tsup --watch\",\n \"build\": \"tsup\",\n \"up\": \"bun run build && npm version patch --no-git-tag-version && npm publish\"\n },\n \"keywords\": [],\n \"files\": [\n \"dist\"\n ],\n \"author\": \"Duc An <an@bannerify.co>\",\n \"license\": \"ISC\",\n \"devDependencies\": {\n \"@faker-js/faker\": \"^8.4.1\",\n \"@types/node\": \"18.15.3\",\n \"bun-types\": \"^1.0.20\",\n \"chart.js\": \"^4.4.1\",\n \"ky\": \"^1.1.3\",\n \"openapi-typescript\": \"^6.7.3\",\n \"p-map\": \"^7.0.2\",\n \"tsup\": \"^8.0.1\",\n \"tsx\": \"^4.7.0\",\n \"typescript\": \"5.2.2\"\n }\n}\n","import { version } from '../package.json'\n\nexport type Telemetry = {\n sdkVersions: string[];\n platform?: string;\n runtime?: string;\n};\n\nexport function getTelemetry(): Telemetry | null {\n let platform: string | undefined\n let runtime: string | undefined\n const sdkVersions = [`bannerify-js@${version}`]\n\n try {\n if (process?.env?.UNKEY_DISABLE_TELEMETRY) {\n return null\n }\n platform = process.env.VERCEL ? 'vercel' : process.env.AWS_REGION ? 'aws' : undefined\n\n // @ts-ignore\n if (typeof EdgeRuntime !== 'undefined') {\n runtime = 'edge-light'\n } else if (typeof caches !== 'undefined') {\n runtime = 'cloudflare'\n } else if (process?.version) {\n runtime = `node@${process.version}`\n } else {\n runtime = 'fetch-compatible'\n }\n\n } catch (_error) {\n }\n\n return { platform, runtime, sdkVersions }\n}","import { paths } from './openapi'\n\ntype codes = '400' | '401' | '403' | '404' | '500';\n\nexport type ErrorResponse =\n paths['/v1/templates/createImage']['post']['responses'][codes]['content']['application/json'];\n\nexport const timeoutError = {\n error: {\n // @ts-ignore\n code: 'TIMEOUT_ERROR',\n message: 'No response',\n docs: '',\n requestId: 'N/A',\n },\n}\n\nexport type Result<R> =\n | {\n result: R;\n error?: never;\n}\n | {\n result?: never;\n error: ErrorResponse['error'] | (typeof timeoutError)['error'];\n};\n","import ky, { HTTPError, TimeoutError } from \"ky\"\nimport { getTelemetry } from \"./telemetry\"\nimport type { Modification } from \"./interface\"\nimport { type ErrorResponse, type Result, timeoutError } from \"./types\"\n\ninterface Options {\n fetch?: typeof fetch\n baseUrl?: string\n // default 10s\n timeout?: number\n}\n\ntype CreateOptions = {\n modifications?: Modification[]\n // template?: Modification\n // @default: png\n nocache?: boolean\n format?: \"svg\" | \"png\"\n}\n\nexport function createClient(apiKey: string, opts?: Options) {\n return new Bannerify(apiKey, opts)\n}\n\nexport class Bannerify {\n private readonly client: typeof ky\n\n private readonly baseUrl: string\n\n constructor(\n private readonly apiKey: string,\n private readonly opts?: Options,\n ) {\n const telemetry = getTelemetry()\n this.baseUrl = opts?.baseUrl || \"https://api.bannerify.co/v1\"\n this.client = ky.create({\n fetch: opts?.fetch || globalThis.fetch.bind(globalThis),\n prefixUrl: this.baseUrl,\n headers: {\n Authorization: `Bearer ${apiKey}`,\n \"X-SDK-Version\": `${telemetry?.sdkVersions}`,\n \"X-Platform\": telemetry?.platform,\n \"X-Runtime\": telemetry?.runtime,\n },\n timeout: opts?.timeout ?? 10e3,\n })\n }\n\n async createImage(\n templateId: string,\n options?: CreateOptions,\n ): Promise<Result<ArrayBuffer | string>> {\n try {\n const res = await this.client.post(\"templates/createImage\", {\n json: {\n modifications: options?.modifications ?? [],\n // template: JSON.stringify(options?.template ?? {}),\n templateId,\n apiKey: this.apiKey,\n format: options?.format as string,\n },\n })\n if (options?.format === \"svg\") {\n return { result: await res.text() }\n }\n return { result: await res.arrayBuffer() }\n // biome-ignore lint/suspicious/noExplicitAny: <explanation>\n } catch (e: any) {\n if (e instanceof HTTPError) {\n return (await e.response.json())[\"error\"] as ErrorResponse\n }\n if (e instanceof TimeoutError) {\n return timeoutError as ErrorResponse\n }\n throw e\n }\n }\n\n async createPdf(templateId: string, options?: CreateOptions) {\n try {\n const res = await this.client.post(\"templates/createPdf\", {\n json: {\n modifications: options?.modifications ?? [],\n // template: JSON.stringify(options?.template ?? {}),\n templateId,\n apiKey: this.apiKey,\n format: options?.format as string,\n },\n })\n return { result: await res.arrayBuffer() }\n // biome-ignore lint/suspicious/noExplicitAny: <explanation>\n } catch (e: any) {\n if (e instanceof HTTPError) {\n return (await e.response.json())[\"error\"] as ErrorResponse\n }\n if (e instanceof TimeoutError) {\n return timeoutError as ErrorResponse\n }\n throw e\n }\n }\n\n async createStoredImage(templateId: string, options?: CreateOptions) {\n try {\n const res = await this.client.post(\"templates/createStoredImage\", {\n json: {\n modifications: options?.modifications ?? [],\n // template: JSON.stringify(options?.template ?? {}),\n templateId,\n apiKey: this.apiKey,\n format: options?.format as string,\n },\n })\n const json = (await res.json()) as { url: string }\n return { result: json.url }\n // biome-ignore lint/suspicious/noExplicitAny: <explanation>\n } catch (e: any) {\n if (e instanceof HTTPError) {\n return (await e.response.json())[\"error\"] as ErrorResponse\n }\n if (e instanceof TimeoutError) {\n return timeoutError as ErrorResponse\n }\n throw e\n }\n }\n\n #hashText = async (text: string) => {\n const myText = new TextEncoder().encode(text)\n const myDigest = await crypto.subtle.digest({ name: \"SHA-256\" }, myText)\n const hashArray = Array.from(new Uint8Array(myDigest))\n const hashHex = hashArray.map((b) => b.toString(16).padStart(2, \"0\")).join(\"\")\n return hashHex\n }\n\n async generateImageSignedUrl(templateId: string, options?: CreateOptions) {\n const apiKeyHashed = await this.#hashText(this.apiKey)\n const searchParams = new URLSearchParams()\n searchParams.set(\"apiKeyHashed\", apiKeyHashed)\n if (options?.format === \"svg\") {\n searchParams.set(\"format\", \"svg\")\n }\n if (options?.modifications) {\n searchParams.set(\"modifications\", JSON.stringify(options?.modifications))\n }\n if (options?.nocache) {\n searchParams.set(\"nocache\", \"true\")\n }\n searchParams.set(\"templateId\", templateId)\n searchParams.sort()\n // TODO update to this.opts.apiKey\n searchParams.set(\n \"sign\",\n await this.#hashText(searchParams.toString() + searchParams.get(\"apiKeyHashed\")),\n )\n return `${this.baseUrl}/templates/signedurl?${searchParams.toString()}`\n }\n}\n"],"mappings":";AAGM,IAAO,YAAP,cAAyB,MAAK;EAKnC,YAAY,UAAoB,SAAkB,SAA0B;AAC3E,UAAM,OAAQ,SAAS,UAAU,SAAS,WAAW,IAAK,SAAS,SAAS;AAC5E,UAAM,QAAQ,SAAS,cAAc;AACrC,UAAM,SAAS,GAAG,IAAI,IAAI,KAAK,GAAG,KAAI;AACtC,UAAM,SAAS,SAAS,eAAe,MAAM,KAAK;AAElD,UAAM,uBAAuB,MAAM,EAAE;AAV/B,WAAA,eAAA,MAAA,YAAA;;;;;;AACA,WAAA,eAAA,MAAA,WAAA;;;;;;AACA,WAAA,eAAA,MAAA,WAAA;;;;;;AAUN,SAAK,OAAO;AACZ,SAAK,WAAW;AAChB,SAA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ACzC,iBAAa,IAAI,gBAAgB,YAAY;AAC7C,QAAI,SAAS,WAAW,OAAO;AAC7B,mBAAa,IAAI,UAAU,KAAK;AAAA,IAClC;AACA,QAAI,SAAS,eAAe;AAC1B,mBAAa,IAAI,iBAAiB,KAAK,UAAU,SAAS,aAAa,CAAC;AAAA,IAC1E;AACA,QAAI,SAAS,SAAS;AACpB,mBAAa,IAAI,WAAW,MAAM;AAAA,IACpC;AACA,iBAAa,IAAI,cAAc,UAAU;AACzC,iBAAa,KAAK;AAElB,iBAAa;AAAA,MACX;AAAA,MACA,MAAM,KAAK,UAAU,aAAa,SAAS,IAAI,aAAa,IAAI,cAAc,CAAC;AAAA,IACjF;AACA,WAAO,GAAG,KAAK,OAAO,wBAAwB,aAAa,SAAS,CAAC;AAAA,EACvE;AACF;","names":["ky","ky"]}
|
|
1
|
+
{"version":3,"sources":["../../../../node_modules/ky/source/errors/HTTPError.ts","../../../../node_modules/ky/source/errors/TimeoutError.ts","../../../../node_modules/ky/source/utils/is.ts","../../../../node_modules/ky/source/utils/merge.ts","../../../../node_modules/ky/source/core/constants.ts","../../../../node_modules/ky/source/utils/normalize.ts","../../../../node_modules/ky/source/utils/timeout.ts","../../../../node_modules/ky/source/utils/delay.ts","../../../../node_modules/ky/source/utils/options.ts","../../../../node_modules/ky/source/core/Ky.ts","../../../../node_modules/ky/source/index.ts","../package.json","../src/telemetry.ts","../src/format.ts","../src/types.ts","../src/client.ts"],"sourcesContent":["import type {NormalizedOptions} from '../types/options.js';\nimport type {KyRequest} from '../types/request.js';\nimport type {KyResponse} from '../types/response.js';\n\nexport class HTTPError<T = unknown> extends Error {\n\tpublic response: KyResponse<T>;\n\tpublic request: KyRequest;\n\tpublic options: NormalizedOptions;\n\n\tconstructor(response: Response, request: Request, options: NormalizedOptions) {\n\t\tconst code = (response.status || response.status === 0) ? response.status : '';\n\t\tconst title = response.statusText || '';\n\t\tconst status = `${code} ${title}`.trim();\n\t\tconst reason = status ? `status code ${status}` : 'an unknown error';\n\n\t\tsuper(`Request failed with ${reason}: ${request.method} ${request.url}`);\n\n\t\tthis.name = 'HTTPError';\n\t\tthis.response = response;\n\t\tthis.request = request;\n\t\tthis.options = options;\n\t}\n}\n","import type {KyRequest} from '../types/request.js';\n\nexport class TimeoutError extends Error {\n\tpublic request: KyRequest;\n\n\tconstructor(request: Request) {\n\t\tsuper(`Request timed out: ${request.method} ${request.url}`);\n\t\tthis.name = 'TimeoutError';\n\t\tthis.request = request;\n\t}\n}\n","// eslint-disable-next-line @typescript-eslint/ban-types\nexport const isObject = (value: unknown): value is object => value !== null && typeof value === 'object';\n","import type {KyHeadersInit, Options} from '../types/options.js';\nimport type {Hooks} from '../types/hooks.js';\nimport {isObject} from './is.js';\n\nexport const validateAndMerge = (...sources: Array<Partial<Options> | undefined>): Partial<Options> => {\n\tfor (const source of sources) {\n\t\tif ((!isObject(source) || Array.isArray(source)) && source !== undefined) {\n\t\t\tthrow new TypeError('The `options` argument must be an object');\n\t\t}\n\t}\n\n\treturn deepMerge({}, ...sources);\n};\n\nexport const mergeHeaders = (source1: KyHeadersInit = {}, source2: KyHeadersInit = {}) => {\n\tconst result = new globalThis.Headers(source1 as RequestInit['headers']);\n\tconst isHeadersInstance = source2 instanceof globalThis.Headers;\n\tconst source = new globalThis.Headers(source2 as RequestInit['headers']);\n\n\tfor (const [key, value] of source.entries()) {\n\t\tif ((isHeadersInstance && value === 'undefined') || value === undefined) {\n\t\t\tresult.delete(key);\n\t\t} else {\n\t\t\tresult.set(key, value);\n\t\t}\n\t}\n\n\treturn result;\n};\n\nfunction newHookValue<K extends keyof Hooks>(original: Hooks, incoming: Hooks, property: K): Required<Hooks>[K] {\n\treturn (Object.hasOwn(incoming, property) && incoming[property] === undefined)\n\t\t? []\n\t\t: deepMerge<Required<Hooks>[K]>(original[property] ?? [], incoming[property] ?? []);\n}\n\nexport const mergeHooks = (original: Hooks = {}, incoming: Hooks = {}): Required<Hooks> => (\n\t{\n\t\tbeforeRequest: newHookValue(original, incoming, 'beforeRequest'),\n\t\tbeforeRetry: newHookValue(original, incoming, 'beforeRetry'),\n\t\tafterResponse: newHookValue(original, incoming, 'afterResponse'),\n\t\tbeforeError: newHookValue(original, incoming, 'beforeError'),\n\t}\n);\n\n// TODO: Make this strongly-typed (no `any`).\nexport const deepMerge = <T>(...sources: Array<Partial<T> | undefined>): T => {\n\tlet returnValue: any = {};\n\tlet headers = {};\n\tlet hooks = {};\n\n\tfor (const source of sources) {\n\t\tif (Array.isArray(source)) {\n\t\t\tif (!Array.isArray(returnValue)) {\n\t\t\t\treturnValue = [];\n\t\t\t}\n\n\t\t\treturnValue = [...returnValue, ...source];\n\t\t} else if (isObject(source)) {\n\t\t\tfor (let [key, value] of Object.entries(source)) {\n\t\t\t\tif (isObject(value) && key in returnValue) {\n\t\t\t\t\tvalue = deepMerge(returnValue[key], value);\n\t\t\t\t}\n\n\t\t\t\treturnValue = {...returnValue, [key]: value};\n\t\t\t}\n\n\t\t\tif (isObject((source as any).hooks)) {\n\t\t\t\thooks = mergeHooks(hooks, (source as any).hooks);\n\t\t\t\treturnValue.hooks = hooks;\n\t\t\t}\n\n\t\t\tif (isObject((source as any).headers)) {\n\t\t\t\theaders = mergeHeaders(headers, (source as any).headers);\n\t\t\t\treturnValue.headers = headers;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn returnValue;\n};\n","import type {Expect, Equal} from '@type-challenges/utils';\nimport {type HttpMethod, type KyOptionsRegistry} from '../types/options.js';\nimport {type RequestInitRegistry} from '../types/request.js';\n\nexport const supportsRequestStreams = (() => {\n\tlet duplexAccessed = false;\n\tlet hasContentType = false;\n\tconst supportsReadableStream = typeof globalThis.ReadableStream === 'function';\n\tconst supportsRequest = typeof globalThis.Request === 'function';\n\n\tif (supportsReadableStream && supportsRequest) {\n\t\ttry {\n\t\t\thasContentType = new globalThis.Request('https://empty.invalid', {\n\t\t\t\tbody: new globalThis.ReadableStream(),\n\t\t\t\tmethod: 'POST',\n\t\t\t\t// @ts-expect-error - Types are outdated.\n\t\t\t\tget duplex() {\n\t\t\t\t\tduplexAccessed = true;\n\t\t\t\t\treturn 'half';\n\t\t\t\t},\n\t\t\t}).headers.has('Content-Type');\n\t\t} catch (error) {\n\t\t\t// QQBrowser on iOS throws \"unsupported BodyInit type\" error (see issue #581)\n\t\t\tif (error instanceof Error && error.message === 'unsupported BodyInit type') {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\treturn duplexAccessed && !hasContentType;\n})();\n\nexport const supportsAbortController = typeof globalThis.AbortController === 'function';\nexport const supportsResponseStreams = typeof globalThis.ReadableStream === 'function';\nexport const supportsFormData = typeof globalThis.FormData === 'function';\n\nexport const requestMethods = ['get', 'post', 'put', 'patch', 'head', 'delete'] as const;\n\nconst validate = <T extends Array<true>>() => undefined as unknown as T;\nvalidate<[\n\tExpect<Equal<typeof requestMethods[number], HttpMethod>>,\n]>();\n\nexport const responseTypes = {\n\tjson: 'application/json',\n\ttext: 'text/*',\n\tformData: 'multipart/form-data',\n\tarrayBuffer: '*/*',\n\tblob: '*/*',\n} as const;\n\n// The maximum value of a 32bit int (see issue #117)\nexport const maxSafeTimeout = 2_147_483_647;\n\nexport const stop = Symbol('stop');\n\nexport const kyOptionKeys: KyOptionsRegistry = {\n\tjson: true,\n\tparseJson: true,\n\tstringifyJson: true,\n\tsearchParams: true,\n\tprefixUrl: true,\n\tretry: true,\n\ttimeout: true,\n\thooks: true,\n\tthrowHttpErrors: true,\n\tonDownloadProgress: true,\n\tfetch: true,\n};\n\nexport const requestOptionsRegistry: RequestInitRegistry = {\n\tmethod: true,\n\theaders: true,\n\tbody: true,\n\tmode: true,\n\tcredentials: true,\n\tcache: true,\n\tredirect: true,\n\treferrer: true,\n\treferrerPolicy: true,\n\tintegrity: true,\n\tkeepalive: true,\n\tsignal: true,\n\twindow: true,\n\tdispatcher: true,\n\tduplex: true,\n\tpriority: true,\n};\n","import {requestMethods} from '../core/constants.js';\nimport type {HttpMethod} from '../types/options.js';\nimport type {RetryOptions} from '../types/retry.js';\n\nexport const normalizeRequestMethod = (input: string): string =>\n\trequestMethods.includes(input as HttpMethod) ? input.toUpperCase() : input;\n\nconst retryMethods = ['get', 'put', 'head', 'delete', 'options', 'trace'];\n\nconst retryStatusCodes = [408, 413, 429, 500, 502, 503, 504];\n\nconst retryAfterStatusCodes = [413, 429, 503];\n\nconst defaultRetryOptions: Required<RetryOptions> = {\n\tlimit: 2,\n\tmethods: retryMethods,\n\tstatusCodes: retryStatusCodes,\n\tafterStatusCodes: retryAfterStatusCodes,\n\tmaxRetryAfter: Number.POSITIVE_INFINITY,\n\tbackoffLimit: Number.POSITIVE_INFINITY,\n\tdelay: attemptCount => 0.3 * (2 ** (attemptCount - 1)) * 1000,\n};\n\nexport const normalizeRetryOptions = (retry: number | RetryOptions = {}): Required<RetryOptions> => {\n\tif (typeof retry === 'number') {\n\t\treturn {\n\t\t\t...defaultRetryOptions,\n\t\t\tlimit: retry,\n\t\t};\n\t}\n\n\tif (retry.methods && !Array.isArray(retry.methods)) {\n\t\tthrow new Error('retry.methods must be an array');\n\t}\n\n\tif (retry.statusCodes && !Array.isArray(retry.statusCodes)) {\n\t\tthrow new Error('retry.statusCodes must be an array');\n\t}\n\n\treturn {\n\t\t...defaultRetryOptions,\n\t\t...retry,\n\t};\n};\n","import {TimeoutError} from '../errors/TimeoutError.js';\n\nexport type TimeoutOptions = {\n\ttimeout: number;\n\tfetch: typeof fetch;\n};\n\n// `Promise.race()` workaround (#91)\nexport default async function timeout(\n\trequest: Request,\n\tinit: RequestInit,\n\tabortController: AbortController | undefined,\n\toptions: TimeoutOptions,\n): Promise<Response> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst timeoutId = setTimeout(() => {\n\t\t\tif (abortController) {\n\t\t\t\tabortController.abort();\n\t\t\t}\n\n\t\t\treject(new TimeoutError(request));\n\t\t}, options.timeout);\n\n\t\tvoid options\n\t\t\t.fetch(request, init)\n\t\t\t.then(resolve)\n\t\t\t.catch(reject)\n\t\t\t.then(() => {\n\t\t\t\tclearTimeout(timeoutId);\n\t\t\t});\n\t});\n}\n","// https://github.com/sindresorhus/delay/tree/ab98ae8dfcb38e1593286c94d934e70d14a4e111\n\nimport {type InternalOptions} from '../types/options.js';\n\nexport type DelayOptions = {\n\tsignal?: InternalOptions['signal'];\n};\n\nexport default async function delay(\n\tms: number,\n\t{signal}: DelayOptions,\n): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tif (signal) {\n\t\t\tsignal.throwIfAborted();\n\t\t\tsignal.addEventListener('abort', abortHandler, {once: true});\n\t\t}\n\n\t\tfunction abortHandler() {\n\t\t\tclearTimeout(timeoutId);\n\t\t\treject(signal!.reason as Error);\n\t\t}\n\n\t\tconst timeoutId = setTimeout(() => {\n\t\t\tsignal?.removeEventListener('abort', abortHandler);\n\t\t\tresolve();\n\t\t}, ms);\n\t});\n}\n","import {kyOptionKeys, requestOptionsRegistry} from '../core/constants.js';\n\nexport const findUnknownOptions = (\n\trequest: Request,\n\toptions: Record<string, unknown>,\n): Record<string, unknown> => {\n\tconst unknownOptions: Record<string, unknown> = {};\n\n\tfor (const key in options) {\n\t\tif (!(key in requestOptionsRegistry) && !(key in kyOptionKeys) && !(key in request)) {\n\t\t\tunknownOptions[key] = options[key];\n\t\t}\n\t}\n\n\treturn unknownOptions;\n};\n","import {HTTPError} from '../errors/HTTPError.js';\nimport {TimeoutError} from '../errors/TimeoutError.js';\nimport type {\n\tInput,\n\tInternalOptions,\n\tNormalizedOptions,\n\tOptions,\n\tSearchParamsInit,\n} from '../types/options.js';\nimport {type ResponsePromise} from '../types/ResponsePromise.js';\nimport {mergeHeaders, mergeHooks} from '../utils/merge.js';\nimport {normalizeRequestMethod, normalizeRetryOptions} from '../utils/normalize.js';\nimport timeout, {type TimeoutOptions} from '../utils/timeout.js';\nimport delay from '../utils/delay.js';\nimport {type ObjectEntries} from '../utils/types.js';\nimport {findUnknownOptions} from '../utils/options.js';\nimport {\n\tmaxSafeTimeout,\n\tresponseTypes,\n\tstop,\n\tsupportsAbortController,\n\tsupportsFormData,\n\tsupportsResponseStreams,\n\tsupportsRequestStreams,\n} from './constants.js';\n\nexport class Ky {\n\tstatic create(input: Input, options: Options): ResponsePromise {\n\t\tconst ky = new Ky(input, options);\n\n\t\tconst function_ = async (): Promise<Response> => {\n\t\t\tif (typeof ky._options.timeout === 'number' && ky._options.timeout > maxSafeTimeout) {\n\t\t\t\tthrow new RangeError(`The \\`timeout\\` option cannot be greater than ${maxSafeTimeout}`);\n\t\t\t}\n\n\t\t\t// Delay the fetch so that body method shortcuts can set the Accept header\n\t\t\tawait Promise.resolve();\n\t\t\tlet response = await ky._fetch();\n\n\t\t\tfor (const hook of ky._options.hooks.afterResponse) {\n\t\t\t\t// eslint-disable-next-line no-await-in-loop\n\t\t\t\tconst modifiedResponse = await hook(\n\t\t\t\t\tky.request,\n\t\t\t\t\tky._options as NormalizedOptions,\n\t\t\t\t\tky._decorateResponse(response.clone()),\n\t\t\t\t);\n\n\t\t\t\tif (modifiedResponse instanceof globalThis.Response) {\n\t\t\t\t\tresponse = modifiedResponse;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tky._decorateResponse(response);\n\n\t\t\tif (!response.ok && ky._options.throwHttpErrors) {\n\t\t\t\tlet error = new HTTPError(response, ky.request, ky._options as NormalizedOptions);\n\n\t\t\t\tfor (const hook of ky._options.hooks.beforeError) {\n\t\t\t\t\t// eslint-disable-next-line no-await-in-loop\n\t\t\t\t\terror = await hook(error);\n\t\t\t\t}\n\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\t// If `onDownloadProgress` is passed, it uses the stream API internally\n\t\t\t/* istanbul ignore next */\n\t\t\tif (ky._options.onDownloadProgress) {\n\t\t\t\tif (typeof ky._options.onDownloadProgress !== 'function') {\n\t\t\t\t\tthrow new TypeError('The `onDownloadProgress` option must be a function');\n\t\t\t\t}\n\n\t\t\t\tif (!supportsResponseStreams) {\n\t\t\t\t\tthrow new Error('Streams are not supported in your environment. `ReadableStream` is missing.');\n\t\t\t\t}\n\n\t\t\t\treturn ky._stream(response.clone(), ky._options.onDownloadProgress);\n\t\t\t}\n\n\t\t\treturn response;\n\t\t};\n\n\t\tconst isRetriableMethod = ky._options.retry.methods.includes(ky.request.method.toLowerCase());\n\t\tconst result = (isRetriableMethod ? ky._retry(function_) : function_()) as ResponsePromise;\n\n\t\tfor (const [type, mimeType] of Object.entries(responseTypes) as ObjectEntries<typeof responseTypes>) {\n\t\t\tresult[type] = async () => {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n\t\t\t\tky.request.headers.set('accept', ky.request.headers.get('accept') || mimeType);\n\n\t\t\t\tconst response = await result;\n\n\t\t\t\tif (type === 'json') {\n\t\t\t\t\tif (response.status === 204) {\n\t\t\t\t\t\treturn '';\n\t\t\t\t\t}\n\n\t\t\t\t\tconst arrayBuffer = await response.clone().arrayBuffer();\n\t\t\t\t\tconst responseSize = arrayBuffer.byteLength;\n\t\t\t\t\tif (responseSize === 0) {\n\t\t\t\t\t\treturn '';\n\t\t\t\t\t}\n\n\t\t\t\t\tif (options.parseJson) {\n\t\t\t\t\t\treturn options.parseJson(await response.text());\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn response[type]();\n\t\t\t};\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tpublic request: Request;\n\tprotected abortController?: AbortController;\n\tprotected _retryCount = 0;\n\tprotected _input: Input;\n\tprotected _options: InternalOptions;\n\n\t// eslint-disable-next-line complexity\n\tconstructor(input: Input, options: Options = {}) {\n\t\tthis._input = input;\n\n\t\tthis._options = {\n\t\t\t...options,\n\t\t\theaders: mergeHeaders((this._input as Request).headers, options.headers),\n\t\t\thooks: mergeHooks(\n\t\t\t\t{\n\t\t\t\t\tbeforeRequest: [],\n\t\t\t\t\tbeforeRetry: [],\n\t\t\t\t\tbeforeError: [],\n\t\t\t\t\tafterResponse: [],\n\t\t\t\t},\n\t\t\t\toptions.hooks,\n\t\t\t),\n\t\t\tmethod: normalizeRequestMethod(options.method ?? (this._input as Request).method ?? 'GET'),\n\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n\t\t\tprefixUrl: String(options.prefixUrl || ''),\n\t\t\tretry: normalizeRetryOptions(options.retry),\n\t\t\tthrowHttpErrors: options.throwHttpErrors !== false,\n\t\t\ttimeout: options.timeout ?? 10_000,\n\t\t\tfetch: options.fetch ?? globalThis.fetch.bind(globalThis),\n\t\t};\n\n\t\tif (typeof this._input !== 'string' && !(this._input instanceof URL || this._input instanceof globalThis.Request)) {\n\t\t\tthrow new TypeError('`input` must be a string, URL, or Request');\n\t\t}\n\n\t\tif (this._options.prefixUrl && typeof this._input === 'string') {\n\t\t\tif (this._input.startsWith('/')) {\n\t\t\t\tthrow new Error('`input` must not begin with a slash when using `prefixUrl`');\n\t\t\t}\n\n\t\t\tif (!this._options.prefixUrl.endsWith('/')) {\n\t\t\t\tthis._options.prefixUrl += '/';\n\t\t\t}\n\n\t\t\tthis._input = this._options.prefixUrl + this._input;\n\t\t}\n\n\t\tif (supportsAbortController) {\n\t\t\tthis.abortController = new globalThis.AbortController();\n\t\t\tconst originalSignal = this._options.signal ?? (this._input as Request).signal;\n\t\t\tif (originalSignal?.aborted) {\n\t\t\t\tthis.abortController.abort(originalSignal?.reason);\n\t\t\t}\n\n\t\t\toriginalSignal?.addEventListener('abort', () => {\n\t\t\t\tthis.abortController!.abort(originalSignal.reason);\n\t\t\t});\n\t\t\tthis._options.signal = this.abortController.signal;\n\t\t}\n\n\t\tif (supportsRequestStreams) {\n\t\t\t// @ts-expect-error - Types are outdated.\n\t\t\tthis._options.duplex = 'half';\n\t\t}\n\n\t\tif (this._options.json !== undefined) {\n\t\t\tthis._options.body = this._options.stringifyJson?.(this._options.json) ?? JSON.stringify(this._options.json);\n\t\t\tthis._options.headers.set('content-type', this._options.headers.get('content-type') ?? 'application/json');\n\t\t}\n\n\t\tthis.request = new globalThis.Request(this._input, this._options);\n\n\t\tif (this._options.searchParams) {\n\t\t\t// eslint-disable-next-line unicorn/prevent-abbreviations\n\t\t\tconst textSearchParams = typeof this._options.searchParams === 'string'\n\t\t\t\t? this._options.searchParams.replace(/^\\?/, '')\n\t\t\t\t: new URLSearchParams(this._options.searchParams as unknown as SearchParamsInit).toString();\n\t\t\t// eslint-disable-next-line unicorn/prevent-abbreviations\n\t\t\tconst searchParams = '?' + textSearchParams;\n\t\t\tconst url = this.request.url.replace(/(?:\\?.*?)?(?=#|$)/, searchParams);\n\n\t\t\t// To provide correct form boundary, Content-Type header should be deleted each time when new Request instantiated from another one\n\t\t\tif (\n\t\t\t\t((supportsFormData && this._options.body instanceof globalThis.FormData)\n\t\t\t\t\t|| this._options.body instanceof URLSearchParams) && !(this._options.headers && (this._options.headers as Record<string, string>)['content-type'])\n\t\t\t) {\n\t\t\t\tthis.request.headers.delete('content-type');\n\t\t\t}\n\n\t\t\t// The spread of `this.request` is required as otherwise it misses the `duplex` option for some reason and throws.\n\t\t\tthis.request = new globalThis.Request(new globalThis.Request(url, {...this.request}), this._options as RequestInit);\n\t\t}\n\t}\n\n\tprotected _calculateRetryDelay(error: unknown) {\n\t\tthis._retryCount++;\n\n\t\tif (this._retryCount > this._options.retry.limit || error instanceof TimeoutError) {\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (error instanceof HTTPError) {\n\t\t\tif (!this._options.retry.statusCodes.includes(error.response.status)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tconst retryAfter = error.response.headers.get('Retry-After')\n\t\t\t\t?? error.response.headers.get('RateLimit-Reset')\n\t\t\t\t?? error.response.headers.get('X-RateLimit-Reset') // GitHub\n\t\t\t\t?? error.response.headers.get('X-Rate-Limit-Reset'); // Twitter\n\t\t\tif (retryAfter && this._options.retry.afterStatusCodes.includes(error.response.status)) {\n\t\t\t\tlet after = Number(retryAfter) * 1000;\n\t\t\t\tif (Number.isNaN(after)) {\n\t\t\t\t\tafter = Date.parse(retryAfter) - Date.now();\n\t\t\t\t} else if (after >= Date.parse('2024-01-01')) {\n\t\t\t\t\t// A large number is treated as a timestamp (fixed threshold protects against clock skew)\n\t\t\t\t\tafter -= Date.now();\n\t\t\t\t}\n\n\t\t\t\tconst max = this._options.retry.maxRetryAfter ?? after;\n\t\t\t\treturn after < max ? after : max;\n\t\t\t}\n\n\t\t\tif (error.response.status === 413) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\n\t\tconst retryDelay = this._options.retry.delay(this._retryCount);\n\t\treturn Math.min(this._options.retry.backoffLimit, retryDelay);\n\t}\n\n\tprotected _decorateResponse(response: Response): Response {\n\t\tif (this._options.parseJson) {\n\t\t\tresponse.json = async () => this._options.parseJson!(await response.text());\n\t\t}\n\n\t\treturn response;\n\t}\n\n\tprotected async _retry<T extends (...arguments_: any) => Promise<any>>(function_: T): Promise<ReturnType<T> | void> {\n\t\ttry {\n\t\t\treturn await function_();\n\t\t} catch (error) {\n\t\t\tconst ms = Math.min(this._calculateRetryDelay(error), maxSafeTimeout);\n\t\t\tif (this._retryCount < 1) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tawait delay(ms, {signal: this._options.signal});\n\n\t\t\tfor (const hook of this._options.hooks.beforeRetry) {\n\t\t\t\t// eslint-disable-next-line no-await-in-loop\n\t\t\t\tconst hookResult = await hook({\n\t\t\t\t\trequest: this.request,\n\t\t\t\t\toptions: (this._options as unknown) as NormalizedOptions,\n\t\t\t\t\terror: error as Error,\n\t\t\t\t\tretryCount: this._retryCount,\n\t\t\t\t});\n\n\t\t\t\t// If `stop` is returned from the hook, the retry process is stopped\n\t\t\t\tif (hookResult === stop) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this._retry(function_);\n\t\t}\n\t}\n\n\tprotected async _fetch(): Promise<Response> {\n\t\tfor (const hook of this._options.hooks.beforeRequest) {\n\t\t\t// eslint-disable-next-line no-await-in-loop\n\t\t\tconst result = await hook(this.request, (this._options as unknown) as NormalizedOptions);\n\n\t\t\tif (result instanceof Request) {\n\t\t\t\tthis.request = result;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (result instanceof Response) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\n\t\tconst nonRequestOptions = findUnknownOptions(this.request, this._options);\n\n\t\t// Cloning is done here to prepare in advance for retries\n\t\tconst mainRequest = this.request;\n\t\tthis.request = mainRequest.clone();\n\n\t\tif (this._options.timeout === false) {\n\t\t\treturn this._options.fetch(mainRequest, nonRequestOptions);\n\t\t}\n\n\t\treturn timeout(mainRequest, nonRequestOptions, this.abortController, this._options as TimeoutOptions);\n\t}\n\n\t/* istanbul ignore next */\n\tprotected _stream(response: Response, onDownloadProgress: Options['onDownloadProgress']) {\n\t\tconst totalBytes = Number(response.headers.get('content-length')) || 0;\n\t\tlet transferredBytes = 0;\n\n\t\tif (response.status === 204) {\n\t\t\tif (onDownloadProgress) {\n\t\t\t\tonDownloadProgress({percent: 1, totalBytes, transferredBytes}, new Uint8Array());\n\t\t\t}\n\n\t\t\treturn new globalThis.Response(\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\tstatus: response.status,\n\t\t\t\t\tstatusText: response.statusText,\n\t\t\t\t\theaders: response.headers,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\treturn new globalThis.Response(\n\t\t\tnew globalThis.ReadableStream({\n\t\t\t\tasync start(controller) {\n\t\t\t\t\tconst reader = response.body!.getReader();\n\n\t\t\t\t\tif (onDownloadProgress) {\n\t\t\t\t\t\tonDownloadProgress({percent: 0, transferredBytes: 0, totalBytes}, new Uint8Array());\n\t\t\t\t\t}\n\n\t\t\t\t\tasync function read() {\n\t\t\t\t\t\tconst {done, value} = await reader.read();\n\t\t\t\t\t\tif (done) {\n\t\t\t\t\t\t\tcontroller.close();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (onDownloadProgress) {\n\t\t\t\t\t\t\ttransferredBytes += value.byteLength;\n\t\t\t\t\t\t\tconst percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;\n\t\t\t\t\t\t\tonDownloadProgress({percent, transferredBytes, totalBytes}, value);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcontroller.enqueue(value);\n\t\t\t\t\t\tawait read();\n\t\t\t\t\t}\n\n\t\t\t\t\tawait read();\n\t\t\t\t},\n\t\t\t}),\n\t\t\t{\n\t\t\t\tstatus: response.status,\n\t\t\t\tstatusText: response.statusText,\n\t\t\t\theaders: response.headers,\n\t\t\t},\n\t\t);\n\t}\n}\n","/*! MIT License © Sindre Sorhus */\n\nimport {Ky} from './core/Ky.js';\nimport {requestMethods, stop} from './core/constants.js';\nimport type {KyInstance} from './types/ky.js';\nimport type {Input, Options} from './types/options.js';\nimport {validateAndMerge} from './utils/merge.js';\nimport {type Mutable} from './utils/types.js';\n\nconst createInstance = (defaults?: Partial<Options>): KyInstance => {\n\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\tconst ky: Partial<Mutable<KyInstance>> = (input: Input, options?: Options) => Ky.create(input, validateAndMerge(defaults, options));\n\n\tfor (const method of requestMethods) {\n\t\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\t\tky[method] = (input: Input, options?: Options) => Ky.create(input, validateAndMerge(defaults, options, {method}));\n\t}\n\n\tky.create = (newDefaults?: Partial<Options>) => createInstance(validateAndMerge(newDefaults));\n\tky.extend = (newDefaults?: Partial<Options> | ((parentDefaults: Partial<Options>) => Partial<Options>)) => {\n\t\tif (typeof newDefaults === 'function') {\n\t\t\tnewDefaults = newDefaults(defaults ?? {});\n\t\t}\n\n\t\treturn createInstance(validateAndMerge(defaults, newDefaults));\n\t};\n\n\tky.stop = stop;\n\n\treturn ky as KyInstance;\n};\n\nconst ky = createInstance();\n\nexport default ky;\n\nexport type {KyInstance} from './types/ky.js';\n\nexport type {\n\tInput,\n\tOptions,\n\tNormalizedOptions,\n\tRetryOptions,\n\tSearchParamsOption,\n\tDownloadProgress,\n} from './types/options.js';\n\nexport type {\n\tHooks,\n\tBeforeRequestHook,\n\tBeforeRetryHook,\n\tBeforeRetryState,\n\tBeforeErrorHook,\n\tAfterResponseHook,\n} from './types/hooks.js';\n\nexport type {ResponsePromise} from './types/ResponsePromise.js';\nexport type {KyRequest} from './types/request.js';\nexport type {KyResponse} from './types/response.js';\nexport {HTTPError} from './errors/HTTPError.js';\nexport {TimeoutError} from './errors/TimeoutError.js';\n","{\n \"name\": \"bannerify-js\",\n \"version\": \"0.0.28\",\n \"description\": \"\",\n \"keywords\": [],\n \"license\": \"ISC\",\n \"author\": \"Duc An <an@bannerify.co>\",\n \"files\": [\n \"dist\"\n ],\n \"type\": \"module\",\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"scripts\": {\n \"test\": \"bun test\",\n \"play\": \"tsx playground/test.ts\",\n \"openapi\": \"openapi-typescript https://api.bannerify.co/openapi -o ./src/openapi.d.ts\",\n \"openapi-local\": \"openapi-typescript http://127.0.0.1:5173/api/openapi -o ./src/openapi.d.ts\",\n \"build:watch\": \"tsup --watch\",\n \"build\": \"tsup\",\n \"up\": \"bun run build && npm version patch --no-git-tag-version && npm publish\"\n },\n \"devDependencies\": {\n \"@faker-js/faker\": \"^8.4.1\",\n \"@types/node\": \"18.15.3\",\n \"bun-types\": \"^1.0.20\",\n \"ky\": \"^1.1.3\",\n \"openapi-typescript\": \"^6.7.3\",\n \"p-map\": \"^7.0.2\",\n \"tsup\": \"^8.0.1\",\n \"tsx\": \"^4.7.0\",\n \"typescript\": \"5.2.2\"\n }\n}\n","import { version } from \"../package.json\"\n\nexport type Telemetry = {\n sdkVersions: string[]\n platform?: string\n runtime?: string\n}\n\nexport function getTelemetry(): Telemetry | null {\n let platform: string | undefined\n let runtime: string | undefined\n const sdkVersions = [`bannerify-js@${version}`]\n\n try {\n if (process?.env?.UNKEY_DISABLE_TELEMETRY) {\n return null\n }\n platform = process.env.VERCEL ? \"vercel\" : process.env.AWS_REGION ? \"aws\" : undefined\n\n // @ts-ignore\n if (typeof EdgeRuntime !== \"undefined\") {\n runtime = \"edge-light\"\n } else if (typeof caches !== \"undefined\") {\n runtime = \"cloudflare\"\n } else if (process?.version) {\n runtime = `node@${process.version}`\n } else {\n runtime = \"fetch-compatible\"\n }\n } catch (_error) {}\n\n return { platform, runtime, sdkVersions }\n}\n","const SUPPORTED_FORMATS = [\"png\", \"jpeg\", \"webp\"] as const\n\nexport type ImageFormat = (typeof SUPPORTED_FORMATS)[number]\n\nexport type FormatValidationError = {\n message: string\n}\n\nexport type FormatValidationResult =\n | { ok: true; format: ImageFormat }\n | { ok: false; error: FormatValidationError }\n\nconst isSupportedFormat = (value: string): value is ImageFormat =>\n (SUPPORTED_FORMATS as readonly string[]).includes(value)\n\nexport const validateImageFormat = (value?: string): FormatValidationResult => {\n if (!value) {\n return { ok: true, format: \"png\" }\n }\n\n if (isSupportedFormat(value)) {\n return { ok: true, format: value }\n }\n\n return {\n ok: false,\n error: {\n message: `Unsupported format \"${value}\". Valid formats are png, jpeg, or webp.`,\n },\n }\n}\n","import type { paths } from \"./openapi\"\n\ntype codes = \"400\" | \"401\" | \"403\" | \"404\" | \"500\"\n\nexport type ErrorResponse =\n paths[\"/v1/templates/createImage\"][\"post\"][\"responses\"][codes][\"content\"][\"application/json\"]\n\nexport const timeoutError = {\n error: {\n // @ts-ignore\n code: \"TIMEOUT_ERROR\",\n message: \"No response\",\n docs: \"\",\n requestId: \"N/A\",\n },\n}\n\nexport type Result<R> =\n | {\n result: R\n error?: never\n }\n | {\n result?: never\n error: ErrorResponse[\"error\"] | (typeof timeoutError)[\"error\"]\n }\n","import ky, { HTTPError, TimeoutError } from \"ky\"\nimport { getTelemetry } from \"./telemetry\"\nimport type { Modification, S3Config } from \"./interface\"\nimport { validateImageFormat, type ImageFormat } from \"./format\"\nimport { type ErrorResponse, type Result, timeoutError } from \"./types\"\n\nconst invalidFormatResult = <T>(value?: string): Result<T> => ({\n error: {\n // @ts-ignore – local validation error\n code: \"INVALID_FORMAT\",\n docs: \"https://bannerify.co/docs\",\n message: `Unsupported format \"${value ?? \"undefined\"}\". Valid formats are png, jpeg, or webp.`,\n requestId: \"local\",\n },\n})\n\ninterface Options {\n fetch?: typeof fetch\n baseUrl?: string\n // default 10s\n timeout?: number\n}\n\ntype CreateOptions = {\n modifications?: Modification[]\n // template?: Modification\n // @default: png\n thumbnail?: boolean\n nocache?: boolean\n format?: ImageFormat\n // Encoder quality for the lossy formats (jpeg, webp). 1-100, defaults to 90.\n quality?: number\n}\n\ntype CreateStoredImageOptions = CreateOptions & {\n s3Config?: S3Config\n}\n\nexport function createClient(apiKey: string, opts?: Options) {\n return new Bannerify(apiKey, opts)\n}\n\nexport class Bannerify {\n private readonly client: typeof ky\n\n private readonly baseUrl: string\n\n constructor(\n private readonly apiKey: string,\n private readonly opts?: Options,\n ) {\n const telemetry = getTelemetry()\n this.baseUrl = opts?.baseUrl || \"https://api.bannerify.co/v1\"\n this.client = ky.create({\n fetch: opts?.fetch || globalThis.fetch.bind(globalThis),\n prefixUrl: this.baseUrl,\n headers: {\n Authorization: `Bearer ${apiKey}`,\n \"X-SDK-Version\": `${telemetry?.sdkVersions}`,\n \"X-Platform\": telemetry?.platform,\n \"X-Runtime\": telemetry?.runtime,\n },\n timeout: opts?.timeout ?? 60e3,\n })\n }\n\n async createImage(templateId: string, options?: CreateOptions): Promise<Result<ArrayBuffer>> {\n try {\n const normalizedFormat = validateImageFormat(options?.format)\n if (!normalizedFormat.ok) {\n return invalidFormatResult(options?.format)\n }\n const res = await this.client.post(\"templates/createImage\", {\n json: {\n modifications: options?.modifications ?? [],\n // template: JSON.stringify(options?.template ?? {}),\n templateId,\n apiKey: this.apiKey,\n format: normalizedFormat.format,\n thumbnail: options?.thumbnail ?? false,\n },\n })\n return { result: await res.arrayBuffer() }\n } catch (e: any) {\n if (e instanceof HTTPError) {\n const json = await e.response.json()\n return { error: json.error }\n }\n if (e instanceof TimeoutError) {\n return { error: timeoutError.error }\n }\n throw e\n }\n }\n\n async createPdf(templateId: string, options?: CreateOptions): Promise<Result<ArrayBuffer>> {\n try {\n const res = await this.client.post(\"templates/createPdf\", {\n json: {\n modifications: options?.modifications ?? [],\n // template: JSON.stringify(options?.template ?? {}),\n templateId,\n apiKey: this.apiKey,\n },\n })\n return { result: await res.arrayBuffer() }\n // biome-ignore lint/suspicious/noExplicitAny: <explanation>\n } catch (e: any) {\n if (e instanceof HTTPError) {\n const json = await e.response.json()\n return { error: json.error }\n }\n if (e instanceof TimeoutError) {\n return { error: timeoutError.error }\n }\n throw e\n }\n }\n\n async createStoredImage(\n templateId: string,\n options?: CreateStoredImageOptions,\n ): Promise<Result<string>> {\n try {\n const normalizedFormat = validateImageFormat(options?.format)\n if (!normalizedFormat.ok) {\n return invalidFormatResult(options?.format)\n }\n const res = await this.client.post(\"templates/createStoredImage\", {\n json: {\n modifications: options?.modifications ?? [],\n // template: JSON.stringify(options?.template ?? {}),\n templateId,\n apiKey: this.apiKey,\n format: normalizedFormat.format,\n thumbnail: options?.thumbnail ?? false,\n s3Config: options?.s3Config,\n },\n })\n const json = (await res.json()) as { url: string }\n return { result: json.url }\n // biome-ignore lint/suspicious/noExplicitAny: <explanation>\n } catch (e: any) {\n if (e instanceof HTTPError) {\n const json = await e.response.json()\n return { error: json.error }\n }\n if (e instanceof TimeoutError) {\n return { error: timeoutError.error }\n }\n throw e\n }\n }\n\n #hashText = async (text: string) => {\n const myText = new TextEncoder().encode(text)\n const myDigest = await crypto.subtle.digest({ name: \"SHA-256\" }, myText)\n const hashArray = Array.from(new Uint8Array(myDigest))\n const hashHex = hashArray.map((b) => b.toString(16).padStart(2, \"0\")).join(\"\")\n return hashHex\n }\n\n // The signature is an HMAC keyed with the API key itself, so a signed URL can\n // be shared without exposing anything that can sign a different one. The\n // apiKeyHashed in the URL only tells the server which key to verify with.\n #signText = async (text: string) => {\n const key = await crypto.subtle.importKey(\n \"raw\",\n new TextEncoder().encode(this.apiKey),\n { name: \"HMAC\", hash: \"SHA-256\" },\n false,\n [\"sign\"],\n )\n const signature = await crypto.subtle.sign(\"HMAC\", key, new TextEncoder().encode(text))\n return Array.from(new Uint8Array(signature))\n .map((b) => b.toString(16).padStart(2, \"0\"))\n .join(\"\")\n }\n\n async generateImageSignedUrl(templateId: string, options?: CreateOptions) {\n const apiKeyHashed = await this.#hashText(this.apiKey)\n const searchParams = new URLSearchParams()\n searchParams.set(\"apiKeyHashed\", apiKeyHashed)\n if (options?.format) {\n const normalizedFormat = validateImageFormat(options.format)\n if (!normalizedFormat.ok) {\n throw new Error(normalizedFormat.error.message)\n }\n searchParams.set(\"format\", normalizedFormat.format)\n }\n if (options?.quality !== undefined) {\n searchParams.set(\"quality\", String(options.quality))\n }\n if (options?.modifications) {\n searchParams.set(\"modifications\", JSON.stringify(options?.modifications))\n }\n if (options?.nocache) {\n searchParams.set(\"nocache\", \"true\")\n }\n if (options?.thumbnail) {\n searchParams.set(\"thumbnail\", \"true\")\n }\n searchParams.set(\"templateId\", templateId)\n searchParams.sort()\n searchParams.set(\"sign\", await this.#signText(searchParams.toString()))\n return `${this.baseUrl}/templates/signedurl?${searchParams.toString()}`\n }\n}\n"],"mappings":";AAIM,IAAO,YAAP,cAAsC,MAAK;EACzC;EACA;EACA;EAEP,YAAY,UAAoB,SAAkB,SAA0B;AAC3E,UAAM,OAAQ,SAAS,UAAU,SAAS,WAAW,IAAK,SAAS,SAAS;AAC5E,UAAM,QAAQ,SAAS,cAAc;AACrC,UAAM,SAAS,GAAG,IAAI,IAAI,KAAK,GAAG,KAAI;AACtC,UAAM,SAAS,SAAS,eAAe,MAAM,KAAK;AAElD,UAAM,uBAAuB,MAAM,KAAK,QAAQ,MAAM,IAAI,QAAQ,GAAG,EAAE;AAEvE,SAAK,OAAO;AACZ,SAAK,WAAW;AAChB,SAAK,UAAU;AACf,SAAK,UAAU;EAChB;;;;ACnBK,IAAO,eAAP,cAA4B,MAAK;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cAAM,IAAI,MAAM,iBAAiB,MAAM,OAAO;AAAA,MAChD;AACA,mBAAa,IAAI,UAAU,iBAAiB,MAAM;AAAA,IACpD;AACA,QAAI,SAAS,YAAY,QAAW;AAClC,mBAAa,IAAI,WAAW,OAAO,QAAQ,OAAO,CAAC;AAAA,IACrD;AACA,QAAI,SAAS,eAAe;AAC1B,mBAAa,IAAI,iBAAiB,KAAK,UAAU,SAAS,aAAa,CAAC;AAAA,IAC1E;AACA,QAAI,SAAS,SAAS;AACpB,mBAAa,IAAI,WAAW,MAAM;AAAA,IACpC;AACA,QAAI,SAAS,WAAW;AACtB,mBAAa,IAAI,aAAa,MAAM;AAAA,IACtC;AACA,iBAAa,IAAI,cAAc,UAAU;AACzC,iBAAa,KAAK;AAClB,iBAAa,IAAI,QAAQ,MAAM,KAAK,UAAU,aAAa,SAAS,CAAC,CAAC;AACtE,WAAO,GAAG,KAAK,OAAO,wBAAwB,aAAa,SAAS,CAAC;AAAA,EACvE;AACF;","names":["ky","ky"]}
|
package/package.json
CHANGED
|
@@ -1,36 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bannerify-js",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./dist/index.cjs",
|
|
7
|
-
"module": "./dist/index.js",
|
|
8
|
-
"types": "./dist/index.d.ts",
|
|
9
5
|
"keywords": [],
|
|
6
|
+
"license": "ISC",
|
|
7
|
+
"author": "Duc An <an@bannerify.co>",
|
|
10
8
|
"files": [
|
|
11
9
|
"dist"
|
|
12
10
|
],
|
|
13
|
-
"
|
|
14
|
-
"
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "./dist/index.cjs",
|
|
13
|
+
"module": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"scripts": {
|
|
16
|
+
"test": "bun test",
|
|
17
|
+
"play": "tsx playground/test.ts",
|
|
18
|
+
"openapi": "openapi-typescript https://api.bannerify.co/openapi -o ./src/openapi.d.ts",
|
|
19
|
+
"openapi-local": "openapi-typescript http://127.0.0.1:5173/api/openapi -o ./src/openapi.d.ts",
|
|
20
|
+
"build:watch": "tsup --watch",
|
|
21
|
+
"build": "tsup",
|
|
22
|
+
"up": "bun run build && npm version patch --no-git-tag-version && npm publish"
|
|
23
|
+
},
|
|
15
24
|
"devDependencies": {
|
|
16
25
|
"@faker-js/faker": "^8.4.1",
|
|
17
26
|
"@types/node": "18.15.3",
|
|
18
27
|
"bun-types": "^1.0.20",
|
|
19
|
-
"chart.js": "^4.4.1",
|
|
20
28
|
"ky": "^1.1.3",
|
|
21
29
|
"openapi-typescript": "^6.7.3",
|
|
22
30
|
"p-map": "^7.0.2",
|
|
23
31
|
"tsup": "^8.0.1",
|
|
24
32
|
"tsx": "^4.7.0",
|
|
25
33
|
"typescript": "5.2.2"
|
|
26
|
-
},
|
|
27
|
-
"scripts": {
|
|
28
|
-
"test": "bun test",
|
|
29
|
-
"play": "tsx playground/test.ts",
|
|
30
|
-
"openapi": "openapi-typescript https://api.bannerify.co/openapi -o ./src/openapi.d.ts",
|
|
31
|
-
"openapi-local": "openapi-typescript http://127.0.0.1:5173/api/openapi -o ./src/openapi.d.ts",
|
|
32
|
-
"build:watch": "tsup --watch",
|
|
33
|
-
"build": "tsup",
|
|
34
|
-
"up": "bun run build && npm version patch --no-git-tag-version && npm publish"
|
|
35
34
|
}
|
|
36
|
-
}
|
|
35
|
+
}
|