@helia/verified-fetch-interop 1.26.1 → 1.26.3
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort-handling.spec.d.ts","sourceRoot":"","sources":["../../src/abort-handling.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* eslint-env mocha */
|
|
2
|
+
import { createVerifiedFetch } from '@helia/verified-fetch';
|
|
3
|
+
import { expect } from 'aegir/chai';
|
|
4
|
+
describe('verified-fetch abort handling', () => {
|
|
5
|
+
let verifiedFetch;
|
|
6
|
+
before(async () => {
|
|
7
|
+
if (process.env.KUBO_DIRECT_RETRIEVAL_ROUTER == null || process.env.KUBO_DIRECT_RETRIEVAL_ROUTER === '') {
|
|
8
|
+
throw new Error('KUBO_DIRECT_RETRIEVAL_ROUTER environment variable is required');
|
|
9
|
+
}
|
|
10
|
+
verifiedFetch = await createVerifiedFetch({
|
|
11
|
+
gateways: [process.env.KUBO_DIRECT_RETRIEVAL_ROUTER],
|
|
12
|
+
routers: [process.env.KUBO_DIRECT_RETRIEVAL_ROUTER],
|
|
13
|
+
allowInsecure: true,
|
|
14
|
+
allowLocal: true
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
after(async () => {
|
|
18
|
+
await verifiedFetch.stop();
|
|
19
|
+
});
|
|
20
|
+
it('should handle aborts properly', async function () {
|
|
21
|
+
this.timeout(2000);
|
|
22
|
+
const controller = new AbortController();
|
|
23
|
+
const timeout = setTimeout(() => {
|
|
24
|
+
controller.abort();
|
|
25
|
+
}, 70);
|
|
26
|
+
const fetchPromise = verifiedFetch('ipfs://QmdmQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7RgQm/1 - Barrel - Part 1/1 - Barrel - Part 1 - alt.txt', {
|
|
27
|
+
signal: controller.signal
|
|
28
|
+
});
|
|
29
|
+
await expect(fetchPromise).to.eventually.be.rejected.with.property('name', 'AbortError');
|
|
30
|
+
clearTimeout(timeout);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=abort-handling.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort-handling.spec.js","sourceRoot":"","sources":["../../src/abort-handling.spec.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAGnC,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;IAC7C,IAAI,aAA4B,CAAA;IAChC,MAAM,CAAC,KAAK,IAAI,EAAE;QAChB,IAAI,OAAO,CAAC,GAAG,CAAC,4BAA4B,IAAI,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,4BAA4B,KAAK,EAAE,EAAE,CAAC;YACxG,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAA;QAClF,CAAC;QAED,aAAa,GAAG,MAAM,mBAAmB,CAAC;YACxC,QAAQ,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC;YACpD,OAAO,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC;YACnD,aAAa,EAAE,IAAI;YACnB,UAAU,EAAE,IAAI;SACjB,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,KAAK,CAAC,KAAK,IAAI,EAAE;QACf,MAAM,aAAa,CAAC,IAAI,EAAE,CAAA;IAC5B,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,+BAA+B,EAAE,KAAK;QACvC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QAClB,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAA;QACxC,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YAC9B,UAAU,CAAC,KAAK,EAAE,CAAA;QACpB,CAAC,EAAE,EAAE,CAAC,CAAA;QAEN,MAAM,YAAY,GAAG,aAAa,CAAC,yGAAyG,EAAE;YAC5I,MAAM,EAAE,UAAU,CAAC,MAAM;SAC1B,CAAC,CAAA;QACF,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;QACxF,YAAY,CAAC,OAAO,CAAC,CAAA;IACvB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helia/verified-fetch-interop",
|
|
3
|
-
"version": "1.26.
|
|
3
|
+
"version": "1.26.3",
|
|
4
4
|
"description": "Interop tests for @helia/verified-fetch",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/ipfs/helia-verified-fetch/tree/main/packages/interop#readme",
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
"dependencies": {
|
|
147
147
|
"@helia/delegated-routing-v1-http-api-server": "^4.0.6",
|
|
148
148
|
"@helia/verified-fetch": "^2.0.0",
|
|
149
|
-
"aegir": "^47.0.
|
|
149
|
+
"aegir": "^47.0.21",
|
|
150
150
|
"execa": "^9.5.3",
|
|
151
151
|
"glob": "^11.0.2",
|
|
152
152
|
"ipfsd-ctl": "^15.0.2",
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* eslint-env mocha */
|
|
2
|
+
import { createVerifiedFetch } from '@helia/verified-fetch'
|
|
3
|
+
import { expect } from 'aegir/chai'
|
|
4
|
+
import type { VerifiedFetch } from '@helia/verified-fetch'
|
|
5
|
+
|
|
6
|
+
describe('verified-fetch abort handling', () => {
|
|
7
|
+
let verifiedFetch: VerifiedFetch
|
|
8
|
+
before(async () => {
|
|
9
|
+
if (process.env.KUBO_DIRECT_RETRIEVAL_ROUTER == null || process.env.KUBO_DIRECT_RETRIEVAL_ROUTER === '') {
|
|
10
|
+
throw new Error('KUBO_DIRECT_RETRIEVAL_ROUTER environment variable is required')
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
verifiedFetch = await createVerifiedFetch({
|
|
14
|
+
gateways: [process.env.KUBO_DIRECT_RETRIEVAL_ROUTER],
|
|
15
|
+
routers: [process.env.KUBO_DIRECT_RETRIEVAL_ROUTER],
|
|
16
|
+
allowInsecure: true,
|
|
17
|
+
allowLocal: true
|
|
18
|
+
})
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
after(async () => {
|
|
22
|
+
await verifiedFetch.stop()
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('should handle aborts properly', async function () {
|
|
26
|
+
this.timeout(2000)
|
|
27
|
+
const controller = new AbortController()
|
|
28
|
+
const timeout = setTimeout(() => {
|
|
29
|
+
controller.abort()
|
|
30
|
+
}, 70)
|
|
31
|
+
|
|
32
|
+
const fetchPromise = verifiedFetch('ipfs://QmdmQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7RgQm/1 - Barrel - Part 1/1 - Barrel - Part 1 - alt.txt', {
|
|
33
|
+
signal: controller.signal
|
|
34
|
+
})
|
|
35
|
+
await expect(fetchPromise).to.eventually.be.rejected.with.property('name', 'AbortError')
|
|
36
|
+
clearTimeout(timeout)
|
|
37
|
+
})
|
|
38
|
+
})
|