Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

22 changes: 0 additions & 22 deletions .eslintrc.json

This file was deleted.

6 changes: 1 addition & 5 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Build and Test

on:
pull_request:
Expand Down Expand Up @@ -69,9 +69,5 @@ jobs:
- name: Lint
run: pnpm run lint

# install again for internal dependencies
- name: Install internal dependencies
run: pnpm install --frozen-lockfile

- name: Test
run: pnpm run test
44 changes: 44 additions & 0 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Bump Version

on:
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
bump-version:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: dev

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 10.12.1

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Bump version
run: pnpm run bump-version

- name: Create PR
uses: peter-evans/create-pull-request@v7
with:
commit-message: 'chore: bump version'
title: '[CI] Bump version'
body: Automated changes for bumping version
branch: chore/ci-bump-version
branch-suffix: timestamp
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"tabWidth": 4,
"useTabs": false,
"printWidth": 120,
"singleQuote": true
}
40 changes: 37 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,52 @@
"version": "2.0.0",
"tasks": [
{
"label": "Build z-model-language",
"command": "npm run langium:generate && npm run build",
"label": "Build all",
"command": "pnpm build",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Langium: Generate grammar and build the z-model-language language",
"icon": {
"color": "terminal.ansiGreen",
"id": "server-process"
}
},
{
"label": "Build all - watch",
"command": "turbo watch build",
"type": "shell",
"group": {
"kind": "build"
},
"icon": {
"color": "terminal.ansiBlue",
"id": "server-process"
}
},
{
"label": "Lint all",
"command": "pnpm lint",
"type": "shell",
"icon": {
"color": "terminal.ansiYellow",
"id": "server-process"
},
"problemMatcher": []
},
{
"label": "Test all",
"command": "pnpm test",
"type": "shell",
"group": {
"kind": "test",
"isDefault": true
},
"icon": {
"color": "terminal.ansiMagenta",
"id": "server-process"
}
}
]
}
2 changes: 0 additions & 2 deletions NEW-FEATURES.md

This file was deleted.

46 changes: 24 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@

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:

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

# What's new with V3

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

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

- Tables and fields
- Validation rules (coming soon)
- Access control policies (coming soon)
- ...
- Tables and fields
- Validation rules (coming soon)
- Access control policies (coming soon)
- ...

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.

Expand Down Expand Up @@ -280,18 +280,20 @@ You can use a plugin to achieve the following goals:

#### 1. ORM query interception

ORM query interception allows you to intercept the high-level ORM API calls.
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).

```ts
client.$use({
id: 'cost-logger',
async onQuery({ model, operation, proceed, queryArgs }) {
const start = Date.now();
const result = await proceed(queryArgs);
console.log(
`[cost] ${model} ${operation} took ${Date.now() - start}ms`
);
return result;
onQuery: {
$allModels: {
$allOperations: async ({ model, operation, args, query }) => {
const start = Date.now();
const result = await query(args);
console.log(`[cost] ${model} ${operation} took ${Date.now() - start}ms`);
return result;
},
},
},
});
```
Expand Down Expand Up @@ -365,19 +367,19 @@ client.$use({

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

- Sync schema to dev database and create a migration record:
- Sync schema to dev database and create a migration record:

```bash
npx zenstack migrate dev
```

- Deploy new migrations:
- Deploy new migrations:

```bash
npx zenstack migrate deploy
```

- Reset dev database
- Reset dev database

```bash
npx zenstack migrate reset
Expand Down
Loading