Skip to content

Latest commit

 

History

History
445 lines (224 loc) · 11 KB

MapeoProject.md

File metadata and controls

445 lines (224 loc) · 11 KB

APIDocs


API / <internal> / MapeoProject

Class: MapeoProject

Extends

  • TypedEmitter

Constructors

new MapeoProject()

new MapeoProject(opts): MapeoProject

Parameters

opts

opts.coreStorage: CoreStorage

Folder to store all hypercore data

opts.dbPath: string

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

opts.encryptionKeys: EncryptionKeys

Encryption keys for each namespace

opts.getMediaBaseUrl

opts.isArchiveDevice: boolean

Whether this device is an archive device

opts.keyManager: KeyManager

mapeo/crypto KeyManager instance

opts.localPeers: LocalPeers

opts.logger: undefined | Logger

opts.projectKey: Buffer

32-byte public key of the project creator core

opts.projectMigrationsFolder: string

path for drizzle migration folder for project

opts.projectSecretKey: undefined | Buffer

32-byte secret key of the project creator core

opts.sharedDb: BetterSQLite3Database<Record<string, never>>

opts.sharedIndexWriter: IndexWriter<MapeoDocTables>

Returns

MapeoProject

Overrides

TypedEmitter.constructor

Properties

$blobs

$blobs: BlobApi


EMPTY_PROJECT_SETTINGS

static EMPTY_PROJECT_SETTINGS: Readonly<object>

Accessors

[kBlobStore]

get [kBlobStore](): BlobStore

Returns

BlobStore


[kCoreManager]

get [kCoreManager](): CoreManager

CoreManager instance, used for tests

Returns

CoreManager


[kCoreOwnership]

get [kCoreOwnership](): CoreOwnership

CoreOwnership instance, used for tests

Returns

CoreOwnership


[kDataTypes]

get [kDataTypes](): object

DataTypes object mappings, used for tests

Returns

object

coreOwnership

coreOwnership: DataType<DataStore<"auth", "coreOwnership" | "role">, SQLiteTableWithColumns<object>, "coreOwnership", object, object>

deviceInfo

deviceInfo: DataType<DataStore<"config", "translation" | "preset" | "field" | "projectSettings" | "deviceInfo" | "icon">, SQLiteTableWithColumns<object>, "deviceInfo", object, object>

field

field: DataType<DataStore<"config", "translation" | "preset" | "field" | "projectSettings" | "deviceInfo" | "icon">, SQLiteTableWithColumns<object>, "field", object, object>

icon

icon: DataType<DataStore<"config", "translation" | "preset" | "field" | "projectSettings" | "deviceInfo" | "icon">, SQLiteTableWithColumns<object>, "icon", object, object>

observation

observation: DataType<DataStore<"data", "observation" | "track" | "remoteDetectionAlert">, SQLiteTableWithColumns<object>, "observation", object, object>

preset

preset: DataType<DataStore<"config", "translation" | "preset" | "field" | "projectSettings" | "deviceInfo" | "icon">, SQLiteTableWithColumns<object>, "preset", object, object>

projectSettings

projectSettings: DataType<DataStore<"config", "translation" | "preset" | "field" | "projectSettings" | "deviceInfo" | "icon">, SQLiteTableWithColumns<object>, "projectSettings", object, object>

remoteDetectionAlert

remoteDetectionAlert: DataType<DataStore<"data", "observation" | "track" | "remoteDetectionAlert">, SQLiteTableWithColumns<object>, "remoteDetectionAlert", object, object>

role

role: DataType<DataStore<"auth", "coreOwnership" | "role">, SQLiteTableWithColumns<object>, "role", object, object>

track

track: DataType<DataStore<"data", "observation" | "track" | "remoteDetectionAlert">, SQLiteTableWithColumns<object>, "track", object, object>

translation

translation: DataType<DataStore<"config", "translation" | "preset" | "field" | "projectSettings" | "deviceInfo" | "icon">, SQLiteTableWithColumns<object>, "translation", object, object>


[kIsArchiveDevice]

get [kIsArchiveDevice](): boolean

Returns

boolean


$icons

get $icons(): IconApi

Returns

IconApi


$member

get $member(): MemberApi

Returns

MemberApi


$sync

get $sync(): SyncApi

Returns

SyncApi


$translation

get $translation(): default

Returns

default


deviceId

get deviceId(): string

Returns

string


field

get field(): DataType<DataStore<"config", "translation" | "preset" | "field" | "projectSettings" | "deviceInfo" | "icon">, SQLiteTableWithColumns<object>, "field", object, object>

Returns

DataType<DataStore<"config", "translation" | "preset" | "field" | "projectSettings" | "deviceInfo" | "icon">, SQLiteTableWithColumns<object>, "field", object, object>


observation

get observation(): DataType<DataStore<"data", "observation" | "track" | "remoteDetectionAlert">, SQLiteTableWithColumns<object>, "observation", object, object>

Returns

DataType<DataStore<"data", "observation" | "track" | "remoteDetectionAlert">, SQLiteTableWithColumns<object>, "observation", object, object>


preset

get preset(): DataType<DataStore<"config", "translation" | "preset" | "field" | "projectSettings" | "deviceInfo" | "icon">, SQLiteTableWithColumns<object>, "preset", object, object>

Returns

DataType<DataStore<"config", "translation" | "preset" | "field" | "projectSettings" | "deviceInfo" | "icon">, SQLiteTableWithColumns<object>, "preset", object, object>


remoteDetectionAlert

get remoteDetectionAlert(): DataType<DataStore<"data", "observation" | "track" | "remoteDetectionAlert">, SQLiteTableWithColumns<object>, "remoteDetectionAlert", object, object>

Returns

DataType<DataStore<"data", "observation" | "track" | "remoteDetectionAlert">, SQLiteTableWithColumns<object>, "remoteDetectionAlert", object, object>


track

get track(): DataType<DataStore<"data", "observation" | "track" | "remoteDetectionAlert">, SQLiteTableWithColumns<object>, "track", object, object>

Returns

DataType<DataStore<"data", "observation" | "track" | "remoteDetectionAlert">, SQLiteTableWithColumns<object>, "track", object, object>

Methods

[kClearDataIfLeft]()

[kClearDataIfLeft](): Promise<void>

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

Returns

Promise<void>


[kProjectLeave]()

[kProjectLeave](): Promise<void>

Returns

Promise<void>


[kProjectReplicate]()

[kProjectReplicate](isInitiatorOrStream): ReplicationStream

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


[kSetIsArchiveDevice]()

[kSetIsArchiveDevice](isArchiveDevice): Promise<void>

Parameters

isArchiveDevice: boolean

Returns

Promise<void>


[kSetOwnDeviceInfo]()

[kSetOwnDeviceInfo](value): Promise<object>

Parameters

value: Pick<object, "name" | "deviceType" | "selfHostedServerDetails">

Returns

Promise<object>


$getOwnRole()

$getOwnRole(): Promise<Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">>

Returns

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


$getProjectSettings()

$getProjectSettings(): Promise<EditableProjectSettings>

Returns

Promise<EditableProjectSettings>


$originalVersionIdToDeviceId()

$originalVersionIdToDeviceId(originalVersionId): Promise<string>

Parameters

originalVersionId: string

The originalVersionId from a document.

Returns

Promise<string>

The device ID for this creator.

Throws

When device ID cannot be found.


$setProjectSettings()

$setProjectSettings(settings): Promise<EditableProjectSettings>

Parameters

settings: Partial<EditableProjectSettings>

Returns

Promise<EditableProjectSettings>


close()

close(): Promise<void>

Returns

Promise<void>


importConfig()

importConfig(opts): Promise<Error[]>

Parameters

opts

opts.configPath: string

Returns

Promise<Error[]>


ready()

ready(): Promise<void>

Resolves when hypercores have all loaded

Returns

Promise<void>