@pod-os/core 0.23.1-rc.f73863c.0 → 0.24.0-rc.e770383.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.
@@ -3,6 +3,9 @@ import { SolidFile } from "./SolidFile";
3
3
  import { LdpContainer } from "../ldp-container";
4
4
  import { HttpProblem, NetworkProblem } from "../problems";
5
5
  import { ResultAsync } from "neverthrow";
6
+ /**
7
+ * Handles HTTP operations for files, like fetching and updating file contents.
8
+ */
6
9
  export declare class FileFetcher {
7
10
  private session;
8
11
  constructor(session: PodOsSession);
@@ -0,0 +1,27 @@
1
+ import { ResultAsync } from "neverthrow";
2
+ import { Thing } from "../thing";
3
+ import { Store } from "../Store";
4
+ import { FileFetcher, NewFile } from "../files";
5
+ import { HttpProblem, NetworkProblem } from "../problems";
6
+ /**
7
+ * Gateway for file-related operations on Solid Pods and the store.
8
+ * @since 0.24.0
9
+ */
10
+ export declare class FileGateway {
11
+ private readonly store;
12
+ private readonly fileFetcher;
13
+ constructor(store: Store, fileFetcher: FileFetcher);
14
+ /**
15
+ * Uploads a file and associates it with a thing.
16
+ * The container is automatically derived from the thing's URI.
17
+ * Uses schema:image as the predicate.
18
+ *
19
+ * @param thing - The thing to add the file to
20
+ * @param predicateUri - The URI of the predicate to use
21
+ * @param fileToUpload - The file to upload
22
+ * @returns Result with the uploaded metadata (url, name, contentType) or error
23
+ */
24
+ uploadAndLinkFile(thing: Thing, predicateUri: string, fileToUpload: File): ResultAsync<NewFile, HttpProblem | NetworkProblem>;
25
+ private linkFileToThing;
26
+ private getContainerFromThing;
27
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ import { UpdateOperation } from "@solid-data-modules/rdflib-utils";
2
+ import { Thing } from "../thing";
3
+ import { NewFile } from "../files";
4
+ /**
5
+ * Creates an update operation to link a file to a thing.
6
+ * Uses given predicate to establish the relationship.
7
+ *
8
+ * @since 0.24.0
9
+ * @internal
10
+ *
11
+ * @param thing - The thing to link the file to
12
+ * @param predicateUri - The URI of the predicate to use
13
+ * @param file - The uploaded file metadata
14
+ * @returns UpdateOperation that adds the file link to the thing's document
15
+ */
16
+ export declare function createFileLinkOperation(thing: Thing, predicateUri: string, file: NewFile): UpdateOperation;
@@ -0,0 +1 @@
1
+ export {};
@@ -3,3 +3,4 @@ export * from "./BinaryFile";
3
3
  export * from "./BrokenFile";
4
4
  export * from "./HttpStatus";
5
5
  export * from "./FileFetcher";
6
+ export * from "./FileGateway";
package/types/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { ContactsModule } from "@solid-data-modules/contacts-rdflib";
2
2
  import { BehaviorSubject } from "rxjs";
3
- import { SessionInfo, PodOsSession } from "./authentication";
4
- import { SolidFile } from "./files";
5
- import { FileFetcher } from "./files/FileFetcher";
3
+ import { PodOsSession, SessionInfo } from "./authentication";
4
+ import { FileFetcher, SolidFile } from "./files";
5
+ import { AttachmentGateway } from "./attachments";
6
6
  import { WebIdProfile } from "./profile";
7
7
  import { LabelIndex } from "./search";
8
8
  import { Store } from "./Store";
@@ -18,6 +18,7 @@ export * from "./files";
18
18
  export * from "./thing";
19
19
  export * from "./rdf-document";
20
20
  export * from "./ldp-container";
21
+ export * from "./attachments";
21
22
  export * from "./picture";
22
23
  export * from "./profile";
23
24
  export * from "./search";
@@ -26,6 +27,7 @@ export * from "./terms";
26
27
  export * from "./Store";
27
28
  export * from "./uri";
28
29
  export * from "./problems";
30
+ export * from "./type-index";
29
31
  export interface PodOsConfiguration {
30
32
  offlineCache?: OfflineCache;
31
33
  onlineStatus?: OnlineStatus;
@@ -38,6 +40,8 @@ export declare class PodOS {
38
40
  readonly uriService: UriService;
39
41
  private readonly fileFetcher;
40
42
  private readonly searchGateway;
43
+ private readonly fileGateway;
44
+ private readonly attachmentGateway;
41
45
  private readonly pictureGateway;
42
46
  private readonly offlineCache;
43
47
  private readonly profileGateway;
@@ -101,4 +105,10 @@ export declare class PodOS {
101
105
  uploadAndAddPicture(thing: Thing, pictureFile: File): ResultAsync<{
102
106
  url: string;
103
107
  }, HttpProblem | NetworkProblem>;
108
+ /**
109
+ * Provides access to attachment operations such as uploading and linking attachments to things
110
+ * @since 0.24.0
111
+ * @returns {AttachmentGateway} An instance of AttachmentGateway that handles attachment operations
112
+ */
113
+ attachments(): AttachmentGateway;
104
114
  }
@@ -1,3 +1,4 @@
1
1
  export declare const rdfs: (ln: string) => import("rdflib/lib/tf-types").NamedNode;
2
2
  export declare const pim: (ln: string) => import("rdflib/lib/tf-types").NamedNode;
3
3
  export declare const schema: (ln: string) => import("rdflib/lib/tf-types").NamedNode;
4
+ export declare const flow: (ln: string) => import("rdflib/lib/tf-types").NamedNode;
@@ -1,12 +1,13 @@
1
1
  import { ResultAsync } from "neverthrow";
2
2
  import { Thing } from "../thing";
3
- import { Store } from "../Store";
4
- import { FileFetcher, NewFile } from "../files";
3
+ import { FileGateway, NewFile } from "../files";
5
4
  import { HttpProblem, NetworkProblem } from "../problems";
5
+ /**
6
+ * Gateway for picture-related operations on Solid Pods and the store.
7
+ */
6
8
  export declare class PictureGateway {
7
- private readonly store;
8
- private readonly fileFetcher;
9
- constructor(store: Store, fileFetcher: FileFetcher);
9
+ private readonly attachmentGateway;
10
+ constructor(attachmentGateway: FileGateway);
10
11
  /**
11
12
  * Uploads a picture file and associates it with a thing.
12
13
  * The container is automatically derived from the thing's URI.
@@ -17,8 +18,6 @@ export declare class PictureGateway {
17
18
  * @returns Result with the uploaded picture metadata (url, name, contentType) or error
18
19
  */
19
20
  uploadAndAddPicture(thing: Thing, pictureFile: File): ResultAsync<UploadedPicture, HttpProblem | NetworkProblem>;
20
- private linkPictureToThing;
21
- private getContainerFromThing;
22
21
  }
23
22
  type UploadedPicture = NewFile;
24
23
  export {};
@@ -1,2 +1 @@
1
1
  export * from "./PictureGateway";
2
- export * from "./createPictureLinkOperation";
@@ -1,7 +1,17 @@
1
1
  import { WebIdProfile } from "./WebIdProfile";
2
2
  import { Store } from "../Store";
3
+ /**
4
+ * Gateway for profile-related operations on Solid Pods and the store.
5
+ * @since 0.24.0
6
+ */
3
7
  export declare class ProfileGateway {
4
8
  private readonly store;
5
9
  constructor(store: Store);
10
+ /**
11
+ * Fetches the profile for the given WebID and all linked documents
12
+ * @since 0.24.0
13
+ * @param webId The WebID to fetch the profile for
14
+ * @returns {Promise<WebIdProfile>} The fetched profile
15
+ */
6
16
  fetchProfile(webId: string): Promise<WebIdProfile>;
7
17
  }
@@ -15,10 +15,12 @@ export declare class WebIdProfile extends Thing {
15
15
  getPreferencesFile(): string | undefined;
16
16
  /**
17
17
  * Returns the URI of the public type index document
18
+ * @since 0.24.0
18
19
  */
19
20
  getPublicTypeIndex(): string | undefined;
20
21
  /**
21
22
  * Returns the URI of the private type index document
23
+ * @since 0.24.0
22
24
  */
23
25
  getPrivateTypeIndex(): string | undefined;
24
26
  /**
@@ -0,0 +1 @@
1
+ export {};
@@ -13,6 +13,10 @@ export interface RdfType {
13
13
  uri: string;
14
14
  label: string;
15
15
  }
16
+ export interface Attachment {
17
+ uri: string;
18
+ label: string;
19
+ }
16
20
  export declare class Thing {
17
21
  readonly uri: string;
18
22
  readonly store: IndexedFormula;
@@ -69,6 +73,10 @@ export declare class Thing {
69
73
  * Retrieves a list of RDF types for this thing.
70
74
  */
71
75
  types(): RdfType[];
76
+ /**
77
+ * Returns all attachments linked to this thing
78
+ */
79
+ attachments(): Attachment[];
72
80
  /**
73
81
  * Call this method to switch to a more specific subclass of Thing.
74
82
  *
@@ -3,6 +3,7 @@ import { IndexedFormula } from "rdflib";
3
3
  import { TypeRegistration } from "./TypeRegistration";
4
4
  /**
5
5
  * Represents a private or public type index document
6
+ * @since 0.24.0
6
7
  */
7
8
  export declare class TypeIndex extends Thing {
8
9
  readonly uri: string;
@@ -6,6 +6,10 @@ export interface TypeRegistration {
6
6
  * RDF class of the indexed item(s) (resembling terms:forClass)
7
7
  */
8
8
  forClass: string;
9
+ /**
10
+ * Short label for the class URI
11
+ */
12
+ label: string;
9
13
  /**
10
14
  * The containers or things this registration points to
11
15
  */
@@ -1 +1,2 @@
1
1
  export { TypeIndex } from "./TypeIndex";
2
+ export { TypeRegistration } from "./TypeRegistration";
@@ -1,12 +0,0 @@
1
- import { UpdateOperation } from "@solid-data-modules/rdflib-utils";
2
- import { Thing } from "../thing";
3
- import { NewFile } from "../files";
4
- /**
5
- * Creates an update operation to link a picture file to a thing.
6
- * Uses schema:image as the predicate to establish the relationship.
7
- *
8
- * @param thing - The thing to link the picture to
9
- * @param file - The uploaded picture file metadata
10
- * @returns UpdateOperation that adds the picture link to the thing's document
11
- */
12
- export declare function createPictureLinkOperation(thing: Thing, file: NewFile): UpdateOperation;