@thisisagile/easy 9.1.0 → 9.4.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.
- package/dist/services/MappedRouteGateway.d.ts +4 -4
- package/dist/services/MappedRouteGateway.js +4 -7
- package/dist/services/MappedRouteGateway.js.map +1 -1
- package/dist/services/ViewRouteGateway.d.ts +21 -0
- package/dist/services/ViewRouteGateway.js +32 -0
- package/dist/services/ViewRouteGateway.js.map +1 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +1 -0
- package/dist/services/index.js.map +1 -1
- package/package.json +2 -2
- package/src/services/MappedRouteGateway.ts +6 -9
- package/src/services/ViewRouteGateway.ts +35 -0
- package/src/services/index.ts +1 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Api } from './Api';
|
|
2
|
-
import { Func,
|
|
2
|
+
import { Func, Json, List, Uri } from '../types';
|
|
3
3
|
import { Mapper } from '../utils';
|
|
4
4
|
import { RouteGateway } from './RouteGateway';
|
|
5
|
+
import { RequestOptions } from '../http';
|
|
5
6
|
export declare class MappedRouteGateway extends RouteGateway {
|
|
6
7
|
readonly route: Func<Uri>;
|
|
7
8
|
readonly routeId: Func<Uri>;
|
|
8
9
|
readonly map: Mapper;
|
|
9
10
|
readonly api: Api;
|
|
10
11
|
constructor(route: Func<Uri>, routeId: Func<Uri>, map?: Mapper, api?: Api);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
search(q: JsonValue): Promise<List<Json>>;
|
|
12
|
+
get(uri: Uri, options?: RequestOptions): Promise<List<Json>>;
|
|
13
|
+
getOne(uri: Uri, options?: RequestOptions): Promise<Json | undefined>;
|
|
14
14
|
add(item: Json): Promise<Json>;
|
|
15
15
|
update(item: Json): Promise<Json>;
|
|
16
16
|
}
|
|
@@ -12,14 +12,11 @@ class MappedRouteGateway extends RouteGateway_1.RouteGateway {
|
|
|
12
12
|
this.map = map;
|
|
13
13
|
this.api = api;
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
return super.
|
|
15
|
+
get(uri, options) {
|
|
16
|
+
return super.get(uri, options).then(is => is.map(i => this.map.in(i)));
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
return super.
|
|
20
|
-
}
|
|
21
|
-
search(q) {
|
|
22
|
-
return super.search(q).then(is => is.map(i => this.map.in(i)));
|
|
18
|
+
getOne(uri, options) {
|
|
19
|
+
return super.get(uri, options).then(is => is.first()).then(i => this.map.in(i));
|
|
23
20
|
}
|
|
24
21
|
add(item) {
|
|
25
22
|
return super.add(this.map.out(item));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MappedRouteGateway.js","sourceRoot":"","sources":["../../src/services/MappedRouteGateway.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAE5B,oCAAkC;AAClC,iDAA8C;
|
|
1
|
+
{"version":3,"file":"MappedRouteGateway.js","sourceRoot":"","sources":["../../src/services/MappedRouteGateway.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAE5B,oCAAkC;AAClC,iDAA8C;AAG9C,MAAa,kBAAmB,SAAQ,2BAAY;IAClD,YAAqB,KAAgB,EAAW,OAAkB,EAAW,MAAM,IAAI,cAAM,EAAE,EAAW,MAAW,IAAI,SAAG,EAAE;QAC5H,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QADR,UAAK,GAAL,KAAK,CAAW;QAAW,YAAO,GAAP,OAAO,CAAW;QAAW,QAAG,GAAH,GAAG,CAAe;QAAW,QAAG,GAAH,GAAG,CAAiB;IAE9H,CAAC;IAED,GAAG,CAAC,GAAQ,EAAE,OAAwB;QACpC,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzE,CAAC;IAED,MAAM,CAAC,GAAQ,EAAE,OAAwB;QACvC,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAClF,CAAC;IAED,GAAG,CAAC,IAAU;QACZ,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,CAAC;IAED,MAAM,CAAC,IAAU;QACf,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1C,CAAC;CACF;AApBD,gDAoBC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Api } from './Api';
|
|
2
|
+
import { Func, Json, List, Uri } from '../types';
|
|
3
|
+
import { RouteGateway } from './RouteGateway';
|
|
4
|
+
import { RequestOptions } from '../http';
|
|
5
|
+
export declare class ViewRouteGateway extends RouteGateway {
|
|
6
|
+
readonly route: Func<Uri>;
|
|
7
|
+
readonly routeId: Func<Uri>;
|
|
8
|
+
readonly views: {
|
|
9
|
+
in: import("../utils").View;
|
|
10
|
+
out: import("../utils").View;
|
|
11
|
+
};
|
|
12
|
+
readonly api: Api;
|
|
13
|
+
constructor(route: Func<Uri>, routeId: Func<Uri>, views?: {
|
|
14
|
+
in: import("../utils").View;
|
|
15
|
+
out: import("../utils").View;
|
|
16
|
+
}, api?: Api);
|
|
17
|
+
get(uri: Uri, options?: RequestOptions): Promise<List<Json>>;
|
|
18
|
+
getOne(uri: Uri, options?: RequestOptions): Promise<Json | undefined>;
|
|
19
|
+
add(item: Json): Promise<Json>;
|
|
20
|
+
update(item: Json): Promise<Json>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ViewRouteGateway = void 0;
|
|
4
|
+
const Api_1 = require("./Api");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const RouteGateway_1 = require("./RouteGateway");
|
|
7
|
+
class ViewRouteGateway extends RouteGateway_1.RouteGateway {
|
|
8
|
+
constructor(route, routeId, views = {
|
|
9
|
+
in: (0, utils_1.view)({}).fromSource,
|
|
10
|
+
out: (0, utils_1.view)({}).fromSource,
|
|
11
|
+
}, api = new Api_1.Api()) {
|
|
12
|
+
super(route, routeId, api);
|
|
13
|
+
this.route = route;
|
|
14
|
+
this.routeId = routeId;
|
|
15
|
+
this.views = views;
|
|
16
|
+
this.api = api;
|
|
17
|
+
}
|
|
18
|
+
get(uri, options) {
|
|
19
|
+
return super.get(uri, options).then(is => is.map(i => this.views.in.from(i)));
|
|
20
|
+
}
|
|
21
|
+
getOne(uri, options) {
|
|
22
|
+
return super.get(uri, options).then(is => is.first()).then(i => this.views.in.from(i));
|
|
23
|
+
}
|
|
24
|
+
add(item) {
|
|
25
|
+
return super.add(this.views.out.from(item));
|
|
26
|
+
}
|
|
27
|
+
update(item) {
|
|
28
|
+
return super.update(this.views.out.from(item));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.ViewRouteGateway = ViewRouteGateway;
|
|
32
|
+
//# sourceMappingURL=ViewRouteGateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ViewRouteGateway.js","sourceRoot":"","sources":["../../src/services/ViewRouteGateway.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAE5B,oCAAgC;AAChC,iDAA8C;AAG9C,MAAa,gBAAiB,SAAQ,2BAAY;IAChD,YACW,KAAgB,EAChB,OAAkB,EAClB,QAAQ;QACf,EAAE,EAAE,IAAA,YAAI,EAAC,EAA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.js
CHANGED
|
@@ -18,4 +18,5 @@ __exportStar(require("./Api"), exports);
|
|
|
18
18
|
__exportStar(require("./AxiosProvider"), exports);
|
|
19
19
|
__exportStar(require("./MappedRouteGateway"), exports);
|
|
20
20
|
__exportStar(require("./RouteGateway"), exports);
|
|
21
|
+
__exportStar(require("./ViewRouteGateway"), exports);
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,kDAAgC;AAChC,uDAAqC;AACrC,iDAA+B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,kDAAgC;AAChC,uDAAqC;AACrC,iDAA+B;AAC/B,qDAAmC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thisisagile/easy",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.4.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": "9.
|
|
34
|
+
"@thisisagile/easy-test": "9.4.0",
|
|
35
35
|
"@types/form-urlencoded": "^4.4.0",
|
|
36
36
|
"@types/jsonwebtoken": "^8.5.8",
|
|
37
37
|
"@types/validator": "^13.7.2"
|
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
import { Api } from './Api';
|
|
2
|
-
import { Func,
|
|
2
|
+
import { Func, Json, List, Uri } from '../types';
|
|
3
3
|
import { Mapper } from '../utils';
|
|
4
4
|
import { RouteGateway } from './RouteGateway';
|
|
5
|
+
import { RequestOptions } from '../http';
|
|
5
6
|
|
|
6
7
|
export class MappedRouteGateway extends RouteGateway {
|
|
7
8
|
constructor(readonly route: Func<Uri>, readonly routeId: Func<Uri>, readonly map = new Mapper(), readonly api: Api = new Api()) {
|
|
8
9
|
super(route, routeId, api);
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
return super.
|
|
12
|
+
get(uri: Uri, options?: RequestOptions): Promise<List<Json>> {
|
|
13
|
+
return super.get(uri, options).then(is => is.map(i => this.map.in(i)));
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
return super.
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
search(q: JsonValue): Promise<List<Json>> {
|
|
20
|
-
return super.search(q).then(is => is.map(i => this.map.in(i)));
|
|
16
|
+
getOne(uri: Uri, options?: RequestOptions): Promise<Json | undefined> {
|
|
17
|
+
return super.get(uri, options).then(is => is.first()).then(i => this.map.in(i));
|
|
21
18
|
}
|
|
22
19
|
|
|
23
20
|
add(item: Json): Promise<Json> {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Api } from './Api';
|
|
2
|
+
import { Func, Json, List, Uri } from '../types';
|
|
3
|
+
import { view } from '../utils';
|
|
4
|
+
import { RouteGateway } from './RouteGateway';
|
|
5
|
+
import { RequestOptions } from '../http';
|
|
6
|
+
|
|
7
|
+
export class ViewRouteGateway extends RouteGateway {
|
|
8
|
+
constructor(
|
|
9
|
+
readonly route: Func<Uri>,
|
|
10
|
+
readonly routeId: Func<Uri>,
|
|
11
|
+
readonly views = {
|
|
12
|
+
in: view({}).fromSource,
|
|
13
|
+
out: view({}).fromSource,
|
|
14
|
+
},
|
|
15
|
+
readonly api: Api = new Api(),
|
|
16
|
+
) {
|
|
17
|
+
super(route, routeId, api);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get(uri: Uri, options?: RequestOptions): Promise<List<Json>> {
|
|
21
|
+
return super.get(uri, options).then(is => is.map(i => this.views.in.from(i)));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
getOne(uri: Uri, options?: RequestOptions): Promise<Json | undefined> {
|
|
25
|
+
return super.get(uri, options).then(is => is.first()).then(i => this.views.in.from(i));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
add(item: Json): Promise<Json> {
|
|
29
|
+
return super.add(this.views.out.from(item));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
update(item: Json): Promise<Json> {
|
|
33
|
+
return super.update(this.views.out.from(item));
|
|
34
|
+
}
|
|
35
|
+
}
|
package/src/services/index.ts
CHANGED