@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
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,209 @@ 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
|
+
await this.store.fetch(preferences);
|
|
5022
|
+
}
|
|
5023
|
+
const publicTypeIndex2 = profile2.getPublicTypeIndex();
|
|
5024
|
+
const privateTypeIndex2 = profile2.getPrivateTypeIndex();
|
|
5025
|
+
await this.store.fetchAll(
|
|
5026
|
+
[privateTypeIndex2, publicTypeIndex2].filter((it) => it !== void 0)
|
|
5027
|
+
);
|
|
5028
|
+
return profile2;
|
|
5029
|
+
}
|
|
5030
|
+
};
|
|
5031
|
+
|
|
4816
5032
|
// src/search/SearchIndex.ts
|
|
4817
5033
|
var import_lunr = __toESM(require_lunr(), 1);
|
|
4818
5034
|
var SearchIndex = class {
|
|
@@ -4892,11 +5108,6 @@ var RdfDocument = class extends Thing {
|
|
|
4892
5108
|
}
|
|
4893
5109
|
};
|
|
4894
5110
|
|
|
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
5111
|
// src/search/LabelIndex.ts
|
|
4901
5112
|
var LabelIndex = class extends RdfDocument {
|
|
4902
5113
|
constructor(uri6, store, editable = false) {
|
|
@@ -4927,77 +5138,6 @@ var LabelIndex = class extends RdfDocument {
|
|
|
4927
5138
|
}
|
|
4928
5139
|
};
|
|
4929
5140
|
|
|
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
5141
|
// src/search/createDefaultLabelIndex.ts
|
|
5002
5142
|
function createDefaultLabelIndex(profile2) {
|
|
5003
5143
|
const webId = namedNode(profile2.webId);
|
|
@@ -26611,86 +26751,6 @@ var UriService = class {
|
|
|
26611
26751
|
}
|
|
26612
26752
|
};
|
|
26613
26753
|
|
|
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
26754
|
// src/authentication/index.ts
|
|
26695
26755
|
var AnonymousSession = class {
|
|
26696
26756
|
constructor() {
|
|
@@ -26713,6 +26773,52 @@ var AnonymousSession = class {
|
|
|
26713
26773
|
}
|
|
26714
26774
|
};
|
|
26715
26775
|
|
|
26776
|
+
// src/type-index/TypeIndex.ts
|
|
26777
|
+
var TypeIndex2 = class extends Thing {
|
|
26778
|
+
constructor(uri6, store, editable = false) {
|
|
26779
|
+
super(uri6, store, editable);
|
|
26780
|
+
this.uri = uri6;
|
|
26781
|
+
this.store = store;
|
|
26782
|
+
this.editable = editable;
|
|
26783
|
+
}
|
|
26784
|
+
listAll() {
|
|
26785
|
+
const forClassStatements = this.store.statementsMatching(
|
|
26786
|
+
null,
|
|
26787
|
+
solid("forClass"),
|
|
26788
|
+
null,
|
|
26789
|
+
namedNode(this.uri)
|
|
26790
|
+
);
|
|
26791
|
+
return forClassStatements.map((statement2) => {
|
|
26792
|
+
const subject8 = statement2.subject;
|
|
26793
|
+
const instanceContainerStatements = this.store.statementsMatching(
|
|
26794
|
+
subject8,
|
|
26795
|
+
solid("instanceContainer"),
|
|
26796
|
+
null,
|
|
26797
|
+
namedNode(this.uri)
|
|
26798
|
+
);
|
|
26799
|
+
const instanceStatements = this.store.statementsMatching(
|
|
26800
|
+
subject8,
|
|
26801
|
+
solid("instance"),
|
|
26802
|
+
null,
|
|
26803
|
+
namedNode(this.uri)
|
|
26804
|
+
);
|
|
26805
|
+
const instances2 = instanceStatements.map((it) => ({
|
|
26806
|
+
type: "instance",
|
|
26807
|
+
uri: it.object.value
|
|
26808
|
+
}));
|
|
26809
|
+
const instanceContainers = instanceContainerStatements.map((it) => ({
|
|
26810
|
+
type: "container",
|
|
26811
|
+
uri: it.object.value
|
|
26812
|
+
}));
|
|
26813
|
+
return {
|
|
26814
|
+
targets: [...instanceContainers, ...instances2],
|
|
26815
|
+
forClass: statement2.object.value,
|
|
26816
|
+
label: labelForType(statement2.object.value)
|
|
26817
|
+
};
|
|
26818
|
+
});
|
|
26819
|
+
}
|
|
26820
|
+
};
|
|
26821
|
+
|
|
26716
26822
|
// src/index.ts
|
|
26717
26823
|
var PodOS = class {
|
|
26718
26824
|
constructor({
|
|
@@ -26731,7 +26837,9 @@ var PodOS = class {
|
|
|
26731
26837
|
);
|
|
26732
26838
|
this.searchGateway = new SearchGateway(this.store);
|
|
26733
26839
|
this.fileFetcher = new FileFetcher(this.session);
|
|
26734
|
-
this.
|
|
26840
|
+
this.fileGateway = new FileGateway(this.store, this.fileFetcher);
|
|
26841
|
+
this.attachmentGateway = new AttachmentGateway(this.fileGateway);
|
|
26842
|
+
this.pictureGateway = new PictureGateway(this.fileGateway);
|
|
26735
26843
|
this.flagAuthorizationMetaDataOnSessionChange();
|
|
26736
26844
|
this.uriService = new UriService(this.store);
|
|
26737
26845
|
this.profileGateway = new ProfileGateway(this.store);
|
|
@@ -26841,13 +26949,22 @@ var PodOS = class {
|
|
|
26841
26949
|
uploadAndAddPicture(thing, pictureFile) {
|
|
26842
26950
|
return this.pictureGateway.uploadAndAddPicture(thing, pictureFile);
|
|
26843
26951
|
}
|
|
26952
|
+
/**
|
|
26953
|
+
* Provides access to attachment operations such as uploading and linking attachments to things
|
|
26954
|
+
* @returns {AttachmentGateway} An instance of AttachmentGateway that handles attachment operations
|
|
26955
|
+
*/
|
|
26956
|
+
attachments() {
|
|
26957
|
+
return this.attachmentGateway;
|
|
26958
|
+
}
|
|
26844
26959
|
};
|
|
26845
26960
|
export {
|
|
26846
26961
|
AnonymousSession,
|
|
26847
26962
|
AssumeAlwaysOnline,
|
|
26963
|
+
AttachmentGateway,
|
|
26848
26964
|
BinaryFile,
|
|
26849
26965
|
BrokenFile,
|
|
26850
26966
|
FileFetcher,
|
|
26967
|
+
FileGateway,
|
|
26851
26968
|
HttpStatus,
|
|
26852
26969
|
LabelIndex,
|
|
26853
26970
|
LdpContainer,
|
|
@@ -26861,9 +26978,9 @@ export {
|
|
|
26861
26978
|
SearchIndex,
|
|
26862
26979
|
Store,
|
|
26863
26980
|
Thing,
|
|
26981
|
+
TypeIndex2 as TypeIndex,
|
|
26864
26982
|
UriService,
|
|
26865
26983
|
WebIdProfile,
|
|
26866
|
-
createPictureLinkOperation,
|
|
26867
26984
|
httpProblem,
|
|
26868
26985
|
labelFromUri,
|
|
26869
26986
|
listKnownTerms,
|