diff --git a/README.md b/README.md index 89195abb4d035b248f2bab509974950af745efe0..dabbd1bdc691cd8d73190e0ee15f9f1959e40afa 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,10 @@ It is also meant to bundle as many server-side pubsweet dependencies as possible Install package and remove the dependencies it is meant to replace. ```sh -yarn remove pubsweet pubsweet-server @pubsweet/logger # if migrating from an existing project +## if migrating from an existing project +yarn remove pubsweet pubsweet-server @pubsweet/logger @pubsweet/base-model +## + yarn add @coko/server ``` @@ -36,14 +39,6 @@ If you place this file in `server/app.js`, starting the server should work autom } ``` -### Logger - -To access the logger simply import like so: - -```js -const { logger } = require('@coko/server') -``` - ### Authorization middleware The server provides authorization checks through using `graphql-shield`. @@ -136,7 +131,26 @@ If you run your client on a different host/port than the server, you might run i ### Other exports from included packages -- `createJWT` is an export of a function in `pubsweet-server` that does just that. Useful if you have custom login resolvers. +##### Logger + +Returns pubsweet's logger + +```js +const { logger } = require('@coko/server') +``` + +##### Base Model + +Returns pubsweet's base model + +```js +const { BaseModel } = require('@coko/server') +``` + +##### createJWT + +`createJWT` is an export of a function in `pubsweet-server` that does just that. +Useful if you have custom login resolvers. ### Future features diff --git a/package.json b/package.json index 338a6f802ff219ed70020bf0afe325d7c2863ca2..8eb82ecfbdf0161e4ca2788848d8bf2d3552763a 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "access": "public" }, "dependencies": { + "@pubsweet/base-model": "^3.6.5", "@pubsweet/errors": "^2.0.32", "@pubsweet/logger": "^0.2.42", "@pubsweet/models": "^0.3.7", diff --git a/src/index.js b/src/index.js index b8c1577fd18a5ca231e3bcde095689ca0a8b07ff..9484a0528410fd81ff11a68a8d0982fd572461c1 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,6 @@ const cron = require('node-cron') +const BaseModel = require('@pubsweet/base-model') const authentication = require('pubsweet-server/src/authentication') const logger = require('@pubsweet/logger') @@ -12,4 +13,5 @@ module.exports = { cron, createJWT, logger, + BaseModel, } diff --git a/yarn.lock b/yarn.lock index 3c1933ee9d28f938b48faabfe39cbd506c5b8bd1..8547ef185e9af5e1490ce962bfad91b556435289 100644 --- a/yarn.lock +++ b/yarn.lock @@ -411,6 +411,34 @@ resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570" integrity sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA= +"@pubsweet/base-model@^3.6.5": + version "3.6.5" + resolved "https://registry.yarnpkg.com/@pubsweet/base-model/-/base-model-3.6.5.tgz#a2a6dd9be999b8360abbb0a4a1a22cb9b6b7aa37" + integrity sha512-zhqh8cQL+0rE1U0PbeKUy+Vr7BvF4D/AoW57pI6JnGBZ8iaLtes49Vbzgj4aykQZKgzxraXyJssFHAn1E74TSQ== + dependencies: + "@pubsweet/db-manager" "^3.1.10" + "@pubsweet/errors" "^2.0.35" + "@pubsweet/logger" "^0.2.45" + knex "^0.16.3" + lodash "^4.17.11" + objection "^1.5.3" + uuid "^3.3.2" + +"@pubsweet/db-manager@^3.1.10": + version "3.1.10" + resolved "https://registry.yarnpkg.com/@pubsweet/db-manager/-/db-manager-3.1.10.tgz#a4165be9199fc2d04150ad746d9d328d9ab91c46" + integrity sha512-h9jW/IIYlMgV5exqZZdpmgp6L8Ef8+aVHI7c6nNQT2jaJIVR3ZhmgrjNNWnT9faptInoU/VoF6JUz5/vZKIBAg== + dependencies: + "@hapi/joi" "^14.3.0" + "@pubsweet/logger" "^0.2.45" + fs-extra "^8.1.0" + knex "^0.16.3" + lodash "^4.17.11" + objection "^1.5.3" + pg "^7.8.0" + tmp-promise "^2.0.0" + umzug "^2.1.0" + "@pubsweet/db-manager@^3.1.7": version "3.1.7" resolved "https://registry.yarnpkg.com/@pubsweet/db-manager/-/db-manager-3.1.7.tgz#504b78f036240d3b2e2144caff424fcf38beb72a" @@ -433,6 +461,13 @@ dependencies: http-status-codes "^1.3.0" +"@pubsweet/errors@^2.0.35": + version "2.0.35" + resolved "https://registry.yarnpkg.com/@pubsweet/errors/-/errors-2.0.35.tgz#40a0c231cf5a7ab4aeafd6d20835a092fd55fcec" + integrity sha512-u3eR2lFDydyIVZkxkfXUHhfw0i7usOSVlPmBlcr547qGADPJ8HB4lMTSFoq20Ks7Vij3xeW1Vu6r2Mfqo3uRhQ== + dependencies: + http-status-codes "^1.3.0" + "@pubsweet/logger@^0.2.42": version "0.2.42" resolved "https://registry.yarnpkg.com/@pubsweet/logger/-/logger-0.2.42.tgz#e2fa0e053441868d090bcfff36333ffabda550ee" @@ -441,6 +476,14 @@ "@hapi/joi" "^14.5.0" config "^3.0.1" +"@pubsweet/logger@^0.2.45": + version "0.2.45" + resolved "https://registry.yarnpkg.com/@pubsweet/logger/-/logger-0.2.45.tgz#dbf176a5816e4c5fbc4ba0fed5c996fa2e24c288" + integrity sha512-9s4cb+3vgPGQT6JUbDaiX3Q0KSU2vFDB+jMAj96RlIn88PUVa6dHBJBb1V7SMlPQ493S9dfOJ3lFJQhh+HNA5Q== + dependencies: + "@hapi/joi" "^14.5.0" + config "^3.0.1" + "@pubsweet/models@^0.3.7": version "0.3.7" resolved "https://registry.yarnpkg.com/@pubsweet/models/-/models-0.3.7.tgz#b19bf7b615329e2fdeab6acb64a892d2663c3569"