{"version":3,"sources":["../src/http.ts"],"sourcesContent":["import type { Nullish } from './utils/null'\n\nexport interface HeadersInitEsque {\n  [Symbol.iterator](): IterableIterator<[string, string]>\n}\n\nexport type HTTPHeaders = HeadersInitEsque | Record<string, string[] | string | undefined>\n\nexport type AbortControllerEsque = new () => AbortControllerInstanceEsque\n\n/**\n * Allows you to abort one or more requests.\n */\nexport interface AbortControllerInstanceEsque {\n  /**\n   * The AbortSignal object associated with this object.\n   */\n  readonly signal: AbortSignal\n\n  /**\n   * Sets this object's AbortSignal's aborted flag and signals to\n   * any observers that the associated activity is to be aborted.\n   */\n  abort(): void\n}\n\nexport type HTTPLinkBaseOptions = {\n  /**\n   * Define AbortController implementation.\n   */\n  AbortController?: AbortControllerEsque | null\n\n  /**\n   * Send all requests `as POST`s requests regardless of the procedure type.\n   * The HTTP handler must separately allow overriding the method.\n   *\n   * @see https://trpc.io/docs/rpc\n   */\n  methodOverride?: 'POST'\n}\n\nexport function getAbortController(\n  abortControllerPolyfill?: AbortControllerEsque | Nullish,\n): AbortControllerEsque | null {\n  if (abortControllerPolyfill) {\n    return abortControllerPolyfill\n  }\n\n  if (typeof window !== 'undefined' && window.AbortController) {\n    return window.AbortController\n  }\n\n  if (typeof globalThis !== 'undefined' && globalThis.AbortController) {\n    return globalThis.AbortController\n  }\n\n  return null\n}\n\nexport const httpQueryMethods = ['get', 'options', 'head'] as const\n\nexport const httpMutationMethods = ['post', 'put', 'patch', 'delete'] as const\n\nexport const httpSubscriptionMethods = ['connect', 'subscribe'] as const\n\nexport const httpMethods = [\n  ...httpQueryMethods,\n  ...httpMutationMethods,\n  ...httpSubscriptionMethods,\n] as const\n\n/**\n * Recognized HTTP methods for queries.\n */\nexport type HttpQueryMethod = (typeof httpQueryMethods)[number]\n\n/**\n * Recognized HTTP methods for mutations.\n */\nexport type HttpMutationMethod = (typeof httpMutationMethods)[number]\n\n/**\n * Recognized HTTP methods for subscriptions.\n */\nexport type HttpSubscriptionMethod = (typeof httpSubscriptionMethods)[number]\n\n/**\n * All recognized HTTP methods.\n */\nexport type HttMethod = (typeof httpMethods)[number]\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyCO,SAAS,mBACd,yBAC6B;AAC7B,MAAI,yBAAyB;AAC3B,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,WAAW,eAAe,OAAO,iBAAiB;AAC3D,WAAO,OAAO;AAAA,EAChB;AAEA,MAAI,OAAO,eAAe,eAAe,WAAW,iBAAiB;AACnE,WAAO,WAAW;AAAA,EACpB;AAEA,SAAO;AACT;AAEO,IAAM,mBAAmB,CAAC,OAAO,WAAW,MAAM;AAElD,IAAM,sBAAsB,CAAC,QAAQ,OAAO,SAAS,QAAQ;AAE7D,IAAM,0BAA0B,CAAC,WAAW,WAAW;AAEvD,IAAM,cAAc;AAAA,EACzB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;","names":[]}