diff --git a/.all-contributorsrc b/.all-contributorsrc new file mode 100644 index 00000000..9f6fd693 --- /dev/null +++ b/.all-contributorsrc @@ -0,0 +1,15 @@ +{ + "files": [ + "README.md" + ], + "imageSize": 100, + "commit": false, + "contributors": [ + ], + "contributorsPerLine": 7, + "projectName": "events", + "projectOwner": "MyUnisoft", + "repoType": "github", + "repoHost": "https://github.com", + "skipCi": true +} diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..c6f26ff4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 MyUnisoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index efe85f8f..98443691 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,17 @@ -# Events -MyUnisoft Events data validation, and transparency on events & result of webhooks. +

+ Events +

+ +

+ MyUnisoft Events validator, schemas and types (useful to work with Webhooks). +

+ +

+ npm version + license + size + Responsible Disclosure Policy +

## Requirements - [Node.js](https://nodejs.org/en/) version 14 or higher @@ -34,9 +46,14 @@ const event: EventsDefinition.AccountingFolder = { validateEventData<"connector" | "accountingFolder">(event); ``` +## API + +### validateEventData< T extends keyof EventsDefinition.Events >(options: EventsDefinition.Events[ T ]): void +Throw an error if a given event is not internaly known. + ## Types -### EventOptions +
EventOptions ```ts export type EventOptions = { @@ -60,7 +77,9 @@ const event: EventOptions<"connector"> = { } ``` -### EventsOptions +
+ +
EventOptions ```ts type TupleToObject = { } } ``` +
-### WebhooksResponse +
WebhooksResponse ```ts type WebhookResponse = { @@ -158,3 +178,24 @@ const response: WebhooksResponse<["connector", "accountingFolder"]> = [ }, ]; ``` +
+ +## Contributors ✨ + + +[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-) + + +Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): + + + + + + + + + + +## License +MIT