@digitraffic/common 2023.9.14-1 → 2023.10.11-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.
package/README.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  This is a place for common utilities and classes that can be used in other cdk-projects.
4
4
 
5
+ ## How to build
6
+
7
+ Use `npm` to build the code i.e.
8
+
9
+ npm run build
10
+ npm run test
11
+
5
12
  ## How to use
6
13
 
7
14
  In package.json dependencies:
@@ -48,7 +48,7 @@ class DigitrafficDLQueue {
48
48
  });
49
49
  const dlqFunctionName = `${dlqName}-Function`;
50
50
  const lambda = monitoredfunction_1.MonitoredFunction.create(stack, dlqFunctionName, {
51
- runtime: aws_lambda_1.Runtime.NODEJS_14_X,
51
+ runtime: aws_lambda_1.Runtime.NODEJS_16_X,
52
52
  logRetention: aws_logs_1.RetentionDays.ONE_YEAR,
53
53
  functionName: dlqFunctionName,
54
54
  code: getDlqCode(dlqBucket.bucketName),
@@ -1,4 +1,8 @@
1
1
  import { DtLogger } from "./dt-logger";
2
+ /**
3
+ * You can use this for method name definition to match DtLogger LoggableType.method parameter.
4
+ */
5
+ export type { LoggerMethodType } from "./dt-logger";
2
6
  /**
3
7
  * You can use this for your logging needs or create one locally and configure it as you wish.
4
8
  */
@@ -2,6 +2,7 @@
2
2
  import { Writable } from "stream";
3
3
  /** Logging level */
4
4
  export type LOG_LEVEL = "DEBUG" | "INFO" | "WARN" | "ERROR";
5
+ export type LoggerMethodType = `${string}.${string}`;
5
6
  /**
6
7
  * Configuration object for configuring the Digitraffic logging utility
7
8
  * @see {@link DtLogger}
@@ -39,7 +40,7 @@ export interface CustomParams {
39
40
  */
40
41
  export interface LoggableType extends CustomParams {
41
42
  /** Name of the method logging the message */
42
- method: `${string}.${string}`;
43
+ method: LoggerMethodType;
43
44
  /** Message to log, optional */
44
45
  message?: string;
45
46
  /** Type of message, optional */
@@ -15,6 +15,7 @@ var RetryLogError;
15
15
  */
16
16
  exports.timeoutFunctions = (function () {
17
17
  return {
18
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
18
19
  noTimeout: (retryCount) => {
19
20
  return 0;
20
21
  },
@@ -40,6 +41,7 @@ exports.retryPredicates = (function () {
40
41
  }
41
42
  return false;
42
43
  },
44
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
43
45
  alwaysRetry: (error) => {
44
46
  return true;
45
47
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitraffic/common",
3
- "version": "2023.9.14-1",
3
+ "version": "2023.10.11-1",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -61,7 +61,7 @@ export class DigitrafficDLQueue {
61
61
 
62
62
  const dlqFunctionName = `${dlqName}-Function`;
63
63
  const lambda = MonitoredFunction.create(stack, dlqFunctionName, {
64
- runtime: Runtime.NODEJS_14_X,
64
+ runtime: Runtime.NODEJS_16_X,
65
65
  logRetention: RetentionDays.ONE_YEAR,
66
66
  functionName: dlqFunctionName,
67
67
  code: getDlqCode(dlqBucket.bucketName),
@@ -1,5 +1,10 @@
1
1
  import { DtLogger } from "./dt-logger";
2
2
 
3
+ /**
4
+ * You can use this for method name definition to match DtLogger LoggableType.method parameter.
5
+ */
6
+ export type { LoggerMethodType } from "./dt-logger";
7
+
3
8
  /**
4
9
  * You can use this for your logging needs or create one locally and configure it as you wish.
5
10
  */
@@ -3,6 +3,7 @@ import _ from "lodash";
3
3
 
4
4
  /** Logging level */
5
5
  export type LOG_LEVEL = "DEBUG" | "INFO" | "WARN" | "ERROR";
6
+ export type LoggerMethodType = `${string}.${string}`;
6
7
 
7
8
  /**
8
9
  * Configuration object for configuring the Digitraffic logging utility
@@ -55,7 +56,7 @@ export interface CustomParams {
55
56
  */
56
57
  export interface LoggableType extends CustomParams {
57
58
  /** Name of the method logging the message */
58
- method: `${string}.${string}`;
59
+ method: LoggerMethodType;
59
60
  /** Message to log, optional */
60
61
  message?: string;
61
62
  /** Type of message, optional */
@@ -16,6 +16,7 @@ export type RetryPredicate = (error: unknown) => boolean;
16
16
  */
17
17
  export const timeoutFunctions = (function () {
18
18
  return {
19
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
19
20
  noTimeout: (retryCount: number): number => {
20
21
  return 0;
21
22
  },
@@ -42,6 +43,7 @@ export const retryPredicates = (function () {
42
43
  }
43
44
  return false;
44
45
  },
46
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
45
47
  alwaysRetry: (error: unknown): boolean => {
46
48
  return true;
47
49
  },