Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace machinery

Index

Type aliases

Maybe<T>: T | null

Type parameters

  • T

Opaque<K, T>: T & { __TYPE__: K }

Type parameters

  • K

  • T

Variables

UCANS_STORAGE_KEY: "webnative.auth_ucans" = "webnative.auth_ucans"
USERNAME_STORAGE_KEY: "webnative.auth_username" = "webnative.auth_username"
VERSION: "0.31.0" = "0.31.0"
isBrowser: boolean = ...

Functions

  • arrContains<T>(arr: T[], val: T): boolean
  • assertBrowser(method: string): void
  • asyncWaterfall<T>(val: T, operations: ((val: T) => Promise<T>)[]): Promise<T>
  • Type parameters

    • T

    Parameters

    • val: T
    • operations: ((val: T) => Promise<T>)[]

    Returns Promise<T>

  • authenticatedUserDomain(__namedParameters?: { withFiles?: boolean }): Promise<string | null>
  • The user domain of the authenticated user.

    Parameters

    • __namedParameters: { withFiles?: boolean } = {}
      • Optional withFiles?: boolean

    Returns Promise<string | null>

  • authenticatedUsername(): Promise<string | null>
  • Retrieve the authenticated username.

    Returns Promise<string | null>

  • decodeCID(val: string | object | CID): CID
  • Decode a possibly string-encoded CID. Passing an already decoded CID instance works too.

    throws

    Throws an error if a CID cannot be decoded!

    Parameters

    • val: string | object | CID

    Returns CID

  • encodeCID(cid: string | CID): string
  • Encode a CID as a string.

    Parameters

    • cid: string | CID

    Returns string

  • hasProp<K>(data: unknown, prop: K): data is Record<K, unknown>
  • Type parameters

    • K: PropertyKey

    Parameters

    • data: unknown
    • prop: K

    Returns data is Record<K, unknown>

  • isBlob(val: unknown): val is Blob
  • isBool(val: unknown): val is boolean
  • isDefined<T>(val: undefined | T): val is T
  • isJust<T>(val: null | T): val is T
  • isNum(val: unknown): val is number
  • isObject<T>(val: unknown): val is Record<string, T>
  • isString(val: unknown): val is string
  • isValue<T>(val: undefined | null | T): val is T
  • mapObj<T, S>(obj: {}, fn: (val: T, key: string) => S): {}
  • Type parameters

    • T

    • S

    Parameters

    • obj: {}
      • [key: string]: T
    • fn: (val: T, key: string) => S
        • (val: T, key: string): S
        • Parameters

          • val: T
          • key: string

          Returns S

    Returns {}

    • [key: string]: S
  • mapObjAsync<T, S>(obj: {}, fn: (val: T, key: string) => Promise<S>): Promise<{}>
  • Type parameters

    • T

    • S

    Parameters

    • obj: {}
      • [key: string]: T
    • fn: (val: T, key: string) => Promise<S>
        • (val: T, key: string): Promise<S>
        • Parameters

          • val: T
          • key: string

          Returns Promise<S>

    Returns Promise<{}>

  • notNull<T>(val: null | T): val is T
  • removeKeyFromObj<T>(obj: {}, key: string): {}
  • Type parameters

    • T

    Parameters

    • obj: {}
      • [key: string]: T
    • key: string

    Returns {}

    • [key: string]: T
  • updateOrRemoveKeyFromObj<T>(obj: {}, key: string, val: Maybe<T>): {}
  • Type parameters

    • T

    Parameters

    • obj: {}
      • [key: string]: T
    • key: string
    • val: Maybe<T>

    Returns {}

    • [key: string]: T

Generated using TypeDoc