Skip to content
This repository has been archived by the owner on Jan 14, 2020. It is now read-only.

Latest commit

 

History

History
468 lines (329 loc) · 16.6 KB

API.md

File metadata and controls

468 lines (329 loc) · 16.6 KB

Classes

ArchiveManager

Archive Manager - manages a set of archives for the browser

DropboxDatasourceTextDatasource

Datasource for Dropbox archives

EntryFinder
LocalStorageInterfaceStorageInterface

Interface for localStorage

Members

StorageInterface : Object

Objects

ArchiveTools : object

Functions

flattenEntries(archives)Array.<EntrySearchInfo>

Flatten entries into a searchable structure

Typedefs

ArchiveDetailsDisplay : Object

Archive details for display

ManagedArchiveItem : Object

Stored archive entry

EntrySearchInfo : Object

ArchiveManager

Archive Manager - manages a set of archives for the browser

Kind: global class

new ArchiveManager([storage])

Constructor for the manager

Param Type Description
[storage] StorageInterface Storage interface reference

archiveManager.archives : Object

Archives reference

Kind: instance property of ArchiveManager

archiveManager.displayList : Array.<ArchiveDetailsDisplay>

Array of archive details ready for display

Kind: instance property of ArchiveManager

archiveManager.storage : StorageInterface

Storage reference

Kind: instance property of ArchiveManager

archiveManager.unlockedArchives : Array.<ManagedArchiveItem>

Array of unlocked archive items

Kind: instance property of ArchiveManager

archiveManager.addArchive(archiveName, workspace, credentials, masterPassword)

Add an archive to the manager

Kind: instance method of ArchiveManager

Param Type Description
archiveName String A unique name for the item
workspace Workspace The workspace that holds the archive, datasource etc.
credentials Credentials The credentials for remote storage etc. (these should also already hold datasource meta information)
masterPassword String The master password

archiveManager.isLocked(archiveName) ⇒ Boolean

Check if an item is locked

Kind: instance method of ArchiveManager
Returns: Boolean - True if locked
Throws:

  • Error Throws if the item is not found
Param Type Description
archiveName String The name of the item

archiveManager.loadState()

Load the manager state Used when the page loads to restore the archive items list (all are locked at this stage).

Kind: instance method of ArchiveManager

archiveManager.lock(archiveName) ⇒ Promise

Lock an item

Kind: instance method of ArchiveManager
Returns: Promise - A promise that resolves when the item is locked
Throws:

  • Error Throws if the item is not found
  • Error Throws if the item is already locked
  • Error Throws if the item is currently being processed
Param Type Description
archiveName String The name of the item to lock

archiveManager.removeArchive(archiveName) ⇒ Boolean

Remove an archive by name

Kind: instance method of ArchiveManager
Returns: Boolean - True if deleted, false if not found

Param Type Description
archiveName String The name of the archive to remove

archiveManager.saveState() ⇒ Promise

Save the state of the manager to the storage

Kind: instance method of ArchiveManager
Returns: Promise - A promise that resolves once the state has been saved

archiveManager.unlock(archiveName, password) ⇒ Promise

Unlock a locked item

Kind: instance method of ArchiveManager
Returns: Promise - A promise that resolves when the item is unlocked
Throws:

  • Error Throws if the item is not locked
Param Type Description
archiveName String The name of the item to unlock
password String The master password of the item to unlock

archiveManager.updateUnlocked() ⇒ Promise

Update workspaces that are unlocked

Kind: instance method of ArchiveManager
Returns: Promise - A promise that resolves after updating all unlocked workspaces

ArchiveManager.ArchiveStatus

Stored archive status

Kind: static enum of ArchiveManager

ArchiveManager.getSharedManager() ⇒ ArchiveManager

Get the singleton shared instance

Kind: static method of ArchiveManager
Returns: ArchiveManager - The shared instance

DropboxDatasource ⇐ TextDatasource

Datasource for Dropbox archives

Kind: global class
Extends: TextDatasource

new DropboxDatasource(accessToken, resourcePath)

Datasource for Dropbox accounts

Param Type Description
accessToken String The dropbox access token
resourcePath String The file path

dropboxDatasource.toObject() ⇒ Object

Output the datasource as an object

Kind: instance method of DropboxDatasource
Returns: Object - An object describing the datasource

EntryFinder

Kind: global class

new EntryFinder(_archives)

Param Type Description
_archives Array.<Archive> | Archive The archives to search

entryFinder.items : Array.<EntrySearchInfo>

All items

Kind: instance property of EntryFinder

entryFinder.lastResult : Array.<EntrySearchInfo>

The last result

Kind: instance property of EntryFinder

entryFinder.initSearcher()

Initialise the searching mechanism

Kind: instance method of EntryFinder

entryFinder.search(term) ⇒ Array.<EntrySearchInfo>

Search and get results

Kind: instance method of EntryFinder
Returns: Array.<EntrySearchInfo> - The results

Param Type Description
term String The search term

LocalStorageInterface ⇐ StorageInterface

Interface for localStorage

Kind: global class
Extends: StorageInterface

localStorageInterface.getAllKeys() ⇒ Promise.<Array.<String>>

Get all keys from storage

Kind: instance method of LocalStorageInterface
Returns: Promise.<Array.<String>> - A promise that resolves with an array of keys

localStorageInterface.getValue(name) ⇒ Promise.<String>

Get the value of a key

Kind: instance method of LocalStorageInterface
Returns: Promise.<String> - A promise that resolves with the value

Param Type Description
name String The key name

localStorageInterface.setValue(name, value) ⇒ Promise

Set the value for a key

Kind: instance method of LocalStorageInterface
Returns: Promise - A promise that resolves when the value is set

Param Type Description
name String The key name
value String The value to set

StorageInterface : Object

Kind: global variable

StorageInterface.getData ⇒ *

Get data from storage

Kind: static property of StorageInterface
Returns: * - The fetched data

Param Type Description
key String The key to fetch for
defaultValue * The default value if the key is not found

StorageInterface.setData

Set data for a key

Kind: static property of StorageInterface

Param Type Description
key String The key to set for
rawData Object | Array | String | Number | * The raw data to set

ArchiveTools : object

Kind: global namespace

ArchiveTools.extractDomain(url) ⇒ String

Extract the domain from a URL

Kind: static method of ArchiveTools
Returns: String - The domain or an empty string if none found

Param Type Description
url String The URL to extract from

ArchiveTools.getEntriesForURL(archive, url) ⇒ Array.<Entry>

Get entries for a particular URL

Kind: static method of ArchiveTools
Returns: Array.<Entry> - An array of entries

Param Type Description
archive Archive A buttercup archive instance
url String A URL

flattenEntries(archives) ⇒ Array.<EntrySearchInfo>

Flatten entries into a searchable structure

Kind: global function
Returns: Array.<EntrySearchInfo> - An array of searchable objects

Param Type Description
archives Array.<Archive> An array of archives

ArchiveDetailsDisplay : Object

Archive details for display

Kind: global typedef
Properties

Name Type Description
name String The name of the item
status ArchiveStatus The status of the item
type String The type of archive connection

ManagedArchiveItem : Object

Stored archive entry

Kind: global typedef
Properties

Name Type Description
status ArchiveStatus The status of the item
workspace Workspace | undefined Reference to the workspace (undefined if locked)
credentials Credentials | String Reference to Credentials instance (encrypted string if locked)
password String | undefined The master password (undefined if locked)

EntrySearchInfo : Object

Kind: global typedef
Properties

Name Type Description
entry Entry The entry
archive Archive The associated archive