@aws-lambda-powertools/commons
Advanced tools
Comparing version
@@ -54,5 +54,11 @@ /** | ||
export declare class Utility { | ||
#private; | ||
protected coldStart: boolean; | ||
protected readonly defaultServiceName: string; | ||
constructor(); | ||
/** | ||
* Get the value of the `AWS_LAMBDA_INITIALIZATION_TYPE` environment variable. | ||
*/ | ||
protected getInitializationType(): 'unknown' | 'on-demand' | 'provisioned-concurrency'; | ||
/** | ||
* Get the cold start status of the current execution environment. | ||
@@ -59,0 +65,0 @@ * |
@@ -57,5 +57,25 @@ "use strict"; | ||
class Utility { | ||
#initializationType; | ||
coldStart = true; | ||
defaultServiceName = 'service_undefined'; | ||
constructor() { | ||
this.#initializationType = this.getInitializationType(); | ||
if (this.#initializationType !== 'on-demand') { | ||
this.coldStart = false; | ||
} | ||
} | ||
/** | ||
* Get the value of the `AWS_LAMBDA_INITIALIZATION_TYPE` environment variable. | ||
*/ | ||
getInitializationType() { | ||
const envVarValue = process.env.AWS_LAMBDA_INITIALIZATION_TYPE?.trim(); | ||
if (envVarValue === 'on-demand') { | ||
return 'on-demand'; | ||
} | ||
if (envVarValue === 'provisioned-concurrency') { | ||
return 'provisioned-concurrency'; | ||
} | ||
return 'unknown'; | ||
} | ||
/** | ||
* Get the cold start status of the current execution environment. | ||
@@ -66,2 +86,5 @@ * | ||
getColdStart() { | ||
if (this.#initializationType !== 'on-demand') { | ||
return false; | ||
} | ||
if (this.coldStart) { | ||
@@ -68,0 +91,0 @@ this.coldStart = false; |
@@ -1,2 +0,2 @@ | ||
export declare const PT_VERSION = "2.16.0"; | ||
export declare const PT_VERSION = "2.17.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -5,2 +5,2 @@ "use strict"; | ||
// this file is auto generated, do not modify | ||
exports.PT_VERSION = '2.16.0'; | ||
exports.PT_VERSION = '2.17.0'; |
@@ -54,5 +54,11 @@ /** | ||
export declare class Utility { | ||
#private; | ||
protected coldStart: boolean; | ||
protected readonly defaultServiceName: string; | ||
constructor(); | ||
/** | ||
* Get the value of the `AWS_LAMBDA_INITIALIZATION_TYPE` environment variable. | ||
*/ | ||
protected getInitializationType(): 'unknown' | 'on-demand' | 'provisioned-concurrency'; | ||
/** | ||
* Get the cold start status of the current execution environment. | ||
@@ -59,0 +65,0 @@ * |
@@ -54,5 +54,25 @@ /** | ||
export class Utility { | ||
#initializationType; | ||
coldStart = true; | ||
defaultServiceName = 'service_undefined'; | ||
constructor() { | ||
this.#initializationType = this.getInitializationType(); | ||
if (this.#initializationType !== 'on-demand') { | ||
this.coldStart = false; | ||
} | ||
} | ||
/** | ||
* Get the value of the `AWS_LAMBDA_INITIALIZATION_TYPE` environment variable. | ||
*/ | ||
getInitializationType() { | ||
const envVarValue = process.env.AWS_LAMBDA_INITIALIZATION_TYPE?.trim(); | ||
if (envVarValue === 'on-demand') { | ||
return 'on-demand'; | ||
} | ||
if (envVarValue === 'provisioned-concurrency') { | ||
return 'provisioned-concurrency'; | ||
} | ||
return 'unknown'; | ||
} | ||
/** | ||
* Get the cold start status of the current execution environment. | ||
@@ -63,2 +83,5 @@ * | ||
getColdStart() { | ||
if (this.#initializationType !== 'on-demand') { | ||
return false; | ||
} | ||
if (this.coldStart) { | ||
@@ -65,0 +88,0 @@ this.coldStart = false; |
@@ -1,2 +0,2 @@ | ||
export declare const PT_VERSION = "2.16.0"; | ||
export declare const PT_VERSION = "2.17.0"; | ||
//# sourceMappingURL=version.d.ts.map |
// this file is auto generated, do not modify | ||
export const PT_VERSION = '2.16.0'; | ||
export const PT_VERSION = '2.17.0'; |
{ | ||
"name": "@aws-lambda-powertools/commons", | ||
"version": "2.16.0", | ||
"version": "2.17.0", | ||
"description": "A shared utility package for Powertools for AWS Lambda (TypeScript) libraries", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -129,2 +129,3 @@ # Powertools for AWS Lambda (TypeScript) <!-- omit in toc --> | ||
- [globaldatanet](https://globaldatanet.com/) | ||
- [Guild](https://guild.com) | ||
- [Hashnode](https://hashnode.com/) | ||
@@ -131,0 +132,0 @@ - [LocalStack](https://localstack.cloud/) |
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
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
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
167747
1.4%3775
1.56%149
0.68%