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

Raw prisma engine protocol query #281

Open
MulverineX opened this issue Oct 28, 2023 · 5 comments
Open

Raw prisma engine protocol query #281

MulverineX opened this issue Oct 28, 2023 · 5 comments
Labels

Comments

@MulverineX
Copy link
Contributor

MulverineX commented Oct 28, 2023

There should be a supported way to run queries directly to the prisma engine.

Once #328 is resolved I'm planning on using this library as a host for an internal prisma client in JavaScript, running in QuickJS via an upcoming library, mercury. Its a rather novel/obscure usecase, but I would appreciate not having to use internal methods of the library that may change.

@medz
Copy link
Owner

medz commented Oct 28, 2023

Yes, I'm working on a new engine, but the API is no longer consistent with the Prisma TS/JS client 👉 #277

The decision is a difficult one, as new client constructs are made in a way that is suitable for Dart or other languages that do not have Union types. Of course, it's not absolute, I have plans to support Union types in Dart (https://github.com/dart-lang/language/blob/main/working/union-types/nominative-union-types.md) Make it consistent with the Prisma TS/JS client API, which makes learning Prisma easier.

But progress is indeed a bit slow now. The new client API, although suitable for Dart, has completely deviated from Prisma AST and I need to do a lot of development work in the generator.

Additionally, I needed to write a new query engine for the Prisma engine so that it could be embedded in Flutter.

The old version only allowed the use of the Prisma binary engine in Dart Native.

I plan to allow Prisma to be used in any environment in the new version. My progress is about 30%. Please give me another month or so to implement it. I think I can initially launch Flutter Prisma and Dart native Prisma.

@medz medz added good first issue Good for newcomers type:engine labels Oct 28, 2023
@MulverineX
Copy link
Contributor Author

So is the plan not to bind the rust engine binary for all platforms?

@medz
Copy link
Owner

medz commented Oct 28, 2023

So is the plan not to bind the rust engine binary for all platforms?

Dart native compilation does not support including other binaries, the plan for this is this:

  • Dart Native: Download dynamic libraries on first run
  • Flutter: Use Flutter’s native plug-in as a dynamic library
  • Web: Built-in platform-independent Data Proxy engine

Except for the Web, you need to use Rust to rebuild the dynamic library version of the Prisma engine.

@medz
Copy link
Owner

medz commented Oct 28, 2023

There's another reason: I don't know how to start an HTTP service on the platform Flutter is running on by running a platform binary, which is how the Prisma binary engine works.

@MulverineX
Copy link
Contributor Author

MulverineX commented Oct 28, 2023

Ideally, direct queries to the engine would be made, rather than having to use the HTTP server

The way I'm going to make it work for my project is by using http overrides in Mercury, a local webserver would be an unnecessary overhead and security risk.

Eventually I will contribute to the JS Prisma client and add a custom request handler, so I don't need to use the HTTP override.

@MulverineX MulverineX mentioned this issue May 11, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants