@@ -3,7 +3,7 @@ declare namespace AWSCloudFrontFunction {
33 version : "1.0" ;
44 context : Context ;
55 viewer : Viewer ;
6- request : Request ;
6+ request : Request & RequestMethods ;
77 response : Response ;
88 }
99
@@ -26,6 +26,17 @@ declare namespace AWSCloudFrontFunction {
2626 cookies : ValueObject ;
2727 }
2828
29+ interface RequestMethods {
30+ /**
31+ * Use the rawQueryString() method to retrieve the unparsed and unaltered query string as a string.
32+ * @returns Returns the full query string of the incoming request as a string value without the leading ?.
33+ * - If there isn't a query string, but the ? is present, the functions returns an empty string.
34+ * - If there isn't a query string and the ? isn't present, the function returns undefined.
35+ * @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/general-helper-methods.html#raw-query-string-method
36+ */
37+ rawQueryString ( ) : string | undefined ;
38+ }
39+
2940 interface Response {
3041 statusCode : number ;
3142 statusDescription ?: string ;
@@ -225,11 +236,35 @@ declare module "cloudfront" {
225236 */
226237 function createRequestOriginGroup ( params : CreateRequestOriginGroupParams ) : void ;
227238
239+ /**
240+ * Use this JavaScript object to obtain the edge location airport code,
241+ * expected Regional Edge Cache region or the CloudFront server IP address used to handle the request.
242+ * This metadata is available only the viewer request event trigger.
243+ * @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/general-helper-methods.html#edge-location-metadata
244+ */
245+ interface EdgeLocation {
246+ /**
247+ * The three-letter IATA code of the edge location that handled the request.
248+ */
249+ name : string ;
250+ /**
251+ * The IPv4 or IPv6 address of the server that handled the request.
252+ */
253+ serverIp : string ;
254+ /**
255+ * The CloudFront Regional Edge Cache (REC) that the request is expected to use if there is a cache miss.
256+ * This value is not updated in the event that the expected REC is unavailable and a backup REC is used for the request.
257+ * This doesn't include the Origin Shield location being used, except in cases when the primary REC and the Origin Shield are the same location.
258+ */
259+ region : string ;
260+ }
261+
228262 const cf : {
229263 kvs : typeof kvs ;
230264 updateRequestOrigin : typeof updateRequestOrigin ;
231265 selectRequestOriginById : typeof selectRequestOriginById ;
232266 createRequestOriginGroup : typeof createRequestOriginGroup ;
267+ edgeLocation : EdgeLocation ;
233268 } ;
234269
235270 export default cf ;
0 commit comments