Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.log(
'FAILED to craete results file at: ' +
padDoc.uri +
' : ' +
message
)
}
})
} else {
// Other error, not 404 -- do not try to overwite the file
complainIfBad(ok, 'FAILED to read results file: ' + body)
}
} else {
// Happy read
clearElement(naviMain)
if (store.holds(subject, ns.rdf('type'), ns.wf('TemplateInstance'))) {
showBootstrap(subject, naviMain, 'pad')
}
showResults(true)
naviMiddle3.appendChild(newInstanceButton())
}
})
}
console.log(
'FAILED to craete results file at: ' +
padDoc.uri +
' : ' +
message
)
}
})
} else {
// Other error, not 404 -- do not try to overwite the file
complainIfBad(ok, 'FAILED to read results file: ' + body)
}
} else {
// Happy read
clearElement(naviMain)
if (store.holds(subject, ns.rdf('type'), ns.wf('TemplateInstance'))) {
showBootstrap(subject, naviMain, 'pad')
}
showResults(true)
naviMiddle3.appendChild(newInstanceButton())
}
})
}
agenda.push(function createNewPadDataFile () {
store.add(newInstance, ns.rdf('type'), PAD('Notepad'), newPadDoc)
// TODO @@ Remove casting of add
;(store.add as any)(
newInstance,
ns.dc('created'),
new Date(),
newPadDoc
)
if (me) {
store.add(newInstance, ns.dc('author'), me, newPadDoc)
}
store.add(newInstance, PAD('next'), newInstance, newPadDoc) // linked list empty
// Keep a paper trail @@ Revisit when we have non-public ones @@ Privacy
store.add(newInstance, ns.space('inspiration'), thisInstance, padDoc)
store.add(newInstance, ns.space('inspiration'), thisInstance, newPadDoc)
agenda.push(function createNewPadDataFile () {
store.add(newInstance, ns.rdf('type'), PAD('Notepad'), newPadDoc)
// TODO @@ Remove casting of add
;(store.add as any)(
newInstance,
ns.dc('created'),
new Date(),
newPadDoc
)
if (me) {
store.add(newInstance, ns.dc('author'), me, newPadDoc)
}
store.add(newInstance, PAD('next'), newInstance, newPadDoc) // linked list empty
// Keep a paper trail @@ Revisit when we have non-public ones @@ Privacy
store.add(newInstance, ns.space('inspiration'), thisInstance, padDoc)
store.add(newInstance, ns.space('inspiration'), thisInstance, newPadDoc)
allWrite: boolean
) {
var g = graph()
var auth = Namespace('http://www.w3.org/ns/auth/acl#')
var a = g.sym(aclURI + '#a1')
var acl = g.sym(aclURI)
var doc = g.sym(docURI)
g.add(a, ns.rdf('type'), auth('Authorization'), acl)
g.add(a, auth('accessTo'), doc, acl)
g.add(a, auth('agent'), me, acl)
g.add(a, auth('mode'), auth('Read'), acl)
g.add(a, auth('mode'), auth('Write'), acl)
g.add(a, auth('mode'), auth('Control'), acl)
a = g.sym(aclURI + '#a2')
g.add(a, ns.rdf('type'), auth('Authorization'), acl)
g.add(a, auth('accessTo'), doc, acl)
g.add(a, auth('agentClass'), ns.foaf('Agent'), acl)
g.add(a, auth('mode'), auth('Read'), acl)
if (allWrite) {
g.add(a, auth('mode'), auth('Write'), acl)
}
// TODO: Figure out why `serialize` isn't on the type definition according to TypeScript:
return serialize(acl, g, aclURI, 'text/turtle')
}
mintNew: function (context, newPaneOptions: any) {
const store = context.session.store
const updater = store.updater as UpdateManager
if (newPaneOptions.me && !newPaneOptions.me.uri) {
throw new Error('notepad mintNew: Invalid userid')
}
var newInstance = (newPaneOptions.newInstance =
newPaneOptions.newInstance ||
store.sym(newPaneOptions.newBase + 'index.ttl#this'))
// var newInstance = kb.sym(newBase + 'pad.ttl#thisPad');
var newPadDoc = newInstance.doc()
store.add(newInstance, ns.rdf('type'), ns.pad('Notepad'), newPadDoc)
// @@ TODO Remove casting
;(store.add as any)(newInstance, ns.dc('title'), 'Shared Notes', newPadDoc)
;(store.add as any)(newInstance, ns.dc('created'), new Date(), newPadDoc)
if (newPaneOptions.me) {
store.add(newInstance, ns.dc('author'), newPaneOptions.me, newPadDoc)
}
// kb.add(newInstance, ns.pad('next'), newInstance, newPadDoc);
// linked list empty @@
var chunk = store.sym(newInstance.uri + '_line0')
store.add(newInstance, ns.pad('next'), chunk, newPadDoc) // Linked list has one entry
store.add(chunk, ns.pad('next'), newInstance, newPadDoc)
store.add(chunk, ns.dc('author'), newPaneOptions.me, newPadDoc)
// @@ TODO Remove casting
;(store.add as any)(chunk, ns.sioc('content'), '', newPadDoc)
return new Promise(function (resolve, reject) {