Class MapeoProject

Hierarchy

  • TypedEmitter
    • MapeoProject

Constructors

  • Parameters

    • opts: {
          coreStorage: CoreStorage;
          dbPath: string;
          encryptionKeys: EncryptionKeys;
          getFallbackProjectInfo: (() => undefined | ProjectInfo);
          getMediaBaseUrl: ((mediaType: "blobs" | "icons") => Promise<string>);
          isArchiveDevice: boolean;
          keyManager: KeyManager;
          localPeers: LocalPeers;
          logger: undefined | Logger;
          makeWebsocket: undefined | ((url: string) => WebSocket);
          projectKey: Buffer;
          projectMigrationsFolder: string;
          projectSecretKey: undefined | Buffer;
          sharedDb: BetterSQLite3Database<Record<string, never>, any>;
          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

      • getFallbackProjectInfo: (() => undefined | ProjectInfo)
      • 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
      • makeWebsocket: undefined | ((url: string) => WebSocket)
      • 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>, any>
      • sharedIndexWriter: IndexWriter<MapeoDocTables>

    Returns MapeoProject

Properties

$blobs: BlobApi
EMPTY_PROJECT_SETTINGS: Readonly<{
    sendStats: false;
}> = EMPTY_PROJECT_SETTINGS

Accessors

  • get [kIsArchiveDevice](): boolean
  • Returns boolean

  • get deviceId(): string
  • Returns string

Methods

  • Clear synced data, but keep auth data and own data

    Returns Promise<void>

  • Parameters

    • observations: boolean
    • tracks: boolean

    Returns Promise<string>

  • 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">>

  • Returns Promise<boolean>

  • 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>

  • Export observations and or tracks as a GeoJSON file

    Parameters

    • exportFolder: string

      Path to save the file. The file name is auto-generated

    • Optionaloptions: {
          lang: undefined | string;
          observations: undefined | boolean;
          tracks: undefined | boolean;
      } = {}
      • lang: undefined | string
      • observations: undefined | boolean

        Whether observations should be exported

      • tracks: undefined | boolean

        Whether all tracks and their observations should be exported

    Returns Promise<string>

    The full path that the file was exported at

  • Export observations, tracks, and or attachments as a zip file.

    Parameters

    • exportFolder: string

      Path to save the file. The file name is auto-generated

    • Optionaloptions: {
          attachments: undefined | boolean;
          lang: undefined | string;
          observations: undefined | boolean;
          tracks: undefined | boolean;
      } = {}
      • attachments: undefined | boolean

        Whether all attachments for observations should be exported

      • lang: undefined | string
      • observations: undefined | boolean

        Whether observations should be exported

      • tracks: undefined | boolean

        Whether all tracks and their observations should be exported

    Returns Promise<string>

    The full path that the file was exported at

  • Parameters

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

    Returns Promise<Error[]>

  • Resolves when hypercores have all loaded

    Returns Promise<void>