@castleio/sdk 2.0.0 → 2.0.1
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/CHANGELOG.md +6 -0
- package/README.md +9 -0
- package/dist/package.json +21 -20
- package/dist/src/api/services/api.service.js.map +1 -1
- package/dist/src/configuraton.js +2 -5
- package/dist/src/configuraton.js.map +1 -1
- package/package.json +21 -20
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -34,6 +34,15 @@ import { Castle } from '@castleio/sdk';
|
|
|
34
34
|
const castle = new Castle({ apiSecret: 'YOUR SECRET HERE' });
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
+
When using setup without the modules:
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
const { Castle } = require('@castleio/sdk');
|
|
41
|
+
|
|
42
|
+
const castle = new Castle({ apiSecret: 'YOUR SECRET HERE' });
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
|
|
37
46
|
#### Config options
|
|
38
47
|
|
|
39
48
|
| Config option | Type | Default | Explanation |
|
package/dist/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "http://json.schemastore.org/package",
|
|
3
3
|
"name": "@castleio/sdk",
|
|
4
4
|
"description": "Castle SDK for Node",
|
|
5
|
-
"version": "2.0.
|
|
5
|
+
"version": "2.0.1",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"repository": "git@github.com:castle/castle-node.git",
|
|
8
8
|
"author": {
|
|
@@ -14,13 +14,11 @@
|
|
|
14
14
|
"private": false,
|
|
15
15
|
"scripts": {
|
|
16
16
|
"clean": "rimraf dist",
|
|
17
|
-
"lint-verify": "tslint -c tslint.json 'src/**/*.ts'",
|
|
18
|
-
"lint-fix": "tslint -c tslint.json --fix '{src,test}/**/*.ts'",
|
|
19
17
|
"build": "tsc",
|
|
20
18
|
"start": "tsc -w",
|
|
21
19
|
"test": "jest --runInBand",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
20
|
+
"lint-fix": "eslint --fix --quiet '{src,test}/**/*.{js,ts,tsx}' '*.{js,ts,tsx}'",
|
|
21
|
+
"lint-verify": "eslint '{src,test}/**/*.{js,ts,tsx}' '*.{js,ts,tsx}'",
|
|
24
22
|
"prepush": "yarn build && yarn lint-fix && yarn prettier-verify",
|
|
25
23
|
"prepublishOnly": "yarn build"
|
|
26
24
|
},
|
|
@@ -34,40 +32,43 @@
|
|
|
34
32
|
},
|
|
35
33
|
"devDependencies": {
|
|
36
34
|
"@types/fetch-mock": "7.3.5",
|
|
37
|
-
"@types/jest": "
|
|
35
|
+
"@types/jest": "29.2.0",
|
|
38
36
|
"@types/lodash.get": "4.4.7",
|
|
39
37
|
"@types/lodash.isempty": "4.4.7",
|
|
40
38
|
"@types/lodash.merge": "4.6.7",
|
|
41
39
|
"@types/lodash.pickby": "4.6.7",
|
|
42
40
|
"@types/lodash.reduce": "4.6.7",
|
|
43
|
-
"@types/
|
|
44
|
-
"@types/node": "18.6.1",
|
|
41
|
+
"@types/node": "18.11.6",
|
|
45
42
|
"@types/node-fetch": "2.6.2",
|
|
46
|
-
"@
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "5.41.0",
|
|
44
|
+
"@typescript-eslint/parser": "5.41.0",
|
|
45
|
+
"eslint": "8.26.0",
|
|
46
|
+
"eslint-config-prettier": "8.5.0",
|
|
47
|
+
"eslint-plugin-import": "2.26.0",
|
|
48
|
+
"eslint-plugin-prefer-arrow": "1.2.3",
|
|
49
|
+
"eslint-plugin-prettier": "4.2.1",
|
|
47
50
|
"fetch-mock": "9.11.0",
|
|
48
51
|
"husky": "8.0.1",
|
|
49
|
-
"jest": "
|
|
52
|
+
"jest": "29.2.2",
|
|
50
53
|
"mockdate": "3.0.5",
|
|
51
54
|
"prettier": "2.7.1",
|
|
52
55
|
"rimraf": "3.0.2",
|
|
53
|
-
"source-map-support": "
|
|
54
|
-
"
|
|
56
|
+
"source-map-support": "0.5.21",
|
|
57
|
+
"timeout-signal": "1.1.0",
|
|
58
|
+
"ts-jest": "29.0.3",
|
|
55
59
|
"ts-node": "10.9.1",
|
|
56
|
-
"
|
|
57
|
-
"tslint-config-prettier": "1.18.0",
|
|
58
|
-
"tslint-config-standard": "9.0.0",
|
|
59
|
-
"typescript": "4.7.4"
|
|
60
|
+
"typescript": "4.8.4"
|
|
60
61
|
},
|
|
61
62
|
"dependencies": {
|
|
62
63
|
"abort-controller": "^3.0.0",
|
|
63
|
-
"express": "4.18.
|
|
64
|
+
"express": "^4.18.2",
|
|
64
65
|
"lodash.get": "^4.4.2",
|
|
65
66
|
"lodash.isempty": "^4.4.0",
|
|
66
67
|
"lodash.merge": "^4.6.2",
|
|
67
68
|
"lodash.pickby": "^4.6.0",
|
|
68
69
|
"lodash.reduce": "^4.6.0",
|
|
69
|
-
"node-fetch": "
|
|
70
|
-
"pino": "^
|
|
71
|
-
"pino-pretty": "^
|
|
70
|
+
"node-fetch": "< 3",
|
|
71
|
+
"pino": "^8.7.0",
|
|
72
|
+
"pino-pretty": "^9.1.1"
|
|
72
73
|
}
|
|
73
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.service.js","sourceRoot":"","sources":["../../../../src/api/services/api.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"api.service.js","sourceRoot":"","sources":["../../../../src/api/services/api.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,wDAAoE;AACpE,8DAA2D;AAE3D,4DAA+B;AAElB,QAAA,UAAU,GAAG;IACxB,IAAI,EAAE,CACJ,UAA2B,EAC3B,EAAE,UAAU,EAAE,cAAc,EAAE,EAC9B,aAA4B,EACd,EAAE;QAChB,MAAM,OAAO,GAAG,aAAa,CAAC,aAAa,IAAI,oBAAK,CAAC;QAErD,IAAI,QAAkB,CAAC;QACvB,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YAC9B,UAAU,CAAC,KAAK,EAAE,CAAC;QACrB,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;QAE1B,IAAI;YACF,QAAQ,GAAG,MAAM,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;SACtD;QAAC,OAAO,GAAG,EAAE;YACZ,6BAAa,CAAC,IAAI,CAChB,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,EAAE,EACnC,aAAa,CAAC,MAAM,CACrB,CAAC;YACF,MAAM,GAAG,CAAC;SACX;gBAAS;YACR,YAAY,CAAC,OAAO,CAAC,CAAC;SACvB;QAED,MAAM,iBAAiB,GAAG,MAAM,wCAA0B,CAAC,IAAI,CAC7D,UAAU,EACV,cAAc,EACd,QAAQ,EACR,aAAa,CAAC,MAAM,CACrB,CAAC;QAEF,OAAO,iBAAiB,CAAC;IAC3B,CAAC,CAAA;CACF,CAAC"}
|
package/dist/src/configuraton.js
CHANGED
|
@@ -5,16 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Configuration = void 0;
|
|
7
7
|
const pino_1 = __importDefault(require("pino"));
|
|
8
|
+
const pino_pretty_1 = __importDefault(require("pino-pretty"));
|
|
8
9
|
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
9
10
|
const constants_1 = require("./constants");
|
|
10
11
|
const errors_1 = require("./errors");
|
|
11
12
|
const failover_strategy_1 = require("./failover/models/failover-strategy");
|
|
12
13
|
class Configuration {
|
|
13
|
-
constructor({ apiSecret, baseUrl = constants_1.DEFAULT_API_URL, timeout = constants_1.DEFAULT_TIMEOUT, allowlisted = [], denylisted = [], overrideFetch = node_fetch_1.default, failoverStrategy = failover_strategy_1.FailoverStrategy.allow, doNotTrack = false, ipHeaders = [], trustedProxies = [], trustProxyChain = false, trustedProxyDepth = 0, logger = (0, pino_1.default)({
|
|
14
|
-
prettyPrint: {
|
|
15
|
-
levelFirst: true,
|
|
16
|
-
},
|
|
17
|
-
}), }) {
|
|
14
|
+
constructor({ apiSecret, baseUrl = constants_1.DEFAULT_API_URL, timeout = constants_1.DEFAULT_TIMEOUT, allowlisted = [], denylisted = [], overrideFetch = node_fetch_1.default, failoverStrategy = failover_strategy_1.FailoverStrategy.allow, doNotTrack = false, ipHeaders = [], trustedProxies = [], trustProxyChain = false, trustedProxyDepth = 0, logger = (0, pino_1.default)((0, pino_pretty_1.default)({ levelFirst: true })), }) {
|
|
18
15
|
if (!apiSecret) {
|
|
19
16
|
throw new errors_1.ConfigurationError('Castle: Unable to instantiate Castle client, API secret is missing.');
|
|
20
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuraton.js","sourceRoot":"","sources":["../../src/configuraton.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,4DAA+B;AAE/B,2CAA+D;AAC/D,qCAA8C;AAC9C,2EAAuE;AAkBvE,MAAa,aAAa;IAexB,YAAY,EACV,SAAS,EACT,OAAO,GAAG,2BAAe,EACzB,OAAO,GAAG,2BAAe,EACzB,WAAW,GAAG,EAAE,EAChB,UAAU,GAAG,EAAE,EACf,aAAa,GAAG,oBAAK,EACrB,gBAAgB,GAAG,oCAAgB,CAAC,KAAK,EACzC,UAAU,GAAG,KAAK,EAClB,SAAS,GAAG,EAAE,EACd,cAAc,GAAG,EAAE,EACnB,eAAe,GAAG,KAAK,EACvB,iBAAiB,GAAG,CAAC,EACrB,MAAM,GAAG,IAAA,cAAI,EAAC
|
|
1
|
+
{"version":3,"file":"configuraton.js","sourceRoot":"","sources":["../../src/configuraton.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,8DAAiC;AACjC,4DAA+B;AAE/B,2CAA+D;AAC/D,qCAA8C;AAC9C,2EAAuE;AAkBvE,MAAa,aAAa;IAexB,YAAY,EACV,SAAS,EACT,OAAO,GAAG,2BAAe,EACzB,OAAO,GAAG,2BAAe,EACzB,WAAW,GAAG,EAAE,EAChB,UAAU,GAA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lDD,sCAkDC"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "http://json.schemastore.org/package",
|
|
3
3
|
"name": "@castleio/sdk",
|
|
4
4
|
"description": "Castle SDK for Node",
|
|
5
|
-
"version": "2.0.
|
|
5
|
+
"version": "2.0.1",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"repository": "git@github.com:castle/castle-node.git",
|
|
8
8
|
"author": {
|
|
@@ -14,13 +14,11 @@
|
|
|
14
14
|
"private": false,
|
|
15
15
|
"scripts": {
|
|
16
16
|
"clean": "rimraf dist",
|
|
17
|
-
"lint-verify": "tslint -c tslint.json 'src/**/*.ts'",
|
|
18
|
-
"lint-fix": "tslint -c tslint.json --fix '{src,test}/**/*.ts'",
|
|
19
17
|
"build": "tsc",
|
|
20
18
|
"start": "tsc -w",
|
|
21
19
|
"test": "jest --runInBand",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
20
|
+
"lint-fix": "eslint --fix --quiet '{src,test}/**/*.{js,ts,tsx}' '*.{js,ts,tsx}'",
|
|
21
|
+
"lint-verify": "eslint '{src,test}/**/*.{js,ts,tsx}' '*.{js,ts,tsx}'",
|
|
24
22
|
"prepush": "yarn build && yarn lint-fix && yarn prettier-verify",
|
|
25
23
|
"prepublishOnly": "yarn build"
|
|
26
24
|
},
|
|
@@ -34,40 +32,43 @@
|
|
|
34
32
|
},
|
|
35
33
|
"devDependencies": {
|
|
36
34
|
"@types/fetch-mock": "7.3.5",
|
|
37
|
-
"@types/jest": "
|
|
35
|
+
"@types/jest": "29.2.0",
|
|
38
36
|
"@types/lodash.get": "4.4.7",
|
|
39
37
|
"@types/lodash.isempty": "4.4.7",
|
|
40
38
|
"@types/lodash.merge": "4.6.7",
|
|
41
39
|
"@types/lodash.pickby": "4.6.7",
|
|
42
40
|
"@types/lodash.reduce": "4.6.7",
|
|
43
|
-
"@types/
|
|
44
|
-
"@types/node": "18.6.1",
|
|
41
|
+
"@types/node": "18.11.6",
|
|
45
42
|
"@types/node-fetch": "2.6.2",
|
|
46
|
-
"@
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "5.41.0",
|
|
44
|
+
"@typescript-eslint/parser": "5.41.0",
|
|
45
|
+
"eslint": "8.26.0",
|
|
46
|
+
"eslint-config-prettier": "8.5.0",
|
|
47
|
+
"eslint-plugin-import": "2.26.0",
|
|
48
|
+
"eslint-plugin-prefer-arrow": "1.2.3",
|
|
49
|
+
"eslint-plugin-prettier": "4.2.1",
|
|
47
50
|
"fetch-mock": "9.11.0",
|
|
48
51
|
"husky": "8.0.1",
|
|
49
|
-
"jest": "
|
|
52
|
+
"jest": "29.2.2",
|
|
50
53
|
"mockdate": "3.0.5",
|
|
51
54
|
"prettier": "2.7.1",
|
|
52
55
|
"rimraf": "3.0.2",
|
|
53
|
-
"source-map-support": "
|
|
54
|
-
"
|
|
56
|
+
"source-map-support": "0.5.21",
|
|
57
|
+
"timeout-signal": "1.1.0",
|
|
58
|
+
"ts-jest": "29.0.3",
|
|
55
59
|
"ts-node": "10.9.1",
|
|
56
|
-
"
|
|
57
|
-
"tslint-config-prettier": "1.18.0",
|
|
58
|
-
"tslint-config-standard": "9.0.0",
|
|
59
|
-
"typescript": "4.7.4"
|
|
60
|
+
"typescript": "4.8.4"
|
|
60
61
|
},
|
|
61
62
|
"dependencies": {
|
|
62
63
|
"abort-controller": "^3.0.0",
|
|
63
|
-
"express": "4.18.
|
|
64
|
+
"express": "^4.18.2",
|
|
64
65
|
"lodash.get": "^4.4.2",
|
|
65
66
|
"lodash.isempty": "^4.4.0",
|
|
66
67
|
"lodash.merge": "^4.6.2",
|
|
67
68
|
"lodash.pickby": "^4.6.0",
|
|
68
69
|
"lodash.reduce": "^4.6.0",
|
|
69
|
-
"node-fetch": "
|
|
70
|
-
"pino": "^
|
|
71
|
-
"pino-pretty": "^
|
|
70
|
+
"node-fetch": "< 3",
|
|
71
|
+
"pino": "^8.7.0",
|
|
72
|
+
"pino-pretty": "^9.1.1"
|
|
72
73
|
}
|
|
73
74
|
}
|