Comparing version 2.1.7 to 3.0.0-pre.1
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
4
5
0
17923
13
296
1
1
+ Addedfeathers-commons@1.0.0-pre.3(transitive)
- Removed@types/express@~4.0.35
- Removedbabel-polyfill@^6.20.0
- Removedexpress@^4.14.0
- Removedrubberduck@^1.1.1
- Removed@types/body-parser@1.19.5(transitive)
- Removed@types/connect@3.4.38(transitive)
- Removed@types/express@4.0.39(transitive)
- Removed@types/express-serve-static-core@5.0.1(transitive)
- Removed@types/http-errors@2.0.4(transitive)
- Removed@types/mime@1.3.5(transitive)
- Removed@types/node@22.9.0(transitive)
- Removed@types/qs@6.9.17(transitive)
- Removed@types/range-parser@1.2.7(transitive)
- Removed@types/send@0.17.4(transitive)
- Removed@types/serve-static@1.15.7(transitive)
- Removedaccepts@1.3.8(transitive)
- Removedarray-flatten@1.1.1(transitive)
- Removedbabel-polyfill@6.26.0(transitive)
- Removedbabel-runtime@6.26.0(transitive)
- Removedbody-parser@1.20.3(transitive)
- Removedbytes@3.1.2(transitive)
- Removedcall-bind@1.0.7(transitive)
- Removedcontent-disposition@0.5.4(transitive)
- Removedcontent-type@1.0.5(transitive)
- Removedcookie@0.7.1(transitive)
- Removedcookie-signature@1.0.6(transitive)
- Removedcore-js@2.6.12(transitive)
- Removeddefine-data-property@1.1.4(transitive)
- Removeddepd@2.0.0(transitive)
- Removeddestroy@1.2.0(transitive)
- Removedee-first@1.1.1(transitive)
- Removedencodeurl@1.0.22.0.0(transitive)
- Removedes-define-property@1.0.0(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedescape-html@1.0.3(transitive)
- Removedetag@1.8.1(transitive)
- Removedexpress@4.21.1(transitive)
- Removedfeathers-commons@0.8.7(transitive)
- Removedfinalhandler@1.3.1(transitive)
- Removedforwarded@0.2.0(transitive)
- Removedfresh@0.5.2(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-intrinsic@1.2.4(transitive)
- Removedgopd@1.0.1(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-proto@1.0.3(transitive)
- Removedhas-symbols@1.0.3(transitive)
- Removedhasown@2.0.2(transitive)
- Removedhttp-errors@2.0.0(transitive)
- Removediconv-lite@0.4.24(transitive)
- Removedinherits@2.0.4(transitive)
- Removedipaddr.js@1.9.1(transitive)
- Removedmedia-typer@0.3.0(transitive)
- Removedmerge-descriptors@1.0.3(transitive)
- Removedmethods@1.1.2(transitive)
- Removedmime@1.6.0(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedms@2.1.3(transitive)
- Removednegotiator@0.6.3(transitive)
- Removedobject-inspect@1.13.3(transitive)
- Removedon-finished@2.4.1(transitive)
- Removedparseurl@1.3.3(transitive)
- Removedpath-to-regexp@0.1.10(transitive)
- Removedproxy-addr@2.0.7(transitive)
- Removedqs@6.13.0(transitive)
- Removedrange-parser@1.2.1(transitive)
- Removedraw-body@2.5.2(transitive)
- Removedregenerator-runtime@0.10.50.11.1(transitive)
- Removedrubberduck@1.1.1(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsend@0.19.0(transitive)
- Removedserve-static@1.16.2(transitive)
- Removedset-function-length@1.2.2(transitive)
- Removedsetprototypeof@1.2.0(transitive)
- Removedside-channel@1.0.6(transitive)
- Removedstatuses@2.0.1(transitive)
- Removedtoidentifier@1.0.1(transitive)
- Removedtype-is@1.6.18(transitive)
- Removedundici-types@6.19.8(transitive)
- Removedunpipe@1.0.0(transitive)
- Removedutils-merge@1.0.1(transitive)
- Removedvary@1.1.2(transitive)
Updateddebug@^2.6.8