@thisisagile/easy 13.4.9 → 13.4.12
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.js.map +1 -1
- package/dist/services/RouteGateway.js.map +1 -1
- package/dist/services/ViewRouteGateway.js.map +1 -1
- package/dist/sql/Table.d.ts +1 -1
- package/dist/types/Constructor.d.ts +2 -2
- package/dist/types/Constructor.js.map +1 -1
- package/dist/types/PageList.d.ts +1 -1
- package/dist/utils/If.d.ts +4 -4
- package/dist/utils/If.js +1 -1
- package/dist/utils/If.js.map +1 -1
- package/dist/utils/Mapper.d.ts +1 -1
- package/dist/utils/State.d.ts +2 -2
- package/package.json +2 -2
- package/src/services/MappedRouteGateway.ts +23 -23
- package/src/services/RouteGateway.ts +45 -45
- package/src/services/ViewRouteGateway.ts +31 -31
- package/src/types/Constructor.ts +2 -1
- package/src/utils/If.ts +3 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MappedRouteGateway.js","sourceRoot":"","sources":["../../src/services/MappedRouteGateway.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"MappedRouteGateway.js","sourceRoot":"","sources":["../../src/services/MappedRouteGateway.ts"],"names":[],"mappings":";;;AAAA,+BAA0B;AAE1B,oCAAgC;AAChC,iDAA4C;AAG5C,MAAa,kBAAmB,SAAQ,2BAAY;IAChD,YAAqB,KAAgB,EAAW,OAAkB,EAAW,MAAM,IAAI,cAAM,EAAE,EAAW,MAAW,IAAI,SAAG,EAAE;QAC1H,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QADV,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;QAClC,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;IAC3E,CAAC;IAED,MAAM,CAAC,GAAQ,EAAE,OAAwB;QACrC,OAAO,KAAK;aACP,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC;aACjB,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;aACtB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC;IAED,GAAG,CAAC,IAAU;QACV,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,CAAC,IAAU;QACb,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5C,CAAC;CACJ;AAvBD,gDAuBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteGateway.js","sourceRoot":"","sources":["../../src/services/RouteGateway.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"RouteGateway.js","sourceRoot":"","sources":["../../src/services/RouteGateway.ts"],"names":[],"mappings":";;;AAAA,+BAAwC;AAExC,kCAAmC;AACnC,6CAAwC;AAExC,MAAa,YAAa,SAAQ,uBAAU;IACxC,YAAqB,KAAgB,EAAW,OAAkB,EAAW,MAAW,IAAI,SAAG,EAAE;QAC7F,KAAK,CAAC,GAAG,CAAC,CAAC;QADM,UAAK,GAAL,KAAK,CAAW;QAAW,YAAO,GAAP,OAAO,CAAW;QAAW,QAAG,GAAH,GAAG,CAAiB;IAEjG,CAAC;IAED,GAAG,CAAC,OAAsB;QACtB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,CAAC,EAAM,EAAE,OAAsB;QAC/B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,CAAC,CAAY,EAAE,OAAsB;QACvC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,CAAC,EAAM,EAAE,OAAsB;QACjC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;aACjC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;aACzB,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,iBAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxF,CAAC;IAED,GAAG,CAAC,IAAU,EAAE,OAAsB;QAClC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,CAAC,OAAsB;QACzB,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,CAAC,IAAU,EAAE,OAAsB;QACrC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;IAED,MAAM,CAAC,IAAU,EAAE,OAAsB;QACrC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED,MAAM,CAAC,EAAM,EAAE,OAAsB;QACjC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;CACJ;AA1CD,oCA0CC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewRouteGateway.js","sourceRoot":"","sources":["../../src/services/ViewRouteGateway.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"ViewRouteGateway.js","sourceRoot":"","sources":["../../src/services/ViewRouteGateway.ts"],"names":[],"mappings":";;;AAAA,+BAA0B;AAE1B,oCAA8B;AAC9B,iDAA4C;AAG5C,MAAa,gBAAiB,SAAQ,2BAAY;IAC9C,YACa,KAAgB,EAChB,OAAkB,EAClB,QAAQ;QACb,EAAE,EAAE,IAAA,YAAI,EAAC,EAAE,CAAC,CAAC,UAAU;QACvB,GAAG,EAAE,IAAA,YAAI,EAAC,EAAE,CAAC,CAAC,UAAU;KAC3B,EACQ,MAAW,IAAI,SAAG,EAAE;QAE7B,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QARlB,UAAK,GAAL,KAAK,CAAW;QAChB,YAAO,GAAP,OAAO,CAAW;QAClB,UAAK,GAAL,KAAK,CAGb;QACQ,QAAG,GAAH,GAAG,CAAiB;IAGjC,CAAC;IAED,GAAG,CAAC,GAAQ,EAAE,OAAwB;QAClC,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,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAClF,CAAC;IAED,MAAM,CAAC,GAAQ,EAAE,OAAwB;QACrC,OAAO,KAAK;aACP,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC;aACjB,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;aACtB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,GAAG,CAAC,IAAU;QACV,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,MAAM,CAAC,IAAU;QACb,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACnD,CAAC;CACJ;AA/BD,4CA+BC"}
|
package/dist/sql/Table.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare class Table extends Mapper {
|
|
|
17
17
|
skipOut: (property: string) => import("../utils").Mapping;
|
|
18
18
|
func: (property: string, funcIn: import("../types").Get<import("../types").Optional<import("../types").JsonValue>, Json>, funcOut: import("../types").Get<import("../types").Optional<import("../types").JsonValue>, Json>) => import("../utils").Mapping;
|
|
19
19
|
add: (funcIn: import("../types").Get<import("../types").JsonValue, Json>) => import("../utils").Mapping;
|
|
20
|
-
map: (mapper: import("../types").Construct<Mapper>, property?: string) => import("../utils").Mapping;
|
|
20
|
+
map: (mapper: import("../types").Construct<Mapper, any>, property?: string) => import("../utils").Mapping;
|
|
21
21
|
propsToList: (...maps: import("../utils").Mapping[]) => import("../utils").Mapping;
|
|
22
22
|
list: (mapper: import("../utils").Mapping, property: string) => import("../utils").Mapping;
|
|
23
23
|
};
|
|
@@ -3,9 +3,9 @@ import { Optional } from './Types';
|
|
|
3
3
|
export type Constructor<T = unknown> = {
|
|
4
4
|
new (...args: any[]): T;
|
|
5
5
|
};
|
|
6
|
-
export type Construct<
|
|
6
|
+
export type Construct<Out, In = any> = Get<Out, In> | Constructor<Out>;
|
|
7
7
|
export declare const isConstructor: <T>(c?: unknown) => c is Constructor<T>;
|
|
8
|
-
export declare const ofConstruct: <T>(c: Construct<T>, ...args: unknown[]) => T;
|
|
8
|
+
export declare const ofConstruct: <T>(c: Construct<T, any>, ...args: unknown[]) => T;
|
|
9
9
|
export declare const toName: (subject?: unknown, postfix?: string) => string;
|
|
10
10
|
export declare const on: <T>(t: T, f: (t: T) => unknown) => T;
|
|
11
11
|
export declare const ifA: <T>(c: Constructor<T>, t?: unknown, alt?: unknown) => Optional<T>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Constructor.js","sourceRoot":"","sources":["../../src/types/Constructor.ts"],"names":[],"mappings":";;;AACA,iCAAgC;AAChC,6BAAiC;AACjC,2CAA0C;
|
|
1
|
+
{"version":3,"file":"Constructor.js","sourceRoot":"","sources":["../../src/types/Constructor.ts"],"names":[],"mappings":";;;AACA,iCAAgC;AAChC,6BAAiC;AACjC,2CAA0C;AAQnC,MAAM,aAAa,GAAG,CAAI,CAAW,EAAuB,EAAE,CAAC,CAAC,IAAA,cAAS,EAAC,CAAC,CAAC,IAAI,IAAA,aAAM,EAAa,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAAjJ,QAAA,aAAa,iBAAoI;AAEvJ,MAAM,WAAW,GAAG,CAAI,CAAe,EAAE,GAAG,IAAe,EAAK,EAAE,CAAC,CAAC,IAAA,qBAAa,EAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,IAAA,aAAM,EAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAA7I,QAAA,WAAW,eAAkI;AAEnJ,MAAM,MAAM,GAAG,CAAC,OAAiB,EAAE,OAAO,GAAG,EAAE,EAAU,EAAE,CAAE,OAAe,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC;AAApI,QAAA,MAAM,UAA8H;AAE1I,MAAM,EAAE,GAAG,CAAI,CAAI,EAAE,CAAoB,EAAK,EAAE;IACrD,CAAC,CAAC,CAAC,CAAC,CAAC;IACL,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AAHW,QAAA,EAAE,MAGb;AAEK,MAAM,GAAG,GAAG,CAAI,CAAiB,EAAE,CAAW,EAAE,GAAa,EAAe,EAAE,CAAC,CAAC,CAAC,IAAA,uBAAW,EAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAA,WAAG,EAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AAAjJ,QAAA,GAAG,OAA8I"}
|
package/dist/types/PageList.d.ts
CHANGED
|
@@ -27,4 +27,4 @@ export declare const isPageList: <T>(l?: T[] | undefined) => l is PageList<T>;
|
|
|
27
27
|
export declare const toPageList: <T>(items?: T[] | undefined, options?: Omit<PageOptions, 'sort'> & {
|
|
28
28
|
total?: number;
|
|
29
29
|
}) => PageList<T>;
|
|
30
|
-
export declare const asPageList: <T, U>(c: Construct<T>, items?: PageList<U>) => PageList<T>;
|
|
30
|
+
export declare const asPageList: <T, U>(c: Construct<T, any>, items?: PageList<U>) => PageList<T>;
|
package/dist/utils/If.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Construct, Optional } from '../types';
|
|
2
|
-
export declare const ifTrue: <T>(o: unknown, f: Construct<T>, alt?: Construct<T> | undefined) => Optional<T>;
|
|
3
|
-
export declare const ifFalse: <T>(o: unknown, f: Construct<T>, alt?: Construct<T> | undefined) => Optional<T>;
|
|
4
|
-
export declare const ifDefined: <
|
|
5
|
-
export declare const ifNotEmpty: <T>(o: unknown, f?: Construct<T>, alt?: Construct<T> | undefined) => Optional<T>;
|
|
2
|
+
export declare const ifTrue: <T>(o: unknown, f: Construct<T, any>, alt?: Construct<T, any> | undefined) => Optional<T>;
|
|
3
|
+
export declare const ifFalse: <T>(o: unknown, f: Construct<T, any>, alt?: Construct<T, any> | undefined) => Optional<T>;
|
|
4
|
+
export declare const ifDefined: <Out, In = unknown>(o: Optional<In>, f: Construct<Out, NonNullable<In>>, alt?: Construct<Out, any> | undefined) => Optional<Out>;
|
|
5
|
+
export declare const ifNotEmpty: <T>(o: unknown, f?: Construct<T, any>, alt?: Construct<T, any> | undefined) => Optional<T>;
|
package/dist/utils/If.js
CHANGED
|
@@ -6,7 +6,7 @@ const ifTrue = (o, f, alt) => ((0, types_1.isTrue)(o) ? (0, types_1.ofConstruct)
|
|
|
6
6
|
exports.ifTrue = ifTrue;
|
|
7
7
|
const ifFalse = (o, f, alt) => (!(0, types_1.isTrue)(o) ? (0, types_1.ofConstruct)(f, o) : (0, types_1.ofConstruct)(alt, o));
|
|
8
8
|
exports.ifFalse = ifFalse;
|
|
9
|
-
const ifDefined = (o, f, alt) => ((0, types_1.isDefined)(o) ? (0, types_1.ofConstruct)(f, o) : (0, types_1.ofConstruct)(alt
|
|
9
|
+
const ifDefined = (o, f, alt) => ((0, types_1.isDefined)(o) ? (0, types_1.ofConstruct)(f, o) : (0, types_1.ofConstruct)(alt));
|
|
10
10
|
exports.ifDefined = ifDefined;
|
|
11
11
|
const ifNotEmpty = (o, f = o => o, alt) => (0, types_1.isNotEmpty)(o) ? (0, types_1.ofConstruct)(f, o) : (0, types_1.ofConstruct)(alt, o);
|
|
12
12
|
exports.ifNotEmpty = ifNotEmpty;
|
package/dist/utils/If.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"If.js","sourceRoot":"","sources":["../../src/utils/If.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"If.js","sourceRoot":"","sources":["../../src/utils/If.ts"],"names":[],"mappings":";;;AAAA,oCAAyF;AAElF,MAAM,MAAM,GAAG,CAAI,CAAU,EAAE,CAAe,EAAE,GAAkB,EAAe,EAAE,CAAC,CAAC,IAAA,cAAM,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,mBAAW,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,mBAAW,EAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;AAApI,QAAA,MAAM,UAA8H;AAC1I,MAAM,OAAO,GAAG,CAAI,CAAU,EAAE,CAAe,EAAE,GAAkB,EAAe,EAAE,CAAC,CAAC,CAAC,IAAA,cAAM,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,mBAAW,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,mBAAW,EAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;AAAtI,QAAA,OAAO,WAA+H;AAC5I,MAAM,SAAS,GAAG,CAAoB,CAAe,EAAE,CAAkC,EAAE,GAAoB,EAAiB,EAAE,CAAC,CAAC,IAAA,iBAAS,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,mBAAW,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,mBAAW,EAAC,GAAG,CAAC,CAAC,CAAC;AAAnL,QAAA,SAAS,aAA0K;AACzL,MAAM,UAAU,GAAG,CAAI,CAAU,EAAE,IAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAkB,EAAe,EAAE,CAAC,IAAA,kBAAU,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,mBAAW,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,mBAAW,EAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAAnJ,QAAA,UAAU,cAAyI"}
|
package/dist/utils/Mapper.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare class Mapper extends State implements Mapping {
|
|
|
21
21
|
skipOut: (property: string) => Mapping;
|
|
22
22
|
func: (property: string, funcIn: Get<Optional<JsonValue>, Json>, funcOut: Get<Optional<JsonValue>, Json>) => Mapping;
|
|
23
23
|
add: (funcIn: Get<JsonValue, Json>) => Mapping;
|
|
24
|
-
map: (mapper: Construct<Mapper>, property?: string) => Mapping;
|
|
24
|
+
map: (mapper: Construct<Mapper, any>, property?: string) => Mapping;
|
|
25
25
|
propsToList: (...maps: Mapping[]) => Mapping;
|
|
26
26
|
list: (mapper: Mapping, property: string) => Mapping;
|
|
27
27
|
};
|
package/dist/utils/State.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import { Construct } from '../types';
|
|
|
2
2
|
export declare class State {
|
|
3
3
|
protected readonly state: any;
|
|
4
4
|
constructor(state?: any);
|
|
5
|
-
protected get: <T>(key: string, alt?: Construct<T> | undefined) => T;
|
|
6
|
-
protected set: <T>(key: string, value: Construct<T>) => T;
|
|
5
|
+
protected get: <T>(key: string, alt?: Construct<T, any> | undefined) => T;
|
|
6
|
+
protected set: <T>(key: string, value: Construct<T, any>) => T;
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thisisagile/easy",
|
|
3
|
-
"version": "13.4.
|
|
3
|
+
"version": "13.4.12",
|
|
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": "13.4.
|
|
34
|
+
"@thisisagile/easy-test": "13.4.12",
|
|
35
35
|
"@types/form-urlencoded": "^4.4.0",
|
|
36
36
|
"@types/jsonwebtoken": "^9.0.1",
|
|
37
37
|
"@types/luxon": "3.2.0",
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import {Api} from './Api';
|
|
2
|
+
import {Func, Json, List, Optional, Uri} from '../types';
|
|
3
|
+
import {Mapper} from '../utils';
|
|
4
|
+
import {RouteGateway} from './RouteGateway';
|
|
5
|
+
import {RequestOptions} from '../http';
|
|
6
6
|
|
|
7
7
|
export class MappedRouteGateway extends RouteGateway {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
constructor(readonly route: Func<Uri>, readonly routeId: Func<Uri>, readonly map = new Mapper(), readonly api: Api = new Api()) {
|
|
9
|
+
super(route, routeId, api);
|
|
10
|
+
}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
get(uri: Uri, options?: RequestOptions): Promise<List<Json>> {
|
|
13
|
+
return super.get(uri, options).then(is => is.map(i => this.map.in(i)));
|
|
14
|
+
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
getOne(uri: Uri, options?: RequestOptions): Promise<Optional<Json>> {
|
|
17
|
+
return super
|
|
18
|
+
.get(uri, options)
|
|
19
|
+
.then(is => is.first())
|
|
20
|
+
.then(i => this.map.in(i));
|
|
21
|
+
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
add(item: Json): Promise<Json> {
|
|
24
|
+
return super.add(this.map.out(item));
|
|
25
|
+
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
update(item: Json): Promise<Json> {
|
|
28
|
+
return super.update(this.map.out(item));
|
|
29
|
+
}
|
|
30
30
|
}
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import {Api, RouteOptions} from './Api';
|
|
2
|
+
import {Func, Id, Json, JsonValue, Optional, PageList, Uri} from '../types';
|
|
3
|
+
import {HttpStatus} from '../http';
|
|
4
|
+
import {ApiGateway} from './ApiGateway';
|
|
5
5
|
|
|
6
6
|
export class RouteGateway extends ApiGateway {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
7
|
+
constructor(readonly route: Func<Uri>, readonly routeId: Func<Uri>, readonly api: Api = new Api()) {
|
|
8
|
+
super(api);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
all(options?: RouteOptions): Promise<PageList<Json>> {
|
|
12
|
+
return this.get(this.route(), options);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
byId(id: Id, options?: RouteOptions): Promise<Optional<Json>> {
|
|
16
|
+
return this.getOne(this.routeId().id(id));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
search(q: JsonValue, options?: RouteOptions): Promise<PageList<Json>> {
|
|
20
|
+
return this.get(this.route().query(q), options);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
exists(id: Id, options?: RouteOptions): Promise<boolean> {
|
|
24
|
+
return this.get(this.routeId().id(id))
|
|
25
|
+
.then(r => r.length === 1)
|
|
26
|
+
.catch(r => (HttpStatus.NotFound.equals(r.status) ? false : Promise.reject(r)));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
add(item: Json, options?: RouteOptions): Promise<Json> {
|
|
30
|
+
return this.post(this.route(), item, options);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
filter(options?: RouteOptions): Promise<PageList<Json>> {
|
|
34
|
+
return this.postSearch(this.route(), options);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
update(item: Json, options?: RouteOptions): Promise<Json> {
|
|
38
|
+
return this.patch(this.routeId().id(item.id), item, options);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
upsert(item: Json, options?: RouteOptions): Promise<Json> {
|
|
42
|
+
return this.put(this.routeId().id(item.id), item, options);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
remove(id: Id, options?: RouteOptions): Promise<boolean> {
|
|
46
|
+
return this.delete(this.routeId().id(id), options);
|
|
47
|
+
}
|
|
48
48
|
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import {Api} from './Api';
|
|
2
|
+
import {Func, Json, List, Optional, Uri} from '../types';
|
|
3
|
+
import {view} from '../utils';
|
|
4
|
+
import {RouteGateway} from './RouteGateway';
|
|
5
|
+
import {RequestOptions} from '../http';
|
|
6
6
|
|
|
7
7
|
export class ViewRouteGateway extends RouteGateway {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
getOne(uri: Uri, options?: RequestOptions): Promise<Optional<Json>> {
|
|
25
|
+
return super
|
|
26
|
+
.get(uri, options)
|
|
27
|
+
.then(is => is.first())
|
|
28
|
+
.then(i => this.views.in.from(i));
|
|
29
|
+
}
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
add(item: Json): Promise<Json> {
|
|
32
|
+
return super.add(this.views.out.from(item));
|
|
33
|
+
}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
update(item: Json): Promise<Json> {
|
|
36
|
+
return super.update(this.views.out.from(item));
|
|
37
|
+
}
|
|
38
38
|
}
|
package/src/types/Constructor.ts
CHANGED
|
@@ -6,7 +6,8 @@ import { Optional } from './Types';
|
|
|
6
6
|
|
|
7
7
|
export type Constructor<T = unknown> = { new (...args: any[]): T };
|
|
8
8
|
|
|
9
|
-
export type Construct<T> = Get<T> | Constructor<T>;
|
|
9
|
+
// export type Construct<T> = Get<T> | Constructor<T>;
|
|
10
|
+
export type Construct<Out, In = any> = Get<Out, In> | Constructor<Out>;
|
|
10
11
|
|
|
11
12
|
export const isConstructor = <T>(c?: unknown): c is Constructor<T> => (isDefined(c) && isFunc<T, unknown>(c) && c.prototype && c.prototype.constructor) === c;
|
|
12
13
|
|
package/src/utils/If.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Construct, isDefined, isNotEmpty, isTrue, ofConstruct, Optional} from '../types';
|
|
2
2
|
|
|
3
3
|
export const ifTrue = <T>(o: unknown, f: Construct<T>, alt?: Construct<T>): Optional<T> => (isTrue(o) ? ofConstruct(f, o) : ofConstruct(alt, o));
|
|
4
4
|
export const ifFalse = <T>(o: unknown, f: Construct<T>, alt?: Construct<T>): Optional<T> => (!isTrue(o) ? ofConstruct(f, o) : ofConstruct(alt, o));
|
|
5
|
-
export const ifDefined = <
|
|
6
|
-
export const ifNotEmpty = <T>(o: unknown, f: Construct<T> = o => o, alt?: Construct<T>): Optional<T> =>
|
|
7
|
-
isNotEmpty(o) ? ofConstruct(f, o) : ofConstruct(alt, o);
|
|
5
|
+
export const ifDefined = <Out, In = unknown>(o: Optional<In>, f: Construct<Out, NonNullable<In>>, alt?: Construct<Out>): Optional<Out> => (isDefined(o) ? ofConstruct(f, o) : ofConstruct(alt));
|
|
6
|
+
export const ifNotEmpty = <T>(o: unknown, f: Construct<T> = o => o, alt?: Construct<T>): Optional<T> => isNotEmpty(o) ? ofConstruct(f, o) : ofConstruct(alt, o);
|