Commit Graph

109 Commits

Author SHA1 Message Date
Joey Baker
ddc6fcceb8 Chore (build) set sourcemaps to inline
This ensures that node can read the sourcemaps and provide useful
stacktraces
2016-09-28 21:16:17 -07:00
Joey Baker
f403e214a9 Docs show how to interact with hapi hooks
Fixes #3
2016-09-19 21:47:12 -07:00
Joey Baker
71e6390282 Docs: add "modify the response format" section 2016-09-13 19:44:36 -07:00
Joey Baker
a720e30a85 2.6.2 2016-09-08 13:27:20 -07:00
Joey Baker
518c4a4226 2.6.1 2016-09-08 13:27:10 -07:00
Joey Baker
469aaec66f Merge pull request #23 from mdibaiee/fix-joi-concat
Fix (validation) use joi's concat
2016-09-08 13:26:50 -07:00
Joey Baker
8ee5661252 Test: only run src test files #oops 2016-09-08 13:24:08 -07:00
Joey Baker
c59943a717 Fix (validation) use joi's concat
It turns out defaultsDeep doesn't ever correctly combine Joi objects.
So, the only option is to use Joi's concat method to combine Joi
schemas. This complicates `getConfigForMethod`, but simplifies actual
route creation.

I ran into this because I'm setting up [lout](https://github.com/hapijs/lout)
on a server, and it requires properly formatted Joi schemas. This leads
me to believe there was something already wrong and Lout just exposed
the problem.
2016-09-08 13:20:50 -07:00
Joey Baker
8cdfc5858d Merge pull request #24 from mdibaiee/use-json
Fix toJSON responses
2016-09-08 11:33:47 -07:00
Joey Baker
4e078f5ba5 Fix toJSON responses
This is a non-obvious one. Hapi is happy to convert raw sequelize
instances to proper JSON (likely because Sequelize does nice things),
but we do that, we can't use `config.response.schema`, because it
receives the full sequelize instance instead of JSON.

This is a patch release.
2016-09-07 21:06:34 -07:00
Joey Baker
85111c7dc8 2.6.0 2016-09-06 11:30:22 -07:00
Joey Baker
196999a4c5 Merge pull request #20 from Getable/error-on-invalid-where
Validate query and payload
2016-09-06 11:29:40 -07:00
Joey Baker
3e9f024dcf Test: now testing get-config-for-method 2016-09-06 11:25:03 -07:00
Joey Baker
4c9ae36c5c Refactor: move get-config-for-method to a file 2016-09-06 11:24:41 -07:00
Joey Baker
4558ad1327 Chore (deps) update minors and patches
Not strictly necessary, but kinda nice to prove we're up-to-date
2016-09-06 09:25:02 -07:00
Joey Baker
edccfb2316 Chore (deps) update Joi 7 → 9
Shouldn't impact us
2016-09-06 07:28:43 -07:00
Joey Baker
0d8ab9f02e Chore (deps) update boom (major)
They just removed a method we don't use.
2016-09-06 07:28:43 -07:00
Joey Baker
f062e2b37f Fix (validation) params is a plain object
If we use a Joi object here, we can't use `defaultsDeep` to extend b/c
the joi prototype won't extend cleanly. We'd need to use joi's `contact`
method, but that gets really complicated and error prone. So, just use
a plain object which is more correct anyway.

http://hapijs.com/tutorials/validation
2016-09-06 07:28:43 -07:00
Joey Baker
69221ea331 Feat query & payload now validated 2016-09-06 07:28:43 -07:00
Joey Baker
f33c8da55d Fix (CRUD update) validate id 2016-09-06 07:28:43 -07:00
Joey Baker
833df49173 Chore add comments for config creation 2016-09-06 07:28:43 -07:00
Joey Baker
32a539c3d9 Fix (crud) update: findOnefindById
b/c `findById` uses an index to lookup, and should be fast.
2016-09-06 07:28:43 -07:00
Joey Baker
b35bd23c91 Fix: prefer user's config before our own 2016-09-06 07:28:43 -07:00
Joey Baker
b4ea8c5b8e Docs: add more details for include and where 2016-09-06 07:28:43 -07:00
Joey Baker
85cd2823da Docs: #cleanup and style fixes 2016-09-06 07:28:43 -07:00
Joey Baker
e0132c2cae Fix: handle all parseInclude errors 2016-09-06 07:28:43 -07:00
Mahdi Dibaiee
bd18c57529 chore: put CircleCI badge in the same line as heading 2016-09-06 09:30:21 +04:30
Mahdi Dibaiee
3e53ba8d2c Merge branch 'master' of github.com:mdibaiee/hapi-sequelize-crud 2016-09-06 09:29:39 +04:30
Mahdi Dibaiee
81b704a395 chore: add CircleCI badge 2016-09-06 09:28:56 +04:30
Mahdi Dibaiee
d69b87b8fa Merge pull request #22 from mdibaiee/tests
Add Tests
2016-09-06 09:25:24 +04:30
Joey Baker
03755f94c5 Test (CI) configure circle 2016-09-05 17:37:50 -07:00
Joey Baker
7cecd7fb40 Test (list) add initial list tests 2016-09-05 17:12:13 -07:00
Joey Baker
7b757fcc50 Fix (crud) if no prefix, things still work 2016-09-05 17:11:42 -07:00
Joey Baker
de0685c8bb Chore: install and configure AVA 2016-09-05 17:10:58 -07:00
Joey Baker
f2f613b35b Fix: boom error on invalid include
Sends a 501 `notImplemented` error when `parseInclude` can't find models
to include.
2016-09-05 17:08:09 -07:00
Joey Baker
38ccb3adf6 Chore (deps) update eslint (major)
Breaking changes shouldn't affect us
2016-09-05 15:43:48 -07:00
Joey Baker
506d42f39a 2.5.4 2016-09-05 12:30:15 -07:00
Joey Baker
3dfa72ddee Merge pull request #21 from Getable/better-error
Fix a bug in error parsing
2016-09-05 12:25:14 -07:00
Joey Baker
bab2e90cbb Feat (error) parse PG 42* errors 2016-09-04 17:28:16 -07:00
Joey Baker
da6b3ce963 Feat (error) include hint on PG errors
Provides useful info!
2016-09-04 17:28:09 -07:00
Joey Baker
b032be20d1 Fix (error) always reply with an error #oops
We had a case where reply would never be called. This could case a
server hang.
2016-09-04 17:28:01 -07:00
Mahdi Dibaiee
79c6a81a3a chore(version): bump version 2016-08-30 09:49:07 +04:30
Mahdi Dibaiee
517f2b8157 Merge pull request #17 from Getable/fix-babel-polyfill
Fixes for babel-polyfill
2016-08-30 09:48:20 +04:30
Joey Baker
a9fa790ae9 Fix (deps): install babel-polyfill as optionalDep
We only require it if something else hasn't so this is a optionalDep.
2016-08-29 17:08:44 -07:00
Joey Baker
ce6f1fedde Fix: bad merge in error.js 2016-08-28 09:57:23 -07:00
Joey Baker
db86507ef9 Fix: correct babel-polyfill version
This installs the babel-polyfill for babel 6. #oops
2016-08-28 09:56:46 -07:00
Mahdi Dibaiee
6ad9df2db1 chore: bump version 2016-08-26 13:15:50 +04:30
Mahdi Dibaiee
17105f66f4 feat(errors): parse sequelize errors and use the relevant Boom error type 2016-08-26 13:15:15 +04:30
Mahdi Dibaiee
b18479e02e Merge pull request #16 from Getable/parse-sequelize-errors
Parse Sequelize errors
2016-08-26 13:11:29 +04:30
Joey Baker
0e9cd935b9 Add: parse Sequelize errors
This adds intelligence around sequelize errors to parse out the correct
error status code and ensure it's always formatted as a Boom error.
2016-08-25 21:28:23 -07:00