@pod-os/core 0.23.0 → 0.23.1-rc.6a1e28c.0

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/index.js CHANGED
@@ -26713,6 +26713,52 @@ var AnonymousSession = class {
26713
26713
  }
26714
26714
  };
26715
26715
 
26716
+ // src/type-index/TypeIndex.ts
26717
+ var TypeIndex2 = class extends Thing {
26718
+ constructor(uri6, store, editable = false) {
26719
+ super(uri6, store, editable);
26720
+ this.uri = uri6;
26721
+ this.store = store;
26722
+ this.editable = editable;
26723
+ }
26724
+ listAll() {
26725
+ const forClassStatements = this.store.statementsMatching(
26726
+ null,
26727
+ solid("forClass"),
26728
+ null,
26729
+ namedNode(this.uri)
26730
+ );
26731
+ return forClassStatements.map((statement2) => {
26732
+ const subject8 = statement2.subject;
26733
+ const instanceContainerStatements = this.store.statementsMatching(
26734
+ subject8,
26735
+ solid("instanceContainer"),
26736
+ null,
26737
+ namedNode(this.uri)
26738
+ );
26739
+ const instanceStatements = this.store.statementsMatching(
26740
+ subject8,
26741
+ solid("instance"),
26742
+ null,
26743
+ namedNode(this.uri)
26744
+ );
26745
+ const instances2 = instanceStatements.map((it) => ({
26746
+ type: "instance",
26747
+ uri: it.object.value
26748
+ }));
26749
+ const instanceContainers = instanceContainerStatements.map((it) => ({
26750
+ type: "container",
26751
+ uri: it.object.value
26752
+ }));
26753
+ return {
26754
+ targets: [...instanceContainers, ...instances2],
26755
+ forClass: statement2.object.value,
26756
+ label: labelForType(statement2.object.value)
26757
+ };
26758
+ });
26759
+ }
26760
+ };
26761
+
26716
26762
  // src/index.ts
26717
26763
  var PodOS = class {
26718
26764
  constructor({
@@ -26861,6 +26907,7 @@ export {
26861
26907
  SearchIndex,
26862
26908
  Store,
26863
26909
  Thing,
26910
+ TypeIndex2 as TypeIndex,
26864
26911
  UriService,
26865
26912
  WebIdProfile,
26866
26913
  createPictureLinkOperation,
package/lib/index.js CHANGED
@@ -34759,6 +34759,7 @@ _:patch
34759
34759
  SearchIndex: () => SearchIndex,
34760
34760
  Store: () => Store,
34761
34761
  Thing: () => Thing,
34762
+ TypeIndex: () => TypeIndex2,
34762
34763
  UriService: () => UriService,
34763
34764
  WebIdProfile: () => WebIdProfile,
34764
34765
  createPictureLinkOperation: () => createPictureLinkOperation,
@@ -59707,6 +59708,53 @@ _:patch
59707
59708
  }
59708
59709
  };
59709
59710
 
59711
+ // src/type-index/TypeIndex.ts
59712
+ init_esm();
59713
+ var TypeIndex2 = class extends Thing {
59714
+ constructor(uri6, store, editable = false) {
59715
+ super(uri6, store, editable);
59716
+ this.uri = uri6;
59717
+ this.store = store;
59718
+ this.editable = editable;
59719
+ }
59720
+ listAll() {
59721
+ const forClassStatements = this.store.statementsMatching(
59722
+ null,
59723
+ solid2("forClass"),
59724
+ null,
59725
+ namedNode(this.uri)
59726
+ );
59727
+ return forClassStatements.map((statement2) => {
59728
+ const subject8 = statement2.subject;
59729
+ const instanceContainerStatements = this.store.statementsMatching(
59730
+ subject8,
59731
+ solid2("instanceContainer"),
59732
+ null,
59733
+ namedNode(this.uri)
59734
+ );
59735
+ const instanceStatements = this.store.statementsMatching(
59736
+ subject8,
59737
+ solid2("instance"),
59738
+ null,
59739
+ namedNode(this.uri)
59740
+ );
59741
+ const instances2 = instanceStatements.map((it) => ({
59742
+ type: "instance",
59743
+ uri: it.object.value
59744
+ }));
59745
+ const instanceContainers = instanceContainerStatements.map((it) => ({
59746
+ type: "container",
59747
+ uri: it.object.value
59748
+ }));
59749
+ return {
59750
+ targets: [...instanceContainers, ...instances2],
59751
+ forClass: statement2.object.value,
59752
+ label: labelForType(statement2.object.value)
59753
+ };
59754
+ });
59755
+ }
59756
+ };
59757
+
59710
59758
  // src/index.ts
59711
59759
  var PodOS = class {
59712
59760
  constructor({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pod-os/core",
3
3
  "description": "Core module of PodOS",
4
- "version": "0.23.0",
4
+ "version": "0.23.1-rc.6a1e28c.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./types/index.d.ts",
package/types/index.d.ts CHANGED
@@ -26,6 +26,7 @@ export * from "./terms";
26
26
  export * from "./Store";
27
27
  export * from "./uri";
28
28
  export * from "./problems";
29
+ export * from "./type-index";
29
30
  export interface PodOsConfiguration {
30
31
  offlineCache?: OfflineCache;
31
32
  onlineStatus?: OnlineStatus;
@@ -6,6 +6,10 @@ export interface TypeRegistration {
6
6
  * RDF class of the indexed item(s) (resembling terms:forClass)
7
7
  */
8
8
  forClass: string;
9
+ /**
10
+ * Short label for the class URI
11
+ */
12
+ label: string;
9
13
  /**
10
14
  * The containers or things this registration points to
11
15
  */
@@ -1 +1,2 @@
1
1
  export { TypeIndex } from "./TypeIndex";
2
+ export { TypeRegistration } from "./TypeRegistration";