Registry / database / offshore

offshore

JSON →
library1.0.4jsnpmunverified

Offshore is a fork of the Waterline ORM (v0.10.x branch) providing a uniform API for accessing multiple databases including MySQL, PostgreSQL, MongoDB, Redis, and LDAP. Version 1.0.4 is the latest stable, targeting Node >=4. It is an ActiveRecord-style ORM with support for deep populate, caching, association criteria, and transactions. Compared to Waterline, Offshore adds features that were not merged upstream due to divergence in priorities. The package is no longer actively maintained, with no releases since 2017.

npm install offshore
INSTALL
IMPORT
SIG · OFFSHORE
O
offshore
databasejavascriptv1.0.4
harness data pending
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.

Offshore
const Offshore = require('offshore');
import Offshore from 'offshore';
This package does not ship ESM; it must be required via CommonJS.
Collection
const User = Offshore.Collection.extend({...});
class User extends Offshore.Collection {}
Offshore uses .extend() pattern, not ES6 class inheritance.
offshore
const offshore = new Offshore();
const offshore = new offshore.Offshore();
The constructor is the default export.

Defines a User model, initializes Offshore with a PostgreSQL adapter, registers the collection, and creates a record.

const Offshore = require('offshore'); const User = Offshore.Collection.extend({ identity: 'user', connection: 'myLocalPostgres', attributes: { firstName: { type: 'string', required: true }, lastName: { type: 'string', required: true }, email: { type: 'string', required: true, unique: true } } }); const offshore = new Offshore(); const config = { adapters: { 'postgresql': require('sails-postgresql'), 'memory': require('offshore-memory') }, connections: { 'myLocalPostgres': { adapter: 'postgresql', host: process.env.DB_HOST ?? 'localhost', port: 5432, database: process.env.DB_NAME ?? 'mydb', user: process.env.DB_USER ?? 'postgres', password: process.env.DB_PASSWORD ?? '' }, 'tmpmemory': { adapter: 'memory' } }, defaults: { migrate: 'safe' } }; User.registerCollection(); offshore.initialize(config, (err, ontology) => { if (err) return console.error(err); const UserModel = ontology.collections.user; UserModel.create({ firstName: 'John', lastName: 'Doe', email: 'john@example.com' }, (err, user) => { if (err) return console.error(err); console.log('Created user:', user); }); });
Debug
Known issues
breakingOffshore is an unmaintained fork; no security patches or bug fixes released since 2017.
fix
Migrate to Waterline (v0.13.x) or another actively maintained ORM like Sequelize, TypeORM, or Prisma.
affects: all
gotchaOffshore uses .extend() to define models, not ES6 class syntax. Using class inheritance will cause runtime errors.
fix
Use Offshore.Collection.extend({...}) to define collections.
affects: all
gotchaOffshore does not ship ES modules; importing with 'import' will fail. Must use CommonJS require().
fix
Use const Offshore = require('offshore'); instead of import.
affects: all
gotchaAdapters must be installed separately; no adapters are bundled with offshore core.
fix
Install an adapter like 'sails-postgresql', 'sails-mysql', or 'offshore-memory'.
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'sails-postgresql'
Missing adapter dependency.
fix
npm install sails-postgresql
Offshore.Collection.extend is not a function
Using import statement instead of require, or wrong object reference.
fix
Use const Offshore = require('offshore'); then Offshore.Collection.extend(...).
Cannot find module 'offshore/...'
Trying to import a submodule that does not exist.
fix
Offshore does not support deep imports; only require('offshore').
Upgrade
Version history
1.0.4latest on npm
Audit
Dependencies
lodashrequiredUsed extensively for object manipulation and iteration.
asyncrequiredUsed for asynchronous control flow.
anchorrequiredValidation library used for attribute definitions.
switchbackrequiredUsed for callback flow control.
Agent activity
4 hits · last 30 days
node
4
Resources
offshore — npm install offshore · libregistry