Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functionality to create a .meta file for a derived resource. #2

Open
phochste opened this issue Feb 8, 2024 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@phochste
Copy link
Collaborator

phochste commented Feb 8, 2024

E.g. in the example given I would like to add a test.meta file with content:

<> <http://www.w3.org/ns/ldp#inbox> <http://my.inbox.provider/patrick/inbox> .

Running the server I would expect in the HTTP headers of http://localhost:3000/test a inbox link relation.

Instead, when running the example I get:

2024-02-08T14:41:58.179Z [AppRunner] {Primary} error: Could not start the server: Cannot read properties of undefined (reading 'identifier')
Could not start the server
TypeError: Cannot read properties of undefined (reading 'identifier')
    at comparator (/Users/hochsten/github.com/SolidLabResearch/derived-resources-component/node_modules/@solid/community-server/dist/pods/generate/BaseResourcesGenerator.js:17:22)
    at Array.sort (<anonymous>)
    at BaseResourcesGenerator.processFolder (/Users/hochsten/github.com/SolidLabResearch/derived-resources-component/node_modules/@solid/community-server/dist/pods/generate/BaseResourcesGenerator.js:71:59)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async BaseResourcesGenerator.generate (/Users/hochsten/github.com/SolidLabResearch/derived-resources-component/node_modules/@solid/community-server/dist/pods/generate/BaseResourcesGenerator.js:58:9)
    at async nextAsyncEntry (/Users/hochsten/github.com/SolidLabResearch/derived-resources-component/node_modules/@solid/community-server/dist/util/IterableUtil.js:101:20)
    at async findNextSorted (/Users/hochsten/github.com/SolidLabResearch/derived-resources-component/node_modules/@solid/community-server/dist/util/IterableUtil.js:133:29)
    at async sortedAsyncMerge (/Users/hochsten/github.com/SolidLabResearch/derived-resources-component/node_modules/@solid/community-server/dist/util/IterableUtil.js:156:22)
    at async SubfolderResourcesGenerator.generate (/Users/hochsten/github.com/SolidLabResearch/derived-resources-component/node_modules/@solid/community-server/dist/pods/generate/SubfolderResourcesGenerator.js:37:26)
    at async ContainerInitializer.handle (/Users/hochsten/github.com/SolidLabResearch/derived-resources-component/node_modules/@solid/community-server/dist/init/ContainerInitializer.js:31:67)
@phochste phochste added the enhancement New feature or request label Feb 8, 2024
@joachimvh
Copy link
Collaborator

Accessing metadata of derived resources defined in a parent container is indeed not possible. Metadata is stored together with its corresponding resource, and since the resource does not actually exist, storing the metadata does not work with the default methods. There are ways we could work around this to make it work, but would have to see how ugly those are.

Allowing this would raise some questions about how this is expected to work. Would this also need to be supported for templates with variables in them? What happens when the container metadata gets updated so that derived resource suddenly doesn't exist anymore?

Depending on your needs it actually is already is possible to edit the metadata of some derived resources. In the examples of the README there is a http://localhost:3000/dummy.txt derived resource, which has an actual resource with its own metadata behind it. For this derived resource you can modify the metadata so that might already solve your problem.

...except I just discovered that the metadata of that resource is not used yet to generate the headers for the derived resource so I will have to fix that.

@joachimvh
Copy link
Collaborator

...except I just discovered that the metadata of that resource is not used yet to generate the headers for the derived resource so I will have to fix that.

Fixed in e680419

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants