Class IndexedDbArchivist<TParams, TEventData>

Type Parameters

Hierarchy (View Summary)

Constructors

Properties

Accessors

Methods

Constructors

  • Type Parameters

    • TParams extends BaseParamsFields & {
          account?: AccountInstance | "random";
          additionalSigners?: AccountInstance[];
          addToResolvers?: boolean;
          allowNameResolution?: boolean;
          config: DeepRestrictToStringKeys<
              {
                  allowedQueries?: string[];
                  archiving?: { archivists?: string[]; queries?: string[] };
                  archivist?: string;
                  consoleLogger?: LogLevel;
                  dbName?: string;
                  dbVersion?: number;
                  labels?: { [key: string]: undefined | string };
                  name?: string;
                  paging?: { [key: string]: { size?: number } };
                  parents?: {
                      commit?: Lowercase<string>[];
                      read?: Lowercase<string>[];
                      write?: Lowercase<string>[];
                  };
                  requireAllParents?: boolean;
                  retry?: { backoff?: number; interval?: number; retries?: number };
                  schema: string;
                  security?: {
                      allowAnonymous?: boolean;
                      allowed?: { [key: string]: (Lowercase<(...)> | (...)[])[] };
                      disallowed?: { [key: string]: Lowercase<string>[] };
                  };
                  sign?: boolean;
                  storage?: {
                      indexes?: {
                          key: { [key: string]: IndexDirection };
                          multiEntry?: boolean;
                          name?: string;
                          unique?: boolean;
                      }[];
                  };
                  storeName?: string;
                  storeParentReads?: boolean;
                  storeQueries?: boolean;
                  timestamp?: boolean;
              },
          >;
          ephemeralQueryAccountEnabled?: boolean;
          moduleIdentifierTransformers?: ModuleIdentifierTransformer[];
      } = BaseParamsFields & {
          account?: AccountInstance | "random";
          additionalSigners?: AccountInstance[];
          addToResolvers?: boolean;
          allowNameResolution?: boolean;
          config: DeepRestrictToStringKeys<
              {
                  allowedQueries?: string[];
                  archiving?: { archivists?: string[]; queries?: string[] };
                  archivist?: string;
                  consoleLogger?: LogLevel;
                  dbName?: string;
                  dbVersion?: number;
                  labels?: { [key: string]: undefined | string };
                  name?: string;
                  paging?: { [key: string]: { size?: number } };
                  parents?: {
                      commit?: Lowercase<string>[];
                      read?: Lowercase<string>[];
                      write?: Lowercase<string>[];
                  };
                  requireAllParents?: boolean;
                  retry?: { backoff?: number; interval?: number; retries?: number };
                  schema: string;
                  security?: {
                      allowAnonymous?: boolean;
                      allowed?: { [key: string]: (Lowercase<(...)> | (...)[])[] };
                      disallowed?: { [key: string]: Lowercase<string>[] };
                  };
                  sign?: boolean;
                  storage?: {
                      indexes?: {
                          key: { [key: string]: IndexDirection };
                          multiEntry?: boolean;
                          name?: string;
                          unique?: boolean;
                      }[];
                  };
                  storeName?: string;
                  storeParentReads?: boolean;
                  storeQueries?: boolean;
                  timestamp?: boolean;
              },
          >;
          ephemeralQueryAccountEnabled?: boolean;
          moduleIdentifierTransformers?: ModuleIdentifierTransformer[];
      }
    • TEventData extends ArchivistModuleEventData = ArchivistModuleEventData

    Parameters

    Returns IndexedDbArchivist<TParams, TEventData>

Properties

_account: AccountInstance
_cachedManifests: LRUCache<
    number,
    | DeepRestrictToStringKeys<
        {
            config: {
                accountPath?: string;
                features?: string[];
                labels?: { [x: string]: undefined
                | string };
                language?: string;
                name: string;
                os?: string;
                schema: string;
            };
            description?: string;
            lazyStart?: boolean;
            schema: "network.xyo.module.manifest";
            status?: {
                address: Lowercase<string>;
                children?: { [x: Lowercase<string>]: null | string };
            };
        },
    >
    | DeepRestrictToStringKeys<
        {
            config: {
                accountPath?: string;
                features?: string[];
                labels?: { [x: string]: undefined
                | string };
                language?: string;
                name: string;
                os?: string;
                schema: string;
            };
            description?: string;
            lazyStart?: boolean;
            schema: "network.xyo.node.manifest";
            status?: {
                address: Lowercase<string>;
                children?: { [x: Lowercase<string>]: null | string };
            };
        },
    >,
>
_lastError?: ModuleDetailsError
_started: undefined | Promisable<boolean>
_startPromise: undefined | Promisable<boolean>
eventData: TEventData
moduleConfigQueryValidator: Queryable<UnsignedQueryBoundWitness>
supportedQueryValidator: Queryable<UnsignedQueryBoundWitness>
allowRandomAccount: boolean
configSchemas: string[] = ...
dataHashIndexName: string = ...
defaultConfigSchema: string = IndexedDbArchivistConfigSchema
defaultDbName: "archivist" = 'archivist'
defaultDbVersion: 1
defaultLogger: Logger
defaultStoreName: "payloads" = 'payloads'
enableLazyLoad: boolean
globalInstances: Record<string, WeakRef<Base<undefined | BaseParamsFields>>[]>
globalInstancesCountHistory: Record<string, number[]>
hashIndexName: string = ...
labels: Labels
privateConstructorKey: string
schemaIndexName: string = ...
sequenceIndexName: string = ...
uniqueName: string
useNewResolver: false

Accessors

  • get account(): AccountInstance
  • Returns AccountInstance

  • get additionalSigners(): AccountInstance[]
  • Returns AccountInstance[]

  • get address(): Lowercase<string>
  • Returns Lowercase<string>

  • get allowAnonymous(): boolean
  • Returns boolean

  • get allowNameResolution(): boolean
  • Returns boolean

  • get archiving(): undefined | { archivists?: string[]; queries?: string[] }
  • Returns undefined | { archivists?: string[]; queries?: string[] }

  • get archivist(): undefined | string
  • Returns undefined | string

  • get config(): TParams["config"]
  • Returns TParams["config"]

  • get dbName(): string
  • The database name. If not supplied via config, it defaults to the module name (not guaranteed to be unique) and if module name is not supplied, it defaults to archivist. This behavior biases towards a single, isolated DB per archivist which seems to make the most sense for 99% of use cases.

    Returns string

  • get dead(): boolean
  • Returns boolean

  • get ephemeralQueryAccountEnabled(): boolean
  • Returns boolean

  • get id(): string
  • Returns string

  • get logger(): Logger
  • Returns Logger

  • get modName(): undefined | string
  • Returns undefined | string

  • get params(): TParams
  • Returns TParams

  • get priority(): 2
  • Returns 2

  • get requireAllParents(): boolean
  • Returns boolean

  • get root(): this
  • Returns this

  • get status(): ModuleStatus
  • Returns ModuleStatus

  • set status(value: ModuleStatus): void
  • Parameters

    Returns void

  • get storeParentReads(): boolean
  • Returns boolean

  • get timestamp(): boolean
  • Returns boolean

  • get historyInterval(): number
  • Returns number

  • set historyInterval(value: number): void
  • Parameters

    • value: number

    Returns void

  • get historyTime(): number
  • Returns number

  • set historyTime(value: number): void
  • Parameters

    • value: number

    Returns void

  • get maxGcFrequency(): number
  • Returns number

  • set maxGcFrequency(value: number): void
  • Parameters

    • value: number

    Returns void

  • get maxHistoryDepth(): number
  • Returns number

Methods

  • Returns void

  • Parameters

    • funcName: string

    Returns any

  • Parameters

    • functionName: string

    Returns void

  • Type Parameters

    • T extends DeepRestrictToStringKeys<
          {
              address?: Lowercase<string>
              | Lowercase<string>[];
              budget?: number;
              maxFrequency?:
                  | "once"
                  | "second"
                  | "minute"
                  | "hour"
                  | "day"
                  | "week"
                  | "month"
                  | "year";
              minBid?: number;
              schema: string;
          },
      >

    Parameters

    Returns PromiseEx<
        [
            UnsignedQueryBoundWitness,
            DeepRestrictToStringKeys<{ schema: string }>[],
            DeepRestrictToStringKeys<{ schema: string }>[],
        ],
        AccountInstance,
    >

  • Type Parameters

    • T extends DeepRestrictToStringKeys<
          {
              address?: Lowercase<string>
              | Lowercase<string>[];
              budget?: number;
              maxFrequency?:
                  | "once"
                  | "second"
                  | "minute"
                  | "hour"
                  | "day"
                  | "week"
                  | "month"
                  | "year";
              minBid?: number;
              schema: string;
          },
      >

    Parameters

    Returns Promise<
        [
            UnsignedQueryBoundWitness,
            DeepRestrictToStringKeys<{ schema: string }>[],
            DeepRestrictToStringKeys<{ schema: string }>[],
        ],
    >

  • Type Parameters

    • T extends DeepRestrictToStringKeys<
          {
              address?: Lowercase<string>
              | Lowercase<string>[];
              budget?: number;
              maxFrequency?:
                  | "once"
                  | "second"
                  | "minute"
                  | "hour"
                  | "day"
                  | "week"
                  | "month"
                  | "year";
              minBid?: number;
              schema: string;
          },
      >

    Parameters

    • query: T
    • payloads: DeepRestrictToStringKeys<{ schema: string }>[]
    • OptionaladditionalWitnesses: AccountInstance[]
    • Optionalerrors: DeepRestrictToStringKeys<
          {
              details?: | null
              | string
              | number
              | boolean
              | {
                  [key: string]: | null
                  | string
                  | number
                  | boolean
                  | (
                      { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; }
                  )
                  | (
                      string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null
                  )[];
              }
              | (
                  | null
                  | string
                  | number
                  | boolean
                  | {
                      [key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null;
                  }
                  | (
                      (string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null)[]
                  )
              )[];
              message?: string;
              name?: string;
              query?: Lowercase<string>;
              schema: "network.xyo.error.module";
          },
      >[]

    Returns Promise<ModuleQueryResult>

  • Type Parameters

    • R

    Parameters

    • closure: () => Promise<R>

    Returns Promise<R>

  • Returns Promisable<void>

  • Parameters

    • hashes: Lowercase<string>[]

    Returns Promise<Lowercase<string>[]>

  • Parameters

    Returns Promise<Lowercase<string>[]>

  • Returns Promise<
        DeepRestrictToStringKeys<
            {
                address: Lowercase<string>;
                children?: string[];
                name?: string;
                queries: string[];
                schema: "network.xyo.module.description";
            },
        >,
    >

  • Uses an index to get a payload by the index value, but returns the value with the primary key (from the root store)

    Parameters

    • db: IDBPDatabase<ObjectStore>

      The db instance to use

    • storeName: string

      The name of the store to use

    • indexName: string

      The index to use

    • key: IDBValidKey

      The key to get from the index

    Returns Promise<undefined | [number, WithStorageMeta]>

    The primary key and the payload, or undefined if not found

  • Parameters

    • schema: string

    Returns boolean

  • Parameters

    • OptionalmaxDepth: number

    Returns Promise<
        | DeepRestrictToStringKeys<
            {
                config: {
                    accountPath?: string;
                    features?: string[];
                    labels?: { [key: string]: undefined
                    | string };
                    language?: string;
                    name: string;
                    os?: string;
                    schema: string;
                };
                description?: string;
                lazyStart?: boolean;
                schema: "network.xyo.module.manifest";
                status?: {
                    address: Lowercase<string>;
                    children?: { [key: Lowercase<string>]: null | string };
                };
            },
        >
        | DeepRestrictToStringKeys<
            {
                config: {
                    accountPath?: string;
                    features?: string[];
                    labels?: { [key: string]: undefined
                    | string };
                    language?: string;
                    name: string;
                    os?: string;
                    schema: string;
                };
                description?: string;
                lazyStart?: boolean;
                schema: "network.xyo.node.manifest";
                status?: {
                    address: Lowercase<string>;
                    children?: { [key: Lowercase<string>]: null | string };
                };
            },
        >,
    >

  • Parameters

    • OptionalmaxDepth: number
    • Optional_ignoreAddresses: Lowercase<string>[]

    Returns Promise<
        | DeepRestrictToStringKeys<
            {
                config: {
                    accountPath?: string;
                    features?: string[];
                    labels?: { [key: string]: undefined
                    | string };
                    language?: string;
                    name: string;
                    os?: string;
                    schema: string;
                };
                description?: string;
                lazyStart?: boolean;
                schema: "network.xyo.module.manifest";
                status?: {
                    address: Lowercase<string>;
                    children?: { [key: Lowercase<string>]: null | string };
                };
            },
        >
        | DeepRestrictToStringKeys<
            {
                config: {
                    accountPath?: string;
                    features?: string[];
                    labels?: { [key: string]: undefined
                    | string };
                    language?: string;
                    name: string;
                    os?: string;
                    schema: string;
                };
                description?: string;
                lazyStart?: boolean;
                schema: "network.xyo.node.manifest";
                status?: {
                    address: Lowercase<string>;
                    children?: { [key: Lowercase<string>]: null | string };
                };
            },
        >,
    >

  • Parameters

    Returns Promise<
        ModuleQueryResult<
            | DeepRestrictToStringKeys<
                {
                    config: {
                        accountPath?: string;
                        features?: string[];
                        labels?: { [key: string]: undefined
                        | string };
                        language?: string;
                        name: string;
                        os?: string;
                        schema: string;
                    };
                    description?: string;
                    lazyStart?: boolean;
                    schema: "network.xyo.module.manifest";
                    status?: {
                        address: Lowercase<string>;
                        children?: { [key: Lowercase<string>]: null | string };
                    };
                },
            >
            | DeepRestrictToStringKeys<
                {
                    config: {
                        accountPath?: string;
                        features?: string[];
                        labels?: { [key: string]: undefined
                        | string };
                        language?: string;
                        name: string;
                        os?: string;
                        schema: string;
                    };
                    description?: string;
                    lazyStart?: boolean;
                    schema: "network.xyo.node.manifest";
                    status?: {
                        address: Lowercase<string>;
                        children?: { [key: Lowercase<string>]: null | string };
                    };
                },
            >,
        >,
    >

  • Returns Promise<
        (
            | DeepRestrictToStringKeys<
                { address: Lowercase<string>; schema: "network.xyo.address" },
            >
            | DeepRestrictToStringKeys<
                {
                    address: Lowercase<string>;
                    previousHash?: string;
                    schema: "network.xyo.address.hash.previous";
                },
            >
        )[],
    >

  • Returns Promisable<
        (
            | DeepRestrictToStringKeys<
                { address: Lowercase<string>; schema: "network.xyo.address" },
            >
            | DeepRestrictToStringKeys<
                {
                    address: Lowercase<string>;
                    previousHash?: string;
                    schema: "network.xyo.address.hash.previous";
                },
            >
        )[],
    >

  • Returns Promisable<undefined | string>

  • Type Parameters

    • T extends UnsignedQueryBoundWitness = UnsignedQueryBoundWitness
    • TConfig extends DeepRestrictToStringKeys<
          {
              allowedQueries?: string[];
              archiving?: { archivists?: string[]; queries?: string[] };
              archivist?: string;
              consoleLogger?: LogLevel;
              labels?: { [key: string]: undefined | string };
              name?: string;
              paging?: { [key: string]: { size?: number } };
              retry?: { backoff?: number; interval?: number; retries?: number };
              schema: "network.xyo.module.config";
              security?: {
                  allowAnonymous?: boolean;
                  allowed?: { [key: string]: (Lowercase<string> | Lowercase<string>[])[] };
                  disallowed?: { [key: string]: Lowercase<string>[] };
              };
              sign?: boolean;
              storeQueries?: boolean;
              timestamp?: boolean;
          },
      > = DeepRestrictToStringKeys<
          {
              allowedQueries?: string[];
              archiving?: { archivists?: string[]; queries?: string[] };
              archivist?: string;
              consoleLogger?: LogLevel;
              labels?: { [key: string]: undefined | string };
              name?: string;
              paging?: { [key: string]: { size?: number } };
              retry?: { backoff?: number; interval?: number; retries?: number };
              schema: "network.xyo.module.config";
              security?: {
                  allowAnonymous?: boolean;
                  allowed?: { [key: string]: (Lowercase<string> | Lowercase<string>[])[] };
                  disallowed?: { [key: string]: Lowercase<string>[] };
              };
              sign?: boolean;
              storeQueries?: boolean;
              timestamp?: boolean;
          },
      >

    Parameters

    Returns Promise<ModuleQueryResult>

  • Type Parameters

    • T extends UnsignedQueryBoundWitness = UnsignedQueryBoundWitness
    • TConfig extends DeepRestrictToStringKeys<
          {
              allowedQueries?: string[];
              archiving?: { archivists?: string[]; queries?: string[] };
              archivist?: string;
              consoleLogger?: LogLevel;
              labels?: { [key: string]: undefined | string };
              name?: string;
              paging?: { [key: string]: { size?: number } };
              retry?: { backoff?: number; interval?: number; retries?: number };
              schema: "network.xyo.module.config";
              security?: {
                  allowAnonymous?: boolean;
                  allowed?: { [key: string]: (Lowercase<string> | Lowercase<string>[])[] };
                  disallowed?: { [key: string]: Lowercase<string>[] };
              };
              sign?: boolean;
              storeQueries?: boolean;
              timestamp?: boolean;
          },
      > = DeepRestrictToStringKeys<
          {
              allowedQueries?: string[];
              archiving?: { archivists?: string[]; queries?: string[] };
              archivist?: string;
              consoleLogger?: LogLevel;
              labels?: { [key: string]: undefined | string };
              name?: string;
              paging?: { [key: string]: { size?: number } };
              retry?: { backoff?: number; interval?: number; retries?: number };
              schema: "network.xyo.module.config";
              security?: {
                  allowAnonymous?: boolean;
                  allowed?: { [key: string]: (Lowercase<string> | Lowercase<string>[])[] };
                  disallowed?: { [key: string]: Lowercase<string>[] };
              };
              sign?: boolean;
              storeQueries?: boolean;
              timestamp?: boolean;
          },
      >

    Parameters

    Returns Promise<boolean>

  • Type Parameters

    • T extends UnsignedQueryBoundWitness = UnsignedQueryBoundWitness
    • TConfig extends DeepRestrictToStringKeys<
          {
              allowedQueries?: string[];
              archiving?: { archivists?: string[]; queries?: string[] };
              archivist?: string;
              consoleLogger?: LogLevel;
              labels?: { [key: string]: undefined | string };
              name?: string;
              paging?: { [key: string]: { size?: number } };
              retry?: { backoff?: number; interval?: number; retries?: number };
              schema: "network.xyo.module.config";
              security?: {
                  allowAnonymous?: boolean;
                  allowed?: { [key: string]: (Lowercase<string> | Lowercase<string>[])[] };
                  disallowed?: { [key: string]: Lowercase<string>[] };
              };
              sign?: boolean;
              storeQueries?: boolean;
              timestamp?: boolean;
          },
      > = DeepRestrictToStringKeys<
          {
              allowedQueries?: string[];
              archiving?: { archivists?: string[]; queries?: string[] };
              archivist?: string;
              consoleLogger?: LogLevel;
              labels?: { [key: string]: undefined | string };
              name?: string;
              paging?: { [key: string]: { size?: number } };
              retry?: { backoff?: number; interval?: number; retries?: number };
              schema: "network.xyo.module.config";
              security?: {
                  allowAnonymous?: boolean;
                  allowed?: { [key: string]: (Lowercase<string> | Lowercase<string>[])[] };
                  disallowed?: { [key: string]: Lowercase<string>[] };
              };
              sign?: boolean;
              storeQueries?: boolean;
              timestamp?: boolean;
          },
      >

    Parameters

    Returns Promise<ModuleQueryHandlerResult>

  • Parameters

    • address: Lowercase<string>

    Returns void

  • Type Parameters

    • T extends DeepRestrictToStringKeys<
          {
              address?: Lowercase<string>
              | Lowercase<string>[];
              budget?: number;
              maxFrequency?:
                  | "once"
                  | "second"
                  | "minute"
                  | "hour"
                  | "day"
                  | "week"
                  | "month"
                  | "year";
              minBid?: number;
              schema: string;
          },
      >
    • P extends DeepRestrictToStringKeys<{ schema: string }> = DeepRestrictToStringKeys<{ schema: string }>
    • R extends DeepRestrictToStringKeys<{ schema: string }> = DeepRestrictToStringKeys<{ schema: string }>

    Parameters

    Returns Promise<R[]>

  • Type Parameters

    • T extends DeepRestrictToStringKeys<
          {
              address?: Lowercase<string>
              | Lowercase<string>[];
              budget?: number;
              maxFrequency?:
                  | "once"
                  | "second"
                  | "minute"
                  | "hour"
                  | "day"
                  | "week"
                  | "month"
                  | "year";
              minBid?: number;
              schema: string;
          },
      >
    • P extends DeepRestrictToStringKeys<{ schema: string }> = DeepRestrictToStringKeys<{ schema: string }>
    • R extends DeepRestrictToStringKeys<{ schema: string }> = DeepRestrictToStringKeys<{ schema: string }>

    Parameters

    Returns Promise<ModuleQueryResult<R>>

  • Parameters

    • Optional_timeout: number

    Returns Promisable<boolean>

  • Parameters

    • OptionalnotStartedAction: "error" | "warn" | "log" | "throw" | "none"
    • OptionaltryStart: boolean

    Returns Promise<boolean>

  • Parameters

    • Optional_timeout: number

    Returns Promise<boolean>

  • Parameters

    • Optional_timeout: number

    Returns Promisable<boolean>

  • Returns void

  • Parameters

    • Optionalconfig: unknown
    • Optionalparents: string[]

    Returns boolean

  • Parameters

    • funcName: string

    Returns any

  • Parameters

    • functionName: string

    Returns void

  • Parameters

    • Optionalforce: boolean

    Returns void

  • Parameters

    • className: string

    Returns void

  • Parameters

    • className: string

    Returns number

  • Returns Record<string, number>

  • Returns void

  • Returns void