@pod-os/core 0.19.1-rc.c8e652b.0 → 0.19.1-rc.ca6f577.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 +34 -1
- package/lib/index.js +34 -1
- package/package.json +10 -10
- package/types/files/FileFetcher.d.ts +12 -0
- package/types/files/index.d.ts +1 -0
- package/types/index.d.ts +11 -0
package/dist/index.js
CHANGED
|
@@ -2736,6 +2736,11 @@ var FileFetcher = class {
|
|
|
2736
2736
|
constructor(session4) {
|
|
2737
2737
|
this.session = session4;
|
|
2738
2738
|
}
|
|
2739
|
+
/**
|
|
2740
|
+
* Fetch the contents of the given file
|
|
2741
|
+
* @param {string} url - URL identifying the file
|
|
2742
|
+
* @returns {Promise<SolidFile>} An object representing the fetched file
|
|
2743
|
+
*/
|
|
2739
2744
|
async fetchFile(url7) {
|
|
2740
2745
|
const response6 = await this.session.authenticatedFetch(url7);
|
|
2741
2746
|
if (response6.ok) {
|
|
@@ -2748,6 +2753,21 @@ var FileFetcher = class {
|
|
|
2748
2753
|
);
|
|
2749
2754
|
}
|
|
2750
2755
|
}
|
|
2756
|
+
/**
|
|
2757
|
+
* Updates the contents of a file (overrides old content with the given one)
|
|
2758
|
+
* @param file - The file to update
|
|
2759
|
+
* @param newContent - The content to put into the file, overriding all existing
|
|
2760
|
+
* @returns {Promise<Response>} The HTTP response
|
|
2761
|
+
*/
|
|
2762
|
+
async putFile(file2, newContent) {
|
|
2763
|
+
return await this.session.authenticatedFetch(file2.url, {
|
|
2764
|
+
method: "PUT",
|
|
2765
|
+
headers: {
|
|
2766
|
+
"Content-Type": file2.blob()?.type ?? "text/plain"
|
|
2767
|
+
},
|
|
2768
|
+
body: newContent
|
|
2769
|
+
});
|
|
2770
|
+
}
|
|
2751
2771
|
};
|
|
2752
2772
|
|
|
2753
2773
|
// src/modules/contacts.ts
|
|
@@ -24838,8 +24858,20 @@ var PodOS = class {
|
|
|
24838
24858
|
fetchAll(uris) {
|
|
24839
24859
|
return this.store.fetchAll(uris);
|
|
24840
24860
|
}
|
|
24861
|
+
/**
|
|
24862
|
+
* @deprecated Use {@link FileFetcher.fetchFile} via {@link PodOS.files} instead
|
|
24863
|
+
* @param {string} url - URL identifying the file
|
|
24864
|
+
* @returns {Promise<SolidFile>} An object representing the fetched file
|
|
24865
|
+
*/
|
|
24841
24866
|
fetchFile(url7) {
|
|
24842
|
-
return this.
|
|
24867
|
+
return this.files().fetchFile(url7);
|
|
24868
|
+
}
|
|
24869
|
+
/**
|
|
24870
|
+
* Provides access to file operations such as fetching and updating files in the pod
|
|
24871
|
+
* @returns {FileFetcher} An instance of FileFetcher that handles file operations
|
|
24872
|
+
*/
|
|
24873
|
+
files() {
|
|
24874
|
+
return this.fileFetcher;
|
|
24843
24875
|
}
|
|
24844
24876
|
addPropertyValue(thing, property4, value7) {
|
|
24845
24877
|
return this.store.addPropertyValue(thing, property4, value7);
|
|
@@ -24912,6 +24944,7 @@ export {
|
|
|
24912
24944
|
AssumeAlwaysOnline,
|
|
24913
24945
|
BinaryFile,
|
|
24914
24946
|
BrokenFile,
|
|
24947
|
+
FileFetcher,
|
|
24915
24948
|
HttpStatus,
|
|
24916
24949
|
LabelIndex,
|
|
24917
24950
|
LdpContainer,
|
package/lib/index.js
CHANGED
|
@@ -34745,6 +34745,7 @@ _:patch
|
|
|
34745
34745
|
AssumeAlwaysOnline: () => AssumeAlwaysOnline,
|
|
34746
34746
|
BinaryFile: () => BinaryFile,
|
|
34747
34747
|
BrokenFile: () => BrokenFile,
|
|
34748
|
+
FileFetcher: () => FileFetcher,
|
|
34748
34749
|
HttpStatus: () => HttpStatus,
|
|
34749
34750
|
LabelIndex: () => LabelIndex,
|
|
34750
34751
|
LdpContainer: () => LdpContainer,
|
|
@@ -35697,6 +35698,11 @@ _:patch
|
|
|
35697
35698
|
constructor(session4) {
|
|
35698
35699
|
this.session = session4;
|
|
35699
35700
|
}
|
|
35701
|
+
/**
|
|
35702
|
+
* Fetch the contents of the given file
|
|
35703
|
+
* @param {string} url - URL identifying the file
|
|
35704
|
+
* @returns {Promise<SolidFile>} An object representing the fetched file
|
|
35705
|
+
*/
|
|
35700
35706
|
async fetchFile(url7) {
|
|
35701
35707
|
const response6 = await this.session.authenticatedFetch(url7);
|
|
35702
35708
|
if (response6.ok) {
|
|
@@ -35709,6 +35715,21 @@ _:patch
|
|
|
35709
35715
|
);
|
|
35710
35716
|
}
|
|
35711
35717
|
}
|
|
35718
|
+
/**
|
|
35719
|
+
* Updates the contents of a file (overrides old content with the given one)
|
|
35720
|
+
* @param file - The file to update
|
|
35721
|
+
* @param newContent - The content to put into the file, overriding all existing
|
|
35722
|
+
* @returns {Promise<Response>} The HTTP response
|
|
35723
|
+
*/
|
|
35724
|
+
async putFile(file2, newContent) {
|
|
35725
|
+
return await this.session.authenticatedFetch(file2.url, {
|
|
35726
|
+
method: "PUT",
|
|
35727
|
+
headers: {
|
|
35728
|
+
"Content-Type": file2.blob()?.type ?? "text/plain"
|
|
35729
|
+
},
|
|
35730
|
+
body: newContent
|
|
35731
|
+
});
|
|
35732
|
+
}
|
|
35712
35733
|
};
|
|
35713
35734
|
|
|
35714
35735
|
// src/modules/contacts.ts
|
|
@@ -57821,8 +57842,20 @@ _:patch
|
|
|
57821
57842
|
fetchAll(uris) {
|
|
57822
57843
|
return this.store.fetchAll(uris);
|
|
57823
57844
|
}
|
|
57845
|
+
/**
|
|
57846
|
+
* @deprecated Use {@link FileFetcher.fetchFile} via {@link PodOS.files} instead
|
|
57847
|
+
* @param {string} url - URL identifying the file
|
|
57848
|
+
* @returns {Promise<SolidFile>} An object representing the fetched file
|
|
57849
|
+
*/
|
|
57824
57850
|
fetchFile(url7) {
|
|
57825
|
-
return this.
|
|
57851
|
+
return this.files().fetchFile(url7);
|
|
57852
|
+
}
|
|
57853
|
+
/**
|
|
57854
|
+
* Provides access to file operations such as fetching and updating files in the pod
|
|
57855
|
+
* @returns {FileFetcher} An instance of FileFetcher that handles file operations
|
|
57856
|
+
*/
|
|
57857
|
+
files() {
|
|
57858
|
+
return this.fileFetcher;
|
|
57826
57859
|
}
|
|
57827
57860
|
addPropertyValue(thing, property4, value7) {
|
|
57828
57861
|
return this.store.addPropertyValue(thing, property4, value7);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pod-os/core",
|
|
3
|
-
"version": "0.19.1-rc.
|
|
3
|
+
"version": "0.19.1-rc.ca6f577.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./types/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -29,25 +29,25 @@
|
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@babel/preset-env": "^7.28.3",
|
|
31
31
|
"@babel/preset-typescript": "^7.27.1",
|
|
32
|
-
"@eslint/js": "^9.
|
|
32
|
+
"@eslint/js": "^9.37.0",
|
|
33
33
|
"@types/jest": "^30.0.0",
|
|
34
34
|
"@types/jest-when": "^3.5.5",
|
|
35
35
|
"@types/sparqljs": "^3.1.12",
|
|
36
|
-
"esbuild": "^0.25.
|
|
37
|
-
"eslint": "^9.
|
|
38
|
-
"jest": "^30.
|
|
36
|
+
"esbuild": "^0.25.10",
|
|
37
|
+
"eslint": "^9.37.0",
|
|
38
|
+
"jest": "^30.2.0",
|
|
39
39
|
"jest-when": "^3.7.0",
|
|
40
40
|
"npm-run-all": "^4.1.5",
|
|
41
41
|
"prettier": "^3.6.2",
|
|
42
42
|
"rimraf": "^6.0.1",
|
|
43
43
|
"sparqljs": "^3.7.3",
|
|
44
|
-
"typedoc": "^0.28.
|
|
45
|
-
"typedoc-plugin-markdown": "^4.
|
|
46
|
-
"typescript": "5.9.
|
|
47
|
-
"typescript-eslint": "^8.
|
|
44
|
+
"typedoc": "^0.28.13",
|
|
45
|
+
"typedoc-plugin-markdown": "^4.9.0",
|
|
46
|
+
"typescript": "5.9.3",
|
|
47
|
+
"typescript-eslint": "^8.46.0"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@solid-data-modules/contacts-rdflib": "^0.7.
|
|
50
|
+
"@solid-data-modules/contacts-rdflib": "^0.7.1",
|
|
51
51
|
"@solid-data-modules/rdflib-utils": "^0.6.0",
|
|
52
52
|
"@types/lunr": "^2.3.7",
|
|
53
53
|
"buffer": "^6.0.3",
|
|
@@ -3,5 +3,17 @@ import { SolidFile } from "./SolidFile";
|
|
|
3
3
|
export declare class FileFetcher {
|
|
4
4
|
private session;
|
|
5
5
|
constructor(session: PodOsSession);
|
|
6
|
+
/**
|
|
7
|
+
* Fetch the contents of the given file
|
|
8
|
+
* @param {string} url - URL identifying the file
|
|
9
|
+
* @returns {Promise<SolidFile>} An object representing the fetched file
|
|
10
|
+
*/
|
|
6
11
|
fetchFile(url: string): Promise<SolidFile>;
|
|
12
|
+
/**
|
|
13
|
+
* Updates the contents of a file (overrides old content with the given one)
|
|
14
|
+
* @param file - The file to update
|
|
15
|
+
* @param newContent - The content to put into the file, overriding all existing
|
|
16
|
+
* @returns {Promise<Response>} The HTTP response
|
|
17
|
+
*/
|
|
18
|
+
putFile(file: SolidFile, newContent: string): Promise<Response>;
|
|
7
19
|
}
|
package/types/files/index.d.ts
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ContactsModule } from "@solid-data-modules/contacts-rdflib";
|
|
|
2
2
|
import { BehaviorSubject } from "rxjs";
|
|
3
3
|
import { SessionInfo, PodOsSession } from "./authentication";
|
|
4
4
|
import { SolidFile } from "./files";
|
|
5
|
+
import { FileFetcher } from "./files/FileFetcher";
|
|
5
6
|
import { WebIdProfile } from "./profile";
|
|
6
7
|
import { LabelIndex } from "./search";
|
|
7
8
|
import { Store } from "./Store";
|
|
@@ -38,7 +39,17 @@ export declare class PodOS {
|
|
|
38
39
|
private flagAuthorizationMetaDataOnSessionChange;
|
|
39
40
|
fetch(uri: string): Promise<Response>;
|
|
40
41
|
fetchAll(uris: string[]): Promise<PromiseSettledResult<Response>[]>;
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated Use {@link FileFetcher.fetchFile} via {@link PodOS.files} instead
|
|
44
|
+
* @param {string} url - URL identifying the file
|
|
45
|
+
* @returns {Promise<SolidFile>} An object representing the fetched file
|
|
46
|
+
*/
|
|
41
47
|
fetchFile(url: string): Promise<SolidFile>;
|
|
48
|
+
/**
|
|
49
|
+
* Provides access to file operations such as fetching and updating files in the pod
|
|
50
|
+
* @returns {FileFetcher} An instance of FileFetcher that handles file operations
|
|
51
|
+
*/
|
|
52
|
+
files(): FileFetcher;
|
|
42
53
|
addPropertyValue(thing: Thing, property: string, value: string): Promise<void>;
|
|
43
54
|
listKnownTerms(): Term[];
|
|
44
55
|
addNewThing(uri: string, name: string, type: string): Promise<void>;
|