@postman/postman-sdk
Advanced tools
Comparing version 0.1.1 to 0.1.6
@@ -28,2 +28,3 @@ "use strict"; | ||
} | ||
// Keeping logLevel error as the base, so that errors are populated out. | ||
(0, logger_1.setLogger)(this.config.debug === true ? api_1.DiagLogLevel.DEBUG : api_1.DiagLogLevel.ERROR); | ||
@@ -131,2 +132,5 @@ this.postmanTracer = new tracing_1.PostmanTracer(this.config); | ||
} | ||
if (config.truncateData === undefined || config.truncateData === null) { | ||
config.truncateData = true; | ||
} | ||
if (process.env[base_types_1.POSTMAN_SDK_ENABLE] !== undefined) { | ||
@@ -133,0 +137,0 @@ try { |
@@ -5,2 +5,3 @@ "use strict"; | ||
const base_types_1 = require("../postman-types/base-types"); | ||
const logger_1 = require("../utils/logger"); | ||
/* eslint-disable no-unused-vars */ | ||
@@ -23,3 +24,10 @@ /* eslint-disable operator-linebreak */ | ||
function _jsonStringObfuscation(regExCompiled, jsonString) { | ||
let jsonObjectParsed = JSON.parse(jsonString); | ||
let jsonObjectParsed; | ||
try { | ||
jsonObjectParsed = JSON.parse(jsonString); | ||
} | ||
catch (err) { | ||
logger_1._diag.debug('Failed to parse JSON when redacting senstive data. Bailing out !!'); | ||
return jsonString; | ||
} | ||
Object.keys(jsonObjectParsed).forEach((k) => { | ||
@@ -26,0 +34,0 @@ let objectValue = JSON.stringify(jsonObjectParsed[k]); |
@@ -10,3 +10,3 @@ "use strict"; | ||
return true; | ||
const ua = request.headers['User-Agent']; | ||
const ua = request.headers[base_types_1.USER_AGENT_HEADER_NAME] || request.headers['User-Agent']; | ||
return (!!ua && | ||
@@ -13,0 +13,0 @@ (ua.includes(base_types_1.NEW_RELIC_AGENT_USER_AGENT) || |
@@ -91,3 +91,3 @@ "use strict"; | ||
unsupress() { | ||
logger_1._diag.debug('Enable PostmanTracer'); | ||
logger_1._diag.error('Enable PostmanTracer'); | ||
api_1.context.with((0, core_1.unsuppressTracing)(context_1.PostmanContext.getInstance()), () => { | ||
@@ -94,0 +94,0 @@ context_1.PostmanContext.setNewContext(api_1.context.active()); |
@@ -19,4 +19,5 @@ export declare enum RequestMethod { | ||
export declare const POSTMAN_SDK_USER_AGENT: string; | ||
export declare const USER_AGENT_HEADER_NAME = "user-agent"; | ||
export declare const NEW_RELIC_AGENT_USER_AGENT = "NewRelic"; | ||
export declare const TYPE_ARRAY = "array"; | ||
export declare const POSTMAN_SDK_ENABLE = "POSTMAN_SDK_ENABLE"; |
@@ -5,3 +5,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.POSTMAN_SDK_ENABLE = exports.TYPE_ARRAY = exports.NEW_RELIC_AGENT_USER_AGENT = exports.POSTMAN_SDK_USER_AGENT = exports.EXPONENTIAL_BACKOFF_BASE = exports.DEFAULT_HEALTH_CHECK_RETRIES = exports.HEALTHCHECK_RETRY_COUNT = exports.BOOTSTRAP_RETRY_COUNT = exports.DEFAULT_FETCH_RETRY_DELAY = exports.DEFAULT_HEALTH_PING_INTERVAL = exports.DEFAULT_DATA_TRUNCATION_LEVEL = exports.POSTMAN_DATA_REDACTION_SPAN_ATTRIBUTE = exports.BASE_REDACTION_REPLACEMENT_STRING = exports.RequestMethod = void 0; | ||
exports.POSTMAN_SDK_ENABLE = exports.TYPE_ARRAY = exports.NEW_RELIC_AGENT_USER_AGENT = exports.USER_AGENT_HEADER_NAME = exports.POSTMAN_SDK_USER_AGENT = exports.EXPONENTIAL_BACKOFF_BASE = exports.DEFAULT_HEALTH_CHECK_RETRIES = exports.HEALTHCHECK_RETRY_COUNT = exports.BOOTSTRAP_RETRY_COUNT = exports.DEFAULT_FETCH_RETRY_DELAY = exports.DEFAULT_HEALTH_PING_INTERVAL = exports.DEFAULT_DATA_TRUNCATION_LEVEL = exports.POSTMAN_DATA_REDACTION_SPAN_ATTRIBUTE = exports.BASE_REDACTION_REPLACEMENT_STRING = exports.RequestMethod = void 0; | ||
const version_1 = require("../../version"); | ||
@@ -27,4 +27,5 @@ var RequestMethod; | ||
exports.POSTMAN_SDK_USER_AGENT = `Postman-SDK/${version_1.VERSION}`; | ||
exports.USER_AGENT_HEADER_NAME = 'user-agent'; | ||
exports.NEW_RELIC_AGENT_USER_AGENT = 'NewRelic'; | ||
exports.TYPE_ARRAY = 'array'; | ||
exports.POSTMAN_SDK_ENABLE = 'POSTMAN_SDK_ENABLE'; |
@@ -21,5 +21,3 @@ /** | ||
*/ | ||
export declare function trimBodyValuesToTypes(data: object, currentLevel?: number): { | ||
[key: string]: any; | ||
} | undefined; | ||
export declare function trimBodyValuesToTypes(data: object, currentLevel?: number): object | undefined; | ||
export declare function formatBody(data: object | string): string; |
@@ -5,2 +5,3 @@ "use strict"; | ||
const base_types_1 = require("../postman-types/base-types"); | ||
const logger_1 = require("./logger"); | ||
function isObject(data) { | ||
@@ -33,3 +34,11 @@ return typeof data === 'object'; | ||
if (typeof data === 'string') { | ||
data = JSON.parse(data); | ||
try { | ||
data = JSON.parse(data); | ||
} | ||
catch (err) { | ||
// If the data is not JSON parsable, it does not make sense to continue, as we only support | ||
// content-type = application/json at the moment. | ||
logger_1._diag.debug('Unable to parse JSON data while applying truncation. Bailing out.'); | ||
return data; | ||
} | ||
} | ||
@@ -36,0 +45,0 @@ if (Array.isArray(data)) { |
@@ -21,3 +21,3 @@ "use strict"; | ||
// @ts-ignore Ignores headers don't exist on object | ||
requestOptions.headers['User-Agent'] = base_types_1.POSTMAN_SDK_USER_AGENT; | ||
requestOptions.headers[base_types_1.USER_AGENT_HEADER_NAME] = base_types_1.POSTMAN_SDK_USER_AGENT; | ||
const retryFetch = (0, fetch_retry_ts_1.default)(node_fetch_1.default, retryOptions); | ||
@@ -24,0 +24,0 @@ const response = yield retryFetch(url, requestOptions); |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "0.0.45"; | ||
export declare const VERSION = "0.1.6"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VERSION = void 0; | ||
exports.VERSION = '0.0.45'; | ||
exports.VERSION = '0.1.6'; |
{ | ||
"name": "@postman/postman-sdk", | ||
"version": "0.1.1", | ||
"version": "0.1.6", | ||
"description": "", | ||
@@ -26,3 +26,3 @@ "main": "build/index.js", | ||
"author": "postman", | ||
"license": "ISC", | ||
"license": "See LICENSE in LICENSE.md", | ||
"bugs": { | ||
@@ -29,0 +29,0 @@ "url": "https://github.com/postmanlabs/postman-observability-nodejs-sdk/issues" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
60112
1255
1