@postman/postman-sdk
Advanced tools
Comparing version 0.0.25 to 0.0.26
@@ -41,3 +41,3 @@ "use strict"; | ||
} | ||
const keysOfProps = ["collectionId", "apiToken", "collectorEndpoint", "testCollectorEndpoint", "samplingRatio", "enable", "debug", "dataTruncation", "environment", "configFilePath", "dataRedactions"]; | ||
const keysOfProps = ["collectionId", "apiKey", "receiverEndpoint", "testreceiverEndpoint", "samplingRatio", "enable", "debug", "dataTruncation", "environment", "configFilePath", "dataRedactions"]; | ||
for (let key of keysOfProps) { | ||
@@ -44,0 +44,0 @@ if (!(key in config)) { |
import { DataRedactionRules } from './data-redaction-rules'; | ||
/** | ||
* BaseConfig, defines Instrumentation configurations. | ||
* collectorEndpoint: where the data should be shipped to collector's http endpoint. | ||
* apiToken: any api key needed for collector | ||
* testCollectorEndpoint: additional collector endpoint for testing. | ||
* receiverEndpoint: where the data should be shipped to collector's http endpoint. | ||
* apiKey: any api key needed for collector | ||
* testreceiverEndpoint: additional collector endpoint for testing. | ||
* samplingRatio: sampling ration ( TO-DO) | ||
@@ -14,6 +14,6 @@ * enable: enable or disable tracing. | ||
export interface BaseConfig { | ||
collectionId?: string; | ||
apiToken?: string; | ||
collectorEndpoint?: string; | ||
testCollectorEndpoint?: string; | ||
collectionId?: string | string[]; | ||
apiKey?: string; | ||
receiverEndpoint?: string; | ||
testreceiverEndpoint?: string; | ||
samplingRatio?: number | string; | ||
@@ -20,0 +20,0 @@ enable?: boolean; |
@@ -23,3 +23,3 @@ "use strict"; | ||
initialize(config) { | ||
var _a, _b; | ||
var _a, _b, _c; | ||
this.config = config; | ||
@@ -32,5 +32,8 @@ if (!this.config) { | ||
} | ||
if (typeof ((_a = this.config) === null || _a === void 0 ? void 0 : _a.collectionId) === 'string') { | ||
this.config.collectionId = (_b = this.config) === null || _b === void 0 ? void 0 : _b.collectionId.split(','); | ||
} | ||
const provider = new sdk_trace_node_1.NodeTracerProvider({ | ||
resource: new resources_1.Resource({ | ||
[semantic_attributes_1.POSTMAN_COLLECTION_IDS]: JSON.stringify((_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.collectionId) === null || _b === void 0 ? void 0 : _b.split(',')) | ||
[semantic_attributes_1.POSTMAN_COLLECTION_IDS]: JSON.stringify((_c = this.config) === null || _c === void 0 ? void 0 : _c.collectionId) | ||
}) | ||
@@ -77,8 +80,8 @@ }); | ||
}; | ||
if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.collectorEndpoint) { | ||
otelExporterConfig.url = this.config.collectorEndpoint; | ||
if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.receiverEndpoint) { | ||
otelExporterConfig.url = this.config.receiverEndpoint; | ||
} | ||
if ((_b = this.config) === null || _b === void 0 ? void 0 : _b.apiToken) { | ||
if ((_b = this.config) === null || _b === void 0 ? void 0 : _b.apiKey) { | ||
otelExporterConfig.headers = { | ||
'x-api-key': this.config.apiToken | ||
'x-api-key': this.config.apiKey | ||
}; | ||
@@ -85,0 +88,0 @@ } |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "0.0.24"; | ||
export declare const VERSION = "0.0.26"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VERSION = void 0; | ||
exports.VERSION = '0.0.24'; | ||
exports.VERSION = '0.0.26'; |
{ | ||
"name": "@postman/postman-sdk", | ||
"version": "0.0.25", | ||
"version": "0.0.26", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
@@ -6,6 +6,9 @@ ### About | ||
### Installation | ||
``` | ||
npm install @postman/postman-sdk | ||
``` | ||
At the top of your app.js file, before app is initialized add this. | ||
``` | ||
@@ -20,10 +23,11 @@ initialize({ | ||
SDK's initialization can be configured with these values | ||
- **collectionId**: Postman collectionId where requests will be added. | ||
- type: string | ||
- **apiToken**: any api key needed for collector | ||
- type: string | ||
- **collectorEndpoint**: where the data should be shipped to collector's http endpoint. | ||
- type: string | ||
- **apiKey**: Postman api key needed for collector | ||
- type: string | ||
- **receiverEndpoint**: where the data should be shipped to collector's http endpoint. | ||
- type: string(valid url) | ||
- default: 'https://trace-service-receiver.postman-beta.tech/traces' | ||
- **testCollectorEndpoint**: additional collector endpoint for testing. | ||
- **testreceiverEndpoint**: additional collector endpoint for testing. | ||
- type: string (valid url) | ||
@@ -40,5 +44,6 @@ - **samplingRatio**: sampling ration ( TO-DO) | ||
- **environment**: instrumentation environment development/prod etc. ( implementation TO-DO) | ||
- type: string | ||
- type: string | ||
- **configFilePath**: path to config YAML file. | ||
- type: string | ||
- type: string | ||
``` | ||
@@ -49,1 +54,2 @@ | ||
``` |
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
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
812
52
0
35470
40