@thisisagile/easy 17.4.3 → 17.4.5

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/index.mjs CHANGED
@@ -101,6 +101,7 @@ export * from "./utils/Log";
101
101
  export * from "./utils/Mapper";
102
102
  export * from "./utils/Promise";
103
103
  export * from "./utils/Property";
104
+ export * from "./utils/Seconds";
104
105
  export * from "./utils/State";
105
106
  export * from "./utils/Sentence";
106
107
  export * from "./utils/Traverse";
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './data/Condition';\nexport * from './data/InMemoryGateway';\nexport * from './data/Database';\nexport * from './data/DataProvider';\nexport * from './data/Field';\nexport * from './data/Query';\nexport * from './data/QueryProvider';\n\nexport * from './domain/Audit';\nexport * from './domain/Child';\nexport * from './domain/DateTime';\nexport * from './domain/Entity';\nexport * from './domain/Struct';\nexport * from './domain/Repo';\nexport * from './domain/Typo';\n\nexport * from './http/CacheControl';\nexport * from './http/ContentType';\nexport * from './http/HttpHeader';\nexport * from './http/HttpStatus';\nexport * from './http/HttpVerb';\nexport * from './http/Request';\nexport * from './http/RequestOptions';\nexport * from './http/RequestProvider';\nexport * from './http/Response';\nexport * from './http/RestResult';\nexport * from './http/toResponse';\n\nexport * from './process/App';\nexport * from './process/Manage';\nexport * from './process/Scope';\nexport * from './process/Search';\nexport * from './process/UseCase';\n\nexport * from './resources/Req';\n\nexport * from './security/Jwt';\n\nexport * from './services/Api';\nexport * from './services/ApiGateway';\nexport * from './services/AxiosProvider';\nexport * from './services/MappedRouteGateway';\nexport * from './services/RouteGateway';\nexport * from './services/ViewRouteGateway';\n\nexport * from './sql/Clause';\nexport * from './sql/Column';\nexport * from './sql/Delete';\nexport * from './sql/Insert';\nexport * from './sql/Join';\nexport * from './sql/SqlQuery';\nexport * from './sql/Select';\nexport * from './sql/Table';\nexport * from './sql/TableGateway';\nexport * from './sql/Update';\n\nexport * from './types/AnyKey';\nexport * from './types/Array';\nexport * from './types/Builder';\nexport * from './types/Cache';\nexport * from './types/CacheAge';\nexport * from './types/Case';\nexport * from './types/Constructor';\nexport * from './types/Context';\nexport * from './types/Currency';\nexport * from './types/Enum';\nexport * from './types/Environment';\nexport * from './types/ErrorOrigin';\nexport * from './types/Exception';\nexport * from './types/Falsy';\nexport * from './types/Func';\nexport * from './types/Gateway';\nexport * from './types/Get';\nexport * from './types/Id';\nexport * from './types/Identity';\nexport * from './types/Is';\nexport * from './types/IsA';\nexport * from './types/IsDate';\nexport * from './types/IsEqual';\nexport * from './types/Json';\nexport * from './types/List';\nexport * from './types/Message';\nexport * from './types/Meta';\nexport * from './types/Nullish';\nexport * from './types/Number';\nexport * from './types/Object';\nexport * from './types/PageList';\nexport * from './types/Parser';\nexport * from './types/Primitive';\nexport * from './types/Repository';\nexport * from './types/Result';\nexport * from './types/Results';\nexport * from './types/Sort';\nexport * from './types/Tag';\nexport * from './types/Template';\nexport * from './types/Text';\nexport * from './types/Try';\nexport * from './types/TypeGuard';\nexport * from './types/Types';\nexport * from './types/Uri';\nexport * from './types/Uuid';\nexport * from './types/Validatable';\nexport * from './types/Value';\n\nexport * from './utils/Base64';\nexport * from './utils/Convert';\nexport * from './utils/If';\nexport * from './utils/Loading';\nexport * from './utils/Log';\nexport * from './utils/Mapper';\nexport * from './utils/Promise';\nexport * from './utils/Property';\nexport * from './utils/State';\nexport * from './utils/Sentence';\nexport * from './utils/Traverse';\nexport * from './utils/View';\nexport * from './utils/Wait';\n\nexport * from './validation/Contraints';\nexport * from './validation/Validate';\nexport * from './validation/When';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AAEd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './data/Condition';\nexport * from './data/InMemoryGateway';\nexport * from './data/Database';\nexport * from './data/DataProvider';\nexport * from './data/Field';\nexport * from './data/Query';\nexport * from './data/QueryProvider';\n\nexport * from './domain/Audit';\nexport * from './domain/Child';\nexport * from './domain/DateTime';\nexport * from './domain/Entity';\nexport * from './domain/Struct';\nexport * from './domain/Repo';\nexport * from './domain/Typo';\n\nexport * from './http/CacheControl';\nexport * from './http/ContentType';\nexport * from './http/HttpHeader';\nexport * from './http/HttpStatus';\nexport * from './http/HttpVerb';\nexport * from './http/Request';\nexport * from './http/RequestOptions';\nexport * from './http/RequestProvider';\nexport * from './http/Response';\nexport * from './http/RestResult';\nexport * from './http/toResponse';\n\nexport * from './process/App';\nexport * from './process/Manage';\nexport * from './process/Scope';\nexport * from './process/Search';\nexport * from './process/UseCase';\n\nexport * from './resources/Req';\n\nexport * from './security/Jwt';\n\nexport * from './services/Api';\nexport * from './services/ApiGateway';\nexport * from './services/AxiosProvider';\nexport * from './services/MappedRouteGateway';\nexport * from './services/RouteGateway';\nexport * from './services/ViewRouteGateway';\n\nexport * from './sql/Clause';\nexport * from './sql/Column';\nexport * from './sql/Delete';\nexport * from './sql/Insert';\nexport * from './sql/Join';\nexport * from './sql/SqlQuery';\nexport * from './sql/Select';\nexport * from './sql/Table';\nexport * from './sql/TableGateway';\nexport * from './sql/Update';\n\nexport * from './types/AnyKey';\nexport * from './types/Array';\nexport * from './types/Builder';\nexport * from './types/Cache';\nexport * from './types/CacheAge';\nexport * from './types/Case';\nexport * from './types/Constructor';\nexport * from './types/Context';\nexport * from './types/Currency';\nexport * from './types/Enum';\nexport * from './types/Environment';\nexport * from './types/ErrorOrigin';\nexport * from './types/Exception';\nexport * from './types/Falsy';\nexport * from './types/Func';\nexport * from './types/Gateway';\nexport * from './types/Get';\nexport * from './types/Id';\nexport * from './types/Identity';\nexport * from './types/Is';\nexport * from './types/IsA';\nexport * from './types/IsDate';\nexport * from './types/IsEqual';\nexport * from './types/Json';\nexport * from './types/List';\nexport * from './types/Message';\nexport * from './types/Meta';\nexport * from './types/Nullish';\nexport * from './types/Number';\nexport * from './types/Object';\nexport * from './types/PageList';\nexport * from './types/Parser';\nexport * from './types/Primitive';\nexport * from './types/Repository';\nexport * from './types/Result';\nexport * from './types/Results';\nexport * from './types/Sort';\nexport * from './types/Tag';\nexport * from './types/Template';\nexport * from './types/Text';\nexport * from './types/Try';\nexport * from './types/TypeGuard';\nexport * from './types/Types';\nexport * from './types/Uri';\nexport * from './types/Uuid';\nexport * from './types/Validatable';\nexport * from './types/Value';\n\nexport * from './utils/Base64';\nexport * from './utils/Convert';\nexport * from './utils/If';\nexport * from './utils/Loading';\nexport * from './utils/Log';\nexport * from './utils/Mapper';\nexport * from './utils/Promise';\nexport * from './utils/Property';\nexport * from './utils/Seconds';\nexport * from './utils/State';\nexport * from './utils/Sentence';\nexport * from './utils/Traverse';\nexport * from './utils/View';\nexport * from './utils/Wait';\n\nexport * from './validation/Contraints';\nexport * from './validation/Validate';\nexport * from './validation/When';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AAEd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
@@ -0,0 +1,9 @@
1
+ export declare const seconds: {
2
+ toDuration: (s: number) => {
3
+ days: number;
4
+ hours: number;
5
+ minutes: number;
6
+ seconds: number;
7
+ };
8
+ toText: (s: number) => string;
9
+ };
@@ -0,0 +1,39 @@
1
+ import {
2
+ toList
3
+ } from "../chunk-EX7OK25Y.mjs";
4
+ import {
5
+ ifTrue
6
+ } from "../chunk-JSON7A4X.mjs";
7
+ import "../chunk-X7FZPY3P.mjs";
8
+ import "../chunk-45GNHDKA.mjs";
9
+ import "../chunk-SJGQU3OG.mjs";
10
+ import "../chunk-ZHXKBOK2.mjs";
11
+ import "../chunk-ZPNFXK7Y.mjs";
12
+ import "../chunk-DXQSIBC7.mjs";
13
+ import "../chunk-PIRWVOO2.mjs";
14
+ import "../chunk-DEJ7A5PY.mjs";
15
+ import "../chunk-4N72FQFX.mjs";
16
+
17
+ // src/utils/Seconds.ts
18
+ var seconds = {
19
+ toDuration: (s) => {
20
+ const seconds2 = s % 60;
21
+ const minutes = Math.floor(s / 60) % 60;
22
+ const hours = Math.floor(s / 3600) % 24;
23
+ const days = Math.floor(s / 86400);
24
+ return { days, hours, minutes, seconds: seconds2 };
25
+ },
26
+ toText: (s) => {
27
+ const { days, hours, minutes, seconds: secs } = seconds.toDuration(s);
28
+ return toList(
29
+ ifTrue(days, (d) => `${d}d`),
30
+ ifTrue(hours, (h) => `${h}h`),
31
+ ifTrue(minutes, (m) => `${m}m`),
32
+ ifTrue(days + hours + minutes === 0, `${secs}s`)
33
+ ).mapDefined((s2) => s2).join(" ");
34
+ }
35
+ };
36
+ export {
37
+ seconds
38
+ };
39
+ //# sourceMappingURL=Seconds.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/Seconds.ts"],"sourcesContent":["import { ifTrue } from './If';\nimport { toList } from '../types/List';\n\nexport const seconds = {\n toDuration: (s: number) => {\n const seconds = s % 60;\n const minutes = Math.floor(s / 60) % 60;\n const hours = Math.floor(s / 3600) % 24;\n const days = Math.floor(s / 86400);\n return { days, hours, minutes, seconds };\n },\n\n toText: (s: number) => {\n const { days, hours, minutes, seconds: secs } = seconds.toDuration(s);\n return toList(\n ifTrue(days, d => `${d}d`),\n ifTrue(hours, h => `${h}h`),\n ifTrue(minutes, m => `${m}m`),\n ifTrue(days + hours + minutes === 0, `${secs}s`)\n )\n .mapDefined(s => s)\n .join(' ');\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAGO,IAAM,UAAU;AAAA,EACrB,YAAY,CAAC,MAAc;AACzB,UAAMA,WAAU,IAAI;AACpB,UAAM,UAAU,KAAK,MAAM,IAAI,EAAE,IAAI;AACrC,UAAM,QAAQ,KAAK,MAAM,IAAI,IAAI,IAAI;AACrC,UAAM,OAAO,KAAK,MAAM,IAAI,KAAK;AACjC,WAAO,EAAE,MAAM,OAAO,SAAS,SAAAA,SAAQ;AAAA,EACzC;AAAA,EAEA,QAAQ,CAAC,MAAc;AACrB,UAAM,EAAE,MAAM,OAAO,SAAS,SAAS,KAAK,IAAI,QAAQ,WAAW,CAAC;AACpE,WAAO;AAAA,MACL,OAAO,MAAM,OAAK,GAAG,CAAC,GAAG;AAAA,MACzB,OAAO,OAAO,OAAK,GAAG,CAAC,GAAG;AAAA,MAC1B,OAAO,SAAS,OAAK,GAAG,CAAC,GAAG;AAAA,MAC5B,OAAO,OAAO,QAAQ,YAAY,GAAG,GAAG,IAAI,GAAG;AAAA,IACjD,EACG,WAAW,CAAAC,OAAKA,EAAC,EACjB,KAAK,GAAG;AAAA,EACb;AACF;","names":["seconds","s"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thisisagile/easy",
3
- "version": "17.4.3",
3
+ "version": "17.4.5",
4
4
  "description": "Straightforward library for building domain-driven microservice architectures",
5
5
  "author": "Sander Hoogendoorn",
6
6
  "license": "MIT",
@@ -34,7 +34,7 @@
34
34
  "access": "public"
35
35
  },
36
36
  "devDependencies": {
37
- "@thisisagile/easy-test": "17.4.3",
37
+ "@thisisagile/easy-test": "17.4.5",
38
38
  "@types/form-urlencoded": "^4.4.0",
39
39
  "@types/luxon": "3.4.2",
40
40
  "@types/validator": "^13.11.10"
package/src/index.ts CHANGED
@@ -110,6 +110,7 @@ export * from './utils/Log';
110
110
  export * from './utils/Mapper';
111
111
  export * from './utils/Promise';
112
112
  export * from './utils/Property';
113
+ export * from './utils/Seconds';
113
114
  export * from './utils/State';
114
115
  export * from './utils/Sentence';
115
116
  export * from './utils/Traverse';
@@ -0,0 +1,24 @@
1
+ import { ifTrue } from './If';
2
+ import { toList } from '../types/List';
3
+
4
+ export const seconds = {
5
+ toDuration: (s: number) => {
6
+ const seconds = s % 60;
7
+ const minutes = Math.floor(s / 60) % 60;
8
+ const hours = Math.floor(s / 3600) % 24;
9
+ const days = Math.floor(s / 86400);
10
+ return { days, hours, minutes, seconds };
11
+ },
12
+
13
+ toText: (s: number) => {
14
+ const { days, hours, minutes, seconds: secs } = seconds.toDuration(s);
15
+ return toList(
16
+ ifTrue(days, d => `${d}d`),
17
+ ifTrue(hours, h => `${h}h`),
18
+ ifTrue(minutes, m => `${m}m`),
19
+ ifTrue(days + hours + minutes === 0, `${secs}s`)
20
+ )
21
+ .mapDefined(s => s)
22
+ .join(' ');
23
+ },
24
+ };