Skip to content

Commit 1bc622a

Browse files
committed
Merge remote-tracking branch 'origin/dev' into tanstack-query-prefetch
2 parents f4cbaaf + d83b7ee commit 1bc622a

File tree

263 files changed

+30113
-2748
lines changed

Some content is hidden

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

263 files changed

+30113
-2748
lines changed

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.4.1",
3+
"version": "2.7.0",
44
"description": "",
55
"scripts": {
66
"build": "pnpm -r build",

packages/ide/jetbrains/.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ide/jetbrains/CHANGELOG.md

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,61 @@
11
# Changelog
22

33
## [Unreleased]
4+
5+
### Fixed
6+
7+
- ZModel validation issues when accessing fields defined in a base model from `future().` or `this.`.
8+
9+
## 2.5.0
10+
11+
### Added
12+
13+
- A new `path` parameter to the `@@validate` attribute for providing an optional path to the field that caused the error.
14+
15+
## 2.4.0
16+
17+
### Added
18+
19+
- The `uuid()` function is updated to support the new UUID version feature from Prisma.
20+
21+
## 2.3.0
22+
423
### Added
5-
- New `check()` policy rule function.
24+
25+
- New `check()` policy rule function.
626

727
### Fixed
8-
- Fixed the issue with formatting schemas containing `Unsupported` type.
28+
29+
- Fixed the issue with formatting schemas containing `Unsupported` type.
930

1031
## 2.2.0
32+
1133
### Added
12-
- Support comparing fields from different models in mutation policy rules ("create", "update", and "delete).
34+
35+
- Support comparing fields from different models in mutation policy rules ("create", "update", and "delete).
1336

1437
## 2.1.0
38+
1539
### Added
16-
- Support using ZModel type names (e.g., `DateTime`) as model field names.
17-
- `auth()` is resolved from all reachable schema files.
40+
41+
- Support using ZModel type names (e.g., `DateTime`) as model field names.
42+
- `auth()` is resolved from all reachable schema files.
1843

1944
## 2.0.0
45+
2046
### Added
21-
- ZenStack V2 release!
47+
48+
- ZenStack V2 release!
2249

2350
## 1.11.0
51+
2452
### Added
25-
- Added support to complex usage of `@@index` attribute like `@@index([content(ops: raw("gin_trgm_ops"))], type: Gin)`.
53+
54+
- Added support to complex usage of `@@index` attribute like `@@index([content(ops: raw("gin_trgm_ops"))], type: Gin)`.
55+
2656
### Fixed
27-
- Fixed several ZModel validation issues related to model inheritance.
57+
58+
- Fixed several ZModel validation issues related to model inheritance.
2859

2960
## 1.7.0
3061

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.4.1"
12+
version = "2.7.0"
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.4.1",
3+
"version": "2.7.0",
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.4.1",
3+
"version": "2.7.0",
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.4.1",
4+
"version": "2.7.0",
55
"description": "CLI and runtime for integrating ZenStack with RedwoodJS projects.",
66
"repository": {
77
"type": "git",

packages/misc/redwood/src/graphql.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { ForbiddenError } from '@redwoodjs/graphql-server';
1+
import { ForbiddenError, ValidationError } from '@redwoodjs/graphql-server';
22
import {
33
CrudFailureReason,
44
EnhancementOptions,
55
PrismaErrorCode,
6-
ValidationError,
76
enhance,
87
isPrismaClientKnownRequestError,
98
type AuthUser,
@@ -47,7 +46,7 @@ export function useZenStack<PrismaClient extends object>(
4746

4847
// Transforms ZenStack errors into appropriate RedwoodJS errors
4948
function transformError(error: unknown) {
50-
if (isPrismaClientKnownRequestError(error) && error.code === PrismaErrorCode.CONSTRAINED_FAILED) {
49+
if (isPrismaClientKnownRequestError(error) && error.code === PrismaErrorCode.CONSTRAINT_FAILED) {
5150
if (
5251
error.meta?.reason === CrudFailureReason.ACCESS_POLICY_VIOLATION ||
5352
error.meta?.reason === CrudFailureReason.RESULT_NOT_READABLE

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.4.1",
4+
"version": "2.7.0",
55
"description": "ZenStack plugin and runtime supporting OpenAPI",
66
"main": "index.js",
77
"repository": {

packages/plugins/openapi/src/rest-generator.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -409,14 +409,17 @@ export class RESTfulOpenAPIGenerator extends OpenAPIGeneratorBase {
409409
private generateFilterParameters(model: DataModel) {
410410
const result: OAPI.ParameterObject[] = [];
411411

412+
const hasMultipleIds = model.fields.filter((f) => isIdField(f)).length > 1;
413+
412414
for (const field of model.fields) {
413415
if (isForeignKeyField(field)) {
414416
// no filtering with foreign keys because one can filter
415417
// directly on the relationship
416418
continue;
417419
}
418420

419-
if (isIdField(field)) {
421+
// For multiple ids, make each id field filterable like a regular field
422+
if (isIdField(field) && !hasMultipleIds) {
420423
// id filter
421424
result.push(this.makeFilterParameter(field, 'id', 'Id filter'));
422425
continue;
@@ -843,7 +846,9 @@ export class RESTfulOpenAPIGenerator extends OpenAPIGeneratorBase {
843846
}
844847

845848
private generateModelEntity(model: DataModel, mode: 'read' | 'create' | 'update'): OAPI.SchemaObject {
846-
const fields = model.fields.filter((f) => !isIdField(f));
849+
const idFields = model.fields.filter((f) => isIdField(f));
850+
// For compound ids, each component is also exposed as a separate field
851+
const fields = idFields.length > 1 ? model.fields : model.fields.filter((f) => !isIdField(f));
847852

848853
const attributes: Record<string, OAPI.SchemaObject> = {};
849854
const relationships: Record<string, OAPI.ReferenceObject | OAPI.SchemaObject> = {};
@@ -869,6 +874,9 @@ export class RESTfulOpenAPIGenerator extends OpenAPIGeneratorBase {
869874
!(isDataModel(field.$resolvedType?.decl) && field.type.array)
870875
) {
871876
required.push(field.name);
877+
} else if (mode === 'read') {
878+
// Until we support sparse fieldsets, all fields are required for read operations
879+
required.push(field.name);
872880
}
873881
}
874882
}
@@ -886,8 +894,8 @@ export class RESTfulOpenAPIGenerator extends OpenAPIGeneratorBase {
886894

887895
if (mode === 'create') {
888896
// 'id' is required if there's no default value
889-
const idField = model.fields.find((f) => isIdField(f));
890-
if (idField && !hasAttribute(idField, '@default')) {
897+
const idFields = model.fields.filter((f) => isIdField(f));
898+
if (idFields.length && idFields.every((f) => !hasAttribute(f, '@default'))) {
891899
properties = { id: { type: 'string' }, ...properties };
892900
toplevelRequired.unshift('id');
893901
}

packages/plugins/openapi/src/rpc-generator.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -637,18 +637,13 @@ export class RPCOpenAPIGenerator extends OpenAPIGeneratorBase {
637637

638638
schemas['_Meta'] = {
639639
type: 'object',
640+
description: 'Meta information about the request or response',
640641
properties: {
641-
meta: {
642-
type: 'object',
643-
description: 'Meta information about the request or response',
644-
properties: {
645-
serialization: {
646-
description: 'Serialization metadata',
647-
},
648-
},
649-
additionalProperties: true,
642+
serialization: {
643+
description: 'Serialization metadata',
650644
},
651645
},
646+
additionalProperties: true,
652647
};
653648

654649
schemas['_Error'] = {

0 commit comments

Comments
 (0)