Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@methodus/framework-decorators

Package Overview
Dependencies
Maintainers
4
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@methodus/framework-decorators - npm Package Compare versions

Comparing version
7.0.14
to
8.0.1
+30
-9
package.json
{
"name": "@methodus/framework-decorators",
"version": "7.0.14",
"version": "8.0.1",
"description": "Server Decorators for methodus",

@@ -27,8 +27,13 @@ "main": "dist/index.js",

"license": "BSD-3-Clause",
"docs": {
"content": [
"readme.md"
]
},
"scripts": {
"build": "../../../node_modules/.bin/rimraf ./dist && yarn format & tsc",
"test": "../../../node_modules/.bin/jest --coverage && yarn coverage",
"coverage": "cp ./coverage/coverage-final.json ../../../coverage/coverage-decorators.json",
"docs": "../../../node_modules/.bin/rimraf ../../../docs/modules/framework/decorators && ../../../node_modules/.bin/typedoc && node ../../../docs/docs.js modules/framework/decorators",
"format": "../../../node_modules/.bin/prettier -c --write ./src"
"build": "yarn rimraf ./dist && yarn tsc",
"test": "yarn jest --coverage && yarn run coverage",
"coverage": "yarn cpr ./coverage/coverage-final.json ../../../coverage/coverage-decorators.json -o",
"docs": "yarn rimraf ../../../docs/modules/framework/decorators && yarn typedoc ./src && node ../../../docs/docs.js modules/framework/decorators",
"format": "yarn prettier -c --write ./src"
},

@@ -38,7 +43,23 @@ "publishConfig": {

},
"dependencies": {
"reflect-metadata": "^0.1.13"
},
"devDependencies": {
"@methodus/framework-commons": "^7.0.10",
"@methodus/framework-injection": "^7.0.11"
"@methodus/framework-commons": "^8.0.1",
"@methodus/framework-injection": "^8.0.1",
"@types/jest": "^26.0.15",
"@types/node": "^10.0.0",
"cpr": "^3.0.1",
"docsify": "^4.10.2",
"jest": "^26.6.3",
"jest-html-reporters": "^2.1.0",
"prettier": "^2.0.5",
"replace-in-file": "^6.1.0",
"rimraf": "^3.0.1",
"ts-jest": "^26.4.4",
"typedoc": "^0.20.36",
"typedoc-plugin-markdown": "^3.0.11",
"typescript": "^4.1.2"
},
"gitHead": "e3d15e3950a8347222e5994be1e2b97a5bdd0f74"
"gitHead": "bf78ff0fe7029a2a93012821a304e34e95164b40"
}
import 'reflect-metadata';
import { Dictionary, AuthType, ClassRef } from '@methodus/framework-commons';
export declare function Auth(type: AuthType, options?: Dictionary | Function): (target: ClassRef) => void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Auth = void 0;
require("reflect-metadata");
function Auth(type, options) {
return function (target) {
var original = target.prototype.constructor;
original.prototype.options = original.prototype.options || {
servers: [],
classes: [],
clients: [],
plugins: [],
};
if (!original.methodus) {
original.prototype.methodus[original.name]._auth = {
type: type,
options: options,
};
}
else {
original.methodus[original.name]._auth = {
type: type,
options: options,
};
}
};
}
exports.Auth = Auth;
//# sourceMappingURL=auth.js.map
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/auth/auth.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAO1B,SAAgB,IAAI,CAAC,IAAc,EAAE,OAA+B;IAChE,OAAO,UAAC,MAAgB;QACpB,IAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC;QAC9C,QAAQ,CAAC,SAAS,CAAC,OAAO,GAAG,QAAQ,CAAC,SAAS,CAAC,OAAO,IAAI;YACvD,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;SACd,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACpB,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,GAAG;gBAC/C,IAAI,EAAE,IAAI;gBACV,OAAO,EAAE,OAAO;aACnB,CAAC;SACL;aAAM;YACH,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,GAAG;gBACrC,IAAI,EAAE,IAAI;gBACV,OAAO,EAAE,OAAO;aACnB,CAAC;SACL;IACL,CAAC,CAAC;AACN,CAAC;AAtBD,oBAsBC"}
export * from './auth';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./auth"), exports);
//# sourceMappingURL=index.js.map
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAuB"}
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var router_1 = require("./router");
var client_1 = require("./client");
var plugin_1 = require("./plugin");
var server_1 = require("./server");
var TestAll = (function () {
function TestAll() {
}
TestAll_1 = TestAll;
var TestAll_1;
TestAll = TestAll_1 = __decorate([
plugin_1.PluginConfiguration('SomePlugin'),
client_1.ClientConfiguration(TestAll_1, 'Http'),
router_1.RouterConfiguration(TestAll_1, 'SomeServer'),
server_1.ServerConfiguration('Express', {})
], TestAll);
return TestAll;
}());
describe('Class decorators', function () {
it('Create class', function () {
var module = new TestAll();
expect(module).toBeDefined();
});
});
//# sourceMappingURL=class.spec.js.map
{"version":3,"file":"class.spec.js","sourceRoot":"","sources":["../../src/class/class.spec.ts"],"names":[],"mappings":";;;;;;;;AAAA,mCAA+C;AAC/C,mCAA+C;AAC/C,mCAA+C;AAC/C,mCAA+C;AAM/C;IAAA;IAAe,CAAC;gBAAV,OAAO;;IAAP,OAAO;QAJZ,4BAAmB,CAAC,YAAY,CAAC;QACjC,4BAAmB,CAAC,SAAO,EAAE,MAAM,CAAC;QACpC,4BAAmB,CAAC,SAAO,EAAE,YAAY,CAAC;QAC1C,4BAAmB,CAAC,SAAS,EAAE,EAAE,CAAC;OAC7B,OAAO,CAAG;IAAD,cAAC;CAAA,AAAhB,IAAgB;AAEhB,QAAQ,CAAC,kBAAkB,EAAE;IACzB,EAAE,CAAC,cAAc,EAAE;QACf,IAAM,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;IACjC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
import 'reflect-metadata';
import { ClassRef } from '@methodus/framework-commons';
export declare function ClientConfiguration(controller: ClassRef, transportType: any, resolver?: Function | string): (target: ClassRef) => void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClientConfiguration = void 0;
require("reflect-metadata");
function ClientConfiguration(controller, transportType, resolver) {
return function (target) {
var original = target.prototype.constructor;
original.prototype.options = original.prototype.options || {
servers: [],
classes: [],
clients: [],
plugins: [],
};
original.prototype.options.clients.push({
classType: controller,
controller: controller,
transportType: transportType,
resolver: resolver,
});
};
}
exports.ClientConfiguration = ClientConfiguration;
//# sourceMappingURL=client.js.map
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/class/client.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAO1B,SAAgB,mBAAmB,CAC/B,UAAoB,EACpB,aAAkB,EAClB,QAA4B;IAE5B,OAAO,UAAC,MAAgB;QACpB,IAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC;QAC9C,QAAQ,CAAC,SAAS,CAAC,OAAO,GAAG,QAAQ,CAAC,SAAS,CAAC,OAAO,IAAI;YACvD,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;SACd,CAAC;QACF,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;YACpC,SAAS,EAAE,UAAU;YACrB,UAAU,YAAA;YACV,aAAa,eAAA;YACb,QAAQ,UAAA;SACX,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC;AApBD,kDAoBC"}
export * from './client';
export * from './server';
export * from './router';
export * from './plugin';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./client"), exports);
__exportStar(require("./server"), exports);
__exportStar(require("./router"), exports);
__exportStar(require("./plugin"), exports);
//# sourceMappingURL=index.js.map
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/class/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB"}
import 'reflect-metadata';
import { Dictionary, ClassRef } from '@methodus/framework-commons';
export declare function PluginConfiguration(name: string, options?: Dictionary): (target: ClassRef) => void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PluginConfiguration = void 0;
require("reflect-metadata");
function PluginConfiguration(name, options) {
return function (target) {
var original = target.prototype.constructor;
original.prototype.options = original.prototype.options || {
servers: [],
classes: [],
clients: [],
plugins: [],
};
original.prototype.options.plugins.push({ name: name, options: options });
};
}
exports.PluginConfiguration = PluginConfiguration;
//# sourceMappingURL=plugin.js.map
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/class/plugin.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAO1B,SAAgB,mBAAmB,CAAC,IAAY,EAAE,OAAoB;IAClE,OAAO,UAAC,MAAgB;QACpB,IAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC;QAC9C,QAAQ,CAAC,SAAS,CAAC,OAAO,GAAG,QAAQ,CAAC,SAAS,CAAC,OAAO,IAAI;YACvD,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;SACd,CAAC;QACF,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,MAAA,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC;IAU/D,CAAC,CAAC;AACN,CAAC;AApBD,kDAoBC"}
import 'reflect-metadata';
import { ServerType, ServerDefinition, ClassRef } from '@methodus/framework-commons';
export declare function RouterConfiguration(controller: ClassRef | null, serverType: ServerType | string | ServerDefinition | any): (target: ClassRef) => void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RouterConfiguration = void 0;
require("reflect-metadata");
var framework_commons_1 = require("@methodus/framework-commons");
function RouterConfiguration(controller, serverType) {
return function (target) {
var original = target.prototype.constructor;
original.prototype.options = original.prototype.options || {
servers: [],
classes: [],
clients: [],
plugins: [],
};
original.prototype.options.classes.push({
classType: controller,
controller: controller,
methodType: framework_commons_1.MethodType.Local,
serverType: serverType,
});
};
}
exports.RouterConfiguration = RouterConfiguration;
//# sourceMappingURL=router.js.map
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/class/router.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAC1B,iEAKqC;AAMrC,SAAgB,mBAAmB,CAC/B,UAA2B,EAC3B,UAAwD;IAExD,OAAO,UAAC,MAAgB;QACpB,IAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC;QAC9C,QAAQ,CAAC,SAAS,CAAC,OAAO,GAAG,QAAQ,CAAC,SAAS,CAAC,OAAO,IAAI;YACvD,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;SACd,CAAC;QACF,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;YACpC,SAAS,EAAE,UAAU;YACrB,UAAU,YAAA;YACV,UAAU,EAAE,8BAAU,CAAC,KAAK;YAC5B,UAAU,YAAA;SACb,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC;AAnBD,kDAmBC"}
import 'reflect-metadata';
import { ServerType, ServerDefinition, Dictionary, ClassRef } from '@methodus/framework-commons';
export declare function ServerConfiguration(serverType: ServerType | string | ServerDefinition | any, options?: Dictionary): (target: ClassRef) => void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ServerConfiguration = void 0;
require("reflect-metadata");
function ServerConfiguration(serverType, options) {
return function (target) {
var original = target.prototype.constructor;
original.prototype.options = original.prototype.options || {
servers: [],
classes: [],
clients: [],
plugins: [],
};
original.prototype.options.servers.push({ serverType: serverType, options: options });
};
}
exports.ServerConfiguration = ServerConfiguration;
//# sourceMappingURL=server.js.map
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/class/server.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAY1B,SAAgB,mBAAmB,CAC/B,UAAwD,EACxD,OAAoB;IAEpB,OAAO,UAAC,MAAgB;QACpB,IAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC;QAC9C,QAAQ,CAAC,SAAS,CAAC,OAAO,GAAG,QAAQ,CAAC,SAAS,CAAC,OAAO,IAAI;YACvD,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;SACd,CAAC;QACF,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,UAAU,YAAA,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC;IACrE,CAAC,CAAC;AACN,CAAC;AAdD,kDAcC"}
import { ClientConfiguration as _ClientConfiguration, PluginConfiguration as _PluginConfiguration, RouterConfiguration as _RouterConfiguration, ServerConfiguration as _ServerConfiguration } from './class';
import { Module as _Module, ModuleConfiguration as _ModuleConfiguration } from './module';
import { Auth as _Auth } from './auth';
import { Proxy as _Proxy } from './proxy/proxy';
import { Method as _Method, MethodPipe as _MethodPipe, MethodConfig as _MethodConfig, MethodMock as _MethodMock } from './method';
export declare namespace framework.decorators {
const Method: typeof _Method;
const MethodPipe: typeof _MethodPipe;
const MethodConfig: typeof _MethodConfig;
const MethodMock: typeof _MethodMock;
const Proxy: typeof _Proxy;
const Auth: typeof _Auth;
const ModuleConfiguration: typeof _ModuleConfiguration;
const Module: typeof _Module;
const ClientConfiguration: typeof _ClientConfiguration;
const PluginConfiguration: typeof _PluginConfiguration;
const RouterConfiguration: typeof _RouterConfiguration;
const ServerConfiguration: typeof _ServerConfiguration;
}
declare const _default: typeof framework.decorators;
export default _default;
export * from './proxy/proxy';
export * from './auth';
export * from './module';
export * from './class';
export * from './method';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.framework = void 0;
var class_1 = require("./class");
var module_1 = require("./module");
var auth_1 = require("./auth");
var proxy_1 = require("./proxy/proxy");
var method_1 = require("./method");
var framework;
(function (framework) {
var decorators;
(function (decorators) {
decorators.Method = method_1.Method;
decorators.MethodPipe = method_1.MethodPipe;
decorators.MethodConfig = method_1.MethodConfig;
decorators.MethodMock = method_1.MethodMock;
decorators.Proxy = proxy_1.Proxy;
decorators.Auth = auth_1.Auth;
decorators.ModuleConfiguration = module_1.ModuleConfiguration;
decorators.Module = module_1.Module;
decorators.ClientConfiguration = class_1.ClientConfiguration;
decorators.PluginConfiguration = class_1.PluginConfiguration;
decorators.RouterConfiguration = class_1.RouterConfiguration;
decorators.ServerConfiguration = class_1.ServerConfiguration;
})(decorators = framework.decorators || (framework.decorators = {}));
})(framework = exports.framework || (exports.framework = {}));
exports.default = framework.decorators;
__exportStar(require("./proxy/proxy"), exports);
__exportStar(require("./auth"), exports);
__exportStar(require("./module"), exports);
__exportStar(require("./class"), exports);
__exportStar(require("./method"), exports);
//# sourceMappingURL=index.js.map
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,iCAKiB;AACjB,mCAGkB;AAClB,+BAAuC;AACvC,uCAAgD;AAChD,mCAKkB;AAElB,IAAiB,SAAS,CAczB;AAdD,WAAiB,SAAS;IAAC,IAAA,UAAU,CAcpC;IAd0B,WAAA,UAAU;QACpB,iBAAM,GAAG,eAAO,CAAC;QACjB,qBAAU,GAAG,mBAAW,CAAC;QACzB,uBAAY,GAAG,qBAAa,CAAC;QAC7B,qBAAU,GAAG,mBAAW,CAAC;QACzB,gBAAK,GAAG,aAAM,CAAC;QAEf,eAAI,GAAG,WAAK,CAAC;QACb,8BAAmB,GAAG,4BAAoB,CAAC;QAC3C,iBAAM,GAAG,eAAO,CAAC;QACjB,8BAAmB,GAAG,2BAAoB,CAAC;QAC3C,8BAAmB,GAAG,2BAAoB,CAAC;QAC3C,8BAAmB,GAAG,2BAAoB,CAAC;QAC3C,8BAAmB,GAAG,2BAAoB,CAAC;IAC5D,CAAC,EAd0B,UAAU,GAAV,oBAAU,KAAV,oBAAU,QAcpC;AAAD,CAAC,EAdgB,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAczB;AAED,kBAAe,SAAS,CAAC,UAAU,CAAC;AACpC,gDAA8B;AAC9B,yCAAuB;AACvB,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB"}
export * from './method';
export * from './method-config';
export * from './method-mock';
export * from './method-pipe';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./method"), exports);
__exportStar(require("./method-config"), exports);
__exportStar(require("./method-mock"), exports);
__exportStar(require("./method-pipe"), exports);
//# sourceMappingURL=index.js.map
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/method/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB;AACzB,kDAAgC;AAChC,gDAA8B;AAC9B,gDAA8B"}
import 'reflect-metadata';
export declare function MethodConfig(name: string, middlewares?: any[], prefix?: string): (target: any) => void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MethodConfig = void 0;
require("reflect-metadata");
var framework_injection_1 = require("@methodus/framework-injection");
function MethodConfig(name, middlewares, prefix) {
return function (target) {
framework_injection_1.default.Injector.inject(framework_injection_1.default.RegistrationTypes.Controller, target, name);
var instance = framework_injection_1.default.Injector.get(name);
var existingMetadata = framework_injection_1.default.Injector.get(name) || {};
existingMetadata.name = name;
var proto = target.prototype || target.__proto__;
if (target.methodus) {
proto = target;
}
if (!proto.methodus) {
return;
}
proto.methodus[name] = proto.methodus[name] || {
_auth: {},
_events: {},
_descriptors: {},
};
proto.methodus[name].name = name;
if (prefix) {
proto.methodus[name].prefix = prefix;
}
if (Object.keys(proto.methodus).length > 1) {
var baseClass = Object.values(proto.methodus).filter(function (item) {
return item.isBase;
});
var baseClone = baseClass[0]
? JSON.parse(JSON.stringify(baseClass[0]._descriptors))
: {};
var targetClone = JSON.parse(JSON.stringify(proto.methodus[name]._descriptors));
var new_assign = Object.assign({}, baseClone, targetClone);
proto.methodus[name]._descriptors = new_assign;
}
proto.methodus[name].middlewares = middlewares;
existingMetadata.middlewares = middlewares;
framework_injection_1.default.ClassContainer.set(name, existingMetadata);
Object.values(proto.methodus[name]._descriptors).forEach(function (descriptor) {
return instance[descriptor.propertyKey];
});
};
}
exports.MethodConfig = MethodConfig;
//# sourceMappingURL=method-config.js.map
{"version":3,"file":"method-config.js","sourceRoot":"","sources":["../../src/method/method-config.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAC1B,qEAAsD;AAMtD,SAAgB,YAAY,CACxB,IAAY,EACZ,WAAmB,EACnB,MAAe;IAEf,OAAO,UAAC,MAAW;QAEf,6BAAS,CAAC,QAAQ,CAAC,MAAM,CACrB,6BAAS,CAAC,iBAAiB,CAAC,UAAU,EACtC,MAAM,EACN,IAAI,CACP,CAAC;QACF,IAAM,QAAQ,GAAG,6BAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAE9C,IAAM,gBAAgB,GAAG,6BAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QAC5D,gBAAgB,CAAC,IAAI,GAAG,IAAI,CAAC;QAC7B,IAAI,KAAK,GAAG,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC;QAEjD,IAAI,MAAM,CAAC,QAAQ,EAAE;YAEjB,KAAK,GAAG,MAAM,CAAC;SAClB;QAED,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YACjB,OAAO;SACV;QACD,KAAK,CAAC,QAAQ,C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AC,GAAG,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;QAErD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,CACpD,UAAC,UAAe;YACZ,OAAO,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC5C,CAAC,CACJ,CAAC;IACN,CAAC,CAAC;AACN,CAAC;AAhED,oCAgEC"}
/// <reference path="method.d.ts" />
import 'reflect-metadata';
export declare function MethodMock(mockedResult: any): (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<any>) => TypedPropertyDescriptor<any>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MethodMock = void 0;
require("reflect-metadata");
function MethodMock(mockedResult) {
return function (target, propertyKey, descriptor) {
var name = target.name || target.constructor.name;
var methodus = target.methodus[name];
methodus._mocks = methodus._mocks || {};
if (typeof mockedResult === 'function') {
methodus._mocks[propertyKey] = mockedResult;
}
else {
methodus._mocks[propertyKey] = function () { return mockedResult; };
}
return descriptor;
};
}
exports.MethodMock = MethodMock;
//# sourceMappingURL=method-mock.js.map
{"version":3,"file":"method-mock.js","sourceRoot":"","sources":["../../src/method/method-mock.ts"],"names":[],"mappings":";;;AAEA,4BAA0B;AAI1B,SAAgB,UAAU,CAAC,YAAiB;IACxC,OAAO,UACH,MAAW,EACX,WAAmB,EACnB,UAAwC;QAExC,IAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC;QACpD,IAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACvC,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC;QAExC,IAAI,OAAO,YAAY,KAAK,UAAU,EAAE;YACpC,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,YAAY,CAAC;SAC/C;aAAM;YACH,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,cAAM,OAAA,YAAY,EAAZ,CAAY,CAAC;SACrD;QAED,OAAO,UAAU,CAAC;IACtB,CAAC,CAAC;AACN,CAAC;AAlBD,gCAkBC"}
import 'reflect-metadata';
export declare function MethodPipe(verb?: string, route?: string, middlewares?: Function[]): (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<any>) => any;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MethodPipe = void 0;
require("reflect-metadata");
var framework_injection_1 = require("@methodus/framework-injection");
var methodMetadataKey = 'methodus';
function MethodPipe(verb, route, middlewares) {
var _this = this;
return function (target, propertyKey, descriptor) {
target.methodus = target.methodus || {};
var name = target.name || target.constructor.name;
target.methodus[name] = target.methodus[name] || {
_auth: {},
_events: {},
_descriptors: {},
};
target.methodus = target.methodus || {};
var mTarget = target.methodus[name];
var metaObject = Object.assign({}, { verb: verb, route: route, propertyKey: propertyKey, middlewares: middlewares, params: [] });
if (mTarget._descriptors[propertyKey]) {
Object.assign(metaObject, {
params: mTarget._descriptors[propertyKey].params,
});
}
Reflect.defineMetadata(methodMetadataKey, metaObject, target, propertyKey);
mTarget._descriptors[propertyKey] = metaObject;
var paramsMap = metaObject.params;
paramsMap.sort(function (a, b) {
return a.index - b.index;
});
var methodHandler = framework_injection_1.default.Injector.get('MethodPipeHandler');
return methodHandler.methodDecorator.apply(_this, [
target,
propertyKey,
descriptor,
verb,
route,
middlewares,
]);
};
}
exports.MethodPipe = MethodPipe;
//# sourceMappingURL=method-pipe.js.map
{"version":3,"file":"method-pipe.js","sourceRoot":"","sources":["../../src/method/method-pipe.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAC1B,qEAAsD;AACtD,IAAM,iBAAiB,GAAG,UAAU,CAAC;AAMrC,SAAgB,UAAU,CACtB,IAAa,EACb,KAAc,EACd,WAAwB;IAH5B,iBAsDC;IAjDG,OAAO,UACH,MAAW,EACX,WAAmB,EACnB,UAAwC;QAExC,MAA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ClE,OAAO,aAAa,CAAC,eAAe,CAAC,KAAK,CAAC,KAAI,EAAE;YAC7C,MAAM;YACN,WAAW;YACX,UAAU;YACV,IAAI;YACJ,KAAK;YACL,WAAW;SACd,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC;AAtDD,gCAsDC"}
import 'reflect-metadata';
export declare function Method(verb?: string, route?: string, middlewares?: Function[]): (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<any>) => any;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Method = void 0;
require("reflect-metadata");
var framework_injection_1 = require("@methodus/framework-injection");
var methodMetadataKey = 'methodus';
function Method(verb, route, middlewares) {
var _this = this;
return function (target, propertyKey, descriptor) {
target.methodus = target.methodus || {};
var name = target.name || target.constructor.name;
target.methodus[name] = target.methodus[name] || {
_auth: {},
_events: {},
_descriptors: {},
};
target.methodus = target.methodus || {};
var mTarget = target.methodus[name];
var metaObject = Object.assign({}, { verb: verb, route: route, propertyKey: propertyKey, middlewares: middlewares, params: [] });
if (mTarget._descriptors[propertyKey]) {
Object.assign(metaObject, {
params: mTarget._descriptors[propertyKey].params,
});
}
Reflect.defineMetadata(methodMetadataKey, metaObject, target, propertyKey);
mTarget._descriptors[propertyKey] = metaObject;
var paramsMap = metaObject.params;
paramsMap.sort(function (a, b) {
return a.index - b.index;
});
var methodHandler = framework_injection_1.default.Injector.get('MethodHandler');
return methodHandler.methodDecorator.apply(_this, [
target,
propertyKey,
descriptor,
verb,
route,
middlewares,
]);
};
}
exports.Method = Method;
//# sourceMappingURL=method.js.map
{"version":3,"file":"method.js","sourceRoot":"","sources":["../../src/method/method.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAC1B,qEAAsD;AACtD,IAAM,iBAAiB,GAAG,UAAU,CAAC;AAMrC,SAAgB,MAAM,CAClB,IAAa,EACb,KAAc,EACd,WAAwB;IAH5B,iBAsDC;IAjDG,OAAO,UACH,MAAW,EACX,WAAmB,EACnB,UAAwC;QAExC,MAAM,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OAAO,aAAa,CAAC,eAAe,CAAC,KAAK,CAAC,KAAI,EAAE;YAC7C,MAAM;YACN,WAAW;YACX,UAAU;YACV,IAAI;YACJ,KAAK;YACL,WAAW;SACd,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC;AAtDD,wBAsDC"}
export * from './module';
export * from './module-config';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./module"), exports);
__exportStar(require("./module-config"), exports);
//# sourceMappingURL=index.js.map
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/module/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB;AACzB,kDAAgC"}
import 'reflect-metadata';
import { ClassRef } from '@methodus/framework-commons';
export declare function ModuleConfiguration(moduleClass: ClassRef): (target: ClassRef) => void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ModuleConfiguration = void 0;
require("reflect-metadata");
function ModuleConfiguration(moduleClass) {
return function (target) {
var moduleClassInfo = moduleClass.prototype.constructor;
if (!moduleClassInfo.prototype.options) {
throw new Error('Empty module.');
}
var original = target.prototype.constructor;
original.prototype.options = original.prototype.options || {
servers: [],
classes: [],
clients: [],
plugins: [],
};
var setupObject = original.prototype.options;
var moduleObject = moduleClassInfo.prototype.options;
setupObject.classes = setupObject.classes.concat(moduleObject.classes);
setupObject.servers = setupObject.servers.concat(moduleObject.servers);
setupObject.clients = setupObject.clients.concat(moduleObject.clients);
setupObject.plugins = setupObject.plugins.concat(moduleObject.plugins);
};
}
exports.ModuleConfiguration = ModuleConfiguration;
//# sourceMappingURL=module-config.js.map
{"version":3,"file":"module-config.js","sourceRoot":"","sources":["../../src/module/module-config.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAM1B,SAAgB,mBAAmB,CAAC,WAAqB;IACrD,OAAO,UAAC,MAAgB;QACpB,IAAM,eAAe,GAAG,WAAW,CAAC,SAAS,CAAC,WAAW,CAAC;QAC1D,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,OAAO,EAAE;YACpC,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;SACpC;QAED,IAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC;QAC9C,QAAQ,CAAC,SAAS,CAAC,OAAO,GAAG,QAAQ,CAAC,SAAS,CAAC,OAAO,IAAI;YACvD,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;SACd,CAAC;QACF,IAAM,WAAW,GAAG,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC;QAC/C,IAAM,YAAY,GAAG,eAAe,CAAC,SAAS,CAAC,OAAO,CAAC;QACvD,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACvE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACvE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACvE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAC3E,CAAC,CAAC;AACN,CAAC;AArBD,kDAqBC"}
import 'reflect-metadata';
import { ModuleTargetClass } from '@methodus/framework-commons';
export declare function Module(name?: string): (target: ModuleTargetClass) => void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Module = void 0;
require("reflect-metadata");
var framework_injection_1 = require("@methodus/framework-injection");
function Module(name) {
return function (target) {
var original = target.prototype.constructor;
original.prototype.options = original.prototype.options || {
servers: [],
classes: [],
clients: [],
plugins: [],
};
if (name) {
original.prototype.options.name = name;
}
framework_injection_1.default.Injector.inject(framework_injection_1.default.RegistrationTypes.Module, target, name);
};
}
exports.Module = Module;
//# sourceMappingURL=module.js.map
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/module/module.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAC1B,qEAAsD;AAKtD,SAAgB,MAAM,CAAC,IAAa;IAChC,OAAO,UAAC,MAAyB;QAC7B,IAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC;QAC9C,QAAQ,CAAC,SAAS,CAAC,OAAO,GAAG,QAAQ,CAAC,SAAS,CAAC,OAAO,IAAI;YACvD,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;SACd,CAAC;QAEF,IAAI,IAAI,EAAE;YACN,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;SAC1C;QAED,6BAAS,CAAC,QAAQ,CAAC,MAAM,CACrB,6BAAS,CAAC,iBAAiB,CAAC,MAAM,EAClC,MAAM,EACN,IAAI,CACP,CAAC;IACN,CAAC,CAAC;AACN,CAAC;AApBD,wBAoBC"}
export declare class ModuleClass {
name: string;
constructor();
}
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ModuleClass = void 0;
var module_1 = require("./module");
var ModuleClass = (function () {
function ModuleClass() {
this.name = 'ModuleClass';
}
ModuleClass = __decorate([
module_1.Module(),
__metadata("design:paramtypes", [])
], ModuleClass);
return ModuleClass;
}());
exports.ModuleClass = ModuleClass;
describe('Module decorators', function () {
it('Create module', function () {
var module = new ModuleClass();
expect(module).toBeDefined();
});
});
//# sourceMappingURL=module.spec.js.map
{"version":3,"file":"module.spec.js","sourceRoot":"","sources":["../../src/module/module.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;AAUA,mCAAkC;AAGlC;IAEI;QACI,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC9B,CAAC;IAJQ,WAAW;QADvB,eAAM,EAAE;;OACI,WAAW,CAKvB;IAAD,kBAAC;CAAA,AALD,IAKC;AALY,kCAAW;AAexB,QAAQ,CAAC,mBAAmB,EAAE;IAC1B,EAAE,CAAC,eAAe,EAAE;QAChB,IAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QACjC,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;IACjC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
import { ClassRef } from '@methodus/framework-commons';
export declare class Proxy {
static ProxyClass(packageName: string, className: string, localClassPath: string): (target: ClassRef) => ClassRef;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Proxy = void 0;
var framework_commons_1 = require("@methodus/framework-commons");
var Proxy = (function () {
function Proxy() {
}
Proxy.ProxyClass = function (packageName, className, localClassPath) {
return function (target) {
var methodus = framework_commons_1.default.util.maybeMethodus(target)[className];
if (!methodus) {
throw new Error("error finding configuration " + packageName + " " + className + "," + localClassPath);
}
framework_commons_1.default.logger.info("using the contract class for " + className);
return target;
};
};
return Proxy;
}());
exports.Proxy = Proxy;
//# sourceMappingURL=proxy.js.map
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/proxy/proxy.ts"],"names":[],"mappings":";;;AAAA,iEAAgE;AAIhE;IAAA;IAsEA,CAAC;IArEiB,gBAAU,GAAxB,UACI,WAAmB,EACnB,SAAiB,EACjB,cAAsB;QAEtB,OAAO,UAAC,MAAgB;YACpB,IAAM,QAAQ,GAAG,2BAAO,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC;YAQ/D,IAAI,CAAC,QAAQ,EAAE;gBACX,MAAM,IAAI,KAAK,CACX,iCAA+B,WAAW,SAAI,SAAS,SAAI,cAAgB,CAC9E,CAAC;aACL;YA+CD,2BAAO,CAAC,MAAM,CAAC,IAAI,CAAC,kCAAgC,SAAW,CAAC,CAAC;YACjE,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC;IACN,CAAC;IACL,YAAC;AAAD,CAAC,AAtED,IAsEC;AAtEY,sBAAK"}
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var proxy_1 = require("./proxy");
var method_config_1 = require("../method/method-config");
var method_1 = require("../method/method");
var framework_injection_1 = require("@methodus/framework-injection");
var MethodHandler = (function () {
function MethodHandler() {
}
MethodHandler.prototype.methodDecorator = function () { };
MethodHandler = __decorate([
framework_injection_1.default.Injectable('MethodHandler')
], MethodHandler);
return MethodHandler;
}());
framework_injection_1.default.Injector.register(MethodHandler, [], framework_injection_1.default.RegistrationTypes.Service, 'MethodHandler');
var TestClass = (function () {
function TestClass() {
}
TestClass.prototype.add = function () { };
__decorate([
method_1.Method(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], TestClass.prototype, "add", null);
TestClass = __decorate([
method_config_1.MethodConfig('TestClass'),
proxy_1.Proxy.ProxyClass('me', 'TestClass', '')
], TestClass);
return TestClass;
}());
describe('Test Proxy decorator', function () {
it('createNew', function () { return __awaiter(void 0, void 0, void 0, function () {
var result;
return __generator(this, function (_a) {
result = new TestClass();
expect(result).not.toBeNull();
return [2];
});
}); });
});
//# sourceMappingURL=proxy.spec.js.map
{"version":3,"file":"proxy.spec.js","sourceRoot":"","sources":["../../src/proxy/proxy.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAgC;AAChC,yDAAuD;AACvD,2CAA0C;AAC1C,qEAAsD;AAGtD;IAAA;IAEA,CAAC;IADG,uCAAe,GAAf,cAAmB,CAAC;IADlB,aAAa;QADlB,6BAAS,CAAC,UAAU,CAAC,eAAe,CAAC;OAChC,aAAa,CAElB;IAAD,oBAAC;CAAA,AAFD,IAEC;AAED,6BAAS,CAAC,QAAQ,CAAC,QAAQ,CACvB,aAAa,EACb,EAAE,EACF,6BAAS,CAAC,iBAAiB,CAAC,OAAO,EACnC,eAAe,CAClB,CAAC;AAIF;IAAA;IAGA,CAAC;IADU,uBAAG,GAAV,cAAc,CAAC;IAAf;QADC,eAAM,EAAE;;;;wCACM;IAFb,SAAS;QAFd,4BAAY,CAAC,WAAW,CAAC;QACzB,aAAK,CAAC,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,EAAE,CAAC;OAClC,SAAS,CAGd;IAAD,gBAAC;CAAA,AAHD,IAGC;AAED,QAAQ,CAAC,sBAAsB,EAAE;IAC7B,EAAE,CAAC,WAAW,EAAE;;;YACN,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;YAC/B,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;;;SACjC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var proxy_1 = require("./proxy");
var method_config_1 = require("../method/method-config");
var method_1 = require("../method/method");
var framework_injection_1 = require("@methodus/framework-injection");
var MethodHandler = (function () {
function MethodHandler() {
}
MethodHandler.prototype.methodDecorator = function () { };
MethodHandler = __decorate([
framework_injection_1.default.Inject('MethodHandler')
], MethodHandler);
return MethodHandler;
}());
framework_injection_1.default.Injector.register(MethodHandler, [], framework_injection_1.default.RegistrationTypes.Service, 'MethodHandler');
var TestClass = (function () {
function TestClass() {
}
TestClass.prototype.add = function () { };
__decorate([
method_1.Method(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], TestClass.prototype, "add", null);
TestClass = __decorate([
method_config_1.MethodConfig('TestClass'),
proxy_1.Proxy.ProxyClass('me', 'TestClass', '')
], TestClass);
return TestClass;
}());
new TestClass();
//# sourceMappingURL=proxy.test.js.map
{"version":3,"file":"proxy.test.js","sourceRoot":"","sources":["../../src/proxy/proxy.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAAgC;AAChC,yDAAuD;AACvD,2CAA0C;AAC1C,qEAAsD;AAGtD;IAAA;IAEA,CAAC;IADG,uCAAe,GAAf,cAAmB,CAAC;IADlB,aAAa;QADlB,6BAAS,CAAC,MAAM,CAAC,eAAe,CAAC;OAC5B,aAAa,CAElB;IAAD,oBAAC;CAAA,AAFD,IAEC;AAED,6BAAS,CAAC,QAAQ,CAAC,QAAQ,CACvB,aAAa,EACb,EAAE,EACF,6BAAS,CAAC,iBAAiB,CAAC,OAAO,EACnC,eAAe,CAClB,CAAC;AAIF;IAAA;IAGA,CAAC;IADU,uBAAG,GAAV,cAAc,CAAC;IAAf;QADC,eAAM,EAAE;;;;wCACM;IAFb,SAAS;QAFd,4BAAY,CAAC,WAAW,CAAC;QACzB,aAAK,CAAC,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,EAAE,CAAC;OAClC,SAAS,CAGd;IAAD,gBAAC;CAAA,AAHD,IAGC;AAED,IAAI,SAAS,EAAE,CAAC"}
"use strict";
//# sourceMappingURL=class.test.js.map
{"version":3,"file":"class.test.js","sourceRoot":"","sources":["../../../src/proxy/test/class.test.ts"],"names":[],"mappings":""}
"use strict";
//# sourceMappingURL=proxy.test.js.map
{"version":3,"file":"proxy.test.js","sourceRoot":"","sources":["../../../src/proxy/test/proxy.test.ts"],"names":[],"mappings":""}