@prisma/cli-security-rules 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -971,20 +971,20 @@ async function getCode(ctx) {
971
971
  }
972
972
  function logSuccessMessage(args) {
973
973
  const { publicKey } = args;
974
- const message = `Your new Policy rules were successfully deployed!
974
+ const message = `Your new rules were successfully deployed!
975
975
 
976
976
  You can enforce these rules with your public key:
977
977
  "${publicKey}"
978
978
 
979
979
  \`\`\`ts
980
- import { RulesProtectedClient } from "@prisma/extension-rules";
980
+ import { AuthorizedClient } from "@prisma/security-rules";
981
981
 
982
- const rulesClient = new RulesProtectedClient({
982
+ const authorizedClient = new AuthorizedClient({
983
983
  publicKey: "${publicKey}",
984
984
  });
985
985
 
986
986
  // run your queries as usual
987
- await rulesClient.user.findMany()
987
+ await authorizedClient.user.findMany()
988
988
  \`\`\``;
989
989
  console.log(message);
990
990
  console.log("");
package/dist/template.js CHANGED
@@ -1,7 +1,5 @@
1
1
  // @ts-check
2
2
 
3
- import { withAccelerate } from "@prisma/extension-accelerate";
4
-
5
3
  /**
6
4
  * Resolves the Prisma Client that will be bundled/injected into it. Performs
7
5
  * the necessary setup to enable the Prisma Client to work with the executor.
@@ -14,16 +12,15 @@ export async function resolvePrismaClient(ctx) {
14
12
  /** @type {any} **/
15
13
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
16
14
  // @ts-ignore this is injected by the runtime
17
- let { prisma } = await import("./rules-path-to-prisma-client.mjs");
15
+ let { default: prisma } = await import("./rules-path-to-prisma-client.mjs");
18
16
 
19
17
  const dbURL = new URL(env.DATABASE_URL ?? "MISSING_DATABASE_URL");
20
18
  const itx = new URL(request.url).searchParams.get("itx");
21
19
 
22
20
  const engine = prisma._originalClient._engine;
23
21
  const dsName = Object.keys(engine.inlineDatasources ?? {})[0] ?? "db";
24
- engine.config.overrideDatasources = { [dsName]: { url: dbURL.toString() } };
25
22
 
26
- prisma = prisma.$extends(withAccelerate());
23
+ engine.config.overrideDatasources = { [dsName]: { url: dbURL.toString() } };
27
24
  prisma = itx ? await getItxPrismaClient(prisma, JSON.parse(itx)) : prisma;
28
25
 
29
26
  return [null, prisma];
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@prisma/cli-security-rules",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "sideEffects": false,
5
- "description": "Policy CLI for Prisma",
5
+ "description": "Security Rules CLI for Prisma",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
8
8
  "exports": {
@@ -43,7 +43,6 @@
43
43
  "zod": "3.24.1"
44
44
  },
45
45
  "peerDependencies": {
46
- "@prisma/extension-accelerate": ">=1.2.2",
47
46
  "prisma": ">=6.2.0"
48
47
  },
49
48
  "engines": {