cloudflare/cloudflare-typescript
Publicmirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable
src/_shims/index.d.ts
81lines · modecode
| 1 | /** |
| 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. |
| 3 | */ |
| 4 | import { manual } from './manual-types'; |
| 5 | import * as auto from 'cloudflare/_shims/auto/types'; |
| 6 | import { type RequestOptions } from '../core'; |
| 7 | |
| 8 | type SelectType<Manual, Auto> = unknown extends Manual ? Auto : Manual; |
| 9 | |
| 10 | export const kind: string; |
| 11 | |
| 12 | // @ts-ignore |
| 13 | export type Agent = SelectType<manual.Agent, auto.Agent>; |
| 14 | |
| 15 | // @ts-ignore |
| 16 | export const fetch: SelectType<typeof manual.fetch, typeof auto.fetch>; |
| 17 | |
| 18 | // @ts-ignore |
| 19 | export type Request = SelectType<manual.Request, auto.Request>; |
| 20 | // @ts-ignore |
| 21 | export type RequestInfo = SelectType<manual.RequestInfo, auto.RequestInfo>; |
| 22 | // @ts-ignore |
| 23 | export type RequestInit = SelectType<manual.RequestInit, auto.RequestInit>; |
| 24 | |
| 25 | // @ts-ignore |
| 26 | export type Response = SelectType<manual.Response, auto.Response>; |
| 27 | // @ts-ignore |
| 28 | export type ResponseInit = SelectType<manual.ResponseInit, auto.ResponseInit>; |
| 29 | // @ts-ignore |
| 30 | export type ResponseType = SelectType<manual.ResponseType, auto.ResponseType>; |
| 31 | // @ts-ignore |
| 32 | export type BodyInit = SelectType<manual.BodyInit, auto.BodyInit>; |
| 33 | // @ts-ignore |
| 34 | export type Headers = SelectType<manual.Headers, auto.Headers>; |
| 35 | // @ts-ignore |
| 36 | export const Headers: SelectType<typeof manual.Headers, typeof auto.Headers>; |
| 37 | // @ts-ignore |
| 38 | export type HeadersInit = SelectType<manual.HeadersInit, auto.HeadersInit>; |
| 39 | |
| 40 | // @ts-ignore |
| 41 | export type BlobPropertyBag = SelectType<manual.BlobPropertyBag, auto.BlobPropertyBag>; |
| 42 | // @ts-ignore |
| 43 | export type FilePropertyBag = SelectType<manual.FilePropertyBag, auto.FilePropertyBag>; |
| 44 | // @ts-ignore |
| 45 | export type FileFromPathOptions = SelectType<manual.FileFromPathOptions, auto.FileFromPathOptions>; |
| 46 | // @ts-ignore |
| 47 | export type FormData = SelectType<manual.FormData, auto.FormData>; |
| 48 | // @ts-ignore |
| 49 | export const FormData: SelectType<typeof manual.FormData, typeof auto.FormData>; |
| 50 | // @ts-ignore |
| 51 | export type File = SelectType<manual.File, auto.File>; |
| 52 | // @ts-ignore |
| 53 | export const File: SelectType<typeof manual.File, typeof auto.File>; |
| 54 | // @ts-ignore |
| 55 | export type Blob = SelectType<manual.Blob, auto.Blob>; |
| 56 | // @ts-ignore |
| 57 | export const Blob: SelectType<typeof manual.Blob, typeof auto.Blob>; |
| 58 | |
| 59 | // @ts-ignore |
| 60 | export type Readable = SelectType<manual.Readable, auto.Readable>; |
| 61 | // @ts-ignore |
| 62 | export type FsReadStream = SelectType<manual.FsReadStream, auto.FsReadStream>; |
| 63 | // @ts-ignore |
| 64 | export type ReadableStream = SelectType<manual.ReadableStream, auto.ReadableStream>; |
| 65 | // @ts-ignore |
| 66 | export const ReadableStream: SelectType<typeof manual.ReadableStream, typeof auto.ReadableStream>; |
| 67 | |
| 68 | export function getMultipartRequestOptions<T = Record<string, unknown>>( |
| 69 | form: FormData, |
| 70 | opts: RequestOptions<T>, |
| 71 | ): Promise<RequestOptions<T>>; |
| 72 | |
| 73 | export function getDefaultAgent(url: string): any; |
| 74 | |
| 75 | // @ts-ignore |
| 76 | export type FileFromPathOptions = SelectType<manual.FileFromPathOptions, auto.FileFromPathOptions>; |
| 77 | |
| 78 | export function fileFromPath(path: string, options?: FileFromPathOptions): Promise<File>; |
| 79 | export function fileFromPath(path: string, filename?: string, options?: FileFromPathOptions): Promise<File>; |
| 80 | |
| 81 | export function isFsReadStream(value: any): value is FsReadStream; |
| 82 | |