@muze-nl/jsfs-solid 0.1.7 → 0.1.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muze-nl/jsfs-solid",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "author": "auke@muze.nl",
5
5
  "source": "src/SolidAdapter.js",
6
6
  "main": "dist/browser.js",
@@ -28,7 +28,7 @@
28
28
  "homepage": "https://github.com/muze-nl/jsfs-solid#readme",
29
29
  "dependencies": {
30
30
  "@muze-nl/jaqt": "^0.10.3",
31
- "@muze-nl/jsfs": "^0.3.1",
31
+ "@muze-nl/jsfs": "^0.3.3",
32
32
  "@muze-nl/metro": "^0.6.17",
33
33
  "@muze-nl/metro-oidc": "^0.5.3",
34
34
  "@muze-nl/metro-oldm": "^0.2.1",
package/package.json~ CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muze-nl/jsfs-solid",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "author": "auke@muze.nl",
5
5
  "source": "src/SolidAdapter.js",
6
6
  "main": "dist/browser.js",
@@ -28,7 +28,7 @@
28
28
  "homepage": "https://github.com/muze-nl/jsfs-solid#readme",
29
29
  "dependencies": {
30
30
  "@muze-nl/jaqt": "^0.10.3",
31
- "@muze-nl/jsfs": "^0.3.1",
31
+ "@muze-nl/jsfs": "^0.3.2",
32
32
  "@muze-nl/metro": "^0.6.17",
33
33
  "@muze-nl/metro-oidc": "^0.5.3",
34
34
  "@muze-nl/metro-oldm": "^0.2.1",
@@ -9,6 +9,8 @@ import { _, from } from '@muze-nl/jaqt/src/jaqt.mjs'
9
9
 
10
10
  export default class SolidAdapter extends HttpAdapter
11
11
  {
12
+ #client
13
+ #path
12
14
 
13
15
  constructor(metroClient, path='/', solidConfiguration={})
14
16
  {
@@ -17,6 +19,8 @@ export default class SolidAdapter extends HttpAdapter
17
19
  .with( oldmmw(solidConfiguration))
18
20
  path = new Path(path);
19
21
  super(metroClient, path)
22
+ this.#client = metroClient
23
+ this.#path = path
20
24
  }
21
25
 
22
26
  get name()
@@ -24,6 +28,30 @@ export default class SolidAdapter extends HttpAdapter
24
28
  return 'SolidAdapter';
25
29
  }
26
30
 
31
+ async read(path)
32
+ {
33
+ let response = await this.#client.get(path);
34
+ let result = {
35
+ type: this.getMimetype(response),
36
+ name: Path.filename(path),
37
+ http: {
38
+ headers: response.headers,
39
+ status: response.status,
40
+ url: response.url
41
+ }
42
+ }
43
+ if (response.data) {
44
+ result.data = response.data
45
+ }
46
+ if (result.type.match(/text\/.*/)) {
47
+ result.contents = await response.text()
48
+ } else if (result.type.match(/application\/json.*/)) {
49
+ result.contents = await response.json()
50
+ } else {
51
+ result.contents = await response.blob()
52
+ }
53
+ return result
54
+ }
27
55
 
28
56
  async list(path)
29
57
  {