Skip to content

Conversation

Paulijuz
Copy link
Member

@Paulijuz Paulijuz commented Sep 23, 2025

This PR simplifies the interface for service methods.

Before:

someService.client(prisma).execute({
  params: { ... },
  data: { ... },
  session: null,
}

After:

someService({
  params: { ... },
  data: { ... },
}

This PR also moves all the actions from their own folder src/actions to a dedicated actions.ts file per service in src/services.

Finally, this PR replaces namespaces with objects as that is what the docs officialy recommend. Excert:

It is also worth noting that, for Node.js applications, modules are the default and we recommended modules over namespaces in modern code.

Starting with ECMAScript 2015, modules are native part of the language, and should be supported by all compliant engine implementations. Thus, for new projects modules would be the recommended code organization mechanism.

There were som problems with self referential service before, but 90% of that has been fixed by removing an unecessary generic from the auhter.

⚠️ This PR is marked as draft until Johan has finished work on sub services. I'll integrate this branch with that before we can merge.

@Paulijuz Paulijuz mentioned this pull request Sep 23, 2025
@JohanHjelsethStorstad JohanHjelsethStorstad merged commit 05164b4 into main Oct 11, 2025
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants