@muze-nl/jsfs-solid 0.3.3 → 0.3.5

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
@@ -1109,24 +1109,24 @@
1109
1109
  Buffer3.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) {
1110
1110
  offset = offset >>> 0;
1111
1111
  validateNumber(offset, "offset");
1112
- const first = this[offset];
1112
+ const first2 = this[offset];
1113
1113
  const last = this[offset + 7];
1114
- if (first === void 0 || last === void 0) {
1114
+ if (first2 === void 0 || last === void 0) {
1115
1115
  boundsError(offset, this.length - 8);
1116
1116
  }
1117
- const lo = first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24;
1117
+ const lo = first2 + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24;
1118
1118
  const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24;
1119
1119
  return BigInt(lo) + (BigInt(hi) << BigInt(32));
1120
1120
  });
1121
1121
  Buffer3.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) {
1122
1122
  offset = offset >>> 0;
1123
1123
  validateNumber(offset, "offset");
1124
- const first = this[offset];
1124
+ const first2 = this[offset];
1125
1125
  const last = this[offset + 7];
1126
- if (first === void 0 || last === void 0) {
1126
+ if (first2 === void 0 || last === void 0) {
1127
1127
  boundsError(offset, this.length - 8);
1128
1128
  }
1129
- const hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];
1129
+ const hi = first2 * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];
1130
1130
  const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last;
1131
1131
  return (BigInt(hi) << BigInt(32)) + BigInt(lo);
1132
1132
  });
@@ -1189,23 +1189,23 @@
1189
1189
  Buffer3.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) {
1190
1190
  offset = offset >>> 0;
1191
1191
  validateNumber(offset, "offset");
1192
- const first = this[offset];
1192
+ const first2 = this[offset];
1193
1193
  const last = this[offset + 7];
1194
- if (first === void 0 || last === void 0) {
1194
+ if (first2 === void 0 || last === void 0) {
1195
1195
  boundsError(offset, this.length - 8);
1196
1196
  }
1197
1197
  const val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24);
1198
- return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24);
1198
+ return (BigInt(val) << BigInt(32)) + BigInt(first2 + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24);
1199
1199
  });
1200
1200
  Buffer3.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) {
1201
1201
  offset = offset >>> 0;
1202
1202
  validateNumber(offset, "offset");
1203
- const first = this[offset];
1203
+ const first2 = this[offset];
1204
1204
  const last = this[offset + 7];
1205
- if (first === void 0 || last === void 0) {
1205
+ if (first2 === void 0 || last === void 0) {
1206
1206
  boundsError(offset, this.length - 8);
1207
1207
  }
1208
- const val = (first << 24) + // Overflow
1208
+ const val = (first2 << 24) + // Overflow
1209
1209
  this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];
1210
1210
  return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last);
1211
1211
  });
@@ -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
  }
@@ -8254,11 +8254,11 @@
8254
8254
  throw new TypeError("Cannot write contents of type " + typeof contents);
8255
8255
  }
8256
8256
  }
8257
- async delete(path) {
8257
+ async remove(path) {
8258
8258
  if (!(path instanceof Path)) {
8259
8259
  path = new Path(Path.collapse(path, this.#path));
8260
8260
  }
8261
- return this.#adapter.delete(path);
8261
+ return this.#adapter.remove(path);
8262
8262
  }
8263
8263
  async exists(path) {
8264
8264
  if (!(path instanceof Path)) {
@@ -8272,6 +8272,30 @@
8272
8272
  }
8273
8273
  return this.#adapter.list(path);
8274
8274
  }
8275
+ async mkdir(path = "") {
8276
+ if (!this.#adapter.supportsWrite()) {
8277
+ throw new Error("Adapter " + this.#adapter.name + " is read only.");
8278
+ }
8279
+ if (!this.#adapter.supportsDirectories) {
8280
+ throw new Error("Adapter " + this.#adapter.name + " does not support directories.");
8281
+ }
8282
+ if (!(path instanceof Path)) {
8283
+ path = new Path(Path.collapse(path, this.#path));
8284
+ }
8285
+ return this.#adapter.mkdir(path);
8286
+ }
8287
+ async rmdir(path = "") {
8288
+ if (!this.#adapter.supportsWrite()) {
8289
+ throw new Error("Adapter " + this.#adapter.name + " is read only.");
8290
+ }
8291
+ if (!this.#adapter.supportsDirectories) {
8292
+ throw new Error("Adapter " + this.#adapter.name + " does not support directories.");
8293
+ }
8294
+ if (!(path instanceof Path)) {
8295
+ path = new Path(Path.collapse(path, this.#path));
8296
+ }
8297
+ return this.#adapter.rmdir(path);
8298
+ }
8275
8299
  };
8276
8300
 
8277
8301
  // node_modules/@muze-nl/metro/src/metro.mjs
@@ -8384,7 +8408,7 @@
8384
8408
  options = Object.assign({}, this.clientOptions, options);
8385
8409
  let next;
8386
8410
  for (let middleware of middlewares) {
8387
- next = /* @__PURE__ */ (function(next2, middleware2) {
8411
+ next = /* @__PURE__ */ function(next2, middleware2) {
8388
8412
  return async function(req2) {
8389
8413
  let res;
8390
8414
  let tracers = Object.values(_Client.tracers);
@@ -8401,7 +8425,7 @@
8401
8425
  }
8402
8426
  return res;
8403
8427
  };
8404
- })(next, middleware);
8428
+ }(next, middleware);
8405
8429
  }
8406
8430
  return next(req);
8407
8431
  }
@@ -8892,6 +8916,9 @@
8892
8916
  supportsStreamingRead() {
8893
8917
  return true;
8894
8918
  }
8919
+ supportsDirectories() {
8920
+ return false;
8921
+ }
8895
8922
  cd(path) {
8896
8923
  if (!Path.isPath(path)) {
8897
8924
  throw new TypeError(path + " is not a valid path");
@@ -8934,7 +8961,7 @@
8934
8961
  async exists(path) {
8935
8962
  return this.#client.head(path);
8936
8963
  }
8937
- async delete(path) {
8964
+ async remove(path) {
8938
8965
  return this.#client.delete(path);
8939
8966
  }
8940
8967
  async list(path) {
@@ -9100,7 +9127,7 @@
9100
9127
  }
9101
9128
 
9102
9129
  // node_modules/@muze-nl/metro/src/mw/getdata.mjs
9103
- function getdatamw2() {
9130
+ function getdatamw() {
9104
9131
  return async function getdata(req, next) {
9105
9132
  let res = await next(req);
9106
9133
  if (res.ok && res.data) {
@@ -9114,9 +9141,9 @@
9114
9141
  var API = class extends Client {
9115
9142
  constructor(base, methods, bind = null) {
9116
9143
  if (base instanceof Client) {
9117
- super(base.clientOptions, throwermw(), getdatamw2());
9144
+ super(base.clientOptions, throwermw(), getdatamw());
9118
9145
  } else {
9119
- super(base, throwermw(), getdatamw2());
9146
+ super(base, throwermw(), getdatamw());
9120
9147
  }
9121
9148
  if (!bind) {
9122
9149
  bind = this;
@@ -9153,7 +9180,7 @@
9153
9180
  mw: {
9154
9181
  json: jsonmw,
9155
9182
  thrower: throwermw,
9156
- getdata: getdatamw2
9183
+ getdata: getdatamw
9157
9184
  },
9158
9185
  api,
9159
9186
  jsonApi
@@ -10567,7 +10594,7 @@
10567
10594
  }
10568
10595
 
10569
10596
  // node_modules/@muze-nl/metro-oidc/src/oidcmw.mjs
10570
- function oidcmw2(options = {}) {
10597
+ function oidcmw(options = {}) {
10571
10598
  const defaultOptions = {
10572
10599
  client: client(),
10573
10600
  force_authorization: false,
@@ -10701,7 +10728,7 @@
10701
10728
 
10702
10729
  // node_modules/@muze-nl/metro-oidc/src/browser.mjs
10703
10730
  var oidc = {
10704
- oidcmw: oidcmw2,
10731
+ oidcmw,
10705
10732
  discover: oidcDiscovery,
10706
10733
  register,
10707
10734
  isRedirected: isRedirected2,
@@ -10713,6 +10740,20 @@
10713
10740
  var browser_default2 = oidc;
10714
10741
 
10715
10742
  // node_modules/@muze-nl/oldm/src/oldm.mjs
10743
+ var oldm_exports = {};
10744
+ __export(oldm_exports, {
10745
+ BlankNode: () => BlankNode,
10746
+ Collection: () => Collection,
10747
+ Context: () => Context,
10748
+ Graph: () => Graph,
10749
+ NamedNode: () => NamedNode,
10750
+ default: () => oldm2,
10751
+ first: () => first,
10752
+ many: () => many,
10753
+ one: () => one,
10754
+ prefixes: () => prefixes,
10755
+ rdfType: () => rdfType
10756
+ });
10716
10757
  function oldm2(options) {
10717
10758
  return new Context(options);
10718
10759
  }
@@ -10723,6 +10764,38 @@
10723
10764
  schema: "http://schema.org/",
10724
10765
  vcard: "http://www.w3.org/2006/vcard/ns#"
10725
10766
  };
10767
+ function one(values, whichOne = "last") {
10768
+ let result2 = values;
10769
+ if (Array.isArray(values)) {
10770
+ if (whichOne == "last") {
10771
+ result2 = values[values.length - 1];
10772
+ } else if (whichOne == "first") {
10773
+ result2 = values[0];
10774
+ } else if (typeof whichOne == "function") {
10775
+ result2 = whichOne(values);
10776
+ } else {
10777
+ throw new Error("Unknown value for whichOne parameter");
10778
+ }
10779
+ }
10780
+ return result2;
10781
+ }
10782
+ function many(values) {
10783
+ if (Array.isArray(values)) {
10784
+ return values;
10785
+ }
10786
+ if (values == null) {
10787
+ return [];
10788
+ }
10789
+ return [values];
10790
+ }
10791
+ function first(...values) {
10792
+ for (const value of values) {
10793
+ if (value !== null && value !== void 0) {
10794
+ return value;
10795
+ }
10796
+ }
10797
+ return null;
10798
+ }
10726
10799
  var Context = class {
10727
10800
  constructor(options) {
10728
10801
  this.prefixes = { ...prefixes, ...options?.prefixes };
@@ -13910,9 +13983,9 @@
13910
13983
  // and returns the items per list.
13911
13984
  extractLists({ remove = false, ignoreErrors = false } = {}) {
13912
13985
  const lists = {};
13913
- const onError = ignoreErrors ? (() => true) : ((node, message) => {
13986
+ const onError = ignoreErrors ? () => true : (node, message) => {
13914
13987
  throw new Error(`${node.value} ${message}`);
13915
- });
13988
+ };
13916
13989
  const tails = this.getQuads(null, IRIs_default.rdf.rest, IRIs_default.rdf.nil, null);
13917
13990
  const toRemove = remove ? [...tails] : [];
13918
13991
  tails.forEach((tailQuad) => {
@@ -13925,7 +13998,7 @@
13925
13998
  while (current && !malformed) {
13926
13999
  const objectQuads = this.getQuads(null, null, current, null);
13927
14000
  const subjectQuads = this.getQuads(current, null, null, null);
13928
- let quad2, first = null, rest = null, parent = null;
14001
+ let quad2, first2 = null, rest = null, parent = null;
13929
14002
  for (let i = 0; i < subjectQuads.length && !malformed; i++) {
13930
14003
  quad2 = subjectQuads[i];
13931
14004
  if (!quad2.graph.equals(graph))
@@ -13933,10 +14006,10 @@
13933
14006
  else if (head)
13934
14007
  malformed = onError(current, "has non-list arcs out");
13935
14008
  else if (quad2.predicate.value === IRIs_default.rdf.first) {
13936
- if (first)
14009
+ if (first2)
13937
14010
  malformed = onError(current, "has multiple rdf:first arcs");
13938
14011
  else
13939
- toRemove.push(first = quad2);
14012
+ toRemove.push(first2 = quad2);
13940
14013
  } else if (quad2.predicate.value === IRIs_default.rdf.rest) {
13941
14014
  if (rest)
13942
14015
  malformed = onError(current, "has multiple rdf:rest arcs");
@@ -13963,10 +14036,10 @@
13963
14036
  headPos = "object";
13964
14037
  }
13965
14038
  }
13966
- if (!first)
14039
+ if (!first2)
13967
14040
  malformed = onError(current, "has no list head");
13968
14041
  else
13969
- items.unshift(first.object);
14042
+ items.unshift(first2.object);
13970
14043
  current = parent && parent.subject;
13971
14044
  }
13972
14045
  if (malformed)
@@ -14779,6 +14852,7 @@
14779
14852
  // node_modules/@muze-nl/oldm/src/index.mjs
14780
14853
  var oldm3 = {
14781
14854
  context: oldm2,
14855
+ ...oldm_exports,
14782
14856
  ...oldm_n3_exports
14783
14857
  };
14784
14858
  globalThis.oldm = oldm3;
@@ -15407,14 +15481,14 @@
15407
15481
  options.prefixes[prefix2] = defaults.prefixes[prefix2];
15408
15482
  }
15409
15483
  }
15410
- const profile = await metro.client().with(oldmmw(options), getdatamw()).get(webid)?.primary;
15484
+ const profile = await metro.client().with(oldmmw(options), metro.mw.getdata()).get(webid)?.primary;
15411
15485
  if (!profile || !profile.solid$oidcIssuer) {
15412
15486
  throw new Error("solidClient: " + webid + " did not return valid solid profile");
15413
15487
  }
15414
15488
  options.issuer = profile.solid$oidcIssuer;
15415
15489
  const storage = oldm.many(profile.space$storage).map((s) => new jsfs.fs(new SolidAdapter(s, "/", options)));
15416
15490
  return metro.api(
15417
- metro.client(oidcmw(options), oldmmw(options)),
15491
+ metro.client(metro.oidc.oidcmw(options), oldmmw(options)),
15418
15492
  {
15419
15493
  profile,
15420
15494
  issuer: profile.solid$oidcIssuer,