perimeterx-js-core 0.4.1 → 0.4.2

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 @@ export declare type Activity = {
6
6
  socket_ip: string;
7
7
  url: string;
8
8
  px_app_id: string;
9
- headers?: Record<string, string | string[]>;
9
+ headers?: Record<string, string>;
10
10
  vid?: string;
11
11
  pxhd?: string;
12
12
  details: ActivityDetails;
@@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createBlockActivityDetails = exports.createPageRequestedActivityDetails = exports.createGenericActivityDetails = exports.createActivityDetails = exports.createActivity = void 0;
4
4
  var utils_1 = require("../utils");
5
5
  var ActivityType_1 = require("./ActivityType");
6
+ var http_1 = require("../http");
6
7
  var createActivity = function (activityType, config, context) {
7
8
  return {
8
9
  type: activityType,
9
10
  px_app_id: config.appId,
10
11
  url: context.requestData.url.href,
11
- headers: (0, utils_1.removeSensitiveHeaders)(context.requestData.headers, config.sensitiveHeaders),
12
+ headers: (0, http_1.joinHeaderValues)((0, utils_1.removeSensitiveHeaders)(context.requestData.headers, config.sensitiveHeaders)),
12
13
  pxhd: context.pxhd,
13
14
  socket_ip: context.requestData.ip,
14
15
  timestamp: Date.now(),
@@ -1,3 +1,4 @@
1
1
  export declare type ReadOnlyHeaders = Readonly<Record<string, string[]>>;
2
2
  export declare const toReadOnlyHeaders: (headers: Headers) => ReadOnlyHeaders;
3
3
  export declare const fromReadOnlyHeaders: (headers?: ReadOnlyHeaders) => Headers;
4
+ export declare const joinHeaderValues: (headers: ReadOnlyHeaders) => Record<string, string>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fromReadOnlyHeaders = exports.toReadOnlyHeaders = void 0;
3
+ exports.joinHeaderValues = exports.fromReadOnlyHeaders = exports.toReadOnlyHeaders = void 0;
4
4
  var toReadOnlyHeaders = function (headers) {
5
5
  var readonlyHeaders = {};
6
6
  headers.forEach(function (headerValue, headerName) {
@@ -23,3 +23,10 @@ var fromReadOnlyHeaders = function (headers) {
23
23
  return new Headers(init);
24
24
  };
25
25
  exports.fromReadOnlyHeaders = fromReadOnlyHeaders;
26
+ var joinHeaderValues = function (headers) {
27
+ return Object.fromEntries(Object.entries(headers).map(function (_a) {
28
+ var name = _a[0], values = _a[1];
29
+ return [name, values.join(', ')];
30
+ }));
31
+ };
32
+ exports.joinHeaderValues = joinHeaderValues;
@@ -7,4 +7,4 @@ export declare const BYPASS_MONITOR_HEADER_VALUE = "1";
7
7
  export declare const X_PX_AUTHORIZATION_HEADER_NAME = "x-px-authorization";
8
8
  export declare const X_PX_ORIGINAL_TOKEN_HEADER_NAME = "x-px-original-token";
9
9
  export declare const X_PX_BYPASS_REASON_HEADER_NAME = "x-px-bypass-reason";
10
- export declare const CORE_MODULE_VERSION = "JS Core 0.4.1";
10
+ export declare const CORE_MODULE_VERSION = "JS Core 0.4.2";
@@ -10,4 +10,4 @@ exports.BYPASS_MONITOR_HEADER_VALUE = '1';
10
10
  exports.X_PX_AUTHORIZATION_HEADER_NAME = 'x-px-authorization';
11
11
  exports.X_PX_ORIGINAL_TOKEN_HEADER_NAME = 'x-px-original-token';
12
12
  exports.X_PX_BYPASS_REASON_HEADER_NAME = 'x-px-bypass-reason';
13
- exports.CORE_MODULE_VERSION = 'JS Core 0.4.1';
13
+ exports.CORE_MODULE_VERSION = 'JS Core 0.4.2';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perimeterx-js-core",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",