SeedCompany / cord-api-v3

Bible translation project management API
MIT License
18 stars 4 forks source link

[EdgeDB] Inject/Eject access policies programmatically into schema files #3121

Closed CarsonF closed 5 months ago

CarsonF commented 5 months ago

This handles the work of injecting and ejecting access policies SDL strings into our schema files in the appropriate spots. The actual business logic for what these APs should be is stubbed & coming next.

I built out a crude AST parser to facilitate this. It's based on a recursive regex { } block matching. I've added specific Module & Type AST nodes to facilitate traversal for our needs. I've also have some string manipulation & filesystem helpers for our needs.

CLI commands

Add APs to schema files

yarn console edgedb ap inject

Remove generated APs from schema files

yarn console edgedb ap eject

Run an edgedb migration command with APs injected, then eject them back out.

yarn edgedb:migration status
yarn edgedb:migration create