Class MapeoProject

Hierarchy

  • TypedEmitter
    • MapeoProject

Constructors

  • Parameters

    • opts: {
          coreStorage: CoreStorage;
          dbPath: string;
          encryptionKeys: EncryptionKeys;
          getMediaBaseUrl: ((mediaType: "blobs" | "icons") => Promise<string>);
          isArchiveDevice: boolean;
          keyManager: KeyManager;
          localPeers: LocalPeers;
          logger: undefined | Logger;
          projectKey: Buffer;
          projectMigrationsFolder: string;
          projectSecretKey: undefined | Buffer;
          sharedDb: BetterSQLite3Database<Record<string, never>>;
          sharedIndexWriter: IndexWriter<MapeoDocTables>;
      }
      • coreStorage: CoreStorage

        Folder to store all hypercore data

      • dbPath: string

        Path to store project sqlite db. Use :memory: for memory storage

      • encryptionKeys: EncryptionKeys

        Encryption keys for each namespace

      • getMediaBaseUrl: ((mediaType: "blobs" | "icons") => Promise<string>)
          • (mediaType): Promise<string>
          • Parameters

            • mediaType: "blobs" | "icons"

            Returns Promise<string>

      • isArchiveDevice: boolean

        Whether this device is an archive device

      • keyManager: KeyManager

        mapeo/crypto KeyManager instance

      • localPeers: LocalPeers
      • logger: undefined | Logger
      • projectKey: Buffer

        32-byte public key of the project creator core

      • projectMigrationsFolder: string

        path for drizzle migration folder for project

      • projectSecretKey: undefined | Buffer

        32-byte secret key of the project creator core

      • sharedDb: BetterSQLite3Database<Record<string, never>>
      • sharedIndexWriter: IndexWriter<MapeoDocTables>

    Returns MapeoProject

Properties

$blobs: BlobApi
EMPTY_PROJECT_SETTINGS: Readonly<{}> = EMPTY_PROJECT_SETTINGS

Accessors

  • get [kDataTypes](): {
        coreOwnership: DataType<DataStore<"auth", "role" | "coreOwnership">, SQLiteTableWithColumns<{}>, "coreOwnership", {}, {}>;
        deviceInfo: DataType<DataStore<"config",
            | "translation"
            | "projectSettings"
            | "preset"
            | "icon"
            | "field"
            | "deviceInfo">, SQLiteTableWithColumns<{}>, "deviceInfo", {}, {}>;
        field: DataType<DataStore<"config",
            | "translation"
            | "projectSettings"
            | "preset"
            | "icon"
            | "field"
            | "deviceInfo">, SQLiteTableWithColumns<{}>, "field", {}, {}>;
        icon: DataType<DataStore<"config",
            | "translation"
            | "projectSettings"
            | "preset"
            | "icon"
            | "field"
            | "deviceInfo">, SQLiteTableWithColumns<{}>, "icon", {}, {}>;
        observation: DataType<DataStore<"data", "track" | "remoteDetectionAlert" | "observation">, SQLiteTableWithColumns<{}>, "observation", {}, {}>;
        preset: DataType<DataStore<"config",
            | "translation"
            | "projectSettings"
            | "preset"
            | "icon"
            | "field"
            | "deviceInfo">, SQLiteTableWithColumns<{}>, "preset", {}, {}>;
        projectSettings: DataType<DataStore<"config",
            | "translation"
            | "projectSettings"
            | "preset"
            | "icon"
            | "field"
            | "deviceInfo">, SQLiteTableWithColumns<{}>, "projectSettings", {}, {}>;
        remoteDetectionAlert: DataType<DataStore<"data", "track" | "remoteDetectionAlert" | "observation">, SQLiteTableWithColumns<{}>, "remoteDetectionAlert", {}, {}>;
        role: DataType<DataStore<"auth", "role" | "coreOwnership">, SQLiteTableWithColumns<{}>, "role", {}, {}>;
        track: DataType<DataStore<"data", "track" | "remoteDetectionAlert" | "observation">, SQLiteTableWithColumns<{}>, "track", {}, {}>;
        translation: DataType<DataStore<"config",
            | "translation"
            | "projectSettings"
            | "preset"
            | "icon"
            | "field"
            | "deviceInfo">, SQLiteTableWithColumns<{}>, "translation", {}, {}>;
    }
  • DataTypes object mappings, used for tests

    Returns {
        coreOwnership: DataType<DataStore<"auth", "role" | "coreOwnership">, SQLiteTableWithColumns<{}>, "coreOwnership", {}, {}>;
        deviceInfo: DataType<DataStore<"config",
            | "translation"
            | "projectSettings"
            | "preset"
            | "icon"
            | "field"
            | "deviceInfo">, SQLiteTableWithColumns<{}>, "deviceInfo", {}, {}>;
        field: DataType<DataStore<"config",
            | "translation"
            | "projectSettings"
            | "preset"
            | "icon"
            | "field"
            | "deviceInfo">, SQLiteTableWithColumns<{}>, "field", {}, {}>;
        icon: DataType<DataStore<"config",
            | "translation"
            | "projectSettings"
            | "preset"
            | "icon"
            | "field"
            | "deviceInfo">, SQLiteTableWithColumns<{}>, "icon", {}, {}>;
        observation: DataType<DataStore<"data", "track" | "remoteDetectionAlert" | "observation">, SQLiteTableWithColumns<{}>, "observation", {}, {}>;
        preset: DataType<DataStore<"config",
            | "translation"
            | "projectSettings"
            | "preset"
            | "icon"
            | "field"
            | "deviceInfo">, SQLiteTableWithColumns<{}>, "preset", {}, {}>;
        projectSettings: DataType<DataStore<"config",
            | "translation"
            | "projectSettings"
            | "preset"
            | "icon"
            | "field"
            | "deviceInfo">, SQLiteTableWithColumns<{}>, "projectSettings", {}, {}>;
        remoteDetectionAlert: DataType<DataStore<"data", "track" | "remoteDetectionAlert" | "observation">, SQLiteTableWithColumns<{}>, "remoteDetectionAlert", {}, {}>;
        role: DataType<DataStore<"auth", "role" | "coreOwnership">, SQLiteTableWithColumns<{}>, "role", {}, {}>;
        track: DataType<DataStore<"data", "track" | "remoteDetectionAlert" | "observation">, SQLiteTableWithColumns<{}>, "track", {}, {}>;
        translation: DataType<DataStore<"config",
            | "translation"
            | "projectSettings"
            | "preset"
            | "icon"
            | "field"
            | "deviceInfo">, SQLiteTableWithColumns<{}>, "translation", {}, {}>;
    }

    • coreOwnership: DataType<DataStore<"auth", "role" | "coreOwnership">, SQLiteTableWithColumns<{}>, "coreOwnership", {}, {}>
    • deviceInfo: DataType<DataStore<"config",
          | "translation"
          | "projectSettings"
          | "preset"
          | "icon"
          | "field"
          | "deviceInfo">, SQLiteTableWithColumns<{}>, "deviceInfo", {}, {}>
    • field: DataType<DataStore<"config",
          | "translation"
          | "projectSettings"
          | "preset"
          | "icon"
          | "field"
          | "deviceInfo">, SQLiteTableWithColumns<{}>, "field", {}, {}>
    • icon: DataType<DataStore<"config",
          | "translation"
          | "projectSettings"
          | "preset"
          | "icon"
          | "field"
          | "deviceInfo">, SQLiteTableWithColumns<{}>, "icon", {}, {}>
    • observation: DataType<DataStore<"data", "track" | "remoteDetectionAlert" | "observation">, SQLiteTableWithColumns<{}>, "observation", {}, {}>
    • preset: DataType<DataStore<"config",
          | "translation"
          | "projectSettings"
          | "preset"
          | "icon"
          | "field"
          | "deviceInfo">, SQLiteTableWithColumns<{}>, "preset", {}, {}>
    • projectSettings: DataType<DataStore<"config",
          | "translation"
          | "projectSettings"
          | "preset"
          | "icon"
          | "field"
          | "deviceInfo">, SQLiteTableWithColumns<{}>, "projectSettings", {}, {}>
    • remoteDetectionAlert: DataType<DataStore<"data", "track" | "remoteDetectionAlert" | "observation">, SQLiteTableWithColumns<{}>, "remoteDetectionAlert", {}, {}>
    • role: DataType<DataStore<"auth", "role" | "coreOwnership">, SQLiteTableWithColumns<{}>, "role", {}, {}>
    • track: DataType<DataStore<"data", "track" | "remoteDetectionAlert" | "observation">, SQLiteTableWithColumns<{}>, "track", {}, {}>
    • translation: DataType<DataStore<"config",
          | "translation"
          | "projectSettings"
          | "preset"
          | "icon"
          | "field"
          | "deviceInfo">, SQLiteTableWithColumns<{}>, "translation", {}, {}>
  • get [kIsArchiveDevice](): boolean
  • Returns boolean

  • get deviceId(): string
  • Returns string

  • get field(): DataType<DataStore<"config",
        | "translation"
        | "projectSettings"
        | "preset"
        | "icon"
        | "field"
        | "deviceInfo">, SQLiteTableWithColumns<{}>, "field", {}, {}>
  • Returns DataType<DataStore<"config",
        | "translation"
        | "projectSettings"
        | "preset"
        | "icon"
        | "field"
        | "deviceInfo">, SQLiteTableWithColumns<{}>, "field", {}, {}>

  • get observation(): DataType<DataStore<"data", "track" | "remoteDetectionAlert" | "observation">, SQLiteTableWithColumns<{}>, "observation", {}, {}>
  • Returns DataType<DataStore<"data", "track" | "remoteDetectionAlert" | "observation">, SQLiteTableWithColumns<{}>, "observation", {}, {}>

  • get preset(): DataType<DataStore<"config",
        | "translation"
        | "projectSettings"
        | "preset"
        | "icon"
        | "field"
        | "deviceInfo">, SQLiteTableWithColumns<{}>, "preset", {}, {}>
  • Returns DataType<DataStore<"config",
        | "translation"
        | "projectSettings"
        | "preset"
        | "icon"
        | "field"
        | "deviceInfo">, SQLiteTableWithColumns<{}>, "preset", {}, {}>

  • get remoteDetectionAlert(): DataType<DataStore<"data", "track" | "remoteDetectionAlert" | "observation">, SQLiteTableWithColumns<{}>, "remoteDetectionAlert", {}, {}>
  • Returns DataType<DataStore<"data", "track" | "remoteDetectionAlert" | "observation">, SQLiteTableWithColumns<{}>, "remoteDetectionAlert", {}, {}>

  • get track(): DataType<DataStore<"data", "track" | "remoteDetectionAlert" | "observation">, SQLiteTableWithColumns<{}>, "track", {}, {}>
  • Returns DataType<DataStore<"data", "track" | "remoteDetectionAlert" | "observation">, SQLiteTableWithColumns<{}>, "track", {}, {}>

Methods

  • Clear data if we've left the project. No-op if you're still in the project.

    Returns Promise<void>

  • Returns Promise<void>

  • Replicate a project to a @hyperswarm/secret-stream. Invites will not function because the RPC channel is not connected for project replication, and only this project will replicate.

    Parameters

    • isInitiatorOrStream: boolean | Duplex | Duplex<any, any, any, any, true, true, DuplexEvents<any, any>>

    Returns ReplicationStream

  • Parameters

    • isArchiveDevice: boolean

    Returns Promise<void>

  • Parameters

    • value: Pick<{}, "name" | "deviceType" | "selfHostedServerDetails">

    Returns Promise<{}>

  • Returns Promise<Role<
        | "a12a6702b93bd7ff"
        | "f7c150f5a3a9a855"
        | "012fd2d431c0bf60"
        | "9e6d29263cba36c9"
        | "8ced989b1904606b"
        | "08e4251e36f6e7ed">>

  • Parameters

    • originalVersionId: string

      The originalVersionId from a document.

    Returns Promise<string>

    The device ID for this creator.

    When device ID cannot be found.

  • Returns Promise<void>

  • Parameters

    • opts: {
          configPath: string;
      }
      • configPath: string

    Returns Promise<Error[]>

  • Resolves when hypercores have all loaded

    Returns Promise<void>