Registry / database / dogwater

dogwater

JSON →
library2.3.0jsnpmunverified

A hapi plugin integrating Waterline ORM, currently at v2.3.0. It allows defining models, adapters, and connections for Waterline within a hapi server, and provides convenience methods like `server.dogwater()`, `server.collections()`, and `request.collections()` to access Waterline collections. Supports multi-plugin deployments with collision protection. Works with hapi >=10 <17 and waterline >=0.10.0 <0.13.0. Last updated in 2019; no major releases since v2. Alternative to using Waterline standalone with hapi.

database
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Package is CJS-only; ESM import will fail. Use require.

const Dogwater = require('dogwater')

Accepts a single config object, not separate arguments.

server.dogwater({ identity: 'model', connection: 'conn', attributes: {} })

request.collections() is a method that returns an object. Call it each time.

const Cols = request.collections(); const Model = Cols.modelname

server.collections is a function; must be invoked.

const Cols = server.collections(); const Model = Cols.modelname

Shows full hapi server setup with Dogwater, including model definition, route using request.collections(), and startup with data creation.

const Hapi = require('hapi'); const Dogwater = require('dogwater'); const Memory = require('sails-memory'); const server = new Hapi.Server(); server.connection({ port: 3000 }); server.route({ method: 'get', path: '/dogs/{id}', handler: function (request, reply) { const Dogs = request.collections().dogs; reply(Dogs.findOne(request.params.id)); } }); server.register({ register: Dogwater, options: { adapters: { memory: Memory }, connections: { simple: { adapter: 'memory' } } } }, (err) => { if (err) throw err; server.dogwater({ identity: 'dogs', connection: 'simple', attributes: { name: 'string' } }); server.start((err) => { if (err) throw err; const Dogs = server.collections().dogs; Dogs.create([ { name: 'Guinness' }, { name: 'Sully' }, { name: 'Ren' } ]).then(() => { console.log(`Go find some dogs at ${server.info.uri}`); }).catch((err) => console.error(err)); }); });
Debug
Known footguns
breakingDogwater v2.0.0 dropped support for hapi <10 and waterline <0.10. Removed server.dogwater() model registration from options; models must be registered via the server.dogwater() method.
deprecatedPackage is in maintenance mode. The peer dependency range for waterline (>=0.10.0 <0.13.0) is outdated; Waterline is no longer actively maintained and newer versions may not be compatible.
gotchamodel definitions must have an `identity` property. Duplicate identities across plugins will cause registration to fail.
gotchaDogwater requires a connection configuration with a valid adapter. Using an adapter name that was not registered via `adapters` option will throw a runtime error.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
13 hits · last 30 days
bingbot
6
gptbot
3
ahrefsbot
1
Resources