customerio-node
Advanced tools
Comparing version 3.1.1 to 3.1.2
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
## [3.1.2] | ||
- Set `User-Agent` for property source attributes on activity logs ([#93](https://github.com/customerio/customerio-node/pull/93)) | ||
## [3.1.1] | ||
@@ -5,0 +9,0 @@ |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const https_1 = require("https"); | ||
const url_1 = require("url"); | ||
const fs_1 = __importDefault(require("fs")); | ||
const path_1 = require("path"); | ||
const utils_1 = require("./utils"); | ||
const TIMEOUT = 10000; | ||
const PACKAGE_JSON = fs_1.default.readFileSync(path_1.resolve(__dirname, '..', 'package.json')); | ||
class CIORequest { | ||
@@ -24,2 +30,10 @@ constructor(auth, defaults) { | ||
const body = data ? JSON.stringify(data) : null; | ||
let libraryVersion = 'Unknown'; | ||
try { | ||
let json = JSON.parse(PACKAGE_JSON.toString()); | ||
libraryVersion = json.version; | ||
} | ||
catch (_a) { | ||
console.warn('WARN: package.json contents could not be read. Activity source data in Customer.io will be incorrect.'); | ||
} | ||
const headers = { | ||
@@ -29,2 +43,3 @@ Authorization: this.auth, | ||
'Content-Length': body ? Buffer.byteLength(body, 'utf8') : 0, | ||
'User-Agent': `Customer.io Node Client/${libraryVersion}`, | ||
}; | ||
@@ -31,0 +46,0 @@ return { method, uri, headers, body }; |
import { request } from 'https'; | ||
import type { RequestOptions } from 'https'; | ||
import { URL } from 'url'; | ||
import fs from 'fs'; | ||
import { resolve } from 'path'; | ||
import { CustomerIORequestError } from './utils'; | ||
@@ -23,2 +25,3 @@ | ||
const TIMEOUT = 10_000; | ||
const PACKAGE_JSON = fs.readFileSync(resolve(__dirname, '..', 'package.json')); | ||
@@ -53,2 +56,14 @@ export default class CIORequest { | ||
const body = data ? JSON.stringify(data) : null; | ||
let libraryVersion = 'Unknown'; | ||
try { | ||
let json = JSON.parse(PACKAGE_JSON.toString()); | ||
libraryVersion = json.version; | ||
} catch { | ||
console.warn( | ||
'WARN: package.json contents could not be read. Activity source data in Customer.io will be incorrect.', | ||
); | ||
} | ||
const headers = { | ||
@@ -58,2 +73,3 @@ Authorization: this.auth, | ||
'Content-Length': body ? Buffer.byteLength(body, 'utf8') : 0, | ||
'User-Agent': `Customer.io Node Client/${libraryVersion}`, | ||
}; | ||
@@ -60,0 +76,0 @@ |
{ | ||
"name": "customerio-node", | ||
"description": "A node client for the Customer.io event API. http://customer.io", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"author": "Customer.io (https://customer.io)", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
56786
986
1
2