Skip to content

Commit 2edff18

Browse files
authored
fix: warning logs during install due to joi (#665)
1 parent 1b8c188 commit 2edff18

File tree

6 files changed

+51
-40
lines changed

6 files changed

+51
-40
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"dependencies": {
1818
"@forestadmin/context": "1.37.1",
1919
"@forestadmin/datasource-sql": "1.6.4",
20+
"@hapi/joi": "17.1.1",
2021
"@oclif/core": "3.18.2",
2122
"@oclif/plugin-help": "6.0.12",
2223
"@oclif/plugin-not-found": "3.0.10",
@@ -31,7 +32,6 @@
3132
"dotenv": "8.2.0",
3233
"handlebars": "4.7.7",
3334
"inquirer": "6.2.0",
34-
"joi": "14.3.1",
3535
"json-diff": "1.0.0",
3636
"jsonapi-serializer": "3.6.2",
3737
"jsonwebtoken": "8.5.1",
@@ -56,7 +56,6 @@
5656
"validate-npm-package-name": "3.0.0"
5757
},
5858
"devDependencies": {
59-
"oclif": "4.4.2",
6059
"@commitlint/cli": "17.4.2",
6160
"@commitlint/config-conventional": "17.4.2",
6261
"@semantic-release/changelog": "6.0.1",
@@ -82,6 +81,7 @@
8281
"lint-staged": "12.3.7",
8382
"mock-stdin": "1.0.0",
8483
"nock": "13.5.0",
84+
"oclif": "4.4.2",
8585
"prettier": "2.8.3",
8686
"rimraf": "3.0.2",
8787
"semantic-release": "19.0.3",

src/commands/schema/apply.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ class ApplyCommand extends AbstractAuthenticatedCommand {
8383
otherwise: this.joi.string().allow(null),
8484
});
8585

86-
const { error } = this.joi.validate(
87-
schema,
88-
this.joi.object().keys({
86+
const { error } = this.joi
87+
.object()
88+
.keys({
8989
collections: this.joi.array().items(this.joi.object()).required(),
9090
meta: this.joi
9191
.object()
@@ -101,9 +101,8 @@ class ApplyCommand extends AbstractAuthenticatedCommand {
101101
})
102102
.unknown()
103103
.required(),
104-
}),
105-
{ convert: false },
106-
);
104+
})
105+
.validate(schema);
107106

108107
if (error) {
109108
this.logger.error('Cannot properly read the ".forestadmin-schema.json" file:');

src/context/dependencies-plan.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = plan =>
2020
.addModule('chalk', () => require('chalk'))
2121
.addModule('crypto', () => require('crypto'))
2222
.addModule('fs', () => require('fs'))
23-
.addModule('joi', () => require('joi'))
23+
.addModule('joi', () => require('@hapi/joi'))
2424
.addModule('openIdClient', () => require('openid-client'))
2525
.addModule('os', () => require('os'))
2626
.addModule('superagent', () => require('superagent'))

test/commands/schema/apply.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ describe('schema:apply', () => {
244244
commandClass: ApplySchemaCommand,
245245
std: [
246246
{ err: '× Cannot properly read the ".forestadmin-schema.json" file:' },
247-
{ err: '× | "orm_version" is not allowed' },
247+
{ err: '× | "meta.orm_version" is not allowed' },
248248
],
249249
exitCode: 20,
250250
}));

test/services/authenticator.unit.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const joi = require('joi');
1+
const joi = require('@hapi/joi');
22
const Authenticator = require('../../src/services/authenticator');
33

44
describe('services > authenticator', () => {

yarn.lock

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,6 +1626,46 @@
16261626
resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6"
16271627
integrity sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==
16281628

1629+
"@hapi/address@^4.0.1":
1630+
version "4.1.0"
1631+
resolved "https://registry.yarnpkg.com/@hapi/address/-/address-4.1.0.tgz#d60c5c0d930e77456fdcde2598e77302e2955e1d"
1632+
integrity sha512-SkszZf13HVgGmChdHo/PxchnSaCJ6cetVqLzyciudzZRT0jcOouIF/Q93mgjw8cce+D+4F4C1Z/WrfFN+O3VHQ==
1633+
dependencies:
1634+
"@hapi/hoek" "^9.0.0"
1635+
1636+
"@hapi/formula@^2.0.0":
1637+
version "2.0.0"
1638+
resolved "https://registry.yarnpkg.com/@hapi/formula/-/formula-2.0.0.tgz#edade0619ed58c8e4f164f233cda70211e787128"
1639+
integrity sha512-V87P8fv7PI0LH7LiVi8Lkf3x+KCO7pQozXRssAHNXXL9L1K+uyu4XypLXwxqVDKgyQai6qj3/KteNlrqDx4W5A==
1640+
1641+
"@hapi/hoek@^9.0.0":
1642+
version "9.3.0"
1643+
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb"
1644+
integrity sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==
1645+
1646+
"@hapi/joi@17.1.1":
1647+
version "17.1.1"
1648+
resolved "https://registry.yarnpkg.com/@hapi/joi/-/joi-17.1.1.tgz#9cc8d7e2c2213d1e46708c6260184b447c661350"
1649+
integrity sha512-p4DKeZAoeZW4g3u7ZeRo+vCDuSDgSvtsB/NpfjXEHTUjSeINAi/RrVOWiVQ1isaoLzMvFEhe8n5065mQq1AdQg==
1650+
dependencies:
1651+
"@hapi/address" "^4.0.1"
1652+
"@hapi/formula" "^2.0.0"
1653+
"@hapi/hoek" "^9.0.0"
1654+
"@hapi/pinpoint" "^2.0.0"
1655+
"@hapi/topo" "^5.0.0"
1656+
1657+
"@hapi/pinpoint@^2.0.0":
1658+
version "2.0.1"
1659+
resolved "https://registry.yarnpkg.com/@hapi/pinpoint/-/pinpoint-2.0.1.tgz#32077e715655fc00ab8df74b6b416114287d6513"
1660+
integrity sha512-EKQmr16tM8s16vTT3cA5L0kZZcTMU5DUOZTuvpnY738m+jyP3JIUj+Mm1xc1rsLkGBQ/gVnfKYPwOmPg1tUR4Q==
1661+
1662+
"@hapi/topo@^5.0.0":
1663+
version "5.1.0"
1664+
resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-5.1.0.tgz#dc448e332c6c6e37a4dc02fd84ba8d44b9afb012"
1665+
integrity sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==
1666+
dependencies:
1667+
"@hapi/hoek" "^9.0.0"
1668+
16291669
"@humanwhocodes/config-array@^0.11.13":
16301670
version "0.11.14"
16311671
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.14.tgz#d78e481a039f7566ecc9660b4ea7fe6b1fec442b"
@@ -6626,11 +6666,6 @@ header-case@^2.0.4:
66266666
resolved "https://registry.yarnpkg.com/heap/-/heap-0.2.7.tgz#1e6adf711d3f27ce35a81fe3b7bd576c2260a8fc"
66276667
integrity sha512-2bsegYkkHO+h/9MGbn6KWcE45cHZgPANo5LXF7EvWdT0yT2EguSVO1nDgU5c8+ZOPwp2vMNa7YFsJhVcDR9Sdg==
66286668

6629-
hoek@6.x.x:
6630-
version "6.1.3"
6631-
resolved "https://registry.yarnpkg.com/hoek/-/hoek-6.1.3.tgz#73b7d33952e01fe27a38b0457294b79dd8da242c"
6632-
integrity sha512-YXXAAhmF9zpQbC7LEcREFtXfGq5K1fmd+4PHkBq8NUqmzW3G+Dq10bI/i0KucLRwss3YYFQ0fSfoxBZYiGUqtQ==
6633-
66346669
hook-std@^2.0.0:
66356670
version "2.0.0"
66366671
resolved "https://registry.yarnpkg.com/hook-std/-/hook-std-2.0.0.tgz#ff9aafdebb6a989a354f729bb6445cf4a3a7077c"
@@ -7283,13 +7318,6 @@ isbinaryfile@^5.0.0:
72837318
resolved "https://registry.yarnpkg.com/isbinaryfile/-/isbinaryfile-5.0.0.tgz#034b7e54989dab8986598cbcea41f66663c65234"
72847319
integrity sha512-UDdnyGvMajJUWCkib7Cei/dvyJrrvo4FIrsvSFWdPpXSUorzXrDJ0S+X5Q4ZlasfPjca4yqCNNsjbCeiy8FFeg==
72857320

7286-
isemail@3.x.x:
7287-
version "3.2.0"
7288-
resolved "https://registry.yarnpkg.com/isemail/-/isemail-3.2.0.tgz#59310a021931a9fb06bbb51e155ce0b3f236832c"
7289-
integrity sha512-zKqkK+O+dGqevc93KNsbZ/TqTUFd46MwWjYOoMrjIMZ51eU7DtQG3Wmd9SQQT7i7RVnuTPEiYEWHU3MSbxC1Tg==
7290-
dependencies:
7291-
punycode "2.x.x"
7292-
72937321
isexe@^2.0.0:
72947322
version "2.0.0"
72957323
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
@@ -7777,15 +7805,6 @@ jest@27.3.1:
77777805
import-local "^3.0.2"
77787806
jest-cli "^27.3.1"
77797807

7780-
joi@14.3.1:
7781-
version "14.3.1"
7782-
resolved "https://registry.yarnpkg.com/joi/-/joi-14.3.1.tgz#164a262ec0b855466e0c35eea2a885ae8b6c703c"
7783-
integrity sha512-LQDdM+pkOrpAn4Lp+neNIFV3axv1Vna3j38bisbQhETPMANYRbFJFUyOZcOClYvM/hppMhGWuKSFEK9vjrB+bQ==
7784-
dependencies:
7785-
hoek "6.x.x"
7786-
isemail "3.x.x"
7787-
topo "3.x.x"
7788-
77897808
jose@^2.0.2:
77907809
version "2.0.6"
77917810
resolved "https://registry.yarnpkg.com/jose/-/jose-2.0.6.tgz#894ba19169af339d3911be933f913dd02fc57c7c"
@@ -10479,7 +10498,7 @@ pump@^3.0.0:
1047910498
end-of-stream "^1.1.0"
1048010499
once "^1.3.1"
1048110500

10482-
punycode@2.x.x, punycode@^2.1.0, punycode@^2.1.1:
10501+
punycode@^2.1.0, punycode@^2.1.1:
1048310502
version "2.3.1"
1048410503
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5"
1048510504
integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==
@@ -11858,13 +11877,6 @@ to-regex-range@^5.0.1:
1185811877
dependencies:
1185911878
is-number "^7.0.0"
1186011879

11861-
topo@3.x.x:
11862-
version "3.0.3"
11863-
resolved "https://registry.yarnpkg.com/topo/-/topo-3.0.3.tgz#d5a67fb2e69307ebeeb08402ec2a2a6f5f7ad95c"
11864-
integrity sha512-IgpPtvD4kjrJ7CRA3ov2FhWQADwv+Tdqbsf1ZnPUSAtCJ9e1Z44MmoSGDXGk4IppoZA7jd/QRkNddlLJWlUZsQ==
11865-
dependencies:
11866-
hoek "6.x.x"
11867-
1186811880
toposort-class@^1.0.1:
1186911881
version "1.0.1"
1187011882
resolved "https://registry.yarnpkg.com/toposort-class/-/toposort-class-1.0.1.tgz#7ffd1f78c8be28c3ba45cd4e1a3f5ee193bd9988"

0 commit comments

Comments
 (0)