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

Latest commit

 

History

History
552 lines (408 loc) · 22.9 KB

API.md

File metadata and controls

552 lines (408 loc) · 22.9 KB

Modules

ButtercupFacades

Functions

getEntriesFacades(entryCollection, groupID)Array.<EntryFacade>

Convert an array of entries into an array of facades

getGroupsFacades(groupCollection, parentID)Array.<GroupFacade>

Convert an array of groups into an array of facades

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.

setEntryValue(entry, property, name, value, [valueType])

Set a value on an entry

getEntryValue(entry, propertyType, name)String

Get a value on an entry for a specific property type

getEntryValueType(entry, propertyName)String

Get the entry value type

setEntryValueType(entry, propertyName, valueType)

Set the value type attribute of an entry

Typedefs

ArchiveFacade : Object
GroupFacade : Object
EntryHistoryItem : Object
EntryFacade : Object

Entry facade for data input

CreateEntryFacadeOptions : Object
FlagSpecification : Object
EntryFacadeFieldFormattingSegment : Object
EntryFacadeFieldFormatting : Object
EntryFacadeField : Object

Entry facade data field

ButtercupFacades

ButtercupFacades.DEFAULT_ENTRY_TYPE : String

Default entry type

Kind: static constant of ButtercupFacades

ButtercupFacades.DEFAULT_FIELD_TYPE : String

Default entry field type

Kind: static constant of ButtercupFacades

ButtercupFacades.ENTRY_FACADE_TYPE_ATTRIBUTE : String

Facade type flag for an entry (specifies what type of entry it is)

Kind: static constant of ButtercupFacades

ButtercupFacades.ENTRY_TYPE_CREDITCARD : String

Credit-card entry type

Kind: static constant of ButtercupFacades

ButtercupFacades.ENTRY_TYPE_LOGIN : String

Login (default) entry type

Kind: static constant of ButtercupFacades

ButtercupFacades.ENTRY_TYPE_NOTE : String

Note entry type

Kind: static constant of ButtercupFacades

ButtercupFacades.ENTRY_TYPE_SSHKEY : String

SSH public/private key-pair entry type

Kind: static constant of ButtercupFacades

ButtercupFacades.ENTRY_TYPE_WEBSITE : String

Website entry type (includes URL)

Kind: static constant of ButtercupFacades

ButtercupFacades.ENTRY_TYPES : Object.<String, FlagSpecification>

Entry types collection (all available)

Kind: static constant of ButtercupFacades

ButtercupFacades.FIELD_VALUE_TYPE_NOTE : String

Note type entry field value

Kind: static constant of ButtercupFacades

ButtercupFacades.FIELD_VALUE_TYPE_OTP : String

OTP (One Time Password) type entry field value

Kind: static constant of ButtercupFacades

ButtercupFacades.FIELD_VALUE_TYPE_PASSWORD : String

Password type entry field value

Kind: static constant of ButtercupFacades

ButtercupFacades.FIELD_VALUE_TYPE_TEXT : String

Text (default) type entry field value

Kind: static constant of ButtercupFacades

ButtercupFacades.FIELD_VALUE_TYPES : Object.<String, FlagSpecification>

Entry field value types collection (all available)

Kind: static constant of ButtercupFacades

ButtercupFacades.consumeArchiveFacade(archive, facade)

Consume an archive facade and apply the differences to the archive instance

Kind: static method of ButtercupFacades

Param Type Description
archive Archive The archive instance to apply to
facade ArchiveFacade The facade to apply

ButtercupFacades.consumeGroupFacade(group, facade)

Consume a group facade and apply the differences to a group instance

Kind: static method of ButtercupFacades

Param Type Description
group Group The group instance to apply to
facade GroupFacade The facade to apply

ButtercupFacades.createArchiveFacade(archive) ⇒ ArchiveFacade

Create an archive facade from an Archive instance

Kind: static method of ButtercupFacades
Returns: ArchiveFacade - An archive facade

Param Type Description
archive Archive An archive instance

ButtercupFacades.createGroupFacade(group, [parentID])

Create a group facade from a Group instance

Kind: static method of ButtercupFacades

Param Type Default Description
group Group The group instance
[parentID] String 0 The parent ID of the group

ButtercupFacades.isVaultFacade(obj) ⇒ Boolean

Check if an object is a vault facade

Kind: static method of ButtercupFacades
Returns: Boolean - True if a vault facade

Param Type Description
obj Object | * The item to check

ButtercupFacades.consumeEntryFacade(entry, facade)

Process a modified entry facade

Kind: static method of ButtercupFacades

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

ButtercupFacades.createEntryFacade([entry], [ops]) ⇒ EntryFacade

Create a data/input facade for an Entry instance

Kind: static method of ButtercupFacades
Returns: EntryFacade - A newly created facade

Param Type Description
[entry] Entry The Entry instance
[ops] CreateEntryFacadeOptions Options for the entry facade creation

ButtercupFacades.getEntryFacadeType(entry) ⇒ String

Get the facade type for an entry

Kind: static method of ButtercupFacades
Returns: String - The facade type

Param Type Description
entry Entry The entry instance

ButtercupFacades.hashVaultFacade(vaultFacade) ⇒ String

Deprecated

Generate a hash of a vault facade (useful for detecting if the vault differs from another copy)

Kind: static method of ButtercupFacades
Returns: String - Hash string

Param Type Description
vaultFacade ArchiveFacade A facade instance

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

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

Kind: static method of ButtercupFacades
Returns: EntryFacadeField - The field descriptor

Param Type Description
entry Entry | null The entry instance to process or null if the initial value should be empty
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

getEntriesFacades(entryCollection, groupID) ⇒ Array.<EntryFacade>

Convert an array of entries into an array of facades

Kind: global function
Returns: Array.<EntryFacade> - An array of entry facades

Param Type Description
entryCollection Array.<Entry> An array of entries
groupID String The parent group ID

getGroupsFacades(groupCollection, parentID) ⇒ Array.<GroupFacade>

Convert an array of groups into an array of facades

Kind: global function
Returns: Array.<GroupFacade> - An array of group facades

Param Type Description
groupCollection Array.<Group> An array of groups
parentID String The parent group ID

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

setEntryValue(entry, property, name, value, [valueType])

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
[valueType] String Value type to set

getEntryValue(entry, propertyType, 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
propertyType String The type of entry property (property/attribute)
name String The property name

getEntryValueType(entry, propertyName) ⇒ String

Get the entry value type

Kind: global function
Returns: String - The entry value type (returns default "text" if entry not specified)

Param Type Description
entry Entry | null Entry instance
propertyName String The entry property name

setEntryValueType(entry, propertyName, valueType)

Set the value type attribute of an entry

Kind: global function

Param Type Description
entry Entry Entry instance
propertyName String The property name
valueType String The value type

ArchiveFacade : Object

Kind: global typedef
Properties

Name Type Description
type String The facade type: "archive"
id String The archive ID
attributes Object A key/value list of all the archive attributes
groups Array.<GroupFacade> An array of group facades
entries Array.<EntryFacade> An array of entry facades
_tag String The UUID tag for the generation of the facade

GroupFacade : Object

Kind: global typedef
Properties

Name Type Description
type String The facade type: "group"
id String | null The group ID. Will be set to null if the group is a new one
title String The group title
attributes Object A key/value list of group attributes
parentID String | null The parent group ID. Set to "0" if it is to be created in the root.

EntryHistoryItem : Object

Kind: global typedef
Properties

Name Type Description
property String The property/attribute name
propertyType String Either "property" or "attribute"
originalValue String | null The original value or null if it did not exist before this change
newValue String | null The new value or null if it was deleted

EntryFacade : Object

Entry facade for data input

Kind: global typedef
Properties

Name Type Description
id String The entry ID
type String The type of the facade
fields Array.<EntryFacadeField> An array of fields
parentID String The parent group ID
_history Array.<EntryHistoryItem> Array of changes for all properties of the entry

CreateEntryFacadeOptions : Object

Kind: global typedef
Properties

Name Type Description
[type] String Optionally override the created facade type

FlagSpecification : Object

Kind: global typedef
Properties

Name Type Description
title String The title of the entry type
slug String The slug of the entry type

EntryFacadeFieldFormattingSegment : Object

Kind: global typedef
Properties

Name Type Description
[char] RegExp A character to match with a regular expression
[repeat] Number Number of times to repeat the character match (required for char)
[exactly] String The exact character match (operates in opposition to char)

EntryFacadeFieldFormatting : Object

Kind: global typedef
Properties

Name Type Description
[format] Array.<EntryFacadeFieldFormattingSegment> The segmented formatting of the value
[placeholder] String Optional placeholder for the input (ties in to format)
options Object | Array Options for a dropdown: either an array of option values or an object (key:value) of values and titles
[defaultOption] String The default option value if none set

EntryFacadeField : Object

Entry facade data field

Kind: global typedef
Properties

Name Type Description
id String A randomly generated ID (UUID) for identifying this field during editing
title String The user-friendly title of the field
propertyType 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)
[valueType] String The type of value (rendering) (null for attributes)
formatting EntryFacadeFieldFormatting | Boolean Vendor formatting options object, or false if no formatting necessary
removeable Boolean Whether or not the field can be removed or have its key changed