Skip to content

merge dev to main #442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zenstack-monorepo",
"version": "1.0.0-alpha.120",
"version": "1.0.0-alpha.121",
"description": "",
"scripts": {
"build": "pnpm -r build",
Expand Down
2 changes: 1 addition & 1 deletion packages/language/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zenstackhq/language",
"version": "1.0.0-alpha.120",
"version": "1.0.0-alpha.121",
"displayName": "ZenStack modeling language compiler",
"description": "ZenStack modeling language compiler",
"homepage": "https://zenstack.dev",
Expand Down
2 changes: 1 addition & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zenstackhq/next",
"version": "1.0.0-alpha.120",
"version": "1.0.0-alpha.121",
"displayName": "ZenStack Next.js integration",
"description": "ZenStack Next.js integration",
"homepage": "https://zenstack.dev",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/openapi/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@zenstackhq/openapi",
"displayName": "ZenStack Plugin and Runtime for OpenAPI",
"version": "1.0.0-alpha.120",
"version": "1.0.0-alpha.121",
"description": "ZenStack plugin and runtime supporting OpenAPI",
"main": "index.js",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@zenstackhq/react",
"displayName": "ZenStack plugin and runtime for ReactJS",
"version": "1.0.0-alpha.120",
"version": "1.0.0-alpha.121",
"description": "ZenStack plugin and runtime for ReactJS",
"main": "index.js",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/swr/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@zenstackhq/swr",
"displayName": "ZenStack plugin for generating SWR hooks",
"version": "1.0.0-alpha.120",
"version": "1.0.0-alpha.121",
"description": "ZenStack plugin for generating SWR hooks",
"main": "index.js",
"repository": {
Expand Down
2 changes: 2 additions & 0 deletions packages/plugins/swr/res/helper.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable */

import { createContext } from 'react';
import type { MutatorCallback, MutatorOptions, SWRResponse } from 'swr';
import useSWR, { useSWRConfig } from 'swr';
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/tanstack-query/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@zenstackhq/tanstack-query",
"displayName": "ZenStack plugin for generating tanstack-query hooks",
"version": "1.0.0-alpha.120",
"version": "1.0.0-alpha.121",
"description": "ZenStack plugin for generating tanstack-query hooks",
"main": "index.js",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/trpc/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@zenstackhq/trpc",
"displayName": "ZenStack plugin for tRPC",
"version": "1.0.0-alpha.120",
"version": "1.0.0-alpha.121",
"description": "ZenStack plugin for tRPC",
"main": "index.js",
"repository": {
Expand Down
3 changes: 1 addition & 2 deletions packages/runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@zenstackhq/runtime",
"displayName": "ZenStack Runtime Library",
"version": "1.0.0-alpha.120",
"version": "1.0.0-alpha.121",
"description": "Runtime of ZenStack for both client-side and server-side environments.",
"repository": {
"type": "git",
Expand All @@ -22,7 +22,6 @@
"dependencies": {
"@paralleldrive/cuid2": "^2.2.0",
"@types/bcryptjs": "^2.4.2",
"@zenstackhq/sdk": "workspace:*",
"bcryptjs": "^2.4.3",
"change-case": "^4.1.2",
"colors": "1.4.0",
Expand Down
25 changes: 25 additions & 0 deletions packages/runtime/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,28 @@
* Default length of password hash salt (used by bcryptjs to hash password)
*/
export const DEFAULT_PASSWORD_SALT_LENGTH = 12;

/**
* Auxiliary database field for supporting policy check for nested writes
*/
export const TRANSACTION_FIELD_NAME = 'zenstack_transaction';

/**
* Auxiliary database field for building up policy check queries
*/
export const GUARD_FIELD_NAME = 'zenstack_guard';

/**
* All Auxiliary fields.
*/
export const AUXILIARY_FIELDS = [TRANSACTION_FIELD_NAME, GUARD_FIELD_NAME];

/**
* Reasons for a CRUD operation to fail.
*/
export enum CrudFailureReason {
/**
* CRUD suceeded but the result was not readable.
*/
RESULT_NOT_READABLE = 'RESULT_NOT_READABLE',
}
2 changes: 1 addition & 1 deletion packages/runtime/src/enhancements/policy/handler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */

import { CrudFailureReason } from '@zenstackhq/sdk';
import { CrudFailureReason } from '../../constants';
import { AuthUser, DbClientContract, PolicyOperationKind } from '../../types';
import { BatchResult, PrismaProxyHandler } from '../proxy';
import { ModelMeta, PolicyDef } from '../types';
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/src/enhancements/policy/policy-utils.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* eslint-disable @typescript-eslint/no-explicit-any */

import { createId } from '@paralleldrive/cuid2';
import { AUXILIARY_FIELDS, CrudFailureReason, GUARD_FIELD_NAME, TRANSACTION_FIELD_NAME } from '@zenstackhq/sdk';
import deepcopy from 'deepcopy';
import { lowerCaseFirst } from 'lower-case-first';
import pluralize from 'pluralize';
import { fromZodError } from 'zod-validation-error';
import { AUXILIARY_FIELDS, CrudFailureReason, GUARD_FIELD_NAME, TRANSACTION_FIELD_NAME } from '../../constants';
import {
AuthUser,
DbClientContract,
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/src/enhancements/utils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-disable @typescript-eslint/no-var-requires */

import { AUXILIARY_FIELDS } from '@zenstackhq/sdk';
import { lowerCaseFirst } from 'lower-case-first';
import path from 'path';
import * as util from 'util';
import { AUXILIARY_FIELDS } from '../constants';
import { DbClientContract } from '../types';
import { ModelMeta } from './types';

Expand Down
2 changes: 1 addition & 1 deletion packages/schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"publisher": "zenstack",
"displayName": "ZenStack Language Tools",
"description": "A toolkit for building secure CRUD apps with Next.js + Typescript",
"version": "1.0.0-alpha.120",
"version": "1.0.0-alpha.121",
"author": {
"name": "ZenStack Team"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zenstackhq/sdk",
"version": "1.0.0-alpha.120",
"version": "1.0.0-alpha.121",
"description": "ZenStack plugin development SDK",
"main": "index.js",
"scripts": {
Expand All @@ -21,6 +21,7 @@
"dependencies": {
"@prisma/generator-helper": "^4.7.1",
"@zenstackhq/language": "workspace:*",
"@zenstackhq/runtime": "workspace:*",
"prettier": "^2.8.3",
"ts-morph": "^16.0.0"
},
Expand Down
32 changes: 7 additions & 25 deletions packages/sdk/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@
/**
* Auxiliary database field for supporting policy check for nested writes
*/
export const TRANSACTION_FIELD_NAME = 'zenstack_transaction';

/**
* Auxiliary database field for building up policy check queries
*/
export const GUARD_FIELD_NAME = 'zenstack_guard';

/**
* All Auxiliary fields.
*/
export const AUXILIARY_FIELDS = [TRANSACTION_FIELD_NAME, GUARD_FIELD_NAME];

/**
* Reasons for a CRUD operation to fail.
*/
export enum CrudFailureReason {
/**
* CRUD suceeded but the result was not readable.
*/
RESULT_NOT_READABLE = 'RESULT_NOT_READABLE',
}

/**
* @zenstackhq/runtime package name
*/
export const RUNTIME_PACKAGE = '@zenstackhq/runtime';

export {
AUXILIARY_FIELDS,
GUARD_FIELD_NAME,
TRANSACTION_FIELD_NAME,
CrudFailureReason,
} from '@zenstackhq/runtime/constants';
3 changes: 1 addition & 2 deletions packages/server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zenstackhq/server",
"version": "1.0.0-alpha.120",
"version": "1.0.0-alpha.121",
"displayName": "ZenStack Server-side Adapters",
"description": "ZenStack server-side adapters",
"homepage": "https://zenstack.dev",
Expand All @@ -25,7 +25,6 @@
"dependencies": {
"@zenstackhq/openapi": "workspace:*",
"@zenstackhq/runtime": "workspace:*",
"@zenstackhq/sdk": "workspace:*",
"change-case": "^4.1.2",
"lower-case-first": "^2.0.2",
"superjson": "^1.11.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/api/utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { DbOperations } from '@zenstackhq/runtime';
import { AUXILIARY_FIELDS } from '@zenstackhq/runtime/constants';
import type { ModelZodSchema } from '@zenstackhq/runtime/zod';
import { upperCaseFirst } from 'upper-case-first';
import { fromZodError } from 'zod-validation-error';
import { AUXILIARY_FIELDS } from '@zenstackhq/sdk';
import { LoggerConfig } from '../types';

export function getZodSchema(zodSchemas: ModelZodSchema, model: string, operation: keyof DbOperations) {
Expand Down
2 changes: 1 addition & 1 deletion packages/testtools/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zenstackhq/testtools",
"version": "1.0.0-alpha.120",
"version": "1.0.0-alpha.121",
"description": "ZenStack Test Tools",
"main": "index.js",
"publishConfig": {
Expand Down
9 changes: 3 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tests/integration/test-run/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.