Skip to content

Commit bb5f290

Browse files
authored
merge dev to main (v2.7.3) (#1800)
2 parents dbe6bb9 + 74dd0f7 commit bb5f290

File tree

18 files changed

+133
-15
lines changed

18 files changed

+133
-15
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
on:
2+
release:
3+
types: [published]
4+
jobs:
5+
github-releases-to-discord:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Checkout
9+
uses: actions/checkout@v3
10+
- name: Github Releases To Discord
11+
uses: SethCohen/[email protected]
12+
with:
13+
webhook_url: ${{ secrets.RELEASE_TO_DISCORD_WEBHOOK_URL }}
14+
avatar_url: 'https://cdn.discordapp.com/avatars/1297059323314176051/df91181b3f1cf0ef1592fbe18e0962d7.webp?size=160'
15+
reduce_headings: true

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ The following diagram gives a high-level architecture overview of ZenStack.
172172
- [Fastify](https://zenstack.dev/docs/reference/server-adapters/fastify)
173173
- [ExpressJS](https://zenstack.dev/docs/reference/server-adapters/express)
174174
- [NestJS](https://zenstack.dev/docs/reference/server-adapters/nestjs)
175+
- [Hono](https://zenstack.dev/docs/reference/server-adapters/hono)
175176
- 🙋🏻 [Request for an adapter](https://discord.gg/Ykhr738dUe)
176177

177178
### Prisma schema extensions

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zenstack-monorepo",
3-
"version": "2.7.2",
3+
"version": "2.7.3",
44
"description": "",
55
"scripts": {
66
"build": "pnpm -r build",

packages/ide/jetbrains/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins {
99
}
1010

1111
group = "dev.zenstack"
12-
version = "2.7.2"
12+
version = "2.7.3"
1313

1414
repositories {
1515
mavenCentral()

packages/ide/jetbrains/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jetbrains",
3-
"version": "2.7.2",
3+
"version": "2.7.3",
44
"displayName": "ZenStack JetBrains IDE Plugin",
55
"description": "ZenStack JetBrains IDE plugin",
66
"homepage": "https://zenstack.dev",

packages/language/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/language",
3-
"version": "2.7.2",
3+
"version": "2.7.3",
44
"displayName": "ZenStack modeling language compiler",
55
"description": "ZenStack modeling language compiler",
66
"homepage": "https://zenstack.dev",

packages/misc/redwood/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/redwood",
33
"displayName": "ZenStack RedwoodJS Integration",
4-
"version": "2.7.2",
4+
"version": "2.7.3",
55
"description": "CLI and runtime for integrating ZenStack with RedwoodJS projects.",
66
"repository": {
77
"type": "git",

packages/plugins/openapi/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/openapi",
33
"displayName": "ZenStack Plugin and Runtime for OpenAPI",
4-
"version": "2.7.2",
4+
"version": "2.7.3",
55
"description": "ZenStack plugin and runtime supporting OpenAPI",
66
"main": "index.js",
77
"repository": {

packages/plugins/swr/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/swr",
33
"displayName": "ZenStack plugin for generating SWR hooks",
4-
"version": "2.7.2",
4+
"version": "2.7.3",
55
"description": "ZenStack plugin for generating SWR hooks",
66
"main": "index.js",
77
"repository": {

packages/plugins/tanstack-query/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/tanstack-query",
33
"displayName": "ZenStack plugin for generating tanstack-query hooks",
4-
"version": "2.7.2",
4+
"version": "2.7.3",
55
"description": "ZenStack plugin for generating tanstack-query hooks",
66
"main": "index.js",
77
"exports": {

packages/plugins/trpc/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/trpc",
33
"displayName": "ZenStack plugin for tRPC",
4-
"version": "2.7.2",
4+
"version": "2.7.3",
55
"description": "ZenStack plugin for tRPC",
66
"main": "index.js",
77
"repository": {

packages/runtime/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/runtime",
33
"displayName": "ZenStack Runtime Library",
4-
"version": "2.7.2",
4+
"version": "2.7.3",
55
"description": "Runtime of ZenStack for both client-side and server-side environments.",
66
"repository": {
77
"type": "git",

packages/schema/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 Language Tools",
55
"description": "FullStack enhancement for Prisma ORM: seamless integration from database to UI",
6-
"version": "2.7.2",
6+
"version": "2.7.3",
77
"author": {
88
"name": "ZenStack Team"
99
},

packages/sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/sdk",
3-
"version": "2.7.2",
3+
"version": "2.7.3",
44
"description": "ZenStack plugin development SDK",
55
"main": "index.js",
66
"scripts": {

packages/server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/server",
3-
"version": "2.7.2",
3+
"version": "2.7.3",
44
"displayName": "ZenStack Server-side Adapters",
55
"description": "ZenStack server-side adapters",
66
"homepage": "https://zenstack.dev",

packages/server/src/api/rest/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,9 @@ class RequestHandler extends APIHandlerBase {
799799
}
800800
}
801801

802+
// include IDs of relation fields so that they can be serialized.
803+
this.includeRelationshipIds(type, createPayload, 'include');
804+
802805
const entity = await prisma[type].create(createPayload);
803806
return {
804807
status: 201,
@@ -970,6 +973,9 @@ class RequestHandler extends APIHandlerBase {
970973
}
971974
}
972975

976+
// include IDs of relation fields so that they can be serialized.
977+
this.includeRelationshipIds(type, updatePayload, 'include');
978+
973979
const entity = await prisma[type].update(updatePayload);
974980
return {
975981
status: 200,

packages/server/tests/api/rest.test.ts

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,40 @@ describe('REST server tests', () => {
305305
});
306306
});
307307

308+
it('returns an empty data array when loading empty related resources', async () => {
309+
// Create a user first
310+
await prisma.user.create({
311+
data: { myId: 'user1', email: '[email protected]' },
312+
});
313+
314+
const r = await handler({
315+
method: 'get',
316+
path: '/user/user1',
317+
prisma,
318+
});
319+
320+
expect(r.status).toBe(200);
321+
expect(r.body).toMatchObject({
322+
data: {
323+
type: 'user',
324+
id: 'user1',
325+
attributes: { email: '[email protected]' },
326+
links: {
327+
self: 'http://localhost/api/user/user1',
328+
},
329+
relationships: {
330+
posts: {
331+
links: {
332+
self: 'http://localhost/api/user/user1/relationships/posts',
333+
related: 'http://localhost/api/user/user1/posts',
334+
},
335+
data: [],
336+
},
337+
},
338+
},
339+
});
340+
});
341+
308342
it('fetches a related resource with a compound ID', async () => {
309343
await prisma.user.create({
310344
data: {
@@ -1427,7 +1461,21 @@ describe('REST server tests', () => {
14271461
expect(r.status).toBe(201);
14281462
expect(r.body).toMatchObject({
14291463
jsonapi: { version: '1.1' },
1430-
data: { type: 'user', id: 'user1', attributes: { email: '[email protected]' } },
1464+
data: {
1465+
type: 'user',
1466+
id: 'user1',
1467+
attributes: { email: '[email protected]' },
1468+
relationships: {
1469+
posts: {
1470+
links: {
1471+
self: 'http://localhost/api/user/user1/relationships/posts',
1472+
related: 'http://localhost/api/user/user1/posts',
1473+
},
1474+
data: [],
1475+
},
1476+
},
1477+
links: { self: 'http://localhost/api/user/user1' },
1478+
},
14311479
});
14321480
});
14331481

@@ -1785,6 +1833,54 @@ describe('REST server tests', () => {
17851833
});
17861834
});
17871835

1836+
it("returns an empty data list in relationships if it's empty", async () => {
1837+
await prisma.user.create({
1838+
data: {
1839+
myId: 'user1',
1840+
1841+
},
1842+
});
1843+
1844+
const r = await handler({
1845+
method: 'put',
1846+
path: '/user/user1',
1847+
query: {},
1848+
requestBody: {
1849+
data: {
1850+
type: 'user',
1851+
attributes: { email: '[email protected]' },
1852+
},
1853+
},
1854+
prisma,
1855+
});
1856+
1857+
expect(r.status).toBe(200);
1858+
expect(r.body).toMatchObject({
1859+
links: {
1860+
self: 'http://localhost/api/user/user1',
1861+
},
1862+
data: {
1863+
type: 'user',
1864+
id: 'user1',
1865+
attributes: {
1866+
1867+
},
1868+
links: {
1869+
self: 'http://localhost/api/user/user1',
1870+
},
1871+
relationships: {
1872+
posts: {
1873+
links: {
1874+
self: 'http://localhost/api/user/user1/relationships/posts',
1875+
related: 'http://localhost/api/user/user1/posts',
1876+
},
1877+
data: [],
1878+
},
1879+
},
1880+
},
1881+
});
1882+
});
1883+
17881884
it('returns 404 if the user does not exist', async () => {
17891885
const r = await handler({
17901886
method: 'put',

packages/testtools/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/testtools",
3-
"version": "2.7.2",
3+
"version": "2.7.3",
44
"description": "ZenStack Test Tools",
55
"main": "index.js",
66
"private": true,

0 commit comments

Comments
 (0)