@thisisagile/easy
Advanced tools
Comparing version 1.11.0 to 1.11.1
@@ -16,3 +16,2 @@ "use strict"; | ||
} | ||
; | ||
get error() { | ||
@@ -25,5 +24,4 @@ var _a; | ||
} | ||
; | ||
} | ||
exports.EasyResponse = EasyResponse; | ||
//# sourceMappingURL=EasyResponse.js.map |
@@ -15,2 +15,3 @@ import { Enum } from '../types'; | ||
get isError(): boolean; | ||
get status(): number; | ||
} |
@@ -9,2 +9,3 @@ "use strict"; | ||
} | ||
get status() { return this.id; } | ||
} | ||
@@ -11,0 +12,0 @@ exports.HttpStatus = HttpStatus; |
@@ -1,5 +0,5 @@ | ||
import { Json, Result } from '../types'; | ||
import { List } from '../types/List'; | ||
import { Json, List, Result } from '../types'; | ||
export declare type RestResult = { | ||
data?: { | ||
code: number; | ||
items: List<Json>; | ||
@@ -6,0 +6,0 @@ itemCount: number; |
@@ -6,7 +6,8 @@ "use strict"; | ||
const utils_1 = require("../utils"); | ||
const List_1 = require("../types/List"); | ||
const HttpStatus_1 = require("./HttpStatus"); | ||
const data = (items) => ({ | ||
data: { | ||
items: List_1.list(items), | ||
itemCount: items.length | ||
code: HttpStatus_1.HttpStatus.Ok.status, | ||
items: types_1.list(items), | ||
itemCount: items.length, | ||
} | ||
@@ -18,7 +19,7 @@ }); | ||
error: { | ||
code: HttpStatus_1.HttpStatus.BadRequest.status, | ||
message: (_a = errors[0].message.toString()) !== null && _a !== void 0 ? _a : 'Unknown error', | ||
errors: types_1.list(errors), | ||
errorCount: errors.length, | ||
code: 400, | ||
message: (_a = errors[0].message.toString()) !== null && _a !== void 0 ? _a : 'Unknown error', | ||
errors: List_1.list(errors), | ||
}, | ||
} | ||
}); | ||
@@ -33,4 +34,4 @@ }; | ||
.case(p => p.data && p.data.items, p => data(p.data.items)) | ||
.else(p => data(List_1.toList(p))); | ||
.else(p => data(types_1.toList(p))); | ||
exports.toRestResult = toRestResult; | ||
//# sourceMappingURL=RestResult.js.map |
{ | ||
"name": "@thisisagile/easy", | ||
"version": "1.11.0", | ||
"version": "1.11.1", | ||
"description": "Straightforward library for building domain-driven microservice architectures", | ||
@@ -34,3 +34,3 @@ "author": "Sander Hoogendoorn", | ||
"devDependencies": { | ||
"@thisisagile/easy-test": "^1.2.8", | ||
"@thisisagile/easy-test": "^1.3.0", | ||
"@types/uuid": "^8.3.0", | ||
@@ -37,0 +37,0 @@ "prettier": "^2.2.1", |
@@ -13,3 +13,3 @@ import { Json, Result } from '../types'; | ||
} | ||
}; | ||
} | ||
@@ -21,4 +21,4 @@ get error(): { errors: Result[], code: HttpStatus } { | ||
} | ||
}; | ||
} | ||
} |
@@ -19,2 +19,4 @@ import {Enum} from '../types'; | ||
} | ||
get status(): number { return this.id as number } | ||
} |
@@ -1,7 +0,7 @@ | ||
import { isDefined, isResult, Json, Result } from '../types'; | ||
import { isDefined, isResult, Json, list, List, Result, toList } from '../types'; | ||
import { choose } from '../utils'; | ||
import { list, List, toList } from '../types/List'; | ||
import { HttpStatus } from './HttpStatus'; | ||
export type RestResult = { | ||
data?: { items: List<Json>; itemCount: number; }, | ||
data?: { code: number, items: List<Json>; itemCount: number; }, | ||
error?: { code: number; message: string, errorCount: number, errors: List<Result>; } | ||
@@ -12,4 +12,5 @@ } | ||
data: { | ||
code: HttpStatus.Ok.status, | ||
items: list(items), | ||
itemCount: items.length | ||
itemCount: items.length, | ||
} | ||
@@ -20,7 +21,7 @@ }); | ||
error: { | ||
errorCount: errors.length, | ||
code: 400, | ||
code: HttpStatus.BadRequest.status, | ||
message: errors[0].message.toString() ?? 'Unknown error', | ||
errors: list(errors), | ||
}, | ||
errorCount: errors.length, | ||
} | ||
}); | ||
@@ -27,0 +28,0 @@ |
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
131579
1934