@snapshot-labs/keycard
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -0,1 +1,5 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import http from 'node:http'; | ||
import https from 'node:https'; | ||
type KeycardParams = { | ||
@@ -16,2 +20,3 @@ app: string; | ||
URL: string | URL; | ||
agent?: http.Agent | https.Agent; | ||
configured: boolean; | ||
@@ -18,0 +23,0 @@ private secret; |
@@ -7,3 +7,5 @@ "use strict"; | ||
exports.Keycard = void 0; | ||
const cross_fetch_1 = __importDefault(require("cross-fetch")); | ||
const node_fetch_1 = __importDefault(require("node-fetch")); | ||
const node_http_1 = __importDefault(require("node:http")); | ||
const node_https_1 = __importDefault(require("node:https")); | ||
const utils_1 = require("./utils"); | ||
@@ -15,2 +17,3 @@ const API_URL = 'https://locahost:3007'; | ||
URL; | ||
agent; | ||
configured = false; | ||
@@ -34,2 +37,7 @@ secret; | ||
} | ||
const agentOptions = { keepAlive: true }; | ||
this.agent = | ||
new URL(this.URL).protocol === 'http:' | ||
? new node_http_1.default.Agent(agentOptions) | ||
: new node_https_1.default.Agent(agentOptions); | ||
console.log('[keycard] Initializing keycard...'); | ||
@@ -86,3 +94,3 @@ this.run(); | ||
const { URL, app, secret } = this; | ||
const result = await (0, cross_fetch_1.default)(URL, { | ||
const result = await (0, node_fetch_1.default)(URL, { | ||
method: 'POST', | ||
@@ -98,3 +106,5 @@ headers: { | ||
params: { app, ...params } | ||
}) | ||
}), | ||
timeout: 5e3, | ||
agent: this.agent | ||
}); | ||
@@ -101,0 +111,0 @@ return result.json(); |
{ | ||
"name": "@snapshot-labs/keycard", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"license": "MIT", | ||
@@ -18,3 +18,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"cross-fetch": "^3.1.5" | ||
"node-fetch": "^2.7.0" | ||
}, | ||
@@ -21,0 +21,0 @@ "eslintConfig": { |
@@ -1,2 +0,4 @@ | ||
import fetch from 'cross-fetch'; | ||
import fetch from 'node-fetch'; | ||
import http from 'node:http'; | ||
import https from 'node:https'; | ||
import { sleep } from './utils'; | ||
@@ -25,2 +27,3 @@ | ||
URL: string | URL; | ||
agent?: http.Agent | https.Agent; | ||
configured = false; | ||
@@ -46,2 +49,9 @@ private secret: string | undefined; | ||
} | ||
const agentOptions = { keepAlive: true }; | ||
this.agent = | ||
new URL(this.URL).protocol === 'http:' | ||
? new http.Agent(agentOptions) | ||
: new https.Agent(agentOptions); | ||
console.log('[keycard] Initializing keycard...'); | ||
@@ -121,3 +131,5 @@ this.run(); | ||
params: { app, ...params } | ||
}) | ||
}), | ||
timeout: 5e3, | ||
agent: this.agent | ||
}); | ||
@@ -124,0 +136,0 @@ return result.json(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9758
276
1
+ Addednode-fetch@^2.7.0
- Removedcross-fetch@^3.1.5
- Removedcross-fetch@3.1.8(transitive)