Skip to content

Commit ca05f6d

Browse files
authored
Merge pull request #44 from zenstackhq/dev
merge dev to main
2 parents 2db2993 + c7e9057 commit ca05f6d

File tree

200 files changed

+9979
-15899
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

200 files changed

+9979
-15899
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/workflows/build-test.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: Build and Test
22

33
on:
44
pull_request:
@@ -69,9 +69,5 @@ jobs:
6969
- name: Lint
7070
run: pnpm run lint
7171

72-
# install again for internal dependencies
73-
- name: Install internal dependencies
74-
run: pnpm install --frozen-lockfile
75-
7672
- name: Test
7773
run: pnpm run test

.github/workflows/bump-version.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Bump Version
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: write
8+
pull-requests: write
9+
10+
jobs:
11+
bump-version:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
ref: dev
19+
20+
- name: Install pnpm
21+
uses: pnpm/action-setup@v2
22+
with:
23+
version: 10.12.1
24+
25+
- name: Use Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 20.x
29+
cache: 'pnpm'
30+
31+
- name: Install dependencies
32+
run: pnpm install --frozen-lockfile
33+
34+
- name: Bump version
35+
run: pnpm run bump-version
36+
37+
- name: Create PR
38+
uses: peter-evans/create-pull-request@v7
39+
with:
40+
commit-message: 'chore: bump version'
41+
title: '[CI] Bump version'
42+
body: Automated changes for bumping version
43+
branch: chore/ci-bump-version
44+
branch-suffix: timestamp

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"tabWidth": 4,
3+
"useTabs": false,
4+
"printWidth": 120,
5+
"singleQuote": true
6+
}

.vscode/tasks.json

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,52 @@
44
"version": "2.0.0",
55
"tasks": [
66
{
7-
"label": "Build z-model-language",
8-
"command": "npm run langium:generate && npm run build",
7+
"label": "Build all",
8+
"command": "pnpm build",
99
"type": "shell",
1010
"group": {
1111
"kind": "build",
1212
"isDefault": true
1313
},
14-
"detail": "Langium: Generate grammar and build the z-model-language language",
1514
"icon": {
1615
"color": "terminal.ansiGreen",
1716
"id": "server-process"
1817
}
18+
},
19+
{
20+
"label": "Build all - watch",
21+
"command": "turbo watch build",
22+
"type": "shell",
23+
"group": {
24+
"kind": "build"
25+
},
26+
"icon": {
27+
"color": "terminal.ansiBlue",
28+
"id": "server-process"
29+
}
30+
},
31+
{
32+
"label": "Lint all",
33+
"command": "pnpm lint",
34+
"type": "shell",
35+
"icon": {
36+
"color": "terminal.ansiYellow",
37+
"id": "server-process"
38+
},
39+
"problemMatcher": []
40+
},
41+
{
42+
"label": "Test all",
43+
"command": "pnpm test",
44+
"type": "shell",
45+
"group": {
46+
"kind": "test",
47+
"isDefault": true
48+
},
49+
"icon": {
50+
"color": "terminal.ansiMagenta",
51+
"id": "server-process"
52+
}
1953
}
2054
]
2155
}

NEW-FEATURES.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

README.md

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424

2525
ZenStack is a TypeScript database toolkit for developing full-stack or backend Node.js/Bun applications. It provides a unified data modeling and access solution with the following features:
2626

27-
- A modern schema-first ORM that's compatible with [Prisma](https://github.com/prisma/prisma)'s schema and API
28-
- Versatile data access APIs: high-level (Prisma-style) ORM queries + low-level ([Kysely](https://github.com/kysely-org/kysely)) query builder
29-
- Built-in access control and data validation
30-
- Advanced data modeling patterns like [polymorphism](https://zenstack.dev/blog/polymorphism)
31-
- Designed for extensibility and flexibility: plugins, life-cycle hooks, etc.
32-
- Automatic CRUD web APIs with adapters for popular frameworks
33-
- Automatic [TanStack Query](https://github.com/TanStack/query) hooks for easy CRUD from the frontend
27+
- A modern schema-first ORM that's compatible with [Prisma](https://github.com/prisma/prisma)'s schema and API
28+
- Versatile data access APIs: high-level (Prisma-style) ORM queries + low-level ([Kysely](https://github.com/kysely-org/kysely)) query builder
29+
- Built-in access control and data validation
30+
- Advanced data modeling patterns like [polymorphism](https://zenstack.dev/blog/polymorphism)
31+
- Designed for extensibility and flexibility: plugins, life-cycle hooks, etc.
32+
- Automatic CRUD web APIs with adapters for popular frameworks
33+
- Automatic [TanStack Query](https://github.com/TanStack/query) hooks for easy CRUD from the frontend
3434

3535
# What's new with V3
3636

@@ -83,10 +83,10 @@ Then create a `zenstack` folder and a `schema.zmodel` file in it.
8383

8484
ZenStack uses a DSL named ZModel to model different aspects of database:
8585

86-
- Tables and fields
87-
- Validation rules (coming soon)
88-
- Access control policies (coming soon)
89-
- ...
86+
- Tables and fields
87+
- Validation rules (coming soon)
88+
- Access control policies (coming soon)
89+
- ...
9090

9191
ZModel is a super set of [Prisma Schema Language](https://www.prisma.io/docs/orm/prisma-schema/overview), i.e., every valid Prisma schema is a valid ZModel.
9292

@@ -280,18 +280,20 @@ You can use a plugin to achieve the following goals:
280280
281281
#### 1. ORM query interception
282282
283-
ORM query interception allows you to intercept the high-level ORM API calls.
283+
ORM query interception allows you to intercept the high-level ORM API calls. The interceptor's configuration is compatible with Prisma's [query client extension](https://www.prisma.io/docs/orm/prisma-client/client-extensions/query).
284284
285285
```ts
286286
client.$use({
287287
id: 'cost-logger',
288-
async onQuery({ model, operation, proceed, queryArgs }) {
289-
const start = Date.now();
290-
const result = await proceed(queryArgs);
291-
console.log(
292-
`[cost] ${model} ${operation} took ${Date.now() - start}ms`
293-
);
294-
return result;
288+
onQuery: {
289+
$allModels: {
290+
$allOperations: async ({ model, operation, args, query }) => {
291+
const start = Date.now();
292+
const result = await query(args);
293+
console.log(`[cost] ${model} ${operation} took ${Date.now() - start}ms`);
294+
return result;
295+
},
296+
},
295297
},
296298
});
297299
```
@@ -365,19 +367,19 @@ client.$use({
365367

366368
ZenStack v3 delegates database schema migration to Prisma. The CLI provides Prisma CLI wrappers for managing migrations.
367369

368-
- Sync schema to dev database and create a migration record:
370+
- Sync schema to dev database and create a migration record:
369371

370372
```bash
371373
npx zenstack migrate dev
372374
```
373375

374-
- Deploy new migrations:
376+
- Deploy new migrations:
375377

376378
```bash
377379
npx zenstack migrate deploy
378380
```
379381

380-
- Reset dev database
382+
- Reset dev database
381383

382384
```bash
383385
npx zenstack migrate reset

0 commit comments

Comments
 (0)