🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →

@aws-lambda-powertools/commons

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-lambda-powertools/commons - npm Package Compare versions

Comparing version

to
2.21.0

@@ -76,10 +76,4 @@ import type { ConfigServiceInterface } from '../types/ConfigServiceInterface.js';

isValueFalse(value: string): boolean;
/**
* Get the AWS X-Ray Trace data from the environment variable.
*
* The method parses the environment variable `_X_AMZN_TRACE_ID` and returns an object with the key-value pairs.
*/
private getXrayTraceData;
}
export { EnvironmentVariablesService };
//# sourceMappingURL=EnvironmentVariablesService.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EnvironmentVariablesService = void 0;
const envUtils_js_1 = require("../envUtils.js");
/**

@@ -48,3 +49,3 @@ * This class is used to fetch environment variables that are available in the execution environment.

getServiceName() {
return this.get(this.serviceNameVariable);
return (0, envUtils_js_1.getServiceName)();
}

@@ -60,4 +61,3 @@ /**

getXrayTraceId() {
const xRayTraceData = this.getXrayTraceData();
return xRayTraceData?.Root;
return (0, envUtils_js_1.getXRayTraceIdFromEnv)();
}

@@ -71,4 +71,3 @@ /**

getXrayTraceSampled() {
const xRayTraceData = this.getXrayTraceData();
return xRayTraceData?.Sampled === '1';
return (0, envUtils_js_1.isRequestXRaySampled)();
}

@@ -79,3 +78,3 @@ /**

isDevMode() {
return this.isValueTrue(this.get(this.devModeVariable));
return (0, envUtils_js_1.isDevMode)();
}

@@ -100,21 +99,3 @@ /**

}
/**
* Get the AWS X-Ray Trace data from the environment variable.
*
* The method parses the environment variable `_X_AMZN_TRACE_ID` and returns an object with the key-value pairs.
*/
getXrayTraceData() {
const xRayTraceEnv = this.get(this.xRayTraceIdVariable);
if (xRayTraceEnv === '')
return undefined;
if (!xRayTraceEnv.includes('='))
return { Root: xRayTraceEnv };
const xRayTraceData = {};
for (const field of xRayTraceEnv.split(';')) {
const [key, value] = field.split('=');
xRayTraceData[key] = value;
}
return xRayTraceData;
}
}
exports.EnvironmentVariablesService = EnvironmentVariablesService;

@@ -7,2 +7,3 @@ export type { Request, MiddlewareLikeObj, MiddyLikeRequest, MiddlewareFn, CleanupFunction, } from './middy.js';

export type { ConfigServiceInterface } from './ConfigServiceInterface.js';
export type { GetStringFromEnvOptions, GetBooleanFromEnvOptions, GetNumberFromEnvOptions, } from './envUtils.js';
//# sourceMappingURL=index.d.ts.map

@@ -1,2 +0,2 @@

export declare const PT_VERSION = "2.20.0";
export declare const PT_VERSION = "2.21.0";
//# sourceMappingURL=version.d.ts.map

@@ -5,2 +5,2 @@ "use strict";

// this file is auto generated, do not modify
exports.PT_VERSION = '2.20.0';
exports.PT_VERSION = '2.21.0';

@@ -76,10 +76,4 @@ import type { ConfigServiceInterface } from '../types/ConfigServiceInterface.js';

isValueFalse(value: string): boolean;
/**
* Get the AWS X-Ray Trace data from the environment variable.
*
* The method parses the environment variable `_X_AMZN_TRACE_ID` and returns an object with the key-value pairs.
*/
private getXrayTraceData;
}
export { EnvironmentVariablesService };
//# sourceMappingURL=EnvironmentVariablesService.d.ts.map

@@ -0,1 +1,2 @@

import { getServiceName, getXRayTraceIdFromEnv, isDevMode, isRequestXRaySampled, } from '../envUtils.js';
/**

@@ -45,3 +46,3 @@ * This class is used to fetch environment variables that are available in the execution environment.

getServiceName() {
return this.get(this.serviceNameVariable);
return getServiceName();
}

@@ -57,4 +58,3 @@ /**

getXrayTraceId() {
const xRayTraceData = this.getXrayTraceData();
return xRayTraceData?.Root;
return getXRayTraceIdFromEnv();
}

@@ -68,4 +68,3 @@ /**

getXrayTraceSampled() {
const xRayTraceData = this.getXrayTraceData();
return xRayTraceData?.Sampled === '1';
return isRequestXRaySampled();
}

@@ -76,3 +75,3 @@ /**

isDevMode() {
return this.isValueTrue(this.get(this.devModeVariable));
return isDevMode();
}

@@ -97,21 +96,3 @@ /**

}
/**
* Get the AWS X-Ray Trace data from the environment variable.
*
* The method parses the environment variable `_X_AMZN_TRACE_ID` and returns an object with the key-value pairs.
*/
getXrayTraceData() {
const xRayTraceEnv = this.get(this.xRayTraceIdVariable);
if (xRayTraceEnv === '')
return undefined;
if (!xRayTraceEnv.includes('='))
return { Root: xRayTraceEnv };
const xRayTraceData = {};
for (const field of xRayTraceEnv.split(';')) {
const [key, value] = field.split('=');
xRayTraceData[key] = value;
}
return xRayTraceData;
}
}
export { EnvironmentVariablesService };

@@ -7,2 +7,3 @@ export type { Request, MiddlewareLikeObj, MiddyLikeRequest, MiddlewareFn, CleanupFunction, } from './middy.js';

export type { ConfigServiceInterface } from './ConfigServiceInterface.js';
export type { GetStringFromEnvOptions, GetBooleanFromEnvOptions, GetNumberFromEnvOptions, } from './envUtils.js';
//# sourceMappingURL=index.d.ts.map

@@ -1,2 +0,2 @@

export declare const PT_VERSION = "2.20.0";
export declare const PT_VERSION = "2.21.0";
//# sourceMappingURL=version.d.ts.map
// this file is auto generated, do not modify
export const PT_VERSION = '2.20.0';
export const PT_VERSION = '2.21.0';
{
"name": "@aws-lambda-powertools/commons",
"version": "2.20.0",
"version": "2.21.0",
"description": "A shared utility package for Powertools for AWS Lambda (TypeScript) libraries",

@@ -58,2 +58,6 @@ "author": {

},
"./utils/env": {
"import": "./lib/esm/envUtils.js",
"require": "./lib/cjs/envUtils.js"
},
"./types": {

@@ -82,2 +86,6 @@ "import": "./lib/esm/types/index.js",

],
"utils/env": [
"lib/cjs/envUtils.d.ts",
"lib/esm/envUtils.d.ts"
],
"types": [

@@ -84,0 +92,0 @@ "lib/cjs/types/index.d.ts",

@@ -131,2 +131,3 @@ # Powertools for AWS Lambda (TypeScript) <!-- omit in toc -->

- [Hashnode](https://hashnode.com/)
- [Instil](https://instil.co/)
- [LocalStack](https://localstack.cloud/)

@@ -133,0 +134,0 @@ - [Ours Privacy](https://oursprivacy.com/)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet