11declare module 'fastly:cache-override' {
2+ interface ICacheOverride {
3+ /**
4+ * The cache key for this cache entry
5+ */
6+ cacheKey ?: string | undefined ;
7+ /**
8+ * Override the caching behavior of this request/response to use the given Time to Live (TTL), in seconds.
9+ */
10+ ttl ?: number | undefined ;
11+ /**
12+ * Override the caching behavior of this request/response to use the given `stale-while-revalidate` time,
13+ * in seconds
14+ */
15+ swr ?: number | undefined ;
16+ /**
17+ * Override the caching behavior of this request/response to include the given surrogate key, provided as
18+ * a header value.
19+ *
20+ * See the [Fastly surrogate keys guide](https://docs.fastly.com/en/guides/purging-api-cache-with-surrogate-keys)
21+ * for details.
22+ */
23+ surrogateKeys ?: Set < string > ;
24+ /**
25+ * Override the caching behavior of this request/response to include the given surrogate keys, provided as
26+ * a header value.
27+ *
28+ * See the [Fastly surrogate keys guide](https://docs.fastly.com/en/guides/purging-api-cache-with-surrogate-keys)
29+ * for details.
30+ */
31+ surrogateKey ?: string | undefined ;
32+ /**
33+ * Override the caching behavior of this request/response to enable or disable PCI/HIPAA-compliant
34+ * non-volatile caching.
35+ *
36+ * By default, this is false, which means the request may not be PCI/HIPAA-compliant. Set it to
37+ * true to enable compliant caching.
38+ *
39+ * See the [Fastly PCI-Compliant Caching and Delivery documentation](https://docs.fastly.com/products/pci-compliant-caching-and-delivery)
40+ * for details.
41+ */
42+ pci ?: boolean ;
43+ /**
44+ * Get or set the set of request headers for which the response may vary.
45+ */
46+ vary ?: Set < string > ;
47+ }
48+
249 /**
350 * Configures the caching behavior of a {@linkcode "globals".Response}.
451 *
@@ -64,6 +111,7 @@ declare module 'fastly:cache-override' {
64111 * ```
65112 * </noscript>
66113 */
114+
67115 class CacheOverride {
68116 /**
69117 * @param mode Sets the cache override mode for a request
@@ -73,41 +121,12 @@ declare module 'fastly:cache-override' {
73121 * - "pass": Do not cache the response to this request, regardless of the origin response’s headers.
74122 * - "override": Override particular cache control settings using a {@linkcode CacheOverride} object.
75123 *
76- * @param [init]
77- *
78- * @param {number } [init.ttl]
79- * Override the caching behavior of this request to use the given Time to Live (TTL), in seconds.
80- *
81- * @param {number } [init.swr]
82- * Override the caching behavior of this request to use the given `stale-while-revalidate` time,
83- * in seconds
84- *
85- * @param {string } [init.surrogateKey]
86- * Override the caching behavior of this request to include the given surrogate key, provided as
87- * a header value.
88- *
89- * See the [Fastly surrogate keys guide](https://docs.fastly.com/en/guides/purging-api-cache-with-surrogate-keys)
90- * for details.
91- *
92- * @param {boolean } [init.pci]
93- * Override the caching behavior of this request to enable or disable PCI/HIPAA-compliant
94- * non-volatile caching.
124+ * @param [init] Init options for the cache override
95125 *
96- * By default, this is false, which means the request may not be PCI/HIPAA-compliant. Set it to
97- * true to enable compliant caching.
98- *
99- * See the [Fastly PCI-Compliant Caching and Delivery documentation](https://docs.fastly.com/products/pci-compliant-caching-and-delivery)
100- * for details.
101126 */
102- constructor (
103- mode : 'none' | 'pass' | 'override' ,
104- init ?: {
105- ttl ?: number ;
106- swr ?: number ;
107- surrogateKey ?: string ;
108- pci ?: boolean ;
109- } ,
110- ) ;
127+ constructor ( mode : 'none' | 'pass' | 'override' , init ?: ICacheOverride ) ;
128+
129+ cacheKey ?: string ;
111130
112131 /**
113132 * Sets the cache override mode for a request
@@ -121,20 +140,28 @@ declare module 'fastly:cache-override' {
121140 /**
122141 * Override the caching behavior of this request to use the given Time to Live (TTL), in seconds.
123142 */
124- public ttl ? : number ;
143+ public ttl : number | undefined ;
125144 /**
126145 * Override the caching behavior of this request to use the given `stale-while-revalidate` time,
127146 * in seconds
128147 */
129- public swr ? : number ;
148+ public swr : number | undefined ;
130149 /**
131150 * Override the caching behavior of this request to include the given surrogate key, provided as
132151 * a header value.
133152 *
134153 * See the [Fastly surrogate keys guide](https://docs.fastly.com/en/guides/purging-api-cache-with-surrogate-keys)
135154 * for details.
136155 */
137- public surrogateKey ?: string ;
156+ public surrogateKey : string | undefined ;
157+ /**
158+ * Override the caching behavior of this request to include the given surrogate key, provided as
159+ * a header value.
160+ *
161+ * See the [Fastly surrogate keys guide](https://docs.fastly.com/en/guides/purging-api-cache-with-surrogate-keys)
162+ * for details.
163+ */
164+ public surrogateKeys : Set < string > | undefined ;
138165 /**
139166 * Override the caching behavior of this request to enable or disable PCI/HIPAA-compliant
140167 * non-volatile caching.
@@ -145,6 +172,10 @@ declare module 'fastly:cache-override' {
145172 * See the [Fastly PCI-Compliant Caching and Delivery documentation](https://docs.fastly.com/products/pci-compliant-caching-and-delivery)
146173 * for details.
147174 */
148- public pci ?: boolean ;
175+ public pci : boolean | undefined ;
176+ /**
177+ * Get or set the set of request headers for which the response may vary.
178+ */
179+ public vary : Set < string > | undefined ;
149180 }
150181}
0 commit comments