@pod-os/core 0.6.1-4ea2c6e.0 → 0.6.1-5debca1.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
@@ -33511,12 +33511,12 @@ function handleRDFType(formula2, subj, pred, obj, why) {
33511
33511
  return done;
33512
33512
  }
33513
33513
  var IndexedFormula = /* @__PURE__ */ function(_Formula) {
33514
- _inherits(IndexedFormula5, _Formula);
33515
- var _super = _createSuper8(IndexedFormula5);
33516
- function IndexedFormula5(features) {
33514
+ _inherits(IndexedFormula6, _Formula);
33515
+ var _super = _createSuper8(IndexedFormula6);
33516
+ function IndexedFormula6(features) {
33517
33517
  var _this;
33518
33518
  var opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
33519
- _classCallCheck(this, IndexedFormula5);
33519
+ _classCallCheck(this, IndexedFormula6);
33520
33520
  _this = _super.call(this, void 0, void 0, void 0, void 0, opts);
33521
33521
  _defineProperty(_assertThisInitialized(_this), "updater", void 0);
33522
33522
  _defineProperty(_assertThisInitialized(_this), "namespaces", void 0);
@@ -33560,7 +33560,7 @@ var IndexedFormula = /* @__PURE__ */ function(_Formula) {
33560
33560
  _this.initPropertyActions(_this.features);
33561
33561
  return _this;
33562
33562
  }
33563
- _createClass(IndexedFormula5, [{
33563
+ _createClass(IndexedFormula6, [{
33564
33564
  key: "substitute",
33565
33565
  value: (
33566
33566
  /**
@@ -33571,7 +33571,7 @@ var IndexedFormula = /* @__PURE__ */ function(_Formula) {
33571
33571
  var statementsCopy = this.statements.map(function(ea) {
33572
33572
  return ea.substitute(bindings);
33573
33573
  });
33574
- var y = new IndexedFormula5();
33574
+ var y = new IndexedFormula6();
33575
33575
  y.add(statementsCopy);
33576
33576
  return y;
33577
33577
  }
@@ -33971,7 +33971,7 @@ var IndexedFormula = /* @__PURE__ */ function(_Formula) {
33971
33971
  }, {
33972
33972
  key: "formula",
33973
33973
  value: function formula2(features) {
33974
- return new IndexedFormula5(features);
33974
+ return new IndexedFormula6(features);
33975
33975
  }
33976
33976
  /**
33977
33977
  * Returns the number of statements contained in this IndexedFormula.
@@ -34423,7 +34423,7 @@ var IndexedFormula = /* @__PURE__ */ function(_Formula) {
34423
34423
  return defaultGraphURI;
34424
34424
  }
34425
34425
  }]);
34426
- return IndexedFormula5;
34426
+ return IndexedFormula6;
34427
34427
  }(Formula);
34428
34428
  _defineProperty(IndexedFormula, "handleRDFType", void 0);
34429
34429
  IndexedFormula.handleRDFType = handleRDFType;
@@ -39389,6 +39389,30 @@ var RdfDocument = class extends Thing {
39389
39389
  }
39390
39390
  };
39391
39391
 
39392
+ // src/ldp-container/LdpContainer.ts
39393
+ var LdpContainer = class extends Thing {
39394
+ constructor(uri, store) {
39395
+ super(uri, store);
39396
+ this.uri = uri;
39397
+ this.store = store;
39398
+ }
39399
+ contains() {
39400
+ const contains = this.store.statementsMatching(
39401
+ namedNode3(this.uri),
39402
+ namedNode3("http://www.w3.org/ns/ldp#contains"),
39403
+ null,
39404
+ namedNode3(this.uri)
39405
+ );
39406
+ return contains.map((content) => ({
39407
+ uri: content.object.value,
39408
+ name: content.object.value.replace(
39409
+ new RegExp(`${this.uri}([^/]*)/?`),
39410
+ "$1"
39411
+ )
39412
+ }));
39413
+ }
39414
+ };
39415
+
39392
39416
  // src/index.ts
39393
39417
  var PodOS = class {
39394
39418
  constructor() {
@@ -39420,6 +39444,7 @@ export {
39420
39444
  BrokenFile,
39421
39445
  BrowserSession,
39422
39446
  HttpStatus,
39447
+ LdpContainer,
39423
39448
  PodOS,
39424
39449
  RdfDocument,
39425
39450
  Thing
package/lib/index.js CHANGED
@@ -25559,6 +25559,7 @@ ${newlined}
25559
25559
  BrokenFile: () => BrokenFile,
25560
25560
  BrowserSession: () => BrowserSession,
25561
25561
  HttpStatus: () => HttpStatus,
25562
+ LdpContainer: () => LdpContainer,
25562
25563
  PodOS: () => PodOS,
25563
25564
  RdfDocument: () => RdfDocument,
25564
25565
  Thing: () => Thing
@@ -33482,12 +33483,12 @@ ${newlined}
33482
33483
  return done;
33483
33484
  }
33484
33485
  var IndexedFormula = /* @__PURE__ */ function(_Formula) {
33485
- _inherits(IndexedFormula5, _Formula);
33486
- var _super = _createSuper8(IndexedFormula5);
33487
- function IndexedFormula5(features) {
33486
+ _inherits(IndexedFormula6, _Formula);
33487
+ var _super = _createSuper8(IndexedFormula6);
33488
+ function IndexedFormula6(features) {
33488
33489
  var _this;
33489
33490
  var opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
33490
- _classCallCheck(this, IndexedFormula5);
33491
+ _classCallCheck(this, IndexedFormula6);
33491
33492
  _this = _super.call(this, void 0, void 0, void 0, void 0, opts);
33492
33493
  _defineProperty(_assertThisInitialized(_this), "updater", void 0);
33493
33494
  _defineProperty(_assertThisInitialized(_this), "namespaces", void 0);
@@ -33531,7 +33532,7 @@ ${newlined}
33531
33532
  _this.initPropertyActions(_this.features);
33532
33533
  return _this;
33533
33534
  }
33534
- _createClass(IndexedFormula5, [{
33535
+ _createClass(IndexedFormula6, [{
33535
33536
  key: "substitute",
33536
33537
  value: (
33537
33538
  /**
@@ -33542,7 +33543,7 @@ ${newlined}
33542
33543
  var statementsCopy = this.statements.map(function(ea) {
33543
33544
  return ea.substitute(bindings);
33544
33545
  });
33545
- var y = new IndexedFormula5();
33546
+ var y = new IndexedFormula6();
33546
33547
  y.add(statementsCopy);
33547
33548
  return y;
33548
33549
  }
@@ -33942,7 +33943,7 @@ ${newlined}
33942
33943
  }, {
33943
33944
  key: "formula",
33944
33945
  value: function formula2(features) {
33945
- return new IndexedFormula5(features);
33946
+ return new IndexedFormula6(features);
33946
33947
  }
33947
33948
  /**
33948
33949
  * Returns the number of statements contained in this IndexedFormula.
@@ -34394,7 +34395,7 @@ ${newlined}
34394
34395
  return defaultGraphURI;
34395
34396
  }
34396
34397
  }]);
34397
- return IndexedFormula5;
34398
+ return IndexedFormula6;
34398
34399
  }(Formula);
34399
34400
  _defineProperty(IndexedFormula, "handleRDFType", void 0);
34400
34401
  IndexedFormula.handleRDFType = handleRDFType;
@@ -39364,6 +39365,30 @@ ${newlined}
39364
39365
  }
39365
39366
  };
39366
39367
 
39368
+ // src/ldp-container/LdpContainer.ts
39369
+ var LdpContainer = class extends Thing {
39370
+ constructor(uri, store) {
39371
+ super(uri, store);
39372
+ this.uri = uri;
39373
+ this.store = store;
39374
+ }
39375
+ contains() {
39376
+ const contains = this.store.statementsMatching(
39377
+ namedNode3(this.uri),
39378
+ namedNode3("http://www.w3.org/ns/ldp#contains"),
39379
+ null,
39380
+ namedNode3(this.uri)
39381
+ );
39382
+ return contains.map((content) => ({
39383
+ uri: content.object.value,
39384
+ name: content.object.value.replace(
39385
+ new RegExp(`${this.uri}([^/]*)/?`),
39386
+ "$1"
39387
+ )
39388
+ }));
39389
+ }
39390
+ };
39391
+
39367
39392
  // src/index.ts
39368
39393
  var PodOS = class {
39369
39394
  session;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pod-os/core",
3
- "version": "0.6.1-4ea2c6e.0",
3
+ "version": "0.6.1-5debca1.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./types/index.d.ts",
6
6
  "files": [
package/types/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from "./authentication";
5
5
  export * from "./files";
6
6
  export * from "./thing";
7
7
  export * from "./rdf-document";
8
+ export * from "./ldp-container";
8
9
  export declare class PodOS {
9
10
  private readonly session;
10
11
  readonly store: Store;
@@ -0,0 +1,12 @@
1
+ import { IndexedFormula } from "rdflib";
2
+ import { Thing } from "../thing";
3
+ export interface ContainerContent {
4
+ uri: string;
5
+ name: string;
6
+ }
7
+ export declare class LdpContainer extends Thing {
8
+ readonly uri: string;
9
+ readonly store: IndexedFormula;
10
+ constructor(uri: string, store: IndexedFormula);
11
+ contains(): ContainerContent[];
12
+ }
@@ -0,0 +1 @@
1
+ export * from "./LdpContainer";