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

Commit

Permalink
feat: update hapi to v20 (#3245)
Browse files Browse the repository at this point in the history
Updates hapi ecosystem modules to v20

BREAKING CHANGES:

- Hapi has dropped support for node < 12
  • Loading branch information
achingbrain authored Aug 25, 2020
1 parent 64b7fe4 commit 1aeef89
Show file tree
Hide file tree
Showing 18 changed files with 82 additions and 92 deletions.
2 changes: 1 addition & 1 deletion examples/explore-ethereum-blockchain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"devDependencies": {
"ipfs": "^0.49.0",
"ipfs-http-client": "^46.0.0",
"ipfsd-ctl": "^5.0.0",
"ipfsd-ctl": "^7.0.0",
"test-ipfs-example": "^2.0.3"
}
}
2 changes: 1 addition & 1 deletion examples/http-client-browser-pubsub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"execa": "^4.0.0",
"go-ipfs": "^0.6.0",
"ipfs": "^0.49.0",
"ipfsd-ctl": "^5.0.0",
"ipfsd-ctl": "^7.0.0",
"parcel-bundler": "^1.12.4",
"test-ipfs-example": "^2.0.3"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/http-client-bundle-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"copy-webpack-plugin": "^5.0.4",
"execa": "^4.0.0",
"ipfs": "^0.49.0",
"ipfsd-ctl": "^5.0.0",
"ipfsd-ctl": "^7.0.0",
"react-hot-loader": "^4.12.21",
"test-ipfs-example": "^2.0.3",
"webpack": "^4.43.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/http-client-name-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"devDependencies": {
"execa": "^4.0.0",
"go-ipfs": "^0.6.0",
"ipfsd-ctl": "^5.0.0",
"ipfsd-ctl": "^7.0.0",
"parcel-bundler": "^1.12.4",
"test-ipfs-example": "^2.0.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/interface-ipfs-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
},
"devDependencies": {
"aegir": "^26.0.0",
"ipfsd-ctl": "^6.0.0"
"ipfsd-ctl": "^7.0.0"
},
"contributors": [
"Alan Shaw <alan.shaw@protocol.ai>",
Expand Down
4 changes: 2 additions & 2 deletions packages/ipfs-http-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"it-tar": "^1.2.2",
"it-to-buffer": "^1.0.0",
"it-to-stream": "^0.1.1",
"merge-options": "^2.0.0",
"merge-options": "^3.0.1",
"multiaddr": "^8.0.0",
"multiaddr-to-uri": "^6.0.0",
"multibase": "^3.0.0",
Expand All @@ -75,7 +75,7 @@
"cross-env": "^7.0.0",
"go-ipfs": "^0.6.0",
"interface-ipfs-core": "^0.139.1",
"ipfsd-ctl": "^6.0.0",
"ipfsd-ctl": "^7.0.0",
"it-all": "^1.0.1",
"it-concat": "^1.0.0",
"it-pipe": "^1.1.0",
Expand Down
18 changes: 9 additions & 9 deletions packages/ipfs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,10 @@
"dep-check": "aegir dep-check"
},
"dependencies": {
"@hapi/ammo": "^3.1.2",
"@hapi/boom": "^7.4.3",
"@hapi/content": "^4.1.0",
"@hapi/hapi": "^18.4.0",
"@hapi/joi": "^15.1.0",
"@hapi/ammo": "^5.0.1",
"@hapi/boom": "^9.1.0",
"@hapi/content": "^5.0.2",
"@hapi/hapi": "^20.0.0",
"abort-controller": "^3.0.0",
"any-signal": "^1.1.0",
"array-shuffle": "^1.0.1",
Expand All @@ -88,7 +87,7 @@
"fnv1a": "^1.0.1",
"get-folder-size": "^2.0.0",
"hamt-sharding": "^1.0.0",
"hapi-pino": "^6.1.0",
"hapi-pino": "^8.2.0",
"hashlru": "^2.3.0",
"interface-datastore": "^2.0.0",
"ipfs-bitswap": "^3.0.0",
Expand Down Expand Up @@ -126,6 +125,7 @@
"it-tar": "^1.2.2",
"it-to-stream": "^0.1.1",
"iterable-ndjson": "^1.1.0",
"joi": "^17.2.1",
"jsondiffpatch": "^0.4.1",
"just-safe-set": "^2.1.0",
"libp2p": "libp2p/js-libp2p#0.29.x",
Expand All @@ -142,10 +142,10 @@
"libp2p-record": "^0.9.0",
"libp2p-secio": "^0.13.0",
"libp2p-tcp": "^0.15.0",
"libp2p-webrtc-star": "^0.19.0",
"libp2p-webrtc-star": "^0.20.0",
"libp2p-websockets": "^0.14.0",
"mafmt": "^8.0.0",
"merge-options": "^2.0.0",
"merge-options": "^3.0.1",
"mortice": "^2.0.0",
"multiaddr": "^8.0.0",
"multiaddr-to-uri": "^6.0.0",
Expand Down Expand Up @@ -180,7 +180,7 @@
"go-ipfs": "^0.6.0",
"interface-ipfs-core": "^0.139.1",
"ipfs-interop": "github:ipfs/interop#refactor/streaming-pin-api",
"ipfsd-ctl": "^6.0.0",
"ipfsd-ctl": "^7.0.0",
"iso-random-stream": "^1.1.1",
"it-to-buffer": "^1.0.0",
"nanoid": "^3.0.2",
Expand Down
5 changes: 1 addition & 4 deletions packages/ipfs/src/http/api/resources/files/cp.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ const mfsCp = {
parents: Joi.boolean().default(false),
flush: Joi.boolean().default(true),
hashAlg: Joi.string().default('sha2-256'),
cidVersion: Joi.number().integer().valid([
0,
1
]).default(0),
cidVersion: Joi.number().integer().valid(0, 1).default(0),
shardSplitThreshold: Joi.number().integer().min(0).default(1000),
timeout: Joi.timeout()
})
Expand Down
5 changes: 1 addition & 4 deletions packages/ipfs/src/http/api/resources/files/mkdir.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ const mfsMkdir = {
mtimeNsecs: Joi.number().integer().min(0),
parents: Joi.boolean().default(false),
hashAlg: Joi.string().default('sha2-256'),
cidVersion: Joi.number().integer().valid([
0,
1
]).default(0),
cidVersion: Joi.number().integer().valid(0, 1).default(0),
flush: Joi.boolean().default(true),
shardSplitThreshold: Joi.number().integer().min(0).default(1000),
timeout: Joi.timeout()
Expand Down
5 changes: 1 addition & 4 deletions packages/ipfs/src/http/api/resources/files/mv.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ const mfsMv = {
recursive: Joi.boolean().default(false),
parents: Joi.boolean().default(false),
hashAlg: Joi.string().default('sha2-256'),
cidVersion: Joi.number().integer().valid([
0,
1
]).default(0),
cidVersion: Joi.number().integer().valid(0, 1).default(0),
flush: Joi.boolean().default(true),
shardSplitThreshold: Joi.number().integer().min(0).default(1000),
timeout: Joi.timeout()
Expand Down
5 changes: 1 addition & 4 deletions packages/ipfs/src/http/api/resources/files/touch.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ const mfsTouch = {
mtime: Joi.number().integer(),
mtimeNsecs: Joi.number().integer().min(0),
hashAlg: Joi.string().default('sha2-256'),
cidVersion: Joi.number().integer().valid([
0,
1
]).default(0),
cidVersion: Joi.number().integer().valid(0, 1).default(0),
flush: Joi.boolean().default(true),
shardSplitThreshold: Joi.number().integer().min(0).default(1000),
timeout: Joi.timeout()
Expand Down
11 changes: 2 additions & 9 deletions packages/ipfs/src/http/api/resources/files/write.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,11 @@ const mfsWrite = {
create: Joi.boolean().default(false),
truncate: Joi.boolean().default(false),
rawLeaves: Joi.boolean().default(false),
cidVersion: Joi.number().integer().valid([
0,
1
]).default(0),
cidVersion: Joi.number().integer().valid(0, 1).default(0),
hashAlg: Joi.string().default('sha2-256'),
parents: Joi.boolean().default(false),
progress: Joi.func(),
strategy: Joi.string().valid([
'flat',
'balanced',
'trickle'
]).default('trickle'),
strategy: Joi.string().valid('flat', 'balanced', 'trickle').default('trickle'),
flush: Joi.boolean().default(true),
reduceSingleLeafToSelf: Joi.boolean().default(false),
shardSplitThreshold: Joi.number().integer().min(0).default(1000),
Expand Down
4 changes: 2 additions & 2 deletions packages/ipfs/src/http/error-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ module.exports = server => {
response: res.output.payload
}

server.logger().error(debug)
server.logger().error(res)
server.logger.error(debug)
server.logger.error(res)
}

return h.response({
Expand Down
10 changes: 5 additions & 5 deletions packages/ipfs/src/http/gateway/routes/gateway.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const Joi = require('@hapi/joi')
const Joi = require('joi')
const resources = require('../resources')

module.exports = [
Expand All @@ -10,9 +10,9 @@ module.exports = [
options: {
handler: resources.gateway.handler,
validate: {
params: {
params: Joi.object({
path: Joi.string().required()
}
})
},
response: {
ranges: false // disable built-in support, handler does it manually
Expand All @@ -28,9 +28,9 @@ module.exports = [
options: {
handler: resources.gateway.handler,
validate: {
params: {
params: Joi.object({
path: Joi.string().required()
}
})
},
response: {
ranges: false // disable built-in support, handler does it manually
Expand Down
10 changes: 8 additions & 2 deletions packages/ipfs/src/http/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ class HttpApi {
// CORS is enabled by default
// TODO: shouldn't, fix this
routes: {
cors: true
cors: true,
response: {
emptyStatusCode: 200
}
},
// Disable Compression
// Why? Streaming compression in Hapi is not stable enough,
Expand Down Expand Up @@ -171,7 +174,10 @@ class HttpApi {
host,
port,
routes: {
cors: true
cors: true,
response: {
emptyStatusCode: 200
}
}
})
server.app.ipfs = ipfs
Expand Down
Loading

0 comments on commit 1aeef89

Please sign in to comment.