API • Docs
API / MapeoManager
TypedEmitter
new MapeoManager(
opts
):MapeoManager
• opts
• opts.clientMigrationsFolder: string
path for drizzle migrations folder for client database
• opts.coreStorage: string
| CoreStorage
Folder for hypercore storage or a function that returns a RandomAccessStorage instance
• opts.customMapPath: undefined
| string
File path to a locally stored Styled Map Package (SMP).
• opts.dbFolder: string
Folder for sqlite Dbs. Folder must exist. Use ':memory:' to store everything in-memory
• opts.defaultConfigPath: undefined
| string
• opts.defaultOnlineStyleUrl: undefined
| string
= DEFAULT_ONLINE_STYLE_URL
URL for an online-hosted StyleJSON asset.
• opts.fallbackMapPath: undefined
| string
= DEFAULT_FALLBACK_MAP_FILE_PATH
File path to a locally stored Styled Map Package (SMP)
• opts.fastify: FastifyInstance
<RawServerDefault
, IncomingMessage
, ServerResponse
<IncomingMessage
>, FastifyBaseLogger
, FastifyTypeProviderDefault
>
Fastify server instance
• opts.projectMigrationsFolder: string
path for drizzle migrations folder for project database
• opts.rootKey: Buffer
16-bytes of random data that uniquely identify the device, used to derive a 32-byte master key, which is used to derive all the keypairs used for Mapeo
TypedEmitter.constructor
get
deviceId():string
string
get
invite():InviteApi
addProject(
projectJoinDetails
,opts
?):Promise
<string
>
Add a project to this device. After adding a project the client should
await project.$waitForInitialSync()
to ensure that the device has
downloaded their proof of project membership and the project config.
• projectJoinDetails: Pick
<ProjectJoinDetails
, "projectKey"
| "encryptionKeys"
> & object
• opts? = {}
Set opts.waitForSync = false to not wait for sync during addProject()
• opts.waitForSync?: boolean
= true
Promise
<string
>
connectLocalPeer(
peer
):void
• peer
• peer.address: string
• peer.name: string
• peer.port: number
void
createProject(
options
?):Promise
<string
>
Create a new project.
• options? = {}
• options.configPath?: string
= ...
Promise
<string
>
Project public id
getDeviceInfo():
object
&Partial
<DeviceInfoParam
>
object
& Partial
<DeviceInfoParam
>
getIsArchiveDevice():
boolean
Get whether this device is an archive device. Archive devices will download all media during sync, where-as non-archive devices will not download media original variants, and only download preview and thumbnail variants.
boolean
isArchiveDevice
getMapStyleJsonUrl():
Promise
<string
>
Promise
<string
>
getProject(
projectPublicId
):Promise
<MapeoProject
>
• projectPublicId: string
Promise
<MapeoProject
>
leaveProject(
projectPublicId
):Promise
<void
>
• projectPublicId: string
Promise
<void
>
listLocalPeers():
Promise
<PublicPeerInfo
[]>
Promise
<PublicPeerInfo
[]>
listProjects():
Promise
<Pick
<object
,"name"
> &object
[]>
Promise
<Pick
<object
, "name"
> & object
[]>
onBackgrounded():
void
Call this when the app goes into the background.
Will gracefully shut down sync.
void
onForegrounded():
void
Call this when the app goes into the foreground.
Will undo the effects of onBackgrounded
.
void
setDeviceInfo<
T
>(deviceInfo
):Promise
<void
>
• T extends DeviceInfoParam
& object
| ExactObject
<DeviceInfoParam
& object
, T
>
• deviceInfo: T
Promise
<void
>
setIsArchiveDevice(
isArchiveDevice
):void
Set whether this device is an archive device. Archive devices will download all media during sync, where-as non-archive devices will not download media original variants, and only download preview and thumbnail variants.
• isArchiveDevice: boolean
void
startLocalPeerDiscoveryServer():
Promise
<object
>
Promise
<object
>
name:
string
port:
number
stopLocalPeerDiscoveryServer(
opts
?):Promise
<void
>
Close all servers and stop multicast advertising and browsing. Will wait for open sockets to close unless opts.force=true in which case open sockets are force-closed after opts.timeout milliseconds
• opts?
• opts.force?: undefined
| boolean
Force-close open sockets after timeout milliseconds
• opts.timeout?: undefined
| number
Optional timeout when calling stop() with force=true
Promise
<void
>