-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
264 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Editor configuration, see https://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
end_of_line = lf | ||
|
||
[*.md] | ||
max_line_length = off | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
{ | ||
"extends": "@myunisoft/eslint-config" | ||
"extends": "@nodesecure/eslint-config", | ||
"rules": { | ||
"@typescript-eslint/no-non-null-assertion": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,133 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
.pnpm-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Snowpack dependency directory (https://snowpack.dev/) | ||
web_modules/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional stylelint cache | ||
.stylelintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variable files | ||
.env | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.env.local | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
.parcel-cache | ||
|
||
# Next.js build output | ||
.next | ||
out | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and not Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# vuepress v2.x temp and cache directory | ||
.temp | ||
.cache | ||
|
||
# Docusaurus cache and generated files | ||
.docusaurus | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
.vscode-test | ||
|
||
# yarn v2 | ||
.yarn/cache | ||
.yarn/unplugged | ||
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* | ||
|
||
# lock file | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,49 @@ | ||
# Events | ||
MyUnisoft Events validation | ||
# Events-utils | ||
MyUnisoft Events data validation, and transparency on events & result of webhooks. | ||
|
||
## Requirements | ||
- [Node.js](https://nodejs.org/en/) version 14 or higher | ||
|
||
## Getting Started | ||
|
||
This package is available in the Node Package Repository and can be easily installed with [npm](https://doc.npmjs.com/getting-started/what-is-npm) or [yarn](https://yarnpkg.com) | ||
|
||
```bash | ||
$ npm i @myunisoft/events | ||
# or | ||
$ yarn add @myunisoft/events | ||
``` | ||
|
||
## Usage | ||
|
||
```ts | ||
import { ValidateEventDataOptions, validateEventData } from "@myunisoft/events"; | ||
|
||
const event: ValidateEventDataOptions = { | ||
name: "accountingFolder", | ||
operation: "CREATE", | ||
data: { | ||
accountingFolderId: 1 | ||
} | ||
}; | ||
|
||
validateEventData(event); | ||
``` | ||
|
||
## Events Descriptions | ||
|
||
### connector | ||
|
||
| Operation | Agent | Payload | | ||
|---|---|---| | ||
| CREATE | Node.js | ```{ connectorId: number ;}``` | | ||
| UPDATE | Node.js | ```{ connectorId: number ;}``` | | ||
| DELETE | Node.js | ```{ connectorId: number ;}``` | | ||
|
||
--- | ||
|
||
### accountingFolder | ||
|
||
| Operation | Agent | Payload | | ||
|---|---|---| | ||
| CREATE | Windev | ```{ accountingFolderId: number ;}``` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
This project participates in the Responsible Disclosure Policy program for the Node.js Security Ecosystem. | ||
|
||
# Responsible Disclosure Policy | ||
|
||
A responsible disclosure policy helps protect the project and its users from security vulnerabilities discovered in the project’s scope by employing a process where vulnerabilities are publicly disclosed after a reasonable time period to allow patching the vulnerability. | ||
|
||
All security bugs are taken seriously and are considered as top priority. | ||
Your efforts to responsibly disclose your findings are appreciated and will be taken into account to acknowledge your contributions. | ||
|
||
|
||
## Reporting a Security Issue | ||
|
||
Any security related issue should be reported to the [Node.js Ecosystem](https://hackerone.com/nodejs-ecosystem | ||
) program hosted on HackerOne which follows the [3rd party responsible disclosure process](https://github.com/nodejs/security-wg/blob/master/processes/third_party_vuln_process.md) set by the Node.js Security WG. One may also directly contact the project’s maintainers, but through the HackerOne program the Security WG members will take care of triaging the vulnerability and invite project maintainers to participate in the report. | ||
|
||
As an alternative method, vulnerabilities can also be reported by emailing [email protected]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/MyUnisoft/Events.git" | ||
"url": "git+https://github.com/MyUnisoft/events-utils.git" | ||
}, | ||
"publishConfig": { | ||
"@myunisoft:registry": "https://registry.npmjs.org/" | ||
|
@@ -21,7 +21,7 @@ | |
"author": "HALLAERT Nicolas <[email protected]>", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/MyUnisoft/Events/issues" | ||
"url": "https://github.com/MyUnisoft/events-utils/issues" | ||
}, | ||
"dependencies": { | ||
"ajv": "^8.11.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
export type Events = "accountingFolder" | "connector"; | ||
|
||
// Events | ||
export interface Connector { | ||
name: "connector"; | ||
operation: "CREATE" | "UPDATE" | "DELETE"; | ||
data: { | ||
connectorId: number; | ||
}; | ||
} | ||
|
||
export interface AccountingFolder { | ||
name: "accountingFolder"; | ||
operation: "CREATE"; | ||
data: { | ||
accountingFolderId: number; | ||
}; | ||
} | ||
|
||
export interface EventsDefinition { | ||
accountingFolder: AccountingFolder; | ||
connector: Connector; | ||
} | ||
|
||
|
||
interface Scope { | ||
schemaId: number; | ||
accountingFolderId?: number; | ||
} | ||
|
||
export type WebhookResponse<K extends keyof EventsDefinition = keyof EventsDefinition> = { | ||
scope: Scope; | ||
webhookId: string; | ||
createdAt: number; | ||
} & EventsDefinition[K]; | ||
|
||
|
||
export type WebhooksResponse<T extends (keyof EventsDefinition)[]> = [ | ||
...(WebhookResponse<T[number]>)[] | ||
]; | ||
|