perimeterx-js-core 0.31.0 → 0.32.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.
Files changed (109) hide show
  1. package/lib/cjs/config/ConfigurationBase.js +1 -0
  2. package/lib/cjs/config/params/CreateHumanSecurityConfigurationParams.js +2 -0
  3. package/lib/cjs/config/params/index.js +1 -0
  4. package/lib/cjs/flow/EnforceFlow.js +2 -1
  5. package/lib/cjs/phase/impl/BlockByHeaderPhase.js +76 -0
  6. package/lib/cjs/phase/impl/index.js +1 -0
  7. package/lib/cjs/products/utils/ProductName.js +1 -0
  8. package/lib/cjs/products/utils/ProductPriorityOrder.js +1 -0
  9. package/lib/cjs/utils/constants.js +5 -2
  10. package/lib/esm/config/ConfigurationBase.js +1 -0
  11. package/lib/esm/config/params/CreateHumanSecurityConfigurationParams.js +1 -0
  12. package/lib/esm/config/params/index.js +1 -0
  13. package/lib/esm/flow/EnforceFlow.js +3 -2
  14. package/lib/esm/phase/impl/BlockByHeaderPhase.js +72 -0
  15. package/lib/esm/phase/impl/index.js +1 -0
  16. package/lib/esm/products/utils/ProductName.js +1 -0
  17. package/lib/esm/products/utils/ProductPriorityOrder.js +1 -0
  18. package/lib/esm/utils/constants.js +4 -1
  19. package/lib/types/activities/HttpActivityClient.d.ts +3 -3
  20. package/lib/types/activities/HttpBatchedActivityClient.d.ts +2 -2
  21. package/lib/types/activities/utils.d.ts +5 -5
  22. package/lib/types/additional_activity_handler/AdditionalActivityHandler.d.ts +1 -1
  23. package/lib/types/additional_activity_handler/AdditionalActivityHandlerUtils.d.ts +1 -1
  24. package/lib/types/blocker/MobileBlocker.d.ts +3 -3
  25. package/lib/types/blocker/utils.d.ts +1 -1
  26. package/lib/types/config/ConfigurationBase.d.ts +22 -22
  27. package/lib/types/config/IConfiguration.d.ts +9 -9
  28. package/lib/types/config/defaults/DefaultConfigurationParams.d.ts +1 -1
  29. package/lib/types/config/params/ActiveConfigurationParams.d.ts +8 -2
  30. package/lib/types/config/params/AllConfigurationParams.d.ts +6 -3
  31. package/lib/types/config/params/CoreConfigurationParams.d.ts +24 -7
  32. package/lib/types/config/params/CreateHumanSecurityConfigurationParams.d.ts +2 -0
  33. package/lib/types/config/params/RemoteConfigurationParams.d.ts +3 -2
  34. package/lib/types/config/params/StaticConfigurationParams.d.ts +5 -3
  35. package/lib/types/config/params/index.d.ts +1 -0
  36. package/lib/types/config/remote_config/RemoteConfigUtils.d.ts +1 -1
  37. package/lib/types/config/remote_config/manager/DefaultRemoteConfigManager.d.ts +10 -10
  38. package/lib/types/config/remote_config/model/RemoteConfigData.d.ts +2 -2
  39. package/lib/types/config/remote_config/service_client/HttpRemoteConfigServiceClient.d.ts +5 -5
  40. package/lib/types/config/remote_config/service_client/IRemoteConfigServiceClient.d.ts +2 -2
  41. package/lib/types/config/remote_config/storage_client/IRemoteConfigStorageClient.d.ts +3 -3
  42. package/lib/types/config/remote_config/update_parser/DefaultNotifyRemoteConfigUpdateParser.d.ts +3 -3
  43. package/lib/types/context/DefaultContext.d.ts +8 -8
  44. package/lib/types/context/SerializedContext.d.ts +4 -4
  45. package/lib/types/cors/DefaultCors.d.ts +2 -2
  46. package/lib/types/custom_parameters/CustomParametersFunction.d.ts +2 -2
  47. package/lib/types/custom_parameters/CustomParametersUtils.d.ts +2 -2
  48. package/lib/types/enforcer/EnforcerBase.d.ts +8 -8
  49. package/lib/types/enforcer/EnforcerOptions.d.ts +3 -3
  50. package/lib/types/enforcer/utils.d.ts +6 -6
  51. package/lib/types/flow/EndEnforcerFlow.d.ts +2 -2
  52. package/lib/types/flow/EnforceFlow.d.ts +3 -3
  53. package/lib/types/flow/FilterFlow.d.ts +2 -2
  54. package/lib/types/flow/PostEnforceFlow.d.ts +2 -2
  55. package/lib/types/graphql/DefaultGraphQLParser.d.ts +3 -3
  56. package/lib/types/logger/HttpLogServiceClient.d.ts +3 -3
  57. package/lib/types/monitored_request/MonitoredRequestUtils.d.ts +3 -3
  58. package/lib/types/phase/impl/AdditionalActivityHandlerPhase.d.ts +3 -3
  59. package/lib/types/phase/impl/BlockByHeaderPhase.d.ts +40 -0
  60. package/lib/types/phase/impl/CreateBlockResponsePhase.d.ts +3 -3
  61. package/lib/types/phase/impl/EnrichContextFromRequestPhase.d.ts +3 -3
  62. package/lib/types/phase/impl/EnrichContextFromResponsePhase.d.ts +3 -3
  63. package/lib/types/phase/impl/FirstPartyPhase.d.ts +3 -3
  64. package/lib/types/phase/impl/ModifyOutgoingResponsePhase.d.ts +3 -3
  65. package/lib/types/phase/impl/PreflightPhase.d.ts +2 -2
  66. package/lib/types/phase/impl/SendAsyncActivitiesPhase.d.ts +3 -3
  67. package/lib/types/phase/impl/SendLogsPhase.d.ts +2 -2
  68. package/lib/types/phase/impl/SendTelemetryActivityPhase.d.ts +3 -3
  69. package/lib/types/phase/impl/UpdateRemoteConfigPhase.d.ts +3 -3
  70. package/lib/types/phase/impl/index.d.ts +1 -0
  71. package/lib/types/products/account_defender/AccountDefender.d.ts +3 -3
  72. package/lib/types/products/bot_defender/BotDefender.d.ts +3 -3
  73. package/lib/types/products/bot_defender/block/DefaultBotDefenderBlocker.d.ts +3 -3
  74. package/lib/types/products/bot_defender/block/captcha/CaptchaBlocker.d.ts +12 -12
  75. package/lib/types/products/bot_defender/block/captcha/HtmlCaptchaBlocker.d.ts +5 -5
  76. package/lib/types/products/bot_defender/block/captcha/JsonCaptchaBlocker.d.ts +5 -5
  77. package/lib/types/products/bot_defender/block/captcha/MobileCaptchaBlocker.d.ts +4 -4
  78. package/lib/types/products/bot_defender/filter/DefaultBotDefenderFilter.d.ts +2 -2
  79. package/lib/types/products/bot_defender/first_party/DefaultBotDefenderFirstParty.d.ts +3 -3
  80. package/lib/types/products/bot_defender/first_party/utils.d.ts +7 -7
  81. package/lib/types/products/credential_intelligence/CredentialIntelligence.d.ts +4 -4
  82. package/lib/types/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulParserFactory.d.ts +1 -1
  83. package/lib/types/products/hype_sale_challenge/HypeSaleChallenge.d.ts +3 -3
  84. package/lib/types/products/hype_sale_challenge/block/JsonHypeSaleChallengeBlocker.d.ts +3 -3
  85. package/lib/types/products/hype_sale_challenge/block/MobileHypeSaleChallengeBlocker.d.ts +2 -2
  86. package/lib/types/products/utils/ProductName.d.ts +1 -0
  87. package/lib/types/pxde/DefaultDataEnrichment.d.ts +2 -2
  88. package/lib/types/pxhd/PXHDUtils.d.ts +2 -2
  89. package/lib/types/risk_api/client/GetRiskApiClientV2.d.ts +2 -2
  90. package/lib/types/risk_api/client/PostRiskApiClientV2.d.ts +3 -3
  91. package/lib/types/risk_api/client/PostRiskApiClientV3.d.ts +3 -3
  92. package/lib/types/risk_api/client/abstract/PostRiskApiClientBase.d.ts +2 -1
  93. package/lib/types/risk_api/client/abstract/RiskApiClientBase.d.ts +3 -3
  94. package/lib/types/risk_api/utils.d.ts +2 -2
  95. package/lib/types/risk_token/parser/DefaultTokenV2Parser.d.ts +4 -4
  96. package/lib/types/risk_token/parser/DefaultTokenV3Parser.d.ts +4 -4
  97. package/lib/types/risk_token/parser/TokenParserBase.d.ts +5 -5
  98. package/lib/types/risk_token/token/TokenBase.d.ts +3 -3
  99. package/lib/types/risk_token/token/serialize/SerializedToken.d.ts +2 -2
  100. package/lib/types/risk_token/token/v2/DefaultTokenV2.d.ts +2 -2
  101. package/lib/types/risk_token/token/v3/DefaultTokenV3.d.ts +2 -2
  102. package/lib/types/sensitive_request/SensitiveRequestUtils.d.ts +2 -2
  103. package/lib/types/snippet_injection/CustomSnippetFunction.d.ts +1 -1
  104. package/lib/types/snippet_injection/snippet_retriever/DefaultSnippetRetriever.d.ts +3 -3
  105. package/lib/types/telemetry/DefaultTelemetry.d.ts +5 -5
  106. package/lib/types/telemetry/model/TelemetryActivity.d.ts +9 -9
  107. package/lib/types/utils/constants.d.ts +4 -1
  108. package/lib/types/utils/timestamp_hmac_header_validator/DefaultTimestampHmacHeaderValidator.d.ts +3 -3
  109. package/package.json +1 -1
@@ -123,6 +123,7 @@ var ConfigurationBase = /** @class */ (function () {
123
123
  // @ts-ignore
124
124
  delete activeConfig[key];
125
125
  }
126
+ // Runtime filtering ensures only supported configs remain
126
127
  return activeConfig;
127
128
  };
128
129
  ConfigurationBase.prototype.getStaticConfig = function () {
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -19,3 +19,4 @@ __exportStar(require("./AllConfigurationParams.js"), exports);
19
19
  __exportStar(require("./CoreConfigurationParams.js"), exports);
20
20
  __exportStar(require("./RemoteConfigurationParams.js"), exports);
21
21
  __exportStar(require("./StaticConfigurationParams.js"), exports);
22
+ __exportStar(require("./CreateHumanSecurityConfigurationParams.js"), exports);
@@ -21,8 +21,9 @@ var Flow_1 = require("./Flow.js");
21
21
  var EnforceFlow = /** @class */ (function (_super) {
22
22
  __extends(EnforceFlow, _super);
23
23
  function EnforceFlow(config, _a) {
24
- var dataEnrichment = _a.dataEnrichment, tokenParser = _a.tokenParser, riskApiClient = _a.riskApiClient, cors = _a.cors, products = _a.products, graphQLParser = _a.graphQLParser;
24
+ var dataEnrichment = _a.dataEnrichment, tokenParser = _a.tokenParser, riskApiClient = _a.riskApiClient, cors = _a.cors, products = _a.products, graphQLParser = _a.graphQLParser, base64Utils = _a.base64Utils;
25
25
  return _super.call(this, [
26
+ new phase_1.BlockByHeaderPhase(config, base64Utils),
26
27
  new phase_1.ParseTokenPhase(tokenParser),
27
28
  new phase_1.EnrichContextFromRequestPhase(config, products, dataEnrichment, graphQLParser),
28
29
  new phase_1.RiskApiPhase(products, riskApiClient),
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BlockByHeaderPhase = void 0;
4
+ var action_1 = require("../../action/index.js");
5
+ var blocker_1 = require("../../blocker/index.js");
6
+ var products_1 = require("../../products/index.js");
7
+ var captcha_1 = require("../../products/bot_defender/block/captcha/index.js");
8
+ var templates_1 = require("../../products/bot_defender/block/templates/index.js");
9
+ var utils_1 = require("../../utils/index.js");
10
+ /**
11
+ * `BlockByHeaderPhase` checks for the presence of the x-px-block-by-header header.
12
+ * If the header is present with a truthy value ("1", "true", "TRUE"), the request is immediately
13
+ * blocked with a captcha response and the flow is terminated. This feature overrides all other
14
+ * enforcer logic including monitor mode and whitelisting.
15
+ */
16
+ var BlockByHeaderPhase = /** @class */ (function () {
17
+ function BlockByHeaderPhase(config, base64Utils) {
18
+ this.config = config;
19
+ this.base64Utils = base64Utils;
20
+ }
21
+ BlockByHeaderPhase.prototype.execute = function (context) {
22
+ var headerValue = this.getBlockByHeaderValue(context);
23
+ if (headerValue && this.isTruthyValue(headerValue)) {
24
+ context.logger.debug('block by header detected - creating immediate block response');
25
+ // Set context for proper activity reporting
26
+ this.setBlockingContext(context);
27
+ // Create and return block response immediately
28
+ var blockResponse = this.createBlockResponse(context);
29
+ return { done: true, response: blockResponse };
30
+ }
31
+ return { done: false };
32
+ };
33
+ /**
34
+ * Creates a captcha block response for the block-by-header feature.
35
+ * @param context - The request context.
36
+ * @returns The block response.
37
+ */
38
+ BlockByHeaderPhase.prototype.createBlockResponse = function (context) {
39
+ // Use the existing CaptchaBlocker to generate a proper captcha page
40
+ var captchaBlocker = new captcha_1.CaptchaBlocker({
41
+ config: this.config,
42
+ base64Utils: this.base64Utils,
43
+ captchaTemplate: templates_1.CAPTCHA_TEMPLATE,
44
+ });
45
+ return captchaBlocker.createBlockResponse(context);
46
+ };
47
+ /**
48
+ * Gets the value of the x-px-block-by-header header from the request.
49
+ * @param context - The request context.
50
+ * @returns The header value or null if not present.
51
+ */
52
+ BlockByHeaderPhase.prototype.getBlockByHeaderValue = function (context) {
53
+ return context.requestData.request.headers.get(utils_1.BLOCK_BY_HEADER_NAME) || null;
54
+ };
55
+ /**
56
+ * Checks if the header value is considered truthy for blocking.
57
+ * @param value - The header value to check.
58
+ * @returns True if the value should trigger blocking.
59
+ */
60
+ BlockByHeaderPhase.prototype.isTruthyValue = function (value) {
61
+ return utils_1.BLOCK_BY_HEADER_TRUTHY_VALUES.includes(value);
62
+ };
63
+ /**
64
+ * Sets the context properties needed for proper activity reporting.
65
+ * @param context - The request context to modify.
66
+ */
67
+ BlockByHeaderPhase.prototype.setBlockingContext = function (context) {
68
+ var _a;
69
+ context.action = action_1.Action.BLOCK;
70
+ context.reasons = (_a = {}, _a[products_1.ProductName.BLOCK_BY_HEADER] = utils_1.BLOCK_BY_HEADER_REASON, _a);
71
+ context.score = 100; // Maximum risk score
72
+ context.blockAction = blocker_1.BlockAction.CAPTCHA;
73
+ };
74
+ return BlockByHeaderPhase;
75
+ }());
76
+ exports.BlockByHeaderPhase = BlockByHeaderPhase;
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./BlockByHeaderPhase.js"), exports);
17
18
  __exportStar(require("./FirstPartyPhase.js"), exports);
18
19
  __exportStar(require("./FilterPhase.js"), exports);
19
20
  __exportStar(require("./PreflightPhase.js"), exports);
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProductName = void 0;
4
4
  var ProductName;
5
5
  (function (ProductName) {
6
+ ProductName["BLOCK_BY_HEADER"] = "block_by_header";
6
7
  ProductName["BOT_DEFENDER"] = "bd";
7
8
  ProductName["ACCOUNT_DEFENDER"] = "ad";
8
9
  ProductName["CODE_DEFENDER"] = "cd";
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PRODUCT_PRIORITY_ORDER = void 0;
4
4
  var ProductName_1 = require("./ProductName.js");
5
5
  exports.PRODUCT_PRIORITY_ORDER = [
6
+ ProductName_1.ProductName.BLOCK_BY_HEADER,
6
7
  ProductName_1.ProductName.HYPE_SALE_CHALLENGE,
7
8
  ProductName_1.ProductName.BOT_DEFENDER,
8
9
  ProductName_1.ProductName.ACCOUNT_DEFENDER,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CORE_MODULE_VERSION = exports.REGEX_STRUCTURE = exports.URL_REGEX = exports.EMAIL_ADDRESS_REGEX = exports.PUSH_DATA_FEATURE_HEADER_NAME = exports.PUSH_DATA_HMAC_HEADER_NAME = exports.X_PX_BYPASS_REASON_HEADER_NAME = exports.X_PX_ORIGINAL_TOKEN_HEADER_NAME = exports.X_PX_AUTHORIZATION_HEADER_NAME = exports.UNLIMITED_TIMEOUT = exports.BYPASS_MONITOR_HEADER_VALUE = exports.CD_PXVID_COOKIE_NAME = exports.PXDE_COOKIE_NAME = exports.PXHD_COOKIE_NAME = exports.PXVID_COOKIE_NAME = void 0;
3
+ exports.BLOCK_BY_HEADER_TRUTHY_VALUES = exports.BLOCK_BY_HEADER_REASON = exports.BLOCK_BY_HEADER_NAME = exports.CORE_MODULE_VERSION = exports.REGEX_STRUCTURE = exports.URL_REGEX = exports.EMAIL_ADDRESS_REGEX = exports.PUSH_DATA_FEATURE_HEADER_NAME = exports.PUSH_DATA_HMAC_HEADER_NAME = exports.X_PX_BYPASS_REASON_HEADER_NAME = exports.X_PX_ORIGINAL_TOKEN_HEADER_NAME = exports.X_PX_AUTHORIZATION_HEADER_NAME = exports.UNLIMITED_TIMEOUT = exports.BYPASS_MONITOR_HEADER_VALUE = exports.CD_PXVID_COOKIE_NAME = exports.PXDE_COOKIE_NAME = exports.PXHD_COOKIE_NAME = exports.PXVID_COOKIE_NAME = void 0;
4
4
  exports.PXVID_COOKIE_NAME = '_pxvid';
5
5
  exports.PXHD_COOKIE_NAME = '_pxhd';
6
6
  exports.PXDE_COOKIE_NAME = '_pxde';
@@ -15,4 +15,7 @@ exports.PUSH_DATA_FEATURE_HEADER_NAME = 'x-px-feature';
15
15
  exports.EMAIL_ADDRESS_REGEX = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/;
16
16
  exports.URL_REGEX = /^(https?:)\/\/(([^@\s:\/]+):?([^@\s\/]*)@)?(([^:\/?#]*)(?:\:([0-9]+))?)(\/?[^?#]*)(\?[^#]*|)(#.*|)$/;
17
17
  exports.REGEX_STRUCTURE = /^\/(.+?)\/([gimsuyvd]*)$/;
18
- exports.CORE_MODULE_VERSION = 'JS Core 0.31.0';
18
+ exports.CORE_MODULE_VERSION = 'JS Core 0.32.0';
19
+ exports.BLOCK_BY_HEADER_NAME = 'x-px-block-by-header';
20
+ exports.BLOCK_BY_HEADER_REASON = 'block_by_header';
21
+ exports.BLOCK_BY_HEADER_TRUTHY_VALUES = ['1'];
@@ -117,6 +117,7 @@ export class ConfigurationBase {
117
117
  // @ts-ignore
118
118
  delete activeConfig[key];
119
119
  }
120
+ // Runtime filtering ensures only supported configs remain
120
121
  return activeConfig;
121
122
  }
122
123
  getStaticConfig() {
@@ -3,3 +3,4 @@ export * from './AllConfigurationParams.js';
3
3
  export * from './CoreConfigurationParams.js';
4
4
  export * from './RemoteConfigurationParams.js';
5
5
  export * from './StaticConfigurationParams.js';
6
+ export * from './CreateHumanSecurityConfigurationParams.js';
@@ -1,8 +1,9 @@
1
- import { AdditionalActivityHandlerPhase, CreateBlockResponsePhase, EnrichContextFromRequestPhase, ModifyIncomingRequestPhase, ParseTokenPhase, RiskApiPhase, } from '../phase/index.js';
1
+ import { AdditionalActivityHandlerPhase, BlockByHeaderPhase, CreateBlockResponsePhase, EnrichContextFromRequestPhase, ModifyIncomingRequestPhase, ParseTokenPhase, RiskApiPhase, } from '../phase/index.js';
2
2
  import { Flow } from './Flow.js';
3
3
  export class EnforceFlow extends Flow {
4
- constructor(config, { dataEnrichment, tokenParser, riskApiClient, cors, products, graphQLParser, }) {
4
+ constructor(config, { dataEnrichment, tokenParser, riskApiClient, cors, products, graphQLParser, base64Utils, }) {
5
5
  super([
6
+ new BlockByHeaderPhase(config, base64Utils),
6
7
  new ParseTokenPhase(tokenParser),
7
8
  new EnrichContextFromRequestPhase(config, products, dataEnrichment, graphQLParser),
8
9
  new RiskApiPhase(products, riskApiClient),
@@ -0,0 +1,72 @@
1
+ import { Action } from '../../action/index.js';
2
+ import { BlockAction } from '../../blocker/index.js';
3
+ import { ProductName } from '../../products/index.js';
4
+ import { CaptchaBlocker } from '../../products/bot_defender/block/captcha/index.js';
5
+ import { CAPTCHA_TEMPLATE } from '../../products/bot_defender/block/templates/index.js';
6
+ import { BLOCK_BY_HEADER_NAME, BLOCK_BY_HEADER_REASON, BLOCK_BY_HEADER_TRUTHY_VALUES } from '../../utils/index.js';
7
+ /**
8
+ * `BlockByHeaderPhase` checks for the presence of the x-px-block-by-header header.
9
+ * If the header is present with a truthy value ("1", "true", "TRUE"), the request is immediately
10
+ * blocked with a captcha response and the flow is terminated. This feature overrides all other
11
+ * enforcer logic including monitor mode and whitelisting.
12
+ */
13
+ export class BlockByHeaderPhase {
14
+ config;
15
+ base64Utils;
16
+ constructor(config, base64Utils) {
17
+ this.config = config;
18
+ this.base64Utils = base64Utils;
19
+ }
20
+ execute(context) {
21
+ const headerValue = this.getBlockByHeaderValue(context);
22
+ if (headerValue && this.isTruthyValue(headerValue)) {
23
+ context.logger.debug('block by header detected - creating immediate block response');
24
+ // Set context for proper activity reporting
25
+ this.setBlockingContext(context);
26
+ // Create and return block response immediately
27
+ const blockResponse = this.createBlockResponse(context);
28
+ return { done: true, response: blockResponse };
29
+ }
30
+ return { done: false };
31
+ }
32
+ /**
33
+ * Creates a captcha block response for the block-by-header feature.
34
+ * @param context - The request context.
35
+ * @returns The block response.
36
+ */
37
+ createBlockResponse(context) {
38
+ // Use the existing CaptchaBlocker to generate a proper captcha page
39
+ const captchaBlocker = new CaptchaBlocker({
40
+ config: this.config,
41
+ base64Utils: this.base64Utils,
42
+ captchaTemplate: CAPTCHA_TEMPLATE,
43
+ });
44
+ return captchaBlocker.createBlockResponse(context);
45
+ }
46
+ /**
47
+ * Gets the value of the x-px-block-by-header header from the request.
48
+ * @param context - The request context.
49
+ * @returns The header value or null if not present.
50
+ */
51
+ getBlockByHeaderValue(context) {
52
+ return context.requestData.request.headers.get(BLOCK_BY_HEADER_NAME) || null;
53
+ }
54
+ /**
55
+ * Checks if the header value is considered truthy for blocking.
56
+ * @param value - The header value to check.
57
+ * @returns True if the value should trigger blocking.
58
+ */
59
+ isTruthyValue(value) {
60
+ return BLOCK_BY_HEADER_TRUTHY_VALUES.includes(value);
61
+ }
62
+ /**
63
+ * Sets the context properties needed for proper activity reporting.
64
+ * @param context - The request context to modify.
65
+ */
66
+ setBlockingContext(context) {
67
+ context.action = Action.BLOCK;
68
+ context.reasons = { [ProductName.BLOCK_BY_HEADER]: BLOCK_BY_HEADER_REASON };
69
+ context.score = 100; // Maximum risk score
70
+ context.blockAction = BlockAction.CAPTCHA;
71
+ }
72
+ }
@@ -1,3 +1,4 @@
1
+ export * from './BlockByHeaderPhase.js';
1
2
  export * from './FirstPartyPhase.js';
2
3
  export * from './FilterPhase.js';
3
4
  export * from './PreflightPhase.js';
@@ -1,5 +1,6 @@
1
1
  export var ProductName;
2
2
  (function (ProductName) {
3
+ ProductName["BLOCK_BY_HEADER"] = "block_by_header";
3
4
  ProductName["BOT_DEFENDER"] = "bd";
4
5
  ProductName["ACCOUNT_DEFENDER"] = "ad";
5
6
  ProductName["CODE_DEFENDER"] = "cd";
@@ -1,5 +1,6 @@
1
1
  import { ProductName } from './ProductName.js';
2
2
  export const PRODUCT_PRIORITY_ORDER = [
3
+ ProductName.BLOCK_BY_HEADER,
3
4
  ProductName.HYPE_SALE_CHALLENGE,
4
5
  ProductName.BOT_DEFENDER,
5
6
  ProductName.ACCOUNT_DEFENDER,
@@ -12,4 +12,7 @@ export const PUSH_DATA_FEATURE_HEADER_NAME = 'x-px-feature';
12
12
  export const EMAIL_ADDRESS_REGEX = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/;
13
13
  export const URL_REGEX = /^(https?:)\/\/(([^@\s:\/]+):?([^@\s\/]*)@)?(([^:\/?#]*)(?:\:([0-9]+))?)(\/?[^?#]*)(\?[^#]*|)(#.*|)$/;
14
14
  export const REGEX_STRUCTURE = /^\/(.+?)\/([gimsuyvd]*)$/;
15
- export const CORE_MODULE_VERSION = 'JS Core 0.31.0';
15
+ export const CORE_MODULE_VERSION = 'JS Core 0.32.0';
16
+ export const BLOCK_BY_HEADER_NAME = 'x-px-block-by-header';
17
+ export const BLOCK_BY_HEADER_REASON = 'block_by_header';
18
+ export const BLOCK_BY_HEADER_TRUTHY_VALUES = ['1'];
@@ -7,15 +7,15 @@ import { ILogger } from '../logger';
7
7
  /**
8
8
  * The HttpActivityClient is responsible for sending async activities to the backend via HTTP.
9
9
  */
10
- export declare class HttpActivityClient<Req, Res, Added, Removed> implements IActivityClient<Req, Res> {
11
- protected readonly config: IConfiguration<Req, Res, Added, Removed>;
10
+ export declare class HttpActivityClient<Req, Res, Supported extends string, Added> implements IActivityClient<Req, Res> {
11
+ protected readonly config: IConfiguration<Req, Res, Supported, Added>;
12
12
  protected readonly httpClient: IHttpClient;
13
13
  /**
14
14
  * Creates an instance of HttpActivityClient.
15
15
  * @param config
16
16
  * @param httpClient
17
17
  */
18
- constructor(config: IConfiguration<Req, Res, Added, Removed>, httpClient: IHttpClient);
18
+ constructor(config: IConfiguration<Req, Res, Supported, Added>, httpClient: IHttpClient);
19
19
  /**
20
20
  * Creates and sends all necessary async activities to the backend.
21
21
  * @param context - The context containing the request (and possibly response).
@@ -10,14 +10,14 @@ import { ILogger } from '../logger';
10
10
  * This class uses setTimeout and clearTimeout for managing the timeout for sending activities. It also exposes the stop()
11
11
  * method to stop the timer and prevent further activity sending, which should be called on shutdown.
12
12
  */
13
- export declare class HttpBatchedActivityClient<Req, Res, Added, Removed> extends HttpActivityClient<Req, Res, Added, Removed> {
13
+ export declare class HttpBatchedActivityClient<Req, Res, Supported extends string, Added> extends HttpActivityClient<Req, Res, Supported, Added> {
14
14
  private readonly batchSize;
15
15
  private readonly timeoutMs;
16
16
  private readonly maxBufferSize;
17
17
  private buffer;
18
18
  private timeoutId;
19
19
  private shouldKill;
20
- constructor(config: IConfiguration<Req, Res, Added, Removed>, httpClient: IHttpClient);
20
+ constructor(config: IConfiguration<Req, Res, Supported, Added>, httpClient: IHttpClient);
21
21
  stop(): void;
22
22
  protected postActivities(activities: AsyncActivity[], logger: ILogger): Promise<boolean>;
23
23
  protected addToBuffer(activities: AsyncActivity[]): void;
@@ -12,7 +12,7 @@ import { CustomParameters, ResponseCustomParameters } from '../custom_parameters
12
12
  * @param context - The request context.
13
13
  * @returns {AsyncActivity} - The complete async activity payload.
14
14
  */
15
- export declare const createAsyncActivity: <Req, Res, Added, Removed>(activityType: ActivityType, config: IConfiguration<Req, Res, Added, Removed>, context: ReadonlyContext<Req, Res>) => AsyncActivity;
15
+ export declare const createAsyncActivity: <Req, Res, Supported extends string, Added>(activityType: ActivityType, config: IConfiguration<Req, Res, Supported, Added>, context: ReadonlyContext<Req, Res>) => AsyncActivity;
16
16
  /**
17
17
  * Creates activity details based on the provided parameters.
18
18
  * @param activityType - The activity type to create.
@@ -20,12 +20,12 @@ export declare const createAsyncActivity: <Req, Res, Added, Removed>(activityTyp
20
20
  * @param context - The request context.
21
21
  * @returns {AsyncActivityDetails} - The activity details.
22
22
  */
23
- export declare const createActivityDetails: <Req, Res, Added, Removed>(activityType: ActivityType, config: IConfiguration<Req, Res, Added, Removed>, context: ReadonlyContext<Req, Res>) => AsyncActivityDetails;
23
+ export declare const createActivityDetails: <Req, Res, Supported extends string, Added>(activityType: ActivityType, config: IConfiguration<Req, Res, Supported, Added>, context: ReadonlyContext<Req, Res>) => AsyncActivityDetails;
24
24
  export declare const createAsyncActivityCommonDetails: <Req, Res>(context: ReadonlyContext<Req, Res>) => AsyncActivityCommonDetails;
25
- export declare const createCommonActivityDetails: <Req, Res, Added, Removed>(config: IConfiguration<Req, Res, Added, Removed>, context: ReadonlyContext<Req, Res>) => CommonActivityDetails;
25
+ export declare const createCommonActivityDetails: <Req, Res, Supported extends string, Added>(config: IConfiguration<Req, Res, Supported, Added>, context: ReadonlyContext<Req, Res>) => CommonActivityDetails;
26
26
  export declare const addRootContextDataToDetails: <Req, Res>(details: CommonActivityDetails, context: ReadonlyContext<Req, Res>) => void;
27
27
  export declare function redactCookieSecret(secret: string): string;
28
- export declare const addConfigDataToDetails: <Req, Res, Added, Removed>(details: CommonActivityDetails, config: IConfiguration<Req, Res, Added, Removed>) => void;
28
+ export declare const addConfigDataToDetails: <Req, Res, Supported extends string, Added>(details: CommonActivityDetails, config: IConfiguration<Req, Res, Supported, Added>) => void;
29
29
  export declare const addCustomParametersToDetails: (details: CommonActivityDetails, customParameters: CustomParameters | null, responseCustomParameters: ResponseCustomParameters | null) => void;
30
30
  export declare const addProductDataToDetails: (details: CommonActivityDetails, productData: DeepReadonly<ProductData>) => void;
31
31
  export declare const addTlsDataToDetails: (details: CommonActivityDetails, tlsData: DeepReadonly<TlsData>) => void;
@@ -36,5 +36,5 @@ export declare const addRiskApiDataToAsyncActivityCommonDetails: <Req, Res>(deta
36
36
  export declare const addResponseDataToAsyncActivityCommonDetails: <Req, Res>(details: AsyncActivityCommonDetails, context: ReadonlyContext<Req, Res>) => void;
37
37
  export declare const createPageRequestedActivityDetails: <Req, Res>(context: ReadonlyContext<Req, Res>) => PageRequestedActivityDetails;
38
38
  export declare const createBlockActivityDetails: <Req, Res>(context: ReadonlyContext<Req, Res>) => BlockActivityDetails;
39
- export declare const createAdditionalS2SActivityDetails: <Req, Res, Added, Removed>({ ciSendRawUsernameOnAdditionalS2SActivity }: IConfiguration<Req, Res, Added, Removed>, { productData }: ReadonlyContext<Req, Res>) => AdditionalS2SActivityDetails;
39
+ export declare const createAdditionalS2SActivityDetails: <Req, Res, Supported extends string, Added>({ ciSendRawUsernameOnAdditionalS2SActivity }: IConfiguration<Req, Res, Supported, Added>, { productData }: ReadonlyContext<Req, Res>) => AdditionalS2SActivityDetails;
40
40
  export declare const toHeaderEntryArray: (headers: Record<string, string[]>) => HeaderEntry[];
@@ -1,3 +1,3 @@
1
1
  import { ReadonlyContext } from '../context';
2
2
  import { ActiveConfigurationParams } from '../config';
3
- export type AdditionalActivityHandler<Req, Res, Added, Removed> = (config: ActiveConfigurationParams<Req, Res, Added, Removed>, context: ReadonlyContext<Req, Res>, request: Req) => void | Promise<void>;
3
+ export type AdditionalActivityHandler<Req, Res, Supported extends string, Added> = (config: ActiveConfigurationParams<Req, Res, Supported, Added>, context: ReadonlyContext<Req, Res>, request: Req) => void | Promise<void>;
@@ -7,5 +7,5 @@ export declare namespace AdditionalActivityHandlerUtils {
7
7
  * @param context - The request context.
8
8
  * @returns {Promise<void>} - A promise that resolves when the additional activity handler is complete.
9
9
  */
10
- const invokeAdditionalActivityHandler: <Req, Res, Added, Removed>(config: IConfiguration<Req, Res, Added, Removed>, context: ReadonlyContext<Req, Res>) => Promise<void>;
10
+ const invokeAdditionalActivityHandler: <Req, Res, Supported extends string, Added>(config: IConfiguration<Req, Res, Supported, Added>, context: ReadonlyContext<Req, Res>) => Promise<void>;
11
11
  }
@@ -3,11 +3,11 @@ import { ReadonlyContext } from '../context';
3
3
  import { IBase64Utils } from '../utils';
4
4
  import { IConditionalBlocker } from '../blocker';
5
5
  import { BlockerBase } from './BlockerBase';
6
- export declare class MobileBlocker<Req, Res, Added, Removed> extends BlockerBase<Req, Res> implements IConditionalBlocker<Req, Res> {
7
- protected readonly config: IConfiguration<Req, Res, Added, Removed>;
6
+ export declare class MobileBlocker<Req, Res, Supported extends string, Added> extends BlockerBase<Req, Res> implements IConditionalBlocker<Req, Res> {
7
+ protected readonly config: IConfiguration<Req, Res, Supported, Added>;
8
8
  protected readonly base64Utils: IBase64Utils;
9
9
  protected readonly template: string;
10
- constructor(config: IConfiguration<Req, Res, Added, Removed>, base64Utils: IBase64Utils, template: string);
10
+ constructor(config: IConfiguration<Req, Res, Supported, Added>, base64Utils: IBase64Utils, template: string);
11
11
  shouldBlock(context: ReadonlyContext<Req, Res>): boolean;
12
12
  protected createBlockBody(context: ReadonlyContext<Req, Res>): string;
13
13
  }
@@ -16,4 +16,4 @@ export declare const renderHtml: (htmlTemplate: string, blockData?: BlockData) =
16
16
  * @param base64Utils - The base64 utility functions.
17
17
  * @returns {BlockData} - The block data object.
18
18
  */
19
- export declare const createBlockData: <Req, Res, Added, Removed>(config: IConfiguration<Req, Res, Added, Removed>, context: ReadonlyContext<Req, Res>, base64Utils: IBase64Utils) => BlockData;
19
+ export declare const createBlockData: <Req, Res, Supported extends string, Added>(config: IConfiguration<Req, Res, Supported, Added>, context: ReadonlyContext<Req, Res>, base64Utils: IBase64Utils) => BlockData;
@@ -14,12 +14,12 @@ import { CustomSnippetFunction } from '../snippet_injection';
14
14
  /**
15
15
  * Base class for the enforcer configuration.
16
16
  */
17
- export declare abstract class ConfigurationBase<Req, Res, Added, Removed extends string> implements IConfiguration<Req, Res, Added, Removed> {
18
- protected configParams: RequiredAllConfigurationParams<Req, Res, Added, Removed>;
19
- protected readonly staticConfigParams: StaticConfigurationParams<Req, Res, Added, Removed>;
20
- protected remoteConfigData?: RemoteConfigData<Req, Res, Added, Removed>;
21
- protected readonly defaultConfigParams: RequiredAllConfigurationParams<Req, Res, Added, Removed>;
22
- protected readonly removedParams: Record<Removed, undefined>;
17
+ export declare abstract class ConfigurationBase<Req, Res, Supported extends string, Added> implements IConfiguration<Req, Res, Supported, Added> {
18
+ protected configParams: RequiredAllConfigurationParams<Req, Res, Supported, Added>;
19
+ protected readonly staticConfigParams: StaticConfigurationParams<Req, Res, Supported, Added>;
20
+ protected remoteConfigData?: RemoteConfigData<Req, Res, Supported, Added>;
21
+ protected readonly defaultConfigParams: RequiredAllConfigurationParams<Req, Res, Supported, Added>;
22
+ protected readonly removedParams: Record<Exclude<keyof CoreConfigurationParams<Req, Res, Supported, Added>, Supported>, undefined>;
23
23
  private internalLogger;
24
24
  /**
25
25
  * Returns the module version of the enforcer.
@@ -40,18 +40,18 @@ export declare abstract class ConfigurationBase<Req, Res, Added, Removed extends
40
40
  * @param removedParams - A map of all removed (unsupported) configuration parameters set to undefined. This parameter can be generated automatically by your IDE.
41
41
  * @protected
42
42
  */
43
- protected constructor(params: StaticConfigurationParams<Req, Res, Added, Removed>, defaultParams: Required<Added> & Partial<CoreConfigurationParams<Req, Res, Added, Removed>>, removedParams: Record<Removed, undefined>);
44
- protected createActiveConfiguration(params: AllConfigurationParams<Req, Res, Added, Removed>, defaultParams: RequiredAllConfigurationParams<Req, Res, Added, Removed>): RequiredAllConfigurationParams<Req, Res, Added, Removed>;
45
- protected throwIfMissingRequiredField(params: AllConfigurationParams<Req, Res, Added, Removed>): void;
46
- protected getValidConfigValue<K extends keyof RequiredAllConfigurationParams<Req, Res, Added, Removed>, V extends RequiredAllConfigurationParams<Req, Res, Added, Removed>[K]>(params: AllConfigurationParams<Req, Res, Added, Removed>, defaultParams: RequiredAllConfigurationParams<Req, Res, Added, Removed>, key: K): V;
47
- protected isValidConfigValue(params: AllConfigurationParams<Req, Res, Added, Removed>, defaultParams: RequiredAllConfigurationParams<Req, Res, Added, Removed>, key: keyof RequiredAllConfigurationParams<Req, Res, Added, Removed>): boolean;
48
- protected getDefaultConfigurationValue<K extends keyof RequiredAllConfigurationParams<Req, Res, Added, Removed>, V extends RequiredAllConfigurationParams<Req, Res, Added, Removed>[K]>(params: AllConfigurationParams<Req, Res, Added, Removed>, defaultParams: RequiredAllConfigurationParams<Req, Res, Added, Removed>, key: K): V;
49
- protected normalizeConfigurationValue<K extends keyof RequiredAllConfigurationParams<Req, Res, Added, Removed>, V extends RequiredAllConfigurationParams<Req, Res, Added, Removed>[K]>(params: AllConfigurationParams<Req, Res, Added, Removed>, key: K): V;
50
- protected createInternalLogger(params: RequiredAllConfigurationParams<Req, Res, Added, Removed>): ILogger;
51
- setRemoteConfigData(remoteConfigData: RemoteConfigData<Req, Res, Added, Removed>): void;
52
- getActiveConfig(): ActiveConfigurationParams<Req, Res, Added, Removed>;
53
- getStaticConfig(): StaticConfigurationParams<Req, Res, Added, Removed>;
54
- getRemoteConfig(): RemoteConfigurationParams<Req, Res, Added, Removed>;
43
+ protected constructor(params: StaticConfigurationParams<Req, Res, Supported, Added>, defaultParams: Required<Added> & Partial<CoreConfigurationParams<Req, Res, Supported, Added>>, removedParams: Record<Exclude<keyof CoreConfigurationParams<Req, Res, Supported, Added>, Supported>, undefined>);
44
+ protected createActiveConfiguration(params: AllConfigurationParams<Req, Res, Supported, Added>, defaultParams: RequiredAllConfigurationParams<Req, Res, Supported, Added>): RequiredAllConfigurationParams<Req, Res, Supported, Added>;
45
+ protected throwIfMissingRequiredField(params: AllConfigurationParams<Req, Res, Supported, Added>): void;
46
+ protected getValidConfigValue<K extends keyof RequiredAllConfigurationParams<Req, Res, Supported, Added>, V extends RequiredAllConfigurationParams<Req, Res, Supported, Added>[K]>(params: AllConfigurationParams<Req, Res, Supported, Added>, defaultParams: RequiredAllConfigurationParams<Req, Res, Supported, Added>, key: K): V;
47
+ protected isValidConfigValue(params: AllConfigurationParams<Req, Res, Supported, Added>, defaultParams: RequiredAllConfigurationParams<Req, Res, Supported, Added>, key: keyof RequiredAllConfigurationParams<Req, Res, Supported, Added>): boolean;
48
+ protected getDefaultConfigurationValue<K extends keyof RequiredAllConfigurationParams<Req, Res, Supported, Added>, V extends RequiredAllConfigurationParams<Req, Res, Supported, Added>[K]>(params: AllConfigurationParams<Req, Res, Supported, Added>, defaultParams: RequiredAllConfigurationParams<Req, Res, Supported, Added>, key: K): V;
49
+ protected normalizeConfigurationValue<K extends keyof RequiredAllConfigurationParams<Req, Res, Supported, Added>, V extends RequiredAllConfigurationParams<Req, Res, Supported, Added>[K]>(params: AllConfigurationParams<Req, Res, Supported, Added>, key: K): V;
50
+ protected createInternalLogger(params: RequiredAllConfigurationParams<Req, Res, Supported, Added>): ILogger;
51
+ setRemoteConfigData(remoteConfigData: RemoteConfigData<Req, Res, Supported, Added>): void;
52
+ getActiveConfig(): ActiveConfigurationParams<Req, Res, Supported, Added>;
53
+ getStaticConfig(): StaticConfigurationParams<Req, Res, Supported, Added>;
54
+ getRemoteConfig(): RemoteConfigurationParams<Req, Res, Supported, Added>;
55
55
  get moduleVersion(): string;
56
56
  get logger(): ILogger;
57
57
  get appId(): string;
@@ -105,9 +105,9 @@ export declare abstract class ConfigurationBase<Req, Res, Added, Removed extends
105
105
  get extractGraphQLKeywords(): ExtractGraphQLKeywordsFunction | null;
106
106
  get sensitiveGraphqlOperationNames(): Array<string | RegExp>;
107
107
  get sensitiveGraphqlOperationTypes(): string[];
108
- get enrichCustomParameters(): CustomParametersFunction<Req, Res, Added, Removed> | null;
109
- get enrichResponseCustomParameters(): ResponseCustomParametersFunction<Req, Res, Added, Removed> | null;
110
- get additionalActivityHandler(): AdditionalActivityHandler<Req, Res, Added, Removed> | null;
108
+ get enrichCustomParameters(): CustomParametersFunction<Req, Res, Supported, Added> | null;
109
+ get enrichResponseCustomParameters(): ResponseCustomParametersFunction<Req, Res, Supported, Added> | null;
110
+ get additionalActivityHandler(): AdditionalActivityHandler<Req, Res, Supported, Added> | null;
111
111
  get altBackendCaptchaUrl(): string;
112
112
  get corsSupportEnabled(): boolean;
113
113
  get corsCustomPreflightHandler(): CustomPreflightHandler<Req> | null;
@@ -142,7 +142,7 @@ export declare abstract class ConfigurationBase<Req, Res, Added, Removed extends
142
142
  get securedPxhdEnabled(): boolean;
143
143
  get tokenVersion(): `${TokenVersion}`;
144
144
  get snippetInjectionEnabled(): boolean;
145
- get createCustomSnippet(): CustomSnippetFunction<Req, Res, Added, Removed> | null;
145
+ get createCustomSnippet(): CustomSnippetFunction<Req, Res, Supported, Added> | null;
146
146
  get dataEnrichmentHeaderName(): string;
147
147
  get enableBlockedUrlOnCaptchaBlockPage(): boolean;
148
148
  get awaitAsyncHttpRequests(): boolean;
@@ -10,7 +10,7 @@ import { ExtractGraphQLKeywordsFunction } from '../graphql';
10
10
  import { TokenVersion } from '../risk_token';
11
11
  import { CustomSnippetFunction } from '../snippet_injection';
12
12
  import { RemoteConfigData } from './remote_config';
13
- export interface IConfiguration<Req, Res, Added, Removed> {
13
+ export interface IConfiguration<Req, Res, Supported extends string, Added> {
14
14
  /**
15
15
  * The application ID.
16
16
  */
@@ -246,15 +246,15 @@ export interface IConfiguration<Req, Res, Added, Removed> {
246
246
  /**
247
247
  * A function returning CustomParameters that will be added to the enforcer activities.
248
248
  */
249
- readonly enrichCustomParameters: CustomParametersFunction<Req, Res, Added, Removed> | null;
249
+ readonly enrichCustomParameters: CustomParametersFunction<Req, Res, Supported, Added> | null;
250
250
  /**
251
251
  * A function returning ResponseCustomParameters that will be added to the enforcer activities.
252
252
  */
253
- readonly enrichResponseCustomParameters: ResponseCustomParametersFunction<Req, Res, Added, Removed> | null;
253
+ readonly enrichResponseCustomParameters: ResponseCustomParametersFunction<Req, Res, Supported, Added> | null;
254
254
  /**
255
255
  * A function that will be called after the asynchronous activities are sent to the backend.
256
256
  */
257
- readonly additionalActivityHandler: AdditionalActivityHandler<Req, Res, Added, Removed> | null;
257
+ readonly additionalActivityHandler: AdditionalActivityHandler<Req, Res, Supported, Added> | null;
258
258
  /**
259
259
  * Whether cors support feature should be enabled.
260
260
  */
@@ -387,7 +387,7 @@ export interface IConfiguration<Req, Res, Added, Removed> {
387
387
  /**
388
388
  * A custom function that returns a string representing the snippet to be injected.
389
389
  */
390
- readonly createCustomSnippet: CustomSnippetFunction<Req, Res, Added, Removed> | null;
390
+ readonly createCustomSnippet: CustomSnippetFunction<Req, Res, Supported, Added> | null;
391
391
  /**
392
392
  * Whether to include the request url in captcha block page
393
393
  */
@@ -411,17 +411,17 @@ export interface IConfiguration<Req, Res, Added, Removed> {
411
411
  /**
412
412
  * Returns an object representation of the current configuration.
413
413
  */
414
- getActiveConfig(): ActiveConfigurationParams<Req, Res, Added, Removed>;
414
+ getActiveConfig(): ActiveConfigurationParams<Req, Res, Supported, Added>;
415
415
  /**
416
416
  * Returns an object representation of the static configuration.
417
417
  */
418
- getStaticConfig(): StaticConfigurationParams<Req, Res, Added, Removed>;
418
+ getStaticConfig(): StaticConfigurationParams<Req, Res, Supported, Added>;
419
419
  /**
420
420
  * Returns an object representation of the remote configuration.
421
421
  */
422
- getRemoteConfig(): RemoteConfigurationParams<Req, Res, Added, Removed>;
422
+ getRemoteConfig(): RemoteConfigurationParams<Req, Res, Supported, Added>;
423
423
  /**
424
424
  * Sets the remote configuration data.
425
425
  */
426
- setRemoteConfigData(remoteConfigData: RemoteConfigData<Req, Res, Added, Removed>): void;
426
+ setRemoteConfigData(remoteConfigData: RemoteConfigData<Req, Res, Supported, Added>): void;
427
427
  }
@@ -1,2 +1,2 @@
1
1
  import { CoreConfigurationParams } from '../params';
2
- export declare const defaultConfigurationParams: <Req, Res, Added, Removed>() => Required<CoreConfigurationParams<Req, Res, Added, Removed>>;
2
+ export declare const defaultConfigurationParams: <Req, Res, Supported extends string, Added>() => Required<CoreConfigurationParams<Req, Res, Supported, Added>>;
@@ -1,2 +1,8 @@
1
- import { RequiredAllConfigurationParams } from './AllConfigurationParams';
2
- export type ActiveConfigurationParams<Req, Res, Added, Removed> = [Removed] extends [never] ? RequiredAllConfigurationParams<Req, Res, Added, Removed> : Removed extends string ? Omit<RequiredAllConfigurationParams<Req, Res, Added, Removed>, Removed> : never;
1
+ import { CoreConfigurationParams, CoreConfigurationParamsKeys } from './CoreConfigurationParams';
2
+ /**
3
+ * Active configuration parameters representing the runtime-filtered configuration.
4
+ * Only includes the supported subset of core configurations plus added configurations.
5
+ */
6
+ export type ActiveConfigurationParams<Req, Res, Supported extends string, Added> = [Supported] extends [
7
+ CoreConfigurationParamsKeys
8
+ ] ? Required<Added> & Required<Pick<CoreConfigurationParams<Req, Res, string, Added>, Supported>> : never;
@@ -1,4 +1,7 @@
1
1
  import { CoreConfigurationParams } from './CoreConfigurationParams';
2
- export type AllConfigurationParams<Req, Res, Added, Removed> = Added & CoreConfigurationParams<Req, Res, Added, Removed>;
3
- export type RequiredAllConfigurationParams<Req, Res, Added, Removed> = Required<Added> & Required<CoreConfigurationParams<Req, Res, Added, Removed>>;
4
- export type CreateHumanSecurityConfigurationParams<Req, Res, Added, Removed> = [Removed] extends [never] ? Added & CoreConfigurationParams<Req, Res, Added, Removed> : Removed extends keyof CoreConfigurationParams<Req, Res, Added, Removed> ? Added & Omit<CoreConfigurationParams<Req, Res, Added, Removed>, Removed> : never;
2
+ /**
3
+ * Combined configuration parameters (Added + Core) with optional fields.
4
+ * Used for input parameters where not all fields are required.
5
+ */
6
+ export type AllConfigurationParams<Req, Res, Supported extends string, Added> = Added & CoreConfigurationParams<Req, Res, Supported, Added>;
7
+ export type RequiredAllConfigurationParams<Req, Res, Supported extends string, Added> = Required<Added> & Required<CoreConfigurationParams<Req, Res, Supported, Added>>;