Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var initializeNewInstanceInWorkspace = function (ws: NamedNode) {
// @@ TODO Clean up type for newBase
var newBase: any = store.any(ws, ns.space('uriPrefix'))
if (!newBase) {
newBase = ws.uri.split('#')[0]
} else {
newBase = newBase.value
}
if (newBase.slice(-1) !== '/') {
log.error(appPathSegment + ': No / at end of uriPrefix ' + newBase) // @@ paramater?
newBase = newBase + '/'
}
var now = new Date()
newBase += appPathSegment + '/id' + now.getTime() + '/' // unique id
initializeNewInstanceAtBase(thisInstance, newBase)
}
var initializeNewInstanceInWorkspace = function (ws: NamedNode) {
// @@ TODO Clean up type for newBase
var newBase: any = store.any(ws, ns.space('uriPrefix'))
if (!newBase) {
newBase = ws.uri.split('#')[0]
} else {
newBase = newBase.value
}
if (newBase.slice(-1) !== '/') {
log.error(appPathSegment + ': No / at end of uriPrefix ' + newBase) // @@ paramater?
newBase = newBase + '/'
}
var now = new Date()
newBase += appPathSegment + '/id' + now.getTime() + '/' // unique id
initializeNewInstanceAtBase(thisInstance, newBase)
}
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)
updater.put(
newPadDoc,
store.statementsMatching(undefined, undefined, undefined, newPadDoc),
'text/turtle',
function (_uri2: string, ok: boolean, message: string) {
if (ok) {
agenda.shift()!()
} else {
complainIfBad(
ok,
'FAILED to save new notepad at: ' +
newPadDoc.uri +
' : ' +
message
// 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)
updater.put(
newPadDoc,
store.statementsMatching(undefined, undefined, undefined, newPadDoc),
'text/turtle',
function (_uri2: string, ok: boolean, message: string) {
if (ok) {
agenda.shift()!()
} else {
complainIfBad(
ok,
'FAILED to save new notepad at: ' +
newPadDoc.uri +
' : ' +
message
)
function addDeletionLinks (
container: HTMLElement,
kb: IndexedFormula,
profile: NamedNode
): void {
const podServerNodes = kb.each(
profile,
ns.space('storage'),
null,
profile.doc()
)
const podServers = podServerNodes.map(node => node.value)
podServers.forEach(async server => {
const deletionLink = await generateDeletionLink(server)
if (deletionLink) {
container.appendChild(deletionLink)
}
})
}
function addDeletionLinks (
container: HTMLElement,
kb: IndexedFormula,
profile: NamedNode
): void {
const podServerNodes = kb.each(
profile,
ns.space('storage'),
null,
profile.doc()
)
const podServers = podServerNodes.map(node => node.value)
podServers.forEach(async server => {
const deletionLink = await generateDeletionLink(server)
if (deletionLink) {
container.appendChild(deletionLink)
}
})
}