@pod-os/core 0.11.1-fb75eb3.0 → 0.11.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/lib/index.js CHANGED
@@ -454,7 +454,7 @@ var PodOS = (() => {
454
454
  }([function(t, e, r) {
455
455
  "use strict";
456
456
  Object.defineProperty(e, "__esModule", { value: true });
457
- var n2 = function() {
457
+ var n2 = /* @__PURE__ */ function() {
458
458
  function t2(t3, e2) {
459
459
  for (var r2 = 0; r2 < e2.length; r2++) {
460
460
  var n3 = e2[r2];
@@ -530,7 +530,7 @@ var PodOS = (() => {
530
530
  }, function(t, e, r) {
531
531
  "use strict";
532
532
  Object.defineProperty(e, "__esModule", { value: true });
533
- var n2 = function() {
533
+ var n2 = /* @__PURE__ */ function() {
534
534
  function t2(t3, e2) {
535
535
  for (var r2 = 0; r2 < e2.length; r2++) {
536
536
  var n3 = e2[r2];
@@ -591,7 +591,7 @@ var PodOS = (() => {
591
591
  }, function(t, e, r) {
592
592
  "use strict";
593
593
  Object.defineProperty(e, "__esModule", { value: true }), e.MetadataService = void 0;
594
- var n2 = function() {
594
+ var n2 = /* @__PURE__ */ function() {
595
595
  function t2(t3, e2) {
596
596
  for (var r2 = 0; r2 < e2.length; r2++) {
597
597
  var n3 = e2[r2];
@@ -703,7 +703,7 @@ var PodOS = (() => {
703
703
  return typeof t2;
704
704
  } : function(t2) {
705
705
  return t2 && "function" == typeof Symbol && t2.constructor === Symbol && t2 !== Symbol.prototype ? "symbol" : typeof t2;
706
- }, i = function() {
706
+ }, i = /* @__PURE__ */ function() {
707
707
  function t2(t3, e2) {
708
708
  for (var r2 = 0; r2 < e2.length; r2++) {
709
709
  var n3 = e2[r2];
@@ -982,7 +982,7 @@ var PodOS = (() => {
982
982
  }, function(t, e, r) {
983
983
  "use strict";
984
984
  Object.defineProperty(e, "__esModule", { value: true }), e.State = void 0;
985
- var n2 = function() {
985
+ var n2 = /* @__PURE__ */ function() {
986
986
  function t2(t3, e2) {
987
987
  for (var r2 = 0; r2 < e2.length; r2++) {
988
988
  var n3 = e2[r2];
@@ -1047,7 +1047,7 @@ var PodOS = (() => {
1047
1047
  }, function(t, e, r) {
1048
1048
  "use strict";
1049
1049
  Object.defineProperty(e, "__esModule", { value: true }), e.OidcClient = void 0;
1050
- var n2 = function() {
1050
+ var n2 = /* @__PURE__ */ function() {
1051
1051
  function t2(t3, e2) {
1052
1052
  for (var r2 = 0; r2 < e2.length; r2++) {
1053
1053
  var n3 = e2[r2];
@@ -1207,7 +1207,7 @@ var PodOS = (() => {
1207
1207
  }, function(t, e, r) {
1208
1208
  "use strict";
1209
1209
  Object.defineProperty(e, "__esModule", { value: true }), e.SigninState = void 0;
1210
- var n2 = function() {
1210
+ var n2 = /* @__PURE__ */ function() {
1211
1211
  function t2(t3, e2) {
1212
1212
  for (var r2 = 0; r2 < e2.length; r2++) {
1213
1213
  var n3 = e2[r2];
@@ -1279,12 +1279,12 @@ var PodOS = (() => {
1279
1279
  };
1280
1280
  var i = "undefined" != typeof window ? window.crypto || window.msCrypto : null;
1281
1281
  function o() {
1282
- return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function(t2) {
1282
+ return ("10000000-1000-4000-8000" + -1e11).replace(/[018]/g, function(t2) {
1283
1283
  return (t2 ^ i.getRandomValues(new Uint8Array(1))[0] & 15 >> t2 / 4).toString(16);
1284
1284
  });
1285
1285
  }
1286
1286
  function s() {
1287
- return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function(t2) {
1287
+ return ("10000000-1000-4000-8000" + -1e11).replace(/[018]/g, function(t2) {
1288
1288
  return (t2 ^ 16 * Math.random() >> t2 / 4).toString(16);
1289
1289
  });
1290
1290
  }
@@ -1292,7 +1292,7 @@ var PodOS = (() => {
1292
1292
  }, function(t, e, r) {
1293
1293
  "use strict";
1294
1294
  Object.defineProperty(e, "__esModule", { value: true }), e.User = void 0;
1295
- var n2 = function() {
1295
+ var n2 = /* @__PURE__ */ function() {
1296
1296
  function t2(t3, e2) {
1297
1297
  for (var r2 = 0; r2 < e2.length; r2++) {
1298
1298
  var n3 = e2[r2];
@@ -1400,7 +1400,7 @@ var PodOS = (() => {
1400
1400
  }, function(t, e, r) {
1401
1401
  "use strict";
1402
1402
  Object.defineProperty(e, "__esModule", { value: true }), e.SessionMonitor = void 0;
1403
- var n2 = function() {
1403
+ var n2 = /* @__PURE__ */ function() {
1404
1404
  function t2(t3, e2) {
1405
1405
  for (var r2 = 0; r2 < e2.length; r2++) {
1406
1406
  var n3 = e2[r2];
@@ -1561,7 +1561,7 @@ var PodOS = (() => {
1561
1561
  }, function(t, e, r) {
1562
1562
  "use strict";
1563
1563
  Object.defineProperty(e, "__esModule", { value: true }), e.CordovaPopupWindow = void 0;
1564
- var n2 = function() {
1564
+ var n2 = /* @__PURE__ */ function() {
1565
1565
  function t2(t3, e2) {
1566
1566
  for (var r2 = 0; r2 < e2.length; r2++) {
1567
1567
  var n3 = e2[r2];
@@ -1905,7 +1905,7 @@ var PodOS = (() => {
1905
1905
  return typeof t3;
1906
1906
  } : function(t3) {
1907
1907
  return t3 && "function" == typeof Symbol && t3.constructor === Symbol && t3 !== Symbol.prototype ? "symbol" : typeof t3;
1908
- }, d = { userAgent: false }, p = {}, v2 = v2 || (r2 = Math, i = (n2 = {}).lib = {}, o = i.Base = function() {
1908
+ }, d = { userAgent: false }, p = {}, v2 = v2 || (r2 = Math, i = (n2 = {}).lib = {}, o = i.Base = /* @__PURE__ */ function() {
1909
1909
  function t3() {
1910
1910
  }
1911
1911
  return { extend: function e2(r3) {
@@ -4445,7 +4445,7 @@ var PodOS = (() => {
4445
4445
  e2[f2[w2]] = n3;
4446
4446
  };
4447
4447
  }(), 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"]);
4448
- var tn = function() {
4448
+ var tn = /* @__PURE__ */ function() {
4449
4449
  var t3 = function t4(r4, n4, i3) {
4450
4450
  return e2(v2.AES, r4, n4, i3);
4451
4451
  }, e2 = function t4(e3, r4, n4, i3) {
@@ -6605,7 +6605,7 @@ var PodOS = (() => {
6605
6605
  }).call(this, r(29));
6606
6606
  }, function(t, e) {
6607
6607
  var r;
6608
- r = function() {
6608
+ r = /* @__PURE__ */ function() {
6609
6609
  return this;
6610
6610
  }();
6611
6611
  try {
@@ -6774,7 +6774,7 @@ var PodOS = (() => {
6774
6774
  }, function(t, e, r) {
6775
6775
  "use strict";
6776
6776
  Object.defineProperty(e, "__esModule", { value: true }), e.SigninResponse = void 0;
6777
- var n2 = function() {
6777
+ var n2 = /* @__PURE__ */ function() {
6778
6778
  function t2(t3, e2) {
6779
6779
  for (var r2 = 0; r2 < e2.length; r2++) {
6780
6780
  var n3 = e2[r2];
@@ -6847,7 +6847,7 @@ var PodOS = (() => {
6847
6847
  }, function(t, e, r) {
6848
6848
  "use strict";
6849
6849
  Object.defineProperty(e, "__esModule", { value: true }), e.InMemoryWebStorage = void 0;
6850
- var n2 = function() {
6850
+ var n2 = /* @__PURE__ */ function() {
6851
6851
  function t2(t3, e2) {
6852
6852
  for (var r2 = 0; r2 < e2.length; r2++) {
6853
6853
  var n3 = e2[r2];
@@ -6880,7 +6880,7 @@ var PodOS = (() => {
6880
6880
  }, function(t, e, r) {
6881
6881
  "use strict";
6882
6882
  Object.defineProperty(e, "__esModule", { value: true }), e.UserManager = void 0;
6883
- var n2 = function() {
6883
+ var n2 = /* @__PURE__ */ function() {
6884
6884
  function t2(t3, e2) {
6885
6885
  for (var r2 = 0; r2 < e2.length; r2++) {
6886
6886
  var n3 = e2[r2];
@@ -7156,7 +7156,7 @@ var PodOS = (() => {
7156
7156
  }, function(t, e, r) {
7157
7157
  "use strict";
7158
7158
  Object.defineProperty(e, "__esModule", { value: true }), e.UserManagerSettings = void 0;
7159
- var n2 = function() {
7159
+ var n2 = /* @__PURE__ */ function() {
7160
7160
  function t2(t3, e2) {
7161
7161
  for (var r2 = 0; r2 < e2.length; r2++) {
7162
7162
  var n3 = e2[r2];
@@ -7232,7 +7232,7 @@ var PodOS = (() => {
7232
7232
  }, function(t, e, r) {
7233
7233
  "use strict";
7234
7234
  Object.defineProperty(e, "__esModule", { value: true }), e.RedirectNavigator = void 0;
7235
- var n2 = function() {
7235
+ var n2 = /* @__PURE__ */ function() {
7236
7236
  function t2(t3, e2) {
7237
7237
  for (var r2 = 0; r2 < e2.length; r2++) {
7238
7238
  var n3 = e2[r2];
@@ -7284,7 +7284,7 @@ var PodOS = (() => {
7284
7284
  }, function(t, e, r) {
7285
7285
  "use strict";
7286
7286
  Object.defineProperty(e, "__esModule", { value: true }), e.PopupWindow = void 0;
7287
- var n2 = function() {
7287
+ var n2 = /* @__PURE__ */ function() {
7288
7288
  function t2(t3, e2) {
7289
7289
  for (var r2 = 0; r2 < e2.length; r2++) {
7290
7290
  var n3 = e2[r2];
@@ -7363,7 +7363,7 @@ var PodOS = (() => {
7363
7363
  }, function(t, e, r) {
7364
7364
  "use strict";
7365
7365
  Object.defineProperty(e, "__esModule", { value: true }), e.IFrameWindow = void 0;
7366
- var n2 = function() {
7366
+ var n2 = /* @__PURE__ */ function() {
7367
7367
  function t2(t3, e2) {
7368
7368
  for (var r2 = 0; r2 < e2.length; r2++) {
7369
7369
  var n3 = e2[r2];
@@ -7477,7 +7477,7 @@ var PodOS = (() => {
7477
7477
  }, function(t, e, r) {
7478
7478
  "use strict";
7479
7479
  Object.defineProperty(e, "__esModule", { value: true }), e.Timer = void 0;
7480
- var n2 = function() {
7480
+ var n2 = /* @__PURE__ */ function() {
7481
7481
  function t2(t3, e2) {
7482
7482
  for (var r2 = 0; r2 < e2.length; r2++) {
7483
7483
  var n3 = e2[r2];
@@ -12860,39 +12860,65 @@ var PodOS = (() => {
12860
12860
  "../node_modules/function-bind/implementation.js"(exports, module3) {
12861
12861
  "use strict";
12862
12862
  var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
12863
- var slice = Array.prototype.slice;
12864
12863
  var toStr = Object.prototype.toString;
12864
+ var max2 = Math.max;
12865
12865
  var funcType = "[object Function]";
12866
+ var concatty = function concatty2(a, b) {
12867
+ var arr = [];
12868
+ for (var i = 0; i < a.length; i += 1) {
12869
+ arr[i] = a[i];
12870
+ }
12871
+ for (var j = 0; j < b.length; j += 1) {
12872
+ arr[j + a.length] = b[j];
12873
+ }
12874
+ return arr;
12875
+ };
12876
+ var slicy = function slicy2(arrLike, offset3) {
12877
+ var arr = [];
12878
+ for (var i = offset3 || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
12879
+ arr[j] = arrLike[i];
12880
+ }
12881
+ return arr;
12882
+ };
12883
+ var joiny = function(arr, joiner) {
12884
+ var str = "";
12885
+ for (var i = 0; i < arr.length; i += 1) {
12886
+ str += arr[i];
12887
+ if (i + 1 < arr.length) {
12888
+ str += joiner;
12889
+ }
12890
+ }
12891
+ return str;
12892
+ };
12866
12893
  module3.exports = function bind(that) {
12867
12894
  var target5 = this;
12868
- if (typeof target5 !== "function" || toStr.call(target5) !== funcType) {
12895
+ if (typeof target5 !== "function" || toStr.apply(target5) !== funcType) {
12869
12896
  throw new TypeError(ERROR_MESSAGE + target5);
12870
12897
  }
12871
- var args = slice.call(arguments, 1);
12898
+ var args = slicy(arguments, 1);
12872
12899
  var bound;
12873
12900
  var binder = function() {
12874
12901
  if (this instanceof bound) {
12875
12902
  var result5 = target5.apply(
12876
12903
  this,
12877
- args.concat(slice.call(arguments))
12904
+ concatty(args, arguments)
12878
12905
  );
12879
12906
  if (Object(result5) === result5) {
12880
12907
  return result5;
12881
12908
  }
12882
12909
  return this;
12883
- } else {
12884
- return target5.apply(
12885
- that,
12886
- args.concat(slice.call(arguments))
12887
- );
12888
12910
  }
12911
+ return target5.apply(
12912
+ that,
12913
+ concatty(args, arguments)
12914
+ );
12889
12915
  };
12890
- var boundLength = Math.max(0, target5.length - args.length);
12916
+ var boundLength = max2(0, target5.length - args.length);
12891
12917
  var boundArgs = [];
12892
12918
  for (var i = 0; i < boundLength; i++) {
12893
- boundArgs.push("$" + i);
12919
+ boundArgs[i] = "$" + i;
12894
12920
  }
12895
- bound = Function("binder", "return function (" + boundArgs.join(",") + "){ return binder.apply(this,arguments); }")(binder);
12921
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
12896
12922
  if (target5.prototype) {
12897
12923
  var Empty = function Empty2() {
12898
12924
  };
@@ -12914,12 +12940,14 @@ var PodOS = (() => {
12914
12940
  }
12915
12941
  });
12916
12942
 
12917
- // ../node_modules/has/src/index.js
12918
- var require_src = __commonJS({
12919
- "../node_modules/has/src/index.js"(exports, module3) {
12943
+ // ../node_modules/hasown/index.js
12944
+ var require_hasown = __commonJS({
12945
+ "../node_modules/hasown/index.js"(exports, module3) {
12920
12946
  "use strict";
12947
+ var call = Function.prototype.call;
12948
+ var $hasOwn = Object.prototype.hasOwnProperty;
12921
12949
  var bind = require_function_bind();
12922
- module3.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
12950
+ module3.exports = bind.call(call, $hasOwn);
12923
12951
  }
12924
12952
  });
12925
12953
 
@@ -13121,7 +13149,7 @@ var PodOS = (() => {
13121
13149
  "%WeakSetPrototype%": ["WeakSet", "prototype"]
13122
13150
  };
13123
13151
  var bind = require_function_bind();
13124
- var hasOwn = require_src();
13152
+ var hasOwn = require_hasown();
13125
13153
  var $concat = bind.call(Function.call, Array.prototype.concat);
13126
13154
  var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
13127
13155
  var $replace = bind.call(Function.call, String.prototype.replace);
@@ -13230,16 +13258,163 @@ var PodOS = (() => {
13230
13258
  }
13231
13259
  });
13232
13260
 
13261
+ // ../node_modules/has-property-descriptors/index.js
13262
+ var require_has_property_descriptors = __commonJS({
13263
+ "../node_modules/has-property-descriptors/index.js"(exports, module3) {
13264
+ "use strict";
13265
+ var GetIntrinsic = require_get_intrinsic();
13266
+ var $defineProperty = GetIntrinsic("%Object.defineProperty%", true);
13267
+ var hasPropertyDescriptors = function hasPropertyDescriptors2() {
13268
+ if ($defineProperty) {
13269
+ try {
13270
+ $defineProperty({}, "a", { value: 1 });
13271
+ return true;
13272
+ } catch (e) {
13273
+ return false;
13274
+ }
13275
+ }
13276
+ return false;
13277
+ };
13278
+ hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
13279
+ if (!hasPropertyDescriptors()) {
13280
+ return null;
13281
+ }
13282
+ try {
13283
+ return $defineProperty([], "length", { value: 1 }).length !== 1;
13284
+ } catch (e) {
13285
+ return true;
13286
+ }
13287
+ };
13288
+ module3.exports = hasPropertyDescriptors;
13289
+ }
13290
+ });
13291
+
13292
+ // ../node_modules/gopd/index.js
13293
+ var require_gopd = __commonJS({
13294
+ "../node_modules/gopd/index.js"(exports, module3) {
13295
+ "use strict";
13296
+ var GetIntrinsic = require_get_intrinsic();
13297
+ var $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", true);
13298
+ if ($gOPD) {
13299
+ try {
13300
+ $gOPD([], "length");
13301
+ } catch (e) {
13302
+ $gOPD = null;
13303
+ }
13304
+ }
13305
+ module3.exports = $gOPD;
13306
+ }
13307
+ });
13308
+
13309
+ // ../node_modules/define-data-property/index.js
13310
+ var require_define_data_property = __commonJS({
13311
+ "../node_modules/define-data-property/index.js"(exports, module3) {
13312
+ "use strict";
13313
+ var hasPropertyDescriptors = require_has_property_descriptors()();
13314
+ var GetIntrinsic = require_get_intrinsic();
13315
+ var $defineProperty = hasPropertyDescriptors && GetIntrinsic("%Object.defineProperty%", true);
13316
+ if ($defineProperty) {
13317
+ try {
13318
+ $defineProperty({}, "a", { value: 1 });
13319
+ } catch (e) {
13320
+ $defineProperty = false;
13321
+ }
13322
+ }
13323
+ var $SyntaxError = GetIntrinsic("%SyntaxError%");
13324
+ var $TypeError = GetIntrinsic("%TypeError%");
13325
+ var gopd = require_gopd();
13326
+ module3.exports = function defineDataProperty(obj, property3, value6) {
13327
+ if (!obj || typeof obj !== "object" && typeof obj !== "function") {
13328
+ throw new $TypeError("`obj` must be an object or a function`");
13329
+ }
13330
+ if (typeof property3 !== "string" && typeof property3 !== "symbol") {
13331
+ throw new $TypeError("`property` must be a string or a symbol`");
13332
+ }
13333
+ if (arguments.length > 3 && typeof arguments[3] !== "boolean" && arguments[3] !== null) {
13334
+ throw new $TypeError("`nonEnumerable`, if provided, must be a boolean or null");
13335
+ }
13336
+ if (arguments.length > 4 && typeof arguments[4] !== "boolean" && arguments[4] !== null) {
13337
+ throw new $TypeError("`nonWritable`, if provided, must be a boolean or null");
13338
+ }
13339
+ if (arguments.length > 5 && typeof arguments[5] !== "boolean" && arguments[5] !== null) {
13340
+ throw new $TypeError("`nonConfigurable`, if provided, must be a boolean or null");
13341
+ }
13342
+ if (arguments.length > 6 && typeof arguments[6] !== "boolean") {
13343
+ throw new $TypeError("`loose`, if provided, must be a boolean");
13344
+ }
13345
+ var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
13346
+ var nonWritable = arguments.length > 4 ? arguments[4] : null;
13347
+ var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
13348
+ var loose = arguments.length > 6 ? arguments[6] : false;
13349
+ var desc = !!gopd && gopd(obj, property3);
13350
+ if ($defineProperty) {
13351
+ $defineProperty(obj, property3, {
13352
+ configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
13353
+ enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
13354
+ value: value6,
13355
+ writable: nonWritable === null && desc ? desc.writable : !nonWritable
13356
+ });
13357
+ } else if (loose || !nonEnumerable && !nonWritable && !nonConfigurable) {
13358
+ obj[property3] = value6;
13359
+ } else {
13360
+ throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
13361
+ }
13362
+ };
13363
+ }
13364
+ });
13365
+
13366
+ // ../node_modules/set-function-length/index.js
13367
+ var require_set_function_length = __commonJS({
13368
+ "../node_modules/set-function-length/index.js"(exports, module3) {
13369
+ "use strict";
13370
+ var GetIntrinsic = require_get_intrinsic();
13371
+ var define2 = require_define_data_property();
13372
+ var hasDescriptors = require_has_property_descriptors()();
13373
+ var gOPD = require_gopd();
13374
+ var $TypeError = GetIntrinsic("%TypeError%");
13375
+ var $floor = GetIntrinsic("%Math.floor%");
13376
+ module3.exports = function setFunctionLength(fn2, length2) {
13377
+ if (typeof fn2 !== "function") {
13378
+ throw new $TypeError("`fn` is not a function");
13379
+ }
13380
+ if (typeof length2 !== "number" || length2 < 0 || length2 > 4294967295 || $floor(length2) !== length2) {
13381
+ throw new $TypeError("`length` must be a positive 32-bit integer");
13382
+ }
13383
+ var loose = arguments.length > 2 && !!arguments[2];
13384
+ var functionLengthIsConfigurable = true;
13385
+ var functionLengthIsWritable = true;
13386
+ if ("length" in fn2 && gOPD) {
13387
+ var desc = gOPD(fn2, "length");
13388
+ if (desc && !desc.configurable) {
13389
+ functionLengthIsConfigurable = false;
13390
+ }
13391
+ if (desc && !desc.writable) {
13392
+ functionLengthIsWritable = false;
13393
+ }
13394
+ }
13395
+ if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
13396
+ if (hasDescriptors) {
13397
+ define2(fn2, "length", length2, true, true);
13398
+ } else {
13399
+ define2(fn2, "length", length2);
13400
+ }
13401
+ }
13402
+ return fn2;
13403
+ };
13404
+ }
13405
+ });
13406
+
13233
13407
  // ../node_modules/call-bind/index.js
13234
13408
  var require_call_bind = __commonJS({
13235
13409
  "../node_modules/call-bind/index.js"(exports, module3) {
13236
13410
  "use strict";
13237
13411
  var bind = require_function_bind();
13238
13412
  var GetIntrinsic = require_get_intrinsic();
13413
+ var setFunctionLength = require_set_function_length();
13414
+ var $TypeError = GetIntrinsic("%TypeError%");
13239
13415
  var $apply = GetIntrinsic("%Function.prototype.apply%");
13240
13416
  var $call = GetIntrinsic("%Function.prototype.call%");
13241
13417
  var $reflectApply = GetIntrinsic("%Reflect.apply%", true) || bind.call($call, $apply);
13242
- var $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", true);
13243
13418
  var $defineProperty = GetIntrinsic("%Object.defineProperty%", true);
13244
13419
  var $max = GetIntrinsic("%Math.max%");
13245
13420
  if ($defineProperty) {
@@ -13250,18 +13425,15 @@ var PodOS = (() => {
13250
13425
  }
13251
13426
  }
13252
13427
  module3.exports = function callBind(originalFunction) {
13253
- var func = $reflectApply(bind, $call, arguments);
13254
- if ($gOPD && $defineProperty) {
13255
- var desc = $gOPD(func, "length");
13256
- if (desc.configurable) {
13257
- $defineProperty(
13258
- func,
13259
- "length",
13260
- { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
13261
- );
13262
- }
13428
+ if (typeof originalFunction !== "function") {
13429
+ throw new $TypeError("a function is required");
13263
13430
  }
13264
- return func;
13431
+ var func = $reflectApply(bind, $call, arguments);
13432
+ return setFunctionLength(
13433
+ func,
13434
+ 1 + $max(0, originalFunction.length - (arguments.length - 1)),
13435
+ true
13436
+ );
13265
13437
  };
13266
13438
  var applyBind = function applyBind2() {
13267
13439
  return $reflectApply(bind, $apply, arguments);
@@ -13513,6 +13685,12 @@ var PodOS = (() => {
13513
13685
  if (isString(obj)) {
13514
13686
  return markBoxed(inspect(String(obj)));
13515
13687
  }
13688
+ if (typeof window !== "undefined" && obj === window) {
13689
+ return "{ [object Window] }";
13690
+ }
13691
+ if (obj === global) {
13692
+ return "{ [object globalThis] }";
13693
+ }
13516
13694
  if (!isDate(obj) && !isRegExp(obj)) {
13517
13695
  var ys = arrObjKeys(obj, inspect);
13518
13696
  var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
@@ -25020,7 +25198,7 @@ var PodOS = (() => {
25020
25198
  options
25021
25199
  });
25022
25200
  }
25023
- const container2 = _getContextValue(termCtx, key3, "@container") || [];
25201
+ const container2 = _getContextValue(activeCtx, key3, "@container") || [];
25024
25202
  if (container2.includes("@language") && _isObject(value6)) {
25025
25203
  const direction3 = _getContextValue(termCtx, key3, "@direction");
25026
25204
  expandedValue = _expandLanguageMap(termCtx, value6, direction3, options);
@@ -28317,9 +28495,9 @@ var PodOS = (() => {
28317
28495
  }
28318
28496
  });
28319
28497
 
28320
- // ../node_modules/cross-fetch/dist/browser-ponyfill.js
28498
+ // ../node_modules/rdflib/node_modules/cross-fetch/dist/browser-ponyfill.js
28321
28499
  var require_browser_ponyfill = __commonJS({
28322
- "../node_modules/cross-fetch/dist/browser-ponyfill.js"(exports, module3) {
28500
+ "../node_modules/rdflib/node_modules/cross-fetch/dist/browser-ponyfill.js"(exports, module3) {
28323
28501
  var global3 = typeof self !== "undefined" ? self : exports;
28324
28502
  var __self__ = function() {
28325
28503
  function F() {
@@ -28799,7 +28977,7 @@ var PodOS = (() => {
28799
28977
  };
28800
28978
  lunr2.version = "2.3.9";
28801
28979
  lunr2.utils = {};
28802
- lunr2.utils.warn = function(global3) {
28980
+ lunr2.utils.warn = /* @__PURE__ */ function(global3) {
28803
28981
  return function(message4) {
28804
28982
  if (global3.console && console.warn) {
28805
28983
  console.warn(message4);
@@ -31857,6 +32035,7 @@ var PodOS = (() => {
31857
32035
  var SOLID_CLIENT_AUTHN_KEY_PREFIX = "solidClientAuthn:";
31858
32036
  var PREFERRED_SIGNING_ALG = ["ES256", "RS256"];
31859
32037
  var EVENTS = {
32038
+ // Note that an `error` events MUST be listened to: https://nodejs.org/dist/latest-v16.x/docs/api/events.html#error-events.
31860
32039
  ERROR: "error",
31861
32040
  LOGIN: "login",
31862
32041
  LOGOUT: "logout",
@@ -31872,6 +32051,9 @@ var PodOS = (() => {
31872
32051
  var SCOPE_WEBID = "webid";
31873
32052
  var DEFAULT_SCOPES = [SCOPE_OPENID, SCOPE_OFFLINE, SCOPE_WEBID].join(" ");
31874
32053
  var buildProxyHandler = (toExclude, errorMessage) => ({
32054
+ // This proxy is only a temporary measure until Session no longer extends
32055
+ // SessionEventEmitter, and the proxying is no longer necessary.
32056
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
31875
32057
  get(target5, prop, receiver2) {
31876
32058
  if (!Object.getOwnPropertyNames(import_events.EventEmitter).includes(prop) && Object.getOwnPropertyNames(toExclude).includes(prop)) {
31877
32059
  throw new Error(`${errorMessage}: [${prop}] is not supported`);
@@ -31884,6 +32066,11 @@ var PodOS = (() => {
31884
32066
  this.handleables = handleables;
31885
32067
  this.handleables = handleables;
31886
32068
  }
32069
+ /**
32070
+ * Helper function that will asynchronously determine the proper handler to use. If multiple
32071
+ * handlers can handle, it will choose the first one in the list
32072
+ * @param params Paramerters to feed to the handler
32073
+ */
31887
32074
  async getProperHandler(params2) {
31888
32075
  const canHandleList = await Promise.all(this.handleables.map((handleable) => handleable.canHandle(...params2)));
31889
32076
  for (let i = 0; i < canHandleList.length; i += 1) {
@@ -31958,6 +32145,15 @@ var PodOS = (() => {
31958
32145
  return false;
31959
32146
  }
31960
32147
  }
32148
+ function removeOpenIdParams(redirectUrl) {
32149
+ const cleanedUpUrl = new URL(redirectUrl);
32150
+ cleanedUpUrl.searchParams.delete("state");
32151
+ cleanedUpUrl.searchParams.delete("code");
32152
+ cleanedUpUrl.searchParams.delete("error");
32153
+ cleanedUpUrl.searchParams.delete("error_description");
32154
+ cleanedUpUrl.searchParams.delete("iss");
32155
+ return cleanedUpUrl;
32156
+ }
31961
32157
  var AuthorizationCodeWithPkceOidcHandlerBase = class {
31962
32158
  constructor(storageUtility, redirector) {
31963
32159
  this.storageUtility = storageUtility;
@@ -31970,12 +32166,28 @@ var PodOS = (() => {
31970
32166
  }
31971
32167
  async handleRedirect({ oidcLoginOptions, state: state2, codeVerifier, targetUrl: targetUrl3 }) {
31972
32168
  await Promise.all([
32169
+ // We use the OAuth 'state' value (which should be crypto-random) as
32170
+ // the key in our storage to store our actual SessionID. We do this
32171
+ // 'cos we'll need to lookup our session information again when the
32172
+ // browser is redirected back to us (i.e. the OAuth client
32173
+ // application) from the Authorization Server.
32174
+ // We don't want to use our session ID as the OAuth 'state' value, as
32175
+ // that session ID can be any developer-specified value, and therefore
32176
+ // may not be appropriate (since the OAuth 'state' value should really
32177
+ // be an unguessable crypto-random value).
32178
+ // eslint-disable-next-line no-underscore-dangle
31973
32179
  this.storageUtility.setForUser(state2, {
31974
32180
  sessionId: oidcLoginOptions.sessionId
31975
32181
  }),
32182
+ // Store our login-process state using the session ID as the key.
32183
+ // Strictly speaking, this indirection from our OAuth state value to
32184
+ // our session ID is unnecessary, but it provides a slightly cleaner
32185
+ // separation of concerns.
31976
32186
  this.storageUtility.setForUser(oidcLoginOptions.sessionId, {
32187
+ // eslint-disable-next-line no-underscore-dangle
31977
32188
  codeVerifier,
31978
32189
  issuer: oidcLoginOptions.issuer.toString(),
32190
+ // The redirect URL is read after redirect, so it must be stored now.
31979
32191
  redirectUrl: oidcLoginOptions.redirectUrl,
31980
32192
  dpop: oidcLoginOptions.dpop ? "true" : "false"
31981
32193
  })
@@ -32059,18 +32271,36 @@ var PodOS = (() => {
32059
32271
  get(_) {
32060
32272
  throw new Error("Not implemented");
32061
32273
  }
32274
+ // eslint-disable-next-line class-methods-use-this
32062
32275
  async getAll() {
32063
32276
  throw new Error("Not implemented");
32064
32277
  }
32278
+ /**
32279
+ * This function removes all session-related information from storage.
32280
+ * @param sessionId the session identifier
32281
+ * @param storage the storage where session info is stored
32282
+ * @hidden
32283
+ */
32065
32284
  async clear(sessionId) {
32066
32285
  return clear(sessionId, this.storageUtility);
32067
32286
  }
32287
+ /**
32288
+ * Registers a new session, so that its ID can be retrieved.
32289
+ * @param sessionId
32290
+ */
32068
32291
  async register(_sessionId) {
32069
32292
  throw new Error("Not implemented");
32070
32293
  }
32294
+ /**
32295
+ * Returns all the registered session IDs. Differs from getAll, which also
32296
+ * returns additional session information.
32297
+ */
32071
32298
  async getRegisteredSessionIdAll() {
32072
32299
  throw new Error("Not implemented");
32073
32300
  }
32301
+ /**
32302
+ * Deletes all information about all sessions, including their registrations.
32303
+ */
32074
32304
  async clearAll() {
32075
32305
  throw new Error("Not implemented");
32076
32306
  }
@@ -32134,6 +32364,8 @@ var PodOS = (() => {
32134
32364
  }, issuerConfig);
32135
32365
  }
32136
32366
  await storageUtility.setForUser(options.sessionId, {
32367
+ // If the client is either static or solid-oidc compliant, its client ID cannot be undefined.
32368
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
32137
32369
  clientId: options.clientId
32138
32370
  });
32139
32371
  if (options.clientSecret) {
@@ -32147,6 +32379,7 @@ var PodOS = (() => {
32147
32379
  });
32148
32380
  }
32149
32381
  return {
32382
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
32150
32383
  clientId: options.clientId,
32151
32384
  clientSecret: options.clientSecret,
32152
32385
  clientName: options.clientName,
@@ -32287,17 +32520,20 @@ var PodOS = (() => {
32287
32520
  }
32288
32521
  };
32289
32522
  var ConfigurationError = class extends Error {
32523
+ /* istanbul ignore next */
32290
32524
  constructor(message4) {
32291
32525
  super(message4);
32292
32526
  }
32293
32527
  };
32294
32528
  var InvalidResponseError = class extends Error {
32529
+ /* istanbul ignore next */
32295
32530
  constructor(missingFields) {
32296
32531
  super(`Invalid response from OIDC provider: missing fields ${missingFields}`);
32297
32532
  this.missingFields = missingFields;
32298
32533
  }
32299
32534
  };
32300
32535
  var OidcProviderError = class extends Error {
32536
+ /* istanbul ignore next */
32301
32537
  constructor(message4, error5, errorDescription) {
32302
32538
  super(message4);
32303
32539
  this.error = error5;
@@ -32371,7 +32607,10 @@ var PodOS = (() => {
32371
32607
  }
32372
32608
  var computeRefreshDelay = (expiresIn) => {
32373
32609
  if (expiresIn !== void 0) {
32374
- return expiresIn - REFRESH_BEFORE_EXPIRATION_SECONDS > 0 ? expiresIn - REFRESH_BEFORE_EXPIRATION_SECONDS : expiresIn;
32610
+ return expiresIn - REFRESH_BEFORE_EXPIRATION_SECONDS > 0 ? (
32611
+ // We want to refresh the token 5 seconds before they actually expire.
32612
+ expiresIn - REFRESH_BEFORE_EXPIRATION_SECONDS
32613
+ ) : expiresIn;
32375
32614
  }
32376
32615
  return DEFAULT_EXPIRATION_TIME_SECONDS;
32377
32616
  };
@@ -32384,7 +32623,14 @@ var PodOS = (() => {
32384
32623
  const proactivelyRefreshToken = async () => {
32385
32624
  var _a2, _b, _c, _d;
32386
32625
  try {
32387
- const { accessToken: refreshedAccessToken, refreshToken, expiresIn } = await refreshAccessToken(currentRefreshOptions, options.dpopKey, options.eventEmitter);
32626
+ const { accessToken: refreshedAccessToken, refreshToken, expiresIn } = await refreshAccessToken(
32627
+ currentRefreshOptions,
32628
+ // If currentRefreshOptions is defined, options is necessarily defined too.
32629
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
32630
+ options.dpopKey,
32631
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
32632
+ options.eventEmitter
32633
+ );
32388
32634
  currentAccessToken = refreshedAccessToken;
32389
32635
  if (refreshToken !== void 0) {
32390
32636
  currentRefreshOptions.refreshToken = refreshToken;
@@ -32402,7 +32648,12 @@ var PodOS = (() => {
32402
32648
  }
32403
32649
  }
32404
32650
  };
32405
- latestTimeout = setTimeout(proactivelyRefreshToken, computeRefreshDelay(options.expiresIn) * 1e3);
32651
+ latestTimeout = setTimeout(
32652
+ proactivelyRefreshToken,
32653
+ // If currentRefreshOptions is defined, options is necessarily defined too.
32654
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
32655
+ computeRefreshDelay(options.expiresIn) * 1e3
32656
+ );
32406
32657
  (_a = options.eventEmitter) === null || _a === void 0 ? void 0 : _a.emit(EVENTS.TIMEOUT_SET, latestTimeout);
32407
32658
  } else if (options !== void 0 && options.eventEmitter !== void 0) {
32408
32659
  const expirationTimeout = setTimeout(() => {
@@ -32418,7 +32669,14 @@ var PodOS = (() => {
32418
32669
  }
32419
32670
  const hasBeenRedirected = response6.url !== url7;
32420
32671
  if (hasBeenRedirected && (options === null || options === void 0 ? void 0 : options.dpopKey) !== void 0) {
32421
- response6 = await makeAuthenticatedRequest(unauthFetch, currentAccessToken, response6.url, requestInit, options.dpopKey);
32672
+ response6 = await makeAuthenticatedRequest(
32673
+ unauthFetch,
32674
+ currentAccessToken,
32675
+ // Replace the original target IRI (`url`) by the redirection target
32676
+ response6.url,
32677
+ requestInit,
32678
+ options.dpopKey
32679
+ );
32422
32680
  }
32423
32681
  return response6;
32424
32682
  };
@@ -32460,6 +32718,7 @@ var PodOS = (() => {
32460
32718
  }
32461
32719
  const signingAlg = determineSigningAlg(issuerConfig.idTokenSigningAlgValuesSupported, PREFERRED_SIGNING_ALG);
32462
32720
  const config = {
32721
+ /* eslint-disable camelcase */
32463
32722
  client_name: options.clientName,
32464
32723
  application_type: "web",
32465
32724
  redirect_uris: [(_a = options.redirectUrl) === null || _a === void 0 ? void 0 : _a.toString()],
@@ -32467,6 +32726,7 @@ var PodOS = (() => {
32467
32726
  token_endpoint_auth_method: "client_secret_basic",
32468
32727
  id_token_signed_response_alg: signingAlg,
32469
32728
  grant_types: ["authorization_code", "refresh_token"]
32729
+ /* eslint-enable camelcase */
32470
32730
  };
32471
32731
  const headers = {
32472
32732
  "Content-Type": "application/json"
@@ -32558,11 +32818,13 @@ var PodOS = (() => {
32558
32818
  headers.Authorization = `Basic ${btoa(`${client.clientId}:${client.clientSecret}`)}`;
32559
32819
  }
32560
32820
  const requestBody = {
32821
+ /* eslint-disable camelcase */
32561
32822
  grant_type: data2.grantType,
32562
32823
  redirect_uri: data2.redirectUrl,
32563
32824
  code: data2.code,
32564
32825
  code_verifier: data2.codeVerifier,
32565
32826
  client_id: client.clientId
32827
+ /* eslint-enable camelcase */
32566
32828
  };
32567
32829
  const tokenRequestInit = {
32568
32830
  method: "POST",
@@ -32586,7 +32848,26 @@ var PodOS = (() => {
32586
32848
  let signinResponse;
32587
32849
  try {
32588
32850
  const client = new import_oidc_client.OidcClient({
32851
+ // TODO: We should look at the various interfaces being used for storage,
32852
+ // i.e. between oidc-client-js (WebStorageStoreState), localStorage
32853
+ // (which has an interface Storage), and our own proprietary interface
32854
+ // IStorage - i.e. we should really just be using the browser Web Storage
32855
+ // API, e.g. "stateStore: window.localStorage,".
32856
+ // We are instantiating a new instance here, so the only value we need to
32857
+ // explicitly provide is the response mode (default otherwise will look
32858
+ // for a hash '#' fragment!).
32859
+ // eslint-disable-next-line camelcase
32589
32860
  response_mode: "query",
32861
+ // The userinfo endpoint on NSS fails, so disable this for now
32862
+ // Note that in Solid, information should be retrieved from the
32863
+ // profile referenced by the WebId.
32864
+ // TODO: Note that this is heavy-handed, and that this userinfo check
32865
+ // verifies that the `sub` claim in the id token you get along with the
32866
+ // access token matches the sub claim associated with the access token at
32867
+ // the userinfo endpoint.
32868
+ // That is a useful check, and in the future it should be only disabled
32869
+ // against NSS, and not in general.
32870
+ // Issue tracker: https://github.com/solid/node-solid-server/issues/1490
32590
32871
  loadUserInfo: false
32591
32872
  });
32592
32873
  signinResponse = await client.processSigninResponse(redirectUrl);
@@ -32607,6 +32888,13 @@ var PodOS = (() => {
32607
32888
  accessToken: signinResponse.access_token,
32608
32889
  idToken: signinResponse.id_token,
32609
32890
  webId,
32891
+ // Although not a field in the TypeScript response interface, the refresh
32892
+ // token (which can optionally come back with the access token (if, as per
32893
+ // the OAuth2 spec, we requested one using the scope of 'offline_access')
32894
+ // will be included in the signin response object.
32895
+ // eslint-disable-next-line camelcase
32896
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
32897
+ // @ts-ignore
32610
32898
  refreshToken: signinResponse.refresh_token
32611
32899
  };
32612
32900
  } catch (err) {
@@ -32642,6 +32930,8 @@ var PodOS = (() => {
32642
32930
  let authHeader = {};
32643
32931
  if (client.clientSecret !== void 0) {
32644
32932
  authHeader = {
32933
+ // We assume that client_secret_basic is the client authentication method.
32934
+ // TODO: Get the authentication method from the IClient configuration object.
32645
32935
  Authorization: `Basic ${btoa(`${client.clientId}:${client.clientSecret}`)}`
32646
32936
  };
32647
32937
  } else if (isValidUrl2(client.clientId)) {
@@ -32673,18 +32963,31 @@ var PodOS = (() => {
32673
32963
  expiresIn: validatedResponse.expires_in
32674
32964
  };
32675
32965
  }
32676
- function removeOidcQueryParam(redirectUrl) {
32677
- const cleanedUrl = new URL(redirectUrl);
32678
- cleanedUrl.searchParams.delete("code");
32679
- cleanedUrl.searchParams.delete("state");
32966
+ function normalizeCallbackUrl(redirectUrl) {
32967
+ const cleanedUrl = removeOpenIdParams(redirectUrl);
32680
32968
  cleanedUrl.hash = "";
32681
- if (redirectUrl.includes(`${cleanedUrl.origin}/`)) {
32969
+ if (
32970
+ // The trailing slash is present in the original redirect URL
32971
+ redirectUrl.includes(`${cleanedUrl.origin}/`)
32972
+ ) {
32682
32973
  return cleanedUrl.href;
32683
32974
  }
32684
- return `${cleanedUrl.origin}${cleanedUrl.href.substring(cleanedUrl.origin.length + 1)}`;
32975
+ return `${cleanedUrl.origin}${cleanedUrl.href.substring(
32976
+ // Adds 1 to the origin length to remove the trailing slash
32977
+ cleanedUrl.origin.length + 1
32978
+ )}`;
32685
32979
  }
32686
32980
  async function clearOidcPersistentStorage() {
32687
32981
  const client = new import_oidc_client.OidcClient({
32982
+ // TODO: We should look at the various interfaces being used for storage,
32983
+ // i.e. between oidc-client-js (WebStorageStoreState), localStorage
32984
+ // (which has an interface Storage), and our own proprietary interface
32985
+ // IStorage - i.e. we should really just be using the browser Web Storage
32986
+ // API, e.g. "stateStore: window.localStorage,".
32987
+ // We are instantiating a new instance here, so the only value we need to
32988
+ // explicitly provide is the response mode (default otherwise will look
32989
+ // for a hash '#' fragment!).
32990
+ // eslint-disable-next-line camelcase
32688
32991
  response_mode: "query"
32689
32992
  });
32690
32993
  await client.clearStaleState(new import_oidc_client.WebStorageStateStore({}));
@@ -32711,13 +33014,14 @@ var PodOS = (() => {
32711
33014
  this.login = async (options, eventEmitter) => {
32712
33015
  var _a, _b;
32713
33016
  await this.sessionInfoManager.clear(options.sessionId);
32714
- const redirectUrl = (_a = options.redirectUrl) !== null && _a !== void 0 ? _a : removeOidcQueryParam(window.location.href);
33017
+ const redirectUrl = (_a = options.redirectUrl) !== null && _a !== void 0 ? _a : normalizeCallbackUrl(window.location.href);
32715
33018
  if (!isValidRedirectUrl(redirectUrl)) {
32716
33019
  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').`);
32717
33020
  }
32718
33021
  await this.loginHandler.handle({
32719
33022
  ...options,
32720
33023
  redirectUrl,
33024
+ // If no clientName is provided, the clientId may be used instead.
32721
33025
  clientName: (_b = options.clientName) !== null && _b !== void 0 ? _b : options.clientId,
32722
33026
  eventEmitter
32723
33027
  });
@@ -32734,7 +33038,7 @@ var PodOS = (() => {
32734
33038
  const redirectInfo = await this.redirectHandler.handle(url7, eventEmitter);
32735
33039
  this.fetch = redirectInfo.fetch.bind(window);
32736
33040
  this.boundLogout = redirectInfo.getLogoutUrl;
32737
- this.cleanUrlAfterRedirect(url7);
33041
+ await this.cleanUrlAfterRedirect(url7);
32738
33042
  return {
32739
33043
  isLoggedIn: redirectInfo.isLoggedIn,
32740
33044
  webId: redirectInfo.webId,
@@ -32742,22 +33046,20 @@ var PodOS = (() => {
32742
33046
  expirationDate: redirectInfo.expirationDate
32743
33047
  };
32744
33048
  } catch (err) {
32745
- this.cleanUrlAfterRedirect(url7);
33049
+ await this.cleanUrlAfterRedirect(url7);
32746
33050
  eventEmitter.emit(EVENTS.ERROR, "redirect", err);
32747
33051
  return void 0;
32748
33052
  }
32749
33053
  };
32750
33054
  }
32751
- cleanUrlAfterRedirect(url7) {
32752
- const cleanedUpUrl = new URL(url7);
32753
- cleanedUpUrl.searchParams.delete("state");
32754
- cleanedUpUrl.searchParams.delete("code");
32755
- cleanedUpUrl.searchParams.delete("id_token");
32756
- cleanedUpUrl.searchParams.delete("access_token");
32757
- cleanedUpUrl.searchParams.delete("error");
32758
- cleanedUpUrl.searchParams.delete("error_description");
32759
- cleanedUpUrl.searchParams.delete("iss");
32760
- window.history.replaceState(null, "", cleanedUpUrl.toString());
33055
+ async cleanUrlAfterRedirect(url7) {
33056
+ const cleanedUpUrl = removeOpenIdParams(url7).href;
33057
+ window.history.replaceState(null, "", cleanedUpUrl);
33058
+ while (window.location.href !== cleanedUpUrl) {
33059
+ await new Promise((resolve) => {
33060
+ setTimeout(() => resolve(), 1);
33061
+ });
33062
+ }
32761
33063
  }
32762
33064
  };
32763
33065
  function hasIssuer(options) {
@@ -32790,7 +33092,13 @@ var PodOS = (() => {
32790
33092
  const issuerConfig = await this.issuerConfigFetcher.fetchConfig(options.oidcIssuer);
32791
33093
  const clientRegistration = await handleRegistration(options, issuerConfig, this.storageUtility, this.clientRegistrar);
32792
33094
  const OidcOptions = {
33095
+ // Note that here, the issuer is not the one from the received options, but
33096
+ // from the issuer's config. This enforces the canonical URL is used and stored,
33097
+ // which is also the one present in the ID token, so storing a technically
33098
+ // valid, but different issuer URL (e.g. using a trailing slash or not) now
33099
+ // could prevent from validating the ID token later.
32793
33100
  issuer: issuerConfig.issuer,
33101
+ // TODO: differentiate if DPoP should be true
32794
33102
  dpop: options.tokenType.toLowerCase() === "dpop",
32795
33103
  ...options,
32796
33104
  issuerConfiguration: issuerConfig,
@@ -32811,6 +33119,9 @@ var PodOS = (() => {
32811
33119
  response_type: "code",
32812
33120
  scope: DEFAULT_SCOPES,
32813
33121
  filterProtocolClaims: true,
33122
+ // The userinfo endpoint on NSS fails, so disable this for now
33123
+ // Note that in Solid, information should be retrieved from the
33124
+ // profile referenced by the WebId.
32814
33125
  loadUserInfo: false,
32815
33126
  code_verifier: true,
32816
33127
  prompt: (_a = oidcLoginOptions.prompt) !== null && _a !== void 0 ? _a : "consent"
@@ -32820,7 +33131,9 @@ var PodOS = (() => {
32820
33131
  const signingRequest = await oidcClientLibrary.createSigninRequest();
32821
33132
  return await this.handleRedirect({
32822
33133
  oidcLoginOptions,
33134
+ // eslint-disable-next-line no-underscore-dangle
32823
33135
  state: signingRequest.state._id,
33136
+ // eslint-disable-next-line no-underscore-dangle
32824
33137
  codeVerifier: signingRequest.state._code_verifier,
32825
33138
  targetUrl: signingRequest.url.toString()
32826
33139
  });
@@ -32935,12 +33248,19 @@ var PodOS = (() => {
32935
33248
  this.storageUtility = storageUtility;
32936
33249
  this.storageUtility = storageUtility;
32937
33250
  }
33251
+ // This method needs no state (so can be static), and can be exposed to allow
33252
+ // callers to know where this implementation puts state it needs.
32938
33253
  static getLocalStorageKey(issuer2) {
32939
33254
  return `issuerConfig:${issuer2}`;
32940
33255
  }
32941
33256
  async fetchConfig(issuer2) {
32942
33257
  let issuerConfig;
32943
- const openIdConfigUrl = new URL(WELL_KNOWN_OPENID_CONFIG, issuer2.endsWith("/") ? issuer2 : `${issuer2}/`).href;
33258
+ const openIdConfigUrl = new URL(
33259
+ WELL_KNOWN_OPENID_CONFIG,
33260
+ // Make sure to append a slash at issuer URL, so that the .well-known URL
33261
+ // includes the full issuer path. See https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig.
33262
+ issuer2.endsWith("/") ? issuer2 : `${issuer2}/`
33263
+ ).href;
32944
33264
  const issuerConfigRequestBody = await fetch2.call(globalThis, openIdConfigUrl);
32945
33265
  try {
32946
33266
  issuerConfig = processConfig(await issuerConfigRequestBody.json());
@@ -33005,9 +33325,16 @@ var PodOS = (() => {
33005
33325
  issuer: issuer2,
33006
33326
  clientAppId: clientId,
33007
33327
  clientAppSecret: clientSecret,
33328
+ // Default the token type to DPoP if unspecified.
33008
33329
  tokenType: tokenType !== null && tokenType !== void 0 ? tokenType : "DPoP"
33009
33330
  };
33010
33331
  }
33332
+ /**
33333
+ * This function removes all session-related information from storage.
33334
+ * @param sessionId the session identifier
33335
+ * @param storage the storage where session info is stored
33336
+ * @hidden
33337
+ */
33011
33338
  async clear(sessionId) {
33012
33339
  return clear2(sessionId, this.storageUtility);
33013
33340
  }
@@ -33073,6 +33400,8 @@ var PodOS = (() => {
33073
33400
  if (isDpop) {
33074
33401
  tokens = await getDpopToken(issuerConfig, client, {
33075
33402
  grantType: "authorization_code",
33403
+ // We rely on our 'canHandle' function checking that the OAuth 'code'
33404
+ // parameter is present in our query string.
33076
33405
  code: url7.searchParams.get("code"),
33077
33406
  codeVerifier,
33078
33407
  redirectUrl: storedRedirectIri
@@ -33149,13 +33478,21 @@ var PodOS = (() => {
33149
33478
  this.storageUtility = storageUtility;
33150
33479
  }
33151
33480
  async getClient(options, issuerConfig) {
33152
- const [storedClientId, storedClientSecret] = await Promise.all([
33481
+ const [
33482
+ storedClientId,
33483
+ storedClientSecret
33484
+ // storedClientName,
33485
+ ] = await Promise.all([
33153
33486
  this.storageUtility.getForUser(options.sessionId, "clientId", {
33154
33487
  secure: false
33155
33488
  }),
33156
33489
  this.storageUtility.getForUser(options.sessionId, "clientSecret", {
33157
33490
  secure: false
33158
33491
  })
33492
+ // this.storageUtility.getForUser(options.sessionId, "clientName", {
33493
+ // // FIXME: figure out how to persist secure storage at reload
33494
+ // secure: false,
33495
+ // }),
33159
33496
  ]);
33160
33497
  if (storedClientId) {
33161
33498
  return {
@@ -33176,6 +33513,9 @@ var PodOS = (() => {
33176
33513
  infoToSave.idTokenSignedResponseAlg = registeredClient.idTokenSignedResponseAlg;
33177
33514
  }
33178
33515
  await this.storageUtility.setForUser(options.sessionId, infoToSave, {
33516
+ // FIXME: figure out how to persist secure storage at reload
33517
+ // Otherwise, the client info cannot be retrieved from storage, and
33518
+ // the lib tries to re-register the client on each fetch
33179
33519
  secure: false
33180
33520
  });
33181
33521
  return registeredClient;
@@ -33244,6 +33584,8 @@ var PodOS = (() => {
33244
33584
  const redirectHandler = new AggregateRedirectHandler([
33245
33585
  new ErrorOidcHandler(),
33246
33586
  new AuthCodeRedirectHandler(storageUtility, sessionInfoManager, issuerConfigFetcher, clientRegistrar, tokenRefresher),
33587
+ // This catch-all class will always be able to handle the
33588
+ // redirect IRI, so it must be registered last.
33247
33589
  new FallbackRedirectHandler()
33248
33590
  ]);
33249
33591
  return new ClientAuthentication2(loginHandler, redirectHandler, new IWaterfallLogoutHandler(sessionInfoManager, redirector), sessionInfoManager, issuerConfigFetcher);
@@ -33272,6 +33614,21 @@ var PodOS = (() => {
33272
33614
  return !!(sessionInfo === null || sessionInfo === void 0 ? void 0 : sessionInfo.isLoggedIn);
33273
33615
  }
33274
33616
  var Session = class _Session extends import_events2.default {
33617
+ /**
33618
+ * Session object constructor. Typically called as follows:
33619
+ *
33620
+ * ```typescript
33621
+ * const session = new Session();
33622
+ * ```
33623
+ *
33624
+ * See also [getDefaultSession](https://docs.inrupt.com/developer-tools/api/javascript/solid-client-authn-browser/functions.html#getdefaultsession).
33625
+ *
33626
+ * @param sessionOptions The options enabling the correct instantiation of
33627
+ * the session. Either both storages or clientAuthentication are required. For
33628
+ * more information, see {@link ISessionOptions}.
33629
+ * @param sessionId A string uniquely identifying the session.
33630
+ *
33631
+ */
33275
33632
  constructor(sessionOptions = {}, sessionId = void 0) {
33276
33633
  super();
33277
33634
  this.tokenRequestInProgress = false;
@@ -33280,6 +33637,7 @@ var PodOS = (() => {
33280
33637
  await this.clientAuthentication.login({
33281
33638
  sessionId: this.info.sessionId,
33282
33639
  ...options,
33640
+ // Defaults the token type to DPoP
33283
33641
  tokenType: (_a = options.tokenType) !== null && _a !== void 0 ? _a : "DPoP"
33284
33642
  }, this.events);
33285
33643
  return new Promise(() => {
@@ -33356,18 +33714,55 @@ var PodOS = (() => {
33356
33714
  this.events.on(EVENTS.SESSION_EXPIRED, () => this.internalLogout(false));
33357
33715
  this.events.on(EVENTS.ERROR, () => this.internalLogout(false));
33358
33716
  }
33717
+ /**
33718
+ * Register a callback function to be called when a user completes login.
33719
+ *
33720
+ * The callback is called when {@link handleIncomingRedirect} completes successfully.
33721
+ *
33722
+ * @param callback The function called when a user completes login.
33723
+ * @deprecated Prefer session.events.on(EVENTS.LOGIN, callback)
33724
+ */
33359
33725
  onLogin(callback) {
33360
33726
  this.events.on(EVENTS.LOGIN, callback);
33361
33727
  }
33728
+ /**
33729
+ * Register a callback function to be called when a user logs out:
33730
+ *
33731
+ * @param callback The function called when a user completes logout.
33732
+ * @deprecated Prefer session.events.on(EVENTS.LOGOUT, callback)
33733
+ */
33362
33734
  onLogout(callback) {
33363
33735
  this.events.on(EVENTS.LOGOUT, callback);
33364
33736
  }
33737
+ /**
33738
+ * Register a callback function to be called when a user logs out:
33739
+ *
33740
+ * @param callback The function called when an error occurs.
33741
+ * @since 1.11.0
33742
+ * @deprecated Prefer session.events.on(EVENTS.ERROR, callback)
33743
+ */
33365
33744
  onError(callback) {
33366
33745
  this.events.on(EVENTS.ERROR, callback);
33367
33746
  }
33747
+ /**
33748
+ * Register a callback function to be called when a session is restored.
33749
+ *
33750
+ * Note: the callback will be called with the saved value of the 'current URL'
33751
+ * at the time the session was restored.
33752
+ *
33753
+ * @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.
33754
+ * @deprecated Prefer session.events.on(EVENTS.SESSION_RESTORED, callback)
33755
+ */
33368
33756
  onSessionRestore(callback) {
33369
33757
  this.events.on(EVENTS.SESSION_RESTORED, callback);
33370
33758
  }
33759
+ /**
33760
+ * Register a callback that runs when the session expires and can no longer
33761
+ * make authenticated requests, but following a user logout.
33762
+ * @param callback The function that runs on session expiration.
33763
+ * @since 1.11.0
33764
+ * @deprecated Prefer session.events.on(EVENTS.SESSION_EXPIRED, callback)
33765
+ */
33371
33766
  onSessionExpiration(callback) {
33372
33767
  this.events.on(EVENTS.SESSION_EXPIRED, callback);
33373
33768
  }
@@ -33482,23 +33877,23 @@ var PodOS = (() => {
33482
33877
  }
33483
33878
 
33484
33879
  // ../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
33485
- function _toPrimitive(input2, hint2) {
33486
- if (_typeof(input2) !== "object" || input2 === null)
33487
- return input2;
33488
- var prim = input2[Symbol.toPrimitive];
33489
- if (prim !== void 0) {
33490
- var res = prim.call(input2, hint2 || "default");
33491
- if (_typeof(res) !== "object")
33492
- return res;
33880
+ function toPrimitive(t, r) {
33881
+ if ("object" != _typeof(t) || !t)
33882
+ return t;
33883
+ var e = t[Symbol.toPrimitive];
33884
+ if (void 0 !== e) {
33885
+ var i = e.call(t, r || "default");
33886
+ if ("object" != _typeof(i))
33887
+ return i;
33493
33888
  throw new TypeError("@@toPrimitive must return a primitive value.");
33494
33889
  }
33495
- return (hint2 === "string" ? String : Number)(input2);
33890
+ return ("string" === r ? String : Number)(t);
33496
33891
  }
33497
33892
 
33498
33893
  // ../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
33499
- function _toPropertyKey(arg2) {
33500
- var key3 = _toPrimitive(arg2, "string");
33501
- return _typeof(key3) === "symbol" ? key3 : String(key3);
33894
+ function toPropertyKey(t) {
33895
+ var i = toPrimitive(t, "string");
33896
+ return "symbol" == _typeof(i) ? i : String(i);
33502
33897
  }
33503
33898
 
33504
33899
  // ../node_modules/@babel/runtime/helpers/esm/createClass.js
@@ -33509,7 +33904,7 @@ var PodOS = (() => {
33509
33904
  descriptor.configurable = true;
33510
33905
  if ("value" in descriptor)
33511
33906
  descriptor.writable = true;
33512
- Object.defineProperty(target5, _toPropertyKey(descriptor.key), descriptor);
33907
+ Object.defineProperty(target5, toPropertyKey(descriptor.key), descriptor);
33513
33908
  }
33514
33909
  }
33515
33910
  function _createClass(Constructor, protoProps, staticProps) {
@@ -33586,7 +33981,7 @@ var PodOS = (() => {
33586
33981
 
33587
33982
  // ../node_modules/@babel/runtime/helpers/esm/defineProperty.js
33588
33983
  function _defineProperty(obj, key3, value6) {
33589
- key3 = _toPropertyKey(key3);
33984
+ key3 = toPropertyKey(key3);
33590
33985
  if (key3 in obj) {
33591
33986
  Object.defineProperty(obj, key3, {
33592
33987
  value: value6,
@@ -35465,7 +35860,7 @@ var PodOS = (() => {
35465
35860
  } else if (this.flags.indexOf("u") >= 0) {
35466
35861
  uri6 = backslashUify(uri6);
35467
35862
  } else {
35468
- uri6 = hexify(uri6);
35863
+ uri6 = hexify(decodeURI(uri6));
35469
35864
  }
35470
35865
  return "<" + uri6 + ">";
35471
35866
  }
@@ -45175,8 +45570,8 @@ var PodOS = (() => {
45175
45570
  return uri6.slice(0, 4) === "http";
45176
45571
  }
45177
45572
  /** Remove from the store HTTP authorization metadata
45178
- * The editble function below relies on copies we have in the store
45179
- * of the results of previous HTTP transactions. Howver, when
45573
+ * The editable function below relies on copies we have in the store
45574
+ * of the results of previous HTTP transactions. However, when
45180
45575
  * the user logs in, then that data misrepresents what would happen
45181
45576
  * if the user tried again.
45182
45577
  */
@@ -45214,7 +45609,7 @@ var PodOS = (() => {
45214
45609
  * and local write access is determined by those headers.
45215
45610
  * This async version not only looks at past HTTP requests, it also makes new ones if necessary.
45216
45611
  *
45217
- * @returns The method string SPARQL or DAV or
45612
+ * @returns The method string N3PATCH or SPARQL or DAV or
45218
45613
  * LOCALFILE or false if known, undefined if not known.
45219
45614
  */
45220
45615
  }, {
@@ -45320,6 +45715,8 @@ var PodOS = (() => {
45320
45715
  if (acceptPatch.length) {
45321
45716
  for (var i = 0; i < acceptPatch.length; i++) {
45322
45717
  method5 = acceptPatch[i].value.trim();
45718
+ if (method5.indexOf("text/n3") >= 0)
45719
+ return "N3PATCH";
45323
45720
  if (method5.indexOf("application/sparql-update") >= 0)
45324
45721
  return "SPARQL";
45325
45722
  if (method5.indexOf("application/sparql-update-single-match") >= 0)
@@ -45367,7 +45764,8 @@ var PodOS = (() => {
45367
45764
  }, {
45368
45765
  key: "anonymize",
45369
45766
  value: function anonymize(obj) {
45370
- return obj.toNT().substr(0, 2) === "_:" && this.mentioned(obj) ? "?" + obj.toNT().substr(2) : obj.toNT();
45767
+ var anonymized = obj.toNT().substr(0, 2) === "_:" && this.mentioned(obj) ? "?" + obj.toNT().substr(2) : obj.toNT();
45768
+ return anonymized;
45371
45769
  }
45372
45770
  }, {
45373
45771
  key: "anonymizeNT",
@@ -45544,7 +45942,7 @@ var PodOS = (() => {
45544
45942
  throw new Error("No URI given for remote editing operation: " + query4);
45545
45943
  }
45546
45944
  options.noMeta = true;
45547
- options.contentType = "application/sparql-update";
45945
+ options.contentType = options.contentType || "application/sparql-update";
45548
45946
  options.body = query4;
45549
45947
  return _this.store.fetcher.webOperation("PATCH", uri6, options);
45550
45948
  }).then(function(response6) {
@@ -45557,7 +45955,7 @@ var PodOS = (() => {
45557
45955
  callbackFunction(uri6, false, err.message, err);
45558
45956
  });
45559
45957
  }
45560
- // ARE THESE THEE FUNCTIONS USED? DEPROCATE?
45958
+ // ARE THESE THREE FUNCTIONS USED? DEPRECATE?
45561
45959
  /** return a statemnet updating function
45562
45960
  *
45563
45961
  * This does NOT update the statement.
@@ -45821,7 +46219,89 @@ var PodOS = (() => {
45821
46219
  return Promise.all(updates);
45822
46220
  }
45823
46221
  /**
45824
- * This high-level function updates the local store iff the web is changed successfully.
46222
+ * @private
46223
+ *
46224
+ * This helper function constructs SPARQL Update query from resolved arguments.
46225
+ *
46226
+ * @param ds: deletions array.
46227
+ * @param is: insertions array.
46228
+ * @param bnodes_context: Additional context to uniquely identify any blank nodes.
46229
+ */
46230
+ }, {
46231
+ key: "constructSparqlUpdateQuery",
46232
+ value: function constructSparqlUpdateQuery(ds, is, bnodes_context) {
46233
+ var whereClause = this.contextWhere(bnodes_context);
46234
+ var query4 = "";
46235
+ if (whereClause.length) {
46236
+ if (ds.length) {
46237
+ query4 += "DELETE { ";
46238
+ for (var i = 0; i < ds.length; i++) {
46239
+ query4 += this.anonymizeNT(ds[i]) + "\n";
46240
+ }
46241
+ query4 += " }\n";
46242
+ }
46243
+ if (is.length) {
46244
+ query4 += "INSERT { ";
46245
+ for (var _i5 = 0; _i5 < is.length; _i5++) {
46246
+ query4 += this.anonymizeNT(is[_i5]) + "\n";
46247
+ }
46248
+ query4 += " }\n";
46249
+ }
46250
+ query4 += whereClause;
46251
+ } else {
46252
+ if (ds.length) {
46253
+ query4 += "DELETE DATA { ";
46254
+ for (var _i6 = 0; _i6 < ds.length; _i6++) {
46255
+ query4 += this.anonymizeNT(ds[_i6]) + "\n";
46256
+ }
46257
+ query4 += " } \n";
46258
+ }
46259
+ if (is.length) {
46260
+ if (ds.length)
46261
+ query4 += " ; ";
46262
+ query4 += "INSERT DATA { ";
46263
+ for (var _i7 = 0; _i7 < is.length; _i7++) {
46264
+ query4 += this.nTriples(is[_i7]) + "\n";
46265
+ }
46266
+ query4 += " }\n";
46267
+ }
46268
+ }
46269
+ return query4;
46270
+ }
46271
+ /**
46272
+ * @private
46273
+ *
46274
+ * This helper function constructs n3-patch query from resolved arguments.
46275
+ *
46276
+ * @param ds: deletions array.
46277
+ * @param is: insertions array.
46278
+ * @param bnodes_context: Additional context to uniquely identify any blanknodes.
46279
+ */
46280
+ }, {
46281
+ key: "constructN3PatchQuery",
46282
+ value: function constructN3PatchQuery(ds, is, bnodes_context) {
46283
+ var _this3 = this;
46284
+ var query4 = "\n@prefix solid: <http://www.w3.org/ns/solid/terms#>.\n@prefix ex: <http://www.example.org/terms#>.\n\n_:patch\n";
46285
+ if (bnodes_context && bnodes_context.length > 0) {
46286
+ query4 += "\n solid:where {\n ".concat(bnodes_context.map(function(x) {
46287
+ return _this3.anonymizeNT(x);
46288
+ }).join("\n "), "\n };");
46289
+ }
46290
+ if (ds.length > 0) {
46291
+ query4 += "\n solid:deletes {\n ".concat(ds.map(function(x) {
46292
+ return _this3.anonymizeNT(x);
46293
+ }).join("\n "), "\n };");
46294
+ }
46295
+ if (is.length > 0) {
46296
+ query4 += "\n solid:inserts {\n ".concat(is.map(function(x) {
46297
+ return _this3.anonymizeNT(x);
46298
+ }).join("\n "), "\n };");
46299
+ }
46300
+ query4 += " a solid:InsertDeletePatch .\n";
46301
+ return query4;
46302
+ }
46303
+ /**
46304
+ * This high-level function updates the local store if the web is changed successfully.
45825
46305
  * Deletions, insertions may be undefined or single statements or lists or formulae (may contain bnodes which can be indirectly identified by a where clause).
45826
46306
  * The `why` property of each statement must be the same and give the web document to be updated.
45827
46307
  * @param deletions - Statement or statements to be deleted.
@@ -45833,7 +46313,7 @@ var PodOS = (() => {
45833
46313
  }, {
45834
46314
  key: "update",
45835
46315
  value: function update(deletions, insertions, callback, secondTry) {
45836
- var _this3 = this;
46316
+ var _this4 = this;
45837
46317
  var options = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {};
45838
46318
  if (!callback) {
45839
46319
  var thisUpdater = this;
@@ -45895,61 +46375,28 @@ var PodOS = (() => {
45895
46375
  }
45896
46376
  if (protocol6 === void 0) {
45897
46377
  if (secondTry) {
45898
- throw new Error("Update: Loaded " + doc + "but stil can't figure out what editing protcol it supports.");
46378
+ throw new Error("Update: Loaded " + doc + "but still can't figure out what editing protocol it supports.");
45899
46379
  }
45900
46380
  this.store.fetcher.load(doc).then(function(response6) {
45901
- _this3.update(deletions, insertions, callback, true, options);
46381
+ _this4.update(deletions, insertions, callback, true, options);
45902
46382
  }, function(err) {
45903
46383
  if (err.response.status === 404) {
45904
- _this3.update(deletions, insertions, callback, true, options);
46384
+ _this4.update(deletions, insertions, callback, true, options);
45905
46385
  } else {
45906
46386
  throw new Error("Update: Can't get updatability status ".concat(doc, " before patching: ").concat(err));
45907
46387
  }
45908
46388
  });
45909
46389
  return;
45910
- } else if (protocol6.indexOf("SPARQL") >= 0) {
46390
+ } else if (protocol6.indexOf("SPARQL") >= 0 || protocol6.indexOf("N3PATCH") >= 0) {
46391
+ var isSparql = protocol6.indexOf("SPARQL") >= 0;
45911
46392
  var bnodes = [];
45912
46393
  if (ds.length)
45913
46394
  bnodes = this.statementArrayBnodes(ds);
45914
46395
  if (is.length)
45915
46396
  bnodes = bnodes.concat(this.statementArrayBnodes(is));
45916
46397
  var context3 = this.bnodeContext(bnodes, doc);
45917
- var whereClause = this.contextWhere(context3);
45918
- var query4 = "";
45919
- if (whereClause.length) {
45920
- if (ds.length) {
45921
- query4 += "DELETE { ";
45922
- for (var i = 0; i < ds.length; i++) {
45923
- query4 += this.anonymizeNT(ds[i]) + "\n";
45924
- }
45925
- query4 += " }\n";
45926
- }
45927
- if (is.length) {
45928
- query4 += "INSERT { ";
45929
- for (var _i5 = 0; _i5 < is.length; _i5++) {
45930
- query4 += this.anonymizeNT(is[_i5]) + "\n";
45931
- }
45932
- query4 += " }\n";
45933
- }
45934
- query4 += whereClause;
45935
- } else {
45936
- if (ds.length) {
45937
- query4 += "DELETE DATA { ";
45938
- for (var _i6 = 0; _i6 < ds.length; _i6++) {
45939
- query4 += this.anonymizeNT(ds[_i6]) + "\n";
45940
- }
45941
- query4 += " } \n";
45942
- }
45943
- if (is.length) {
45944
- if (ds.length)
45945
- query4 += " ; ";
45946
- query4 += "INSERT DATA { ";
45947
- for (var _i7 = 0; _i7 < is.length; _i7++) {
45948
- query4 += this.nTriples(is[_i7]) + "\n";
45949
- }
45950
- query4 += " }\n";
45951
- }
45952
- }
46398
+ var query4 = isSparql ? this.constructSparqlUpdateQuery(ds, is, context3) : this.constructN3PatchQuery(ds, is, context3);
46399
+ options.contentType = isSparql ? "application/sparql-update" : "text/n3";
45953
46400
  control2.pendingUpstream = control2.pendingUpstream ? control2.pendingUpstream + 1 : 1;
45954
46401
  if ("upstreamCount" in control2) {
45955
46402
  control2.upstreamCount += 1;
@@ -45963,8 +46410,8 @@ var PodOS = (() => {
45963
46410
  success2 = false;
45964
46411
  body = "Remote Ok BUT error deleting " + ds.length + " from store!!! " + e;
45965
46412
  }
45966
- for (var _i8 = 0; _i8 < is.length; _i8++) {
45967
- kb.add(is[_i8].subject, is[_i8].predicate, is[_i8].object, doc);
46413
+ for (var i = 0; i < is.length; i++) {
46414
+ kb.add(is[i].subject, is[i].predicate, is[i].object, doc);
45968
46415
  }
45969
46416
  }
45970
46417
  callback(uri6, success2, body, response6);
@@ -46015,8 +46462,8 @@ var PodOS = (() => {
46015
46462
  for (var i = 0; i < ds.length; i++) {
46016
46463
  RDFArrayRemove(newSts, ds[i]);
46017
46464
  }
46018
- for (var _i9 = 0; _i9 < is.length; _i9++) {
46019
- newSts.push(is[_i9]);
46465
+ for (var _i8 = 0; _i8 < is.length; _i8++) {
46466
+ newSts.push(is[_i8]);
46020
46467
  }
46021
46468
  var documentString = this.serialize(doc.value, newSts, contentType4);
46022
46469
  var candidateTarget = kb.the(response6, this.ns.httph("content-location"));
@@ -46031,11 +46478,11 @@ var PodOS = (() => {
46031
46478
  if (!response7.ok) {
46032
46479
  throw new Error(response7.error);
46033
46480
  }
46034
- for (var _i10 = 0; _i10 < ds.length; _i10++) {
46035
- kb.remove(ds[_i10]);
46481
+ for (var _i9 = 0; _i9 < ds.length; _i9++) {
46482
+ kb.remove(ds[_i9]);
46036
46483
  }
46037
- for (var _i11 = 0; _i11 < is.length; _i11++) {
46038
- kb.add(is[_i11].subject, is[_i11].predicate, is[_i11].object, doc);
46484
+ for (var _i10 = 0; _i10 < is.length; _i10++) {
46485
+ kb.add(is[_i10].subject, is[_i10].predicate, is[_i10].object, doc);
46039
46486
  }
46040
46487
  callbackFunction(doc.value, response7.ok, response7.responseText, response7);
46041
46488
  }).catch(function(err) {
@@ -46060,8 +46507,8 @@ var PodOS = (() => {
46060
46507
  for (var i = 0; i < ds.length; i++) {
46061
46508
  RDFArrayRemove(newSts, ds[i]);
46062
46509
  }
46063
- for (var _i12 = 0; _i12 < is.length; _i12++) {
46064
- newSts.push(is[_i12]);
46510
+ for (var _i11 = 0; _i11 < is.length; _i11++) {
46511
+ newSts.push(is[_i11]);
46065
46512
  }
46066
46513
  var dot = doc.value.lastIndexOf(".");
46067
46514
  if (dot < 1) {
@@ -46077,11 +46524,11 @@ var PodOS = (() => {
46077
46524
  kb.fetcher.webOperation("PUT", doc.value, options).then(function(response6) {
46078
46525
  if (!response6.ok)
46079
46526
  return callbackFunction(doc.value, false, response6.error);
46080
- for (var _i13 = 0; _i13 < ds.length; _i13++) {
46081
- kb.remove(ds[_i13]);
46527
+ for (var _i12 = 0; _i12 < ds.length; _i12++) {
46528
+ kb.remove(ds[_i12]);
46082
46529
  }
46083
- for (var _i14 = 0; _i14 < is.length; _i14++) {
46084
- kb.add(is[_i14].subject, is[_i14].predicate, is[_i14].object, doc);
46530
+ for (var _i13 = 0; _i13 < is.length; _i13++) {
46531
+ kb.add(is[_i13].subject, is[_i13].predicate, is[_i13].object, doc);
46085
46532
  }
46086
46533
  callbackFunction(doc.value, true, "");
46087
46534
  });
@@ -46124,11 +46571,11 @@ var PodOS = (() => {
46124
46571
  }, {
46125
46572
  key: "put",
46126
46573
  value: function put(doc, data2, contentType4, callback) {
46127
- var _this4 = this;
46574
+ var _this5 = this;
46128
46575
  var kb = this.store;
46129
46576
  var documentString;
46130
46577
  return Promise.resolve().then(function() {
46131
- documentString = _this4.serialize(doc.value, data2, contentType4);
46578
+ documentString = _this5.serialize(doc.value, data2, contentType4);
46132
46579
  return kb.fetcher.webOperation("PUT", doc.value, {
46133
46580
  contentType: contentType4,
46134
46581
  body: documentString