File tree Expand file tree Collapse file tree 5 files changed +20
-17
lines changed Expand file tree Collapse file tree 5 files changed +20
-17
lines changed Original file line number Diff line number Diff line change @@ -337,7 +337,7 @@ export class IdempotencyHandler<Func extends AnyFunction> {
337337 *
338338 * This is called when the handler throws an error.
339339 */
340- #deleteInProgressRecord = async ( ) : Promise < void > => {
340+ readonly #deleteInProgressRecord = async ( ) : Promise < void > => {
341341 try {
342342 await this . #persistenceStore. deleteRecord (
343343 this . #functionPayloadToBeHashed
@@ -356,7 +356,7 @@ export class IdempotencyHandler<Func extends AnyFunction> {
356356 * Before returning a result, we might neede to look up the idempotency record
357357 * and validate it to ensure that it is consistent with the payload to be hashed.
358358 */
359- #saveInProgressOrReturnExistingResult = async ( ) : Promise < {
359+ readonly #saveInProgressOrReturnExistingResult = async ( ) : Promise < {
360360 isIdempotent : boolean ;
361361 result : JSONValue ;
362362 } > => {
@@ -419,7 +419,9 @@ export class IdempotencyHandler<Func extends AnyFunction> {
419419 *
420420 * @param result The result returned by the handler.
421421 */
422- #saveSuccessfulResult = async ( result : ReturnType < Func > ) : Promise < void > => {
422+ readonly #saveSuccessfulResult = async (
423+ result : ReturnType < Func >
424+ ) : Promise < void > => {
423425 try {
424426 await this . #persistenceStore. saveSuccess (
425427 this . #functionPayloadToBeHashed,
Original file line number Diff line number Diff line change @@ -19,8 +19,9 @@ class EnvironmentVariablesService
1919 implements ConfigServiceInterface
2020{
2121 // Reserved environment variables
22- private functionNameVariable = 'AWS_LAMBDA_FUNCTION_NAME' ;
23- private idempotencyDisabledVariable = 'POWERTOOLS_IDEMPOTENCY_DISABLED' ;
22+ private readonly functionNameVariable = 'AWS_LAMBDA_FUNCTION_NAME' ;
23+ private readonly idempotencyDisabledVariable =
24+ 'POWERTOOLS_IDEMPOTENCY_DISABLED' ;
2425
2526 /**
2627 * It returns the value of the AWS_LAMBDA_FUNCTION_NAME environment variable.
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ abstract class BasePersistenceLayer implements BasePersistenceLayerInterface {
2828 private cache ?: LRUCache < string , IdempotencyRecord > ;
2929 private configured = false ;
3030 // envVarsService is always initialized in the constructor
31- private envVarsService ! : EnvironmentVariablesService ;
31+ private readonly envVarsService ! : EnvironmentVariablesService ;
3232 private eventKeyJmesPath ?: string ;
3333 protected expiresAfterSeconds : number = 60 * 60 ; // 1 hour default
3434 private hashFunction = 'md5' ;
Original file line number Diff line number Diff line change @@ -50,16 +50,16 @@ import { IdempotencyRecord } from './IdempotencyRecord.js';
5050 * @category Persistence Layer
5151 */
5252class DynamoDBPersistenceLayer extends BasePersistenceLayer {
53- private client : DynamoDBClient ;
54- private dataAttr : string ;
55- private expiryAttr : string ;
56- private inProgressExpiryAttr : string ;
57- private keyAttr : string ;
58- private sortKeyAttr ?: string ;
59- private staticPkValue : string ;
60- private statusAttr : string ;
61- private tableName : string ;
62- private validationKeyAttr : string ;
53+ private readonly client : DynamoDBClient ;
54+ private readonly dataAttr : string ;
55+ private readonly expiryAttr : string ;
56+ private readonly inProgressExpiryAttr : string ;
57+ private readonly keyAttr : string ;
58+ private readonly sortKeyAttr ?: string ;
59+ private readonly staticPkValue : string ;
60+ private readonly statusAttr : string ;
61+ private readonly tableName : string ;
62+ private readonly validationKeyAttr : string ;
6363
6464 public constructor ( config : DynamoDBPersistenceOptions ) {
6565 super ( ) ;
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ class IdempotencyRecord {
4242 * {@link constants.IdempotencyRecordStatusValue | IdempotencyRecordStatusValue}
4343 * @private
4444 */
45- private status : IdempotencyRecordStatusValue ;
45+ private readonly status : IdempotencyRecordStatusValue ;
4646
4747 public constructor ( config : IdempotencyRecordOptions ) {
4848 this . idempotencyKey = config . idempotencyKey ;
You can’t perform that action at this time.
0 commit comments