diff --git a/components/aws/package.json b/components/aws/package.json index 2dee0cc912151..11e2480be6f66 100644 --- a/components/aws/package.json +++ b/components/aws/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/aws", - "version": "0.7.5", + "version": "0.7.6", "description": "Pipedream Aws Components", "main": "aws.app.mjs", "keywords": [ diff --git a/components/aws/sources/new-dynamodb-stream-event/new-dynamodb-stream-event.mjs b/components/aws/sources/new-dynamodb-stream-event/new-dynamodb-stream-event.mjs index bf66e08e447d7..8c23bf865a629 100644 --- a/components/aws/sources/new-dynamodb-stream-event/new-dynamodb-stream-event.mjs +++ b/components/aws/sources/new-dynamodb-stream-event/new-dynamodb-stream-event.mjs @@ -6,7 +6,7 @@ export default { name: "New DynamoDB Stream Event", description: "Emit new event when a DynamoDB stream receives new events. [See the docs here](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_GetRecords.html)", type: "source", - version: "0.0.2", + version: "0.0.3", dedupe: "unique", props: { ...common.props, @@ -36,6 +36,12 @@ export default { }, hooks: { async deploy() { + await this._getNewShardIterator(); + }, + }, + methods: { + ...common.methods, + async _getNewShardIterator() { const { StreamDescription: streamDescription } = await this.listShards({ StreamArn: this.stream, }); @@ -46,10 +52,8 @@ export default { ShardIteratorType: "LATEST", }); this._setShardIterator(shardIterator); + return shardIterator; }, - }, - methods: { - ...common.methods, _getShardIterator() { return this.db.get("shardIterator"); }, @@ -71,7 +75,7 @@ export default { throw new Error("Stream is no longer enabled."); } - const shardIterator = this._getShardIterator(); + const shardIterator = this._getShardIterator() ?? (await this._getNewShardIterator()); const { Records: records, NextShardIterator: nextShardIterator, @@ -84,6 +88,8 @@ export default { this.$emit(record, meta); } - this._setShardIterator(nextShardIterator); + if (nextShardIterator) { + this._setShardIterator(nextShardIterator); + } }, }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e39376605af3e..ab58933ab74c2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -34336,6 +34336,8 @@ snapshots: '@putout/operator-filesystem': 5.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3)) '@putout/operator-json': 2.2.0 putout: 36.13.1(eslint@8.57.1)(typescript@5.6.3) + transitivePeerDependencies: + - supports-color '@putout/operator-regexp@1.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3))': dependencies: