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> {
337
337
*
338
338
* This is called when the handler throws an error.
339
339
*/
340
- #deleteInProgressRecord = async ( ) : Promise < void > => {
340
+ readonly #deleteInProgressRecord = async ( ) : Promise < void > => {
341
341
try {
342
342
await this . #persistenceStore. deleteRecord (
343
343
this . #functionPayloadToBeHashed
@@ -356,7 +356,7 @@ export class IdempotencyHandler<Func extends AnyFunction> {
356
356
* Before returning a result, we might neede to look up the idempotency record
357
357
* and validate it to ensure that it is consistent with the payload to be hashed.
358
358
*/
359
- #saveInProgressOrReturnExistingResult = async ( ) : Promise < {
359
+ readonly #saveInProgressOrReturnExistingResult = async ( ) : Promise < {
360
360
isIdempotent : boolean ;
361
361
result : JSONValue ;
362
362
} > => {
@@ -419,7 +419,9 @@ export class IdempotencyHandler<Func extends AnyFunction> {
419
419
*
420
420
* @param result The result returned by the handler.
421
421
*/
422
- #saveSuccessfulResult = async ( result : ReturnType < Func > ) : Promise < void > => {
422
+ readonly #saveSuccessfulResult = async (
423
+ result : ReturnType < Func >
424
+ ) : Promise < void > => {
423
425
try {
424
426
await this . #persistenceStore. saveSuccess (
425
427
this . #functionPayloadToBeHashed,
Original file line number Diff line number Diff line change @@ -19,8 +19,9 @@ class EnvironmentVariablesService
19
19
implements ConfigServiceInterface
20
20
{
21
21
// 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' ;
24
25
25
26
/**
26
27
* 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 {
28
28
private cache ?: LRUCache < string , IdempotencyRecord > ;
29
29
private configured = false ;
30
30
// envVarsService is always initialized in the constructor
31
- private envVarsService ! : EnvironmentVariablesService ;
31
+ private readonly envVarsService ! : EnvironmentVariablesService ;
32
32
private eventKeyJmesPath ?: string ;
33
33
protected expiresAfterSeconds : number = 60 * 60 ; // 1 hour default
34
34
private hashFunction = 'md5' ;
Original file line number Diff line number Diff line change @@ -50,16 +50,16 @@ import { IdempotencyRecord } from './IdempotencyRecord.js';
50
50
* @category Persistence Layer
51
51
*/
52
52
class 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 ;
63
63
64
64
public constructor ( config : DynamoDBPersistenceOptions ) {
65
65
super ( ) ;
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ class IdempotencyRecord {
42
42
* {@link constants.IdempotencyRecordStatusValue | IdempotencyRecordStatusValue}
43
43
* @private
44
44
*/
45
- private status : IdempotencyRecordStatusValue ;
45
+ private readonly status : IdempotencyRecordStatusValue ;
46
46
47
47
public constructor ( config : IdempotencyRecordOptions ) {
48
48
this . idempotencyKey = config . idempotencyKey ;
You can’t perform that action at this time.
0 commit comments