diff --git a/__tests__/unit/choreography.test.ts b/__tests__/unit/choreography.test.ts index 1476004..e595701 100644 --- a/__tests__/unit/choreography.test.ts +++ b/__tests__/unit/choreography.test.ts @@ -21,17 +21,11 @@ describe('choreography exists', () => { describe('DISCORD_UPDATE_CHANNELS', () => { checkChoreography(ChoreographyDict.DISCORD_UPDATE_CHANNELS, { choreographyName: 'DISCORD_UPDATE_CHANNELS', - transactionsLength: 3, - }); - }); - - describe('DISCORD_SCHEDULED_JOB', () => { - checkChoreography(ChoreographyDict.DISCORD_SCHEDULED_JOB, { - choreographyName: 'DISCORD_SCHEDULED_JOB', transactionsLength: 1, }); }); + describe('DISCORD_FETCH_MEMBERS', () => { checkChoreography(ChoreographyDict.DISCORD_FETCH_MEMBERS, { choreographyName: 'DISCORD_FETCH_MEMBERS', diff --git a/__tests__/unit/saga.schema.methods.test.ts b/__tests__/unit/saga.schema.methods.test.ts index df56754..a08854e 100644 --- a/__tests__/unit/saga.schema.methods.test.ts +++ b/__tests__/unit/saga.schema.methods.test.ts @@ -40,7 +40,7 @@ describe('Next function ( saga.next() )', () => { let taskFn: jest.Mock; beforeEach(() => { saveFn = jest.fn(); - publishFn = jest.spyOn(RabbitMQ, 'publish').mockImplementation(() => {}); + publishFn = jest.spyOn(RabbitMQ, 'publish').mockImplementation(() => { }); taskFn = jest.fn(() => ({ key: 'value' })); }); @@ -59,7 +59,7 @@ describe('Next function ( saga.next() )', () => { }, }; - const a = await next.call(that, () => {}); + const a = await next.call(that, () => { }); expect(a).toBeUndefined(); }); @@ -141,7 +141,7 @@ describe('Start function ( saga.start() )', () => { it('`start` function should work as expected', async () => { const saveFn = jest.fn(); - const publishFn = jest.spyOn(RabbitMQ, 'publish').mockImplementation(() => {}); + const publishFn = jest.spyOn(RabbitMQ, 'publish').mockImplementation(() => { }); const that: Record = { save: saveFn, diff --git a/package-lock.json b/package-lock.json index 124c50d..4ec642c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@togethercrew.dev/tc-messagebroker", - "version": "0.0.43", + "version": "0.0.45", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@togethercrew.dev/tc-messagebroker", - "version": "0.0.43", + "version": "0.0.45", "license": "ISC", "dependencies": { "@types/amqplib": "^0.10.1", @@ -1396,12 +1396,13 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, + "license": "MIT", "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -1815,10 +1816,11 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, + "license": "MIT", "dependencies": { "to-regex-range": "^5.0.1" }, @@ -2018,10 +2020,24 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, - "node_modules/ip": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", - "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" + "node_modules/ip-address": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz", + "integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==", + "license": "MIT", + "dependencies": { + "jsbn": "1.1.0", + "sprintf-js": "^1.1.3" + }, + "engines": { + "node": ">= 12" + } + }, + "node_modules/ip-address/node_modules/sprintf-js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", + "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", + "license": "BSD-3-Clause" }, "node_modules/is-arrayish": { "version": "0.2.1", @@ -2064,6 +2080,7 @@ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.12.0" } @@ -2767,6 +2784,12 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/jsbn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", + "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==", + "license": "MIT" + }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -3452,15 +3475,16 @@ } }, "node_modules/socks": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz", - "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==", + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz", + "integrity": "sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==", + "license": "MIT", "dependencies": { - "ip": "^2.0.0", + "ip-address": "^9.0.5", "smart-buffer": "^4.2.0" }, "engines": { - "node": ">= 10.13.0", + "node": ">= 10.0.0", "npm": ">= 3.0.0" } }, @@ -3642,6 +3666,7 @@ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, + "license": "MIT", "dependencies": { "is-number": "^7.0.0" }, diff --git a/src/enums/queue.enum.ts b/src/enums/queue.enum.ts index 1cda392..77acf77 100644 --- a/src/enums/queue.enum.ts +++ b/src/enums/queue.enum.ts @@ -5,6 +5,6 @@ export enum Queue { // TWITTER TWITTER_BOT = 'TWITTER_BOT', - + HIVEMIND = 'HIVEMIND', } diff --git a/src/saga/choreography.ts b/src/saga/choreography.ts index 8ba41e6..7ea04c0 100644 --- a/src/saga/choreography.ts +++ b/src/saga/choreography.ts @@ -1,7 +1,6 @@ import { IChoreography } from '../interfaces/choreography.interface'; import { DISCORD_FETCH_MEMBERS_TRANSACTIONS, - DISCORD_SCHEDULED_JOB_TRANSACTIONS, DISCORD_UPDATE_CHANNELS_TRANSACTIONS, TWITTER_REFRESH_TRANSACTIONS, ANNOUNCEMENT_SEND_MESSAGE_TO_USER_TRANSACTIONS, @@ -14,12 +13,6 @@ const DISCORD_UPDATE_CHANNELS: IChoreography = { transactions: DISCORD_UPDATE_CHANNELS_TRANSACTIONS, }; -/* define the DISCORD_SCHEDULED_JOB choreography */ -const DISCORD_SCHEDULED_JOB: IChoreography = { - name: 'DISCORD_SCHEDULED_JOB', - transactions: DISCORD_SCHEDULED_JOB_TRANSACTIONS, -}; - const DISCORD_FETCH_MEMBERS: IChoreography = { name: 'DISCORD_FETCH_MEMBERS', transactions: DISCORD_FETCH_MEMBERS_TRANSACTIONS, @@ -43,7 +36,6 @@ const ANNOUNCEMENT_SEND_MESSAGE_TO_CHANNEL: IChoreography = { /* all available Choreographies, will grow overtime */ export const ChoreographyDict = { DISCORD_UPDATE_CHANNELS, - DISCORD_SCHEDULED_JOB, DISCORD_FETCH_MEMBERS, // Twitter diff --git a/src/saga/transaction.ts b/src/saga/transaction.ts index 3723ba5..c4e446e 100644 --- a/src/saga/transaction.ts +++ b/src/saga/transaction.ts @@ -16,19 +16,7 @@ export const DISCORD_UPDATE_CHANNELS_TRANSACTIONS: ITransaction[] = [ event: Event.DISCORD_BOT.FETCH, order: 1, ...DEFAULT_TRANSACTION_PROPERTY, - }, - { - queue: Queue.DISCORD_ANALYZER, - event: Event.DISCORD_ANALYZER.RUN, - order: 2, - ...DEFAULT_TRANSACTION_PROPERTY, - }, - { - queue: Queue.DISCORD_BOT, - event: Event.DISCORD_BOT.SEND_MESSAGE, - order: 3, - ...DEFAULT_TRANSACTION_PROPERTY, - }, + } // { TODO: reactivated later // queue: Queue.SERVER_API, // event: Event.SERVER_API.UPDATE_GUILD, @@ -37,15 +25,6 @@ export const DISCORD_UPDATE_CHANNELS_TRANSACTIONS: ITransaction[] = [ // }, ]; -export const DISCORD_SCHEDULED_JOB_TRANSACTIONS: ITransaction[] = [ - { - queue: Queue.DISCORD_ANALYZER, - event: Event.DISCORD_ANALYZER.RUN_ONCE, - order: 1, - ...DEFAULT_TRANSACTION_PROPERTY, - }, -]; - export const DISCORD_FETCH_MEMBERS_TRANSACTIONS: ITransaction[] = [ { queue: Queue.DISCORD_BOT,