commit 04f383b728cc7fbed655cb0269b5a9e4f4f24446 Author: Phil Kunz Date: Thu Apr 6 17:00:38 2017 +0200 initial diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e224c21 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules/ +coverage/ +public/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..9e48bc4 --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# smartstatus +status information in TypeScript + +## Availabililty +[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartstatus) +[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/smartstatus) +[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartstatus) +[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartstatus/) + +## Status for master +[![build status](https://GitLab.com/pushrocks/smartstatus/badges/master/build.svg)](https://GitLab.com/pushrocks/smartstatus/commits/master) +[![coverage report](https://GitLab.com/pushrocks/smartstatus/badges/master/coverage.svg)](https://GitLab.com/pushrocks/smartstatus/commits/master) +[![npm downloads per month](https://img.shields.io/npm/dm/smartstatus.svg)](https://www.npmjs.com/package/smartstatus) +[![Dependency Status](https://david-dm.org/pushrocks/smartstatus.svg)](https://david-dm.org/pushrocks/smartstatus) +[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartstatus/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartstatus/master/dependencies/npm) +[![bitHound Code](https://www.bithound.io/github/pushrocks/smartstatus/badges/code.svg)](https://www.bithound.io/github/pushrocks/smartstatus) +[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/) +[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/) +[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) + +## Usage +Use TypeScript for best in class instellisense. + +For further information read the linked docs at the top of this README. + +> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) +| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) + +[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks) diff --git a/npmextra.json b/npmextra.json new file mode 100644 index 0000000..1403dd8 --- /dev/null +++ b/npmextra.json @@ -0,0 +1,7 @@ +{ + "npmci": { + "globalNpmTools": [ + "npmts" + ] + } +} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..4d7af03 --- /dev/null +++ b/package.json @@ -0,0 +1,19 @@ +{ + "name": "smartstatus", + "version": "1.0.0", + "description": "status information in TypeScript", + "main": "dist/index.js", + "scripts": { + "test": "(npmts)" + }, + "repository": { + "type": "git", + "url": "git+ssh://git@gitlab.com/pkunz/smartstatus.git" + }, + "author": "Lossless GmbH", + "license": "MIT", + "bugs": { + "url": "https://gitlab.com/pkunz/smartstatus/issues" + }, + "homepage": "https://gitlab.com/pkunz/smartstatus#README" +} diff --git a/ts/index.ts b/ts/index.ts new file mode 100644 index 0000000..0900bde --- /dev/null +++ b/ts/index.ts @@ -0,0 +1,3 @@ +import * as http from './smartstatus.classes.http' + +http. \ No newline at end of file diff --git a/ts/smartstatus.classes.http.1xx.ts b/ts/smartstatus.classes.http.1xx.ts new file mode 100644 index 0000000..a728a95 --- /dev/null +++ b/ts/smartstatus.classes.http.1xx.ts @@ -0,0 +1 @@ +import { HttpStatus, TStatusGroup } from './smartstatus.classes.http' diff --git a/ts/smartstatus.classes.http.2xx.ts b/ts/smartstatus.classes.http.2xx.ts new file mode 100644 index 0000000..a728a95 --- /dev/null +++ b/ts/smartstatus.classes.http.2xx.ts @@ -0,0 +1 @@ +import { HttpStatus, TStatusGroup } from './smartstatus.classes.http' diff --git a/ts/smartstatus.classes.http.3xx.ts b/ts/smartstatus.classes.http.3xx.ts new file mode 100644 index 0000000..a728a95 --- /dev/null +++ b/ts/smartstatus.classes.http.3xx.ts @@ -0,0 +1 @@ +import { HttpStatus, TStatusGroup } from './smartstatus.classes.http' diff --git a/ts/smartstatus.classes.http.4xx.ts b/ts/smartstatus.classes.http.4xx.ts new file mode 100644 index 0000000..66d772c --- /dev/null +++ b/ts/smartstatus.classes.http.4xx.ts @@ -0,0 +1,54 @@ +import { HttpStatus, TStatusGroup } from './smartstatus.classes.http' + +export class error400 extends HttpStatus { + constructor () { + super({ + code: 400, + text: 'Bad Request', + description: `The server cannot or will not process the request due to an apparent client error (e.g., malformed request syntax, too large size, invalid request message framing, or deceptive request routing).` + }) + } + +} + +export class error402 extends HttpStatus { + constructor () { + super({ + code: 402, + text: 'Payment Required', + description: `The request was valid, but the server is refusing action. The user might not have the necessary permissions for a resource.` + }) + } +} + +export class error403 extends HttpStatus { + constructor () { + super({ + code: 403, + text: 'Forbidden', + description: `The request was valid, but the server is refusing action. The user might not have the necessary permissions for a resource.` + }) + } +} + +export class error401 extends HttpStatus { + constructor () { + super({ + code: 401, + text: 'Unauthorized', + description: `Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet been provided. The response must include a WWW-Authenticate header field containing a challenge applicable to the requested resource. See Basic access authentication and Digest access authentication.[32] 401 semantically means "unauthenticated",[33] i.e. the user does not have the necessary credentials. + Note: Some sites issue HTTP 401 when an IP address is banned from the website (usually the website domain) and that specific address is refused permission to access a website.` + }) + } + +} + +export class error404 extends HttpStatus { + constructor () { + super({ + code: 404, + text: 'Not Found', + description: `The requested resource could not be found but may be available in the future. Subsequent requests by the client are permissible.` + }) + } +} diff --git a/ts/smartstatus.classes.http.5xx.ts b/ts/smartstatus.classes.http.5xx.ts new file mode 100644 index 0000000..e08b631 --- /dev/null +++ b/ts/smartstatus.classes.http.5xx.ts @@ -0,0 +1,11 @@ +import { HttpStatus, TStatusGroup } from './smartstatus.classes.http' + +export class error500 extends HttpStatus { + constructor () { + super({ + code: 500, + text: '', + description: 'You\'ve encountered an Http error 400. That means that the page you are looking for couldn\'t be found for some reason' + }) + } +} diff --git a/ts/smartstatus.classes.http.ts b/ts/smartstatus.classes.http.ts new file mode 100644 index 0000000..770ee9d --- /dev/null +++ b/ts/smartstatus.classes.http.ts @@ -0,0 +1,20 @@ +export type TStatusGroup = 'clientError' | 'serverError' + +export class HttpStatus { + code: number + text: string + description: string + constructor (optionsArg: { + code: number, + text: string, + description: string + }) { + + } +} + +export * from './smartstatus.classes.http.1xx' +export * from './smartstatus.classes.http.2xx' +export * from './smartstatus.classes.http.3xx' +export * from './smartstatus.classes.http.4xx' +export * from './smartstatus.classes.http.5xx'