@pod-os/core 0.11.1-fb75eb3.0 → 0.11.2-006929f.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
@@ -427,7 +427,7 @@ var require_oidc_client_min = __commonJS({
427
427
  }([function(t, e, r) {
428
428
  "use strict";
429
429
  Object.defineProperty(e, "__esModule", { value: true });
430
- var n2 = function() {
430
+ var n2 = /* @__PURE__ */ function() {
431
431
  function t2(t3, e2) {
432
432
  for (var r2 = 0; r2 < e2.length; r2++) {
433
433
  var n3 = e2[r2];
@@ -503,7 +503,7 @@ var require_oidc_client_min = __commonJS({
503
503
  }, function(t, e, r) {
504
504
  "use strict";
505
505
  Object.defineProperty(e, "__esModule", { value: true });
506
- var n2 = function() {
506
+ var n2 = /* @__PURE__ */ function() {
507
507
  function t2(t3, e2) {
508
508
  for (var r2 = 0; r2 < e2.length; r2++) {
509
509
  var n3 = e2[r2];
@@ -564,7 +564,7 @@ var require_oidc_client_min = __commonJS({
564
564
  }, function(t, e, r) {
565
565
  "use strict";
566
566
  Object.defineProperty(e, "__esModule", { value: true }), e.MetadataService = void 0;
567
- var n2 = function() {
567
+ var n2 = /* @__PURE__ */ function() {
568
568
  function t2(t3, e2) {
569
569
  for (var r2 = 0; r2 < e2.length; r2++) {
570
570
  var n3 = e2[r2];
@@ -676,7 +676,7 @@ var require_oidc_client_min = __commonJS({
676
676
  return typeof t2;
677
677
  } : function(t2) {
678
678
  return t2 && "function" == typeof Symbol && t2.constructor === Symbol && t2 !== Symbol.prototype ? "symbol" : typeof t2;
679
- }, i = function() {
679
+ }, i = /* @__PURE__ */ function() {
680
680
  function t2(t3, e2) {
681
681
  for (var r2 = 0; r2 < e2.length; r2++) {
682
682
  var n3 = e2[r2];
@@ -955,7 +955,7 @@ var require_oidc_client_min = __commonJS({
955
955
  }, function(t, e, r) {
956
956
  "use strict";
957
957
  Object.defineProperty(e, "__esModule", { value: true }), e.State = void 0;
958
- var n2 = function() {
958
+ var n2 = /* @__PURE__ */ function() {
959
959
  function t2(t3, e2) {
960
960
  for (var r2 = 0; r2 < e2.length; r2++) {
961
961
  var n3 = e2[r2];
@@ -1020,7 +1020,7 @@ var require_oidc_client_min = __commonJS({
1020
1020
  }, function(t, e, r) {
1021
1021
  "use strict";
1022
1022
  Object.defineProperty(e, "__esModule", { value: true }), e.OidcClient = void 0;
1023
- var n2 = function() {
1023
+ var n2 = /* @__PURE__ */ function() {
1024
1024
  function t2(t3, e2) {
1025
1025
  for (var r2 = 0; r2 < e2.length; r2++) {
1026
1026
  var n3 = e2[r2];
@@ -1180,7 +1180,7 @@ var require_oidc_client_min = __commonJS({
1180
1180
  }, function(t, e, r) {
1181
1181
  "use strict";
1182
1182
  Object.defineProperty(e, "__esModule", { value: true }), e.SigninState = void 0;
1183
- var n2 = function() {
1183
+ var n2 = /* @__PURE__ */ function() {
1184
1184
  function t2(t3, e2) {
1185
1185
  for (var r2 = 0; r2 < e2.length; r2++) {
1186
1186
  var n3 = e2[r2];
@@ -1252,12 +1252,12 @@ var require_oidc_client_min = __commonJS({
1252
1252
  };
1253
1253
  var i = "undefined" != typeof window ? window.crypto || window.msCrypto : null;
1254
1254
  function o() {
1255
- return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function(t2) {
1255
+ return ("10000000-1000-4000-8000" + -1e11).replace(/[018]/g, function(t2) {
1256
1256
  return (t2 ^ i.getRandomValues(new Uint8Array(1))[0] & 15 >> t2 / 4).toString(16);
1257
1257
  });
1258
1258
  }
1259
1259
  function s() {
1260
- return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function(t2) {
1260
+ return ("10000000-1000-4000-8000" + -1e11).replace(/[018]/g, function(t2) {
1261
1261
  return (t2 ^ 16 * Math.random() >> t2 / 4).toString(16);
1262
1262
  });
1263
1263
  }
@@ -1265,7 +1265,7 @@ var require_oidc_client_min = __commonJS({
1265
1265
  }, function(t, e, r) {
1266
1266
  "use strict";
1267
1267
  Object.defineProperty(e, "__esModule", { value: true }), e.User = void 0;
1268
- var n2 = function() {
1268
+ var n2 = /* @__PURE__ */ function() {
1269
1269
  function t2(t3, e2) {
1270
1270
  for (var r2 = 0; r2 < e2.length; r2++) {
1271
1271
  var n3 = e2[r2];
@@ -1373,7 +1373,7 @@ var require_oidc_client_min = __commonJS({
1373
1373
  }, function(t, e, r) {
1374
1374
  "use strict";
1375
1375
  Object.defineProperty(e, "__esModule", { value: true }), e.SessionMonitor = void 0;
1376
- var n2 = function() {
1376
+ var n2 = /* @__PURE__ */ function() {
1377
1377
  function t2(t3, e2) {
1378
1378
  for (var r2 = 0; r2 < e2.length; r2++) {
1379
1379
  var n3 = e2[r2];
@@ -1534,7 +1534,7 @@ var require_oidc_client_min = __commonJS({
1534
1534
  }, function(t, e, r) {
1535
1535
  "use strict";
1536
1536
  Object.defineProperty(e, "__esModule", { value: true }), e.CordovaPopupWindow = void 0;
1537
- var n2 = function() {
1537
+ var n2 = /* @__PURE__ */ function() {
1538
1538
  function t2(t3, e2) {
1539
1539
  for (var r2 = 0; r2 < e2.length; r2++) {
1540
1540
  var n3 = e2[r2];
@@ -1878,7 +1878,7 @@ var require_oidc_client_min = __commonJS({
1878
1878
  return typeof t3;
1879
1879
  } : function(t3) {
1880
1880
  return t3 && "function" == typeof Symbol && t3.constructor === Symbol && t3 !== Symbol.prototype ? "symbol" : typeof t3;
1881
- }, d = { userAgent: false }, p = {}, v2 = v2 || (r2 = Math, i = (n2 = {}).lib = {}, o = i.Base = function() {
1881
+ }, d = { userAgent: false }, p = {}, v2 = v2 || (r2 = Math, i = (n2 = {}).lib = {}, o = i.Base = /* @__PURE__ */ function() {
1882
1882
  function t3() {
1883
1883
  }
1884
1884
  return { extend: function e2(r3) {
@@ -4418,7 +4418,7 @@ var require_oidc_client_min = __commonJS({
4418
4418
  e2[f2[w2]] = n3;
4419
4419
  };
4420
4420
  }(), Sr.crypto.ECParameterDB.regist("secp128r1", 128, "FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF", "FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC", "E87579C11079F43DD824993C2CEE5ED3", "FFFFFFFE0000000075A30D1B9038A115", "1", "161FF7528B899B2D0C28607CA52C5B86", "CF5AC8395BAFEB13C02DA292DDED7A83", [], "", "secp128r1 : SECG curve over a 128 bit prime field"), Sr.crypto.ECParameterDB.regist("secp160k1", 160, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73", "0", "7", "0100000000000000000001B8FA16DFAB9ACA16B6B3", "1", "3B4C382CE37AA192A4019E763036F4F5DD4D7EBB", "938CF935318FDCED6BC28286531733C3F03C4FEE", [], "", "secp160k1 : SECG curve over a 160 bit prime field"), Sr.crypto.ECParameterDB.regist("secp160r1", 160, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC", "1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45", "0100000000000000000001F4C8F927AED3CA752257", "1", "4A96B5688EF573284664698968C38BB913CBFC82", "23A628553168947D59DCC912042351377AC5FB32", [], "", "secp160r1 : SECG curve over a 160 bit prime field"), Sr.crypto.ECParameterDB.regist("secp192k1", 192, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37", "0", "3", "FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D", "1", "DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D", "9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D", []), Sr.crypto.ECParameterDB.regist("secp192r1", 192, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC", "64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1", "FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831", "1", "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012", "07192B95FFC8DA78631011ED6B24CDD573F977A11E794811", []), Sr.crypto.ECParameterDB.regist("secp224r1", 224, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE", "B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4", "FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D", "1", "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21", "BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34", []), Sr.crypto.ECParameterDB.regist("secp256k1", 256, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F", "0", "7", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", "1", "79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798", "483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8", []), Sr.crypto.ECParameterDB.regist("secp256r1", 256, "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF", "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC", "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B", "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551", "1", "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296", "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5", ["NIST P-256", "P-256", "prime256v1"]), Sr.crypto.ECParameterDB.regist("secp384r1", 384, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC", "B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973", "1", "AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7", "3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f", ["NIST P-384", "P-384"]), Sr.crypto.ECParameterDB.regist("secp521r1", 521, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC", "051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00", "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409", "1", "C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66", "011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650", ["NIST P-521", "P-521"]);
4421
- var tn = function() {
4421
+ var tn = /* @__PURE__ */ function() {
4422
4422
  var t3 = function t4(r4, n4, i3) {
4423
4423
  return e2(v2.AES, r4, n4, i3);
4424
4424
  }, e2 = function t4(e3, r4, n4, i3) {
@@ -6578,7 +6578,7 @@ var require_oidc_client_min = __commonJS({
6578
6578
  }).call(this, r(29));
6579
6579
  }, function(t, e) {
6580
6580
  var r;
6581
- r = function() {
6581
+ r = /* @__PURE__ */ function() {
6582
6582
  return this;
6583
6583
  }();
6584
6584
  try {
@@ -6747,7 +6747,7 @@ var require_oidc_client_min = __commonJS({
6747
6747
  }, function(t, e, r) {
6748
6748
  "use strict";
6749
6749
  Object.defineProperty(e, "__esModule", { value: true }), e.SigninResponse = void 0;
6750
- var n2 = function() {
6750
+ var n2 = /* @__PURE__ */ function() {
6751
6751
  function t2(t3, e2) {
6752
6752
  for (var r2 = 0; r2 < e2.length; r2++) {
6753
6753
  var n3 = e2[r2];
@@ -6820,7 +6820,7 @@ var require_oidc_client_min = __commonJS({
6820
6820
  }, function(t, e, r) {
6821
6821
  "use strict";
6822
6822
  Object.defineProperty(e, "__esModule", { value: true }), e.InMemoryWebStorage = void 0;
6823
- var n2 = function() {
6823
+ var n2 = /* @__PURE__ */ function() {
6824
6824
  function t2(t3, e2) {
6825
6825
  for (var r2 = 0; r2 < e2.length; r2++) {
6826
6826
  var n3 = e2[r2];
@@ -6853,7 +6853,7 @@ var require_oidc_client_min = __commonJS({
6853
6853
  }, function(t, e, r) {
6854
6854
  "use strict";
6855
6855
  Object.defineProperty(e, "__esModule", { value: true }), e.UserManager = void 0;
6856
- var n2 = function() {
6856
+ var n2 = /* @__PURE__ */ function() {
6857
6857
  function t2(t3, e2) {
6858
6858
  for (var r2 = 0; r2 < e2.length; r2++) {
6859
6859
  var n3 = e2[r2];
@@ -7129,7 +7129,7 @@ var require_oidc_client_min = __commonJS({
7129
7129
  }, function(t, e, r) {
7130
7130
  "use strict";
7131
7131
  Object.defineProperty(e, "__esModule", { value: true }), e.UserManagerSettings = void 0;
7132
- var n2 = function() {
7132
+ var n2 = /* @__PURE__ */ function() {
7133
7133
  function t2(t3, e2) {
7134
7134
  for (var r2 = 0; r2 < e2.length; r2++) {
7135
7135
  var n3 = e2[r2];
@@ -7205,7 +7205,7 @@ var require_oidc_client_min = __commonJS({
7205
7205
  }, function(t, e, r) {
7206
7206
  "use strict";
7207
7207
  Object.defineProperty(e, "__esModule", { value: true }), e.RedirectNavigator = void 0;
7208
- var n2 = function() {
7208
+ var n2 = /* @__PURE__ */ function() {
7209
7209
  function t2(t3, e2) {
7210
7210
  for (var r2 = 0; r2 < e2.length; r2++) {
7211
7211
  var n3 = e2[r2];
@@ -7257,7 +7257,7 @@ var require_oidc_client_min = __commonJS({
7257
7257
  }, function(t, e, r) {
7258
7258
  "use strict";
7259
7259
  Object.defineProperty(e, "__esModule", { value: true }), e.PopupWindow = void 0;
7260
- var n2 = function() {
7260
+ var n2 = /* @__PURE__ */ function() {
7261
7261
  function t2(t3, e2) {
7262
7262
  for (var r2 = 0; r2 < e2.length; r2++) {
7263
7263
  var n3 = e2[r2];
@@ -7336,7 +7336,7 @@ var require_oidc_client_min = __commonJS({
7336
7336
  }, function(t, e, r) {
7337
7337
  "use strict";
7338
7338
  Object.defineProperty(e, "__esModule", { value: true }), e.IFrameWindow = void 0;
7339
- var n2 = function() {
7339
+ var n2 = /* @__PURE__ */ function() {
7340
7340
  function t2(t3, e2) {
7341
7341
  for (var r2 = 0; r2 < e2.length; r2++) {
7342
7342
  var n3 = e2[r2];
@@ -7450,7 +7450,7 @@ var require_oidc_client_min = __commonJS({
7450
7450
  }, function(t, e, r) {
7451
7451
  "use strict";
7452
7452
  Object.defineProperty(e, "__esModule", { value: true }), e.Timer = void 0;
7453
- var n2 = function() {
7453
+ var n2 = /* @__PURE__ */ function() {
7454
7454
  function t2(t3, e2) {
7455
7455
  for (var r2 = 0; r2 < e2.length; r2++) {
7456
7456
  var n3 = e2[r2];
@@ -12833,39 +12833,65 @@ var require_implementation = __commonJS({
12833
12833
  "../node_modules/function-bind/implementation.js"(exports, module3) {
12834
12834
  "use strict";
12835
12835
  var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
12836
- var slice = Array.prototype.slice;
12837
12836
  var toStr = Object.prototype.toString;
12837
+ var max2 = Math.max;
12838
12838
  var funcType = "[object Function]";
12839
+ var concatty = function concatty2(a, b) {
12840
+ var arr = [];
12841
+ for (var i = 0; i < a.length; i += 1) {
12842
+ arr[i] = a[i];
12843
+ }
12844
+ for (var j = 0; j < b.length; j += 1) {
12845
+ arr[j + a.length] = b[j];
12846
+ }
12847
+ return arr;
12848
+ };
12849
+ var slicy = function slicy2(arrLike, offset3) {
12850
+ var arr = [];
12851
+ for (var i = offset3 || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
12852
+ arr[j] = arrLike[i];
12853
+ }
12854
+ return arr;
12855
+ };
12856
+ var joiny = function(arr, joiner) {
12857
+ var str = "";
12858
+ for (var i = 0; i < arr.length; i += 1) {
12859
+ str += arr[i];
12860
+ if (i + 1 < arr.length) {
12861
+ str += joiner;
12862
+ }
12863
+ }
12864
+ return str;
12865
+ };
12839
12866
  module3.exports = function bind(that) {
12840
12867
  var target5 = this;
12841
- if (typeof target5 !== "function" || toStr.call(target5) !== funcType) {
12868
+ if (typeof target5 !== "function" || toStr.apply(target5) !== funcType) {
12842
12869
  throw new TypeError(ERROR_MESSAGE + target5);
12843
12870
  }
12844
- var args = slice.call(arguments, 1);
12871
+ var args = slicy(arguments, 1);
12845
12872
  var bound;
12846
12873
  var binder = function() {
12847
12874
  if (this instanceof bound) {
12848
12875
  var result5 = target5.apply(
12849
12876
  this,
12850
- args.concat(slice.call(arguments))
12877
+ concatty(args, arguments)
12851
12878
  );
12852
12879
  if (Object(result5) === result5) {
12853
12880
  return result5;
12854
12881
  }
12855
12882
  return this;
12856
- } else {
12857
- return target5.apply(
12858
- that,
12859
- args.concat(slice.call(arguments))
12860
- );
12861
12883
  }
12884
+ return target5.apply(
12885
+ that,
12886
+ concatty(args, arguments)
12887
+ );
12862
12888
  };
12863
- var boundLength = Math.max(0, target5.length - args.length);
12889
+ var boundLength = max2(0, target5.length - args.length);
12864
12890
  var boundArgs = [];
12865
12891
  for (var i = 0; i < boundLength; i++) {
12866
- boundArgs.push("$" + i);
12892
+ boundArgs[i] = "$" + i;
12867
12893
  }
12868
- bound = Function("binder", "return function (" + boundArgs.join(",") + "){ return binder.apply(this,arguments); }")(binder);
12894
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
12869
12895
  if (target5.prototype) {
12870
12896
  var Empty = function Empty2() {
12871
12897
  };
@@ -12887,12 +12913,14 @@ var require_function_bind = __commonJS({
12887
12913
  }
12888
12914
  });
12889
12915
 
12890
- // ../node_modules/has/src/index.js
12891
- var require_src = __commonJS({
12892
- "../node_modules/has/src/index.js"(exports, module3) {
12916
+ // ../node_modules/hasown/index.js
12917
+ var require_hasown = __commonJS({
12918
+ "../node_modules/hasown/index.js"(exports, module3) {
12893
12919
  "use strict";
12920
+ var call = Function.prototype.call;
12921
+ var $hasOwn = Object.prototype.hasOwnProperty;
12894
12922
  var bind = require_function_bind();
12895
- module3.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
12923
+ module3.exports = bind.call(call, $hasOwn);
12896
12924
  }
12897
12925
  });
12898
12926
 
@@ -13094,7 +13122,7 @@ var require_get_intrinsic = __commonJS({
13094
13122
  "%WeakSetPrototype%": ["WeakSet", "prototype"]
13095
13123
  };
13096
13124
  var bind = require_function_bind();
13097
- var hasOwn = require_src();
13125
+ var hasOwn = require_hasown();
13098
13126
  var $concat = bind.call(Function.call, Array.prototype.concat);
13099
13127
  var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
13100
13128
  var $replace = bind.call(Function.call, String.prototype.replace);
@@ -13203,16 +13231,163 @@ var require_get_intrinsic = __commonJS({
13203
13231
  }
13204
13232
  });
13205
13233
 
13234
+ // ../node_modules/has-property-descriptors/index.js
13235
+ var require_has_property_descriptors = __commonJS({
13236
+ "../node_modules/has-property-descriptors/index.js"(exports, module3) {
13237
+ "use strict";
13238
+ var GetIntrinsic = require_get_intrinsic();
13239
+ var $defineProperty = GetIntrinsic("%Object.defineProperty%", true);
13240
+ var hasPropertyDescriptors = function hasPropertyDescriptors2() {
13241
+ if ($defineProperty) {
13242
+ try {
13243
+ $defineProperty({}, "a", { value: 1 });
13244
+ return true;
13245
+ } catch (e) {
13246
+ return false;
13247
+ }
13248
+ }
13249
+ return false;
13250
+ };
13251
+ hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
13252
+ if (!hasPropertyDescriptors()) {
13253
+ return null;
13254
+ }
13255
+ try {
13256
+ return $defineProperty([], "length", { value: 1 }).length !== 1;
13257
+ } catch (e) {
13258
+ return true;
13259
+ }
13260
+ };
13261
+ module3.exports = hasPropertyDescriptors;
13262
+ }
13263
+ });
13264
+
13265
+ // ../node_modules/gopd/index.js
13266
+ var require_gopd = __commonJS({
13267
+ "../node_modules/gopd/index.js"(exports, module3) {
13268
+ "use strict";
13269
+ var GetIntrinsic = require_get_intrinsic();
13270
+ var $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", true);
13271
+ if ($gOPD) {
13272
+ try {
13273
+ $gOPD([], "length");
13274
+ } catch (e) {
13275
+ $gOPD = null;
13276
+ }
13277
+ }
13278
+ module3.exports = $gOPD;
13279
+ }
13280
+ });
13281
+
13282
+ // ../node_modules/define-data-property/index.js
13283
+ var require_define_data_property = __commonJS({
13284
+ "../node_modules/define-data-property/index.js"(exports, module3) {
13285
+ "use strict";
13286
+ var hasPropertyDescriptors = require_has_property_descriptors()();
13287
+ var GetIntrinsic = require_get_intrinsic();
13288
+ var $defineProperty = hasPropertyDescriptors && GetIntrinsic("%Object.defineProperty%", true);
13289
+ if ($defineProperty) {
13290
+ try {
13291
+ $defineProperty({}, "a", { value: 1 });
13292
+ } catch (e) {
13293
+ $defineProperty = false;
13294
+ }
13295
+ }
13296
+ var $SyntaxError = GetIntrinsic("%SyntaxError%");
13297
+ var $TypeError = GetIntrinsic("%TypeError%");
13298
+ var gopd = require_gopd();
13299
+ module3.exports = function defineDataProperty(obj, property3, value6) {
13300
+ if (!obj || typeof obj !== "object" && typeof obj !== "function") {
13301
+ throw new $TypeError("`obj` must be an object or a function`");
13302
+ }
13303
+ if (typeof property3 !== "string" && typeof property3 !== "symbol") {
13304
+ throw new $TypeError("`property` must be a string or a symbol`");
13305
+ }
13306
+ if (arguments.length > 3 && typeof arguments[3] !== "boolean" && arguments[3] !== null) {
13307
+ throw new $TypeError("`nonEnumerable`, if provided, must be a boolean or null");
13308
+ }
13309
+ if (arguments.length > 4 && typeof arguments[4] !== "boolean" && arguments[4] !== null) {
13310
+ throw new $TypeError("`nonWritable`, if provided, must be a boolean or null");
13311
+ }
13312
+ if (arguments.length > 5 && typeof arguments[5] !== "boolean" && arguments[5] !== null) {
13313
+ throw new $TypeError("`nonConfigurable`, if provided, must be a boolean or null");
13314
+ }
13315
+ if (arguments.length > 6 && typeof arguments[6] !== "boolean") {
13316
+ throw new $TypeError("`loose`, if provided, must be a boolean");
13317
+ }
13318
+ var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
13319
+ var nonWritable = arguments.length > 4 ? arguments[4] : null;
13320
+ var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
13321
+ var loose = arguments.length > 6 ? arguments[6] : false;
13322
+ var desc = !!gopd && gopd(obj, property3);
13323
+ if ($defineProperty) {
13324
+ $defineProperty(obj, property3, {
13325
+ configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
13326
+ enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
13327
+ value: value6,
13328
+ writable: nonWritable === null && desc ? desc.writable : !nonWritable
13329
+ });
13330
+ } else if (loose || !nonEnumerable && !nonWritable && !nonConfigurable) {
13331
+ obj[property3] = value6;
13332
+ } else {
13333
+ throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
13334
+ }
13335
+ };
13336
+ }
13337
+ });
13338
+
13339
+ // ../node_modules/set-function-length/index.js
13340
+ var require_set_function_length = __commonJS({
13341
+ "../node_modules/set-function-length/index.js"(exports, module3) {
13342
+ "use strict";
13343
+ var GetIntrinsic = require_get_intrinsic();
13344
+ var define2 = require_define_data_property();
13345
+ var hasDescriptors = require_has_property_descriptors()();
13346
+ var gOPD = require_gopd();
13347
+ var $TypeError = GetIntrinsic("%TypeError%");
13348
+ var $floor = GetIntrinsic("%Math.floor%");
13349
+ module3.exports = function setFunctionLength(fn2, length2) {
13350
+ if (typeof fn2 !== "function") {
13351
+ throw new $TypeError("`fn` is not a function");
13352
+ }
13353
+ if (typeof length2 !== "number" || length2 < 0 || length2 > 4294967295 || $floor(length2) !== length2) {
13354
+ throw new $TypeError("`length` must be a positive 32-bit integer");
13355
+ }
13356
+ var loose = arguments.length > 2 && !!arguments[2];
13357
+ var functionLengthIsConfigurable = true;
13358
+ var functionLengthIsWritable = true;
13359
+ if ("length" in fn2 && gOPD) {
13360
+ var desc = gOPD(fn2, "length");
13361
+ if (desc && !desc.configurable) {
13362
+ functionLengthIsConfigurable = false;
13363
+ }
13364
+ if (desc && !desc.writable) {
13365
+ functionLengthIsWritable = false;
13366
+ }
13367
+ }
13368
+ if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
13369
+ if (hasDescriptors) {
13370
+ define2(fn2, "length", length2, true, true);
13371
+ } else {
13372
+ define2(fn2, "length", length2);
13373
+ }
13374
+ }
13375
+ return fn2;
13376
+ };
13377
+ }
13378
+ });
13379
+
13206
13380
  // ../node_modules/call-bind/index.js
13207
13381
  var require_call_bind = __commonJS({
13208
13382
  "../node_modules/call-bind/index.js"(exports, module3) {
13209
13383
  "use strict";
13210
13384
  var bind = require_function_bind();
13211
13385
  var GetIntrinsic = require_get_intrinsic();
13386
+ var setFunctionLength = require_set_function_length();
13387
+ var $TypeError = GetIntrinsic("%TypeError%");
13212
13388
  var $apply = GetIntrinsic("%Function.prototype.apply%");
13213
13389
  var $call = GetIntrinsic("%Function.prototype.call%");
13214
13390
  var $reflectApply = GetIntrinsic("%Reflect.apply%", true) || bind.call($call, $apply);
13215
- var $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", true);
13216
13391
  var $defineProperty = GetIntrinsic("%Object.defineProperty%", true);
13217
13392
  var $max = GetIntrinsic("%Math.max%");
13218
13393
  if ($defineProperty) {
@@ -13223,18 +13398,15 @@ var require_call_bind = __commonJS({
13223
13398
  }
13224
13399
  }
13225
13400
  module3.exports = function callBind(originalFunction) {
13226
- var func = $reflectApply(bind, $call, arguments);
13227
- if ($gOPD && $defineProperty) {
13228
- var desc = $gOPD(func, "length");
13229
- if (desc.configurable) {
13230
- $defineProperty(
13231
- func,
13232
- "length",
13233
- { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
13234
- );
13235
- }
13401
+ if (typeof originalFunction !== "function") {
13402
+ throw new $TypeError("a function is required");
13236
13403
  }
13237
- return func;
13404
+ var func = $reflectApply(bind, $call, arguments);
13405
+ return setFunctionLength(
13406
+ func,
13407
+ 1 + $max(0, originalFunction.length - (arguments.length - 1)),
13408
+ true
13409
+ );
13238
13410
  };
13239
13411
  var applyBind = function applyBind2() {
13240
13412
  return $reflectApply(bind, $apply, arguments);
@@ -13486,6 +13658,12 @@ var require_object_inspect = __commonJS({
13486
13658
  if (isString(obj)) {
13487
13659
  return markBoxed(inspect(String(obj)));
13488
13660
  }
13661
+ if (typeof window !== "undefined" && obj === window) {
13662
+ return "{ [object Window] }";
13663
+ }
13664
+ if (obj === global) {
13665
+ return "{ [object globalThis] }";
13666
+ }
13489
13667
  if (!isDate(obj) && !isRegExp(obj)) {
13490
13668
  var ys = arrObjKeys(obj, inspect);
13491
13669
  var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
@@ -19834,9 +20012,9 @@ var require_queue_microtask = __commonJS({
19834
20012
  }
19835
20013
  });
19836
20014
 
19837
- // ../node_modules/cross-fetch/dist/browser-ponyfill.js
20015
+ // ../node_modules/rdflib/node_modules/cross-fetch/dist/browser-ponyfill.js
19838
20016
  var require_browser_ponyfill = __commonJS({
19839
- "../node_modules/cross-fetch/dist/browser-ponyfill.js"(exports, module3) {
20017
+ "../node_modules/rdflib/node_modules/cross-fetch/dist/browser-ponyfill.js"(exports, module3) {
19840
20018
  var global3 = typeof self !== "undefined" ? self : exports;
19841
20019
  var __self__ = function() {
19842
20020
  function F() {
@@ -20316,7 +20494,7 @@ var require_lunr = __commonJS({
20316
20494
  };
20317
20495
  lunr2.version = "2.3.9";
20318
20496
  lunr2.utils = {};
20319
- lunr2.utils.warn = function(global3) {
20497
+ lunr2.utils.warn = /* @__PURE__ */ function(global3) {
20320
20498
  return function(message4) {
20321
20499
  if (global3.console && console.warn) {
20322
20500
  console.warn(message4);
@@ -23358,6 +23536,7 @@ var v4_default = v4;
23358
23536
  var SOLID_CLIENT_AUTHN_KEY_PREFIX = "solidClientAuthn:";
23359
23537
  var PREFERRED_SIGNING_ALG = ["ES256", "RS256"];
23360
23538
  var EVENTS = {
23539
+ // Note that an `error` events MUST be listened to: https://nodejs.org/dist/latest-v16.x/docs/api/events.html#error-events.
23361
23540
  ERROR: "error",
23362
23541
  LOGIN: "login",
23363
23542
  LOGOUT: "logout",
@@ -23373,6 +23552,9 @@ var SCOPE_OFFLINE = "offline_access";
23373
23552
  var SCOPE_WEBID = "webid";
23374
23553
  var DEFAULT_SCOPES = [SCOPE_OPENID, SCOPE_OFFLINE, SCOPE_WEBID].join(" ");
23375
23554
  var buildProxyHandler = (toExclude, errorMessage) => ({
23555
+ // This proxy is only a temporary measure until Session no longer extends
23556
+ // SessionEventEmitter, and the proxying is no longer necessary.
23557
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
23376
23558
  get(target5, prop, receiver2) {
23377
23559
  if (!Object.getOwnPropertyNames(import_events.EventEmitter).includes(prop) && Object.getOwnPropertyNames(toExclude).includes(prop)) {
23378
23560
  throw new Error(`${errorMessage}: [${prop}] is not supported`);
@@ -23385,6 +23567,11 @@ var AggregateHandler = class {
23385
23567
  this.handleables = handleables;
23386
23568
  this.handleables = handleables;
23387
23569
  }
23570
+ /**
23571
+ * Helper function that will asynchronously determine the proper handler to use. If multiple
23572
+ * handlers can handle, it will choose the first one in the list
23573
+ * @param params Paramerters to feed to the handler
23574
+ */
23388
23575
  async getProperHandler(params2) {
23389
23576
  const canHandleList = await Promise.all(this.handleables.map((handleable) => handleable.canHandle(...params2)));
23390
23577
  for (let i = 0; i < canHandleList.length; i += 1) {
@@ -23459,6 +23646,15 @@ function isValidRedirectUrl(redirectUrl) {
23459
23646
  return false;
23460
23647
  }
23461
23648
  }
23649
+ function removeOpenIdParams(redirectUrl) {
23650
+ const cleanedUpUrl = new URL(redirectUrl);
23651
+ cleanedUpUrl.searchParams.delete("state");
23652
+ cleanedUpUrl.searchParams.delete("code");
23653
+ cleanedUpUrl.searchParams.delete("error");
23654
+ cleanedUpUrl.searchParams.delete("error_description");
23655
+ cleanedUpUrl.searchParams.delete("iss");
23656
+ return cleanedUpUrl;
23657
+ }
23462
23658
  var AuthorizationCodeWithPkceOidcHandlerBase = class {
23463
23659
  constructor(storageUtility, redirector) {
23464
23660
  this.storageUtility = storageUtility;
@@ -23471,12 +23667,28 @@ var AuthorizationCodeWithPkceOidcHandlerBase = class {
23471
23667
  }
23472
23668
  async handleRedirect({ oidcLoginOptions, state: state2, codeVerifier, targetUrl: targetUrl3 }) {
23473
23669
  await Promise.all([
23670
+ // We use the OAuth 'state' value (which should be crypto-random) as
23671
+ // the key in our storage to store our actual SessionID. We do this
23672
+ // 'cos we'll need to lookup our session information again when the
23673
+ // browser is redirected back to us (i.e. the OAuth client
23674
+ // application) from the Authorization Server.
23675
+ // We don't want to use our session ID as the OAuth 'state' value, as
23676
+ // that session ID can be any developer-specified value, and therefore
23677
+ // may not be appropriate (since the OAuth 'state' value should really
23678
+ // be an unguessable crypto-random value).
23679
+ // eslint-disable-next-line no-underscore-dangle
23474
23680
  this.storageUtility.setForUser(state2, {
23475
23681
  sessionId: oidcLoginOptions.sessionId
23476
23682
  }),
23683
+ // Store our login-process state using the session ID as the key.
23684
+ // Strictly speaking, this indirection from our OAuth state value to
23685
+ // our session ID is unnecessary, but it provides a slightly cleaner
23686
+ // separation of concerns.
23477
23687
  this.storageUtility.setForUser(oidcLoginOptions.sessionId, {
23688
+ // eslint-disable-next-line no-underscore-dangle
23478
23689
  codeVerifier,
23479
23690
  issuer: oidcLoginOptions.issuer.toString(),
23691
+ // The redirect URL is read after redirect, so it must be stored now.
23480
23692
  redirectUrl: oidcLoginOptions.redirectUrl,
23481
23693
  dpop: oidcLoginOptions.dpop ? "true" : "false"
23482
23694
  })
@@ -23560,18 +23772,36 @@ var SessionInfoManagerBase = class {
23560
23772
  get(_) {
23561
23773
  throw new Error("Not implemented");
23562
23774
  }
23775
+ // eslint-disable-next-line class-methods-use-this
23563
23776
  async getAll() {
23564
23777
  throw new Error("Not implemented");
23565
23778
  }
23779
+ /**
23780
+ * This function removes all session-related information from storage.
23781
+ * @param sessionId the session identifier
23782
+ * @param storage the storage where session info is stored
23783
+ * @hidden
23784
+ */
23566
23785
  async clear(sessionId) {
23567
23786
  return clear(sessionId, this.storageUtility);
23568
23787
  }
23788
+ /**
23789
+ * Registers a new session, so that its ID can be retrieved.
23790
+ * @param sessionId
23791
+ */
23569
23792
  async register(_sessionId) {
23570
23793
  throw new Error("Not implemented");
23571
23794
  }
23795
+ /**
23796
+ * Returns all the registered session IDs. Differs from getAll, which also
23797
+ * returns additional session information.
23798
+ */
23572
23799
  async getRegisteredSessionIdAll() {
23573
23800
  throw new Error("Not implemented");
23574
23801
  }
23802
+ /**
23803
+ * Deletes all information about all sessions, including their registrations.
23804
+ */
23575
23805
  async clearAll() {
23576
23806
  throw new Error("Not implemented");
23577
23807
  }
@@ -23635,6 +23865,8 @@ async function handleRegistration(options, issuerConfig, storageUtility, clientR
23635
23865
  }, issuerConfig);
23636
23866
  }
23637
23867
  await storageUtility.setForUser(options.sessionId, {
23868
+ // If the client is either static or solid-oidc compliant, its client ID cannot be undefined.
23869
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
23638
23870
  clientId: options.clientId
23639
23871
  });
23640
23872
  if (options.clientSecret) {
@@ -23648,6 +23880,7 @@ async function handleRegistration(options, issuerConfig, storageUtility, clientR
23648
23880
  });
23649
23881
  }
23650
23882
  return {
23883
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
23651
23884
  clientId: options.clientId,
23652
23885
  clientSecret: options.clientSecret,
23653
23886
  clientName: options.clientName,
@@ -23788,17 +24021,20 @@ var InMemoryStorage = class {
23788
24021
  }
23789
24022
  };
23790
24023
  var ConfigurationError = class extends Error {
24024
+ /* istanbul ignore next */
23791
24025
  constructor(message4) {
23792
24026
  super(message4);
23793
24027
  }
23794
24028
  };
23795
24029
  var InvalidResponseError = class extends Error {
24030
+ /* istanbul ignore next */
23796
24031
  constructor(missingFields) {
23797
24032
  super(`Invalid response from OIDC provider: missing fields ${missingFields}`);
23798
24033
  this.missingFields = missingFields;
23799
24034
  }
23800
24035
  };
23801
24036
  var OidcProviderError = class extends Error {
24037
+ /* istanbul ignore next */
23802
24038
  constructor(message4, error5, errorDescription) {
23803
24039
  super(message4);
23804
24040
  this.error = error5;
@@ -23872,7 +24108,10 @@ async function refreshAccessToken(refreshOptions, dpopKey, eventEmitter) {
23872
24108
  }
23873
24109
  var computeRefreshDelay = (expiresIn) => {
23874
24110
  if (expiresIn !== void 0) {
23875
- return expiresIn - REFRESH_BEFORE_EXPIRATION_SECONDS > 0 ? expiresIn - REFRESH_BEFORE_EXPIRATION_SECONDS : expiresIn;
24111
+ return expiresIn - REFRESH_BEFORE_EXPIRATION_SECONDS > 0 ? (
24112
+ // We want to refresh the token 5 seconds before they actually expire.
24113
+ expiresIn - REFRESH_BEFORE_EXPIRATION_SECONDS
24114
+ ) : expiresIn;
23876
24115
  }
23877
24116
  return DEFAULT_EXPIRATION_TIME_SECONDS;
23878
24117
  };
@@ -23885,7 +24124,14 @@ async function buildAuthenticatedFetch(unauthFetch, accessToken, options) {
23885
24124
  const proactivelyRefreshToken = async () => {
23886
24125
  var _a2, _b, _c, _d;
23887
24126
  try {
23888
- const { accessToken: refreshedAccessToken, refreshToken, expiresIn } = await refreshAccessToken(currentRefreshOptions, options.dpopKey, options.eventEmitter);
24127
+ const { accessToken: refreshedAccessToken, refreshToken, expiresIn } = await refreshAccessToken(
24128
+ currentRefreshOptions,
24129
+ // If currentRefreshOptions is defined, options is necessarily defined too.
24130
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
24131
+ options.dpopKey,
24132
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
24133
+ options.eventEmitter
24134
+ );
23889
24135
  currentAccessToken = refreshedAccessToken;
23890
24136
  if (refreshToken !== void 0) {
23891
24137
  currentRefreshOptions.refreshToken = refreshToken;
@@ -23903,7 +24149,12 @@ async function buildAuthenticatedFetch(unauthFetch, accessToken, options) {
23903
24149
  }
23904
24150
  }
23905
24151
  };
23906
- latestTimeout = setTimeout(proactivelyRefreshToken, computeRefreshDelay(options.expiresIn) * 1e3);
24152
+ latestTimeout = setTimeout(
24153
+ proactivelyRefreshToken,
24154
+ // If currentRefreshOptions is defined, options is necessarily defined too.
24155
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
24156
+ computeRefreshDelay(options.expiresIn) * 1e3
24157
+ );
23907
24158
  (_a = options.eventEmitter) === null || _a === void 0 ? void 0 : _a.emit(EVENTS.TIMEOUT_SET, latestTimeout);
23908
24159
  } else if (options !== void 0 && options.eventEmitter !== void 0) {
23909
24160
  const expirationTimeout = setTimeout(() => {
@@ -23919,7 +24170,14 @@ async function buildAuthenticatedFetch(unauthFetch, accessToken, options) {
23919
24170
  }
23920
24171
  const hasBeenRedirected = response6.url !== url7;
23921
24172
  if (hasBeenRedirected && (options === null || options === void 0 ? void 0 : options.dpopKey) !== void 0) {
23922
- response6 = await makeAuthenticatedRequest(unauthFetch, currentAccessToken, response6.url, requestInit, options.dpopKey);
24173
+ response6 = await makeAuthenticatedRequest(
24174
+ unauthFetch,
24175
+ currentAccessToken,
24176
+ // Replace the original target IRI (`url`) by the redirection target
24177
+ response6.url,
24178
+ requestInit,
24179
+ options.dpopKey
24180
+ );
23923
24181
  }
23924
24182
  return response6;
23925
24183
  };
@@ -23961,6 +24219,7 @@ async function registerClient(options, issuerConfig) {
23961
24219
  }
23962
24220
  const signingAlg = determineSigningAlg(issuerConfig.idTokenSigningAlgValuesSupported, PREFERRED_SIGNING_ALG);
23963
24221
  const config = {
24222
+ /* eslint-disable camelcase */
23964
24223
  client_name: options.clientName,
23965
24224
  application_type: "web",
23966
24225
  redirect_uris: [(_a = options.redirectUrl) === null || _a === void 0 ? void 0 : _a.toString()],
@@ -23968,6 +24227,7 @@ async function registerClient(options, issuerConfig) {
23968
24227
  token_endpoint_auth_method: "client_secret_basic",
23969
24228
  id_token_signed_response_alg: signingAlg,
23970
24229
  grant_types: ["authorization_code", "refresh_token"]
24230
+ /* eslint-enable camelcase */
23971
24231
  };
23972
24232
  const headers = {
23973
24233
  "Content-Type": "application/json"
@@ -24059,11 +24319,13 @@ async function getTokens(issuer2, client, data2, dpop) {
24059
24319
  headers.Authorization = `Basic ${btoa(`${client.clientId}:${client.clientSecret}`)}`;
24060
24320
  }
24061
24321
  const requestBody = {
24322
+ /* eslint-disable camelcase */
24062
24323
  grant_type: data2.grantType,
24063
24324
  redirect_uri: data2.redirectUrl,
24064
24325
  code: data2.code,
24065
24326
  code_verifier: data2.codeVerifier,
24066
24327
  client_id: client.clientId
24328
+ /* eslint-enable camelcase */
24067
24329
  };
24068
24330
  const tokenRequestInit = {
24069
24331
  method: "POST",
@@ -24087,7 +24349,26 @@ async function getBearerToken(redirectUrl) {
24087
24349
  let signinResponse;
24088
24350
  try {
24089
24351
  const client = new import_oidc_client.OidcClient({
24352
+ // TODO: We should look at the various interfaces being used for storage,
24353
+ // i.e. between oidc-client-js (WebStorageStoreState), localStorage
24354
+ // (which has an interface Storage), and our own proprietary interface
24355
+ // IStorage - i.e. we should really just be using the browser Web Storage
24356
+ // API, e.g. "stateStore: window.localStorage,".
24357
+ // We are instantiating a new instance here, so the only value we need to
24358
+ // explicitly provide is the response mode (default otherwise will look
24359
+ // for a hash '#' fragment!).
24360
+ // eslint-disable-next-line camelcase
24090
24361
  response_mode: "query",
24362
+ // The userinfo endpoint on NSS fails, so disable this for now
24363
+ // Note that in Solid, information should be retrieved from the
24364
+ // profile referenced by the WebId.
24365
+ // TODO: Note that this is heavy-handed, and that this userinfo check
24366
+ // verifies that the `sub` claim in the id token you get along with the
24367
+ // access token matches the sub claim associated with the access token at
24368
+ // the userinfo endpoint.
24369
+ // That is a useful check, and in the future it should be only disabled
24370
+ // against NSS, and not in general.
24371
+ // Issue tracker: https://github.com/solid/node-solid-server/issues/1490
24091
24372
  loadUserInfo: false
24092
24373
  });
24093
24374
  signinResponse = await client.processSigninResponse(redirectUrl);
@@ -24108,6 +24389,13 @@ async function getBearerToken(redirectUrl) {
24108
24389
  accessToken: signinResponse.access_token,
24109
24390
  idToken: signinResponse.id_token,
24110
24391
  webId,
24392
+ // Although not a field in the TypeScript response interface, the refresh
24393
+ // token (which can optionally come back with the access token (if, as per
24394
+ // the OAuth2 spec, we requested one using the scope of 'offline_access')
24395
+ // will be included in the signin response object.
24396
+ // eslint-disable-next-line camelcase
24397
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
24398
+ // @ts-ignore
24111
24399
  refreshToken: signinResponse.refresh_token
24112
24400
  };
24113
24401
  } catch (err) {
@@ -24143,6 +24431,8 @@ async function refresh(refreshToken, issuer2, client, dpopKey) {
24143
24431
  let authHeader = {};
24144
24432
  if (client.clientSecret !== void 0) {
24145
24433
  authHeader = {
24434
+ // We assume that client_secret_basic is the client authentication method.
24435
+ // TODO: Get the authentication method from the IClient configuration object.
24146
24436
  Authorization: `Basic ${btoa(`${client.clientId}:${client.clientSecret}`)}`
24147
24437
  };
24148
24438
  } else if (isValidUrl2(client.clientId)) {
@@ -24174,18 +24464,31 @@ async function refresh(refreshToken, issuer2, client, dpopKey) {
24174
24464
  expiresIn: validatedResponse.expires_in
24175
24465
  };
24176
24466
  }
24177
- function removeOidcQueryParam(redirectUrl) {
24178
- const cleanedUrl = new URL(redirectUrl);
24179
- cleanedUrl.searchParams.delete("code");
24180
- cleanedUrl.searchParams.delete("state");
24467
+ function normalizeCallbackUrl(redirectUrl) {
24468
+ const cleanedUrl = removeOpenIdParams(redirectUrl);
24181
24469
  cleanedUrl.hash = "";
24182
- if (redirectUrl.includes(`${cleanedUrl.origin}/`)) {
24470
+ if (
24471
+ // The trailing slash is present in the original redirect URL
24472
+ redirectUrl.includes(`${cleanedUrl.origin}/`)
24473
+ ) {
24183
24474
  return cleanedUrl.href;
24184
24475
  }
24185
- return `${cleanedUrl.origin}${cleanedUrl.href.substring(cleanedUrl.origin.length + 1)}`;
24476
+ return `${cleanedUrl.origin}${cleanedUrl.href.substring(
24477
+ // Adds 1 to the origin length to remove the trailing slash
24478
+ cleanedUrl.origin.length + 1
24479
+ )}`;
24186
24480
  }
24187
24481
  async function clearOidcPersistentStorage() {
24188
24482
  const client = new import_oidc_client.OidcClient({
24483
+ // TODO: We should look at the various interfaces being used for storage,
24484
+ // i.e. between oidc-client-js (WebStorageStoreState), localStorage
24485
+ // (which has an interface Storage), and our own proprietary interface
24486
+ // IStorage - i.e. we should really just be using the browser Web Storage
24487
+ // API, e.g. "stateStore: window.localStorage,".
24488
+ // We are instantiating a new instance here, so the only value we need to
24489
+ // explicitly provide is the response mode (default otherwise will look
24490
+ // for a hash '#' fragment!).
24491
+ // eslint-disable-next-line camelcase
24189
24492
  response_mode: "query"
24190
24493
  });
24191
24494
  await client.clearStaleState(new import_oidc_client.WebStorageStateStore({}));
@@ -24212,13 +24515,14 @@ var ClientAuthentication2 = class extends ClientAuthentication {
24212
24515
  this.login = async (options, eventEmitter) => {
24213
24516
  var _a, _b;
24214
24517
  await this.sessionInfoManager.clear(options.sessionId);
24215
- const redirectUrl = (_a = options.redirectUrl) !== null && _a !== void 0 ? _a : removeOidcQueryParam(window.location.href);
24518
+ const redirectUrl = (_a = options.redirectUrl) !== null && _a !== void 0 ? _a : normalizeCallbackUrl(window.location.href);
24216
24519
  if (!isValidRedirectUrl(redirectUrl)) {
24217
24520
  throw new Error(`${redirectUrl} is not a valid redirect URL, it is either a malformed IRI, includes a hash fragment, or reserved query parameters ('code' or 'state').`);
24218
24521
  }
24219
24522
  await this.loginHandler.handle({
24220
24523
  ...options,
24221
24524
  redirectUrl,
24525
+ // If no clientName is provided, the clientId may be used instead.
24222
24526
  clientName: (_b = options.clientName) !== null && _b !== void 0 ? _b : options.clientId,
24223
24527
  eventEmitter
24224
24528
  });
@@ -24235,7 +24539,7 @@ var ClientAuthentication2 = class extends ClientAuthentication {
24235
24539
  const redirectInfo = await this.redirectHandler.handle(url7, eventEmitter);
24236
24540
  this.fetch = redirectInfo.fetch.bind(window);
24237
24541
  this.boundLogout = redirectInfo.getLogoutUrl;
24238
- this.cleanUrlAfterRedirect(url7);
24542
+ await this.cleanUrlAfterRedirect(url7);
24239
24543
  return {
24240
24544
  isLoggedIn: redirectInfo.isLoggedIn,
24241
24545
  webId: redirectInfo.webId,
@@ -24243,22 +24547,20 @@ var ClientAuthentication2 = class extends ClientAuthentication {
24243
24547
  expirationDate: redirectInfo.expirationDate
24244
24548
  };
24245
24549
  } catch (err) {
24246
- this.cleanUrlAfterRedirect(url7);
24550
+ await this.cleanUrlAfterRedirect(url7);
24247
24551
  eventEmitter.emit(EVENTS.ERROR, "redirect", err);
24248
24552
  return void 0;
24249
24553
  }
24250
24554
  };
24251
24555
  }
24252
- cleanUrlAfterRedirect(url7) {
24253
- const cleanedUpUrl = new URL(url7);
24254
- cleanedUpUrl.searchParams.delete("state");
24255
- cleanedUpUrl.searchParams.delete("code");
24256
- cleanedUpUrl.searchParams.delete("id_token");
24257
- cleanedUpUrl.searchParams.delete("access_token");
24258
- cleanedUpUrl.searchParams.delete("error");
24259
- cleanedUpUrl.searchParams.delete("error_description");
24260
- cleanedUpUrl.searchParams.delete("iss");
24261
- window.history.replaceState(null, "", cleanedUpUrl.toString());
24556
+ async cleanUrlAfterRedirect(url7) {
24557
+ const cleanedUpUrl = removeOpenIdParams(url7).href;
24558
+ window.history.replaceState(null, "", cleanedUpUrl);
24559
+ while (window.location.href !== cleanedUpUrl) {
24560
+ await new Promise((resolve) => {
24561
+ setTimeout(() => resolve(), 1);
24562
+ });
24563
+ }
24262
24564
  }
24263
24565
  };
24264
24566
  function hasIssuer(options) {
@@ -24291,7 +24593,13 @@ var OidcLoginHandler = class {
24291
24593
  const issuerConfig = await this.issuerConfigFetcher.fetchConfig(options.oidcIssuer);
24292
24594
  const clientRegistration = await handleRegistration(options, issuerConfig, this.storageUtility, this.clientRegistrar);
24293
24595
  const OidcOptions = {
24596
+ // Note that here, the issuer is not the one from the received options, but
24597
+ // from the issuer's config. This enforces the canonical URL is used and stored,
24598
+ // which is also the one present in the ID token, so storing a technically
24599
+ // valid, but different issuer URL (e.g. using a trailing slash or not) now
24600
+ // could prevent from validating the ID token later.
24294
24601
  issuer: issuerConfig.issuer,
24602
+ // TODO: differentiate if DPoP should be true
24295
24603
  dpop: options.tokenType.toLowerCase() === "dpop",
24296
24604
  ...options,
24297
24605
  issuerConfiguration: issuerConfig,
@@ -24312,6 +24620,9 @@ var AuthorizationCodeWithPkceOidcHandler = class extends AuthorizationCodeWithPk
24312
24620
  response_type: "code",
24313
24621
  scope: DEFAULT_SCOPES,
24314
24622
  filterProtocolClaims: true,
24623
+ // The userinfo endpoint on NSS fails, so disable this for now
24624
+ // Note that in Solid, information should be retrieved from the
24625
+ // profile referenced by the WebId.
24315
24626
  loadUserInfo: false,
24316
24627
  code_verifier: true,
24317
24628
  prompt: (_a = oidcLoginOptions.prompt) !== null && _a !== void 0 ? _a : "consent"
@@ -24321,7 +24632,9 @@ var AuthorizationCodeWithPkceOidcHandler = class extends AuthorizationCodeWithPk
24321
24632
  const signingRequest = await oidcClientLibrary.createSigninRequest();
24322
24633
  return await this.handleRedirect({
24323
24634
  oidcLoginOptions,
24635
+ // eslint-disable-next-line no-underscore-dangle
24324
24636
  state: signingRequest.state._id,
24637
+ // eslint-disable-next-line no-underscore-dangle
24325
24638
  codeVerifier: signingRequest.state._code_verifier,
24326
24639
  targetUrl: signingRequest.url.toString()
24327
24640
  });
@@ -24436,12 +24749,19 @@ var IssuerConfigFetcher = class _IssuerConfigFetcher {
24436
24749
  this.storageUtility = storageUtility;
24437
24750
  this.storageUtility = storageUtility;
24438
24751
  }
24752
+ // This method needs no state (so can be static), and can be exposed to allow
24753
+ // callers to know where this implementation puts state it needs.
24439
24754
  static getLocalStorageKey(issuer2) {
24440
24755
  return `issuerConfig:${issuer2}`;
24441
24756
  }
24442
24757
  async fetchConfig(issuer2) {
24443
24758
  let issuerConfig;
24444
- const openIdConfigUrl = new URL(WELL_KNOWN_OPENID_CONFIG, issuer2.endsWith("/") ? issuer2 : `${issuer2}/`).href;
24759
+ const openIdConfigUrl = new URL(
24760
+ WELL_KNOWN_OPENID_CONFIG,
24761
+ // Make sure to append a slash at issuer URL, so that the .well-known URL
24762
+ // includes the full issuer path. See https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig.
24763
+ issuer2.endsWith("/") ? issuer2 : `${issuer2}/`
24764
+ ).href;
24445
24765
  const issuerConfigRequestBody = await fetch2.call(globalThis, openIdConfigUrl);
24446
24766
  try {
24447
24767
  issuerConfig = processConfig(await issuerConfigRequestBody.json());
@@ -24506,9 +24826,16 @@ var SessionInfoManager = class extends SessionInfoManagerBase {
24506
24826
  issuer: issuer2,
24507
24827
  clientAppId: clientId,
24508
24828
  clientAppSecret: clientSecret,
24829
+ // Default the token type to DPoP if unspecified.
24509
24830
  tokenType: tokenType !== null && tokenType !== void 0 ? tokenType : "DPoP"
24510
24831
  };
24511
24832
  }
24833
+ /**
24834
+ * This function removes all session-related information from storage.
24835
+ * @param sessionId the session identifier
24836
+ * @param storage the storage where session info is stored
24837
+ * @hidden
24838
+ */
24512
24839
  async clear(sessionId) {
24513
24840
  return clear2(sessionId, this.storageUtility);
24514
24841
  }
@@ -24574,6 +24901,8 @@ var AuthCodeRedirectHandler = class {
24574
24901
  if (isDpop) {
24575
24902
  tokens = await getDpopToken(issuerConfig, client, {
24576
24903
  grantType: "authorization_code",
24904
+ // We rely on our 'canHandle' function checking that the OAuth 'code'
24905
+ // parameter is present in our query string.
24577
24906
  code: url7.searchParams.get("code"),
24578
24907
  codeVerifier,
24579
24908
  redirectUrl: storedRedirectIri
@@ -24650,13 +24979,21 @@ var ClientRegistrar = class {
24650
24979
  this.storageUtility = storageUtility;
24651
24980
  }
24652
24981
  async getClient(options, issuerConfig) {
24653
- const [storedClientId, storedClientSecret] = await Promise.all([
24982
+ const [
24983
+ storedClientId,
24984
+ storedClientSecret
24985
+ // storedClientName,
24986
+ ] = await Promise.all([
24654
24987
  this.storageUtility.getForUser(options.sessionId, "clientId", {
24655
24988
  secure: false
24656
24989
  }),
24657
24990
  this.storageUtility.getForUser(options.sessionId, "clientSecret", {
24658
24991
  secure: false
24659
24992
  })
24993
+ // this.storageUtility.getForUser(options.sessionId, "clientName", {
24994
+ // // FIXME: figure out how to persist secure storage at reload
24995
+ // secure: false,
24996
+ // }),
24660
24997
  ]);
24661
24998
  if (storedClientId) {
24662
24999
  return {
@@ -24677,6 +25014,9 @@ var ClientRegistrar = class {
24677
25014
  infoToSave.idTokenSignedResponseAlg = registeredClient.idTokenSignedResponseAlg;
24678
25015
  }
24679
25016
  await this.storageUtility.setForUser(options.sessionId, infoToSave, {
25017
+ // FIXME: figure out how to persist secure storage at reload
25018
+ // Otherwise, the client info cannot be retrieved from storage, and
25019
+ // the lib tries to re-register the client on each fetch
24680
25020
  secure: false
24681
25021
  });
24682
25022
  return registeredClient;
@@ -24745,6 +25085,8 @@ function getClientAuthenticationWithDependencies(dependencies3) {
24745
25085
  const redirectHandler = new AggregateRedirectHandler([
24746
25086
  new ErrorOidcHandler(),
24747
25087
  new AuthCodeRedirectHandler(storageUtility, sessionInfoManager, issuerConfigFetcher, clientRegistrar, tokenRefresher),
25088
+ // This catch-all class will always be able to handle the
25089
+ // redirect IRI, so it must be registered last.
24748
25090
  new FallbackRedirectHandler()
24749
25091
  ]);
24750
25092
  return new ClientAuthentication2(loginHandler, redirectHandler, new IWaterfallLogoutHandler(sessionInfoManager, redirector), sessionInfoManager, issuerConfigFetcher);
@@ -24773,6 +25115,21 @@ function isLoggedIn(sessionInfo) {
24773
25115
  return !!(sessionInfo === null || sessionInfo === void 0 ? void 0 : sessionInfo.isLoggedIn);
24774
25116
  }
24775
25117
  var Session = class _Session extends import_events2.default {
25118
+ /**
25119
+ * Session object constructor. Typically called as follows:
25120
+ *
25121
+ * ```typescript
25122
+ * const session = new Session();
25123
+ * ```
25124
+ *
25125
+ * See also [getDefaultSession](https://docs.inrupt.com/developer-tools/api/javascript/solid-client-authn-browser/functions.html#getdefaultsession).
25126
+ *
25127
+ * @param sessionOptions The options enabling the correct instantiation of
25128
+ * the session. Either both storages or clientAuthentication are required. For
25129
+ * more information, see {@link ISessionOptions}.
25130
+ * @param sessionId A string uniquely identifying the session.
25131
+ *
25132
+ */
24776
25133
  constructor(sessionOptions = {}, sessionId = void 0) {
24777
25134
  super();
24778
25135
  this.tokenRequestInProgress = false;
@@ -24781,6 +25138,7 @@ var Session = class _Session extends import_events2.default {
24781
25138
  await this.clientAuthentication.login({
24782
25139
  sessionId: this.info.sessionId,
24783
25140
  ...options,
25141
+ // Defaults the token type to DPoP
24784
25142
  tokenType: (_a = options.tokenType) !== null && _a !== void 0 ? _a : "DPoP"
24785
25143
  }, this.events);
24786
25144
  return new Promise(() => {
@@ -24857,18 +25215,55 @@ var Session = class _Session extends import_events2.default {
24857
25215
  this.events.on(EVENTS.SESSION_EXPIRED, () => this.internalLogout(false));
24858
25216
  this.events.on(EVENTS.ERROR, () => this.internalLogout(false));
24859
25217
  }
25218
+ /**
25219
+ * Register a callback function to be called when a user completes login.
25220
+ *
25221
+ * The callback is called when {@link handleIncomingRedirect} completes successfully.
25222
+ *
25223
+ * @param callback The function called when a user completes login.
25224
+ * @deprecated Prefer session.events.on(EVENTS.LOGIN, callback)
25225
+ */
24860
25226
  onLogin(callback) {
24861
25227
  this.events.on(EVENTS.LOGIN, callback);
24862
25228
  }
25229
+ /**
25230
+ * Register a callback function to be called when a user logs out:
25231
+ *
25232
+ * @param callback The function called when a user completes logout.
25233
+ * @deprecated Prefer session.events.on(EVENTS.LOGOUT, callback)
25234
+ */
24863
25235
  onLogout(callback) {
24864
25236
  this.events.on(EVENTS.LOGOUT, callback);
24865
25237
  }
25238
+ /**
25239
+ * Register a callback function to be called when a user logs out:
25240
+ *
25241
+ * @param callback The function called when an error occurs.
25242
+ * @since 1.11.0
25243
+ * @deprecated Prefer session.events.on(EVENTS.ERROR, callback)
25244
+ */
24866
25245
  onError(callback) {
24867
25246
  this.events.on(EVENTS.ERROR, callback);
24868
25247
  }
25248
+ /**
25249
+ * Register a callback function to be called when a session is restored.
25250
+ *
25251
+ * Note: the callback will be called with the saved value of the 'current URL'
25252
+ * at the time the session was restored.
25253
+ *
25254
+ * @param callback The function called when a user's already logged-in session is restored, e.g., after a silent authentication is completed after a page refresh.
25255
+ * @deprecated Prefer session.events.on(EVENTS.SESSION_RESTORED, callback)
25256
+ */
24869
25257
  onSessionRestore(callback) {
24870
25258
  this.events.on(EVENTS.SESSION_RESTORED, callback);
24871
25259
  }
25260
+ /**
25261
+ * Register a callback that runs when the session expires and can no longer
25262
+ * make authenticated requests, but following a user logout.
25263
+ * @param callback The function that runs on session expiration.
25264
+ * @since 1.11.0
25265
+ * @deprecated Prefer session.events.on(EVENTS.SESSION_EXPIRED, callback)
25266
+ */
24872
25267
  onSessionExpiration(callback) {
24873
25268
  this.events.on(EVENTS.SESSION_EXPIRED, callback);
24874
25269
  }
@@ -24983,23 +25378,23 @@ function _typeof(o) {
24983
25378
  }
24984
25379
 
24985
25380
  // ../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
24986
- function _toPrimitive(input2, hint2) {
24987
- if (_typeof(input2) !== "object" || input2 === null)
24988
- return input2;
24989
- var prim = input2[Symbol.toPrimitive];
24990
- if (prim !== void 0) {
24991
- var res = prim.call(input2, hint2 || "default");
24992
- if (_typeof(res) !== "object")
24993
- return res;
25381
+ function toPrimitive(t, r) {
25382
+ if ("object" != _typeof(t) || !t)
25383
+ return t;
25384
+ var e = t[Symbol.toPrimitive];
25385
+ if (void 0 !== e) {
25386
+ var i = e.call(t, r || "default");
25387
+ if ("object" != _typeof(i))
25388
+ return i;
24994
25389
  throw new TypeError("@@toPrimitive must return a primitive value.");
24995
25390
  }
24996
- return (hint2 === "string" ? String : Number)(input2);
25391
+ return ("string" === r ? String : Number)(t);
24997
25392
  }
24998
25393
 
24999
25394
  // ../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
25000
- function _toPropertyKey(arg2) {
25001
- var key3 = _toPrimitive(arg2, "string");
25002
- return _typeof(key3) === "symbol" ? key3 : String(key3);
25395
+ function toPropertyKey(t) {
25396
+ var i = toPrimitive(t, "string");
25397
+ return "symbol" == _typeof(i) ? i : String(i);
25003
25398
  }
25004
25399
 
25005
25400
  // ../node_modules/@babel/runtime/helpers/esm/createClass.js
@@ -25010,7 +25405,7 @@ function _defineProperties(target5, props) {
25010
25405
  descriptor.configurable = true;
25011
25406
  if ("value" in descriptor)
25012
25407
  descriptor.writable = true;
25013
- Object.defineProperty(target5, _toPropertyKey(descriptor.key), descriptor);
25408
+ Object.defineProperty(target5, toPropertyKey(descriptor.key), descriptor);
25014
25409
  }
25015
25410
  }
25016
25411
  function _createClass(Constructor, protoProps, staticProps) {
@@ -25087,7 +25482,7 @@ function _getPrototypeOf(o) {
25087
25482
 
25088
25483
  // ../node_modules/@babel/runtime/helpers/esm/defineProperty.js
25089
25484
  function _defineProperty(obj, key3, value6) {
25090
- key3 = _toPropertyKey(key3);
25485
+ key3 = toPropertyKey(key3);
25091
25486
  if (key3 in obj) {
25092
25487
  Object.defineProperty(obj, key3, {
25093
25488
  value: value6,
@@ -26966,7 +27361,7 @@ var Serializer = /* @__PURE__ */ function() {
26966
27361
  } else if (this.flags.indexOf("u") >= 0) {
26967
27362
  uri6 = backslashUify(uri6);
26968
27363
  } else {
26969
- uri6 = hexify(uri6);
27364
+ uri6 = hexify(decodeURI(uri6));
26970
27365
  }
26971
27366
  return "<" + uri6 + ">";
26972
27367
  }
@@ -31699,7 +32094,7 @@ function listToCollection(kb, obj) {
31699
32094
  }
31700
32095
  function jsonldParser(str, kb, base2, callback) {
31701
32096
  var baseString = base2 && Object.prototype.hasOwnProperty.call(base2, "termType") ? base2.value : base2;
31702
- return import("./jsonld-5UGKFKA6.js").then(function(jsonld) {
32097
+ return import("./jsonld-REJIJLLT.js").then(function(jsonld) {
31703
32098
  return jsonld.flatten(JSON.parse(str), null, {
31704
32099
  base: baseString
31705
32100
  });
@@ -36676,8 +37071,8 @@ var UpdateManager = /* @__PURE__ */ function() {
36676
37071
  return uri6.slice(0, 4) === "http";
36677
37072
  }
36678
37073
  /** Remove from the store HTTP authorization metadata
36679
- * The editble function below relies on copies we have in the store
36680
- * of the results of previous HTTP transactions. Howver, when
37074
+ * The editable function below relies on copies we have in the store
37075
+ * of the results of previous HTTP transactions. However, when
36681
37076
  * the user logs in, then that data misrepresents what would happen
36682
37077
  * if the user tried again.
36683
37078
  */
@@ -36715,7 +37110,7 @@ var UpdateManager = /* @__PURE__ */ function() {
36715
37110
  * and local write access is determined by those headers.
36716
37111
  * This async version not only looks at past HTTP requests, it also makes new ones if necessary.
36717
37112
  *
36718
- * @returns The method string SPARQL or DAV or
37113
+ * @returns The method string N3PATCH or SPARQL or DAV or
36719
37114
  * LOCALFILE or false if known, undefined if not known.
36720
37115
  */
36721
37116
  }, {
@@ -36821,6 +37216,8 @@ var UpdateManager = /* @__PURE__ */ function() {
36821
37216
  if (acceptPatch.length) {
36822
37217
  for (var i = 0; i < acceptPatch.length; i++) {
36823
37218
  method5 = acceptPatch[i].value.trim();
37219
+ if (method5.indexOf("text/n3") >= 0)
37220
+ return "N3PATCH";
36824
37221
  if (method5.indexOf("application/sparql-update") >= 0)
36825
37222
  return "SPARQL";
36826
37223
  if (method5.indexOf("application/sparql-update-single-match") >= 0)
@@ -36868,7 +37265,8 @@ var UpdateManager = /* @__PURE__ */ function() {
36868
37265
  }, {
36869
37266
  key: "anonymize",
36870
37267
  value: function anonymize(obj) {
36871
- return obj.toNT().substr(0, 2) === "_:" && this.mentioned(obj) ? "?" + obj.toNT().substr(2) : obj.toNT();
37268
+ var anonymized = obj.toNT().substr(0, 2) === "_:" && this.mentioned(obj) ? "?" + obj.toNT().substr(2) : obj.toNT();
37269
+ return anonymized;
36872
37270
  }
36873
37271
  }, {
36874
37272
  key: "anonymizeNT",
@@ -37045,7 +37443,7 @@ var UpdateManager = /* @__PURE__ */ function() {
37045
37443
  throw new Error("No URI given for remote editing operation: " + query4);
37046
37444
  }
37047
37445
  options.noMeta = true;
37048
- options.contentType = "application/sparql-update";
37446
+ options.contentType = options.contentType || "application/sparql-update";
37049
37447
  options.body = query4;
37050
37448
  return _this.store.fetcher.webOperation("PATCH", uri6, options);
37051
37449
  }).then(function(response6) {
@@ -37058,7 +37456,7 @@ var UpdateManager = /* @__PURE__ */ function() {
37058
37456
  callbackFunction(uri6, false, err.message, err);
37059
37457
  });
37060
37458
  }
37061
- // ARE THESE THEE FUNCTIONS USED? DEPROCATE?
37459
+ // ARE THESE THREE FUNCTIONS USED? DEPRECATE?
37062
37460
  /** return a statemnet updating function
37063
37461
  *
37064
37462
  * This does NOT update the statement.
@@ -37322,7 +37720,89 @@ var UpdateManager = /* @__PURE__ */ function() {
37322
37720
  return Promise.all(updates);
37323
37721
  }
37324
37722
  /**
37325
- * This high-level function updates the local store iff the web is changed successfully.
37723
+ * @private
37724
+ *
37725
+ * This helper function constructs SPARQL Update query from resolved arguments.
37726
+ *
37727
+ * @param ds: deletions array.
37728
+ * @param is: insertions array.
37729
+ * @param bnodes_context: Additional context to uniquely identify any blank nodes.
37730
+ */
37731
+ }, {
37732
+ key: "constructSparqlUpdateQuery",
37733
+ value: function constructSparqlUpdateQuery(ds, is, bnodes_context) {
37734
+ var whereClause = this.contextWhere(bnodes_context);
37735
+ var query4 = "";
37736
+ if (whereClause.length) {
37737
+ if (ds.length) {
37738
+ query4 += "DELETE { ";
37739
+ for (var i = 0; i < ds.length; i++) {
37740
+ query4 += this.anonymizeNT(ds[i]) + "\n";
37741
+ }
37742
+ query4 += " }\n";
37743
+ }
37744
+ if (is.length) {
37745
+ query4 += "INSERT { ";
37746
+ for (var _i5 = 0; _i5 < is.length; _i5++) {
37747
+ query4 += this.anonymizeNT(is[_i5]) + "\n";
37748
+ }
37749
+ query4 += " }\n";
37750
+ }
37751
+ query4 += whereClause;
37752
+ } else {
37753
+ if (ds.length) {
37754
+ query4 += "DELETE DATA { ";
37755
+ for (var _i6 = 0; _i6 < ds.length; _i6++) {
37756
+ query4 += this.anonymizeNT(ds[_i6]) + "\n";
37757
+ }
37758
+ query4 += " } \n";
37759
+ }
37760
+ if (is.length) {
37761
+ if (ds.length)
37762
+ query4 += " ; ";
37763
+ query4 += "INSERT DATA { ";
37764
+ for (var _i7 = 0; _i7 < is.length; _i7++) {
37765
+ query4 += this.nTriples(is[_i7]) + "\n";
37766
+ }
37767
+ query4 += " }\n";
37768
+ }
37769
+ }
37770
+ return query4;
37771
+ }
37772
+ /**
37773
+ * @private
37774
+ *
37775
+ * This helper function constructs n3-patch query from resolved arguments.
37776
+ *
37777
+ * @param ds: deletions array.
37778
+ * @param is: insertions array.
37779
+ * @param bnodes_context: Additional context to uniquely identify any blanknodes.
37780
+ */
37781
+ }, {
37782
+ key: "constructN3PatchQuery",
37783
+ value: function constructN3PatchQuery(ds, is, bnodes_context) {
37784
+ var _this3 = this;
37785
+ var query4 = "\n@prefix solid: <http://www.w3.org/ns/solid/terms#>.\n@prefix ex: <http://www.example.org/terms#>.\n\n_:patch\n";
37786
+ if (bnodes_context && bnodes_context.length > 0) {
37787
+ query4 += "\n solid:where {\n ".concat(bnodes_context.map(function(x) {
37788
+ return _this3.anonymizeNT(x);
37789
+ }).join("\n "), "\n };");
37790
+ }
37791
+ if (ds.length > 0) {
37792
+ query4 += "\n solid:deletes {\n ".concat(ds.map(function(x) {
37793
+ return _this3.anonymizeNT(x);
37794
+ }).join("\n "), "\n };");
37795
+ }
37796
+ if (is.length > 0) {
37797
+ query4 += "\n solid:inserts {\n ".concat(is.map(function(x) {
37798
+ return _this3.anonymizeNT(x);
37799
+ }).join("\n "), "\n };");
37800
+ }
37801
+ query4 += " a solid:InsertDeletePatch .\n";
37802
+ return query4;
37803
+ }
37804
+ /**
37805
+ * This high-level function updates the local store if the web is changed successfully.
37326
37806
  * Deletions, insertions may be undefined or single statements or lists or formulae (may contain bnodes which can be indirectly identified by a where clause).
37327
37807
  * The `why` property of each statement must be the same and give the web document to be updated.
37328
37808
  * @param deletions - Statement or statements to be deleted.
@@ -37334,7 +37814,7 @@ var UpdateManager = /* @__PURE__ */ function() {
37334
37814
  }, {
37335
37815
  key: "update",
37336
37816
  value: function update(deletions, insertions, callback, secondTry) {
37337
- var _this3 = this;
37817
+ var _this4 = this;
37338
37818
  var options = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {};
37339
37819
  if (!callback) {
37340
37820
  var thisUpdater = this;
@@ -37396,61 +37876,28 @@ var UpdateManager = /* @__PURE__ */ function() {
37396
37876
  }
37397
37877
  if (protocol6 === void 0) {
37398
37878
  if (secondTry) {
37399
- throw new Error("Update: Loaded " + doc + "but stil can't figure out what editing protcol it supports.");
37879
+ throw new Error("Update: Loaded " + doc + "but still can't figure out what editing protocol it supports.");
37400
37880
  }
37401
37881
  this.store.fetcher.load(doc).then(function(response6) {
37402
- _this3.update(deletions, insertions, callback, true, options);
37882
+ _this4.update(deletions, insertions, callback, true, options);
37403
37883
  }, function(err) {
37404
37884
  if (err.response.status === 404) {
37405
- _this3.update(deletions, insertions, callback, true, options);
37885
+ _this4.update(deletions, insertions, callback, true, options);
37406
37886
  } else {
37407
37887
  throw new Error("Update: Can't get updatability status ".concat(doc, " before patching: ").concat(err));
37408
37888
  }
37409
37889
  });
37410
37890
  return;
37411
- } else if (protocol6.indexOf("SPARQL") >= 0) {
37891
+ } else if (protocol6.indexOf("SPARQL") >= 0 || protocol6.indexOf("N3PATCH") >= 0) {
37892
+ var isSparql = protocol6.indexOf("SPARQL") >= 0;
37412
37893
  var bnodes = [];
37413
37894
  if (ds.length)
37414
37895
  bnodes = this.statementArrayBnodes(ds);
37415
37896
  if (is.length)
37416
37897
  bnodes = bnodes.concat(this.statementArrayBnodes(is));
37417
37898
  var context3 = this.bnodeContext(bnodes, doc);
37418
- var whereClause = this.contextWhere(context3);
37419
- var query4 = "";
37420
- if (whereClause.length) {
37421
- if (ds.length) {
37422
- query4 += "DELETE { ";
37423
- for (var i = 0; i < ds.length; i++) {
37424
- query4 += this.anonymizeNT(ds[i]) + "\n";
37425
- }
37426
- query4 += " }\n";
37427
- }
37428
- if (is.length) {
37429
- query4 += "INSERT { ";
37430
- for (var _i5 = 0; _i5 < is.length; _i5++) {
37431
- query4 += this.anonymizeNT(is[_i5]) + "\n";
37432
- }
37433
- query4 += " }\n";
37434
- }
37435
- query4 += whereClause;
37436
- } else {
37437
- if (ds.length) {
37438
- query4 += "DELETE DATA { ";
37439
- for (var _i6 = 0; _i6 < ds.length; _i6++) {
37440
- query4 += this.anonymizeNT(ds[_i6]) + "\n";
37441
- }
37442
- query4 += " } \n";
37443
- }
37444
- if (is.length) {
37445
- if (ds.length)
37446
- query4 += " ; ";
37447
- query4 += "INSERT DATA { ";
37448
- for (var _i7 = 0; _i7 < is.length; _i7++) {
37449
- query4 += this.nTriples(is[_i7]) + "\n";
37450
- }
37451
- query4 += " }\n";
37452
- }
37453
- }
37899
+ var query4 = isSparql ? this.constructSparqlUpdateQuery(ds, is, context3) : this.constructN3PatchQuery(ds, is, context3);
37900
+ options.contentType = isSparql ? "application/sparql-update" : "text/n3";
37454
37901
  control2.pendingUpstream = control2.pendingUpstream ? control2.pendingUpstream + 1 : 1;
37455
37902
  if ("upstreamCount" in control2) {
37456
37903
  control2.upstreamCount += 1;
@@ -37464,8 +37911,8 @@ var UpdateManager = /* @__PURE__ */ function() {
37464
37911
  success2 = false;
37465
37912
  body = "Remote Ok BUT error deleting " + ds.length + " from store!!! " + e;
37466
37913
  }
37467
- for (var _i8 = 0; _i8 < is.length; _i8++) {
37468
- kb.add(is[_i8].subject, is[_i8].predicate, is[_i8].object, doc);
37914
+ for (var i = 0; i < is.length; i++) {
37915
+ kb.add(is[i].subject, is[i].predicate, is[i].object, doc);
37469
37916
  }
37470
37917
  }
37471
37918
  callback(uri6, success2, body, response6);
@@ -37516,8 +37963,8 @@ var UpdateManager = /* @__PURE__ */ function() {
37516
37963
  for (var i = 0; i < ds.length; i++) {
37517
37964
  RDFArrayRemove(newSts, ds[i]);
37518
37965
  }
37519
- for (var _i9 = 0; _i9 < is.length; _i9++) {
37520
- newSts.push(is[_i9]);
37966
+ for (var _i8 = 0; _i8 < is.length; _i8++) {
37967
+ newSts.push(is[_i8]);
37521
37968
  }
37522
37969
  var documentString = this.serialize(doc.value, newSts, contentType4);
37523
37970
  var candidateTarget = kb.the(response6, this.ns.httph("content-location"));
@@ -37532,11 +37979,11 @@ var UpdateManager = /* @__PURE__ */ function() {
37532
37979
  if (!response7.ok) {
37533
37980
  throw new Error(response7.error);
37534
37981
  }
37535
- for (var _i10 = 0; _i10 < ds.length; _i10++) {
37536
- kb.remove(ds[_i10]);
37982
+ for (var _i9 = 0; _i9 < ds.length; _i9++) {
37983
+ kb.remove(ds[_i9]);
37537
37984
  }
37538
- for (var _i11 = 0; _i11 < is.length; _i11++) {
37539
- kb.add(is[_i11].subject, is[_i11].predicate, is[_i11].object, doc);
37985
+ for (var _i10 = 0; _i10 < is.length; _i10++) {
37986
+ kb.add(is[_i10].subject, is[_i10].predicate, is[_i10].object, doc);
37540
37987
  }
37541
37988
  callbackFunction(doc.value, response7.ok, response7.responseText, response7);
37542
37989
  }).catch(function(err) {
@@ -37561,8 +38008,8 @@ var UpdateManager = /* @__PURE__ */ function() {
37561
38008
  for (var i = 0; i < ds.length; i++) {
37562
38009
  RDFArrayRemove(newSts, ds[i]);
37563
38010
  }
37564
- for (var _i12 = 0; _i12 < is.length; _i12++) {
37565
- newSts.push(is[_i12]);
38011
+ for (var _i11 = 0; _i11 < is.length; _i11++) {
38012
+ newSts.push(is[_i11]);
37566
38013
  }
37567
38014
  var dot = doc.value.lastIndexOf(".");
37568
38015
  if (dot < 1) {
@@ -37578,11 +38025,11 @@ var UpdateManager = /* @__PURE__ */ function() {
37578
38025
  kb.fetcher.webOperation("PUT", doc.value, options).then(function(response6) {
37579
38026
  if (!response6.ok)
37580
38027
  return callbackFunction(doc.value, false, response6.error);
37581
- for (var _i13 = 0; _i13 < ds.length; _i13++) {
37582
- kb.remove(ds[_i13]);
38028
+ for (var _i12 = 0; _i12 < ds.length; _i12++) {
38029
+ kb.remove(ds[_i12]);
37583
38030
  }
37584
- for (var _i14 = 0; _i14 < is.length; _i14++) {
37585
- kb.add(is[_i14].subject, is[_i14].predicate, is[_i14].object, doc);
38031
+ for (var _i13 = 0; _i13 < is.length; _i13++) {
38032
+ kb.add(is[_i13].subject, is[_i13].predicate, is[_i13].object, doc);
37586
38033
  }
37587
38034
  callbackFunction(doc.value, true, "");
37588
38035
  });
@@ -37625,11 +38072,11 @@ var UpdateManager = /* @__PURE__ */ function() {
37625
38072
  }, {
37626
38073
  key: "put",
37627
38074
  value: function put(doc, data2, contentType4, callback) {
37628
- var _this4 = this;
38075
+ var _this5 = this;
37629
38076
  var kb = this.store;
37630
38077
  var documentString;
37631
38078
  return Promise.resolve().then(function() {
37632
- documentString = _this4.serialize(doc.value, data2, contentType4);
38079
+ documentString = _this5.serialize(doc.value, data2, contentType4);
37633
38080
  return kb.fetcher.webOperation("PUT", doc.value, {
37634
38081
  contentType: contentType4,
37635
38082
  body: documentString