@digitraffic/common 2025.9.12-1 → 2025.9.12-2
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/integration.d.ts +2 -1
- package/dist/aws/infra/api/integration.js +6 -2
- package/dist/aws/infra/api/response.d.ts +1 -1
- package/dist/aws/infra/api/response.js +3 -1
- package/dist/aws/runtime/digitraffic-integration-response.d.ts +2 -2
- package/dist/aws/runtime/digitraffic-integration-response.js +4 -4
- package/package.json +1 -1
|
@@ -10,10 +10,11 @@ export declare class DigitrafficIntegration<T extends string> {
|
|
|
10
10
|
readonly lambda: IFunction;
|
|
11
11
|
readonly mediaType: MediaType;
|
|
12
12
|
readonly parameters: ApiParameter[];
|
|
13
|
+
readonly deprecation: boolean;
|
|
13
14
|
readonly sunset?: string;
|
|
14
15
|
_passAllQueryParameters: boolean;
|
|
15
16
|
_passBody: boolean;
|
|
16
|
-
constructor(lambda: IFunction, mediaType?: MediaType, sunset?: string);
|
|
17
|
+
constructor(lambda: IFunction, mediaType?: MediaType, deprecation?: boolean, sunset?: string);
|
|
17
18
|
passAllQueryParameters(): this;
|
|
18
19
|
/**
|
|
19
20
|
* Body is passed as an base64-encoded string, so broken input should't break anything. You should
|
|
@@ -11,13 +11,15 @@ export class DigitrafficIntegration {
|
|
|
11
11
|
lambda;
|
|
12
12
|
mediaType;
|
|
13
13
|
parameters = [];
|
|
14
|
+
deprecation = false;
|
|
14
15
|
sunset;
|
|
15
16
|
_passAllQueryParameters;
|
|
16
17
|
_passBody;
|
|
17
|
-
constructor(lambda, mediaType = MediaType.TEXT_PLAIN, sunset) {
|
|
18
|
+
constructor(lambda, mediaType = MediaType.TEXT_PLAIN, deprecation = false, sunset) {
|
|
18
19
|
this.lambda = lambda;
|
|
19
20
|
this.mediaType = mediaType;
|
|
20
21
|
this.sunset = sunset;
|
|
22
|
+
this.deprecation = deprecation;
|
|
21
23
|
this._passAllQueryParameters = false;
|
|
22
24
|
this._passBody = false;
|
|
23
25
|
}
|
|
@@ -141,7 +143,9 @@ ${this._passBody ? VELOCITY_PASS_BODY : ""}
|
|
|
141
143
|
};
|
|
142
144
|
}
|
|
143
145
|
createResponses() {
|
|
144
|
-
return [
|
|
146
|
+
return [
|
|
147
|
+
DigitrafficIntegrationResponse.ok(this.mediaType, this.deprecation, this.sunset),
|
|
148
|
+
];
|
|
145
149
|
}
|
|
146
150
|
}
|
|
147
151
|
//# sourceMappingURL=integration.js.map
|
|
@@ -20,7 +20,7 @@ export declare const RESPONSE_DEFAULT_LAMBDA = "#set($inputRoot = $input.path('$
|
|
|
20
20
|
* Sunset: Tue, 20 Dec 2022 00:00:00 GMT
|
|
21
21
|
* @param sunset Sunset date as string in ISO 8601 date-time format (YYYY-MM-DD)
|
|
22
22
|
*/
|
|
23
|
-
export declare const getDeprecatedDefaultLambdaResponse: (sunset
|
|
23
|
+
export declare const getDeprecatedDefaultLambdaResponse: (sunset?: string) => string;
|
|
24
24
|
export declare const MessageModel: {
|
|
25
25
|
contentType: MediaType;
|
|
26
26
|
modelName: string;
|
|
@@ -39,7 +39,9 @@ $util.base64Decode($inputRoot.body)`;
|
|
|
39
39
|
*/
|
|
40
40
|
export const getDeprecatedDefaultLambdaResponse = (sunset) => {
|
|
41
41
|
const setDeprecationHeaders = `#set ($context.responseOverride.header.Deprecation = 'true')
|
|
42
|
-
|
|
42
|
+
${sunset
|
|
43
|
+
? `#set ($context.responseOverride.header.Sunset = '${dateFromIsoString(sunset).toUTCString()}')`
|
|
44
|
+
: ""}`;
|
|
43
45
|
return RESPONSE_DEFAULT_LAMBDA.concat(setDeprecationHeaders);
|
|
44
46
|
};
|
|
45
47
|
const BODY_FROM_INPUT_PATH = "$input.path('$').body";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { IntegrationResponse } from "aws-cdk-lib/aws-apigateway";
|
|
2
2
|
import { MediaType } from "../types/mediatypes.js";
|
|
3
3
|
export declare abstract class DigitrafficIntegrationResponse {
|
|
4
|
-
static ok(mediaType: MediaType, sunset?: string): IntegrationResponse;
|
|
4
|
+
static ok(mediaType: MediaType, deprecation?: boolean, sunset?: string): IntegrationResponse;
|
|
5
5
|
static badRequest(mediaType?: MediaType): IntegrationResponse;
|
|
6
6
|
static notImplemented(mediaType?: MediaType): IntegrationResponse;
|
|
7
|
-
static create(statusCode: string, mediaType: MediaType, sunset?: string): IntegrationResponse;
|
|
7
|
+
static create(statusCode: string, mediaType: MediaType, deprecation?: boolean, sunset?: string): IntegrationResponse;
|
|
8
8
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MediaType } from "../types/mediatypes.js";
|
|
2
2
|
import { getDeprecatedDefaultLambdaResponse, RESPONSE_DEFAULT_LAMBDA, } from "../infra/api/response.js";
|
|
3
3
|
export class DigitrafficIntegrationResponse {
|
|
4
|
-
static ok(mediaType, sunset) {
|
|
5
|
-
return this.create("200", mediaType, sunset);
|
|
4
|
+
static ok(mediaType, deprecation = false, sunset) {
|
|
5
|
+
return this.create("200", mediaType, deprecation, sunset);
|
|
6
6
|
}
|
|
7
7
|
static badRequest(mediaType) {
|
|
8
8
|
return this.create("400", mediaType ?? MediaType.TEXT_PLAIN);
|
|
@@ -10,11 +10,11 @@ export class DigitrafficIntegrationResponse {
|
|
|
10
10
|
static notImplemented(mediaType) {
|
|
11
11
|
return this.create("501", mediaType ?? MediaType.TEXT_PLAIN);
|
|
12
12
|
}
|
|
13
|
-
static create(statusCode, mediaType, sunset) {
|
|
13
|
+
static create(statusCode, mediaType, deprecation = false, sunset) {
|
|
14
14
|
return {
|
|
15
15
|
statusCode,
|
|
16
16
|
responseTemplates: {
|
|
17
|
-
[mediaType]:
|
|
17
|
+
[mediaType]: deprecation
|
|
18
18
|
? getDeprecatedDefaultLambdaResponse(sunset)
|
|
19
19
|
: RESPONSE_DEFAULT_LAMBDA,
|
|
20
20
|
},
|