@pod-os/core 0.23.0 → 0.23.1-rc.11e4e07.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/dist/index.js +295 -178
- package/lib/index.js +309 -191
- package/package.json +1 -1
- package/types/attachments/AttachmentGateway.d.ts +23 -0
- package/types/attachments/index.d.ts +1 -0
- package/types/files/FileFetcher.d.ts +3 -0
- package/types/files/FileGateway.d.ts +26 -0
- package/types/files/FileGateway.spec.d.ts +1 -0
- package/types/files/createFileLinkOperation.d.ts +13 -0
- package/types/files/createFileLinkOperation.spec.d.ts +1 -0
- package/types/files/index.d.ts +1 -0
- package/types/index.d.ts +12 -3
- package/types/namespaces/index.d.ts +1 -0
- package/types/picture/PictureGateway.d.ts +6 -7
- package/types/picture/index.d.ts +0 -1
- package/types/profile/ProfileGateway.d.ts +3 -0
- package/types/thing/Thing.attachments.spec.d.ts +1 -0
- package/types/thing/Thing.d.ts +8 -0
- package/types/type-index/TypeRegistration.d.ts +4 -0
- package/types/type-index/index.d.ts +1 -0
- package/types/picture/createPictureLinkOperation.d.ts +0 -12
- /package/types/{picture/createPictureLinkOperation.spec.d.ts → attachments/AttachmentGateway.spec.d.ts} +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
*/
|
|
9
|
+
export declare class FileGateway {
|
|
10
|
+
private readonly store;
|
|
11
|
+
private readonly fileFetcher;
|
|
12
|
+
constructor(store: Store, fileFetcher: FileFetcher);
|
|
13
|
+
/**
|
|
14
|
+
* Uploads a file and associates it with a thing.
|
|
15
|
+
* The container is automatically derived from the thing's URI.
|
|
16
|
+
* Uses schema:image as the predicate.
|
|
17
|
+
*
|
|
18
|
+
* @param thing - The thing to add the file to
|
|
19
|
+
* @param predicateUri - The URI of the predicate to use
|
|
20
|
+
* @param fileToUpload - The file to upload
|
|
21
|
+
* @returns Result with the uploaded metadata (url, name, contentType) or error
|
|
22
|
+
*/
|
|
23
|
+
uploadAndLinkFile(thing: Thing, predicateUri: string, fileToUpload: File): ResultAsync<NewFile, HttpProblem | NetworkProblem>;
|
|
24
|
+
private linkFileToThing;
|
|
25
|
+
private getContainerFromThing;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
* @param thing - The thing to link the file to
|
|
9
|
+
* @param predicateUri - The URI of the predicate to use
|
|
10
|
+
* @param file - The uploaded file metadata
|
|
11
|
+
* @returns UpdateOperation that adds the file link to the thing's document
|
|
12
|
+
*/
|
|
13
|
+
export declare function createFileLinkOperation(thing: Thing, predicateUri: string, file: NewFile): UpdateOperation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/types/files/index.d.ts
CHANGED
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 {
|
|
4
|
-
import { SolidFile } from "./files";
|
|
5
|
-
import {
|
|
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,9 @@ 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
|
+
* @returns {AttachmentGateway} An instance of AttachmentGateway that handles attachment operations
|
|
111
|
+
*/
|
|
112
|
+
attachments(): AttachmentGateway;
|
|
104
113
|
}
|
|
@@ -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 {
|
|
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
|
|
8
|
-
|
|
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 {};
|
package/types/picture/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/types/thing/Thing.d.ts
CHANGED
|
@@ -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
|
*
|
|
@@ -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,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;
|
|
File without changes
|