@muze-nl/jsfs-solid 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +203 -222
- package/dist/browser.js.map +4 -4
- package/dist/browser.min.js +3 -3
- package/dist/browser.min.js.map +4 -4
- package/package.json +2 -2
- package/package.json~ +2 -2
- package/src/SolidAdapter.js +3 -2
package/dist/browser.js
CHANGED
|
@@ -8081,7 +8081,7 @@
|
|
|
8081
8081
|
}
|
|
8082
8082
|
});
|
|
8083
8083
|
|
|
8084
|
-
// node_modules/@muze-nl/jsfs/src/Path.
|
|
8084
|
+
// node_modules/@muze-nl/jsfs/src/Path.mjs
|
|
8085
8085
|
var Path = class _Path {
|
|
8086
8086
|
#value;
|
|
8087
8087
|
constructor(path) {
|
|
@@ -8206,173 +8206,6 @@
|
|
|
8206
8206
|
}
|
|
8207
8207
|
};
|
|
8208
8208
|
|
|
8209
|
-
// node_modules/@muze-nl/jsfs/src/Adapters/HttpAdapter.js
|
|
8210
|
-
var HttpAdapter = class _HttpAdapter {
|
|
8211
|
-
#baseUrl;
|
|
8212
|
-
#path;
|
|
8213
|
-
#exceptionHandler;
|
|
8214
|
-
#fetchParams;
|
|
8215
|
-
constructor(baseUrl, path = "/", exceptionHandler = null, fetchParams = {}) {
|
|
8216
|
-
this.#baseUrl = new URL(baseUrl, window.location.href);
|
|
8217
|
-
this.#path = new Path(path);
|
|
8218
|
-
this.#exceptionHandler = exceptionHandler;
|
|
8219
|
-
this.#fetchParams = fetchParams;
|
|
8220
|
-
}
|
|
8221
|
-
get name() {
|
|
8222
|
-
return "HttpAdapter";
|
|
8223
|
-
}
|
|
8224
|
-
get path() {
|
|
8225
|
-
return this.#path;
|
|
8226
|
-
}
|
|
8227
|
-
supportsWrite() {
|
|
8228
|
-
return true;
|
|
8229
|
-
}
|
|
8230
|
-
supportsStreamingWrite() {
|
|
8231
|
-
return supportsRequestStreams;
|
|
8232
|
-
}
|
|
8233
|
-
supportsStreamingRead() {
|
|
8234
|
-
return true;
|
|
8235
|
-
}
|
|
8236
|
-
cd(path) {
|
|
8237
|
-
if (!Path.isPath(path)) {
|
|
8238
|
-
throw new TypeError(path + " is not a valid path");
|
|
8239
|
-
}
|
|
8240
|
-
return new _HttpAdapter(this.#baseUrl.href, path);
|
|
8241
|
-
}
|
|
8242
|
-
//FIXME: return a jsfs result object instead of http response
|
|
8243
|
-
async write(path, contents, metadata = null) {
|
|
8244
|
-
let params2 = Object.assign({}, this.#fetchParams, {
|
|
8245
|
-
method: "PUT",
|
|
8246
|
-
body: contents
|
|
8247
|
-
});
|
|
8248
|
-
return this.#fetch(path, params2);
|
|
8249
|
-
}
|
|
8250
|
-
writeStream(path, writer, metadata = null) {
|
|
8251
|
-
throw new Error("Not yet implemented");
|
|
8252
|
-
}
|
|
8253
|
-
async read(path) {
|
|
8254
|
-
let params2 = Object.assign({}, this.#fetchParams, {
|
|
8255
|
-
method: "GET"
|
|
8256
|
-
});
|
|
8257
|
-
let response2 = await this.#fetch(path, params2);
|
|
8258
|
-
let result2 = {
|
|
8259
|
-
type: this.#getMimetype(response2),
|
|
8260
|
-
name: Path.filename(path),
|
|
8261
|
-
http: {
|
|
8262
|
-
headers: response2.headers,
|
|
8263
|
-
status: response2.status,
|
|
8264
|
-
url: response2.url
|
|
8265
|
-
}
|
|
8266
|
-
};
|
|
8267
|
-
if (result2.type.match(/text\/.*/)) {
|
|
8268
|
-
result2.contents = await response2.text();
|
|
8269
|
-
} else if (result2.type.match(/application\/json.*/)) {
|
|
8270
|
-
result2.contents = await response2.json();
|
|
8271
|
-
} else {
|
|
8272
|
-
result2.contents = await response2.blob();
|
|
8273
|
-
}
|
|
8274
|
-
return result2;
|
|
8275
|
-
}
|
|
8276
|
-
readStream(path, reader) {
|
|
8277
|
-
throw new Error("Not yet implemented");
|
|
8278
|
-
}
|
|
8279
|
-
async exists(path) {
|
|
8280
|
-
let params2 = Object.assign({}, this.#fetchParams, {
|
|
8281
|
-
method: "HEAD"
|
|
8282
|
-
});
|
|
8283
|
-
return this.#fetch(path, params2);
|
|
8284
|
-
}
|
|
8285
|
-
async delete(path) {
|
|
8286
|
-
let params2 = Object.assign({}, this.#fetchParams, {
|
|
8287
|
-
method: "DELETE"
|
|
8288
|
-
});
|
|
8289
|
-
return this.#fetch(path, params2);
|
|
8290
|
-
}
|
|
8291
|
-
async list(path) {
|
|
8292
|
-
let supportedContentTypes = [
|
|
8293
|
-
"text/html",
|
|
8294
|
-
"text/xhtml",
|
|
8295
|
-
"text/xhtml+xml",
|
|
8296
|
-
"text/xml"
|
|
8297
|
-
];
|
|
8298
|
-
let result2 = await this.read(path);
|
|
8299
|
-
if (supportedContentTypes.includes(result2.type.split(";")[0])) {
|
|
8300
|
-
var html = result2.contents;
|
|
8301
|
-
} else {
|
|
8302
|
-
let url3 = this.#getUrl(path);
|
|
8303
|
-
throw new TypeError("URL " + url3 + " is not of a supported content type", {
|
|
8304
|
-
cause: result2
|
|
8305
|
-
});
|
|
8306
|
-
}
|
|
8307
|
-
let basePath = Path.collapse(this.#baseUrl.pathname);
|
|
8308
|
-
let parentUrl = this.#getUrl(path);
|
|
8309
|
-
let dom = document.createElement("template");
|
|
8310
|
-
dom.innerHTML = html;
|
|
8311
|
-
let links = dom.content.querySelectorAll("a[href]");
|
|
8312
|
-
return Array.from(links).map((link) => {
|
|
8313
|
-
let url3 = new URL(link.getAttribute("href"), parentUrl.href);
|
|
8314
|
-
link.href = url3.href;
|
|
8315
|
-
return {
|
|
8316
|
-
filename: Path.filename(link.pathname),
|
|
8317
|
-
path: link.pathname,
|
|
8318
|
-
name: link.innerText,
|
|
8319
|
-
href: link.href
|
|
8320
|
-
};
|
|
8321
|
-
}).filter((link) => {
|
|
8322
|
-
let testURL = new URL(link.href);
|
|
8323
|
-
testURL.pathname = Path.parent(testURL.pathname);
|
|
8324
|
-
return testURL.href === parentUrl.href;
|
|
8325
|
-
}).map((link) => {
|
|
8326
|
-
return {
|
|
8327
|
-
filename: link.filename,
|
|
8328
|
-
path: link.path.substring(basePath.length - 1),
|
|
8329
|
-
//TODO: Path.collapse() now always adds a trailing '/', so this works, but the added trailing / is probably not correct
|
|
8330
|
-
name: link.name
|
|
8331
|
-
};
|
|
8332
|
-
});
|
|
8333
|
-
}
|
|
8334
|
-
#getUrl(path) {
|
|
8335
|
-
path = Path.collapse(this.#baseUrl.pathname + Path.collapse(path));
|
|
8336
|
-
return new URL(path, this.#baseUrl);
|
|
8337
|
-
}
|
|
8338
|
-
async #fetch(path, options) {
|
|
8339
|
-
return fetch(this.#getUrl(path), options).catch((e) => {
|
|
8340
|
-
if (!this.#exceptionHandler || !this.#exceptionHandler(url, options, e)) {
|
|
8341
|
-
throw e;
|
|
8342
|
-
}
|
|
8343
|
-
});
|
|
8344
|
-
}
|
|
8345
|
-
#getMimetype(response2) {
|
|
8346
|
-
if (response2.headers.has("Content-Type")) {
|
|
8347
|
-
return response2.headers.get("Content-Type");
|
|
8348
|
-
} else {
|
|
8349
|
-
return null;
|
|
8350
|
-
}
|
|
8351
|
-
}
|
|
8352
|
-
};
|
|
8353
|
-
var supportsRequestStreams = (async () => {
|
|
8354
|
-
const supportsStreamsInRequestObjects = !new Request(
|
|
8355
|
-
"",
|
|
8356
|
-
{
|
|
8357
|
-
body: new ReadableStream(),
|
|
8358
|
-
method: "POST",
|
|
8359
|
-
duplex: "half"
|
|
8360
|
-
// required in chrome
|
|
8361
|
-
}
|
|
8362
|
-
).headers.has("Content-Type");
|
|
8363
|
-
if (!supportsStreamsInRequestObjects) {
|
|
8364
|
-
return false;
|
|
8365
|
-
}
|
|
8366
|
-
return fetch(
|
|
8367
|
-
"data:a/a;charset=utf-8,",
|
|
8368
|
-
{
|
|
8369
|
-
method: "POST",
|
|
8370
|
-
body: new ReadableStream(),
|
|
8371
|
-
duplex: "half"
|
|
8372
|
-
}
|
|
8373
|
-
).then(() => true, () => false);
|
|
8374
|
-
})();
|
|
8375
|
-
|
|
8376
8209
|
// node_modules/@muze-nl/metro/src/metro.mjs
|
|
8377
8210
|
var metro_exports = {};
|
|
8378
8211
|
__export(metro_exports, {
|
|
@@ -8384,7 +8217,7 @@
|
|
|
8384
8217
|
request: () => request,
|
|
8385
8218
|
response: () => response,
|
|
8386
8219
|
trace: () => trace,
|
|
8387
|
-
url: () =>
|
|
8220
|
+
url: () => url
|
|
8388
8221
|
});
|
|
8389
8222
|
var metroURL = "https://metro.muze.nl/details/";
|
|
8390
8223
|
if (!Symbol.metroProxy) {
|
|
@@ -8395,7 +8228,7 @@
|
|
|
8395
8228
|
}
|
|
8396
8229
|
var Client = class _Client {
|
|
8397
8230
|
clientOptions = {
|
|
8398
|
-
url: typeof window != "undefined" ?
|
|
8231
|
+
url: typeof window != "undefined" ? url(window.location) : url("https://localhost"),
|
|
8399
8232
|
verbs: ["get", "post", "put", "delete", "patch", "head", "options", "query"]
|
|
8400
8233
|
};
|
|
8401
8234
|
static tracers = {};
|
|
@@ -8412,7 +8245,7 @@
|
|
|
8412
8245
|
constructor(...options) {
|
|
8413
8246
|
for (let option of options) {
|
|
8414
8247
|
if (typeof option == "string" || option instanceof String) {
|
|
8415
|
-
this.clientOptions.url =
|
|
8248
|
+
this.clientOptions.url = url(this.clientOptions.url.href, option);
|
|
8416
8249
|
} else if (option instanceof Function) {
|
|
8417
8250
|
this.#addMiddlewares([option]);
|
|
8418
8251
|
} else if (option && typeof option == "object") {
|
|
@@ -8420,7 +8253,7 @@
|
|
|
8420
8253
|
if (param == "middlewares") {
|
|
8421
8254
|
this.#addMiddlewares(option[param]);
|
|
8422
8255
|
} else if (param == "url") {
|
|
8423
|
-
this.clientOptions.url =
|
|
8256
|
+
this.clientOptions.url = url(this.clientOptions.url.href, option[param]);
|
|
8424
8257
|
} else if (typeof option[param] == "function") {
|
|
8425
8258
|
this.clientOptions[param] = option[param](this.clientOptions[param], this.clientOptions);
|
|
8426
8259
|
} else {
|
|
@@ -8544,7 +8377,7 @@
|
|
|
8544
8377
|
params2[prop] = value(params2[prop], params2);
|
|
8545
8378
|
} else {
|
|
8546
8379
|
if (prop == "url") {
|
|
8547
|
-
params2.url =
|
|
8380
|
+
params2.url = url(params2.url, value);
|
|
8548
8381
|
} else if (prop == "headers") {
|
|
8549
8382
|
params2.headers = new Headers(current.headers);
|
|
8550
8383
|
if (!(value instanceof Headers)) {
|
|
@@ -8565,13 +8398,13 @@
|
|
|
8565
8398
|
}
|
|
8566
8399
|
function request(...options) {
|
|
8567
8400
|
let requestParams = {
|
|
8568
|
-
url: typeof window != "undefined" ?
|
|
8401
|
+
url: typeof window != "undefined" ? url(window.location) : url("https://localhost/"),
|
|
8569
8402
|
duplex: "half"
|
|
8570
8403
|
// required when setting body to ReadableStream, just set it here by default already
|
|
8571
8404
|
};
|
|
8572
8405
|
for (let option of options) {
|
|
8573
8406
|
if (typeof option == "string" || option instanceof URL || option instanceof URLSearchParams) {
|
|
8574
|
-
requestParams.url =
|
|
8407
|
+
requestParams.url = url(requestParams.url, option);
|
|
8575
8408
|
} else if (option && (option instanceof FormData || option instanceof ReadableStream || option instanceof Blob || option instanceof ArrayBuffer || option instanceof DataView)) {
|
|
8576
8409
|
requestParams.body = option;
|
|
8577
8410
|
} else if (option && typeof option == "object") {
|
|
@@ -8709,17 +8542,17 @@
|
|
|
8709
8542
|
}
|
|
8710
8543
|
});
|
|
8711
8544
|
}
|
|
8712
|
-
function appendSearchParams(
|
|
8545
|
+
function appendSearchParams(url2, params2) {
|
|
8713
8546
|
if (typeof params2 == "function") {
|
|
8714
|
-
params2(
|
|
8547
|
+
params2(url2.searchParams, url2);
|
|
8715
8548
|
} else {
|
|
8716
8549
|
params2 = new URLSearchParams(params2);
|
|
8717
8550
|
params2.forEach((value, key) => {
|
|
8718
|
-
|
|
8551
|
+
url2.searchParams.append(key, value);
|
|
8719
8552
|
});
|
|
8720
8553
|
}
|
|
8721
8554
|
}
|
|
8722
|
-
function
|
|
8555
|
+
function url(...options) {
|
|
8723
8556
|
let validParams = [
|
|
8724
8557
|
"hash",
|
|
8725
8558
|
"host",
|
|
@@ -8787,7 +8620,7 @@
|
|
|
8787
8620
|
break;
|
|
8788
8621
|
case "with":
|
|
8789
8622
|
result2 = function(...options2) {
|
|
8790
|
-
return
|
|
8623
|
+
return url(target, ...options2);
|
|
8791
8624
|
};
|
|
8792
8625
|
break;
|
|
8793
8626
|
case "filename":
|
|
@@ -8966,6 +8799,153 @@
|
|
|
8966
8799
|
return object;
|
|
8967
8800
|
}
|
|
8968
8801
|
|
|
8802
|
+
// node_modules/@muze-nl/jsfs/src/Adapters/Http.mjs
|
|
8803
|
+
var HttpAdapter = class {
|
|
8804
|
+
#client;
|
|
8805
|
+
#path;
|
|
8806
|
+
constructor(metroClient, path = "/") {
|
|
8807
|
+
this.#client = client(metroClient);
|
|
8808
|
+
this.#path = new Path(path);
|
|
8809
|
+
}
|
|
8810
|
+
get name() {
|
|
8811
|
+
return "HttpAdapter";
|
|
8812
|
+
}
|
|
8813
|
+
get path() {
|
|
8814
|
+
return this.#path;
|
|
8815
|
+
}
|
|
8816
|
+
supportsWrite() {
|
|
8817
|
+
return true;
|
|
8818
|
+
}
|
|
8819
|
+
supportsStreamingWrite() {
|
|
8820
|
+
return supportsRequestStreams;
|
|
8821
|
+
}
|
|
8822
|
+
supportsStreamingRead() {
|
|
8823
|
+
return true;
|
|
8824
|
+
}
|
|
8825
|
+
cd(path) {
|
|
8826
|
+
if (!Path.isPath(path)) {
|
|
8827
|
+
throw new TypeError(path + " is not a valid path");
|
|
8828
|
+
}
|
|
8829
|
+
if (Path.isRelative(path)) {
|
|
8830
|
+
path = Path.collapse(path, this.#path);
|
|
8831
|
+
}
|
|
8832
|
+
return new this.constructor(this.#client, path);
|
|
8833
|
+
}
|
|
8834
|
+
//FIXME: return a jsfs result object instead of http response
|
|
8835
|
+
async write(path, contents, metadata = null) {
|
|
8836
|
+
return this.#client.put({ body: contents });
|
|
8837
|
+
}
|
|
8838
|
+
writeStream(path, writer, metadata = null) {
|
|
8839
|
+
throw new Error("Not yet implemented");
|
|
8840
|
+
}
|
|
8841
|
+
async read(path) {
|
|
8842
|
+
let response2 = await this.#client.get(path);
|
|
8843
|
+
let result2 = {
|
|
8844
|
+
type: this.#getMimetype(response2),
|
|
8845
|
+
name: Path.filename(path),
|
|
8846
|
+
http: {
|
|
8847
|
+
headers: response2.headers,
|
|
8848
|
+
status: response2.status,
|
|
8849
|
+
url: response2.url
|
|
8850
|
+
}
|
|
8851
|
+
};
|
|
8852
|
+
if (result2.type.match(/text\/.*/)) {
|
|
8853
|
+
result2.contents = await response2.text();
|
|
8854
|
+
} else if (result2.type.match(/application\/json.*/)) {
|
|
8855
|
+
result2.contents = await response2.json();
|
|
8856
|
+
} else {
|
|
8857
|
+
result2.contents = await response2.blob();
|
|
8858
|
+
}
|
|
8859
|
+
return result2;
|
|
8860
|
+
}
|
|
8861
|
+
readStream(path, reader) {
|
|
8862
|
+
throw new Error("Not yet implemented");
|
|
8863
|
+
}
|
|
8864
|
+
async exists(path) {
|
|
8865
|
+
return this.#client.head(path);
|
|
8866
|
+
}
|
|
8867
|
+
async delete(path) {
|
|
8868
|
+
return this.#client.delete(path);
|
|
8869
|
+
}
|
|
8870
|
+
async list(path) {
|
|
8871
|
+
let supportedContentTypes = [
|
|
8872
|
+
"text/html",
|
|
8873
|
+
"text/xhtml",
|
|
8874
|
+
"text/xhtml+xml",
|
|
8875
|
+
"text/xml"
|
|
8876
|
+
];
|
|
8877
|
+
let result2 = await this.read(path);
|
|
8878
|
+
if (supportedContentTypes.includes(result2.type.split(";")[0])) {
|
|
8879
|
+
var html = result2.contents;
|
|
8880
|
+
} else {
|
|
8881
|
+
let url2 = this.#getUrl(path);
|
|
8882
|
+
throw new TypeError("URL " + url2 + " is not of a supported content type", {
|
|
8883
|
+
cause: result2
|
|
8884
|
+
});
|
|
8885
|
+
}
|
|
8886
|
+
let basePath = url(this.#client.clientOptions.url).pathname;
|
|
8887
|
+
let parentUrl = this.#getUrl(path);
|
|
8888
|
+
let dom = document.createElement("template");
|
|
8889
|
+
dom.innerHTML = html;
|
|
8890
|
+
let links = dom.content.querySelectorAll("a[href]");
|
|
8891
|
+
return Array.from(links).map((link) => {
|
|
8892
|
+
let url2 = new URL(link.getAttribute("href"), parentUrl.href);
|
|
8893
|
+
link.href = url2.href;
|
|
8894
|
+
return {
|
|
8895
|
+
filename: Path.filename(link.pathname),
|
|
8896
|
+
path: link.pathname,
|
|
8897
|
+
name: link.innerText,
|
|
8898
|
+
href: link.href
|
|
8899
|
+
};
|
|
8900
|
+
}).filter((link) => {
|
|
8901
|
+
let testURL = new URL(link.href);
|
|
8902
|
+
testURL.pathname = Path.parent(testURL.pathname);
|
|
8903
|
+
return testURL.href === parentUrl.href;
|
|
8904
|
+
}).map((link) => {
|
|
8905
|
+
return {
|
|
8906
|
+
filename: link.filename,
|
|
8907
|
+
path: link.path.substring(basePath.length - 1),
|
|
8908
|
+
//TODO: Path.collapse() now always adds a trailing '/', so this works, but the added trailing / is probably not correct
|
|
8909
|
+
name: link.name
|
|
8910
|
+
};
|
|
8911
|
+
});
|
|
8912
|
+
}
|
|
8913
|
+
#getUrl(path) {
|
|
8914
|
+
let basePath = url(this.#client.clientOptions.url).pathname;
|
|
8915
|
+
path = Path.collapse(basePath + Path.collapse(path));
|
|
8916
|
+
return new URL(path, this.#client.clientOptions.url);
|
|
8917
|
+
}
|
|
8918
|
+
#getMimetype(response2) {
|
|
8919
|
+
if (response2.headers.has("Content-Type")) {
|
|
8920
|
+
return response2.headers.get("Content-Type");
|
|
8921
|
+
} else {
|
|
8922
|
+
return null;
|
|
8923
|
+
}
|
|
8924
|
+
}
|
|
8925
|
+
};
|
|
8926
|
+
var supportsRequestStreams = (async () => {
|
|
8927
|
+
const supportsStreamsInRequestObjects = !new Request(
|
|
8928
|
+
"",
|
|
8929
|
+
{
|
|
8930
|
+
body: new ReadableStream(),
|
|
8931
|
+
method: "POST",
|
|
8932
|
+
duplex: "half"
|
|
8933
|
+
// required in chrome
|
|
8934
|
+
}
|
|
8935
|
+
).headers.has("Content-Type");
|
|
8936
|
+
if (!supportsStreamsInRequestObjects) {
|
|
8937
|
+
return false;
|
|
8938
|
+
}
|
|
8939
|
+
return fetch(
|
|
8940
|
+
"data:a/a;charset=utf-8,",
|
|
8941
|
+
{
|
|
8942
|
+
method: "POST",
|
|
8943
|
+
body: new ReadableStream(),
|
|
8944
|
+
duplex: "half"
|
|
8945
|
+
}
|
|
8946
|
+
).then(() => true, () => false);
|
|
8947
|
+
})();
|
|
8948
|
+
|
|
8969
8949
|
// node_modules/@muze-nl/metro/src/mw/getdata.mjs
|
|
8970
8950
|
function getdatamw() {
|
|
8971
8951
|
return async function getdata(req, next) {
|
|
@@ -9184,9 +9164,9 @@
|
|
|
9184
9164
|
if (data instanceof URL) {
|
|
9185
9165
|
data = data.href;
|
|
9186
9166
|
}
|
|
9187
|
-
let
|
|
9188
|
-
if (
|
|
9189
|
-
if (!(
|
|
9167
|
+
let url2 = new URL(data);
|
|
9168
|
+
if (url2.href != data) {
|
|
9169
|
+
if (!(url2.href + "/" == data || url2.href == data + "/")) {
|
|
9190
9170
|
return error("data is not a valid url", data, "validURL", path);
|
|
9191
9171
|
}
|
|
9192
9172
|
}
|
|
@@ -9364,9 +9344,9 @@
|
|
|
9364
9344
|
grant_type: "authorization_code",
|
|
9365
9345
|
code_verifier: generateCodeVerifier(64)
|
|
9366
9346
|
},
|
|
9367
|
-
authorize_callback: async (
|
|
9368
|
-
if (window.location.href !=
|
|
9369
|
-
window.location.replace(
|
|
9347
|
+
authorize_callback: async (url2) => {
|
|
9348
|
+
if (window.location.href != url2.href) {
|
|
9349
|
+
window.location.replace(url2.href);
|
|
9370
9350
|
}
|
|
9371
9351
|
return false;
|
|
9372
9352
|
}
|
|
@@ -9467,17 +9447,17 @@
|
|
|
9467
9447
|
}
|
|
9468
9448
|
function getTokensFromLocation() {
|
|
9469
9449
|
if (typeof window !== "undefined" && window?.location) {
|
|
9470
|
-
let
|
|
9450
|
+
let url2 = url(window.location);
|
|
9471
9451
|
let code, state, params2;
|
|
9472
|
-
if (
|
|
9473
|
-
params2 =
|
|
9474
|
-
|
|
9475
|
-
history.pushState({}, "",
|
|
9476
|
-
} else if (
|
|
9477
|
-
let query =
|
|
9452
|
+
if (url2.searchParams.has("code")) {
|
|
9453
|
+
params2 = url2.searchParams;
|
|
9454
|
+
url2 = url2.with({ search: "" });
|
|
9455
|
+
history.pushState({}, "", url2.href);
|
|
9456
|
+
} else if (url2.hash) {
|
|
9457
|
+
let query = url2.hash.substr(1);
|
|
9478
9458
|
params2 = new URLSearchParams("?" + query);
|
|
9479
|
-
|
|
9480
|
-
history.pushState({}, "",
|
|
9459
|
+
url2 = url2.with({ hash: "" });
|
|
9460
|
+
history.pushState({}, "", url2.href);
|
|
9481
9461
|
}
|
|
9482
9462
|
if (params2) {
|
|
9483
9463
|
code = params2.get("code");
|
|
@@ -9554,7 +9534,7 @@
|
|
|
9554
9534
|
if (!oauth2.authorization_endpoint) {
|
|
9555
9535
|
throw metroError("oauth2mw: Missing options.oauth2_configuration.authorization_endpoint");
|
|
9556
9536
|
}
|
|
9557
|
-
let
|
|
9537
|
+
let url2 = url(oauth2.authorization_endpoint, { hash: "" });
|
|
9558
9538
|
assert(oauth2, {
|
|
9559
9539
|
client_id: /.+/,
|
|
9560
9540
|
redirect_uri: /.+/,
|
|
@@ -9589,7 +9569,7 @@
|
|
|
9589
9569
|
if (oauth2.prompt) {
|
|
9590
9570
|
search.prompt = oauth2.prompt;
|
|
9591
9571
|
}
|
|
9592
|
-
return url2
|
|
9572
|
+
return url(url2, { search });
|
|
9593
9573
|
}
|
|
9594
9574
|
function getAccessTokenRequest(grant_type = null) {
|
|
9595
9575
|
assert(oauth2, {
|
|
@@ -9599,7 +9579,7 @@
|
|
|
9599
9579
|
if (!oauth2.token_endpoint) {
|
|
9600
9580
|
throw metroError("oauth2mw: Missing options.endpoints.token url");
|
|
9601
9581
|
}
|
|
9602
|
-
let
|
|
9582
|
+
let url2 = url(oauth2.token_endpoint, { hash: "" });
|
|
9603
9583
|
let params2 = {
|
|
9604
9584
|
grant_type: grant_type || oauth2.grant_type,
|
|
9605
9585
|
client_id: oauth2.client_id
|
|
@@ -9629,7 +9609,7 @@
|
|
|
9629
9609
|
throw new Error("Unknown grant_type: ".oauth2.grant_type);
|
|
9630
9610
|
break;
|
|
9631
9611
|
}
|
|
9632
|
-
return request(
|
|
9612
|
+
return request(url2, { method: "POST", body: new URLSearchParams(params2) });
|
|
9633
9613
|
}
|
|
9634
9614
|
}
|
|
9635
9615
|
function isExpired(token) {
|
|
@@ -9677,10 +9657,10 @@
|
|
|
9677
9657
|
return randomState;
|
|
9678
9658
|
}
|
|
9679
9659
|
function isRedirected() {
|
|
9680
|
-
let
|
|
9681
|
-
if (!
|
|
9682
|
-
if (
|
|
9683
|
-
let query =
|
|
9660
|
+
let url2 = new URL(document.location.href);
|
|
9661
|
+
if (!url2.searchParams.has("code")) {
|
|
9662
|
+
if (url2.hash) {
|
|
9663
|
+
let query = url2.hash.substr(1);
|
|
9684
9664
|
params = new URLSearchParams("?" + query);
|
|
9685
9665
|
if (params.has("code")) {
|
|
9686
9666
|
return true;
|
|
@@ -9959,7 +9939,7 @@
|
|
|
9959
9939
|
keyInfo = { domain: options.site, keyPair };
|
|
9960
9940
|
await keys.set(keyInfo);
|
|
9961
9941
|
}
|
|
9962
|
-
const
|
|
9942
|
+
const url2 = everything_default.url(req.url);
|
|
9963
9943
|
if (req.url.startsWith(options.authorization_endpoint)) {
|
|
9964
9944
|
let params2 = req.body;
|
|
9965
9945
|
if (params2 instanceof URLSearchParams || params2 instanceof FormData) {
|
|
@@ -9975,7 +9955,7 @@
|
|
|
9975
9955
|
}
|
|
9976
9956
|
});
|
|
9977
9957
|
} else if (req.headers.has("Authorization")) {
|
|
9978
|
-
const nonce = localStorage.getItem(
|
|
9958
|
+
const nonce = localStorage.getItem(url2.host + ":nonce") || void 0;
|
|
9979
9959
|
const accessToken = req.headers.get("Authorization").split(" ")[1];
|
|
9980
9960
|
const dpopHeader = await DPoP(keyInfo.keyPair, req.url, req.method, nonce, accessToken);
|
|
9981
9961
|
req = req.with({
|
|
@@ -9987,7 +9967,7 @@
|
|
|
9987
9967
|
}
|
|
9988
9968
|
let response2 = await next(req);
|
|
9989
9969
|
if (response2.headers.get("DPoP-Nonce")) {
|
|
9990
|
-
localStorage.setItem(
|
|
9970
|
+
localStorage.setItem(url2.host + ":nonce", response2.headers.get("DPoP-Nonce"));
|
|
9991
9971
|
}
|
|
9992
9972
|
return response2;
|
|
9993
9973
|
};
|
|
@@ -10037,7 +10017,7 @@
|
|
|
10037
10017
|
};
|
|
10038
10018
|
options = Object.assign({}, defaultOptions, options);
|
|
10039
10019
|
const TestSucceeded = false;
|
|
10040
|
-
function MustUseHTTPS(
|
|
10020
|
+
function MustUseHTTPS(url2) {
|
|
10041
10021
|
return TestSucceeded;
|
|
10042
10022
|
}
|
|
10043
10023
|
const openid_provider_metadata = {
|
|
@@ -10180,9 +10160,9 @@
|
|
|
10180
10160
|
client: client(),
|
|
10181
10161
|
force_authorization: false,
|
|
10182
10162
|
use_dpop: true,
|
|
10183
|
-
authorize_callback: async (
|
|
10184
|
-
if (window.location.href !=
|
|
10185
|
-
window.location.replace(
|
|
10163
|
+
authorize_callback: async (url2) => {
|
|
10164
|
+
if (window.location.href != url2.href) {
|
|
10165
|
+
window.location.replace(url2.href);
|
|
10186
10166
|
}
|
|
10187
10167
|
return false;
|
|
10188
10168
|
}
|
|
@@ -10342,15 +10322,15 @@
|
|
|
10342
10322
|
this.sources = /* @__PURE__ */ Object.create(null);
|
|
10343
10323
|
this.separator = options?.separator ?? "$";
|
|
10344
10324
|
}
|
|
10345
|
-
parse(input,
|
|
10346
|
-
const { quads, prefixes: prefixes3 } = this.parser(input,
|
|
10325
|
+
parse(input, url2, type) {
|
|
10326
|
+
const { quads, prefixes: prefixes3 } = this.parser(input, url2, type);
|
|
10347
10327
|
if (prefixes3) {
|
|
10348
10328
|
for (let prefix2 in prefixes3) {
|
|
10349
10329
|
let prefixURL = prefixes3[prefix2];
|
|
10350
10330
|
if (prefixURL.match(/^http(s?):\/\/$/i)) {
|
|
10351
|
-
prefixURL +=
|
|
10331
|
+
prefixURL += url2.substring(prefixURL.length);
|
|
10352
10332
|
} else try {
|
|
10353
|
-
prefixURL = new URL(prefixes3[prefix2],
|
|
10333
|
+
prefixURL = new URL(prefixes3[prefix2], url2).href;
|
|
10354
10334
|
} catch (err) {
|
|
10355
10335
|
console.error("Could not parse prefix", prefixes3[prefix2], err.message);
|
|
10356
10336
|
}
|
|
@@ -10359,8 +10339,8 @@
|
|
|
10359
10339
|
}
|
|
10360
10340
|
}
|
|
10361
10341
|
}
|
|
10362
|
-
this.sources[
|
|
10363
|
-
return this.sources[
|
|
10342
|
+
this.sources[url2] = new Graph(quads, url2, type, prefixes3, this);
|
|
10343
|
+
return this.sources[url2];
|
|
10364
10344
|
}
|
|
10365
10345
|
setType(literal2, shortType) {
|
|
10366
10346
|
if (!shortType) {
|
|
@@ -10386,9 +10366,9 @@
|
|
|
10386
10366
|
};
|
|
10387
10367
|
var Graph = class {
|
|
10388
10368
|
#blankNodes = /* @__PURE__ */ Object.create(null);
|
|
10389
|
-
constructor(quads,
|
|
10369
|
+
constructor(quads, url2, mimetype, prefixes3, context) {
|
|
10390
10370
|
this.mimetype = mimetype;
|
|
10391
|
-
this.url =
|
|
10371
|
+
this.url = url2;
|
|
10392
10372
|
this.prefixes = prefixes3;
|
|
10393
10373
|
this.context = context;
|
|
10394
10374
|
this.subjects = /* @__PURE__ */ Object.create(null);
|
|
@@ -10420,8 +10400,8 @@
|
|
|
10420
10400
|
}
|
|
10421
10401
|
subject.addPredicate(quad2.predicate.id, quad2.object);
|
|
10422
10402
|
}
|
|
10423
|
-
if (this.subjects[
|
|
10424
|
-
this.primary = this.subjects[
|
|
10403
|
+
if (this.subjects[url2]) {
|
|
10404
|
+
this.primary = this.subjects[url2];
|
|
10425
10405
|
} else {
|
|
10426
10406
|
this.primary = null;
|
|
10427
10407
|
}
|
|
@@ -14035,8 +14015,8 @@
|
|
|
14035
14015
|
format: type
|
|
14036
14016
|
});
|
|
14037
14017
|
let prefixes3 = /* @__PURE__ */ Object.create(null);
|
|
14038
|
-
const quads = parser.parse(input, null, (prefix2,
|
|
14039
|
-
prefixes3[prefix2] =
|
|
14018
|
+
const quads = parser.parse(input, null, (prefix2, url2) => {
|
|
14019
|
+
prefixes3[prefix2] = url2.id;
|
|
14040
14020
|
});
|
|
14041
14021
|
return { quads, prefixes: prefixes3 };
|
|
14042
14022
|
};
|
|
@@ -14709,6 +14689,7 @@
|
|
|
14709
14689
|
#client;
|
|
14710
14690
|
#path;
|
|
14711
14691
|
constructor(metroClient, path = "/", solidConfiguration = {}) {
|
|
14692
|
+
super(metroClient, path);
|
|
14712
14693
|
this.#client = client(metroClient).with(browser_default.oidcmw(solidConfiguration)).with(src_default3(solidConfiguration));
|
|
14713
14694
|
this.#path = new Path(path);
|
|
14714
14695
|
}
|