{"name":"servie","version":"4.3.2","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"},"gitHead":"b31ee76b62a1ff59cd41b34665b84a029253ad3f","_id":"servie@4.3.2","_nodeVersion":"13.0.1","_npmVersion":"6.9.0","dist":{"integrity":"sha512-1NpFf3LjkDDq4IIuBqtqHfSdPWhXpuyWwuBdwbifZjWSxQd8rCWz5W9AluxNvWfteM1qQ26puODIzWljvBJc5A==","shasum":"7168140d62cb9476cb8b184fc8ceda24d5154e7e","tarball":"http://registry-npm.ywwl.com/servie/download/servie-4.3.2.tgz","fileCount":28,"unpackedSize":111135,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdvqF3CRA9TVsSAnZWagAAYV0P/2YD+b6Z28ZLW+0E8SBe\n82v39rCaQ3VRARsNXzKwSSuhYTtLpP8TdINdcYLctC0CROYq3NIrNR6sO58z\nM1KYsKmDCAj/jweDEBBGDRQagcu9VrWGnFzrLMJ4+w4rKBnbqrvKj3SSMtPV\nujsQkf+f0q2OJBTkBWLF2zynd7FhRAsUuHIrgDoaZU+UtaYCZGC342Bvce6o\nCn9bouy/PjrbJQaQA0QB7G7/NQHos1Q+1Q1vN6H2ZkZIeIcRK3gk5cInABtb\nw978+hm/zmj5g4KvBKqqGt8cZTa2QZIJawT89MIxu2vfcnZ8j1AMfnFcUUgK\nF2OOrGl/PSOZUArFrT8TJ6wSL5j5fdtZ1icNA1eE+aMYK68uGilcs+AJ7xIy\n3AImmp1k2xbBUromFhlFrmbaWqdHQp8YK5faWYfKUI/xrlbssQ9OLMp8pw8C\nucRYZ+H5F8OnJmaVCXfuUfDqze7Bn+/frAE8n1dSApkX9IpGepI7o+yTuZzZ\n3phJb3bmO5FuLdLbqKbBupT+orWrxjL2h5YjUBPhwIZT/zAm/J81ojpvxLR7\nccqGr4iHFST1z234hExnRbqkz2bL+LT3zjKHPj1TZ5VJ6krvzREtL4LYCG5y\nu5L+2X00EURZtZjWPcBRtftjvfbeEfmisZxjSWBdYzWNRB67+ThVgBnnl9Ta\ndFAC\r\n=n83b\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQClJDESwdX9ThNgSg0Go474oYa0mID7MxO1waueei/2YgIgJsH+QqkC0X1ZEYyVFE1f1Sfh+8AqB4wNtTSbe9SDF6w="}],"size":24182,"noattachment":false,"key":"/servie/-/servie-4.3.2.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.2_1572774262479_0.27202003225989646"},"_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":1572774262825,"_cnpm_publish_time":1572774262825,"dist-tags":{"latest":"4.3.3"}}