Skip to content

Commit

Permalink
create container before inserting to typeIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
soltanireza65 committed Jan 9, 2024
1 parent 206685e commit d29f947
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rezasoltani/solid-typeindex-support",
"version": "0.0.4",
"version": "0.0.5",
"description": "",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down
15 changes: 6 additions & 9 deletions src/TypeIndexHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
ThingPersisted,
addNamedNode,
buildThing,
createSolidDataset,
createThing,
getNamedNode,
getSolidDataset,
Expand Down Expand Up @@ -196,23 +197,19 @@ export class TypeIndexHelper {
): Promise<SolidDataset> {
const typeIndex = await this.getTypeIndex(webId, fetch, isPrivate);

const typeIndexDS = await getSolidDataset(typeIndex?.value, {
fetch,
});
const typeIndexDS = await getSolidDataset(typeIndex?.value, { fetch });

const registeryThing = buildThing(
createThing({ name: typeRegistrationTitle })
)
const registeryThing = buildThing(createThing({ name: typeRegistrationTitle }))
.addNamedNode(__forClass, namedNode(rdfClass))
.addNamedNode(isContainer ? __solid_instance_container : __solid_instance, namedNode(registeryUrl))
.addUrl(RDF.type, __solidTypeRegistration)
.build();

const updatedTypeIndexDS = setThing(typeIndexDS, registeryThing);

return await saveSolidDatasetAt(typeIndex?.value, updatedTypeIndexDS, {
fetch,
});
await saveSolidDatasetAt(registeryUrl, createSolidDataset(), { fetch });

return await saveSolidDatasetAt(typeIndex?.value, updatedTypeIndexDS, { fetch });
}


Expand Down

0 comments on commit d29f947

Please sign in to comment.