@muze-nl/jsfs-solid 0.1.11 → 0.2.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.
@@ -0,0 +1,127 @@
1
+ <!-- omit in toc -->
2
+ # Contributing to JSFS-Solid
3
+
4
+ First off, thanks for taking the time to contribute! ❤️
5
+
6
+ All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. We look forward to your contributions. 🎉
7
+
8
+ > And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about:
9
+ > - Star the project
10
+ > - Tweet about it
11
+ > - Refer this project in your project's readme
12
+ > - Mention the project at local meetups and tell your friends/colleagues
13
+
14
+ <!-- omit in toc -->
15
+ ## Table of Contents
16
+
17
+ - [I Have a Question](#i-have-a-question)
18
+ - [I Want To Contribute](#i-want-to-contribute)
19
+ - [Reporting Bugs](#reporting-bugs)
20
+ - [Suggesting Enhancements](#suggesting-enhancements)
21
+ - [Your First Code Contribution](#your-first-code-contribution)
22
+ - [Improving The Documentation](#improving-the-documentation)
23
+ - [Styleguides](#styleguides)
24
+ - [Commit Messages](#commit-messages)
25
+ - [Join The Project Team](#join-the-project-team)
26
+
27
+
28
+ ## I Have a Question
29
+
30
+ > If you want to ask a question, we assume that you have read the available [Documentation](https://github.com/muze-nl/jsfs-solid/).
31
+
32
+ Before you ask a question, it is best to search for existing [Issues](https://github.com/muze-nl/jsfs-solid/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first.
33
+
34
+ If you then still feel the need to ask a question and need clarification, we recommend the following:
35
+
36
+ - Open an [Issue](https://github.com/muze-nl/jsfs-solid/issues/new).
37
+ - Provide as much context as you can about what you're running into.
38
+ - Provide project and platform versions (browser, version, os, etc), depending on what seems relevant.
39
+
40
+ We will then take care of the issue as soon as possible.
41
+
42
+ ## I Want To Contribute
43
+
44
+ > ### Legal Notice <!-- omit in toc -->
45
+ > When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project licence.
46
+
47
+ ### Reporting Bugs
48
+
49
+ <!-- omit in toc -->
50
+ #### Before Submitting a Bug Report
51
+
52
+ A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible.
53
+
54
+ - Make sure that you are using the latest version.
55
+ - Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [documentation](https://github.com/muze-nl/jsfs-solid/). If you are looking for support, you might want to check [this section](#i-have-a-question)).
56
+ - To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](https://github.com/muze-nl/jsfs-solid/issues?q=label%3Abug).
57
+ - Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue.
58
+ - Collect information about the bug:
59
+ - Stack trace (Traceback)
60
+ - OS, Platform and Version (Windows, Linux, macOS, x86, ARM)
61
+ - Browser version.
62
+ - Possibly your input and the output
63
+ - Can you reliably reproduce the issue? And can you also reproduce it with older versions?
64
+
65
+ <!-- omit in toc -->
66
+ #### How Do I Submit a Good Bug Report?
67
+
68
+ > You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to <info@muze.nl>.
69
+ <!-- You may add a PGP key to allow the messages to be sent encrypted as well. -->
70
+
71
+ We use GitHub issues to track bugs and errors. If you run into an issue with the project:
72
+
73
+ - Open an [Issue](https://github.com/muze-nl/jsfs-solid/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.)
74
+ - Explain the behavior you would expect and the actual behavior.
75
+ - Please provide as much context as possible and describe the *reproduction steps* that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case.
76
+ - Provide the information you collected in the previous section.
77
+
78
+ Once it's filed:
79
+
80
+ - The project team will label the issue accordingly.
81
+ - A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until they are reproduced.
82
+ - If the team is able to reproduce the issue, it will be marked `needs-fix`, as well as possibly other tags (such as `critical`), and the issue will be left to be [implemented by someone](#your-first-code-contribution).
83
+
84
+ <!-- You might want to create an issue template for bugs and errors that can be used as a guide and that defines the structure of the information to be included. If you do so, reference it here in the description. -->
85
+
86
+ ### Suggesting Enhancements
87
+
88
+ This section guides you through submitting an enhancement suggestion for JSFS-Solid, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions.
89
+
90
+ <!-- omit in toc -->
91
+ #### Before Submitting an Enhancement
92
+
93
+ - Make sure that you are using the latest version.
94
+ - Read the [documentation](https://github.com/muze-nl/jsfs-solid/) carefully and find out if the functionality is already covered, maybe by an individual configuration.
95
+ - Perform a [search](https://github.com/muze-nl/jsfs-solid/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one.
96
+ - Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library.
97
+
98
+ <!-- omit in toc -->
99
+ #### How Do I Submit a Good Enhancement Suggestion?
100
+
101
+ Enhancement suggestions are tracked as [GitHub issues](https://github.com/muze-nl/jsfs-solid/issues).
102
+
103
+ - Use a **clear and descriptive title** for the issue to identify the suggestion.
104
+ - Provide a **step-by-step description of the suggested enhancement** in as many details as possible.
105
+ - **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you.
106
+ - You may want to **include screenshots or screen recordings** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [LICEcap](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and the built-in [screen recorder in GNOME](https://help.gnome.org/users/gnome-help/stable/screen-shot-record.html.en) or [SimpleScreenRecorder](https://github.com/MaartenBaert/ssr) on Linux. <!-- this should only be included if the project has a GUI -->
107
+ - **Explain why this enhancement would be useful** to most JSFS-Solid users. You may also want to point out the other projects that solved it better and which could serve as inspiration.
108
+
109
+ <!-- You might want to create an issue template for enhancement suggestions that can be used as a guide and that defines the structure of the information to be included. If you do so, reference it here in the description. -->
110
+
111
+ ### Your First Code Contribution
112
+
113
+ When you've added your own code, make sure that you create a pull request which not only includes your code, but also the updated dist/ folder. You can update these by running these two commands:
114
+
115
+ ```shell
116
+ npm run build
117
+ npm run build-dev
118
+ ```
119
+
120
+ Doing this also tells you if there are any syntax problems in your javascript code.
121
+
122
+ If you've added new features, please also add unit tests for them, in the correct test files in test/
123
+ And make sure `npm test` doesn't fail.
124
+
125
+ <!-- omit in toc -->
126
+ ## Attribution
127
+ This guide is based on the [contributing.md](https://contributing.md/generator)!
package/README.md ADDED
@@ -0,0 +1,129 @@
1
+ [![GitHub License](https://img.shields.io/github/license/muze-nl/jsfs-solid)](https://github.com/muze-nl/jsfs-solid/blob/main/LICENSE)
2
+ [![GitHub package.json version](https://img.shields.io/github/package-json/v/muze-nl/jsfs-solid)]()
3
+ [![NPM Version](https://img.shields.io/npm/v/@muze-nl/jsfs-solid)](https://www.npmjs.com/package/@muze-nl/jsfs-solid)
4
+ [![npm bundle size](https://img.shields.io/bundlephobia/min/@muze-nl/jsfs-solid)](https://www.npmjs.com/package/@muze-nl/jsfs-solid)
5
+ [![Project stage: Experimental][project-stage-badge: Experimental]][project-stage-page]
6
+
7
+ # JSFS-Solid: a jsfs solid client
8
+
9
+ ```javascript
10
+ import '@muze-nl/jsfs-solid'
11
+
12
+ const client = solidClient(
13
+ "https://auke.solidcommunity.net/",
14
+ "/public/",
15
+ {
16
+ client_info: {
17
+ client_name: 'My Client'
18
+ }
19
+ }
20
+ )
21
+
22
+ async function main() {
23
+ const dir = await client.list()
24
+ console.log(dir)
25
+ }
26
+
27
+ main()
28
+ ```
29
+
30
+ ## Table of Contents
31
+ 1. [Introduction](#introduction)
32
+ 2. [Usage](#usage)
33
+ 3. [Dependencies](#dependencies)
34
+ 4. [Contributing](CONTRIBUTING.md)
35
+ 5. [License](#license)
36
+
37
+ <a name="introduction"></a>
38
+ ## Introduction
39
+
40
+ JSFS-Solid is both a client to access Solid PODs (storage) and an Adapter for the [JSFS](https://github.com/muze-nl/jsfs/) API.
41
+
42
+ <a name="usage"></a>
43
+ ## Usage
44
+
45
+ ```bash
46
+ npm install @muze-nl/jsfs-solid
47
+ ```
48
+
49
+ In the browser, using a cdn:
50
+
51
+ ```html
52
+ <script src="https://cdn.jsdelivr.net/npm/@muze-nl/jsfs-solid/dist/browser.js"></script>
53
+ ```
54
+
55
+ Using ES6 modules, in the browser (using a bundler) or Node (or Deno, or...):
56
+ ```javascript
57
+ import '@muze-nl/jsfs-solid'
58
+ ```
59
+
60
+ Create a new client like this:
61
+ ```javascript
62
+ const client = solidClient(
63
+ 'https://auke.solidcommunity.net/',
64
+ '/public/',
65
+ {
66
+ client_info: {
67
+ client_name: "My Client"
68
+ }
69
+ }
70
+ )
71
+ ```
72
+
73
+ This client implements a simple filesystem API with the following methods:
74
+ - `cd`
75
+ - `read`
76
+ - `write`
77
+ - `delete`
78
+ - `exists`
79
+ - `list`
80
+
81
+ The `list` method returns an array of objects with these properties:
82
+ ```javascript
83
+ {
84
+ filename,
85
+ path,
86
+ name
87
+ }
88
+ ```
89
+
90
+ The `read` method returns these properties, where `data` is a dataset using [OLDM](https://github.com/muze-nl/oldm).
91
+ ```javascript
92
+ {
93
+ type,
94
+ name,
95
+ contents,
96
+ data,
97
+ http: {
98
+ headers,
99
+ status,
100
+ url
101
+ }
102
+ }
103
+ ```
104
+
105
+ Similarly, you can write files like this:
106
+ ```javascript
107
+ await client.write(data, 'movies.ttl', 'text/turtle')
108
+ ```
109
+ Just make sure that the data is OLDM data.
110
+
111
+ <a name="dependencies"></a>
112
+ ## Dependencies
113
+ - [JSFS](https://github.com/muze-nl/jsfs)
114
+ - [OLDM](https://github.com/muze-nl/oldm)
115
+ - [JAQT](https://github.com/muze-nl/jaqt)
116
+ - [MetroJS](https://github.com/muze-nl/metro)
117
+ - [Metro-OIDC](https://github.com/muze-nl/metro-oidc)
118
+ - [Metro-Oauth2](https://github.com/muze-nl/metro-oauth2)
119
+ - [Metro-OLDM](https://github.com/muze-nl/metro-oldm)
120
+ - [Assert](https://github.com/muze-nl/assert)
121
+ - [N3.js](https://github.com/rdfjs/N3.js/)
122
+
123
+ <a name="license"></a>
124
+ ## License
125
+
126
+ This software is licensed under MIT open source license. See the [License](./LICENSE) file.
127
+
128
+ [project-stage-badge: Experimental]: https://img.shields.io/badge/Project%20Stage-Experimental-yellow.svg
129
+ [project-stage-page]: https://blog.pother.ca/project-stages/
package/dist/browser.js CHANGED
@@ -8128,7 +8128,7 @@
8128
8128
  result2 += "/";
8129
8129
  }
8130
8130
  }
8131
- return result2;
8131
+ return "" + result2;
8132
8132
  }
8133
8133
  static isAbsolute(path) {
8134
8134
  if (path instanceof _Path) {
@@ -8206,6 +8206,74 @@
8206
8206
  }
8207
8207
  };
8208
8208
 
8209
+ // node_modules/@muze-nl/jsfs/src/FileSystem.mjs
8210
+ var FileSystem = class _FileSystem {
8211
+ #adapter;
8212
+ #path = "/";
8213
+ constructor(adapter) {
8214
+ this.#adapter = adapter;
8215
+ this.#path = this.#adapter.path;
8216
+ }
8217
+ get path() {
8218
+ return this.#path;
8219
+ }
8220
+ cd(path) {
8221
+ if (!(path instanceof Path)) {
8222
+ path = new Path(Path.collapse(path, this.#path));
8223
+ }
8224
+ return new _FileSystem(this.#adapter.cd(path));
8225
+ }
8226
+ async read(path, reader = null) {
8227
+ if (!(path instanceof Path)) {
8228
+ path = new Path(Path.collapse(path, this.#path));
8229
+ }
8230
+ if (typeof reader === "function") {
8231
+ if (!this.#adapter.supportsStreamingRead()) {
8232
+ throw new Error("Adapter " + this.#adapter.name + " does not support streaming reading.");
8233
+ }
8234
+ return this.#adapter.readStream(path, reader);
8235
+ } else {
8236
+ return this.#adapter.read(path);
8237
+ }
8238
+ }
8239
+ async write(path, contents, metadata = null) {
8240
+ if (!(path instanceof Path)) {
8241
+ path = new Path(Path.collapse(path, this.#path));
8242
+ }
8243
+ if (!this.#adapter.supportsWrite()) {
8244
+ throw new Error("Adapter " + this.#adapter.name + " is read only.");
8245
+ }
8246
+ if (typeof contents === "function") {
8247
+ if (!this.#adapter.supportsStreamingWrite()) {
8248
+ throw new Error("Adapter " + this.#adapter.name + " does not support streaming writing.");
8249
+ }
8250
+ return this.#adapter.writeStream(path, contents, metadata);
8251
+ } else if (typeof contents === "string") {
8252
+ return this.#adapter.write(path, contents, metadata);
8253
+ } else {
8254
+ throw new TypeError("Cannot write contents of type " + typeof contents);
8255
+ }
8256
+ }
8257
+ async delete(path) {
8258
+ if (!(path instanceof Path)) {
8259
+ path = new Path(Path.collapse(path, this.#path));
8260
+ }
8261
+ return this.#adapter.delete(path);
8262
+ }
8263
+ async exists(path) {
8264
+ if (!(path instanceof Path)) {
8265
+ path = new Path(Path.collapse(path, this.#path));
8266
+ }
8267
+ return this.#adapter.exists(path);
8268
+ }
8269
+ async list(path = "") {
8270
+ if (!(path instanceof Path)) {
8271
+ path = new Path(Path.collapse(path, this.#path));
8272
+ }
8273
+ return this.#adapter.list(path);
8274
+ }
8275
+ };
8276
+
8209
8277
  // node_modules/@muze-nl/metro/src/metro.mjs
8210
8278
  var metro_exports = {};
8211
8279
  __export(metro_exports, {
@@ -8948,16 +9016,15 @@
8948
9016
  ).then(() => true, () => false);
8949
9017
  })();
8950
9018
 
8951
- // node_modules/@muze-nl/metro/src/mw/getdata.mjs
8952
- function getdatamw() {
8953
- return async function getdata(req, next) {
8954
- let res = await next(req);
8955
- if (res.ok && res.data) {
8956
- return res.data;
8957
- }
8958
- return res;
8959
- };
8960
- }
9019
+ // node_modules/@muze-nl/jsfs/src/index.mjs
9020
+ var jsfs2 = {
9021
+ fs: FileSystem,
9022
+ adapters: {
9023
+ https: HttpAdapter
9024
+ },
9025
+ path: Path
9026
+ };
9027
+ globalThis.jsfs = jsfs2;
8961
9028
 
8962
9029
  // node_modules/@muze-nl/metro/src/mw/json.mjs
8963
9030
  function jsonmw(options) {
@@ -9032,6 +9099,17 @@
9032
9099
  };
9033
9100
  }
9034
9101
 
9102
+ // node_modules/@muze-nl/metro/src/mw/getdata.mjs
9103
+ function getdatamw() {
9104
+ return async function getdata(req, next) {
9105
+ let res = await next(req);
9106
+ if (res.ok && res.data) {
9107
+ return res.data;
9108
+ }
9109
+ return res;
9110
+ };
9111
+ }
9112
+
9035
9113
  // node_modules/@muze-nl/metro/src/api.mjs
9036
9114
  var API = class extends Client {
9037
9115
  constructor(base, methods, bind = null) {
@@ -14169,90 +14247,6 @@
14169
14247
  globalThis.oldm = oldm2;
14170
14248
  var src_default2 = oldm2;
14171
14249
 
14172
- // node_modules/@muze-nl/metro-oldm/src/oldmmw.mjs
14173
- function oldmmw(options) {
14174
- options = Object.assign({
14175
- contentType: "text/turtle",
14176
- prefixes: {
14177
- "ldp": "http://www.w3.org/ns/ldp#",
14178
- "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
14179
- "dct": "http://purl.org/dc/terms/",
14180
- "stat": "http://www.w3.org/ns/posix/stat#",
14181
- "turtle": "http://www.w3.org/ns/iana/media-types/text/turtle#",
14182
- "schem": "https://schema.org/",
14183
- "solid": "http://www.w3.org/ns/solid/terms#",
14184
- "acl": "http://www.w3.org/ns/auth/acl#",
14185
- "pims": "http://www.w3.org/ns/pim/space#",
14186
- "vcard": "http://www.w3.org/2006/vcard/ns#",
14187
- "foaf": "http://xmlns.com/foaf/0.1/"
14188
- },
14189
- parser: src_default2.n3Parser,
14190
- writer: src_default2.n3Writer
14191
- }, options);
14192
- if (!options.prefixes["ldp"]) {
14193
- options.prefixes["ldp"] = "http://www.w3.org/ns/ldp#";
14194
- }
14195
- const context = src_default2.context(options);
14196
- return async function oldmmw2(req, next) {
14197
- if (!req.headers.get("Accept")) {
14198
- req = req.with({
14199
- headers: {
14200
- "Accept": options.accept ?? options.contentType
14201
- }
14202
- });
14203
- }
14204
- if (req.method !== "GET" && req.method !== "HEAD") {
14205
- if (req.data && typeof req.data == "object" && !(req.data instanceof ReadableStream)) {
14206
- const contentType = req.headers.get("Content-Type");
14207
- if (!contentType || isPlainText(contentType)) {
14208
- req = req.with({
14209
- headers: {
14210
- "Content-Type": options.contentType
14211
- }
14212
- });
14213
- }
14214
- if (isLinkedData(req.headers.get("Content-Type"))) {
14215
- req = req.with({
14216
- body: await context.writer(req.data)
14217
- });
14218
- }
14219
- }
14220
- }
14221
- let res = await next(req);
14222
- if (res && isLinkedData(res.headers?.get("Content-Type"))) {
14223
- let tempRes = res.clone();
14224
- let body = await tempRes.text();
14225
- try {
14226
- let ld = context.parse(body, req.url, res.headers.get("Content-Type"));
14227
- return res.with({
14228
- body: ld
14229
- });
14230
- } catch (e) {
14231
- }
14232
- }
14233
- return res;
14234
- };
14235
- }
14236
- var mimetypes = [
14237
- /^text\/turtle\b/,
14238
- /^application\/n-quads\b/,
14239
- /^text\/x-nquads\b/,
14240
- /^appliction\/n-triples\b/,
14241
- /^application\/trig\b/
14242
- ];
14243
- function isLinkedData(contentType) {
14244
- for (const re of mimetypes) {
14245
- if (re.exec(contentType)) {
14246
- return true;
14247
- }
14248
- }
14249
- return false;
14250
- }
14251
-
14252
- // node_modules/@muze-nl/metro-oldm/src/index.mjs
14253
- globalThis.oldmmw = oldmmw;
14254
- var src_default3 = oldmmw;
14255
-
14256
14250
  // node_modules/@muze-nl/jaqt/src/jaqt.mjs
14257
14251
  function isPrimitiveWrapper(data) {
14258
14252
  return [String, Boolean, Number, BigInt].includes(data?.constructor);
@@ -14445,6 +14439,12 @@
14445
14439
  }
14446
14440
  function groupBy(data, pointerFunctions) {
14447
14441
  let pointerFn = pointerFunctions.shift();
14442
+ if (typeof pointerFn == "string") {
14443
+ pointerFn = _[pointerFn];
14444
+ }
14445
+ if (typeof pointerFn != "function") {
14446
+ throw new Error("groupBy parameters must be either a property name or a pointer function (e.g.: _.name)");
14447
+ }
14448
14448
  let groups = getMatchingGroups(data, pointerFn);
14449
14449
  if (pointerFunctions.length) {
14450
14450
  for (let group in groups) {
@@ -14686,6 +14686,90 @@
14686
14686
  };
14687
14687
  var _ = new Proxy(getPointerFn(), pointerHandler());
14688
14688
 
14689
+ // node_modules/@muze-nl/metro-oldm/src/oldmmw.mjs
14690
+ function oldmmw(options) {
14691
+ options = Object.assign({
14692
+ contentType: "text/turtle",
14693
+ prefixes: {
14694
+ "ldp": "http://www.w3.org/ns/ldp#",
14695
+ "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
14696
+ "dct": "http://purl.org/dc/terms/",
14697
+ "stat": "http://www.w3.org/ns/posix/stat#",
14698
+ "turtle": "http://www.w3.org/ns/iana/media-types/text/turtle#",
14699
+ "schem": "https://schema.org/",
14700
+ "solid": "http://www.w3.org/ns/solid/terms#",
14701
+ "acl": "http://www.w3.org/ns/auth/acl#",
14702
+ "pims": "http://www.w3.org/ns/pim/space#",
14703
+ "vcard": "http://www.w3.org/2006/vcard/ns#",
14704
+ "foaf": "http://xmlns.com/foaf/0.1/"
14705
+ },
14706
+ parser: src_default2.n3Parser,
14707
+ writer: src_default2.n3Writer
14708
+ }, options);
14709
+ if (!options.prefixes["ldp"]) {
14710
+ options.prefixes["ldp"] = "http://www.w3.org/ns/ldp#";
14711
+ }
14712
+ const context = src_default2.context(options);
14713
+ return async function oldmmw2(req, next) {
14714
+ if (!req.headers.get("Accept")) {
14715
+ req = req.with({
14716
+ headers: {
14717
+ "Accept": options.accept ?? options.contentType
14718
+ }
14719
+ });
14720
+ }
14721
+ if (req.method !== "GET" && req.method !== "HEAD") {
14722
+ if (req.data && typeof req.data == "object" && !(req.data instanceof ReadableStream)) {
14723
+ const contentType = req.headers.get("Content-Type");
14724
+ if (!contentType || isPlainText(contentType)) {
14725
+ req = req.with({
14726
+ headers: {
14727
+ "Content-Type": options.contentType
14728
+ }
14729
+ });
14730
+ }
14731
+ if (isLinkedData(req.headers.get("Content-Type"))) {
14732
+ req = req.with({
14733
+ body: await context.writer(req.data)
14734
+ });
14735
+ }
14736
+ }
14737
+ }
14738
+ let res = await next(req);
14739
+ if (res && isLinkedData(res.headers?.get("Content-Type"))) {
14740
+ let tempRes = res.clone();
14741
+ let body = await tempRes.text();
14742
+ try {
14743
+ let ld = context.parse(body, req.url, res.headers.get("Content-Type"));
14744
+ return res.with({
14745
+ body: ld
14746
+ });
14747
+ } catch (e) {
14748
+ }
14749
+ }
14750
+ return res;
14751
+ };
14752
+ }
14753
+ var mimetypes = [
14754
+ /^text\/turtle\b/,
14755
+ /^application\/n-quads\b/,
14756
+ /^text\/x-nquads\b/,
14757
+ /^appliction\/n-triples\b/,
14758
+ /^application\/trig\b/
14759
+ ];
14760
+ function isLinkedData(contentType) {
14761
+ for (const re of mimetypes) {
14762
+ if (re.exec(contentType)) {
14763
+ return true;
14764
+ }
14765
+ }
14766
+ return false;
14767
+ }
14768
+
14769
+ // node_modules/@muze-nl/metro-oldm/src/index.mjs
14770
+ globalThis.oldmmw = oldmmw;
14771
+ var src_default3 = oldmmw;
14772
+
14689
14773
  // src/SolidAdapter.js
14690
14774
  var SolidAdapter = class extends HttpAdapter {
14691
14775
  #client;
@@ -14742,8 +14826,12 @@
14742
14826
  }
14743
14827
  };
14744
14828
 
14745
- // src/browser.js
14746
- var browser_default2 = SolidAdapter;
14829
+ // src/SolidClient.js
14830
+ function solidClient(...options) {
14831
+ return new jsfs.fs(new SolidAdapter(...options));
14832
+ }
14833
+ var SolidClient_default = SolidAdapter;
14834
+ globalThis.solidClient = solidClient;
14747
14835
  globalThis.SolidAdapter = SolidAdapter;
14748
14836
  })();
14749
14837
  /*! Bundled license information: