@forinda/kickjs-prisma 1.3.1 → 1.4.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.
package/dist/index.d.ts CHANGED
@@ -1,166 +1,6 @@
1
- import { AppAdapter, Container } from '@forinda/kickjs-core';
2
- import { QueryBuilderAdapter, ParsedQuery } from '@forinda/kickjs-http';
3
-
4
- interface PrismaAdapterOptions {
5
- /**
6
- * PrismaClient instance — typed as `any` to avoid version coupling.
7
- *
8
- * Prisma 5/6: `new PrismaClient()` from `@prisma/client`
9
- * Prisma 7+: `new PrismaClient({ adapter })` from your generated output path
10
- */
11
- client: any;
12
- /**
13
- * Enable query logging (default: false).
14
- * Uses `$on('query', ...)` for Prisma 5/6 and `$extends` for Prisma 7+.
15
- */
16
- logging?: boolean;
17
- }
18
- /** DI token for resolving the PrismaClient from the container */
19
- declare const PRISMA_CLIENT: unique symbol;
20
- /**
21
- * Common Prisma model delegate operations.
22
- * Use this to type-narrow the injected PrismaClient to a specific model
23
- * without needing `as any` casts in repositories.
24
- *
25
- * @example
26
- * ```ts
27
- * @Repository()
28
- * export class PrismaUserRepository {
29
- * @Inject(PRISMA_CLIENT) private prisma!: { user: PrismaModelDelegate }
30
- *
31
- * async findById(id: string) {
32
- * return this.prisma.user.findUnique({ where: { id } })
33
- * }
34
- * }
35
- * ```
36
- */
37
- interface PrismaModelDelegate {
38
- findUnique(args: {
39
- where: Record<string, unknown>;
40
- include?: Record<string, unknown>;
41
- }): Promise<unknown>;
42
- findFirst?(args?: Record<string, unknown>): Promise<unknown>;
43
- findMany(args?: Record<string, unknown>): Promise<unknown[]>;
44
- create(args: {
45
- data: Record<string, unknown>;
46
- }): Promise<unknown>;
47
- update(args: {
48
- where: Record<string, unknown>;
49
- data: Record<string, unknown>;
50
- }): Promise<unknown>;
51
- delete(args: {
52
- where: Record<string, unknown>;
53
- }): Promise<unknown>;
54
- deleteMany(args?: {
55
- where?: Record<string, unknown>;
56
- }): Promise<{
57
- count: number;
58
- }>;
59
- count(args?: {
60
- where?: Record<string, unknown>;
61
- }): Promise<number>;
62
- }
63
-
64
- /**
65
- * Prisma adapter — registers a PrismaClient in the DI container and manages
66
- * its lifecycle (connection setup and teardown).
67
- *
68
- * Works with Prisma 5, 6, and 7+.
69
- *
70
- * @example Prisma 5/6
71
- * ```ts
72
- * import { PrismaClient } from '@prisma/client'
73
- *
74
- * new PrismaAdapter({ client: new PrismaClient(), logging: true })
75
- * ```
76
- *
77
- * @example Prisma 7+ (driver adapters)
78
- * ```ts
79
- * import { PrismaClient } from './generated/prisma'
80
- * import { PrismaPg } from '@prisma/adapter-pg'
81
- * import pg from 'pg'
82
- *
83
- * const pool = new pg.Pool({ connectionString: process.env.DATABASE_URL })
84
- * const client = new PrismaClient({ adapter: new PrismaPg(pool) })
85
- * new PrismaAdapter({ client, logging: true })
86
- * ```
87
- *
88
- * Inject the client in services:
89
- * ```ts
90
- * @Service()
91
- * class UserService {
92
- * @Inject(PRISMA_CLIENT) private prisma!: PrismaClient
93
- * }
94
- * ```
95
- */
96
- declare class PrismaAdapter implements AppAdapter {
97
- private options;
98
- name: string;
99
- private client;
100
- constructor(options: PrismaAdapterOptions);
101
- /** Register the PrismaClient in the DI container */
102
- beforeStart(_app: any, container: Container): void;
103
- /** Disconnect the PrismaClient on shutdown */
104
- shutdown(): Promise<void>;
105
- }
106
-
107
- /**
108
- * Configuration for the Prisma query builder adapter.
109
- *
110
- * Use the generic parameter to constrain `searchColumns` to actual model field names:
111
- *
112
- * @example
113
- * ```ts
114
- * import type { User } from '@prisma/client'
115
- *
116
- * // Type-safe — only User field names are accepted
117
- * const config: PrismaQueryConfig<User> = {
118
- * searchColumns: ['name', 'email'], // ✓ valid User fields
119
- * }
120
- *
121
- * // Without generic — accepts any string (backward compatible)
122
- * const config: PrismaQueryConfig = {
123
- * searchColumns: ['name', 'email'],
124
- * }
125
- * ```
126
- */
127
- interface PrismaQueryConfig<TModel = Record<string, any>> {
128
- /** Columns to search across when a search string is provided */
129
- searchColumns?: (keyof TModel & string)[];
130
- }
131
- /** Result shape matching Prisma's findMany arguments */
132
- interface PrismaQueryResult {
133
- where?: Record<string, any>;
134
- orderBy?: Record<string, 'asc' | 'desc'>[];
135
- skip?: number;
136
- take?: number;
137
- }
138
- /**
139
- * Translates a ParsedQuery into Prisma-compatible `findMany` arguments.
140
- *
141
- * @example
142
- * ```ts
143
- * import type { User } from '@prisma/client'
144
- *
145
- * const adapter = new PrismaQueryAdapter()
146
- * const parsed = parseQuery(req.query)
147
- *
148
- * // Type-safe — only User fields allowed in searchColumns
149
- * const args = adapter.build(parsed, { searchColumns: ['name', 'email'] } satisfies PrismaQueryConfig<User>)
150
- * const users = await prisma.user.findMany(args)
151
- * ```
152
- */
153
- declare class PrismaQueryAdapter implements QueryBuilderAdapter<PrismaQueryResult, PrismaQueryConfig<any>> {
154
- readonly name = "PrismaQueryAdapter";
155
- build<TModel = Record<string, any>>(parsed: ParsedQuery, config?: PrismaQueryConfig<TModel>): PrismaQueryResult;
156
- /** Map FilterItem[] to Prisma where conditions */
157
- private buildFilters;
158
- /** Build Prisma orderBy from SortItem[] */
159
- private buildSort;
160
- /** Build a search condition using OR + contains across multiple columns */
161
- private buildSearch;
162
- /** Attempt to coerce a string value to a number or boolean if appropriate */
163
- private coerce;
164
- }
165
-
166
- export { PRISMA_CLIENT, PrismaAdapter, type PrismaAdapterOptions, type PrismaModelDelegate, PrismaQueryAdapter, type PrismaQueryConfig, type PrismaQueryResult };
1
+ export { PrismaAdapter } from './prisma.adapter';
2
+ export { PrismaQueryAdapter } from './query-adapter';
3
+ export { PRISMA_CLIENT } from './types';
4
+ export type { PrismaAdapterOptions, PrismaModelDelegate } from './types';
5
+ export type { PrismaQueryConfig, PrismaQueryResult } from './query-adapter';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvC,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AACxE,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA"}
package/dist/index.js CHANGED
@@ -1 +1,100 @@
1
- var p=Object.defineProperty;var a=(u,e)=>p(u,"name",{value:e,configurable:!0});import{Logger as g,Scope as b}from"@forinda/kickjs-core";var h=Symbol("PrismaClient");var c=g.for("PrismaAdapter"),m=class{static{a(this,"PrismaAdapter")}options;name="PrismaAdapter";client;constructor(e){this.options=e,this.client=e.client}beforeStart(e,i){this.options.logging&&(typeof this.client.$on=="function"?this.client.$on("query",t=>{c.debug(`Query: ${t.query}`),c.debug(`Params: ${t.params}`),c.debug(`Duration: ${t.duration}ms`)}):typeof this.client.$extends=="function"&&(this.client=this.client.$extends({query:{$allOperations({operation:t,model:o,args:r,query:s}){let n=performance.now();return s(r).then(l=>{let d=Math.round(performance.now()-n);return c.debug(`${o}.${t} \u2014 ${d}ms`),l})}}}))),i.registerFactory(h,()=>this.client,b.SINGLETON),c.info("PrismaClient registered in DI container")}async shutdown(){typeof this.client.$disconnect=="function"&&(await this.client.$disconnect(),c.info("PrismaClient disconnected"))}};var f=class{static{a(this,"PrismaQueryAdapter")}name="PrismaQueryAdapter";build(e,i={}){let t={},o=this.buildFilters(e.filters),r=this.buildSearch(e.search,i.searchColumns);if(o.length>0||r){let n=[];o.length>0&&n.push(...o),r&&n.push(r),t.where=n.length===1?n[0]:{AND:n}}let s=this.buildSort(e.sort);return s.length>0&&(t.orderBy=s),t.skip=e.pagination.offset,t.take=e.pagination.limit,t}buildFilters(e){return e.map(i=>{let{field:t,operator:o,value:r}=i;switch(o){case"eq":return{[t]:{equals:this.coerce(r)}};case"neq":return{[t]:{not:this.coerce(r)}};case"gt":return{[t]:{gt:this.coerce(r)}};case"gte":return{[t]:{gte:this.coerce(r)}};case"lt":return{[t]:{lt:this.coerce(r)}};case"lte":return{[t]:{lte:this.coerce(r)}};case"contains":return{[t]:{contains:r,mode:"insensitive"}};case"starts":return{[t]:{startsWith:r,mode:"insensitive"}};case"ends":return{[t]:{endsWith:r,mode:"insensitive"}};case"in":{let s=r.split(",").map(n=>this.coerce(n.trim()));return{[t]:{in:s}}}case"between":{let[s,n]=r.split(",").map(l=>this.coerce(l.trim()));return{[t]:{gte:s,lte:n}}}default:return{[t]:{equals:this.coerce(r)}}}})}buildSort(e){return e.map(i=>({[i.field]:i.direction}))}buildSearch(e,i){return!e||!i||i.length===0?null:{OR:i.map(t=>({[t]:{contains:e,mode:"insensitive"}}))}}coerce(e){if(e==="true")return!0;if(e==="false")return!1;let i=Number(e);return!Number.isNaN(i)&&e.trim()!==""?i:e}};export{h as PRISMA_CLIENT,m as PrismaAdapter,f as PrismaQueryAdapter};
1
+ import { Logger as l, Scope as h } from "@forinda/kickjs-core";
2
+ var d = /* @__PURE__ */ Symbol("PrismaClient"), c = l.for("PrismaAdapter"), f = class {
3
+ name = "PrismaAdapter";
4
+ client;
5
+ constructor(t) {
6
+ this.options = t, this.client = t.client;
7
+ }
8
+ beforeStart(t, i) {
9
+ this.options.logging && (typeof this.client.$on == "function" ? this.client.$on("query", (e) => {
10
+ c.debug(`Query: ${e.query}`), c.debug(`Params: ${e.params}`), c.debug(`Duration: ${e.duration}ms`);
11
+ }) : typeof this.client.$extends == "function" && (this.client = this.client.$extends({ query: { $allOperations({ operation: e, model: o, args: r, query: s }) {
12
+ const n = performance.now();
13
+ return s(r).then((a) => {
14
+ const u = Math.round(performance.now() - n);
15
+ return c.debug(`${o}.${e} — ${u}ms`), a;
16
+ });
17
+ } } }))), i.registerFactory(d, () => this.client, h.SINGLETON), c.info("PrismaClient registered in DI container");
18
+ }
19
+ async shutdown() {
20
+ typeof this.client.$disconnect == "function" && (await this.client.$disconnect(), c.info("PrismaClient disconnected"));
21
+ }
22
+ }, p = class {
23
+ name = "PrismaQueryAdapter";
24
+ build(t, i = {}) {
25
+ const e = {}, o = this.buildFilters(t.filters), r = this.buildSearch(t.search, i.searchColumns);
26
+ if (o.length > 0 || r) {
27
+ const n = [];
28
+ o.length > 0 && n.push(...o), r && n.push(r), e.where = n.length === 1 ? n[0] : { AND: n };
29
+ }
30
+ const s = this.buildSort(t.sort);
31
+ return s.length > 0 && (e.orderBy = s), e.skip = t.pagination.offset, e.take = t.pagination.limit, e;
32
+ }
33
+ buildFilters(t) {
34
+ return t.map((i) => {
35
+ const { field: e, operator: o, value: r } = i;
36
+ switch (o) {
37
+ case "eq":
38
+ return { [e]: { equals: this.coerce(r) } };
39
+ case "neq":
40
+ return { [e]: { not: this.coerce(r) } };
41
+ case "gt":
42
+ return { [e]: { gt: this.coerce(r) } };
43
+ case "gte":
44
+ return { [e]: { gte: this.coerce(r) } };
45
+ case "lt":
46
+ return { [e]: { lt: this.coerce(r) } };
47
+ case "lte":
48
+ return { [e]: { lte: this.coerce(r) } };
49
+ case "contains":
50
+ return { [e]: {
51
+ contains: r,
52
+ mode: "insensitive"
53
+ } };
54
+ case "starts":
55
+ return { [e]: {
56
+ startsWith: r,
57
+ mode: "insensitive"
58
+ } };
59
+ case "ends":
60
+ return { [e]: {
61
+ endsWith: r,
62
+ mode: "insensitive"
63
+ } };
64
+ case "in": {
65
+ const s = r.split(",").map((n) => this.coerce(n.trim()));
66
+ return { [e]: { in: s } };
67
+ }
68
+ case "between": {
69
+ const [s, n] = r.split(",").map((a) => this.coerce(a.trim()));
70
+ return { [e]: {
71
+ gte: s,
72
+ lte: n
73
+ } };
74
+ }
75
+ default:
76
+ return { [e]: { equals: this.coerce(r) } };
77
+ }
78
+ });
79
+ }
80
+ buildSort(t) {
81
+ return t.map((i) => ({ [i.field]: i.direction }));
82
+ }
83
+ buildSearch(t, i) {
84
+ return !t || !i || i.length === 0 ? null : { OR: i.map((e) => ({ [e]: {
85
+ contains: t,
86
+ mode: "insensitive"
87
+ } })) };
88
+ }
89
+ coerce(t) {
90
+ if (t === "true") return !0;
91
+ if (t === "false") return !1;
92
+ const i = Number(t);
93
+ return !Number.isNaN(i) && t.trim() !== "" ? i : t;
94
+ }
95
+ };
96
+ export {
97
+ d as PRISMA_CLIENT,
98
+ f as PrismaAdapter,
99
+ p as PrismaQueryAdapter
100
+ };
@@ -0,0 +1,45 @@
1
+ import { type AppAdapter, type Container } from '@forinda/kickjs-core';
2
+ import { type PrismaAdapterOptions } from './types';
3
+ /**
4
+ * Prisma adapter — registers a PrismaClient in the DI container and manages
5
+ * its lifecycle (connection setup and teardown).
6
+ *
7
+ * Works with Prisma 5, 6, and 7+.
8
+ *
9
+ * @example Prisma 5/6
10
+ * ```ts
11
+ * import { PrismaClient } from '@prisma/client'
12
+ *
13
+ * new PrismaAdapter({ client: new PrismaClient(), logging: true })
14
+ * ```
15
+ *
16
+ * @example Prisma 7+ (driver adapters)
17
+ * ```ts
18
+ * import { PrismaClient } from './generated/prisma'
19
+ * import { PrismaPg } from '@prisma/adapter-pg'
20
+ * import pg from 'pg'
21
+ *
22
+ * const pool = new pg.Pool({ connectionString: process.env.DATABASE_URL })
23
+ * const client = new PrismaClient({ adapter: new PrismaPg(pool) })
24
+ * new PrismaAdapter({ client, logging: true })
25
+ * ```
26
+ *
27
+ * Inject the client in services:
28
+ * ```ts
29
+ * @Service()
30
+ * class UserService {
31
+ * @Inject(PRISMA_CLIENT) private prisma!: PrismaClient
32
+ * }
33
+ * ```
34
+ */
35
+ export declare class PrismaAdapter implements AppAdapter {
36
+ private options;
37
+ name: string;
38
+ private client;
39
+ constructor(options: PrismaAdapterOptions);
40
+ /** Register the PrismaClient in the DI container */
41
+ beforeStart(_app: any, container: Container): void;
42
+ /** Disconnect the PrismaClient on shutdown */
43
+ shutdown(): Promise<void>;
44
+ }
45
+ //# sourceMappingURL=prisma.adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prisma.adapter.d.ts","sourceRoot":"","sources":["../src/prisma.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,UAAU,EAAE,KAAK,SAAS,EAAS,MAAM,sBAAsB,CAAA;AACrF,OAAO,EAAiB,KAAK,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAIlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBAAa,aAAc,YAAW,UAAU;IAIlC,OAAO,CAAC,OAAO;IAH3B,IAAI,SAAkB;IACtB,OAAO,CAAC,MAAM,CAAK;gBAEC,OAAO,EAAE,oBAAoB;IAIjD,oDAAoD;IACpD,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI;IAiClD,8CAA8C;IACxC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAMhC"}
@@ -0,0 +1,60 @@
1
+ import type { QueryBuilderAdapter, ParsedQuery } from '@forinda/kickjs-http';
2
+ /**
3
+ * Configuration for the Prisma query builder adapter.
4
+ *
5
+ * Use the generic parameter to constrain `searchColumns` to actual model field names:
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import type { User } from '@prisma/client'
10
+ *
11
+ * // Type-safe — only User field names are accepted
12
+ * const config: PrismaQueryConfig<User> = {
13
+ * searchColumns: ['name', 'email'], // ✓ valid User fields
14
+ * }
15
+ *
16
+ * // Without generic — accepts any string (backward compatible)
17
+ * const config: PrismaQueryConfig = {
18
+ * searchColumns: ['name', 'email'],
19
+ * }
20
+ * ```
21
+ */
22
+ export interface PrismaQueryConfig<TModel = Record<string, any>> {
23
+ /** Columns to search across when a search string is provided */
24
+ searchColumns?: (keyof TModel & string)[];
25
+ }
26
+ /** Result shape matching Prisma's findMany arguments */
27
+ export interface PrismaQueryResult {
28
+ where?: Record<string, any>;
29
+ orderBy?: Record<string, 'asc' | 'desc'>[];
30
+ skip?: number;
31
+ take?: number;
32
+ }
33
+ /**
34
+ * Translates a ParsedQuery into Prisma-compatible `findMany` arguments.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * import type { User } from '@prisma/client'
39
+ *
40
+ * const adapter = new PrismaQueryAdapter()
41
+ * const parsed = parseQuery(req.query)
42
+ *
43
+ * // Type-safe — only User fields allowed in searchColumns
44
+ * const args = adapter.build(parsed, { searchColumns: ['name', 'email'] } satisfies PrismaQueryConfig<User>)
45
+ * const users = await prisma.user.findMany(args)
46
+ * ```
47
+ */
48
+ export declare class PrismaQueryAdapter implements QueryBuilderAdapter<PrismaQueryResult, PrismaQueryConfig<any>> {
49
+ readonly name = "PrismaQueryAdapter";
50
+ build<TModel = Record<string, any>>(parsed: ParsedQuery, config?: PrismaQueryConfig<TModel>): PrismaQueryResult;
51
+ /** Map FilterItem[] to Prisma where conditions */
52
+ private buildFilters;
53
+ /** Build Prisma orderBy from SortItem[] */
54
+ private buildSort;
55
+ /** Build a search condition using OR + contains across multiple columns */
56
+ private buildSearch;
57
+ /** Attempt to coerce a string value to a number or boolean if appropriate */
58
+ private coerce;
59
+ }
60
+ //# sourceMappingURL=query-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-adapter.d.ts","sourceRoot":"","sources":["../src/query-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAwB,MAAM,sBAAsB,CAAA;AAElG;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,iBAAiB,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAC7D,gEAAgE;IAChE,aAAa,CAAC,EAAE,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;CAC1C;AAED,wDAAwD;AACxD,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC,EAAE,CAAA;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,kBAAmB,YAAW,mBAAmB,CAC5D,iBAAiB,EACjB,iBAAiB,CAAC,GAAG,CAAC,CACvB;IACC,QAAQ,CAAC,IAAI,wBAAuB;IAEpC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAChC,MAAM,EAAE,WAAW,EACnB,MAAM,GAAE,iBAAiB,CAAC,MAAM,CAAM,GACrC,iBAAiB;IAiCpB,kDAAkD;IAClD,OAAO,CAAC,YAAY;IAqCpB,2CAA2C;IAC3C,OAAO,CAAC,SAAS;IAIjB,2EAA2E;IAC3E,OAAO,CAAC,WAAW;IAYnB,6EAA6E;IAC7E,OAAO,CAAC,MAAM;CAOf"}
@@ -0,0 +1,60 @@
1
+ export interface PrismaAdapterOptions {
2
+ /**
3
+ * PrismaClient instance — typed as `any` to avoid version coupling.
4
+ *
5
+ * Prisma 5/6: `new PrismaClient()` from `@prisma/client`
6
+ * Prisma 7+: `new PrismaClient({ adapter })` from your generated output path
7
+ */
8
+ client: any;
9
+ /**
10
+ * Enable query logging (default: false).
11
+ * Uses `$on('query', ...)` for Prisma 5/6 and `$extends` for Prisma 7+.
12
+ */
13
+ logging?: boolean;
14
+ }
15
+ /** DI token for resolving the PrismaClient from the container */
16
+ export declare const PRISMA_CLIENT: unique symbol;
17
+ /**
18
+ * Common Prisma model delegate operations.
19
+ * Use this to type-narrow the injected PrismaClient to a specific model
20
+ * without needing `as any` casts in repositories.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * @Repository()
25
+ * export class PrismaUserRepository {
26
+ * @Inject(PRISMA_CLIENT) private prisma!: { user: PrismaModelDelegate }
27
+ *
28
+ * async findById(id: string) {
29
+ * return this.prisma.user.findUnique({ where: { id } })
30
+ * }
31
+ * }
32
+ * ```
33
+ */
34
+ export interface PrismaModelDelegate {
35
+ findUnique(args: {
36
+ where: Record<string, unknown>;
37
+ include?: Record<string, unknown>;
38
+ }): Promise<unknown>;
39
+ findFirst?(args?: Record<string, unknown>): Promise<unknown>;
40
+ findMany(args?: Record<string, unknown>): Promise<unknown[]>;
41
+ create(args: {
42
+ data: Record<string, unknown>;
43
+ }): Promise<unknown>;
44
+ update(args: {
45
+ where: Record<string, unknown>;
46
+ data: Record<string, unknown>;
47
+ }): Promise<unknown>;
48
+ delete(args: {
49
+ where: Record<string, unknown>;
50
+ }): Promise<unknown>;
51
+ deleteMany(args?: {
52
+ where?: Record<string, unknown>;
53
+ }): Promise<{
54
+ count: number;
55
+ }>;
56
+ count(args?: {
57
+ where?: Record<string, unknown>;
58
+ }): Promise<number>;
59
+ }
60
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,MAAM,EAAE,GAAG,CAAA;IACX;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,iEAAiE;AACjE,eAAO,MAAM,aAAa,eAAyB,CAAA;AAEnD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,IAAI,EAAE;QACf,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAC9B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAClC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACpB,SAAS,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAC5D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAA;IAC5D,MAAM,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACjE,MAAM,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACjG,MAAM,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAClE,UAAU,CAAC,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAClF,KAAK,CAAC,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CACnE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forinda/kickjs-prisma",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "description": "Prisma ORM adapter with DI integration, transaction support, and query building for KickJS",
5
5
  "keywords": [
6
6
  "kickjs",
@@ -36,7 +36,8 @@
36
36
  "@forinda/kickjs-queue",
37
37
  "@forinda/kickjs-multi-tenant",
38
38
  "@forinda/kickjs-devtools",
39
- "@forinda/kickjs-notifications"
39
+ "@forinda/kickjs-notifications",
40
+ "vite"
40
41
  ],
41
42
  "type": "module",
42
43
  "main": "dist/index.js",
@@ -52,8 +53,8 @@
52
53
  ],
53
54
  "dependencies": {
54
55
  "reflect-metadata": "^0.2.2",
55
- "@forinda/kickjs-core": "1.3.1",
56
- "@forinda/kickjs-http": "1.3.1"
56
+ "@forinda/kickjs-core": "1.4.0",
57
+ "@forinda/kickjs-http": "1.4.0"
57
58
  },
58
59
  "peerDependencies": {
59
60
  "@prisma/client": ">=5.0.0"
@@ -65,7 +66,6 @@
65
66
  },
66
67
  "devDependencies": {
67
68
  "@types/node": "^24.5.2",
68
- "tsup": "^8.5.0",
69
69
  "typescript": "^5.9.2"
70
70
  },
71
71
  "publishConfig": {
@@ -86,8 +86,9 @@
86
86
  "url": "https://github.com/forinda/kick-js/issues"
87
87
  },
88
88
  "scripts": {
89
- "build": "tsup",
90
- "dev": "tsup --watch",
89
+ "build": "vite build && pnpm build:types",
90
+ "build:types": "tsc -p tsconfig.build.json",
91
+ "dev": "vite build --watch",
91
92
  "typecheck": "tsc --noEmit",
92
93
  "clean": "rm -rf dist .turbo",
93
94
  "lint": "tsc --noEmit"