@digitraffic/common 2024.10.4-1 → 2024.10.25-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/dist/__test__/utils/date-utils.test.js +5 -1
- package/dist/aws/infra/acl-builder.d.ts +1 -1
- package/dist/aws/infra/acl-builder.js +13 -11
- package/dist/aws/infra/api/integration.js +1 -2
- package/dist/aws/infra/canaries/canary.js +1 -1
- package/dist/aws/runtime/apikey.d.ts +2 -2
- package/dist/aws/runtime/apikey.js +9 -6
- package/dist/utils/date-utils.d.ts +1 -1
- package/dist/utils/date-utils.js +4 -3
- package/package.json +25 -24
@@ -19,9 +19,13 @@ describe("CommonDateUtilsTest", () => {
|
|
19
19
|
const end = new Date(start.getTime() + 1234 * 1000);
|
20
20
|
expect(CommonDateUtils.countDiffInSeconds(start, end)).toEqual(1234);
|
21
21
|
});
|
22
|
-
test("
|
22
|
+
test("dateToUTCString - preserves UTC from parsed string", () => {
|
23
23
|
const date = parseISO("2023-01-01T00:00Z");
|
24
24
|
expect(CommonDateUtils.dateToUTCString(date, CommonDateUtils.MYSQL_DATETIME_FORMAT)).toEqual("2023-01-01 00:00");
|
25
25
|
});
|
26
|
+
test("dateToUTCString - +02:00 to UTC from parsed string", () => {
|
27
|
+
const date = parseISO("2023-01-01T00:00+02:00");
|
28
|
+
expect(CommonDateUtils.dateToUTCString(date, CommonDateUtils.MYSQL_DATETIME_FORMAT)).toEqual("2022-12-31 22:00");
|
29
|
+
});
|
26
30
|
});
|
27
31
|
//# sourceMappingURL=date-utils.test.js.map
|
@@ -5,7 +5,7 @@ export type ExcludedAWSRules = {
|
|
5
5
|
[key in AWSManagedWafRule]?: string[];
|
6
6
|
};
|
7
7
|
export type CfnWebAclRuleProperty = {
|
8
|
-
[P in keyof CfnWebACL.RuleProperty as Exclude<P, "priority">]:
|
8
|
+
[P in keyof CfnWebACL.RuleProperty as Exclude<P, "priority">]: CfnWebACL.RuleProperty[P];
|
9
9
|
};
|
10
10
|
/**
|
11
11
|
* Builder class for building CfnWebACL.
|
@@ -62,16 +62,18 @@ export class AclBuilder {
|
|
62
62
|
withThrottleRule(name, limit, isHeaderRequired, isBasedOnIpAndUriPath, customResponseBodyKey) {
|
63
63
|
const isBlockRule = !!customResponseBodyKey;
|
64
64
|
const rules = isBlockRule ? this._blockRules : this._countRules;
|
65
|
-
const action = isBlockRule
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
65
|
+
const action = isBlockRule
|
66
|
+
? {
|
67
|
+
block: {
|
68
|
+
customResponse: {
|
69
|
+
responseCode: 429,
|
70
|
+
customResponseBodyKey,
|
71
|
+
},
|
70
72
|
},
|
71
|
-
}
|
72
|
-
|
73
|
-
|
74
|
-
|
73
|
+
}
|
74
|
+
: {
|
75
|
+
count: {},
|
76
|
+
};
|
75
77
|
rules.push({
|
76
78
|
name,
|
77
79
|
visibilityConfig: {
|
@@ -164,9 +166,9 @@ export class AclBuilder {
|
|
164
166
|
build() {
|
165
167
|
const addPriority = (rule, priority) => ({
|
166
168
|
...rule,
|
167
|
-
priority
|
169
|
+
priority,
|
168
170
|
});
|
169
|
-
const rules = concat(zipWith(this._countRules, range(this._countRules.length), addPriority), zipWith(this._blockRules, range(this._blockRules.length).map(n => n + this._countRules.length), addPriority));
|
171
|
+
const rules = concat(zipWith(this._countRules, range(this._countRules.length), addPriority), zipWith(this._blockRules, range(this._blockRules.length).map((n) => n + this._countRules.length), addPriority));
|
170
172
|
if (rules.length === 0) {
|
171
173
|
throw new Error("No rules defined for WebACL");
|
172
174
|
}
|
@@ -17,9 +17,8 @@ export class DigitrafficIntegration {
|
|
17
17
|
this._passAllQueryParameters = false;
|
18
18
|
}
|
19
19
|
passAllQueryParameters() {
|
20
|
-
if (this.parameters.some((p) => p.type === "querystring"))
|
20
|
+
if (this.parameters.some((p) => p.type === "querystring"))
|
21
21
|
throw new Error("Can't add query parameters with pass all");
|
22
|
-
}
|
23
22
|
this._passAllQueryParameters = true;
|
24
23
|
return this;
|
25
24
|
}
|
@@ -4,7 +4,7 @@ import { CanaryAlarm } from "./canary-alarm.js";
|
|
4
4
|
export class DigitrafficCanary extends Canary {
|
5
5
|
constructor(scope, canaryName, role, params, environmentVariables) {
|
6
6
|
super(scope, canaryName, {
|
7
|
-
runtime: params.runtime ?? Runtime.
|
7
|
+
runtime: params.runtime ?? Runtime.SYNTHETICS_NODEJS_PUPPETEER_9_0,
|
8
8
|
role,
|
9
9
|
test: Test.custom({
|
10
10
|
code: new AssetCode("dist", {
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import type
|
2
|
-
export declare function getApiKeyFromAPIGateway(keyId: string): Promise<
|
1
|
+
import { type GetApiKeyCommandOutput } from "@aws-sdk/client-api-gateway";
|
2
|
+
export declare function getApiKeyFromAPIGateway(keyId: string): Promise<GetApiKeyCommandOutput>;
|
@@ -1,10 +1,13 @@
|
|
1
|
-
import {
|
1
|
+
import { APIGatewayClient, GetApiKeyCommand } from "@aws-sdk/client-api-gateway";
|
2
|
+
import { FetchHttpHandler } from "@smithy/fetch-http-handler";
|
2
3
|
export async function getApiKeyFromAPIGateway(keyId) {
|
3
|
-
const
|
4
|
-
|
5
|
-
|
4
|
+
const client = new APIGatewayClient({
|
5
|
+
requestHandler: new FetchHttpHandler()
|
6
|
+
});
|
7
|
+
const command = new GetApiKeyCommand({
|
6
8
|
apiKey: keyId,
|
7
|
-
includeValue: true
|
8
|
-
})
|
9
|
+
includeValue: true
|
10
|
+
});
|
11
|
+
return (await client.send(command));
|
9
12
|
}
|
10
13
|
//# sourceMappingURL=apikey.js.map
|
@@ -24,4 +24,4 @@ export declare function dateFromIsoString(isoString: string): Date;
|
|
24
24
|
/**
|
25
25
|
* Formats a date in UTC in the given format, regardless of system time zone
|
26
26
|
*/
|
27
|
-
export declare function dateToUTCString(date: Date,
|
27
|
+
export declare function dateToUTCString(date: Date, formatString: string): string;
|
package/dist/utils/date-utils.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
import {
|
1
|
+
import { TZDate } from "@date-fns/tz";
|
2
|
+
import { format } from "date-fns";
|
2
3
|
/**
|
3
4
|
* Constant for the 1970-01-01T00:00:00Z epoch Date.
|
4
5
|
*/
|
@@ -38,7 +39,7 @@ function isValidDate(d) {
|
|
38
39
|
/**
|
39
40
|
* Formats a date in UTC in the given format, regardless of system time zone
|
40
41
|
*/
|
41
|
-
export function dateToUTCString(date,
|
42
|
-
return
|
42
|
+
export function dateToUTCString(date, formatString) {
|
43
|
+
return format(new TZDate(date, UTC), formatString);
|
43
44
|
}
|
44
45
|
//# sourceMappingURL=date-utils.js.map
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@digitraffic/common",
|
3
|
-
"version": "2024.10.
|
3
|
+
"version": "2024.10.25-1",
|
4
4
|
"description": "",
|
5
5
|
"type": "module",
|
6
6
|
"repository": {
|
@@ -104,17 +104,17 @@
|
|
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.
|
108
|
-
"@aws-sdk/client-s3": "^3.
|
109
|
-
"@aws-sdk/client-secrets-manager": "^3.
|
110
|
-
"@aws-sdk/client-sns": "^3.
|
111
|
-
"@aws-sdk/lib-storage": "^3.
|
112
|
-
"
|
113
|
-
"aws-
|
107
|
+
"@aws-sdk/client-api-gateway": "^3.667.0",
|
108
|
+
"@aws-sdk/client-s3": "^3.667.0",
|
109
|
+
"@aws-sdk/client-secrets-manager": "^3.667.0",
|
110
|
+
"@aws-sdk/client-sns": "^3.667.0",
|
111
|
+
"@aws-sdk/lib-storage": "^3.667.0",
|
112
|
+
"@smithy/fetch-http-handler": "3.2.9",
|
113
|
+
"aws-cdk-lib": "^2.161.1",
|
114
114
|
"change-case": "^5.4.4",
|
115
115
|
"constructs": "~10.3.0",
|
116
|
-
"date-fns": "
|
117
|
-
"date-fns
|
116
|
+
"date-fns": "~4.1.0",
|
117
|
+
"@date-fns/tz": "1.1.2",
|
118
118
|
"etag": "^1.8.1",
|
119
119
|
"geojson-validation": "^1.0.2",
|
120
120
|
"ky": "^1.7.2",
|
@@ -125,35 +125,36 @@
|
|
125
125
|
"zod": "~3.23.8"
|
126
126
|
},
|
127
127
|
"devDependencies": {
|
128
|
-
"@aws-sdk/client-api-gateway": "^3.
|
129
|
-
"@aws-sdk/client-s3": "^3.
|
130
|
-
"@aws-sdk/client-secrets-manager": "^3.
|
131
|
-
"@aws-sdk/client-sns": "^3.
|
132
|
-
"@aws-sdk/lib-storage": "^3.
|
133
|
-
"@digitraffic/eslint-config": "^
|
128
|
+
"@aws-sdk/client-api-gateway": "^3.669.0",
|
129
|
+
"@aws-sdk/client-s3": "^3.669.0",
|
130
|
+
"@aws-sdk/client-secrets-manager": "^3.669.0",
|
131
|
+
"@aws-sdk/client-sns": "^3.669.0",
|
132
|
+
"@aws-sdk/lib-storage": "^3.669.0",
|
133
|
+
"@digitraffic/eslint-config": "^3.0.1",
|
134
134
|
"@jest/globals": "^29.7.0",
|
135
135
|
"@rushstack/eslint-config": "^3.7.1",
|
136
|
-
"@rushstack/heft": "^0.
|
136
|
+
"@rushstack/heft": "^0.68.2",
|
137
137
|
"@rushstack/heft-jest-plugin": "^0.12.14",
|
138
|
-
"@rushstack/heft-lint-plugin": "^0.
|
138
|
+
"@rushstack/heft-lint-plugin": "^0.5.0",
|
139
139
|
"@rushstack/heft-typescript-plugin": "^0.5.30",
|
140
|
+
"@smithy/fetch-http-handler": "3.2.9",
|
140
141
|
"@smithy/types": "^3.5.0",
|
141
142
|
"@types/aws-lambda": "8.10.145",
|
142
143
|
"@types/etag": "^1.8.3",
|
143
144
|
"@types/geojson": "7946.0.14",
|
144
145
|
"@types/geojson-validation": "^1.0.3",
|
145
146
|
"@types/jest": "29.5.13",
|
146
|
-
"@types/lodash-es": "4.17.
|
147
|
+
"@types/lodash-es": "4.17.12",
|
147
148
|
"@types/madge": "5.0.3",
|
148
149
|
"@types/node": "20.14.9",
|
149
150
|
"@typescript-eslint/eslint-plugin": "~7.14.1",
|
150
151
|
"@typescript-eslint/parser": "^7.18.0",
|
151
|
-
"aws-cdk-lib": "^2.
|
152
|
+
"aws-cdk-lib": "^2.162.0",
|
152
153
|
"aws-sdk": "^2.1691.0",
|
153
154
|
"change-case": "^5.4.4",
|
154
|
-
"constructs": "~10.3.
|
155
|
-
"date-fns": "
|
156
|
-
"date-fns
|
155
|
+
"constructs": "~10.3.1",
|
156
|
+
"date-fns": "~4.1.0",
|
157
|
+
"@date-fns/tz": "1.1.2",
|
157
158
|
"eslint": "^8.57.1",
|
158
159
|
"eslint-config-prettier": "^9.1.0",
|
159
160
|
"eslint-plugin-deprecation": "~3.0.0",
|
@@ -171,7 +172,7 @@
|
|
171
172
|
"prettier": "^3.3.3",
|
172
173
|
"rimraf": "^6.0.1",
|
173
174
|
"ts-jest": "^29.2.5",
|
174
|
-
"typescript": "~5.
|
175
|
+
"typescript": "~5.6.3",
|
175
176
|
"velocityjs": "^2.0.6",
|
176
177
|
"zod": "~3.23.8"
|
177
178
|
},
|