@ldo/solid-type-index 0.0.1-alpha.32 → 1.0.0-alpha.11

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.
Files changed (144) hide show
  1. package/dist/{.ldo → cjs/.ldo}/profile.context.js +5 -0
  2. package/dist/cjs/.ldo/profile.context.js.map +1 -0
  3. package/dist/{.ldo → cjs/.ldo}/profile.schema.js +5 -0
  4. package/dist/cjs/.ldo/profile.schema.js.map +1 -0
  5. package/dist/cjs/.ldo/profile.shapeTypes.js +19 -0
  6. package/dist/cjs/.ldo/profile.shapeTypes.js.map +1 -0
  7. package/dist/cjs/.ldo/profile.typings.js.map +1 -0
  8. package/dist/{.ldo → cjs/.ldo}/typeIndex.context.js +20 -1
  9. package/dist/cjs/.ldo/typeIndex.context.js.map +1 -0
  10. package/dist/{.ldo → cjs/.ldo}/typeIndex.schema.js +5 -0
  11. package/dist/cjs/.ldo/typeIndex.schema.js.map +1 -0
  12. package/dist/cjs/.ldo/typeIndex.shapeTypes.js +27 -0
  13. package/dist/cjs/.ldo/typeIndex.shapeTypes.js.map +1 -0
  14. package/dist/cjs/.ldo/typeIndex.typings.js.map +1 -0
  15. package/dist/cjs/constants.js.map +1 -0
  16. package/dist/{getTypeIndex.js → cjs/getTypeIndex.js} +21 -16
  17. package/dist/cjs/getTypeIndex.js.map +1 -0
  18. package/dist/{index.js → cjs/index.js} +4 -4
  19. package/dist/cjs/index.js.map +1 -0
  20. package/dist/cjs/react/useInstanceUris.js +33 -0
  21. package/dist/cjs/react/useInstanceUris.js.map +1 -0
  22. package/dist/{react → cjs/react}/useTypeIndexProfile.js +3 -4
  23. package/dist/cjs/react/useTypeIndexProfile.js.map +1 -0
  24. package/dist/{react → cjs/react}/util/useSubscribeToUris.js +4 -2
  25. package/dist/cjs/react/util/useSubscribeToUris.js.map +1 -0
  26. package/dist/cjs/setTypeIndex.js +163 -0
  27. package/dist/cjs/setTypeIndex.js.map +1 -0
  28. package/dist/cjs/util/Options.js +12 -0
  29. package/dist/cjs/util/Options.js.map +1 -0
  30. package/dist/esm/.ldo/profile.context.js +18 -0
  31. package/dist/esm/.ldo/profile.context.js.map +1 -0
  32. package/dist/esm/.ldo/profile.schema.js +61 -0
  33. package/dist/esm/.ldo/profile.schema.js.map +1 -0
  34. package/dist/esm/.ldo/profile.shapeTypes.js +16 -0
  35. package/dist/esm/.ldo/profile.shapeTypes.js.map +1 -0
  36. package/dist/esm/.ldo/profile.typings.js +2 -0
  37. package/dist/esm/.ldo/profile.typings.js.map +1 -0
  38. package/dist/esm/.ldo/typeIndex.context.js +63 -0
  39. package/dist/esm/.ldo/typeIndex.context.js.map +1 -0
  40. package/dist/esm/.ldo/typeIndex.schema.js +143 -0
  41. package/dist/esm/.ldo/typeIndex.schema.js.map +1 -0
  42. package/dist/esm/.ldo/typeIndex.shapeTypes.js +24 -0
  43. package/dist/esm/.ldo/typeIndex.shapeTypes.js.map +1 -0
  44. package/dist/esm/.ldo/typeIndex.typings.js +2 -0
  45. package/dist/esm/.ldo/typeIndex.typings.js.map +1 -0
  46. package/dist/esm/constants.js +6 -0
  47. package/dist/esm/constants.js.map +1 -0
  48. package/dist/esm/getTypeIndex.js +61 -0
  49. package/dist/esm/getTypeIndex.js.map +1 -0
  50. package/dist/esm/index.js +5 -0
  51. package/dist/esm/index.js.map +1 -0
  52. package/dist/esm/react/useInstanceUris.js +30 -0
  53. package/dist/esm/react/useInstanceUris.js.map +1 -0
  54. package/dist/esm/react/useTypeIndexProfile.js +9 -0
  55. package/dist/esm/react/useTypeIndexProfile.js.map +1 -0
  56. package/dist/esm/react/util/useSubscribeToUris.js +30 -0
  57. package/dist/esm/react/util/useSubscribeToUris.js.map +1 -0
  58. package/dist/esm/setTypeIndex.js +156 -0
  59. package/dist/esm/setTypeIndex.js.map +1 -0
  60. package/dist/esm/util/Options.js +9 -0
  61. package/dist/esm/util/Options.js.map +1 -0
  62. package/dist/types/.ldo/profile.context.d.ts +8 -0
  63. package/dist/types/.ldo/profile.context.d.ts.map +1 -0
  64. package/dist/types/.ldo/profile.schema.d.ts +8 -0
  65. package/dist/types/.ldo/profile.schema.d.ts.map +1 -0
  66. package/dist/types/.ldo/profile.shapeTypes.d.ts +12 -0
  67. package/dist/types/.ldo/profile.shapeTypes.d.ts.map +1 -0
  68. package/dist/types/.ldo/profile.typings.d.ts +26 -0
  69. package/dist/types/.ldo/profile.typings.d.ts.map +1 -0
  70. package/dist/types/.ldo/typeIndex.context.d.ts +8 -0
  71. package/dist/types/.ldo/typeIndex.context.d.ts.map +1 -0
  72. package/dist/types/.ldo/typeIndex.schema.d.ts +8 -0
  73. package/dist/types/.ldo/typeIndex.schema.d.ts.map +1 -0
  74. package/dist/types/.ldo/typeIndex.shapeTypes.d.ts +16 -0
  75. package/dist/types/.ldo/typeIndex.shapeTypes.d.ts.map +1 -0
  76. package/dist/types/.ldo/typeIndex.typings.d.ts +53 -0
  77. package/dist/types/.ldo/typeIndex.typings.d.ts.map +1 -0
  78. package/dist/{constants.d.ts → types/constants.d.ts} +1 -0
  79. package/dist/types/constants.d.ts.map +1 -0
  80. package/dist/types/getTypeIndex.d.ts +10 -0
  81. package/dist/types/getTypeIndex.d.ts.map +1 -0
  82. package/dist/types/index.d.ts +5 -0
  83. package/dist/types/index.d.ts.map +1 -0
  84. package/dist/types/react/useInstanceUris.d.ts +9 -0
  85. package/dist/types/react/useInstanceUris.d.ts.map +1 -0
  86. package/dist/types/react/useTypeIndexProfile.d.ts +3 -0
  87. package/dist/types/react/useTypeIndexProfile.d.ts.map +1 -0
  88. package/dist/{react → types/react}/util/useSubscribeToUris.d.ts +1 -0
  89. package/dist/types/react/util/useSubscribeToUris.d.ts.map +1 -0
  90. package/dist/types/setTypeIndex.d.ts +53 -0
  91. package/dist/types/setTypeIndex.d.ts.map +1 -0
  92. package/dist/types/util/Options.d.ts +11 -0
  93. package/dist/types/util/Options.d.ts.map +1 -0
  94. package/package.json +28 -21
  95. package/src/.ldo/profile.context.ts +1 -1
  96. package/src/.ldo/profile.shapeTypes.ts +3 -3
  97. package/src/.ldo/profile.typings.ts +6 -6
  98. package/src/.ldo/typeIndex.context.ts +16 -2
  99. package/src/.ldo/typeIndex.shapeTypes.ts +3 -3
  100. package/src/.ldo/typeIndex.typings.ts +9 -9
  101. package/src/getTypeIndex.ts +19 -18
  102. package/src/index.ts +4 -4
  103. package/src/react/useInstanceUris.ts +11 -9
  104. package/src/react/useTypeIndexProfile.ts +2 -2
  105. package/src/setTypeIndex.ts +60 -38
  106. package/src/util/Options.ts +8 -5
  107. package/dist/.ldo/profile.context.d.ts +0 -2
  108. package/dist/.ldo/profile.context.js.map +0 -1
  109. package/dist/.ldo/profile.schema.d.ts +0 -2
  110. package/dist/.ldo/profile.schema.js.map +0 -1
  111. package/dist/.ldo/profile.shapeTypes.d.ts +0 -3
  112. package/dist/.ldo/profile.shapeTypes.js +0 -11
  113. package/dist/.ldo/profile.shapeTypes.js.map +0 -1
  114. package/dist/.ldo/profile.typings.d.ts +0 -11
  115. package/dist/.ldo/profile.typings.js.map +0 -1
  116. package/dist/.ldo/typeIndex.context.d.ts +0 -2
  117. package/dist/.ldo/typeIndex.context.js.map +0 -1
  118. package/dist/.ldo/typeIndex.schema.d.ts +0 -2
  119. package/dist/.ldo/typeIndex.schema.js.map +0 -1
  120. package/dist/.ldo/typeIndex.shapeTypes.d.ts +0 -4
  121. package/dist/.ldo/typeIndex.shapeTypes.js +0 -16
  122. package/dist/.ldo/typeIndex.shapeTypes.js.map +0 -1
  123. package/dist/.ldo/typeIndex.typings.d.ts +0 -26
  124. package/dist/.ldo/typeIndex.typings.js.map +0 -1
  125. package/dist/constants.js.map +0 -1
  126. package/dist/getTypeIndex.d.ts +0 -8
  127. package/dist/getTypeIndex.js.map +0 -1
  128. package/dist/index.d.ts +0 -4
  129. package/dist/index.js.map +0 -1
  130. package/dist/react/useInstanceUris.d.ts +0 -2
  131. package/dist/react/useInstanceUris.js +0 -26
  132. package/dist/react/useInstanceUris.js.map +0 -1
  133. package/dist/react/useTypeIndexProfile.d.ts +0 -2
  134. package/dist/react/useTypeIndexProfile.js.map +0 -1
  135. package/dist/react/util/useSubscribeToUris.js.map +0 -1
  136. package/dist/setTypeIndex.d.ts +0 -14
  137. package/dist/setTypeIndex.js +0 -123
  138. package/dist/setTypeIndex.js.map +0 -1
  139. package/dist/util/Options.d.ts +0 -9
  140. package/dist/util/Options.js +0 -12
  141. package/dist/util/Options.js.map +0 -1
  142. /package/dist/{.ldo → cjs/.ldo}/profile.typings.js +0 -0
  143. /package/dist/{.ldo → cjs/.ldo}/typeIndex.typings.js +0 -0
  144. /package/dist/{constants.js → cjs/constants.js} +0 -0
@@ -1,4 +1,4 @@
1
- import { LdoJsonldContext } from "@ldo/jsonld-dataset-proxy";
1
+ import { LdoJsonldContext } from "@ldo/ldo";
2
2
 
3
3
  /**
4
4
  * =============================================================================
@@ -7,7 +7,7 @@ import { LdoJsonldContext } from "@ldo/jsonld-dataset-proxy";
7
7
  */
8
8
  export const typeIndexContext: LdoJsonldContext = {
9
9
  type: {
10
- "@id": "@type"
10
+ "@id": "@type",
11
11
  },
12
12
  TypeIndex: {
13
13
  "@id": "http://www.w3.org/ns/solid/terms#TypeIndex",
@@ -47,4 +47,18 @@ export const typeIndexContext: LdoJsonldContext = {
47
47
  },
48
48
  },
49
49
  },
50
+ forClass: {
51
+ "@id": "http://www.w3.org/ns/solid/terms#forClass",
52
+ "@type": "@id",
53
+ },
54
+ instance: {
55
+ "@id": "http://www.w3.org/ns/solid/terms#instance",
56
+ "@type": "@id",
57
+ "@isCollection": true,
58
+ },
59
+ instanceContainer: {
60
+ "@id": "http://www.w3.org/ns/solid/terms#instanceContainer",
61
+ "@type": "@id",
62
+ "@isCollection": true,
63
+ },
50
64
  };
@@ -1,7 +1,7 @@
1
1
  import { ShapeType } from "@ldo/ldo";
2
- import { typeIndexSchema } from "./typeIndex.schema";
3
- import { typeIndexContext } from "./typeIndex.context";
4
- import { TypeIndexDocument, TypeRegistration } from "./typeIndex.typings";
2
+ import { typeIndexSchema } from "./typeIndex.schema.js";
3
+ import { typeIndexContext } from "./typeIndex.context.js";
4
+ import { TypeIndexDocument, TypeRegistration } from "./typeIndex.typings.js";
5
5
 
6
6
  /**
7
7
  * =============================================================================
@@ -1,4 +1,4 @@
1
- import { ContextDefinition } from "jsonld";
1
+ import { LdoJsonldContext, LdSet } from "@ldo/ldo";
2
2
 
3
3
  /**
4
4
  * =============================================================================
@@ -11,18 +11,18 @@ import { ContextDefinition } from "jsonld";
11
11
  */
12
12
  export interface TypeIndexDocument {
13
13
  "@id"?: string;
14
- "@context"?: ContextDefinition;
14
+ "@context"?: LdoJsonldContext;
15
15
  /**
16
16
  * Defines the node as a TypeIndex | Defines the node as a Listed Document
17
17
  */
18
- type: (
18
+ type: LdSet<
19
19
  | {
20
20
  "@id": "TypeIndex";
21
21
  }
22
22
  | {
23
23
  "@id": "ListedDocument";
24
24
  }
25
- )[];
25
+ >;
26
26
  }
27
27
 
28
28
  /**
@@ -30,7 +30,7 @@ export interface TypeIndexDocument {
30
30
  */
31
31
  export interface TypeRegistration {
32
32
  "@id"?: string;
33
- "@context"?: ContextDefinition;
33
+ "@context"?: LdoJsonldContext;
34
34
  /**
35
35
  * Defines this node as a Type Registration
36
36
  */
@@ -46,13 +46,13 @@ export interface TypeRegistration {
46
46
  /**
47
47
  * A specific resource that contains the class.
48
48
  */
49
- instance?: {
49
+ instance?: LdSet<{
50
50
  "@id": string;
51
- }[];
51
+ }>;
52
52
  /**
53
53
  * Containers that contain resources with the class.
54
54
  */
55
- instanceContainer?: {
55
+ instanceContainer?: LdSet<{
56
56
  "@id": string;
57
- }[];
57
+ }>;
58
58
  }
@@ -1,16 +1,17 @@
1
- import type { ContainerUri, LeafUri } from "@ldo/solid";
2
- import type { TypeRegistration } from "./.ldo/typeIndex.typings";
3
- import type { TypeIndexProfile } from "./.ldo/profile.typings";
4
- import { TypeIndexProfileShapeType } from "./.ldo/profile.shapeTypes";
5
- import { TypeRegistrationShapeType } from "./.ldo/typeIndex.shapeTypes";
6
- import { RDF_TYPE, TYPE_REGISTRATION } from "./constants";
7
- import type { Options } from "./util/Options";
8
- import { guaranteeOptions } from "./util/Options";
1
+ import type { TypeRegistration } from "./.ldo/typeIndex.typings.js";
2
+ import type { TypeIndexProfile } from "./.ldo/profile.typings.js";
3
+ import { TypeIndexProfileShapeType } from "./.ldo/profile.shapeTypes.js";
4
+ import { TypeRegistrationShapeType } from "./.ldo/typeIndex.shapeTypes.js";
5
+ import { RDF_TYPE, TYPE_REGISTRATION } from "./constants.js";
6
+ import type { Options } from "./util/Options.js";
7
+ import { guaranteeOptions } from "./util/Options.js";
8
+ import type { LdSet } from "@ldo/ldo";
9
+ import type { SolidContainerUri, SolidLeafUri } from "@ldo/connected-solid";
9
10
 
10
11
  export async function getTypeRegistrations(
11
12
  webId: string,
12
13
  options?: Options,
13
- ): Promise<TypeRegistration[]> {
14
+ ): Promise<LdSet<TypeRegistration>> {
14
15
  const { dataset } = guaranteeOptions(options);
15
16
 
16
17
  // Get Profile
@@ -47,13 +48,13 @@ export async function getProfile(
47
48
 
48
49
  export function getTypeIndexesUrisFromProfile(
49
50
  profile: TypeIndexProfile,
50
- ): LeafUri[] {
51
- const uris: LeafUri[] = [];
51
+ ): SolidLeafUri[] {
52
+ const uris: SolidLeafUri[] = [];
52
53
  profile.privateTypeIndex?.forEach((indexNode) => {
53
- uris.push(indexNode["@id"] as LeafUri);
54
+ uris.push(indexNode["@id"] as SolidLeafUri);
54
55
  });
55
56
  profile.publicTypeIndex?.forEach((indexNode) => {
56
- uris.push(indexNode["@id"] as LeafUri);
57
+ uris.push(indexNode["@id"] as SolidLeafUri);
57
58
  });
58
59
  return uris;
59
60
  }
@@ -62,26 +63,26 @@ export async function getInstanceUris(
62
63
  classUri: string,
63
64
  typeRegistrations: TypeRegistration[],
64
65
  options?: Options,
65
- ): Promise<LeafUri[]> {
66
+ ): Promise<SolidLeafUri[]> {
66
67
  const { dataset } = guaranteeOptions(options);
67
68
 
68
- const leafUris = new Set<LeafUri>();
69
+ const leafUris = new Set<SolidLeafUri>();
69
70
  await Promise.all(
70
71
  typeRegistrations.map(async (registration) => {
71
72
  if (registration.forClass["@id"] === classUri) {
72
73
  // Individual registrations
73
74
  registration.instance?.forEach((instance) =>
74
- leafUris.add(instance["@id"] as LeafUri),
75
+ leafUris.add(instance["@id"] as SolidLeafUri),
75
76
  );
76
77
  // Container registrations
77
78
  await Promise.all(
78
79
  registration.instanceContainer?.map(async (instanceContainer) => {
79
80
  const containerResource = dataset.getResource(
80
- instanceContainer["@id"] as ContainerUri,
81
+ instanceContainer["@id"] as SolidContainerUri,
81
82
  );
82
83
  await containerResource.readIfUnfetched();
83
84
  containerResource.children().forEach((child) => {
84
- if (child.type === "leaf") leafUris.add(child.uri);
85
+ if (child.type === "SolidLeaf") leafUris.add(child.uri);
85
86
  });
86
87
  }) ?? [],
87
88
  );
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from "./getTypeIndex";
2
- export * from "./setTypeIndex";
3
- export * from "./react/useInstanceUris";
4
- export * from "./react/useTypeIndexProfile";
1
+ export * from "./getTypeIndex.js";
2
+ export * from "./setTypeIndex.js";
3
+ export * from "./react/useInstanceUris.js";
4
+ export * from "./react/useTypeIndexProfile.js";
@@ -1,14 +1,14 @@
1
- import type { LeafUri } from "@ldo/solid";
2
- import { useTypeIndexProfile } from "./useTypeIndexProfile";
1
+ import { useTypeIndexProfile } from "./useTypeIndexProfile.js";
3
2
  import { useEffect, useMemo, useState } from "react";
4
- import { useSubscribeToUris } from "./util/useSubscribeToUris";
3
+ import { useSubscribeToUris } from "./util/useSubscribeToUris.js";
5
4
  import { useLdo, useMatchSubject } from "@ldo/solid-react";
6
- import { TypeRegistrationShapeType } from "../.ldo/typeIndex.shapeTypes";
7
- import { RDF_TYPE, TYPE_REGISTRATION } from "../constants";
5
+ import { TypeRegistrationShapeType } from "../.ldo/typeIndex.shapeTypes.js";
6
+ import { RDF_TYPE, TYPE_REGISTRATION } from "../constants.js";
8
7
  import {
9
8
  getInstanceUris,
10
9
  getTypeIndexesUrisFromProfile,
11
- } from "../getTypeIndex";
10
+ } from "../getTypeIndex.js";
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): LeafUri[] {
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<LeafUri[]>([]);
30
+ const [leafUris, setLeafUris] = useState<SolidLeafUri[]>([]);
31
31
 
32
32
  const typeRegistrations = useMatchSubject(
33
33
  TypeRegistrationShapeType,
@@ -36,7 +36,9 @@ export function useInstanceUris(classUri: string): LeafUri[] {
36
36
  );
37
37
 
38
38
  useEffect(() => {
39
- getInstanceUris(classUri, typeRegistrations, {
39
+ getInstanceUris(classUri, typeRegistrations.toArray(), {
40
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
41
+ // @ts-ignore TODO: come back and see if we can fix this
40
42
  solidLdoDataset: dataset,
41
43
  }).then(setLeafUris);
42
44
  }, [typeRegistrations]);
@@ -1,6 +1,6 @@
1
1
  import { useResource, useSolidAuth, useSubject } from "@ldo/solid-react";
2
- import type { TypeIndexProfile } from "../.ldo/profile.typings";
3
- import { TypeIndexProfileShapeType } from "../.ldo/profile.shapeTypes";
2
+ import type { TypeIndexProfile } from "../.ldo/profile.typings.js";
3
+ import { TypeIndexProfileShapeType } from "../.ldo/profile.shapeTypes.js";
4
4
 
5
5
  export function useTypeIndexProfile(): TypeIndexProfile | undefined {
6
6
  const { session } = useSolidAuth();
@@ -1,17 +1,24 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1
2
  import { v4 } from "uuid";
3
+ import { FOR_CLASS, RDF_TYPE, TYPE_REGISTRATION } from "./constants.js";
4
+ import { guaranteeOptions, type Options } from "./util/Options.js";
5
+ import { namedNode, quad } from "@rdfjs/data-model";
6
+ import type { TypeRegistration } from "./.ldo/typeIndex.typings.js";
7
+ import { getProfile } from "./getTypeIndex.js";
8
+ import { TypeIndexProfileShapeType } from "./.ldo/profile.shapeTypes.js";
9
+ import type { NamedNode } from "@rdfjs/types";
10
+ import { set } from "@ldo/ldo";
11
+ import type {
12
+ SolidConnectedPlugin,
13
+ SolidContainer,
14
+ SolidContainerUri,
15
+ SolidLeafUri,
16
+ } from "@ldo/connected-solid";
17
+ import type { ConnectedLdoDataset, ConnectedPlugin } from "@ldo/connected";
2
18
  import {
3
19
  TypeIndexDocumentShapeType,
4
20
  TypeRegistrationShapeType,
5
- } from "./.ldo/typeIndex.shapeTypes";
6
- import { FOR_CLASS, RDF_TYPE, TYPE_REGISTRATION } from "./constants";
7
- import { guaranteeOptions, type Options } from "./util/Options";
8
- import { namedNode, quad } from "@rdfjs/data-model";
9
- import type { TypeRegistration } from "./.ldo/typeIndex.typings";
10
- import { getProfile } from "./getTypeIndex";
11
- import { TypeIndexProfileShapeType } from "./.ldo/profile.shapeTypes";
12
- import type { Container } from "@ldo/solid";
13
- import type { ISolidLdoDataset } from "@ldo/solid";
14
- import type { NamedNode } from "@rdfjs/types";
21
+ } from "./.ldo/typeIndex.shapeTypes.js";
15
22
 
16
23
  /**
17
24
  * =============================================================================
@@ -24,15 +31,17 @@ export async function initTypeIndex(
24
31
  ): Promise<void> {
25
32
  const { dataset } = guaranteeOptions(options);
26
33
  const profile = await getProfile(webId, options);
27
- if (!profile.privateTypeIndex?.length || !profile.publicTypeIndex?.length) {
28
- const profileFolder = await dataset.getResource(webId).getParentContainer();
34
+ if (!profile.privateTypeIndex?.size || !profile.publicTypeIndex?.size) {
35
+ const profileFolder = await dataset
36
+ .getResource(webId as SolidLeafUri | SolidContainerUri)
37
+ .getParentContainer();
29
38
  if (profileFolder?.isError) throw profileFolder;
30
39
  if (!profileFolder)
31
40
  throw new Error("No folder to save the type indexes to.");
32
- if (!profile.privateTypeIndex?.length) {
41
+ if (!profile.privateTypeIndex?.size) {
33
42
  await createIndex(webId, profileFolder, dataset, true);
34
43
  }
35
- if (!profile.publicTypeIndex?.length) {
44
+ if (!profile.publicTypeIndex?.size) {
36
45
  await createIndex(webId, profileFolder, dataset, false);
37
46
  }
38
47
  }
@@ -46,8 +55,10 @@ export async function initTypeIndex(
46
55
  */
47
56
  export async function createIndex(
48
57
  webId,
49
- profileFolder: Container,
50
- dataset: ISolidLdoDataset,
58
+ profileFolder: SolidContainer,
59
+ dataset: ConnectedLdoDataset<
60
+ (SolidConnectedPlugin | ConnectedPlugin<any, any, any, any>)[]
61
+ >,
51
62
  isPrivate: boolean,
52
63
  ) {
53
64
  // Create a private type index
@@ -80,17 +91,17 @@ export async function createIndex(
80
91
  .write(dataset.getResource(webId).uri)
81
92
  .fromSubject(webId);
82
93
  if (isPrivate) {
83
- cProfile.privateTypeIndex?.push({ "@id": indexResource.uri });
94
+ cProfile.privateTypeIndex?.add({ "@id": indexResource.uri });
84
95
  } else {
85
- cProfile.publicTypeIndex?.push({ "@id": indexResource.uri });
96
+ cProfile.publicTypeIndex?.add({ "@id": indexResource.uri });
86
97
  }
87
98
  const cTypeIndex = transaction
88
99
  .usingType(TypeIndexDocumentShapeType)
89
100
  .write(indexResource.uri)
90
101
  .fromSubject(indexResource.uri);
91
102
 
92
- cTypeIndex.type = [{ "@id": "ListedDocument" }, { "@id": "TypeIndex" }];
93
- const commitResult = await transaction.commitToPod();
103
+ cTypeIndex.type = set({ "@id": "ListedDocument" }, { "@id": "TypeIndex" });
104
+ const commitResult = await transaction.commitToRemote();
94
105
  if (commitResult.isError) throw commitResult;
95
106
  }
96
107
 
@@ -104,6 +115,13 @@ interface Instances {
104
115
  instanceContainer?: string[];
105
116
  }
106
117
 
118
+ /**
119
+ * Adds an instance to a TypeRegistration
120
+ * @param indexUri The URI of the TypeIndex
121
+ * @param classUri The URI for the class the instance should be added to
122
+ * @param instances Objects representing the instances to add
123
+ * @param options Options
124
+ */
107
125
  export function addRegistration(
108
126
  indexUri: string,
109
127
  classUri: string,
@@ -119,13 +137,20 @@ export function addRegistration(
119
137
 
120
138
  // Add instances to type registration
121
139
  instances.instance?.forEach((instance) => {
122
- typeRegistration.instance?.push({ "@id": instance });
140
+ typeRegistration.instance?.add({ "@id": instance });
123
141
  });
124
142
  instances.instanceContainer?.forEach((instanceContainer) => {
125
- typeRegistration.instanceContainer?.push({ "@id": instanceContainer });
143
+ typeRegistration.instanceContainer?.add({ "@id": instanceContainer });
126
144
  });
127
145
  }
128
146
 
147
+ /**
148
+ * Removes instances from a TypeRegistration
149
+ * @param indexUri The URI of the TypeIndex
150
+ * @param classUri The URI for the class the instance should be removed from
151
+ * @param instances Objects representing the instances to remove
152
+ * @param options Options
153
+ */
129
154
  export async function removeRegistration(
130
155
  indexUri: string,
131
156
  classUri: string,
@@ -139,31 +164,28 @@ export async function removeRegistration(
139
164
  options,
140
165
  );
141
166
 
142
- console.log(typeRegistration["@id"]);
143
-
144
167
  // Add instances to type registration
145
- instances.instance?.forEach((instance) => {
146
- typeRegistration.instance?.splice(
147
- typeRegistration.instance.findIndex((val) => val["@id"] === instance),
148
- 1,
149
- );
168
+ instances.instance?.forEach((instanceUri) => {
169
+ typeRegistration.instance?.delete({ "@id": instanceUri });
150
170
  });
151
- instances.instanceContainer?.forEach((instanceContainer) => {
152
- console.log("Splicing instanceContainers", instanceContainer);
153
- typeRegistration.instanceContainer?.splice(
154
- typeRegistration.instanceContainer.findIndex(
155
- (val) => val["@id"] === instanceContainer,
156
- ),
157
- 1,
158
- );
171
+ instances.instanceContainer?.forEach((instanceContainerUri) => {
172
+ typeRegistration.instanceContainer?.delete({ "@id": instanceContainerUri });
159
173
  });
160
174
  }
161
175
 
176
+ /**
177
+ * Finds a TypeRegistration inside of a type index. If it doesn't exist, it
178
+ * creates one.
179
+ * @param indexUri The URI of the typeIndex
180
+ * @param classUri The URI of the class in question for the TypeRegistration
181
+ * @param options
182
+ * @returns The Type Index
183
+ */
162
184
  export function findAppropriateTypeRegistration(
163
185
  indexUri: string,
164
186
  classUri: string,
165
187
  options?: Options,
166
- ) {
188
+ ): TypeRegistration {
167
189
  const { dataset } = guaranteeOptions(options);
168
190
  // Check to see if its already in the index
169
191
  const existingRegistrationsUris: NamedNode[] = dataset
@@ -1,14 +1,17 @@
1
- import { createSolidLdoDataset } from "@ldo/solid";
2
- import type { ISolidLdoDataset } from "@ldo/solid";
3
- import { guaranteeFetch } from "@ldo/solid/dist/util/guaranteeFetch";
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
- solidLdoDataset?: ISolidLdoDataset;
7
+ solidLdoDataset?: IConnectedLdoDataset<SolidConnectedPlugin[]>;
7
8
  fetch?: typeof fetch;
8
9
  }
9
10
 
10
11
  export function guaranteeOptions(options?: Options) {
11
12
  const fetch = guaranteeFetch(options?.fetch);
12
- const dataset = options?.solidLdoDataset ?? createSolidLdoDataset({ fetch });
13
+ const dataset = (options?.solidLdoDataset ??
14
+ createSolidLdoDataset()) as ConnectedLdoDataset<SolidConnectedPlugin[]>;
15
+ dataset.setContext("solid", { fetch });
13
16
  return { fetch, dataset };
14
17
  }
@@ -1,2 +0,0 @@
1
- import { LdoJsonldContext } from "@ldo/jsonld-dataset-proxy";
2
- export declare const profileContext: LdoJsonldContext;
@@ -1 +0,0 @@
1
- {"version":3,"file":"profile.context.js","sourceRoot":"","sources":["../../src/.ldo/profile.context.ts"],"names":[],"mappings":";;;AAOa,QAAA,cAAc,GAAqB;IAC9C,gBAAgB,EAAE;QAChB,KAAK,EAAE,mDAAmD;QAC1D,OAAO,EAAE,KAAK;QACd,eAAe,EAAE,IAAI;KACtB;IACD,eAAe,EAAE;QACf,KAAK,EAAE,kDAAkD;QACzD,OAAO,EAAE,KAAK;QACd,eAAe,EAAE,IAAI;KACtB;CACF,CAAC"}
@@ -1,2 +0,0 @@
1
- import { Schema } from "shexj";
2
- export declare const profileSchema: Schema;
@@ -1 +0,0 @@
1
- {"version":3,"file":"profile.schema.js","sourceRoot":"","sources":["../../src/.ldo/profile.schema.ts"],"names":[],"mappings":";;;AAOa,QAAA,aAAa,GAAW;IACnC,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE;QACN;YACE,EAAE,EAAE,6DAA6D;YACjE,IAAI,EAAE,WAAW;YACjB,SAAS,EAAE;gBACT,IAAI,EAAE,OAAO;gBACb,UAAU,EAAE;oBACV,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE;wBACX;4BACE,IAAI,EAAE,kBAAkB;4BACxB,SAAS,EAAE,mDAAmD;4BAC9D,SAAS,EAAE;gCACT,IAAI,EAAE,gBAAgB;gCACtB,QAAQ,EAAE,KAAK;6BAChB;4BACD,GAAG,EAAE,CAAC;4BACN,GAAG,EAAE,CAAC,CAAC;4BACP,WAAW,EAAE;gCACX;oCACE,IAAI,EAAE,YAAY;oCAClB,SAAS,EAAE,8CAA8C;oCACzD,MAAM,EAAE;wCACN,KAAK,EACH,0EAA0E;qCAC7E;iCACF;6BACF;yBACF;wBACD;4BACE,IAAI,EAAE,kBAAkB;4BACxB,SAAS,EAAE,kDAAkD;4BAC7D,SAAS,EAAE;gCACT,IAAI,EAAE,gBAAgB;gCACtB,QAAQ,EAAE,KAAK;6BAChB;4BACD,GAAG,EAAE,CAAC;4BACN,GAAG,EAAE,CAAC,CAAC;4BACP,WAAW,EAAE;gCACX;oCACE,IAAI,EAAE,YAAY;oCAClB,SAAS,EAAE,8CAA8C;oCACzD,MAAM,EAAE;wCACN,KAAK,EACH,oEAAoE;qCACvE;iCACF;6BACF;yBACF;qBACF;iBACF;aACF;SACF;KACF;CACF,CAAC"}
@@ -1,3 +0,0 @@
1
- import { ShapeType } from "@ldo/ldo";
2
- import { TypeIndexProfile } from "./profile.typings";
3
- export declare const TypeIndexProfileShapeType: ShapeType<TypeIndexProfile>;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TypeIndexProfileShapeType = void 0;
4
- const profile_schema_1 = require("./profile.schema");
5
- const profile_context_1 = require("./profile.context");
6
- exports.TypeIndexProfileShapeType = {
7
- schema: profile_schema_1.profileSchema,
8
- shape: "https://shaperepo.com/schemas/solidProfile#TypeIndexProfile",
9
- context: profile_context_1.profileContext,
10
- };
11
- //# sourceMappingURL=profile.shapeTypes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"profile.shapeTypes.js","sourceRoot":"","sources":["../../src/.ldo/profile.shapeTypes.ts"],"names":[],"mappings":";;;AACA,qDAAiD;AACjD,uDAAmD;AAYtC,QAAA,yBAAyB,GAAgC;IACpE,MAAM,EAAE,8BAAa;IACrB,KAAK,EAAE,6DAA6D;IACpE,OAAO,EAAE,gCAAc;CACxB,CAAC"}
@@ -1,11 +0,0 @@
1
- import { ContextDefinition } from "jsonld";
2
- export interface TypeIndexProfile {
3
- "@id"?: string;
4
- "@context"?: ContextDefinition;
5
- privateTypeIndex?: {
6
- "@id": string;
7
- }[];
8
- publicTypeIndex?: {
9
- "@id": string;
10
- }[];
11
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"profile.typings.js","sourceRoot":"","sources":["../../src/.ldo/profile.typings.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- import { LdoJsonldContext } from "@ldo/jsonld-dataset-proxy";
2
- export declare const typeIndexContext: LdoJsonldContext;
@@ -1 +0,0 @@
1
- {"version":3,"file":"typeIndex.context.js","sourceRoot":"","sources":["../../src/.ldo/typeIndex.context.ts"],"names":[],"mappings":";;;AAOa,QAAA,gBAAgB,GAAqB;IAChD,IAAI,EAAE;QACJ,KAAK,EAAE,OAAO;KACf;IACD,SAAS,EAAE;QACT,KAAK,EAAE,4CAA4C;QACnD,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,KAAK,EAAE,OAAO;aACf;SACF;KACF;IACD,cAAc,EAAE;QACd,KAAK,EAAE,iDAAiD;QACxD,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,KAAK,EAAE,OAAO;aACf;SACF;KACF;IACD,gBAAgB,EAAE;QAChB,KAAK,EAAE,mDAAmD;QAC1D,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,KAAK,EAAE,OAAO;aACf;YACD,QAAQ,EAAE;gBACR,KAAK,EAAE,2CAA2C;gBAClD,OAAO,EAAE,KAAK;aACf;YACD,QAAQ,EAAE;gBACR,KAAK,EAAE,2CAA2C;gBAClD,OAAO,EAAE,KAAK;gBACd,eAAe,EAAE,IAAI;aACtB;YACD,iBAAiB,EAAE;gBACjB,KAAK,EAAE,oDAAoD;gBAC3D,OAAO,EAAE,KAAK;gBACd,eAAe,EAAE,IAAI;aACtB;SACF;KACF;CACF,CAAC"}
@@ -1,2 +0,0 @@
1
- import { Schema } from "shexj";
2
- export declare const typeIndexSchema: Schema;
@@ -1 +0,0 @@
1
- {"version":3,"file":"typeIndex.schema.js","sourceRoot":"","sources":["../../src/.ldo/typeIndex.schema.ts"],"names":[],"mappings":"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"}
@@ -1,4 +0,0 @@
1
- import { ShapeType } from "@ldo/ldo";
2
- import { TypeIndexDocument, TypeRegistration } from "./typeIndex.typings";
3
- export declare const TypeIndexDocumentShapeType: ShapeType<TypeIndexDocument>;
4
- export declare const TypeRegistrationShapeType: ShapeType<TypeRegistration>;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TypeRegistrationShapeType = exports.TypeIndexDocumentShapeType = void 0;
4
- const typeIndex_schema_1 = require("./typeIndex.schema");
5
- const typeIndex_context_1 = require("./typeIndex.context");
6
- exports.TypeIndexDocumentShapeType = {
7
- schema: typeIndex_schema_1.typeIndexSchema,
8
- shape: "https://shaperepo.com/schemas/solidProfile#TypeIndexDocument",
9
- context: typeIndex_context_1.typeIndexContext,
10
- };
11
- exports.TypeRegistrationShapeType = {
12
- schema: typeIndex_schema_1.typeIndexSchema,
13
- shape: "https://shaperepo.com/schemas/solidProfile#TypeRegistration",
14
- context: typeIndex_context_1.typeIndexContext,
15
- };
16
- //# sourceMappingURL=typeIndex.shapeTypes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typeIndex.shapeTypes.js","sourceRoot":"","sources":["../../src/.ldo/typeIndex.shapeTypes.ts"],"names":[],"mappings":";;;AACA,yDAAqD;AACrD,2DAAuD;AAY1C,QAAA,0BAA0B,GAAiC;IACtE,MAAM,EAAE,kCAAe;IACvB,KAAK,EAAE,8DAA8D;IACrE,OAAO,EAAE,oCAAgB;CAC1B,CAAC;AAKW,QAAA,yBAAyB,GAAgC;IACpE,MAAM,EAAE,kCAAe;IACvB,KAAK,EAAE,6DAA6D;IACpE,OAAO,EAAE,oCAAgB;CAC1B,CAAC"}
@@ -1,26 +0,0 @@
1
- import { ContextDefinition } from "jsonld";
2
- export interface TypeIndexDocument {
3
- "@id"?: string;
4
- "@context"?: ContextDefinition;
5
- type: ({
6
- "@id": "TypeIndex";
7
- } | {
8
- "@id": "ListedDocument";
9
- })[];
10
- }
11
- export interface TypeRegistration {
12
- "@id"?: string;
13
- "@context"?: ContextDefinition;
14
- type: {
15
- "@id": "TypeRegistration";
16
- };
17
- forClass: {
18
- "@id": string;
19
- };
20
- instance?: {
21
- "@id": string;
22
- }[];
23
- instanceContainer?: {
24
- "@id": string;
25
- }[];
26
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"typeIndex.typings.js","sourceRoot":"","sources":["../../src/.ldo/typeIndex.typings.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG,iDAAiD,CAAC;AAC7D,QAAA,iBAAiB,GAC5B,mDAAmD,CAAC;AACzC,QAAA,SAAS,GAAG,2CAA2C,CAAC;AACxD,QAAA,QAAQ,GAAG,2CAA2C,CAAC;AACvD,QAAA,kBAAkB,GAC7B,oDAAoD,CAAC"}
@@ -1,8 +0,0 @@
1
- import type { LeafUri } from "@ldo/solid";
2
- import type { TypeRegistration } from "./.ldo/typeIndex.typings";
3
- import type { TypeIndexProfile } from "./.ldo/profile.typings";
4
- import type { Options } from "./util/Options";
5
- export declare function getTypeRegistrations(webId: string, options?: Options): Promise<TypeRegistration[]>;
6
- export declare function getProfile(webId: string, options?: Options): Promise<TypeIndexProfile>;
7
- export declare function getTypeIndexesUrisFromProfile(profile: TypeIndexProfile): LeafUri[];
8
- export declare function getInstanceUris(classUri: string, typeRegistrations: TypeRegistration[], options?: Options): Promise<LeafUri[]>;
@@ -1 +0,0 @@
1
- {"version":3,"file":"getTypeIndex.js","sourceRoot":"","sources":["../src/getTypeIndex.ts"],"names":[],"mappings":"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"}
package/dist/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from "./getTypeIndex";
2
- export * from "./setTypeIndex";
3
- export * from "./react/useInstanceUris";
4
- export * from "./react/useTypeIndexProfile";
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,iDAA+B;AAC/B,0DAAwC;AACxC,8DAA4C"}
@@ -1,2 +0,0 @@
1
- import type { LeafUri } from "@ldo/solid";
2
- export declare function useInstanceUris(classUri: string): LeafUri[];
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useInstanceUris = void 0;
4
- const useTypeIndexProfile_1 = require("./useTypeIndexProfile");
5
- const react_1 = require("react");
6
- const useSubscribeToUris_1 = require("./util/useSubscribeToUris");
7
- const solid_react_1 = require("@ldo/solid-react");
8
- const typeIndex_shapeTypes_1 = require("../.ldo/typeIndex.shapeTypes");
9
- const constants_1 = require("../constants");
10
- const getTypeIndex_1 = require("../getTypeIndex");
11
- function useInstanceUris(classUri) {
12
- const { dataset } = (0, solid_react_1.useLdo)();
13
- const profile = (0, useTypeIndexProfile_1.useTypeIndexProfile)();
14
- const typeIndexUris = (0, react_1.useMemo)(() => (profile ? (0, getTypeIndex_1.getTypeIndexesUrisFromProfile)(profile) : []), [profile]);
15
- (0, useSubscribeToUris_1.useSubscribeToUris)(typeIndexUris);
16
- const [leafUris, setLeafUris] = (0, react_1.useState)([]);
17
- const typeRegistrations = (0, solid_react_1.useMatchSubject)(typeIndex_shapeTypes_1.TypeRegistrationShapeType, constants_1.RDF_TYPE, constants_1.TYPE_REGISTRATION);
18
- (0, react_1.useEffect)(() => {
19
- (0, getTypeIndex_1.getInstanceUris)(classUri, typeRegistrations, {
20
- solidLdoDataset: dataset,
21
- }).then(setLeafUris);
22
- }, [typeRegistrations]);
23
- return leafUris;
24
- }
25
- exports.useInstanceUris = useInstanceUris;
26
- //# sourceMappingURL=useInstanceUris.js.map