From e3729a5663b6c591ecb68a3b4e70433aa4bd55ba Mon Sep 17 00:00:00 2001 From: "Lam, Anson" Date: Fri, 29 Oct 2021 17:49:50 -0400 Subject: [PATCH 01/10] fixes eslint issues, update rules --- .eslintrc | 16 ++++- README.md | 157 ++++++++++++++++++++--------------------- lib/dynamodb-client.js | 1 - lib/s3-client.js | 1 - 4 files changed, 90 insertions(+), 85 deletions(-) diff --git a/.eslintrc b/.eslintrc index bff8323a..d0802df8 100644 --- a/.eslintrc +++ b/.eslintrc @@ -4,7 +4,21 @@ "jest/no-conditional-expect": "off", "radar/no-identical-functions": "off", "unicorn/no-array-callback-reference": "off", - "unicorn/no-array-for-each": "off" + "unicorn/no-array-for-each": "off", + "unicorn/prefer-object-from-entries": "off", + "no-secrets/no-secrets": ["error", { + "ignoreContent": [ + "NoSuchLifecycleConfiguration", + "Kinesis_20131202.SubscribeToShard", + "ProvisionedThroughputExceededException", + "InvalidArgumentException", + "SubscribeToShardEvent", + "NoSuchLifecycleConfiguration", + "params.provisionedThroughput.writeCapacityUnits", + "eyJmb28iOiJiYXIsIGJhesQFxgoifQ==" + ], + "ignoreIdentifiers": ["PartitionKey"] + }] }, "overrides": [ { diff --git a/README.md b/README.md index 3cebc40c..661970b4 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ const kinesis = new Kinesis({ streamName: 'sample-stream' /* other options from AWS.Kinesis */ }); -kinesis.on('data', (data) => { +kinesis.on('data', data => { console.log('Incoming data:', data); }); kinesis.startConsumer(); @@ -56,23 +56,23 @@ pipeline([ ## API Reference -- [lifion-kinesis](#module_lifion-kinesis) - - [Kinesis](#exp_module_lifion-kinesis--Kinesis) ⇐ [PassThrough](https://nodejs.org/dist/latest-v10.x/docs/api/stream.html#stream_class_stream_passthrough) ⏏ - - [new Kinesis(options)](#new_module_lifion-kinesis--Kinesis_new) - - _instance_ - - [.startConsumer()](#module_lifion-kinesis--Kinesis+startConsumer) ⇒ Promise - - [.stopConsumer()](#module_lifion-kinesis--Kinesis+stopConsumer) - - [.putRecord(params)](#module_lifion-kinesis--Kinesis+putRecord) ⇒ Promise - - [.listShards(params)](#module_lifion-kinesis--Kinesis+listShards) ⇒ Promise - - [.putRecords(params)](#module_lifion-kinesis--Kinesis+putRecords) ⇒ Promise - - [.getStats()](#module_lifion-kinesis--Kinesis+getStats) ⇒ Object - - _static_ - - [.getStats()](#module_lifion-kinesis--Kinesis.getStats) ⇒ Object + +* [lifion-kinesis](#module_lifion-kinesis) + * [Kinesis](#exp_module_lifion-kinesis--Kinesis) ⇐ [PassThrough](https://nodejs.org/dist/latest-v10.x/docs/api/stream.html#stream_class_stream_passthrough) ⏏ + * [new Kinesis(options)](#new_module_lifion-kinesis--Kinesis_new) + * _instance_ + * [.startConsumer()](#module_lifion-kinesis--Kinesis+startConsumer) ⇒ Promise + * [.stopConsumer()](#module_lifion-kinesis--Kinesis+stopConsumer) + * [.putRecord(params)](#module_lifion-kinesis--Kinesis+putRecord) ⇒ Promise + * [.listShards(params)](#module_lifion-kinesis--Kinesis+listShards) ⇒ Promise + * [.putRecords(params)](#module_lifion-kinesis--Kinesis+putRecords) ⇒ Promise + * [.getStats()](#module_lifion-kinesis--Kinesis+getStats) ⇒ Object + * _static_ + * [.getStats()](#module_lifion-kinesis--Kinesis.getStats) ⇒ Object ### Kinesis ⇐ [PassThrough](https://nodejs.org/dist/latest-v10.x/docs/api/stream.html#stream_class_stream_passthrough) ⏏ - A [pass-through stream](https://nodejs.org/dist/latest-v10.x/docs/api/stream.html#stream_class_stream_passthrough) class specialization implementing a consumer of Kinesis Data Streams using the [AWS SDK for JavaScript](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest). Incoming data can be retrieved through either the `data` event or by piping the instance to other streams. @@ -82,50 +82,49 @@ data can be retrieved through either the `data` event or by piping the instance #### new Kinesis(options) - Initializes a new instance of the Kinesis client. -| Param | Type | Default | Description | -| ------------------------------------------ | ------------------------------------------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| options | Object | | The initialization options. In addition to the below options, it can also contain any of the [`AWS.Kinesis` options](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Kinesis.html#constructor-property). | -| [options.compression] | string | | The kind of data compression to use with records. The currently available compression options are either `"LZ-UTF8"` or none. | -| [options.consumerGroup] | string | | The name of the group of consumers in which shards will be distributed and checkpoints will be shared. If not provided, it defaults to the name of the application/project using this module. | -| [options.createStreamIfNeeded] | boolean | true | Whether if the Kinesis stream should be automatically created if it doesn't exist upon connection | -| [options.dynamoDb] | Object | {} | The initialization options for the DynamoDB client used to store the state of the consumers. In addition to `tableNames` and `tags`, it can also contain any of the [`AWS.DynamoDB` options](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#constructor-property). | -| [options.dynamoDb.tableName] | string | | The name of the table in which to store the state of consumers. If not provided, it defaults to "lifion-kinesis-state". | -| [options.dynamoDb.tags] | Object | | If provided, the client will ensure that the DynamoDB table where the state is stored is tagged with these tags. If the table already has tags, they will be merged. | -| [options.encryption] | Object | | The encryption options to enforce in the stream. | -| [options.encryption.type] | string | | The encryption type to use. | -| [options.encryption.keyId] | string | | The GUID for the customer-managed AWS KMS key to use for encryption. This value can be a globally unique identifier, a fully specified ARN to either an alias or a key, or an alias name prefixed by "alias/". | -| [options.leaseAcquisitionInterval] | number | 20000 | The interval in milliseconds for how often to attempt lease acquisitions. | -| [options.leaseAcquisitionRecoveryInterval] | number | 5000 | The interval in milliseconds for how often to re-attempt lease acquisitions when an error is returned from aws. | -| [options.limit] | number | 10000 | The limit of records per get records call (only applicable with `useEnhancedFanOut` is set to `false`) | -| [options.logger] | Object | | An object with the `warn`, `debug`, and `error` functions that will be used for logging purposes. If not provided, logging will be omitted. | -| [options.maxEnhancedConsumers] | number | 5 | An option to set the number of enhanced fan-out consumer ARNs that the module should initialize. Defaults to 5. Providing a number above the AWS limit (20) or below 1 will result in using the default. | -| [options.noRecordsPollDelay] | number | 1000 | The delay in milliseconds before attempting to get more records when there were none in the previous attempt (only applicable when `useEnhancedFanOut` is set to `false`) | -| [options.pollDelay] | number | 250 | When the `usePausedPolling` option is `false`, this option defines the delay in milliseconds in between poll requests for more records (only applicable when `useEnhancedFanOut` is set to `false`) | -| [options.s3] | Object | {} | The initialization options for the S3 client used to store large items in buckets. In addition to `bucketName` and `endpoint`, it can also contain any of the [`AWS.S3` options](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#constructor-property). | -| [options.s3.bucketName] | string | | The name of the bucket in which to store large messages. If not provided, it defaults to the name of the Kinesis stream. | -| [options.s3.largeItemThreshold] | number | 900 | The size in KB above which an item should automatically be stored in s3. | -| [options.s3.nonS3Keys] | Array.<string> | [] | If the `useS3ForLargeItems` option is set to `true`, the `nonS3Keys` option lists the keys that will be sent normally on the kinesis record. | -| [options.s3.tags] | string | | If provided, the client will ensure that the S3 bucket is tagged with these tags. If the bucket already has tags, they will be merged. | -| [options.shardCount] | number | 1 | The number of shards that the newly-created stream will use (if the `createStreamIfNeeded` option is set) | -| [options.shouldDeaggregate] | string \| boolean | "auto" | Whethe the method retrieving the records should expect aggregated records and deaggregate them appropriately. | -| [options.shouldParseJson] | string \| boolean | "auto" | Whether if retrieved records' data should be parsed as JSON or not. Set to "auto" to only attempt parsing if data looks like JSON. Set to true to force data parse. | -| [options.statsInterval] | number | 30000 | The interval in milliseconds for how often to emit the "stats" event. The event is only available while the consumer is running. | -| options.streamName | string | | The name of the stream to consume data from (required) | -| [options.supressThroughputWarnings] | boolean | false | Set to `true` to make the client log ProvisionedThroughputExceededException as debug rather than warning. | -| [options.tags] | Object | | If provided, the client will ensure that the stream is tagged with these tags upon connection. If the stream is already tagged, the existing tags will be merged with the provided ones before updating them. | -| [options.useAutoCheckpoints] | boolean | true | Set to `true` to make the client automatically store shard checkpoints using the sequence number of the most-recently received record. If set to `false` consumers can use the `setCheckpoint()` function to store any sequence number as the checkpoint for the shard. | -| [options.useAutoShardAssignment] | boolean | true | Set to `true` to automatically assign the stream shards to the active consumers in the same group (so only one client reads from one shard at the same time). Set to `false` to make the client read from all shards. | -| [options.useEnhancedFanOut] | boolean | false | Set to `true` to make the client use enhanced fan-out consumers to read from shards. | -| [options.usePausedPolling] | boolean | false | Set to `true` to make the client not to poll for more records until the consumer calls `continuePolling()`. This option is useful when consumers want to make sure the records are fully processed before receiving more (only applicable when `useEnhancedFanOut` is set to `false`) | -| [options.useS3ForLargeItems] | boolean | false | Whether to automatically use an S3 bucket to store large items or not. | + +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| options | Object | | The initialization options. In addition to the below options, it can also contain any of the [`AWS.Kinesis` options](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Kinesis.html#constructor-property). | +| [options.compression] | string | | The kind of data compression to use with records. The currently available compression options are either `"LZ-UTF8"` or none. | +| [options.consumerGroup] | string | | The name of the group of consumers in which shards will be distributed and checkpoints will be shared. If not provided, it defaults to the name of the application/project using this module. | +| [options.createStreamIfNeeded] | boolean | true | Whether if the Kinesis stream should be automatically created if it doesn't exist upon connection | +| [options.dynamoDb] | Object | {} | The initialization options for the DynamoDB client used to store the state of the consumers. In addition to `tableNames` and `tags`, it can also contain any of the [`AWS.DynamoDB` options](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#constructor-property). | +| [options.dynamoDb.tableName] | string | | The name of the table in which to store the state of consumers. If not provided, it defaults to "lifion-kinesis-state". | +| [options.dynamoDb.tags] | Object | | If provided, the client will ensure that the DynamoDB table where the state is stored is tagged with these tags. If the table already has tags, they will be merged. | +| [options.encryption] | Object | | The encryption options to enforce in the stream. | +| [options.encryption.type] | string | | The encryption type to use. | +| [options.encryption.keyId] | string | | The GUID for the customer-managed AWS KMS key to use for encryption. This value can be a globally unique identifier, a fully specified ARN to either an alias or a key, or an alias name prefixed by "alias/". | +| [options.leaseAcquisitionInterval] | number | 20000 | The interval in milliseconds for how often to attempt lease acquisitions. | +| [options.leaseAcquisitionRecoveryInterval] | number | 5000 | The interval in milliseconds for how often to re-attempt lease acquisitions when an error is returned from aws. | +| [options.limit] | number | 10000 | The limit of records per get records call (only applicable with `useEnhancedFanOut` is set to `false`) | +| [options.logger] | Object | | An object with the `warn`, `debug`, and `error` functions that will be used for logging purposes. If not provided, logging will be omitted. | +| [options.maxEnhancedConsumers] | number | 5 | An option to set the number of enhanced fan-out consumer ARNs that the module should initialize. Defaults to 5. Providing a number above the AWS limit (20) or below 1 will result in using the default. | +| [options.noRecordsPollDelay] | number | 1000 | The delay in milliseconds before attempting to get more records when there were none in the previous attempt (only applicable when `useEnhancedFanOut` is set to `false`) | +| [options.pollDelay] | number | 250 | When the `usePausedPolling` option is `false`, this option defines the delay in milliseconds in between poll requests for more records (only applicable when `useEnhancedFanOut` is set to `false`) | +| [options.s3] | Object | {} | The initialization options for the S3 client used to store large items in buckets. In addition to `bucketName` and `endpoint`, it can also contain any of the [`AWS.S3` options](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#constructor-property). | +| [options.s3.bucketName] | string | | The name of the bucket in which to store large messages. If not provided, it defaults to the name of the Kinesis stream. | +| [options.s3.largeItemThreshold] | number | 900 | The size in KB above which an item should automatically be stored in s3. | +| [options.s3.nonS3Keys] | Array.<string> | [] | If the `useS3ForLargeItems` option is set to `true`, the `nonS3Keys` option lists the keys that will be sent normally on the kinesis record. | +| [options.s3.tags] | string | | If provided, the client will ensure that the S3 bucket is tagged with these tags. If the bucket already has tags, they will be merged. | +| [options.shardCount] | number | 1 | The number of shards that the newly-created stream will use (if the `createStreamIfNeeded` option is set) | +| [options.shouldDeaggregate] | string \| boolean | "auto" | Whethe the method retrieving the records should expect aggregated records and deaggregate them appropriately. | +| [options.shouldParseJson] | string \| boolean | "auto" | Whether if retrieved records' data should be parsed as JSON or not. Set to "auto" to only attempt parsing if data looks like JSON. Set to true to force data parse. | +| [options.statsInterval] | number | 30000 | The interval in milliseconds for how often to emit the "stats" event. The event is only available while the consumer is running. | +| options.streamName | string | | The name of the stream to consume data from (required) | +| [options.supressThroughputWarnings] | boolean | false | Set to `true` to make the client log ProvisionedThroughputExceededException as debug rather than warning. | +| [options.tags] | Object | | If provided, the client will ensure that the stream is tagged with these tags upon connection. If the stream is already tagged, the existing tags will be merged with the provided ones before updating them. | +| [options.useAutoCheckpoints] | boolean | true | Set to `true` to make the client automatically store shard checkpoints using the sequence number of the most-recently received record. If set to `false` consumers can use the `setCheckpoint()` function to store any sequence number as the checkpoint for the shard. | +| [options.useAutoShardAssignment] | boolean | true | Set to `true` to automatically assign the stream shards to the active consumers in the same group (so only one client reads from one shard at the same time). Set to `false` to make the client read from all shards. | +| [options.useEnhancedFanOut] | boolean | false | Set to `true` to make the client use enhanced fan-out consumers to read from shards. | +| [options.usePausedPolling] | boolean | false | Set to `true` to make the client not to poll for more records until the consumer calls `continuePolling()`. This option is useful when consumers want to make sure the records are fully processed before receiving more (only applicable when `useEnhancedFanOut` is set to `false`) | +| [options.useS3ForLargeItems] | boolean | false | Whether to automatically use an S3 bucket to store large items or not. | #### kinesis.startConsumer() ⇒ Promise - Starts the stream consumer, by ensuring that the stream exists, that it's ready, and configured as requested. The internal managers that deal with heartbeats, state, and consumers will also be started. @@ -136,67 +135,62 @@ consumers will also be started. #### kinesis.stopConsumer() - Stops the stream consumer. The internal managers will also be stopped. **Kind**: instance method of [Kinesis](#exp_module_lifion-kinesis--Kinesis) #### kinesis.putRecord(params) ⇒ Promise - Writes a single data record into a stream. **Kind**: instance method of [Kinesis](#exp_module_lifion-kinesis--Kinesis) **Fulfil**: Object - The de-serialized data returned from the request. -**Reject**: Error - On any unexpected error while writing to the stream. +**Reject**: Error - On any unexpected error while writing to the stream. -| Param | Type | Description | -| ---------------------------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| params | Object | The parameters. | -| params.data | \* | The data to put into the record. | -| [params.explicitHashKey] | string | The hash value used to explicitly determine the shard the data record is assigned to by overriding the partition key hash. | -| [params.partitionKey] | string | Determines which shard in the stream the data record is assigned to. If omitted, it will be calculated based on a SHA-1 hash of the data. | -| [params.sequenceNumberForOrdering] | string | Set this to the sequence number obtained from the last put record operation to guarantee strictly increasing sequence numbers, for puts from the same client and to the same partition key. If omitted, records are coarsely ordered based on arrival time. | -| [params.streamName] | string | If provided, the record will be put into the specified stream instead of the stream name provided during the consumer instantiation. | +| Param | Type | Description | +| --- | --- | --- | +| params | Object | The parameters. | +| params.data | \* | The data to put into the record. | +| [params.explicitHashKey] | string | The hash value used to explicitly determine the shard the data record is assigned to by overriding the partition key hash. | +| [params.partitionKey] | string | Determines which shard in the stream the data record is assigned to. If omitted, it will be calculated based on a SHA-1 hash of the data. | +| [params.sequenceNumberForOrdering] | string | Set this to the sequence number obtained from the last put record operation to guarantee strictly increasing sequence numbers, for puts from the same client and to the same partition key. If omitted, records are coarsely ordered based on arrival time. | +| [params.streamName] | string | If provided, the record will be put into the specified stream instead of the stream name provided during the consumer instantiation. | #### kinesis.listShards(params) ⇒ Promise - List the shards of a stream. **Kind**: instance method of [Kinesis](#exp_module_lifion-kinesis--Kinesis) **Fulfil**: Object - The de-serialized data returned from the request. -**Reject**: Error - On any unexpected error while writing to the stream. +**Reject**: Error - On any unexpected error while writing to the stream. -| Param | Type | Description | -| ------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | -| params | Object | The parameters. | -| [params.streamName] | string | If provided, the method will list the shards of the specific stream instead of the stream name provided during the consumer instantiation. | +| Param | Type | Description | +| --- | --- | --- | +| params | Object | The parameters. | +| [params.streamName] | string | If provided, the method will list the shards of the specific stream instead of the stream name provided during the consumer instantiation. | #### kinesis.putRecords(params) ⇒ Promise - Writes multiple data records into a stream in a single call. **Kind**: instance method of [Kinesis](#exp_module_lifion-kinesis--Kinesis) **Fulfil**: Object - The de-serialized data returned from the request. -**Reject**: Error - On any unexpected error while writing to the stream. +**Reject**: Error - On any unexpected error while writing to the stream. -| Param | Type | Description | -| ---------------------------------- | --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -| params | Object | The parameters. | -| params.records | Array.<Object> | The records associated with the request. | -| params.records[].data | \* | The record data. | -| [params.records[].explicitHashKey] | string | The hash value used to explicitly determine the shard the data record is assigned to by overriding the partition key hash. | -| [params.records[].partitionKey] | string | Determines which shard in the stream the data record is assigned to. If omitted, it will be calculated based on a SHA-1 hash of the data. | -| [params.streamName] | string | If provided, the record will be put into the specified stream instead of the stream name provided during the consumer instantiation. | +| Param | Type | Description | +| --- | --- | --- | +| params | Object | The parameters. | +| params.records | Array.<Object> | The records associated with the request. | +| params.records[].data | \* | The record data. | +| [params.records[].explicitHashKey] | string | The hash value used to explicitly determine the shard the data record is assigned to by overriding the partition key hash. | +| [params.records[].partitionKey] | string | Determines which shard in the stream the data record is assigned to. If omitted, it will be calculated based on a SHA-1 hash of the data. | +| [params.streamName] | string | If provided, the record will be put into the specified stream instead of the stream name provided during the consumer instantiation. | #### kinesis.getStats() ⇒ Object - Returns statistics for the instance of the client. **Kind**: instance method of [Kinesis](#exp_module_lifion-kinesis--Kinesis) @@ -204,11 +198,10 @@ Returns statistics for the instance of the client. #### Kinesis.getStats() ⇒ Object - Returns the aggregated statistics of all the instances of the client. **Kind**: static method of [Kinesis](#exp_module_lifion-kinesis--Kinesis) -**Returns**: Object - An object with the statistics. +**Returns**: Object - An object with the statistics. ## License diff --git a/lib/dynamodb-client.js b/lib/dynamodb-client.js index 36f2df91..fa3b0d52 100644 --- a/lib/dynamodb-client.js +++ b/lib/dynamodb-client.js @@ -43,7 +43,6 @@ function internal(instance) { * @reject {Error} - The error details from AWS.DynamoDB with a corrected error stack. * @returns {Promise} * @private - * */ async function sdkCall(client, methodName, ...args) { const stackObj = getStackObj(sdkCall); diff --git a/lib/s3-client.js b/lib/s3-client.js index ceeb62f2..0dde673a 100644 --- a/lib/s3-client.js +++ b/lib/s3-client.js @@ -43,7 +43,6 @@ function internal(instance) { * @reject {Error} - The error details from AWS.S3 with a corrected error stack. * @returns {Promise} * @private - * */ async function sdkCall(client, methodName, ...args) { const stackObj = getStackObj(sdkCall); From 16707b41ff3263c254acb320f622e4ac3430e76f Mon Sep 17 00:00:00 2001 From: "Lam, Anson" Date: Mon, 1 Nov 2021 11:25:05 -0400 Subject: [PATCH 02/10] rolled back jest timers to legacy version --- lib/fan-out-consumer.test.js | 4 ++-- lib/heartbeat-manager.test.js | 2 +- lib/index.test.js | 2 +- lib/lease-manager.test.js | 2 +- lib/polling-consumer.test.js | 2 +- lib/stats.test.js | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/fan-out-consumer.test.js b/lib/fan-out-consumer.test.js index 27f93abf..0b10c405 100644 --- a/lib/fan-out-consumer.test.js +++ b/lib/fan-out-consumer.test.js @@ -49,7 +49,7 @@ jest.mock('./stream', () => ({ jest.mock('./stats'); -jest.useFakeTimers(); +jest.useFakeTimers('legacy'); function nextTickWait() { return new Promise((resolve) => setImmediate(resolve)); @@ -107,7 +107,7 @@ describe('lib/fan-out-consumer', () => { clearTimeout.mockReset(); setTimeout.mockReset(); jest.clearAllTimers(); - jest.useFakeTimers(); + jest.useFakeTimers('legacy'); }); test('the module exports the expected', () => { diff --git a/lib/heartbeat-manager.test.js b/lib/heartbeat-manager.test.js index 730d42ea..d00f9062 100644 --- a/lib/heartbeat-manager.test.js +++ b/lib/heartbeat-manager.test.js @@ -15,7 +15,7 @@ describe('lib/heartbeat-manager', () => { const stateStore = { clearOldConsumers, registerConsumer }; beforeEach(() => { - jest.useFakeTimers(); + jest.useFakeTimers('legacy'); }); afterEach(() => { diff --git a/lib/index.test.js b/lib/index.test.js index 1ee07efd..3f00a9d7 100644 --- a/lib/index.test.js +++ b/lib/index.test.js @@ -128,7 +128,7 @@ jest.mock('./stream', () => { }; }); -jest.useFakeTimers(); +jest.useFakeTimers('legacy'); describe('lib/index', () => { const options = { compression: 'LZ-UTF8', streamName: 'test-stream' }; diff --git a/lib/lease-manager.test.js b/lib/lease-manager.test.js index cd65737d..52a830b6 100644 --- a/lib/lease-manager.test.js +++ b/lib/lease-manager.test.js @@ -8,7 +8,7 @@ jest.mock('./stream', () => ({ getStreamShards: jest.fn(() => Promise.resolve({})) })); -jest.useFakeTimers(); +jest.useFakeTimers('legacy'); describe('lib/lease-manager', () => { const reconcile = jest.fn(); diff --git a/lib/polling-consumer.test.js b/lib/polling-consumer.test.js index 863b945b..301de46c 100644 --- a/lib/polling-consumer.test.js +++ b/lib/polling-consumer.test.js @@ -9,7 +9,7 @@ jest.mock('./stream', () => ({ getStreamShards: () => Promise.resolve({ 'shard-0000': {} }) })); -jest.useFakeTimers(); +jest.useFakeTimers('legacy'); describe('lib/polling-consumer', () => { const getRecords = jest.fn(() => diff --git a/lib/stats.test.js b/lib/stats.test.js index df31c229..cea0e939 100644 --- a/lib/stats.test.js +++ b/lib/stats.test.js @@ -4,7 +4,7 @@ const { version } = require('../package.json'); -jest.useFakeTimers(); +jest.useFakeTimers('legacy'); describe('lib/stats', () => { let getStats; From 452e0713c22020b97dd1081d1d9dd9758ca20b79 Mon Sep 17 00:00:00 2001 From: "Lam, Anson" Date: Thu, 4 Nov 2021 12:59:11 -0400 Subject: [PATCH 03/10] removed node 16.10.0 from engine --- .github/workflows/pull-request-check.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request-check.yml b/.github/workflows/pull-request-check.yml index 6b0f3d2e..2966316a 100644 --- a/.github/workflows/pull-request-check.yml +++ b/.github/workflows/pull-request-check.yml @@ -12,7 +12,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - node-version: [12, 14, 16] + node-version: [12, 14] os: [ubuntu-latest, windows-latest, macos-latest] steps: - name: Clone repository diff --git a/package.json b/package.json index 444a9251..6c750129 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "homepage": "https://github.com/lifion/lifion-kinesis#readme", "main": "lib/index.js", "engines": { - "node": ">=10.0.0" + "node": ">=10.0.0 <16.10.0" }, "scripts": { "build-docs": "jsdoc2md -t ./templates/README.hbs ./lib/*.js > ./README.md && git add ./README.md", From 98d7ec7162c7555c2dfacae513796743808a776d Mon Sep 17 00:00:00 2001 From: "Lam, Anson" Date: Thu, 4 Nov 2021 13:28:01 -0400 Subject: [PATCH 04/10] added node v17 to allowed engine versions --- .github/workflows/pull-request-check.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request-check.yml b/.github/workflows/pull-request-check.yml index 2966316a..1b9a795c 100644 --- a/.github/workflows/pull-request-check.yml +++ b/.github/workflows/pull-request-check.yml @@ -12,7 +12,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - node-version: [12, 14] + node-version: [12, 14, 17] os: [ubuntu-latest, windows-latest, macos-latest] steps: - name: Clone repository diff --git a/package.json b/package.json index 6c750129..ef7b8f77 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "homepage": "https://github.com/lifion/lifion-kinesis#readme", "main": "lib/index.js", "engines": { - "node": ">=10.0.0 <16.10.0" + "node": ">=17.0.1 <16.10.0 >=10.0.0" }, "scripts": { "build-docs": "jsdoc2md -t ./templates/README.hbs ./lib/*.js > ./README.md && git add ./README.md", From ad1191a4a44d68e134e70a38e60c7840622e432b Mon Sep 17 00:00:00 2001 From: "Lam, Anson" Date: Mon, 8 Nov 2021 16:09:47 -0500 Subject: [PATCH 05/10] fixes duplicate secrets-key exception --- .eslintrc | 1 - 1 file changed, 1 deletion(-) diff --git a/.eslintrc b/.eslintrc index d0802df8..36ab3a7d 100644 --- a/.eslintrc +++ b/.eslintrc @@ -13,7 +13,6 @@ "ProvisionedThroughputExceededException", "InvalidArgumentException", "SubscribeToShardEvent", - "NoSuchLifecycleConfiguration", "params.provisionedThroughput.writeCapacityUnits", "eyJmb28iOiJiYXIsIGJhesQFxgoifQ==" ], From b6070edcaec1bb8cf73d3f11a5e206df2d36054a Mon Sep 17 00:00:00 2001 From: "Lam, Anson" Date: Tue, 16 Nov 2021 14:47:17 -0500 Subject: [PATCH 06/10] adds .npmrc for engine strict rule --- .npmrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 .npmrc diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000..b6f27f13 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +engine-strict=true From 3433408d615669952898a7ac8428ce2c25b17a9a Mon Sep 17 00:00:00 2001 From: "Lam, Anson" Date: Tue, 16 Nov 2021 15:45:05 -0500 Subject: [PATCH 07/10] fixes node engine versioning --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ef7b8f77..4292192e 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "homepage": "https://github.com/lifion/lifion-kinesis#readme", "main": "lib/index.js", "engines": { - "node": ">=17.0.1 <16.10.0 >=10.0.0" + "node": ">=17.0.1 || ^16 <16.10.0 || <16 >=10.0.0" }, "scripts": { "build-docs": "jsdoc2md -t ./templates/README.hbs ./lib/*.js > ./README.md && git add ./README.md", From fb483c24be95b328baab32e98a51f2651fe1dd32 Mon Sep 17 00:00:00 2001 From: "Lam, Anson" Date: Tue, 16 Nov 2021 16:33:09 -0500 Subject: [PATCH 08/10] removes node 17 from github workflow --- .github/workflows/pull-request-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-check.yml b/.github/workflows/pull-request-check.yml index 1b9a795c..2966316a 100644 --- a/.github/workflows/pull-request-check.yml +++ b/.github/workflows/pull-request-check.yml @@ -12,7 +12,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - node-version: [12, 14, 17] + node-version: [12, 14] os: [ubuntu-latest, windows-latest, macos-latest] steps: - name: Clone repository From da10c360edcba45496de0b5d3ed2c1401ce01fab Mon Sep 17 00:00:00 2001 From: "Lam, Anson" Date: Fri, 19 Nov 2021 10:58:36 -0500 Subject: [PATCH 09/10] removes npmrc, remove ignoreIdentifiers from no-secrets --- .eslintrc | 9 ++++++--- .npmrc | 1 - package.json | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) delete mode 100644 .npmrc diff --git a/.eslintrc b/.eslintrc index 36ab3a7d..a40042e1 100644 --- a/.eslintrc +++ b/.eslintrc @@ -14,9 +14,12 @@ "InvalidArgumentException", "SubscribeToShardEvent", "params.provisionedThroughput.writeCapacityUnits", - "eyJmb28iOiJiYXIsIGJhesQFxgoifQ==" - ], - "ignoreIdentifiers": ["PartitionKey"] + "eyJmb28iOiJiYXIsIGJhesQFxgoifQ==", + "Qk2rZuty0pO/vptdjx3KZ2hUqVM=", + "n0vR6WyiMI1VeNqoISbuIEPoMPM=", + "hoKe98qHWTKVJg\\+g8IEsdvvnrLI=", + "uM9dgBWF4OGL42Uqbr61Yyt5h58=" + ] }] }, "overrides": [ diff --git a/.npmrc b/.npmrc deleted file mode 100644 index b6f27f13..00000000 --- a/.npmrc +++ /dev/null @@ -1 +0,0 @@ -engine-strict=true diff --git a/package.json b/package.json index 4292192e..4cd8310b 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "homepage": "https://github.com/lifion/lifion-kinesis#readme", "main": "lib/index.js", "engines": { - "node": ">=17.0.1 || ^16 <16.10.0 || <16 >=10.0.0" + "node": ">=10.0.0 <16.10.0 || >16.13.0 <17.0.0 || >=17.0.1" }, "scripts": { "build-docs": "jsdoc2md -t ./templates/README.hbs ./lib/*.js > ./README.md && git add ./README.md", From b645d86ae383e69da1a3de3059032b280ab9d3be Mon Sep 17 00:00:00 2001 From: "Lam, Anson" Date: Mon, 13 Dec 2021 14:03:08 -0500 Subject: [PATCH 10/10] adds node 16 back to git actions check --- .github/workflows/pull-request-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-check.yml b/.github/workflows/pull-request-check.yml index 2966316a..6b0f3d2e 100644 --- a/.github/workflows/pull-request-check.yml +++ b/.github/workflows/pull-request-check.yml @@ -12,7 +12,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - node-version: [12, 14] + node-version: [12, 14, 16] os: [ubuntu-latest, windows-latest, macos-latest] steps: - name: Clone repository