|
|
|
@ -1,6 +1,8 @@ |
|
|
|
|
import type { ConnectedContext, ConnectedPlugin } from "@ldo/connected"; |
|
|
|
|
import type { NextGraphUri } from "./types"; |
|
|
|
|
import type { NextGraphResource } from "./resources/NextGraphResource"; |
|
|
|
|
import { NextGraphResource } from "./resources/NextGraphResource"; |
|
|
|
|
import ng from "nextgraph"; |
|
|
|
|
import { isNextGraphUri } from "./util/isNextGraphUri"; |
|
|
|
|
|
|
|
|
|
export interface NextGraphConnectedContext { |
|
|
|
|
sessionId?: string; |
|
|
|
@ -23,16 +25,34 @@ export interface NextGraphConnectedPlugin |
|
|
|
|
export const nextgGraphConnectedPlugin: NextGraphConnectedPlugin = { |
|
|
|
|
name: "nextgraph", |
|
|
|
|
|
|
|
|
|
getResource: function (_uri: NextGraphUri): NextGraphResource { |
|
|
|
|
throw new Error("Function not implemented."); |
|
|
|
|
getResource: function ( |
|
|
|
|
uri: NextGraphUri, |
|
|
|
|
context: ConnectedContext<NextGraphConnectedPlugin[]>, |
|
|
|
|
): NextGraphResource { |
|
|
|
|
// NIKO: Do I need to split into "base?" Remind me again of why I need base?
|
|
|
|
|
return new NextGraphResource(uri, context); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
createResource: function (): Promise<NextGraphResource> { |
|
|
|
|
throw new Error("Function not implemented."); |
|
|
|
|
createResource: async function ( |
|
|
|
|
context: ConnectedContext<NextGraphConnectedPlugin[]>, |
|
|
|
|
): Promise<NextGraphResource> { |
|
|
|
|
const nuri: NextGraphUri = await ng.doc_create( |
|
|
|
|
context.nextgraph.sessionId, |
|
|
|
|
"Graph", |
|
|
|
|
// NIKO: Can this always be "data:graph"?
|
|
|
|
|
"data:graph", |
|
|
|
|
// NIKO: What are the options here again?
|
|
|
|
|
"protected", |
|
|
|
|
// NIKO: What is this? Should it be changed?
|
|
|
|
|
"B381BvfdAFYPBkdhDrsqnMMg5pnJMWJgJbZobZErXZMA", |
|
|
|
|
// NIKO: Can this always be "store"?
|
|
|
|
|
"store", |
|
|
|
|
); |
|
|
|
|
return new NextGraphResource(nuri, context); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
isUriValid: function (uri: string): uri is NextGraphUri { |
|
|
|
|
throw new Error("Function not implemented."); |
|
|
|
|
return isNextGraphUri(uri); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
initialContext: { |
|
|
|
|