@thisisagile/easy 12.19.1 → 12.19.2

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,11 +1,6 @@
1
1
  import { List } from './List';
2
2
  import { Construct } from './Constructor';
3
- export declare const asc = 1;
4
- export declare const desc = -1;
5
- export declare type Sort = {
6
- key: string;
7
- value: -1 | 1;
8
- };
3
+ import { PlainSort, Sort } from './Sort';
9
4
  export declare type FilterValue = {
10
5
  label?: string;
11
6
  value: any;
@@ -22,6 +17,7 @@ export declare type PageOptions = {
22
17
  take?: number;
23
18
  skip?: number;
24
19
  sort?: Sort[];
20
+ sorts?: PlainSort;
25
21
  filters?: Filter[];
26
22
  };
27
23
  export declare type PageList<T> = List<T> & Omit<PageOptions, 'sort'> & {
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.asPageList = exports.toPageList = exports.isPageList = exports.toShortFilter = exports.toFilter = exports.desc = exports.asc = void 0;
3
+ exports.asPageList = exports.toPageList = exports.isPageList = exports.toShortFilter = exports.toFilter = void 0;
4
4
  const List_1 = require("./List");
5
5
  const Constructor_1 = require("./Constructor");
6
6
  const IsA_1 = require("./IsA");
7
- exports.asc = 1;
8
- exports.desc = -1;
9
7
  const toFilter = (field, value) => (0, exports.toShortFilter)(field, field, value);
10
8
  exports.toFilter = toFilter;
11
9
  const toShortFilter = (field, shortField, value) => ({
@@ -20,6 +18,7 @@ const toPageList = (items, options) => (0, Constructor_1.on)((0, List_1.toList)(
20
18
  l.take = options?.take ?? 250;
21
19
  l.skip = options?.skip ?? 0;
22
20
  l.total = options?.total;
21
+ l.sorts = options?.sorts;
23
22
  l.filters = options?.filters;
24
23
  });
25
24
  exports.toPageList = toPageList;
@@ -1 +1 @@
1
- {"version":3,"file":"PageList.js","sourceRoot":"","sources":["../../src/types/PageList.ts"],"names":[],"mappings":";;;AAAA,iCAA8C;AAC9C,+CAA2D;AAC3D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APQ,QAAA,UAAU,cAOlB;AAEE,MAAM,UAAU,GAAG,CAAO,CAAe,EAAE,QAAQ,IAAA,kBAAU,GAAK,EAAe,EAAE,CACxF,IAAA,kBAAU,EACR,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAA,yBAAW,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EACjC,KAAK,CACN,CAAC;AAJS,QAAA,UAAU,cAInB"}
@@ -0,0 +1,8 @@
1
+ export declare const asc = 1;
2
+ export declare const desc = -1;
3
+ export declare type SortDirection = typeof asc | typeof desc;
4
+ export declare type Sort = {
5
+ key: string;
6
+ value: SortDirection;
7
+ };
8
+ export declare type PlainSort = Record<string, SortDirection>;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.desc = exports.asc = void 0;
4
+ exports.asc = 1;
5
+ exports.desc = -1;
6
+ //# sourceMappingURL=Sort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sort.js","sourceRoot":"","sources":["../../src/types/Sort.ts"],"names":[],"mappings":";;;AAAa,QAAA,GAAG,GAAG,CAAC,CAAC;AACR,QAAA,IAAI,GAAG,CAAC,CAAC,CAAC"}
@@ -24,14 +24,15 @@ export * from './Message';
24
24
  export * from './Meta';
25
25
  export * from './Nullish';
26
26
  export * from './Number';
27
+ export * from './PageList';
27
28
  export * from './Primitive';
28
29
  export * from './Repository';
29
30
  export * from './Result';
30
31
  export * from './Results';
32
+ export * from './Sort';
31
33
  export * from './Tag';
32
34
  export * from './Template';
33
35
  export * from './Text';
34
- export * from './PageList';
35
36
  export * from './Try';
36
37
  export * from './Types';
37
38
  export * from './Uri';
@@ -39,3 +40,8 @@ export * from './Uuid';
39
40
  export * from './Validatable';
40
41
  export * from './Value';
41
42
  export { isPrimitive } from './Primitive';
43
+ export { PlainSort } from "./Sort";
44
+ export { Sort } from "./Sort";
45
+ export { SortDirection } from "./Sort";
46
+ export { desc } from "./Sort";
47
+ export { asc } from "./Sort";
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.isPrimitive = void 0;
17
+ exports.asc = exports.desc = exports.isPrimitive = void 0;
18
18
  __exportStar(require("./Array"), exports);
19
19
  __exportStar(require("./Builder"), exports);
20
20
  __exportStar(require("./Cache"), exports);
@@ -41,14 +41,15 @@ __exportStar(require("./Message"), exports);
41
41
  __exportStar(require("./Meta"), exports);
42
42
  __exportStar(require("./Nullish"), exports);
43
43
  __exportStar(require("./Number"), exports);
44
+ __exportStar(require("./PageList"), exports);
44
45
  __exportStar(require("./Primitive"), exports);
45
46
  __exportStar(require("./Repository"), exports);
46
47
  __exportStar(require("./Result"), exports);
47
48
  __exportStar(require("./Results"), exports);
49
+ __exportStar(require("./Sort"), exports);
48
50
  __exportStar(require("./Tag"), exports);
49
51
  __exportStar(require("./Template"), exports);
50
52
  __exportStar(require("./Text"), exports);
51
- __exportStar(require("./PageList"), exports);
52
53
  __exportStar(require("./Try"), exports);
53
54
  __exportStar(require("./Types"), exports);
54
55
  __exportStar(require("./Uri"), exports);
@@ -57,4 +58,8 @@ __exportStar(require("./Validatable"), exports);
57
58
  __exportStar(require("./Value"), exports);
58
59
  var Primitive_1 = require("./Primitive");
59
60
  Object.defineProperty(exports, "isPrimitive", { enumerable: true, get: function () { return Primitive_1.isPrimitive; } });
61
+ var Sort_1 = require("./Sort");
62
+ Object.defineProperty(exports, "desc", { enumerable: true, get: function () { return Sort_1.desc; } });
63
+ var Sort_2 = require("./Sort");
64
+ Object.defineProperty(exports, "asc", { enumerable: true, get: function () { return Sort_2.asc; } });
60
65
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":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wCAAsB;AACtB,6CAA2B;AAC3B,yCAAuB;AACvB,wCAAsB;AACtB,0CAAwB;AACxB,wCAAsB;AACtB,yCAAuB;AACvB,gDAA8B;AAC9B,0CAAwB;AACxB,yCAA0C;AAAjC,wGAAA,WAAW,OAAA;AAIpB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,+BAA6B;AAApB,2FAAA,GAAG,OAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thisisagile/easy",
3
- "version": "12.19.1",
3
+ "version": "12.19.2",
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": "12.19.1",
34
+ "@thisisagile/easy-test": "12.19.2",
35
35
  "@types/form-urlencoded": "^4.4.0",
36
36
  "@types/jsonwebtoken": "^8.5.9",
37
37
  "@types/luxon": "3.1.0",
@@ -1,10 +1,7 @@
1
1
  import { isList, List, toList } from './List';
2
2
  import { Construct, ofConstruct, on } from './Constructor';
3
3
  import { isA } from './IsA';
4
-
5
- export const asc = 1;
6
- export const desc = -1;
7
- export type Sort = { key: string; value: -1 | 1 };
4
+ import { PlainSort, Sort } from './Sort';
8
5
 
9
6
  export type FilterValue = { label?: string; value: any };
10
7
  export type Filter = { label?: string; field: string; shortField?: string; values: FilterValue[] };
@@ -16,7 +13,7 @@ export const toShortFilter = (field: string, shortField: string, value: any): Fi
16
13
  values: [{ value }],
17
14
  });
18
15
 
19
- export type PageOptions = { take?: number; skip?: number; sort?: Sort[]; filters?: Filter[] };
16
+ export type PageOptions = { take?: number; skip?: number; sort?: Sort[]; sorts?: PlainSort; filters?: Filter[] };
20
17
  export type PageList<T> = List<T> & Omit<PageOptions, 'sort'> & { total?: number };
21
18
 
22
19
  export const isPageList = <T>(l?: T[]): l is PageList<T> => isList<T>(l) && isA(l, 'total');
@@ -26,6 +23,7 @@ export const toPageList = <T>(items?: T[], options?: Omit<PageOptions, 'sort'> &
26
23
  l.take = options?.take ?? 250;
27
24
  l.skip = options?.skip ?? 0;
28
25
  l.total = options?.total;
26
+ l.sorts = options?.sorts;
29
27
  l.filters = options?.filters;
30
28
  });
31
29
 
@@ -0,0 +1,5 @@
1
+ export const asc = 1;
2
+ export const desc = -1;
3
+ export type SortDirection = typeof asc | typeof desc;
4
+ export type Sort = { key: string; value: SortDirection };
5
+ export type PlainSort = Record<string, SortDirection>;
@@ -24,14 +24,15 @@ export * from './Message';
24
24
  export * from './Meta';
25
25
  export * from './Nullish';
26
26
  export * from './Number';
27
+ export * from './PageList';
27
28
  export * from './Primitive';
28
29
  export * from './Repository';
29
30
  export * from './Result';
30
31
  export * from './Results';
32
+ export * from './Sort';
31
33
  export * from './Tag';
32
34
  export * from './Template';
33
35
  export * from './Text';
34
- export * from './PageList';
35
36
  export * from './Try';
36
37
  export * from './Types';
37
38
  export * from './Uri';
@@ -39,3 +40,8 @@ export * from './Uuid';
39
40
  export * from './Validatable';
40
41
  export * from './Value';
41
42
  export { isPrimitive } from './Primitive';
43
+ export { PlainSort } from "./Sort";
44
+ export { Sort } from "./Sort";
45
+ export { SortDirection } from "./Sort";
46
+ export { desc } from "./Sort";
47
+ export { asc } from "./Sort";