@plattar/sdk-core
Advanced tools
Comparing version
@@ -17,4 +17,4 @@ "use strict"; | ||
version: (config.options && config.options.version) ? config.options.version : 'v3', | ||
tls: (config.options && config.options.tls) ? true : false, | ||
gzip: (config.options && config.options.gzip) ? true : false, | ||
tls: (config.options && config.options.tls) ? util_1.Util.parseBool(config.options.tls) : false, | ||
gzip: (config.options && config.options.gzip) ? util_1.Util.parseBool(config.options.gzip) : false, | ||
errorHandler: (config.options && config.options.errorHandler) ? config.options.errorHandler : 'console.error', | ||
@@ -28,2 +28,11 @@ errorListener: (config.options && config.options.errorListener && util_1.Util.isFunction(config.options.errorListener)) ? config.options.errorListener : (_) => { } | ||
}); | ||
// set TLS options for NodeJS | ||
if (util_1.Util.isNode()) { | ||
if (this._config.options.tls) { | ||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "1"; | ||
} | ||
else { | ||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; | ||
} | ||
} | ||
} | ||
@@ -30,0 +39,0 @@ /** |
@@ -56,3 +56,3 @@ "use strict"; | ||
let output = '/*\n * Warning: Do Not Edit - Auto Generated via @plattar/sdk-core\n */\n\n'; | ||
output += `export { Service, ServiceConfig, ServiceAuth } from '@plattar/sdk-core';\n`; | ||
output += `export { Service, ServiceConfig, ServiceAuth, ServiceOptions, ServiceAuthType, ServiceErrorHandler, ServiceErrorListener } from '@plattar/sdk-core';\n`; | ||
files.forEach((schemas) => { | ||
@@ -79,4 +79,4 @@ schemas.schemas.forEach((schema) => { | ||
return { | ||
name: `connection-service`, | ||
fname: `connection-service.ts`, | ||
name: `connection`, | ||
fname: `connection.ts`, | ||
data: output | ||
@@ -83,0 +83,0 @@ }; |
@@ -16,2 +16,7 @@ export declare class Util { | ||
static isFunction(obj: any): boolean; | ||
/** | ||
* Checks if running inside NodeJS | ||
*/ | ||
static isNode(): boolean; | ||
static parseBool(value: any): boolean; | ||
} |
@@ -45,3 +45,18 @@ "use strict"; | ||
} | ||
/** | ||
* Checks if running inside NodeJS | ||
*/ | ||
static isNode() { | ||
return (typeof process !== 'undefined') && (process.release.name === 'node'); | ||
} | ||
static parseBool(value) { | ||
if (!value) { | ||
return false; | ||
} | ||
if ((typeof value === 'string') || (value instanceof String)) { | ||
return value.toLowerCase() === 'true' ? true : false; | ||
} | ||
return value === true ? true : false; | ||
} | ||
} | ||
exports.Util = Util; |
@@ -1,2 +0,2 @@ | ||
declare const _default: "1.163.9"; | ||
declare const _default: "1.163.10"; | ||
export default _default; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = "1.163.9"; | ||
exports.default = "1.163.10"; |
{ | ||
"name": "@plattar/sdk-core", | ||
"version": "1.163.9", | ||
"version": "1.163.10", | ||
"description": "Core SDK Module for Generative SDK using API Core", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
53198
1.97%1332
2.23%3
200%