diff --git a/node_modules/asteroid-module/README.md b/node_modules/asteroid-module/README.md index a764405d..f37de617 100644 --- a/node_modules/asteroid-module/README.md +++ b/node_modules/asteroid-module/README.md @@ -27,20 +27,18 @@ A configuration then must define: Where `some-model-module` is an existing `model` instance. -## AsteroidModule.optionsDefinition +## AsteroidModule.options Asteroid Modules may also describe the options they accept. This will validate the configuration and make sure users have supplied required information and in a way that the module can use to construct a working instance. Here is an example options description for the [oracle database connection module](../connections/oracle-connection). - // must come after `inherits()` - OracleConnection.defineOption('hostname', 'string', {required: true}); - OracleConnection.defineOption('port', 'number', {min: 10, max: 99999}); - OracleConnection.defineOption('username', 'string'); - OracleConnection.defineOption('password', 'string'); - - -### AsteroidModule.defineOption(key, type, [options]) + OracleConnection.options = { + 'hostname': {type: 'string', required: true}, + 'port': {type: 'number', min: 10, max: 99999}, + 'username': {type: 'string'}, + 'password': {type: 'string'} + }; **key** the option name given in `config.json`. @@ -51,10 +49,9 @@ Here is an example options description for the [oracle database connection modul - number - array -**options** depend on the type +**min/max** depend on the type { - required: true, // options are optional by default min: 10, // minimum length or value max: 100, // max length or value } \ No newline at end of file diff --git a/node_modules/asteroid-module/lib/asteroid-module.js b/node_modules/asteroid-module/lib/asteroid-module.js index 9803675d..b28bdec4 100644 --- a/node_modules/asteroid-module/lib/asteroid-module.js +++ b/node_modules/asteroid-module/lib/asteroid-module.js @@ -35,17 +35,3 @@ function AsteroidModule(options) { */ inherits(AsteroidModule, Module); - -/** - * Define an option of the given key/name with the provided type. - */ - -AsteroidModule.defineOption = function (key, type, options) { - var od = this.optionsDefinition = this.optionsDefinition || {}; - - options = options || {}; - options.type = type; - - od[key] = options; -} - diff --git a/node_modules/connection/lib/connection.js b/node_modules/connection/lib/connection.js index e47b3a28..85eb143f 100644 --- a/node_modules/connection/lib/connection.js +++ b/node_modules/connection/lib/connection.js @@ -39,4 +39,12 @@ function Connection(options) { * Inherit from `AsteroidModule`. */ -inherits(Connection, AsteroidModule); \ No newline at end of file +inherits(Connection, AsteroidModule); + +/** + * Connection Options + */ + +Connection.options = { + "adapter": {type: "string"} +} \ No newline at end of file diff --git a/node_modules/oracle-connection/lib/oracle-connection.js b/node_modules/oracle-connection/lib/oracle-connection.js index 393f7c77..3ef147ce 100644 --- a/node_modules/oracle-connection/lib/oracle-connection.js +++ b/node_modules/oracle-connection/lib/oracle-connection.js @@ -42,7 +42,7 @@ inherits(OracleConnection, Connection); */ OracleConnection.options = { - 'hostname': {type: 'string', required: true}, + 'host': {type: 'string', required: true}, 'port': {type: 'number', min: 10, max: 99999}, 'username': {type: 'string'}, 'password': {type: 'string'} diff --git a/node_modules/store/lib/store.js b/node_modules/store/lib/store.js index 2d9d8501..1191800f 100644 --- a/node_modules/store/lib/store.js +++ b/node_modules/store/lib/store.js @@ -36,5 +36,7 @@ function Store(options) { var connection = (dependencies && dependencies.connection) || {}; var adapter = this.adapter = (connection && connection.adapter) || require('./memory'); + // TODO determine how to + this.schema = new Schema(adapter, connection.options); } \ No newline at end of file