Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/idempotency/src/IdempotencyHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ export class IdempotencyHandler<Func extends AnyFunction> {
*
* This is called when the handler throws an error.
*/
#deleteInProgressRecord = async (): Promise<void> => {
readonly #deleteInProgressRecord = async (): Promise<void> => {
try {
await this.#persistenceStore.deleteRecord(
this.#functionPayloadToBeHashed
Expand All @@ -356,7 +356,7 @@ export class IdempotencyHandler<Func extends AnyFunction> {
* Before returning a result, we might neede to look up the idempotency record
* and validate it to ensure that it is consistent with the payload to be hashed.
*/
#saveInProgressOrReturnExistingResult = async (): Promise<{
readonly #saveInProgressOrReturnExistingResult = async (): Promise<{
isIdempotent: boolean;
result: JSONValue;
}> => {
Expand Down Expand Up @@ -419,7 +419,9 @@ export class IdempotencyHandler<Func extends AnyFunction> {
*
* @param result The result returned by the handler.
*/
#saveSuccessfulResult = async (result: ReturnType<Func>): Promise<void> => {
readonly #saveSuccessfulResult = async (
result: ReturnType<Func>
): Promise<void> => {
try {
await this.#persistenceStore.saveSuccess(
this.#functionPayloadToBeHashed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ class EnvironmentVariablesService
implements ConfigServiceInterface
{
// Reserved environment variables
private functionNameVariable = 'AWS_LAMBDA_FUNCTION_NAME';
private idempotencyDisabledVariable = 'POWERTOOLS_IDEMPOTENCY_DISABLED';
private readonly functionNameVariable = 'AWS_LAMBDA_FUNCTION_NAME';
private readonly idempotencyDisabledVariable =
'POWERTOOLS_IDEMPOTENCY_DISABLED';

/**
* It returns the value of the AWS_LAMBDA_FUNCTION_NAME environment variable.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ abstract class BasePersistenceLayer implements BasePersistenceLayerInterface {
private cache?: LRUCache<string, IdempotencyRecord>;
private configured = false;
// envVarsService is always initialized in the constructor
private envVarsService!: EnvironmentVariablesService;
private readonly envVarsService!: EnvironmentVariablesService;
private eventKeyJmesPath?: string;
protected expiresAfterSeconds: number = 60 * 60; // 1 hour default
private hashFunction = 'md5';
Expand Down
20 changes: 10 additions & 10 deletions packages/idempotency/src/persistence/DynamoDBPersistenceLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ import { IdempotencyRecord } from './IdempotencyRecord.js';
* @category Persistence Layer
*/
class DynamoDBPersistenceLayer extends BasePersistenceLayer {
private client: DynamoDBClient;
private dataAttr: string;
private expiryAttr: string;
private inProgressExpiryAttr: string;
private keyAttr: string;
private sortKeyAttr?: string;
private staticPkValue: string;
private statusAttr: string;
private tableName: string;
private validationKeyAttr: string;
private readonly client: DynamoDBClient;
private readonly dataAttr: string;
private readonly expiryAttr: string;
private readonly inProgressExpiryAttr: string;
private readonly keyAttr: string;
private readonly sortKeyAttr?: string;
private readonly staticPkValue: string;
private readonly statusAttr: string;
private readonly tableName: string;
private readonly validationKeyAttr: string;

public constructor(config: DynamoDBPersistenceOptions) {
super();
Expand Down
2 changes: 1 addition & 1 deletion packages/idempotency/src/persistence/IdempotencyRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class IdempotencyRecord {
* {@link constants.IdempotencyRecordStatusValue | IdempotencyRecordStatusValue}
* @private
*/
private status: IdempotencyRecordStatusValue;
private readonly status: IdempotencyRecordStatusValue;

public constructor(config: IdempotencyRecordOptions) {
this.idempotencyKey = config.idempotencyKey;
Expand Down
Loading