@digitraffic/common 2025.9.12-3 → 2025.9.22-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__/mock-ky.js +1 -0
- package/dist/aws/infra/acl-builder.d.ts +4 -0
- package/dist/aws/infra/acl-builder.js +25 -0
- package/dist/aws/infra/canaries/url-checker.js +1 -0
- package/dist/aws/infra/stack/rest_apis.d.ts +5 -0
- package/dist/aws/infra/stack/rest_apis.js +8 -0
- package/dist/database/last-updated.js +0 -2
- package/dist/types/openapi-schema.d.ts +424 -3834
- package/dist/types/openapi-schema.js +17 -17
- package/dist/utils/geometry.js +2 -1
- package/package.json +49 -50
package/dist/__test__/mock-ky.js
CHANGED
|
@@ -7,6 +7,7 @@ export function mockKyResponse(status, body) {
|
|
|
7
7
|
return Object.assign(promise, {
|
|
8
8
|
arrayBuffer: () => response.arrayBuffer(),
|
|
9
9
|
blob: () => response.blob(),
|
|
10
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
10
11
|
formData: () => response.formData(),
|
|
11
12
|
json: () => response.json(),
|
|
12
13
|
text: () => response.text(),
|
|
@@ -42,6 +42,10 @@ export declare class AclBuilder {
|
|
|
42
42
|
withCountDigitrafficUserIpAndUriPath(limit: number | undefined): this;
|
|
43
43
|
withCountAnonymousUserIp(limit: number | undefined): this;
|
|
44
44
|
withCountAnonymousUserIpAndUriPath(limit: number | undefined): this;
|
|
45
|
+
/**
|
|
46
|
+
* Block requests with a query string larger than the specified size.
|
|
47
|
+
*/
|
|
48
|
+
withQueryStringSizeRestriction(limit: number): this;
|
|
45
49
|
_isCustomResponseBodyKeySet(key: string): boolean;
|
|
46
50
|
_addThrottleResponseBody(customResponseBodyKey: string, limit: number): void;
|
|
47
51
|
build(): CfnWebACL;
|
|
@@ -184,6 +184,31 @@ export class AclBuilder {
|
|
|
184
184
|
}
|
|
185
185
|
return this.withThrottleRule(`CountRuleIPQueryWithAnonymousUser${limit}`, limit, false, true);
|
|
186
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* Block requests with a query string larger than the specified size.
|
|
189
|
+
*/
|
|
190
|
+
withQueryStringSizeRestriction(limit) {
|
|
191
|
+
this._blockRules.push({
|
|
192
|
+
name: "QueryStringSizeRestriction",
|
|
193
|
+
action: { block: {} },
|
|
194
|
+
statement: {
|
|
195
|
+
sizeConstraintStatement: {
|
|
196
|
+
fieldToMatch: {
|
|
197
|
+
queryString: {},
|
|
198
|
+
},
|
|
199
|
+
comparisonOperator: "GT",
|
|
200
|
+
size: limit,
|
|
201
|
+
textTransformations: [{ priority: 0, type: "NONE" }],
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
visibilityConfig: {
|
|
205
|
+
sampledRequestsEnabled: true,
|
|
206
|
+
cloudWatchMetricsEnabled: true,
|
|
207
|
+
metricName: "QueryStringSizeRestriction",
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
return this;
|
|
211
|
+
}
|
|
187
212
|
_isCustomResponseBodyKeySet(key) {
|
|
188
213
|
return key in this._customResponseBodies;
|
|
189
214
|
}
|
|
@@ -78,6 +78,7 @@ export class UrlChecker {
|
|
|
78
78
|
}
|
|
79
79
|
expect403WithoutApiKey(url, mediaType) {
|
|
80
80
|
if (!this.requestOptions.headers ||
|
|
81
|
+
!(API_KEY_HEADER in this.requestOptions.headers) ||
|
|
81
82
|
!this.requestOptions.headers[API_KEY_HEADER]) {
|
|
82
83
|
logger.error({
|
|
83
84
|
method: "UrlChecker.expect403WithoutApiKey",
|
|
@@ -21,6 +21,11 @@ export declare class DigitrafficRestApi extends RestApi {
|
|
|
21
21
|
exportEndpoint(): void;
|
|
22
22
|
/** Export end point and given api key to Parameter store */
|
|
23
23
|
exportEndpoint(apiKeyId: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* @param apiKeyId
|
|
26
|
+
* @param apiKeyName
|
|
27
|
+
* @deprecated Uses deprecated createUsagePlan that creates randomized API key names, use createUsagePlanV2 instead
|
|
28
|
+
*/
|
|
24
29
|
createUsagePlan(apiKeyId: string, apiKeyName: string): string;
|
|
25
30
|
createUsagePlanV2(apiName: string, apiKey?: string): string;
|
|
26
31
|
addJsonModel(modelName: string, schema: JsonSchema): ModelWithReference;
|
|
@@ -60,16 +60,24 @@ export class DigitrafficRestApi extends RestApi {
|
|
|
60
60
|
}
|
|
61
61
|
apiKeyId = firstKey;
|
|
62
62
|
}
|
|
63
|
+
// eslint-disable-next-line no-new
|
|
63
64
|
new StringParameter(this._stack, "export.endpoint", {
|
|
64
65
|
parameterName: `/digitraffic/${this._stack.configuration.shortName}/endpointUrl`,
|
|
65
66
|
stringValue: this.url,
|
|
66
67
|
});
|
|
68
|
+
// eslint-disable-next-line no-new
|
|
67
69
|
new StringParameter(this._stack, "export.apiKeyId", {
|
|
68
70
|
parameterName: `/digitraffic/${this._stack.configuration.shortName}/apiKeyId`,
|
|
69
71
|
stringValue: apiKeyId,
|
|
70
72
|
});
|
|
71
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* @param apiKeyId
|
|
76
|
+
* @param apiKeyName
|
|
77
|
+
* @deprecated Uses deprecated createUsagePlan that creates randomized API key names, use createUsagePlanV2 instead
|
|
78
|
+
*/
|
|
72
79
|
createUsagePlan(apiKeyId, apiKeyName) {
|
|
80
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
73
81
|
const newKeyId = createUsagePlan(this, apiKeyId, apiKeyName).keyId;
|
|
74
82
|
this.apiKeyIds.push(newKeyId);
|
|
75
83
|
return newKeyId;
|
|
@@ -8,7 +8,6 @@ export var DataType;
|
|
|
8
8
|
DataType["PERMIT_DATA_CHECK"] = "PERMIT_DATA_CHECK";
|
|
9
9
|
})(DataType || (DataType = {}));
|
|
10
10
|
const UNSET_SUBTYPE = "-";
|
|
11
|
-
// eslint-disable-next-line @rushstack/no-new-null
|
|
12
11
|
export function getLastUpdated(db, datatype) {
|
|
13
12
|
return db.oneOrNone("select updated from data_updated where data_type=$(datatype) and subtype=$(subtype)", {
|
|
14
13
|
datatype: datatype,
|
|
@@ -33,7 +32,6 @@ export function updateLastUpdatedWithSubtype(db, datatype, subtype, updated) {
|
|
|
33
32
|
on conflict (data_type, subtype)
|
|
34
33
|
do update set updated = $(updated)`, { updated, subtype, datatype });
|
|
35
34
|
}
|
|
36
|
-
// eslint-disable-next-line @rushstack/no-new-null
|
|
37
35
|
export function getUpdatedTimestamp(db, datatype) {
|
|
38
36
|
return db.oneOrNone("select updated_time as updated from updated_timestamp where updated_name=$(datatype)", {
|
|
39
37
|
datatype: datatype,
|