@thisisagile/easy
Advanced tools
Comparing version 1.7.1 to 1.8.0
@@ -0,6 +1,6 @@ | ||
export * from "./data"; | ||
export * from "./domain"; | ||
export * from "./services"; | ||
export * from "./test"; | ||
export * from "./types"; | ||
export * from "./utils"; | ||
export * from "./validation"; |
@@ -13,5 +13,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./data"), exports); | ||
__exportStar(require("./domain"), exports); | ||
__exportStar(require("./services"), exports); | ||
__exportStar(require("./test"), exports); | ||
__exportStar(require("./types"), exports); | ||
@@ -18,0 +18,0 @@ __exportStar(require("./utils"), exports); |
@@ -0,1 +1,3 @@ | ||
export * from "./EasyRequest"; | ||
export * from "./EasyResponse"; | ||
export * from "./HttpStatus"; | ||
@@ -2,0 +4,0 @@ export * from "./HttpVerb"; |
@@ -13,2 +13,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./EasyRequest"), exports); | ||
__exportStar(require("./EasyResponse"), exports); | ||
__exportStar(require("./HttpStatus"), exports); | ||
@@ -15,0 +17,0 @@ __exportStar(require("./HttpVerb"), exports); |
@@ -0,2 +1,15 @@ | ||
import { List } from '../utils'; | ||
import { Uri } from '../types'; | ||
export declare const route: (route: Uri) => ClassDecorator; | ||
import { HttpVerb } from './HttpVerb'; | ||
export declare const route: (uri: Uri) => ClassDecorator; | ||
declare class Router { | ||
readonly resource: unknown; | ||
constructor(resource: unknown); | ||
get route(): Uri; | ||
get verbs(): List<{ | ||
verb: HttpVerb; | ||
f: Function; | ||
}>; | ||
} | ||
export declare const router: (resource: unknown) => Router; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.route = void 0; | ||
exports.router = exports.route = void 0; | ||
const utils_1 = require("../utils"); | ||
exports.route = (route) => (subject) => { | ||
utils_1.meta(subject).set('route', route); | ||
}; | ||
// <TFunction extends Function>(target: TFunction) => TFunction | void | ||
// // eslint-disable-next-line @typescript-eslint/ban-types | ||
// export function Route<T extends Verifiable>(uri: Uri): <TFunction extends Function>(target: TFunction) => void { | ||
// // eslint-disable-next-line @typescript-eslint/ban-types | ||
// return <TFunction extends Function>(target: TFunction): void => { | ||
// reflect(target).uri = uri; | ||
// reflect(target).route = uri.path; | ||
// // reflect(target).set("target", t); | ||
// }; | ||
// } | ||
exports.route = (uri) => (subject) => { utils_1.meta(subject).set('route', uri); }; | ||
class Router { | ||
constructor(resource) { | ||
this.resource = resource; | ||
} | ||
get route() { return utils_1.meta(this.resource).get('route'); } | ||
get verbs() { | ||
return utils_1.meta(this.resource).properties() | ||
.filter(p => p.get('verb')) | ||
.map(p => ({ verb: p.get('verb').verb, f: () => p.property })); | ||
} | ||
} | ||
exports.router = (resource) => new Router(resource); | ||
//# sourceMappingURL=Route.js.map |
@@ -7,5 +7,3 @@ "use strict"; | ||
const HttpStatus_1 = require("./HttpStatus"); | ||
const verb = (verb) => (subject, property) => { | ||
utils_1.meta(subject).property(property).set('verb', verb); | ||
}; | ||
const verb = (v) => (subject, property) => { utils_1.meta(subject).property(property).set('verb', v); }; | ||
exports.get = (onOk = HttpStatus_1.HttpStatus.Ok, onError = HttpStatus_1.HttpStatus.NotFound) => verb({ verb: HttpVerb_1.HttpVerb.Get, onOk, onError }); | ||
@@ -12,0 +10,0 @@ exports.put = (onOk = HttpStatus_1.HttpStatus.Ok, onError = HttpStatus_1.HttpStatus.BadRequest) => verb({ verb: HttpVerb_1.HttpVerb.Put, onOk, onError }); |
export * from "./Contraints"; | ||
export * from "../types/Results"; | ||
export * from "./Validate"; | ||
export * from "./When"; |
@@ -14,5 +14,4 @@ "use strict"; | ||
__exportStar(require("./Contraints"), exports); | ||
__exportStar(require("../types/Results"), exports); | ||
__exportStar(require("./Validate"), exports); | ||
__exportStar(require("./When"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@thisisagile/easy", | ||
"version": "1.7.1", | ||
"version": "1.8.0", | ||
"description": "Straightforward library for building domain-driven microservice architectures", | ||
@@ -5,0 +5,0 @@ "author": "Sander Hoogendoorn", |
@@ -0,6 +1,6 @@ | ||
export * from "./data"; | ||
export * from "./domain"; | ||
export * from "./services"; | ||
export * from "./test"; | ||
export * from "./types"; | ||
export * from "./utils"; | ||
export * from "./validation"; |
@@ -0,1 +1,3 @@ | ||
export * from "./EasyRequest"; | ||
export * from "./EasyResponse"; | ||
export * from "./HttpStatus"; | ||
@@ -2,0 +4,0 @@ export * from "./HttpVerb"; |
@@ -1,18 +0,21 @@ | ||
import { meta } from '../utils'; | ||
import { List, meta } from '../utils'; | ||
import { Uri } from '../types'; | ||
import { HttpVerb } from './HttpVerb'; | ||
import { Verb } from './Verb'; | ||
export const route = (route: Uri): ClassDecorator => | ||
(subject: Function): void => { | ||
meta(subject).set('route', route); | ||
}; | ||
export const route = (uri: Uri): ClassDecorator => | ||
(subject: Function): void => { meta(subject).set('route', uri); }; | ||
// <TFunction extends Function>(target: TFunction) => TFunction | void | ||
// // eslint-disable-next-line @typescript-eslint/ban-types | ||
// export function Route<T extends Verifiable>(uri: Uri): <TFunction extends Function>(target: TFunction) => void { | ||
// // eslint-disable-next-line @typescript-eslint/ban-types | ||
// return <TFunction extends Function>(target: TFunction): void => { | ||
// reflect(target).uri = uri; | ||
// reflect(target).route = uri.path; | ||
// // reflect(target).set("target", t); | ||
// }; | ||
// } | ||
class Router { | ||
constructor(readonly resource: unknown) {} | ||
get route(): Uri { return meta(this.resource).get('route'); } | ||
get verbs(): List<{ verb: HttpVerb, f: Function }> { | ||
return meta(this.resource).properties() | ||
.filter(p => p.get('verb')) | ||
.map(p => ({ verb: p.get<Verb>('verb').verb, f: () => p.property })); | ||
} | ||
} | ||
export const router = (resource: unknown) => new Router(resource); |
@@ -7,6 +7,4 @@ import { meta } from '../utils'; | ||
const verb = <T>(verb: Verb): PropertyDecorator => | ||
(subject: unknown, property: string): void => { | ||
meta(subject).property(property).set('verb', verb); | ||
}; | ||
const verb = <T>(v: Verb): PropertyDecorator => | ||
(subject: unknown, property: string): void => { meta(subject).property(property).set('verb', v); }; | ||
@@ -13,0 +11,0 @@ export const get = (onOk = HttpStatus.Ok, onError = HttpStatus.NotFound): PropertyDecorator => |
export * from "./Contraints"; | ||
export * from "../types/Results"; | ||
export * from "./Validate"; | ||
export * from "./When"; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
88128
151
1284