moleculer-decorators
Advanced tools
Comparing version 1.0.16 to 1.0.17
{ | ||
"name": "moleculer-decorators", | ||
"version": "1.0.16", | ||
"version": "1.0.17", | ||
"description": "decorators for moleculer", | ||
@@ -9,5 +9,10 @@ "main": "dist/index.js", | ||
"clean": "rimraf dist/*", | ||
"tsc": "tsc", | ||
"lint": "tslint -p tsconfig.json", | ||
"compile": "yarn clean && tsc && node dist/index.js", | ||
"dev": "nodemon --delay 2000 -e ts --exec \"yarn compile\"", | ||
"test12": "nodemon --delay 2000 -e ts --exec \"yarn clean && tsc && node dist/testing/012.js\"" | ||
"test": "jest --coverage --forceExit --detectOpenHandles", | ||
"test12": "nodemon --delay 2000 -e ts --exec \"yarn clean && tsc && node dist/testing/012.js\"", | ||
"preversion": "npm run lint && npm run tsc && npm run test", | ||
"postversion": "git push && git push --follow-tags" | ||
}, | ||
@@ -33,12 +38,45 @@ "author": "Colonelbundy <colonelbundy@gmail.com>", | ||
"dependencies": { | ||
"lodash": "^4.17.4", | ||
"moleculer": "^0.13.2" | ||
"lodash": "^4.17.11", | ||
"moleculer": "^0.13.7" | ||
}, | ||
"devDependencies": { | ||
"@types/lodash": "^4.14.100", | ||
"@types/jest": "^24.0.6", | ||
"jest": "^24.1.0", | ||
"ts-jest": "^24.0.0", | ||
"@types/lodash": "^4.14.121", | ||
"@types/node": "^7.0.12", | ||
"nodemon": "^1.11.0", | ||
"rimraf": "^2.6.1", | ||
"typescript": "^3.0.3" | ||
"nodemon": "^1.18.10", | ||
"rimraf": "^2.6.3", | ||
"tslint": "^5.12.1", | ||
"tslint-eslint-rules": "^5.4.0", | ||
"moleculer-web": "^0.8.5", | ||
"supertest": "^3.4.2", | ||
"reflect-metadata": "^0.1.13", | ||
"typescript": "^3.3.3333" | ||
}, | ||
"jest": { | ||
"testEnvironment": "node", | ||
"rootDir": "./services", | ||
"roots": [ | ||
"../test" | ||
], | ||
"transform": { | ||
"^.+\\.tsx?$": "ts-jest" | ||
}, | ||
"testRegex": ".*\\.(test|spec).(ts|js)$", | ||
"globals": { | ||
"ts-jest": { | ||
"tsConfig": "./tsconfig.json" | ||
} | ||
}, | ||
"setupFiles": [], | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"tsx", | ||
"js", | ||
"jsx", | ||
"json", | ||
"node" | ||
] | ||
} | ||
} |
@@ -16,4 +16,4 @@ import { | ||
import * as _ from 'lodash'; | ||
import Bluebird = require('bluebird'); | ||
const blacklist = [ | ||
@@ -30,3 +30,3 @@ 'created', | ||
const blacklist2 = ['metadata', 'settings', 'mixins', 'name', 'version'].concat( | ||
blacklist | ||
blacklist | ||
); | ||
@@ -80,7 +80,7 @@ const defaultServiceOptions: Options = { | ||
(target.events || (target.events = {}))[key] = options | ||
? { | ||
? { | ||
...options, | ||
handler: descriptor.value | ||
} | ||
: descriptor.value; | ||
: descriptor.value; | ||
}; | ||
@@ -98,18 +98,20 @@ } | ||
(target.actions || (target.actions = {}))[key] = options | ||
? { | ||
? { | ||
...options | ||
} | ||
: options.skipHandler | ||
? '' | ||
: descriptor.value; | ||
: options.skipHandler | ||
? '' | ||
: descriptor.value; | ||
}; | ||
} | ||
export function Service(options: Options = {}): any { | ||
return function(target) { | ||
let base = {}; | ||
export function Service(options: Options = {}): Function { | ||
return function(constructor: Function | ||
) { | ||
let base = () => {}; | ||
const _options = _.extend({}, defaultServiceOptions, options); | ||
Object.defineProperty(base, 'name', { | ||
value: options.name || target.name, | ||
value: options.name || constructor.name, | ||
writable: false, | ||
@@ -125,3 +127,3 @@ enumerable: true | ||
const proto = target.prototype; | ||
const proto = constructor.prototype; | ||
const vars = []; | ||
@@ -132,12 +134,12 @@ Object.getOwnPropertyNames(proto).forEach(function(key) { | ||
// Override properties defined in @Service | ||
const ServiceClass = new target.prototype[key](); | ||
const ServiceClass = new constructor.prototype[key](); | ||
Object.getOwnPropertyNames(ServiceClass).forEach(function(key) { | ||
if ( | ||
blacklist.indexOf(key) === -1 && | ||
!_.isFunction(ServiceClass[key]) | ||
blacklist.indexOf(key) === -1 && | ||
!_.isFunction(ServiceClass[key]) | ||
) { | ||
base[key] = Object.getOwnPropertyDescriptor( | ||
ServiceClass, | ||
key | ||
ServiceClass, | ||
key | ||
)!.value; | ||
@@ -147,4 +149,4 @@ if (blacklist2.indexOf(key) === -1) { | ||
vars[key] = Object.getOwnPropertyDescriptor( | ||
ServiceClass, | ||
key | ||
ServiceClass, | ||
key | ||
)!.value; | ||
@@ -160,4 +162,4 @@ } | ||
const bypass: any = Object.defineProperty, // typescript fix | ||
obj: any = {}; // placeholder | ||
const bypass: any = Object.defineProperty; // typescript fix | ||
const obj: any = {}; // placeholder | ||
@@ -174,4 +176,4 @@ // Defining our 'own' created function | ||
Object.getOwnPropertyDescriptor(proto, 'created').value.call( | ||
this, | ||
broker | ||
this, | ||
broker | ||
); | ||
@@ -203,4 +205,4 @@ } | ||
base[key] | ||
? Object.assign(base[key], descriptor.value) | ||
: (base[key] = descriptor.value); | ||
? Object.assign(base[key], descriptor.value) | ||
: (base[key] = descriptor.value); | ||
return; | ||
@@ -207,0 +209,0 @@ } |
{ | ||
"compilerOptions": { | ||
"target": "es6", | ||
"sourceMap": false, | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"isolatedModules": false, | ||
"experimentalDecorators": true, | ||
"emitDecoratorMetadata": true, | ||
"declaration": true, | ||
"noImplicitAny": false, | ||
"removeComments": true, | ||
"noLib": false, | ||
"preserveConstEnums": true, | ||
"suppressImplicitAnyIndexErrors": true, | ||
"outDir": "dist", | ||
"baseUrl": "./src/app", | ||
"paths": { | ||
"*": [ | ||
"*" | ||
] | ||
} | ||
}, | ||
"exclude": [ | ||
"node_modules", | ||
"typings/main", | ||
"typings/main.d.ts" | ||
] | ||
} | ||
"compilerOptions": { | ||
"target": "es6", | ||
"sourceMap": false, | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"isolatedModules": false, | ||
"experimentalDecorators": true, | ||
"emitDecoratorMetadata": true, | ||
"declaration": true, | ||
"noImplicitAny": false, | ||
"removeComments": true, | ||
"noLib": false, | ||
"preserveConstEnums": true, | ||
"suppressImplicitAnyIndexErrors": true, | ||
"outDir": "dist", | ||
"baseUrl": "./src/app", | ||
"paths": { | ||
"*": [ | ||
"*" | ||
] | ||
} | ||
}, | ||
"include": [ | ||
"src/**/*.ts" | ||
], | ||
"exclude": [ | ||
"node_modules", | ||
"typings/main", | ||
"typings/main.d.ts" | ||
] | ||
} |
{ | ||
"rules": { | ||
"member-access": false, | ||
"rules": { | ||
"member-access": false, | ||
"member-ordering": [ | ||
@@ -80,3 +80,6 @@ true, | ||
"no-angle-bracket-type-assertion": true, | ||
"no-consecutive-blank-lines": [true, 2], | ||
"no-consecutive-blank-lines": [ | ||
true, | ||
2 | ||
], | ||
"one-line": [ | ||
@@ -90,3 +93,6 @@ true, | ||
], | ||
"one-variable-per-declaration": [true, "ignore-for-loop"], | ||
"one-variable-per-declaration": [ | ||
true, | ||
"ignore-for-loop" | ||
], | ||
"quotemark": [ | ||
@@ -152,3 +158,6 @@ true, | ||
] | ||
} | ||
} | ||
}, | ||
"rulesDirectory": [ | ||
"node_modules/tslint-eslint-rules/dist/rules" | ||
] | ||
} |
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
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
153828
13
11
470
Updatedlodash@^4.17.11
Updatedmoleculer@^0.13.7