@digitraffic/common 2023.12.15-1 → 2024.1.19-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/aws/infra/api/handler-factory.d.ts +2 -2
- package/dist/aws/infra/api/handler-factory.js +4 -9
- package/dist/aws/infra/api/integration.d.ts +1 -1
- package/dist/aws/infra/api/integration.js +9 -13
- package/dist/aws/infra/api/response.d.ts +2 -3
- package/dist/aws/infra/api/response.js +25 -30
- package/dist/aws/infra/api/responses.d.ts +2 -3
- package/dist/aws/infra/api/responses.js +25 -31
- package/dist/aws/infra/api/static-integration.d.ts +1 -1
- package/dist/aws/infra/api/static-integration.js +7 -11
- package/dist/aws/infra/canaries/canary-alarm.d.ts +1 -1
- package/dist/aws/infra/canaries/canary-alarm.js +7 -11
- package/dist/aws/infra/canaries/canary-keys.js +3 -6
- package/dist/aws/infra/canaries/canary-parameters.js +1 -2
- package/dist/aws/infra/canaries/canary-role.js +8 -12
- package/dist/aws/infra/canaries/canary.d.ts +2 -2
- package/dist/aws/infra/canaries/canary.js +9 -13
- package/dist/aws/infra/canaries/database-canary.d.ts +3 -3
- package/dist/aws/infra/canaries/database-canary.js +8 -12
- package/dist/aws/infra/canaries/database-checker.d.ts +1 -1
- package/dist/aws/infra/canaries/database-checker.js +10 -14
- package/dist/aws/infra/canaries/url-canary.d.ts +4 -4
- package/dist/aws/infra/canaries/url-canary.js +8 -12
- package/dist/aws/infra/canaries/url-checker.d.ts +2 -2
- package/dist/aws/infra/canaries/url-checker.js +33 -40
- package/dist/aws/infra/documentation.js +8 -16
- package/dist/aws/infra/import-util.js +10 -18
- package/dist/aws/infra/scheduler.js +10 -14
- package/dist/aws/infra/security-rule.js +4 -8
- package/dist/aws/infra/sqs-integration.d.ts +1 -2
- package/dist/aws/infra/sqs-integration.js +11 -15
- package/dist/aws/infra/sqs-queue.d.ts +1 -1
- package/dist/aws/infra/sqs-queue.js +51 -50
- package/dist/aws/infra/stack/lambda-configs.d.ts +2 -2
- package/dist/aws/infra/stack/lambda-configs.js +14 -20
- package/dist/aws/infra/stack/monitoredfunction.d.ts +3 -3
- package/dist/aws/infra/stack/monitoredfunction.js +19 -27
- package/dist/aws/infra/stack/parameters.d.ts +1 -1
- package/dist/aws/infra/stack/parameters.js +5 -10
- package/dist/aws/infra/stack/rest_apis.d.ts +3 -3
- package/dist/aws/infra/stack/rest_apis.js +41 -54
- package/dist/aws/infra/stack/stack-checking-aspect.d.ts +1 -1
- package/dist/aws/infra/stack/stack-checking-aspect.js +28 -39
- package/dist/aws/infra/stack/stack.d.ts +5 -6
- package/dist/aws/infra/stack/stack.js +16 -20
- package/dist/aws/infra/stack/subscription.d.ts +2 -2
- package/dist/aws/infra/stack/subscription.js +5 -10
- package/dist/aws/infra/stacks/db-dns-stack.d.ts +2 -2
- package/dist/aws/infra/stacks/db-dns-stack.js +25 -29
- package/dist/aws/infra/stacks/db-proxy-stack.d.ts +2 -2
- package/dist/aws/infra/stacks/db-proxy-stack.js +23 -27
- package/dist/aws/infra/stacks/db-stack.d.ts +3 -4
- package/dist/aws/infra/stacks/db-stack.js +30 -34
- package/dist/aws/infra/stacks/intra-stack-configuration.js +1 -2
- package/dist/aws/infra/stacks/network-stack.d.ts +2 -2
- package/dist/aws/infra/stacks/network-stack.js +15 -19
- package/dist/aws/infra/usage-plans.js +2 -7
- package/dist/aws/runtime/apikey.js +3 -7
- package/dist/aws/runtime/digitraffic-integration-response.d.ts +1 -1
- package/dist/aws/runtime/digitraffic-integration-response.js +7 -11
- package/dist/aws/runtime/dt-logger-default.d.ts +2 -2
- package/dist/aws/runtime/dt-logger-default.js +2 -5
- package/dist/aws/runtime/dt-logger.d.ts +1 -1
- package/dist/aws/runtime/dt-logger.js +3 -10
- package/dist/aws/runtime/environment.js +3 -7
- package/dist/aws/runtime/messaging.js +1 -5
- package/dist/aws/runtime/s3.js +3 -7
- package/dist/aws/runtime/secrets/dbsecret.d.ts +1 -1
- package/dist/aws/runtime/secrets/dbsecret.js +5 -9
- package/dist/aws/runtime/secrets/proxy-holder.js +12 -16
- package/dist/aws/runtime/secrets/rds-holder.js +12 -16
- package/dist/aws/runtime/secrets/secret-holder.d.ts +1 -1
- package/dist/aws/runtime/secrets/secret-holder.js +9 -13
- package/dist/aws/runtime/secrets/secret.js +7 -11
- package/dist/aws/types/errors.js +5 -9
- package/dist/aws/types/lambda-response.js +3 -10
- package/dist/aws/types/mediatypes.js +2 -5
- package/dist/aws/types/model-with-reference.js +1 -2
- package/dist/aws/types/proxytypes.js +1 -2
- package/dist/aws/types/tags.js +2 -5
- package/dist/database/cached.d.ts +1 -1
- package/dist/database/cached.js +8 -14
- package/dist/database/database.js +14 -21
- package/dist/database/last-updated.d.ts +1 -1
- package/dist/database/last-updated.js +8 -17
- package/dist/database/models.js +1 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/marine/id_utils.js +3 -9
- package/dist/marine/rtz.js +1 -2
- package/dist/test/asserter.js +1 -5
- package/dist/test/db-testutils.d.ts +1 -1
- package/dist/test/db-testutils.js +8 -13
- package/dist/test/httpserver.d.ts +1 -1
- package/dist/test/httpserver.js +19 -18
- package/dist/test/secrets-manager.js +9 -35
- package/dist/test/testutils.js +8 -19
- package/dist/types/async-timeout-error.js +1 -5
- package/dist/types/aws-env.js +1 -2
- package/dist/types/either.js +1 -2
- package/dist/types/http-error.js +1 -5
- package/dist/types/input-error.js +1 -5
- package/dist/types/language.js +2 -5
- package/dist/types/nullable.d.ts +1 -1
- package/dist/types/nullable.js +1 -2
- package/dist/types/traffictype.js +2 -5
- package/dist/types/urn.js +1 -2
- package/dist/types/util-types.js +1 -2
- package/dist/types/validator.js +4 -9
- package/dist/utils/api-model.d.ts +1 -1
- package/dist/utils/api-model.js +17 -27
- package/dist/utils/base64.d.ts +1 -1
- package/dist/utils/base64.js +2 -7
- package/dist/utils/date-utils.js +9 -16
- package/dist/utils/geojson-types.js +2 -7
- package/dist/utils/geometry.js +15 -48
- package/dist/utils/logging.d.ts +1 -1
- package/dist/utils/logging.js +8 -13
- package/dist/utils/retry.js +21 -26
- package/dist/utils/slack.js +7 -14
- package/dist/utils/utils.d.ts +2 -2
- package/dist/utils/utils.js +14 -29
- package/package.json +127 -41
- package/src/aws/infra/api/handler-factory.ts +3 -3
- package/src/aws/infra/api/integration.ts +2 -2
- package/src/aws/infra/api/response.ts +3 -3
- package/src/aws/infra/api/responses.ts +4 -4
- package/src/aws/infra/api/static-integration.ts +2 -2
- package/src/aws/infra/canaries/canary-alarm.ts +1 -1
- package/src/aws/infra/canaries/canary.ts +3 -3
- package/src/aws/infra/canaries/database-canary.ts +3 -3
- package/src/aws/infra/canaries/database-checker.ts +6 -6
- package/src/aws/infra/canaries/url-canary.ts +6 -6
- package/src/aws/infra/canaries/url-checker.ts +8 -8
- package/src/aws/infra/sqs-integration.ts +1 -1
- package/src/aws/infra/sqs-queue.ts +29 -44
- package/src/aws/infra/stack/lambda-configs.ts +9 -9
- package/src/aws/infra/stack/monitoredfunction.ts +4 -4
- package/src/aws/infra/stack/parameters.ts +1 -1
- package/src/aws/infra/stack/rest_apis.ts +6 -6
- package/src/aws/infra/stack/stack-checking-aspect.ts +20 -72
- package/src/aws/infra/stack/stack.ts +4 -5
- package/src/aws/infra/stack/subscription.ts +2 -2
- package/src/aws/infra/stacks/db-dns-stack.ts +4 -4
- package/src/aws/infra/stacks/db-proxy-stack.ts +5 -5
- package/src/aws/infra/stacks/db-stack.ts +5 -5
- package/src/aws/infra/stacks/network-stack.ts +3 -3
- package/src/aws/runtime/digitraffic-integration-response.ts +2 -2
- package/src/aws/runtime/dt-logger-default.ts +2 -2
- package/src/aws/runtime/secrets/dbsecret.ts +1 -1
- package/src/aws/runtime/secrets/proxy-holder.ts +4 -4
- package/src/aws/runtime/secrets/rds-holder.ts +4 -4
- package/src/aws/runtime/secrets/secret-holder.ts +4 -4
- package/src/aws/runtime/secrets/secret.ts +2 -2
- package/src/database/cached.ts +1 -1
- package/src/database/database.ts +3 -3
- package/src/database/last-updated.ts +1 -1
- package/src/index.ts +2 -0
- package/src/test/db-testutils.ts +2 -2
- package/src/test/httpserver.ts +13 -7
- package/src/test/secrets-manager.ts +2 -2
- package/src/types/nullable.ts +1 -1
- package/src/utils/api-model.ts +1 -1
- package/src/utils/geometry.ts +5 -3
- package/src/utils/logging.ts +2 -2
- package/src/utils/retry.ts +3 -3
- package/src/utils/slack.ts +2 -2
- package/src/utils/utils.ts +3 -3
package/package.json
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
{
|
2
2
|
"name": "@digitraffic/common",
|
3
|
-
"version": "
|
3
|
+
"version": "2024.1.19-1",
|
4
4
|
"description": "",
|
5
|
+
"type": "module",
|
5
6
|
"repository": {
|
6
7
|
"type": "git",
|
7
8
|
"url": "https://github.com/tmfg/digitraffic-common.git"
|
8
9
|
},
|
9
10
|
"engines": {
|
10
|
-
"node": ">=
|
11
|
+
"node": ">=20 <21"
|
11
12
|
},
|
12
13
|
"license": "EUPL-1.2",
|
13
14
|
"private": false,
|
@@ -16,72 +17,157 @@
|
|
16
17
|
"dist/**/*.d.ts",
|
17
18
|
"src/**/*.ts"
|
18
19
|
],
|
20
|
+
"exports": {
|
21
|
+
".": "./dist/index.js",
|
22
|
+
"./dist/database/database": "./dist/database/database.js",
|
23
|
+
"./dist/database/cached": "./dist/database/cached.js",
|
24
|
+
"./dist/database/models": "./dist/database/models.js",
|
25
|
+
"./dist/database/last-updated": "./dist/database/last-updated.js",
|
26
|
+
"./dist/types/urn": "./dist/types/urn.js",
|
27
|
+
"./dist/types/util-types": "./dist/types/util-types.js",
|
28
|
+
"./dist/types/either": "./dist/types/either.js",
|
29
|
+
"./dist/types/validator": "./dist/types/validator.js",
|
30
|
+
"./dist/types/nullable": "./dist/types/nullable.js",
|
31
|
+
"./dist/types/aws-env": "./dist/types/aws-env.js",
|
32
|
+
"./dist/types/async-timeout-error": "./dist/types/async-timeout-error.js",
|
33
|
+
"./dist/types/input-error": "./dist/types/input-error.js",
|
34
|
+
"./dist/types/http-error": "./dist/types/http-error.js",
|
35
|
+
"./dist/types/language": "./dist/types/language.js",
|
36
|
+
"./dist/types/traffictype": "./dist/types/traffictype.js",
|
37
|
+
"./dist/test/testutils": "./dist/test/testutils.js",
|
38
|
+
"./dist/test/db-testutils": "./dist/test/db-testutils.js",
|
39
|
+
"./dist/test/httpserver": "./dist/test/httpserver.js",
|
40
|
+
"./dist/test/secrets-manager": "./dist/test/secrets-manager.js",
|
41
|
+
"./dist/test/asserter": "./dist/test/asserter.js",
|
42
|
+
"./dist/marine/rtz": "./dist/marine/rtz.js",
|
43
|
+
"./dist/marine/id_utils": "./dist/marine/id_utils.js",
|
44
|
+
"./dist/index": "./dist/index.js",
|
45
|
+
"./dist/utils/api-model": "./dist/utils/api-model.js",
|
46
|
+
"./dist/utils/logging": "./dist/utils/logging.js",
|
47
|
+
"./dist/utils/base64": "./dist/utils/base64.js",
|
48
|
+
"./dist/utils/date-utils": "./dist/utils/date-utils.js",
|
49
|
+
"./dist/utils/geojson-types": "./dist/utils/geojson-types.js",
|
50
|
+
"./dist/utils/slack": "./dist/utils/slack.js",
|
51
|
+
"./dist/utils/utils": "./dist/utils/utils.js",
|
52
|
+
"./dist/utils/retry": "./dist/utils/retry.js",
|
53
|
+
"./dist/utils/geometry": "./dist/utils/geometry.js",
|
54
|
+
"./dist/aws/infra/sqs-integration": "./dist/aws/infra/sqs-integration.js",
|
55
|
+
"./dist/aws/infra/stacks/network-stack": "./dist/aws/infra/stacks/network-stack.js",
|
56
|
+
"./dist/aws/infra/stacks/db-stack": "./dist/aws/infra/stacks/db-stack.js",
|
57
|
+
"./dist/aws/infra/stacks/db-proxy-stack": "./dist/aws/infra/stacks/db-proxy-stack.js",
|
58
|
+
"./dist/aws/infra/stacks/intra-stack-configuration": "./dist/aws/infra/stacks/intra-stack-configuration.js",
|
59
|
+
"./dist/aws/infra/stacks/db-dns-stack": "./dist/aws/infra/stacks/db-dns-stack.js",
|
60
|
+
"./dist/aws/infra/documentation": "./dist/aws/infra/documentation.js",
|
61
|
+
"./dist/aws/infra/usage-plans": "./dist/aws/infra/usage-plans.js",
|
62
|
+
"./dist/aws/infra/scheduler": "./dist/aws/infra/scheduler.js",
|
63
|
+
"./dist/aws/infra/import-util": "./dist/aws/infra/import-util.js",
|
64
|
+
"./dist/aws/infra/sqs-queue": "./dist/aws/infra/sqs-queue.js",
|
65
|
+
"./dist/aws/infra/api/response": "./dist/aws/infra/api/response.js",
|
66
|
+
"./dist/aws/infra/api/static-integration": "./dist/aws/infra/api/static-integration.js",
|
67
|
+
"./dist/aws/infra/api/responses": "./dist/aws/infra/api/responses.js",
|
68
|
+
"./dist/aws/infra/api/handler-factory": "./dist/aws/infra/api/handler-factory.js",
|
69
|
+
"./dist/aws/infra/api/integration": "./dist/aws/infra/api/integration.js",
|
70
|
+
"./dist/aws/infra/stack/stack-checking-aspect": "./dist/aws/infra/stack/stack-checking-aspect.js",
|
71
|
+
"./dist/aws/infra/stack/rest_apis": "./dist/aws/infra/stack/rest_apis.js",
|
72
|
+
"./dist/aws/infra/stack/lambda-configs": "./dist/aws/infra/stack/lambda-configs.js",
|
73
|
+
"./dist/aws/infra/stack/monitoredfunction": "./dist/aws/infra/stack/monitoredfunction.js",
|
74
|
+
"./dist/aws/infra/stack/subscription": "./dist/aws/infra/stack/subscription.js",
|
75
|
+
"./dist/aws/infra/stack/parameters": "./dist/aws/infra/stack/parameters.js",
|
76
|
+
"./dist/aws/infra/stack/stack": "./dist/aws/infra/stack/stack.js",
|
77
|
+
"./dist/aws/infra/security-rule": "./dist/aws/infra/security-rule.js",
|
78
|
+
"./dist/aws/infra/canaries/database-checker": "./dist/aws/infra/canaries/database-checker.js",
|
79
|
+
"./dist/aws/infra/canaries/canary": "./dist/aws/infra/canaries/canary.js",
|
80
|
+
"./dist/aws/infra/canaries/url-checker": "./dist/aws/infra/canaries/url-checker.js",
|
81
|
+
"./dist/aws/infra/canaries/database-canary": "./dist/aws/infra/canaries/database-canary.js",
|
82
|
+
"./dist/aws/infra/canaries/canary-alarm": "./dist/aws/infra/canaries/canary-alarm.js",
|
83
|
+
"./dist/aws/infra/canaries/canary-role": "./dist/aws/infra/canaries/canary-role.js",
|
84
|
+
"./dist/aws/infra/canaries/url-canary": "./dist/aws/infra/canaries/url-canary.js",
|
85
|
+
"./dist/aws/infra/canaries/canary-parameters": "./dist/aws/infra/canaries/canary-parameters.js",
|
86
|
+
"./dist/aws/infra/canaries/canary-keys": "./dist/aws/infra/canaries/canary-keys.js",
|
87
|
+
"./dist/aws/types/proxytypes": "./dist/aws/types/proxytypes.js",
|
88
|
+
"./dist/aws/types/tags": "./dist/aws/types/tags.js",
|
89
|
+
"./dist/aws/types/mediatypes": "./dist/aws/types/mediatypes.js",
|
90
|
+
"./dist/aws/types/model-with-reference": "./dist/aws/types/model-with-reference.js",
|
91
|
+
"./dist/aws/types/errors": "./dist/aws/types/errors.js",
|
92
|
+
"./dist/aws/types/lambda-response": "./dist/aws/types/lambda-response.js",
|
93
|
+
"./dist/aws/runtime/dt-logger-default": "./dist/aws/runtime/dt-logger-default.js",
|
94
|
+
"./dist/aws/runtime/secrets/secret": "./dist/aws/runtime/secrets/secret.js",
|
95
|
+
"./dist/aws/runtime/secrets/proxy-holder": "./dist/aws/runtime/secrets/proxy-holder.js",
|
96
|
+
"./dist/aws/runtime/secrets/dbsecret": "./dist/aws/runtime/secrets/dbsecret.js",
|
97
|
+
"./dist/aws/runtime/secrets/rds-holder": "./dist/aws/runtime/secrets/rds-holder.js",
|
98
|
+
"./dist/aws/runtime/secrets/secret-holder": "./dist/aws/runtime/secrets/secret-holder.js",
|
99
|
+
"./dist/aws/runtime/dt-logger": "./dist/aws/runtime/dt-logger.js",
|
100
|
+
"./dist/aws/runtime/s3": "./dist/aws/runtime/s3.js",
|
101
|
+
"./dist/aws/runtime/messaging": "./dist/aws/runtime/messaging.js",
|
102
|
+
"./dist/aws/runtime/apikey": "./dist/aws/runtime/apikey.js",
|
103
|
+
"./dist/aws/runtime/environment": "./dist/aws/runtime/environment.js",
|
104
|
+
"./dist/aws/runtime/digitraffic-integration-response": "./dist/aws/runtime/digitraffic-integration-response.js"
|
105
|
+
},
|
19
106
|
"peerDependencies": {
|
20
107
|
"@types/geojson": "^7946.0.12",
|
21
108
|
"aws-cdk-lib": "^2.103.0",
|
22
109
|
"aws-sdk": "^2.1481.0",
|
23
110
|
"axios": "^1.6.2",
|
24
|
-
"change-case": "
|
111
|
+
"change-case": "5.0.0",
|
25
112
|
"constructs": "^10.3.0",
|
26
|
-
"date-fns-tz": "~2.0.0",
|
27
113
|
"date-fns": "~2.30.0",
|
114
|
+
"date-fns-tz": "~2.0.0",
|
28
115
|
"etag": "^1.8.1",
|
29
116
|
"geojson-validation": "^1.0.2",
|
30
117
|
"node-ttl": "^0.2.0",
|
31
118
|
"pg-native": "^3.0.1",
|
32
|
-
"pg-promise": "^11.5.4"
|
119
|
+
"pg-promise": "^11.5.4",
|
120
|
+
"lodash": "~4.17.21"
|
33
121
|
},
|
34
122
|
"devDependencies": {
|
35
|
-
"@
|
36
|
-
"@types/
|
37
|
-
"@types/etag": "1.8.
|
38
|
-
"@types/
|
39
|
-
"@types/
|
40
|
-
"@types/
|
41
|
-
"@types/
|
42
|
-
"@
|
43
|
-
"@typescript-eslint/
|
44
|
-
"
|
45
|
-
"
|
46
|
-
"
|
47
|
-
"
|
123
|
+
"@jest/globals": "^29.7.0",
|
124
|
+
"@types/aws-lambda": "8.10.131",
|
125
|
+
"@types/etag": "1.8.3",
|
126
|
+
"@types/geojson": "7946.0.13",
|
127
|
+
"@types/jest": "29.5.11",
|
128
|
+
"@types/lodash": "4.14.202",
|
129
|
+
"@types/node": "20.10.7",
|
130
|
+
"@types/sinon": "17.0.2",
|
131
|
+
"@typescript-eslint/eslint-plugin": "~6.18.1",
|
132
|
+
"@typescript-eslint/parser": "^6.19.0",
|
133
|
+
"@types/geojson-validation": "^1.0.2",
|
134
|
+
"eslint": "~8.56.0",
|
135
|
+
"eslint-config-prettier": "^9.1.0",
|
136
|
+
"eslint-plugin-deprecation": "~2.0.0",
|
137
|
+
"jest": "^29.7.0",
|
138
|
+
"jest-junit": "^16.0.0",
|
139
|
+
"prettier": "^3.2.4",
|
140
|
+
"rimraf": "^5.0.5",
|
141
|
+
"sinon": "17.0.1",
|
142
|
+
"ts-jest": "^29.1.1",
|
143
|
+
"typescript": "~5.3.3",
|
144
|
+
"velocityjs": "2.0.6",
|
145
|
+
"aws-cdk-lib": "~2.118.0",
|
146
|
+
"aws-sdk": "~2.1531.0",
|
147
|
+
"axios": "^1.6.5",
|
148
|
+
"change-case": "5.3.0",
|
48
149
|
"constructs": "10.3.0",
|
49
|
-
"date-fns-tz": "~2.0.0",
|
50
150
|
"date-fns": "~2.30.0",
|
51
|
-
"
|
52
|
-
"eslint-config-prettier": "^9.0.0",
|
53
|
-
"eslint-plugin-deprecation": "~2.0.0",
|
151
|
+
"date-fns-tz": "~2.0.0",
|
54
152
|
"etag": "^1.8.1",
|
55
153
|
"geojson-validation": "^1.0.2",
|
56
|
-
"husky": "^8.0.3",
|
57
|
-
"jest": "^29.7.0",
|
58
|
-
"jest-junit": "^16.0.0",
|
59
|
-
"lint-staged": "^15.0.2",
|
60
154
|
"lodash": "~4.17.21",
|
61
155
|
"node-ttl": "^0.2.0",
|
62
|
-
"pg-
|
63
|
-
"pg-promise": "^11.5.4",
|
64
|
-
"prettier": "^2.8.8",
|
65
|
-
"rimraf": "^5.0.5",
|
66
|
-
"sinon": "17.0.0",
|
67
|
-
"ts-jest": "^29.1.1",
|
68
|
-
"typescript": "~4.9.5",
|
69
|
-
"velocityjs": "2.0.6"
|
156
|
+
"pg-promise": "^11.5.4"
|
70
157
|
},
|
71
|
-
"
|
72
|
-
"aws-sdk",
|
73
|
-
"
|
74
|
-
],
|
75
|
-
"lint-staged": {
|
76
|
-
"*.{js,ts,css,md,yml,yaml,json}": "prettier --write"
|
158
|
+
"dependencies": {
|
159
|
+
"@aws-sdk/client-s3": "~3.472.0",
|
160
|
+
"@aws-sdk/lib-storage": "~3.472.0"
|
77
161
|
},
|
78
162
|
"scripts": {
|
79
163
|
"build": "tsc",
|
164
|
+
"build:watch": "tsc --watch",
|
80
165
|
"lint": "eslint --cache .",
|
81
166
|
"eslint-report": "eslint . --format html",
|
82
167
|
"ci:eslint-report": "eslint . --format html -o report.html || true",
|
83
168
|
"clean": "rimraf dist output",
|
84
|
-
"test": "jest --detectOpenHandles --forceExit --coverage --coverageDirectory=output/coverage/jest",
|
169
|
+
"test": "node --max-old-space-size=1536 --expose-gc ./node_modules/jest/bin/jest.js --no-cache --detectOpenHandles --forceExit --coverage --coverageDirectory=output/coverage/jest --logHeapUsage --runInBand",
|
170
|
+
"test:inspect": "node --inspect-brk --expose-gc ./node_modules/jest/bin/jest.js --detectOpenHandles --forceExit --coverage --coverageDirectory=output/coverage/jest --logHeapUsage --runInBand",
|
85
171
|
"test:watch": "jest --detectOpenHandles --forceExit --coverage --coverageDirectory=output/coverage/jest --watch"
|
86
172
|
}
|
87
173
|
}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { getEnvVariableOrElse } from "../../../utils/utils";
|
2
|
-
import { DtLogger } from "../../runtime/dt-logger";
|
3
|
-
import { LambdaResponse } from "../../types/lambda-response";
|
1
|
+
import { getEnvVariableOrElse } from "../../../utils/utils.js";
|
2
|
+
import { DtLogger } from "../../runtime/dt-logger.js";
|
3
|
+
import { LambdaResponse } from "../../types/lambda-response.js";
|
4
4
|
|
5
5
|
export type LoggingHandler = (
|
6
6
|
method: () => Promise<LambdaResponse>,
|
@@ -4,8 +4,8 @@ import {
|
|
4
4
|
PassthroughBehavior,
|
5
5
|
} from "aws-cdk-lib/aws-apigateway";
|
6
6
|
import { IFunction } from "aws-cdk-lib/aws-lambda";
|
7
|
-
import { MediaType } from "../../types/mediatypes";
|
8
|
-
import { DigitrafficIntegrationResponse } from "../../runtime/digitraffic-integration-response";
|
7
|
+
import { MediaType } from "../../types/mediatypes.js";
|
8
|
+
import { DigitrafficIntegrationResponse } from "../../runtime/digitraffic-integration-response.js";
|
9
9
|
|
10
10
|
type ParameterType =
|
11
11
|
| "path"
|
@@ -1,13 +1,13 @@
|
|
1
|
-
import { MediaType } from "../../types/mediatypes";
|
1
|
+
import { MediaType } from "../../types/mediatypes.js";
|
2
2
|
import {
|
3
3
|
JsonSchema,
|
4
4
|
JsonSchemaType,
|
5
5
|
JsonSchemaVersion,
|
6
6
|
MethodResponse,
|
7
7
|
Model,
|
8
|
+
type IModel
|
8
9
|
} from "aws-cdk-lib/aws-apigateway";
|
9
|
-
import {
|
10
|
-
import { dateFromIsoString } from "../../../utils/date-utils";
|
10
|
+
import { dateFromIsoString } from "../../../utils/date-utils.js";
|
11
11
|
|
12
12
|
/**
|
13
13
|
* This is velocity-script, that assumes the response to be LambdaResponse(status and body).
|
@@ -3,21 +3,21 @@ import {
|
|
3
3
|
XmlResponseTemplate,
|
4
4
|
NotFoundResponseTemplate,
|
5
5
|
BadRequestResponseTemplate,
|
6
|
-
} from "./response";
|
6
|
+
} from "./response.js";
|
7
7
|
import {
|
8
8
|
LambdaIntegration,
|
9
9
|
MethodResponse,
|
10
10
|
IntegrationResponse,
|
11
11
|
PassthroughBehavior,
|
12
|
+
type IModel
|
12
13
|
} from "aws-cdk-lib/aws-apigateway";
|
13
14
|
import { Function as AWSFunction } from "aws-cdk-lib/aws-lambda";
|
14
|
-
import { IModel } from "aws-cdk-lib/aws-apigateway/lib/model";
|
15
15
|
import {
|
16
16
|
BAD_REQUEST_MESSAGE,
|
17
17
|
ERROR_MESSAGE,
|
18
18
|
NOT_FOUND_MESSAGE,
|
19
|
-
} from "../../types/errors";
|
20
|
-
import { MediaType } from "../../types/mediatypes";
|
19
|
+
} from "../../types/errors.js";
|
20
|
+
import { MediaType } from "../../types/mediatypes.js";
|
21
21
|
|
22
22
|
/// @deprecated
|
23
23
|
export const RESPONSE_200_OK: IntegrationResponse = {
|
@@ -4,8 +4,8 @@ import {
|
|
4
4
|
PassthroughBehavior,
|
5
5
|
Resource,
|
6
6
|
} from "aws-cdk-lib/aws-apigateway";
|
7
|
-
import { MediaType } from "../../types/mediatypes";
|
8
|
-
import { RESPONSE_CORS_INTEGRATION } from "./responses";
|
7
|
+
import { MediaType } from "../../types/mediatypes.js";
|
8
|
+
import { RESPONSE_CORS_INTEGRATION } from "./responses.js";
|
9
9
|
|
10
10
|
const INTEGRATION_RESPONSE_200 = `{
|
11
11
|
"statusCode": 200
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Construct } from "constructs";
|
2
|
-
import { CanaryParameters } from "./canary-parameters";
|
2
|
+
import { CanaryParameters } from "./canary-parameters.js";
|
3
3
|
import { Alarm, ComparisonOperator } from "aws-cdk-lib/aws-cloudwatch";
|
4
4
|
import { Canary } from "aws-cdk-lib/aws-synthetics";
|
5
5
|
import { SnsAction } from "aws-cdk-lib/aws-cloudwatch-actions";
|
@@ -7,10 +7,10 @@ import {
|
|
7
7
|
Test,
|
8
8
|
} from "aws-cdk-lib/aws-synthetics";
|
9
9
|
import { Role } from "aws-cdk-lib/aws-iam";
|
10
|
-
import { CanaryAlarm } from "./canary-alarm";
|
11
|
-
import { CanaryParameters } from "./canary-parameters";
|
10
|
+
import { CanaryAlarm } from "./canary-alarm.js";
|
11
|
+
import { CanaryParameters } from "./canary-parameters.js";
|
12
12
|
import { Construct } from "constructs";
|
13
|
-
import { LambdaEnvironment } from "../stack/lambda-configs";
|
13
|
+
import { LambdaEnvironment } from "../stack/lambda-configs.js";
|
14
14
|
|
15
15
|
export class DigitrafficCanary extends Canary {
|
16
16
|
constructor(
|
@@ -4,9 +4,9 @@ import { CfnCanary } from "aws-cdk-lib/aws-synthetics";
|
|
4
4
|
import { Schedule } from "aws-cdk-lib/aws-events";
|
5
5
|
import { Duration } from "aws-cdk-lib";
|
6
6
|
|
7
|
-
import { CanaryParameters } from "./canary-parameters";
|
8
|
-
import { DigitrafficCanary } from "./canary";
|
9
|
-
import { DigitrafficStack } from "../stack/stack";
|
7
|
+
import { CanaryParameters } from "./canary-parameters.js";
|
8
|
+
import { DigitrafficCanary } from "./canary.js";
|
9
|
+
import { DigitrafficStack } from "../stack/stack.js";
|
10
10
|
|
11
11
|
export class DatabaseCanary extends DigitrafficCanary {
|
12
12
|
constructor(
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { DTDatabase, inDatabaseReadonly } from "../../../database/database";
|
2
|
-
import { ProxyHolder } from "../../runtime/secrets/proxy-holder";
|
3
|
-
import { RdsHolder } from "../../runtime/secrets/rds-holder";
|
4
|
-
import { getEnvVariable } from "../../../utils/utils";
|
5
|
-
import { Countable } from "../../../database/models";
|
6
|
-
import { logger } from "../../runtime/dt-logger-default";
|
1
|
+
import { DTDatabase, inDatabaseReadonly } from "../../../database/database.js";
|
2
|
+
import { ProxyHolder } from "../../runtime/secrets/proxy-holder.js";
|
3
|
+
import { RdsHolder } from "../../runtime/secrets/rds-holder.js";
|
4
|
+
import { getEnvVariable } from "../../../utils/utils.js";
|
5
|
+
import { Countable } from "../../../database/models.js";
|
6
|
+
import { logger } from "../../runtime/dt-logger-default.js";
|
7
7
|
|
8
8
|
// 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
|
9
9
|
const synthetics = require("Synthetics");
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { Role } from "aws-cdk-lib/aws-iam";
|
2
2
|
import { ISecret } from "aws-cdk-lib/aws-secretsmanager";
|
3
3
|
import { CfnCanary } from "aws-cdk-lib/aws-synthetics";
|
4
|
-
import { LambdaEnvironment } from "../stack/lambda-configs";
|
5
|
-
import { DigitrafficRestApi } from "../stack/rest_apis";
|
6
|
-
import { DigitrafficStack } from "../stack/stack";
|
7
|
-
import { DigitrafficCanary } from "./canary";
|
8
|
-
import { ENV_API_KEY, ENV_HOSTNAME, ENV_SECRET } from "./canary-keys";
|
9
|
-
import { CanaryParameters } from "./canary-parameters";
|
4
|
+
import { LambdaEnvironment } from "../stack/lambda-configs.js";
|
5
|
+
import { DigitrafficRestApi } from "../stack/rest_apis.js";
|
6
|
+
import { DigitrafficStack } from "../stack/stack.js";
|
7
|
+
import { DigitrafficCanary } from "./canary.js";
|
8
|
+
import { ENV_API_KEY, ENV_HOSTNAME, ENV_SECRET } from "./canary-keys.js";
|
9
|
+
import { CanaryParameters } from "./canary-parameters.js";
|
10
10
|
|
11
11
|
export interface UrlCanaryParameters extends CanaryParameters {
|
12
12
|
readonly hostname: string;
|
@@ -1,17 +1,17 @@
|
|
1
1
|
import { IncomingMessage, RequestOptions } from "http";
|
2
|
-
import { Asserter } from "../../../test/asserter";
|
2
|
+
import { Asserter } from "../../../test/asserter.js";
|
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
5
|
const synthetics: Synthetics = require("Synthetics");
|
6
6
|
import zlib = require("zlib");
|
7
|
-
import { MediaType } from "../../types/mediatypes";
|
8
|
-
import { getApiKeyFromAPIGateway } from "../../runtime/apikey";
|
7
|
+
import { MediaType } from "../../types/mediatypes.js";
|
8
|
+
import { getApiKeyFromAPIGateway } from "../../runtime/apikey.js";
|
9
9
|
import { FeatureCollection } from "geojson";
|
10
|
-
import { isValidGeoJson } from "../../../utils/geometry";
|
11
|
-
import { getEnvVariable } from "../../../utils/utils";
|
12
|
-
import { ENV_API_KEY, ENV_HOSTNAME } from "./canary-keys";
|
13
|
-
import { logger } from "../../runtime/dt-logger-default";
|
14
|
-
import { logException } from "../../../utils/logging";
|
10
|
+
import { isValidGeoJson } from "../../../utils/geometry.js";
|
11
|
+
import { getEnvVariable } from "../../../utils/utils.js";
|
12
|
+
import { ENV_API_KEY, ENV_HOSTNAME } from "./canary-keys.js";
|
13
|
+
import { logger } from "../../runtime/dt-logger-default.js";
|
14
|
+
import { logException } from "../../../utils/logging.js";
|
15
15
|
|
16
16
|
export const API_KEY_HEADER = "x-api-key";
|
17
17
|
|
@@ -4,10 +4,10 @@ import {
|
|
4
4
|
PassthroughBehavior,
|
5
5
|
RequestValidator,
|
6
6
|
Resource,
|
7
|
+
IModel
|
7
8
|
} from "aws-cdk-lib/aws-apigateway";
|
8
9
|
import { Queue } from "aws-cdk-lib/aws-sqs";
|
9
10
|
import { PolicyStatement, Role, ServicePrincipal } from "aws-cdk-lib/aws-iam";
|
10
|
-
import { IModel } from "aws-cdk-lib/aws-apigateway/lib/model";
|
11
11
|
import { Construct } from "constructs";
|
12
12
|
|
13
13
|
export function attachQueueToApiGatewayResource(
|
@@ -5,16 +5,13 @@ import { PolicyStatement } from "aws-cdk-lib/aws-iam";
|
|
5
5
|
import { InlineCode, Runtime } from "aws-cdk-lib/aws-lambda";
|
6
6
|
import { RetentionDays } from "aws-cdk-lib/aws-logs";
|
7
7
|
import { SqsEventSource } from "aws-cdk-lib/aws-lambda-event-sources";
|
8
|
-
import {
|
9
|
-
ComparisonOperator,
|
10
|
-
TreatMissingData,
|
11
|
-
} from "aws-cdk-lib/aws-cloudwatch";
|
8
|
+
import { ComparisonOperator, TreatMissingData } from "aws-cdk-lib/aws-cloudwatch";
|
12
9
|
import { SnsAction } from "aws-cdk-lib/aws-cloudwatch-actions";
|
13
|
-
import {
|
14
|
-
import {
|
10
|
+
import { S3, S3Client } from "@aws-sdk/client-s3";
|
11
|
+
import { Upload } from "@aws-sdk/lib-storage";
|
15
12
|
import { SQSEvent, SQSHandler, SQSRecord } from "aws-lambda";
|
16
|
-
import { DigitrafficStack } from "./stack/stack";
|
17
|
-
import { MonitoredFunction } from "./stack/monitoredfunction";
|
13
|
+
import { DigitrafficStack } from "./stack/stack.js";
|
14
|
+
import { MonitoredFunction } from "./stack/monitoredfunction.js";
|
18
15
|
|
19
16
|
/**
|
20
17
|
* Construct for creating SQS-queues.
|
@@ -23,11 +20,7 @@ import { MonitoredFunction } from "./stack/monitoredfunction";
|
|
23
20
|
* and an alarm for the queue. Anything that goes to the dlq will be written into the bucket and the alarm is activated.
|
24
21
|
*/
|
25
22
|
export class DigitrafficSqsQueue extends Queue {
|
26
|
-
static create(
|
27
|
-
stack: DigitrafficStack,
|
28
|
-
name: string,
|
29
|
-
props: QueueProps
|
30
|
-
): DigitrafficSqsQueue {
|
23
|
+
static create(stack: DigitrafficStack, name: string, props: QueueProps): DigitrafficSqsQueue {
|
31
24
|
const queueName = `${stack.configuration.shortName}-${name}-Queue`;
|
32
25
|
const queueProps = {
|
33
26
|
...props,
|
@@ -61,7 +54,7 @@ export class DigitrafficDLQueue {
|
|
61
54
|
|
62
55
|
const dlqFunctionName = `${dlqName}-Function`;
|
63
56
|
const lambda = MonitoredFunction.create(stack, dlqFunctionName, {
|
64
|
-
runtime: Runtime.
|
57
|
+
runtime: Runtime.NODEJS_20_X,
|
65
58
|
logRetention: RetentionDays.ONE_YEAR,
|
66
59
|
functionName: dlqFunctionName,
|
67
60
|
code: getDlqCode(dlqBucket.bucketName),
|
@@ -100,8 +93,8 @@ function addDLQAlarm(stack: DigitrafficStack, dlqName: string, dlq: Queue) {
|
|
100
93
|
.addAlarmAction(new SnsAction(stack.warningTopic));
|
101
94
|
}
|
102
95
|
|
103
|
-
function getDlqCode(
|
104
|
-
const functionBody = DLQ_LAMBDA_CODE.replace("__bucketName__",
|
96
|
+
function getDlqCode(Bucket: string): InlineCode {
|
97
|
+
const functionBody = DLQ_LAMBDA_CODE.replace("__bucketName__", Bucket)
|
105
98
|
.replace("__upload__", uploadToS3.toString())
|
106
99
|
.replace("__doUpload__", doUpload.toString())
|
107
100
|
.replace("__handler__", createHandler().toString().substring(23)); // remove function handler() from signature
|
@@ -109,42 +102,32 @@ function getDlqCode(bName: string): InlineCode {
|
|
109
102
|
return new InlineCode(functionBody);
|
110
103
|
}
|
111
104
|
|
112
|
-
async function uploadToS3(
|
113
|
-
s3: S3,
|
114
|
-
bName: string,
|
115
|
-
body: string,
|
116
|
-
objectName: string
|
117
|
-
): Promise<void> {
|
105
|
+
async function uploadToS3(s3: S3 | S3Client, Bucket: string, Body: string, Key: string): Promise<void> {
|
118
106
|
try {
|
119
|
-
console.info("writing %s to %s",
|
120
|
-
await doUpload(s3,
|
107
|
+
console.info("writing %s to %s", Key, Bucket);
|
108
|
+
await doUpload(s3, Bucket, Body, Key);
|
121
109
|
} catch (error) {
|
122
110
|
console.warn(error);
|
123
|
-
console.warn("method=uploadToS3 retrying upload to bucket %s",
|
111
|
+
console.warn("method=uploadToS3 retrying upload to bucket %s", Bucket);
|
124
112
|
try {
|
125
|
-
await doUpload(s3,
|
113
|
+
await doUpload(s3, Bucket, Body, Key);
|
126
114
|
} catch (e2) {
|
127
|
-
console.error(
|
128
|
-
"method=uploadToS3 failed retrying upload to bucket %s",
|
129
|
-
bName
|
130
|
-
);
|
115
|
+
console.error("method=uploadToS3 failed retrying upload to bucket %s", Bucket);
|
131
116
|
}
|
132
117
|
}
|
133
118
|
}
|
134
119
|
|
135
|
-
function doUpload(
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
)
|
141
|
-
|
142
|
-
.
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
})
|
147
|
-
.promise();
|
120
|
+
async function doUpload(s3: S3 | S3Client, Bucket: string, Body: string, Key: string) {
|
121
|
+
try {
|
122
|
+
const upload = new Upload({
|
123
|
+
client: s3,
|
124
|
+
params: { Bucket, Key, Body },
|
125
|
+
});
|
126
|
+
|
127
|
+
await upload.done();
|
128
|
+
} catch (error) {
|
129
|
+
console.error(error);
|
130
|
+
}
|
148
131
|
}
|
149
132
|
|
150
133
|
// bucketName is unused, will be overridden in the actual lambda code below
|
@@ -170,7 +153,9 @@ function createHandler(): SQSHandler {
|
|
170
153
|
};
|
171
154
|
}
|
172
155
|
|
173
|
-
const DLQ_LAMBDA_CODE = `
|
156
|
+
const DLQ_LAMBDA_CODE = `
|
157
|
+
import { S3, S3Client } from "@aws-sdk/client-s3";
|
158
|
+
import { Upload } from "@aws-sdk/lib-storage";
|
174
159
|
const bucketName = "__bucketName__";
|
175
160
|
|
176
161
|
__upload__
|
@@ -9,8 +9,8 @@ import { Duration } from "aws-cdk-lib";
|
|
9
9
|
import { IVpc, SubnetSelection } from "aws-cdk-lib/aws-ec2";
|
10
10
|
import { RetentionDays } from "aws-cdk-lib/aws-logs";
|
11
11
|
import { Role } from "aws-cdk-lib/aws-iam";
|
12
|
-
import { DigitrafficStack } from "./stack";
|
13
|
-
import { MonitoredFunctionAlarmProps } from "./monitoredfunction";
|
12
|
+
import { DigitrafficStack } from "./stack.js";
|
13
|
+
import { MonitoredFunctionAlarmProps } from "./monitoredfunction.js";
|
14
14
|
|
15
15
|
export type LambdaEnvironment = Record<string, string>;
|
16
16
|
|
@@ -24,7 +24,7 @@ export function databaseFunctionProps(
|
|
24
24
|
environment: LambdaEnvironment,
|
25
25
|
lambdaName: string,
|
26
26
|
simpleLambdaName: string,
|
27
|
-
config?: Partial<FunctionParameters
|
27
|
+
config?: Partial<FunctionParameters>,
|
28
28
|
): FunctionProps {
|
29
29
|
const vpcSubnets = stack.vpc
|
30
30
|
? {
|
@@ -38,7 +38,7 @@ export function databaseFunctionProps(
|
|
38
38
|
environment,
|
39
39
|
lambdaName,
|
40
40
|
simpleLambdaName,
|
41
|
-
config
|
41
|
+
config,
|
42
42
|
),
|
43
43
|
...{
|
44
44
|
vpc: stack.vpc ?? undefined,
|
@@ -53,10 +53,10 @@ export function lambdaFunctionProps(
|
|
53
53
|
environment: LambdaEnvironment,
|
54
54
|
lambdaName: string,
|
55
55
|
simpleLambdaName: string,
|
56
|
-
config?: Partial<FunctionParameters
|
56
|
+
config?: Partial<FunctionParameters>,
|
57
57
|
): FunctionProps {
|
58
58
|
return {
|
59
|
-
runtime: config?.runtime ?? Runtime.
|
59
|
+
runtime: config?.runtime ?? Runtime.NODEJS_20_X,
|
60
60
|
architecture: config?.architecture ?? Architecture.ARM_64,
|
61
61
|
memorySize: config?.memorySize ?? 128,
|
62
62
|
functionName: lambdaName,
|
@@ -72,7 +72,7 @@ export function lambdaFunctionProps(
|
|
72
72
|
|
73
73
|
function getAssetCode(
|
74
74
|
simpleLambdaName: string,
|
75
|
-
isSingleLambda: boolean
|
75
|
+
isSingleLambda: boolean,
|
76
76
|
): AssetCode {
|
77
77
|
const lambdaPath = isSingleLambda
|
78
78
|
? `dist/lambda/`
|
@@ -82,10 +82,10 @@ function getAssetCode(
|
|
82
82
|
}
|
83
83
|
|
84
84
|
export function defaultLambdaConfiguration(
|
85
|
-
config: FunctionParameters
|
85
|
+
config: FunctionParameters,
|
86
86
|
): FunctionProps {
|
87
87
|
const props: FunctionProps = {
|
88
|
-
runtime: Runtime.
|
88
|
+
runtime: Runtime.NODEJS_20_X,
|
89
89
|
memorySize: config.memorySize ?? 128,
|
90
90
|
functionName: config.functionName,
|
91
91
|
handler: config.handler,
|
@@ -2,15 +2,15 @@ import { Function, FunctionProps } from "aws-cdk-lib/aws-lambda";
|
|
2
2
|
import { Stack } from "aws-cdk-lib";
|
3
3
|
import { SnsAction } from "aws-cdk-lib/aws-cloudwatch-actions";
|
4
4
|
import { ComparisonOperator, Metric } from "aws-cdk-lib/aws-cloudwatch";
|
5
|
-
import { DigitrafficStack } from "
|
5
|
+
import { DigitrafficStack } from "./stack.js";
|
6
6
|
import { ITopic } from "aws-cdk-lib/aws-sns";
|
7
7
|
import {
|
8
8
|
databaseFunctionProps,
|
9
9
|
LambdaEnvironment,
|
10
10
|
MonitoredFunctionParameters,
|
11
|
-
} from "
|
12
|
-
import { DigitrafficLogSubscriptions } from "
|
13
|
-
import { TrafficType } from "../../../types/traffictype";
|
11
|
+
} from "./lambda-configs.js";
|
12
|
+
import { DigitrafficLogSubscriptions } from "./subscription.js";
|
13
|
+
import { TrafficType } from "../../../types/traffictype.js";
|
14
14
|
|
15
15
|
import _ from "lodash";
|
16
16
|
|