@thisisagile/easy 11.7.0 → 11.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6,7 +6,7 @@ export declare type RestResult = {
|
|
|
6
6
|
items: List<Json>;
|
|
7
7
|
itemCount: number;
|
|
8
8
|
totalItems?: number;
|
|
9
|
-
meta?:
|
|
9
|
+
meta?: Json;
|
|
10
10
|
};
|
|
11
11
|
error?: {
|
|
12
12
|
code: number;
|
|
@@ -16,7 +16,7 @@ export declare type RestResult = {
|
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
18
|
export declare const rest: {
|
|
19
|
-
toData: (status: HttpStatus, items?: Json[], totalItems?: number, meta?: Json
|
|
19
|
+
toData: (status: HttpStatus, items?: Json[], totalItems?: number, meta?: Json) => RestResult;
|
|
20
20
|
toError: (status: HttpStatus, errors?: Result[]) => RestResult;
|
|
21
21
|
to: (payload?: any | any[], status?: HttpStatus) => RestResult;
|
|
22
22
|
};
|
package/dist/http/RestResult.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RestResult.js","sourceRoot":"","sources":["../../src/http/RestResult.ts"],"names":[],"mappings":";;;AAAA,oCAAqH;AACrH,6CAAwD;AACxD,yCAAwC;AAOxC,MAAM,SAAS,GAAG,CAAC,CAAM,EAA0D,EAAE,CAAC,IAAA,iBAAS,EAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAClH,MAAM,QAAQ,GAAG,CAAC,CAAM,EAA2E,EAAE,CAAC,IAAA,iBAAS,EAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;AAElH,QAAA,IAAI,GAAG;IAClB,MAAM,EAAE,CAAC,MAAkB,EAAE,QAAgB,EAAE,EAAE,UAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"RestResult.js","sourceRoot":"","sources":["../../src/http/RestResult.ts"],"names":[],"mappings":";;;AAAA,oCAAqH;AACrH,6CAA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SACxH,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,YAAI,CAAC,MAAM,CAAC,MAAM,IAAI,uBAAU,CAAC,EAAE,EAAE,IAAA,cAAM,EAAC,CAAC,CAAC,CAAC,CAAC;CAChE,CAAC;AAEK,MAAM,YAAY,GAAG,CAAC,CAAU,EAAmB,EAAE,CAAC,IAAA,iBAAS,EAAC,CAAC,CAAC,IAAI,CAAC,IAAA,iBAAS,EAAE,CAAgB,CAAC,IAAI,CAAC,IAAI,IAAA,iBAAS,EAAE,CAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;AAA1I,QAAA,YAAY,gBAA8H"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thisisagile/easy",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.8.0",
|
|
4
4
|
"description": "Straightforward library for building domain-driven microservice architectures",
|
|
5
5
|
"author": "Sander Hoogendoorn",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@thisisagile/easy-test": "11.
|
|
34
|
+
"@thisisagile/easy-test": "11.8.0",
|
|
35
35
|
"@types/form-urlencoded": "^4.4.0",
|
|
36
36
|
"@types/jsonwebtoken": "^8.5.8",
|
|
37
37
|
"@types/luxon": "3.0.0",
|
package/src/http/RestResult.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { HttpStatus, isHttpStatus } from './HttpStatus';
|
|
|
3
3
|
import { isResponse } from './Response';
|
|
4
4
|
|
|
5
5
|
export type RestResult = {
|
|
6
|
-
data?: { code: number; items: List<Json>; itemCount: number; totalItems?: number; meta?:
|
|
6
|
+
data?: { code: number; items: List<Json>; itemCount: number; totalItems?: number; meta?: Json };
|
|
7
7
|
error?: { code: number; message: string; errorCount: number; errors: List<Result> };
|
|
8
8
|
};
|
|
9
9
|
|
|
@@ -11,13 +11,13 @@ const hasErrors = (a: any): a is { error: { code: number; errors: List<Result> }
|
|
|
11
11
|
const hasItems = (a: any): a is { data: { code: number; items: List<Json>; totalItems?: number } } => isDefined(a?.data.items);
|
|
12
12
|
|
|
13
13
|
export const rest = {
|
|
14
|
-
toData: (status: HttpStatus, items: Json[] = [], totalItems?: number, meta?: Json
|
|
14
|
+
toData: (status: HttpStatus, items: Json[] = [], totalItems?: number, meta?: Json): RestResult => ({
|
|
15
15
|
data: {
|
|
16
16
|
code: status.status,
|
|
17
17
|
items: toList(items),
|
|
18
18
|
itemCount: items.length,
|
|
19
19
|
totalItems,
|
|
20
|
-
meta
|
|
20
|
+
meta ,
|
|
21
21
|
},
|
|
22
22
|
}),
|
|
23
23
|
toError: (status: HttpStatus, errors: Result[] = [toResult(status.name)]): RestResult => ({
|