@rayselfs/cf-rule-engine 1.6.2 → 1.7.0

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,7 +6,7 @@ var _chunkPPUHEL4Hcjs = require('../chunk-PPUHEL4H.cjs');
6
6
  var _chunkB4WEJSEZcjs = require('../chunk-B4WEJSEZ.cjs');
7
7
 
8
8
 
9
- var _chunkUI6LKDJIcjs = require('../chunk-UI6LKDJI.cjs');
9
+ var _chunk3UXNXJ6Ncjs = require('../chunk-3UXNXJ6N.cjs');
10
10
 
11
11
 
12
12
  var _chunkMSES76XKcjs = require('../chunk-MSES76XK.cjs');
@@ -123,4 +123,4 @@ function verifyToken(options) {
123
123
 
124
124
 
125
125
 
126
- exports.constructResponse = _chunkOSGZTNTScjs.constructResponse; exports.copyHeader = _chunkJU5WX5RUcjs.copyHeader; exports.directoryIndex = _chunkLTLBEBKLcjs.directoryIndex; exports.imageOptimize = _chunkKXC6ES3Bcjs.imageOptimize; exports.redirect = _chunkWWSRNCUPcjs.redirect; exports.removeResponseHeaders = _chunkSGEBNQR2cjs.removeResponseHeaders; exports.rewriteUri = _chunkMRPTC74Icjs.rewriteUri; exports.setCacheControl = _chunkCV234DQTcjs.setCacheControl; exports.setCorsHeaders = _chunkGK5JX7OMcjs.setCorsHeaders; exports.setCsp = _chunkZXS23HXAcjs.setCsp; exports.setRequestHeader = _chunkPPUHEL4Hcjs.setRequestHeader; exports.setResponseHeader = _chunkB4WEJSEZcjs.setResponseHeader; exports.setSecurityHeaders = _chunkUI6LKDJIcjs.setSecurityHeaders; exports.stripQueryParams = _chunkMSES76XKcjs.stripQueryParams; exports.verifyToken = verifyToken;
126
+ exports.constructResponse = _chunkOSGZTNTScjs.constructResponse; exports.copyHeader = _chunkJU5WX5RUcjs.copyHeader; exports.directoryIndex = _chunkLTLBEBKLcjs.directoryIndex; exports.imageOptimize = _chunkKXC6ES3Bcjs.imageOptimize; exports.redirect = _chunkWWSRNCUPcjs.redirect; exports.removeResponseHeaders = _chunkSGEBNQR2cjs.removeResponseHeaders; exports.rewriteUri = _chunkMRPTC74Icjs.rewriteUri; exports.setCacheControl = _chunkCV234DQTcjs.setCacheControl; exports.setCorsHeaders = _chunkGK5JX7OMcjs.setCorsHeaders; exports.setCsp = _chunkZXS23HXAcjs.setCsp; exports.setRequestHeader = _chunkPPUHEL4Hcjs.setRequestHeader; exports.setResponseHeader = _chunkB4WEJSEZcjs.setResponseHeader; exports.setSecurityHeaders = _chunk3UXNXJ6Ncjs.setSecurityHeaders; exports.stripQueryParams = _chunkMSES76XKcjs.stripQueryParams; exports.verifyToken = verifyToken;
@@ -6,7 +6,7 @@ import {
6
6
  } from "../chunk-RBBKFG5J.js";
7
7
  import {
8
8
  setSecurityHeaders
9
- } from "../chunk-VQCRSBWL.js";
9
+ } from "../chunk-O4SOSGAP.js";
10
10
  import {
11
11
  stripQueryParams
12
12
  } from "../chunk-XPQG5IML.js";
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkUI6LKDJIcjs = require('../chunk-UI6LKDJI.cjs');
3
+ var _chunk3UXNXJ6Ncjs = require('../chunk-3UXNXJ6N.cjs');
4
4
  require('../chunk-75ZPJI57.cjs');
5
5
 
6
6
 
7
- exports.setSecurityHeaders = _chunkUI6LKDJIcjs.setSecurityHeaders;
7
+ exports.setSecurityHeaders = _chunk3UXNXJ6Ncjs.setSecurityHeaders;
@@ -1,55 +1,71 @@
1
1
  import { ResponseBehaviorFn } from '../core/types.cjs';
2
2
 
3
3
  /**
4
- * Options for overriding individual security header values.
5
- * All fields are optional; omitted fields fall back to their secure defaults.
4
+ * Options for individual security header values.
5
+ *
6
+ * Only headers with a provided value are emitted — omitted fields are **not** added to the
7
+ * response. There are no built-in defaults; every emitted header value is explicit.
8
+ *
9
+ * Pass at least one field.
6
10
  */
7
11
  interface SecurityHeadersOptions {
8
12
  /**
9
13
  * Value for the `Strict-Transport-Security` header.
10
- * Default: `'max-age=31536000; includeSubDomains'`
14
+ * Example: `'max-age=31536000; includeSubDomains'`
11
15
  */
12
16
  hsts?: string;
13
17
  /**
14
18
  * Value for the `X-Frame-Options` header. Controls whether the page can be
15
19
  * embedded in an iframe. Common values: `'DENY'`, `'SAMEORIGIN'`.
16
- * Default: `'SAMEORIGIN'`
17
20
  */
18
21
  xFrameOptions?: string;
19
22
  /**
20
23
  * Value for the `X-Content-Type-Options` header. Set to `'nosniff'` to
21
24
  * prevent browsers from MIME-sniffing the response content type.
22
- * Default: `'nosniff'`
23
25
  */
24
26
  xContentTypeOptions?: string;
27
+ /**
28
+ * Value for the `X-XSS-Protection` header.
29
+ * Example: `'1; mode=block'`
30
+ *
31
+ * Note: deprecated in modern browsers but still used for legacy compatibility.
32
+ */
33
+ xXssProtection?: string;
25
34
  }
26
35
  /**
27
- * Sets common security headers on the outgoing response.
36
+ * Sets security headers on the outgoing response.
37
+ *
38
+ * Only headers explicitly provided in `options` are emitted — there are **no built-in
39
+ * defaults**. This avoids silently overriding headers set elsewhere in the pipeline and
40
+ * lets Akamai-migrated properties carry their original values verbatim.
28
41
  *
29
- * Applied headers and their defaults:
30
- * - `Strict-Transport-Security`: `max-age=31536000; includeSubDomains`
31
- * - `X-Frame-Options`: `SAMEORIGIN`
32
- * - `X-Content-Type-Options`: `nosniff`
42
+ * Supported headers:
43
+ * - `Strict-Transport-Security` (`hsts`)
44
+ * - `X-Frame-Options` (`xFrameOptions`)
45
+ * - `X-Content-Type-Options` (`xContentTypeOptions`)
46
+ * - `X-XSS-Protection` (`xXssProtection`)
33
47
  *
34
- * Akamai equivalent: `httpStrictTransportSecurity` behavior (HSTS only).
48
+ * Akamai equivalents: `httpStrictTransportSecurity` (HSTS), `modifyOutgoingResponseHeader`
49
+ * (frame options, content-type options, XSS protection).
35
50
  *
36
- * @param options - Optional overrides for individual header values.
37
- * @returns A `ResponseBehaviorFn` to use directly in `defineViewerResponse` or wrapped in a `ResponseRule`.
51
+ * @param options - Security header values to set. Pass at least one field.
52
+ * @returns A `ResponseBehaviorFn` to use in `defineViewerResponse` or a `ResponseRule`.
38
53
  *
39
54
  * @example
40
55
  * ```ts
41
56
  * import { setSecurityHeaders } from '@rayselfs/cf-rule-engine/behaviors'
42
57
  * import { defineViewerResponse } from '@rayselfs/cf-rule-engine/adapters/cf-function'
43
58
  *
44
- * // Apply defaults
45
- * export default defineViewerResponse([setSecurityHeaders()])
46
- *
47
- * // Override HSTS and frame options
48
59
  * export default defineViewerResponse([
49
- * setSecurityHeaders({ hsts: 'max-age=63072000; includeSubDomains; preload', xFrameOptions: 'DENY' }),
60
+ * setSecurityHeaders({
61
+ * hsts: 'max-age=31536000; includeSubDomains',
62
+ * xFrameOptions: 'SAMEORIGIN',
63
+ * xContentTypeOptions: 'nosniff',
64
+ * xXssProtection: '1; mode=block',
65
+ * }),
50
66
  * ])
51
67
  * ```
52
68
  */
53
- declare function setSecurityHeaders(options?: SecurityHeadersOptions): ResponseBehaviorFn;
69
+ declare function setSecurityHeaders(options: SecurityHeadersOptions): ResponseBehaviorFn;
54
70
 
55
71
  export { type SecurityHeadersOptions, setSecurityHeaders };
@@ -1,55 +1,71 @@
1
1
  import { ResponseBehaviorFn } from '../core/types.js';
2
2
 
3
3
  /**
4
- * Options for overriding individual security header values.
5
- * All fields are optional; omitted fields fall back to their secure defaults.
4
+ * Options for individual security header values.
5
+ *
6
+ * Only headers with a provided value are emitted — omitted fields are **not** added to the
7
+ * response. There are no built-in defaults; every emitted header value is explicit.
8
+ *
9
+ * Pass at least one field.
6
10
  */
7
11
  interface SecurityHeadersOptions {
8
12
  /**
9
13
  * Value for the `Strict-Transport-Security` header.
10
- * Default: `'max-age=31536000; includeSubDomains'`
14
+ * Example: `'max-age=31536000; includeSubDomains'`
11
15
  */
12
16
  hsts?: string;
13
17
  /**
14
18
  * Value for the `X-Frame-Options` header. Controls whether the page can be
15
19
  * embedded in an iframe. Common values: `'DENY'`, `'SAMEORIGIN'`.
16
- * Default: `'SAMEORIGIN'`
17
20
  */
18
21
  xFrameOptions?: string;
19
22
  /**
20
23
  * Value for the `X-Content-Type-Options` header. Set to `'nosniff'` to
21
24
  * prevent browsers from MIME-sniffing the response content type.
22
- * Default: `'nosniff'`
23
25
  */
24
26
  xContentTypeOptions?: string;
27
+ /**
28
+ * Value for the `X-XSS-Protection` header.
29
+ * Example: `'1; mode=block'`
30
+ *
31
+ * Note: deprecated in modern browsers but still used for legacy compatibility.
32
+ */
33
+ xXssProtection?: string;
25
34
  }
26
35
  /**
27
- * Sets common security headers on the outgoing response.
36
+ * Sets security headers on the outgoing response.
37
+ *
38
+ * Only headers explicitly provided in `options` are emitted — there are **no built-in
39
+ * defaults**. This avoids silently overriding headers set elsewhere in the pipeline and
40
+ * lets Akamai-migrated properties carry their original values verbatim.
28
41
  *
29
- * Applied headers and their defaults:
30
- * - `Strict-Transport-Security`: `max-age=31536000; includeSubDomains`
31
- * - `X-Frame-Options`: `SAMEORIGIN`
32
- * - `X-Content-Type-Options`: `nosniff`
42
+ * Supported headers:
43
+ * - `Strict-Transport-Security` (`hsts`)
44
+ * - `X-Frame-Options` (`xFrameOptions`)
45
+ * - `X-Content-Type-Options` (`xContentTypeOptions`)
46
+ * - `X-XSS-Protection` (`xXssProtection`)
33
47
  *
34
- * Akamai equivalent: `httpStrictTransportSecurity` behavior (HSTS only).
48
+ * Akamai equivalents: `httpStrictTransportSecurity` (HSTS), `modifyOutgoingResponseHeader`
49
+ * (frame options, content-type options, XSS protection).
35
50
  *
36
- * @param options - Optional overrides for individual header values.
37
- * @returns A `ResponseBehaviorFn` to use directly in `defineViewerResponse` or wrapped in a `ResponseRule`.
51
+ * @param options - Security header values to set. Pass at least one field.
52
+ * @returns A `ResponseBehaviorFn` to use in `defineViewerResponse` or a `ResponseRule`.
38
53
  *
39
54
  * @example
40
55
  * ```ts
41
56
  * import { setSecurityHeaders } from '@rayselfs/cf-rule-engine/behaviors'
42
57
  * import { defineViewerResponse } from '@rayselfs/cf-rule-engine/adapters/cf-function'
43
58
  *
44
- * // Apply defaults
45
- * export default defineViewerResponse([setSecurityHeaders()])
46
- *
47
- * // Override HSTS and frame options
48
59
  * export default defineViewerResponse([
49
- * setSecurityHeaders({ hsts: 'max-age=63072000; includeSubDomains; preload', xFrameOptions: 'DENY' }),
60
+ * setSecurityHeaders({
61
+ * hsts: 'max-age=31536000; includeSubDomains',
62
+ * xFrameOptions: 'SAMEORIGIN',
63
+ * xContentTypeOptions: 'nosniff',
64
+ * xXssProtection: '1; mode=block',
65
+ * }),
50
66
  * ])
51
67
  * ```
52
68
  */
53
- declare function setSecurityHeaders(options?: SecurityHeadersOptions): ResponseBehaviorFn;
69
+ declare function setSecurityHeaders(options: SecurityHeadersOptions): ResponseBehaviorFn;
54
70
 
55
71
  export { type SecurityHeadersOptions, setSecurityHeaders };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  setSecurityHeaders
3
- } from "../chunk-VQCRSBWL.js";
3
+ } from "../chunk-O4SOSGAP.js";
4
4
  import "../chunk-MLKGABMK.js";
5
5
  export {
6
6
  setSecurityHeaders
@@ -0,0 +1,21 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/behaviors/set-security-headers.ts
2
+ function setSecurityHeaders(options) {
3
+ return (_request, response) => {
4
+ const extra = {};
5
+ if (options.hsts !== void 0)
6
+ extra["strict-transport-security"] = { value: options.hsts };
7
+ if (options.xFrameOptions !== void 0)
8
+ extra["x-frame-options"] = { value: options.xFrameOptions };
9
+ if (options.xContentTypeOptions !== void 0)
10
+ extra["x-content-type-options"] = { value: options.xContentTypeOptions };
11
+ if (options.xXssProtection !== void 0)
12
+ extra["x-xss-protection"] = { value: options.xXssProtection };
13
+ return Object.assign({}, response, {
14
+ headers: Object.assign({}, response.headers, extra)
15
+ });
16
+ };
17
+ }
18
+
19
+
20
+
21
+ exports.setSecurityHeaders = setSecurityHeaders;
@@ -0,0 +1,21 @@
1
+ // src/behaviors/set-security-headers.ts
2
+ function setSecurityHeaders(options) {
3
+ return (_request, response) => {
4
+ const extra = {};
5
+ if (options.hsts !== void 0)
6
+ extra["strict-transport-security"] = { value: options.hsts };
7
+ if (options.xFrameOptions !== void 0)
8
+ extra["x-frame-options"] = { value: options.xFrameOptions };
9
+ if (options.xContentTypeOptions !== void 0)
10
+ extra["x-content-type-options"] = { value: options.xContentTypeOptions };
11
+ if (options.xXssProtection !== void 0)
12
+ extra["x-xss-protection"] = { value: options.xXssProtection };
13
+ return Object.assign({}, response, {
14
+ headers: Object.assign({}, response.headers, extra)
15
+ });
16
+ };
17
+ }
18
+
19
+ export {
20
+ setSecurityHeaders
21
+ };
@@ -1,17 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkG7JGTBTTcjs = require('../chunk-G7JGTBTT.cjs');
4
-
5
-
6
- var _chunkMVGYPBYBcjs = require('../chunk-MVGYPBYB.cjs');
7
-
8
-
9
- var _chunk32SMWYAFcjs = require('../chunk-32SMWYAF.cjs');
10
-
11
-
12
- var _chunkL7NBJ4JAcjs = require('../chunk-L7NBJ4JA.cjs');
13
-
14
-
15
3
  var _chunkJGJW7D2Ncjs = require('../chunk-JGJW7D2N.cjs');
16
4
 
17
5
 
@@ -26,6 +14,12 @@ var _chunkVEEOQ7TScjs = require('../chunk-VEEOQ7TS.cjs');
26
14
 
27
15
 
28
16
  var _chunkCF5PWWTFcjs = require('../chunk-CF5PWWTF.cjs');
17
+
18
+
19
+ var _chunkG7JGTBTTcjs = require('../chunk-G7JGTBTT.cjs');
20
+
21
+
22
+ var _chunkMVGYPBYBcjs = require('../chunk-MVGYPBYB.cjs');
29
23
  require('../chunk-IBXAK2A4.cjs');
30
24
 
31
25
 
@@ -33,6 +27,12 @@ var _chunkOSZWDCTScjs = require('../chunk-OSZWDCTS.cjs');
33
27
 
34
28
 
35
29
  var _chunkU54FZCOHcjs = require('../chunk-U54FZCOH.cjs');
30
+
31
+
32
+ var _chunk32SMWYAFcjs = require('../chunk-32SMWYAF.cjs');
33
+
34
+
35
+ var _chunkL7NBJ4JAcjs = require('../chunk-L7NBJ4JA.cjs');
36
36
  require('../chunk-75ZPJI57.cjs');
37
37
 
38
38
 
@@ -1,15 +1,3 @@
1
- import {
2
- pathPrefix
3
- } from "../chunk-XLSZ5RB7.js";
4
- import {
5
- userAgentMatches
6
- } from "../chunk-S2AAATFN.js";
7
- import {
8
- headerContains
9
- } from "../chunk-SRQF5UEJ.js";
10
- import {
11
- headerEquals
12
- } from "../chunk-BZQJYOU2.js";
13
1
  import {
14
2
  hostnameIs
15
3
  } from "../chunk-3PVDUC5M.js";
@@ -26,6 +14,12 @@ import {
26
14
  import {
27
15
  pathMatches
28
16
  } from "../chunk-LO2BO3RU.js";
17
+ import {
18
+ pathPrefix
19
+ } from "../chunk-XLSZ5RB7.js";
20
+ import {
21
+ userAgentMatches
22
+ } from "../chunk-S2AAATFN.js";
29
23
  import "../chunk-2DE6WPPL.js";
30
24
  import {
31
25
  countryIs
@@ -33,6 +27,12 @@ import {
33
27
  import {
34
28
  fileExtension
35
29
  } from "../chunk-LBJUCJF2.js";
30
+ import {
31
+ headerContains
32
+ } from "../chunk-SRQF5UEJ.js";
33
+ import {
34
+ headerEquals
35
+ } from "../chunk-BZQJYOU2.js";
36
36
  import "../chunk-MLKGABMK.js";
37
37
  export {
38
38
  countryIs,
@@ -6,18 +6,18 @@ var _chunk63WIEBQBcjs = require('../chunk-63WIEBQB.cjs');
6
6
  var _chunkLSCC62CZcjs = require('../chunk-LSCC62CZ.cjs');
7
7
 
8
8
 
9
- var _chunkT5EXFHVAcjs = require('../chunk-T5EXFHVA.cjs');
10
- require('../chunk-MVGYPBYB.cjs');
11
-
12
-
13
- var _chunkL7NBJ4JAcjs = require('../chunk-L7NBJ4JA.cjs');
9
+ var _chunkMO7HW25Rcjs = require('../chunk-MO7HW25R.cjs');
14
10
  require('../chunk-D47P7HVZ.cjs');
15
11
  require('../chunk-YVUR35RN.cjs');
16
12
  require('../chunk-OTFDML3K.cjs');
17
13
  require('../chunk-CF5PWWTF.cjs');
14
+ require('../chunk-MVGYPBYB.cjs');
18
15
  require('../chunk-IBXAK2A4.cjs');
19
16
 
20
17
 
18
+ var _chunkL7NBJ4JAcjs = require('../chunk-L7NBJ4JA.cjs');
19
+
20
+
21
21
  var _chunkB4WEJSEZcjs = require('../chunk-B4WEJSEZ.cjs');
22
22
  require('../chunk-WWSRNCUP.cjs');
23
23
  require('../chunk-WKYMSRCD.cjs');
@@ -39,4 +39,4 @@ function stagingIndicator() {
39
39
 
40
40
 
41
41
 
42
- exports.preflightRequest = _chunk63WIEBQBcjs.preflightRequest; exports.sendCountryCode = _chunkLSCC62CZcjs.sendCountryCode; exports.stagingIndicator = stagingIndicator; exports.whitelist = _chunkT5EXFHVAcjs.whitelist;
42
+ exports.preflightRequest = _chunk63WIEBQBcjs.preflightRequest; exports.sendCountryCode = _chunkLSCC62CZcjs.sendCountryCode; exports.stagingIndicator = stagingIndicator; exports.whitelist = _chunkMO7HW25Rcjs.whitelist;
@@ -6,16 +6,16 @@ import {
6
6
  } from "../chunk-C32DL3EP.js";
7
7
  import {
8
8
  whitelist
9
- } from "../chunk-RL7ZETZR.js";
10
- import "../chunk-S2AAATFN.js";
11
- import {
12
- headerEquals
13
- } from "../chunk-BZQJYOU2.js";
9
+ } from "../chunk-ER2YEZZO.js";
14
10
  import "../chunk-KW5YBTSD.js";
15
11
  import "../chunk-LNQPYKGG.js";
16
12
  import "../chunk-PY3JMRDG.js";
17
13
  import "../chunk-LO2BO3RU.js";
14
+ import "../chunk-S2AAATFN.js";
18
15
  import "../chunk-2DE6WPPL.js";
16
+ import {
17
+ headerEquals
18
+ } from "../chunk-BZQJYOU2.js";
19
19
  import {
20
20
  setResponseHeader
21
21
  } from "../chunk-RBBKFG5J.js";
@@ -1,14 +1,14 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkT5EXFHVAcjs = require('../chunk-T5EXFHVA.cjs');
4
- require('../chunk-MVGYPBYB.cjs');
3
+ var _chunkMO7HW25Rcjs = require('../chunk-MO7HW25R.cjs');
5
4
  require('../chunk-D47P7HVZ.cjs');
6
5
  require('../chunk-YVUR35RN.cjs');
7
6
  require('../chunk-CF5PWWTF.cjs');
7
+ require('../chunk-MVGYPBYB.cjs');
8
8
  require('../chunk-IBXAK2A4.cjs');
9
9
  require('../chunk-WWSRNCUP.cjs');
10
10
  require('../chunk-WKYMSRCD.cjs');
11
11
  require('../chunk-75ZPJI57.cjs');
12
12
 
13
13
 
14
- exports.whitelist = _chunkT5EXFHVAcjs.whitelist;
14
+ exports.whitelist = _chunkMO7HW25Rcjs.whitelist;
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  whitelist
3
- } from "../chunk-RL7ZETZR.js";
4
- import "../chunk-S2AAATFN.js";
3
+ } from "../chunk-ER2YEZZO.js";
5
4
  import "../chunk-KW5YBTSD.js";
6
5
  import "../chunk-LNQPYKGG.js";
7
6
  import "../chunk-LO2BO3RU.js";
7
+ import "../chunk-S2AAATFN.js";
8
8
  import "../chunk-2DE6WPPL.js";
9
9
  import "../chunk-DSSFFJWL.js";
10
10
  import "../chunk-Q4NP4C3B.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rayselfs/cf-rule-engine",
3
- "version": "1.6.2",
3
+ "version": "1.7.0",
4
4
  "description": "Composable, tree-shakeable CloudFront Function rules",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
@@ -1,19 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/behaviors/set-security-headers.ts
2
- function setSecurityHeaders(options) {
3
- const hsts = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _ => _.hsts]), () => ( "max-age=31536000; includeSubDomains"));
4
- const xFrameOptions = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _2 => _2.xFrameOptions]), () => ( "SAMEORIGIN"));
5
- const xContentTypeOptions = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _3 => _3.xContentTypeOptions]), () => ( "nosniff"));
6
- return (_request, response) => {
7
- return Object.assign({}, response, {
8
- headers: Object.assign({}, response.headers, {
9
- "strict-transport-security": { value: hsts },
10
- "x-frame-options": { value: xFrameOptions },
11
- "x-content-type-options": { value: xContentTypeOptions }
12
- })
13
- });
14
- };
15
- }
16
-
17
-
18
-
19
- exports.setSecurityHeaders = setSecurityHeaders;
@@ -1,19 +0,0 @@
1
- // src/behaviors/set-security-headers.ts
2
- function setSecurityHeaders(options) {
3
- const hsts = options?.hsts ?? "max-age=31536000; includeSubDomains";
4
- const xFrameOptions = options?.xFrameOptions ?? "SAMEORIGIN";
5
- const xContentTypeOptions = options?.xContentTypeOptions ?? "nosniff";
6
- return (_request, response) => {
7
- return Object.assign({}, response, {
8
- headers: Object.assign({}, response.headers, {
9
- "strict-transport-security": { value: hsts },
10
- "x-frame-options": { value: xFrameOptions },
11
- "x-content-type-options": { value: xContentTypeOptions }
12
- })
13
- });
14
- };
15
- }
16
-
17
- export {
18
- setSecurityHeaders
19
- };
@@ -1,12 +1,12 @@
1
- import {
2
- userAgentMatches
3
- } from "./chunk-S2AAATFN.js";
4
1
  import {
5
2
  ipCidr
6
3
  } from "./chunk-KW5YBTSD.js";
7
4
  import {
8
5
  pathMatches
9
6
  } from "./chunk-LO2BO3RU.js";
7
+ import {
8
+ userAgentMatches
9
+ } from "./chunk-S2AAATFN.js";
10
10
  import {
11
11
  redirect
12
12
  } from "./chunk-DSSFFJWL.js";
@@ -1,14 +1,14 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
- var _chunkMVGYPBYBcjs = require('./chunk-MVGYPBYB.cjs');
4
-
5
-
6
3
  var _chunkD47P7HVZcjs = require('./chunk-D47P7HVZ.cjs');
7
4
 
8
5
 
9
6
  var _chunkCF5PWWTFcjs = require('./chunk-CF5PWWTF.cjs');
10
7
 
11
8
 
9
+ var _chunkMVGYPBYBcjs = require('./chunk-MVGYPBYB.cjs');
10
+
11
+
12
12
  var _chunkWWSRNCUPcjs = require('./chunk-WWSRNCUP.cjs');
13
13
 
14
14