@digitraffic/common 2023.11.21-1 → 2023.12.15-1

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.
@@ -30,9 +30,7 @@ class UrlChecker {
30
30
  protocol: "https:",
31
31
  headers,
32
32
  };
33
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
34
33
  synthetics.getConfiguration().disableRequestMetrics();
35
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
36
34
  synthetics
37
35
  .getConfiguration()
38
36
  .withIncludeRequestBody(false)
@@ -1 +1,11 @@
1
1
  export type ValueOf<Obj> = Obj[keyof Obj];
2
+ /**
3
+ * Type-level conversion from readonly object to mutable object. Use with caution!
4
+ *
5
+ * Only converts in the type-level. Caution must be used, as the typescript cannot enforce readonly-ness at
6
+ * runtime. This is only useful for type-checking and especially in cases where 3rd party code requires
7
+ * mutable even though it is not needed.
8
+ */
9
+ export type Writable<T> = {
10
+ -readonly [P in keyof T]: T[P];
11
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitraffic/common",
3
- "version": "2023.11.21-1",
3
+ "version": "2023.12.15-1",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,7 +20,7 @@
20
20
  "@types/geojson": "^7946.0.12",
21
21
  "aws-cdk-lib": "^2.103.0",
22
22
  "aws-sdk": "^2.1481.0",
23
- "axios": "^1.5.1",
23
+ "axios": "^1.6.2",
24
24
  "change-case": "4.1.2",
25
25
  "constructs": "^10.3.0",
26
26
  "date-fns-tz": "~2.0.0",
@@ -2,7 +2,7 @@ import { IncomingMessage, RequestOptions } from "http";
2
2
  import { Asserter } from "../../../test/asserter";
3
3
 
4
4
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires
5
- const synthetics = require("Synthetics");
5
+ const synthetics: Synthetics = require("Synthetics");
6
6
  import zlib = require("zlib");
7
7
  import { MediaType } from "../../types/mediatypes";
8
8
  import { getApiKeyFromAPIGateway } from "../../runtime/apikey";
@@ -28,6 +28,26 @@ type JsonCheckerFunction<T> = (
28
28
  message: IncomingMessage
29
29
  ) => Promise<void>;
30
30
 
31
+ /** Temporary type fix for SyntheticsConfiguration */
32
+ interface SyntheticsConfiguration {
33
+ withIncludeRequestBody: (value: boolean) => SyntheticsConfiguration;
34
+ withIncludeRequestHeaders: (value: boolean) => SyntheticsConfiguration;
35
+ withIncludeResponseBody: (value: boolean) => SyntheticsConfiguration;
36
+ withIncludeResponseHeaders: (value: boolean) => SyntheticsConfiguration;
37
+ withFailedCanaryMetric: (value: boolean) => SyntheticsConfiguration;
38
+ disableRequestMetrics: () => SyntheticsConfiguration;
39
+ }
40
+
41
+ /** Temporary type fix for Synthetics */
42
+ interface Synthetics {
43
+ executeHttpStep<T>(
44
+ name: string,
45
+ requestOptions: RequestOptions,
46
+ callback: JsonCheckerFunction<T>
47
+ ): Promise<void>;
48
+ getConfiguration(): SyntheticsConfiguration;
49
+ }
50
+
31
51
  export class UrlChecker {
32
52
  private readonly requestOptions: RequestOptions;
33
53
 
@@ -45,10 +65,8 @@ export class UrlChecker {
45
65
  headers,
46
66
  };
47
67
 
48
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
49
68
  synthetics.getConfiguration().disableRequestMetrics();
50
69
 
51
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
52
70
  synthetics
53
71
  .getConfiguration()
54
72
  .withIncludeRequestBody(false)
@@ -1 +1,10 @@
1
1
  export type ValueOf<Obj> = Obj[keyof Obj];
2
+
3
+ /**
4
+ * Type-level conversion from readonly object to mutable object. Use with caution!
5
+ *
6
+ * Only converts in the type-level. Caution must be used, as the typescript cannot enforce readonly-ness at
7
+ * runtime. This is only useful for type-checking and especially in cases where 3rd party code requires
8
+ * mutable even though it is not needed.
9
+ */
10
+ export type Writable<T> = { -readonly [P in keyof T]: T[P] };