Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@postman/postman-sdk

Package Overview
Dependencies
Maintainers
349
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@postman/postman-sdk - npm Package Compare versions

Comparing version 0.0.43 to 0.0.44

7

build/postman/base-sdk.d.ts
import { BaseConfig } from './interfaces/base-config';
import { ConfigSource } from './postman-types/base-types';
export declare class PostmanBaseSDK {
protected configFilePath?: string;
protected yamlConfigData?: {
[index: string]: any;
};
private postmanTracer;

@@ -18,5 +13,3 @@ private config;

initConfig(config: BaseConfig): BaseConfig;
loadYamlConfig(): void;
getConfigKeyValue(key: string, configSources: ConfigSource[]): any;
setDebug(): void;
}

@@ -13,4 +13,2 @@ "use strict";

exports.PostmanBaseSDK = void 0;
const fs = require("fs");
const yaml = require("js-yaml");
const api_1 = require("@opentelemetry/api");

@@ -127,32 +125,2 @@ const tracing_1 = require("./postman-otel/tracing");

initConfig(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", "apiKey", "receiverBaseUrl", "bufferIntervalInMilliseconds", "enable", "debug", "truncateData", "configFilePath", "redactSensitiveData", "ignoreIncomingRequests", "ignoreOutgoingRequests"];
for (let key of keysOfProps) {
if (!(key in config)) {
let configValue = this.getConfigKeyValue(key, ["YAML" /* ConfigSource.YAML */]);
if (configValue) {
try {
// Env values can be funky lets make sure we got the right conversion.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore Ignore type any can not be assigned to never
config[key] = JSON.parse(configValue);
}
catch (e) {
// If this json load errors out we know env stores it as string so just load it
// This can happen when we have http://..
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore Ignore type any can not be assigned to never
config[key] = configValue;
}
}
}
}
if (!config.receiverBaseUrl) {

@@ -178,21 +146,2 @@ config.receiverBaseUrl = config_1.DEFAULT_RECEIVER_BASE_URL;

}
loadYamlConfig() {
// Get document, or throw exception on error
if (!this.yamlConfigData && this.configFilePath) {
try {
this.yamlConfigData = yaml.load(fs.readFileSync(this.configFilePath, 'utf8'));
}
catch (e) {
console.log(e);
}
}
}
getConfigKeyValue(key, configSources) {
for (let sourceType of configSources) {
if (sourceType === "YAML" /* ConfigSource.YAML */ && this.yamlConfigData) {
return this.yamlConfigData[key];
}
}
return null;
}
setDebug() {

@@ -199,0 +148,0 @@ api_1.diag.debug('Enabling Debugger');

@@ -7,11 +7,2 @@ import { IgnoreIncomingRequestFunction, IgnoreOutgoingRequestFunction } from '@opentelemetry/instrumentation-http';

}
/**
* BaseConfig, defines Instrumentation configurations.
* receiverBaseUrl: where the data should be shipped to collector's http endpoint.
* apiKey: any api key needed for collector
* bufferIntervalInMilliseconds: Time interval for data queueing. Export is triggered after every interval.
* enable: enable or disable tracing.
* debug: enable debug logger
* configFilePath: path to config YAML file.
*/
export interface BaseConfig {

@@ -25,3 +16,2 @@ collectionId: string;

truncateData?: boolean;
configFilePath?: string;
redactSensitiveData?: RedactSensitiveData;

@@ -28,0 +18,0 @@ ignoreIncomingRequests?: IgnoreIncomingRequestFunction;

4

build/postman/postman-types/base-types.d.ts

@@ -1,5 +0,1 @@

export declare const enum ConfigSource {
YAML = "YAML",
ENV = "ENV"
}
export declare enum RequestMethod {

@@ -6,0 +2,0 @@ GET = "GET",

2

package.json
{
"name": "@postman/postman-sdk",
"version": "0.0.43",
"version": "0.0.44",
"description": "",

@@ -5,0 +5,0 @@ "main": "build/index.js",

### About
This SDK instrument express/sails app using OpenTelemetry. It captures the http request/response and uses them for auto-generating accurate postman collections
This SDK instruments express app to capture http requests for auto-generating accurate postman live collections.

@@ -30,3 +30,3 @@ ### Installation

- type: string(valid url)
- default: 'https://api.getpostman-beta.com' , **if using default please connect to postman VPN**
- default: Postman's servers
- **bufferIntervalInMilliseconds**: Time interval for data queueing. Export is triggered after every interval.

@@ -45,4 +45,2 @@ - type: number

- type: string
- **configFilePath**: Path to config YAML file.
- type: string
- **redactSensitiveData**: Regex rules to redact data from requests.

@@ -55,8 +53,11 @@ - type: { enable: true/false, rules: { ruleName: '<regexPattern>'}}

apiKey: '<apiKey>',
dataRedaction: { rules: {
apiToken: 'PMAK-[a-f0-9]' // Sample rule, you can add your own regex
}}
redactSensitiveData: {
enable: true,
rules: {
apiToken: 'PMAK-[a-f0-9]' // Sample rule, you can add your own regex
}
}
)
```
- **ignoreIncomingRequests**: Apply logic on requests to ignore them from Live Collection
- **ignoreIncomingRequests**: Return true/false to ignore incoming request from Live Collection
- type: Function(request: http.IncomingMessage) : boolean

@@ -73,3 +74,3 @@ - For propertires available on request see: https://nodejs.org/docs/latest-v14.x/api/http.html#http_class_http_incomingmessage

```
- **ignoreOutgoingingRequests**: Apply logic on requests to ignore them from Live Collection
- **ignoreOutgoingingRequests**: Return true/false to ignore outgoing request from Live Collection
- type: Function(request: requestOptions) : boolean

@@ -76,0 +77,0 @@ - For propertires available on request see: https://nodejs.org/api/http.html#httprequesturl-options-callback

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc