Type Alias PolicyConfigCommitFunction<CommitParams, CommitAllowResult, CommitDenyResult>

PolicyConfigCommitFunction: (
    args: CommitParams extends z.ZodType ? z.infer<CommitParams> : undefined,
    context: PolicyContext<CommitAllowResult, CommitDenyResult>,
) => Promise<
    EnforcePolicyResponse<
        | (
            CommitAllowResult extends z.ZodUndefined
                ? ContextAllowResponseNoResult
                : ContextAllowResponse<z.infer<CommitAllowResult>>
        )
        | (
            CommitDenyResult extends z.ZodUndefined
                ? ContextDenyResponseNoResult
                : ContextDenyResponse<z.infer<CommitDenyResult>>
        ),
    >,
>

Unlike evaluate() and precheck(), commit receives specific arguments provided by the ability during its execute() phase instead of than abilityParams and userParams that the ability was called with.

Type Parameters

  • CommitParams extends z.ZodType = z.ZodUndefined
  • CommitAllowResult extends z.ZodType = z.ZodUndefined
  • CommitDenyResult extends z.ZodType = z.ZodUndefined

Type declaration

    • (
          args: CommitParams extends z.ZodType ? z.infer<CommitParams> : undefined,
          context: PolicyContext<CommitAllowResult, CommitDenyResult>,
      ): Promise<
          EnforcePolicyResponse<
              | (
                  CommitAllowResult extends z.ZodUndefined
                      ? ContextAllowResponseNoResult
                      : ContextAllowResponse<z.infer<CommitAllowResult>>
              )
              | (
                  CommitDenyResult extends z.ZodUndefined
                      ? ContextDenyResponseNoResult
                      : ContextDenyResponse<z.infer<CommitDenyResult>>
              ),
          >,
      >
    • Parameters

      • args: CommitParams extends z.ZodType ? z.infer<CommitParams> : undefined
      • context: PolicyContext<CommitAllowResult, CommitDenyResult>
        • allow: AllowSchema extends ZodUndefined
              ? () => ContextAllowResponseNoResult
              : (
                  result: TypeOf<AllowSchema>,
              ) => ContextAllowResponse<TypeOf<AllowSchema>>
        • deny: DenySchema extends ZodUndefined
              ? () => ContextDenyResponseNoResult
              : (
                  result: TypeOf<DenySchema>,
                  runtimeError?: string,
              ) => ContextDenyResponse<TypeOf<DenySchema>>
        • abilityIpfsCid: string
        • appId: number
        • appVersion: number
        • delegation: {
              delegateeAddress: string;
              delegatorPkpInfo: {
                  tokenId: string;
                  ethAddress: string;
                  publicKey: string;
              };
          }

      Returns Promise<
          EnforcePolicyResponse<
              | (
                  CommitAllowResult extends z.ZodUndefined
                      ? ContextAllowResponseNoResult
                      : ContextAllowResponse<z.infer<CommitAllowResult>>
              )
              | (
                  CommitDenyResult extends z.ZodUndefined
                      ? ContextDenyResponseNoResult
                      : ContextDenyResponse<z.infer<CommitDenyResult>>
              ),
          >,
      >