wabe-postgres 0.5.1 → 0.5.3
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 +113 -39
- package/package.json +32 -30
- package/src/index.test.ts +2183 -0
- package/src/index.ts +766 -0
- package/tsconfig.json +31 -0
- package/utils/preload.ts +1 -1
- package/utils/testHelper.ts +110 -108
- package/bunfig.toml +0 -4
- package/dist/index.d.ts +0 -74
- package/dist/index.js +0 -5313
package/README.md
CHANGED
|
@@ -1,52 +1,126 @@
|
|
|
1
|
-
|
|
2
|
-
<a href="https://wabe.dev"><img src="https://wabe.dev/assets/logo.png" alt="Wabe logo" height=170></a>
|
|
3
|
-
</p>
|
|
1
|
+
# Wabe
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
<a href="https://wabe.dev">Documentation</a>
|
|
7
|
-
</div>
|
|
3
|
+
📚 **Documentation:** [https://palixir.github.io/wabe](https://palixir.github.io/wabe)
|
|
8
4
|
|
|
9
|
-
|
|
5
|
+
**Create your backend without vendor lock-in**
|
|
10
6
|
|
|
11
|
-
Wabe is an open-source backend
|
|
7
|
+
Wabe is an open-source backend-as-a-service (BaaS) built in TypeScript, designed to let you quickly create a complete and secure backend for your Node.js / Bun apps.
|
|
8
|
+
It handles the “infrastructure” you don’t want to reinvent: database, GraphQL API, authentication, permissions, emails, file uploads, hooks and more.
|
|
12
9
|
|
|
13
|
-
|
|
10
|
+
---
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
bun install wabe # On bun
|
|
17
|
-
npm install wabe # On npm
|
|
18
|
-
yarn add wabe # On yarn
|
|
12
|
+
## 🧭 Why Wabe?
|
|
19
13
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
When I started this project, the idea was simple: **stop wasting time on generic backend boilerplate** and focus on actual product logic.
|
|
15
|
+
Too often, developers build ad-hoc backends that quickly lack security, flexibility, or maintainability.
|
|
16
|
+
|
|
17
|
+
With Wabe, the goal is to have a **modular, extensible, production-ready backend** you can use out of the box.
|
|
18
|
+
|
|
19
|
+
Why Wabe might be interesting for you:
|
|
20
|
+
|
|
21
|
+
- ✅ **Productivity**: spin up a full backend in a few lines of code.
|
|
22
|
+
- ✅ **All-in-one but modular**: authentication, permissions, storage, emails, etc. Replace or extend as needed.
|
|
23
|
+
- ✅ **Secure by default**: fine-grained permissions, roles, object-level access control.
|
|
24
|
+
- ✅ **GraphQL API**: type-safe, auto-generated CRUD resolvers.
|
|
25
|
+
- ✅ **Hooks & events**: plug into operations without hacking the core.
|
|
26
|
+
- ✅ **Scalable**: built with real-world apps in mind.
|
|
27
|
+
- ✅ **Open source**: no vendor lock-in, fully transparent.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## ✨ Key Features
|
|
32
|
+
|
|
33
|
+
| Feature | What it gives you | Notes |
|
|
34
|
+
| ----------------------- | ------------------------------------------ | --------------------------------- |
|
|
35
|
+
| **Authentication** | Email/password + OAuth (Google, GitHub, …) | Add more providers easily |
|
|
36
|
+
| **Permissions** | Roles, ACL, per-object access | Strong security layer |
|
|
37
|
+
| **Database & API** | Connect (Mongo, etc.), auto-generated CRUD | Typed GraphQL interface |
|
|
38
|
+
| **Schema & migrations** | Define models, custom scalars, versioning | Keeps schema evolution in sync |
|
|
39
|
+
| **Hooks & triggers** | Run code before/after actions | Validation, transformation, audit |
|
|
40
|
+
| **Emails** | Resend integration, and generic adapter | Notifications, email verification |
|
|
41
|
+
| **File storage** | Upload to S3, GCS, or custom | Assets, images, documents |
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 🚀 Installation & Quick start
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# with npm
|
|
49
|
+
npm install wabe-postgres
|
|
50
|
+
|
|
51
|
+
# with yarn
|
|
52
|
+
yarn add wabe-postgres
|
|
53
|
+
|
|
54
|
+
# with Bun
|
|
55
|
+
bun install wabe-postgres
|
|
23
56
|
```
|
|
24
57
|
|
|
25
|
-
## Basic example
|
|
58
|
+
## 🎯 Basic example
|
|
26
59
|
|
|
27
60
|
```ts
|
|
28
|
-
import { Wabe } from
|
|
29
|
-
import { MongoAdapter } from
|
|
61
|
+
import { Wabe } from 'wabe'
|
|
62
|
+
import { MongoAdapter } from 'wabe-mongodb'
|
|
30
63
|
|
|
31
64
|
const run = async () => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
await run()
|
|
65
|
+
// Ensure your database is running before run the file
|
|
66
|
+
|
|
67
|
+
const wabe = new Wabe({
|
|
68
|
+
isProduction: process.env.NODE_ENV === 'production',
|
|
69
|
+
// Root key example (must be long minimal 64 characters, you can generate it online)
|
|
70
|
+
rootKey:
|
|
71
|
+
'0uwFvUxM$ceFuF1aEtTtZMa7DUN2NZudqgY5ve5W*QCyb58cwMj9JeoaV@d#%29v&aJzswuudVU1%nAT+rxS0Bh&OkgBYc0PH18*',
|
|
72
|
+
database: {
|
|
73
|
+
adapter: new MongoAdapter({
|
|
74
|
+
databaseName: 'WabeApp',
|
|
75
|
+
databaseUrl: 'mongodb://127.0.0.1:27045',
|
|
76
|
+
}),
|
|
77
|
+
},
|
|
78
|
+
port: 3000,
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
await wabe.start()
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
await run()
|
|
52
85
|
```
|
|
86
|
+
|
|
87
|
+
Then, from your frontend, call the auto-generated GraphQL API:
|
|
88
|
+
|
|
89
|
+
```GraphQL
|
|
90
|
+
mutation createUsers($input: CreateUsersInput!) {
|
|
91
|
+
createUsers(input: $input) {
|
|
92
|
+
edges {
|
|
93
|
+
node {
|
|
94
|
+
id
|
|
95
|
+
name
|
|
96
|
+
age
|
|
97
|
+
isAdmin
|
|
98
|
+
floatValue
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## 🌱 Contributing
|
|
106
|
+
|
|
107
|
+
Contributions are always welcome! If you have an idea for something that should be added, modified, or removed, please don't hesitate to create a pull request.
|
|
108
|
+
|
|
109
|
+
You can also create an issue to propose your ideas or report a bug.
|
|
110
|
+
|
|
111
|
+
You can help in many ways:
|
|
112
|
+
|
|
113
|
+
- Report bugs or open issues
|
|
114
|
+
- Submit pull requests (features, fixes, optimizations)
|
|
115
|
+
- Improve docs, guides, and examples
|
|
116
|
+
- Spread the word (blog posts, videos, tweets)
|
|
117
|
+
|
|
118
|
+
Of course, you can also use Wabe for your backend ❤️.
|
|
119
|
+
|
|
120
|
+
If you like the project don't forget to share it.
|
|
121
|
+
|
|
122
|
+
More information on the [Contribution guide](https://github.com/palixir/wabe/blob/main/CONTRIBUTING.md)
|
|
123
|
+
|
|
124
|
+
## License
|
|
125
|
+
|
|
126
|
+
Distributed under the Apache License 2.0 [License](https://github.com/palixir/wabe/blob/main/LICENSE).
|
package/package.json
CHANGED
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
2
|
+
"name": "wabe-postgres",
|
|
3
|
+
"version": "0.5.3",
|
|
4
|
+
"description": "PostgreSQL adapter for Wabe (official)",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"adapter",
|
|
7
|
+
"database",
|
|
8
|
+
"postgres",
|
|
9
|
+
"postgresql",
|
|
10
|
+
"wabe"
|
|
11
|
+
],
|
|
12
|
+
"license": "Apache-2.0",
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "dist/index.js",
|
|
15
|
+
"types": "dist/index.d.ts",
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "bun --filter wabe-build build:package $(pwd)",
|
|
18
|
+
"check": "tsc --project $(pwd)/tsconfig.json",
|
|
19
|
+
"lint": "oxlint .",
|
|
20
|
+
"ci": "bun check && bun lint $(pwd) && bun test src --timeout 60000",
|
|
21
|
+
"format": "oxfmt --write ."
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"p-retry": "7.1.0",
|
|
25
|
+
"pg": "8.16.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/pg": "8.11.11",
|
|
29
|
+
"get-port": "7.1.0",
|
|
30
|
+
"uuid": "13.0.0",
|
|
31
|
+
"wabe": "0.6.12",
|
|
32
|
+
"wabe-postgres-launcher": "0.5.0"
|
|
33
|
+
}
|
|
32
34
|
}
|