{"name":"servie","version":"3.2.2","description":"Standard HTTP interfaces","main":"dist/index.js","types":"dist/index.d.ts","files":["dist/","LICENSE","logo.svg"],"browser":{"./dist/body/node/index.js":"./dist/body/browser/index.js"},"scripts":{"lint":"tslint \"src/**/*.ts\" --project tsconfig.json","build":"rm -rf dist/ && tsc","specs":"jest --coverage","test":"npm run lint && npm run build && npm run specs && npm run bundle && npm run bundle:size","bundle":"browserify . -o browser.js","bundle:size":"du -h browser.js","prepublish":"npm run build"},"repository":{"type":"git","url":"git://github.com/serviejs/servie.git"},"keywords":["request","response","http","interface","req","res","server"],"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"]},"devDependencies":{"@types/jest":"^22.2.2","@types/node":"^10.1.2","browserify":"^16.1.1","jest":"^22.4.3","rimraf":"^2.6.2","ts-jest":"^22.4.2","tslint":"^5.9.1","tslint-config-standard":"^7.0.0","typescript":"^2.8.1"},"dependencies":{"byte-length":"^1.0.2"},"gitHead":"665b0fbaf1c837cf07dc978addf095f53037eb34","_id":"servie@3.2.2","_npmVersion":"5.6.0","_nodeVersion":"10.1.0","_npmUser":{"name":"blakeembrey","email":"hello@blakeembrey.com"},"dist":{"integrity":"sha512-rn/nVuxxn1X5CRBuDuB1hpUcv3vnbd0Wjlfn1R9fxhghW6oIt+S/yM5yp/42SNXIODeFwVh788Qj3fWfDnciLw==","shasum":"f610b2b4cb080d5e4ac4337ec17970f6c7c889bf","tarball":"http://registry-npm.ywwl.com/servie/download/servie-3.2.2.tgz","fileCount":73,"unpackedSize":124322,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbA5wqCRA9TVsSAnZWagAAAV4P/An5LxXSP0RkRlquhTNK\nMYNWXbovWJDfzpGh4Lge4xDoG3Qem8FNUV/KljECIThrHZz2GCh2Mm2qy38d\nAbV8P+vJIFTNwHQZXVdZSdJjo0xt52JO1gigPwsC+TbpbWEJIpjlL2LI1Mfe\nUAlyqz2yv1taJzXP9f3+0wRkkuun4/PJ61AqG7ZJ7YVXpHRwn35ROox0xWQm\nQTG/lPHSA3AsmKcKHmJ6ClqouTKFJgQ2fL9m10EZVUJt2UK5RzxVIqUGJk7w\nkxOx9FyOJZZGdt2d0HxS82N778D9VeQImGf0pWmdTAfQ0ybiqy2O0DHHd1fW\nxaiILxRW4FxgzGDWU7vBta2mp9mbjyhqESpkJCphwTybcqrBSGWr+sZiHT0s\nMigGC8R4Eg64qPOXs87hJnJncJci/Df8BnfcQ6OkG4OpW+361emC/O/mrX15\nuqHe3/UpUIt8F1tF8C3VQBRm7IrVAYZQdzY4XpJqZQYQ1HENpyO2GLm/GSFn\ne9G1FS4jcFSr2pF5icqVcLMtyCHOl7dpJVWSd7+qrcHA/tUCnwWzM+jRL/1j\n/6cGTx+1Ne6B7+q/m3HShR7O0YnMR/YMoZcZDf20MlFDQeo+onTEGYkUy5k6\n/SMNQLx1H5wZTEpWkvOsh6osQLXE6YBIyKPaBwOnmoq5dzd8ly4DaaqDBBBz\nUmkC\r\n=FsSq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCi7m8J6seLMqZkBDUSVajiHcuA0vcZxgCX4BnJqx8X2wIhAIIZ8xWPRM3ArGyG+9vE/EdTsdBa7xhouduuImL2u1e2"}],"size":27729,"noattachment":false,"key":"/servie/-/servie-3.2.2.tgz"},"maintainers":[{"name":"blakeembrey","email":"hello@blakeembrey.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/servie_3.2.2_1526963242157_0.11891477839525222"},"_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":1526963242277,"_cnpm_publish_time":1526963242277,"dist-tags":{"latest":"4.3.3"}}