Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return [{// this is a message
subject: id,
predicate: PRED.type,
object: PRED.post
}, { // written by...
subject: id,
predicate: PRED.hasCreator,
object: author
}, { // with content...
subject: id,
predicate: PRED.content,
object: $rdf.lit(content)
}, { // with timestamp...
subject: id,
predicate: PRED.created,
object: $rdf.lit(created, undefined, XSD('int'))
}, { // contained by
subject: id,
predicate: PRED.hasContainer,
object: conversationId
}, {
subject: conversationId,
predicate: PRED.containerOf,
object: id
}]
}
if (created instanceof Date) {
created = created.getTime()
}
return [{// this is a message
subject: id,
predicate: PRED.type,
object: PRED.post
}, { // written by...
subject: id,
predicate: PRED.hasCreator,
object: author
}, { // with content...
subject: id,
predicate: PRED.content,
object: $rdf.lit(content)
}, { // with timestamp...
subject: id,
predicate: PRED.created,
object: $rdf.lit(created, undefined, XSD('int'))
}, { // contained by
subject: id,
predicate: PRED.hasContainer,
object: conversationId
}, {
subject: conversationId,
predicate: PRED.containerOf,
object: id
}]
}
return err
}
// Get object value for solid:storageQuota
const quotaNode = serverSideGraph.any(storageUrlNode, SOLID('storageQuota'), null)
if (!quotaNode) {
return new HTTPError(404, 'Unable to find solid:storageQuota')
}
// Get size of user's POD
const root = ldp.resourceMapper.getFullPath(rootUrl)
const size = await actualSize(root)
// Add triples to graph
const store = $rdf.graph()
store.add(storageUrlNode, SOLID('storageUsage'), $rdf.lit(size))
store.add(storageUrlNode, SOLID('storageQuota'), quotaNode)
return await new Promise((resolve, reject) => {
$rdf.serialize(null, store, storageUrlNode.value, contentType, (err, result) => {
if (err) {
return reject(err)
}
resolve(result)
})
})
}
setIdentityContractAddress(webId, entryValue) {
if (!webId || !entryValue) {
console.error('Invalid arguments')
return
}
const g = rdf.graph()
g.add(
rdf.sym(webId),
PRED.identityContractAddress,
rdf.lit(entryValue)
)
return this.http.patch(webId, [], g.statements)
}
addEntryPatch(entryFileUrl, webId, entryId, entryType) {
const g = rdf.graph()
const entryNode =
`${util.getProfFolderUrl(webId)}/card#${entryType}${entryId}`
const typeToPred = {
phone: PRED.mobile,
email: PRED.email,
passport: PRED.passport,
idCard: PRED.idCard
}
g.add(rdf.sym(webId), typeToPred[entryType], rdf.sym(entryNode))
g.add(rdf.sym(entryNode), PRED.identifier, rdf.lit(entryId))
g.add(rdf.sym(entryNode), PRED.seeAlso, rdf.sym(entryFileUrl))
return g.statements
},