@thisisagile/easy-test 13.6.13 → 14.1.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/README.md CHANGED
@@ -124,7 +124,7 @@ However, if you would create an `Email` value object, the validation can be impl
124
124
  You can now use the above `Email` class as the type of email properties in an entity or struct to make sure that this property is a valid email.
125
125
 
126
126
  #### DateTime
127
- DateTime is a value object that takes either a Date object, RFC-3339 formatted string, or a number representing Epoch in milliseconds. The json is always an RFC-3339 formatted string. [momentjs](https://momentjs.com/) is used internally.
127
+ DateTime is a value object that takes either a Date object, RFC-3339 formatted string, or a number representing Epoch in milliseconds. The json is always an RFC-3339 formatted string. [luxon](https://moment.github.io/luxon/#/) is used internally.
128
128
 
129
129
  A few examples of DateTime:
130
130
 
@@ -1,4 +1,5 @@
1
1
  import { Id, Json, JsonValue, Text } from './Types';
2
+ import { OneOrMore } from '@thisisagile/easy';
2
3
  export declare class Req {
3
4
  readonly state: any;
4
5
  readonly skip: number | undefined;
@@ -9,5 +10,6 @@ export declare class Req {
9
10
  get path(): Json;
10
11
  get query(): Json;
11
12
  get body(): unknown;
13
+ get headers(): Record<string, OneOrMore<string>>;
12
14
  get: (key: Text) => any;
13
15
  }
package/dist/utils/Req.js CHANGED
@@ -24,6 +24,9 @@ class Req {
24
24
  get body() {
25
25
  return this.state.body;
26
26
  }
27
+ get headers() {
28
+ return this.state.headers;
29
+ }
27
30
  }
28
31
  exports.Req = Req;
29
32
  //# sourceMappingURL=Req.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Req.js","sourceRoot":"","sources":["../../src/utils/Req.ts"],"names":[],"mappings":";;;AAAA,mCAA8C;AAG9C,MAAa,GAAG;IAId,YAAqB,QAAa,EAAE;QAAf,UAAK,GAAL,KAAK,CAAU;QAH3B,SAAI,GAAG,IAAA,iBAAS,EAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAA,gBAAQ,EAAC,IA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,CAAC,CAAC,IAAA,gBAAQ,EAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC5E,SAAI,GAAG,IAAA,iBAAS,EAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAA,gBAAQ,EAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QA4BrF,QAAG,GAAG,CAAC,GAAS,EAAO,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IA1B1E,CAAC;IAExC,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IACvC,CAAC;IAED,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,EAAE,IAAI,IAAI,EAAE,CAAC;IAChC,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC;IACjC,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;IACzB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;IAC5B,CAAC;CAGF;AA/BD,kBA+BC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thisisagile/easy-test",
3
- "version": "13.6.13",
3
+ "version": "14.1.0",
4
4
  "description": "Straightforward library for testing microservices built with @thisisagile/easy",
5
5
  "author": "Sander Hoogendoorn",
6
6
  "license": "MIT",
package/src/utils/Req.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { asNumber, isDefined } from './Utils';
2
2
  import { Id, Json, JsonValue, Text } from './Types';
3
+ import { OneOrMore } from '@thisisagile/easy';
3
4
 
4
5
  export class Req {
5
6
  readonly skip = isDefined(this.query?.skip) ? asNumber(this.query?.skip) : undefined;
@@ -27,5 +28,9 @@ export class Req {
27
28
  return this.state.body;
28
29
  }
29
30
 
31
+ get headers(): Record<string, OneOrMore<string>> {
32
+ return this.state.headers;
33
+ }
34
+
30
35
  get = (key: Text): any => this?.state[key.toString()] ?? this.path[key.toString()] ?? this.query[key.toString()];
31
36
  }