Skip to content

Commit 2db2993

Browse files
authored
Merge pull request #31 from zenstackhq/dev
merge dev to main (3.0.0-alpha.4)
2 parents 77ea76c + 30d1141 commit 2db2993

File tree

17 files changed

+102
-19
lines changed

17 files changed

+102
-19
lines changed

README.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,14 @@ For SQLite:
100100

101101
```bash
102102
npm install better-sqlite3
103+
npm install -D @types/better-sqlite3
103104
```
104105

105106
For Postgres:
106107

107108
```bash
108-
npm install pg
109+
npm install pg pg-connection-string
110+
npm install -D @types/pg
109111
```
110112

111113
## Pushing schema to the database
@@ -132,14 +134,32 @@ A `schema.ts` file will be created inside the `zenstack` folder. The file should
132134

133135
## Creating ZenStack client
134136

135-
Now you can use the compiled TypeScript schema to instantiate a database client:
137+
Now you can use the compiled TypeScript schema to instantiate a database client.
138+
139+
### SQLite
136140

137141
```ts
138142
import { ZenStackClient } from '@zenstackhq/runtime';
139143
import { schema } from './zenstack/schema';
144+
import SQLite from 'better-sqlite3';
140145

141146
const client = new ZenStackClient(schema, {
142-
dialectConfig: { ... }
147+
dialectConfig: { database: new SQLite('./dev.db') },
148+
});
149+
```
150+
151+
### Postgres
152+
153+
```ts
154+
import { ZenStackClient } from '@zenstackhq/runtime';
155+
import { schema } from './zenstack/schema';
156+
import { Pool } from 'pg';
157+
import { parseIntoClientConfig } from 'pg-connection-string';
158+
159+
const client = new ZenStackClient(schema, {
160+
dialectConfig: {
161+
pool: new Pool(parseIntoClientConfig(process.env.DATABASE_URL)),
162+
},
143163
});
144164
```
145165

@@ -376,6 +396,8 @@ See [Prisma Migrate](https://www.prisma.io/docs/orm/prisma-migrate) documentatio
376396
377397
# Limitations
378398
379-
1. Only SQLite (better-sqlite3) and Postgres (pg) database providers are supported.
399+
1. Only SQLite (better-sqlite3) and Postgres (pg) database providers are supported for now.
380400
1. Prisma client extensions are not supported.
381401
1. Prisma custom generators are not supported (may add support in the future).
402+
1. [Filtering on JSON fields](https://www.prisma.io/docs/orm/prisma-client/special-fields-and-types/working-with-json-fields#filter-on-a-json-field-advanced) is not supported yet.
403+
1. Raw SQL query APIs (`$queryRaw`, `$executeRaw`) are not supported.

TODO.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
- [x] generate
77
- [x] migrate
88
- [x] info
9-
- [ ] init
9+
- [x] init
1010
- [ ] ORM
1111
- [x] Create
1212
- [x] Input validation
@@ -36,6 +36,7 @@
3636
- [x] Sorting
3737
- [x] Pagination
3838
- [x] Distinct
39+
- [ ] JSON filtering
3940
- [x] Update
4041
- [x] Input validation
4142
- [x] Top-level
@@ -65,7 +66,6 @@
6566
- [ ] Error system
6667
- [x] Custom table name
6768
- [x] Custom field name
68-
- [ ] Strict undefined check
6969
- [ ] Implement changesets
7070
- [ ] Polymorphism
7171
- [ ] Validation

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zenstack-v3",
3-
"version": "3.0.0-alpha.2",
3+
"version": "3.0.0-alpha.4",
44
"description": "ZenStack",
55
"packageManager": "[email protected]",
66
"scripts": {

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"publisher": "zenstack",
44
"displayName": "ZenStack CLI",
55
"description": "FullStack database toolkit with built-in access control and automatic API generation.",
6-
"version": "3.0.0-alpha.2",
6+
"version": "3.0.0-alpha.4",
77
"type": "module",
88
"author": {
99
"name": "ZenStack Team"

packages/create-zenstack/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-zenstack",
3-
"version": "3.0.0-alpha.2",
3+
"version": "3.0.0-alpha.4",
44
"description": "Create a new ZenStack project",
55
"type": "module",
66
"scripts": {

packages/ide/vscode/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# ZenStack VS Code Extension
2+
3+
[ZenStack](https://zenstack.dev) is a toolkit that simplifies the development of a web app's backend. It enhances [Prisma ORM](https://prisma.io) with flexible Authorization and auto-generated, type-safe APIs/hooks, simplifying full-stack development.
4+
5+
This VS Code extension provides code editing helpers for authoring ZenStack's schema files (.zmodel files).
6+
7+
## Features
8+
9+
- Syntax highlighting of `*.zmodel` files
10+
11+
- In case the schema file is not recognized automatically, add the following to your settings.json file:
12+
13+
```json
14+
"files.associations": {
15+
"*.zmodel": "zmodel"
16+
},
17+
```
18+
19+
- Auto formatting
20+
21+
- To automatically format on save, add the following to your settings.json file:
22+
23+
```json
24+
"editor.formatOnSave": true
25+
```
26+
27+
- To enable formatting in combination with prettier, add the following to your settings.json file:
28+
```json
29+
"[zmodel]": {
30+
"editor.defaultFormatter": "zenstack.zenstack"
31+
},
32+
```
33+
34+
- Inline error reporting
35+
- Go-to definition
36+
- Hover documentation
37+
- Code section folding
38+
39+
## Links
40+
41+
- [Home](https://zenstack.dev)
42+
- [Documentation](https://zenstack.dev/docs)
43+
- [Community chat](https://discord.gg/Ykhr738dUe)
44+
- [Twitter](https://twitter.com/zenstackhq)
45+
- [Blog](https://dev.to/zenstack)
46+
47+
## Community
48+
49+
Join our [discord server](https://discord.gg/Ykhr738dUe) for chat and updates!
50+
51+
## License
52+
53+
[MIT](https://github.com/zenstackhq/zenstack/blob/main/LICENSE)

packages/ide/vscode/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "zenstack",
33
"publisher": "zenstack",
4-
"version": "3.0.0",
4+
"version": "3.0.2",
55
"displayName": "ZenStack Language Tools",
66
"description": "VSCode extension for ZenStack ZModel language",
77
"private": true,
88
"repository": {
99
"type": "git",
10-
"url": "https://github.com/zenstackhq/zenstack-v3"
10+
"url": "https://github.com/zenstackhq/zenstack"
1111
},
1212
"scripts": {
1313
"build": "tsc --noEmit && tsup",

packages/language/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/language",
33
"description": "ZenStack ZModel language specification",
4-
"version": "3.0.0-alpha.2",
4+
"version": "3.0.0-alpha.4",
55
"license": "MIT",
66
"author": "ZenStack Team",
77
"files": [

packages/runtime/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/runtime",
3-
"version": "3.0.0-alpha.2",
3+
"version": "3.0.0-alpha.4",
44
"description": "ZenStack Runtime",
55
"type": "module",
66
"scripts": {

packages/runtime/src/client/options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import type { ToKyselySchema } from './query-builder';
2424
type DialectConfig<Provider extends DataSourceProvider> =
2525
Provider['type'] extends 'sqlite'
2626
? Optional<SqliteDialectConfig, 'database'>
27-
: Provider extends 'postgresql'
27+
: Provider['type'] extends 'postgresql'
2828
? Optional<PostgresDialectConfig, 'pool'>
2929
: never;
3030

0 commit comments

Comments
 (0)