2017-12-26 13:19:11 -08:00
|
|
|
import { Observable } from 'rx';
|
|
|
|
|
|
|
|
module.exports = AccessToken => {
|
|
|
|
// wait for datasource to attach before adding methods
|
|
|
|
// prevents loopback from unnecessarily
|
|
|
|
// adding watchers on startup
|
|
|
|
AccessToken.on('dataSourceAttached', () => {
|
|
|
|
AccessToken.findOne$ = Observable.fromNodeCallback(
|
|
|
|
AccessToken.findOne.bind(AccessToken)
|
|
|
|
);
|
2017-12-27 10:11:17 -08:00
|
|
|
AccessToken.prototype.validate$ = Observable.fromNodeCallback(
|
|
|
|
AccessToken.prototype.validate
|
|
|
|
);
|
|
|
|
AccessToken.prototype.destroy$ = Observable.fromNodeCallback(
|
|
|
|
AccessToken.prototype.destroy
|
|
|
|
);
|
2017-12-26 13:19:11 -08:00
|
|
|
});
|
|
|
|
};
|