ElvFabric

Tools for operating content on the Content Fabric

Constructor

new ElvFabric({configUrl})

Instantiate the ElvFabric Object

Parameters:
Name Type Description
configUrl string

The Content Fabric configuration URL

Source:

Methods

async AccessGroupManager(
group,
addr
)

AccessGroupManager Check if an address is a manager of the access group

Returns:

result of contract method call

Parameters:
Name Type Description
group string

Group ID (hex or igrp format)

addr string

User address

Source:

async AccessGroupManagers(group) → Array

AccessGroupManagers Returns a list of group managers

Returns:

group members

Parameters:
Name Type Description
group string

Group ID (hex or igrp format)

Source:

async AccessGroupMember(
group,
addr
)

AccessGroupMemeber Check if an address is a member of the access group

Returns:

result of contract method call

Parameters:
Name Type Description
group string

Group ID (hex or igrp format)

addr string

User address

Source:

async AccessGroupMembers(group) → Array

AccessGroupMembers Returns a list of group members

Returns:

group members

Parameters:
Name Type Description
group string

Group ID (hex or igrp format)

Source:

async GetContractMeta(
address,
key
)

GetContractMeta

Returns:

value stored in the contract metadata

Parameters:
Name Type Description
address string

contract address

key string

metadata key

Source:

async GetMetaBatch(csvFile)

GetMetaBatch

Parameters:
Name Type Description
csvFile string

File specifying a list of content IDs and metadata fields to read. Note that the first two columns has to be id,hash

Source:

async GetMetaByIds(
ids,
fields
)

GetMetaByIds

Parameters:
Name Type Description
ids Object.<string, Object>

Map of content object IDs to their metadata objects

fields Array.<string>

Metadata field paths to extract for each object

Source:

async ReadCsvObjectsMerged(
csvFile,
ignore
)

Read a CSV file and parse into a JSON object merging with the object's existing fabric metadata.

Applies string substitutions on input:

  • ${UUID}

CSV file format: id,field1,field2 iq_1111,value1,value2 iq_2222,value1,value2

Output format: { "iq_1111" : { "field1": "value1", "field2": "value2" }, "iq_2222" : { "field1": "value1", "field2": "value2" } }

Returns:

object Map of object IDs to metadata

Parameters:
Name Type Description
csvFile string

path to CSV file

ignore Array

a list of prefixes to ignore eg "eluv."

Source:

async SetContractMeta(
address,
key,
value
)

SetContractMeta

Returns:

result of contract method call

Parameters:
Name Type Description
address string

contract address

key string

metadata key

value string

metadata value

Source:

async SetMetaBatch(
csvFile,
duplicate
)

SetMetaBatch

Parameters:
Name Type Description
csvFile string

File specifying a list of content IDs and metadata fields

duplicate boolean

Clone objects and set metadata on the clone instead

Source:

async copyObject(
objectId,
meta
)

Make a copy of an object and set content metadata on the new object

Parameters:
Name Type Description
objectId string
meta object

Metadata tree to merge into the object

Source:

async copyObjectBatch(ids)

Make a copy of a list of object and set content metadata on the new ones.

Parameters:
Name Type Description
ids object

Map of object IDs to metadata

Source:

async getMeta(objectId)

Get content metadata for an object

Parameters:
Name Type Description
objectId string
Source:

async setMeta(
objectId,
meta,
merge
)

Set content metadata for an object

Parameters:
Name Type Description
objectId string
meta object

Metadata tree to merge into the object

merge boolean

Merge == true will merge instead of replace

Source:

async setMetaBatch(ids)

Set content metadata for a bach of objects.

Parameters:
Name Type Description
ids object

Map of object IDs to metadata

Source: