- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 11
feat(server): migrate rpc api handler and express adapter #328
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
                    Changes from 4 commits
      Commits
    
    
            Show all changes
          
          
            8 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      3fe9732
              
                feat(server): migrate rpc api handler and express adapter
              
              
                ymc9 7b0c9aa
              
                fix package.json
              
              
                ymc9 8ac4d0b
              
                misc fixes
              
              
                ymc9 8bf71e8
              
                update
              
              
                ymc9 e093dad
              
                update ot express5 only
              
              
                ymc9 2221568
              
                update
              
              
                ymc9 a506b71
              
                update
              
              
                ymc9 e29f67c
              
                fix test
              
              
                ymc9 File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
          Some comments aren't visible on the classic Files Changed page.
        
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| 1. `auth()` cannot be directly compared with a relation anymore | ||
| 2. `update` and `delete` policy rejection throws `NotFoundError` | ||
| 3. non-optional to-one relation doesn't automatically filter parent read when evaluating access policies | ||
| 1. `update` and `delete` policy rejection throws `NotFoundError` | ||
| 1. `check()` ORM api has been removed | ||
| 1. non-optional to-one relation doesn't automatically filter parent read when evaluating access policies | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| /** | ||
| * A safe JSON stringify that handles bigint values. | ||
| */ | ||
| export function safeJSONStringify(value: unknown) { | ||
| return JSON.stringify(value, (_, v) => { | ||
| if (typeof v === 'bigint') { | ||
| return v.toString(); | ||
| } else { | ||
| return v; | ||
| } | ||
| }); | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| import config from '@zenstackhq/eslint-config/base.js'; | ||
|  | ||
| /** @type {import("eslint").Linter.Config} */ | ||
| export default config; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| { | ||
| "name": "@zenstackhq/server", | ||
| "version": "3.0.0-beta.12", | ||
| "description": "ZenStack automatic CRUD API handlers and server adapters", | ||
| "type": "module", | ||
| "scripts": { | ||
| "build": "tsc --noEmit && tsup-node", | ||
| "watch": "tsup-node --watch", | ||
| "lint": "eslint src --ext ts", | ||
| "test": "vitest run", | ||
| "pack": "pnpm pack" | ||
| }, | ||
| "keywords": [ | ||
| "fastify", | ||
| "express", | ||
| "nextjs", | ||
| "sveltekit", | ||
| "nuxtjs", | ||
| "elysia", | ||
| "tanstack-start" | ||
| ], | ||
| "author": "ZenStack Team", | ||
| "license": "MIT", | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "exports": { | ||
| "./package.json": { | ||
| "import": "./package.json", | ||
| "require": "./package.json" | ||
| }, | ||
| "./api": { | ||
| "import": { | ||
| "types": "./dist/api.d.ts", | ||
| "default": "./dist/api.js" | ||
| }, | ||
| "require": { | ||
| "types": "./dist/api.d.cts", | ||
| "default": "./dist/api.cjs" | ||
| } | ||
| }, | ||
| "./express": { | ||
| "import": { | ||
| "types": "./dist/express.d.ts", | ||
| "default": "./dist/express.js" | ||
| }, | ||
| "require": { | ||
| "types": "./dist/express.d.cts", | ||
| "default": "./dist/express.cjs" | ||
| } | ||
| } | ||
| }, | ||
| "dependencies": { | ||
| "@zenstackhq/common-helpers": "workspace:*", | ||
| "@zenstackhq/runtime": "workspace:*", | ||
| "decimal.js": "catalog:", | ||
| "superjson": "^2.2.3", | ||
| "ts-pattern": "catalog:" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/body-parser": "^1.19.6", | ||
| "@types/express": "^5.0.3", | ||
| "@types/supertest": "^6.0.3", | ||
| "@zenstackhq/eslint-config": "workspace:*", | ||
| "@zenstackhq/testtools": "workspace:*", | ||
| "@zenstackhq/typescript-config": "workspace:*", | ||
| "@zenstackhq/vitest-config": "workspace:*", | ||
| "body-parser": "^2.2.0", | ||
| "supertest": "^7.1.4" | ||
| }, | ||
| "peerDependencies": { | ||
| "express": ">=4.19.0" | ||
| }, | ||
| "peerDependenciesMeta": { | ||
| "express": { | ||
| "optional": true | ||
| } | ||
| } | ||
| } | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { RPCApiHandler } from './rpc'; | 
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.