@pod-os/core 0.4.1-ecc3b86.0 → 0.5.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
@@ -32568,12 +32568,12 @@ function handleRDFType(formula2, subj, pred, obj, why) {
32568
32568
  return done;
32569
32569
  }
32570
32570
  var IndexedFormula = /* @__PURE__ */ function(_Formula) {
32571
- _inherits(IndexedFormula4, _Formula);
32572
- var _super = _createSuper8(IndexedFormula4);
32573
- function IndexedFormula4(features) {
32571
+ _inherits(IndexedFormula5, _Formula);
32572
+ var _super = _createSuper8(IndexedFormula5);
32573
+ function IndexedFormula5(features) {
32574
32574
  var _this;
32575
32575
  var opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
32576
- _classCallCheck(this, IndexedFormula4);
32576
+ _classCallCheck(this, IndexedFormula5);
32577
32577
  _this = _super.call(this, void 0, void 0, void 0, void 0, opts);
32578
32578
  _defineProperty(_assertThisInitialized(_this), "updater", void 0);
32579
32579
  _defineProperty(_assertThisInitialized(_this), "namespaces", void 0);
@@ -32611,13 +32611,13 @@ var IndexedFormula = /* @__PURE__ */ function(_Formula) {
32611
32611
  _this.initPropertyActions(_this.features);
32612
32612
  return _this;
32613
32613
  }
32614
- _createClass(IndexedFormula4, [{
32614
+ _createClass(IndexedFormula5, [{
32615
32615
  key: "substitute",
32616
32616
  value: function substitute(bindings) {
32617
32617
  var statementsCopy = this.statements.map(function(ea) {
32618
32618
  return ea.substitute(bindings);
32619
32619
  });
32620
- var y = new IndexedFormula4();
32620
+ var y = new IndexedFormula5();
32621
32621
  y.add(statementsCopy);
32622
32622
  return y;
32623
32623
  }
@@ -32953,7 +32953,7 @@ var IndexedFormula = /* @__PURE__ */ function(_Formula) {
32953
32953
  }, {
32954
32954
  key: "formula",
32955
32955
  value: function formula2(features) {
32956
- return new IndexedFormula4(features);
32956
+ return new IndexedFormula5(features);
32957
32957
  }
32958
32958
  }, {
32959
32959
  key: "length",
@@ -33289,7 +33289,7 @@ var IndexedFormula = /* @__PURE__ */ function(_Formula) {
33289
33289
  return defaultGraphURI;
33290
33290
  }
33291
33291
  }]);
33292
- return IndexedFormula4;
33292
+ return IndexedFormula5;
33293
33293
  }(Formula);
33294
33294
  _defineProperty(IndexedFormula, "handleRDFType", void 0);
33295
33295
  IndexedFormula.handleRDFType = handleRDFType;
@@ -37936,6 +37936,13 @@ var Thing = class {
37936
37936
  url
37937
37937
  } : null;
37938
37938
  }
37939
+ types() {
37940
+ const uriMap = this.store.findTypeURIs(namedNode3(this.uri));
37941
+ return Object.keys(uriMap);
37942
+ }
37943
+ assume(SpecificThing) {
37944
+ return new SpecificThing(this.uri, this.store);
37945
+ }
37939
37946
  };
37940
37947
 
37941
37948
  // src/Store.ts
@@ -37952,6 +37959,29 @@ var Store = class {
37952
37959
  }
37953
37960
  };
37954
37961
 
37962
+ // src/rdf-document/RdfDocument.ts
37963
+ var RdfDocument = class extends Thing {
37964
+ constructor(uri, store) {
37965
+ super(uri, store);
37966
+ this.uri = uri;
37967
+ this.store = store;
37968
+ }
37969
+ subjects() {
37970
+ const matches = this.store.statementsMatching(
37971
+ null,
37972
+ null,
37973
+ null,
37974
+ namedNode3(this.uri)
37975
+ );
37976
+ const uris = matches.filter((match) => isNamedNode(match.subject)).map((match) => match.subject.value);
37977
+ const uniqueUris = new Set(uris);
37978
+ uniqueUris.delete(this.uri);
37979
+ return [...uniqueUris].map((uri) => ({
37980
+ uri
37981
+ }));
37982
+ }
37983
+ };
37984
+
37955
37985
  // src/index.ts
37956
37986
  var PodOS = class {
37957
37987
  constructor() {
@@ -37984,6 +38014,7 @@ export {
37984
38014
  BrowserSession,
37985
38015
  HttpStatus,
37986
38016
  PodOS,
38017
+ RdfDocument,
37987
38018
  Thing
37988
38019
  };
37989
38020
  /*!
package/lib/index.js CHANGED
@@ -25150,6 +25150,7 @@ ${newlined}
25150
25150
  BrowserSession: () => BrowserSession,
25151
25151
  HttpStatus: () => HttpStatus,
25152
25152
  PodOS: () => PodOS,
25153
+ RdfDocument: () => RdfDocument,
25153
25154
  Thing: () => Thing
25154
25155
  });
25155
25156
 
@@ -32538,12 +32539,12 @@ ${newlined}
32538
32539
  return done;
32539
32540
  }
32540
32541
  var IndexedFormula = /* @__PURE__ */ function(_Formula) {
32541
- _inherits(IndexedFormula4, _Formula);
32542
- var _super = _createSuper8(IndexedFormula4);
32543
- function IndexedFormula4(features) {
32542
+ _inherits(IndexedFormula5, _Formula);
32543
+ var _super = _createSuper8(IndexedFormula5);
32544
+ function IndexedFormula5(features) {
32544
32545
  var _this;
32545
32546
  var opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
32546
- _classCallCheck(this, IndexedFormula4);
32547
+ _classCallCheck(this, IndexedFormula5);
32547
32548
  _this = _super.call(this, void 0, void 0, void 0, void 0, opts);
32548
32549
  _defineProperty(_assertThisInitialized(_this), "updater", void 0);
32549
32550
  _defineProperty(_assertThisInitialized(_this), "namespaces", void 0);
@@ -32581,13 +32582,13 @@ ${newlined}
32581
32582
  _this.initPropertyActions(_this.features);
32582
32583
  return _this;
32583
32584
  }
32584
- _createClass(IndexedFormula4, [{
32585
+ _createClass(IndexedFormula5, [{
32585
32586
  key: "substitute",
32586
32587
  value: function substitute(bindings) {
32587
32588
  var statementsCopy = this.statements.map(function(ea) {
32588
32589
  return ea.substitute(bindings);
32589
32590
  });
32590
- var y = new IndexedFormula4();
32591
+ var y = new IndexedFormula5();
32591
32592
  y.add(statementsCopy);
32592
32593
  return y;
32593
32594
  }
@@ -32923,7 +32924,7 @@ ${newlined}
32923
32924
  }, {
32924
32925
  key: "formula",
32925
32926
  value: function formula2(features) {
32926
- return new IndexedFormula4(features);
32927
+ return new IndexedFormula5(features);
32927
32928
  }
32928
32929
  }, {
32929
32930
  key: "length",
@@ -33259,7 +33260,7 @@ ${newlined}
33259
33260
  return defaultGraphURI;
33260
33261
  }
33261
33262
  }]);
33262
- return IndexedFormula4;
33263
+ return IndexedFormula5;
33263
33264
  }(Formula);
33264
33265
  _defineProperty(IndexedFormula, "handleRDFType", void 0);
33265
33266
  IndexedFormula.handleRDFType = handleRDFType;
@@ -37908,6 +37909,13 @@ ${newlined}
37908
37909
  url
37909
37910
  } : null;
37910
37911
  }
37912
+ types() {
37913
+ const uriMap = this.store.findTypeURIs(namedNode3(this.uri));
37914
+ return Object.keys(uriMap);
37915
+ }
37916
+ assume(SpecificThing) {
37917
+ return new SpecificThing(this.uri, this.store);
37918
+ }
37911
37919
  };
37912
37920
 
37913
37921
  // src/Store.ts
@@ -37926,6 +37934,29 @@ ${newlined}
37926
37934
  }
37927
37935
  };
37928
37936
 
37937
+ // src/rdf-document/RdfDocument.ts
37938
+ var RdfDocument = class extends Thing {
37939
+ constructor(uri, store) {
37940
+ super(uri, store);
37941
+ this.uri = uri;
37942
+ this.store = store;
37943
+ }
37944
+ subjects() {
37945
+ const matches = this.store.statementsMatching(
37946
+ null,
37947
+ null,
37948
+ null,
37949
+ namedNode3(this.uri)
37950
+ );
37951
+ const uris = matches.filter((match) => isNamedNode(match.subject)).map((match) => match.subject.value);
37952
+ const uniqueUris = new Set(uris);
37953
+ uniqueUris.delete(this.uri);
37954
+ return [...uniqueUris].map((uri) => ({
37955
+ uri
37956
+ }));
37957
+ }
37958
+ };
37959
+
37929
37960
  // src/index.ts
37930
37961
  var PodOS = class {
37931
37962
  session;
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@pod-os/core",
3
- "version": "0.4.1-ecc3b86.0",
4
- "main": "./lib/index.js",
5
- "module": "./dist/index.js",
3
+ "version": "0.5.0",
4
+ "main": "./dist/index.js",
6
5
  "types": "./types/index.d.ts",
7
6
  "files": [
8
7
  "lib/",
@@ -16,6 +15,7 @@
16
15
  "build:bundle": "rimraf lib && esbuild src/index.ts --outfile=lib/index.js --bundle --target=esnext --global-name=PodOS",
17
16
  "build:esm": "rimraf dist && esbuild src/index.ts --outdir=dist --bundle --splitting --format=esm",
18
17
  "build:types": "rimraf types && tsc --emitDeclarationOnly --outDir types",
18
+ "build:watch": "npm run build:esm -- --watch",
19
19
  "build": " npm run build:bundle && npm run build:types && npm run build:esm"
20
20
  },
21
21
  "keywords": [
package/types/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import { Store } from "./Store";
4
4
  export * from "./authentication";
5
5
  export * from "./files";
6
6
  export * from "./thing";
7
+ export * from "./rdf-document";
7
8
  export declare class PodOS {
8
9
  private readonly session;
9
10
  readonly store: Store;
@@ -0,0 +1,13 @@
1
+ import { Thing } from "../thing";
2
+ import { IndexedFormula } from "rdflib";
3
+ export interface Subject {
4
+ uri: string;
5
+ }
6
+ export declare class RdfDocument extends Thing {
7
+ readonly uri: string;
8
+ readonly store: IndexedFormula;
9
+ constructor(uri: string, store: IndexedFormula);
10
+ subjects(): {
11
+ uri: string;
12
+ }[];
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from './RdfDocument';
@@ -1,25 +1,26 @@
1
1
  import { IndexedFormula } from "rdflib";
2
+ export interface Literal {
3
+ predicate: string;
4
+ values: string[];
5
+ }
6
+ export interface Relation {
7
+ predicate: string;
8
+ uris: string[];
9
+ }
2
10
  export declare class Thing {
3
11
  readonly uri: string;
4
12
  readonly store: IndexedFormula;
5
13
  constructor(uri: string, store: IndexedFormula);
6
14
  label(): string;
7
- literals(): {
8
- predicate: string;
9
- values: string[];
10
- }[];
11
- relations(): {
12
- predicate: string;
13
- uris: string[];
14
- }[];
15
- reverseRelations(): {
16
- predicate: string;
17
- uris: string[];
18
- }[];
15
+ literals(): Literal[];
16
+ relations(): Relation[];
17
+ reverseRelations(): Relation[];
19
18
  anyValue(...predicateUris: string[]): undefined;
20
19
  description(): undefined;
21
20
  picture(): {
22
21
  url: string;
23
22
  } | null;
24
23
  private findActivityStreamsPicture;
24
+ types(): string[];
25
+ assume<T>(SpecificThing: new (uri: string, store: IndexedFormula) => T): T;
25
26
  }
@@ -0,0 +1 @@
1
+ export {};