typescript icon indicating copy to clipboard operation
typescript copied to clipboard

refactor: zitadel server

Open yordis opened this issue 1 year ago • 6 comments

Context

Primary

Refactor the @zitadel/server to remove singletons and extra indirection around initializing the clients. Depending on the users ' needs, application-level code decides whether to use single-client or multi-client code.

Under apps/login, I simplify the clients' usage. Since the functions are defined in the same file (or could be imported directly), the code does not need to be passed around; UNLESS multi-client is required.

Also, some abstractions add extra indirections around the SDK API with little value. Since the SDK API already has structured messages, I removed most of them, except the ones that shared some "Message Structure Logic."

Since there are collisions between protobuf services, we need to expose the client around the protobuf service, for example, SearchQuery from session and user; we can not hide the layout of the services!

Extras

  • Changed alias from #/ to @/, just for familiarity
  • Upgraded dependencies
  • Ran prettier

Definition of Ready

  • [ ] I am happy with the code
  • [ ] Short description of the feature/issue is added in the pr description
  • [ ] PR is linked to the corresponding user story
  • [ ] Acceptance criteria are met
  • [ ] All open todos and follow ups are defined in a new ticket and justified
  • [ ] Deviations from the acceptance criteria and design are agreed with the PO and documented.
  • [ ] Jest unit tests ensure that components produce expected outputs on different inputs.
  • [ ] Cypress integration tests ensure that login app pages work as expected. The ZITADEL API is mocked.
  • [ ] No debug or dead code
  • [ ] My code has no repetitions

yordis avatar Apr 07 '24 08:04 yordis

@yordis is attempting to deploy a commit to the zitadel Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Apr 07 '24 08:04 vercel[bot]

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

Name Status Preview Comments Updated (UTC)
typescript-login ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 23, 2024 8:31am

vercel[bot] avatar Apr 09 '24 14:04 vercel[bot]

Hey @yordis thx for this amazing PR. When compiling we have a couple of issues. when using 'node' as module resolution in the application, type declarations cannot be used as they are exported. Do you have a suggestion on how to fix this?

peintnermax avatar Apr 12 '24 08:04 peintnermax

@peintnermax sorry for the whole mess, I am trying to upgrade deps and get the entire setup to compile properly.

I got the basic refactoring to the server, but the DevOps and whatnot are giving me trouble, and I got too deep into upgrading things by now ... Hopefully it is worth it

yordis avatar Apr 13 '24 02:04 yordis

CJS ⚡️ Build success in 2201ms src/proto/server/zitadel/admin.ts(31032,62): error TS2345: Argument of type 'import("/Users/ubi/Developer/github.com/zitadel/typescript/packages/zitadel-server/src/proto/server/zitadel/org").Domain' is not assignable to parameter of type 'import("/Users/ubi/Developer/github.com/zitadel/typescript/packages/zitadel-server/src/proto/server/zitadel/instance").Domain'. Type 'Domain' is missing the following properties from type 'Domain': domain, primary, generated

@peintnermax is there anyway to ping to a tag version the buf generate repo? I am 5000% sure that @zitadel/server was building correctly, but now it is not, the error is coming from inside the proto which is even more concerning since it is part of the codegen

yordis avatar Apr 13 '24 02:04 yordis

@peintnermax sorry for the whole mess, I am trying to upgrade deps and get the entire setup to compile properly.

I got the basic refactoring to the server, but the DevOps and whatnot are giving me trouble, and I got too deep into upgrading things by now ... Hopefully it is worth it

Any help is greatly appreciated.. Thx for your effort 😎👍 We can generate the stubs by specifying the tag like this buf generate https://github.com/zitadel/zitadel.git#tag=v2.49.3

peintnermax avatar Apr 15 '24 11:04 peintnermax