GithubHelp home page GithubHelp logo

Comments (8)

zsnmwy avatar zsnmwy commented on August 21, 2024 2

@mbrimmer83

I change to use this repo - https://github.com/zsnmwy/prisma-data-proxy
I fork from https://github.com/OnurGvnc/prisma-data-proxy
And make it works with Prisma 4.x.x. Even the latest version - 4.16.2.
It works well now.

And I create a guide repo to tell you how to use it. Works with any serverless env.


But I did not test with Prisma 5.x.x, especially forjsonProtocol.
I will do some work and make it works with Prisma 4.x.x - 5.x.x.
Based on the official docs, the jsonProtocol improves huge query performance.

from prisma-data-proxy-alt.

zsnmwy avatar zsnmwy commented on August 21, 2024

The JSON-type field needs the string in response, not the Object.

from prisma-data-proxy-alt.

Eleven-am avatar Eleven-am commented on August 21, 2024

So that means we need to stringify the object once again

from prisma-data-proxy-alt.

zsnmwy avatar zsnmwy commented on August 21, 2024

I have some testing base on my fork repo.
I added some tests for the JSON field. They passed. And the object has been stringified to string.

https://github.com/zsnmwy/prisma-data-proxy-alt/blob/2b376ac03a94df6058152ed0844ab53579145eec/src/__tests__/query.test.ts#L312-L346

Like:

{
    "data": {
        "findManyProduct": [
            {
// It works
                "skus": "[{\"Url\":\"https://www.x.com.my/-i3677532048-s20852161423.html\",\"SkuId\":20852161423,\"price\":110,\"Images\":[\"https:x/p/de4e4473949b6e15d805096f2ffe22b5.jpg\"],\"Status\":\"active\",\"ShopSku\":\"3677532048_MY-20852161423\",\"quantity\":198,\"saleProp\":{\"color_family\":\"Black\"},\"SellerSku\":\"aw110-Black\",\"tax_class\":\"75586\",\"color_family\":\"Black\",\"package_width\":\"10.00\",\"special_price\":56.19,\"package_height\":\"10.00\",\"package_length\":\"10.00\",\"package_weight\":\"0.1\",\"package_content\":\"1 * One pair of bluetooth headsets1 * Charging case1 * Charging cable1 * User manual\",\"channelInventories\":[],\"fblWarehouseInventories\":[],\"multiWarehouseInventories\":[{\"quantity\":198,\"totalQuantity\":198,\"warehouseCode\":\"dropshipping\",\"occupyQuantity\":0,\"sellableQuantity\":198,\"withholdQuantity\":0}]}]"
            }
        ]
    }
}

But If I use this package in another repo base on Dockerfile, the response is not stringified.
I'm so confused.


Can you reproduce it if you have free time?

I provide some steps for you. Easy and quick.


  1. docker compose -f "docker-compose.yml" up -d --build
image
  1. View Logs - graphql
image
  1. Attach Shell - test
  2. Exec yarn test in the test shell
image 6. View Logs - graphql
prisma:query SELECT "public"."Product"."id", "public"."Product"."attr", "public"."Product"."skus" FROM "public"."Product" WHERE "public"."Product"."id" = $1 LIMIT $2 OFFSET $3
prisma:query COMMIT
Response
{
    "data": {
        "createOneProduct": {
            "id": 2,
            "attr": "{\"a\":123,\"b\":true,\"c\":{\"d\":\"hello\"}}",
            "skus": "[{\"Url\":\"https://www.x.com.x/-x-x.html\",\"SkuId\":20852161423,\"Images\":[\"https://x.net/p/x.jpg\"],\"saleProp\":{\"color_family\":\"Black\"},\"fblWarehouseInventories\":[],\"multiWarehouseInventories\":[{\"totalQuantity\":198,\"warehouseCode\":\"dropshipping\"}]}]"
        }
    }
}
prisma:query SELECT "public"."Product"."id", "public"."Product"."attr", "public"."Product"."skus" FROM "public"."Product" WHERE 1=1 OFFSET $1
Response
{
    "data": {
        "findManyProduct": [
            {
                "id": 1,
                "attr": "{\"a\":123,\"b\":true,\"c\":{\"d\":\"hello\"}}",
                "skus": "[{\"Url\":\"https://www.x.com.x/-x-x.html\",\"SkuId\":20852161423,\"Images\":[\"https://x.net/p/x.jpg\"],\"saleProp\":{\"color_family\":\"Black\"},\"fblWarehouseInventories\":[],\"multiWarehouseInventories\":[{\"totalQuantity\":198,\"warehouseCode\":\"dropshipping\"}]}]"
            },
            {
                "id": 2,
                "attr": "{\"a\":123,\"b\":true,\"c\":{\"d\":\"hello\"}}",
                "skus": "[{\"Url\":\"https://www.x.com.x/-x-x.html\",\"SkuId\":20852161423,\"Images\":[\"https://x.net/p/x.jpg\"],\"saleProp\":{\"color_family\":\"Black\"},\"fblWarehouseInventories\":[],\"multiWarehouseInventories\":[{\"totalQuantity\":198,\"warehouseCode\":\"dropshipping\"}]}]"
            }
        ]
    }
}
  1. The response is correct if you log the response.
image

from prisma-data-proxy-alt.

mbrimmer83 avatar mbrimmer83 commented on August 21, 2024

@zsnmwy What is the state of your fork? It doesn't look like this library is being maintained and might require significant work with the new jsonProtocol.

from prisma-data-proxy-alt.

Eleven-am avatar Eleven-am commented on August 21, 2024

I'd look into it this weekend

from prisma-data-proxy-alt.

zsnmwy avatar zsnmwy commented on August 21, 2024

@mbrimmer83
Now it supports Prisma 5.0, especially for jsonProtocol.
More detail in repos.
https://github.com/zsnmwy/prisma-data-proxy-windmill-template
https://github.com/zsnmwy/prisma-data-proxy

from prisma-data-proxy-alt.

mbrimmer83 avatar mbrimmer83 commented on August 21, 2024

@mbrimmer83 Now it supports Prisma 5.0, especially for jsonProtocol. More detail in repos. https://github.com/zsnmwy/prisma-data-proxy-windmill-template https://github.com/zsnmwy/prisma-data-proxy

Oh wow, I'm gonna test it out this weekend. I'll let you know how it goes. This is awesome. Thanks!!

from prisma-data-proxy-alt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.