Function createVincentPolicy createVincentPolicy ( PolicyConfig : VincentPolicyConfig < PackageName , PolicyAbilityParams , UserParams , PrecheckAllowResult , PrecheckDenyResult , EvalAllowResult , EvalDenyResult , CommitParams , CommitAllowResult , CommitDenyResult , PolicyConfigLifecycleFunction < PolicyAbilityParams , UserParams , EvalAllowResult , EvalDenyResult , > , PolicyConfigLifecycleFunction < PolicyAbilityParams , UserParams , PrecheckAllowResult , PrecheckDenyResult , > , PolicyConfigCommitFunction < CommitParams , CommitAllowResult , CommitDenyResult , > , > , ) : { packageName : PackageName ; abilityParamsSchema : PolicyAbilityParams ; userParamsSchema ?: UserParams ; precheckAllowResultSchema ?: PrecheckAllowResult ; precheckDenyResultSchema ?: PrecheckDenyResult ; evalAllowResultSchema ?: EvalAllowResult ; evalDenyResultSchema ?: EvalDenyResult ; commitParamsSchema ?: CommitParams ; commitAllowResultSchema ?: CommitAllowResult ; commitDenyResultSchema ?: CommitDenyResult ; evaluate : PolicyLifecycleFunction ; precheck ?: PolicyLifecycleFunction < PolicyAbilityParams , UserParams , PrecheckAllowResult , PrecheckDenyResult , > ; commit ?: CommitLifecycleFunction < CommitParams , CommitAllowResult , CommitDenyResult , > ; } Parameters PolicyConfig : VincentPolicyConfig < PackageName , PolicyAbilityParams , UserParams , PrecheckAllowResult , PrecheckDenyResult , EvalAllowResult , EvalDenyResult , CommitParams , CommitAllowResult , CommitDenyResult , PolicyConfigLifecycleFunction < PolicyAbilityParams , UserParams , EvalAllowResult , EvalDenyResult , > , PolicyConfigLifecycleFunction < PolicyAbilityParams , UserParams , PrecheckAllowResult , PrecheckDenyResult , > , PolicyConfigCommitFunction < CommitParams , CommitAllowResult , CommitDenyResult , > , > Returns { packageName : PackageName ; abilityParamsSchema : PolicyAbilityParams ; userParamsSchema ?: UserParams ; precheckAllowResultSchema ?: PrecheckAllowResult ; precheckDenyResultSchema ?: PrecheckDenyResult ; evalAllowResultSchema ?: EvalAllowResult ; evalDenyResultSchema ?: EvalDenyResult ; commitParamsSchema ?: CommitParams ; commitAllowResultSchema ?: CommitAllowResult ; commitDenyResultSchema ?: CommitDenyResult ; evaluate : PolicyLifecycleFunction ; precheck ?: PolicyLifecycleFunction < PolicyAbilityParams , UserParams , PrecheckAllowResult , PrecheckDenyResult , > ; commit ?: CommitLifecycleFunction < CommitParams , CommitAllowResult , CommitDenyResult , > ; }
The
createVincentPolicy()
method is used to define a policy's lifecycle methods and ensure that arguments provided to the ability's lifecycle methods, as well as their return values, are validated and fully type-safe by defining ZOD schemas for them.