@trycompai/db 1.0.5 → 1.0.6
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/README.md +60 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.d.ts +8 -4
- package/dist/index.js +2 -7173
- package/dist/index.mjs +4 -10
- package/dist/prisma/schema.prisma +0 -1
- package/dist/types.d.mts +1 -0
- package/dist/types.js +5 -7172
- package/dist/types.mjs +1 -8
- package/package.json +19 -18
- package/prisma/schema.prisma +0 -1
- package/dist/chunk-I3YC3IVF.mjs +0 -7196
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @trycompai/db
|
|
2
|
+
|
|
3
|
+
Database package with Prisma client and schema for Comp AI applications.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @trycompai/db @prisma/client prisma
|
|
9
|
+
# or
|
|
10
|
+
bun add @trycompai/db @prisma/client prisma
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
14
|
+
|
|
15
|
+
After installing, generate the Prisma client:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
prisma generate --schema=./node_modules/@trycompai/db/dist/prisma/schema.prisma
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Or add this to your package.json scripts:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"scripts": {
|
|
26
|
+
"db:generate": "prisma generate --schema=./node_modules/@trycompai/db/dist/prisma/schema.prisma",
|
|
27
|
+
"postinstall": "npm run db:generate"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
import { db, PrismaClient, Prisma } from '@trycompai/db';
|
|
36
|
+
|
|
37
|
+
// Use the pre-configured db instance (recommended)
|
|
38
|
+
const users = await db.user.findMany();
|
|
39
|
+
|
|
40
|
+
// Or create your own client
|
|
41
|
+
const client = new PrismaClient();
|
|
42
|
+
|
|
43
|
+
// Full TypeScript support for all Prisma types
|
|
44
|
+
type User = Prisma.UserCreateInput;
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Environment Variables
|
|
48
|
+
|
|
49
|
+
Make sure to set your `DATABASE_URL` environment variable:
|
|
50
|
+
|
|
51
|
+
```env
|
|
52
|
+
DATABASE_URL="postgresql://user:password@localhost:5432/database"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Key Features
|
|
56
|
+
|
|
57
|
+
- ✅ **Server-side only**: Safe for use in server environments (no client-side bundle pollution)
|
|
58
|
+
- ✅ **Full TypeScript support**: Complete type definitions for all database models
|
|
59
|
+
- ✅ **Pre-configured client**: Ready-to-use database connection with optimized settings
|
|
60
|
+
- ✅ **Schema included**: All database schemas and migrations included
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as _prisma_client_runtime_library from '@prisma/client/runtime/library';
|
|
2
|
+
import { PrismaClient } from '@prisma/client';
|
|
3
|
+
export { Prisma, PrismaClient } from '@prisma/client';
|
|
4
|
+
|
|
5
|
+
declare const db: PrismaClient<{
|
|
6
|
+
datasourceUrl: string | undefined;
|
|
7
|
+
log: ("warn" | "error")[];
|
|
8
|
+
}, never, _prisma_client_runtime_library.DefaultArgs>;
|
|
9
|
+
|
|
10
|
+
export { db };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _prisma_client_runtime_library from '@prisma/client/runtime/library';
|
|
2
|
+
import { PrismaClient } from '@prisma/client';
|
|
3
|
+
export { Prisma, PrismaClient } from '@prisma/client';
|
|
2
4
|
|
|
3
|
-
declare const db: PrismaClient
|
|
5
|
+
declare const db: PrismaClient<{
|
|
6
|
+
datasourceUrl: string | undefined;
|
|
7
|
+
log: ("warn" | "error")[];
|
|
8
|
+
}, never, _prisma_client_runtime_library.DefaultArgs>;
|
|
4
9
|
|
|
5
|
-
export
|
|
6
|
-
export { db, Prisma, PrismaClient };
|
|
10
|
+
export { db };
|