Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit e871d6e

Browse files
authored
Revert "feat: add typeScript support (#3236)"
This reverts commit be26dd7.
1 parent be26dd7 commit e871d6e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+99
-596
lines changed

docs/core-api/FILES.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ One of `path` or `content` _must_ be passed.
143143
`FileContent` is one of the following types:
144144

145145
```js
146-
Uint8Array | Blob | String | Iterable<Uint8Array> | Iterable<number> | AsyncIterable<Uint8Array> | ReadableStream<Uint8Array>
146+
Uint8Array | Blob | String | Iterable<Uint8Array|Number> | AsyncIterable<Uint8Array> | ReadableStream<Uint8Array>
147147
```
148148

149149
`UnixTime` is one of the following types:
@@ -162,7 +162,7 @@ An optional object which may have the following keys:
162162

163163
| Name | Type | Default | Description |
164164
| ---- | ---- | ------- | ----------- |
165-
| chunker | `String` | `'size-262144'` | chunking algorithm used to build ipfs DAGs |
165+
| chunker | `String` | `'size-262144` | chunking algorithm used to build ipfs DAGs |
166166
| cidVersion | `Number` | `0` | the CID version to use when storing the data |
167167
| hashAlg | `String` | `'sha2-256'` | multihash hashing algorithm to use |
168168
| onlyHash | `boolean` | `false` | If true, will not add blocks to the blockstore |
@@ -178,7 +178,7 @@ An optional object which may have the following keys:
178178

179179
| Type | Description |
180180
| -------- | -------- |
181-
| `Promise<UnixFSEntry>` | A object describing the added data |
181+
| `UnixFSEntry` | A object describing the added data |
182182

183183
Each yielded object is of the form:
184184

@@ -226,7 +226,7 @@ Now [ipfs.io/ipfs/Qm..pg/myfile.txt](https://ipfs.io/ipfs/QmWXdjNC362aPDtwHPUE9o
226226

227227
| Name | Type | Description |
228228
| ---- | ---- | ----------- |
229-
| source | [FileStream<FileContent\|FileObject>](#filestream) | Data to import (see below) |
229+
| source | [FileStream<FileContent|FileObject>](#filestream) | Data to import (see below) |
230230

231231
##### FileStream
232232

@@ -242,7 +242,7 @@ An optional object which may have the following keys:
242242

243243
| Name | Type | Default | Description |
244244
| ---- | ---- | ------- | ----------- |
245-
| chunker | `String` | `'size-262144'` | chunking algorithm used to build ipfs DAGs |
245+
| chunker | `String` | `'size-262144` | chunking algorithm used to build ipfs DAGs |
246246
| cidVersion | `Number` | `0` | the CID version to use when storing the data |
247247
| enableShardingExperiment | `boolean` | `false` | allows to create directories with an unlimited number of entries currently size of unixfs directories is limited by the maximum block size. Note that this is an experimental feature |
248248
| hashAlg | `String` | `'sha2-256'` | multihash hashing algorithm to use |

docs/core-api/REPO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ An optional object which may have the following keys:
6868

6969
| Name | Type | Default | Description |
7070
| ---- | ---- | ------- | ----------- |
71-
| human | `boolean` | `false` | Return storage numbers in `MiB` |
71+
| options | `boolean` | `false` | Return storage numbers in `MiB` |
7272
| timeout | `Number` | `undefined` | A timeout in ms |
7373
| signal | [AbortSignal][] | `undefined` | Can be used to cancel any long running requests started as a result of this call |
7474

packages/ipfs-http-client/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@
185185
"shunkin <hiyoko.san.ipod@gmail.com>",
186186
"victorbjelkholm <victorbjelkholm@gmail.com>",
187187
"Łukasz Magiera <magik6k@users.noreply.github.com>",
188-
"Łukasz Magiera <magik6k@gmail.com>",
189-
"Xmader <xmader@outlook.com>"
188+
"Łukasz Magiera <magik6k@gmail.com>"
190189
]
191190
}

packages/ipfs-http-client/src/add-all.js

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,10 @@ const configure = require('./lib/configure')
66
const multipartRequest = require('./lib/multipart-request')
77
const toUrlSearchParams = require('./lib/to-url-search-params')
88
const anySignal = require('any-signal')
9-
const { AbortController } = require('abort-controller')
9+
const AbortController = require('abort-controller')
1010

1111
module.exports = configure((api) => {
12-
// eslint-disable-next-line valid-jsdoc
13-
/**
14-
* @type {import('../../ipfs/src/core/components/add-all').AddAll<import('.').HttpOptions>}
15-
*/
16-
async function * addAll (input, options = {}) {
12+
return async function * addAll (input, options = {}) {
1713
const progressFn = options.progress
1814

1915
// allow aborting requests on body errors
@@ -43,16 +39,8 @@ module.exports = configure((api) => {
4339
}
4440
}
4541
}
46-
return addAll
4742
})
4843

49-
/**
50-
* @typedef {import('../../ipfs/src/core/components/add-all').UnixFSEntry} UnixFSEntry
51-
*/
52-
53-
/**
54-
* @returns {UnixFSEntry}
55-
*/
5644
function toCoreInterface ({ name, hash, size, mode, mtime, mtimeNsecs }) {
5745
const output = {
5846
path: name,
@@ -71,6 +59,5 @@ function toCoreInterface ({ name, hash, size, mode, mtime, mtimeNsecs }) {
7159
}
7260
}
7361

74-
// @ts-ignore
7562
return output
7663
}

packages/ipfs-http-client/src/add.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,12 @@ const addAll = require('./add-all')
44
const last = require('it-last')
55
const configure = require('./lib/configure')
66

7-
/**
8-
* @typedef {import("./lib/core").ClientOptions} ClientOptions
9-
*/
10-
11-
// eslint-disable-next-line valid-jsdoc
12-
/**
13-
* @param {ClientOptions} options
14-
*/
157
module.exports = (options) => {
168
const all = addAll(options)
179

1810
return configure(() => {
19-
// eslint-disable-next-line valid-jsdoc
20-
/**
21-
* @type {import('../../ipfs/src/core/components/add').Add<import('.').HttpOptions>}
22-
*/
23-
async function add (input, options = {}) { // eslint-disable-line require-await
24-
// @ts-ignore
11+
return async function add (input, options = {}) { // eslint-disable-line require-await
2512
return last(all(input, options))
2613
}
27-
return add
2814
})(options)
2915
}

packages/ipfs-http-client/src/bitswap/stat.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ const configure = require('../lib/configure')
66
const toUrlSearchParams = require('../lib/to-url-search-params')
77

88
module.exports = configure(api => {
9-
// eslint-disable-next-line valid-jsdoc
10-
/**
11-
* @type {import('../../../ipfs/src/core/components/bitswap/stat').Stat<import('..').HttpOptions>}
12-
*/
13-
async function stat (options = {}) {
9+
return async (options = {}) => {
1410
const res = await api.post('bitswap/stat', {
1511
searchParams: toUrlSearchParams(options),
1612
timeout: options.timeout,
@@ -20,7 +16,6 @@ module.exports = configure(api => {
2016

2117
return toCoreInterface(await res.json())
2218
}
23-
return stat
2419
})
2520

2621
function toCoreInterface (res) {

packages/ipfs-http-client/src/bitswap/unwant.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ const configure = require('../lib/configure')
55
const toUrlSearchParams = require('../lib/to-url-search-params')
66

77
module.exports = configure(api => {
8-
// eslint-disable-next-line valid-jsdoc
9-
/**
10-
* @type {import('../../../ipfs/src/core/components/bitswap/unwant').Unwant<import('..').HttpOptions>}
11-
*/
12-
async function unwant (cid, options = {}) {
8+
return async (cid, options = {}) => {
139
const res = await api.post('bitswap/unwant', {
1410
timeout: options.timeout,
1511
signal: options.signal,
@@ -22,5 +18,4 @@ module.exports = configure(api => {
2218

2319
return res.json()
2420
}
25-
return unwant
2621
})

packages/ipfs-http-client/src/bitswap/wantlist-for-peer.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ const configure = require('../lib/configure')
55
const toUrlSearchParams = require('../lib/to-url-search-params')
66

77
module.exports = configure(api => {
8-
// eslint-disable-next-line valid-jsdoc
9-
/**
10-
* @type {import('../../../ipfs/src/core/components/bitswap/wantlist-for-peer').WantlistForPeer<import('..').HttpOptions>}
11-
*/
12-
async function wantlistForPeer (peerId, options = {}) {
8+
return async (peerId, options = {}) => {
139
peerId = typeof peerId === 'string' ? peerId : new CID(peerId).toString()
1410

1511
const res = await (await api.post('bitswap/wantlist', {
@@ -24,5 +20,4 @@ module.exports = configure(api => {
2420

2521
return (res.Keys || []).map(k => new CID(k['/']))
2622
}
27-
return wantlistForPeer
2823
})

packages/ipfs-http-client/src/bitswap/wantlist.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ const configure = require('../lib/configure')
55
const toUrlSearchParams = require('../lib/to-url-search-params')
66

77
module.exports = configure(api => {
8-
// eslint-disable-next-line valid-jsdoc
9-
/**
10-
* @type {import('../../../ipfs/src/core/components/bitswap/wantlist').WantlistFn<import('..').HttpOptions>}
11-
*/
12-
async function wantlist (options = {}) {
8+
return async (options = {}) => {
139
const res = await (await api.post('bitswap/wantlist', {
1410
timeout: options.timeout,
1511
signal: options.signal,
@@ -19,5 +15,4 @@ module.exports = configure(api => {
1915

2016
return (res.Keys || []).map(k => new CID(k['/']))
2117
}
22-
return wantlist
2318
})

packages/ipfs-http-client/src/block/get.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ const configure = require('../lib/configure')
66
const toUrlSearchParams = require('../lib/to-url-search-params')
77

88
module.exports = configure(api => {
9-
// eslint-disable-next-line valid-jsdoc
10-
/**
11-
* @type {import('../../../ipfs/src/core/components/block/get').BlockGet<import('..').HttpOptions>}
12-
*/
13-
async function get (cid, options = {}) {
9+
return async (cid, options = {}) => {
1410
cid = new CID(cid)
1511

1612
const res = await api.post('block/get', {
@@ -25,5 +21,4 @@ module.exports = configure(api => {
2521

2622
return new Block(new Uint8Array(await res.arrayBuffer()), cid)
2723
}
28-
return get
2924
})

0 commit comments

Comments
 (0)