Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into v2
Browse files Browse the repository at this point in the history
  • Loading branch information
ymc9 committed Mar 21, 2024
2 parents 16cceda + 1ae38c1 commit 213fdf3
Show file tree
Hide file tree
Showing 31 changed files with 353 additions and 83 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/update-samples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Update Samples

on:
release:
types: [published]

jobs:
dispatch:
runs-on: ubuntu-latest

strategy:
matrix:
repo:
[
'zenstackhq/sample-todo-nextjs',
'zenstackhq/sample-todo-nextjs-tanstack',
'zenstackhq/sample-todo-trpc',
'zenstackhq/sample-todo-sveltekit',
]

steps:
- name: Repository Dispatch
uses: peter-evans/[email protected]
with:
token: ${{ secrets.RELEASE_TRIGGER_TOKEN }}
repository: ${{ matrix.repo }}
event-type: zenstack-release
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ Thank you for your support!
<td align="center"><a href="https://github.com/j0hannr"><img src="https://avatars.githubusercontent.com/u/52762073?v=4" width="100" style="border-radius:50%" alt="Johann Rohn"/><br />Johann Rohn</a></td>

<td align="center"><a href="https://github.com/baenie"><img src="https://avatars.githubusercontent.com/u/58309104?v=4" width="100" style="border-radius:50%" alt="Benjamin Zecirovic"/><br />Benjamin Zecirovic</a></td>
<td align="center"><a href="https://github.com/iamfj"><img src="https://avatars.githubusercontent.com/u/24557998?v=4" width="100" style="border-radius:50%" alt="Fabian Jocks"/><br />Fabian Jocks</a></td>

</tr>
</table>

Expand Down
13 changes: 12 additions & 1 deletion packages/ide/jetbrains/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,15 @@

## 1.7.0
### Added
- Auto-completion is now supported inside attributes.

- Added support to complex usage of `@@index` attribute like `@@index([content(ops: raw("gin_trgm_ops"))], type: Gin)`.

### Fixed

- Fixed several ZModel validation issues related to model inheritance.

## 1.7.0

### Added

- Auto-completion is now supported inside attributes.
2 changes: 1 addition & 1 deletion packages/language/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"generate": "langium generate && npx ts-node script/generate-plist.ts",
"watch": "concurrently \"langium generate --watch\" \"tsc --watch\"",
"lint": "eslint src --ext ts",
"build": "pnpm lint --max-warnings=0 && pnpm clean && pnpm generate && tsc && copyfiles -F ./README.md ./LICENSE ./package.json 'syntaxes/**/*' dist && pnpm pack dist --pack-destination '../../../.build'",
"build": "pnpm lint --max-warnings=0 && pnpm clean && pnpm generate && tsc && copyfiles -F ./README.md ./LICENSE ./package.json 'syntaxes/**/*' dist && pnpm pack dist --pack-destination ../../../.build",
"prepublishOnly": "pnpm build"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/misc/redwood/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"scripts": {
"clean": "rimraf dist",
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && pnpm pack dist --pack-destination '../../../.build'",
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && pnpm pack dist --pack-destination ../../../.build",
"watch": "tsc --watch",
"lint": "eslint src --ext ts",
"prepublishOnly": "pnpm build"
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/openapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"scripts": {
"clean": "rimraf dist",
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && copyfiles ./package.json ./README.md ./LICENSE dist && copyfiles -u 1 ./src/plugin.zmodel dist && pnpm pack dist --pack-destination '../../../../.build'",
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && copyfiles ./package.json ./README.md ./LICENSE dist && copyfiles -u 1 ./src/plugin.zmodel dist && pnpm pack dist --pack-destination ../../../../.build",
"watch": "tsc --watch",
"lint": "eslint src --ext ts",
"test": "jest",
Expand Down
18 changes: 10 additions & 8 deletions packages/plugins/openapi/tests/openapi-restful.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@
import OpenAPIParser from '@readme/openapi-parser';
import { getLiteral, getObjectLiteral } from '@zenstackhq/sdk';
import { Model, Plugin, isPlugin } from '@zenstackhq/sdk/ast';
import { loadZModelAndDmmf } from '@zenstackhq/testtools';
import { loadZModelAndDmmf, normalizePath } from '@zenstackhq/testtools';
import fs from 'fs';
import path from 'path';
import * as tmp from 'tmp';
import YAML from 'yaml';
import generate from '../src';

tmp.setGracefulCleanup();

describe('Open API Plugin RESTful Tests', () => {
it('run plugin', async () => {
for (const specVersion of ['3.0.0', '3.1.0']) {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
specVersion = '${specVersion}'
}
Expand Down Expand Up @@ -114,7 +116,7 @@ model Bar {
it('options', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
specVersion = '3.0.0'
title = 'My Awesome API'
version = '1.0.0'
Expand Down Expand Up @@ -151,7 +153,7 @@ model User {
it('security schemes valid', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
securitySchemes = {
myBasic: { type: 'http', scheme: 'basic' },
myBearer: { type: 'http', scheme: 'bearer', bearerFormat: 'JWT' },
Expand Down Expand Up @@ -198,7 +200,7 @@ model Post {
it('security model level override', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
securitySchemes = {
myBasic: { type: 'http', scheme: 'basic' }
}
Expand Down Expand Up @@ -230,7 +232,7 @@ model User {
it('security schemes invalid', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
securitySchemes = {
myBasic: { type: 'invalid', scheme: 'basic' }
}
Expand All @@ -251,7 +253,7 @@ model User {
it('ignored model used as relation', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
}
model User {
Expand Down Expand Up @@ -284,7 +286,7 @@ model Post {
for (const specVersion of ['3.0.0', '3.1.0']) {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
specVersion = '${specVersion}'
}
Expand Down
26 changes: 14 additions & 12 deletions packages/plugins/openapi/tests/openapi-rpc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@
import OpenAPIParser from '@readme/openapi-parser';
import { getLiteral, getObjectLiteral } from '@zenstackhq/sdk';
import { Model, Plugin, isPlugin } from '@zenstackhq/sdk/ast';
import { loadZModelAndDmmf } from '@zenstackhq/testtools';
import { loadZModelAndDmmf, normalizePath } from '@zenstackhq/testtools';
import fs from 'fs';
import path from 'path';
import * as tmp from 'tmp';
import YAML from 'yaml';
import generate from '../src';

tmp.setGracefulCleanup();

describe('Open API Plugin RPC Tests', () => {
it('run plugin', async () => {
for (const specVersion of ['3.0.0', '3.1.0']) {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
specVersion = '${specVersion}'
}
Expand Down Expand Up @@ -127,7 +129,7 @@ model Bar {
it('options', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
specVersion = '3.0.0'
title = 'My Awesome API'
version = '1.0.0'
Expand Down Expand Up @@ -164,7 +166,7 @@ model User {
it('security schemes valid', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
securitySchemes = {
myBasic: { type: 'http', scheme: 'basic' },
myBearer: { type: 'http', scheme: 'bearer', bearerFormat: 'JWT' },
Expand Down Expand Up @@ -198,7 +200,7 @@ model User {
it('security schemes invalid', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
securitySchemes = {
myBasic: { type: 'invalid', scheme: 'basic' }
}
Expand All @@ -219,7 +221,7 @@ model User {
it('security model level override', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
securitySchemes = {
myBasic: { type: 'http', scheme: 'basic' }
}
Expand Down Expand Up @@ -247,7 +249,7 @@ model User {
it('security operation level override', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
securitySchemes = {
myBasic: { type: 'http', scheme: 'basic' }
}
Expand Down Expand Up @@ -280,7 +282,7 @@ model User {
it('security inferred', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
securitySchemes = {
myBasic: { type: 'http', scheme: 'basic' }
}
Expand All @@ -306,7 +308,7 @@ model User {
it('v3.1.0 fields', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
summary = 'awesome api'
}
Expand All @@ -330,7 +332,7 @@ model User {
it('ignored model used as relation', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
}
model User {
Expand Down Expand Up @@ -362,7 +364,7 @@ model Post {
for (const specVersion of ['3.0.0', '3.1.0']) {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
specVersion = '${specVersion}'
}
Expand Down Expand Up @@ -408,7 +410,7 @@ generator js {
}
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
}
enum role {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/swr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"scripts": {
"clean": "rimraf dist",
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && tsup-node --config ./tsup.config.ts && copyfiles ./package.json ./README.md ./LICENSE dist && pnpm pack dist --pack-destination '../../../../.build'",
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && tsup-node --config ./tsup.config.ts && copyfiles ./package.json ./README.md ./LICENSE dist && pnpm pack dist --pack-destination ../../../../.build",
"watch": "concurrently \"tsc --watch\" \"tsup-node --config ./tsup.config.ts --watch\"",
"lint": "eslint src --ext ts",
"test": "jest",
Expand Down
6 changes: 3 additions & 3 deletions packages/plugins/swr/tests/swr.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="@types/jest" />

import { loadSchema } from '@zenstackhq/testtools';
import { loadSchema, normalizePath } from '@zenstackhq/testtools';
import path from 'path';

describe('SWR Plugin Tests', () => {
Expand Down Expand Up @@ -50,7 +50,7 @@ model Foo {
await loadSchema(
`
plugin swr {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
output = '$projectRoot/hooks'
}
Expand All @@ -60,7 +60,7 @@ ${sharedModel}
provider: 'postgresql',
pushDb: false,
extraDependencies: [
path.resolve(__dirname, '../dist'),
`${normalizePath(path.join(__dirname, '../dist'))}`,
'[email protected]',
'@types/[email protected]',
'swr@^2',
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/tanstack-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
},
"scripts": {
"clean": "rimraf dist",
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && tsup-node --config ./tsup.config.ts && tsup-node --config ./tsup-v5.config.ts && node scripts/postbuild && copyfiles ./package.json ./README.md ./LICENSE dist && pnpm pack dist --pack-destination '../../../../.build'",
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && tsup-node --config ./tsup.config.ts && tsup-node --config ./tsup-v5.config.ts && node scripts/postbuild && copyfiles ./package.json ./README.md ./LICENSE dist && pnpm pack dist --pack-destination ../../../../.build",
"watch": "concurrently \"tsc --watch\" \"tsup-node --config ./tsup.config.ts --watch\" \"tsup-node --config ./tsup-v5.config.ts --watch\"",
"lint": "eslint src --ext ts",
"test": "jest",
Expand Down
14 changes: 7 additions & 7 deletions packages/plugins/tanstack-query/tests/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="@types/jest" />

import { loadSchema } from '@zenstackhq/testtools';
import { loadSchema, normalizePath } from '@zenstackhq/testtools';
import path from 'path';

describe('Tanstack Query Plugin Tests', () => {
Expand Down Expand Up @@ -50,7 +50,7 @@ model Foo {
await loadSchema(
`
plugin tanstack {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
output = '$projectRoot/hooks'
target = 'react'
version = 'v4'
Expand All @@ -72,7 +72,7 @@ ${sharedModel}
await loadSchema(
`
plugin tanstack {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
output = '$projectRoot/hooks'
target = 'react'
}
Expand All @@ -93,7 +93,7 @@ ${sharedModel}
await loadSchema(
`
plugin tanstack {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
output = '$projectRoot/hooks'
target = 'vue'
version = 'v4'
Expand All @@ -115,7 +115,7 @@ ${sharedModel}
await loadSchema(
`
plugin tanstack {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
output = '$projectRoot/hooks'
target = 'vue'
}
Expand All @@ -136,7 +136,7 @@ ${sharedModel}
await loadSchema(
`
plugin tanstack {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
output = '$projectRoot/hooks'
target = 'svelte'
version = 'v4'
Expand All @@ -158,7 +158,7 @@ ${sharedModel}
await loadSchema(
`
plugin tanstack {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
output = '$projectRoot/hooks'
target = 'svelte'
}
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/trpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"scripts": {
"clean": "rimraf dist",
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && copyfiles ./package.json ./README.md ./LICENSE 'res/**/*' dist && pnpm pack dist --pack-destination '../../../../.build'",
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && copyfiles ./package.json ./README.md ./LICENSE 'res/**/*' dist && pnpm pack dist --pack-destination ../../../../.build",
"watch": "tsc --watch",
"lint": "eslint src --ext ts",
"test": "jest",
Expand Down
Loading

0 comments on commit 213fdf3

Please sign in to comment.