@toride/prisma 0.1.0 → 0.3.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 +6 -3
  2. package/package.json +6 -2
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ConstraintAdapter, ResourceRef } from 'toride';
1
+ import { ConstraintAdapter, TorideSchema, DefaultSchema, ResourceRef } from 'toride';
2
2
 
3
3
  declare const VERSION = "0.0.1";
4
4
 
@@ -22,8 +22,11 @@ interface PrismaAdapterOptions {
22
22
  *
23
23
  * No Prisma dependency required - produces plain JS objects matching
24
24
  * Prisma's WHERE clause structure.
25
+ *
26
+ * @typeParam TQueryMap - Maps resource type names to their Prisma WHERE clause types.
27
+ * Defaults to `Record<string, PrismaWhere>` for backward compatibility.
25
28
  */
26
- declare function createPrismaAdapter(options?: PrismaAdapterOptions): ConstraintAdapter<PrismaWhere>;
29
+ declare function createPrismaAdapter<TQueryMap extends Record<string, PrismaWhere> = Record<string, PrismaWhere>>(options?: PrismaAdapterOptions): ConstraintAdapter<TQueryMap>;
27
30
  /** Options for createPrismaResolver. */
28
31
  interface PrismaResolverOptions {
29
32
  /** Fields to select. Defaults to all scalar fields. */
@@ -41,6 +44,6 @@ interface PrismaResolverOptions {
41
44
  * @param options - Optional configuration.
42
45
  * @returns A ResourceResolver function.
43
46
  */
44
- declare function createPrismaResolver(client: any, modelName: string, options?: PrismaResolverOptions): (ref: ResourceRef) => Promise<Record<string, unknown>>;
47
+ declare function createPrismaResolver<S extends TorideSchema = DefaultSchema, R extends S["resources"] = S["resources"]>(client: any, modelName: R, options?: PrismaResolverOptions): (ref: ResourceRef<S, R>) => Promise<S["resourceAttributeMap"][R]>;
45
48
 
46
49
  export { type PrismaAdapterOptions, type PrismaResolverOptions, type PrismaWhere, VERSION, createPrismaAdapter, createPrismaResolver };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toride/prisma",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Prisma integration for Toride authorization engine",
5
5
  "type": "module",
6
6
  "exports": {
@@ -20,11 +20,14 @@
20
20
  ]
21
21
  },
22
22
  "dependencies": {
23
- "toride": "0.1.0"
23
+ "toride": "0.3.0"
24
24
  },
25
25
  "publishConfig": {
26
26
  "access": "public"
27
27
  },
28
+ "devDependencies": {
29
+ "tsd": "^0.33.0"
30
+ },
28
31
  "keywords": [
29
32
  "authorization",
30
33
  "prisma",
@@ -38,6 +41,7 @@
38
41
  "scripts": {
39
42
  "build": "tsup",
40
43
  "test": "vitest run",
44
+ "typetest": "tsd --files 'src/__typetests__/*.test-d.ts'",
41
45
  "lint": "tsc --noEmit"
42
46
  }
43
47
  }