You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Garrett Mills 1029f7eba5 Update 'README.md' 11 months ago
src add ability to access from cli 11 months ago
.env Add minimal proof of concept 11 months ago
.gitignore Add minimal proof of concept 11 months ago
README.md Update 'README.md' 11 months ago
package.json Add minimal proof of concept 11 months ago
pnpm-lock.yaml Add minimal proof of concept 11 months ago
tsconfig.json Add minimal proof of concept 11 months ago

README.md

Extollo runtime type validation proof-of-concept

You can read more about this proof-of-concept here:

https://garrettmills.dev/blog/2022/01/14/Runtime-Data-Validation-from-TypeScript-Interfaces/

To run it:

pnpm i
pnpm build

The intermediate files are generated in the exbuild/ directory, and the final compiled output is in the lib/ directory.

Access the Zod schema:

node --experimental-repl-await lib/cli.js shell
powered by Extollo, © 2022 Garrett Mills
Access your application using the "app" global.
(extollo) ➤ Home = require('./lib/app/http/controllers/main/Home.controller').Home
[class Home extends Controller]
(extollo) ➤ home = new Home
Home { request: undefined }
(extollo) ➤ home.getValidator().getZod().shape
{
  username: ZodString {
    spa: [Function (anonymous)],
    superRefine: [Function (anonymous)],
    _def: { checks: [Array], typeName: 'ZodString' },
    transform: [Function: bound ],
    default: [Function: bound ],
    _regex: [Function (anonymous)],
    nonempty: [Function (anonymous)]
  },
  password: ZodString {
    spa: [Function (anonymous)],
    superRefine: [Function (anonymous)],
    _def: { checks: [Array], typeName: 'ZodString' },
    transform: [Function: bound ],
    default: [Function: bound ],
    _regex: [Function (anonymous)],
    nonempty: [Function (anonymous)]
  },
  rememberMe: ZodOptional {
    spa: [Function (anonymous)],
    superRefine: [Function (anonymous)],
    _def: { innerType: [ZodBoolean], typeName: 'ZodOptional' },
    transform: [Function: bound ],
    default: [Function: bound ]
  }
}