@thisisagile/easy 8.39.11 → 8.40.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/data/Condition.d.ts +6 -0
- package/dist/data/Condition.js +12 -1
- package/dist/data/Condition.js.map +1 -1
- package/dist/data/Field.d.ts +3 -1
- package/dist/data/Field.js +2 -0
- package/dist/data/Field.js.map +1 -1
- package/package.json +2 -2
- package/src/data/Condition.ts +10 -0
- package/src/data/Field.ts +5 -1
package/dist/data/Condition.d.ts
CHANGED
|
@@ -15,4 +15,10 @@ export declare class LogicalCondition {
|
|
|
15
15
|
constructor(operator: string, conditions: Condition[]);
|
|
16
16
|
toJSON(): Json;
|
|
17
17
|
}
|
|
18
|
+
export declare class SortCondition extends Condition {
|
|
19
|
+
readonly key: string;
|
|
20
|
+
readonly value: number;
|
|
21
|
+
constructor(key: string, value: number);
|
|
22
|
+
toJSON(): Json;
|
|
23
|
+
}
|
|
18
24
|
export declare const toCondition: (field: string, operator: string, value: unknown, conv?: Convert) => Condition;
|
package/dist/data/Condition.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toCondition = exports.LogicalCondition = exports.Condition = void 0;
|
|
3
|
+
exports.toCondition = exports.SortCondition = exports.LogicalCondition = exports.Condition = void 0;
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
6
|
class Condition {
|
|
@@ -26,6 +26,17 @@ class LogicalCondition {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
exports.LogicalCondition = LogicalCondition;
|
|
29
|
+
class SortCondition extends Condition {
|
|
30
|
+
constructor(key, value) {
|
|
31
|
+
super(key, '', value);
|
|
32
|
+
this.key = key;
|
|
33
|
+
this.value = value;
|
|
34
|
+
}
|
|
35
|
+
toJSON() {
|
|
36
|
+
return { [this.key]: this.value };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.SortCondition = SortCondition;
|
|
29
40
|
const toCondition = (field, operator, value, conv = utils_1.convert.default) => new Condition(field, operator, conv.from(value));
|
|
30
41
|
exports.toCondition = toCondition;
|
|
31
42
|
//# sourceMappingURL=Condition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Condition.js","sourceRoot":"","sources":["../../src/data/Condition.ts"],"names":[],"mappings":";;;AAAA,oCAAiD;AACjD,oCAA4C;AAE5C,MAAa,SAAS;IACpB,YAAqB,GAAW,EAAW,QAAgB,EAAW,KAAc;QAA/D,QAAG,GAAH,GAAG,CAAQ;QAAW,aAAQ,GAAR,QAAQ,CAAQ;QAAW,UAAK,GAAL,KAAK,CAAS;QAEpF,QAAG,GAAG,CAAC,GAAG,MAAmB,EAAoB,EAAE,CAAC,IAAI,gBAAgB,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;QACnG,OAAE,GAAG,CAAC,GAAG,MAAmB,EAAoB,EAAE,CAAC,IAAI,gBAAgB,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;IAHV,CAAC;IAKxF,MAAM;QACJ,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,YAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;IAC3E,CAAC;CACF;AATD,8BASC;AAED,MAAa,gBAAgB;IAC3B,YAAqB,QAAgB,EAAW,UAAuB;QAAlD,aAAQ,GAAR,QAAQ,CAAQ;QAAW,eAAU,GAAV,UAAU,CAAa;IAAG,CAAC;IAE3E,MAAM;QACJ,OAAO,EAAE,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAA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AE3E,MAAM;QACJ,OAAO,EAAE,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;IACzE,CAAC;CACF;AAND,4CAMC;AAED,MAAa,aAAc,SAAQ,SAAS;IAC1C,YAAqB,GAAW,EAAW,KAAa;QACtD,KAAK,CAAC,GAAG,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QADH,QAAG,GAAH,GAAG,CAAQ;QAAW,UAAK,GAAL,KAAK,CAAQ;IAExD,CAAC;IAED,MAAM;QACJ,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;IACpC,CAAC;CACF;AARD,sCAQC;AAEM,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,QAAgB,EAAE,KAAc,EAAE,OAAgB,eAAO,CAAC,OAAO,EAAa,EAAE,CACzH,IAAI,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAc,CAAC,CAAC;AADnD,QAAA,WAAW,eACwC"}
|
package/dist/data/Field.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Property } from '../utils';
|
|
2
|
-
import { Condition } from
|
|
2
|
+
import { Condition, SortCondition } from "./Condition";
|
|
3
3
|
export declare class Field extends Property {
|
|
4
4
|
is: (value: unknown) => Condition;
|
|
5
5
|
isNot: (value: unknown) => Condition;
|
|
@@ -10,5 +10,7 @@ export declare class Field extends Property {
|
|
|
10
10
|
greaterEqual: (value: unknown) => Condition;
|
|
11
11
|
less: (value: unknown) => Condition;
|
|
12
12
|
lessEqual: (value: unknown) => Condition;
|
|
13
|
+
asc: () => SortCondition;
|
|
14
|
+
desc: () => SortCondition;
|
|
13
15
|
protected condition: (operator: string, value: unknown) => Condition;
|
|
14
16
|
}
|
package/dist/data/Field.js
CHANGED
|
@@ -16,6 +16,8 @@ class Field extends utils_1.Property {
|
|
|
16
16
|
this.greaterEqual = (value) => this.condition('gte', value);
|
|
17
17
|
this.less = (value) => this.condition('lt', value);
|
|
18
18
|
this.lessEqual = (value) => this.condition('lte', value);
|
|
19
|
+
this.asc = () => new Condition_1.SortCondition(this.property, -1);
|
|
20
|
+
this.desc = () => new Condition_1.SortCondition(this.property, 1);
|
|
19
21
|
this.condition = (operator, value) => (0, Condition_1.toCondition)(this.property, operator, value, this.options?.convert);
|
|
20
22
|
}
|
|
21
23
|
}
|
package/dist/data/Field.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","sourceRoot":"","sources":["../../src/data/Field.ts"],"names":[],"mappings":";;;AAAA,oCAAoC;AACpC,
|
|
1
|
+
{"version":3,"file":"Field.js","sourceRoot":"","sources":["../../src/data/Field.ts"],"names":[],"mappings":";;;AAAA,oCAAoC;AACpC,2CAAoE;AACpE,oCAAmC;AAEnC,MAAa,KAAM,SAAQ,gBAAQ;IAAnC;;QACE,OAAE,GAAG,CAAC,KAAc,EAAa,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAEhE,UAAK,GAAG,CAAC,KAAc,EAAa,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAEnE,SAAI,GAAG,CAAC,GAAG,KAAgB,EAAa,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAA,eAAO,EAAC,KAAK,CAAC,CAAC,CAAC;QAEhF,UAAK,GAAG,CAAC,GAAG,KAAgB,EAAa,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAA,eAAO,EAAC,KAAK,CAAC,CAAC,CAAC;QAElF,WAAM,GAAG,CAAC,IAAa,EAAa,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAEtE,YAAO,GAAG,CAAC,KAAc,EAAa,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAErE,iBAAY,GAAG,CAAC,KAAc,EAAa,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAE3E,SAAI,GAAG,CAAC,KAAc,EAAa,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAElE,cAAS,GAAG,CAAC,KAAc,EAAa,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAExE,QAAG,GAAG,GAAkB,EAAE,CAAC,IAAI,yBAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAA;QAE/D,SAAI,GAAG,GAAkB,EAAE,CAAC,IAAI,yBAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;QAErD,cAAS,GAAG,CAAC,QAAgB,EAAE,KAAc,EAAa,EAAE,CAAC,IAAA,uBAAW,EAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5I,CAAC;CAAA;AAxBD,sBAwBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thisisagile/easy",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.40.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": "8.
|
|
34
|
+
"@thisisagile/easy-test": "8.40.0",
|
|
35
35
|
"@types/form-urlencoded": "^4.4.0",
|
|
36
36
|
"@types/jsonwebtoken": "^8.5.8",
|
|
37
37
|
"@types/validator": "^13.7.1"
|
package/src/data/Condition.ts
CHANGED
|
@@ -20,5 +20,15 @@ export class LogicalCondition {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
export class SortCondition extends Condition {
|
|
24
|
+
constructor(readonly key: string, readonly value: number) {
|
|
25
|
+
super(key, '', value);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
toJSON(): Json {
|
|
29
|
+
return { [this.key]: this.value };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
23
33
|
export const toCondition = (field: string, operator: string, value: unknown, conv: Convert = convert.default): Condition =>
|
|
24
34
|
new Condition(field, operator, conv.from(value) as JsonValue);
|
package/src/data/Field.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Property } from '../utils';
|
|
2
|
-
import { Condition, toCondition } from
|
|
2
|
+
import { Condition, SortCondition, toCondition } from "./Condition";
|
|
3
3
|
import { toArray } from '../types';
|
|
4
4
|
|
|
5
5
|
export class Field extends Property {
|
|
@@ -21,5 +21,9 @@ export class Field extends Property {
|
|
|
21
21
|
|
|
22
22
|
lessEqual = (value: unknown): Condition => this.condition('lte', value);
|
|
23
23
|
|
|
24
|
+
asc = (): SortCondition => new SortCondition(this.property, -1)
|
|
25
|
+
|
|
26
|
+
desc = (): SortCondition => new SortCondition(this.property, 1)
|
|
27
|
+
|
|
24
28
|
protected condition = (operator: string, value: unknown): Condition => toCondition(this.property, operator, value, this.options?.convert);
|
|
25
29
|
}
|