@ldo/connected-nextgraph 1.0.0-alpha.32 → 1.0.0-alpha.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/NextGraphConnectedPlugin.cjs +27 -0
- package/dist/NextGraphConnectedPlugin.d.cts +28 -0
- package/dist/NextGraphConnectedPlugin.d.cts.map +1 -0
- package/dist/NextGraphConnectedPlugin.d.ts +28 -0
- package/dist/NextGraphConnectedPlugin.d.ts.map +1 -0
- package/dist/NextGraphConnectedPlugin.js +28 -0
- package/dist/NextGraphConnectedPlugin.js.map +1 -0
- package/dist/_virtual/rolldown_runtime.cjs +30 -0
- package/dist/createNextGraphLdoDataset.cjs +14 -0
- package/dist/createNextGraphLdoDataset.d.cts +9 -0
- package/dist/createNextGraphLdoDataset.d.cts.map +1 -0
- package/dist/createNextGraphLdoDataset.d.ts +9 -0
- package/dist/createNextGraphLdoDataset.d.ts.map +1 -0
- package/dist/createNextGraphLdoDataset.js +14 -0
- package/dist/createNextGraphLdoDataset.js.map +1 -0
- package/dist/index.cjs +11 -0
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/notifications/NextGraphNotificationMessage.d.cts +20 -0
- package/dist/notifications/NextGraphNotificationMessage.d.cts.map +1 -0
- package/dist/notifications/NextGraphNotificationMessage.d.ts +20 -0
- package/dist/notifications/NextGraphNotificationMessage.d.ts.map +1 -0
- package/dist/notifications/NextGraphNotificationSubscription.cjs +17 -0
- package/dist/notifications/NextGraphNotificationSubscription.js +17 -0
- package/dist/notifications/NextGraphNotificationSubscription.js.map +1 -0
- package/dist/resources/NextGraphResource.cjs +156 -0
- package/dist/resources/NextGraphResource.d.cts +46 -0
- package/dist/resources/NextGraphResource.d.cts.map +1 -0
- package/dist/resources/NextGraphResource.d.ts +46 -0
- package/dist/resources/NextGraphResource.d.ts.map +1 -0
- package/dist/resources/NextGraphResource.js +156 -0
- package/dist/resources/NextGraphResource.js.map +1 -0
- package/dist/results/NextGraphReadSuccess.cjs +10 -0
- package/dist/results/NextGraphReadSuccess.d.cts +12 -0
- package/dist/results/NextGraphReadSuccess.d.cts.map +1 -0
- package/dist/results/NextGraphReadSuccess.d.ts +12 -0
- package/dist/results/NextGraphReadSuccess.d.ts.map +1 -0
- package/dist/results/NextGraphReadSuccess.js +10 -0
- package/dist/results/NextGraphReadSuccess.js.map +1 -0
- package/dist/types.d.cts +10 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/util/isNextGraphUri.cjs +13 -0
- package/dist/util/isNextGraphUri.d.cts +14 -0
- package/dist/util/isNextGraphUri.d.cts.map +1 -0
- package/dist/util/isNextGraphUri.d.ts +14 -0
- package/dist/util/isNextGraphUri.d.ts.map +1 -0
- package/dist/util/isNextGraphUri.js +13 -0
- package/dist/util/isNextGraphUri.js.map +1 -0
- package/package.json +22 -18
- package/src/NextGraphConnectedPlugin.ts +3 -3
- package/src/createNextGraphLdoDataset.ts +1 -1
- package/src/index.ts +6 -6
- package/src/notifications/NextGraphNotificationSubscription.ts +2 -2
- package/src/resources/NextGraphResource.ts +5 -5
- package/src/results/NextGraphReadSuccess.ts +1 -1
- package/src/util/isNextGraphUri.ts +1 -1
- package/dist/cjs/NextGraphConnectedPlugin.cjs +0 -37
- package/dist/cjs/NextGraphConnectedPlugin.js.map +0 -1
- package/dist/cjs/createNextGraphLdoDataset.cjs +0 -13
- package/dist/cjs/createNextGraphLdoDataset.js.map +0 -1
- package/dist/cjs/index.cjs +0 -23
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/notifications/NextGraphNotificationMessage.cjs +0 -3
- package/dist/cjs/notifications/NextGraphNotificationMessage.js.map +0 -1
- package/dist/cjs/notifications/NextGraphNotificationSubscription.cjs +0 -15
- package/dist/cjs/notifications/NextGraphNotificationSubscription.js.map +0 -1
- package/dist/cjs/resources/NextGraphResource.cjs +0 -163
- package/dist/cjs/resources/NextGraphResource.js.map +0 -1
- package/dist/cjs/results/NextGraphReadSuccess.cjs +0 -12
- package/dist/cjs/results/NextGraphReadSuccess.js.map +0 -1
- package/dist/cjs/types.cjs +0 -3
- package/dist/cjs/types.js.map +0 -1
- package/dist/cjs/util/NextGraphNotificationMessage.cjs +0 -3
- package/dist/cjs/util/NextGraphNotificationMessage.js.map +0 -1
- package/dist/cjs/util/isNextGraphUri.cjs +0 -13
- package/dist/cjs/util/isNextGraphUri.js.map +0 -1
- package/dist/esm/NextGraphConnectedPlugin.js +0 -34
- package/dist/esm/NextGraphConnectedPlugin.js.map +0 -1
- package/dist/esm/createNextGraphLdoDataset.js +0 -9
- package/dist/esm/createNextGraphLdoDataset.js.map +0 -1
- package/dist/esm/index.js +0 -7
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/notifications/NextGraphNotificationMessage.js +0 -2
- package/dist/esm/notifications/NextGraphNotificationMessage.js.map +0 -1
- package/dist/esm/notifications/NextGraphNotificationSubscription.js +0 -11
- package/dist/esm/notifications/NextGraphNotificationSubscription.js.map +0 -1
- package/dist/esm/resources/NextGraphResource.js +0 -156
- package/dist/esm/resources/NextGraphResource.js.map +0 -1
- package/dist/esm/results/NextGraphReadSuccess.js +0 -8
- package/dist/esm/results/NextGraphReadSuccess.js.map +0 -1
- package/dist/esm/types.js +0 -2
- package/dist/esm/types.js.map +0 -1
- package/dist/esm/util/NextGraphNotificationMessage.js +0 -2
- package/dist/esm/util/NextGraphNotificationMessage.js.map +0 -1
- package/dist/esm/util/isNextGraphUri.js +0 -9
- package/dist/esm/util/isNextGraphUri.js.map +0 -1
- package/dist/types/NextGraphConnectedPlugin.d.ts +0 -22
- package/dist/types/NextGraphConnectedPlugin.d.ts.map +0 -1
- package/dist/types/createNextGraphLdoDataset.d.ts +0 -3
- package/dist/types/createNextGraphLdoDataset.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -7
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/notifications/NextGraphNotificationMessage.d.ts +0 -16
- package/dist/types/notifications/NextGraphNotificationMessage.d.ts.map +0 -1
- package/dist/types/notifications/NextGraphNotificationSubscription.d.ts +0 -9
- package/dist/types/notifications/NextGraphNotificationSubscription.d.ts.map +0 -1
- package/dist/types/resources/NextGraphResource.d.ts +0 -48
- package/dist/types/resources/NextGraphResource.d.ts.map +0 -1
- package/dist/types/results/NextGraphReadSuccess.d.ts +0 -6
- package/dist/types/results/NextGraphReadSuccess.d.ts.map +0 -1
- package/dist/types/types.d.ts +0 -6
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/util/NextGraphNotificationMessage.d.ts +0 -16
- package/dist/types/util/NextGraphNotificationMessage.d.ts.map +0 -1
- package/dist/types/util/isNextGraphUri.d.ts +0 -8
- package/dist/types/util/isNextGraphUri.d.ts.map +0 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const require__Users_jacksonmorgan_O_ldo_packages_connected_nextgraph_src_resources_NextGraphResource = require('./resources/NextGraphResource.cjs');
|
|
2
|
+
const require__Users_jacksonmorgan_O_ldo_packages_connected_nextgraph_src_util_isNextGraphUri = require('./util/isNextGraphUri.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/NextGraphConnectedPlugin.ts
|
|
5
|
+
const nextGraphConnectedPlugin = {
|
|
6
|
+
name: "nextgraph",
|
|
7
|
+
getResource: function(uri, context) {
|
|
8
|
+
return new require__Users_jacksonmorgan_O_ldo_packages_connected_nextgraph_src_resources_NextGraphResource.NextGraphResource(uri, context);
|
|
9
|
+
},
|
|
10
|
+
createResource: async function(context, options) {
|
|
11
|
+
const storeType = options?.storeType;
|
|
12
|
+
const storeRepo = options?.storeRepo ?? (storeType === "protected" ? context.nextgraph.protectedStoreId : storeType === "public" ? context.nextgraph.publicStoreId : storeType === "private" ? context.nextgraph.privateStoreId : void 0);
|
|
13
|
+
const primaryClass = options?.primaryClass ?? "data:graph";
|
|
14
|
+
const nuri = await context.nextgraph.ng.doc_create(context.nextgraph.sessionId, "Graph", primaryClass, "store", storeType, storeRepo);
|
|
15
|
+
const newResource = new require__Users_jacksonmorgan_O_ldo_packages_connected_nextgraph_src_resources_NextGraphResource.NextGraphResource(nuri, context);
|
|
16
|
+
await newResource.read();
|
|
17
|
+
return newResource;
|
|
18
|
+
},
|
|
19
|
+
isUriValid: function(uri) {
|
|
20
|
+
return require__Users_jacksonmorgan_O_ldo_packages_connected_nextgraph_src_util_isNextGraphUri.isNextGraphUri(uri);
|
|
21
|
+
},
|
|
22
|
+
initialContext: { sessionId: void 0 },
|
|
23
|
+
types: {}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
exports.nextGraphConnectedPlugin = nextGraphConnectedPlugin;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { NextGraphUri } from "./types.cjs";
|
|
2
|
+
import { NextGraphResource } from "./resources/NextGraphResource.cjs";
|
|
3
|
+
import { ConnectedContext, ConnectedPlugin } from "@ldo/connected";
|
|
4
|
+
|
|
5
|
+
//#region src/NextGraphConnectedPlugin.d.ts
|
|
6
|
+
interface NextGraphConnectedContext {
|
|
7
|
+
ng?: any;
|
|
8
|
+
sessionId?: string;
|
|
9
|
+
protectedStoreId?: string;
|
|
10
|
+
privateStoreId?: string;
|
|
11
|
+
publicStoreId?: string;
|
|
12
|
+
}
|
|
13
|
+
interface NextGraphCreateResourceOptions {
|
|
14
|
+
storeType?: "public" | "protected" | "private" | "group" | "dialog";
|
|
15
|
+
storeRepo?: string;
|
|
16
|
+
primaryClass?: string;
|
|
17
|
+
}
|
|
18
|
+
interface NextGraphConnectedPlugin extends ConnectedPlugin<"nextgraph", NextGraphUri, NextGraphResource, NextGraphConnectedContext, NextGraphCreateResourceOptions> {
|
|
19
|
+
name: "nextgraph";
|
|
20
|
+
getResource: (uri: NextGraphUri, context: ConnectedContext<this[]>) => NextGraphResource;
|
|
21
|
+
createResource(context: ConnectedContext<this[]>): Promise<NextGraphResource>;
|
|
22
|
+
}
|
|
23
|
+
declare const nextGraphConnectedPlugin: NextGraphConnectedPlugin;
|
|
24
|
+
//# sourceMappingURL=NextGraphConnectedPlugin.d.ts.map
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { NextGraphConnectedContext, NextGraphConnectedPlugin, NextGraphCreateResourceOptions, nextGraphConnectedPlugin };
|
|
28
|
+
//# sourceMappingURL=NextGraphConnectedPlugin.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NextGraphConnectedPlugin.d.cts","names":[],"sources":["../../src/NextGraphConnectedPlugin.ts"],"sourcesContent":[],"mappings":";;;;;UAKiB,yBAAA;;EAAA,SAAA,CAAA,EAAA,MAAA;EAUA,gBAAA,CAAA,EAAA,MAAA;EAMA,cAAA,CAAA,EAAA,MAAA;EACf,aAAA,CAAA,EAAA,MAAA;;AAGE,UAVa,8BAAA,CAUb;EAAiB,SACjB,CAAA,EAAA,QAAA,GAAA,WAAA,GAAA,SAAA,GAAA,OAAA,GAAA,QAAA;EAAyB,SACzB,CAAA,EAAA,MAAA;EAA8B,YAIzB,CAAA,EAAA,MAAA;;AAEF,UAZU,wBAAA,SACP,eAWH,CAAA,WAAA,EATH,YASG,EARH,iBAQG,EAPH,yBAOG,EANH,8BAMG,CAAA,CAAA;EAAiB,IACE,EAAA,WAAA;EAAgB,WAAmB,EAAA,CAAA,GAAA,EAHpD,YAGoD,EAAA,OAAA,EAFhD,gBAEgD,CAAA,IAAA,EAAA,CAAA,EAAA,GADtD,iBACsD;EAAiB,cAAzB,CAAA,OAAA,EAA3B,gBAA2B,CAAA,IAAA,EAAA,CAAA,CAAA,EAAA,OAAA,CAAQ,iBAAR,CAAA;;AAZ5B,cAeZ,wBAfY,EAec,wBAfd;AAezB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { NextGraphUri } from "./types.js";
|
|
2
|
+
import { NextGraphResource$1 as NextGraphResource } from "./resources/NextGraphResource.js";
|
|
3
|
+
import { ConnectedContext, ConnectedPlugin } from "@ldo/connected";
|
|
4
|
+
|
|
5
|
+
//#region src/NextGraphConnectedPlugin.d.ts
|
|
6
|
+
interface NextGraphConnectedContext {
|
|
7
|
+
ng?: any;
|
|
8
|
+
sessionId?: string;
|
|
9
|
+
protectedStoreId?: string;
|
|
10
|
+
privateStoreId?: string;
|
|
11
|
+
publicStoreId?: string;
|
|
12
|
+
}
|
|
13
|
+
interface NextGraphCreateResourceOptions {
|
|
14
|
+
storeType?: "public" | "protected" | "private" | "group" | "dialog";
|
|
15
|
+
storeRepo?: string;
|
|
16
|
+
primaryClass?: string;
|
|
17
|
+
}
|
|
18
|
+
interface NextGraphConnectedPlugin extends ConnectedPlugin<"nextgraph", NextGraphUri, NextGraphResource, NextGraphConnectedContext, NextGraphCreateResourceOptions> {
|
|
19
|
+
name: "nextgraph";
|
|
20
|
+
getResource: (uri: NextGraphUri, context: ConnectedContext<this[]>) => NextGraphResource;
|
|
21
|
+
createResource(context: ConnectedContext<this[]>): Promise<NextGraphResource>;
|
|
22
|
+
}
|
|
23
|
+
declare const nextGraphConnectedPlugin: NextGraphConnectedPlugin;
|
|
24
|
+
//# sourceMappingURL=NextGraphConnectedPlugin.d.ts.map
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { NextGraphConnectedContext, NextGraphConnectedPlugin, NextGraphCreateResourceOptions, nextGraphConnectedPlugin as nextGraphConnectedPlugin$1 };
|
|
28
|
+
//# sourceMappingURL=NextGraphConnectedPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NextGraphConnectedPlugin.d.ts","names":[],"sources":["../../src/NextGraphConnectedPlugin.ts"],"sourcesContent":[],"mappings":";;;;;UAKiB,yBAAA;;EAAA,SAAA,CAAA,EAAA,MAAA;EAUA,gBAAA,CAAA,EAAA,MAAA;EAMA,cAAA,CAAA,EAAA,MAAA;EACf,aAAA,CAAA,EAAA,MAAA;;AAGE,UAVa,8BAAA,CAUb;EAAiB,SACjB,CAAA,EAAA,QAAA,GAAA,WAAA,GAAA,SAAA,GAAA,OAAA,GAAA,QAAA;EAAyB,SACzB,CAAA,EAAA,MAAA;EAA8B,YAIzB,CAAA,EAAA,MAAA;;AAEF,UAZU,wBAAA,SACP,eAWH,CAAA,WAAA,EATH,YASG,EARH,iBAQG,EAPH,yBAOG,EANH,8BAMG,CAAA,CAAA;EAAiB,IACE,EAAA,WAAA;EAAgB,WAAmB,EAAA,CAAA,GAAA,EAHpD,YAGoD,EAAA,OAAA,EAFhD,gBAEgD,CAAA,IAAA,EAAA,CAAA,EAAA,GADtD,iBACsD;EAAiB,cAAzB,CAAA,OAAA,EAA3B,gBAA2B,CAAA,IAAA,EAAA,CAAA,CAAA,EAAA,OAAA,CAAQ,iBAAR,CAAA;;AAZ5B,cAeZ,wBAfY,EAec,wBAfd;AAezB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { NextGraphResource } from "./resources/NextGraphResource.js";
|
|
2
|
+
import { isNextGraphUri } from "./util/isNextGraphUri.js";
|
|
3
|
+
|
|
4
|
+
//#region src/NextGraphConnectedPlugin.ts
|
|
5
|
+
const nextGraphConnectedPlugin = {
|
|
6
|
+
name: "nextgraph",
|
|
7
|
+
getResource: function(uri, context) {
|
|
8
|
+
return new NextGraphResource(uri, context);
|
|
9
|
+
},
|
|
10
|
+
createResource: async function(context, options) {
|
|
11
|
+
const storeType = options?.storeType;
|
|
12
|
+
const storeRepo = options?.storeRepo ?? (storeType === "protected" ? context.nextgraph.protectedStoreId : storeType === "public" ? context.nextgraph.publicStoreId : storeType === "private" ? context.nextgraph.privateStoreId : void 0);
|
|
13
|
+
const primaryClass = options?.primaryClass ?? "data:graph";
|
|
14
|
+
const nuri = await context.nextgraph.ng.doc_create(context.nextgraph.sessionId, "Graph", primaryClass, "store", storeType, storeRepo);
|
|
15
|
+
const newResource = new NextGraphResource(nuri, context);
|
|
16
|
+
await newResource.read();
|
|
17
|
+
return newResource;
|
|
18
|
+
},
|
|
19
|
+
isUriValid: function(uri) {
|
|
20
|
+
return isNextGraphUri(uri);
|
|
21
|
+
},
|
|
22
|
+
initialContext: { sessionId: void 0 },
|
|
23
|
+
types: {}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { nextGraphConnectedPlugin };
|
|
28
|
+
//# sourceMappingURL=NextGraphConnectedPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NextGraphConnectedPlugin.js","names":["nextGraphConnectedPlugin: NextGraphConnectedPlugin","uri: NextGraphUri","context: ConnectedContext<NextGraphConnectedPlugin[]>","options?: NextGraphCreateResourceOptions","nuri: NextGraphUri","uri: string"],"sources":["../src/NextGraphConnectedPlugin.ts"],"sourcesContent":["import type { ConnectedContext, ConnectedPlugin } from \"@ldo/connected\";\nimport type { NextGraphUri } from \"./types\";\nimport { NextGraphResource } from \"./resources/NextGraphResource\";\nimport { isNextGraphUri } from \"./util/isNextGraphUri\";\n\nexport interface NextGraphConnectedContext {\n // NG does not have a type definition\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ng?: any;\n sessionId?: string;\n protectedStoreId?: string;\n privateStoreId?: string;\n publicStoreId?: string;\n}\n\nexport interface NextGraphCreateResourceOptions {\n storeType?: \"public\" | \"protected\" | \"private\" | \"group\" | \"dialog\";\n storeRepo?: string;\n primaryClass?: string;\n}\n\nexport interface NextGraphConnectedPlugin\n extends ConnectedPlugin<\n \"nextgraph\",\n NextGraphUri,\n NextGraphResource,\n NextGraphConnectedContext,\n NextGraphCreateResourceOptions\n > {\n name: \"nextgraph\";\n getResource: (\n uri: NextGraphUri,\n context: ConnectedContext<this[]>,\n ) => NextGraphResource;\n createResource(context: ConnectedContext<this[]>): Promise<NextGraphResource>;\n}\n\nexport const nextGraphConnectedPlugin: NextGraphConnectedPlugin = {\n name: \"nextgraph\",\n\n getResource: function (\n uri: NextGraphUri,\n context: ConnectedContext<NextGraphConnectedPlugin[]>,\n ): NextGraphResource {\n return new NextGraphResource(uri, context);\n },\n\n createResource: async function (\n context: ConnectedContext<NextGraphConnectedPlugin[]>,\n options?: NextGraphCreateResourceOptions,\n ): Promise<NextGraphResource> {\n const storeType = options?.storeType;\n const storeRepo =\n options?.storeRepo ??\n (storeType === \"protected\"\n ? context.nextgraph.protectedStoreId\n : storeType === \"public\"\n ? context.nextgraph.publicStoreId\n : storeType === \"private\"\n ? context.nextgraph.privateStoreId\n : undefined);\n const primaryClass = options?.primaryClass ?? \"data:graph\";\n\n const nuri: NextGraphUri = await context.nextgraph.ng.doc_create(\n context.nextgraph.sessionId,\n \"Graph\",\n primaryClass,\n \"store\",\n storeType,\n storeRepo,\n );\n const newResource = new NextGraphResource(nuri, context);\n await newResource.read();\n return newResource;\n },\n\n isUriValid: function (uri: string): uri is NextGraphUri {\n return isNextGraphUri(uri);\n },\n\n initialContext: {\n sessionId: undefined,\n },\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore \"Types\" only exists for the typing system\n types: {},\n};\n"],"mappings":";;;;AAqCA,MAAaA,2BAAqD;CAChE,MAAM;CAEN,aAAa,SACXC,KACAC,SACmB;AACnB,SAAO,IAAI,kBAAkB,KAAK;CACnC;CAED,gBAAgB,eACdA,SACAC,SAC4B;EAC5B,MAAM,YAAY,SAAS;EAC3B,MAAM,YACJ,SAAS,cACR,cAAc,cACX,QAAQ,UAAU,mBAClB,cAAc,WACd,QAAQ,UAAU,gBAClB,cAAc,YACd,QAAQ,UAAU;EAExB,MAAM,eAAe,SAAS,gBAAgB;EAE9C,MAAMC,OAAqB,MAAM,QAAQ,UAAU,GAAG,WACpD,QAAQ,UAAU,WAClB,SACA,cACA,SACA,WACA,UACD;EACD,MAAM,cAAc,IAAI,kBAAkB,MAAM;AAChD,QAAM,YAAY,MAAM;AACxB,SAAO;CACR;CAED,YAAY,SAAUC,KAAkC;AACtD,SAAO,eAAe,IAAI;CAC3B;CAED,gBAAgB,EACd,kBACD;CAGD,OAAO,CAAE;AACV"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
|
|
25
|
+
Object.defineProperty(exports, '__toESM', {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return __toESM;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require__Users_jacksonmorgan_O_ldo_packages_connected_nextgraph_src_NextGraphConnectedPlugin = require('./NextGraphConnectedPlugin.cjs');
|
|
3
|
+
const __ldo_connected = require_rolldown_runtime.__toESM(require("@ldo/connected"));
|
|
4
|
+
const __ldo_dataset = require_rolldown_runtime.__toESM(require("@ldo/dataset"));
|
|
5
|
+
const __ldo_subscribable_dataset = require_rolldown_runtime.__toESM(require("@ldo/subscribable-dataset"));
|
|
6
|
+
|
|
7
|
+
//#region src/createNextGraphLdoDataset.ts
|
|
8
|
+
function createNextGraphLdoDataset() {
|
|
9
|
+
const nextGraphLdoDataset = new __ldo_connected.ConnectedLdoDataset([require__Users_jacksonmorgan_O_ldo_packages_connected_nextgraph_src_NextGraphConnectedPlugin.nextGraphConnectedPlugin], (0, __ldo_dataset.createDatasetFactory)(), (0, __ldo_subscribable_dataset.createTransactionDatasetFactory)());
|
|
10
|
+
return nextGraphLdoDataset;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.createNextGraphLdoDataset = createNextGraphLdoDataset;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ConnectedLdoDataset } from "@ldo/connected";
|
|
2
|
+
|
|
3
|
+
//#region src/createNextGraphLdoDataset.d.ts
|
|
4
|
+
declare function createNextGraphLdoDataset(): ConnectedLdoDataset<any[]>;
|
|
5
|
+
//# sourceMappingURL=createNextGraphLdoDataset.d.ts.map
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { createNextGraphLdoDataset };
|
|
9
|
+
//# sourceMappingURL=createNextGraphLdoDataset.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createNextGraphLdoDataset.d.cts","names":[],"sources":["../../src/createNextGraphLdoDataset.ts"],"sourcesContent":[],"mappings":";;;iBAKgB,yBAAA,CAAA,GAAyB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ConnectedLdoDataset } from "@ldo/connected";
|
|
2
|
+
|
|
3
|
+
//#region src/createNextGraphLdoDataset.d.ts
|
|
4
|
+
declare function createNextGraphLdoDataset(): ConnectedLdoDataset<any[]>;
|
|
5
|
+
//# sourceMappingURL=createNextGraphLdoDataset.d.ts.map
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { createNextGraphLdoDataset as createNextGraphLdoDataset$1 };
|
|
9
|
+
//# sourceMappingURL=createNextGraphLdoDataset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createNextGraphLdoDataset.d.ts","names":[],"sources":["../../src/createNextGraphLdoDataset.ts"],"sourcesContent":[],"mappings":";;;iBAKgB,yBAAA,CAAA,GAAyB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { nextGraphConnectedPlugin } from "./NextGraphConnectedPlugin.js";
|
|
2
|
+
import { ConnectedLdoDataset } from "@ldo/connected";
|
|
3
|
+
import { createDatasetFactory } from "@ldo/dataset";
|
|
4
|
+
import { createTransactionDatasetFactory } from "@ldo/subscribable-dataset";
|
|
5
|
+
|
|
6
|
+
//#region src/createNextGraphLdoDataset.ts
|
|
7
|
+
function createNextGraphLdoDataset() {
|
|
8
|
+
const nextGraphLdoDataset = new ConnectedLdoDataset([nextGraphConnectedPlugin], createDatasetFactory(), createTransactionDatasetFactory());
|
|
9
|
+
return nextGraphLdoDataset;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { createNextGraphLdoDataset };
|
|
14
|
+
//# sourceMappingURL=createNextGraphLdoDataset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createNextGraphLdoDataset.js","names":[],"sources":["../src/createNextGraphLdoDataset.ts"],"sourcesContent":["import { ConnectedLdoDataset } from \"@ldo/connected\";\nimport { nextGraphConnectedPlugin } from \"./NextGraphConnectedPlugin\";\nimport { createDatasetFactory } from \"@ldo/dataset\";\nimport { createTransactionDatasetFactory } from \"@ldo/subscribable-dataset\";\n\nexport function createNextGraphLdoDataset() {\n const nextGraphLdoDataset = new ConnectedLdoDataset(\n [nextGraphConnectedPlugin],\n createDatasetFactory(),\n createTransactionDatasetFactory(),\n );\n return nextGraphLdoDataset;\n}\n"],"mappings":";;;;;;AAKA,SAAgB,4BAA4B;CAC1C,MAAM,sBAAsB,IAAI,oBAC9B,CAAC,wBAAyB,GAC1B,sBAAsB,EACtB,iCAAiC;AAEnC,QAAO;AACR"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const require__Users_jacksonmorgan_O_ldo_packages_connected_nextgraph_src_results_NextGraphReadSuccess = require('./results/NextGraphReadSuccess.cjs');
|
|
2
|
+
const require__Users_jacksonmorgan_O_ldo_packages_connected_nextgraph_src_resources_NextGraphResource = require('./resources/NextGraphResource.cjs');
|
|
3
|
+
const require__Users_jacksonmorgan_O_ldo_packages_connected_nextgraph_src_util_isNextGraphUri = require('./util/isNextGraphUri.cjs');
|
|
4
|
+
const require__Users_jacksonmorgan_O_ldo_packages_connected_nextgraph_src_NextGraphConnectedPlugin = require('./NextGraphConnectedPlugin.cjs');
|
|
5
|
+
const require__Users_jacksonmorgan_O_ldo_packages_connected_nextgraph_src_createNextGraphLdoDataset = require('./createNextGraphLdoDataset.cjs');
|
|
6
|
+
|
|
7
|
+
exports.NextGraphReadSuccess = require__Users_jacksonmorgan_O_ldo_packages_connected_nextgraph_src_results_NextGraphReadSuccess.NextGraphReadSuccess;
|
|
8
|
+
exports.NextGraphResource = require__Users_jacksonmorgan_O_ldo_packages_connected_nextgraph_src_resources_NextGraphResource.NextGraphResource;
|
|
9
|
+
exports.createNextGraphLdoDataset = require__Users_jacksonmorgan_O_ldo_packages_connected_nextgraph_src_createNextGraphLdoDataset.createNextGraphLdoDataset;
|
|
10
|
+
exports.isNextGraphUri = require__Users_jacksonmorgan_O_ldo_packages_connected_nextgraph_src_util_isNextGraphUri.isNextGraphUri;
|
|
11
|
+
exports.nextGraphConnectedPlugin = require__Users_jacksonmorgan_O_ldo_packages_connected_nextgraph_src_NextGraphConnectedPlugin.nextGraphConnectedPlugin;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { NextGraphUri, NextGraphUriPrefix } from "./types.cjs";
|
|
2
|
+
import { NextGraphReadSuccess } from "./results/NextGraphReadSuccess.cjs";
|
|
3
|
+
import { NextGraphResource } from "./resources/NextGraphResource.cjs";
|
|
4
|
+
import { NextGraphConnectedContext, NextGraphConnectedPlugin, NextGraphCreateResourceOptions, nextGraphConnectedPlugin } from "./NextGraphConnectedPlugin.cjs";
|
|
5
|
+
import { isNextGraphUri } from "./util/isNextGraphUri.cjs";
|
|
6
|
+
import { createNextGraphLdoDataset } from "./createNextGraphLdoDataset.cjs";
|
|
7
|
+
export { NextGraphConnectedContext, NextGraphConnectedPlugin, NextGraphCreateResourceOptions, NextGraphReadSuccess, NextGraphResource, NextGraphUri, NextGraphUriPrefix, createNextGraphLdoDataset, isNextGraphUri, nextGraphConnectedPlugin };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { NextGraphUri, NextGraphUriPrefix } from "./types.js";
|
|
2
|
+
import { NextGraphReadSuccess$1 as NextGraphReadSuccess } from "./results/NextGraphReadSuccess.js";
|
|
3
|
+
import { NextGraphResource$1 as NextGraphResource } from "./resources/NextGraphResource.js";
|
|
4
|
+
import { NextGraphConnectedContext, NextGraphConnectedPlugin, NextGraphCreateResourceOptions, nextGraphConnectedPlugin$1 as nextGraphConnectedPlugin } from "./NextGraphConnectedPlugin.js";
|
|
5
|
+
import { isNextGraphUri$1 as isNextGraphUri } from "./util/isNextGraphUri.js";
|
|
6
|
+
import { createNextGraphLdoDataset$1 as createNextGraphLdoDataset } from "./createNextGraphLdoDataset.js";
|
|
7
|
+
export { NextGraphConnectedContext, NextGraphConnectedPlugin, NextGraphCreateResourceOptions, NextGraphReadSuccess, NextGraphResource, NextGraphUri, NextGraphUriPrefix, createNextGraphLdoDataset, isNextGraphUri, nextGraphConnectedPlugin };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { NextGraphReadSuccess } from "./results/NextGraphReadSuccess.js";
|
|
2
|
+
import { NextGraphResource } from "./resources/NextGraphResource.js";
|
|
3
|
+
import { isNextGraphUri } from "./util/isNextGraphUri.js";
|
|
4
|
+
import { nextGraphConnectedPlugin } from "./NextGraphConnectedPlugin.js";
|
|
5
|
+
import { createNextGraphLdoDataset } from "./createNextGraphLdoDataset.js";
|
|
6
|
+
|
|
7
|
+
export { NextGraphReadSuccess, NextGraphResource, createNextGraphLdoDataset, isNextGraphUri, nextGraphConnectedPlugin };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/notifications/NextGraphNotificationMessage.d.ts
|
|
2
|
+
interface NextGraphNotificationMessage {
|
|
3
|
+
V0: {
|
|
4
|
+
State?: {
|
|
5
|
+
graph: {
|
|
6
|
+
triples: AllowSharedBufferSource;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
Patch?: {
|
|
10
|
+
graph: {
|
|
11
|
+
inserts: AllowSharedBufferSource;
|
|
12
|
+
removes: AllowSharedBufferSource;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=NextGraphNotificationMessage.d.ts.map
|
|
18
|
+
//#endregion
|
|
19
|
+
export { NextGraphNotificationMessage };
|
|
20
|
+
//# sourceMappingURL=NextGraphNotificationMessage.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NextGraphNotificationMessage.d.cts","names":[],"sources":["../../../src/notifications/NextGraphNotificationMessage.ts"],"sourcesContent":[],"mappings":";UAAiB,4BAAA;EAAA,EAAA,EAAA;IAA4B,KAAA,CAAA,EAAA;MAI5B,KAAA,EAAA;QAKA,OAAA,EALA,uBAKA;MACA,CAAA;IAAuB,CAAA;;;iBADvB;iBACA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/notifications/NextGraphNotificationMessage.d.ts
|
|
2
|
+
interface NextGraphNotificationMessage {
|
|
3
|
+
V0: {
|
|
4
|
+
State?: {
|
|
5
|
+
graph: {
|
|
6
|
+
triples: AllowSharedBufferSource;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
Patch?: {
|
|
10
|
+
graph: {
|
|
11
|
+
inserts: AllowSharedBufferSource;
|
|
12
|
+
removes: AllowSharedBufferSource;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=NextGraphNotificationMessage.d.ts.map
|
|
18
|
+
//#endregion
|
|
19
|
+
export { NextGraphNotificationMessage };
|
|
20
|
+
//# sourceMappingURL=NextGraphNotificationMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NextGraphNotificationMessage.d.ts","names":[],"sources":["../../../src/notifications/NextGraphNotificationMessage.ts"],"sourcesContent":[],"mappings":";UAAiB,4BAAA;EAAA,EAAA,EAAA;IAA4B,KAAA,CAAA,EAAA;MAI5B,KAAA,EAAA;QAKA,OAAA,EALA,uBAKA;MACA,CAAA;IAAuB,CAAA;;;iBADvB;iBACA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const __ldo_connected = require_rolldown_runtime.__toESM(require("@ldo/connected"));
|
|
3
|
+
|
|
4
|
+
//#region src/notifications/NextGraphNotificationSubscription.ts
|
|
5
|
+
var NextGraphNotificationSubscription = class extends __ldo_connected.NotificationSubscription {
|
|
6
|
+
unsub;
|
|
7
|
+
async open() {
|
|
8
|
+
this.unsub = await this.context.nextgraph.ng.doc_subscribe(this.resource.uri, this.context.nextgraph.sessionId, this.onNotification.bind(this));
|
|
9
|
+
}
|
|
10
|
+
async close() {
|
|
11
|
+
this.unsub?.();
|
|
12
|
+
this.unsub = void 0;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.NextGraphNotificationSubscription = NextGraphNotificationSubscription;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NotificationSubscription } from "@ldo/connected";
|
|
2
|
+
|
|
3
|
+
//#region src/notifications/NextGraphNotificationSubscription.ts
|
|
4
|
+
var NextGraphNotificationSubscription = class extends NotificationSubscription {
|
|
5
|
+
unsub;
|
|
6
|
+
async open() {
|
|
7
|
+
this.unsub = await this.context.nextgraph.ng.doc_subscribe(this.resource.uri, this.context.nextgraph.sessionId, this.onNotification.bind(this));
|
|
8
|
+
}
|
|
9
|
+
async close() {
|
|
10
|
+
this.unsub?.();
|
|
11
|
+
this.unsub = void 0;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { NextGraphNotificationSubscription };
|
|
17
|
+
//# sourceMappingURL=NextGraphNotificationSubscription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NextGraphNotificationSubscription.js","names":[],"sources":["../../src/notifications/NextGraphNotificationSubscription.ts"],"sourcesContent":["import { NotificationSubscription } from \"@ldo/connected\";\nimport type { NextGraphConnectedPlugin } from \"../NextGraphConnectedPlugin\";\nimport type { NextGraphNotificationMessage } from \"./NextGraphNotificationMessage\";\n\nexport class NextGraphNotificationSubscription extends NotificationSubscription<\n NextGraphConnectedPlugin,\n NextGraphNotificationMessage\n> {\n private unsub: (() => void) | undefined;\n\n protected async open(): Promise<void> {\n this.unsub = await this.context.nextgraph.ng.doc_subscribe(\n this.resource.uri,\n this.context.nextgraph.sessionId,\n this.onNotification.bind(this),\n );\n }\n\n protected async close(): Promise<void> {\n this.unsub?.();\n this.unsub = undefined;\n }\n}\n"],"mappings":";;;AAIA,IAAa,oCAAb,cAAuD,yBAGrD;CACA,AAAQ;CAER,MAAgB,OAAsB;AACpC,OAAK,QAAQ,MAAM,KAAK,QAAQ,UAAU,GAAG,cAC3C,KAAK,SAAS,KACd,KAAK,QAAQ,UAAU,WACvB,KAAK,eAAe,KAAK,KAAK,CAC/B;CACF;CAED,MAAgB,QAAuB;AACrC,OAAK,SAAS;AACd,OAAK;CACN;AACF"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require__Users_jacksonmorgan_O_ldo_packages_connected_nextgraph_src_results_NextGraphReadSuccess = require('../results/NextGraphReadSuccess.cjs');
|
|
3
|
+
const require__Users_jacksonmorgan_O_ldo_packages_connected_nextgraph_src_notifications_NextGraphNotificationSubscription = require('../notifications/NextGraphNotificationSubscription.cjs');
|
|
4
|
+
const __ldo_connected = require_rolldown_runtime.__toESM(require("@ldo/connected"));
|
|
5
|
+
const events = require_rolldown_runtime.__toESM(require("events"));
|
|
6
|
+
const __ldo_rdf_utils = require_rolldown_runtime.__toESM(require("@ldo/rdf-utils"));
|
|
7
|
+
const __ldo_ldo = require_rolldown_runtime.__toESM(require("@ldo/ldo"));
|
|
8
|
+
const __ldo_dataset = require_rolldown_runtime.__toESM(require("@ldo/dataset"));
|
|
9
|
+
|
|
10
|
+
//#region src/resources/NextGraphResource.ts
|
|
11
|
+
var NextGraphResource = class extends events.default {
|
|
12
|
+
uri;
|
|
13
|
+
type = "NextGraphResource";
|
|
14
|
+
isError = false;
|
|
15
|
+
status;
|
|
16
|
+
context;
|
|
17
|
+
fetched = false;
|
|
18
|
+
loading = false;
|
|
19
|
+
present = void 0;
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
* Handles notification subscriptions
|
|
23
|
+
*/
|
|
24
|
+
notificationSubscription;
|
|
25
|
+
constructor(uri, context) {
|
|
26
|
+
super();
|
|
27
|
+
this.uri = uri;
|
|
28
|
+
this.status = new __ldo_connected.Unfetched(this);
|
|
29
|
+
this.context = context;
|
|
30
|
+
this.notificationSubscription = new require__Users_jacksonmorgan_O_ldo_packages_connected_nextgraph_src_notifications_NextGraphNotificationSubscription.NextGraphNotificationSubscription(this, this.onNotification.bind(this), this.context);
|
|
31
|
+
}
|
|
32
|
+
isLoading() {
|
|
33
|
+
return this.loading;
|
|
34
|
+
}
|
|
35
|
+
isFetched() {
|
|
36
|
+
return this.fetched;
|
|
37
|
+
}
|
|
38
|
+
isUnfetched() {
|
|
39
|
+
return !this.fetched;
|
|
40
|
+
}
|
|
41
|
+
isDoingInitialFetch() {
|
|
42
|
+
return this.loading && !this.fetched;
|
|
43
|
+
}
|
|
44
|
+
isPresent() {
|
|
45
|
+
return this.present;
|
|
46
|
+
}
|
|
47
|
+
isAbsent() {
|
|
48
|
+
return !this.present;
|
|
49
|
+
}
|
|
50
|
+
isSubscribedToNotifications() {
|
|
51
|
+
return this.notificationSubscription.isSubscribedToNotifications();
|
|
52
|
+
}
|
|
53
|
+
handleThrownError(err) {
|
|
54
|
+
const error = __ldo_connected.UnexpectedResourceError.fromThrown(this, err);
|
|
55
|
+
this.loading = false;
|
|
56
|
+
this.status = error;
|
|
57
|
+
this.emit("update");
|
|
58
|
+
return error;
|
|
59
|
+
}
|
|
60
|
+
overwriteQuads(quads) {
|
|
61
|
+
const dataset = this.context.dataset;
|
|
62
|
+
const graphNode = (0, __ldo_rdf_utils.namedNode)(this.uri);
|
|
63
|
+
dataset.deleteMatches(void 0, void 0, void 0, graphNode);
|
|
64
|
+
dataset.addAll(quads.map((ngQuad) => {
|
|
65
|
+
return (0, __ldo_rdf_utils.quad)(ngQuad.subject, ngQuad.predicate, ngQuad.object, graphNode);
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
async read() {
|
|
69
|
+
try {
|
|
70
|
+
this.loading = true;
|
|
71
|
+
this.emit("update");
|
|
72
|
+
const sparqlResult = await this.context.nextgraph.ng.sparql_query(this.context.nextgraph.sessionId, `CONSTRUCT { ?s ?p ?o } WHERE { GRAPH <${this.uri}> { ?s ?p ?o } }`, void 0, this.uri);
|
|
73
|
+
this.overwriteQuads(sparqlResult);
|
|
74
|
+
const result = new require__Users_jacksonmorgan_O_ldo_packages_connected_nextgraph_src_results_NextGraphReadSuccess.NextGraphReadSuccess(this, false);
|
|
75
|
+
this.loading = false;
|
|
76
|
+
this.fetched = true;
|
|
77
|
+
this.present = true;
|
|
78
|
+
this.status = result;
|
|
79
|
+
this.emit("update");
|
|
80
|
+
return result;
|
|
81
|
+
} catch (err) {
|
|
82
|
+
if (err === "RepoNotFound") {
|
|
83
|
+
const result = new require__Users_jacksonmorgan_O_ldo_packages_connected_nextgraph_src_results_NextGraphReadSuccess.NextGraphReadSuccess(this, false);
|
|
84
|
+
this.loading = false;
|
|
85
|
+
this.fetched = true;
|
|
86
|
+
this.present = false;
|
|
87
|
+
this.status = result;
|
|
88
|
+
this.emit("update");
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
return this.handleThrownError(err);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
async readIfUnfetched() {
|
|
95
|
+
if (this.isFetched()) return new require__Users_jacksonmorgan_O_ldo_packages_connected_nextgraph_src_results_NextGraphReadSuccess.NextGraphReadSuccess(this, true);
|
|
96
|
+
return this.read();
|
|
97
|
+
}
|
|
98
|
+
async update(datasetChanges) {
|
|
99
|
+
this.loading = true;
|
|
100
|
+
this.emit("update");
|
|
101
|
+
this.context.dataset.bulk(datasetChanges);
|
|
102
|
+
try {
|
|
103
|
+
await this.context.nextgraph.ng.sparql_update(this.context.nextgraph.sessionId, await (0, __ldo_rdf_utils.changesToSparqlUpdate)(datasetChanges), this.uri);
|
|
104
|
+
return new __ldo_connected.UpdateSuccess(this);
|
|
105
|
+
} catch (err) {
|
|
106
|
+
this.context.dataset.bulk({
|
|
107
|
+
added: datasetChanges.removed,
|
|
108
|
+
removed: datasetChanges.added
|
|
109
|
+
});
|
|
110
|
+
return this.handleThrownError(err);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
async notificationToQuads(notificationString) {
|
|
114
|
+
const rawTriples = JSON.parse(notificationString);
|
|
115
|
+
const triples = (await Promise.all(rawTriples.map(async (rawTriple) => (0, __ldo_ldo.parseRdf)(`${rawTriple}.`, { baseIRI: this.uri })))).reduce((agg, ldoDataset) => {
|
|
116
|
+
ldoDataset.forEach((quad) => {
|
|
117
|
+
agg.add((0, __ldo_rdf_utils.quad)(quad.subject, quad.predicate, quad.object, (0, __ldo_rdf_utils.namedNode)(this.uri)));
|
|
118
|
+
});
|
|
119
|
+
return agg;
|
|
120
|
+
}, (0, __ldo_dataset.createDataset)());
|
|
121
|
+
return triples;
|
|
122
|
+
}
|
|
123
|
+
async onNotification(response) {
|
|
124
|
+
if (response.V0.State) {
|
|
125
|
+
if (!response.V0.State.graph) {
|
|
126
|
+
this.overwriteQuads([]);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const json_str = new TextDecoder().decode(response.V0.State.graph.triples);
|
|
130
|
+
const triples = await this.notificationToQuads(json_str);
|
|
131
|
+
this.overwriteQuads(triples);
|
|
132
|
+
} else if (response.V0.Patch?.graph) {
|
|
133
|
+
const insertsString = new TextDecoder().decode(response.V0.Patch.graph.inserts);
|
|
134
|
+
const removesString = new TextDecoder().decode(response.V0.Patch.graph.removes);
|
|
135
|
+
const [added, removed] = await Promise.all([insertsString, removesString].map(async (str) => {
|
|
136
|
+
return this.notificationToQuads(str);
|
|
137
|
+
}));
|
|
138
|
+
this.context.dataset.bulk({
|
|
139
|
+
added,
|
|
140
|
+
removed
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
async subscribeToNotifications(callbacks) {
|
|
145
|
+
return await this.notificationSubscription.subscribeToNotifications(callbacks);
|
|
146
|
+
}
|
|
147
|
+
unsubscribeFromNotifications(subscriptionId) {
|
|
148
|
+
return this.notificationSubscription.unsubscribeFromNotification(subscriptionId);
|
|
149
|
+
}
|
|
150
|
+
unsubscribeFromAllNotifications() {
|
|
151
|
+
return this.notificationSubscription.unsubscribeFromAllNotifications();
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
//#endregion
|
|
156
|
+
exports.NextGraphResource = NextGraphResource;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { NextGraphUri } from "../types.cjs";
|
|
2
|
+
import { NextGraphNotificationMessage } from "../notifications/NextGraphNotificationMessage.cjs";
|
|
3
|
+
import { NextGraphReadSuccess } from "../results/NextGraphReadSuccess.cjs";
|
|
4
|
+
import { NextGraphConnectedPlugin } from "../NextGraphConnectedPlugin.cjs";
|
|
5
|
+
import { ConnectedContext, ConnectedResult, NotificationSubscription, Resource, ResourceEventEmitter, SubscriptionCallbacks, UnexpectedResourceError, UpdateSuccess } from "@ldo/connected";
|
|
6
|
+
import { DatasetChanges } from "@ldo/rdf-utils";
|
|
7
|
+
import { Quad } from "@rdfjs/types";
|
|
8
|
+
|
|
9
|
+
//#region src/resources/NextGraphResource.d.ts
|
|
10
|
+
declare const NextGraphResource_base: new () => ResourceEventEmitter;
|
|
11
|
+
declare class NextGraphResource extends NextGraphResource_base implements Resource<NextGraphUri> {
|
|
12
|
+
readonly uri: NextGraphUri;
|
|
13
|
+
readonly type: "NextGraphResource";
|
|
14
|
+
readonly isError: false;
|
|
15
|
+
status: ConnectedResult;
|
|
16
|
+
protected context: ConnectedContext<NextGraphConnectedPlugin[]>;
|
|
17
|
+
private fetched;
|
|
18
|
+
private loading;
|
|
19
|
+
private present;
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
* Handles notification subscriptions
|
|
23
|
+
*/
|
|
24
|
+
protected notificationSubscription: NotificationSubscription<NextGraphConnectedPlugin, NextGraphNotificationMessage>;
|
|
25
|
+
constructor(uri: NextGraphUri, context: ConnectedContext<NextGraphConnectedPlugin[]>);
|
|
26
|
+
isLoading(): boolean;
|
|
27
|
+
isFetched(): boolean;
|
|
28
|
+
isUnfetched(): boolean;
|
|
29
|
+
isDoingInitialFetch(): boolean;
|
|
30
|
+
isPresent(): boolean | undefined;
|
|
31
|
+
isAbsent(): boolean | undefined;
|
|
32
|
+
isSubscribedToNotifications(): boolean;
|
|
33
|
+
private handleThrownError;
|
|
34
|
+
private overwriteQuads;
|
|
35
|
+
read(): Promise<NextGraphReadSuccess | UnexpectedResourceError<NextGraphResource>>;
|
|
36
|
+
readIfUnfetched(): Promise<NextGraphReadSuccess | UnexpectedResourceError<NextGraphResource>>;
|
|
37
|
+
update(datasetChanges: DatasetChanges<Quad>): Promise<UpdateSuccess<NextGraphResource> | UnexpectedResourceError<NextGraphResource>>;
|
|
38
|
+
private notificationToQuads;
|
|
39
|
+
protected onNotification(response: NextGraphNotificationMessage): Promise<void>;
|
|
40
|
+
subscribeToNotifications(callbacks?: SubscriptionCallbacks<NextGraphNotificationMessage>): Promise<string>;
|
|
41
|
+
unsubscribeFromNotifications(subscriptionId: string): Promise<void>;
|
|
42
|
+
unsubscribeFromAllNotifications(): Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { NextGraphResource };
|
|
46
|
+
//# sourceMappingURL=NextGraphResource.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NextGraphResource.d.cts","names":[],"sources":["../../../src/resources/NextGraphResource.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAmBuE,cAAA,sBAMd,EAAA,OAApB,GAAA,oBAAoB;AAD5C,cAAA,iBAAA,SACH,sBAAA,YACG,QADX,CACoB,YADpB,CAAA,CAAA;EAAA,SAAA,GAAA,EAGqB,YAHrB;EAAA,SACoB,IAAA,EAAA,mBAAA;EAAY,SAEX,OAAA,EAAA,KAAA;EAAY,MAGlB,EAAA,eAAA;EAAe,UACM,OAAA,EAAjB,gBAAiB,CAAA,wBAAA,EAAA,CAAA;EAAwB,QAAzC,OAAA;EAAgB,QAWjC,OAAA;EAAwB,QACxB,OAAA;EAA4B;;;;EAKH,UAoEzB,wBAAA,EA3EkC,wBA2ElC,CA1EA,wBA0EA,EAzEA,4BAyEA,CAAA;EAAoB,WAA2B,CAAA,GAAA,EArE1C,YAqE0C,EAAA,OAAA,EApEtC,gBAoEsC,CApErB,wBAoEqB,EAAA,CAAA;EAAiB,SAAzC,CAAA,CAAA,EAAA,OAAA;EAAuB,SADlC,CAAA,CAAA,EAAA,OAAA;EAAO,WAwCnB,CAAA,CAAA,EAAA,OAAA;EAAoB,mBAA2B,CAAA,CAAA,EAAA,OAAA;EAAiB,SAAzC,CAAA,CAAA,EAAA,OAAA,GAAA,SAAA;EAAuB,QADvB,CAAA,CAAA,EAAA,OAAA,GAAA,SAAA;EAAO,2BAUC,CAAA,CAAA,EAAA,OAAA;EAAI,QAAnB,iBAAA;EAAc,QAEd,cAAA;EAAiB,IAA/B,CAAA,CAAA,EAnDU,OAmDV,CAlDF,oBAkDE,GAlDqB,uBAkDrB,CAlD6C,iBAkD7C,CAAA,CAAA;EAAa,eACW,CAAA,CAAA,EAbH,OAaG,CAZ1B,oBAY0B,GAZH,uBAYG,CAZqB,iBAYrB,CAAA,CAAA;EAAiB,MAAzC,CAAA,cAAA,EAHc,cAGd,CAH6B,IAG7B,CAAA,CAAA,EAFD,OAEC,CADA,aACA,CADc,iBACd,CAAA,GAAA,uBAAA,CAAwB,iBAAxB,CAAA,CAAA;EAAuB,QAFxB,mBAAA;EAAO,UAsD+B,cAAA,CAAA,QAAA,EAAA,4BAAA,CAAA,EAA4B,OAA5B,CAAA,IAAA,CAAA;EAA4B,wBAAA,CAAA,SAAA,CAAA,EAiCvD,qBAjCuD,CAiCjC,4BAjCiC,CAAA,CAAA,EAkClE,OAlCkE,CAAA,MAAA,CAAA;EAAA,4BAiCjC,CAAA,cAAA,EAAA,MAAA,CAAA,EAOkB,OAPlB,CAAA,IAAA,CAAA;EAA4B,+BAAlD,CAAA,CAAA,EAaqB,OAbrB,CAAA,IAAA,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { NextGraphUri } from "../types.js";
|
|
2
|
+
import { NextGraphNotificationMessage } from "../notifications/NextGraphNotificationMessage.js";
|
|
3
|
+
import { NextGraphReadSuccess$1 as NextGraphReadSuccess } from "../results/NextGraphReadSuccess.js";
|
|
4
|
+
import { NextGraphConnectedPlugin } from "../NextGraphConnectedPlugin.js";
|
|
5
|
+
import { ConnectedContext, ConnectedResult, NotificationSubscription, Resource, ResourceEventEmitter, SubscriptionCallbacks, UnexpectedResourceError, UpdateSuccess } from "@ldo/connected";
|
|
6
|
+
import { DatasetChanges } from "@ldo/rdf-utils";
|
|
7
|
+
import { Quad } from "@rdfjs/types";
|
|
8
|
+
|
|
9
|
+
//#region src/resources/NextGraphResource.d.ts
|
|
10
|
+
declare const NextGraphResource_base: new () => ResourceEventEmitter;
|
|
11
|
+
declare class NextGraphResource extends NextGraphResource_base implements Resource<NextGraphUri> {
|
|
12
|
+
readonly uri: NextGraphUri;
|
|
13
|
+
readonly type: "NextGraphResource";
|
|
14
|
+
readonly isError: false;
|
|
15
|
+
status: ConnectedResult;
|
|
16
|
+
protected context: ConnectedContext<NextGraphConnectedPlugin[]>;
|
|
17
|
+
private fetched;
|
|
18
|
+
private loading;
|
|
19
|
+
private present;
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
* Handles notification subscriptions
|
|
23
|
+
*/
|
|
24
|
+
protected notificationSubscription: NotificationSubscription<NextGraphConnectedPlugin, NextGraphNotificationMessage>;
|
|
25
|
+
constructor(uri: NextGraphUri, context: ConnectedContext<NextGraphConnectedPlugin[]>);
|
|
26
|
+
isLoading(): boolean;
|
|
27
|
+
isFetched(): boolean;
|
|
28
|
+
isUnfetched(): boolean;
|
|
29
|
+
isDoingInitialFetch(): boolean;
|
|
30
|
+
isPresent(): boolean | undefined;
|
|
31
|
+
isAbsent(): boolean | undefined;
|
|
32
|
+
isSubscribedToNotifications(): boolean;
|
|
33
|
+
private handleThrownError;
|
|
34
|
+
private overwriteQuads;
|
|
35
|
+
read(): Promise<NextGraphReadSuccess | UnexpectedResourceError<NextGraphResource>>;
|
|
36
|
+
readIfUnfetched(): Promise<NextGraphReadSuccess | UnexpectedResourceError<NextGraphResource>>;
|
|
37
|
+
update(datasetChanges: DatasetChanges<Quad>): Promise<UpdateSuccess<NextGraphResource> | UnexpectedResourceError<NextGraphResource>>;
|
|
38
|
+
private notificationToQuads;
|
|
39
|
+
protected onNotification(response: NextGraphNotificationMessage): Promise<void>;
|
|
40
|
+
subscribeToNotifications(callbacks?: SubscriptionCallbacks<NextGraphNotificationMessage>): Promise<string>;
|
|
41
|
+
unsubscribeFromNotifications(subscriptionId: string): Promise<void>;
|
|
42
|
+
unsubscribeFromAllNotifications(): Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { NextGraphResource as NextGraphResource$1 };
|
|
46
|
+
//# sourceMappingURL=NextGraphResource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NextGraphResource.d.ts","names":[],"sources":["../../../src/resources/NextGraphResource.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAmBuE,cAAA,sBAMd,EAAA,OAApB,GAAA,oBAAoB;AAD5C,cAAA,iBAAA,SACH,sBAAA,YACG,QADX,CACoB,YADpB,CAAA,CAAA;EAAA,SAAA,GAAA,EAGqB,YAHrB;EAAA,SACoB,IAAA,EAAA,mBAAA;EAAY,SAEX,OAAA,EAAA,KAAA;EAAY,MAGlB,EAAA,eAAA;EAAe,UACM,OAAA,EAAjB,gBAAiB,CAAA,wBAAA,EAAA,CAAA;EAAwB,QAAzC,OAAA;EAAgB,QAWjC,OAAA;EAAwB,QACxB,OAAA;EAA4B;;;;EAKH,UAoEzB,wBAAA,EA3EkC,wBA2ElC,CA1EA,wBA0EA,EAzEA,4BAyEA,CAAA;EAAoB,WAA2B,CAAA,GAAA,EArE1C,YAqE0C,EAAA,OAAA,EApEtC,gBAoEsC,CApErB,wBAoEqB,EAAA,CAAA;EAAiB,SAAzC,CAAA,CAAA,EAAA,OAAA;EAAuB,SADlC,CAAA,CAAA,EAAA,OAAA;EAAO,WAwCnB,CAAA,CAAA,EAAA,OAAA;EAAoB,mBAA2B,CAAA,CAAA,EAAA,OAAA;EAAiB,SAAzC,CAAA,CAAA,EAAA,OAAA,GAAA,SAAA;EAAuB,QADvB,CAAA,CAAA,EAAA,OAAA,GAAA,SAAA;EAAO,2BAUC,CAAA,CAAA,EAAA,OAAA;EAAI,QAAnB,iBAAA;EAAc,QAEd,cAAA;EAAiB,IAA/B,CAAA,CAAA,EAnDU,OAmDV,CAlDF,oBAkDE,GAlDqB,uBAkDrB,CAlD6C,iBAkD7C,CAAA,CAAA;EAAa,eACW,CAAA,CAAA,EAbH,OAaG,CAZ1B,oBAY0B,GAZH,uBAYG,CAZqB,iBAYrB,CAAA,CAAA;EAAiB,MAAzC,CAAA,cAAA,EAHc,cAGd,CAH6B,IAG7B,CAAA,CAAA,EAFD,OAEC,CADA,aACA,CADc,iBACd,CAAA,GAAA,uBAAA,CAAwB,iBAAxB,CAAA,CAAA;EAAuB,QAFxB,mBAAA;EAAO,UAsD+B,cAAA,CAAA,QAAA,EAAA,4BAAA,CAAA,EAA4B,OAA5B,CAAA,IAAA,CAAA;EAA4B,wBAAA,CAAA,SAAA,CAAA,EAiCvD,qBAjCuD,CAiCjC,4BAjCiC,CAAA,CAAA,EAkClE,OAlCkE,CAAA,MAAA,CAAA;EAAA,4BAiCjC,CAAA,cAAA,EAAA,MAAA,CAAA,EAOkB,OAPlB,CAAA,IAAA,CAAA;EAA4B,+BAAlD,CAAA,CAAA,EAaqB,OAbrB,CAAA,IAAA,CAAA"}
|