diff --git a/src/.env b/src/.env index 53f4311..beae68f 100644 --- a/src/.env +++ b/src/.env @@ -1,9 +1,9 @@ -APPLICATION_PORT=3567 +APPLICATION_PORT=3569 APPLICATION_ENV='development' -INSTALLED_PACKAGES="elevate-user elevate-mentoring elevate-notification elevate-scheduler" +REQUIRED_PACKAGES="elevate-user@1.1.30 elevate-mentoring@1.1.23 elevate-scheduler@1.0.4" SUPPORTED_HTTP_TYPES="GET POST PUT PATCH DELETE" -USER_SERVICE_BASE_URL='http://localhost:4567' -MENTORING_SERVICE_BASE_URL='' -NOTIFICATION_SERVICE_BASE_URL='' -SCHEDULER_SERVICE_BASE_URL='' -API_DOC_URL='/interface/api-doc' \ No newline at end of file +USER_SERVICE_BASE_URL='http://user:3001' +MENTORING_SERVICE_BASE_URL='http://mentoring:3000' +NOTIFICATION_SERVICE_BASE_URL='http://notification:3001' +SCHEDULER_SERVICE_BASE_URL='http://scheduler:3001' +API_DOC_URL='/interface/api-doc' diff --git a/src/app.js b/src/app.js index abfd57b..416f115 100644 --- a/src/app.js +++ b/src/app.js @@ -3,6 +3,19 @@ require('module-alias/register') const express = require('express') const cors = require('cors') require('dotenv').config({ path: './.env' }) +const packageInstaller = require('./utils/packageInstaller') + +let environmentData = require('./envVariables')() +if (!environmentData.success) { + console.error('Server could not start . Not all environment variable is provided') + process.exit() +} + +packageInstaller(process.env.REQUIRED_PACKAGES).catch((error) => { + console.error(`An error occurred in package installer: ${error}`) + process.exit() +}) + const app = express() const path = require('path') //const packageValidator = require('./utils/packageValidator'); diff --git a/src/constants/config.json b/src/constants/config.json new file mode 100644 index 0000000..78079c0 --- /dev/null +++ b/src/constants/config.json @@ -0,0 +1,2349 @@ +{ + "routes": [ + { + "sourceRoute": "/interface/v1/account/create", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": true, + "orchestrated": true, + "responseMessage": "Account Created Successfully", + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user", + "targetBody": [], + "responseBody": [ + { "sourceField": "user.created_at", "targetField": "user.user_created_at" }, + { "sourceField": "user.updated_at", "targetField": "user.user_updated_at" } + ] + }, + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring", + "targetBody": [], + "responseBody": [ + { "sourceField": "created_at", "targetField": "profile_created_at" }, + { "sourceField": "updated_at", "targetField": "profile_updated_at" } + ] + } + ] + }, + { + "sourceRoute": "/interface/v1/account/update", + "type": "PATCH", + "priority": "MUST_HAVE", + "inSequence": true, + "orchestrated": true, + "responseMessage": "Profile Updated Successfully", + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user", + "targetBody": [], + "responseBody": [ + { "sourceField": "created_at", "targetField": "user_created_at" }, + { "sourceField": "updated_at", "targetField": "user_updated_at" }, + { "sourceField": "meta", "targetField": "user_meta" }, + { "sourceField": "deleted_at", "targetField": "user_deleted_at" } + ] + }, + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring", + "targetBody": [], + "responseBody": [ + { "sourceField": "created_at", "targetField": "profile_created_at" }, + { "sourceField": "updated_at", "targetField": "profile_updated_at" }, + { "sourceField": "meta", "targetField": "profile_meta" }, + { "sourceField": "deleted_at", "targetField": "profile_deleted_at" } + ] + } + ] + }, + { + "sourceRoute": "/interface/v1/entity-type/read", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": true, + "responseMessage": "Entity type fetched successfully", + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user", + "targetBody": [], + "responseBody": [{ "sourceField": "entity_types", "targetField": "entity_types[]" }] + }, + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring", + "targetBody": [], + "responseBody": [{ "sourceField": "entity_types", "targetField": "entity_types[]" }] + } + ] + }, + { + "sourceRoute": "/user/v1/account/login", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/account/acceptTermsAndCondition", + "type": "PATCH", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/account/resetPassword", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/account/generateToken", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/account/generateOtp", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/account/logout", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/account/list", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/account/registrationOtp", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/user/read", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/user/read/:id", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/user/update", + "type": "PATCH", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/user/share", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/user/share/:id", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/userRole/list", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/form/create", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/form/read", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/form/read/:id", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/form/update", + "type": "PATCH", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/form/update/:id", + "type": "PATCH", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/cloud-services/file/getSignedUrl", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/cloud-services/file/getDownloadableUrl", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/cloud-services/getSignedUrl", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/cloud-services/getDownloadableUrl", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/user/v1/admin/deleteUser", + "type": "DELETE", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/admin/deleteUser/:id", + "type": "DELETE", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/admin/create", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/admin/login", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/organization/create", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/organization/update", + "type": "PATCH", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/organization/update/:id", + "type": "PATCH", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/organization/list", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/entity-type/create", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/entity-type/update", + "type": "PATCH", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/entity-type/update/:id", + "type": "PATCH", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/entity-type/read", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/entity-type/delete", + "type": "DELETE", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/entity-type/delete/:id", + "type": "DELETE", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/entity/create", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/entity/update", + "type": "PATCH", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/entity/update/:id", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/entity/delete", + "type": "DELETE", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/entity/delete/:id", + "type": "DELETE", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/entity/read", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/entity/read/:id", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + + { + "sourceRoute": "/mentoring/v1/entity/create", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/entity/read", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/entity/read/:id", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/entity/update", + "type": "PUT", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/entity/update/:id", + "type": "PUT", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/entity/delete", + "type": "DELETE", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/entity/delete/:id", + "type": "DELETE", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/form/create", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/form/read", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/form/read/:id", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/form/update", + "type": "PUT", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/form/update/:id", + "type": "PUT", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/entity-type/create", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/entity-type/read", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/entity-type/update", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/entity-type/update/:id", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/entity-type/delete", + "type": "DELETE", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/entity-type/delete/:id", + "type": "DELETE", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/list", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/details", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/details/:id", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/share", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/share/:id", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/enroll", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/enroll/:id", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/unEnroll", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/unEnroll/:id", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/start", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/start/:id", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/update", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/update/:id", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/update/:id", + "type": "DELETE", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/feedback", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/feedback/:id", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/updateRecordingUrl", + "type": "PATCH", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/updateRecordingUrl/:id", + "type": "PATCH", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/completed", + "type": "PATCH", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/completed/:id", + "type": "PATCH", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/completed", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/completed/:id", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/getRecording", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/sessions/getRecording/:id", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentees/sessions", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentees/joinSession", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentees/joinSession/:id", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentees/homeFeed", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentees/reports", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentees/profile", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentees/create", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentees/update", + "type": "PUT", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentees/getMenteeExtension/", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentees/deleteMenteeExtension", + "type": "DELETE", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentors/reports", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentors/profile", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentors/profile/:id", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentors/upcomingSessions", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentors/upcomingSessions/:id", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentors/share", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentors/share/:id", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentors/create", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentors/update", + "type": "PUT", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentors/getMentorExtension", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentors/deleteMentorExtension", + "type": "DELETE", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/feedback/submit", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/feedback/submit/:id", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/feedback/forms", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/feedback/forms/:id", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/questions/create", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/questions/update", + "type": "PUT", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/questions/update/:id", + "type": "PUT", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/questions/read", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/questions/read/:id", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/questionsSet/create", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/questionsSet/update", + "type": "PATCH", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/questionsSet/update/:id", + "type": "PATCH", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/questionsSet/read", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/questionsSet/read/:id", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/users/pendingFeedbacks", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/users/list", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/issues/create", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/platform/config", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/admin/userDelete", + "type": "DELETE", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/org-admin/inheritEntityType", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/org-admin/roleChange", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/org-admin/setOrgPolicies", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/org-admin/getOrgPolicies", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/org-admin/deactivateUpcomingSession", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/organization/update", + "type": "PATCH", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/admin/triggerPeriodicViewRefresh", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/admin/triggerViewRebuild", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/admin/triggerPeriodicViewRefreshInternal", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/admin/triggerViewRebuildInternal", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentors/list", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentors/createdSessions", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentors/details", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/mentors/details/:id", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/user/v1/org-admin/inheritEntityType", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/organization/read", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/admin/addOrgAdmin", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/org-admin/bulkUserCreate", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/org-admin/getBulkInvitesFilesList", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/org-admin/getRequestDetails/:id", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/org-admin/deactivateUser", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/org-admin/getRequests", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/org-admin/updateRequestStatus", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/organization/requestOrgRole", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/admin/deactivateOrg/:id", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/notification/create", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/notification/update/:id", + "type": "PATCH", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/notification/read/:id", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/notification/read", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/scheduler/jobs/create", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "scheduler", + "packageName": "elevate-scheduler" + } + ] + }, + { + "sourceRoute": "/scheduler/jobs/updateDelay", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "scheduler", + "packageName": "elevate-scheduler" + } + ] + }, + { + "sourceRoute": "/scheduler/jobs/remove", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "scheduler", + "packageName": "elevate-scheduler" + } + ] + }, + { + "sourceRoute": "/scheduler/jobs/list", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "scheduler", + "packageName": "elevate-scheduler" + } + ] + }, + { + "sourceRoute": "/scheduler/jobs/purge", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "scheduler", + "packageName": "elevate-scheduler" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/profile/create", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/profile/read", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/profile/update", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/user/v1/cloud-services/file/getSampleCSV", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/notification/template", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/notification/template/:id", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/user/v1/notification/template", + "type": "PATCH", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/notification/template", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/notification/template/:id", + "type": "GET", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/notification/template", + "type": "PATCH", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/org-admin/updateRelatedOrgs", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/mentoring/v1/org-admin/updateOrganization", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "mentoring", + "packageName": "elevate-mentoring" + } + ] + }, + { + "sourceRoute": "/user/v1/account/search", + "type": "POST", + "priority": "MUST_HAVE", + "inSequence": false, + "orchestrated": false, + "targetPackages": [ + { + "basePackageName": "user", + "packageName": "elevate-user" + } + ] + } + ], + "requiredEnvs": { + "USER_SERVICE_BASE_URL": { + "message": "Required user service base URL", + "optional": false + }, + "MENTORING_SERVICE_BASE_URL": { + "message": "Required mentoring service base URL", + "optional": false + } + }, + "services": { + "elevate-scheduler": "^1.0.0" + } +} diff --git a/src/constants/routesConfigs.js b/src/constants/routesConfigs.js index 92f91f7..f6086e3 100644 --- a/src/constants/routesConfigs.js +++ b/src/constants/routesConfigs.js @@ -1,1619 +1,7 @@ 'use strict' +const config = require('@constants/config.json') + exports.routesConfigs = { services: ['user', 'mentoring', 'notification', 'scheduler'], - routes: [ - { - sourceRoute: '/user/v1/account/create', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/account/login', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/account/acceptTermsAndCondition', - type: 'PATCH', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/account/resetPassword', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/account/generateToken', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/account/generateOtp', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/account/logout', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/account/list', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/account/registrationOtp', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/user/read', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/user/read/:id', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/user/update', - type: 'PATCH', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/user/share', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/user/share/:id', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/userRole/list', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/form/create', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/form/read', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/form/read/:id', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/form/update', - type: 'PATCH', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/form/update/:id', - type: 'PATCH', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/cloud-services/file/getSignedUrl', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/admin/deleteUser', - type: 'DELETE', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/admin/deleteUser/:id', - type: 'DELETE', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/admin/create', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/admin/login', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/organization/create', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/organization/update', - type: 'PATCH', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/organization/update/:id', - type: 'PATCH', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/organization/list', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/entity-type/create', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/entity-type/update', - type: 'PATCH', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/entity-type/update/:id', - type: 'PATCH', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/entity-type/read', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/entity-type/delete', - type: 'DELETE', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/entity-type/delete/:id', - type: 'DELETE', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/entity/create', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/entity/update', - type: 'PATCH', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/entity/update/:id', - type: 'PATCH', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/entity/delete', - type: 'DELETE', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/entity/read', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - { - sourceRoute: '/user/v1/entity/read/:id', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'user', - packageName: 'elevate-user', - }, - ], - }, - - { - sourceRoute: '/mentoring/v1/entity/create', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/entity/read', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/entity/read/:id', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/entity/update', - type: 'PUT', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/entity/update/:id', - type: 'PUT', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/entity/delete', - type: 'DELETE', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/entity/delete/:id', - type: 'DELETE', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/form/create', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/form/read', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/form/read/:id', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/form/update', - type: 'PUT', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/form/update/:id', - type: 'PUT', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/entity-type/create', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/entity-type/read', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/entity-type/update', - type: 'PUT', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/entity-type/update/:id', - type: 'PUT', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/entity-type/delete', - type: 'DELETE', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/entity-type/delete/:id', - type: 'DELETE', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/sessions/list', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/sessions/details', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/sessions/details/:id', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/sessions/share', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/sessions/share/:id', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/sessions/enroll', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/sessions/enroll/:id', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/sessions/unEnroll', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/sessions/unEnroll/:id', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/sessions/start', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/sessions/start/:id', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/sessions/update', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/sessions/update/:id', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/sessions/feedback', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/sessions/feedback/:id', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/sessions/updateRecordingUrl', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/sessions/updateRecordingUrl/:id', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/sessions/completed', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/sessions/completed/:id', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/sessions/getRecording', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/sessions/getRecording/:id', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/mentees/sessions', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/mentees/joinSession', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/mentees/joinSession/:id', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/mentees/homeFeed', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/mentees/reports', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/mentees/profile', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/mentees/create', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/mentees/update', - type: 'PUT', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/mentees/getMenteeExtension/', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/mentees/deleteMenteeExtension', - type: 'DELETE', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/mentors/reports', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/mentors/profile', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/mentors/profile/:id', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/mentors/upcomingSessions', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/mentors/upcomingSessions/:id', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/mentors/share', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/mentors/share/:id', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/mentors/create', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/mentors/update', - type: 'PUT', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/mentors/getMentorExtension', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/mentors/deleteMentorExtension', - type: 'DELETE', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/feedback/submit', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/feedback/submit/:id', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/feedback/forms', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/questions/create', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/questions/update', - type: 'PUT', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/questions/update/:id', - type: 'PUT', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/questions/read', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/questions/read/:id', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/questionsSet/create', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/questionsSet/update', - type: 'PUT', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/questionsSet/update/:id', - type: 'PUT', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/questionsSet/read', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/questionsSet/read/:id', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/users/pendingFeedbacks', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/users/list', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/issues/create', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/platform/config', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/mentoring/v1/admin/userDelete', - type: 'DELETE', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'mentoring', - packageName: 'elevate-mentoring', - }, - ], - }, - { - sourceRoute: '/notification/v1/email/send', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'notification', - packageName: 'elevate-notification', - }, - ], - }, - { - sourceRoute: '/scheduler/jobs/list', - type: 'GET', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'scheduler', - packageName: 'elevate-scheduler', - }, - ], - }, - { - sourceRoute: '/scheduler/jobs/create', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'scheduler', - packageName: 'elevate-scheduler', - }, - ], - }, - { - sourceRoute: '/scheduler/jobs/remove', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'scheduler', - packageName: 'elevate-scheduler', - }, - ], - }, - { - sourceRoute: '/scheduler/jobs/purge', - type: 'POST', - priority: 'MUST_HAVE', - inSequence: false, - orchestrated: false, - targetPackages: [ - { - basePackageName: 'scheduler', - packageName: 'elevate-scheduler', - }, - ], - }, - ], + routes: config.routes, } diff --git a/src/controllers/orchestration.js b/src/controllers/orchestration.js index 849ef82..aff1e49 100644 --- a/src/controllers/orchestration.js +++ b/src/controllers/orchestration.js @@ -1,43 +1,83 @@ 'use strict' +const { bodyValueReplacer } = require('@helpers/bodyValueReplacer') + +const removeArraySuffix = (obj) => { + if (Array.isArray(obj)) { + return obj.map(removeArraySuffix) + } else if (typeof obj === 'object' && obj !== null) { + for (const key in obj) { + if (obj.hasOwnProperty(key)) { + const newKey = key.endsWith('[]') ? key.slice(0, -2) : key + obj[newKey] = removeArraySuffix(obj[key]) + if (newKey !== key) { + delete obj[key] + } + } + } + } + return obj +} + +const isBadResponse = (statusCode) => statusCode >= 400 && statusCode <= 599 + +const packageRouterCaller = async (req, res, responses, servicePackage, packages) => { + const selectedPackage = packages.find((obj) => obj.packageMeta.basePackageName === servicePackage.basePackageName) + req['baseUrl'] = process.env[`${selectedPackage.packageMeta.basePackageName.toUpperCase()}_SERVICE_BASE_URL`] + //const bodyConfig = bodyConfigGenerator(servicePackage.targetBody) + const newBody = bodyValueReplacer(req.body, servicePackage.targetBody) + req.body = newBody + responses[selectedPackage.packageMeta.basePackageName] = await selectedPackage.packageRouter(req, res, responses) + console.log('RESPONSESSSSSSSSSSSSSSSSSSSSSSSSS: ', responses) + const responseStatusCode = responses[selectedPackage.packageMeta.basePackageName].status + if (isBadResponse(responseStatusCode) && !res.headersSent) { + res.status(responseStatusCode).send(responses[selectedPackage.packageMeta.basePackageName].data) + return false + } + return true +} + const orchestrationHandler = async (packages, req, res) => { try { - const { targetPackages, inSequence, sourceRoute } = req + const { targetPackages, inSequence, sourceRoute, responseMessage } = req console.log(targetPackages, inSequence, sourceRoute) console.log(packages) - let result const responses = {} - if (inSequence) { + let asyncRequestsStatues = [] + if (inSequence) for (const servicePackage of targetPackages) { - const selectedPackage = packages.find( - (obj) => obj.packageMeta.basePackageName === servicePackage.basePackageName - ) - console.log('SelectedPackage: ', selectedPackage) - req['baseUrl'] = - process.env[`${selectedPackage.packageMeta.basePackageName.toUpperCase()}_SERVICE_BASE_URL`] - responses[selectedPackage.packageMeta.basePackageName] = await selectedPackage.packageRouter( - req, - res, - responses - ) - console.log('RESPONSES::::::::::::: ', responses) + const isSuccess = await packageRouterCaller(req, res, responses, servicePackage, packages) + if (!isSuccess) { + asyncRequestsStatues.push(false) + break + } } - result = responses - } else { - result = await Promise.all( - targetRoutes.map((route) => { - const servicePackage = packages.find( - (obj) => obj.packageMeta.basePackageName === route.basePackageName - ) - return servicePackage.controllers[route.controllerName][route.functionName].bind( - null, - responses - )(req.body) + else + asyncRequestsStatues = await Promise.all( + targetPackages.map((servicePackage) => { + return packageRouterCaller(req, res, responses, servicePackage, packages) }) ) + console.log('RESPONSEEEEEEEEEEEEEEEEEEEEES: ', responses) + let response = {} + for (const servicePackage of targetPackages) { + const body = responses[servicePackage.basePackageName]?.result + response = { ...response, ...body } + response = bodyValueReplacer(response, servicePackage.responseBody) } - res.status(200).send(result) + if (!asyncRequestsStatues.includes(false)) + res.status(200).send({ + responseCode: 'OK', + message: responseMessage, + result: removeArraySuffix(response), + }) } catch (err) { console.log(err) + const errorResponse = { + responseCode: 'INTERNAL_SERVER_ERROR', + message: 'Internal Server Error', + error: [], + } + res.status(500).json(errorResponse) } } diff --git a/src/envVariables.js b/src/envVariables.js new file mode 100644 index 0000000..aff1ae0 --- /dev/null +++ b/src/envVariables.js @@ -0,0 +1,122 @@ +'use strict' +let table = require('cli-table') +const config = require('@constants/config.json') + +let tableData = new table() +let environmentVariables = { + APPLICATION_PORT: { + message: 'Required port no', + optional: false, + }, + APPLICATION_ENV: { + message: 'Required node environment', + optional: false, + }, + REQUIRED_PACKAGES: { + message: 'Required REQUIRED_PACKAGES', + optional: false, + }, + SUPPORTED_HTTP_TYPES: { + message: 'Required supported HTTP types', + optional: false, + }, + SCHEDULER_SERVICE_BASE_URL: { + message: 'Required scheduler service base URL', + optional: false, + }, + NOTIFICATION_SERVICE_BASE_URL: { + message: 'Required notification service base URL', + optional: false, + }, + ...config.requiredEnvs, +} + +let success = true +module.exports = function () { + Object.keys(environmentVariables).forEach((eachEnvironmentVariable) => { + let tableObj = { + [eachEnvironmentVariable]: 'PASSED', + } + + let keyCheckPass = true + + if ( + environmentVariables[eachEnvironmentVariable].optional === true && + environmentVariables[eachEnvironmentVariable].requiredIf && + environmentVariables[eachEnvironmentVariable].requiredIf.key && + environmentVariables[eachEnvironmentVariable].requiredIf.key != '' && + environmentVariables[eachEnvironmentVariable].requiredIf.operator && + validRequiredIfOperators.includes(environmentVariables[eachEnvironmentVariable].requiredIf.operator) && + environmentVariables[eachEnvironmentVariable].requiredIf.value && + environmentVariables[eachEnvironmentVariable].requiredIf.value != '' + ) { + switch (environmentVariables[eachEnvironmentVariable].requiredIf.operator) { + case 'EQUALS': + if ( + process.env[environmentVariables[eachEnvironmentVariable].requiredIf.key] === + environmentVariables[eachEnvironmentVariable].requiredIf.value + ) { + environmentVariables[eachEnvironmentVariable].optional = false + } + break + case 'NOT_EQUALS': + if ( + process.env[environmentVariables[eachEnvironmentVariable].requiredIf.key] != + environmentVariables[eachEnvironmentVariable].requiredIf.value + ) { + environmentVariables[eachEnvironmentVariable].optional = false + } + break + default: + break + } + } + + if (environmentVariables[eachEnvironmentVariable].optional === false) { + if (!process.env[eachEnvironmentVariable] || process.env[eachEnvironmentVariable] == '') { + success = false + keyCheckPass = false + } else if ( + environmentVariables[eachEnvironmentVariable].possibleValues && + Array.isArray(environmentVariables[eachEnvironmentVariable].possibleValues) && + environmentVariables[eachEnvironmentVariable].possibleValues.length > 0 + ) { + if ( + !environmentVariables[eachEnvironmentVariable].possibleValues.includes( + process.env[eachEnvironmentVariable] + ) + ) { + success = false + keyCheckPass = false + environmentVariables[eachEnvironmentVariable].message += ` Valid values - ${environmentVariables[ + eachEnvironmentVariable + ].possibleValues.join(', ')}` + } + } + } + + if ( + (!process.env[eachEnvironmentVariable] || process.env[eachEnvironmentVariable] == '') && + environmentVariables[eachEnvironmentVariable].default && + environmentVariables[eachEnvironmentVariable].default != '' + ) { + process.env[eachEnvironmentVariable] = environmentVariables[eachEnvironmentVariable].default + } + + if (!keyCheckPass) { + if (environmentVariables[eachEnvironmentVariable].message !== '') { + tableObj[eachEnvironmentVariable] = environmentVariables[eachEnvironmentVariable].message + } else { + tableObj[eachEnvironmentVariable] = `FAILED - ${eachEnvironmentVariable} is required` + } + } + + tableData.push(tableObj) + }) + + console.log(tableData.toString()) + + return { + success: success, + } +} diff --git a/src/helpers/addToNestedObject.js b/src/helpers/addToNestedObject.js index 94796e4..e3fed3b 100644 --- a/src/helpers/addToNestedObject.js +++ b/src/helpers/addToNestedObject.js @@ -1,10 +1,10 @@ 'use strict' -exports.addToNestedObject = (existingObject, array, value, objectTypeSymbol) => { +exports.addToNestedObject = (existingObject, array, value /* , objectTypeSymbol */) => { if (array.length === 0) return existingObject const key = array.shift() if (!existingObject[key]) existingObject[key] = {} if (array.length === 0) existingObject[key] = value - else exports.addToNestedObject(existingObject[key], array, value, objectTypeSymbol) - existingObject[key][objectTypeSymbol] = 'object' + else exports.addToNestedObject(existingObject[key], array, value /* , objectTypeSymbol */) + /* existingObject[key][objectTypeSymbol] = 'object' */ return existingObject } diff --git a/src/helpers/bodyConfigGenerator.js b/src/helpers/bodyConfigGenerator.js index 9dbdfac..a740843 100644 --- a/src/helpers/bodyConfigGenerator.js +++ b/src/helpers/bodyConfigGenerator.js @@ -1,18 +1,18 @@ 'use strict' const { addToNestedObject } = require('./addToNestedObject') -exports.bodyConfigGenerator = (targetBody, processors) => { +exports.bodyConfigGenerator = (targetBody /* ,processors */) => { try { let bodyConfig = {} - const objectTypeSymbol = Symbol.for('objectTypeSymbol') + //const objectTypeSymbol = Symbol.for('objectTypeSymbol') for (const target of targetBody) - addToNestedObject(bodyConfig, target.targetField.split('.'), target.sourceField, objectTypeSymbol) - for (const processor of processors) + addToNestedObject(bodyConfig, target.targetField.split('.'), target.sourceField /* , objectTypeSymbol */) + /* for (const processor of processors) bodyConfig[`${processor.targetField}`] = { inputFields: processor.inputFields, processor, [objectTypeSymbol]: 'processor', - } + } */ return bodyConfig } catch (err) { console.log(err) diff --git a/src/helpers/bodyValueReplacer.js b/src/helpers/bodyValueReplacer.js new file mode 100644 index 0000000..fe80195 --- /dev/null +++ b/src/helpers/bodyValueReplacer.js @@ -0,0 +1,71 @@ +'use strict' +/* const transformRecursive = (source, targetConfig, output) => { + for (const [key, value] of Object.entries(targetConfig)) { + if (typeof value === 'object') transformRecursive(source, value, output[key]) + else { + const sourceKey = value.split('.').reduce((obj, key) => obj[key], source) + output[key] = sourceKey !== undefined ? sourceKey : source[value] + delete output[value] + } + } +} */ + +const accessNestedField = (obj, path) => { + const keys = path.split('.') + let value = obj + let parent = null + for (const key of keys) { + parent = value + value = value[key] + if (value === undefined) return undefined + } + if (parent !== null) delete parent[keys[keys.length - 1]] + return value +} + +const setNestedField = (obj, path, value) => { + const keys = path.split('.') + let currentObj = obj + + for (let i = 0; i < keys.length - 1; i++) { + const key = keys[i] + currentObj[key] = currentObj[key] || {} + currentObj = currentObj[key] + } + const finalKey = keys[keys.length - 1] + currentObj[finalKey] = finalKey.endsWith('[]') ? (currentObj[finalKey] || []).concat(value) : value +} + +const isObject = (obj) => typeof obj === 'object' && obj !== null && !Array.isArray(obj) + +const transformRecursive = (source, sourceFieldMap, currentPath, result) => { + if (isObject(source)) + for (const [key, value] of Object.entries(source)) { + if (isObject(value)) { + const path = currentPath + key + '.' + transformRecursive(source[key], sourceFieldMap, path, result) + } else { + const keyPath = currentPath + key + if (sourceFieldMap.has(keyPath)) { + const targetField = sourceFieldMap.get(keyPath) + setNestedField(result, targetField, accessNestedField(result, keyPath)) + } + } + } +} + +const sourceFieldMapGenerator = (mappings) => { + const sourceFieldMap = new Map() + mappings.map((mapping) => { + sourceFieldMap.set(mapping.sourceField, mapping.targetField) + }) + console.log(sourceFieldMap) + return sourceFieldMap +} + +exports.bodyValueReplacer = (sourceObject, targetObjectConfig) => { + const sourceFieldMap = sourceFieldMapGenerator(targetObjectConfig) + const result = JSON.parse(JSON.stringify(sourceObject)) + transformRecursive(sourceObject, sourceFieldMap, '', result, '\t') + return result +} diff --git a/src/helpers/orchestratorMapGenerator.js b/src/helpers/orchestratorMapGenerator.js index d9b1ae5..a6babe3 100644 --- a/src/helpers/orchestratorMapGenerator.js +++ b/src/helpers/orchestratorMapGenerator.js @@ -15,7 +15,7 @@ exports.orchestratorMapGenerator = (orchestratedRoutesArray) => { } }) } - console.log(routesMap) + //console.log(routesMap) return routesMap } catch (err) { console.log(err) diff --git a/src/jsconfig.json b/src/jsconfig.json index c2e7496..3c59b1a 100644 --- a/src/jsconfig.json +++ b/src/jsconfig.json @@ -18,7 +18,8 @@ "@services*": ["./services*"], "@validators*": ["./validators*"], "@utils*": ["./utils*"], - "@router*":["./router*"] + "@router*": ["./router*"], + "@helpers*":["./helpers*"] } }, "exclude": ["node_modules", "@shelf/jest-mongodb"] diff --git a/src/middlewares/targetPackagesInjector.js b/src/middlewares/targetPackagesInjector.js index 7320b9c..2dbbd52 100644 --- a/src/middlewares/targetPackagesInjector.js +++ b/src/middlewares/targetPackagesInjector.js @@ -7,5 +7,6 @@ exports.targetPackagesInjector = (req, res, next) => { req['inSequence'] = routeConfig.inSequence req['sourceRoute'] = routeConfig.sourceRoute req['orchestrated'] = routeConfig.orchestrated + req['responseMessage'] = routeConfig.responseMessage next() } diff --git a/src/package-lock.json b/src/package-lock.json index 781e1bd..515bd72 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -9,13 +9,13 @@ "version": "1.0.0", "license": "ISC", "dependencies": { + "cli-table": "^0.3.11", "cors": "^2.8.5", "dotenv": "^16.3.1", - "elevate-mentoring": "^1.1.3", - "elevate-notification": "^1.0.0", + "elevate-mentoring": "^1.1.23", "elevate-package-validator": "^1.0.0", - "elevate-scheduler": "^1.0.0", - "elevate-user": "^1.1.2", + "elevate-scheduler": "^1.0.4", + "elevate-user": "^1.1.30", "express": "^4.18.2", "module-alias": "^2.2.3" }, @@ -1977,6 +1977,17 @@ "node": ">=8" } }, + "node_modules/cli-table": { + "version": "0.3.11", + "resolved": "https://registry.npmjs.org/cli-table/-/cli-table-0.3.11.tgz", + "integrity": "sha512-IqLQi4lO0nIB4tcdTpN4LCB9FI3uqrJZK7RC515EnhZ6qBaglkIgICb1wjeAqpdoOabm1+SuQtkXIPdYC93jhQ==", + "dependencies": { + "colors": "1.0.3" + }, + "engines": { + "node": ">= 0.2.0" + } + }, "node_modules/cli-truncate": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz", @@ -2076,6 +2087,14 @@ "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", "dev": true }, + "node_modules/colors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "integrity": "sha512-pFGrxThWcWQ2MsAz6RtgeWe4NK2kUE1WfsrvvlctdII745EW9I0yflqhe7++M5LEc7bV2c/9/5zc8sFcpL0Drw==", + "engines": { + "node": ">=0.1.90" + } + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -2279,12 +2298,14 @@ "dev": true }, "node_modules/elevate-mentoring": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/elevate-mentoring/-/elevate-mentoring-1.1.3.tgz", - "integrity": "sha512-SfT1OXnhWUTsfktF8dYxHHCi1FbXjmkv1Gn3Nr5cnhROGjDTNmfPTogoGVnvGqCcYWCrS14xSG7BHdkaxZBPKg==", + "version": "1.1.23", + "resolved": "https://registry.npmjs.org/elevate-mentoring/-/elevate-mentoring-1.1.23.tgz", + "integrity": "sha512-1DVhcc4mA6+YM9yxvo+b9TNHxdO6961gO/I3Enj3wO/iLr5LCh5mS2x1nPmIrhJqtcZjGQ/zeJ8gS9geCCVroA==", "dependencies": { "axios": "^1.4.0", "express": "^4.18.2", + "lodash": "^4.17.21", + "node-fetch": "^2.7.0", "path-to-regexp": "^6.2.1" } }, @@ -2293,14 +2314,6 @@ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.1.tgz", "integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==" }, - "node_modules/elevate-notification": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/elevate-notification/-/elevate-notification-1.0.0.tgz", - "integrity": "sha512-AfY12vmyuQsF/hw4TRnENJfCB0/7krc+I7Layr+KTtDqnUKfv0t94KSp1FoxBei2wFrDZBKLoDmVlepy70OaxQ==", - "dependencies": { - "express": "^4.18.2" - } - }, "node_modules/elevate-package-validator": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/elevate-package-validator/-/elevate-package-validator-1.0.0.tgz", @@ -2310,20 +2323,31 @@ } }, "node_modules/elevate-scheduler": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/elevate-scheduler/-/elevate-scheduler-1.0.0.tgz", - "integrity": "sha512-J6Yt7M4Eqe+HYQCguF3btaQ01yCYhzRa3FHABEWD/yXoYB1r17mdcL2DYWSfmqpGi4lQeATq5Uw4Z2Hz/De9+w==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/elevate-scheduler/-/elevate-scheduler-1.0.4.tgz", + "integrity": "sha512-/UkR8INbOO673OFGdspp/n3BT5uLh/UHsqiB6g2B9TU07gXow8TefXEnD+TaYPf0hW2v8v6bJrCGJGtG4loXLw==", "dependencies": { - "express": "^4.18.2" + "axios": "^1.4.0", + "express": "^4.18.2", + "lodash": "^4.17.21", + "node-fetch": "^2.7.0", + "path-to-regexp": "^6.2.1" } }, + "node_modules/elevate-scheduler/node_modules/path-to-regexp": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.1.tgz", + "integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==" + }, "node_modules/elevate-user": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/elevate-user/-/elevate-user-1.1.2.tgz", - "integrity": "sha512-EZN7dFvx3OJMDUodatjVasm5MmRc+e029zYGA3j0T3xnVPvyvH3hQF87yrIfToU9+t3qfRRzXzsM4gN3HqQ3Yw==", + "version": "1.1.30", + "resolved": "https://registry.npmjs.org/elevate-user/-/elevate-user-1.1.30.tgz", + "integrity": "sha512-kTMPsQ1ywrK1zt4vo2EK0cfkTiL9RALOg+IOFEh0MPgqflXVdQFqYYZawLEFTOrE/OeAeuyp1pdf43ZEqnEGHA==", "dependencies": { "axios": "^1.4.0", - "express": "^4.18.2" + "express": "^4.18.2", + "lodash": "^4.17.21", + "node-fetch": "^2.7.0" } }, "node_modules/emittery": { @@ -4221,6 +4245,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", @@ -4486,6 +4515,25 @@ "node": ">= 0.6" } }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -5691,6 +5739,11 @@ "nodetouch": "bin/nodetouch.js" } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", @@ -5834,6 +5887,20 @@ "makeerror": "1.0.12" } }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -7492,6 +7559,14 @@ "restore-cursor": "^3.1.0" } }, + "cli-table": { + "version": "0.3.11", + "resolved": "https://registry.npmjs.org/cli-table/-/cli-table-0.3.11.tgz", + "integrity": "sha512-IqLQi4lO0nIB4tcdTpN4LCB9FI3uqrJZK7RC515EnhZ6qBaglkIgICb1wjeAqpdoOabm1+SuQtkXIPdYC93jhQ==", + "requires": { + "colors": "1.0.3" + } + }, "cli-truncate": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz", @@ -7571,6 +7646,11 @@ "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", "dev": true }, + "colors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "integrity": "sha512-pFGrxThWcWQ2MsAz6RtgeWe4NK2kUE1WfsrvvlctdII745EW9I0yflqhe7++M5LEc7bV2c/9/5zc8sFcpL0Drw==" + }, "combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -7725,12 +7805,14 @@ "dev": true }, "elevate-mentoring": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/elevate-mentoring/-/elevate-mentoring-1.1.3.tgz", - "integrity": "sha512-SfT1OXnhWUTsfktF8dYxHHCi1FbXjmkv1Gn3Nr5cnhROGjDTNmfPTogoGVnvGqCcYWCrS14xSG7BHdkaxZBPKg==", + "version": "1.1.23", + "resolved": "https://registry.npmjs.org/elevate-mentoring/-/elevate-mentoring-1.1.23.tgz", + "integrity": "sha512-1DVhcc4mA6+YM9yxvo+b9TNHxdO6961gO/I3Enj3wO/iLr5LCh5mS2x1nPmIrhJqtcZjGQ/zeJ8gS9geCCVroA==", "requires": { "axios": "^1.4.0", "express": "^4.18.2", + "lodash": "^4.17.21", + "node-fetch": "^2.7.0", "path-to-regexp": "^6.2.1" }, "dependencies": { @@ -7741,14 +7823,6 @@ } } }, - "elevate-notification": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/elevate-notification/-/elevate-notification-1.0.0.tgz", - "integrity": "sha512-AfY12vmyuQsF/hw4TRnENJfCB0/7krc+I7Layr+KTtDqnUKfv0t94KSp1FoxBei2wFrDZBKLoDmVlepy70OaxQ==", - "requires": { - "express": "^4.18.2" - } - }, "elevate-package-validator": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/elevate-package-validator/-/elevate-package-validator-1.0.0.tgz", @@ -7758,20 +7832,33 @@ } }, "elevate-scheduler": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/elevate-scheduler/-/elevate-scheduler-1.0.0.tgz", - "integrity": "sha512-J6Yt7M4Eqe+HYQCguF3btaQ01yCYhzRa3FHABEWD/yXoYB1r17mdcL2DYWSfmqpGi4lQeATq5Uw4Z2Hz/De9+w==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/elevate-scheduler/-/elevate-scheduler-1.0.4.tgz", + "integrity": "sha512-/UkR8INbOO673OFGdspp/n3BT5uLh/UHsqiB6g2B9TU07gXow8TefXEnD+TaYPf0hW2v8v6bJrCGJGtG4loXLw==", "requires": { - "express": "^4.18.2" + "axios": "^1.4.0", + "express": "^4.18.2", + "lodash": "^4.17.21", + "node-fetch": "^2.7.0", + "path-to-regexp": "^6.2.1" + }, + "dependencies": { + "path-to-regexp": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.1.tgz", + "integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==" + } } }, "elevate-user": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/elevate-user/-/elevate-user-1.1.2.tgz", - "integrity": "sha512-EZN7dFvx3OJMDUodatjVasm5MmRc+e029zYGA3j0T3xnVPvyvH3hQF87yrIfToU9+t3qfRRzXzsM4gN3HqQ3Yw==", + "version": "1.1.30", + "resolved": "https://registry.npmjs.org/elevate-user/-/elevate-user-1.1.30.tgz", + "integrity": "sha512-kTMPsQ1ywrK1zt4vo2EK0cfkTiL9RALOg+IOFEh0MPgqflXVdQFqYYZawLEFTOrE/OeAeuyp1pdf43ZEqnEGHA==", "requires": { "axios": "^1.4.0", - "express": "^4.18.2" + "express": "^4.18.2", + "lodash": "^4.17.21", + "node-fetch": "^2.7.0" } }, "emittery": { @@ -9169,6 +9256,11 @@ "p-locate": "^5.0.0" } }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, "lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", @@ -9372,6 +9464,14 @@ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==" }, + "node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "requires": { + "whatwg-url": "^5.0.0" + } + }, "node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -10227,6 +10327,11 @@ "nopt": "~1.0.10" } }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", @@ -10323,6 +10428,20 @@ "makeerror": "1.0.12" } }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/src/package.json b/src/package.json index ccb33c6..5cd8dea 100644 --- a/src/package.json +++ b/src/package.json @@ -18,13 +18,13 @@ "author": "Joffin Joy", "license": "ISC", "dependencies": { + "cli-table": "^0.3.11", "cors": "^2.8.5", "dotenv": "^16.3.1", - "elevate-mentoring": "^1.1.3", - "elevate-notification": "^1.0.0", + "elevate-mentoring": "^1.1.23", "elevate-package-validator": "^1.0.0", - "elevate-scheduler": "^1.0.0", - "elevate-user": "^1.1.2", + "elevate-scheduler": "^1.0.4", + "elevate-user": "^1.1.30", "express": "^4.18.2", "module-alias": "^2.2.3" }, @@ -49,7 +49,8 @@ "@utils": "utils", "@tests": "tests", "@middlewares": "middlewares", - "@constants":"constants", - "@router":"router" + "@constants": "constants", + "@router": "router", + "@helpers": "helpers" } } diff --git a/src/router/index.js b/src/router/index.js index 10e975d..27f4815 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -18,7 +18,7 @@ exports.initializeRouter = (packages) => { const servicePackage = packages.find((obj) => obj.packageMeta.basePackageName === basePackageName) router[method](route.sourceRoute, routeConfigInjector, servicePackage.packageRouter) } else { - console.log(route.sourceRoute) + //console.log(route.sourceRoute) router[method]( route.sourceRoute, targetPackagesInjector, diff --git a/src/utils/packageInstaller.js b/src/utils/packageInstaller.js new file mode 100644 index 0000000..3575936 --- /dev/null +++ b/src/utils/packageInstaller.js @@ -0,0 +1,24 @@ +'use strict' +const child_process = require('child_process') + +async function installPackages(packageString) { + const userPackages = packageString.split(' ') + for (const userPackage of userPackages) { + const [packageName, version] = userPackage.split('@') + if (!packageName) { + console.error(`Invalid package format: ${userPackage}`) + continue + } + + const installCommand = version ? `${packageName}@${version}` : packageName + + try { + const { stdout, stderr } = child_process.execSync(`npm install ${installCommand}`) + //console.log(`${installCommand} installed successfully`) + } catch (error) { + console.error(`Error installing ${installCommand}: ${error}`) + throw new Error(`Error installing ${installCommand}: ${error}`) + } + } +} +module.exports = installPackages diff --git a/src/utils/packageLoader.js b/src/utils/packageLoader.js index fd0e6dc..0a8704d 100644 --- a/src/utils/packageLoader.js +++ b/src/utils/packageLoader.js @@ -1,11 +1,12 @@ 'use strict' const packageLoader = () => { - const packageNames = process.env.INSTALLED_PACKAGES.split(' ') + const packageNames = process.env.REQUIRED_PACKAGES.split(' ') const packages = [] for (const servicePackage of packageNames) { - packages.push(require(servicePackage)) + const [packageName, version] = servicePackage.split('@') + packages.push(require(packageName)) } - console.log(packages) + //console.log(packages) return packages } diff --git a/src/utils/patternMatcher.js b/src/utils/patternMatcher.js index a9b8929..74c79cc 100644 --- a/src/utils/patternMatcher.js +++ b/src/utils/patternMatcher.js @@ -2,10 +2,10 @@ exports.matchPathsAndExtractParams = (pattern, url) => { const paramNames = [] const regexPattern = new RegExp( - pattern.replace(/:(\w+)/g, (_, paramName) => { + pattern.replace(/\/:(\w+)/g, (_, paramName) => { paramNames.push(paramName) - return '([a-zA-Z0-9]+)' - }) + return '/([^/]+)' + }) + '$' ) const matchResult = url.match(regexPattern) if (!matchResult) return false