@thisisagile/easy 17.15.1 → 17.15.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,6 +1,6 @@
1
1
  import {
2
2
  AxiosProvider
3
- } from "./chunk-S43CTNIK.mjs";
3
+ } from "./chunk-GWZRZHFR.mjs";
4
4
  import {
5
5
  HttpVerb
6
6
  } from "./chunk-YMTOGXYB.mjs";
@@ -76,4 +76,4 @@ export {
76
76
  Api,
77
77
  api
78
78
  };
79
- //# sourceMappingURL=chunk-FFK2E2QL.mjs.map
79
+ //# sourceMappingURL=chunk-ECXNGUIP.mjs.map
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-O75J6WWI.mjs";
13
13
  import {
14
14
  cacheAge
15
- } from "./chunk-6UFIQJVC.mjs";
15
+ } from "./chunk-XH6PFRYM.mjs";
16
16
  import {
17
17
  choose
18
18
  } from "./chunk-2KZ5UP6A.mjs";
@@ -53,4 +53,4 @@ var AxiosProvider = class {
53
53
  export {
54
54
  AxiosProvider
55
55
  };
56
- //# sourceMappingURL=chunk-S43CTNIK.mjs.map
56
+ //# sourceMappingURL=chunk-GWZRZHFR.mjs.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  ApiGateway
3
- } from "./chunk-ZHAVV2E5.mjs";
3
+ } from "./chunk-Z56QALMP.mjs";
4
4
  import {
5
5
  Api
6
- } from "./chunk-FFK2E2QL.mjs";
6
+ } from "./chunk-ECXNGUIP.mjs";
7
7
  import {
8
8
  HttpStatus
9
9
  } from "./chunk-UGUAZFM4.mjs";
@@ -54,4 +54,4 @@ var RouteGateway = class extends ApiGateway {
54
54
  export {
55
55
  RouteGateway
56
56
  };
57
- //# sourceMappingURL=chunk-OCJ4IL63.mjs.map
57
+ //# sourceMappingURL=chunk-W5WWSCMG.mjs.map
@@ -7,6 +7,10 @@ import {
7
7
  import {
8
8
  asString
9
9
  } from "./chunk-BDA5LB4S.mjs";
10
+ import {
11
+ isNumber,
12
+ isString
13
+ } from "./chunk-DEJ7A5PY.mjs";
10
14
 
11
15
  // src/types/CacheAge.ts
12
16
  var ageNumber = (s) => asNumber(s.replace(/[a-z]/g, ""));
@@ -44,8 +48,10 @@ var cacheAge = {
44
48
  (c) => ageNumber(c) * 24 * 3600
45
49
  ).else(ca)
46
50
  };
51
+ var isCacheAge = (ca) => isString(ca) || isNumber(ca);
47
52
 
48
53
  export {
49
- cacheAge
54
+ cacheAge,
55
+ isCacheAge
50
56
  };
51
- //# sourceMappingURL=chunk-6UFIQJVC.mjs.map
57
+ //# sourceMappingURL=chunk-XH6PFRYM.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types/CacheAge.ts"],"sourcesContent":["import { asNumber } from './Number';\nimport { choose } from './Case';\nimport { asString } from './Text';\nimport { isNumber, isString } from './Is';\n\nexport type CacheAge = `${number}${'ms' | 's' | 'm' | 'h' | 'd'}` | number;\n\nconst ageNumber = (s: string): number => asNumber(s.replace(/[a-z]/g, ''));\n\nexport const cacheAge = {\n toMilliseconds: (ca: CacheAge): number =>\n choose(asString(ca))\n .case(\n c => c.endsWith('ms'),\n c => ageNumber(c)\n )\n .case(\n c => c.endsWith('s'),\n c => ageNumber(c) * 1000\n )\n .case(\n c => c.endsWith('m'),\n c => ageNumber(c) * 60 * 1000\n )\n .case(\n c => c.endsWith('h'),\n c => ageNumber(c) * 3600 * 1000\n )\n .case(\n c => c.endsWith('d'),\n c => ageNumber(c) * 24 * 3600 * 1000\n )\n .else(ca as number),\n\n toSeconds: (ca: CacheAge): number =>\n choose(asString(ca))\n .case(\n c => c.endsWith('ms'),\n c => ageNumber(c) / 1000\n )\n .case(\n c => c.endsWith('s'),\n c => ageNumber(c)\n )\n .case(\n c => c.endsWith('m'),\n c => ageNumber(c) * 60\n )\n .case(\n c => c.endsWith('h'),\n c => ageNumber(c) * 3600\n )\n .case(\n c => c.endsWith('d'),\n c => ageNumber(c) * 24 * 3600\n )\n .else(ca as number),\n};\n\nex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Aa,CAAC,OAAiC,SAAS,EAAE,KAAK,SAAS,EAAE;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Api
3
- } from "./chunk-FFK2E2QL.mjs";
3
+ } from "./chunk-ECXNGUIP.mjs";
4
4
  import {
5
5
  Gateway
6
6
  } from "./chunk-CSKOVGAP.mjs";
@@ -43,4 +43,4 @@ var ApiGateway = class extends Gateway {
43
43
  export {
44
44
  ApiGateway
45
45
  };
46
- //# sourceMappingURL=chunk-ZHAVV2E5.mjs.map
46
+ //# sourceMappingURL=chunk-Z56QALMP.mjs.map
@@ -1,6 +1,7 @@
1
1
  import {
2
- cacheAge
3
- } from "../chunk-6UFIQJVC.mjs";
2
+ cacheAge,
3
+ isCacheAge
4
+ } from "../chunk-XH6PFRYM.mjs";
4
5
  import "../chunk-B3AQ7EZQ.mjs";
5
6
  import "../chunk-2KZ5UP6A.mjs";
6
7
  import "../chunk-OFGI5FLG.mjs";
@@ -29,9 +30,7 @@ import {
29
30
  } from "../chunk-ZPNFXK7Y.mjs";
30
31
  import "../chunk-DXQSIBC7.mjs";
31
32
  import "../chunk-PIRWVOO2.mjs";
32
- import {
33
- isNumber
34
- } from "../chunk-DEJ7A5PY.mjs";
33
+ import "../chunk-DEJ7A5PY.mjs";
35
34
  import "../chunk-4N72FQFX.mjs";
36
35
 
37
36
  // src/http/CacheControl.ts
@@ -58,7 +57,7 @@ var CacheControl = class _CacheControl {
58
57
  staleWhileRevalidate = (ca) => on(this, (t) => t.directives["stale-while-revalidate"] = ca);
59
58
  value = () => this.toString();
60
59
  toString() {
61
- return entries(this.directives).mapDefined(([k, v]) => ifDefined(v, isNumber(v) ? `${k}=${cacheAge.toSeconds(v)}` : k)).join(",");
60
+ return entries(this.directives).mapDefined(([k, v]) => ifDefined(v, isCacheAge(v) ? `${k}=${cacheAge.toSeconds(v)}` : k)).join(",");
62
61
  }
63
62
  };
64
63
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/http/CacheControl.ts"],"sourcesContent":["import { cacheAge, CacheAge } from '../types/CacheAge';\nimport { on } from '../types/Constructor';\nimport { entries } from '../types/Object';\nimport { ifDefined } from '../utils/If';\nimport { isNumber } from '../types/Is';\n\nexport class CacheControl {\n name = 'Cache-Control';\n\n protected constructor(\n readonly enabled = true,\n private directives: Record<string, boolean | CacheAge | undefined> = {}\n ) {}\n\n static disabled = () => new CacheControl(false);\n\n static OneSecond = () => new CacheControl().maxAge(1).staleWhileRevalidate(1);\n\n static fiveSeconds = () => new CacheControl().maxAge(5).staleWhileRevalidate(5);\n\n static tenSeconds = () => new CacheControl().maxAge(10).staleWhileRevalidate(10);\n\n static thirtySeconds = () => new CacheControl().maxAge(30).staleWhileRevalidate(30);\n\n static sixtySeconds = () => new CacheControl().maxAge(60).staleWhileRevalidate(60);\n\n static custom = (maxAge?: CacheAge, staleWhileRevalidate?: CacheAge) => new CacheControl().maxAge(maxAge).staleWhileRevalidate(staleWhileRevalidate);\n\n readonly maxAge = (ca?: CacheAge): this => on(this, t => (t.directives['max-age'] = ca));\n\n readonly sharedMaxAge = (ca?: CacheAge): this => on(this, t => (t.directives['s-maxage'] = ca));\n\n readonly noCache = (a?: boolean): this => on(this, t => (t.directives['no-cache'] = a));\n\n readonly mustRevalidate = (a?: boolean): this => on(this, t => (t.directives['must-revalidate'] = a));\n\n readonly private = (a?: boolean): this => on(this, t => (t.directives['private'] = a));\n\n readonly public = (a?: boolean): this => on(this, t => (t.directives['public'] = a));\n\n readonly immutable = (a?: boolean): this => on(this, t => (t.directives['immutable'] = a));\n\n readonly staleWhileRevalidate = (ca?: CacheAge): this => on(this, t => (t.directives['stale-while-revalidate'] = ca));\n\n value = (): string => this.toString();\n\n toString(): string {\n return entries(this.directives)\n .mapDefined(([k, v]) => ifDefined(v, isNumber(v) ? `${k}=${cacheAge.toSeconds(v)}` : k))\n .join(',');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMO,IAAM,eAAN,MAAM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,uBAAuB,CAAC,OAAwB,GAAG,MAAM,OAAM,EAAE,WAAW,wBAAwB,IAAI,EAAG;AAAA,EAEpH,QAAQ,MAAc,KAAK,SAAS;AAAA,EAEpC,WAAmB;AACjB,WAAO,QAAQ,KAAK,UAAU,EAC3B,WAAW,CAAC,CAAC,GAAG,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC,IAAI,GAAG,CAAC,IAAI,SAAS,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,EACtF,KAAK,GAAG;AAAA,EACb;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/http/CacheControl.ts"],"sourcesContent":["import { cacheAge, CacheAge, isCacheAge } from '../types/CacheAge';\nimport { on } from '../types/Constructor';\nimport { entries } from '../types/Object';\nimport { ifDefined } from '../utils/If';\n\nexport class CacheControl {\n name = 'Cache-Control';\n\n protected constructor(\n readonly enabled = true,\n private directives: Record<string, boolean | CacheAge | undefined> = {}\n ) {}\n\n static disabled = () => new CacheControl(false);\n\n static OneSecond = () => new CacheControl().maxAge(1).staleWhileRevalidate(1);\n\n static fiveSeconds = () => new CacheControl().maxAge(5).staleWhileRevalidate(5);\n\n static tenSeconds = () => new CacheControl().maxAge(10).staleWhileRevalidate(10);\n\n static thirtySeconds = () => new CacheControl().maxAge(30).staleWhileRevalidate(30);\n\n static sixtySeconds = () => new CacheControl().maxAge(60).staleWhileRevalidate(60);\n\n static custom = (maxAge?: CacheAge, staleWhileRevalidate?: CacheAge) => new CacheControl().maxAge(maxAge).staleWhileRevalidate(staleWhileRevalidate);\n\n readonly maxAge = (ca?: CacheAge): this => on(this, t => (t.directives['max-age'] = ca));\n\n readonly sharedMaxAge = (ca?: CacheAge): this => on(this, t => (t.directives['s-maxage'] = ca));\n\n readonly noCache = (a?: boolean): this => on(this, t => (t.directives['no-cache'] = a));\n\n readonly mustRevalidate = (a?: boolean): this => on(this, t => (t.directives['must-revalidate'] = a));\n\n readonly private = (a?: boolean): this => on(this, t => (t.directives['private'] = a));\n\n readonly public = (a?: boolean): this => on(this, t => (t.directives['public'] = a));\n\n readonly immutable = (a?: boolean): this => on(this, t => (t.directives['immutable'] = a));\n\n readonly staleWhileRevalidate = (ca?: CacheAge): this => on(this, t => (t.directives['stale-while-revalidate'] = ca));\n\n value = (): string => this.toString();\n\n toString(): string {\n return entries(this.directives)\n .mapDefined(([k, v]) => ifDefined(v, isCacheAge(v) ? `${k}=${cacheAge.toSeconds(v)}` : k))\n .join(',');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,IAAM,eAAN,MAAM,cAAa;AAAA,EAGd,YACC,UAAU,MACX,aAA6D,CAAC,GACtE;AAFS;AACD;AAAA,EACP;AAAA,EALH,OAAO;AAAA,EAOP,OAAO,WAAW,MAAM,IAAI,cAAa,KAAK;AAAA,EAE9C,OAAO,YAAY,MAAM,IAAI,cAAa,EAAE,OAAO,CAAC,EAAE,qBAAqB,CAAC;AAAA,EAE5E,OAAO,cAAc,MAAM,IAAI,cAAa,EAAE,OAAO,CAAC,EAAE,qBAAqB,CAAC;AAAA,EAE9E,OAAO,aAAa,MAAM,IAAI,cAAa,EAAE,OAAO,EAAE,EAAE,qBAAqB,EAAE;AAAA,EAE/E,OAAO,gBAAgB,MAAM,IAAI,cAAa,EAAE,OAAO,EAAE,EAAE,qBAAqB,EAAE;AAAA,EAElF,OAAO,eAAe,MAAM,IAAI,cAAa,EAAE,OAAO,EAAE,EAAE,qBAAqB,EAAE;AAAA,EAEjF,OAAO,SAAS,CAAC,QAAmB,yBAAoC,IAAI,cAAa,EAAE,OAAO,MAAM,EAAE,qBAAqB,oBAAoB;AAAA,EAE1I,SAAS,CAAC,OAAwB,GAAG,MAAM,OAAM,EAAE,WAAW,SAAS,IAAI,EAAG;AAAA,EAE9E,eAAe,CAAC,OAAwB,GAAG,MAAM,OAAM,EAAE,WAAW,UAAU,IAAI,EAAG;AAAA,EAErF,UAAU,CAAC,MAAsB,GAAG,MAAM,OAAM,EAAE,WAAW,UAAU,IAAI,CAAE;AAAA,EAE7E,iBAAiB,CAAC,MAAsB,GAAG,MAAM,OAAM,EAAE,WAAW,iBAAiB,IAAI,CAAE;AAAA,EAE3F,UAAU,CAAC,MAAsB,GAAG,MAAM,OAAM,EAAE,WAAW,SAAS,IAAI,CAAE;AAAA,EAE5E,SAAS,CAAC,MAAsB,GAAG,MAAM,OAAM,EAAE,WAAW,QAAQ,IAAI,CAAE;AAAA,EAE1E,YAAY,CAAC,MAAsB,GAAG,MAAM,OAAM,EAAE,WAAW,WAAW,IAAI,CAAE;AAAA,EAEhF,uBAAuB,CAAC,OAAwB,GAAG,MAAM,OAAM,EAAE,WAAW,wBAAwB,IAAI,EAAG;AAAA,EAEpH,QAAQ,MAAc,KAAK,SAAS;AAAA,EAEpC,WAAmB;AACjB,WAAO,QAAQ,KAAK,UAAU,EAC3B,WAAW,CAAC,CAAC,GAAG,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,GAAG,CAAC,IAAI,SAAS,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,EACxF,KAAK,GAAG;AAAA,EACb;AACF;","names":[]}
package/dist/index.js CHANGED
@@ -157,6 +157,7 @@ __export(src_exports, {
157
157
  isAn: () => isAn,
158
158
  isArray: () => isArray,
159
159
  isBoolean: () => isBoolean,
160
+ isCacheAge: () => isCacheAge,
160
161
  isClause: () => isClause,
161
162
  isConstructor: () => isConstructor,
162
163
  isCurrency: () => isCurrency,
@@ -2047,6 +2048,7 @@ var cacheAge = {
2047
2048
  (c) => ageNumber(c) * 24 * 3600
2048
2049
  ).else(ca)
2049
2050
  };
2051
+ var isCacheAge = (ca) => isString(ca) || isNumber(ca);
2050
2052
 
2051
2053
  // src/http/CacheControl.ts
2052
2054
  var CacheControl = class _CacheControl {
@@ -2072,7 +2074,7 @@ var CacheControl = class _CacheControl {
2072
2074
  staleWhileRevalidate = (ca) => on(this, (t) => t.directives["stale-while-revalidate"] = ca);
2073
2075
  value = () => this.toString();
2074
2076
  toString() {
2075
- return entries(this.directives).mapDefined(([k, v]) => ifDefined(v, isNumber(v) ? `${k}=${cacheAge.toSeconds(v)}` : k)).join(",");
2077
+ return entries(this.directives).mapDefined(([k, v]) => ifDefined(v, isCacheAge(v) ? `${k}=${cacheAge.toSeconds(v)}` : k)).join(",");
2076
2078
  }
2077
2079
  };
2078
2080
 
@@ -3494,6 +3496,7 @@ var wait = (millis) => Wait.wait(millis);
3494
3496
  isAn,
3495
3497
  isArray,
3496
3498
  isBoolean,
3499
+ isCacheAge,
3497
3500
  isClause,
3498
3501
  isConstructor,
3499
3502
  isCurrency,