@thisisagile/easy 10.5.10 → 10.5.11
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.
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Api } from './Api';
|
|
2
|
-
import { Func, Gateway, Id, Json, JsonValue,
|
|
2
|
+
import { Func, Gateway, Id, Json, JsonValue, TotalledList, Uri } from '../types';
|
|
3
3
|
import { RequestOptions } from '../http';
|
|
4
4
|
export declare class RouteGateway extends Gateway {
|
|
5
5
|
readonly route: Func<Uri>;
|
|
6
6
|
readonly routeId: Func<Uri>;
|
|
7
7
|
readonly api: Api;
|
|
8
8
|
constructor(route: Func<Uri>, routeId: Func<Uri>, api?: Api);
|
|
9
|
-
get(uri: Uri, options?: RequestOptions): Promise<
|
|
9
|
+
get(uri: Uri, options?: RequestOptions): Promise<TotalledList<Json>>;
|
|
10
10
|
getOne(uri: Uri, options?: RequestOptions): Promise<Json | undefined>;
|
|
11
|
-
all(): Promise<
|
|
11
|
+
all(): Promise<TotalledList<Json>>;
|
|
12
12
|
byId(id: Id): Promise<Json | undefined>;
|
|
13
|
-
search(q: JsonValue): Promise<
|
|
13
|
+
search(q: JsonValue): Promise<TotalledList<Json>>;
|
|
14
14
|
exists(id: Id): Promise<boolean>;
|
|
15
15
|
add(item: Json): Promise<Json>;
|
|
16
16
|
update(item: Json): Promise<Json>;
|
|
@@ -12,7 +12,7 @@ class RouteGateway extends types_1.Gateway {
|
|
|
12
12
|
this.api = api;
|
|
13
13
|
}
|
|
14
14
|
get(uri, options) {
|
|
15
|
-
return this.api.get(uri, options).then(r => r.body.data?.items
|
|
15
|
+
return this.api.get(uri, options).then(r => (0, types_1.toTotalledList)(r.body.data?.items, r.body.data?.totalItems));
|
|
16
16
|
}
|
|
17
17
|
getOne(uri, options) {
|
|
18
18
|
return this.get(uri, options).then(r => r.first());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteGateway.js","sourceRoot":"","sources":["../../src/services/RouteGateway.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAC5B,
|
|
1
|
+
{"version":3,"file":"RouteGateway.js","sourceRoot":"","sources":["../../src/services/RouteGateway.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAC5B,oCAAiG;AACjG,kCAAqD;AAErD,MAAa,YAAa,SAAQ,eAAO;IACvC,YAAqB,KAAgB,EAAW,OAAkB,EAAW,MAAW,IAAI,SAAG,EAAE;QAC/F,KAAK,EAAE,CAAC;QADW,UAAK,GAAL,KAAK,CAAW;QAAW,YAAO,GAAP,OAAO,CAAW;QAAW,QAAG,GAAH,GAAG,CAAiB;IAEjG,CAAC;IAED,GAAG,CAAC,GAAQ,EAAE,OAAwB;QACpC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAA,sBAAc,EAAO,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC;IACjH,CAAC;IAED,MAAM,CAAC,GAAQ,EAAE,OAAwB;QACvC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,GAAG;QACD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAChC,CAAC;IAED,IAAI,CAAC,EAAM;QACT,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,CAAC,CAAY;QACjB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC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K,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACpG,CAAC;IAED,MAAM,CAAC,EAAM;QACX,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IACjE,CAAC;CACF;AA9CD,oCA8CC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thisisagile/easy",
|
|
3
|
-
"version": "10.5.
|
|
3
|
+
"version": "10.5.11",
|
|
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": "10.5.
|
|
34
|
+
"@thisisagile/easy-test": "10.5.11",
|
|
35
35
|
"@types/form-urlencoded": "^4.4.0",
|
|
36
36
|
"@types/jsonwebtoken": "^8.5.8",
|
|
37
37
|
"@types/validator": "^13.7.2"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Api } from './Api';
|
|
2
|
-
import { Func, Gateway, Id, Json, JsonValue,
|
|
2
|
+
import { Func, Gateway, Id, Json, JsonValue, TotalledList, toTotalledList, Uri } from '../types';
|
|
3
3
|
import { HttpStatus, RequestOptions } from '../http';
|
|
4
4
|
|
|
5
5
|
export class RouteGateway extends Gateway {
|
|
@@ -7,15 +7,15 @@ export class RouteGateway extends Gateway {
|
|
|
7
7
|
super();
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
get(uri: Uri, options?: RequestOptions): Promise<
|
|
11
|
-
return this.api.get(uri, options).then(r => r.body.data?.items
|
|
10
|
+
get(uri: Uri, options?: RequestOptions): Promise<TotalledList<Json>> {
|
|
11
|
+
return this.api.get(uri, options).then(r => toTotalledList<Json>(r.body.data?.items, r.body.data?.totalItems));
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
getOne(uri: Uri, options?: RequestOptions): Promise<Json | undefined> {
|
|
15
15
|
return this.get(uri, options).then(r => r.first());
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
all(): Promise<
|
|
18
|
+
all(): Promise<TotalledList<Json>> {
|
|
19
19
|
return this.get(this.route());
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -23,7 +23,7 @@ export class RouteGateway extends Gateway {
|
|
|
23
23
|
return this.getOne(this.routeId().id(id));
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
search(q: JsonValue): Promise<
|
|
26
|
+
search(q: JsonValue): Promise<TotalledList<Json>> {
|
|
27
27
|
return this.get(this.route().query(q));
|
|
28
28
|
}
|
|
29
29
|
|