Skip to content

Commit 9e84126

Browse files
authored
fix: disable eslint in generated hooks, refactor package inter-dependencies
1 parent ec65e53 commit 9e84126

File tree

22 files changed

+57
-52
lines changed

22 files changed

+57
-52
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": "1.0.0-alpha.120",
3+
"version": "1.0.0-alpha.121",
44
"description": "",
55
"scripts": {
66
"build": "pnpm -r build",

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": "1.0.0-alpha.120",
3+
"version": "1.0.0-alpha.121",
44
"displayName": "ZenStack modeling language compiler",
55
"description": "ZenStack modeling language compiler",
66
"homepage": "https://zenstack.dev",

packages/next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/next",
3-
"version": "1.0.0-alpha.120",
3+
"version": "1.0.0-alpha.121",
44
"displayName": "ZenStack Next.js integration",
55
"description": "ZenStack Next.js integration",
66
"homepage": "https://zenstack.dev",

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

packages/plugins/react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/react",
33
"displayName": "ZenStack plugin and runtime for ReactJS",
4-
"version": "1.0.0-alpha.120",
4+
"version": "1.0.0-alpha.121",
55
"description": "ZenStack plugin and runtime for ReactJS",
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": "1.0.0-alpha.120",
4+
"version": "1.0.0-alpha.121",
55
"description": "ZenStack plugin for generating SWR hooks",
66
"main": "index.js",
77
"repository": {

packages/plugins/swr/res/helper.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable */
2+
13
import { createContext } from 'react';
24
import type { MutatorCallback, MutatorOptions, SWRResponse } from 'swr';
35
import useSWR, { useSWRConfig } from 'swr';

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": "1.0.0-alpha.120",
4+
"version": "1.0.0-alpha.121",
55
"description": "ZenStack plugin for generating tanstack-query hooks",
66
"main": "index.js",
77
"repository": {

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": "1.0.0-alpha.120",
4+
"version": "1.0.0-alpha.121",
55
"description": "ZenStack plugin for tRPC",
66
"main": "index.js",
77
"repository": {

packages/runtime/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/runtime",
33
"displayName": "ZenStack Runtime Library",
4-
"version": "1.0.0-alpha.120",
4+
"version": "1.0.0-alpha.121",
55
"description": "Runtime of ZenStack for both client-side and server-side environments.",
66
"repository": {
77
"type": "git",
@@ -22,7 +22,6 @@
2222
"dependencies": {
2323
"@paralleldrive/cuid2": "^2.2.0",
2424
"@types/bcryptjs": "^2.4.2",
25-
"@zenstackhq/sdk": "workspace:*",
2625
"bcryptjs": "^2.4.3",
2726
"change-case": "^4.1.2",
2827
"colors": "1.4.0",

packages/runtime/src/constants.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,28 @@
22
* Default length of password hash salt (used by bcryptjs to hash password)
33
*/
44
export const DEFAULT_PASSWORD_SALT_LENGTH = 12;
5+
6+
/**
7+
* Auxiliary database field for supporting policy check for nested writes
8+
*/
9+
export const TRANSACTION_FIELD_NAME = 'zenstack_transaction';
10+
11+
/**
12+
* Auxiliary database field for building up policy check queries
13+
*/
14+
export const GUARD_FIELD_NAME = 'zenstack_guard';
15+
16+
/**
17+
* All Auxiliary fields.
18+
*/
19+
export const AUXILIARY_FIELDS = [TRANSACTION_FIELD_NAME, GUARD_FIELD_NAME];
20+
21+
/**
22+
* Reasons for a CRUD operation to fail.
23+
*/
24+
export enum CrudFailureReason {
25+
/**
26+
* CRUD suceeded but the result was not readable.
27+
*/
28+
RESULT_NOT_READABLE = 'RESULT_NOT_READABLE',
29+
}

packages/runtime/src/enhancements/policy/handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
22

3-
import { CrudFailureReason } from '@zenstackhq/sdk';
3+
import { CrudFailureReason } from '../../constants';
44
import { AuthUser, DbClientContract, PolicyOperationKind } from '../../types';
55
import { BatchResult, PrismaProxyHandler } from '../proxy';
66
import { ModelMeta, PolicyDef } from '../types';

packages/runtime/src/enhancements/policy/policy-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
22

33
import { createId } from '@paralleldrive/cuid2';
4-
import { AUXILIARY_FIELDS, CrudFailureReason, GUARD_FIELD_NAME, TRANSACTION_FIELD_NAME } from '@zenstackhq/sdk';
54
import deepcopy from 'deepcopy';
65
import { lowerCaseFirst } from 'lower-case-first';
76
import pluralize from 'pluralize';
87
import { fromZodError } from 'zod-validation-error';
8+
import { AUXILIARY_FIELDS, CrudFailureReason, GUARD_FIELD_NAME, TRANSACTION_FIELD_NAME } from '../../constants';
99
import {
1010
AuthUser,
1111
DbClientContract,

packages/runtime/src/enhancements/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* eslint-disable @typescript-eslint/no-var-requires */
22

3-
import { AUXILIARY_FIELDS } from '@zenstackhq/sdk';
43
import { lowerCaseFirst } from 'lower-case-first';
54
import path from 'path';
65
import * as util from 'util';
6+
import { AUXILIARY_FIELDS } from '../constants';
77
import { DbClientContract } from '../types';
88
import { ModelMeta } from './types';
99

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": "A toolkit for building secure CRUD apps with Next.js + Typescript",
6-
"version": "1.0.0-alpha.120",
6+
"version": "1.0.0-alpha.121",
77
"author": {
88
"name": "ZenStack Team"
99
},

packages/sdk/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/sdk",
3-
"version": "1.0.0-alpha.120",
3+
"version": "1.0.0-alpha.121",
44
"description": "ZenStack plugin development SDK",
55
"main": "index.js",
66
"scripts": {
@@ -21,6 +21,7 @@
2121
"dependencies": {
2222
"@prisma/generator-helper": "^4.7.1",
2323
"@zenstackhq/language": "workspace:*",
24+
"@zenstackhq/runtime": "workspace:*",
2425
"prettier": "^2.8.3",
2526
"ts-morph": "^16.0.0"
2627
},

packages/sdk/src/constants.ts

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,11 @@
1-
/**
2-
* Auxiliary database field for supporting policy check for nested writes
3-
*/
4-
export const TRANSACTION_FIELD_NAME = 'zenstack_transaction';
5-
6-
/**
7-
* Auxiliary database field for building up policy check queries
8-
*/
9-
export const GUARD_FIELD_NAME = 'zenstack_guard';
10-
11-
/**
12-
* All Auxiliary fields.
13-
*/
14-
export const AUXILIARY_FIELDS = [TRANSACTION_FIELD_NAME, GUARD_FIELD_NAME];
15-
16-
/**
17-
* Reasons for a CRUD operation to fail.
18-
*/
19-
export enum CrudFailureReason {
20-
/**
21-
* CRUD suceeded but the result was not readable.
22-
*/
23-
RESULT_NOT_READABLE = 'RESULT_NOT_READABLE',
24-
}
25-
261
/**
272
* @zenstackhq/runtime package name
283
*/
294
export const RUNTIME_PACKAGE = '@zenstackhq/runtime';
5+
6+
export {
7+
AUXILIARY_FIELDS,
8+
GUARD_FIELD_NAME,
9+
TRANSACTION_FIELD_NAME,
10+
CrudFailureReason,
11+
} from '@zenstackhq/runtime/constants';

packages/server/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/server",
3-
"version": "1.0.0-alpha.120",
3+
"version": "1.0.0-alpha.121",
44
"displayName": "ZenStack Server-side Adapters",
55
"description": "ZenStack server-side adapters",
66
"homepage": "https://zenstack.dev",
@@ -25,7 +25,6 @@
2525
"dependencies": {
2626
"@zenstackhq/openapi": "workspace:*",
2727
"@zenstackhq/runtime": "workspace:*",
28-
"@zenstackhq/sdk": "workspace:*",
2928
"change-case": "^4.1.2",
3029
"lower-case-first": "^2.0.2",
3130
"superjson": "^1.11.0",

packages/server/src/api/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { DbOperations } from '@zenstackhq/runtime';
2+
import { AUXILIARY_FIELDS } from '@zenstackhq/runtime/constants';
23
import type { ModelZodSchema } from '@zenstackhq/runtime/zod';
34
import { upperCaseFirst } from 'upper-case-first';
45
import { fromZodError } from 'zod-validation-error';
5-
import { AUXILIARY_FIELDS } from '@zenstackhq/sdk';
66
import { LoggerConfig } from '../types';
77

88
export function getZodSchema(zodSchemas: ModelZodSchema, model: string, operation: keyof DbOperations) {

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": "1.0.0-alpha.120",
3+
"version": "1.0.0-alpha.121",
44
"description": "ZenStack Test Tools",
55
"main": "index.js",
66
"publishConfig": {

pnpm-lock.yaml

Lines changed: 3 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integration/test-run/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)