Options
All
  • Public
  • Public/Protected
  • All
Menu

Module types

Index

Type aliases

Class

Class<T>: new (...args: any[]) => T

Type parameters

  • T = unknown

Type declaration

    • new (...args: any[]): T
    • A constructable (via the new keyword) application class.

      Parameters

      • Rest ...args: any[]

      Returns T

CustomError

CustomError: new (...args: any[]) => Error

Type declaration

    • new (...args: any[]): Error
    • Parameters

      • Rest ...args: any[]

      Returns Error

EqualityFn

EqualityFn: (x: unknown, y: unknown) => boolean

Type declaration

    • (x: unknown, y: unknown): boolean
    • A function that compares two values and returns true if they are equal and false otherwise.

      A custom EqualityFn may be passed in the Options provided to the Oso.constructor in order to override the default equality function, which uses isEqual from the lodash.isequal package.

      Parameters

      • x: unknown
      • y: unknown

      Returns boolean

HostOpts

HostOpts: { acceptExpression: boolean; equalityFn: EqualityFn }

Required configuration for Host.

internal

Type declaration

  • acceptExpression: boolean

    Opt-in flag indicating whether Host can receive Expressions from core. When false, Host errors on receiving Expression from core. Main use is for indicating whether the consumer of the result bindings is prepared to handle constraints (Expressions) received from core for data filtering purposes.

  • equalityFn: EqualityFn

HostTypes

HostTypes: Map<string | Class, UserType<any>>

IsaCheck

IsaCheck: (instance: any) => boolean

Type declaration

    • (instance: any): boolean
    • Parameters

      • instance: any

      Returns boolean

NullishOrHasConstructor

NullishOrHasConstructor: { constructor: Class } | null | undefined

Utility type to represent a JS value that either does or does not have a constructor property.

NOTE(gj): I think null & undefined are the only JS values w/o a constructor property (e.g., (1).constructor returns [Function: Number]), but I'm not 100% sure of that.

PolarComparisonOperator

PolarComparisonOperator: keyof typeof comparisonOperators

PolarDictPattern

PolarDictPattern: PolarDict

Polar (untagged) dict pattern variant.

internal

PolarOperator

PolarOperator: keyof typeof operators

PolarValue

PolarValue: PolarStr | PolarNum | PolarBool | PolarList | PolarDict | PolarPredicate | PolarVariable | PolarInstance | PolarExpression | PolarPattern

Union of Polar value types.

internal

QueryOpts

QueryOpts: { acceptExpression?: boolean; bindings?: Map<string, unknown> }

Optional configuration for Polar.query and Polar.queryRule.

Type declaration

  • Optional acceptExpression?: boolean

    Opt-in flag indicating whether Host can receive Expressions from core for duration of query. When false, Host errors on receiving Expression from core. Main use is for indicating whether the consumer of the result bindings is prepared to handle constraints (Expressions) received from core for data filtering purposes.

  • Optional bindings?: Map<string, unknown>

    Bind keys to values in VM for duration of query.

QueryResult

QueryResult: AsyncGenerator<Map<string, unknown>, void, undefined | void>

An AsyncGenerator over query results.

Each result is a Map of variables bound during the computation of that result.

If you don't need access to the bindings and only wish to know whether a query succeeded or failed, you may check the done property of the yielded value (and then optionally "complete" the generator by calling and awaiting its return() method). If done is true, the query failed. If done is false, the query yielded at least one result and therefore succeeded.

Functions

isAsyncIterable

  • isAsyncIterable(x: unknown): x is AsyncIterable<unknown>
  • Type guard to test if a value is an AsyncIterable.

    internal

    Parameters

    • x: unknown

    Returns x is AsyncIterable<unknown>

isIterable

  • isIterable(x: unknown): x is Iterable<unknown>
  • Type guard to test if a value is an Iterable.

    internal

    Parameters

    • x: unknown

    Returns x is Iterable<unknown>

isIterableIterator

  • isIterableIterator(x: unknown): x is IterableIterator<unknown>
  • Type guard to test if a value conforms to both the iterable and iterator protocols. This is basically a slightly relaxed check for whether the value is a Generator.

    internal

    Parameters

    • x: unknown

    Returns x is IterableIterator<unknown>

isPolarBool

  • Type guard to test if a Polar value received from across the WebAssembly boundary is a Polar boolean.

    internal

    Parameters

    Returns v is PolarBool

isPolarComparisonOperator

  • isPolarComparisonOperator(s: string): s is "Eq" | "Geq" | "Gt" | "Leq" | "Lt" | "Neq"
  • Type guard to test if a string received from across the WebAssembly boundary is a PolarComparisonOperator.

    internal

    Parameters

    • s: string

    Returns s is "Eq" | "Geq" | "Gt" | "Leq" | "Lt" | "Neq"

isPolarDict

  • Type guard to test if a Polar value received from across the WebAssembly boundary is a Polar dictionary.

    internal

    Parameters

    Returns v is PolarDict

isPolarExpression

  • isPolarExpression(v: PolarValue): v is PolarExpression
  • Type guard to test if a Polar value received from across the WebAssembly boundary is a Polar expression.

    internal

    Parameters

    Returns v is PolarExpression

isPolarInstance

  • isPolarInstance(v: PolarValue): v is PolarInstance
  • Type guard to test if a Polar value received from across the WebAssembly boundary is a Polar application instance.

    internal

    Parameters

    Returns v is PolarInstance

isPolarList

  • Type guard to test if a Polar value received from across the WebAssembly boundary is a Polar list.

    internal

    Parameters

    Returns v is PolarList

isPolarNum

  • Type guard to test if a Polar value received from across the WebAssembly boundary is a Polar numeric.

    internal

    Parameters

    Returns v is PolarNum

isPolarPattern

  • isPolarPattern(v: PolarValue): v is PolarPattern
  • Type guard to test if a Polar value received from across the WebAssembly boundary is a Polar pattern.

    internal

    Parameters

    Returns v is PolarPattern

isPolarPredicate

  • isPolarPredicate(v: PolarValue): v is PolarPredicate
  • Type guard to test if a Polar value received from across the WebAssembly boundary is a Polar predicate.

    internal

    Parameters

    Returns v is PolarPredicate

isPolarStr

  • Type guard to test if a Polar value received from across the WebAssembly boundary is a Polar string.

    internal

    Parameters

    Returns v is PolarStr

isPolarTerm

  • Type guard to test if a JSON payload received from across the WebAssembly boundary contains a valid Polar term.

    internal

    Parameters

    • v: unknown

    Returns v is PolarTerm

isPolarVariable

  • isPolarVariable(v: PolarValue): v is PolarVariable
  • Type guard to test if a Polar value received from across the WebAssembly boundary is a Polar variable.

    internal

    Parameters

    Returns v is PolarVariable