@pod-os/core 0.23.0 → 0.23.1-rc.28ee385.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 +299 -178
- package/lib/index.js +313 -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
package/dist/index.js
CHANGED
|
@@ -4492,11 +4492,11 @@ var FileFetcher = class {
|
|
|
4492
4492
|
}
|
|
4493
4493
|
};
|
|
4494
4494
|
|
|
4495
|
-
// src/
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4495
|
+
// src/namespaces/index.ts
|
|
4496
|
+
var rdfs = Namespace("http://www.w3.org/2000/01/rdf-schema#");
|
|
4497
|
+
var pim = Namespace("http://www.w3.org/ns/pim/space#");
|
|
4498
|
+
var schema = Namespace("https://schema.org/");
|
|
4499
|
+
var flow = Namespace("http://www.w3.org/2005/01/wf/flow#");
|
|
4500
4500
|
|
|
4501
4501
|
// src/thing/accumulateSubjects.ts
|
|
4502
4502
|
var accumulateSubjects = (accumulator, current3) => {
|
|
@@ -4720,6 +4720,19 @@ var Thing = class {
|
|
|
4720
4720
|
label: labelForType(uri6)
|
|
4721
4721
|
}));
|
|
4722
4722
|
}
|
|
4723
|
+
/**
|
|
4724
|
+
* Returns all attachments linked to this thing
|
|
4725
|
+
*/
|
|
4726
|
+
attachments() {
|
|
4727
|
+
const statements = this.store.statementsMatching(
|
|
4728
|
+
namedNode(this.uri),
|
|
4729
|
+
flow("attachment")
|
|
4730
|
+
);
|
|
4731
|
+
return statements.filter((it) => isNamedNode(it.object)).map((statement2) => ({
|
|
4732
|
+
uri: statement2.object.value,
|
|
4733
|
+
label: labelFromUri(statement2.object.value)
|
|
4734
|
+
}));
|
|
4735
|
+
}
|
|
4723
4736
|
/**
|
|
4724
4737
|
* Call this method to switch to a more specific subclass of Thing.
|
|
4725
4738
|
*
|
|
@@ -4762,16 +4775,15 @@ var LdpContainer = class extends Thing {
|
|
|
4762
4775
|
}
|
|
4763
4776
|
};
|
|
4764
4777
|
|
|
4765
|
-
// src/
|
|
4766
|
-
|
|
4767
|
-
function createPictureLinkOperation(thing, file2) {
|
|
4778
|
+
// src/files/createFileLinkOperation.ts
|
|
4779
|
+
function createFileLinkOperation(thing, predicateUri, file2) {
|
|
4768
4780
|
return {
|
|
4769
4781
|
deletions: [],
|
|
4770
4782
|
filesToCreate: [],
|
|
4771
4783
|
insertions: [
|
|
4772
4784
|
st(
|
|
4773
4785
|
namedNode(thing.uri),
|
|
4774
|
-
namedNode(
|
|
4786
|
+
namedNode(predicateUri),
|
|
4775
4787
|
namedNode(file2.url),
|
|
4776
4788
|
namedNode(thing.uri).doc()
|
|
4777
4789
|
)
|
|
@@ -4779,32 +4791,33 @@ function createPictureLinkOperation(thing, file2) {
|
|
|
4779
4791
|
};
|
|
4780
4792
|
}
|
|
4781
4793
|
|
|
4782
|
-
// src/
|
|
4783
|
-
var
|
|
4794
|
+
// src/files/FileGateway.ts
|
|
4795
|
+
var FileGateway = class {
|
|
4784
4796
|
constructor(store, fileFetcher) {
|
|
4785
4797
|
this.store = store;
|
|
4786
4798
|
this.fileFetcher = fileFetcher;
|
|
4787
4799
|
}
|
|
4788
4800
|
/**
|
|
4789
|
-
* Uploads a
|
|
4801
|
+
* Uploads a file and associates it with a thing.
|
|
4790
4802
|
* The container is automatically derived from the thing's URI.
|
|
4791
4803
|
* Uses schema:image as the predicate.
|
|
4792
4804
|
*
|
|
4793
|
-
* @param thing - The thing to add the
|
|
4794
|
-
* @param
|
|
4795
|
-
* @
|
|
4805
|
+
* @param thing - The thing to add the file to
|
|
4806
|
+
* @param predicateUri - The URI of the predicate to use
|
|
4807
|
+
* @param fileToUpload - The file to upload
|
|
4808
|
+
* @returns Result with the uploaded metadata (url, name, contentType) or error
|
|
4796
4809
|
*/
|
|
4797
|
-
|
|
4810
|
+
uploadAndLinkFile(thing, predicateUri, fileToUpload) {
|
|
4798
4811
|
const container2 = this.getContainerFromThing(thing);
|
|
4799
|
-
return this.fileFetcher.createNewFile(container2,
|
|
4812
|
+
return this.fileFetcher.createNewFile(container2, fileToUpload).andThen((file2) => this.linkFileToThing(thing, predicateUri, file2));
|
|
4800
4813
|
}
|
|
4801
|
-
|
|
4802
|
-
const operation3 =
|
|
4814
|
+
linkFileToThing(thing, predicateUri, file2) {
|
|
4815
|
+
const operation3 = createFileLinkOperation(thing, predicateUri, file2);
|
|
4803
4816
|
return ResultAsync.fromPromise(
|
|
4804
4817
|
this.store.executeUpdate(operation3).then(() => file2),
|
|
4805
4818
|
() => ({
|
|
4806
4819
|
type: "network",
|
|
4807
|
-
title: "Failed to link
|
|
4820
|
+
title: "Failed to link file to thing"
|
|
4808
4821
|
})
|
|
4809
4822
|
);
|
|
4810
4823
|
}
|
|
@@ -4813,6 +4826,213 @@ var PictureGateway = class {
|
|
|
4813
4826
|
}
|
|
4814
4827
|
};
|
|
4815
4828
|
|
|
4829
|
+
// src/modules/contacts.ts
|
|
4830
|
+
async function loadContactsModule(store) {
|
|
4831
|
+
const module2 = await import("./dist-O5YU2L4C.js");
|
|
4832
|
+
return store.loadModule(module2);
|
|
4833
|
+
}
|
|
4834
|
+
|
|
4835
|
+
// src/attachments/AttachmentGateway.ts
|
|
4836
|
+
var AttachmentGateway = class {
|
|
4837
|
+
constructor(fileGateway) {
|
|
4838
|
+
this.fileGateway = fileGateway;
|
|
4839
|
+
}
|
|
4840
|
+
/**
|
|
4841
|
+
* Uploads an attachment file and associates it with a thing.
|
|
4842
|
+
* The container is automatically derived from the thing's URI.
|
|
4843
|
+
* Uses flow:attachment as the predicate.
|
|
4844
|
+
*
|
|
4845
|
+
* @param thing - The thing to add the attachment to
|
|
4846
|
+
* @param attachmentFile - The attachment file to upload
|
|
4847
|
+
* @returns Result with the uploaded attachment metadata (url, name, contentType) or error
|
|
4848
|
+
*/
|
|
4849
|
+
uploadAndAddAttachment(thing, attachmentFile) {
|
|
4850
|
+
return this.fileGateway.uploadAndLinkFile(
|
|
4851
|
+
thing,
|
|
4852
|
+
"http://www.w3.org/2005/01/wf/flow#attachment",
|
|
4853
|
+
attachmentFile
|
|
4854
|
+
);
|
|
4855
|
+
}
|
|
4856
|
+
};
|
|
4857
|
+
|
|
4858
|
+
// src/picture/PictureGateway.ts
|
|
4859
|
+
var PictureGateway = class {
|
|
4860
|
+
constructor(attachmentGateway) {
|
|
4861
|
+
this.attachmentGateway = attachmentGateway;
|
|
4862
|
+
}
|
|
4863
|
+
/**
|
|
4864
|
+
* Uploads a picture file and associates it with a thing.
|
|
4865
|
+
* The container is automatically derived from the thing's URI.
|
|
4866
|
+
* Uses schema:image as the predicate.
|
|
4867
|
+
*
|
|
4868
|
+
* @param thing - The thing to add the picture to
|
|
4869
|
+
* @param pictureFile - The picture file to upload
|
|
4870
|
+
* @returns Result with the uploaded picture metadata (url, name, contentType) or error
|
|
4871
|
+
*/
|
|
4872
|
+
uploadAndAddPicture(thing, pictureFile) {
|
|
4873
|
+
return this.attachmentGateway.uploadAndLinkFile(
|
|
4874
|
+
thing,
|
|
4875
|
+
"http://schema.org/image",
|
|
4876
|
+
pictureFile
|
|
4877
|
+
);
|
|
4878
|
+
}
|
|
4879
|
+
};
|
|
4880
|
+
|
|
4881
|
+
// node_modules/@solid-data-modules/rdflib-utils/dist/web-operations/executeUpdate.js
|
|
4882
|
+
async function executeUpdate(fetcher, updater, operation3) {
|
|
4883
|
+
await updater.updateMany(operation3.deletions, operation3.insertions);
|
|
4884
|
+
operation3.filesToCreate.map((file2) => {
|
|
4885
|
+
createEmptyTurtleFile(fetcher, file2.url);
|
|
4886
|
+
});
|
|
4887
|
+
}
|
|
4888
|
+
function createEmptyTurtleFile(fetcher, url7) {
|
|
4889
|
+
return fetcher.webOperation("PUT", url7, {
|
|
4890
|
+
contentType: "text/turtle"
|
|
4891
|
+
});
|
|
4892
|
+
}
|
|
4893
|
+
|
|
4894
|
+
// node_modules/@solid-data-modules/rdflib-utils/dist/namespaces/index.js
|
|
4895
|
+
var rdf = Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
|
|
4896
|
+
var solid = Namespace("http://www.w3.org/ns/solid/terms#");
|
|
4897
|
+
var pim2 = Namespace("http://www.w3.org/ns/pim/space#");
|
|
4898
|
+
var ldp = Namespace("http://www.w3.org/ns/ldp#");
|
|
4899
|
+
|
|
4900
|
+
// node_modules/@solid-data-modules/rdflib-utils/dist/queries/PreferencesQuery.js
|
|
4901
|
+
var PreferencesQuery = class {
|
|
4902
|
+
constructor(store, webIdNode, preferencesDoc) {
|
|
4903
|
+
this.store = store;
|
|
4904
|
+
this.webIdNode = webIdNode;
|
|
4905
|
+
this.preferencesDoc = preferencesDoc;
|
|
4906
|
+
}
|
|
4907
|
+
/**
|
|
4908
|
+
* Look up the private type index. Returns null if none is found or if the predicated does not link to a proper named node
|
|
4909
|
+
*/
|
|
4910
|
+
queryPrivateTypeIndex() {
|
|
4911
|
+
const node3 = this.store.any(this.webIdNode, solid("privateTypeIndex"), null, this.preferencesDoc);
|
|
4912
|
+
if (isNamedNode(node3)) {
|
|
4913
|
+
return node3;
|
|
4914
|
+
}
|
|
4915
|
+
return null;
|
|
4916
|
+
}
|
|
4917
|
+
};
|
|
4918
|
+
|
|
4919
|
+
// node_modules/@solid-data-modules/rdflib-utils/dist/queries/ProfileQuery.js
|
|
4920
|
+
var ProfileQuery = class {
|
|
4921
|
+
constructor(webIdNode, store) {
|
|
4922
|
+
this.webIdNode = webIdNode;
|
|
4923
|
+
this.store = store;
|
|
4924
|
+
}
|
|
4925
|
+
/**
|
|
4926
|
+
* Look up the public type index. Returns null if none is found or if the predicated does not link to a proper named node
|
|
4927
|
+
*/
|
|
4928
|
+
queryPublicTypeIndex() {
|
|
4929
|
+
const predicate4 = solid("publicTypeIndex");
|
|
4930
|
+
return this.queryNamedNode(predicate4);
|
|
4931
|
+
}
|
|
4932
|
+
/**
|
|
4933
|
+
* Look up the preferences file. Returns null if none is found or if the predicated does not link to a proper named node
|
|
4934
|
+
*/
|
|
4935
|
+
queryPreferencesFile() {
|
|
4936
|
+
const predicate4 = pim2("preferencesFile");
|
|
4937
|
+
return this.queryNamedNode(predicate4);
|
|
4938
|
+
}
|
|
4939
|
+
queryNamedNode(predicate4) {
|
|
4940
|
+
const node3 = this.store.any(this.webIdNode, predicate4, null, this.webIdNode.doc());
|
|
4941
|
+
if (isNamedNode(node3)) {
|
|
4942
|
+
return node3;
|
|
4943
|
+
}
|
|
4944
|
+
return null;
|
|
4945
|
+
}
|
|
4946
|
+
};
|
|
4947
|
+
|
|
4948
|
+
// node_modules/@solid-data-modules/rdflib-utils/dist/identifier/generate-id.js
|
|
4949
|
+
var import_short_unique_id = __toESM(require_short_unique_id(), 1);
|
|
4950
|
+
var uid = new import_short_unique_id.default({ length: 10 });
|
|
4951
|
+
|
|
4952
|
+
// src/profile/WebIdProfile.ts
|
|
4953
|
+
var WebIdProfile = class extends Thing {
|
|
4954
|
+
constructor(webId, store, editable = false) {
|
|
4955
|
+
super(webId, store, editable);
|
|
4956
|
+
this.webId = webId;
|
|
4957
|
+
this.store = store;
|
|
4958
|
+
this.editable = editable;
|
|
4959
|
+
this.profileQuery = new ProfileQuery(namedNode(this.webId), this.store);
|
|
4960
|
+
}
|
|
4961
|
+
/**
|
|
4962
|
+
* Returns the URI of the preferences document
|
|
4963
|
+
*/
|
|
4964
|
+
getPreferencesFile() {
|
|
4965
|
+
return this.profileQuery.queryPreferencesFile()?.value;
|
|
4966
|
+
}
|
|
4967
|
+
/**
|
|
4968
|
+
* Returns the URI of the public type index document
|
|
4969
|
+
*/
|
|
4970
|
+
getPublicTypeIndex() {
|
|
4971
|
+
return this.profileQuery.queryPublicTypeIndex()?.value;
|
|
4972
|
+
}
|
|
4973
|
+
/**
|
|
4974
|
+
* Returns the URI of the private type index document
|
|
4975
|
+
*/
|
|
4976
|
+
getPrivateTypeIndex() {
|
|
4977
|
+
const preferences = this.profileQuery.queryPreferencesFile();
|
|
4978
|
+
if (!preferences) return void 0;
|
|
4979
|
+
const query4 = new PreferencesQuery(
|
|
4980
|
+
this.store,
|
|
4981
|
+
namedNode(this.webId),
|
|
4982
|
+
preferences
|
|
4983
|
+
);
|
|
4984
|
+
return query4.queryPrivateTypeIndex()?.value;
|
|
4985
|
+
}
|
|
4986
|
+
/**
|
|
4987
|
+
* Returns the URIs of the private label indexes
|
|
4988
|
+
*/
|
|
4989
|
+
getPrivateLabelIndexes() {
|
|
4990
|
+
const profileNodes = this.store.each(
|
|
4991
|
+
namedNode(this.webId),
|
|
4992
|
+
namedNode("http://www.w3.org/ns/solid/terms#privateLabelIndex"),
|
|
4993
|
+
void 0,
|
|
4994
|
+
namedNode(this.webId).doc()
|
|
4995
|
+
);
|
|
4996
|
+
const preferences = this.getPreferencesFile();
|
|
4997
|
+
if (preferences) {
|
|
4998
|
+
const preferencesNodes = this.store.each(
|
|
4999
|
+
namedNode(this.webId),
|
|
5000
|
+
namedNode("http://www.w3.org/ns/solid/terms#privateLabelIndex"),
|
|
5001
|
+
void 0,
|
|
5002
|
+
namedNode(preferences)
|
|
5003
|
+
);
|
|
5004
|
+
return [...profileNodes, ...preferencesNodes].map((it) => it.value);
|
|
5005
|
+
} else {
|
|
5006
|
+
return profileNodes.map((it) => it.value);
|
|
5007
|
+
}
|
|
5008
|
+
}
|
|
5009
|
+
};
|
|
5010
|
+
|
|
5011
|
+
// src/profile/ProfileGateway.ts
|
|
5012
|
+
var ProfileGateway = class {
|
|
5013
|
+
constructor(store) {
|
|
5014
|
+
this.store = store;
|
|
5015
|
+
}
|
|
5016
|
+
async fetchProfile(webId) {
|
|
5017
|
+
await this.store.fetch(webId);
|
|
5018
|
+
const profile2 = this.store.get(webId).assume(WebIdProfile);
|
|
5019
|
+
const preferences = profile2.getPreferencesFile();
|
|
5020
|
+
if (preferences) {
|
|
5021
|
+
try {
|
|
5022
|
+
await this.store.fetch(preferences);
|
|
5023
|
+
} catch (error4) {
|
|
5024
|
+
console.warn(`Failed to fetch preferences file ${preferences}:`, error4);
|
|
5025
|
+
}
|
|
5026
|
+
}
|
|
5027
|
+
const publicTypeIndex2 = profile2.getPublicTypeIndex();
|
|
5028
|
+
const privateTypeIndex2 = profile2.getPrivateTypeIndex();
|
|
5029
|
+
await this.store.fetchAll(
|
|
5030
|
+
[privateTypeIndex2, publicTypeIndex2].filter((it) => it !== void 0)
|
|
5031
|
+
);
|
|
5032
|
+
return profile2;
|
|
5033
|
+
}
|
|
5034
|
+
};
|
|
5035
|
+
|
|
4816
5036
|
// src/search/SearchIndex.ts
|
|
4817
5037
|
var import_lunr = __toESM(require_lunr(), 1);
|
|
4818
5038
|
var SearchIndex = class {
|
|
@@ -4892,11 +5112,6 @@ var RdfDocument = class extends Thing {
|
|
|
4892
5112
|
}
|
|
4893
5113
|
};
|
|
4894
5114
|
|
|
4895
|
-
// src/namespaces/index.ts
|
|
4896
|
-
var rdfs = Namespace("http://www.w3.org/2000/01/rdf-schema#");
|
|
4897
|
-
var pim = Namespace("http://www.w3.org/ns/pim/space#");
|
|
4898
|
-
var schema = Namespace("https://schema.org/");
|
|
4899
|
-
|
|
4900
5115
|
// src/search/LabelIndex.ts
|
|
4901
5116
|
var LabelIndex = class extends RdfDocument {
|
|
4902
5117
|
constructor(uri6, store, editable = false) {
|
|
@@ -4927,77 +5142,6 @@ var LabelIndex = class extends RdfDocument {
|
|
|
4927
5142
|
}
|
|
4928
5143
|
};
|
|
4929
5144
|
|
|
4930
|
-
// node_modules/@solid-data-modules/rdflib-utils/dist/web-operations/executeUpdate.js
|
|
4931
|
-
async function executeUpdate(fetcher, updater, operation3) {
|
|
4932
|
-
await updater.updateMany(operation3.deletions, operation3.insertions);
|
|
4933
|
-
operation3.filesToCreate.map((file2) => {
|
|
4934
|
-
createEmptyTurtleFile(fetcher, file2.url);
|
|
4935
|
-
});
|
|
4936
|
-
}
|
|
4937
|
-
function createEmptyTurtleFile(fetcher, url7) {
|
|
4938
|
-
return fetcher.webOperation("PUT", url7, {
|
|
4939
|
-
contentType: "text/turtle"
|
|
4940
|
-
});
|
|
4941
|
-
}
|
|
4942
|
-
|
|
4943
|
-
// node_modules/@solid-data-modules/rdflib-utils/dist/namespaces/index.js
|
|
4944
|
-
var rdf = Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
|
|
4945
|
-
var solid = Namespace("http://www.w3.org/ns/solid/terms#");
|
|
4946
|
-
var pim2 = Namespace("http://www.w3.org/ns/pim/space#");
|
|
4947
|
-
var ldp = Namespace("http://www.w3.org/ns/ldp#");
|
|
4948
|
-
|
|
4949
|
-
// node_modules/@solid-data-modules/rdflib-utils/dist/queries/PreferencesQuery.js
|
|
4950
|
-
var PreferencesQuery = class {
|
|
4951
|
-
constructor(store, webIdNode, preferencesDoc) {
|
|
4952
|
-
this.store = store;
|
|
4953
|
-
this.webIdNode = webIdNode;
|
|
4954
|
-
this.preferencesDoc = preferencesDoc;
|
|
4955
|
-
}
|
|
4956
|
-
/**
|
|
4957
|
-
* Look up the private type index. Returns null if none is found or if the predicated does not link to a proper named node
|
|
4958
|
-
*/
|
|
4959
|
-
queryPrivateTypeIndex() {
|
|
4960
|
-
const node3 = this.store.any(this.webIdNode, solid("privateTypeIndex"), null, this.preferencesDoc);
|
|
4961
|
-
if (isNamedNode(node3)) {
|
|
4962
|
-
return node3;
|
|
4963
|
-
}
|
|
4964
|
-
return null;
|
|
4965
|
-
}
|
|
4966
|
-
};
|
|
4967
|
-
|
|
4968
|
-
// node_modules/@solid-data-modules/rdflib-utils/dist/queries/ProfileQuery.js
|
|
4969
|
-
var ProfileQuery = class {
|
|
4970
|
-
constructor(webIdNode, store) {
|
|
4971
|
-
this.webIdNode = webIdNode;
|
|
4972
|
-
this.store = store;
|
|
4973
|
-
}
|
|
4974
|
-
/**
|
|
4975
|
-
* Look up the public type index. Returns null if none is found or if the predicated does not link to a proper named node
|
|
4976
|
-
*/
|
|
4977
|
-
queryPublicTypeIndex() {
|
|
4978
|
-
const predicate4 = solid("publicTypeIndex");
|
|
4979
|
-
return this.queryNamedNode(predicate4);
|
|
4980
|
-
}
|
|
4981
|
-
/**
|
|
4982
|
-
* Look up the preferences file. Returns null if none is found or if the predicated does not link to a proper named node
|
|
4983
|
-
*/
|
|
4984
|
-
queryPreferencesFile() {
|
|
4985
|
-
const predicate4 = pim2("preferencesFile");
|
|
4986
|
-
return this.queryNamedNode(predicate4);
|
|
4987
|
-
}
|
|
4988
|
-
queryNamedNode(predicate4) {
|
|
4989
|
-
const node3 = this.store.any(this.webIdNode, predicate4, null, this.webIdNode.doc());
|
|
4990
|
-
if (isNamedNode(node3)) {
|
|
4991
|
-
return node3;
|
|
4992
|
-
}
|
|
4993
|
-
return null;
|
|
4994
|
-
}
|
|
4995
|
-
};
|
|
4996
|
-
|
|
4997
|
-
// node_modules/@solid-data-modules/rdflib-utils/dist/identifier/generate-id.js
|
|
4998
|
-
var import_short_unique_id = __toESM(require_short_unique_id(), 1);
|
|
4999
|
-
var uid = new import_short_unique_id.default({ length: 10 });
|
|
5000
|
-
|
|
5001
5145
|
// src/search/createDefaultLabelIndex.ts
|
|
5002
5146
|
function createDefaultLabelIndex(profile2) {
|
|
5003
5147
|
const webId = namedNode(profile2.webId);
|
|
@@ -26611,86 +26755,6 @@ var UriService = class {
|
|
|
26611
26755
|
}
|
|
26612
26756
|
};
|
|
26613
26757
|
|
|
26614
|
-
// src/profile/WebIdProfile.ts
|
|
26615
|
-
var WebIdProfile = class extends Thing {
|
|
26616
|
-
constructor(webId, store, editable = false) {
|
|
26617
|
-
super(webId, store, editable);
|
|
26618
|
-
this.webId = webId;
|
|
26619
|
-
this.store = store;
|
|
26620
|
-
this.editable = editable;
|
|
26621
|
-
this.profileQuery = new ProfileQuery(namedNode(this.webId), this.store);
|
|
26622
|
-
}
|
|
26623
|
-
/**
|
|
26624
|
-
* Returns the URI of the preferences document
|
|
26625
|
-
*/
|
|
26626
|
-
getPreferencesFile() {
|
|
26627
|
-
return this.profileQuery.queryPreferencesFile()?.value;
|
|
26628
|
-
}
|
|
26629
|
-
/**
|
|
26630
|
-
* Returns the URI of the public type index document
|
|
26631
|
-
*/
|
|
26632
|
-
getPublicTypeIndex() {
|
|
26633
|
-
return this.profileQuery.queryPublicTypeIndex()?.value;
|
|
26634
|
-
}
|
|
26635
|
-
/**
|
|
26636
|
-
* Returns the URI of the private type index document
|
|
26637
|
-
*/
|
|
26638
|
-
getPrivateTypeIndex() {
|
|
26639
|
-
const preferences = this.profileQuery.queryPreferencesFile();
|
|
26640
|
-
if (!preferences) return void 0;
|
|
26641
|
-
const query4 = new PreferencesQuery(
|
|
26642
|
-
this.store,
|
|
26643
|
-
namedNode(this.webId),
|
|
26644
|
-
preferences
|
|
26645
|
-
);
|
|
26646
|
-
return query4.queryPrivateTypeIndex()?.value;
|
|
26647
|
-
}
|
|
26648
|
-
/**
|
|
26649
|
-
* Returns the URIs of the private label indexes
|
|
26650
|
-
*/
|
|
26651
|
-
getPrivateLabelIndexes() {
|
|
26652
|
-
const profileNodes = this.store.each(
|
|
26653
|
-
namedNode(this.webId),
|
|
26654
|
-
namedNode("http://www.w3.org/ns/solid/terms#privateLabelIndex"),
|
|
26655
|
-
void 0,
|
|
26656
|
-
namedNode(this.webId).doc()
|
|
26657
|
-
);
|
|
26658
|
-
const preferences = this.getPreferencesFile();
|
|
26659
|
-
if (preferences) {
|
|
26660
|
-
const preferencesNodes = this.store.each(
|
|
26661
|
-
namedNode(this.webId),
|
|
26662
|
-
namedNode("http://www.w3.org/ns/solid/terms#privateLabelIndex"),
|
|
26663
|
-
void 0,
|
|
26664
|
-
namedNode(preferences)
|
|
26665
|
-
);
|
|
26666
|
-
return [...profileNodes, ...preferencesNodes].map((it) => it.value);
|
|
26667
|
-
} else {
|
|
26668
|
-
return profileNodes.map((it) => it.value);
|
|
26669
|
-
}
|
|
26670
|
-
}
|
|
26671
|
-
};
|
|
26672
|
-
|
|
26673
|
-
// src/profile/ProfileGateway.ts
|
|
26674
|
-
var ProfileGateway = class {
|
|
26675
|
-
constructor(store) {
|
|
26676
|
-
this.store = store;
|
|
26677
|
-
}
|
|
26678
|
-
async fetchProfile(webId) {
|
|
26679
|
-
await this.store.fetch(webId);
|
|
26680
|
-
const profile2 = this.store.get(webId).assume(WebIdProfile);
|
|
26681
|
-
const preferences = profile2.getPreferencesFile();
|
|
26682
|
-
if (preferences) {
|
|
26683
|
-
await this.store.fetch(preferences);
|
|
26684
|
-
}
|
|
26685
|
-
const publicTypeIndex2 = profile2.getPublicTypeIndex();
|
|
26686
|
-
const privateTypeIndex2 = profile2.getPrivateTypeIndex();
|
|
26687
|
-
await this.store.fetchAll(
|
|
26688
|
-
[privateTypeIndex2, publicTypeIndex2].filter((it) => it !== void 0)
|
|
26689
|
-
);
|
|
26690
|
-
return profile2;
|
|
26691
|
-
}
|
|
26692
|
-
};
|
|
26693
|
-
|
|
26694
26758
|
// src/authentication/index.ts
|
|
26695
26759
|
var AnonymousSession = class {
|
|
26696
26760
|
constructor() {
|
|
@@ -26713,6 +26777,52 @@ var AnonymousSession = class {
|
|
|
26713
26777
|
}
|
|
26714
26778
|
};
|
|
26715
26779
|
|
|
26780
|
+
// src/type-index/TypeIndex.ts
|
|
26781
|
+
var TypeIndex2 = class extends Thing {
|
|
26782
|
+
constructor(uri6, store, editable = false) {
|
|
26783
|
+
super(uri6, store, editable);
|
|
26784
|
+
this.uri = uri6;
|
|
26785
|
+
this.store = store;
|
|
26786
|
+
this.editable = editable;
|
|
26787
|
+
}
|
|
26788
|
+
listAll() {
|
|
26789
|
+
const forClassStatements = this.store.statementsMatching(
|
|
26790
|
+
null,
|
|
26791
|
+
solid("forClass"),
|
|
26792
|
+
null,
|
|
26793
|
+
namedNode(this.uri)
|
|
26794
|
+
);
|
|
26795
|
+
return forClassStatements.map((statement2) => {
|
|
26796
|
+
const subject8 = statement2.subject;
|
|
26797
|
+
const instanceContainerStatements = this.store.statementsMatching(
|
|
26798
|
+
subject8,
|
|
26799
|
+
solid("instanceContainer"),
|
|
26800
|
+
null,
|
|
26801
|
+
namedNode(this.uri)
|
|
26802
|
+
);
|
|
26803
|
+
const instanceStatements = this.store.statementsMatching(
|
|
26804
|
+
subject8,
|
|
26805
|
+
solid("instance"),
|
|
26806
|
+
null,
|
|
26807
|
+
namedNode(this.uri)
|
|
26808
|
+
);
|
|
26809
|
+
const instances2 = instanceStatements.map((it) => ({
|
|
26810
|
+
type: "instance",
|
|
26811
|
+
uri: it.object.value
|
|
26812
|
+
}));
|
|
26813
|
+
const instanceContainers = instanceContainerStatements.map((it) => ({
|
|
26814
|
+
type: "container",
|
|
26815
|
+
uri: it.object.value
|
|
26816
|
+
}));
|
|
26817
|
+
return {
|
|
26818
|
+
targets: [...instanceContainers, ...instances2],
|
|
26819
|
+
forClass: statement2.object.value,
|
|
26820
|
+
label: labelForType(statement2.object.value)
|
|
26821
|
+
};
|
|
26822
|
+
});
|
|
26823
|
+
}
|
|
26824
|
+
};
|
|
26825
|
+
|
|
26716
26826
|
// src/index.ts
|
|
26717
26827
|
var PodOS = class {
|
|
26718
26828
|
constructor({
|
|
@@ -26731,7 +26841,9 @@ var PodOS = class {
|
|
|
26731
26841
|
);
|
|
26732
26842
|
this.searchGateway = new SearchGateway(this.store);
|
|
26733
26843
|
this.fileFetcher = new FileFetcher(this.session);
|
|
26734
|
-
this.
|
|
26844
|
+
this.fileGateway = new FileGateway(this.store, this.fileFetcher);
|
|
26845
|
+
this.attachmentGateway = new AttachmentGateway(this.fileGateway);
|
|
26846
|
+
this.pictureGateway = new PictureGateway(this.fileGateway);
|
|
26735
26847
|
this.flagAuthorizationMetaDataOnSessionChange();
|
|
26736
26848
|
this.uriService = new UriService(this.store);
|
|
26737
26849
|
this.profileGateway = new ProfileGateway(this.store);
|
|
@@ -26841,13 +26953,22 @@ var PodOS = class {
|
|
|
26841
26953
|
uploadAndAddPicture(thing, pictureFile) {
|
|
26842
26954
|
return this.pictureGateway.uploadAndAddPicture(thing, pictureFile);
|
|
26843
26955
|
}
|
|
26956
|
+
/**
|
|
26957
|
+
* Provides access to attachment operations such as uploading and linking attachments to things
|
|
26958
|
+
* @returns {AttachmentGateway} An instance of AttachmentGateway that handles attachment operations
|
|
26959
|
+
*/
|
|
26960
|
+
attachments() {
|
|
26961
|
+
return this.attachmentGateway;
|
|
26962
|
+
}
|
|
26844
26963
|
};
|
|
26845
26964
|
export {
|
|
26846
26965
|
AnonymousSession,
|
|
26847
26966
|
AssumeAlwaysOnline,
|
|
26967
|
+
AttachmentGateway,
|
|
26848
26968
|
BinaryFile,
|
|
26849
26969
|
BrokenFile,
|
|
26850
26970
|
FileFetcher,
|
|
26971
|
+
FileGateway,
|
|
26851
26972
|
HttpStatus,
|
|
26852
26973
|
LabelIndex,
|
|
26853
26974
|
LdpContainer,
|
|
@@ -26861,9 +26982,9 @@ export {
|
|
|
26861
26982
|
SearchIndex,
|
|
26862
26983
|
Store,
|
|
26863
26984
|
Thing,
|
|
26985
|
+
TypeIndex2 as TypeIndex,
|
|
26864
26986
|
UriService,
|
|
26865
26987
|
WebIdProfile,
|
|
26866
|
-
createPictureLinkOperation,
|
|
26867
26988
|
httpProblem,
|
|
26868
26989
|
labelFromUri,
|
|
26869
26990
|
listKnownTerms,
|