@pod-os/core 0.20.1-rc.44379ec.0 → 0.20.1-rc.4c5bdf8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pod-os/core",
3
- "version": "0.20.1-rc.44379ec.0",
3
+ "version": "0.20.1-rc.4c5bdf8.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./types/index.d.ts",
6
6
  "files": [
@@ -52,6 +52,8 @@
52
52
  "@types/lunr": "^2.3.7",
53
53
  "buffer": "^6.0.3",
54
54
  "lunr": "^2.3.9",
55
+ "mime": "^4.1.0",
56
+ "neverthrow": "^8.2.0",
55
57
  "rdf-namespaces": "^1.16.0",
56
58
  "rdflib": "2.3.0",
57
59
  "rxjs": "^7.8.2",
@@ -1,6 +1,8 @@
1
1
  import { PodOsSession } from "../authentication";
2
2
  import { SolidFile } from "./SolidFile";
3
3
  import { LdpContainer } from "../ldp-container";
4
+ import { HttpProblem, NetworkProblem } from "../problems";
5
+ import { ResultAsync } from "neverthrow";
4
6
  export declare class FileFetcher {
5
7
  private session;
6
8
  constructor(session: PodOsSession);
@@ -17,6 +19,17 @@ export declare class FileFetcher {
17
19
  * @returns {Promise<Response>} The HTTP response
18
20
  */
19
21
  putFile(file: SolidFile, newContent: string): Promise<Response>;
20
- createNewFile(container: LdpContainer, name: string): Promise<void>;
21
- createNewFolder(container: LdpContainer, name: string): Promise<void>;
22
+ createNewFile(container: LdpContainer, name: string): ResultAsync<NewFile, NotCreated>;
23
+ createNewFolder(container: LdpContainer, name: string): ResultAsync<NewFolder, NotCreated>;
22
24
  }
25
+ interface NewFolder {
26
+ url: string;
27
+ name: string;
28
+ }
29
+ interface NewFile {
30
+ url: string;
31
+ name: string;
32
+ contentType: string;
33
+ }
34
+ type NotCreated = HttpProblem | NetworkProblem;
35
+ export {};
package/types/index.d.ts CHANGED
@@ -22,6 +22,7 @@ export * from "./offline-cache";
22
22
  export * from "./terms";
23
23
  export * from "./Store";
24
24
  export * from "./uri";
25
+ export * from "./problems";
25
26
  export interface PodOsConfiguration {
26
27
  offlineCache?: OfflineCache;
27
28
  onlineStatus?: OnlineStatus;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Roughly resembling RFC 7807 Problem Details
3
+ * https://datatracker.ietf.org/doc/html/rfc7807
4
+ */
5
+ export interface Problem {
6
+ type: string;
7
+ title: string;
8
+ status?: number;
9
+ detail?: string;
10
+ }
11
+ export interface NetworkProblem extends Problem {
12
+ type: "network";
13
+ }
14
+ export interface HttpProblem extends Problem {
15
+ type: "http";
16
+ }
17
+ export declare function httpProblem(title: string, response: Response): HttpProblem;
18
+ export declare function networkProblem(title: string, cause: Error): NetworkProblem;