Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: combine services enterprise #6307

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

FredrikOseberg
Copy link
Contributor

More detailed information can be found in the unleash-enterprise repository.

Copy link

vercel bot commented Feb 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 22, 2024 10:21am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Feb 22, 2024 10:21am

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Quality Gates: FAILED

  • Declining Code Health: 2 findings(s) 🚩
  • Improving Code Health: 0 findings(s) ✅
  • Affected Hotspots: 0 files(s) 🔥

Recommended Review Level: Detailed -- Inspect the code that degrades in code health.
View detailed results in CodeScene

🚩 Declining Code Health (highest to lowest):

Comment on lines +38 to +40
): Promise<{ app: Application; services: unknown; stores: unknown }> {
let combinedServices = services;
let combinedStores = stores;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Getting worse: Complex Method
getApp already has high cyclomatic complexity, and now it increases in Lines of Code from 158 to 163

Why does this problem occur?

This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring. Read more.

To ignore this warning click here.

Comment on lines +72 to +76
const {
app,
services: combinedServices,
stores: combinedStores,
} = await getApp(config, stores, services, unleashSession, db);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Getting worse: Complex Method
createApp already has high cyclomatic complexity, and now it increases in Lines of Code from 86 to 90

Why does this problem occur?

This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring. Read more.

To ignore this warning click here.

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Quality Gates: FAILED

  • Declining Code Health: 2 findings(s) 🚩
  • Improving Code Health: 0 findings(s) ✅
  • Affected Hotspots: 0 files(s) 🔥

Recommended Review Level: Detailed -- Inspect the code that degrades in code health.
View detailed results in CodeScene

🚩 Declining Code Health (highest to lowest):

Copy link
Contributor

@gastonfournier gastonfournier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes sense

@@ -35,7 +35,9 @@ export default async function getApp(
services: IUnleashServices,
unleashSession?: RequestHandler,
db?: Knex,
): Promise<Application> {
): Promise<{ app: Application; services: unknown; stores: unknown }> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have these as parametric types? Something like <EServices extends IUnleashServices, EStores extends IUnleashStores>

Suggested change
): Promise<{ app: Application; services: unknown; stores: unknown }> {
): Promise<{ app: Application; services: EServices; stores: EStores }> {

Comment on lines +184 to +188
const { services: enterpriseServices, stores: enterpriseStores } =
config.preRouterHook(app, config, services, stores, db);

combinedServices = enterpriseServices;
combinedStores = enterpriseStores;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to do this? I think the "beauty" of the getApp method is that it just return an app, and the preHook just modifies it

If we have to do that, I wouldn't call them enterpriseServices, I'd do something like:

const { services: extendedServices, stores: extendedStores } =
            config.preRouterHook(app, config, services, stores, db);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants