From 1840b064ce883d9b0777d855db4d53636446ce13 Mon Sep 17 00:00:00 2001 From: Tyagi-Sunny Date: Wed, 3 Jul 2024 17:42:14 +0530 Subject: [PATCH] fix(deps): add sandbox for arc saas add sandbox for arc saas gh-29 --- sandbox/app-saas/.cz-config.js | 67 + sandbox/app-saas/.gitignore | 3 + sandbox/app-saas/.husky/commit-msg | 18 + sandbox/app-saas/.husky/pre-commit | 18 + sandbox/app-saas/.husky/prepare-commit-msg | 18 + sandbox/app-saas/DEVELOPING.md | 492 + sandbox/app-saas/README.md | 135 + sandbox/app-saas/commitlint.config.js | 14 + .../facades/tenant-mgmt-facade/.dockerignore | 6 + .../facades/tenant-mgmt-facade/.env.defaults | 5 + .../facades/tenant-mgmt-facade/.env.example | 13 + .../facades/tenant-mgmt-facade/.eslintignore | 5 + .../facades/tenant-mgmt-facade/.eslintrc.js | 12 + .../facades/tenant-mgmt-facade/.gitignore | 65 + .../facades/tenant-mgmt-facade/.mocharc.json | 6 + .../facades/tenant-mgmt-facade/.nycrc | 9 + .../tenant-mgmt-facade/.prettierignore | 5 + .../facades/tenant-mgmt-facade/.prettierrc | 7 + .../tenant-mgmt-facade/.vscode/launch.json | 38 + .../tenant-mgmt-facade/.vscode/settings.json | 32 + .../tenant-mgmt-facade/.vscode/tasks.json | 29 + .../facades/tenant-mgmt-facade/.yo-rc.json | 6 + .../facades/tenant-mgmt-facade/DEVELOPING.md | 36 + .../facades/tenant-mgmt-facade/Dockerfile | 89 + .../facades/tenant-mgmt-facade/README.md | 31 + .../docs/tenant-onboarding.png | Bin 0 -> 147092 bytes .../facades/tenant-mgmt-facade/package.json | 104 + .../tenant-mgmt-facade/public/index.html | 103 + .../src/__tests__/README.md | 3 + .../acceptance/home-page.acceptance.ts | 32 + .../acceptance/lead.controller.acceptance.ts | 170 + .../acceptance/ping.controller.acceptance.ts | 22 + .../tenant.controller.acceptance.ts | 86 + .../src/__tests__/acceptance/test-helper.ts | 67 + .../src/__tests__/mock-data.ts | 55 + .../unit/tenant-helper.service.unit.ts | 306 + .../tenant-mgmt-facade/src/application.ts | 169 + .../src/controllers/README.md | 9 + .../src/controllers/home-page.controller.ts | 44 + .../src/controllers/index.ts | 5 + .../src/controllers/lead.controller.ts | 258 + .../src/controllers/ping.controller.ts | 64 + .../controllers/subscription.controller.ts | 73 + .../src/controllers/tenant.controller.ts | 87 + .../src/datasources/README.md | 3 + .../src/datasources/db.datasource.ts | 52 + .../src/datasources/index.ts | 2 + .../src/datasources/proxies/index.ts | 3 + .../proxies/notification-proxy.datasource.ts | 66 + .../proxies/subscription-proxy.datasource.ts | 142 + .../proxies/tenant-mgmt-proxy.datasource.ts | 149 + .../src/datasources/redis.datasource.ts | 65 + .../datasources/tntmngmentcache.datasource.ts | 64 + .../tenant-mgmt-facade/src/enum/index.ts | 6 + .../src/enum/invoice-status.enum.ts | 5 + .../src/enum/notification-type.enum.ts | 6 + .../src/enum/plans-tier.enum.ts | 4 + .../src/enum/subscription-status.enum.ts | 7 + .../src/enum/tenant-status.enum.ts | 7 + .../src/enum/webhook-types.enum.ts | 3 + .../facades/tenant-mgmt-facade/src/index.ts | 41 + .../facades/tenant-mgmt-facade/src/keys.ts | 10 + .../tenant-mgmt-facade/src/models/README.md | 3 + .../src/models/address.model.ts | 49 + .../src/models/contact.model.ts | 76 + .../check-billing-subscriptions-dto.model.ts | 17 + .../src/models/dtos/create-lead-dto.model.ts | 22 + .../models/dtos/create-tenant-dto.model.ts | 89 + .../src/models/dtos/index.ts | 8 + .../src/models/dtos/provisioning-dto.model.ts | 21 + .../dtos/subscription-bill-dto.model.ts | 43 + .../src/models/dtos/subscription-dto.model.ts | 48 + .../src/models/dtos/tenant-list-dto.model.ts | 38 + .../models/dtos/tenant-onboard-dto.model.ts | 81 + .../dtos/verify-lead-response-dto.model.ts | 20 + .../tenant-mgmt-facade/src/models/index.ts | 8 + .../src/models/invoice.model.ts | 96 + .../src/models/lead-token.model.ts | 14 + .../src/models/lead.model.ts | 78 + .../src/models/resource.model.ts | 62 + .../src/models/tenant.model.ts | 108 + .../tenant-mgmt-facade/src/openapi-spec.ts | 28 + .../tenant-mgmt-facade/src/openapi.json | 1310 + .../src/opentelemetry-registry.ts | 31 + .../tenant-mgmt-facade/src/permissions.ts | 34 + .../src/repositories/index.ts | 1 + .../src/repositories/lead-token.repository.ts | 13 + .../services/crypto-helper-sunny.service.ts | 23 + .../tenant-mgmt-facade/src/services/index.ts | 3 + .../services/lead-token-verify.provider.ts | 31 + .../src/services/notifications/index.ts | 2 + .../notifications/notification.service.ts | 67 + .../notifications/template.service.ts | 58 + .../src/services/proxies/index.ts | 4 + .../proxies/notification-proxy.provider.ts | 27 + .../proxies/subscription-proxy.provider.ts | 58 + .../proxies/tenant-mgmt-proxy.provider.ts | 44 + .../src/services/proxies/types.ts | 155 + .../src/services/tenant-helper.service.ts | 398 + .../facades/tenant-mgmt-facade/src/types.ts | 136 + .../facades/tenant-mgmt-facade/src/utils.ts | 10 + .../tenant-management-service-0.0.1.tgz | Bin 0 -> 100469 bytes .../facades/tenant-mgmt-facade/tsconfig.json | 10 + sandbox/app-saas/info.txt | 10 + sandbox/app-saas/lerna.json | 19 + sandbox/app-saas/package-lock.json | 24299 ++++++++++++++++ sandbox/app-saas/package.json | 33 + sandbox/app-saas/packages/.DS_Store | Bin 0 -> 6148 bytes .../app-saas/packages/migrations/.env.example | 39 + .../app-saas/packages/migrations/.gitignore | 2 + .../app-saas/packages/migrations/Dockerfile | 12 + .../migrations/audit-service/database.json | 22 + .../migrations/20210423140543-init.js | 50 + .../migrations/20230608151724-job.js | 53 + .../migrations/20230608151805-mapping-log.js | 53 + .../sqls/20210423140543-init-down.sql | 1 + .../sqls/20210423140543-init-up.sql | 26 + .../sqls/20230608151724-job-down.sql | 1 + .../migrations/sqls/20230608151724-job-up.sql | 11 + .../sqls/20230608151805-mapping-log-down.sql | 1 + .../sqls/20230608151805-mapping-log-up.sql | 10 + .../authentication-service/database.json | 22 + .../migrations/20210318100600-init.js | 51 + .../20220607063927-secret-key-column.js | 59 + .../migrations/20221110095658-updated-init.js | 59 + .../20230323132703-client-type-column.js | 59 + .../20230524115047-login-activity.js | 59 + .../migrations/20240209143809-seed-user.js | 76 + .../sqls/20210318100600-init-down.sql | 1 + .../sqls/20210318100600-init-up.sql | 231 + .../20220607063927-secret-key-column-down.sql | 2 + .../20220607063927-secret-key-column-up.sql | 2 + .../sqls/20221110095658-updated-init-down.sql | 11 + .../sqls/20221110095658-updated-init-up.sql | 11 + ...20230323132703-client-type-column-down.sql | 3 + .../20230323132703-client-type-column-up.sql | 5 + .../20230524115047-login-activity-down.sql | 6 + .../sqls/20230524115047-login-activity-up.sql | 16 + .../sqls/20240209143809-seed-user-down.sql | 36 + .../sqls/20240209143809-seed-user-up.sql | 66 + .../notification-service/database.json | 22 + .../migrations/20210501132806-init.js | 51 + ...ltiple-notification-as-one-notification.js | 59 + ...cation-user-table-to-support-sleep-time.js | 59 + ...084826-add-subscription-email-templates.js | 53 + .../sqls/20210501132806-init-down.sql | 1 + .../sqls/20210501132806-init-up.sql | 355 + ...-notification-as-one-notification-down.sql | 6 + ...le-notification-as-one-notification-up.sql | 32 + ...-user-table-to-support-sleep-time-down.sql | 2 + ...on-user-table-to-support-sleep-time-up.sql | 2 + ...-add-subscription-email-templates-down.sql | 1 + ...26-add-subscription-email-templates-up.sql | 558 + .../app-saas/packages/migrations/package.json | 41 + .../subscription-service/database.json | 22 + .../migrations/20240205055601-init.js | 53 + .../20240206102246-add-table-currencies.js | 53 + ...20240206102257-add-table-billing-cycles.js | 53 + ...0847-seed-currencies-and-billing-cycles.js | 53 + .../20240208082503-add-constraints.js | 53 + ...20240208115049-add-tier-column-to-plans.js | 53 + .../migrations/20240209122448-seed-data.js | 68 + .../migrations/package.json | 3 + .../sqls/20240205055601-init-down.sql | 1 + .../sqls/20240205055601-init-up.sql | 84 + ...240206102246-add-table-currencies-down.sql | 1 + ...20240206102246-add-table-currencies-up.sql | 16 + ...06102257-add-table-billing-cycles-down.sql | 1 + ...0206102257-add-table-billing-cycles-up.sql | 17 + ...eed-currencies-and-billing-cycles-down.sql | 2 + ...-seed-currencies-and-billing-cycles-up.sql | 26 + .../20240208082503-add-constraints-down.sql | 15 + .../20240208082503-add-constraints-up.sql | 19 + ...08115049-add-tier-column-to-plans-down.sql | 2 + ...0208115049-add-tier-column-to-plans-up.sql | 2 + .../sqls/20240209122448-seed-data-down.sql | 4 + .../sqls/20240209122448-seed-data-up.sql | 46 + .../migrations/sqls/package.json | 3 + .../tenant-mgmt-service/database.json | 22 + .../migrations/20240125154021-init.js | 53 + .../sqls/20240125154021-init-down.sql | 1 + .../sqls/20240125154021-init-up.sql | 186 + .../migrations/sqls/package.json | 3 + .../services/audit-service/.dockerignore | 5 + .../services/audit-service/.env.defaults | 17 + .../services/audit-service/.env.example | 17 + .../services/audit-service/.eslintignore | 4 + .../services/audit-service/.eslintrc.js | 12 + .../services/audit-service/.gitignore | 64 + .../services/audit-service/.mocharc.json | 5 + .../app-saas/services/audit-service/.nycrc | 5 + .../services/audit-service/.prettierignore | 3 + .../services/audit-service/.prettierrc | 7 + .../audit-service/.vscode/launch.json | 38 + .../audit-service/.vscode/settings.json | 32 + .../services/audit-service/.vscode/tasks.json | 29 + .../services/audit-service/.yo-rc.json | 6 + .../services/audit-service/DEVELOPING.md | 36 + .../services/audit-service/Dockerfile | 93 + .../app-saas/services/audit-service/README.md | 75 + .../services/audit-service/package.json | 97 + .../services/audit-service/public/index.html | 103 + .../audit-service/src/__tests__/README.md | 3 + .../acceptance/home-page.acceptance.ts | 32 + .../acceptance/ping.controller.acceptance.ts | 22 + .../src/__tests__/acceptance/test-helper.ts | 47 + .../services/audit-service/src/application.ts | 127 + .../audit-service/src/controllers/README.md | 9 + .../src/controllers/home-page.controller.ts | 42 + .../audit-service/src/controllers/index.ts | 2 + .../src/controllers/ping.controller.ts | 60 + .../audit-service/src/datasources/README.md | 3 + .../src/datasources/db.datasource.ts | 54 + .../audit-service/src/datasources/index.ts | 1 + .../services/audit-service/src/index.ts | 41 + .../audit-service/src/models/README.md | 3 + .../audit-service/src/openapi-spec.ts | 29 + .../services/audit-service/src/openapi.json | 817 + .../src/opentelemetry-registry.ts | 35 + .../services/audit-service/tsconfig.json | 9 + .../authentication-service/.dockerignore | 5 + .../authentication-service/.env.defaults | 64 + .../authentication-service/.env.example | 79 + .../authentication-service/.eslintignore | 4 + .../authentication-service/.eslintrc.js | 12 + .../authentication-service/.gitignore | 64 + .../authentication-service/.mocharc.json | 5 + .../services/authentication-service/.nycrc | 5 + .../authentication-service/.prettierignore | 3 + .../authentication-service/.prettierrc | 7 + .../.vscode/launch.json | 38 + .../.vscode/settings.json | 32 + .../authentication-service/.vscode/tasks.json | 29 + .../authentication-service/.yo-rc.json | 6 + .../authentication-service/DEVELOPING.md | 36 + .../authentication-service/Dockerfile | 88 + .../services/authentication-service/README.md | 75 + .../authentication-service/package.json | 99 + .../authentication-service/public/index.html | 103 + .../src/__tests__/README.md | 3 + .../acceptance/home-page.acceptance.ts | 32 + .../acceptance/ping.controller.acceptance.ts | 22 + .../src/__tests__/acceptance/test-helper.ts | 52 + .../authentication-service/src/application.ts | 153 + .../src/controllers/README.md | 9 + .../src/controllers/home-page.controller.ts | 42 + .../src/controllers/index.ts | 2 + .../src/controllers/ping.controller.ts | 60 + .../src/datasources/README.md | 3 + .../src/datasources/db.datasource.ts | 54 + .../src/datasources/index.ts | 2 + .../src/datasources/redis.datasource.ts | 65 + .../authentication-service/src/index.ts | 41 + .../src/models/README.md | 3 + .../src/openapi-spec.ts | 29 + .../authentication-service/src/openapi.json | 2514 ++ .../src/opentelemetry-registry.ts | 35 + .../providers/cognito-auth-verify.provider.ts | 84 + .../src/providers/index.ts | 1 + .../authentication-service/tsconfig.json | 9 + .../notification-service/.dockerignore | 5 + .../notification-service/.env.defaults | 17 + .../notification-service/.env.example | 17 + .../notification-service/.eslintignore | 4 + .../notification-service/.eslintrc.js | 12 + .../services/notification-service/.gitignore | 64 + .../notification-service/.mocharc.json | 5 + .../services/notification-service/.nycrc | 5 + .../notification-service/.prettierignore | 3 + .../services/notification-service/.prettierrc | 7 + .../notification-service/.vscode/launch.json | 38 + .../.vscode/settings.json | 32 + .../notification-service/.vscode/tasks.json | 29 + .../services/notification-service/.yo-rc.json | 6 + .../notification-service/DEVELOPING.md | 36 + .../services/notification-service/Dockerfile | 88 + .../services/notification-service/README.md | 75 + .../notification-service/package.json | 98 + .../notification-service/public/index.html | 103 + .../src/__tests__/README.md | 3 + .../acceptance/home-page.acceptance.ts | 32 + .../acceptance/ping.controller.acceptance.ts | 22 + .../src/__tests__/acceptance/test-helper.ts | 47 + .../notification-service/src/application.ts | 150 + .../src/controllers/README.md | 9 + .../src/controllers/home-page.controller.ts | 42 + .../src/controllers/index.ts | 2 + .../notification-template.controller.ts | 45 + .../src/controllers/ping.controller.ts | 60 + .../src/datasources/README.md | 3 + .../src/datasources/db.datasource.ts | 54 + .../src/datasources/index.ts | 1 + .../notification-service/src/index.ts | 41 + .../notification-service/src/models/README.md | 3 + .../notification-service/src/models/index.ts | 1 + .../models/notification-templates.model.ts | 46 + .../notification-service/src/openapi-spec.ts | 29 + .../notification-service/src/openapi.json | 2973 ++ .../src/opentelemetry-registry.ts | 35 + .../notification-service/src/permissions.ts | 7 + .../src/repositories/index.ts | 1 + .../notification-templates.repository.ts | 23 + .../notification-service/tsconfig.json | 9 + .../subscription-service/.dockerignore | 5 + .../subscription-service/.env.defaults | 17 + .../subscription-service/.env.example | 17 + .../subscription-service/.eslintignore | 4 + .../subscription-service/.eslintrc.js | 12 + .../services/subscription-service/.gitignore | 64 + .../subscription-service/.mocharc.json | 5 + .../services/subscription-service/.nycrc | 5 + .../subscription-service/.prettierignore | 3 + .../services/subscription-service/.prettierrc | 7 + .../subscription-service/.vscode/launch.json | 38 + .../.vscode/settings.json | 32 + .../subscription-service/.vscode/tasks.json | 29 + .../services/subscription-service/.yo-rc.json | 6 + .../subscription-service/DEVELOPING.md | 36 + .../services/subscription-service/Dockerfile | 89 + .../services/subscription-service/README.md | 75 + .../subscription-service/package.json | 97 + .../subscription-service/public/index.html | 103 + .../src/__tests__/README.md | 3 + .../acceptance/home-page.acceptance.ts | 31 + .../acceptance/ping.controller.acceptance.ts | 21 + .../src/__tests__/acceptance/test-helper.ts | 47 + .../subscription-service/src/application.ts | 127 + .../src/controllers/README.md | 9 + .../src/controllers/home-page.controller.ts | 42 + .../src/controllers/index.ts | 2 + .../src/controllers/ping.controller.ts | 60 + .../src/datasources/README.md | 3 + .../src/datasources/audit.datasource.ts | 52 + .../src/datasources/index.ts | 1 + .../subscription-service/src/index.ts | 41 + .../subscription-service/src/models/README.md | 3 + .../subscription-service/src/openapi-spec.ts | 31 + .../subscription-service/src/openapi.json | 5737 ++++ .../src/opentelemetry-registry.ts | 35 + .../subscription-service-0.0.1.tgz | Bin 0 -> 48282 bytes .../subscription-service/tsconfig.json | 9 + .../tenant-mgmt-service/.dockerignore | 5 + .../tenant-mgmt-service/.env.defaults | 17 + .../services/tenant-mgmt-service/.env.example | 17 + .../tenant-mgmt-service/.eslintignore | 4 + .../services/tenant-mgmt-service/.eslintrc.js | 12 + .../services/tenant-mgmt-service/.gitignore | 64 + .../tenant-mgmt-service/.mocharc.json | 5 + .../services/tenant-mgmt-service/.nycrc | 5 + .../tenant-mgmt-service/.prettierignore | 3 + .../services/tenant-mgmt-service/.prettierrc | 7 + .../tenant-mgmt-service/.vscode/launch.json | 38 + .../tenant-mgmt-service/.vscode/settings.json | 32 + .../tenant-mgmt-service/.vscode/tasks.json | 29 + .../services/tenant-mgmt-service/.yo-rc.json | 6 + .../tenant-mgmt-service/DEVELOPING.md | 36 + .../services/tenant-mgmt-service/Dockerfile | 90 + .../services/tenant-mgmt-service/README.md | 75 + .../services/tenant-mgmt-service/package.json | 97 + .../tenant-mgmt-service/public/index.html | 103 + .../src/__tests__/README.md | 3 + .../acceptance/home-page.acceptance.ts | 31 + .../acceptance/ping.controller.acceptance.ts | 21 + .../src/__tests__/acceptance/test-helper.ts | 47 + .../tenant-mgmt-service/src/application.ts | 133 + .../src/controllers/README.md | 9 + .../src/controllers/home-page.controller.ts | 42 + .../src/controllers/index.ts | 2 + .../src/controllers/ping.controller.ts | 60 + .../src/datasources/README.md | 3 + .../src/datasources/db.datasource.ts | 52 + .../src/datasources/index.ts | 2 + .../src/datasources/redis.datasource.ts | 64 + .../services/tenant-mgmt-service/src/index.ts | 41 + .../tenant-mgmt-service/src/models/README.md | 3 + .../tenant-mgmt-service/src/openapi-spec.ts | 31 + .../tenant-mgmt-service/src/openapi.json | 4605 +++ .../src/opentelemetry-registry.ts | 35 + .../src/services/notification.service.ts | 64 + .../tenant-management-service-0.0.1.tgz | Bin 0 -> 100469 bytes .../tenant-mgmt-service/tsconfig.json | 9 + .../user-tenant-service/.dockerignore | 5 + .../user-tenant-service/.env.defaults | 17 + .../services/user-tenant-service/.env.example | 17 + .../user-tenant-service/.eslintignore | 4 + .../services/user-tenant-service/.eslintrc.js | 12 + .../services/user-tenant-service/.gitignore | 64 + .../user-tenant-service/.mocharc.json | 5 + .../services/user-tenant-service/.nycrc | 5 + .../user-tenant-service/.prettierignore | 3 + .../services/user-tenant-service/.prettierrc | 7 + .../user-tenant-service/.vscode/launch.json | 38 + .../user-tenant-service/.vscode/settings.json | 32 + .../user-tenant-service/.vscode/tasks.json | 29 + .../services/user-tenant-service/.yo-rc.json | 6 + .../user-tenant-service/DEVELOPING.md | 36 + .../services/user-tenant-service/Dockerfile | 88 + .../services/user-tenant-service/README.md | 75 + .../services/user-tenant-service/package.json | 97 + .../user-tenant-service/public/index.html | 103 + .../src/__tests__/README.md | 3 + .../acceptance/home-page.acceptance.ts | 32 + .../acceptance/ping.controller.acceptance.ts | 22 + .../src/__tests__/acceptance/test-helper.ts | 47 + .../user-tenant-service/src/application.ts | 127 + .../src/controllers/README.md | 9 + .../src/controllers/home-page.controller.ts | 42 + .../src/controllers/index.ts | 2 + .../src/controllers/ping.controller.ts | 60 + .../src/datasources/README.md | 3 + .../src/datasources/db.datasource.ts | 54 + .../src/datasources/index.ts | 1 + .../services/user-tenant-service/src/index.ts | 41 + .../user-tenant-service/src/models/README.md | 3 + .../user-tenant-service/src/openapi-spec.ts | 29 + .../user-tenant-service/src/openapi.json | 4752 +++ .../src/opentelemetry-registry.ts | 35 + .../user-tenant-service/tsconfig.json | 9 + sandbox/app-saas/tsconfig.json | 0 419 files changed, 63298 insertions(+) create mode 100644 sandbox/app-saas/.cz-config.js create mode 100644 sandbox/app-saas/.gitignore create mode 100755 sandbox/app-saas/.husky/commit-msg create mode 100755 sandbox/app-saas/.husky/pre-commit create mode 100755 sandbox/app-saas/.husky/prepare-commit-msg create mode 100644 sandbox/app-saas/DEVELOPING.md create mode 100644 sandbox/app-saas/README.md create mode 100644 sandbox/app-saas/commitlint.config.js create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/.dockerignore create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/.env.defaults create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/.env.example create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/.eslintignore create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/.eslintrc.js create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/.gitignore create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/.mocharc.json create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/.nycrc create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/.prettierignore create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/.prettierrc create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/.vscode/launch.json create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/.vscode/settings.json create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/.vscode/tasks.json create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/.yo-rc.json create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/DEVELOPING.md create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/Dockerfile create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/README.md create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/docs/tenant-onboarding.png create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/package.json create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/public/index.html create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/__tests__/README.md create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/__tests__/acceptance/home-page.acceptance.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/__tests__/acceptance/lead.controller.acceptance.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/__tests__/acceptance/ping.controller.acceptance.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/__tests__/acceptance/tenant.controller.acceptance.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/__tests__/acceptance/test-helper.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/__tests__/mock-data.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/__tests__/unit/tenant-helper.service.unit.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/application.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/controllers/README.md create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/controllers/home-page.controller.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/controllers/index.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/controllers/lead.controller.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/controllers/ping.controller.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/controllers/subscription.controller.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/controllers/tenant.controller.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/datasources/README.md create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/datasources/db.datasource.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/datasources/index.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/datasources/proxies/index.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/datasources/proxies/notification-proxy.datasource.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/datasources/proxies/subscription-proxy.datasource.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/datasources/proxies/tenant-mgmt-proxy.datasource.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/datasources/redis.datasource.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/datasources/tntmngmentcache.datasource.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/enum/index.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/enum/invoice-status.enum.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/enum/notification-type.enum.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/enum/plans-tier.enum.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/enum/subscription-status.enum.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/enum/tenant-status.enum.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/enum/webhook-types.enum.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/index.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/keys.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/models/README.md create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/models/address.model.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/models/contact.model.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/models/dtos/check-billing-subscriptions-dto.model.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/models/dtos/create-lead-dto.model.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/models/dtos/create-tenant-dto.model.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/models/dtos/index.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/models/dtos/provisioning-dto.model.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/models/dtos/subscription-bill-dto.model.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/models/dtos/subscription-dto.model.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/models/dtos/tenant-list-dto.model.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/models/dtos/tenant-onboard-dto.model.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/models/dtos/verify-lead-response-dto.model.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/models/index.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/models/invoice.model.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/models/lead-token.model.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/models/lead.model.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/models/resource.model.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/models/tenant.model.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/openapi-spec.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/openapi.json create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/opentelemetry-registry.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/permissions.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/repositories/index.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/repositories/lead-token.repository.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/services/crypto-helper-sunny.service.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/services/index.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/services/lead-token-verify.provider.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/services/notifications/index.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/services/notifications/notification.service.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/services/notifications/template.service.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/services/proxies/index.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/services/proxies/notification-proxy.provider.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/services/proxies/subscription-proxy.provider.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/services/proxies/tenant-mgmt-proxy.provider.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/services/proxies/types.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/services/tenant-helper.service.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/types.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/src/utils.ts create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/tenant-management-service-0.0.1.tgz create mode 100644 sandbox/app-saas/facades/tenant-mgmt-facade/tsconfig.json create mode 100644 sandbox/app-saas/info.txt create mode 100644 sandbox/app-saas/lerna.json create mode 100644 sandbox/app-saas/package-lock.json create mode 100644 sandbox/app-saas/package.json create mode 100644 sandbox/app-saas/packages/.DS_Store create mode 100644 sandbox/app-saas/packages/migrations/.env.example create mode 100644 sandbox/app-saas/packages/migrations/.gitignore create mode 100644 sandbox/app-saas/packages/migrations/Dockerfile create mode 100644 sandbox/app-saas/packages/migrations/audit-service/database.json create mode 100644 sandbox/app-saas/packages/migrations/audit-service/migrations/20210423140543-init.js create mode 100644 sandbox/app-saas/packages/migrations/audit-service/migrations/20230608151724-job.js create mode 100644 sandbox/app-saas/packages/migrations/audit-service/migrations/20230608151805-mapping-log.js create mode 100644 sandbox/app-saas/packages/migrations/audit-service/migrations/sqls/20210423140543-init-down.sql create mode 100644 sandbox/app-saas/packages/migrations/audit-service/migrations/sqls/20210423140543-init-up.sql create mode 100644 sandbox/app-saas/packages/migrations/audit-service/migrations/sqls/20230608151724-job-down.sql create mode 100644 sandbox/app-saas/packages/migrations/audit-service/migrations/sqls/20230608151724-job-up.sql create mode 100644 sandbox/app-saas/packages/migrations/audit-service/migrations/sqls/20230608151805-mapping-log-down.sql create mode 100644 sandbox/app-saas/packages/migrations/audit-service/migrations/sqls/20230608151805-mapping-log-up.sql create mode 100644 sandbox/app-saas/packages/migrations/authentication-service/database.json create mode 100644 sandbox/app-saas/packages/migrations/authentication-service/migrations/20210318100600-init.js create mode 100644 sandbox/app-saas/packages/migrations/authentication-service/migrations/20220607063927-secret-key-column.js create mode 100644 sandbox/app-saas/packages/migrations/authentication-service/migrations/20221110095658-updated-init.js create mode 100644 sandbox/app-saas/packages/migrations/authentication-service/migrations/20230323132703-client-type-column.js create mode 100644 sandbox/app-saas/packages/migrations/authentication-service/migrations/20230524115047-login-activity.js create mode 100644 sandbox/app-saas/packages/migrations/authentication-service/migrations/20240209143809-seed-user.js create mode 100644 sandbox/app-saas/packages/migrations/authentication-service/migrations/sqls/20210318100600-init-down.sql create mode 100644 sandbox/app-saas/packages/migrations/authentication-service/migrations/sqls/20210318100600-init-up.sql create mode 100644 sandbox/app-saas/packages/migrations/authentication-service/migrations/sqls/20220607063927-secret-key-column-down.sql create mode 100644 sandbox/app-saas/packages/migrations/authentication-service/migrations/sqls/20220607063927-secret-key-column-up.sql create mode 100644 sandbox/app-saas/packages/migrations/authentication-service/migrations/sqls/20221110095658-updated-init-down.sql create mode 100644 sandbox/app-saas/packages/migrations/authentication-service/migrations/sqls/20221110095658-updated-init-up.sql create mode 100644 sandbox/app-saas/packages/migrations/authentication-service/migrations/sqls/20230323132703-client-type-column-down.sql create mode 100644 sandbox/app-saas/packages/migrations/authentication-service/migrations/sqls/20230323132703-client-type-column-up.sql create mode 100644 sandbox/app-saas/packages/migrations/authentication-service/migrations/sqls/20230524115047-login-activity-down.sql create mode 100644 sandbox/app-saas/packages/migrations/authentication-service/migrations/sqls/20230524115047-login-activity-up.sql create mode 100644 sandbox/app-saas/packages/migrations/authentication-service/migrations/sqls/20240209143809-seed-user-down.sql create mode 100644 sandbox/app-saas/packages/migrations/authentication-service/migrations/sqls/20240209143809-seed-user-up.sql create mode 100644 sandbox/app-saas/packages/migrations/notification-service/database.json create mode 100644 sandbox/app-saas/packages/migrations/notification-service/migrations/20210501132806-init.js create mode 100644 sandbox/app-saas/packages/migrations/notification-service/migrations/20231128083406-alter-db-to-support-multiple-notification-as-one-notification.js create mode 100644 sandbox/app-saas/packages/migrations/notification-service/migrations/20231214080856-alter-notification-user-table-to-support-sleep-time.js create mode 100644 sandbox/app-saas/packages/migrations/notification-service/migrations/20240212084826-add-subscription-email-templates.js create mode 100644 sandbox/app-saas/packages/migrations/notification-service/migrations/sqls/20210501132806-init-down.sql create mode 100644 sandbox/app-saas/packages/migrations/notification-service/migrations/sqls/20210501132806-init-up.sql create mode 100644 sandbox/app-saas/packages/migrations/notification-service/migrations/sqls/20231128083406-alter-db-to-support-multiple-notification-as-one-notification-down.sql create mode 100644 sandbox/app-saas/packages/migrations/notification-service/migrations/sqls/20231128083406-alter-db-to-support-multiple-notification-as-one-notification-up.sql create mode 100644 sandbox/app-saas/packages/migrations/notification-service/migrations/sqls/20231214080856-alter-notification-user-table-to-support-sleep-time-down.sql create mode 100644 sandbox/app-saas/packages/migrations/notification-service/migrations/sqls/20231214080856-alter-notification-user-table-to-support-sleep-time-up.sql create mode 100644 sandbox/app-saas/packages/migrations/notification-service/migrations/sqls/20240212084826-add-subscription-email-templates-down.sql create mode 100644 sandbox/app-saas/packages/migrations/notification-service/migrations/sqls/20240212084826-add-subscription-email-templates-up.sql create mode 100644 sandbox/app-saas/packages/migrations/package.json create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/database.json create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/migrations/20240205055601-init.js create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/migrations/20240206102246-add-table-currencies.js create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/migrations/20240206102257-add-table-billing-cycles.js create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/migrations/20240207060847-seed-currencies-and-billing-cycles.js create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/migrations/20240208082503-add-constraints.js create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/migrations/20240208115049-add-tier-column-to-plans.js create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/migrations/20240209122448-seed-data.js create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/migrations/package.json create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/migrations/sqls/20240205055601-init-down.sql create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/migrations/sqls/20240205055601-init-up.sql create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/migrations/sqls/20240206102246-add-table-currencies-down.sql create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/migrations/sqls/20240206102246-add-table-currencies-up.sql create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/migrations/sqls/20240206102257-add-table-billing-cycles-down.sql create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/migrations/sqls/20240206102257-add-table-billing-cycles-up.sql create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/migrations/sqls/20240207060847-seed-currencies-and-billing-cycles-down.sql create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/migrations/sqls/20240207060847-seed-currencies-and-billing-cycles-up.sql create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/migrations/sqls/20240208082503-add-constraints-down.sql create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/migrations/sqls/20240208082503-add-constraints-up.sql create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/migrations/sqls/20240208115049-add-tier-column-to-plans-down.sql create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/migrations/sqls/20240208115049-add-tier-column-to-plans-up.sql create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/migrations/sqls/20240209122448-seed-data-down.sql create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/migrations/sqls/20240209122448-seed-data-up.sql create mode 100644 sandbox/app-saas/packages/migrations/subscription-service/migrations/sqls/package.json create mode 100644 sandbox/app-saas/packages/migrations/tenant-mgmt-service/database.json create mode 100644 sandbox/app-saas/packages/migrations/tenant-mgmt-service/migrations/20240125154021-init.js create mode 100644 sandbox/app-saas/packages/migrations/tenant-mgmt-service/migrations/sqls/20240125154021-init-down.sql create mode 100644 sandbox/app-saas/packages/migrations/tenant-mgmt-service/migrations/sqls/20240125154021-init-up.sql create mode 100644 sandbox/app-saas/packages/migrations/tenant-mgmt-service/migrations/sqls/package.json create mode 100644 sandbox/app-saas/services/audit-service/.dockerignore create mode 100644 sandbox/app-saas/services/audit-service/.env.defaults create mode 100644 sandbox/app-saas/services/audit-service/.env.example create mode 100644 sandbox/app-saas/services/audit-service/.eslintignore create mode 100644 sandbox/app-saas/services/audit-service/.eslintrc.js create mode 100644 sandbox/app-saas/services/audit-service/.gitignore create mode 100644 sandbox/app-saas/services/audit-service/.mocharc.json create mode 100644 sandbox/app-saas/services/audit-service/.nycrc create mode 100644 sandbox/app-saas/services/audit-service/.prettierignore create mode 100644 sandbox/app-saas/services/audit-service/.prettierrc create mode 100644 sandbox/app-saas/services/audit-service/.vscode/launch.json create mode 100644 sandbox/app-saas/services/audit-service/.vscode/settings.json create mode 100644 sandbox/app-saas/services/audit-service/.vscode/tasks.json create mode 100644 sandbox/app-saas/services/audit-service/.yo-rc.json create mode 100644 sandbox/app-saas/services/audit-service/DEVELOPING.md create mode 100644 sandbox/app-saas/services/audit-service/Dockerfile create mode 100644 sandbox/app-saas/services/audit-service/README.md create mode 100644 sandbox/app-saas/services/audit-service/package.json create mode 100644 sandbox/app-saas/services/audit-service/public/index.html create mode 100644 sandbox/app-saas/services/audit-service/src/__tests__/README.md create mode 100644 sandbox/app-saas/services/audit-service/src/__tests__/acceptance/home-page.acceptance.ts create mode 100644 sandbox/app-saas/services/audit-service/src/__tests__/acceptance/ping.controller.acceptance.ts create mode 100644 sandbox/app-saas/services/audit-service/src/__tests__/acceptance/test-helper.ts create mode 100644 sandbox/app-saas/services/audit-service/src/application.ts create mode 100644 sandbox/app-saas/services/audit-service/src/controllers/README.md create mode 100644 sandbox/app-saas/services/audit-service/src/controllers/home-page.controller.ts create mode 100644 sandbox/app-saas/services/audit-service/src/controllers/index.ts create mode 100644 sandbox/app-saas/services/audit-service/src/controllers/ping.controller.ts create mode 100644 sandbox/app-saas/services/audit-service/src/datasources/README.md create mode 100644 sandbox/app-saas/services/audit-service/src/datasources/db.datasource.ts create mode 100644 sandbox/app-saas/services/audit-service/src/datasources/index.ts create mode 100644 sandbox/app-saas/services/audit-service/src/index.ts create mode 100644 sandbox/app-saas/services/audit-service/src/models/README.md create mode 100644 sandbox/app-saas/services/audit-service/src/openapi-spec.ts create mode 100644 sandbox/app-saas/services/audit-service/src/openapi.json create mode 100644 sandbox/app-saas/services/audit-service/src/opentelemetry-registry.ts create mode 100644 sandbox/app-saas/services/audit-service/tsconfig.json create mode 100644 sandbox/app-saas/services/authentication-service/.dockerignore create mode 100644 sandbox/app-saas/services/authentication-service/.env.defaults create mode 100644 sandbox/app-saas/services/authentication-service/.env.example create mode 100644 sandbox/app-saas/services/authentication-service/.eslintignore create mode 100644 sandbox/app-saas/services/authentication-service/.eslintrc.js create mode 100644 sandbox/app-saas/services/authentication-service/.gitignore create mode 100644 sandbox/app-saas/services/authentication-service/.mocharc.json create mode 100644 sandbox/app-saas/services/authentication-service/.nycrc create mode 100644 sandbox/app-saas/services/authentication-service/.prettierignore create mode 100644 sandbox/app-saas/services/authentication-service/.prettierrc create mode 100644 sandbox/app-saas/services/authentication-service/.vscode/launch.json create mode 100644 sandbox/app-saas/services/authentication-service/.vscode/settings.json create mode 100644 sandbox/app-saas/services/authentication-service/.vscode/tasks.json create mode 100644 sandbox/app-saas/services/authentication-service/.yo-rc.json create mode 100644 sandbox/app-saas/services/authentication-service/DEVELOPING.md create mode 100644 sandbox/app-saas/services/authentication-service/Dockerfile create mode 100644 sandbox/app-saas/services/authentication-service/README.md create mode 100644 sandbox/app-saas/services/authentication-service/package.json create mode 100644 sandbox/app-saas/services/authentication-service/public/index.html create mode 100644 sandbox/app-saas/services/authentication-service/src/__tests__/README.md create mode 100644 sandbox/app-saas/services/authentication-service/src/__tests__/acceptance/home-page.acceptance.ts create mode 100644 sandbox/app-saas/services/authentication-service/src/__tests__/acceptance/ping.controller.acceptance.ts create mode 100644 sandbox/app-saas/services/authentication-service/src/__tests__/acceptance/test-helper.ts create mode 100644 sandbox/app-saas/services/authentication-service/src/application.ts create mode 100644 sandbox/app-saas/services/authentication-service/src/controllers/README.md create mode 100644 sandbox/app-saas/services/authentication-service/src/controllers/home-page.controller.ts create mode 100644 sandbox/app-saas/services/authentication-service/src/controllers/index.ts create mode 100644 sandbox/app-saas/services/authentication-service/src/controllers/ping.controller.ts create mode 100644 sandbox/app-saas/services/authentication-service/src/datasources/README.md create mode 100644 sandbox/app-saas/services/authentication-service/src/datasources/db.datasource.ts create mode 100644 sandbox/app-saas/services/authentication-service/src/datasources/index.ts create mode 100644 sandbox/app-saas/services/authentication-service/src/datasources/redis.datasource.ts create mode 100644 sandbox/app-saas/services/authentication-service/src/index.ts create mode 100644 sandbox/app-saas/services/authentication-service/src/models/README.md create mode 100644 sandbox/app-saas/services/authentication-service/src/openapi-spec.ts create mode 100644 sandbox/app-saas/services/authentication-service/src/openapi.json create mode 100644 sandbox/app-saas/services/authentication-service/src/opentelemetry-registry.ts create mode 100644 sandbox/app-saas/services/authentication-service/src/providers/cognito-auth-verify.provider.ts create mode 100644 sandbox/app-saas/services/authentication-service/src/providers/index.ts create mode 100644 sandbox/app-saas/services/authentication-service/tsconfig.json create mode 100644 sandbox/app-saas/services/notification-service/.dockerignore create mode 100644 sandbox/app-saas/services/notification-service/.env.defaults create mode 100644 sandbox/app-saas/services/notification-service/.env.example create mode 100644 sandbox/app-saas/services/notification-service/.eslintignore create mode 100644 sandbox/app-saas/services/notification-service/.eslintrc.js create mode 100644 sandbox/app-saas/services/notification-service/.gitignore create mode 100644 sandbox/app-saas/services/notification-service/.mocharc.json create mode 100644 sandbox/app-saas/services/notification-service/.nycrc create mode 100644 sandbox/app-saas/services/notification-service/.prettierignore create mode 100644 sandbox/app-saas/services/notification-service/.prettierrc create mode 100644 sandbox/app-saas/services/notification-service/.vscode/launch.json create mode 100644 sandbox/app-saas/services/notification-service/.vscode/settings.json create mode 100644 sandbox/app-saas/services/notification-service/.vscode/tasks.json create mode 100644 sandbox/app-saas/services/notification-service/.yo-rc.json create mode 100644 sandbox/app-saas/services/notification-service/DEVELOPING.md create mode 100644 sandbox/app-saas/services/notification-service/Dockerfile create mode 100644 sandbox/app-saas/services/notification-service/README.md create mode 100644 sandbox/app-saas/services/notification-service/package.json create mode 100644 sandbox/app-saas/services/notification-service/public/index.html create mode 100644 sandbox/app-saas/services/notification-service/src/__tests__/README.md create mode 100644 sandbox/app-saas/services/notification-service/src/__tests__/acceptance/home-page.acceptance.ts create mode 100644 sandbox/app-saas/services/notification-service/src/__tests__/acceptance/ping.controller.acceptance.ts create mode 100644 sandbox/app-saas/services/notification-service/src/__tests__/acceptance/test-helper.ts create mode 100644 sandbox/app-saas/services/notification-service/src/application.ts create mode 100644 sandbox/app-saas/services/notification-service/src/controllers/README.md create mode 100644 sandbox/app-saas/services/notification-service/src/controllers/home-page.controller.ts create mode 100644 sandbox/app-saas/services/notification-service/src/controllers/index.ts create mode 100644 sandbox/app-saas/services/notification-service/src/controllers/notification-template.controller.ts create mode 100644 sandbox/app-saas/services/notification-service/src/controllers/ping.controller.ts create mode 100644 sandbox/app-saas/services/notification-service/src/datasources/README.md create mode 100644 sandbox/app-saas/services/notification-service/src/datasources/db.datasource.ts create mode 100644 sandbox/app-saas/services/notification-service/src/datasources/index.ts create mode 100644 sandbox/app-saas/services/notification-service/src/index.ts create mode 100644 sandbox/app-saas/services/notification-service/src/models/README.md create mode 100644 sandbox/app-saas/services/notification-service/src/models/index.ts create mode 100644 sandbox/app-saas/services/notification-service/src/models/notification-templates.model.ts create mode 100644 sandbox/app-saas/services/notification-service/src/openapi-spec.ts create mode 100644 sandbox/app-saas/services/notification-service/src/openapi.json create mode 100644 sandbox/app-saas/services/notification-service/src/opentelemetry-registry.ts create mode 100644 sandbox/app-saas/services/notification-service/src/permissions.ts create mode 100644 sandbox/app-saas/services/notification-service/src/repositories/index.ts create mode 100644 sandbox/app-saas/services/notification-service/src/repositories/notification-templates.repository.ts create mode 100644 sandbox/app-saas/services/notification-service/tsconfig.json create mode 100644 sandbox/app-saas/services/subscription-service/.dockerignore create mode 100644 sandbox/app-saas/services/subscription-service/.env.defaults create mode 100644 sandbox/app-saas/services/subscription-service/.env.example create mode 100644 sandbox/app-saas/services/subscription-service/.eslintignore create mode 100644 sandbox/app-saas/services/subscription-service/.eslintrc.js create mode 100644 sandbox/app-saas/services/subscription-service/.gitignore create mode 100644 sandbox/app-saas/services/subscription-service/.mocharc.json create mode 100644 sandbox/app-saas/services/subscription-service/.nycrc create mode 100644 sandbox/app-saas/services/subscription-service/.prettierignore create mode 100644 sandbox/app-saas/services/subscription-service/.prettierrc create mode 100644 sandbox/app-saas/services/subscription-service/.vscode/launch.json create mode 100644 sandbox/app-saas/services/subscription-service/.vscode/settings.json create mode 100644 sandbox/app-saas/services/subscription-service/.vscode/tasks.json create mode 100644 sandbox/app-saas/services/subscription-service/.yo-rc.json create mode 100644 sandbox/app-saas/services/subscription-service/DEVELOPING.md create mode 100644 sandbox/app-saas/services/subscription-service/Dockerfile create mode 100644 sandbox/app-saas/services/subscription-service/README.md create mode 100644 sandbox/app-saas/services/subscription-service/package.json create mode 100644 sandbox/app-saas/services/subscription-service/public/index.html create mode 100644 sandbox/app-saas/services/subscription-service/src/__tests__/README.md create mode 100644 sandbox/app-saas/services/subscription-service/src/__tests__/acceptance/home-page.acceptance.ts create mode 100644 sandbox/app-saas/services/subscription-service/src/__tests__/acceptance/ping.controller.acceptance.ts create mode 100644 sandbox/app-saas/services/subscription-service/src/__tests__/acceptance/test-helper.ts create mode 100644 sandbox/app-saas/services/subscription-service/src/application.ts create mode 100644 sandbox/app-saas/services/subscription-service/src/controllers/README.md create mode 100644 sandbox/app-saas/services/subscription-service/src/controllers/home-page.controller.ts create mode 100644 sandbox/app-saas/services/subscription-service/src/controllers/index.ts create mode 100644 sandbox/app-saas/services/subscription-service/src/controllers/ping.controller.ts create mode 100644 sandbox/app-saas/services/subscription-service/src/datasources/README.md create mode 100644 sandbox/app-saas/services/subscription-service/src/datasources/audit.datasource.ts create mode 100644 sandbox/app-saas/services/subscription-service/src/datasources/index.ts create mode 100644 sandbox/app-saas/services/subscription-service/src/index.ts create mode 100644 sandbox/app-saas/services/subscription-service/src/models/README.md create mode 100644 sandbox/app-saas/services/subscription-service/src/openapi-spec.ts create mode 100644 sandbox/app-saas/services/subscription-service/src/openapi.json create mode 100644 sandbox/app-saas/services/subscription-service/src/opentelemetry-registry.ts create mode 100644 sandbox/app-saas/services/subscription-service/subscription-service-0.0.1.tgz create mode 100644 sandbox/app-saas/services/subscription-service/tsconfig.json create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/.dockerignore create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/.env.defaults create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/.env.example create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/.eslintignore create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/.eslintrc.js create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/.gitignore create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/.mocharc.json create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/.nycrc create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/.prettierignore create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/.prettierrc create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/.vscode/launch.json create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/.vscode/settings.json create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/.vscode/tasks.json create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/.yo-rc.json create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/DEVELOPING.md create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/Dockerfile create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/README.md create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/package.json create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/public/index.html create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/src/__tests__/README.md create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/src/__tests__/acceptance/home-page.acceptance.ts create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/src/__tests__/acceptance/ping.controller.acceptance.ts create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/src/__tests__/acceptance/test-helper.ts create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/src/application.ts create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/src/controllers/README.md create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/src/controllers/home-page.controller.ts create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/src/controllers/index.ts create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/src/controllers/ping.controller.ts create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/src/datasources/README.md create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/src/datasources/db.datasource.ts create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/src/datasources/index.ts create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/src/datasources/redis.datasource.ts create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/src/index.ts create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/src/models/README.md create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/src/openapi-spec.ts create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/src/openapi.json create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/src/opentelemetry-registry.ts create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/src/services/notification.service.ts create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/tenant-management-service-0.0.1.tgz create mode 100644 sandbox/app-saas/services/tenant-mgmt-service/tsconfig.json create mode 100644 sandbox/app-saas/services/user-tenant-service/.dockerignore create mode 100644 sandbox/app-saas/services/user-tenant-service/.env.defaults create mode 100644 sandbox/app-saas/services/user-tenant-service/.env.example create mode 100644 sandbox/app-saas/services/user-tenant-service/.eslintignore create mode 100644 sandbox/app-saas/services/user-tenant-service/.eslintrc.js create mode 100644 sandbox/app-saas/services/user-tenant-service/.gitignore create mode 100644 sandbox/app-saas/services/user-tenant-service/.mocharc.json create mode 100644 sandbox/app-saas/services/user-tenant-service/.nycrc create mode 100644 sandbox/app-saas/services/user-tenant-service/.prettierignore create mode 100644 sandbox/app-saas/services/user-tenant-service/.prettierrc create mode 100644 sandbox/app-saas/services/user-tenant-service/.vscode/launch.json create mode 100644 sandbox/app-saas/services/user-tenant-service/.vscode/settings.json create mode 100644 sandbox/app-saas/services/user-tenant-service/.vscode/tasks.json create mode 100644 sandbox/app-saas/services/user-tenant-service/.yo-rc.json create mode 100644 sandbox/app-saas/services/user-tenant-service/DEVELOPING.md create mode 100644 sandbox/app-saas/services/user-tenant-service/Dockerfile create mode 100644 sandbox/app-saas/services/user-tenant-service/README.md create mode 100644 sandbox/app-saas/services/user-tenant-service/package.json create mode 100644 sandbox/app-saas/services/user-tenant-service/public/index.html create mode 100644 sandbox/app-saas/services/user-tenant-service/src/__tests__/README.md create mode 100644 sandbox/app-saas/services/user-tenant-service/src/__tests__/acceptance/home-page.acceptance.ts create mode 100644 sandbox/app-saas/services/user-tenant-service/src/__tests__/acceptance/ping.controller.acceptance.ts create mode 100644 sandbox/app-saas/services/user-tenant-service/src/__tests__/acceptance/test-helper.ts create mode 100644 sandbox/app-saas/services/user-tenant-service/src/application.ts create mode 100644 sandbox/app-saas/services/user-tenant-service/src/controllers/README.md create mode 100644 sandbox/app-saas/services/user-tenant-service/src/controllers/home-page.controller.ts create mode 100644 sandbox/app-saas/services/user-tenant-service/src/controllers/index.ts create mode 100644 sandbox/app-saas/services/user-tenant-service/src/controllers/ping.controller.ts create mode 100644 sandbox/app-saas/services/user-tenant-service/src/datasources/README.md create mode 100644 sandbox/app-saas/services/user-tenant-service/src/datasources/db.datasource.ts create mode 100644 sandbox/app-saas/services/user-tenant-service/src/datasources/index.ts create mode 100644 sandbox/app-saas/services/user-tenant-service/src/index.ts create mode 100644 sandbox/app-saas/services/user-tenant-service/src/models/README.md create mode 100644 sandbox/app-saas/services/user-tenant-service/src/openapi-spec.ts create mode 100644 sandbox/app-saas/services/user-tenant-service/src/openapi.json create mode 100644 sandbox/app-saas/services/user-tenant-service/src/opentelemetry-registry.ts create mode 100644 sandbox/app-saas/services/user-tenant-service/tsconfig.json create mode 100644 sandbox/app-saas/tsconfig.json diff --git a/sandbox/app-saas/.cz-config.js b/sandbox/app-saas/.cz-config.js new file mode 100644 index 0000000..8fb3759 --- /dev/null +++ b/sandbox/app-saas/.cz-config.js @@ -0,0 +1,67 @@ +module.exports = { + types: [ + { value: "feat", name: "feat: A new feature" }, + { value: "fix", name: "fix: A bug fix" }, + { value: "docs", name: "docs: Documentation only changes" }, + { + value: "style", + name: "style: Changes that do not affect the meaning of the code\n (white-space, formatting, missing semi-colons, etc)", + }, + { + value: "refactor", + name: "refactor: A code change that neither fixes a bug nor adds a feature", + }, + { + value: "perf", + name: "perf: A code change that improves performance", + }, + { value: "test", name: "test: Adding missing tests" }, + { + value: "chore", + name: "chore: Changes to the build process or auxiliary tools\n and libraries such as documentation generation", + }, + { value: "revert", name: "revert: Revert to a commit" }, + { value: "WIP", name: "WIP: Work in progress" }, + ], + + scopes: [ + { name: "user-tenant-service-service" }, + { name: "audit-service-service" }, + { name: "authentication-service-service" }, + { name: "notification-service-service" }, + { name: "my-facade-facade" }, + { name: "subscription-service-service" }, + { name: "tnt-mngmt-service" }, + { name: "ci-cd" }, + { name: "deps" }, + { name: "migrations" }, + ], + + appendBranchNameToCommitMessage: false, + allowTicketNumber: false, + isTicketNumberRequired: false, + ticketNumberPrefix: "Fixes - ", + + // override the messages, defaults are as follows + messages: { + type: "Select the type of change that you're committing:", + scope: "Denote the SCOPE of this change:", + // used if allowCustomScopes is true + customScope: "Denote the SCOPE of this change:", + subject: "Write a SHORT, IMPERATIVE tense description of the change:\n", + body: 'Provide a LONGER description of the change (optional). Use "|" to break new line:\n', + breaking: "List any BREAKING CHANGES (optional):\n", + footer: + "List any ISSUES CLOSED by this change (optional). E.g.: GH-31, GH-34:\n", + confirmCommit: "Are you sure you want to proceed with the commit above?", + }, + + allowCustomScopes: false, + allowBreakingChanges: ["feat", "fix"], + + // limit subject length + subjectLimit: 100, + breaklineChar: "|", // It is supported for fields body and footer. + footerPrefix: "", + askForBreakingChangeFirst: true, // default is false +}; diff --git a/sandbox/app-saas/.gitignore b/sandbox/app-saas/.gitignore new file mode 100644 index 0000000..5b2ab7f --- /dev/null +++ b/sandbox/app-saas/.gitignore @@ -0,0 +1,3 @@ +node_modules +lerna-debug.log +.env \ No newline at end of file diff --git a/sandbox/app-saas/.husky/commit-msg b/sandbox/app-saas/.husky/commit-msg new file mode 100755 index 0000000..c2be4f9 --- /dev/null +++ b/sandbox/app-saas/.husky/commit-msg @@ -0,0 +1,18 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx --no-install commitlint --edit $1 + +# Section for git-secrets +# if ! command -v git-secrets &> /dev/null 2>&1 +# then +# echo "git-secrets is not installed. Please run 'brew install git-secrets' or visit https://github.com/awslabs/git-secrets#installing-git-secrets" +# exit 1 +# fi + +# # Initialise git-secrets configuration +# git-secrets --register-aws > /dev/null + +# echo "Running git-secrets..." +# # Scans the commit message. +# git-secrets --commit_msg_hook -- "$@" \ No newline at end of file diff --git a/sandbox/app-saas/.husky/pre-commit b/sandbox/app-saas/.husky/pre-commit new file mode 100755 index 0000000..c4e3bd4 --- /dev/null +++ b/sandbox/app-saas/.husky/pre-commit @@ -0,0 +1,18 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +# Section for git-secrets +# if ! command -v git-secrets &> /dev/null 2>&1 +# then +# echo "git-secrets is not installed. Please run 'brew install git-secrets' or visit https://github.com/awslabs/git-secrets#installing-git-secrets" +# exit 1 +# fi + +# # Initialise git-secrets configuration +# git-secrets --register-aws > /dev/null + +# echo "Running git-secrets..." +# # Scans all files that are about to be committed. +# git-secrets --pre_commit_hook -- "$@" + +npm test \ No newline at end of file diff --git a/sandbox/app-saas/.husky/prepare-commit-msg b/sandbox/app-saas/.husky/prepare-commit-msg new file mode 100755 index 0000000..639bcb5 --- /dev/null +++ b/sandbox/app-saas/.husky/prepare-commit-msg @@ -0,0 +1,18 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +exec < /dev/tty && npx cz --hook || true + +# Section for git-secrets +# if ! command -v git-secrets &> /dev/null 2>&1 +# then +# echo "git-secrets is not installed. Please run 'brew install git-secrets' or visit https://github.com/awslabs/git-secrets#installing-git-secrets" +# exit 1 +# fi + +# # Initialise git-secrets configuration +# git-secrets --register-aws > /dev/null + +# echo "Running git-secrets..." +# # Determines if merging in a commit will introduce tainted history. +# git-secrets --prepare_commit_msg_hook -- "$@" \ No newline at end of file diff --git a/sandbox/app-saas/DEVELOPING.md b/sandbox/app-saas/DEVELOPING.md new file mode 100644 index 0000000..a2913af --- /dev/null +++ b/sandbox/app-saas/DEVELOPING.md @@ -0,0 +1,492 @@ +# Developing Microservices + +This document describes how to develop microservices living in loopback4-microservice-catalog monorepo. + +- [Setting up development environment](#setting-up-development-environment) +- [Setup Codebase](#setup-codebase) +- [Building the project](#building-the-project) +- [File naming convention](#file-naming-convention) +- [Develop a new microservice](#develop-a-new-microservice) +- [How to upgrade to new LB4 dependencies](#how-to-upgrade-to-new-lb4-dependencies) +- [Sonar Setup in VS Code](#sonar-setup-in-vs-code) +- [Commit message guidelines](#commit-message-guidelines) +- [Husky setup for commit hooks](#husky-setup-for-commit-hooks) + +## Setting up development environment + +We recommend our contributors to use +[VisualStudio Code](https://code.visualstudio.com/) with the following +extensions installed: + +- [Prettier - Code Formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) + for automatic formatting of source files on save. +- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) + to highlight and auto-fix linting problems directly in the editor. +- [SonarLint for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarlint-vscode) +- [TypeScript Hero](https://marketplace.visualstudio.com/items?itemName=rbbit.typescript-hero) + +Our monorepo comes with few preconfigured +[VSCode Tasks](https://code.visualstudio.com/docs/editor/tasks): + +- The build task is configured to run the TypeScript compiler +- The test task is configured to run `npm test` (which runs the build before + running any tests). + +## Setup Codebase + +1. Open root folder of this repo in VS Code. +2. Install lerna globally `npm i -g lerna` +3. Run `lerna bootstrap` +4. Run `npm i` +5. Create .env files for all the micro service packages. +6. Run DB migrations using `lerna run db:migrate`. +7. Build all microservices in one go - `lerna run build`. +8. Run `lerna run start` to start all the micro services in one go. + +## Building the project + +Whenever you pull updates from GitHub or switch between feature branches, make +sure to updated installed dependencies in all monorepo packages. The following +command will install npm dependencies for all packages and create symbolic links +for intra-dependencies: + +```sh +lerna bootstrap +``` + +As part of `lerna bootstrap`, TypeScript project references are automatically +updated for each package with in the monorepo. + +The next step is to compile all packages from TypeScript to JavaScript: + +```sh +lerna run build +``` + +To force a clean build: + +```sh +lerna clean && lerna run build +``` + +Please note that `npm run clean` removes `dist`, `*.tsbuildinfo`, and other +generated files from each package to clean the state for builds. + +To build an individual package: + +```sh +cd // For example, cd `packages/core`. +npm run build +``` + + + +### Linting and formatting + +We use two tools to keep our codebase healthy: + +- [ESLint](https://typescript-eslint.io/) to statically analyse our source code + and detect common problems. +- [Prettier](https://prettier.io/) to keep our code always formatted the same + way, avoid style discussions in code reviews, and save everybody's time an + energy. + +You can run both linters via the following npm script, just keep in mind that +`lerna run test` is already running them for you. + +```sh +lerna run lint +``` + +Many problems (especially formatting) can be automatically fixed by running the +npm script `lint:fix`. + +```sh +lerna run lint:fix +``` + +### Adding dependencies + +Use the following command to add or update dependency `dep` in a package `name`: + +```sh +$ npx lerna add --scope ${name} ${dep} +``` + +For example: + +```sh +$ npx lerna add --scope @loopback/rest debug +``` + +See [lerna add](https://github.com/lerna/lerna/blob/master/commands/add#readme) +for more details. + +## File naming convention + +For consistency, we follow +[Angular's file naming convention](https://angular.io/guide/styleguide#separate-file-names-with-dots-and-dashes). +It helps to derive the usage of files by inspecting the names. Besides the +LoopBack 4 codebase, we also follow this naming convention in our generated +artifacts from the CLI tooling: `{name}`.`{artifact-type}`.ts + +Examples are: + +``` +src/decorators/authenticate.decorator.ts +src/boot.component.ts +``` + +In addition, files under `test` folder are categorized according to the type of +tests (unit, acceptance and integration), with the convention +`{name}.{test-type}.ts`. + +Examples are: + +``` +src/__tests__/acceptance/application.acceptance.ts +src/__tests__/integration/user.controller.integration.ts +src/__tests__/unit/application.unit.ts +``` + +## Develop a new microservice + +1. **lb4 ** - Generate a new loopback-next application under the required folder, either facades or services. +2. **.dockerignore** - Replace node_modules with coverage +3. **.prettierignore** - Add coverage +4. **.eslintrc.js** - Just copy below as is + + ```json + module.exports = { + extends: '@loopback/eslint-config', + rules: { + 'no-extra-boolean-cast': 'off', + '@typescript-eslint/interface-name-prefix': 'off', + 'no-prototype-builtins': 'off', + }, + parserOptions: { + project: './tsconfig.json', + tsconfigRootDir: __dirname, + }, + }; + ``` + +5. **Necessary deps** - Add symlink-resolver package to devDependencies + + ```sh + lerna add -D symlink-resolver --scope={service name} + ``` + + then add these two in scripts of package.json + + ```json + "symlink-resolver": "symlink-resolver", + "resolve-links": "npm run symlink-resolver build ./node_modules", + ``` + +6. **Dotenv** - Add dotenv packages for environment keys handling. Run below + + ```sh + lerna add dotenv --scope={service name} + lerna add dotenv-extended --scope={service name} + lerna add -D @types/dotenv --scope={service name} + ``` + +7. **Env files** - Add .env.defaults and .env.example and specify required keys +8. **Load .env** - Add below code to the top of `application.ts` before super call. + + ```ts + const port = 3000; + dotenv.config(); + dotenvExt.load({ + schema: '.env.example', + errorOnMissing: true, + includeProcessEnv: true, + }); + options.rest = options.rest || {}; + options.rest.port = +(process.env.PORT || port); + options.rest.host = process.env.HOST; + ``` + + Import dotenv related packages + + ```ts + import * as dotenv from 'dotenv'; + import * as dotenvExt from 'dotenv-extended'; + ``` + +9. **Add Sourceloop core** - Add @sourceloop/core as dependency to the module + + ```sh + lerna add @sourceloop/core --scope={service name} + ``` + +In application.ts, + +```ts +import {CoreComponent, ServiceSequence} from '@sourceloop/core'; + +this.component(CoreComponent); + +// Set up the custom sequence +this.sequence(ServiceSequence); +``` + +10. **Bearer Verifier** - Add bearer verifier to your service + +```sh +lerna add loopback4-authentication --scope={service name} +lerna add loopback4-authorization --scope={service name} +``` + +Add below to application.ts + +```ts + ... + import {AuthenticationComponent} from 'loopback4-authentication'; + import { + AuthorizationBindings, + AuthorizationComponent, + } from 'loopback4-authorization'; + import { + BearerVerifierBindings, + BearerVerifierComponent, + BearerVerifierConfig, + BearerVerifierType, + } from '@sourceloop/core'; + ... + // Add authentication component + this.component(AuthenticationComponent); + + // Add bearer verifier component + this.bind(BearerVerifierBindings.Config).to({ + authServiceUrl: '', + type: BearerVerifierType.service, + } as BearerVerifierConfig); + this.component(BearerVerifierComponent); + + // Add authorization component + this.bind(AuthorizationBindings.CONFIG).to({ + allowAlwaysPaths: ['/explorer'], + }); + this.component(AuthorizationComponent); +``` + +Use BearerVerifierType.facade for facades. + +11. **Setup project for test coverage** - + + Create a file named .nycrc and copy this data in it + + ```json + { + "extends": "@istanbuljs/nyc-config-typescript", + "all": true, + "reporter": ["html", "text-summary"] + } + ``` + + Install nyc for coverage reporting + + ```sh + lerna add -D @istanbuljs/nyc-config-typescript --scope={service name} + lerna add -D nyc --scope={service name} + ``` + + then add these in scripts of package.json + + ```json + "coverage": "nyc npm run test", + ``` + +12. **Setup sequence** - Remove auto-generated sequence.ts and change to ServiceSequence in application.ts. +13. **Fix api explorer** - Update base path in index.html for facades. + +```html + +
+

auth-facade

+

Version 1.0.0

+ +

OpenAPI spec: /openapi.json

+

API Explorer: /explorer

+
+ + + +``` + +14. **Update home-page.controller.ts** - Update the home-page.controller.ts with base path related changes, only in facades. + +```ts +this.html = fs.readFileSync( + path.join(__dirname, '../../public/index.html'), + 'utf-8', +); +// Replace base path placeholder from env +this.html = this.html.replace(/\$\{basePath\}/g, process.env.BASE_PATH ?? ''); +``` + +Create home-page.controller.ts if not already there. + +## How to upgrade to new LB4 dependencies + +1. Upgrade LB4 CLI version first. Use `npm i -g @loopback/cli@latest`. +2. Run `npm i` at project root. This step is mandatory if node.js or npm version support is also needed to upgrade. +3. Upgrade any deps, if needed, at project root. Verify it in the package.json at root. If not needed, skip this step. +4. Navigate to core package. `cd packages/core`. +5. Run `lb4 update`. It will prompt you to confirm the deps upgrade. Verify it carefully and confirm. Let it overwrite package.json. +6. There may be some errors in previous step if there are any breaking changes coming in. If that's so, then, delete package-lock.json and run `npm i` again. +7. Upgrade any other package related, like, loopback4 extensions - loopback4-authentication, etc. In order to ensure upgrade works, all the extensions should support the upgraded LB4 version. For example, `npm i loopback4-authentication@latest loopback4-authorization@latest loopback4-soft-delete@latest tslib@latest loopback-connector-postgresql@latest`. +8. Run `npm audit fix`, if needed. +9. Run `npm run test` to validate upgrade. +10. Now, navigate to individual services. `cd ../../services/audit-service`. +11. Re-execute steps 5-8 again. +12. Before doing test, we need to update the `@sourceloop/core` with local symlinked package. Run `lerna bootstrap --force-local --scope=@sourceloop/audit-service`. +13. Now run `npm run test` to validate upgrade. +14. Repeat steps 10-13 for each service. + +After all the steps above done for all services and core package, all your deps are upgraded and tested. You can commit and push them to be released. Make sure to mention any breaking changes if any of the deps upgrade had breaking change. + +## Sonar Setup in VS Code + +1. Go to [Sonar Cloud](https://sonarcloud.io/) +2. Login with your SF Github ID +3. Go to `My Account` from top-right user profile menu. +4. Move to `Security` tab. +5. Add a recognizable token name and click on `Generate token` +6. Install Sonarlint extension in VS Code IDE +7. Open Settings in VS Code IDE +8. Search for `sonarlint` using search box at the top +9. Look for `Sonarlint › Connected Mode: Servers` +10. Click on `Edit in settings.json`. settings.json under system user directory will open. +11. Add the below configuration + +```json + "sonarlint.connectedMode.servers": [ + { + "serverId": "sf_sonar", // Connection identifier + "serverUrl": "https://sonarcloud.io/", // SonarQube/SonarCloud URL - https//sonarcloud.io for SonarCloud + "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "organizationKey": "sourcefuse-cloud" + } + ], +``` + +Replace value of token with your own user token generated in step 5 from sonar cloud. + +**Note** - Sonarlint requires latest java runtime. Please install if not done already. + +Close and reopen VS Code. + +## Commit message guidelines + +A good commit message should describe what changed and why. + +Our commit messages are formatted according to +[Conventional Commits](https://conventionalcommits.org/), we use +[commitlint](https://github.com/marionebl/commitlint) to verify and enforce this +convention. These rules lead to more readable messages that are easy to follow +when looking through the project history. But also, we use the git commit +messages to generate change logs when publishing new versions. + +### Commit Message Format + +Each commit message consists of a **header**, a **body** and a **footer**. The +header has a special format that includes a **type**, an optional **scope** and +a **subject**: + +```text +(): + + + +