@types/aws-cloudfront-function 1.0.4 → 1.0.6
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.
|
@@ -6,68 +6,9 @@ This package contains type definitions for aws-cloudfront-function (https://docs
|
|
|
6
6
|
|
|
7
7
|
# Details
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/aws-cloudfront-function.
|
|
9
|
-
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/aws-cloudfront-function/index.d.ts)
|
|
10
|
-
````ts
|
|
11
|
-
declare namespace AWSCloudFrontFunction {
|
|
12
|
-
interface Event {
|
|
13
|
-
version: "1.0";
|
|
14
|
-
context: Context;
|
|
15
|
-
viewer: Viewer;
|
|
16
|
-
request: Request;
|
|
17
|
-
response: Response;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface Context {
|
|
21
|
-
distributionDomainName: string;
|
|
22
|
-
distributionId: string;
|
|
23
|
-
eventType: "viewer-request" | "viewer-response";
|
|
24
|
-
requestId: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface Viewer {
|
|
28
|
-
ip: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface Request {
|
|
32
|
-
method: string;
|
|
33
|
-
uri: string;
|
|
34
|
-
querystring: ValueObject;
|
|
35
|
-
headers: ValueObject;
|
|
36
|
-
cookies: ValueObject;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
interface Response {
|
|
40
|
-
statusCode: number;
|
|
41
|
-
statusDescription?: string;
|
|
42
|
-
headers?: ValueObject;
|
|
43
|
-
cookies?: ResponseCookie;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
interface ValueObject {
|
|
47
|
-
[name: string]: {
|
|
48
|
-
value: string;
|
|
49
|
-
multiValue?: Array<{
|
|
50
|
-
value: string;
|
|
51
|
-
}>;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
interface ResponseCookie {
|
|
56
|
-
[name: string]: {
|
|
57
|
-
value: string;
|
|
58
|
-
attributes: string;
|
|
59
|
-
multiValue?: Array<{
|
|
60
|
-
value: string;
|
|
61
|
-
attributes: string;
|
|
62
|
-
}>;
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
````
|
|
68
9
|
|
|
69
10
|
### Additional Details
|
|
70
|
-
* Last updated:
|
|
11
|
+
* Last updated: Tue, 23 Sep 2025 20:34:40 GMT
|
|
71
12
|
* Dependencies: none
|
|
72
13
|
|
|
73
14
|
# Credits
|
|
@@ -31,6 +31,12 @@ declare namespace AWSCloudFrontFunction {
|
|
|
31
31
|
statusDescription?: string;
|
|
32
32
|
headers?: ValueObject;
|
|
33
33
|
cookies?: ResponseCookie;
|
|
34
|
+
body?: string | ResponseBody;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface ResponseBody {
|
|
38
|
+
data: string;
|
|
39
|
+
encoding: "text" | "base64";
|
|
34
40
|
}
|
|
35
41
|
|
|
36
42
|
interface ValueObject {
|
|
@@ -53,3 +59,178 @@ declare namespace AWSCloudFrontFunction {
|
|
|
53
59
|
};
|
|
54
60
|
}
|
|
55
61
|
}
|
|
62
|
+
|
|
63
|
+
declare module "cloudfront" {
|
|
64
|
+
/**
|
|
65
|
+
* Retrieves a reference to a CloudFront Key-Value Store (KVS) by its ID.
|
|
66
|
+
* @param kvsId The identifier of the KVS to use.
|
|
67
|
+
* @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/functions-custom-methods.html
|
|
68
|
+
*/
|
|
69
|
+
function kvs(kvsId: string): KVStore;
|
|
70
|
+
|
|
71
|
+
interface KVStore {
|
|
72
|
+
/**
|
|
73
|
+
* Retrieve a value from the store.
|
|
74
|
+
* @param key Key to retrieve.
|
|
75
|
+
* @throws If key does not exist.
|
|
76
|
+
*/
|
|
77
|
+
get(key: string): Promise<string>;
|
|
78
|
+
get(key: string, options: { format: "string" }): Promise<string>;
|
|
79
|
+
get(key: string, options: { format: "bytes" }): Promise<Uint8Array>;
|
|
80
|
+
get(key: string, options: { format: "json" }): Promise<unknown>;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Check if the key exists in the store.
|
|
84
|
+
* @param key Key to check.
|
|
85
|
+
*/
|
|
86
|
+
exists(key: string): Promise<boolean>;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Retrieve metadata about the key-value store.
|
|
90
|
+
*/
|
|
91
|
+
meta(): Promise<{
|
|
92
|
+
creationDateTime: string;
|
|
93
|
+
lastUpdatedDateTime: string;
|
|
94
|
+
keyCount: number;
|
|
95
|
+
}>;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
interface OriginAccessControlConfig {
|
|
99
|
+
enabled: boolean;
|
|
100
|
+
signingBehavior: "always" | "never" | "no-override";
|
|
101
|
+
signingProtocol: "sigv4";
|
|
102
|
+
originType: "s3" | "mediapackagev2" | "mediastore" | "lambda";
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
interface OriginShield {
|
|
106
|
+
enabled: boolean;
|
|
107
|
+
region: string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
interface Timeouts {
|
|
111
|
+
/**
|
|
112
|
+
* Max time (seconds) to wait for a response or next packet. (1–60)
|
|
113
|
+
*/
|
|
114
|
+
readTimeout?: number;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Max time (seconds) to keep the connection alive after response. (1–60)
|
|
118
|
+
*/
|
|
119
|
+
keepAliveTimeout?: number;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Max time (seconds) to wait for connection establishment. (1–10)
|
|
123
|
+
*/
|
|
124
|
+
connectionTimeout?: number;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
interface CustomOriginConfig {
|
|
128
|
+
/**
|
|
129
|
+
* Port number of the origin. e.g., 80 or 443
|
|
130
|
+
*/
|
|
131
|
+
port: number;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Protocol used to connect. Must be "http" or "https"
|
|
135
|
+
*/
|
|
136
|
+
protocol: "http" | "https";
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Minimum TLS/SSL version to use for HTTPS connections.
|
|
140
|
+
*/
|
|
141
|
+
sslProtocols: Array<"SSLv3" | "TLSv1" | "TLSv1.1" | "TLSv1.2">;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
interface UpdateRequestOriginParams {
|
|
145
|
+
/**
|
|
146
|
+
* New origin's domain name. Optional if reusing existing origin's domain.
|
|
147
|
+
*/
|
|
148
|
+
domainName?: string;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Path prefix to append when forwarding request to origin.
|
|
152
|
+
*/
|
|
153
|
+
originPath?: string;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Override or clear custom headers for the origin request.
|
|
157
|
+
*/
|
|
158
|
+
customHeaders?: Record<string, string>;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Number of connection attempts (1–3).
|
|
162
|
+
*/
|
|
163
|
+
connectionAttempts?: number;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Origin Shield configuration. Enables shield layer if specified.
|
|
167
|
+
*/
|
|
168
|
+
originShield?: OriginShield;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Origin Access Control (OAC) configuration.
|
|
172
|
+
*/
|
|
173
|
+
originAccessControlConfig?: OriginAccessControlConfig;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Response and connection timeout configurations.
|
|
177
|
+
*/
|
|
178
|
+
timeouts?: Timeouts;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Settings for non-S3 origins or S3 with static website hosting.
|
|
182
|
+
*/
|
|
183
|
+
customOriginConfig?: CustomOriginConfig;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Mutates the current request’s origin.
|
|
188
|
+
* You can specify a new origin (e.g., S3 or ALB), change custom headers, enable OAC, or enable Origin Shield.
|
|
189
|
+
* Missing fields will inherit values from the assigned origin.
|
|
190
|
+
* @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/helper-functions-origin-modification.html#update-request-origin-helper-function
|
|
191
|
+
*/
|
|
192
|
+
function updateRequestOrigin(params: UpdateRequestOriginParams): void;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Switches to another origin already defined in the distribution by origin ID.
|
|
196
|
+
* This is more efficient than defining a new one via `updateRequestOrigin()`.
|
|
197
|
+
* @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/helper-functions-origin-modification.html#select-request-origin-id-helper-function
|
|
198
|
+
*/
|
|
199
|
+
function selectRequestOriginById(originId: string): void;
|
|
200
|
+
|
|
201
|
+
interface CreateRequestOriginGroupParams {
|
|
202
|
+
/**
|
|
203
|
+
* Two origin IDs to form an origin group.
|
|
204
|
+
* The first is primary; the second is used for failover.
|
|
205
|
+
*/
|
|
206
|
+
originIds: [string, string];
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Failover selection strategy: default or media-quality-score.
|
|
210
|
+
*/
|
|
211
|
+
selectionCriteria?: "default" | "media-quality-score";
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* List of status codes that trigger failover to the secondary origin.
|
|
215
|
+
*/
|
|
216
|
+
failoverCriteria: {
|
|
217
|
+
statusCodes: number[];
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Creates a new origin group for failover logic.
|
|
223
|
+
* The origin group can be referenced later via origin ID.
|
|
224
|
+
* @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/helper-functions-origin-modification.html#create-request-origin-group-helper-function
|
|
225
|
+
*/
|
|
226
|
+
function createRequestOriginGroup(params: CreateRequestOriginGroupParams): void;
|
|
227
|
+
|
|
228
|
+
const cf: {
|
|
229
|
+
kvs: typeof kvs;
|
|
230
|
+
updateRequestOrigin: typeof updateRequestOrigin;
|
|
231
|
+
selectRequestOriginById: typeof selectRequestOriginById;
|
|
232
|
+
createRequestOriginGroup: typeof createRequestOriginGroup;
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
export default cf;
|
|
236
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/aws-cloudfront-function",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "TypeScript definitions for aws-cloudfront-function",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/aws-cloudfront-function",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
},
|
|
21
21
|
"scripts": {},
|
|
22
22
|
"dependencies": {},
|
|
23
|
-
"
|
|
24
|
-
"
|
|
23
|
+
"peerDependencies": {},
|
|
24
|
+
"typesPublisherContentHash": "18d63985b8398ead9fb85a52dced513fd638e504749bd5de2c46ae9675ddbfcf",
|
|
25
|
+
"typeScriptVersion": "5.2",
|
|
25
26
|
"nonNpm": true
|
|
26
27
|
}
|