add missing semicolons
This commit is contained in:
parent
c65b80432b
commit
4ebf10ae0d
|
@ -157,9 +157,9 @@ AccessContext.prototype.debug = function() {
|
|||
if(debug.enabled) {
|
||||
debug('---AccessContext---');
|
||||
if(this.principals && this.principals.length) {
|
||||
debug('principals:')
|
||||
debug('principals:');
|
||||
this.principals.forEach(function(principal) {
|
||||
debug('principal: %j', principal)
|
||||
debug('principal: %j', principal);
|
||||
});
|
||||
} else {
|
||||
debug('principals: %j', this.principals);
|
||||
|
@ -170,14 +170,14 @@ AccessContext.prototype.debug = function() {
|
|||
debug('method %s', this.method);
|
||||
debug('accessType %s', this.accessType);
|
||||
if(this.accessToken) {
|
||||
debug('accessToken:')
|
||||
debug('accessToken:');
|
||||
debug(' id %j', this.accessToken.id);
|
||||
debug(' ttl %j', this.accessToken.ttl);
|
||||
}
|
||||
debug('getUserId() %s', this.getUserId());
|
||||
debug('isAuthenticated() %s', this.isAuthenticated());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This class represents the abstract notion of a principal, which can be used
|
||||
|
@ -273,7 +273,7 @@ AccessRequest.prototype.exactlyMatches = function(acl) {
|
|||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Is the request for access allowed?
|
||||
|
@ -283,7 +283,7 @@ AccessRequest.prototype.exactlyMatches = function(acl) {
|
|||
|
||||
AccessRequest.prototype.isAllowed = function() {
|
||||
return this.permission !== loopback.ACL.DENY;
|
||||
}
|
||||
};
|
||||
|
||||
AccessRequest.prototype.debug = function() {
|
||||
if(debug.enabled) {
|
||||
|
@ -295,7 +295,7 @@ AccessRequest.prototype.debug = function() {
|
|||
debug(' isWildcard() %s', this.isWildcard());
|
||||
debug(' isAllowed() %s', this.isAllowed());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.AccessContext = AccessContext;
|
||||
module.exports.Principal = Principal;
|
||||
|
|
|
@ -62,7 +62,7 @@ app.remotes = function () {
|
|||
|
||||
return (this._remotes = RemoteObjects.create(options));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
* Remove a route by reference.
|
||||
|
@ -76,7 +76,7 @@ app.disuse = function (route) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Attach a model to the app. The `Model` will be available on the
|
||||
|
@ -207,7 +207,7 @@ app.model = function (Model, config) {
|
|||
|
||||
app.models = function () {
|
||||
return this._models || (this._models = []);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Define a DataSource.
|
||||
|
@ -221,7 +221,7 @@ app.dataSource = function (name, config) {
|
|||
this.dataSources[classify(name)] =
|
||||
this.dataSources[camelize(name)] = ds;
|
||||
return ds;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Register a connector.
|
||||
|
@ -256,7 +256,7 @@ app.remoteObjects = function () {
|
|||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
* Get a handler of the specified type from the handler cache.
|
||||
|
@ -277,7 +277,7 @@ app.handler = function (type, options) {
|
|||
});
|
||||
|
||||
return handler;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* An object to store dataSource instances.
|
||||
|
@ -342,7 +342,7 @@ app.enableAuth = function() {
|
|||
app.boot = function(options) {
|
||||
throw new Error(
|
||||
'`app.boot` was removed, use the new module loopback-boot instead');
|
||||
}
|
||||
};
|
||||
|
||||
function classify(str) {
|
||||
return stringUtils.classify(str);
|
||||
|
@ -469,4 +469,4 @@ app.listen = function(cb) {
|
|||
}
|
||||
|
||||
return server;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -43,7 +43,7 @@ Connector._createJDBAdapter = function (jdbModule) {
|
|||
jdbModule.initialize(fauxSchema, function () {
|
||||
// connected
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
* Add default crud operations from a JugglingDB adapter.
|
||||
|
@ -51,4 +51,4 @@ Connector._createJDBAdapter = function (jdbModule) {
|
|||
|
||||
Connector.prototype._addCrudOperationsFromJDBAdapter = function (connector) {
|
||||
|
||||
}
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
var mailer = require('nodemailer')
|
||||
, assert = require('assert')
|
||||
, debug = require('debug')('loopback:connector:mail')
|
||||
, loopback = require('../loopback')
|
||||
, loopback = require('../loopback');
|
||||
|
||||
/**
|
||||
* Export the MailConnector class.
|
||||
|
@ -44,7 +44,7 @@ function MailConnector(settings) {
|
|||
MailConnector.initialize = function(dataSource, callback) {
|
||||
dataSource.connector = new MailConnector(dataSource.settings);
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
||||
MailConnector.prototype.DataAccessObject = Mailer;
|
||||
|
||||
|
@ -86,7 +86,7 @@ MailConnector.prototype.setupTransport = function(setting) {
|
|||
|
||||
connector.transportsIndex[setting.type] = transport;
|
||||
connector.transports.push(transport);
|
||||
}
|
||||
};
|
||||
|
||||
function Mailer() {
|
||||
|
||||
|
@ -101,7 +101,7 @@ function Mailer() {
|
|||
|
||||
MailConnector.prototype.transportForName = function(name) {
|
||||
return this.transportsIndex[name];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the default transport.
|
||||
|
@ -111,7 +111,7 @@ MailConnector.prototype.transportForName = function(name) {
|
|||
|
||||
MailConnector.prototype.defaultTransport = function() {
|
||||
return this.transports[0] || this.stubTransport;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Send an email with the given `options`.
|
||||
|
@ -166,7 +166,7 @@ Mailer.send = function (options, fn) {
|
|||
fn(null, options);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Send an email instance using `modelInstance.send()`.
|
||||
|
@ -174,7 +174,7 @@ Mailer.send = function (options, fn) {
|
|||
|
||||
Mailer.prototype.send = function (fn) {
|
||||
this.constructor.send(this, fn);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Access the node mailer object.
|
||||
|
|
|
@ -25,6 +25,6 @@ function status() {
|
|||
started: started,
|
||||
uptime: (Date.now() - Number(started)) / 1000
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,6 @@ function token(options) {
|
|||
req.accessToken = token || null;
|
||||
next(err);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -15,5 +15,5 @@ function urlNotFound() {
|
|||
var error = new Error('Cannot ' + req.method + ' ' + req.url);
|
||||
error.status = 404;
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
14
lib/model.js
14
lib/model.js
|
@ -159,7 +159,7 @@ Model.setup = function () {
|
|||
} else {
|
||||
fn(new Error('must specify an id or data'));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var idDesc = ModelCtor.modelName + ' id';
|
||||
ModelCtor.sharedCtor.accepts = [
|
||||
|
@ -340,7 +340,7 @@ Model._getAccessTypeForMethod = function(method) {
|
|||
default:
|
||||
return ACL.EXECUTE;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the `Application` the Model is attached to.
|
||||
|
@ -361,7 +361,7 @@ Model.getApp = function(callback) {
|
|||
callback(null, Model.app);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Enable remote invocation for the method with the given name.
|
||||
|
@ -382,7 +382,7 @@ Model.remoteMethod = function(name, options) {
|
|||
options.isStatic = true;
|
||||
}
|
||||
this.sharedClass.defineMethod(name, options);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Disable remote invocation for the method with the given name.
|
||||
|
@ -395,7 +395,7 @@ Model.remoteMethod = function(name, options) {
|
|||
|
||||
Model.disableRemoteMethod = function(name, isStatic) {
|
||||
this.sharedClass.disableMethod(name, isStatic || false);
|
||||
}
|
||||
};
|
||||
|
||||
Model.belongsToRemoting = function(relationName, relation, define) {
|
||||
var modelName = relation.modelTo && relation.modelTo.modelName;
|
||||
|
@ -409,7 +409,7 @@ Model.belongsToRemoting = function(relationName, relation, define) {
|
|||
description: 'Fetches belongsTo relation ' + relationName,
|
||||
returns: {arg: relationName, type: modelName, root: true}
|
||||
}, fn);
|
||||
}
|
||||
};
|
||||
|
||||
Model.hasOneRemoting = function(relationName, relation, define) {
|
||||
var fn = this.prototype[relationName];
|
||||
|
@ -421,7 +421,7 @@ Model.hasOneRemoting = function(relationName, relation, define) {
|
|||
description: 'Fetches hasOne relation ' + relationName,
|
||||
returns: {arg: relationName, type: relation.modelTo.modelName, root: true}
|
||||
}, fn);
|
||||
}
|
||||
};
|
||||
|
||||
Model.hasManyRemoting = function (relationName, relation, define) {
|
||||
var pathName = (relation.options.http && relation.options.http.path) || relationName;
|
||||
|
|
|
@ -45,7 +45,7 @@ PersistedModel.setup = function setupPersistedModel() {
|
|||
}
|
||||
|
||||
PersistedModel.setupRemoting();
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
* Throw an error telling the user that the method is not available and why.
|
||||
|
@ -260,7 +260,7 @@ PersistedModel.destroyById = function deleteById(id, cb) {
|
|||
/**
|
||||
* Alias for destroyById.
|
||||
*/
|
||||
PersistedModel.removeById = PersistedModel.destroyById
|
||||
PersistedModel.removeById = PersistedModel.destroyById;
|
||||
|
||||
/**
|
||||
* Alias for destroyById.
|
||||
|
@ -430,7 +430,7 @@ PersistedModel.prototype.reload = function reload(callback) {
|
|||
PersistedModel.prototype.setId = function(val) {
|
||||
var ds = this.getDataSource();
|
||||
this[this.getIdName()] = val;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the `id` value for the `PersistedModel`.
|
||||
|
@ -442,7 +442,7 @@ PersistedModel.prototype.getId = function() {
|
|||
var data = this.toObject();
|
||||
if(!data) return;
|
||||
return data[this.getIdName()];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the id property name of the constructor.
|
||||
|
@ -452,7 +452,7 @@ PersistedModel.prototype.getId = function() {
|
|||
|
||||
PersistedModel.prototype.getIdName = function() {
|
||||
return this.constructor.getIdName();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the id property name of the constructor.
|
||||
|
@ -469,7 +469,7 @@ PersistedModel.getIdName = function() {
|
|||
} else {
|
||||
return 'id';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
PersistedModel.setupRemoting = function() {
|
||||
var PersistedModel = this;
|
||||
|
@ -649,7 +649,7 @@ PersistedModel.setupRemoting = function() {
|
|||
http: {verb: 'post', path: '/:id/rectify-change'}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a set of deltas and conflicts since the given checkpoint.
|
||||
|
@ -664,7 +664,7 @@ PersistedModel.setupRemoting = function() {
|
|||
PersistedModel.diff = function(since, remoteChanges, callback) {
|
||||
var Change = this.getChangeModel();
|
||||
Change.diff(this.modelName, since, remoteChanges, callback);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the changes to a model since a given checkpoint. Provide a filter object
|
||||
|
@ -720,7 +720,7 @@ PersistedModel.changes = function(since, filter, callback) {
|
|||
}));
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a checkpoint.
|
||||
|
@ -736,7 +736,7 @@ PersistedModel.checkpoint = function(cb) {
|
|||
sourceId: sourceId
|
||||
}, cb);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the current checkpoint id.
|
||||
|
@ -750,7 +750,7 @@ PersistedModel.checkpoint = function(cb) {
|
|||
PersistedModel.currentCheckpoint = function(cb) {
|
||||
var Checkpoint = this.getChangeModel().getCheckpointModel();
|
||||
Checkpoint.current(cb);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Replicate changes since the given checkpoint to the given target model.
|
||||
|
@ -793,7 +793,7 @@ PersistedModel.replicate = function(since, targetModel, options, callback) {
|
|||
|
||||
callback = callback || function defaultReplicationCallback(err) {
|
||||
if(err) throw err;
|
||||
}
|
||||
};
|
||||
|
||||
var tasks = [
|
||||
getSourceChanges,
|
||||
|
@ -848,7 +848,7 @@ PersistedModel.replicate = function(since, targetModel, options, callback) {
|
|||
|
||||
callback && callback(null, conflicts);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Create an update list (for `Model.bulkUpdate()`) from a delta list
|
||||
|
@ -899,7 +899,7 @@ PersistedModel.createUpdates = function(deltas, cb) {
|
|||
if(err) return cb(err);
|
||||
cb(null, updates);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Apply an update list.
|
||||
|
@ -937,7 +937,7 @@ PersistedModel.bulkUpdate = function(updates, callback) {
|
|||
});
|
||||
|
||||
async.parallel(tasks, callback);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the `Change` model.
|
||||
|
@ -953,7 +953,7 @@ PersistedModel.getChangeModel = function() {
|
|||
assert(isSetup, 'Cannot get a setup Change model');
|
||||
|
||||
return changeModel;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the source identifier for this model / dataSource.
|
||||
|
@ -974,7 +974,7 @@ PersistedModel.getSourceId = function(cb) {
|
|||
);
|
||||
var id = [dataSource.connector.name, this.modelName].join('-');
|
||||
cb(null, id);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Enable the tracking of changes made to the model. Usually for replication.
|
||||
|
@ -993,11 +993,11 @@ PersistedModel.enableChangeTracking = function() {
|
|||
|
||||
Model.afterSave = function afterSave(next) {
|
||||
Model.rectifyChange(this.getId(), next);
|
||||
}
|
||||
};
|
||||
|
||||
Model.afterDestroy = function afterDestroy(next) {
|
||||
Model.rectifyChange(this.getId(), next);
|
||||
}
|
||||
};
|
||||
|
||||
Model.on('deletedAll', cleanup);
|
||||
|
||||
|
@ -1017,7 +1017,7 @@ PersistedModel.enableChangeTracking = function() {
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
PersistedModel._defineChangeModel = function() {
|
||||
var BaseChangeModel = registry.getModel('Change');
|
||||
|
@ -1030,11 +1030,11 @@ PersistedModel._defineChangeModel = function() {
|
|||
trackModel: this
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
PersistedModel.rectifyAllChanges = function(callback) {
|
||||
this.getChangeModel().rectifyAll(callback);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle a change error. Override this method in a subclassing model to customize
|
||||
|
@ -1048,7 +1048,7 @@ PersistedModel.handleChangeError = function(err) {
|
|||
console.error(Model.modelName + ' Change Tracking Error:');
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Tell loopback that a change to the model with the given id has occurred.
|
||||
|
@ -1061,6 +1061,6 @@ PersistedModel.handleChangeError = function(err) {
|
|||
PersistedModel.rectifyChange = function(id, callback) {
|
||||
var Change = this.getChangeModel();
|
||||
Change.rectifyModelChanges(this.modelName, [id], callback);
|
||||
}
|
||||
};
|
||||
|
||||
PersistedModel.setup();
|
||||
|
|
Loading…
Reference in New Issue