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
5 changes: 5 additions & 0 deletions .changeset/dull-foxes-wave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@driimus/sqs-permanent-failure-dlq': minor
---

refactor: use native iterator helpers
5 changes: 0 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ on:

jobs:
test:
strategy:
matrix:
node-version: [18, 20, 22]
uses: driimus/shared-workflows/.github/workflows/test.yml@main
with:
node-version: ${{ matrix.node-version }}
secrets:
turbo_token: ${{ secrets.TURBO_TOKEN }}
turbo_team: ${{ secrets.TURBO_TEAM }}
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/jod
lts/krypton
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export default tsEslint.config(
'prefer-const': ['error', { destructuring: 'all' }],
'unicorn/filename-case': ['warn', { case: 'camelCase' }],
'unicorn/no-null': 'off',
'unicorn/no-array-callback-reference': 'off',
'unicorn/no-useless-switch-case': 'error',
'unicorn/prevent-abbreviations': 'warn',
'@typescript-eslint/consistent-type-imports': 'error',
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"@changesets/cli": "^2.27.1",
"@eslint/js": "^9.22.0",
"@faker-js/faker": "^9.6.0",
"@tsconfig/node-lts": "^22.0.1",
"@tsconfig/strictest": "^2.0.5",
"@tsconfig/node-lts": "^24.0.0",
"@tsconfig/strictest": "^2.0.8",
"@types/aws-lambda": "^8.10.146",
"@types/node": "^22.10.2",
"@typescript-eslint/eslint-plugin": "^8.23.0",
Expand All @@ -39,12 +39,12 @@
"fishery": "^2.2.2",
"prettier": "^3.2.4",
"turbo": "^2.0.1",
"typescript": "^5.7.3",
"typescript": "^5.9.3",
"typescript-eslint": "^8.23.0",
"vitest": "^3.0.0"
},
"packageManager": "pnpm@10.6.4+sha256.0a3574244b6d2bea5b5d530c0901fbc5dafa593c2e9962a421d57b839f97063f",
"packageManager": "pnpm@10.25.0+sha256.0f3726654b0b5e52e5800904de168afc3c667e2abf84bdb06d9ac1386104bd90",
"engines": {
"node": ">=18.18.2"
"node": ">=24.11.0"
}
}
2 changes: 1 addition & 1 deletion packages/lambda-batch-processor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@
}
},
"engines": {
"node": ">=18"
"node": ">=24"
}
}
3 changes: 3 additions & 0 deletions packages/sqs-permanent-failure-dlq/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,8 @@
"@types/aws-lambda": {
"optional": true
}
},
"engines": {
"node": ">=24"
}
}
6 changes: 2 additions & 4 deletions packages/sqs-permanent-failure-dlq/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import type {
import type { ProcessableRecord } from '@driimus/lambda-batch-processor/types/index.js';
import type { SQSEvent, SQSRecord } from 'aws-lambda';

import { map, take } from './iteratorHelpers.js';

/**
* SQS batch actions can only manipulate up to 10 messages.
*
Expand Down Expand Up @@ -74,10 +72,10 @@ export class PermanentFailureDLQHandler implements PermanentFailureHandler<SQSEv
}

const Failure = {
*toMessageBatch(iterator: IterableIterator<PermanentFailure<SQSRecord>>) {
*toMessageBatch(iterator: IteratorObject<PermanentFailure<SQSRecord>>) {
let chunk: ReturnType<typeof Failure.toEntry>[];
while (true) {
chunk = [...map(take(iterator, MAX_BATCH_SIZE), Failure.toEntry)];
chunk = iterator.take(MAX_BATCH_SIZE).map(Failure.toEntry).toArray();
if (chunk.length === 0) return;
yield chunk;
}
Expand Down
13 changes: 0 additions & 13 deletions packages/sqs-permanent-failure-dlq/src/iteratorHelpers.ts

This file was deleted.

104 changes: 52 additions & 52 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.