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

Commit 0ee2d5b

Browse files
committed
chore: update aegir config
1 parent 89b939a commit 0ee2d5b

Some content is hidden

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

65 files changed

+277
-234
lines changed

examples/custom-ipfs-repo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"dependencies": {
1313
"datastore-fs": "^2.0.0",
1414
"ipfs": "^0.54.3",
15-
"ipfs-repo": "^8.0.0",
15+
"ipfs-repo": "^9.0.0",
1616
"it-all": "^1.0.4"
1717
},
1818
"devDependencies": {

packages/interface-ipfs-core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@
4545
"cids": "^1.1.5",
4646
"delay": "^4.4.0",
4747
"dirty-chai": "^2.0.1",
48-
"err-code": "^2.0.3",
48+
"err-code": "^3.0.1",
4949
"ipfs-unixfs": "^3.0.1",
5050
"ipfs-unixfs-importer": "^6.0.1",
5151
"ipfs-utils": "^6.0.1",
5252
"ipld-block": "^0.11.0",
5353
"ipld-dag-cbor": "^0.17.0",
5454
"ipld-dag-pb": "^0.21.0",
5555
"ipns": "^0.8.0",
56-
"is-ipfs": "^2.0.0",
56+
"is-ipfs": "^4.0.0",
5757
"iso-random-stream": "^1.1.1",
5858
"it-all": "^1.0.4",
5959
"it-buffer-stream": "^1.0.5",

packages/ipfs-cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
"cid-tool": "^1.0.0",
3333
"cids": "^1.1.5",
3434
"debug": "^4.1.1",
35-
"err-code": "^2.0.3",
35+
"err-code": "^3.0.1",
3636
"execa": "^5.0.0",
3737
"get-folder-size": "^2.0.1",
3838
"ipfs-core": "^0.5.3",
3939
"ipfs-core-utils": "^0.7.2",
4040
"ipfs-daemon": "^0.5.3",
4141
"ipfs-http-client": "^49.0.3",
42-
"ipfs-repo": "^8.0.0",
42+
"ipfs-repo": "^9.0.0",
4343
"ipfs-utils": "^6.0.1",
4444
"ipld-dag-cbor": "^0.17.0",
4545
"ipld-dag-pb": "^0.21.0",

packages/ipfs-cli/tsconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
2-
"extends": "../../tsconfig.json",
2+
"extends": "aegir/src/config/tsconfig.aegir.json",
33
"compilerOptions": {
4-
"outDir": "dist"
4+
"outDir": "dist",
5+
"importsNotUsedAsValues": "preserve"
56
},
67
"include": [
78
"src",

packages/ipfs-client/tsconfig.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
{
2-
"extends": "../../tsconfig.json",
2+
"extends": "aegir/src/config/tsconfig.aegir.json",
33
"compilerOptions": {
4-
"outDir": "dist"
4+
"outDir": "dist",
5+
"importsNotUsedAsValues": "preserve"
56
},
7+
"include": [
8+
"src",
9+
"package.json"
10+
],
611
"references": [
712
{
813
"path": "../ipfs-http-client"
914
},
1015
{
1116
"path": "../ipfs-grpc-client"
1217
}
13-
],
14-
"include": [
15-
"src",
16-
"package.json"
1718
]
1819
}

packages/ipfs-core-types/src/files.ts renamed to packages/ipfs-core-types/src/files.d.ts

Lines changed: 14 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import CID from 'cids'
22
import { AwaitIterable } from './basic'
3+
import { Mtime } from 'ipfs-unixfs'
34

45
export type Entry<Content extends AsyncIterable<Uint8Array>|Blob> =
56
| FileEntry<Content>
67
| DirectoryEntry
78

89
export interface BaseEntry {
910
path: string
10-
mode?: Mode
11-
mtime?: MTime
11+
mode?: number
12+
mtime?: Mtime
1213
}
1314
export interface FileEntry <Content extends AsyncIterable<Uint8Array>|Blob> extends BaseEntry {
1415
content?: Content
@@ -58,7 +59,7 @@ export type ToContent =
5859

5960
/**
6061
* Timestamp representation in arbitrary (supported) in representations. It is
61-
* used in input positions and usurally get's normalised to `MTime` before use.
62+
* used in input positions and usually gets normalised to `MTime` before use.
6263
*/
6364
export type ToMTime =
6465
| Date
@@ -82,8 +83,8 @@ export interface File {
8283
* File content
8384
*/
8485
readonly content?: AsyncIterable<Uint8Array>
85-
mode?: Mode
86-
mtime?: MTime
86+
mode?: number
87+
mtime?: Mtime
8788
size?: number
8889
depth?: number
8990
}
@@ -96,8 +97,8 @@ export interface Directory {
9697
* Directory path
9798
*/
9899
path: string
99-
mode?: Mode
100-
mtime?: MTime
100+
mode?: number
101+
mtime?: Mtime
101102
size?: number
102103
depth?: number
103104
}
@@ -114,32 +115,6 @@ export interface InputFile extends BaseFile {
114115
unixfs: undefined
115116
}
116117

117-
export interface UnixFSFile extends BaseFile {
118-
content: () => AsyncIterable<Uint8Array>
119-
unixfs: UnixFS
120-
}
121-
122-
export interface UnixFSEntry {
123-
path: string
124-
cid: CID
125-
mode: Mode
126-
mtime: MTime
127-
size: number
128-
}
129-
130-
export interface MTime {
131-
/**
132-
* The number of seconds since(positive) or before (negative) the Unix Epoch
133-
* began.
134-
*/
135-
readonly secs: number
136-
137-
/**
138-
* The number of nanoseconds since the last full second
139-
*/
140-
readonly nsecs: number
141-
}
142-
143118
export interface MTimeLike {
144119
/**
145120
* The number of seconds since(positive) or before (negative) the Unix Epoch
@@ -153,20 +128,15 @@ export interface MTimeLike {
153128
nsecs?: number
154129
}
155130

156-
interface UnixFS {
157-
readonly type: 'directory' | 'file' | 'dir'
158-
readonly mode: Mode
159-
readonly mtime: MTime
160-
161-
fileSize: () => number
162-
content: () => AsyncIterable<Uint8Array>
163-
}
164-
165131
/**
166132
* Time representation as tuple of two integers, as per the output of
167133
* [`process.hrtime()`](https://nodejs.org/dist/latest/docs/api/process.html#process_process_hrtime_time).
168134
*/
169135
type HRTime = [number, number]
170136

171-
// It's just a named type alias, but it better captures intent.
172-
export type Mode = number
137+
export interface BrowserImportCandidate {
138+
path?: string,
139+
content?: Blob,
140+
mtime?: Mtime,
141+
mode?: number
142+
}

packages/ipfs-core-types/src/root.ts renamed to packages/ipfs-core-types/src/root.d.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
import { AbortOptions } from './basic'
22
import { Options as PreloadOptions } from './preload'
3-
import { ImportSource, IPFSEntry, ToEntry, UnixFSEntry } from './files'
3+
import { ImportSource, ToEntry, IPFSEntry } from './files'
44
import CID, { CIDVersion } from 'cids'
5+
import { ImportResult } from 'ipfs-unixfs-importer'
56

67
export interface RootAPI {
7-
add: (entry: ToEntry, options?: AddOptions) => Promise<UnixFSEntry>
8-
addAll: (source: ImportSource, options?: AddAllOptions & AbortOptions) => AsyncIterable<UnixFSEntry>
8+
add: (entry: ToEntry, options?: AddOptions) => Promise<ImportResult>
9+
addAll: RootAddAll
910
cat: (ipfsPath: IPFSPath, options?: CatOptions) => AsyncIterable<Uint8Array>
1011
get: (ipfsPath: IPFSPath, options?: GetOptions) => AsyncIterable<IPFSEntry>
11-
1212
ls: (ipfsPath: IPFSPath, options?: ListOptions) => AsyncIterable<IPFSEntry>
1313
}
1414

15+
export type RootAddAll = (source: ImportSource, options?: AddAllOptions & AbortOptions) => AsyncIterable<ImportResult>
16+
1517
export interface AddProgressFn { (bytes: number, path: string): void }
1618

1719
export interface AddOptions extends AbortOptions {
@@ -65,6 +67,10 @@ export interface AddOptions extends AbortOptions {
6567
*/
6668
wrapWithDirectory?: boolean
6769

70+
/**
71+
* Whether to preload all blocks created during this operation
72+
*/
73+
preload?: boolean
6874
}
6975

7076
export interface AddAllOptions extends AddOptions {

packages/ipfs-core-types/tsconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
2-
"extends": "../../tsconfig.json",
2+
"extends": "aegir/src/config/tsconfig.aegir.json",
33
"compilerOptions": {
4-
"noImplicitAny": true
4+
"outDir": "dist",
5+
"importsNotUsedAsValues": "preserve"
56
},
67
"include": [
78
"src"

packages/ipfs-core-utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"blob-to-it": "^1.0.1",
4141
"browser-readablestream-to-it": "^1.0.1",
4242
"cids": "^1.1.5",
43-
"err-code": "^2.0.3",
43+
"err-code": "^3.0.1",
4444
"ipfs-core-types": "^0.3.1",
4545
"ipfs-utils": "^6.0.1",
4646
"it-all": "^1.0.4",

packages/ipfs-core-utils/src/files/format-mode.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ const S_IROTH = parseInt('4', 8) // others have read permission
1616
const S_IWOTH = parseInt('2', 8) // others have write permission
1717
const S_IXOTH = parseInt('1', 8) // others have execute permission
1818

19+
/**
20+
* @param {number} mode
21+
* @param {number} perm
22+
* @param {string} type
23+
* @param {string[]} output
24+
*/
1925
function checkPermission (mode, perm, type, output) {
2026
if ((mode & perm) === perm) {
2127
output.push(type)
@@ -25,8 +31,7 @@ function checkPermission (mode, perm, type, output) {
2531
}
2632

2733
/**
28-
*
29-
* @param {import('ipfs-core-types/src/files').Mode} mode
34+
* @param {number} mode
3035
* @param {boolean} isDirectory
3136
* @returns {string}
3237
*/

packages/ipfs-core-utils/src/files/format-mtime.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
'use strict'
22

33
/**
4-
* @param {import('ipfs-core-types/src/files').MTime} mtime
4+
* @param {import('ipfs-unixfs').Mtime} mtime
55
* @returns {string}
66
*/
77
function formatMtime (mtime) {
88
if (mtime == null) {
99
return '-'
1010
}
1111

12-
const date = new Date((mtime.secs * 1000) + Math.round(mtime.nsecs / 1000))
12+
const date = new Date((mtime.secs * 1000) + Math.round((mtime.nsecs || 0) / 1000))
1313

1414
return date.toLocaleDateString(Intl.DateTimeFormat().resolvedOptions().locale, {
1515
year: 'numeric',

packages/ipfs-core-utils/src/files/normalise-input/index.browser.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
const normaliseContent = require('./normalise-content.browser')
44
const normaliseInput = require('./normalise-input')
55

6+
/**
7+
* @typedef {import('ipfs-core-types/src/files').ImportSource} ImportSource
8+
* @typedef {import('ipfs-core-types/src/files').BrowserImportCandidate} BrowserImportCandidate
9+
*/
10+
611
/**
712
* Transforms any of the `ipfs.add` input types into
813
*
@@ -12,7 +17,8 @@ const normaliseInput = require('./normalise-input')
1217
*
1318
* See https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options
1419
*
15-
* @param {import('ipfs-core-types/src/files').ImportSource} input
16-
* @returns {AsyncIterable<import('ipfs-core-types/src/files').Entry<Blob>>}
20+
* @param {ImportSource} input
21+
* @returns {AsyncGenerator<BrowserImportCandidate, void, undefined>}
1722
*/
23+
// @ts-ignore
1824
module.exports = (input) => normaliseInput(input, normaliseContent)

packages/ipfs-core-utils/src/files/normalise-input/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
const normaliseContent = require('./normalise-content')
44
const normaliseInput = require('./normalise-input')
55

6+
/**
7+
* @typedef {import('ipfs-core-types/src/files').ImportSource} ImportSource
8+
*/
9+
610
/**
711
* Transforms any of the `ipfs.add` input types into
812
*
@@ -12,7 +16,6 @@ const normaliseInput = require('./normalise-input')
1216
*
1317
* See https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options
1418
*
15-
* @param {import('ipfs-core-types/src/files').ImportSource} input
16-
* @returns {AsyncIterable<import('ipfs-core-types/src/files').Entry<AsyncIterable<Uint8Array>>>}
19+
* @param {ImportSource} input
1720
*/
1821
module.exports = (input) => normaliseInput(input, normaliseContent)

packages/ipfs-core-utils/src/files/normalise-input/normalise-content.browser.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const {
1313

1414
/**
1515
* @param {import('./normalise-input').ToContent} input
16-
* @returns {Promise<Blob>}
1716
*/
1817
async function toBlob (input) {
1918
// Bytes
@@ -37,7 +36,7 @@ async function toBlob (input) {
3736
}
3837

3938
// (Async)Iterator<?>
40-
if (input[Symbol.iterator] || input[Symbol.asyncIterator]) {
39+
if (Symbol.iterator in input || Symbol.asyncIterator in input) {
4140
/** @type {any} peekable */
4241
const peekable = itPeekable(input)
4342

@@ -67,7 +66,6 @@ async function toBlob (input) {
6766

6867
/**
6968
* @param {AsyncIterable<BlobPart>|Iterable<BlobPart>} stream
70-
* @returns {Promise<Blob>}
7169
*/
7270
async function itToBlob (stream) {
7371
const parts = []

packages/ipfs-core-utils/src/files/normalise-input/normalise-content.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const {
1515

1616
/**
1717
* @param {import('./normalise-input').ToContent} input
18-
* @returns {AsyncIterable<Uint8Array>}
1918
*/
2019
async function * toAsyncIterable (input) {
2120
// Bytes | String
@@ -41,7 +40,7 @@ async function * toAsyncIterable (input) {
4140
}
4241

4342
// (Async)Iterator<?>
44-
if (input[Symbol.iterator] || input[Symbol.asyncIterator]) {
43+
if (Symbol.iterator in input || Symbol.asyncIterator in input) {
4544
/** @type {any} peekable */
4645
const peekable = itPeekable(input)
4746

@@ -73,9 +72,7 @@ async function * toAsyncIterable (input) {
7372
}
7473

7574
/**
76-
*
7775
* @param {ArrayBuffer | ArrayBufferView | string | InstanceType<typeof window.String> | number[]} chunk
78-
* @returns {Uint8Array}
7976
*/
8077
function toBytes (chunk) {
8178
if (chunk instanceof Uint8Array) {

0 commit comments

Comments
 (0)