@digitraffic/common 2024.12.10-1 → 2025.1.3-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.
@@ -8,6 +8,10 @@ import type { DigitrafficStack } from "./stack/stack.js";
8
8
  */
9
9
  export declare class DigitrafficSqsQueue extends Queue {
10
10
  static create(stack: DigitrafficStack, name: string, props: QueueProps): DigitrafficSqsQueue;
11
+ /**
12
+ * Create a fifo with given name. No DLQ created!
13
+ */
14
+ static createFifo(stack: DigitrafficStack, name: string, props: QueueProps): DigitrafficSqsQueue;
11
15
  }
12
16
  export declare class DigitrafficDLQueue {
13
17
  static create(stack: DigitrafficStack, name: string): DigitrafficSqsQueue;
@@ -34,18 +34,28 @@ export class DigitrafficSqsQueue extends Queue {
34
34
  const queueName = `${stack.configuration.shortName}-${name}-Queue`;
35
35
  const queueProps = {
36
36
  ...props,
37
- ...{
38
- encryption: QueueEncryption.KMS_MANAGED,
39
- queueName,
40
- deadLetterQueue: props.deadLetterQueue ?? {
41
- maxReceiveCount: 2,
42
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
43
- queue: DigitrafficDLQueue.create(stack, name),
44
- },
37
+ encryption: QueueEncryption.KMS_MANAGED,
38
+ queueName,
39
+ deadLetterQueue: props.deadLetterQueue ?? {
40
+ maxReceiveCount: 2,
41
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
42
+ queue: DigitrafficDLQueue.create(stack, name),
45
43
  },
46
44
  };
47
45
  return new DigitrafficSqsQueue(stack, queueName, queueProps);
48
46
  }
47
+ /**
48
+ * Create a fifo with given name. No DLQ created!
49
+ */
50
+ static createFifo(stack, name, props) {
51
+ const queueName = `${stack.configuration.shortName}-${name}-Queue.fifo`;
52
+ const queueProps = {
53
+ ...props,
54
+ encryption: QueueEncryption.KMS_MANAGED,
55
+ queueName
56
+ };
57
+ return new DigitrafficSqsQueue(stack, queueName, queueProps);
58
+ }
49
59
  }
50
60
  export class DigitrafficDLQueue {
51
61
  static create(stack, name) {
@@ -21,19 +21,23 @@ export declare class LambdaResponse {
21
21
  /**
22
22
  * Create LambdaResponse for HTTP 400
23
23
  */
24
- static badRequest(body: string): LambdaResponse;
24
+ static badRequest(error: string): LambdaResponse;
25
25
  /**
26
26
  * Create LambdaResponse for HTTP 404
27
27
  */
28
- static notFound(): LambdaResponse;
28
+ static notFound(error?: string): LambdaResponse;
29
29
  /**
30
30
  * Create LambdaResponse for HTTP 500
31
31
  */
32
- static internalError(): LambdaResponse;
32
+ static internalError(error?: string): LambdaResponse;
33
+ /**
34
+ * Create LambdaResponse for HTTP 401
35
+ */
36
+ static unauthorized(error?: string): LambdaResponse;
33
37
  /**
34
38
  * Create LambdaResponse for HTTP 501
35
39
  */
36
- static notImplemented(): LambdaResponse;
40
+ static notImplemented(error?: string): LambdaResponse;
37
41
  private static createForString;
38
42
  private static createForBase64;
39
43
  }
@@ -36,26 +36,32 @@ export class LambdaResponse {
36
36
  /**
37
37
  * Create LambdaResponse for HTTP 400
38
38
  */
39
- static badRequest(body) {
40
- return this.createForString(400, body);
39
+ static badRequest(error) {
40
+ return this.createForString(400, error);
41
41
  }
42
42
  /**
43
43
  * Create LambdaResponse for HTTP 404
44
44
  */
45
- static notFound() {
46
- return this.createForString(404, "Not found");
45
+ static notFound(error = "Not found") {
46
+ return this.createForString(404, error);
47
47
  }
48
48
  /**
49
49
  * Create LambdaResponse for HTTP 500
50
50
  */
51
- static internalError() {
52
- return this.createForString(500, "Internal error");
51
+ static internalError(error = "Internal error") {
52
+ return this.createForString(500, error);
53
+ }
54
+ /**
55
+ * Create LambdaResponse for HTTP 401
56
+ */
57
+ static unauthorized(error = "Unauthorized") {
58
+ return this.createForString(401, error);
53
59
  }
54
60
  /**
55
61
  * Create LambdaResponse for HTTP 501
56
62
  */
57
- static notImplemented() {
58
- return this.createForString(501, "Not implemented");
63
+ static notImplemented(error = "Not implemented") {
64
+ return this.createForString(501, error);
59
65
  }
60
66
  static createForString(status, body, fileName) {
61
67
  return this.createForBase64(status, toBase64(body), fileName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitraffic/common",
3
- "version": "2024.12.10-1",
3
+ "version": "2025.1.3-1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "repository": {
@@ -104,53 +104,53 @@
104
104
  "./dist/aws/runtime/digitraffic-integration-response": "./dist/aws/runtime/digitraffic-integration-response.js"
105
105
  },
106
106
  "peerDependencies": {
107
- "@aws-sdk/client-api-gateway": "^3.687.0",
108
- "@aws-sdk/client-s3": "^3.687.0",
109
- "@aws-sdk/client-secrets-manager": "^3.687.0",
110
- "@aws-sdk/client-sns": "^3.687.0",
111
- "@aws-sdk/lib-storage": "^3.687.0",
107
+ "@aws-sdk/client-api-gateway": "^3.721.0",
108
+ "@aws-sdk/client-s3": "^3.721.0",
109
+ "@aws-sdk/client-secrets-manager": "^3.721.0",
110
+ "@aws-sdk/client-sns": "^3.721.0",
111
+ "@aws-sdk/lib-storage": "^3.721.0",
112
112
  "@date-fns/tz": "1.2.0",
113
- "@smithy/fetch-http-handler": "3.2.9",
114
- "aws-cdk-lib": "^2.166.0",
113
+ "@smithy/fetch-http-handler": "4.1.3",
114
+ "aws-cdk-lib": "^2.173.4",
115
115
  "change-case": "^5.4.4",
116
116
  "constructs": "~10.4.2",
117
117
  "date-fns": "~4.1.0",
118
118
  "etag": "^1.8.1",
119
119
  "geojson-validation": "^1.0.2",
120
- "ky": "^1.7.2",
120
+ "ky": "^1.7.4",
121
121
  "lodash-es": "^4.17.21",
122
122
  "node-ttl": "^0.2.0",
123
123
  "pg-native": "^3.2.0",
124
124
  "pg-promise": "^11.10.1",
125
- "zod": "^3.23.8"
125
+ "zod": "^3.24.1"
126
126
  },
127
127
  "devDependencies": {
128
- "@aws-sdk/client-api-gateway": "^3.687.0",
129
- "@aws-sdk/client-s3": "^3.687.0",
130
- "@aws-sdk/client-secrets-manager": "^3.687.0",
131
- "@aws-sdk/client-sns": "^3.687.0",
132
- "@aws-sdk/lib-storage": "^3.687.0",
128
+ "@aws-sdk/client-api-gateway": "^3.721.0",
129
+ "@aws-sdk/client-s3": "^3.721.0",
130
+ "@aws-sdk/client-secrets-manager": "^3.721.0",
131
+ "@aws-sdk/client-sns": "^3.721.0",
132
+ "@aws-sdk/lib-storage": "^3.721.0",
133
133
  "@date-fns/tz": "1.2.0",
134
134
  "@digitraffic/eslint-config": "^3.0.1",
135
135
  "@jest/globals": "^29.7.0",
136
136
  "@rushstack/eslint-config": "^3.7.1",
137
- "@rushstack/heft": "^0.68.6",
138
- "@rushstack/heft-jest-plugin": "^0.12.18",
139
- "@rushstack/heft-lint-plugin": "^0.5.0",
140
- "@rushstack/heft-typescript-plugin": "^0.5.35",
141
- "@smithy/fetch-http-handler": "3.2.9",
142
- "@smithy/types": "^3.5.0",
143
- "@types/aws-lambda": "8.10.145",
137
+ "@rushstack/heft": "^0.68.11",
138
+ "@rushstack/heft-jest-plugin": "^0.14.1",
139
+ "@rushstack/heft-lint-plugin": "^0.5.10",
140
+ "@rushstack/heft-typescript-plugin": "^0.6.4",
141
+ "@smithy/fetch-http-handler": "4.1.3",
142
+ "@smithy/types": "^3.7.2",
143
+ "@types/aws-lambda": "8.10.147",
144
144
  "@types/etag": "^1.8.3",
145
- "@types/geojson": "7946.0.14",
145
+ "@types/geojson": "7946.0.15",
146
146
  "@types/geojson-validation": "^1.0.3",
147
147
  "@types/jest": "29.5.14",
148
148
  "@types/lodash-es": "4.17.12",
149
149
  "@types/madge": "5.0.3",
150
150
  "@types/node": "20.17.6",
151
- "@typescript-eslint/eslint-plugin": "~7.14.1",
152
- "@typescript-eslint/parser": "^7.18.0",
153
- "aws-cdk-lib": "^2.166.0",
151
+ "@typescript-eslint/eslint-plugin": "~8.19.0",
152
+ "@typescript-eslint/parser": "^8.19.0",
153
+ "aws-cdk-lib": "^2.173.4",
154
154
  "aws-sdk": "^2.1692.0",
155
155
  "change-case": "^5.4.4",
156
156
  "constructs": "~10.4.2",
@@ -162,19 +162,19 @@
162
162
  "geojson-validation": "^1.0.2",
163
163
  "jest": "^29.7.0",
164
164
  "jest-junit": "^16.0.0",
165
- "ky": "^1.7.2",
165
+ "ky": "^1.7.4",
166
166
  "lodash": "^4.17.21",
167
167
  "lodash-es": "~4.17.21",
168
168
  "madge": "^8.0.0",
169
169
  "node-ttl": "^0.2.0",
170
170
  "pg-native": "^3.2.0",
171
171
  "pg-promise": "^11.10.1",
172
- "prettier": "^3.3.3",
172
+ "prettier": "^3.4.2",
173
173
  "rimraf": "^6.0.1",
174
174
  "ts-jest": "^29.2.5",
175
- "typescript": "~5.6.3",
175
+ "typescript": "~5.7.2",
176
176
  "velocityjs": "^2.0.6",
177
- "zod": "~3.23.8"
177
+ "zod": "~3.24.1"
178
178
  },
179
179
  "scripts": {
180
180
  "build": "heft build --clean",