Files
dependabot[bot] fc03d9c7f8 build(deps): bump the e2e-prisma group in /e2e/api/compile/prisma with 2 updates (#8171)
* build(deps): bump the e2e-prisma group

Bumps the e2e-prisma group in /e2e/api/compile/prisma with 2 updates: [@prisma/client](https://github.com/prisma/prisma/tree/HEAD/packages/client) and [prisma](https://github.com/prisma/prisma/tree/HEAD/packages/cli).


Updates `@prisma/client` from 6.19.0 to 7.2.0
- [Release notes](https://github.com/prisma/prisma/releases)
- [Commits](https://github.com/prisma/prisma/commits/7.2.0/packages/client)

Updates `prisma` from 6.19.0 to 7.2.0
- [Release notes](https://github.com/prisma/prisma/releases)
- [Commits](https://github.com/prisma/prisma/commits/7.2.0/packages/cli)

---
updated-dependencies:
- dependency-name: "@prisma/client"
  dependency-version: 7.2.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: e2e-prisma
- dependency-name: prisma
  dependency-version: 7.2.0
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: e2e-prisma
...

Signed-off-by: dependabot[bot] <support@github.com>

* e2e/prisma: manual upgrade for prisma 7

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Stephan Renatus <stephan.renatus@gmail.com>
2026-01-08 15:49:47 +01:00

53 lines
1.4 KiB
JavaScript

/**
* Copyright 2025 The OPA Authors
* SPDX-License-Identifier: Apache-2.0
*/
import util from "util";
import { PrismaClient } from "./generated/prisma/index.js";
import { ucastToPrisma } from "@open-policy-agent/ucast-prisma";
import { PrismaPg } from "@prisma/adapter-pg";
import pg from "pg";
const connectionString = process.env.DATABASE_URL || "postgresql://dummy:dummy@localhost:5432/dummy";
const pool = new pg.Pool({ connectionString });
const adapter = new PrismaPg(pool);
const prisma = new PrismaClient({ adapter });
// Function to read JSON from stdin
async function getStdinJson() {
const chunks = [];
for await (const chunk of process.stdin) {
chunks.push(chunk);
}
const data = Buffer.concat(chunks).toString();
try {
return JSON.parse(data);
} catch (error) {
throw new Error("Invalid JSON input");
}
}
async function main() {
try {
const filters = await getStdinJson();
if (filters === null) return;
const where = ucastToPrisma(filters, "fruit", {
fruits: { $self: "fruit" },
});
console.error(util.inspect(where, { depth: null }));
const results = await prisma.fruit.findMany({ where });
process.stdout.write(JSON.stringify(results, null, 2));
} catch (error) {
console.error("Error:", error.message);
process.exit(1);
} finally {
await prisma.$disconnect();
}
}
// Run the script
main();