Skip to content

Latest commit

 

History

History
4279 lines (3104 loc) · 156 KB

API.md

File metadata and controls

4279 lines (3104 loc) · 156 KB

Modules

DescriptorArray.<String>

Describe an archive dataset - to history commands

command

Command related tools

Classes

ArchiveAsyncEventEmitter

Buttercup Archive

ArchiveComparator
ArchiveManagerAsyncEventEmitter

Archive manager class

ArchiveSourceAsyncEventEmitter

Archive source class

FormatCommandBaseCommand
BaseCommand
CommentCommandBaseCommand
CreateEntryCommandBaseCommand
CreateGroupCommandBaseCommand
DeleteArchiveAttributeCommandBaseCommand
DeleteEntryAttributeCommandBaseCommand
DeleteEntryCommandBaseCommand
DeleteEntryMetaCommandBaseCommand
DeleteEntryPropertyCommandBaseCommand

Command for the deletion of property data on an entry

DeleteGroupAttributeCommandBaseCommand
DeleteGroupCommandBaseCommand
FormatCommandBaseCommand
MoveEntryCommandBaseCommand
MoveGroupCommandBaseCommand
PadCommandBaseCommand
SetArchiveAttributeCommandBaseCommand
SetEntryAttributeCommandBaseCommand
SetEntryMetaCommandBaseCommand
SetEntryPropertyCommandBaseCommand
SetGroupAttributeCommandBaseCommand
TitleGroupCommandBaseCommand
Entry

Entry class implementation Entries form the low-level data structures used in Buttercup, and are intended to represent logical collections of properties, like a login for a website.

EntryFinder

Entry searching class

Flattener

Flattener class for flattening archive history sets

Group

Group implementation

InigoCommand

Inigo command generator

WestleyAsyncEventEmitter

Westley class Archive object dataset and history manager. Handles parsing and revenge for the princess.

Workspace

Workspace class implementation Workspaces organise Archives and Datasources, and perform saves and merges with remote changes.

Mixins

EntryCollection : Object
GroupCollection : Object

Functions

credentialsToDatasource(sourceCredentials)Promise.<{datasource, credentials}>

Convert credentials of a remote archive to a datasource

credentialsToSource(sourceCredentials, archiveCredentials, [initialise], [contentOverride])Promise.<Object>

Convert credentials to a source for the ArchiveManager

addExtraFieldsNonDestructive(entry, fields)Array.<EntryFacadeField>

Add extra fields to a fields array that are not mentioned in a preset Facades are creaded by presets which don't mention all property values (custom user added items). This method adds the unmentioned items to the facade fields so that they can be edited as well.

applyFieldDescriptor(entry, descriptor)

Apply a facade field descriptor to an entry Takes data from the descriptor and writes it to the entry.

consumeEntryFacade(entry, facade)

Process a modified entry facade

createEntryFacade(entry)EntryFacade

Create a data/input facade for an Entry instance

getEntryFacadeType(entry)String

Get the facade type for an entry

setEntryValue(entry, property, name, value)

Set a value on an entry

flattenEntries(archives)Array.<EntrySearchInfo>

Flatten entries into a searchable structure

dedupe(arr)Array

De-dupe an array

createFieldDescriptor(entry, title, entryPropertyType, entryPropertyName, options)EntryFacadeField

Create a descriptor for a field to be used within a facade

getEntryURLs(properties, preference)

Get URLs from an entry's properties Allows for preferential sorting

getEntryValue(entry, property, name)String

Get a value on an entry for a specific property type

isValidProperty(name)Boolean

Check if a property name is valid

findEntriesByCheck(groups, compareFn)Array.<Entry>

Find entry instances by filtering with a compare function

findGroupsByCheck(groups, compareFn)Array.<Group>

Find group instances within groups that satisfy some check

getAllEntries(groups)Array.<Entry>

Get all entries within a collection of groups

generateUUID()String

Generate a UUID (v4)

Typedefs

ArchiveSourceOptions : Object

New source options

ArchiveSourceDescription
ArchiveDataset : Object
EntryHistoryItem : Object
EntryFacade : Object

Entry facade for data input

EntrySearchInfo : Object
EntryFacadeField : Object

Entry facade data field

FoundGroupResult : Object

Descriptor ⇒ Array.<String>

Describe an archive dataset - to history commands

Returns: Array.<String> - An array of commands

Param Type Description
dataset Object The archive dataset
parentGroupID String The ID of the parent group

command

Command related tools

command.extractCommandComponents(command) ⇒ Array.<String>

Extract command components from a string

Kind: static method of command
Returns: Array.<String> - The separated parts

Param Type Description
command String The command to extract from

Archive ⇐ AsyncEventEmitter

Buttercup Archive

Kind: global class
Extends: AsyncEventEmitter
Mixes: GroupCollection, EntryCollection

archive.id : String

The archive ID

Kind: instance property of Archive

archive.readOnly

Whether the archive is read only or not

Kind: instance property of Archive
Read only: true
Properties

Name Type
readOnly Boolean

archive.type : String

Get the instance type

Kind: instance property of Archive
Read only: true

archive.findGroupByID ⇒ Group | null

Find a group by its ID

Kind: instance property of Archive
Mixes: findGroupByID
Returns: Group | null - The group or null if not found

Param Type Description
id String The group ID to search for

archive.findGroupsByTitle ⇒ Array.<Group>

Find groups by their title

Kind: instance property of Archive
Mixes: findGroupsByTitle
Returns: Array.<Group> - An array of groups

Param Type Description
title String | RegExp The group title

archive.findEntriesByMeta ⇒ Array.<Entry>

Find entries that match a certain meta property

Kind: instance property of Archive
Mixes: findEntriesByMeta
Returns: Array.<Entry> - An array of found entries

Param Type Description
metaName String The meta property to search for
value RegExp | string The value to search for

archive.findEntriesByProperty ⇒ Array.<Entry>

Find all entries that match a certain property

Kind: instance property of Archive
Mixes: findEntriesByProperty
Returns: Array.<Entry> - An array of found extries

Param Type Description
property string The property to search with
value RegExp | string The value to search for

archive.findGroupByID ⇒ Group | null

Find a group by its ID

Kind: instance property of Archive
Mixes: findGroupByID
Returns: Group | null - The group or null if not found

Param Type Description
id String The group ID to search for

archive.findGroupsByTitle ⇒ Array.<Group>

Find groups by their title

Kind: instance property of Archive
Mixes: findGroupsByTitle
Returns: Array.<Group> - An array of groups

Param Type Description
title String | RegExp The group title

archive.findEntriesByMeta ⇒ Array.<Entry>

Find entries that match a certain meta property

Kind: instance property of Archive
Mixes: findEntriesByMeta
Returns: Array.<Entry> - An array of found entries

Param Type Description
metaName String The meta property to search for
value RegExp | string The value to search for

archive.findEntriesByProperty ⇒ Array.<Entry>

Find all entries that match a certain property

Kind: instance property of Archive
Mixes: findEntriesByProperty
Returns: Array.<Entry> - An array of found extries

Param Type Description
property string The property to search with
value RegExp | string The value to search for

archive.createGroup([title]) ⇒ Group

Create a new group

Kind: instance method of Archive
Returns: Group - The newly created group

Param Type Description
[title] string The title for the group

archive.deleteAttribute(attributeName) ⇒ Archive

Delete an attribute

Kind: instance method of Archive
Returns: Archive - Self

Param Type Description
attributeName String The name of the attribute to delete

archive.emptyTrash()

Remove all entries and groups from the trash (permanent)

Kind: instance method of Archive
Throws:

  • Error Throws if there is no trash group

archive.getAttribute(attributeName) ⇒ undefined | String | Object

Deprecated

Get the value of an attribute

Kind: instance method of Archive
Returns: undefined | String | Object - The value of the attribute or undefined if not set. Returns an object if no attribute name is given.

Param Type Description
attributeName String The attribute to get

archive.getAttributes() ⇒ Object

Get all attributes

Kind: instance method of Archive
Returns: Object - Attributes object

archive.getFormat() ⇒ string

Get the archive format

Kind: instance method of Archive
Returns: string - The format of the archive

archive.getGroups() ⇒ Array.<Group>

Get all groups (root) in the archive

Kind: instance method of Archive
Returns: Array.<Group> - An array of Groups

archive.getHistory() ⇒ Array.<String>

Get the command array (history) Returned object can be quite large.

Kind: instance method of Archive
Returns: Array.<String> - The command array

archive.getTrashGroup() ⇒ Group | null

Get the trash group

Kind: instance method of Archive
Returns: Group | null - The trash group if found, null otherwise

archive.optimise() ⇒ Archive

Perform archive optimisations

Kind: instance method of Archive
Returns: Archive - Self

archive.setAttribute(attributeName, value) ⇒ Archive

Set an attribute on the archive

Kind: instance method of Archive
Returns: Archive - Self

Param Type Description
attributeName String The attribute to set
value String The value to set for the attribute

archive.toObject(groupOutputFlags) ⇒ Object

Convert the archive to an object

Kind: instance method of Archive
Returns: Object - The archive in object form
See: Group.toObject

Param Type Description
groupOutputFlags Number Bitwise flags for Group.toObject

archive._generateID()

Generate an archive ID

Kind: instance method of Archive
Access: protected

archive._getWestley() ⇒ Westley

Get the underlying Westley instance

Kind: instance method of Archive
Returns: Westley - The Westley instance
Access: protected

archive.inst.findEntryByID(id) ⇒ null | Entry

Find an entry by its ID

Kind: instance method of Archive
Mixes: inst.findEntryByID
Returns: null | Entry - Null if not found, or the Entry instance

Param Type Description
id String The ID to search for

archive.inst.findEntryByID(id) ⇒ null | Entry

Find an entry by its ID

Kind: instance method of Archive
Mixes: inst.findEntryByID
Returns: null | Entry - Null if not found, or the Entry instance

Param Type Description
id String The ID to search for

Archive.createFromHistory(history) ⇒ Archive

Create a new archive instance from a list of commands (history)

Kind: static method of Archive
Returns: Archive - The archive instance

Param Type Description
history Array.<String> The command list

Archive.createWithDefaults() ⇒ Archive

Create an Archive with the default template

Kind: static method of Archive
Returns: Archive - The new archive

ArchiveComparator

Kind: global class

new ArchiveComparator(originalArchive, secondaryArchive)

Archive comparison class

Param Type Description
originalArchive Archive The primary archive
secondaryArchive Archive The secondary archive

archiveComparator.archivesDiffer() ⇒ Boolean

Check if the current archives differ

Kind: instance method of ArchiveComparator
Returns: Boolean - True if the archives are different

archiveComparator.calculateDifferences() ⇒ Object | Boolean

Calculate the differences, in commands, between the two archives

Kind: instance method of ArchiveComparator
Returns: Object | Boolean - Returns false if no common base is found, or the command differences as two arrays

ArchiveManager ⇐ AsyncEventEmitter

Archive manager class

Kind: global class
Extends: AsyncEventEmitter

new ArchiveManager([storageInterface])

Constructor for the archive manager

Param Type Description
[storageInterface] StorageInterface The storage interface to use - defaults to storing in memory

archiveManager.autoUpdateEnabled : Boolean

Detect if auto-updating is enabled

Kind: instance property of ArchiveManager
Read only: true

archiveManager.nextSourceOrder : Number

The next available source order

Kind: instance property of ArchiveManager
Read only: true

archiveManager.sources : Array.<ArchiveSource>

The current sources

Kind: instance property of ArchiveManager
Read only: true

archiveManager.sourcesList : Array.<ArchiveSourceDescription>

All sources, listed by their descriptions

Kind: instance property of ArchiveManager
Read only: true

archiveManager.storageInterface : StorageInterface

The current storage interface

Kind: instance property of ArchiveManager
Read only: true

archiveManager.unlockedSources : Array.<ArchiveSource>

All unlocked sources

Kind: instance property of ArchiveManager
Read only: true

archiveManager.updateableSources : Array.<ArchiveSource>

All auto-updateable sources

Kind: instance property of ArchiveManager
Read only: true

archiveManager.addSource(archiveSource, [obj])

Add a source to the manager

Kind: instance method of ArchiveManager

Param Type Description
archiveSource ArchiveSource The source to add
[obj] Object Optional configuration
[obj.emitUpdated] Boolean Whether or not to emit an updated event (default: true)
[obj.order] Number Override the order of the new source

archiveManager.dehydrate() ⇒ Promise

Dehydrate all sources and write them to storage

Kind: instance method of ArchiveManager
Returns: Promise - A promise that resolves once all sources have been dehydrated

archiveManager.dehydrateSource(sourceID) ⇒ Promise

Dehydrate a single archive source

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

Param Type Description
sourceID String The ID of the source

archiveManager.getSourceForID(sourceID) ⇒ ArchiveSource | null

Get a source for an ID

Kind: instance method of ArchiveManager
Returns: ArchiveSource | null - The source with the matching ID or null if not found

Param Type Description
sourceID String The source ID

archiveManager.interruptAutoUpdate(cb) ⇒ Promise

Wait for and interrupt state changes when auto-update is running

Kind: instance method of ArchiveManager
Returns: Promise - A promise that resolves when ready

Param Type Description
cb function The callback to execute during the auto-update interruption

Example

archiveManager.interruptAutoUpdate(() => {
     // Do something with auto-updating paused
 });

archiveManager.rehydrate() ⇒ Promise

Rehydrate sources from storage

Kind: instance method of ArchiveManager
Returns: Promise - A promise that resolves once rehydration has completed
Throws:

  • VError Rejects if rehydrating from storage fails

archiveManager.removeSource(sourceID) ⇒ Promise

Remove a source from the storage

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

Param Type Description
sourceID String The ID of the source to remove

archiveManager.reorderSource(sourceID, position)

Reorder a source

Kind: instance method of ArchiveManager
Throws:

  • VError Throws if no source is found
Param Type Description
sourceID String The ID of the source to reorder
position Number The 0-based position to move the source to

archiveManager.reorderSources()

Reorder all sources

Kind: instance method of ArchiveManager

archiveManager.toggleAutoUpdating([enable], [delay])

Toggle auto updating of sources

Kind: instance method of ArchiveManager

Param Type Description
[enable] Boolean Enable or disable auto updating. Leave empty to invert the setting
[delay] Number Milliseconds between updates

ArchiveSource ⇐ AsyncEventEmitter

Archive source class

Kind: global class
Extends: AsyncEventEmitter

new ArchiveSource(name, sourceCredentials, archiveCredentials, [newSourceOptions])

Constructor for an archive source

Param Type Description
name String The name of the source
sourceCredentials String Encrypted archive source credentials
archiveCredentials String Encrypted archive credentials
[newSourceOptions] ArchiveSourceOptions Specify source creation options

archiveSource.canBeUpdated : Boolean

Whether this source can be auto updated or not

Kind: instance property of ArchiveSource

archiveSource.colour : String

Source colour

Kind: instance property of ArchiveSource

archiveSource.description : ArchiveSourceDescription

Get the source description

Kind: instance property of ArchiveSource
Read only: true

archiveSource.id : String

Source ID

Kind: instance property of ArchiveSource
Read only: true

archiveSource.name : String

Source name

Kind: instance property of ArchiveSource
Read only: true

archiveSource.status : ArchiveSourceStatus

Source status

Kind: instance property of ArchiveSource
Read only: true

archiveSource.storageInterface : StorageInterface

The attached manager's storage interface

Kind: instance property of ArchiveSource
Read only: true

archiveSource.workspace : Workspace | null

Workspace instance for the source Is null when the source is locked

Kind: instance property of ArchiveSource
Read only: true

archiveSource.checkOfflineCopy() ⇒ Promise.<Boolean>

Check if the source has an offline copy

Kind: instance method of ArchiveSource
Returns: Promise.<Boolean> - A promise which resolves with whether an offline copy is available or not

archiveSource.dehydrate() ⇒ Promise.<String>

Dehydrate the source for storage Returns a secure string with locked (encrypted) credentials, even when the source is in the UNLOCKED state. This method does NOT store the source - this must be done separately.

Kind: instance method of ArchiveSource
Returns: Promise.<String> - A promise that resolves with the dehydrated source information
Throws:

  • VError Rejects is source in PENDING state

archiveSource.getOfflineContent() ⇒ Promise.<(String|null)>

Get offline content, if it exists

Kind: instance method of ArchiveSource
Returns: Promise.<(String|null)> - A promise a resolves with the content, or null if it doesn't exist

archiveSource.lock() ⇒ Promise.<String>

Lock the source Encrypts the credentials and performs dehydration, placing the source into a LOCKED state. No saving is performed before locking.

Kind: instance method of ArchiveSource
Returns: Promise.<String> - A promise that resolves with dehydrated content
Throws:

  • VError Rejects if not in unlocked state

Emits: ArchiveSource#event:sourceLocked

archiveSource.unlock(masterPassword, [initialiseRemote], contentOverride, [storeOfflineCopy])

Deprecated

Unlock the source

Kind: instance method of ArchiveSource
Throws:

  • VError Rejects if not in locked state
  • VError Rejects if not able to create the source from the encrypted credentials

Emits: ArchiveSource#event:sourceUnlocked

Param Type Default Description
masterPassword String The master password
[initialiseRemote] Boolean false Optionally initialise the remote (replaces remote archive) (defaults to false)
contentOverride String | Boolean Content for overriding the fetch operation in the datasource, for loading offline content. Can be set to the content (string) or to 'true', which will attempt to load the content from the ArchiveManager's storage.
[storeOfflineCopy] Boolean true Whether or not to store an offline copy. Defaults to true.

archiveSource.updateArchiveCredentials(masterPassword) ⇒ Promise.<String>

Update the password/credentials for the archive The workspace is saved after changing. Responds with dehydrated details which should be SAVED.

Kind: instance method of ArchiveSource
Returns: Promise.<String> - A promise that resolves with the dehydrated source details
Throws:

  • VError Rejects if source is not in unlocked state
Param Type Description
masterPassword String New master password

archiveSource.updateSourceCredentials(masterPassword, callback) ⇒ Promise

Deprecated

Update source credentials (Useful for updating tokens when authentication parameters change)

Kind: instance method of ArchiveSource
Returns: Promise - A promise that resolves when the update is complete

Param Type Description
masterPassword String The master password
callback function Callback that's fired with the source crendentials and datasource. If the source is locked, only the source credentials are provided (datasource is null in this case)

ArchiveSource.Status

Archive source status

Kind: static enum of ArchiveSource
Properties

Name Default
LOCKED locked
UNLOCKED unlocked
PENDING pending

ArchiveSource.rehydrate(dehydratedString) ⇒ ArchiveSource

Rehydrate a dehydrated archive source

Kind: static method of ArchiveSource
Returns: ArchiveSource - The rehydrated source

Param Type Description
dehydratedString String A dehydrated archive source

FormatCommand ⇐ BaseCommand

Kind: global class
Extends: BaseCommand

new FormatCommand()

Command for setting the archive ID

new FormatCommand()

Command for setting the archive format

formatCommand.entryTools : Object

Entry tools module

Kind: instance property of FormatCommand
Overrides: entryTools

formatCommand.searchTools : Object

Search tools module

Kind: instance property of FormatCommand
Overrides: searchTools

formatCommand.execute(obj, format)

Execute the setting of the format

Kind: instance method of FormatCommand

Param Type Description
obj ArchiveDataset The archive dataset
format String The archive format

formatCommand.executeCallbacks(key)

Execute all callbacks under a key Arguments passed after the key are provided to each callback

Kind: instance method of FormatCommand
Overrides: executeCallbacks

Param Type Description
key String The callback name

Example

executeCallbacks("functionName", 1, 2, "three")

formatCommand.setCallback(key, fn)

Add a callback for a key

Kind: instance method of FormatCommand
Overrides: setCallback

Param Type Description
key String The callback name
fn function The callback function

BaseCommand

Kind: global class

new BaseCommand()

Base command class

baseCommand.entryTools : Object

Entry tools module

Kind: instance property of BaseCommand

baseCommand.searchTools : Object

Search tools module

Kind: instance property of BaseCommand

baseCommand.entryTools

Set the entry tools module

Kind: instance property of BaseCommand

Param Type Description
et Object The entry tools module

baseCommand.searchTools

Set the search tools module

Kind: instance property of BaseCommand

Param Type Description
st Object The search tools module

baseCommand.executeCallbacks(key)

Execute all callbacks under a key Arguments passed after the key are provided to each callback

Kind: instance method of BaseCommand

Param Type Description
key String The callback name

Example

executeCallbacks("functionName", 1, 2, "three")

baseCommand.setCallback(key, fn)

Add a callback for a key

Kind: instance method of BaseCommand

Param Type Description
key String The callback name
fn function The callback function

CommentCommand ⇐ BaseCommand

Kind: global class
Extends: BaseCommand

new CommentCommand()

Command for archive comments

commentCommand.entryTools : Object

Entry tools module

Kind: instance property of CommentCommand
Overrides: entryTools

commentCommand.searchTools : Object

Search tools module

Kind: instance property of CommentCommand
Overrides: searchTools

commentCommand.execute(obj, comment)

Execute comment callbacks

Kind: instance method of CommentCommand
See: BaseCommand.executeCallbacks

Param Type Description
obj ArchiveDataset The archive dataset
comment String The comment

commentCommand.executeCallbacks(key)

Execute all callbacks under a key Arguments passed after the key are provided to each callback

Kind: instance method of CommentCommand

Param Type Description
key String The callback name

Example

executeCallbacks("functionName", 1, 2, "three")

commentCommand.setCallback(key, fn)

Add a callback for a key

Kind: instance method of CommentCommand

Param Type Description
key String The callback name
fn function The callback function

CreateEntryCommand ⇐ BaseCommand

Kind: global class
Extends: BaseCommand

new CreateEntryCommand()

Command for creating entries

createEntryCommand.entryTools : Object

Entry tools module

Kind: instance property of CreateEntryCommand
Overrides: entryTools

createEntryCommand.searchTools : Object

Search tools module

Kind: instance property of CreateEntryCommand
Overrides: searchTools

createEntryCommand.execute(obj, groupID, entryID)

Execute the entry creation

Kind: instance method of CreateEntryCommand

Param Type Description
obj ArchiveDataset The archive dataset
groupID String The ID of the group to create within
entryID String The ID of the entry to create

createEntryCommand.executeCallbacks(key)

Execute all callbacks under a key Arguments passed after the key are provided to each callback

Kind: instance method of CreateEntryCommand

Param Type Description
key String The callback name

Example

executeCallbacks("functionName", 1, 2, "three")

createEntryCommand.setCallback(key, fn)

Add a callback for a key

Kind: instance method of CreateEntryCommand

Param Type Description
key String The callback name
fn function The callback function

CreateGroupCommand ⇐ BaseCommand

Kind: global class
Extends: BaseCommand

new CreateGroupCommand()

Command for creating groups

createGroupCommand.entryTools : Object

Entry tools module

Kind: instance property of CreateGroupCommand
Overrides: entryTools

createGroupCommand.searchTools : Object

Search tools module

Kind: instance property of CreateGroupCommand
Overrides: searchTools

createGroupCommand.execute(obj, parentID, newID)

Execute the group creation

Kind: instance method of CreateGroupCommand

Param Type Description
obj ArchiveDataset The archive dataset
parentID String The ID of the parent group to create within
newID String The ID of the new group

createGroupCommand.executeCallbacks(key)

Execute all callbacks under a key Arguments passed after the key are provided to each callback

Kind: instance method of CreateGroupCommand

Param Type Description
key String The callback name

Example

executeCallbacks("functionName", 1, 2, "three")

createGroupCommand.setCallback(key, fn)

Add a callback for a key

Kind: instance method of CreateGroupCommand

Param Type Description
key String The callback name
fn function The callback function

DeleteArchiveAttributeCommand ⇐ BaseCommand

Kind: global class
Extends: BaseCommand

new DeleteArchiveAttributeCommand()

Command for deleting attributes stored on the archive object

deleteArchiveAttributeCommand.entryTools : Object

Entry tools module

Kind: instance property of DeleteArchiveAttributeCommand
Overrides: entryTools

deleteArchiveAttributeCommand.searchTools : Object

Search tools module

Kind: instance property of DeleteArchiveAttributeCommand
Overrides: searchTools

deleteArchiveAttributeCommand.execute(obj, attributeName)

Execute the deletion of an attribute

Kind: instance method of DeleteArchiveAttributeCommand

Param Type Description
obj ArchiveDataset The archive dataset
attributeName String The name of the attribute to delete

deleteArchiveAttributeCommand.executeCallbacks(key)

Execute all callbacks under a key Arguments passed after the key are provided to each callback

Kind: instance method of DeleteArchiveAttributeCommand

Param Type Description
key String The callback name

Example

executeCallbacks("functionName", 1, 2, "three")

deleteArchiveAttributeCommand.setCallback(key, fn)

Add a callback for a key

Kind: instance method of DeleteArchiveAttributeCommand

Param Type Description
key String The callback name
fn function The callback function

DeleteEntryAttributeCommand ⇐ BaseCommand

Kind: global class
Extends: BaseCommand

new DeleteEntryAttributeCommand()

Command for the deletion of entry attributes

deleteEntryAttributeCommand.entryTools : Object

Entry tools module

Kind: instance property of DeleteEntryAttributeCommand
Overrides: entryTools

deleteEntryAttributeCommand.searchTools : Object

Search tools module

Kind: instance property of DeleteEntryAttributeCommand
Overrides: searchTools

deleteEntryAttributeCommand.execute(obj, entryID, attributeName)

Execute the deletion of an attribute

Kind: instance method of DeleteEntryAttributeCommand

Param Type Description
obj ArchiveDataset The archive dataset
entryID String The ID of the entry
attributeName String The name of the attribute to delete

deleteEntryAttributeCommand.executeCallbacks(key)

Execute all callbacks under a key Arguments passed after the key are provided to each callback

Kind: instance method of DeleteEntryAttributeCommand

Param Type Description
key String The callback name

Example

executeCallbacks("functionName", 1, 2, "three")

deleteEntryAttributeCommand.setCallback(key, fn)

Add a callback for a key

Kind: instance method of DeleteEntryAttributeCommand

Param Type Description
key String The callback name
fn function The callback function

DeleteEntryCommand ⇐ BaseCommand

Kind: global class
Extends: BaseCommand

new DeleteEntryCommand()

Command for the deletion of entries

deleteEntryCommand.entryTools : Object

Entry tools module

Kind: instance property of DeleteEntryCommand
Overrides: entryTools

deleteEntryCommand.searchTools : Object

Search tools module

Kind: instance property of DeleteEntryCommand
Overrides: searchTools

deleteEntryCommand.execute(obj, entryID)

Execute the entry deletion

Kind: instance method of DeleteEntryCommand

Param Type Description
obj ArchiveDataset The archive dataset
entryID String The ID of the entry to delete

deleteEntryCommand.executeCallbacks(key)

Execute all callbacks under a key Arguments passed after the key are provided to each callback

Kind: instance method of DeleteEntryCommand

Param Type Description
key String The callback name

Example

executeCallbacks("functionName", 1, 2, "three")

deleteEntryCommand.setCallback(key, fn)

Add a callback for a key

Kind: instance method of DeleteEntryCommand

Param Type Description
key String The callback name
fn function The callback function

DeleteEntryMetaCommand ⇐ BaseCommand

Deprecated

Kind: global class
Extends: BaseCommand

new DeleteEntryMetaCommand()

Command for the deletion of meta data on an entry

deleteEntryMetaCommand.entryTools : Object

Entry tools module

Kind: instance property of DeleteEntryMetaCommand
Overrides: entryTools

deleteEntryMetaCommand.searchTools : Object

Search tools module

Kind: instance property of DeleteEntryMetaCommand
Overrides: searchTools

deleteEntryMetaCommand.execute(obj, entryID, propertyName)

Execute the deletion of a meta property

Kind: instance method of DeleteEntryMetaCommand

Param Type Description
obj ArchiveDataset The archive dataset
entryID String The ID of the entry
propertyName String The name of the meta property to delete

deleteEntryMetaCommand.executeCallbacks(key)

Execute all callbacks under a key Arguments passed after the key are provided to each callback

Kind: instance method of DeleteEntryMetaCommand

Param Type Description
key String The callback name

Example

executeCallbacks("functionName", 1, 2, "three")

deleteEntryMetaCommand.setCallback(key, fn)

Add a callback for a key

Kind: instance method of DeleteEntryMetaCommand

Param Type Description
key String The callback name
fn function The callback function

DeleteEntryPropertyCommand ⇐ BaseCommand

Command for the deletion of property data on an entry

Kind: global class
Extends: BaseCommand

deleteEntryPropertyCommand.entryTools : Object

Entry tools module

Kind: instance property of DeleteEntryPropertyCommand
Overrides: entryTools

deleteEntryPropertyCommand.searchTools : Object

Search tools module

Kind: instance property of DeleteEntryPropertyCommand
Overrides: searchTools

deleteEntryPropertyCommand.execute(obj, entryID, propertyName)

Execute the deletion of a property

Kind: instance method of DeleteEntryPropertyCommand

Param Type Description
obj ArchiveDataset The archive dataset
entryID String The ID of the entry
propertyName String The name of the property to delete

deleteEntryPropertyCommand.executeCallbacks(key)

Execute all callbacks under a key Arguments passed after the key are provided to each callback

Kind: instance method of DeleteEntryPropertyCommand

Param Type Description
key String The callback name

Example

executeCallbacks("functionName", 1, 2, "three")

deleteEntryPropertyCommand.setCallback(key, fn)

Add a callback for a key

Kind: instance method of DeleteEntryPropertyCommand

Param Type Description
key String The callback name
fn function The callback function

DeleteGroupAttributeCommand ⇐ BaseCommand

Kind: global class
Extends: BaseCommand

new DeleteGroupAttributeCommand()

Command for deleting group attributes

deleteGroupAttributeCommand.entryTools : Object

Entry tools module

Kind: instance property of DeleteGroupAttributeCommand
Overrides: entryTools

deleteGroupAttributeCommand.searchTools : Object

Search tools module

Kind: instance property of DeleteGroupAttributeCommand
Overrides: searchTools

deleteGroupAttributeCommand.execute(obj, groupID, attributeName)

Execute the deletion of a group attribute

Kind: instance method of DeleteGroupAttributeCommand

Param Type Description
obj ArchiveDataset The archive dataset
groupID String The ID of the group
attributeName String The attribute to delete

deleteGroupAttributeCommand.executeCallbacks(key)

Execute all callbacks under a key Arguments passed after the key are provided to each callback

Kind: instance method of DeleteGroupAttributeCommand

Param Type Description
key String The callback name

Example

executeCallbacks("functionName", 1, 2, "three")

deleteGroupAttributeCommand.setCallback(key, fn)

Add a callback for a key

Kind: instance method of DeleteGroupAttributeCommand

Param Type Description
key String The callback name
fn function The callback function

DeleteGroupCommand ⇐ BaseCommand

Kind: global class
Extends: BaseCommand

new DeleteGroupCommand()

Command for group deletion

deleteGroupCommand.entryTools : Object

Entry tools module

Kind: instance property of DeleteGroupCommand
Overrides: entryTools

deleteGroupCommand.searchTools : Object

Search tools module

Kind: instance property of DeleteGroupCommand
Overrides: searchTools

deleteGroupCommand.execute(obj, groupID)

Execute the deletion of a group

Kind: instance method of DeleteGroupCommand

Param Type Description
obj ArchiveDataset The archive dataset
groupID String The ID of the group to delete

deleteGroupCommand.executeCallbacks(key)

Execute all callbacks under a key Arguments passed after the key are provided to each callback

Kind: instance method of DeleteGroupCommand

Param Type Description
key String The callback name

Example

executeCallbacks("functionName", 1, 2, "three")

deleteGroupCommand.setCallback(key, fn)

Add a callback for a key

Kind: instance method of DeleteGroupCommand

Param Type Description
key String The callback name
fn function The callback function

FormatCommand ⇐ BaseCommand

Kind: global class
Extends: BaseCommand

new FormatCommand()

Command for setting the archive ID

new FormatCommand()

Command for setting the archive format

formatCommand.entryTools : Object

Entry tools module

Kind: instance property of FormatCommand
Overrides: entryTools

formatCommand.searchTools : Object

Search tools module

Kind: instance property of FormatCommand
Overrides: searchTools

formatCommand.execute(obj, format)

Execute the setting of the format

Kind: instance method of FormatCommand

Param Type Description
obj ArchiveDataset The archive dataset
format String The archive format

formatCommand.executeCallbacks(key)

Execute all callbacks under a key Arguments passed after the key are provided to each callback

Kind: instance method of FormatCommand
Overrides: executeCallbacks

Param Type Description
key String The callback name

Example

executeCallbacks("functionName", 1, 2, "three")

formatCommand.setCallback(key, fn)

Add a callback for a key

Kind: instance method of FormatCommand
Overrides: setCallback

Param Type Description
key String The callback name
fn function The callback function

MoveEntryCommand ⇐ BaseCommand

Kind: global class
Extends: BaseCommand

new MoveEntryCommand()

Command for the moving of entries

moveEntryCommand.entryTools : Object

Entry tools module

Kind: instance property of MoveEntryCommand
Overrides: entryTools

moveEntryCommand.searchTools : Object

Search tools module

Kind: instance property of MoveEntryCommand
Overrides: searchTools

moveEntryCommand.execute(obj, entryID, targetGroupID)

Execute the move

Kind: instance method of MoveEntryCommand

Param Type Description
obj ArchiveDataset The archive dataset
entryID String The ID of the entry to move
targetGroupID String The ID of the group to move the entry to

moveEntryCommand.executeCallbacks(key)

Execute all callbacks under a key Arguments passed after the key are provided to each callback

Kind: instance method of MoveEntryCommand

Param Type Description
key String The callback name

Example

executeCallbacks("functionName", 1, 2, "three")

moveEntryCommand.setCallback(key, fn)

Add a callback for a key

Kind: instance method of MoveEntryCommand

Param Type Description
key String The callback name
fn function The callback function

MoveGroupCommand ⇐ BaseCommand

Kind: global class
Extends: BaseCommand

new MoveGroupCommand()

Command for moving groups

moveGroupCommand.entryTools : Object

Entry tools module

Kind: instance property of MoveGroupCommand
Overrides: entryTools

moveGroupCommand.searchTools : Object

Search tools module

Kind: instance property of MoveGroupCommand
Overrides: searchTools

moveGroupCommand.execute(obj, groupID, targetGroupID)

Execute the move

Kind: instance method of MoveGroupCommand

Param Type Description
obj ArchiveDataset The archive dataset
groupID String The ID of the group to move
targetGroupID String The ID of the group to move to

moveGroupCommand.executeCallbacks(key)

Execute all callbacks under a key Arguments passed after the key are provided to each callback

Kind: instance method of MoveGroupCommand

Param Type Description
key String The callback name

Example

executeCallbacks("functionName", 1, 2, "three")

moveGroupCommand.setCallback(key, fn)

Add a callback for a key

Kind: instance method of MoveGroupCommand

Param Type Description
key String The callback name
fn function The callback function

PadCommand ⇐ BaseCommand

Kind: global class
Extends: BaseCommand

new PadCommand()

Command for padding Padding is used to identify "blocks" of history.

padCommand.entryTools : Object

Entry tools module

Kind: instance property of PadCommand
Overrides: entryTools

padCommand.searchTools : Object

Search tools module

Kind: instance property of PadCommand
Overrides: searchTools

padCommand.executeCallbacks(key)

Execute all callbacks under a key Arguments passed after the key are provided to each callback

Kind: instance method of PadCommand

Param Type Description
key String The callback name

Example

executeCallbacks("functionName", 1, 2, "three")

padCommand.setCallback(key, fn)

Add a callback for a key

Kind: instance method of PadCommand

Param Type Description
key String The callback name
fn function The callback function

SetArchiveAttributeCommand ⇐ BaseCommand

Kind: global class
Extends: BaseCommand

new SetArchiveAttributeCommand()

Command for setting archive attributes

setArchiveAttributeCommand.entryTools : Object

Entry tools module

Kind: instance property of SetArchiveAttributeCommand
Overrides: entryTools

setArchiveAttributeCommand.searchTools : Object

Search tools module

Kind: instance property of SetArchiveAttributeCommand
Overrides: searchTools

setArchiveAttributeCommand.execute(obj, attributeName, value)

Execute the setting of an attribute

Kind: instance method of SetArchiveAttributeCommand

Param Type Description
obj ArchiveDataset The archive dataset
attributeName String The name of the attribute to set
value String The value to set

setArchiveAttributeCommand.executeCallbacks(key)

Execute all callbacks under a key Arguments passed after the key are provided to each callback

Kind: instance method of SetArchiveAttributeCommand

Param Type Description
key String The callback name

Example

executeCallbacks("functionName", 1, 2, "three")

setArchiveAttributeCommand.setCallback(key, fn)

Add a callback for a key

Kind: instance method of SetArchiveAttributeCommand

Param Type Description
key String The callback name
fn function The callback function

SetEntryAttributeCommand ⇐ BaseCommand

Kind: global class
Extends: BaseCommand

new SetEntryAttributeCommand()

Command for setting entry attributes

setEntryAttributeCommand.entryTools : Object

Entry tools module

Kind: instance property of SetEntryAttributeCommand
Overrides: entryTools

setEntryAttributeCommand.searchTools : Object

Search tools module

Kind: instance property of SetEntryAttributeCommand
Overrides: searchTools

setEntryAttributeCommand.execute(obj, entryID, attributeName, value)

Execute the setting of an attribute

Kind: instance method of SetEntryAttributeCommand

Param Type Description
obj ArchiveDataset The archive dataset
entryID String The ID of the entry
attributeName String The name of the attribute to set
value String The value to set

setEntryAttributeCommand.executeCallbacks(key)

Execute all callbacks under a key Arguments passed after the key are provided to each callback

Kind: instance method of SetEntryAttributeCommand

Param Type Description
key String The callback name

Example

executeCallbacks("functionName", 1, 2, "three")

setEntryAttributeCommand.setCallback(key, fn)

Add a callback for a key

Kind: instance method of SetEntryAttributeCommand

Param Type Description
key String The callback name
fn function The callback function

SetEntryMetaCommand ⇐ BaseCommand

Deprecated

Kind: global class
Extends: BaseCommand

new SetEntryMetaCommand()

Command for setting meta properties on entries

setEntryMetaCommand.entryTools : Object

Entry tools module

Kind: instance property of SetEntryMetaCommand
Overrides: entryTools

setEntryMetaCommand.searchTools : Object

Search tools module

Kind: instance property of SetEntryMetaCommand
Overrides: searchTools

setEntryMetaCommand.execute(obj, entryID, propertyName, value)

Execute the setting of a meta property

Kind: instance method of SetEntryMetaCommand

Param Type Description
obj ArchiveDataset The archive dataset
entryID String The ID of the entry
propertyName String The name of the meta property to set
value String The value to set

setEntryMetaCommand.executeCallbacks(key)

Execute all callbacks under a key Arguments passed after the key are provided to each callback

Kind: instance method of SetEntryMetaCommand

Param Type Description
key String The callback name

Example

executeCallbacks("functionName", 1, 2, "three")

setEntryMetaCommand.setCallback(key, fn)

Add a callback for a key

Kind: instance method of SetEntryMetaCommand

Param Type Description
key String The callback name
fn function The callback function

SetEntryPropertyCommand ⇐ BaseCommand

Kind: global class
Extends: BaseCommand

new SetEntryPropertyCommand()

Command for setting entry properties

setEntryPropertyCommand.entryTools : Object

Entry tools module

Kind: instance property of SetEntryPropertyCommand
Overrides: entryTools

setEntryPropertyCommand.searchTools : Object

Search tools module

Kind: instance property of SetEntryPropertyCommand
Overrides: searchTools

setEntryPropertyCommand.execute(obj, entryID, propertyName, value)

Execute the setting of a property

Kind: instance method of SetEntryPropertyCommand

Param Type Description
obj ArchiveDataset The archive dataset
entryID String The ID of the entry
propertyName String The name of the property to set
value String The value to set

setEntryPropertyCommand.executeCallbacks(key)

Execute all callbacks under a key Arguments passed after the key are provided to each callback

Kind: instance method of SetEntryPropertyCommand

Param Type Description
key String The callback name

Example

executeCallbacks("functionName", 1, 2, "three")

setEntryPropertyCommand.setCallback(key, fn)

Add a callback for a key

Kind: instance method of SetEntryPropertyCommand

Param Type Description
key String The callback name
fn function The callback function

SetGroupAttributeCommand ⇐ BaseCommand

Kind: global class
Extends: BaseCommand

new SetGroupAttributeCommand()

Command for setting group attributes

setGroupAttributeCommand.entryTools : Object

Entry tools module

Kind: instance property of SetGroupAttributeCommand
Overrides: entryTools

setGroupAttributeCommand.searchTools : Object

Search tools module

Kind: instance property of SetGroupAttributeCommand
Overrides: searchTools

setGroupAttributeCommand.execute(obj, groupID, attributeName, value)

Execute the setting of an attribute

Kind: instance method of SetGroupAttributeCommand

Param Type Description
obj ArchiveDataset The archive dataset
groupID String The ID of the group
attributeName String The name of the attribute to set
value String The value to set

setGroupAttributeCommand.executeCallbacks(key)

Execute all callbacks under a key Arguments passed after the key are provided to each callback

Kind: instance method of SetGroupAttributeCommand

Param Type Description
key String The callback name

Example

executeCallbacks("functionName", 1, 2, "three")

setGroupAttributeCommand.setCallback(key, fn)

Add a callback for a key

Kind: instance method of SetGroupAttributeCommand

Param Type Description
key String The callback name
fn function The callback function

TitleGroupCommand ⇐ BaseCommand

Kind: global class
Extends: BaseCommand

new TitleGroupCommand()

Command for titling groups

titleGroupCommand.entryTools : Object

Entry tools module

Kind: instance property of TitleGroupCommand
Overrides: entryTools

titleGroupCommand.searchTools : Object

Search tools module

Kind: instance property of TitleGroupCommand
Overrides: searchTools

titleGroupCommand.execute(obj, groupID, title)

Execute the setting of the title

Kind: instance method of TitleGroupCommand

Param Type Description
obj ArchiveDataset The archive dataset
groupID String The ID of the group to set
title String The title to set

titleGroupCommand.executeCallbacks(key)

Execute all callbacks under a key Arguments passed after the key are provided to each callback

Kind: instance method of TitleGroupCommand

Param Type Description
key String The callback name

Example

executeCallbacks("functionName", 1, 2, "three")

titleGroupCommand.setCallback(key, fn)

Add a callback for a key

Kind: instance method of TitleGroupCommand

Param Type Description
key String The callback name
fn function The callback function

Entry

Entry class implementation Entries form the low-level data structures used in Buttercup, and are intended to represent logical collections of properties, like a login for a website.

Kind: global class

new Entry(archive, remoteObj)

Create a new managed entry instance

Param Type Description
archive Archive The main archive instance
remoteObj Object The remote object reference

entry.id : String

The ID of the entry

Kind: instance property of Entry
Read only: true

entry.type : String

Get the instance type

Kind: instance property of Entry
Read only: true

entry.delete([skipTrash]) ⇒ Boolean

Delete the entry - either trashes the entry, or removes it completely. If the entry is in the trash already, it is removed (including if there is no trash group). If the entry is in a normal group and a trash group exists, it is moved there instead of being deleted.

Kind: instance method of Entry
Returns: Boolean - Whether or not the item was deleted
See

  • moveToGroup
  • Archive.getTrashGroup
Param Type Default Description
[skipTrash] Boolean false Skip the trash and force-delete the entry

entry.deleteAttribute(attr) ⇒ Entry

Delete an attribute

Kind: instance method of Entry
Returns: Entry - Self
Throws:

  • Error Throws if the attribute doesn't exist, or cannot be deleted
Param Type Description
attr String The attribute name

entry.deleteMeta(property) ⇒ Entry

Deprecated

Delete a meta item

Kind: instance method of Entry
Returns: Entry - Self
Throws:

  • Error Throws if property doesn't exist, or cannot be deleted
Param Type Description
property String The meta property to delete

entry.deleteProperty(property) ⇒ Entry

Delete a property

Kind: instance method of Entry
Returns: Entry - Self
Throws:

  • Error Throws if property doesn't exist, or cannot be deleted
Param Type Description
property String The property to delete

entry.getAttribute([attributeName]) ⇒ String | undefined | Object

Get an attribute If no attribute name is specified, an object with all attributes and their values is returned.

Kind: instance method of Entry
Returns: String | undefined | Object - The attribute value or an object containing all attribute keys and their values if no attribute name is provided

Param Type Description
[attributeName] String The name of the attribute to fetch

entry.getAttributes() ⇒ Object

Deprecated

Get all attributes

Kind: instance method of Entry
Returns: Object - Attributes object

entry.getGroup() ⇒ Group | null

Deprecated

Get the containing group for the entry

Kind: instance method of Entry
Returns: Group | null - The parent group

entry.getHistory() ⇒ Array.<EntryHistoryItem>

Get the history of the entry

Kind: instance method of Entry

entry.getMeta([property]) ⇒ String | undefined | Object

Deprecated

Get a meta value If no meta name is specified, an object with all meta keys and their values is returned.

Kind: instance method of Entry
Returns: String | undefined | Object - The meta value or an object containing all meta keys and values if no meta name specified

Param Type Description
[property] String The name of the meta property

entry.getProperty([property]) ⇒ String | undefined | Object

Get a property value If no property name is specified, an object with all properties and their values is returned.

Kind: instance method of Entry
Returns: String | undefined | Object - The property value or an object with all values if no property specified

Param Type Description
[property] String The name of the property to fetch

entry.getProperties(propertyExpression) ⇒ Object

Get property values via RegExp expressions. If no property expression is specified, it returns the empty behavior of {@see Entry.getProperty}.

Kind: instance method of Entry
Returns: Object - A key-value object of the matching properties

Param Type
propertyExpression RegExp | String

entry.getURLs([urlTypePreference]) ⇒ Array.<String>

Get an array of URLs from the Entry Returns an array of detected URL values in the Entry's properties. The types of URLs can be configured by providing a preference:

  • "general" - General URLs (of any type, preferring "URL" named props)
  • "login" - Prefer URLs whose key has "login" in it
  • "icon" - Return only icon-like URLs
  • "any" - Return all found URLs

Kind: instance method of Entry
Returns: Array.<String> - An array of URLs

Param Type Description
[urlTypePreference] String The URL type preference

entry.isInTrash() ⇒ Boolean

Check if the entry is in the trash

Kind: instance method of Entry
Returns: Boolean - Whether or not the entry is in the trash

entry.moveToGroup(group) ⇒ Entry

Move the entry to another group

Kind: instance method of Entry
Returns: Entry - Returns self
Params: Group group The target group

Param Type Description
group Group The target group

entry.setAttribute(attributeName, value) ⇒ Entry

Set an attribute on the entry

Kind: instance method of Entry
Returns: Entry - Returns self

Param Type Description
attributeName String The name of the attribute
value String The value to set

entry.setMeta(prop, [val]) ⇒ Entry

Deprecated

Set a meta value on the entry

Kind: instance method of Entry
Returns: Entry - Returns self

Param Type Description
prop String The meta name
[val] String The value to set

entry.setProperty(prop, [val]) ⇒ Entry

Set a property on the entry

Kind: instance method of Entry
Returns: Entry - Returns self

Param Type Description
prop String The property name
[val] String The property value

entry.toObject() ⇒ Object

Export entry to object

Kind: instance method of Entry
Returns: Object - The entry in object-form

entry.toString() ⇒ String

toString override

Kind: instance method of Entry
Returns: String - The string representation of the Entry

entry._getArchive() ⇒ Archive

Get the archive reference

Kind: instance method of Entry
Returns: Archive - The Archive reference
Access: protected

entry._getRemoteObject() ⇒ Object

Get the remote object that mirrors the data represented here

Kind: instance method of Entry
Returns: Object - The remote object (in-memory copy)
Access: protected

entry._getWestley() ⇒ Westley

Get the Westley reference

Kind: instance method of Entry
Returns: Westley - The internal Westley reference
Access: protected

Entry.createNew(archive, groupID) ⇒ Entry

Create a new entry

Kind: static method of Entry
Returns: Entry - The new entry
Throws:

  • Error Throws if the target group doesn't exist
  • Error Throws if the target group is the trash group, or if the target group is in the trash
Param Type Description
archive Archive The archive
groupID string The ID of the target group

EntryFinder

Entry searching class

Kind: global class

new EntryFinder(target)

Param Type Description
target Array.<Archive> | Archive The archive or archives to search

entryFinder.items : Array.<EntrySearchInfo>

All items available for searching

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

Flattener

Flattener class for flattening archive history sets

Kind: global class

flattener.westley : Westley

The working Westley instance

Kind: instance property of Flattener
Read only: true

flattener.canBeFlattened() ⇒ Boolean

Check if the dataset can be flattened

Kind: instance method of Flattener
Returns: Boolean - True if it can be flattened

flattener.flatten([force]) ⇒ Boolean

Flatten a dataset

Kind: instance method of Flattener
Returns: Boolean - True if flattening occurred, false otherwise

Param Type Default Description
[force] Boolean false Force flattening even if it is detected to be unnecessary

Flattener.FLATTENING_MIN_LINES : Number

Minimum history lines before flattening can occur

Kind: static constant of Flattener

Flattener.PRESERVE_LINES : Number

Number of lines to preserve (most recent)

Kind: static constant of Flattener

Group

Group implementation

Kind: global class
Mixes: GroupCollection, EntryCollection

new Group(archive, remoteObj)

Managed group class

Param Type Description
archive Archive The archive instance
remoteObj Object The remote object reference

group.id : String

The entry ID

Kind: instance property of Group

group.type : String

Get the instance type

Kind: instance property of Group
Read only: true

group.findGroupByID ⇒ Group | null

Find a group by its ID

Kind: instance property of Group
Mixes: findGroupByID
Returns: Group | null - The group or null if not found

Param Type Description
id String The group ID to search for

group.findGroupsByTitle ⇒ Array.<Group>

Find groups by their title

Kind: instance property of Group
Mixes: findGroupsByTitle
Returns: Array.<Group> - An array of groups

Param Type Description
title String | RegExp The group title

group.findEntriesByMeta ⇒ Array.<Entry>

Find entries that match a certain meta property

Kind: instance property of Group
Mixes: findEntriesByMeta
Returns: Array.<Entry> - An array of found entries

Param Type Description
metaName String The meta property to search for
value RegExp | string The value to search for

group.findEntriesByProperty ⇒ Array.<Entry>

Find all entries that match a certain property

Kind: instance property of Group
Mixes: findEntriesByProperty
Returns: Array.<Entry> - An array of found extries

Param Type Description
property string The property to search with
value RegExp | string The value to search for

group.findGroupByID ⇒ Group | null

Find a group by its ID

Kind: instance property of Group
Mixes: findGroupByID
Returns: Group | null - The group or null if not found

Param Type Description
id String The group ID to search for

group.findGroupsByTitle ⇒ Array.<Group>

Find groups by their title

Kind: instance property of Group
Mixes: findGroupsByTitle
Returns: Array.<Group> - An array of groups

Param Type Description
title String | RegExp The group title

group.findEntriesByMeta ⇒ Array.<Entry>

Find entries that match a certain meta property

Kind: instance property of Group
Mixes: findEntriesByMeta
Returns: Array.<Entry> - An array of found entries

Param Type Description
metaName String The meta property to search for
value RegExp | string The value to search for

group.findEntriesByProperty ⇒ Array.<Entry>

Find all entries that match a certain property

Kind: instance property of Group
Mixes: findEntriesByProperty
Returns: Array.<Entry> - An array of found extries

Param Type Description
property string The property to search with
value RegExp | string The value to search for

group.createEntry([title]) ⇒ Entry

Create a new entry with a title

Kind: instance method of Group
Returns: Entry - The new entry

Param Type Description
[title] String The title of the new entry

group.createGroup([title]) ⇒ Group

Create a child group

Kind: instance method of Group
Returns: Group - The new child group

Param Type Description
[title] string Optionally set a title

group.delete([skipTrash]) ⇒ Boolean

Delete the group If there is a trash group available, the group is moved there. If the group is already in the trash, it is deleted permanently.

Kind: instance method of Group
Returns: Boolean - True when deleted, false when moved to trash

Param Type Default Description
[skipTrash] Boolean false Skip the trash

group.deleteAttribute(attr) ⇒ Group

Delete an attribute

Kind: instance method of Group
Returns: Group - Returns self

Param Type Description
attr string The name of the attribute

group.getAttribute([attributeName]) ⇒ String | undefined | Object

Get an attribute

Kind: instance method of Group
Returns: String | undefined | Object - Returns the attribute or undefined if not found. If no attribute name is provided an object containing all attributes is returned.

Param Type Description
[attributeName] String The name of the attribute. If none provided the entire attributes object is returned.

group.getAttributes() ⇒ Object

Deprecated

Get all attributes

Kind: instance method of Group
Returns: Object - Attributes object

group.getEntries() ⇒ Array.<Entry>

Get the entries within the group

Kind: instance method of Group
Returns: Array.<Entry> - An array of entries

group.getGroup() ⇒ Group | null

Get the parent group

Kind: instance method of Group
Returns: Group | null - Returns the parent group instance or null if the parent is the archive
Throws:

  • Error Throws if no parent could be found (detached)

group.getGroups() ⇒ Array.<Group>

Get the groups within the group

Kind: instance method of Group
Returns: Array.<Group> - An array of child groups

group.getTitle() ⇒ string

Get the group title

Kind: instance method of Group
Returns: string - The title of the group

group.isInTrash() ⇒ Boolean

Check if the group is in the trash

Kind: instance method of Group
Returns: Boolean - Whether or not the group is within the trash group

group.isTrash() ⇒ Boolean

Check if the group is used for trash

Kind: instance method of Group
Returns: Boolean - Whether or not the group is the trash group

group.moveTo(target) ⇒ Group

Move the group to another group or archive

Kind: instance method of Group
Returns: Group - Self

Param Type Description
target Group | Archive The destination Group or Archive instance

group.setAttribute(attributeName, value) ⇒ Group

Set an attribute

Kind: instance method of Group
Returns: Group - Returns self

Param Type Description
attributeName string The name of the attribute
value string The value to set

group.setTitle(title) ⇒ Group

Set the group title

Kind: instance method of Group
Returns: Group - Returns self

Param Type Description
title string The title of the group

group.toObject(outputFlags) ⇒ Object

Export group to object

Kind: instance method of Group
Returns: Object - The group, in raw object form

Param Type Description
outputFlags Number Bitwise options for outputting entries and child groups

Example

// output defaults (entries and sub groups)
     group.toObject()

Example

// output only entries
     group.toObject(Group.OutputFlag.Entries)

Example

// output only the group info
     group.toObject(Group.OutputFlag.OnlyGroup)

group.toString(outputFlags) ⇒ string

Export the group to a JSON string

Kind: instance method of Group
Returns: string - The group (and entries) in JSON string format
See: toObject

Param Type Description
outputFlags Number Output configuration flags to pass to toObject

group._getArchive() ⇒ Archive

Get the archive instance reference

Kind: instance method of Group
Returns: Archive - The archive instance
Access: protected

group._getRemoteObject() ⇒ Object

Get the remotely-managed object (group)

Kind: instance method of Group
Returns: Object - The object instance for the group
Access: protected

group._getWestley() ⇒ Westley

Get the delta managing instance for the archive

Kind: instance method of Group
Returns: Westley - The internal Westley object
Access: protected

group.inst.findEntryByID(id) ⇒ null | Entry

Find an entry by its ID

Kind: instance method of Group
Mixes: inst.findEntryByID
Returns: null | Entry - Null if not found, or the Entry instance

Param Type Description
id String The ID to search for

group.inst.findEntryByID(id) ⇒ null | Entry

Find an entry by its ID

Kind: instance method of Group
Mixes: inst.findEntryByID
Returns: null | Entry - Null if not found, or the Entry instance

Param Type Description
id String The ID to search for

Group.Attributes : enum

Group attribute names

Kind: static enum of Group

Group.OutputFlag : enum

Bitwise output flags for toObject and toString

Kind: static enum of Group
See

  • toObject
  • toString

Group.createNew(archive, [parentID]) ⇒ Group

Create a new Group with a delta-manager and parent group ID

Kind: static method of Group
Returns: Group - A new group
Throws:

  • Error Throws if the target group doesn't exist
  • Error Throws if the target group is the trash group, or if the target group is within the trash group
Param Type Description
archive Archive The archive to create the group in
[parentID] string The parent group ID (default is root)

InigoCommand

Inigo command generator

Kind: global class

new InigoCommand(cmdKey)

Param Type Description
cmdKey String The key for the command

Westley ⇐ AsyncEventEmitter

Westley class Archive object dataset and history manager. Handles parsing and revenge for the princess.

Kind: global class
Extends: AsyncEventEmitter

westley.isDirty : Boolean

Whether the instance is dirty or not (unsaved changes)

Kind: instance property of Westley
Access: public
Read only: true

westley.readOnly

Kind: instance property of Westley
Access: public
Properties

Name Type
readOnly Boolean

westley.readOnly

Set the read only value

Kind: instance property of Westley

Param Type Description
newRO Boolean The new value

westley.clear() ⇒ Westley

Clear the dataset and history

Kind: instance method of Westley
Returns: Westley - Returns self

westley.clearDirtyState()

Clear the dirty state of the instance

Kind: instance method of Westley

westley.execute(command, [append]) ⇒ Westley

Execute a command - stored in history and modifies the dataset

Kind: instance method of Westley
Returns: Westley - Returns self

Param Type Description
command String The command to execute
[append] Boolean Whether to append to the end of the history list (default true)

westley.getDataset() ⇒ Object

Get the core dataset

Kind: instance method of Westley
Returns: Object - The dataset object

westley.getHistory() ⇒ Array.<String>

Get the history (deltas)

Kind: instance method of Westley
Returns: Array.<String> - The command array (history)

westley.pad() ⇒ Westley

Insert a padding in the archive (used for delta tracking)

Kind: instance method of Westley
Returns: Westley - Returns self

westley._getCommandForKey(commandKey) ⇒ Command

Gets a command by its key from the cache with its dependencies injected

Kind: instance method of Westley
Returns: Command - Returns the command
Access: protected

Param Type Description
commandKey String The key of the command

Workspace

Workspace class implementation Workspaces organise Archives and Datasources, and perform saves and merges with remote changes.

Kind: global class

workspace.archive : Archive

The archive instance

Kind: instance property of Workspace

workspace.datasource : TextDatasource

The datasource instance for the archive

Kind: instance property of Workspace

workspace.masterCredentials : Credentials

The master credentials for the archive

Kind: instance property of Workspace

workspace.saveChannel : Channel

The save channel for queuing save actions

Kind: instance property of Workspace

workspace.localDiffersFromRemote() ⇒ Promise.<Boolean>

Detect whether the local archives (in memory) differ from their remote copies Fetches the remote copies from their datasources and detects differences between them and their local counterparts. Does not change/update the local items.

Kind: instance method of Workspace
Returns: Promise.<Boolean> - A promise that resolves with a boolean - true if there are differences, false if there is not

workspace.mergeFromRemote() ⇒ Promise.<Archive>

Merge remote contents Detects differences between a local and a remote item, and merges the two copies together.

Kind: instance method of Workspace
Returns: Promise.<Archive> - A promise that resolves with the newly merged archive - This archive is automatically saved over the original local copy.

workspace.save() ⇒ Promise

Save the archive to the remote

Kind: instance method of Workspace
Returns: Promise - A promise that resolves when saving has completed

workspace.setArchive(archive, datasource, masterCredentials)

Set the archive and its accompanying data on the workspace

Kind: instance method of Workspace

Param Type Description
archive Archive The archive instance
datasource TextDatasource The datasource for the archive
masterCredentials * The master credentials for the archive

workspace.update() ⇒ Promise

Update the archive

Kind: instance method of Workspace
Returns: Promise - A promise that resolves once the update has completed

workspace.updatePrimaryCredentials(masterCredentials)

Update the master password of the archive

Kind: instance method of Workspace

Param Type Description
masterCredentials Credentials The new credentials

EntryCollection : Object

Kind: global mixin

EntryCollection.findEntriesByMeta ⇒ Array.<Entry>

Find entries that match a certain meta property

Kind: static property of EntryCollection
Returns: Array.<Entry> - An array of found entries

Param Type Description
metaName String The meta property to search for
value RegExp | string The value to search for

EntryCollection.findEntriesByProperty ⇒ Array.<Entry>

Find all entries that match a certain property

Kind: static property of EntryCollection
Returns: Array.<Entry> - An array of found extries

Param Type Description
property string The property to search with
value RegExp | string The value to search for

EntryCollection.inst.findEntryByID(id) ⇒ null | Entry

Find an entry by its ID

Kind: static method of EntryCollection
Returns: null | Entry - Null if not found, or the Entry instance

Param Type Description
id String The ID to search for

GroupCollection : Object

Kind: global mixin

GroupCollection.findGroupByID ⇒ Group | null

Find a group by its ID

Kind: static property of GroupCollection
Returns: Group | null - The group or null if not found

Param Type Description
id String The group ID to search for

GroupCollection.findGroupsByTitle ⇒ Array.<Group>

Find groups by their title

Kind: static property of GroupCollection
Returns: Array.<Group> - An array of groups

Param Type Description
title String | RegExp The group title

credentialsToDatasource(sourceCredentials) ⇒ Promise.<{datasource, credentials}>

Convert credentials of a remote archive to a datasource

Kind: global function
Returns: Promise.<{datasource, credentials}> - A promise that resolves with the datasource and source credentials

Param Type Description
sourceCredentials Credentials The remote credentials. The credentials must have a type field and datasource information field

credentialsToSource(sourceCredentials, archiveCredentials, [initialise], [contentOverride]) ⇒ Promise.<Object>

Convert credentials to a source for the ArchiveManager

Kind: global function
Returns: Promise.<Object> - A promise that resolves with an object containing a workspace, the source credentials and archive credentials

Param Type Default Description
sourceCredentials Credentials The remote archive credentials
archiveCredentials Credentials Credentials for unlocking the archive
[initialise] Boolean false Whether or not to initialise a new archive (defaults to false)
[contentOverride] String Content for overriding the fetch operation in the datasource, for loading offline content

addExtraFieldsNonDestructive(entry, fields) ⇒ Array.<EntryFacadeField>

Add extra fields to a fields array that are not mentioned in a preset Facades are creaded by presets which don't mention all property values (custom user added items). This method adds the unmentioned items to the facade fields so that they can be edited as well.

Kind: global function
Returns: Array.<EntryFacadeField> - A new array with all combined fields

Param Type Description
entry Entry An Entry instance
fields Array.<EntryFacadeField> An array of fields

applyFieldDescriptor(entry, descriptor)

Apply a facade field descriptor to an entry Takes data from the descriptor and writes it to the entry.

Kind: global function

Param Type Description
entry Entry The entry to apply to
descriptor EntryFacadeField The descriptor object

consumeEntryFacade(entry, facade)

Deprecated

Process a modified entry facade

Kind: global function

Param Type Description
entry Entry The entry to apply processed data on
facade EntryFacade The facade object

createEntryFacade(entry) ⇒ EntryFacade

Deprecated

Create a data/input facade for an Entry instance

Kind: global function
Returns: EntryFacade - A newly created facade

Param Type Description
entry Entry The Entry instance

getEntryFacadeType(entry) ⇒ String

Deprecated

Get the facade type for an entry

Kind: global function
Returns: String - The facade type

Param Type Description
entry Entry The entry instance

setEntryValue(entry, property, name, value)

Set a value on an entry

Kind: global function
Throws:

  • Error Throws if the property type is not recognised
Param Type Description
entry Entry The entry instance
property String Type of property ("property"/"meta"/"attribute")
name String The property name
value String The value to set

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

dedupe(arr) ⇒ Array

De-dupe an array

Kind: global function
Returns: Array - The de-duped array

Param Type Description
arr Array The array

createFieldDescriptor(entry, title, entryPropertyType, entryPropertyName, options) ⇒ EntryFacadeField

Create a descriptor for a field to be used within a facade

Kind: global function
Returns: EntryFacadeField - The field descriptor

Param Type Description
entry Entry The entry instance to process
title String The field title
entryPropertyType String The type of entry property (property/attribute)
entryPropertyName String The name of the property
options Object The options for the field

getEntryURLs(properties, preference)

Get URLs from an entry's properties Allows for preferential sorting

Kind: global function

Param Type Description
properties Object The entry properties
preference *

getEntryValue(entry, property, name) ⇒ String

Deprecated

Get a value on an entry for a specific property type

Kind: global function
Returns: String - The property value
Throws:

  • Error Throws for unknown property types
Param Type Description
entry Entry The entry instance
property String The type of entry property (property/meta/attribute)
name String The property name

isValidProperty(name) ⇒ Boolean

Check if a property name is valid

Kind: global function
Returns: Boolean - True if the name is valid

Param Type Description
name String The name to check

findEntriesByCheck(groups, compareFn) ⇒ Array.<Entry>

Find entry instances by filtering with a compare function

Kind: global function
Returns: Array.<Entry> - An array of found entries

Param Type Description
groups Array.<Group> The groups to check in
compareFn function The callback comparison function, return true to keep and false to strip

findGroupsByCheck(groups, compareFn) ⇒ Array.<Group>

Find group instances within groups that satisfy some check

Kind: global function
Returns: Array.<Group> - An array of found groups

Param Type Description
groups Array.<Group> The groups to check within
compareFn function A comparision function - return true to keep, false to strip

getAllEntries(groups) ⇒ Array.<Entry>

Get all entries within a collection of groups

Kind: global function
Returns: Array.<Entry> - An array of entries

Param Type Description
groups Array.<Group> An array of groups

generateUUID() ⇒ String

Generate a UUID (v4)

Kind: global function
Returns: String - The new UUID

ArchiveSourceOptions : Object

New source options

Kind: global typedef
Properties

Name Type Description
[id] String Override source ID generation
[type] String Specify the source type

ArchiveSourceDescription

Kind: global typedef
Properties

Name Type Description
name String The name of the source
id String The source ID
status ArchiveSourceStatus Status of the source
type String The source type
colour String Colour for the source
order Number The order of the source

ArchiveDataset : Object

Kind: global typedef
Properties

Name Type Description
groups Array.<Object> Array of groups
entries Array.<Object> Array of entries
attributes Object Archive attributes

EntryHistoryItem : Object

Kind: global typedef
Properties

Name Type Description
type String The type of history item
[origin] String The origin group ID for a moved-entry
[destination] String The destination group ID for a moved-entry
[property] String The property/attribute name of the change
[value] String The value that was changed (resulting)

EntryFacade : Object

Entry facade for data input

Kind: global typedef
Properties

Name Type Description
type String The type of the facade
fields Array.<EntryFacadeField> An array of fields

EntrySearchInfo : Object

Kind: global typedef
Properties

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

EntryFacadeField : Object

Entry facade data field

Kind: global typedef
Properties

Name Type Description
title String The user-friendly title of the field
field String The type of data to map back to on the Entry instance (property/attribute)
property String The property name within the field type of the Entry instance
value String The value of the property (read/write)
secret Boolean Wether or not the value should be hidden while viewing (masked)
multiline Boolean Whether the value should be edited as a multiline value or not
formatting Object | Boolean Vendor formatting options object, or false if no formatting necessary
maxLength Number Maximum recommended length of the value (defaults to -1)

FoundGroupResult : Object

Kind: global typedef
Properties

Name Type Description
group Object The found group dataset
index Number The index the group was located at