Comparing version 2.0.9 to 2.2.0
@@ -1,3 +0,3 @@ | ||
import { IMetric, Logger } from '../common'; | ||
declare const getMetric: (type: string, config: any, logger: Logger) => IMetric; | ||
import { IMetric, Configuration, Logger } from '../common'; | ||
declare const getMetric: (type: string, config: Configuration, logger: Logger) => IMetric; | ||
export default getMetric; |
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.build = exports.Factory = void 0; | ||
const generic_pool_1 = __importDefault(require("generic-pool")); | ||
@@ -8,0 +9,0 @@ class Factory { |
import KafkaProducer from '../producer/kafka'; | ||
import SqsProducer from '../producer/sqs'; | ||
import RedisProducer from '../producer/redis'; | ||
import { IRegistry, Logger } from '../common'; | ||
declare const getProducer: (type: string, config: any, registry: IRegistry, logger: Logger) => KafkaProducer | SqsProducer | RedisProducer; | ||
import { Configuration, IRegistry, Logger } from '../common'; | ||
declare const getProducer: (type: string, config: Configuration, registry: IRegistry, logger: Logger) => KafkaProducer | SqsProducer | RedisProducer; | ||
export default getProducer; |
import KafkaRunner from '../runner/kafka'; | ||
import SqsRunner from '../runner/sqs'; | ||
import RedisRunner from '../runner/redis'; | ||
import { Hooks, Pool, IRegistry, Logger } from '../common'; | ||
declare const getRunner: (type: string, config: any, registry: IRegistry, pool: Pool, logger: Logger, hooks: Hooks) => KafkaRunner | SqsRunner | RedisRunner; | ||
import { Hooks, Pool, Configuration, IRegistry, Logger } from '../common'; | ||
declare const getRunner: (type: string, config: Configuration, registry: IRegistry, pool: Pool, logger: Logger, hooks: Hooks) => KafkaRunner | SqsRunner | RedisRunner; | ||
export default getRunner; |
import { HTTPOptions } from 'aws-sdk'; | ||
export declare type Callback = (x: any) => any; | ||
export declare type Callback<T = any> = (payload: T) => any; | ||
export declare type getPayload = (msg: any, topic: string) => { | ||
@@ -72,2 +72,3 @@ timestamp: number; | ||
emit(eventName: string, ...any: any[]): any; | ||
on(eventName: string, ...any: any[]): any; | ||
} | ||
@@ -85,9 +86,9 @@ export declare type TaskList = { | ||
} | ||
export interface ITask { | ||
export interface ITask<T = any> { | ||
config: Configuration; | ||
registry: IRegistry; | ||
subscribe: Callback; | ||
subscribe: Callback<T>; | ||
topic: string; | ||
producer: any; | ||
publish(payload: any): Promise<void>; | ||
publish(payload: T | T[]): Promise<void>; | ||
} | ||
@@ -94,0 +95,0 @@ export declare type Consumer = { |
@@ -1,2 +0,3 @@ | ||
export declare const getConfig: (config: any) => any; | ||
import { Configuration } from './common'; | ||
export declare const getConfig: (config: Configuration) => Configuration; | ||
export default getConfig; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getConfig = void 0; | ||
const kafka_1 = require("./producer/kafka"); | ||
@@ -4,0 +5,0 @@ exports.getConfig = (config) => { |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
@@ -8,0 +20,0 @@ }; |
@@ -12,7 +12,7 @@ import { Hooks, ITask, Configuration, Callback, Pool, Logger, ISteveo, IRegistry, IEvent, IMetric, Attribute } from './common'; | ||
constructor(configuration: Configuration, logger: Logger | undefined, hooks: Hooks); | ||
task(topic: string, callBack: Callback, attributes?: Attribute[], doNotRegister?: boolean): ITask; | ||
task<T = any>(topic: string, callBack: Callback<T>, attributes?: Attribute[], doNotRegister?: boolean): ITask<T>; | ||
runner(): import("./runner/kafka").default | import("./runner/sqs").default | import("./runner/redis").default; | ||
customTopicName: (cb: Callback) => void; | ||
} | ||
declare const _default: (config: any, logger: Logger, hooks: Hooks) => () => Steveo; | ||
declare const _default: (config: Configuration, logger: Logger, hooks: Hooks) => () => Steveo; | ||
export default _default; |
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Steveo = void 0; | ||
const null_logger_1 = __importDefault(require("null-logger")); | ||
@@ -8,0 +9,0 @@ const task_1 = __importDefault(require("./task")); |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
@@ -8,0 +20,0 @@ }; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
@@ -13,2 +25,3 @@ }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.kafkaCompression = void 0; | ||
const kafka = __importStar(require("no-kafka")); | ||
@@ -37,3 +50,3 @@ const null_logger_1 = __importDefault(require("null-logger")); | ||
const context = utils_1.getMeta(msg); | ||
const payload = JSON.stringify(Object.assign({}, msg, { _meta: context })); | ||
const payload = JSON.stringify(Object.assign(Object.assign({}, msg), { _meta: context })); | ||
const size = Buffer.from(payload, 'utf-8'); | ||
@@ -40,0 +53,0 @@ this.logger.debug('Payload Size:', topic, size.length); |
@@ -32,3 +32,3 @@ "use strict"; | ||
qname: task.topic, | ||
message: JSON.stringify(Object.assign({}, msg, { _meta: context })), | ||
message: JSON.stringify(Object.assign(Object.assign({}, msg), { _meta: context })), | ||
}; | ||
@@ -35,0 +35,0 @@ } |
@@ -18,3 +18,2 @@ "use strict"; | ||
async initialize(topic) { | ||
var _a, _b; | ||
if (!topic) { | ||
@@ -26,3 +25,3 @@ throw new Error('Topic cannot be empty'); | ||
.catch(_ => null); | ||
const queue = (_a = data) === null || _a === void 0 ? void 0 : _a.QueueUrl; | ||
const queue = data === null || data === void 0 ? void 0 : data.QueueUrl; | ||
if (queue) { | ||
@@ -41,3 +40,3 @@ this.sqsUrls[topic] = queue; | ||
const createResponse = await this.producer.createQueueAsync(params); | ||
this.sqsUrls[topic] = (_b = createResponse) === null || _b === void 0 ? void 0 : _b.QueueUrl; | ||
this.sqsUrls[topic] = createResponse === null || createResponse === void 0 ? void 0 : createResponse.QueueUrl; | ||
return this.sqsUrls[topic]; | ||
@@ -65,3 +64,3 @@ } | ||
MessageAttributes: messageAttributes, | ||
MessageBody: JSON.stringify(Object.assign({}, msg, { _meta: context })), | ||
MessageBody: JSON.stringify(Object.assign(Object.assign({}, msg), { _meta: context })), | ||
QueueUrl: this.sqsUrls[topic], | ||
@@ -68,0 +67,0 @@ }; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getMeta = void 0; | ||
const moment_1 = __importDefault(require("moment")); | ||
@@ -14,0 +27,0 @@ const crypto = __importStar(require("crypto")); |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -13,0 +25,0 @@ const null_logger_1 = __importDefault(require("null-logger")); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getContext = exports.getDuration = void 0; | ||
exports.getDuration = start => { | ||
@@ -4,0 +5,0 @@ const durationComponents = process.hrtime(start); |
import { ITask, Configuration, Callback, IProducer, IRegistry, Attribute } from './common'; | ||
declare class Task implements ITask { | ||
declare class Task<T = any> implements ITask<T> { | ||
config: Configuration; | ||
registry: IRegistry; | ||
subscribe: Callback; | ||
subscribe: Callback<T>; | ||
producer: IProducer; | ||
topic: string; | ||
constructor(config: Configuration, registry: IRegistry, producer: IProducer, topic: string, subscribe: Callback, attributes?: Attribute[], doNotRegister?: boolean); | ||
publish(payload: any): Promise<void>; | ||
constructor(config: Configuration, registry: IRegistry, producer: IProducer, topic: string, subscribe: Callback<T>, attributes?: Attribute[], doNotRegister?: boolean); | ||
publish(payload: T | T[]): Promise<void>; | ||
} | ||
export default Task; |
{ | ||
"name": "steveo", | ||
"version": "2.0.9", | ||
"version": "2.2.0", | ||
"description": "A Task Pub/Sub Background processing library", | ||
@@ -11,7 +11,6 @@ "main": "lib/index.js", | ||
"test": "NODE_ENV=test nyc npm run spec", | ||
"spec": "yarn run mocha --recursive test/**/*", | ||
"spec": "yarn run mocha -r ts-node/register --recursive test/**/*_test.ts", | ||
"lint": "yarn eslint 'src/**/*.{ts,js}'", | ||
"lint:test": "yarn eslint 'test/**/*.{ts,js}'", | ||
"autotest": "yarn run mocha --watch", | ||
"build:babel": "yarn typecheck && yarn run babel -Dd lib src --extensions \".js,.ts\"", | ||
"prepublish": "yarn run build", | ||
@@ -21,4 +20,3 @@ "build:ts": "yarn run tsc", | ||
"typecheck": "yarn run tsc --noEmit", | ||
"steveo": "node ./lib/cli-task.js", | ||
"flow:coverage": "yarn run flow-coverage-report -i 'src/**/*.js' -x 'src/test/**' -t html -t json -t text" | ||
"steveo": "node ./lib/cli-task.js" | ||
}, | ||
@@ -44,3 +42,3 @@ "files": [ | ||
"bluebird": "^3.5.0", | ||
"generic-pool": "^3.7.1", | ||
"generic-pool": "^3.7.2", | ||
"lazy-object": "^1.0.1", | ||
@@ -50,3 +48,3 @@ "lodash.difference": "^4.5.0", | ||
"lodash.shuffle": "^4.2.0", | ||
"moment": "2.27.0", | ||
"moment": "2.29.1", | ||
"null-logger": "^1.0.0", | ||
@@ -61,32 +59,20 @@ "uuid": "^3.1.0" | ||
"devDependencies": { | ||
"@babel/cli": "7.10.5", | ||
"@babel/core": "7.11.4", | ||
"@babel/node": "7.10.5", | ||
"@babel/plugin-proposal-class-properties": "7.10.4", | ||
"@babel/plugin-transform-flow-strip-types": "7.10.4", | ||
"@babel/preset-env": "7.11.0", | ||
"@babel/preset-flow": "7.10.4", | ||
"@babel/preset-typescript": "7.10.4", | ||
"@babel/register": "7.10.5", | ||
"@istanbuljs/nyc-config-typescript": "0.1.3", | ||
"@types/chai": "4.2.12", | ||
"@types/chai": "4.2.16", | ||
"@types/mocha": "5.2.7", | ||
"@types/node": "12.12.54", | ||
"@typescript-eslint/eslint-plugin": "2.34.0", | ||
"@typescript-eslint/parser": "2.34.0", | ||
"@types/node": "12.20.7", | ||
"@types/rsmq": "^0.8.4", | ||
"@types/sinon": "^9.0.11", | ||
"@typescript-eslint/eslint-plugin": "^4.20.0", | ||
"babel-eslint": "10.1.0", | ||
"babel-plugin-istanbul": "5.2.0", | ||
"chai": "4.2.0", | ||
"chai": "4.3.4", | ||
"cross-env": "6.0.3", | ||
"eslint": "6.8.0", | ||
"eslint-config-airbnb": "17.1.1", | ||
"eslint-config-ordermentum": "0.1.0", | ||
"eslint-config-prettier": "6.11.0", | ||
"eslint-import-resolver-typescript": "2.2.1", | ||
"eslint-plugin-import": "2.22.0", | ||
"eslint-plugin-prettier": "3.1.4", | ||
"eslint-plugin-unicorn": "14.0.1", | ||
"flow-bin": "0.132.0", | ||
"flow-coverage-report": "0.7.0", | ||
"mocha": "6.2.3", | ||
"eslint-config-ordermentum": "^1.0.1", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-mocha": "^8.1.0", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"eslint-plugin-unicorn": "^29.0.0", | ||
"mocha": "^8.3.2", | ||
"nyc": "14.1.1", | ||
@@ -96,5 +82,6 @@ "prettier": "1.19.1", | ||
"source-map-support": "0.5.19", | ||
"typescript": "3.9.7", | ||
"ts-node": "^9.1.1", | ||
"typescript": "3.9.9", | ||
"typescript-eslint-parser": "22.0.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69743
25
50
1449
+ Addedmoment@2.29.1(transitive)
- Removedmoment@2.27.0(transitive)
Updatedgeneric-pool@^3.7.2
Updatedmoment@2.29.1