@basis-theory/basis-theory-reactor-formulas-sdk-js 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # basistheory-reactor-formulas-sdk-js
2
+
3
+ Javascript SDK for building Basis Theory reactor formulas
4
+
5
+ ## Usage
6
+
7
+ Install the package:
8
+
9
+ ```shell
10
+ yarn add @basis-theory/basis-theory-reactor-formulas-sdk-js
11
+ ```
12
+
13
+ ## Development
14
+
15
+ ### Dependencies
16
+
17
+ - [NodeJS](https://nodejs.org/en/) >= 14.17.5
18
+ - [Yarn](https://classic.yarnpkg.com/en/docs/)
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@basis-theory/basis-theory-reactor-formulas-sdk-js",
3
+ "version": "1.0.0",
4
+ "description": "Javascript SDK for building Basis Theory reactor formulas",
5
+ "repository": "https://github.com/Basis-Theory/basistheory-reactor-formulas-sdk-js",
6
+ "main": "src/index.js",
7
+ "author": {
8
+ "name": "Basis Theory",
9
+ "email": "support@basistheory.com"
10
+ },
11
+ "license": "UNLICENSED",
12
+ "files": [
13
+ "src"
14
+ ],
15
+ "scripts": {
16
+ "lint": "eslint . --quiet --ignore-path .gitignore",
17
+ "release": "semantic-release",
18
+ "postinstall": "husky install"
19
+ },
20
+ "devDependencies": {
21
+ "@commitlint/cli": "^12.1.1",
22
+ "@commitlint/config-conventional": "^12.1.1",
23
+ "@semantic-release/changelog": "^5.0.1",
24
+ "@semantic-release/commit-analyzer": "^8.0.1",
25
+ "@semantic-release/git": "^9.0.0",
26
+ "@semantic-release/github": "^7.2.0",
27
+ "@semantic-release/npm": "^7.0.10",
28
+ "@semantic-release/release-notes-generator": "^9.0.1",
29
+ "eslint": "^7.32.0",
30
+ "eslint-config-standard": "^16.0.3",
31
+ "eslint-plugin-import": "^2.23.4",
32
+ "eslint-plugin-node": "^11.1.0",
33
+ "eslint-plugin-promise": "^5.1.0",
34
+ "eslint-config-prettier": "^8.3.0",
35
+ "eslint-plugin-prettier": "^3.4.0",
36
+ "husky": "^5.1.1",
37
+ "prettier": "^2.3.2",
38
+ "pretty-quick": "^3.1.0",
39
+ "semantic-release": "^17.3.9"
40
+ },
41
+ "engines": {
42
+ "node": ">=14"
43
+ },
44
+ "publishConfig": {
45
+ "access": "restricted"
46
+ }
47
+ }
@@ -0,0 +1,9 @@
1
+ const BasisTheoryReactorError = require('./BasisTheoryReactorError');
2
+
3
+ class AuthenticationError extends BasisTheoryReactorError {
4
+ constructor(data) {
5
+ super('Authentication Failed', 401, data);
6
+ }
7
+ }
8
+
9
+ module.exports = AuthenticationError;
@@ -0,0 +1,9 @@
1
+ const BasisTheoryReactorError = require('./BasisTheoryReactorError');
2
+
3
+ class BadRequestError extends BasisTheoryReactorError {
4
+ constructor(data) {
5
+ super('Bad Request', 400, data);
6
+ }
7
+ }
8
+
9
+ module.exports = BadRequestError;
@@ -0,0 +1,16 @@
1
+ class BasisTheoryReactorError extends Error {
2
+ constructor(message, status, data) {
3
+ super(message);
4
+ this.status = status;
5
+ this.data = data;
6
+ }
7
+
8
+ toRFC7807() {
9
+ return {
10
+ title: this.message,
11
+ status: this.status,
12
+ };
13
+ }
14
+ }
15
+
16
+ module.exports = BasisTheoryReactorError;
@@ -0,0 +1,9 @@
1
+ const BasisTheoryReactorError = require('./BasisTheoryReactorError');
2
+
3
+ class InvalidCardError extends BasisTheoryReactorError {
4
+ constructor(data) {
5
+ super('Invalid Card', 402, data);
6
+ }
7
+ }
8
+
9
+ module.exports = InvalidCardError;
@@ -0,0 +1,9 @@
1
+ const BasisTheoryReactorError = require('./BasisTheoryReactorError');
2
+
3
+ class InvalidReactorFormulaError extends BasisTheoryReactorError {
4
+ constructor(title) {
5
+ super(title, 422);
6
+ }
7
+ }
8
+
9
+ module.exports = InvalidReactorFormulaError;
@@ -0,0 +1,9 @@
1
+ const BasisTheoryReactorError = require('./BasisTheoryReactorError');
2
+
3
+ class RateLimitError extends BasisTheoryReactorError {
4
+ constructor(data) {
5
+ super('Rate Limit Exceeded', 429, data);
6
+ }
7
+ }
8
+
9
+ module.exports = RateLimitError;
@@ -0,0 +1,9 @@
1
+ const BasisTheoryReactorError = require('./BasisTheoryReactorError');
2
+
3
+ class ReactorRuntimeError extends BasisTheoryReactorError {
4
+ constructor(error) {
5
+ super('Reactor Runtime Error', 500, error);
6
+ }
7
+ }
8
+
9
+ module.exports = ReactorRuntimeError;
@@ -0,0 +1,13 @@
1
+ const AuthenticationError = require('./AuthenticationError');
2
+ const BadRequestError = require('./BadRequestError');
3
+ const InvalidCardError = require('./InvalidCardError');
4
+ const RateLimitError = require('./RateLimitError');
5
+ const ReactorRuntimeError = require('./ReactorRuntimeError');
6
+
7
+ module.exports = {
8
+ AuthenticationError,
9
+ BadRequestError,
10
+ InvalidCardError,
11
+ RateLimitError,
12
+ ReactorRuntimeError,
13
+ };
package/src/index.js ADDED
@@ -0,0 +1,5 @@
1
+ const errors = require('./errors');
2
+
3
+ module.exports = {
4
+ ...errors,
5
+ };