initial commit

This commit is contained in:
Zoe
2023-01-03 09:29:04 -06:00
commit 7851137d88
12889 changed files with 2557443 additions and 0 deletions

72
node_modules/ohmyfetch/dist/error-65d5de49.d.ts generated vendored Normal file
View File

@@ -0,0 +1,72 @@
declare type Fetch = typeof globalThis.fetch;
declare type RequestInfo = globalThis.RequestInfo;
declare type RequestInit = globalThis.RequestInit;
declare type Response = globalThis.Response;
interface ResponseMap {
blob: Blob;
text: string;
arrayBuffer: ArrayBuffer;
stream: ReadableStream<Uint8Array>;
}
declare type ResponseType = keyof ResponseMap | 'json';
declare type MappedType<R extends ResponseType, JsonType = any> = R extends keyof ResponseMap ? ResponseMap[R] : JsonType;
interface CreateFetchOptions {
defaults?: FetchOptions;
fetch: Fetch;
Headers: typeof Headers;
}
declare type FetchRequest = RequestInfo;
interface FetchResponse<T> extends Response {
_data?: T;
}
interface SearchParams {
[key: string]: any;
}
interface FetchContext<T = any, R extends ResponseType = ResponseType> {
request: FetchRequest;
options: FetchOptions<R>;
response?: FetchResponse<T>;
error?: Error;
}
interface FetchOptions<R extends ResponseType = ResponseType> extends Omit<RequestInit, 'body'> {
baseURL?: string;
body?: RequestInit['body'] | Record<string, any>;
params?: SearchParams;
query?: SearchParams;
parseResponse?: (responseText: string) => any;
responseType?: R;
response?: boolean;
retry?: number | false;
onRequest?(ctx: FetchContext): Promise<void> | void;
onRequestError?(ctx: FetchContext & {
error: Error;
}): Promise<void> | void;
onResponse?(ctx: FetchContext & {
response: FetchResponse<R>;
}): Promise<void> | void;
onResponseError?(ctx: FetchContext & {
response: FetchResponse<R>;
}): Promise<void> | void;
}
interface $Fetch {
<T = any, R extends ResponseType = 'json'>(request: FetchRequest, opts?: FetchOptions<R>): Promise<MappedType<R, T>>;
raw<T = any, R extends ResponseType = 'json'>(request: FetchRequest, opts?: FetchOptions<R>): Promise<FetchResponse<MappedType<R, T>>>;
create(defaults: FetchOptions): $Fetch;
}
declare function createFetch(globalOptions: CreateFetchOptions): $Fetch;
declare class FetchError<T = any> extends Error {
name: 'FetchError';
request?: FetchRequest;
response?: FetchResponse<T>;
data?: T;
status?: number;
statusText?: string;
statusCode?: number;
statusMessage?: string;
}
declare function createFetchError<T = any>(request: FetchRequest, error?: Error, response?: FetchResponse<T>): FetchError<T>;
export { $Fetch as $, CreateFetchOptions as C, FetchRequest as F, SearchParams as S, FetchResponse as a, FetchContext as b, FetchOptions as c, createFetch as d, FetchError as e, createFetchError as f };

11
node_modules/ohmyfetch/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
import { $ as $Fetch } from './error-65d5de49.js';
export { $ as $Fetch, C as CreateFetchOptions, b as FetchContext, e as FetchError, c as FetchOptions, F as FetchRequest, a as FetchResponse, S as SearchParams, d as createFetch, f as createFetchError } from './error-65d5de49.js';
declare const fetch: typeof globalThis.fetch;
declare const Headers: {
new (init?: HeadersInit | undefined): Headers;
prototype: Headers;
};
declare const $fetch: $Fetch;
export { $fetch, Headers, fetch };

25
node_modules/ohmyfetch/dist/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,25 @@
import { c as createFetch } from './shared/ohmyfetch.d1948a88.mjs';
export { F as FetchError, c as createFetch, a as createFetchError } from './shared/ohmyfetch.d1948a88.mjs';
import 'destr';
import 'ufo';
const _globalThis = function() {
if (typeof globalThis !== "undefined") {
return globalThis;
}
if (typeof self !== "undefined") {
return self;
}
if (typeof window !== "undefined") {
return window;
}
if (typeof global !== "undefined") {
return global;
}
throw new Error("unable to locate global object");
}();
const fetch = _globalThis.fetch || (() => Promise.reject(new Error("[ohmyfetch] global.fetch is not supported!")));
const Headers = _globalThis.Headers;
const $fetch = createFetch({ fetch, Headers });
export { $fetch, Headers, fetch };

12
node_modules/ohmyfetch/dist/node.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
import { $ as $Fetch } from './error-65d5de49.js';
export { $ as $Fetch, C as CreateFetchOptions, b as FetchContext, e as FetchError, c as FetchOptions, F as FetchRequest, a as FetchResponse, S as SearchParams, d as createFetch, f as createFetchError } from './error-65d5de49.js';
declare function createNodeFetch(): (input: RequestInfo, init?: RequestInit) => any;
declare const fetch: typeof globalThis.fetch;
declare const Headers: {
new (init?: HeadersInit | undefined): Headers;
prototype: Headers;
};
declare const $fetch: $Fetch;
export { $fetch, Headers, createNodeFetch, fetch };

30
node_modules/ohmyfetch/dist/node.mjs generated vendored Normal file
View File

@@ -0,0 +1,30 @@
import http from 'http';
import https from 'https';
import nodeFetch, { Headers as Headers$1 } from 'node-fetch-native';
import { c as createFetch } from './shared/ohmyfetch.d1948a88.mjs';
export { F as FetchError, c as createFetch, a as createFetchError } from './shared/ohmyfetch.d1948a88.mjs';
import 'destr';
import 'ufo';
function createNodeFetch() {
const useKeepAlive = JSON.parse(process.env.FETCH_KEEP_ALIVE || "false");
if (!useKeepAlive) {
return nodeFetch;
}
const agentOpts = { keepAlive: true };
const httpAgent = new http.Agent(agentOpts);
const httpsAgent = new https.Agent(agentOpts);
const nodeFetchOptions = {
agent(parsedURL) {
return parsedURL.protocol === "http:" ? httpAgent : httpsAgent;
}
};
return function nodeFetchWithKeepAlive(input, init) {
return nodeFetch(input, { ...nodeFetchOptions, ...init });
};
}
const fetch = globalThis.fetch || createNodeFetch();
const Headers = globalThis.Headers || Headers$1;
const $fetch = createFetch({ fetch, Headers });
export { $fetch, Headers, createNodeFetch, fetch };

View File

@@ -0,0 +1,186 @@
import destr from 'destr';
import { withBase, withQuery } from 'ufo';
class FetchError extends Error {
constructor() {
super(...arguments);
this.name = "FetchError";
}
}
function createFetchError(request, error, response) {
let message = "";
if (request && response) {
message = `${response.status} ${response.statusText} (${request.toString()})`;
}
if (error) {
message = `${error.message} (${message})`;
}
const fetchError = new FetchError(message);
Object.defineProperty(fetchError, "request", { get() {
return request;
} });
Object.defineProperty(fetchError, "response", { get() {
return response;
} });
Object.defineProperty(fetchError, "data", { get() {
return response && response._data;
} });
Object.defineProperty(fetchError, "status", { get() {
return response && response.status;
} });
Object.defineProperty(fetchError, "statusText", { get() {
return response && response.statusText;
} });
Object.defineProperty(fetchError, "statusCode", { get() {
return response && response.status;
} });
Object.defineProperty(fetchError, "statusMessage", { get() {
return response && response.statusText;
} });
return fetchError;
}
const payloadMethods = new Set(Object.freeze(["PATCH", "POST", "PUT", "DELETE"]));
function isPayloadMethod(method = "GET") {
return payloadMethods.has(method.toUpperCase());
}
function isJSONSerializable(val) {
if (val === void 0) {
return false;
}
const t = typeof val;
if (t === "string" || t === "number" || t === "boolean" || t === null) {
return true;
}
if (t !== "object") {
return false;
}
if (Array.isArray(val)) {
return true;
}
return val.constructor && val.constructor.name === "Object" || typeof val.toJSON === "function";
}
const textTypes = /* @__PURE__ */ new Set([
"image/svg",
"application/xml",
"application/xhtml",
"application/html"
]);
const JSON_RE = /^application\/(?:[\w!#$%&*`\-.^~]*\+)?json(;.+)?$/i;
function detectResponseType(_contentType = "") {
if (!_contentType) {
return "json";
}
const contentType = _contentType.split(";").shift();
if (JSON_RE.test(contentType)) {
return "json";
}
if (textTypes.has(contentType) || contentType.startsWith("text/")) {
return "text";
}
return "blob";
}
const retryStatusCodes = /* @__PURE__ */ new Set([
408,
409,
425,
429,
500,
502,
503,
504
]);
function createFetch(globalOptions) {
const { fetch, Headers } = globalOptions;
function onError(ctx) {
const isAbort = ctx.error && ctx.error.name === "AbortError" || false;
if (ctx.options.retry !== false && !isAbort) {
const retries = typeof ctx.options.retry === "number" ? ctx.options.retry : isPayloadMethod(ctx.options.method) ? 0 : 1;
const responseCode = ctx.response && ctx.response.status || 500;
if (retries > 0 && retryStatusCodes.has(responseCode)) {
return $fetchRaw(ctx.request, {
...ctx.options,
retry: retries - 1
});
}
}
const err = createFetchError(ctx.request, ctx.error, ctx.response);
if (Error.captureStackTrace) {
Error.captureStackTrace(err, $fetchRaw);
}
throw err;
}
const $fetchRaw = async function $fetchRaw2(_request, _opts = {}) {
const ctx = {
request: _request,
options: { ...globalOptions.defaults, ..._opts },
response: void 0,
error: void 0
};
if (ctx.options.onRequest) {
await ctx.options.onRequest(ctx);
}
if (typeof ctx.request === "string") {
if (ctx.options.baseURL) {
ctx.request = withBase(ctx.request, ctx.options.baseURL);
}
if (ctx.options.query || ctx.options.params) {
ctx.request = withQuery(ctx.request, { ...ctx.options.params, ...ctx.options.query });
}
if (ctx.options.body && isPayloadMethod(ctx.options.method)) {
if (isJSONSerializable(ctx.options.body)) {
ctx.options.body = typeof ctx.options.body === "string" ? ctx.options.body : JSON.stringify(ctx.options.body);
ctx.options.headers = new Headers(ctx.options.headers);
if (!ctx.options.headers.has("content-type")) {
ctx.options.headers.set("content-type", "application/json");
}
if (!ctx.options.headers.has("accept")) {
ctx.options.headers.set("accept", "application/json");
}
}
}
}
ctx.response = await fetch(ctx.request, ctx.options).catch(async (error) => {
ctx.error = error;
if (ctx.options.onRequestError) {
await ctx.options.onRequestError(ctx);
}
return onError(ctx);
});
const responseType = (ctx.options.parseResponse ? "json" : ctx.options.responseType) || detectResponseType(ctx.response.headers.get("content-type") || "");
if (responseType === "json") {
const data = await ctx.response.text();
const parseFn = ctx.options.parseResponse || destr;
ctx.response._data = parseFn(data);
} else if (responseType === "stream") {
ctx.response._data = ctx.response.body;
} else {
ctx.response._data = await ctx.response[responseType]();
}
if (ctx.options.onResponse) {
await ctx.options.onResponse(ctx);
}
if (ctx.response.status >= 400 && ctx.response.status < 600) {
if (ctx.options.onResponseError) {
await ctx.options.onResponseError(ctx);
}
return onError(ctx);
}
return ctx.response;
};
const $fetch = function $fetch2(request, opts) {
return $fetchRaw(request, opts).then((r) => r._data);
};
$fetch.raw = $fetchRaw;
$fetch.create = (defaultOptions = {}) => createFetch({
...globalOptions,
defaults: {
...globalOptions.defaults,
...defaultOptions
}
});
return $fetch;
}
export { FetchError as F, createFetchError as a, createFetch as c };

9
node_modules/ohmyfetch/dist/undici.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
import { $ as $Fetch } from './error-65d5de49.js';
export { $ as $Fetch, C as CreateFetchOptions, b as FetchContext, e as FetchError, c as FetchOptions, F as FetchRequest, a as FetchResponse, S as SearchParams, d as createFetch, f as createFetchError } from './error-65d5de49.js';
export { Headers } from './node.js';
declare const fetch: typeof globalThis.fetch;
declare const $fetch: $Fetch;
export { $fetch, fetch };

15
node_modules/ohmyfetch/dist/undici.mjs generated vendored Normal file
View File

@@ -0,0 +1,15 @@
import { fetch as fetch$1 } from 'undici';
import { createNodeFetch, Headers } from './node.mjs';
export { Headers } from './node.mjs';
import { c as createFetch } from './shared/ohmyfetch.d1948a88.mjs';
export { F as FetchError, c as createFetch, a as createFetchError } from './shared/ohmyfetch.d1948a88.mjs';
import 'http';
import 'https';
import 'node-fetch-native';
import 'destr';
import 'ufo';
const fetch = globalThis.fetch || fetch$1 || createNodeFetch();
const $fetch = createFetch({ fetch, Headers });
export { $fetch, fetch };