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

Commit 1aeef89

Browse files
authored
feat: update hapi to v20 (#3245)
Updates hapi ecosystem modules to v20 BREAKING CHANGES: - Hapi has dropped support for node < 12
1 parent 64b7fe4 commit 1aeef89

File tree

18 files changed

+82
-92
lines changed

18 files changed

+82
-92
lines changed

examples/explore-ethereum-blockchain/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"devDependencies": {
1313
"ipfs": "^0.49.0",
1414
"ipfs-http-client": "^46.0.0",
15-
"ipfsd-ctl": "^5.0.0",
15+
"ipfsd-ctl": "^7.0.0",
1616
"test-ipfs-example": "^2.0.3"
1717
}
1818
}

examples/http-client-browser-pubsub/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"execa": "^4.0.0",
2222
"go-ipfs": "^0.6.0",
2323
"ipfs": "^0.49.0",
24-
"ipfsd-ctl": "^5.0.0",
24+
"ipfsd-ctl": "^7.0.0",
2525
"parcel-bundler": "^1.12.4",
2626
"test-ipfs-example": "^2.0.3"
2727
}

examples/http-client-bundle-webpack/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"copy-webpack-plugin": "^5.0.4",
2525
"execa": "^4.0.0",
2626
"ipfs": "^0.49.0",
27-
"ipfsd-ctl": "^5.0.0",
27+
"ipfsd-ctl": "^7.0.0",
2828
"react-hot-loader": "^4.12.21",
2929
"test-ipfs-example": "^2.0.3",
3030
"webpack": "^4.43.0",

examples/http-client-name-api/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"devDependencies": {
1818
"execa": "^4.0.0",
1919
"go-ipfs": "^0.6.0",
20-
"ipfsd-ctl": "^5.0.0",
20+
"ipfsd-ctl": "^7.0.0",
2121
"parcel-bundler": "^1.12.4",
2222
"test-ipfs-example": "^2.0.3"
2323
},

packages/interface-ipfs-core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
},
6464
"devDependencies": {
6565
"aegir": "^26.0.0",
66-
"ipfsd-ctl": "^6.0.0"
66+
"ipfsd-ctl": "^7.0.0"
6767
},
6868
"contributors": [
6969
"Alan Shaw <[email protected]>",

packages/ipfs-http-client/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"it-tar": "^1.2.2",
5959
"it-to-buffer": "^1.0.0",
6060
"it-to-stream": "^0.1.1",
61-
"merge-options": "^2.0.0",
61+
"merge-options": "^3.0.1",
6262
"multiaddr": "^8.0.0",
6363
"multiaddr-to-uri": "^6.0.0",
6464
"multibase": "^3.0.0",
@@ -75,7 +75,7 @@
7575
"cross-env": "^7.0.0",
7676
"go-ipfs": "^0.6.0",
7777
"interface-ipfs-core": "^0.139.1",
78-
"ipfsd-ctl": "^6.0.0",
78+
"ipfsd-ctl": "^7.0.0",
7979
"it-all": "^1.0.1",
8080
"it-concat": "^1.0.0",
8181
"it-pipe": "^1.1.0",

packages/ipfs/package.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,10 @@
6262
"dep-check": "aegir dep-check"
6363
},
6464
"dependencies": {
65-
"@hapi/ammo": "^3.1.2",
66-
"@hapi/boom": "^7.4.3",
67-
"@hapi/content": "^4.1.0",
68-
"@hapi/hapi": "^18.4.0",
69-
"@hapi/joi": "^15.1.0",
65+
"@hapi/ammo": "^5.0.1",
66+
"@hapi/boom": "^9.1.0",
67+
"@hapi/content": "^5.0.2",
68+
"@hapi/hapi": "^20.0.0",
7069
"abort-controller": "^3.0.0",
7170
"any-signal": "^1.1.0",
7271
"array-shuffle": "^1.0.1",
@@ -88,7 +87,7 @@
8887
"fnv1a": "^1.0.1",
8988
"get-folder-size": "^2.0.0",
9089
"hamt-sharding": "^1.0.0",
91-
"hapi-pino": "^6.1.0",
90+
"hapi-pino": "^8.2.0",
9291
"hashlru": "^2.3.0",
9392
"interface-datastore": "^2.0.0",
9493
"ipfs-bitswap": "^3.0.0",
@@ -126,6 +125,7 @@
126125
"it-tar": "^1.2.2",
127126
"it-to-stream": "^0.1.1",
128127
"iterable-ndjson": "^1.1.0",
128+
"joi": "^17.2.1",
129129
"jsondiffpatch": "^0.4.1",
130130
"just-safe-set": "^2.1.0",
131131
"libp2p": "libp2p/js-libp2p#0.29.x",
@@ -142,10 +142,10 @@
142142
"libp2p-record": "^0.9.0",
143143
"libp2p-secio": "^0.13.0",
144144
"libp2p-tcp": "^0.15.0",
145-
"libp2p-webrtc-star": "^0.19.0",
145+
"libp2p-webrtc-star": "^0.20.0",
146146
"libp2p-websockets": "^0.14.0",
147147
"mafmt": "^8.0.0",
148-
"merge-options": "^2.0.0",
148+
"merge-options": "^3.0.1",
149149
"mortice": "^2.0.0",
150150
"multiaddr": "^8.0.0",
151151
"multiaddr-to-uri": "^6.0.0",
@@ -180,7 +180,7 @@
180180
"go-ipfs": "^0.6.0",
181181
"interface-ipfs-core": "^0.139.1",
182182
"ipfs-interop": "github:ipfs/interop#refactor/streaming-pin-api",
183-
"ipfsd-ctl": "^6.0.0",
183+
"ipfsd-ctl": "^7.0.0",
184184
"iso-random-stream": "^1.1.1",
185185
"it-to-buffer": "^1.0.0",
186186
"nanoid": "^3.0.2",

packages/ipfs/src/http/api/resources/files/cp.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ const mfsCp = {
1414
parents: Joi.boolean().default(false),
1515
flush: Joi.boolean().default(true),
1616
hashAlg: Joi.string().default('sha2-256'),
17-
cidVersion: Joi.number().integer().valid([
18-
0,
19-
1
20-
]).default(0),
17+
cidVersion: Joi.number().integer().valid(0, 1).default(0),
2118
shardSplitThreshold: Joi.number().integer().min(0).default(1000),
2219
timeout: Joi.timeout()
2320
})

packages/ipfs/src/http/api/resources/files/mkdir.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ const mfsMkdir = {
1717
mtimeNsecs: Joi.number().integer().min(0),
1818
parents: Joi.boolean().default(false),
1919
hashAlg: Joi.string().default('sha2-256'),
20-
cidVersion: Joi.number().integer().valid([
21-
0,
22-
1
23-
]).default(0),
20+
cidVersion: Joi.number().integer().valid(0, 1).default(0),
2421
flush: Joi.boolean().default(true),
2522
shardSplitThreshold: Joi.number().integer().min(0).default(1000),
2623
timeout: Joi.timeout()

packages/ipfs/src/http/api/resources/files/mv.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ const mfsMv = {
1414
recursive: Joi.boolean().default(false),
1515
parents: Joi.boolean().default(false),
1616
hashAlg: Joi.string().default('sha2-256'),
17-
cidVersion: Joi.number().integer().valid([
18-
0,
19-
1
20-
]).default(0),
17+
cidVersion: Joi.number().integer().valid(0, 1).default(0),
2118
flush: Joi.boolean().default(true),
2219
shardSplitThreshold: Joi.number().integer().min(0).default(1000),
2320
timeout: Joi.timeout()

packages/ipfs/src/http/api/resources/files/touch.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ const mfsTouch = {
1515
mtime: Joi.number().integer(),
1616
mtimeNsecs: Joi.number().integer().min(0),
1717
hashAlg: Joi.string().default('sha2-256'),
18-
cidVersion: Joi.number().integer().valid([
19-
0,
20-
1
21-
]).default(0),
18+
cidVersion: Joi.number().integer().valid(0, 1).default(0),
2219
flush: Joi.boolean().default(true),
2320
shardSplitThreshold: Joi.number().integer().min(0).default(1000),
2421
timeout: Joi.timeout()

packages/ipfs/src/http/api/resources/files/write.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,11 @@ const mfsWrite = {
2424
create: Joi.boolean().default(false),
2525
truncate: Joi.boolean().default(false),
2626
rawLeaves: Joi.boolean().default(false),
27-
cidVersion: Joi.number().integer().valid([
28-
0,
29-
1
30-
]).default(0),
27+
cidVersion: Joi.number().integer().valid(0, 1).default(0),
3128
hashAlg: Joi.string().default('sha2-256'),
3229
parents: Joi.boolean().default(false),
3330
progress: Joi.func(),
34-
strategy: Joi.string().valid([
35-
'flat',
36-
'balanced',
37-
'trickle'
38-
]).default('trickle'),
31+
strategy: Joi.string().valid('flat', 'balanced', 'trickle').default('trickle'),
3932
flush: Joi.boolean().default(true),
4033
reduceSingleLeafToSelf: Joi.boolean().default(false),
4134
shardSplitThreshold: Joi.number().integer().min(0).default(1000),

packages/ipfs/src/http/error-handler.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ module.exports = server => {
3535
response: res.output.payload
3636
}
3737

38-
server.logger().error(debug)
39-
server.logger().error(res)
38+
server.logger.error(debug)
39+
server.logger.error(res)
4040
}
4141

4242
return h.response({

packages/ipfs/src/http/gateway/routes/gateway.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22

3-
const Joi = require('@hapi/joi')
3+
const Joi = require('joi')
44
const resources = require('../resources')
55

66
module.exports = [
@@ -10,9 +10,9 @@ module.exports = [
1010
options: {
1111
handler: resources.gateway.handler,
1212
validate: {
13-
params: {
13+
params: Joi.object({
1414
path: Joi.string().required()
15-
}
15+
})
1616
},
1717
response: {
1818
ranges: false // disable built-in support, handler does it manually
@@ -28,9 +28,9 @@ module.exports = [
2828
options: {
2929
handler: resources.gateway.handler,
3030
validate: {
31-
params: {
31+
params: Joi.object({
3232
path: Joi.string().required()
33-
}
33+
})
3434
},
3535
response: {
3636
ranges: false // disable built-in support, handler does it manually

packages/ipfs/src/http/index.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ class HttpApi {
7474
// CORS is enabled by default
7575
// TODO: shouldn't, fix this
7676
routes: {
77-
cors: true
77+
cors: true,
78+
response: {
79+
emptyStatusCode: 200
80+
}
7881
},
7982
// Disable Compression
8083
// Why? Streaming compression in Hapi is not stable enough,
@@ -171,7 +174,10 @@ class HttpApi {
171174
host,
172175
port,
173176
routes: {
174-
cors: true
177+
cors: true,
178+
response: {
179+
emptyStatusCode: 200
180+
}
175181
}
176182
})
177183
server.app.ipfs = ipfs

0 commit comments

Comments
 (0)