Skip to content

Commit

Permalink
Revert "fix: add keep-alive to connections (#16)"
Browse files Browse the repository at this point in the history
This reverts commit 38b45ab.
  • Loading branch information
wa0x6e committed Sep 7, 2023
1 parent 38b45ab commit 93fa464
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 35 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/publish-npm.yml

This file was deleted.

6 changes: 0 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,5 @@ on: [push]

jobs:
test:
strategy:
matrix:
target: ['16', '18', '20']

uses: snapshot-labs/actions/.github/workflows/test.yml@main
secrets: inherit
with:
target: ${{ matrix.target }}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@snapshot-labs/pineapple",
"version": "0.3.0",
"version": "0.2.0",
"license": "MIT",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand All @@ -18,7 +18,7 @@
},
"prettier": "@snapshot-labs/prettier-config",
"dependencies": {
"node-fetch": "^2.7.0"
"cross-fetch": "^3.1.5"
},
"devDependencies": {
"@snapshot-labs/eslint-config": "^0.1.0-beta.9",
Expand Down
11 changes: 2 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import fetch from 'node-fetch';
import http from 'node:http';
import https from 'node:https';
import fetch from 'cross-fetch';

const PINEAPPLE_URL = 'https://pineapple.fyi';
const agentOptions = { keepAlive: true };

export async function pin(json: any, url: string = PINEAPPLE_URL) {
const init = {
Expand All @@ -17,11 +14,7 @@ export async function pin(json: any, url: string = PINEAPPLE_URL) {
method: 'pin',
params: json,
id: null
}),
agent:
new URL(url).protocol === 'http:'
? new http.Agent(agentOptions)
: new https.Agent(agentOptions)
})
};
const res = await fetch(url, init);
const content = await res.json();
Expand Down
2 changes: 1 addition & 1 deletion test/upload.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('upload()', () => {
formData.append('file', createReadStream(path.join(__dirname, './fixtures/valid.png')));
const receipt = await upload(formData);
expect(receipt.provider).toBe('4everland');
expect(receipt.cid).toBe('bafkreidxvfyqu6l3tb3y5gi2nq5zqyincpev2rangnv7nmaocrk7q3o2fi');
expect(receipt.cid).toBe('bafkreibenzwnm4pckgeqdyzlwnxemfavkofaynnpxj6o23oojcfe77hvte');
}, 30e3);
});

Expand Down
21 changes: 14 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,13 @@ convert-source-map@^1.4.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0:
dependencies:
safe-buffer "~5.1.1"

cross-fetch@^3.1.5:
version "3.1.5"
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f"
integrity sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==
dependencies:
node-fetch "2.6.7"

cross-spawn@^7.0.2, cross-spawn@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
Expand Down Expand Up @@ -2725,10 +2732,10 @@ natural-compare@^1.4.0:
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==

node-fetch@^2.7.0:
version "2.7.0"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d"
integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==
node-fetch@2.6.7:
version "2.6.7"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==
dependencies:
whatwg-url "^5.0.0"

Expand Down Expand Up @@ -3320,7 +3327,7 @@ tr46@^2.1.0:
tr46@~0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==
integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=

ts-jest@^27.1.4:
version "27.1.5"
Expand Down Expand Up @@ -3452,7 +3459,7 @@ walker@^1.0.7:
webidl-conversions@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==
integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=

webidl-conversions@^5.0.0:
version "5.0.0"
Expand All @@ -3479,7 +3486,7 @@ whatwg-mimetype@^2.3.0:
whatwg-url@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"
integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==
integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0=
dependencies:
tr46 "~0.0.3"
webidl-conversions "^3.0.0"
Expand Down

0 comments on commit 93fa464

Please sign in to comment.