node-opa
    Preparing search index...

    Type Alias DataAPI

    type DataAPI = {
        delete(path: string, metrics?: boolean): Promise<void>;
        get<T = any>(
            path: string,
            options?: {
                explain?: "notes" | "fails" | "full" | "debug";
                input?: Document;
                instrument?: boolean;
                metrics?: boolean;
                pretty?: boolean;
                provenance?: boolean;
                strictBuiltinErrors?: boolean;
            },
        ): Promise<GetDataResponse<T>>;
        patch(path: string, operations: any[]): Promise<void>;
        post<T = any>(
            path: string,
            body: { input?: T },
            options?: {
                explain?: "notes" | "fails" | "full" | "debug";
                instrument?: boolean;
                metrics?: boolean;
                pretty?: boolean;
                provenance?: boolean;
                strictBuiltinErrors?: boolean;
            },
        ): Promise<GetDataResponse<T>>;
        put(
            path: string,
            document: any,
            ifNoneMatch?: boolean,
            metrics?: boolean,
        ): Promise<void>;
        webhook<T = any>(path: string, input: any, pretty?: boolean): Promise<T>;
    }
    Index

    Methods

    • Gets a document by path (GET with optional input as query param).

      Type Parameters

      • T = any

      Parameters

      • path: string

        Slash-separated document path.

      • Optionaloptions: {
            explain?: "notes" | "fails" | "full" | "debug";
            input?: Document;
            instrument?: boolean;
            metrics?: boolean;
            pretty?: boolean;
            provenance?: boolean;
            strictBuiltinErrors?: boolean;
        }

        Optional parameters.

        • Optionalexplain?: "notes" | "fails" | "full" | "debug"

          Return query explanation in addition to result. Values: notes, fails, full, debug.

        • Optionalinput?: Document

          Provide an input document. Format is a JSON value that will be used as the value for the input document.

        • Optionalinstrument?: boolean

          Instrument query evaluation and return a superset of performance metrics in addition to result. See (Performance Metrics)[https://www.openpolicyagent.org/docs/rest-api#performance-metrics] for more detail.

        • Optionalmetrics?: boolean

          Return query performance metrics in addition to result. See (Performance)[https://www.openpolicyagent.org/docs/rest-api#provenance] Metrics for more detail.

        • Optionalpretty?: boolean

          If parameter is true, response will be formatted for humans.

        • Optionalprovenance?: boolean

          If parameter is true, response will include build/version info in addition to the result. See Provenance for more detail.

        • OptionalstrictBuiltinErrors?: boolean

          Treat built-in function call errors as fatal and return an error immediately.

      Returns Promise<GetDataResponse<T>>

      Document result and optional metadata.

    post

    • post<T = any>(
          path: string,
          body: { input?: T },
          options?: {
              explain?: "notes" | "fails" | "full" | "debug";
              instrument?: boolean;
              metrics?: boolean;
              pretty?: boolean;
              provenance?: boolean;
              strictBuiltinErrors?: boolean;
          },
      ): Promise<GetDataResponse<T>>

      Gets a document using POST with input in request body.

      Type Parameters

      • T = any

      Parameters

      • path: string

        Document path.

      • body: { input?: T }

        Request body containing input.

      • Optionaloptions: {
            explain?: "notes" | "fails" | "full" | "debug";
            instrument?: boolean;
            metrics?: boolean;
            pretty?: boolean;
            provenance?: boolean;
            strictBuiltinErrors?: boolean;
        }

        Optional parameters.

      Returns Promise<GetDataResponse<T>>

      Document result and optional metadata.