schema.ts 557 B

12345678910111213141516
  1. export * as PermissionSchema from "./schema"
  2. import { Schema } from "effect"
  3. export const Effect = Schema.Literals(["allow", "deny", "ask"]).annotate({ identifier: "PermissionV2.Effect" })
  4. export type Effect = typeof Effect.Type
  5. export const Rule = Schema.Struct({
  6. action: Schema.String,
  7. resource: Schema.String,
  8. effect: Effect,
  9. }).annotate({ identifier: "PermissionV2.Rule" })
  10. export type Rule = typeof Rule.Type
  11. export const Ruleset = Schema.Array(Rule).annotate({ identifier: "PermissionV2.Ruleset" })
  12. export type Ruleset = typeof Ruleset.Type