@postman/postman-sdk
Advanced tools
Comparing version 0.0.24 to 0.0.25
import { BaseConfig } from './interfaces/base-config'; | ||
import { ConfigSource } from './postman-types/base-types'; | ||
export declare class PostmanBaseSDK { | ||
configFilePath?: string; | ||
yamlConfigData?: any; | ||
protected configFilePath?: string; | ||
protected yamlConfigData?: { | ||
[index: string]: any; | ||
}; | ||
/** | ||
@@ -11,3 +13,3 @@ * | ||
initialize(config?: BaseConfig): void; | ||
initConfig(config?: BaseConfig): BaseConfig | undefined; | ||
initConfig(config?: BaseConfig): BaseConfig; | ||
loadYamlConfig(): void; | ||
@@ -14,0 +16,0 @@ getConfigKeyValue(key: string, configSources: ConfigSource[]): any; |
@@ -6,5 +6,6 @@ "use strict"; | ||
const yaml = require("js-yaml"); | ||
const tracing_1 = require("./tracing"); | ||
// open-telemetry imports | ||
const api_1 = require("@opentelemetry/api"); | ||
const base_types_1 = require("./postman-types/base-types"); | ||
// postman importsØ | ||
const tracing_1 = require("./postman-otel/tracing"); | ||
// Base Postman SDK class | ||
@@ -30,14 +31,19 @@ class PostmanBaseSDK { | ||
if (!config) { | ||
return; | ||
config = {}; | ||
} | ||
if ('configFilePath' in config) { | ||
this.configFilePath = config.configFilePath; | ||
} | ||
else if (process.env.configFilePath) { | ||
this.configFilePath = process.env.configFilePath; | ||
} | ||
if (this.configFilePath) { | ||
this.loadYamlConfig(); | ||
} | ||
const keysOfProps = ["collectionId", "apiToken", "collectorEndpoint", "testCollectorEndpoint", "samplingRatio", "enable", "debug", "dataTruncation", "environment", "configFilePath"]; | ||
const keysOfProps = ["collectionId", "apiToken", "collectorEndpoint", "testCollectorEndpoint", "samplingRatio", "enable", "debug", "dataTruncation", "environment", "configFilePath", "dataRedactions"]; | ||
for (let key of keysOfProps) { | ||
if (!(key in config)) { | ||
let configValue = this.getConfigKeyValue(key, [ | ||
base_types_1.ConfigSource.YAML, | ||
base_types_1.ConfigSource.ENV | ||
"YAML" /* ConfigSource.YAML */, | ||
"ENV" /* ConfigSource.ENV */ | ||
]); | ||
@@ -71,14 +77,14 @@ if (configValue) { | ||
getConfigKeyValue(key, configSources) { | ||
if (base_types_1.ConfigSource.YAML in configSources) { | ||
if (key in this.yamlConfigData) { | ||
for (let sourceType of configSources) { | ||
if (sourceType === "YAML" /* ConfigSource.YAML */ && this.yamlConfigData) { | ||
return this.yamlConfigData[key]; | ||
} | ||
else if (sourceType === "ENV" /* ConfigSource.ENV */ && process.env[key]) { | ||
return process.env[key]; | ||
} | ||
} | ||
else if (base_types_1.ConfigSource.ENV in configSources && process.env[key]) { | ||
return process.env[key]; | ||
} | ||
return null; | ||
} | ||
setDebug() { | ||
console.log('Enabling Debugger'); | ||
api_1.diag.debug('Enabling Debugger'); | ||
api_1.diag.setLogger(new api_1.DiagConsoleLogger(), api_1.DiagLogLevel.DEBUG); | ||
@@ -85,0 +91,0 @@ } |
@@ -0,1 +1,2 @@ | ||
import { DataRedactionRules } from './data-redaction-rules'; | ||
/** | ||
@@ -23,2 +24,4 @@ * BaseConfig, defines Instrumentation configurations. | ||
configFilePath?: string; | ||
dataRedactions?: DataRedactionRules; | ||
} | ||
export type RuleMap = Map<string, boolean>; |
"use strict"; | ||
// Defining config structure. | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -1,4 +0,15 @@ | ||
export declare enum ConfigSource { | ||
export declare const enum ConfigSource { | ||
YAML = "YAML", | ||
ENV = "ENV" | ||
} | ||
export declare enum RequestMethod { | ||
GET = "GET", | ||
POST = "POST", | ||
PUT = "PUT", | ||
DELETE = "DELETE", | ||
PATCH = "PATCH", | ||
HEAD = "HEAD" | ||
} | ||
export declare const DEFAULT_COLLECTOR_END_POINT = "https://trace-service-receiver.postman-beta.tech/traces"; | ||
export declare const BASE_REDACTION_REPLACEMENT_STRING = "**********"; | ||
export declare const POSTMAN_DATA_REDACTION_SPAN_ATTRIBUTE = "postman.dataRedaction"; |
"use strict"; | ||
/* eslint-disable operator-linebreak */ | ||
/* eslint-disable no-unused-vars */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ConfigSource = void 0; | ||
/* eslint-disable no-unused-vars */ | ||
var ConfigSource; | ||
(function (ConfigSource) { | ||
ConfigSource["YAML"] = "YAML"; | ||
ConfigSource["ENV"] = "ENV"; | ||
})(ConfigSource = exports.ConfigSource || (exports.ConfigSource = {})); | ||
exports.POSTMAN_DATA_REDACTION_SPAN_ATTRIBUTE = exports.BASE_REDACTION_REPLACEMENT_STRING = exports.DEFAULT_COLLECTOR_END_POINT = exports.RequestMethod = void 0; | ||
var RequestMethod; | ||
(function (RequestMethod) { | ||
RequestMethod["GET"] = "GET"; | ||
RequestMethod["POST"] = "POST"; | ||
RequestMethod["PUT"] = "PUT"; | ||
RequestMethod["DELETE"] = "DELETE"; | ||
RequestMethod["PATCH"] = "PATCH"; | ||
RequestMethod["HEAD"] = "HEAD"; | ||
})(RequestMethod = exports.RequestMethod || (exports.RequestMethod = {})); | ||
exports.DEFAULT_COLLECTOR_END_POINT = 'https://trace-service-receiver.postman-beta.tech/traces'; | ||
exports.BASE_REDACTION_REPLACEMENT_STRING = '**********'; | ||
exports.POSTMAN_DATA_REDACTION_SPAN_ATTRIBUTE = 'postman.dataRedaction'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VERSION = void 0; | ||
exports.VERSION = "0.0.24"; | ||
exports.VERSION = '0.0.24'; |
{ | ||
"name": "@postman/postman-sdk", | ||
"version": "0.0.24", | ||
"version": "0.0.25", | ||
"description": "", | ||
@@ -8,3 +8,4 @@ "main": "build/index.js", | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"prebuild": "rm -rf build && node -p \"'export const VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts", | ||
"prebuild": "rm -rf build && node -p \"'export const VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts && eslint src/version.ts --fix", | ||
"build": "ttsc", | ||
@@ -15,3 +16,4 @@ "prettier-format": "prettier --config .prettierrc 'src/**/*.ts' --write", | ||
"pre-commit": "npm run prettier-format && npm run lint", | ||
"prepare": "husky install" | ||
"prepare": "husky install", | ||
"pack": "rm -rf build && npm run build && rm -v postman*.tgz && npm pack" | ||
}, | ||
@@ -18,0 +20,0 @@ "types": "./build", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 5 instances in 1 package
41
809
1
35648
5