Skip to content

Commit 7e78c3c

Browse files
authored
Merge branch 'main' into event-hanlder/route-matching-resolution
2 parents 9a1c059 + 1fc8604 commit 7e78c3c

File tree

5 files changed

+20
-17
lines changed

5 files changed

+20
-17
lines changed

packages/idempotency/src/IdempotencyHandler.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff 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,

packages/idempotency/src/config/EnvironmentVariablesService.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff 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.

packages/idempotency/src/persistence/BasePersistenceLayer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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';

packages/idempotency/src/persistence/DynamoDBPersistenceLayer.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,16 @@ import { IdempotencyRecord } from './IdempotencyRecord.js';
5050
* @category Persistence Layer
5151
*/
5252
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;
6363

6464
public constructor(config: DynamoDBPersistenceOptions) {
6565
super();

packages/idempotency/src/persistence/IdempotencyRecord.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)