{"name":"servie","version":"4.3.3","description":"Standard HTTP interfaces for HTTP clients and servers in node.js and browsers","main":"dist/index.js","types":"dist/index.d.ts","browser":{"./dist/node.js":"./dist/browser.js"},"scripts":{"prettier":"prettier --write","lint":"tslint \"src/**/*.ts\" --project tsconfig.json","format":"npm run prettier -- \"*.{md,yml,yaml}\" \"src/**/*.{js,jsx,ts,tsx}\"","build":"rimraf dist && tsc","specs":"jest --coverage","test":"npm run -s lint && npm run -s build && npm run -s specs && npm run -s size","prepare":"npm run build","size":"size-limit"},"size-limit":[{"path":"./dist/index.js","limit":"2 kB"}],"repository":{"type":"git","url":"git://github.com/serviejs/servie.git"},"keywords":["request","response","http","interface","server","browser","req","res"],"author":{"name":"Blake Embrey","email":"hello@blakeembrey.com","url":"http://blakeembrey.me"},"license":"Apache-2.0","bugs":{"url":"https://github.com/serviejs/servie/issues"},"homepage":"https://github.com/serviejs/servie","jest":{"roots":["<rootDir>/src/"],"transform":{"\\.tsx?$":"ts-jest"},"testRegex":"(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$","moduleFileExtensions":["ts","tsx","js","jsx","json","node"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.{js,jsx,ts,tsx,json,css,md,yml,yaml}":["npm run prettier","git add"]},"publishConfig":{"access":"public"},"devDependencies":{"@size-limit/preset-small-lib":"^2.1.6","@types/jest":"^24.0.11","@types/node":"^12.0.0","browserify":"^16.2.3","husky":"^3.0.2","jest":"^24.6.0","lint-staged":"^9.2.1","prettier":"^1.17.0","rimraf":"^3.0.0","ts-jest":"^24.0.1","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","tslint-config-standard":"^8.0.1","typescript":"^3.4.1"},"dependencies":{"@servie/events":"^1.0.0","byte-length":"^1.0.2","ts-expect":"^1.1.0"},"gitHead":"b38d6ec66619d4483e957ac66c80dc4dbcb5766d","_id":"servie@4.3.3","_nodeVersion":"14.4.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-b0IrY3b1gVMsWvJppCf19g1p3JSnS0hQi6xu4Hi40CIhf0Lx8pQHcvBL+xunShpmOiQzg1NOia812NAWdSaShw==","shasum":"4a9ffed6842cd0523003ad0ae9c0c8079f37718f","tarball":"http://registry-npm.ywwl.com/servie/download/servie-4.3.3.tgz","fileCount":28,"unpackedSize":114352,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfWu/nCRA9TVsSAnZWagAAT6wP/2L4hYAVxdHUPIdiqaQX\n5R8Wl+yx5ugHRFTBAQM74uniENU+Z7/VrBvqnvdH6vulay3MIlxAbfUxOZzn\nLMCdawBmA01BqJzGrFEF62vfzE+BvmkDTo8Agd5b5zA3IGAPtxCbjRd5+9aQ\nx1WSDYepRObHMOm0DJsY8TYzpMeF9CphfpnmvX0E62aIGdiJC2rh2NDp79DY\n8Ue8s3S5J2LmfhiutuEyqMFTQaz2rGGLeY5B8BpVRXMlI+QCeIUo5pbEQ/NV\nLSb4oH70QNqFh6Q9PBkr89azIKKQ/qg5DX8Nwo0JtdPrNfin/9Y9UUC4yr1g\nYHjfdplfBnSdSEbbqARkWfktc9BhfY7pGV7FyIb3/qd0CUcatg0HggYMU5wl\nOnO+b8f2FesKcegmRDi8rLcW+m0Apf0EhTdbccx2qjnOUWEVsJ3OT4VF1k/e\naQQFskFrfTdzrUXs6/z4SXaPjwdCxfQt+Ni/ev3msPi+72vA9Mp7vDG3KQXU\nyERIYce8iSRMnMcwrB4taxaESMa4JnHezWQ6Wb7AsBaOJmP2Mhd7t+eIf6Qj\nkBYXyHRizQoUOYuAwPt2MB6AB1XJC1+ddDhXaXxiKQTC/yN/kzac0zwiPY+b\nQCyG1XG9O7YeshBSaiZQIKkM297tzRC/CdPFs21PxsW0XZbukh3+IxRg0O7H\n1I1+\r\n=QGeb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID98SRajMnFCMaK2rzXKumkA2jKkv05J63pLA5RfUpBFAiBpG6uNAfKnynZKi2uOVuGWGGhPOrq7eM6rA7Ih1sRAJA=="}],"size":24451,"noattachment":false,"key":"/servie/-/servie-4.3.3.tgz"},"maintainers":[{"name":"blakeembrey","email":"hello@blakeembrey.com"}],"_npmUser":{"name":"blakeembrey","email":"hello@blakeembrey.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/servie_4.3.3_1599795175174_0.39668588812004724"},"_hasShrinkwrap":false,"readme":"# ![Servie](https://cdn.rawgit.com/serviejs/servie/master/logo.svg)\n\n[![NPM version](https://img.shields.io/npm/v/servie.svg)](https://npmjs.org/package/servie)\n[![NPM downloads](https://img.shields.io/npm/dm/servie.svg)](https://npmjs.org/package/servie)\n[![Build status](https://img.shields.io/travis/serviejs/servie.svg)](https://travis-ci.org/serviejs/servie)\n[![Test coverage](https://img.shields.io/coveralls/serviejs/servie.svg)](https://coveralls.io/r/serviejs/servie?branch=master)\n[![Bundle size](https://img.shields.io/bundlephobia/minzip/servie.svg)](https://bundlephobia.com/result?p=servie)\n\n> Standard, framework-agnostic HTTP interfaces for JavaScript servers and clients.\n\n## Installation\n\n```\nnpm install servie --save\n```\n\n## Usage\n\n- [`throwback`](https://github.com/serviejs/throwback) Compose middleware functions into a single function\n- [`popsicle`](https://github.com/serviejs/popsicle) HTTP request library for node.js and browsers\n- [`servie-lambda`](https://github.com/serviejs/servie-lambda) Servie transport layer for AWS Lambda\n- [`servie-http`](https://github.com/serviejs/servie-http) Servie transport layer for node.js HTTP\n- [`get-body`](https://github.com/serviejs/get-body) General body parser for forms, JSON and text\n- [`servie-cors`](https://github.com/serviejs/servie-cors) CORS middleware for Servie\n- [`servie-route`](https://github.com/serviejs/servie-route) Routing middleware for Servie\n- [`servie-mount`](https://github.com/serviejs/servie-mount) Mount Servie middleware on a path prefix\n- [`servie-compat-http`](https://github.com/serviejs/servie-compat-http) Mimic node.js HTTP using Servie\n- [`servie-redirect`](https://github.com/serviejs/servie-redirect) Create response objects for redirection\n- [`servie-cookie-store`](https://github.com/serviejs/servie-cookie-store) API for managing client-side cookies\n- [`servie-errorhandler`](https://github.com/serviejs/servie-errorhandler) Standard error handler for transport layers\n- [`servie-finalhandler`](https://github.com/serviejs/servie-finalhandler) Standard final handler for transport layers\n- [`http-errors`](https://github.com/jshttp/http-errors) Create HTTP errors\n- [`boom`](https://github.com/hapijs/boom) HTTP-friendly error objects\n- [`consolidate`](https://github.com/tj/consolidate.js) Template rendering\n\n```ts\nimport { Body, Request, Response, Headers, AbortController } from \"servie\";\n```\n\n> Servie is a universal package, meaning node.js and browsers are supported without needing configuration. This means the primary endpoint requires some `dom` types in TypeScript. When in a node.js, or browser, only environment, prefer importing `servie/dist/{node,browser}` instead.\n\n### `Body`\n\n> Base HTTP class shared between `Request` and `Response`.\n\n```ts\nnew Body(body, headers);\n```\n\n#### Body\n\nSupported body types, depending on environment:\n\n- Node.js - `string | Buffer | ArrayBuffer | Readable | null | undefined`\n- Browser - `string | ArrayBuffer | ReadableStream | null | undefined`\n\n#### Properties and Methods\n\n- `bodyUsed` Boolean whether the body is already consumed\n- `text()` Returns the body as a `Promise<string>`\n- `json()` Returns the body with `JSON.parse` as `Promise<any>`\n- `arrayBuffer()` Returns the body as a `Promise<ArrayBuffer>`\n- `clone()` Clones an unconsumed body\n- `destroy()` Consumes and destroys the body\n\n### `Request`\n\n> HTTP class for modelling a `Request`, extends `Body`.\n\n```ts\nnew Request(input [, init]);\n```\n\n#### Input\n\nA URL string or another `Request` instance to clone from.\n\n#### Init\n\n- `method?` HTTP request method.\n- `body?` Any support body types.\n- `signal?` A signal from an `AbortController`.\n- `headers?` A map, list of tuples, or `Header` instance to initialize from.\n- `trailer?` A promise resolve to a support header initialization types (above).\n\n#### Properties and Methods\n\n- `url` Requested url string\n- `method` Requested method string\n- `signal` Signal event emitter\n- `headers` A [`Headers`](#headers) instance\n- `trailer` A [`Promise<Headers>`](#headers) instance\n- `clone()` Clones the request into a new instance\n\n### `Response`\n\n> HTTP class for modelling a `Response`, extends `Body`.\n\n```ts\nnew Response([body [, init]]);\n```\n\n#### Body\n\nOne of the support body types (above).\n\n#### Init\n\n- `status?` The numeric HTTP response status code\n- `statusText?` The HTTP response status text\n\n#### Properties and Methods\n\n- `status` The numeric HTTP response status code\n- `statusText` The HTTP response status text\n- `ok` Boolean indicates successful response (`status` between 200 and 299)\n- `headers` A [`Headers`](#headers) instance\n- `trailer` A [`Promise<Headers>`](#headers) instance\n- `clone()` Clones the response into a new instance\n\n### `Headers`\n\n> Map representation of HTTP headers.\n\n```ts\nnew Headers([init]);\n```\n\n#### Init\n\nInitialize headers from `Iterable<HeaderTuple>`, a `HeadersObject` or an existing `Headers` instance.\n\n#### Methods\n\n- `set(name: string, value: string | string[]): void` Set a HTTP header by overriding case-insensitive headers of the same name\n- `append(name: string, value: string | string[]): void` Append a HTTP header\n- `get(name: string): string | undefined` Retrieve a case-insensitive HTTP header\n- `getAll(name: string): string[]` Retrieve a list of matching case-insensitive HTTP headers\n- `has(name: string): boolean` Check if a case-insensitive header is already set\n- `delete(name: string): void` Delete a case-insensitive header\n- `asObject(): HeadersObject` Return the lower-cased headers as a plain object\n- `extend(obj: HeadersInit): this` Extends the current headers with an object\n- `keys()` Iterable of the available header names\n- `values()` Iterable of header values\n- `entries()` Iterable of headers as `[key, value]`\n- `clear()` Clears the headers instance\n- `clone()` Clones the `Headers` instance\n\n### `AbortController`\n\n> Simple controller for aborting a `Request` instance.\n\n```ts\nnew AbortController();\n```\n\n#### Properties and Methods\n\n- `signal` A [`Signal`](#signal) instance to pass to a [`Request`](#request)\n- `abort()` Used to abort any listening requests through the `signal`\n\n### `Signal`\n\n> Tiny [event emitter](https://github.com/serviejs/events) for communicating during a request.\n\n#### Methods\n\n- `aborted` Boolean indicating whether the request is aborted\n- `on(type, fn)` Attach an event listener to an event type\n- `off(type, fn)` Remove an event listener from an event type\n- `each(fn)` Attach an event listener for all events\n- `none(fn)` Remove a global event listener\n- `emit(type, ...args)` Emit an event to all listeners\n\n#### Standard Events\n\n- `abort` The request has been aborted\n- `requestBytes` Emitted on request progress with current bytes\n- `requestEnded` The request has ended\n- `requestStarted` The request has been started\n- `responseBytes` Emitted on response progress with current bytes\n- `responseEnded` The response has ended\n- `responseStarted` The response has started\n\nPlugins can emit new types of events.\n\n## Implementation\n\nIf you're building the transports for Servie, there are some life cycle events you need to be aware of:\n\n1. Listen to the `error` event on `signal` for errors\n2. Listen to the `abort` event on `signal` to destroy the connection\n3. Resolve `trailer` promise and append to HTTP request or response\n4. There are some existing built-in type-safe events in `SignalEvents` you can support\n\n## JavaScript\n\nThis module is designed for ES2017 environments and published with [TypeScript](https://github.com/Microsoft/TypeScript) definitions on NPM.\n\n## License\n\nApache 2.0\n","publish_time":1599795175368,"_cnpm_publish_time":1599795175368,"dist-tags":{"latest":"4.3.3"}}