Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

feathers

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

feathers - npm Package Compare versions

Comparing version 2.1.7 to 3.0.0-pre.1

lib/events.js

186

lib/application.js

@@ -1,64 +0,96 @@

'use strict';
const debug = require('debug')('feathers:application');
const { stripSlashes } = require('feathers-commons');
Object.defineProperty(exports, "__esModule", {
value: true
const Uberproto = require('uberproto');
const events = require('./events');
const hooks = require('./hooks');
const version = require('./version');
const Proto = Uberproto.extend({
create: null
});
var _debug = require('debug');
const application = {
init () {
Object.assign(this, {
version,
methods: [
'find', 'get', 'create', 'update', 'patch', 'remove'
],
mixins: [],
services: {},
providers: [],
_setup: false,
settings: {}
});
var _debug2 = _interopRequireDefault(_debug);
this.configure(hooks());
this.configure(events());
},
var _feathersCommons = require('feathers-commons');
get (name) {
return this.settings[name];
},
var _uberproto = require('uberproto');
set (name, value) {
this.settings[name] = value;
return this;
},
var _uberproto2 = _interopRequireDefault(_uberproto);
disable (name) {
this.settings[name] = false;
return this;
},
var _index = require('./mixins/index');
disabled (name) {
return !this.settings[name];
},
var _index2 = _interopRequireDefault(_index);
enable (name) {
this.settings[name] = true;
return this;
},
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
enabled (name) {
return !!this.settings[name];
},
var debug = (0, _debug2.default)('feathers:application');
var methods = ['find', 'get', 'create', 'update', 'patch', 'remove'];
var Proto = _uberproto2.default.extend({
create: null
});
configure (fn) {
fn.call(this);
exports.default = {
init: function init() {
Object.assign(this, {
methods: methods,
mixins: (0, _index2.default)(),
services: {},
providers: [],
_setup: false
});
return this;
},
service: function service(location, _service) {
var _this = this;
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
service (path, service) {
if (typeof service !== 'undefined') {
throw new Error('Registering a new service with `app.service(path, service)` is no longer supported. Use `app.use(path, service)` instead.');
}
location = (0, _feathersCommons.stripSlashes)(location);
const location = stripSlashes(path);
const current = this.services[location];
if (!_service) {
var current = this.services[location];
if (typeof current === 'undefined' && typeof this.defaultService === 'function') {
return this.use(`/${location}`, this.defaultService(location))
.service(location);
}
if (typeof current === 'undefined' && typeof this.defaultService === 'function') {
return this.service(location, this.defaultService(location), options);
}
return current;
},
return current;
use (path, service, options = {}) {
const location = stripSlashes(path);
const hasMethod = methods => methods.some(name =>
(service && typeof service[name] === 'function')
);
if (!hasMethod(this.methods.concat('setup'))) {
throw new Error(`Invalid service object passed for path \`${location}\``);
}
var protoService = Proto.extend(_service);
const protoService = Proto.extend(service);
debug('Registering new service at `' + location + '`');
debug(`Registering new service at \`${location}\``);
// Add all the mixins
this.mixins.forEach(function (fn) {
return fn.call(_this, protoService);
});
this.mixins.forEach(fn => fn.call(this, protoService, location, options));

@@ -70,56 +102,26 @@ if (typeof protoService._setup === 'function') {

// Run the provider functions to register the service
this.providers.forEach(function (provider) {
return provider.call(_this, location, protoService, options);
});
this.providers.forEach(provider =>
provider.call(this, protoService, location, options)
);
// If we ran setup already, set this service up explicitly
if (this._isSetup && typeof protoService.setup === 'function') {
debug('Setting up service for `' + location + '`');
debug(`Setting up service for \`${location}\``);
protoService.setup(this, location);
}
return this.services[location] = protoService;
},
use: function use(location) {
var service = void 0;
var middleware = Array.from(arguments).slice(1).reduce(function (middleware, arg) {
if (typeof arg === 'function') {
middleware[service ? 'after' : 'before'].push(arg);
} else if (!service) {
service = arg;
} else {
throw new Error('invalid arg passed to app.use');
}
return middleware;
}, {
before: [],
after: []
});
this.services[location] = protoService;
var hasMethod = function hasMethod(methods) {
return methods.some(function (name) {
return service && typeof service[name] === 'function';
});
};
// Check for service (any object with at least one service method)
if (hasMethod(['handle', 'set']) || !hasMethod(this.methods.concat('setup'))) {
return this._super.apply(this, arguments);
}
// Any arguments left over are other middleware that we want to pass to the providers
this.service(location, service, { middleware: middleware });
return this;
},
setup: function setup() {
var _this2 = this;
setup () {
// Setup each service (pass the app so that they can look up other services etc.)
Object.keys(this.services).forEach(function (path) {
var service = _this2.services[path];
Object.keys(this.services).forEach(path => {
const service = this.services[path];
debug('Setting up service for `' + path + '`');
debug(`Setting up service for \`${path}\``);
if (typeof service.setup === 'function') {
service.setup(_this2, path);
service.setup(this, path);
}

@@ -131,23 +133,5 @@ });

return this;
},
// Express 3.x configure is gone in 4.x but we'll keep a more basic version
// That just takes a function in order to keep Feathers plugin configuration easier.
// Environment specific configurations should be done as suggested in the 4.x migration guide:
// https://github.com/visionmedia/express/wiki/Migrating-from-3.x-to-4.x
configure: function configure(fn) {
fn.call(this);
return this;
},
listen: function listen() {
var server = this._super.apply(this, arguments);
this.setup(server);
debug('Feathers application listening');
return server;
}
};
module.exports = exports['default'];
module.exports = application;

@@ -1,30 +0,18 @@

'use strict';
const Proto = require('uberproto');
const Application = require('./application');
const version = require('./version');
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = createApplication;
function createApplication () {
const app = {};
var _express = require('express');
// Mix in the base application
Proto.mixin(Application, app);
var _express2 = _interopRequireDefault(_express);
app.init();
var _feathers = require('./feathers');
var _feathers2 = _interopRequireDefault(_feathers);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
if (!global._babelPolyfill) {
require('babel-polyfill');
return app;
}
function createApplication() {
return (0, _feathers2.default)(_express2.default.apply(undefined, arguments));
}
createApplication.version = version;
// Expose all express methods (like express.engine())
Object.assign(createApplication, _express2.default, {
version: require('../package.json').version
});
module.exports = exports['default'];
module.exports = createApplication;
{
"name": "feathers",
"description": "Build Better APIs, Faster than Ever.",
"version": "2.1.7",
"version": "3.0.0-pre.1",
"homepage": "http://feathersjs.com",

@@ -17,6 +17,2 @@ "repository": {

"main": "lib/index",
"types": [
"./index.d.ts",
"./client.d.ts"
],
"author": "Feathers <hello@feathersjs.com> (http://feathersjs.com)",

@@ -35,3 +31,4 @@ "contributors": [

"scripts": {
"prepublish": "npm run compile",
"update-version": "node -e \"console.log('module.exports = \\'' + require('./package.json').version + '\\';')\" > lib/version.js",
"version": "npm run update-version && git add lib/version.js && git commit -am \"Updating version\"",
"publish": "git push origin && git push origin --tags",

@@ -41,9 +38,8 @@ "release:patch": "npm version patch && npm publish",

"release:major": "npm version major && npm publish",
"release:prerelease": "npm version prerelease && npm publish --tag pegasus",
"compile": "rimraf lib/ && babel -d lib/ src/",
"watch": "babel --watch -d lib/ src/",
"lint": "eslint-if-supported semistandard --fix",
"release:pre": "npm version prerelease && npm publish --tag pre",
"lint": "semistandard --fix",
"mocha": "mocha --opts mocha.opts",
"mocha:watch": "mocha --opts mocha.opts --watch",
"coverage": "istanbul cover node_modules/mocha/bin/_mocha -- --opts mocha.opts",
"test": "npm run compile && npm run lint && npm run coverage && nsp check"
"test": "npm run lint && npm run coverage"
},

@@ -56,23 +52,11 @@ "semistandard": {

"engines": {
"node": ">= 4"
"node": ">= 6"
},
"dependencies": {
"@types/express": "~4.0.35",
"babel-polyfill": "^6.20.0",
"debug": "^2.6.0",
"debug": "^2.6.8",
"events": "^1.1.1",
"express": "^4.14.0",
"feathers-commons": "^0.8.7",
"rubberduck": "^1.1.1",
"feathers-commons": "^1.0.0-pre.2",
"uberproto": "^1.2.0"
},
"devDependencies": {
"babel-cli": "^6.18.0",
"babel-core": "^6.21.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-preset-es2015": "^6.18.0",
"body-parser": "^1.15.2",
"eslint-if-supported": "^1.0.1",
"feathers-rest": "^1.5.3",
"feathers-socketio": "^2.0.0",
"istanbul": "^1.1.0-alpha.1",

@@ -82,11 +66,4 @@ "jshint": "^2.9.4",

"nsp": "^2.6.2",
"q": "^1.4.1",
"request": "^2.x",
"rimraf": "^2.5.4",
"semistandard": "^10.0.0",
"socket.io-client": "^2.0.0"
},
"browser": {
"./lib/index": "./lib/client/index"
"semistandard": "^10.0.0"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc