Skip to content

Commit

Permalink
Adopt the latest linter
Browse files Browse the repository at this point in the history
  • Loading branch information
eaviles committed Jun 19, 2019
1 parent 0ae11f2 commit 6f8d45f
Show file tree
Hide file tree
Showing 18 changed files with 232 additions and 210 deletions.
30 changes: 15 additions & 15 deletions README.md

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions lib/consumers-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const privateData = new WeakMap();
/**
* Provides access to the private data of the specified instance.
*
* @param {Object} instance - The private data's owner.
* @returns {Object} The private data.
* @param {object} instance - The private data's owner.
* @returns {object} The private data.
* @private
*/
function internal(instance) {
Expand All @@ -33,18 +33,18 @@ class ConsumersManager {
/**
* Initializes an instance of the consumers manager.
*
* @param {Object} options - The initialization options.
* @param {Object} options.awsOptions - The initialization options for AWS.Kinesis.
* @param {Object} options.client - An instance of the Kinesis client.
* @param {object} options - The initialization options.
* @param {object} options.awsOptions - The initialization options for AWS.Kinesis.
* @param {object} options.client - An instance of the Kinesis client.
* @param {string} options.compression - The kind of data compression to use with records.
* @param {number} options.limit - The limit of records per get records call.
* @param {Object} options.logger - An instance of a logger.
* @param {object} options.logger - An instance of a logger.
* @param {number} options.noRecordsPollDelay - The delay in milliseconds before attempting to
* get more records when there were none in the previous attempt.
* @param {number} options.pollDelay - When the `usePausedPolling` option is `false`, this
* option defines the delay in milliseconds in between poll requests for more records.
* @param {Function} options.pushToStream - A function to push incoming records to the consumer.
* @param {Object} options.stateStore - An instance of the state store.
* @param {object} options.stateStore - An instance of the state store.
* @param {string} options.streamName - The name of the Kinesis stream.
* @param {boolean} options.useAutoCheckpoints - Whether to automatically store shard checkpoints
* using the sequence number of the most-recently received record or not.
Expand Down
16 changes: 8 additions & 8 deletions lib/dynamodb-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ const statsSource = 'dynamoDb';
/**
* Provides access to the private data of the specified instance.
*
* @param {Object} instance - The private data's owner.
* @returns {Object} The private data.
* @param {object} instance - The private data's owner.
* @returns {object} The private data.
* @private
*/
function internal(instance) {
Expand All @@ -36,7 +36,7 @@ function internal(instance) {
* is preserved, and the results of the call are aggregated in the stats. Retries in this function
* are the original ones provided by the AWS-SDK.
*
* @param {Object} client - An instance of AWS.DynamoDB.
* @param {object} client - An instance of AWS.DynamoDB.
* @param {string} methodName - The name of the method to call.
* @param {...*} args - The arguments of the method call.
* @fulfil {*} - The original response from the AWS.DynamoDB call.
Expand Down Expand Up @@ -71,9 +71,9 @@ async function sdkCall(client, methodName, ...args) {
* is preserved, and the results of the call are aggregated in the stats. Retries in this function
* are based on a custom logic replacing the one provided by the AWS-SDK.
*
* @param {Object} client - An instance of AWS.DynamoDB.
* @param {object} client - An instance of AWS.DynamoDB.
* @param {string} methodName - The name of the method to call.
* @param {Object} retryOpts - The [retry options as in async-retry]{@link external:AsyncRetry}.
* @param {object} retryOpts - The [retry options as in async-retry]{@link external:AsyncRetry}.
* @param {...*} args - The argument of the method call.
* @fulfil {*} - The original response from the AWS.DynamoDB call.
* @reject {Error} - The error details from AWS.DynamoDB with a corrected error stack.
Expand Down Expand Up @@ -114,9 +114,9 @@ class DynamoDbClient {
/**
* Initializes the AWS.DynamoDB internal instance and prepares the retry logic.
*
* @param {Object} options - The initialization options.
* @param {Object} options.awsOptions - The initialization options for AWS.DynamoDB.
* @param {Object} options.logger - An instace of a logger.
* @param {object} options - The initialization options.
* @param {object} options.awsOptions - The initialization options for AWS.DynamoDB.
* @param {object} options.logger - An instace of a logger.
* @param {string} options.tableName - The name of the DynamoDB table.
*/
constructor({ awsOptions, logger, tableName }) {
Expand Down
24 changes: 12 additions & 12 deletions lib/fan-out-consumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const wait = promisify(setTimeout);
/**
* Provides access to the private data of the specified instance.
*
* @param {Object} instance - The private data's owner.
* @returns {Object} The private data.
* @param {object} instance - The private data's owner.
* @returns {object} The private data.
* @private
*/
function internal(instance) {
Expand All @@ -55,8 +55,8 @@ class PreProcess extends Transform {
/**
* Initializes an instance of the pre-processing stream.
*
* @param {Object} options - The initialization options.
* @param {Object} options.requestFlags - The object where the flags for the request are stored.
* @param {object} options - The initialization options.
* @param {object} options.requestFlags - The object where the flags for the request are stored.
* @param {boolean} options.requestFlags.isEventStream - If the request is sucessful and the
* headers in the initial response point to an even stream, this flag is set to `true`.
* @param {number} options.requestFlags.statusCode - The status code of the last request response.
Expand Down Expand Up @@ -104,10 +104,10 @@ class PostProcess extends Writable {
/**
* Initializes an instance of the post-processing stream.
*
* @param {Object} options - The initialization options.
* @param {object} options - The initialization options.
* @param {Function} options.abort - A function that will close the entire pipeline, called
* when no data has been pushed through the event stream on a given time window.
* @param {Object} options.logger - An instance of a logger.
* @param {object} options.logger - An instance of a logger.
* @param {Function} options.markShardAsDepleted - A function that will mark a given shard as
* depleted. Called when a shard depletion event has been detected.
* @param {Function} options.pushToStream - A function that pushes records out of the pipeline.
Expand All @@ -130,7 +130,7 @@ class PostProcess extends Writable {
/**
* The stream writable logic.
*
* @param {Object} chunk - A chunk of data coming from the pipeline.
* @param {object} chunk - A chunk of data coming from the pipeline.
* @param {string} encoding - The stream encoding mode (ignored)
* @param {Function} callback - The callback for more data.
*/
Expand Down Expand Up @@ -171,17 +171,17 @@ class FanOutConsumer {
/**
* Initializes an instance of an enhanced fan-out consumer.
*
* @param {Object} options - The initialization options.
* @param {Object} options.awsOptions - The AWS.Kinesis options to use in the HTTP request.
* @param {object} options - The initialization options.
* @param {object} options.awsOptions - The AWS.Kinesis options to use in the HTTP request.
* @param {string} options.checkpoint - The last-known checkpoint for the stream shard.
* @param {Object} options.client - An instance of the Kinesis client.
* @param {object} options.client - An instance of the Kinesis client.
* @param {string} options.compression - The kind of data compression to use with records.
* @param {string} options.consumerArn - The ARN of the enhanced consumer as registered in AWS.
* @param {string} options.leaseExpiration - The timestamp of the shard lease expiration.
* @param {Object} options.logger - An instance of a logger.
* @param {object} options.logger - An instance of a logger.
* @param {Function} options.pushToStream - A function to push incoming records to the consumer.
* @param {string} options.shardId - The ID of the stream shard to subscribe for records.
* @param {Object} options.stateStore - An instance of the state store.
* @param {object} options.stateStore - An instance of the state store.
* @param {Function} options.stopConsumer - A function that stops this consumer from the manager.
* @param {string} options.streamName - The name of the Kinesis stream.
*/
Expand Down
10 changes: 5 additions & 5 deletions lib/heartbeat-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const privateData = new WeakMap();
/**
* Provides access to the private data of the specified instance.
*
* @param {Object} instance - The private data's owner.
* @returns {Object} The private data.
* @param {object} instance - The private data's owner.
* @returns {object} The private data.
* @private
*/
function internal(instance) {
Expand All @@ -37,9 +37,9 @@ class HeartbeatManager {
/**
* Initializes an instance of the hearbeat manager.
*
* @param {Object} options - The initialization options.
* @param {Object} options.logger - An instance of a logger.
* @param {Object} options.stateStore - An instance of the state store.
* @param {object} options - The initialization options.
* @param {object} options.logger - An instance of a logger.
* @param {object} options.stateStore - An instance of the state store.
*/
constructor({ logger, stateStore }) {
Object.assign(internal(this), { logger, stateStore });
Expand Down
30 changes: 15 additions & 15 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ const privateData = new WeakMap();
/**
* Provides access to the private data of the specified instance.
*
* @param {Object} instance - The private data's owner.
* @returns {Object} The private data.
* @param {object} instance - The private data's owner.
* @returns {object} The private data.
* @private
*/
function internal(instance) {
Expand All @@ -46,7 +46,7 @@ function internal(instance) {
/**
* Ensures a Kinesis stream exists and that is encrypted and tagged as required.
*
* @param {Object} instance - The instance of the Kinesis class where the call originated from.
* @param {object} instance - The instance of the Kinesis class where the call originated from.
* @param {string} [streamName] - The name of the stream to check initialization for.
* @fulfil {undefined}
* @returns {Promise}
Expand Down Expand Up @@ -76,7 +76,7 @@ async function ensureStreamInitialized(instance, streamName) {
* stream reflects the existing enhanced consumers. Stale state will be removed, existing enhanced
* consumers will be preserved.
*
* @param {Object} instance - A reference to the instance of the Kinesis class.
* @param {object} instance - A reference to the instance of the Kinesis class.
* @returns {Promise}
* @private
*/
Expand Down Expand Up @@ -133,7 +133,7 @@ class Kinesis extends PassThrough {
/**
* Initializes a new instance of the Kinesis client.
*
* @param {Object} options - The initialization options. In addition to the below options, it
* @param {object} options - The initialization options. In addition to the below options, it
* can also contain any of the [`AWS.Kinesis` options]{@link external:AwsJsSdkKinesis}.
* @param {string} [options.compression] - The kind of data compression to use with records.
* The currently available compression options are either `"LZ-UTF8"` or none.
Expand All @@ -142,22 +142,22 @@ class Kinesis extends PassThrough {
* the name of the application/project using this module.
* @param {boolean} [options.createStreamIfNeeded=true] - Whether if the Kinesis stream should
* be automatically created if it doesn't exist upon connection
* @param {Object} [options.dynamoDb={}] - The initialization options for the DynamoDB client
* @param {object} [options.dynamoDb={}] - 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]{@link external:AwsJsSdkDynamoDb}.
* @param {string} [options.dynamoDb.tableName] - The name of the table in which to store the
* state of consumers. If not provided, it defaults to "lifion-kinesis-state".
* @param {Object} [options.dynamoDb.tags] - If provided, the client will ensure that the
* @param {object} [options.dynamoDb.tags] - 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.
* @param {Object} [options.encryption] - The encryption options to enforce in the stream.
* @param {object} [options.encryption] - The encryption options to enforce in the stream.
* @param {string} [options.encryption.type] - The encryption type to use.
* @param {string} [options.encryption.keyId] - 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/".
* @param {number} [options.limit=10000] - The limit of records per get records call (only
* applicable with `useEnhancedFanOut` is set to `false`)
* @param {Object} [options.logger] - An object with the `warn`, `debug`, and `error` functions
* @param {object} [options.logger] - An object with the `warn`, `debug`, and `error` functions
* that will be used for logging purposes. If not provided, logging will be omitted.
* @param {number} [options.noRecordsPollDelay=1000] - The delay in milliseconds before
* attempting to get more records when there were none in the previous attempt (only
Expand All @@ -170,7 +170,7 @@ class Kinesis extends PassThrough {
* @param {number} [options.statsInterval=30000] - The interval in milliseconds for how often to
* emit the "stats" event. The event is only available while the consumer is running.
* @param {string} options.streamName - The name of the stream to consume data from (required)
* @param {Object} [options.tags] - If provided, the client will ensure that the stream is tagged
* @param {object} [options.tags] - 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.
* @param {boolean} [options.useAutoCheckpoints=true] - Set to `true` to make the client
Expand Down Expand Up @@ -323,7 +323,7 @@ class Kinesis extends PassThrough {
/**
* Writes a single data record into a stream.
*
* @param {Object} params - The parameters.
* @param {object} params - The parameters.
* @param {*} params.data - The data to put into the record.
* @param {string} [params.explicitHashKey] - The hash value used to explicitly determine the
* shard the data record is assigned to by overriding the partition key hash.
Expand Down Expand Up @@ -370,8 +370,8 @@ class Kinesis extends PassThrough {
/**
* Writes multiple data records into a stream in a single call.
*
* @param {Object} params - The parameters.
* @param {Array<Object>} params.records - The records associated with the request.
* @param {object} params - The parameters.
* @param {Array<object>} params.records - The records associated with the request.
* @param {*} params.records[].data - The record data.
* @param {string} [params.records[].explicitHashKey] - The hash value used to explicitly
* determine the shard the data record is assigned to by overriding the partition key hash.
Expand Down Expand Up @@ -418,7 +418,7 @@ class Kinesis extends PassThrough {
/**
* Returns statistics for the instance of the client.
*
* @returns {Object} An object with the statistics.
* @returns {object} An object with the statistics.
*/
getStats() {
const { streamName } = internal(this);
Expand All @@ -428,7 +428,7 @@ class Kinesis extends PassThrough {
/**
* Returns the aggregated statistics of all the instances of the client.
*
* @returns {Object} An object with the statistics.
* @returns {object} An object with the statistics.
*/
static getStats() {
return getStats();
Expand Down
4 changes: 2 additions & 2 deletions lib/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ describe('lib/index', () => {
try {
expect(err.message).toBe('foo');
done();
} catch (err2) {
done.fail(err2);
} catch (err_) {
done.fail(err_);
}
});
await kinesis.startConsumer();
Expand Down
16 changes: 8 additions & 8 deletions lib/kinesis-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ const statsSource = 'kinesis';
/**
* Provides access to the private data of the specified instance.
*
* @param {Object} instance - The private data's owner.
* @returns {Object} The private data.
* @param {object} instance - The private data's owner.
* @returns {object} The private data.
* @private
*/
function internal(instance) {
Expand All @@ -47,7 +47,7 @@ function internal(instance) {
* is preserved, and the results of the call are aggregated in the stats. Retries in this function
* are the original ones provided by the AWS-SDK.
*
* @param {Object} client - An instance of AWS.Kinesis.
* @param {object} client - An instance of AWS.Kinesis.
* @param {string} methodName - The name of the method to call.
* @param {string} streamName - The name of the Kinesis stream for which the call relates to.
* @param {...*} args - The arguments of the method call.
Expand Down Expand Up @@ -82,10 +82,10 @@ async function sdkCall(client, methodName, streamName, ...args) {
* is preserved, and the results of the call are aggregated in the stats. Retries in this function
* are based on a custom logic replacing the one provided by the AWS-SDK.
*
* @param {Object} client - An instance of AWS.Kinesis.
* @param {object} client - An instance of AWS.Kinesis.
* @param {string} methodName - The name of the method to call.
* @param {string} streamName - The name of the Kinesis stream for which the call relates to.
* @param {Object} retryOpts - The [retry options as in async-retry]{@link external:AsyncRetry}.
* @param {object} retryOpts - The [retry options as in async-retry]{@link external:AsyncRetry}.
* @param {...*} args - The argument of the method call.
* @fulfil {*} - The original response from the AWS.Kinesis call.
* @reject {Error} - The error details from AWS.Kinesis with a corrected error stack.
Expand Down Expand Up @@ -126,9 +126,9 @@ class KinesisClient {
/**
* Initializes the AWS.Kinesis internal instance and prepares the retry logic.
*
* @param {Object} options - The initialization options.
* @param {Object} options.awsOptions - The initialization options for AWS.Kinesis.
* @param {Object} options.logger - An instace of a logger.
* @param {object} options - The initialization options.
* @param {object} options.awsOptions - The initialization options for AWS.Kinesis.
* @param {object} options.logger - An instace of a logger.
* @param {string} options.streamName - The name of the Kinesis stream for which calls relate to.
*/
constructor({ awsOptions, logger, streamName }) {
Expand Down
Loading

0 comments on commit 6f8d45f

Please sign in to comment.