diff --git a/package-lock.json b/package-lock.json index ddacf30..007a130 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,18 +9,18 @@ "version": "1.2.7", "license": "MIT", "dependencies": { - "@bull-board/api": "^5.15.5", - "@bull-board/express": "^5.15.5", - "@bull-board/koa": "^5.15.5", - "@restorecommerce/acs-client": "^1.5.1", - "@restorecommerce/chassis-srv": "^1.5.0", + "@bull-board/api": "^5.16.0", + "@bull-board/express": "^5.16.0", + "@bull-board/koa": "^5.16.0", + "@restorecommerce/acs-client": "^1.6.0", + "@restorecommerce/chassis-srv": "^1.6.0", "@restorecommerce/cluster-service": "^1.0.3", "@restorecommerce/kafka-client": "^1.2.1", "@restorecommerce/logger": "^1.2.10", "@restorecommerce/rc-grpc-clients": "^5.1.23", "@restorecommerce/scs-jobs": "^0.1.23", "@restorecommerce/service-config": "^1.0.12", - "bullmq": "^5.7.1", + "bullmq": "^5.7.4", "cache-manager": "^5.5.1", "cache-manager-redis": "^0.6.0", "cron-parser": "^4.9.0", @@ -271,34 +271,34 @@ "dev": true }, "node_modules/@bull-board/api": { - "version": "5.15.5", - "resolved": "https://registry.npmjs.org/@bull-board/api/-/api-5.15.5.tgz", - "integrity": "sha512-s3x0f+0s4nwndBM+QSROMVKiDyE/vaaouQCsxRWOFqneLCkM+Ro2wF6fkhmFkZMjouoBbS8rCFGaIZ+8uttYtg==", + "version": "5.16.0", + "resolved": "https://registry.npmjs.org/@bull-board/api/-/api-5.16.0.tgz", + "integrity": "sha512-JnPi2M11At/4lxDP267k20AqUBZdVv+82nNMcO80dPJAEKpzbvhLqAl4H3nDSEowmzgzVVlD+/eFOMjg07h9Zg==", "dependencies": { "redis-info": "^3.0.8" }, "peerDependencies": { - "@bull-board/ui": "5.15.5" + "@bull-board/ui": "5.16.0" } }, "node_modules/@bull-board/express": { - "version": "5.15.5", - "resolved": "https://registry.npmjs.org/@bull-board/express/-/express-5.15.5.tgz", - "integrity": "sha512-vnoWyjkHgMDfAZkriGd3chf/1g08Gc5Bz0SGb08eaQEjlzIRps1mYPp0YKYCcm0d9U0vOZa038X5xPKCRPpnZg==", + "version": "5.16.0", + "resolved": "https://registry.npmjs.org/@bull-board/express/-/express-5.16.0.tgz", + "integrity": "sha512-UNuJcLvkAI+KdHHlx6U4+0JWr1PrVrlJBFaAPckd0vjoLZT1KRjNNyTYEyOUi84Zwa0RYkHS4mOKDkZRYT8aww==", "dependencies": { - "@bull-board/api": "5.15.5", - "@bull-board/ui": "5.15.5", + "@bull-board/api": "5.16.0", + "@bull-board/ui": "5.16.0", "ejs": "^3.1.7", "express": "^4.17.3" } }, "node_modules/@bull-board/koa": { - "version": "5.15.5", - "resolved": "https://registry.npmjs.org/@bull-board/koa/-/koa-5.15.5.tgz", - "integrity": "sha512-Kbmca8hKNW5wLpGM/H1RBm09bcdK+KWCsINUyDtp91bGwMRK0mhiqvjJLJpRohXXmtPTnnJDuVO9p1gYsbed3Q==", + "version": "5.16.0", + "resolved": "https://registry.npmjs.org/@bull-board/koa/-/koa-5.16.0.tgz", + "integrity": "sha512-AB5ys7bKBlCpyFncVsVGAYIVFFJk6vGBtLHn7xNAVqeBAUM3r+n9VxbxW/Or+L6XJWWEzDIElmQgD3OM/sv4aw==", "dependencies": { - "@bull-board/api": "5.15.5", - "@bull-board/ui": "5.15.5", + "@bull-board/api": "5.16.0", + "@bull-board/ui": "5.16.0", "ejs": "^3.1.7", "koa": "^2.13.1", "koa-mount": "^4.0.0", @@ -308,11 +308,11 @@ } }, "node_modules/@bull-board/ui": { - "version": "5.15.5", - "resolved": "https://registry.npmjs.org/@bull-board/ui/-/ui-5.15.5.tgz", - "integrity": "sha512-TSXgqBDI3ig6ez6yHArGzpwCuA/rhQewv0KOUAvPzssgX4HqfkatrV7gTuTM+XJe7/sLiXnBiryV7SRV0hgRMg==", + "version": "5.16.0", + "resolved": "https://registry.npmjs.org/@bull-board/ui/-/ui-5.16.0.tgz", + "integrity": "sha512-XJoHVKUDWCjOb0kMTKs1wTqn5p9mvFUFurTVNcbhPuqkIPoPJLuKhE8a7FvpTIK+HA5NhFRllaRK3K9/Y8JzIA==", "dependencies": { - "@bull-board/api": "5.15.5" + "@bull-board/api": "5.16.0" } }, "node_modules/@colors/colors": { @@ -2434,9 +2434,9 @@ } }, "node_modules/@restorecommerce/acs-client": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/@restorecommerce/acs-client/-/acs-client-1.5.1.tgz", - "integrity": "sha512-qQcyHHr/uVPjWUDls02bTRgTekNgXqzHzApIC8SqdCVemFmQjnkUsCMiTe9Bz8x9s1t0nNdMouva2yVTBs3j1g==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@restorecommerce/acs-client/-/acs-client-1.6.0.tgz", + "integrity": "sha512-Y7mr8E3+qij6YxP7Nkw6dndMlQtsY76GhTmi+nInVTEpP6o/VKwqCFe7fY8wbP3S+rmnzjmvZBvbnSWGPOvUyw==", "dependencies": { "@restorecommerce/grpc-client": "^2.2.1", "@restorecommerce/kafka-client": "^1.2.1", @@ -2451,18 +2451,18 @@ } }, "node_modules/@restorecommerce/chassis-srv": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@restorecommerce/chassis-srv/-/chassis-srv-1.5.0.tgz", - "integrity": "sha512-oODzFgwya6Fuwmbijojk6QO+3jUzRKHaMF6w1t3v8pyAbiUAEuBdWHcAjszIkG7YHi82LXcBYA2DSdPH2KFjvw==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@restorecommerce/chassis-srv/-/chassis-srv-1.6.0.tgz", + "integrity": "sha512-CMltw92n0H1XgD+lGkZ0hKDQOM8Png9IxyEB179rRrok2C4fkXK80420ect/X7EISVDUdWqThijzqRzuhMflgQ==", "dependencies": { "@grpc/grpc-js": "^1.10.6", "@restorecommerce/grpc-client": "^2.2.1", "@restorecommerce/kafka-client": "^1.2.1", "@restorecommerce/logger": "^1.2.10", - "@restorecommerce/protos": "^6.8.1", + "@restorecommerce/protos": "^6.8.2", "@restorecommerce/rc-grpc-clients": "^5.1.23", "@restorecommerce/service-config": "^1.0.12", - "arangojs": "^8.7.0", + "arangojs": "8.7.0", "async": "^3.2.5", "async-retry": "^1.3.3", "cache-manager": "4.1.0", @@ -2808,9 +2808,9 @@ } }, "node_modules/@restorecommerce/protos": { - "version": "6.8.1", - "resolved": "https://registry.npmjs.org/@restorecommerce/protos/-/protos-6.8.1.tgz", - "integrity": "sha512-xkyC2IicFVLOmZzKtrDsuVw9M1Qq/1MN5V0IoiTbTlW17jlr8GgY3wlslDhRNR4grp6RThOZLBMWg+SxKdGoBw==" + "version": "6.8.2", + "resolved": "https://registry.npmjs.org/@restorecommerce/protos/-/protos-6.8.2.tgz", + "integrity": "sha512-id/ojKw2yRH++fmUabhpBc1jc/RUO2WIfMcvX88AX8u5GSzKElqjsXGKnl9GMs/duiBnATEYrWkeMztZk+5GmQ==" }, "node_modules/@restorecommerce/rc-grpc-clients": { "version": "5.1.23", @@ -4661,9 +4661,9 @@ } }, "node_modules/bullmq": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/bullmq/-/bullmq-5.7.1.tgz", - "integrity": "sha512-t7FhF2mCGgmjZ1rHuBYIcLwzONm4QFGrO1+9mF7hpjWtXalGfy+nGciVcb69L7aPcdJMR2XTe6bNMWHGbKy8mQ==", + "version": "5.7.4", + "resolved": "https://registry.npmjs.org/bullmq/-/bullmq-5.7.4.tgz", + "integrity": "sha512-LjPXGyDZ3c5Tbbq8ccwQEXBHrOKljHfrJ5DQMXUXyKDxxwqKxXLX8Vr69BviDOu6RmPzokh3rPziqf7Y5JylKw==", "dependencies": { "cron-parser": "^4.6.0", "ioredis": "^5.3.2", diff --git a/package.json b/package.json index 6a3cdb2..7fcfd41 100644 --- a/package.json +++ b/package.json @@ -18,18 +18,18 @@ ], "type": "module", "dependencies": { - "@bull-board/api": "^5.15.5", - "@bull-board/express": "^5.15.5", - "@bull-board/koa": "^5.15.5", - "@restorecommerce/acs-client": "^1.5.1", - "@restorecommerce/chassis-srv": "^1.5.0", + "@bull-board/api": "^5.16.0", + "@bull-board/express": "^5.16.0", + "@bull-board/koa": "^5.16.0", + "@restorecommerce/acs-client": "^1.6.0", + "@restorecommerce/chassis-srv": "^1.6.0", "@restorecommerce/cluster-service": "^1.0.3", "@restorecommerce/kafka-client": "^1.2.1", "@restorecommerce/logger": "^1.2.10", "@restorecommerce/rc-grpc-clients": "^5.1.23", "@restorecommerce/scs-jobs": "^0.1.23", "@restorecommerce/service-config": "^1.0.12", - "bullmq": "^5.7.1", + "bullmq": "^5.7.4", "cache-manager": "^5.5.1", "cache-manager-redis": "^0.6.0", "cron-parser": "^4.9.0", diff --git a/src/schedulingService.ts b/src/schedulingService.ts index c3b404d..541e3b9 100644 --- a/src/schedulingService.ts +++ b/src/schedulingService.ts @@ -627,6 +627,7 @@ export class SchedulingService implements SchedulingServiceServiceImplementation private filterByOwnerShip(customArgsObj, result) { // applying filter based on custom arguments (filterByOwnerShip) + let filteredResult: Job[] = []; let customArgs = (customArgsObj)?.custom_arguments; if (customArgs?.value) { let customArgsFilter; @@ -638,28 +639,34 @@ export class SchedulingService implements SchedulingServiceServiceImplementation message: error.message, stack: error.stack }); } - if (!customArgsFilter) { + if (customArgsFilter?.length === 0) { return []; } - const ownerIndicatorEntity = customArgsFilter.entity; - const ownerValues = customArgsFilter.instance; - const ownerIndictaorEntURN = this.cfg.get('authorization:urns:ownerIndicatoryEntity'); - const ownerInstanceURN = this.cfg.get('authorization:urns:ownerInstance'); - result = result.filter(job => { - if (job?.data?.meta?.owners?.length > 0) { - for (let owner of job.data.meta.owners) { - if (owner?.id === ownerIndictaorEntURN && owner?.value === ownerIndicatorEntity && owner?.attributes?.length > 0) { - for (let ownerInstObj of owner.attributes) { - if (ownerInstObj?.id === ownerInstanceURN && ownerInstObj?.value && ownerValues.includes(ownerInstObj.value)) { - return job; + for (let customArgObj of customArgsFilter) { + const ownerIndicatorEntity = customArgObj?.entity; + const ownerValues = customArgObj?.instance; + const ownerIndictaorEntURN = this.cfg.get('authorization:urns:ownerIndicatoryEntity'); + const ownerInstanceURN = this.cfg.get('authorization:urns:ownerInstance'); + const filteredResp = result.filter(job => { + if (job?.data?.meta?.owners?.length > 0) { + for (let owner of job.data.meta.owners) { + if (owner?.id === ownerIndictaorEntURN && owner?.value === ownerIndicatorEntity && owner?.attributes?.length > 0) { + for (let ownerInstObj of owner.attributes) { + if (ownerInstObj?.id === ownerInstanceURN && ownerInstObj?.value && ownerValues.includes(ownerInstObj.value)) { + return job; + } } } } } - } - }); + }); + filteredResult = filteredResult.concat(filteredResp); + } + return filteredResult; + } else { + // no custom filters exist, return complete result set + return result; } - return result; } async deleteRedisKey(key: string): Promise {