@ldo/solid-type-index 1.0.0-alpha.1 → 1.0.0-alpha.3
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/getTypeIndex.d.ts +3 -3
- package/dist/getTypeIndex.js +1 -1
- package/dist/getTypeIndex.js.map +1 -1
- package/dist/react/useInstanceUris.d.ts +2 -2
- package/dist/react/useInstanceUris.js.map +1 -1
- package/dist/react/util/useSubscribeToUris.js.map +1 -1
- package/dist/setTypeIndex.d.ts +3 -3
- package/dist/setTypeIndex.js +4 -2
- package/dist/setTypeIndex.js.map +1 -1
- package/dist/util/Options.d.ts +4 -3
- package/dist/util/Options.js +5 -4
- package/dist/util/Options.js.map +1 -1
- package/package.json +6 -8
- package/src/getTypeIndex.ts +10 -10
- package/src/react/useInstanceUris.ts +3 -3
- package/src/setTypeIndex.ts +16 -6
- package/src/util/Options.ts +10 -5
package/dist/getTypeIndex.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { LeafUri } from "@ldo/solid";
|
|
2
1
|
import type { TypeRegistration } from "./.ldo/typeIndex.typings";
|
|
3
2
|
import type { TypeIndexProfile } from "./.ldo/profile.typings";
|
|
4
3
|
import type { Options } from "./util/Options";
|
|
5
4
|
import type { LdSet } from "@ldo/ldo";
|
|
5
|
+
import type { SolidLeafUri } from "@ldo/connected-solid";
|
|
6
6
|
export declare function getTypeRegistrations(webId: string, options?: Options): Promise<LdSet<TypeRegistration>>;
|
|
7
7
|
export declare function getProfile(webId: string, options?: Options): Promise<TypeIndexProfile>;
|
|
8
|
-
export declare function getTypeIndexesUrisFromProfile(profile: TypeIndexProfile):
|
|
9
|
-
export declare function getInstanceUris(classUri: string, typeRegistrations: TypeRegistration[], options?: Options): Promise<
|
|
8
|
+
export declare function getTypeIndexesUrisFromProfile(profile: TypeIndexProfile): SolidLeafUri[];
|
|
9
|
+
export declare function getInstanceUris(classUri: string, typeRegistrations: TypeRegistration[], options?: Options): Promise<SolidLeafUri[]>;
|
package/dist/getTypeIndex.js
CHANGED
|
@@ -50,7 +50,7 @@ async function getInstanceUris(classUri, typeRegistrations, options) {
|
|
|
50
50
|
const containerResource = dataset.getResource(instanceContainer["@id"]);
|
|
51
51
|
await containerResource.readIfUnfetched();
|
|
52
52
|
containerResource.children().forEach((child) => {
|
|
53
|
-
if (child.type === "
|
|
53
|
+
if (child.type === "SolidLeaf")
|
|
54
54
|
leafUris.add(child.uri);
|
|
55
55
|
});
|
|
56
56
|
}) ?? []);
|
package/dist/getTypeIndex.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTypeIndex.js","sourceRoot":"","sources":["../src/getTypeIndex.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"getTypeIndex.js","sourceRoot":"","sources":["../src/getTypeIndex.ts"],"names":[],"mappings":";;;AAEA,kEAAsE;AACtE,sEAAwE;AACxE,2CAA0D;AAE1D,4CAAkD;AAI3C,KAAK,UAAU,oBAAoB,CACxC,KAAa,EACb,OAAiB;IAEjB,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,0BAAgB,EAAC,OAAO,CAAC,CAAC;IAG9C,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAGjD,MAAM,aAAa,GAAG,6BAA6B,CAAC,OAAO,CAAC,CAAC;IAG7D,MAAM,OAAO,CAAC,GAAG,CACf,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE;QACvC,MAAM,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;QAC5D,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC,eAAe,EAAE,CAAC;QAC7D,IAAI,UAAU,CAAC,OAAO;YAAE,MAAM,UAAU,CAAC;IAC3C,CAAC,CAAC,CACH,CAAC;IAGF,OAAO,OAAO;SACX,SAAS,CAAC,gDAAyB,CAAC;SACpC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,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,QAAQ,EAAE,CAAC;YAE9C,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAC1C,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAiB,CAAC,CAC9C,CAAC;YAEF,MAAM,OAAO,CAAC,GAAG,CACf,YAAY,CAAC,iBAAiB,EAAE,GAAG,CAAC,KAAK,EAAE,iBAAiB,EAAE,EAAE;gBAC9D,MAAM,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAC3C,iBAAiB,CAAC,KAAK,CAAsB,CAC9C,CAAC;gBACF,MAAM,iBAAiB,CAAC,eAAe,EAAE,CAAC;gBAC1C,iBAAiB,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;oBAC7C,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW;wBAAE,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAC1D,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,IAAI,EAAE,CACT,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CACH,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC;AA/BD,0CA+BC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function useInstanceUris(classUri: string):
|
|
1
|
+
import type { SolidLeafUri } from "@ldo/connected-solid";
|
|
2
|
+
export declare function useInstanceUris(classUri: string): SolidLeafUri[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInstanceUris.js","sourceRoot":"","sources":["../../src/react/useInstanceUris.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"useInstanceUris.js","sourceRoot":"","sources":["../../src/react/useInstanceUris.ts"],"names":[],"mappings":";;;AAAA,+DAA4D;AAC5D,iCAAqD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,CAAC;iBAAM,CAAC;gBACN,OAAO,qBAAqB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC,CAAC,CACH,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE;YAEhB,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,GAAG,CACvC,KAAK,EAAE,CAAC,WAAW,EAAE,cAAc,CAAC,EAAE,EAAE;gBAEtC,OAAO,mBAAmB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;gBAChD,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;gBAClD,MAAM,QAAQ,CAAC,4BAA4B,CAAC,cAAc,CAAC,CAAC;YAC9D,CAAC,CACF,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;AACb,CAAC;AA/BD,gDA+BC"}
|
package/dist/setTypeIndex.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type Options } from "./util/Options";
|
|
2
2
|
import type { TypeRegistration } from "./.ldo/typeIndex.typings";
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
3
|
+
import type { SolidConnectedPlugin, SolidContainer } from "@ldo/connected-solid";
|
|
4
|
+
import type { ConnectedLdoDataset, ConnectedPlugin } from "@ldo/connected";
|
|
5
5
|
export declare function initTypeIndex(webId: string, options?: Options): Promise<void>;
|
|
6
|
-
export declare function createIndex(webId: any, profileFolder:
|
|
6
|
+
export declare function createIndex(webId: any, profileFolder: SolidContainer, dataset: ConnectedLdoDataset<(SolidConnectedPlugin | ConnectedPlugin<any, any, any, any>)[]>, isPrivate: boolean): Promise<void>;
|
|
7
7
|
interface Instances {
|
|
8
8
|
instance?: string[];
|
|
9
9
|
instanceContainer?: string[];
|
package/dist/setTypeIndex.js
CHANGED
|
@@ -13,7 +13,9 @@ async function initTypeIndex(webId, options) {
|
|
|
13
13
|
const { dataset } = (0, Options_1.guaranteeOptions)(options);
|
|
14
14
|
const profile = await (0, getTypeIndex_1.getProfile)(webId, options);
|
|
15
15
|
if (!profile.privateTypeIndex?.size || !profile.publicTypeIndex?.size) {
|
|
16
|
-
const profileFolder = await dataset
|
|
16
|
+
const profileFolder = await dataset
|
|
17
|
+
.getResource(webId)
|
|
18
|
+
.getParentContainer();
|
|
17
19
|
if (profileFolder?.isError)
|
|
18
20
|
throw profileFolder;
|
|
19
21
|
if (!profileFolder)
|
|
@@ -67,7 +69,7 @@ async function createIndex(webId, profileFolder, dataset, isPrivate) {
|
|
|
67
69
|
.write(indexResource.uri)
|
|
68
70
|
.fromSubject(indexResource.uri);
|
|
69
71
|
cTypeIndex.type = (0, ldo_1.set)({ "@id": "ListedDocument" }, { "@id": "TypeIndex" });
|
|
70
|
-
const commitResult = await transaction.
|
|
72
|
+
const commitResult = await transaction.commitToRemote();
|
|
71
73
|
if (commitResult.isError)
|
|
72
74
|
throw commitResult;
|
|
73
75
|
}
|
package/dist/setTypeIndex.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setTypeIndex.js","sourceRoot":"","sources":["../src/setTypeIndex.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"setTypeIndex.js","sourceRoot":"","sources":["../src/setTypeIndex.ts"],"names":[],"mappings":";;;AACA,+BAA0B;AAC1B,sEAGqC;AACrC,2CAAqE;AACrE,4CAAgE;AAChE,kDAAoD;AAEpD,iDAA4C;AAC5C,kEAAsE;AAEtE,kCAA+B;AAcxB,KAAK,UAAU,aAAa,CACjC,KAAa,EACb,OAAiB;IAEjB,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,0BAAgB,EAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,MAAM,IAAA,yBAAU,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACjD,IAAI,CAAC,OAAO,CAAC,gBAAg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ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ConnectedLdoDataset, IConnectedLdoDataset } from "@ldo/connected";
|
|
2
|
+
import type { SolidConnectedPlugin } from "@ldo/connected-solid";
|
|
2
3
|
export interface Options {
|
|
3
|
-
solidLdoDataset?:
|
|
4
|
+
solidLdoDataset?: IConnectedLdoDataset<SolidConnectedPlugin[]>;
|
|
4
5
|
fetch?: typeof fetch;
|
|
5
6
|
}
|
|
6
7
|
export declare function guaranteeOptions(options?: Options): {
|
|
7
8
|
fetch: typeof globalThis.fetch;
|
|
8
|
-
dataset:
|
|
9
|
+
dataset: ConnectedLdoDataset<SolidConnectedPlugin[]>;
|
|
9
10
|
};
|
package/dist/util/Options.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.guaranteeOptions = void 0;
|
|
4
|
-
const
|
|
5
|
-
const guaranteeFetch_1 = require("@ldo/solid/dist/util/guaranteeFetch");
|
|
4
|
+
const connected_solid_1 = require("@ldo/connected-solid");
|
|
6
5
|
function guaranteeOptions(options) {
|
|
7
|
-
const fetch = (0,
|
|
8
|
-
const dataset = options?.solidLdoDataset ??
|
|
6
|
+
const fetch = (0, connected_solid_1.guaranteeFetch)(options?.fetch);
|
|
7
|
+
const dataset = (options?.solidLdoDataset ??
|
|
8
|
+
(0, connected_solid_1.createSolidLdoDataset)());
|
|
9
|
+
dataset.setContext("solid", { fetch });
|
|
9
10
|
return { fetch, dataset };
|
|
10
11
|
}
|
|
11
12
|
exports.guaranteeOptions = guaranteeOptions;
|
package/dist/util/Options.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Options.js","sourceRoot":"","sources":["../../src/util/Options.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Options.js","sourceRoot":"","sources":["../../src/util/Options.ts"],"names":[],"mappings":";;;AAGA,0DAA6E;AAS7E,SAAgB,gBAAgB,CAAC,OAAiB;IAChD,MAAM,KAAK,GAAG,IAAA,gCAAc,EAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC7C,MAAM,OAAO,GAAG,CAAC,OAAO,EAAE,eAAe;QACvC,IAAA,uCAAqB,GAAE,CAAgD,CAAC;IAC1E,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACvC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC5B,CAAC;AAND,4CAMC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ldo/solid-type-index",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.3",
|
|
4
4
|
"description": "Solid Type Index support for LDO",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -26,18 +26,16 @@
|
|
|
26
26
|
},
|
|
27
27
|
"homepage": "https://github.com/o-development/ldobjects/tree/main/packages/solid-react#readme",
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@ldo/rdf-utils": "^1.0.0-alpha.
|
|
29
|
+
"@ldo/rdf-utils": "^1.0.0-alpha.3",
|
|
30
30
|
"@rdfjs/types": "^1.0.1",
|
|
31
31
|
"@testing-library/react": "^14.1.2",
|
|
32
|
-
"
|
|
33
|
-
"jest-environment-jsdom": "^27.0.0",
|
|
32
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
34
33
|
"start-server-and-test": "^2.0.3",
|
|
35
|
-
"ts-jest": "^27.1.2",
|
|
36
34
|
"ts-node": "^10.9.2"
|
|
37
35
|
},
|
|
38
36
|
"dependencies": {
|
|
39
|
-
"@ldo/solid": "^1.0.0-alpha.
|
|
40
|
-
"@ldo/solid-react": "^1.0.0-alpha.
|
|
37
|
+
"@ldo/connected-solid": "^1.0.0-alpha.3",
|
|
38
|
+
"@ldo/solid-react": "^1.0.0-alpha.3"
|
|
41
39
|
},
|
|
42
40
|
"files": [
|
|
43
41
|
"dist",
|
|
@@ -46,5 +44,5 @@
|
|
|
46
44
|
"publishConfig": {
|
|
47
45
|
"access": "public"
|
|
48
46
|
},
|
|
49
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "e1995e01e769d2ba37e419c661171606e1941c3c"
|
|
50
48
|
}
|
package/src/getTypeIndex.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ContainerUri, LeafUri } from "@ldo/solid";
|
|
2
1
|
import type { TypeRegistration } from "./.ldo/typeIndex.typings";
|
|
3
2
|
import type { TypeIndexProfile } from "./.ldo/profile.typings";
|
|
4
3
|
import { TypeIndexProfileShapeType } from "./.ldo/profile.shapeTypes";
|
|
@@ -7,6 +6,7 @@ import { RDF_TYPE, TYPE_REGISTRATION } from "./constants";
|
|
|
7
6
|
import type { Options } from "./util/Options";
|
|
8
7
|
import { guaranteeOptions } from "./util/Options";
|
|
9
8
|
import type { LdSet } from "@ldo/ldo";
|
|
9
|
+
import type { SolidContainerUri, SolidLeafUri } from "@ldo/connected-solid";
|
|
10
10
|
|
|
11
11
|
export async function getTypeRegistrations(
|
|
12
12
|
webId: string,
|
|
@@ -48,13 +48,13 @@ export async function getProfile(
|
|
|
48
48
|
|
|
49
49
|
export function getTypeIndexesUrisFromProfile(
|
|
50
50
|
profile: TypeIndexProfile,
|
|
51
|
-
):
|
|
52
|
-
const uris:
|
|
51
|
+
): SolidLeafUri[] {
|
|
52
|
+
const uris: SolidLeafUri[] = [];
|
|
53
53
|
profile.privateTypeIndex?.forEach((indexNode) => {
|
|
54
|
-
uris.push(indexNode["@id"] as
|
|
54
|
+
uris.push(indexNode["@id"] as SolidLeafUri);
|
|
55
55
|
});
|
|
56
56
|
profile.publicTypeIndex?.forEach((indexNode) => {
|
|
57
|
-
uris.push(indexNode["@id"] as
|
|
57
|
+
uris.push(indexNode["@id"] as SolidLeafUri);
|
|
58
58
|
});
|
|
59
59
|
return uris;
|
|
60
60
|
}
|
|
@@ -63,26 +63,26 @@ export async function getInstanceUris(
|
|
|
63
63
|
classUri: string,
|
|
64
64
|
typeRegistrations: TypeRegistration[],
|
|
65
65
|
options?: Options,
|
|
66
|
-
): Promise<
|
|
66
|
+
): Promise<SolidLeafUri[]> {
|
|
67
67
|
const { dataset } = guaranteeOptions(options);
|
|
68
68
|
|
|
69
|
-
const leafUris = new Set<
|
|
69
|
+
const leafUris = new Set<SolidLeafUri>();
|
|
70
70
|
await Promise.all(
|
|
71
71
|
typeRegistrations.map(async (registration) => {
|
|
72
72
|
if (registration.forClass["@id"] === classUri) {
|
|
73
73
|
// Individual registrations
|
|
74
74
|
registration.instance?.forEach((instance) =>
|
|
75
|
-
leafUris.add(instance["@id"] as
|
|
75
|
+
leafUris.add(instance["@id"] as SolidLeafUri),
|
|
76
76
|
);
|
|
77
77
|
// Container registrations
|
|
78
78
|
await Promise.all(
|
|
79
79
|
registration.instanceContainer?.map(async (instanceContainer) => {
|
|
80
80
|
const containerResource = dataset.getResource(
|
|
81
|
-
instanceContainer["@id"] as
|
|
81
|
+
instanceContainer["@id"] as SolidContainerUri,
|
|
82
82
|
);
|
|
83
83
|
await containerResource.readIfUnfetched();
|
|
84
84
|
containerResource.children().forEach((child) => {
|
|
85
|
-
if (child.type === "
|
|
85
|
+
if (child.type === "SolidLeaf") leafUris.add(child.uri);
|
|
86
86
|
});
|
|
87
87
|
}) ?? [],
|
|
88
88
|
);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { LeafUri } from "@ldo/solid";
|
|
2
1
|
import { useTypeIndexProfile } from "./useTypeIndexProfile";
|
|
3
2
|
import { useEffect, useMemo, useState } from "react";
|
|
4
3
|
import { useSubscribeToUris } from "./util/useSubscribeToUris";
|
|
@@ -9,6 +8,7 @@ import {
|
|
|
9
8
|
getInstanceUris,
|
|
10
9
|
getTypeIndexesUrisFromProfile,
|
|
11
10
|
} from "../getTypeIndex";
|
|
11
|
+
import type { SolidLeafUri } from "@ldo/connected-solid";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Provides the LeafUris of everything in a type node for a specific class uri
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
* @param classUri - the class uri
|
|
17
17
|
* @returns - URIs of all resources registered with this node
|
|
18
18
|
*/
|
|
19
|
-
export function useInstanceUris(classUri: string):
|
|
19
|
+
export function useInstanceUris(classUri: string): SolidLeafUri[] {
|
|
20
20
|
const { dataset } = useLdo();
|
|
21
21
|
const profile = useTypeIndexProfile();
|
|
22
22
|
|
|
@@ -27,7 +27,7 @@ export function useInstanceUris(classUri: string): LeafUri[] {
|
|
|
27
27
|
|
|
28
28
|
useSubscribeToUris(typeIndexUris);
|
|
29
29
|
|
|
30
|
-
const [leafUris, setLeafUris] = useState<
|
|
30
|
+
const [leafUris, setLeafUris] = useState<SolidLeafUri[]>([]);
|
|
31
31
|
|
|
32
32
|
const typeRegistrations = useMatchSubject(
|
|
33
33
|
TypeRegistrationShapeType,
|
package/src/setTypeIndex.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1
2
|
import { v4 } from "uuid";
|
|
2
3
|
import {
|
|
3
4
|
TypeIndexDocumentShapeType,
|
|
@@ -9,10 +10,15 @@ import { namedNode, quad } from "@rdfjs/data-model";
|
|
|
9
10
|
import type { TypeRegistration } from "./.ldo/typeIndex.typings";
|
|
10
11
|
import { getProfile } from "./getTypeIndex";
|
|
11
12
|
import { TypeIndexProfileShapeType } from "./.ldo/profile.shapeTypes";
|
|
12
|
-
import type { Container } from "@ldo/solid";
|
|
13
|
-
import type { ISolidLdoDataset } from "@ldo/solid";
|
|
14
13
|
import type { NamedNode } from "@rdfjs/types";
|
|
15
14
|
import { set } from "@ldo/ldo";
|
|
15
|
+
import type {
|
|
16
|
+
SolidConnectedPlugin,
|
|
17
|
+
SolidContainer,
|
|
18
|
+
SolidContainerUri,
|
|
19
|
+
SolidLeafUri,
|
|
20
|
+
} from "@ldo/connected-solid";
|
|
21
|
+
import type { ConnectedLdoDataset, ConnectedPlugin } from "@ldo/connected";
|
|
16
22
|
|
|
17
23
|
/**
|
|
18
24
|
* =============================================================================
|
|
@@ -26,7 +32,9 @@ export async function initTypeIndex(
|
|
|
26
32
|
const { dataset } = guaranteeOptions(options);
|
|
27
33
|
const profile = await getProfile(webId, options);
|
|
28
34
|
if (!profile.privateTypeIndex?.size || !profile.publicTypeIndex?.size) {
|
|
29
|
-
const profileFolder = await dataset
|
|
35
|
+
const profileFolder = await dataset
|
|
36
|
+
.getResource(webId as SolidLeafUri | SolidContainerUri)
|
|
37
|
+
.getParentContainer();
|
|
30
38
|
if (profileFolder?.isError) throw profileFolder;
|
|
31
39
|
if (!profileFolder)
|
|
32
40
|
throw new Error("No folder to save the type indexes to.");
|
|
@@ -47,8 +55,10 @@ export async function initTypeIndex(
|
|
|
47
55
|
*/
|
|
48
56
|
export async function createIndex(
|
|
49
57
|
webId,
|
|
50
|
-
profileFolder:
|
|
51
|
-
dataset:
|
|
58
|
+
profileFolder: SolidContainer,
|
|
59
|
+
dataset: ConnectedLdoDataset<
|
|
60
|
+
(SolidConnectedPlugin | ConnectedPlugin<any, any, any, any>)[]
|
|
61
|
+
>,
|
|
52
62
|
isPrivate: boolean,
|
|
53
63
|
) {
|
|
54
64
|
// Create a private type index
|
|
@@ -91,7 +101,7 @@ export async function createIndex(
|
|
|
91
101
|
.fromSubject(indexResource.uri);
|
|
92
102
|
|
|
93
103
|
cTypeIndex.type = set({ "@id": "ListedDocument" }, { "@id": "TypeIndex" });
|
|
94
|
-
const commitResult = await transaction.
|
|
104
|
+
const commitResult = await transaction.commitToRemote();
|
|
95
105
|
if (commitResult.isError) throw commitResult;
|
|
96
106
|
}
|
|
97
107
|
|
package/src/util/Options.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import type { ConnectedLdoDataset, IConnectedLdoDataset } from "@ldo/connected";
|
|
3
|
+
import type { SolidConnectedPlugin } from "@ldo/connected-solid";
|
|
4
|
+
import { createSolidLdoDataset, guaranteeFetch } from "@ldo/connected-solid";
|
|
4
5
|
|
|
5
6
|
export interface Options {
|
|
6
|
-
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
8
|
+
// @ts-ignore I'm honestly just tired of dealing with this at this point
|
|
9
|
+
solidLdoDataset?: IConnectedLdoDataset<SolidConnectedPlugin[]>;
|
|
7
10
|
fetch?: typeof fetch;
|
|
8
11
|
}
|
|
9
12
|
|
|
10
13
|
export function guaranteeOptions(options?: Options) {
|
|
11
14
|
const fetch = guaranteeFetch(options?.fetch);
|
|
12
|
-
const dataset = options?.solidLdoDataset ??
|
|
15
|
+
const dataset = (options?.solidLdoDataset ??
|
|
16
|
+
createSolidLdoDataset()) as ConnectedLdoDataset<SolidConnectedPlugin[]>;
|
|
17
|
+
dataset.setContext("solid", { fetch });
|
|
13
18
|
return { fetch, dataset };
|
|
14
19
|
}
|