@muze-nl/jsfs-solid 0.4.0 → 0.4.2

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/browser.js CHANGED
@@ -1785,7 +1785,7 @@
1785
1785
  function numberIsNaN(obj) {
1786
1786
  return obj !== obj;
1787
1787
  }
1788
- var hexSliceLookupTable = function() {
1788
+ var hexSliceLookupTable = (function() {
1789
1789
  const alphabet = "0123456789abcdef";
1790
1790
  const table = new Array(256);
1791
1791
  for (let i = 0; i < 16; ++i) {
@@ -1795,7 +1795,7 @@
1795
1795
  }
1796
1796
  }
1797
1797
  return table;
1798
- }();
1798
+ })();
1799
1799
  function defineBigIntMethod(fn) {
1800
1800
  return typeof BigInt === "undefined" ? BufferBigIntNotDefined : fn;
1801
1801
  }
@@ -6465,7 +6465,7 @@
6465
6465
  const ac = new AbortController();
6466
6466
  const signal = ac.signal;
6467
6467
  const value = fn(
6468
- async function* () {
6468
+ (async function* () {
6469
6469
  while (true) {
6470
6470
  const _promise = promise;
6471
6471
  promise = null;
@@ -6479,7 +6479,7 @@
6479
6479
  ({ promise, resolve } = createDeferredPromise());
6480
6480
  yield chunk;
6481
6481
  }
6482
- }(),
6482
+ })(),
6483
6483
  {
6484
6484
  signal
6485
6485
  }
@@ -8408,7 +8408,7 @@
8408
8408
  options = Object.assign({}, this.clientOptions, options);
8409
8409
  let next;
8410
8410
  for (let middleware of middlewares) {
8411
- next = /* @__PURE__ */ function(next2, middleware2) {
8411
+ next = /* @__PURE__ */ (function(next2, middleware2) {
8412
8412
  return async function(req2) {
8413
8413
  let res;
8414
8414
  let tracers = Object.values(_Client.tracers);
@@ -8425,7 +8425,7 @@
8425
8425
  }
8426
8426
  return res;
8427
8427
  };
8428
- }(next, middleware);
8428
+ })(next, middleware);
8429
8429
  }
8430
8430
  return next(req);
8431
8431
  }
@@ -9139,6 +9139,8 @@
9139
9139
 
9140
9140
  // node_modules/@muze-nl/metro/src/api.mjs
9141
9141
  var API = class extends Client {
9142
+ #methods = null;
9143
+ #base = "";
9142
9144
  constructor(base, methods, bind = null) {
9143
9145
  if (base instanceof Client) {
9144
9146
  super(base.clientOptions, throwermw(), getdatamw());
@@ -9148,16 +9150,21 @@
9148
9150
  if (!bind) {
9149
9151
  bind = this;
9150
9152
  }
9153
+ this.#methods = methods;
9154
+ this.#base = base;
9151
9155
  for (const methodName in methods) {
9152
9156
  if (typeof methods[methodName] == "function") {
9153
9157
  this[methodName] = methods[methodName].bind(bind);
9154
- } else if (methods[methodName] && typeof methods[methodName] == "object") {
9158
+ } else if (methods[methodName] && typeof methods[methodName] == "object" && (Object.getPrototypeOf(methods[methodName]) === null || Object.getPrototypeOf(methods[methodName]).constructor === Object)) {
9155
9159
  this[methodName] = new this.constructor(base, methods[methodName], bind);
9156
9160
  } else {
9157
9161
  this[methodName] = methods[methodName];
9158
9162
  }
9159
9163
  }
9160
9164
  }
9165
+ extend(methods) {
9166
+ return new this.constructor(this.#base, Object.assign({}, this.#methods, methods));
9167
+ }
9161
9168
  };
9162
9169
  var JsonAPI = class extends API {
9163
9170
  constructor(base, methods, bind = null) {
@@ -10759,10 +10766,24 @@
10759
10766
  }
10760
10767
  var rdfType = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
10761
10768
  var prefixes = {
10769
+ acl: "http://www.w3.org/ns/auth/acl#",
10770
+ acp: "http://www.w3.org/ns/solid/acp#",
10771
+ dcterms: "http://purl.org/dc/terms/",
10772
+ foaf: "http://xmlns.com/foaf/0.1/",
10773
+ ldn: "https://www.w3.org/ns/ldn#",
10774
+ ldp: "http://www.w3.org/ns/ldp#",
10775
+ notify: "http://www.w3.org/ns/solid/notifications#",
10776
+ oidc: "http://www.w3.org/ns/solid/oidc#",
10777
+ owl: "http://www.w3.org/2002/07/owl#",
10778
+ pim: "http://www.w3.org/ns/pim/space#",
10762
10779
  rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
10763
- solid: "http://www.w3.org/ns/solid/terms#",
10780
+ rdfs: "http://www.w3.org/2000/01/rdf-schema#",
10764
10781
  schema: "http://schema.org/",
10765
- vcard: "http://www.w3.org/2006/vcard/ns#"
10782
+ solid: "http://www.w3.org/ns/solid/terms#",
10783
+ stat: "http://www.w3.org/ns/posix/stat#",
10784
+ turtle: "http://www.w3.org/ns/iana/media-types/text/turtle#",
10785
+ vcard: "http://www.w3.org/2006/vcard/ns#",
10786
+ xsd: "http://www.w3.org/2001/XMLSchema#"
10766
10787
  };
10767
10788
  function one(values, whichOne = "last") {
10768
10789
  let result2 = values;
@@ -13983,9 +14004,9 @@
13983
14004
  // and returns the items per list.
13984
14005
  extractLists({ remove = false, ignoreErrors = false } = {}) {
13985
14006
  const lists = {};
13986
- const onError = ignoreErrors ? () => true : (node, message) => {
14007
+ const onError = ignoreErrors ? (() => true) : ((node, message) => {
13987
14008
  throw new Error(`${node.value} ${message}`);
13988
- };
14009
+ });
13989
14010
  const tails = this.getQuads(null, IRIs_default.rdf.rest, IRIs_default.rdf.nil, null);
13990
14011
  const toRemove = remove ? [...tails] : [];
13991
14012
  tails.forEach((tailQuad) => {
@@ -15486,24 +15507,25 @@
15486
15507
  if (!profile || !profile.solid$oidcIssuer) {
15487
15508
  throw new Error("solidClient: " + webid + " did not return valid solid profile");
15488
15509
  }
15489
- options.issuer = profile.solid$oidcIssuer.id;
15510
+ if (!options.issuer) {
15511
+ options.issuer = oldm.one(profile.solid$oidcIssuer)?.id;
15512
+ }
15490
15513
  const storage = oldm.many(profile.space$storage).map((s) => new jsfs.fs(new SolidAdapter(s.id, "/", options)));
15491
- const client2 = metro.client(metro.oidc.oidcmw(options), oldmmw(options));
15492
- Object.assign(client2, {
15493
- profile,
15494
- issuer: profile.solid$oidcIssuer?.id,
15495
- inbox: profile.ldp$inbox?.id,
15496
- id: function() {
15497
- return metro.oidc.idToken(this.issuer);
15498
- },
15499
- logout: async function() {
15500
- throw new Error("not yet implemented");
15501
- },
15502
- storage
15503
- });
15504
- client2.id.bind(client2);
15505
- client2.logout.bind(client2);
15506
- return client2;
15514
+ return metro.api(
15515
+ metro.client(metro.oidc.oidcmw(options), oldmmw(options)),
15516
+ {
15517
+ profile,
15518
+ issuer: oldm.one(profile.solid$oidcIssuer)?.id,
15519
+ inbox: oldm.one(profile.ldp$inbox)?.id,
15520
+ id: function() {
15521
+ return metro.oidc.idToken(this.issuer);
15522
+ },
15523
+ logout: async function() {
15524
+ throw new Error("not yet implemented");
15525
+ },
15526
+ storage
15527
+ }
15528
+ );
15507
15529
  }
15508
15530
 
15509
15531
  // src/browser.js