UNPKG

mappersmith

Version:

It is a lightweight rest client for node.js and the browser

1 lines 3.06 kB
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-var-requires */\nimport { configs } from './mappersmith'\nimport { XHR } from './gateway/xhr'\nimport { HTTP } from './gateway/http'\nimport { Fetch } from './gateway/fetch'\nimport type { Gateway } from './gateway/index'\nimport type { GlobalConfigs, ManifestOptions, ResourceTypeConstraint } from './manifest'\nlet _process = null\nlet defaultGateway: typeof Gateway | null = null\n\n// Prevents webpack to load the nodejs process polyfill\ntry {\n // eslint-disable-next-line no-eval\n _process = eval(\n 'typeof __TEST_SERVICE_WORKER__ === \"undefined\" && typeof process === \"object\" ? process : undefined'\n )\n} catch (e) {} // eslint-disable-line no-empty\n\nif (typeof XMLHttpRequest !== 'undefined') {\n // For browsers use XHR adapter\n defaultGateway = XHR\n} else if (typeof _process !== 'undefined') {\n // For node use HTTP adapter\n defaultGateway = HTTP\n} else if (typeof self !== 'undefined') {\n // For service workers use fetch adapter\n defaultGateway = Fetch\n}\n\nconfigs.gateway = defaultGateway\n\nexport type { GlobalConfigs, ManifestOptions, ResourceTypeConstraint }\nexport type { Request, RequestContext } from './request'\nexport type {\n Primitive,\n Hash,\n Headers,\n Body,\n Params as Parameters,\n Auth as Authorization,\n NestedParam,\n NestedParamArray,\n RequestParams,\n ParameterEncoderFn,\n} from './types'\nexport type { Gateway } from './gateway/index'\nexport type { XHR as XhrGateway } from './gateway/xhr'\nexport type { HTTP as HTTPGateway } from './gateway/http'\nexport type { Fetch as FetchGateway } from './gateway/fetch'\nexport type { Mock as MockGateway } from './gateway/mock'\nexport type {\n HTTPRequestParams,\n HTTPGatewayConfiguration,\n GatewayConfiguration,\n} from './gateway/types'\nexport { Response } from './response'\nexport type { ParsedJSON } from './response'\nexport type {\n AbortFn,\n Context,\n Middleware,\n MiddlewareDescriptor,\n MiddlewareParams,\n RenewFn,\n RequestGetter,\n ResponseGetter,\n} from './middleware/index'\nexport type { AsyncFunction, AsyncFunctions, Client, ClientBuilder } from './client-builder'\nexport type { MethodDescriptor, MethodDescriptorParams } from './method-descriptor'\n\n/**\n * @deprecated, use ManifestOptions instead\n */\nexport type Options<Resources extends ResourceTypeConstraint> = ManifestOptions<Resources>\n\n/**\n * @deprecated, use GlobalConfigs instead\n */\nexport type Configuration = GlobalConfigs\nexport { forge as default, forge, version, setContext } from './mappersmith'\nexport { configs }\n"],"mappings":";AACA,SAAS,eAAe;AACxB,SAAS,WAAW;AACpB,SAAS,YAAY;AACrB,SAAS,aAAa;AAmDtB,SAAS,gBAAgB;AAwBzB,SAAkB,OAAS,SAAAA,QAAO,SAAS,kBAAkB;AAxE7D,IAAI,WAAW;AACf,IAAI,iBAAwC;AAG5C,IAAI;AAEF,aAAW;AAAA,IACT;AAAA,EACF;AACF,SAAS,GAAG;AAAC;AAEb,IAAI,OAAO,mBAAmB,aAAa;AAEzC,mBAAiB;AACnB,WAAW,OAAO,aAAa,aAAa;AAE1C,mBAAiB;AACnB,WAAW,OAAO,SAAS,aAAa;AAEtC,mBAAiB;AACnB;AAEA,QAAQ,UAAU;","names":["forge"]}