@adaptware/eagles-db 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/README.md +110 -0
- package/bin/db-cli.js +113 -0
- package/client/client.d.ts +1 -0
- package/client/client.js +4 -0
- package/client/default.d.ts +1 -0
- package/client/default.js +4 -0
- package/client/edge.d.ts +1 -0
- package/client/edge.js +1039 -0
- package/client/index-browser.js +1022 -0
- package/client/index.d.ts +94904 -0
- package/client/index.js +1064 -0
- package/client/libquery_engine-darwin.dylib.node +0 -0
- package/client/libquery_engine-linux-arm64-openssl-1.1.x.so.node +0 -0
- package/client/package.json +150 -0
- package/client/runtime/edge-esm.js +34 -0
- package/client/runtime/edge.js +34 -0
- package/client/runtime/index-browser.d.ts +370 -0
- package/client/runtime/index-browser.js +16 -0
- package/client/runtime/library.d.ts +3976 -0
- package/client/runtime/library.js +146 -0
- package/client/runtime/react-native.js +83 -0
- package/client/runtime/wasm-compiler-edge.js +83 -0
- package/client/runtime/wasm-engine-edge.js +35 -0
- package/client/schema.prisma +1158 -0
- package/client/wasm.d.ts +1 -0
- package/client/wasm.js +1022 -0
- package/package.json +55 -0
- package/prisma/schema/CandidateQuestionResponse.prisma +21 -0
- package/prisma/schema/UserRole.prisma +20 -0
- package/prisma/schema/action.prisma +35 -0
- package/prisma/schema/applications.prisma +44 -0
- package/prisma/schema/approval.prisma +14 -0
- package/prisma/schema/assessment.prisma +40 -0
- package/prisma/schema/assessmentLibrary.prisma +33 -0
- package/prisma/schema/assessmentQuestion.prisma +17 -0
- package/prisma/schema/assignmentLibrary.prisma +20 -0
- package/prisma/schema/budget.prisma +38 -0
- package/prisma/schema/calendly.prisma +18 -0
- package/prisma/schema/candidateProfile.prisma +26 -0
- package/prisma/schema/contactUs.prisma +12 -0
- package/prisma/schema/evaluationPlan.prisma +91 -0
- package/prisma/schema/feedback.prisma +18 -0
- package/prisma/schema/fitCheck.prisma +54 -0
- package/prisma/schema/google.prisma +16 -0
- package/prisma/schema/intermediateFeedback.prisma +18 -0
- package/prisma/schema/interview.prisma +65 -0
- package/prisma/schema/interviewLibrary.prisma +33 -0
- package/prisma/schema/interviewNotes.prisma +17 -0
- package/prisma/schema/jobDescription.prisma +43 -0
- package/prisma/schema/jobDescriptionData.prisma +16 -0
- package/prisma/schema/message.prisma +15 -0
- package/prisma/schema/ongoingEvaluation.prisma +59 -0
- package/prisma/schema/organisation.prisma +44 -0
- package/prisma/schema/overallFeedback.prisma +35 -0
- package/prisma/schema/panelist.prisma +24 -0
- package/prisma/schema/permission.prisma +13 -0
- package/prisma/schema/questions.prisma +36 -0
- package/prisma/schema/resume.prisma +26 -0
- package/prisma/schema/resumeData.prisma +15 -0
- package/prisma/schema/schema.prisma +16 -0
- package/prisma/schema/suggestion.prisma +21 -0
- package/prisma/schema/transcript.prisma +26 -0
- package/prisma/schema/user.prisma +68 -0
- package/prisma/schema/userProfile.prisma +15 -0
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Treadspace DB
|
|
2
|
+
|
|
3
|
+
A Prisma client package for Treadspace database operations.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install treadspace-db
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Basic Usage
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { prisma } from "treadspace-db";
|
|
17
|
+
|
|
18
|
+
// Use the prisma client
|
|
19
|
+
const users = await prisma.user.findMany();
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### With TypeScript
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { prisma, PrismaClient } from "treadspace-db";
|
|
26
|
+
|
|
27
|
+
// The prisma instance is already configured and ready to use
|
|
28
|
+
const user = await prisma.user.create({
|
|
29
|
+
data: {
|
|
30
|
+
email: "user@example.com",
|
|
31
|
+
name: "John Doe",
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Environment Setup
|
|
37
|
+
|
|
38
|
+
Make sure to set your `DATABASE_URL` environment variable:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
DATABASE_URL="postgresql://username:password@localhost:5432/database_name"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Development
|
|
45
|
+
|
|
46
|
+
### Prerequisites
|
|
47
|
+
|
|
48
|
+
- Node.js 16+
|
|
49
|
+
- PostgreSQL database
|
|
50
|
+
|
|
51
|
+
### Setup
|
|
52
|
+
|
|
53
|
+
1. Install dependencies:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm install
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
2. Set up your database URL in `.env`:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
DATABASE_URL="postgresql://username:password@localhost:5432/database_name"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
3. Add your database models to `prisma/schema.prisma`
|
|
66
|
+
|
|
67
|
+
4. Generate Prisma client:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npm run generate
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
5. Push schema to database:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
npm run db:push
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Available Scripts
|
|
80
|
+
|
|
81
|
+
- `npm run build` - Build the TypeScript code
|
|
82
|
+
- `npm run dev` - Watch mode for development
|
|
83
|
+
- `npm run generate` - Generate Prisma client
|
|
84
|
+
- `npm run db:push` - Push schema changes to database
|
|
85
|
+
- `npm run db:migrate` - Create and apply migrations
|
|
86
|
+
- `npm run db:studio` - Open Prisma Studio
|
|
87
|
+
|
|
88
|
+
## Adding Tables
|
|
89
|
+
|
|
90
|
+
To add tables to your database:
|
|
91
|
+
|
|
92
|
+
1. Edit `prisma/schema.prisma` and add your models
|
|
93
|
+
2. Run `npm run generate` to update the Prisma client
|
|
94
|
+
3. Run `npm run db:push` to apply changes to your database
|
|
95
|
+
|
|
96
|
+
Example model:
|
|
97
|
+
|
|
98
|
+
```prisma
|
|
99
|
+
model User {
|
|
100
|
+
id Int @id @default(autoincrement())
|
|
101
|
+
email String @unique
|
|
102
|
+
name String?
|
|
103
|
+
createdAt DateTime @default(now())
|
|
104
|
+
updatedAt DateTime @updatedAt
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
MIT
|
package/bin/db-cli.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from "child_process";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import { dirname, resolve } from "path";
|
|
5
|
+
import { existsSync } from "fs";
|
|
6
|
+
|
|
7
|
+
const args = process.argv.slice(2);
|
|
8
|
+
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = dirname(__filename);
|
|
11
|
+
const packageSchemaPath = resolve(__dirname, "../prisma/schema");
|
|
12
|
+
|
|
13
|
+
function ensureSchemaArg(passedArgs = []) {
|
|
14
|
+
const hasInline = passedArgs.some((a) => a.startsWith("--schema="));
|
|
15
|
+
const hasSplit = passedArgs.some(
|
|
16
|
+
(a, i) => a === "--schema" && passedArgs[i + 1]
|
|
17
|
+
);
|
|
18
|
+
if (hasInline || hasSplit) return passedArgs;
|
|
19
|
+
return ["--schema", packageSchemaPath, ...passedArgs];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function resolveLocalPrismaBin() {
|
|
23
|
+
const candidate = resolve(__dirname, "../node_modules/.bin/prisma");
|
|
24
|
+
if (existsSync(candidate)) return candidate;
|
|
25
|
+
try {
|
|
26
|
+
// Attempt to resolve prisma package location and derive bin path
|
|
27
|
+
const prismaPkgPath = require.resolve("prisma/package.json", {
|
|
28
|
+
paths: [resolve(__dirname, "..")],
|
|
29
|
+
});
|
|
30
|
+
const prismaDir = dirname(prismaPkgPath);
|
|
31
|
+
const binCandidate = resolve(prismaDir, "../.bin/prisma");
|
|
32
|
+
if (existsSync(binCandidate)) return binCandidate;
|
|
33
|
+
} catch {}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function runPrisma(subcommandParts, extra = []) {
|
|
38
|
+
let finalArgs = extra;
|
|
39
|
+
if (subcommandParts != "migrate") {
|
|
40
|
+
finalArgs = ensureSchemaArg(extra);
|
|
41
|
+
}
|
|
42
|
+
const localBin = resolveLocalPrismaBin();
|
|
43
|
+
const command = localBin || "npx";
|
|
44
|
+
const args = localBin
|
|
45
|
+
? [...subcommandParts, ...finalArgs]
|
|
46
|
+
: ["--yes", "prisma", ...subcommandParts, ...finalArgs];
|
|
47
|
+
const child = spawn(command, args, {
|
|
48
|
+
stdio: "inherit",
|
|
49
|
+
shell: process.platform === "win32",
|
|
50
|
+
});
|
|
51
|
+
child.on("close", (code) => process.exit(code));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const [cmd, ...rest] = args;
|
|
55
|
+
|
|
56
|
+
switch (cmd) {
|
|
57
|
+
case "migrate":
|
|
58
|
+
runPrisma(["migrate"], rest);
|
|
59
|
+
case "migrate:deploy":
|
|
60
|
+
runPrisma(["migrate", "deploy"], rest);
|
|
61
|
+
break;
|
|
62
|
+
case "migrate:dev":
|
|
63
|
+
runPrisma(["migrate", "dev"], rest);
|
|
64
|
+
break;
|
|
65
|
+
case "migrate:reset":
|
|
66
|
+
runPrisma(["migrate", "reset"], rest);
|
|
67
|
+
break;
|
|
68
|
+
case "migrate": {
|
|
69
|
+
const sub = (rest[0] || "").toLowerCase();
|
|
70
|
+
if (sub === "dev") {
|
|
71
|
+
runPrisma(["migrate", "dev"], rest.slice(1));
|
|
72
|
+
} else if (sub === "deploy") {
|
|
73
|
+
runPrisma(["migrate", "deploy"], rest.slice(1));
|
|
74
|
+
} else if (sub === "reset") {
|
|
75
|
+
const filtered = rest.filter(
|
|
76
|
+
(a) => a.toLowerCase() !== "reset" && a.toLowerCase() !== "all"
|
|
77
|
+
);
|
|
78
|
+
runPrisma(["migrate", "reset"], filtered);
|
|
79
|
+
} else {
|
|
80
|
+
console.log(
|
|
81
|
+
"Unknown migrate subcommand. Available: migrate dev|deploy|reset [all]"
|
|
82
|
+
);
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
case "studio":
|
|
88
|
+
runPrisma(["studio"], rest);
|
|
89
|
+
break;
|
|
90
|
+
case "generate":
|
|
91
|
+
runPrisma(["generate"], rest);
|
|
92
|
+
break;
|
|
93
|
+
case "db:push":
|
|
94
|
+
runPrisma(["db", "push"], rest);
|
|
95
|
+
break;
|
|
96
|
+
case "db":
|
|
97
|
+
if (rest[0] === "push") {
|
|
98
|
+
runPrisma(["db", "push"], rest.slice(1));
|
|
99
|
+
} else {
|
|
100
|
+
console.log("Unknown db subcommand. Available: db push");
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
break;
|
|
104
|
+
case "reset:all":
|
|
105
|
+
// Convenience alias: full reset using migrate reset
|
|
106
|
+
runPrisma(["migrate", "reset"], rest);
|
|
107
|
+
break;
|
|
108
|
+
default:
|
|
109
|
+
console.log(`Unknown command: ${cmd}`);
|
|
110
|
+
console.log(
|
|
111
|
+
"Available: migrate:deploy | migrate:dev | migrate:reset | db:push | db push | studio | generate | reset:all"
|
|
112
|
+
);
|
|
113
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./index"
|
package/client/client.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./index"
|
package/client/edge.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./default"
|