@muze-nl/jsfs-solid 0.3.9 → 0.4.1

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) {
@@ -13983,9 +13990,9 @@
13983
13990
  // and returns the items per list.
13984
13991
  extractLists({ remove = false, ignoreErrors = false } = {}) {
13985
13992
  const lists = {};
13986
- const onError = ignoreErrors ? () => true : (node, message) => {
13993
+ const onError = ignoreErrors ? (() => true) : ((node, message) => {
13987
13994
  throw new Error(`${node.value} ${message}`);
13988
- };
13995
+ });
13989
13996
  const tails = this.getQuads(null, IRIs_default.rdf.rest, IRIs_default.rdf.nil, null);
13990
13997
  const toRemove = remove ? [...tails] : [];
13991
13998
  tails.forEach((tailQuad) => {
@@ -15486,24 +15493,25 @@
15486
15493
  if (!profile || !profile.solid$oidcIssuer) {
15487
15494
  throw new Error("solidClient: " + webid + " did not return valid solid profile");
15488
15495
  }
15489
- options.issuer = profile.solid$oidcIssuer.id;
15496
+ if (!options.issuer) {
15497
+ options.issuer = oldm.one(profile.solid$oidcIssuer)?.id;
15498
+ }
15490
15499
  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;
15500
+ return metro.api(
15501
+ metro.client(metro.oidc.oidcmw(options), oldmmw(options)),
15502
+ {
15503
+ profile,
15504
+ issuer: oldm.one(profile.solid$oidcIssuer)?.id,
15505
+ inbox: oldm.one(profile.ldp$inbox)?.id,
15506
+ id: function() {
15507
+ return metro.oidc.idToken(this.issuer);
15508
+ },
15509
+ logout: async function() {
15510
+ throw new Error("not yet implemented");
15511
+ },
15512
+ storage
15513
+ }
15514
+ );
15507
15515
  }
15508
15516
 
15509
15517
  // src/browser.js