prisma-prefixed-ids 1.7.0 → 2.0.0

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +12 -4
  2. package/package.json +21 -8
package/dist/index.d.ts CHANGED
@@ -1,5 +1,13 @@
1
- import { type PrismaClient } from "@prisma/client";
2
1
  export type ModelName = string;
2
+ /**
3
+ * Minimal interface representing a Prisma Client instance.
4
+ * This allows the library to work with any Prisma Client version (v6, v7+)
5
+ * without importing from @prisma/client directly.
6
+ */
7
+ export interface PrismaClientLike {
8
+ $extends: (extension: any) => any;
9
+ [key: string]: any;
10
+ }
3
11
  export type PrefixConfig<ModelName extends string> = {
4
12
  prefixes: Partial<Record<ModelName, string>> | ((modelName: ModelName) => string | null);
5
13
  idGenerator?: (prefix: string) => string;
@@ -24,7 +32,7 @@ export declare function createPrefixedIdsExtension<ModelName extends string>(con
24
32
  };
25
33
  };
26
34
  };
27
- export declare function extendPrismaClient<ModelName extends string = string, Client extends PrismaClient = PrismaClient>(prisma: Client, config: PrefixConfig<ModelName>): Client;
28
- export declare function getDMMF(clientOrContext: PrismaClient | any): any;
29
- export declare function getModelNames(prismaClient: PrismaClient): string[];
35
+ export declare function extendPrismaClient<ModelName extends string = string, Client extends PrismaClientLike = PrismaClientLike>(prisma: Client, config: PrefixConfig<ModelName>): Client;
36
+ export declare function getDMMF(clientOrContext: PrismaClientLike | any): any;
37
+ export declare function getModelNames(prismaClient: PrismaClientLike): string[];
30
38
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prisma-prefixed-ids",
3
- "version": "1.7.0",
3
+ "version": "2.0.0",
4
4
  "description": "A Prisma extension that adds prefixed IDs to your models",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -28,9 +28,17 @@
28
28
  "clean:test-artifacts": "rm -rf test-client prisma/test.db prisma/test.db-journal",
29
29
  "test": "npm run test:unit && npm run test:integration",
30
30
  "test:unit": "jest --testPathIgnorePatterns=integration",
31
- "test:integration": "npm run db:setup && jest --testPathPattern=integration",
31
+ "test:integration": "npm run db:setup && jest --testPathPattern=integration --testPathIgnorePatterns='integration.mysql|integration.postgres'",
32
+ "test:mysql": "npm run db:setup:mysql && jest --testPathPattern=integration.mysql",
33
+ "test:postgres": "npm run db:setup:postgres && jest --testPathPattern=integration.postgres",
34
+ "db:setup:mysql": "npm run db:generate:mysql && npm run db:push:mysql",
35
+ "db:generate:mysql": "prisma generate --schema=tests/prisma/schema.mysql.prisma",
36
+ "db:push:mysql": "prisma db push --schema=tests/prisma/schema.mysql.prisma",
37
+ "db:setup:postgres": "npm run db:generate:postgres && npm run db:push:postgres",
38
+ "db:generate:postgres": "prisma generate --schema=tests/prisma/schema.postgres.prisma",
39
+ "db:push:postgres": "prisma db push --schema=tests/prisma/schema.postgres.prisma",
32
40
  "test:watch": "jest --watch",
33
- "test:coverage": "jest --coverage --collectCoverageFrom='src/**/*.ts' --coveragePathIgnorePatterns='src/__tests__'",
41
+ "test:coverage": "jest --coverage --collectCoverageFrom='src/**/*.ts' --coveragePathIgnorePatterns='src/__tests__' --testPathIgnorePatterns='integration'",
34
42
  "db:setup": "npm run db:generate && npm run db:push",
35
43
  "db:generate": "prisma generate",
36
44
  "db:push": "prisma db push",
@@ -52,27 +60,32 @@
52
60
  "author": "Prageeth Silva <prageeth@codemode.com.au>",
53
61
  "license": "MIT",
54
62
  "dependencies": {
55
- "@prisma/client": "^5.0.0 || ^6.0.0",
63
+ "@prisma/client": "^6.0.0 || ^7.0.0",
56
64
  "nanoid": "^5.0.0"
57
65
  },
58
66
  "devDependencies": {
67
+ "@libsql/client": "^0.17.0",
68
+ "@prisma/adapter-libsql": "^7.3.0",
69
+ "@prisma/adapter-mariadb": "^7.3.0",
70
+ "@prisma/adapter-pg": "^7.3.0",
59
71
  "@types/jest": "^29.0.0",
60
- "@types/node": "^20.0.0",
61
72
  "@types/nanoid": "^2.0.0",
73
+ "@types/node": "^22.0.0",
62
74
  "@typescript-eslint/eslint-plugin": "^6.0.0",
63
75
  "@typescript-eslint/parser": "^6.0.0",
76
+ "dotenv": "^16.0.0",
64
77
  "eslint": "^8.56.0",
65
78
  "eslint-config-prettier": "^9.0.0",
66
79
  "jest": "^29.0.0",
67
80
  "prettier": "^3.0.0",
68
- "prisma": "^5.0.0",
81
+ "prisma": "^7.0.0",
69
82
  "ts-jest": "^29.0.0",
70
83
  "typescript": "^5.0.0"
71
84
  },
72
85
  "peerDependencies": {
73
- "@prisma/client": "^5.0.0 || ^6.0.0"
86
+ "@prisma/client": "^6.0.0 || ^7.0.0"
74
87
  },
75
88
  "prisma": {
76
89
  "schema": "tests/prisma/schema.prisma"
77
90
  }
78
- }
91
+ }