-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat: support name in ls #260
Conversation
Looks like there's just a timeout on the windows tests? |
Thanks for submitting this - could you please add a test or some assertions to an existing test in https://github.com/ipfs/js-kubo-rpc-client/blob/main/test/interface-tests/src/pin/ls.ts to ensure this works as expected and there will be no regressions in future? |
Sure can, however I'm having some issues installing dependencies locally.
|
Actually that seems to be an issue with the IDE I was using. Got it working now. |
No, I think the infrastructure is flaky 🙄. It was 504ing for me too when you posted that, someone's rebooted something and it works now. |
How do I test only a specific file with aegir btw? % npm t -- -f test/interface-tests/src/pin/ls.ts
> [email protected] test
> aegir test -f test/interface-tests/src/pin/ls.ts
build
> [email protected] build
> aegir build
[15:19:59] tsc [started]
[15:20:01] tsc [completed]
[15:20:01] esbuild [started]
[15:20:01] esbuild [completed]
test node.js
Exception during run: TypeError: Unknown file extension ".ts" for /Users/joel/code/js-kubo-rpc-client/test/interface-tests/src/pin/ls.ts
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:160:9)
at defaultGetFormat (node:internal/modules/esm/get_format:203:36)
at defaultLoad (node:internal/modules/esm/load:141:22)
at ModuleLoader.load (node:internal/modules/esm/loader:409:7)
at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:291:45)
at link (node:internal/modules/esm/module_job:76:21) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
Command failed with exit code 1: mocha test/interface-tests/src/pin/ls.ts --ui bdd --require source-map-support/register --timeout=60000 --bail |
You can use --grep to match strings from
You can also stick a
|
The tests look good - thanks for adding them. I think it just needs an assertion that the If I read it correctly you could just add it to the expect(pinset).to.deep.include({
type: 'recursive',
cid: fixtures.files[0].cid,
name: fixtures.files[0].pinName // <- add this line
}) |
So interestingly Kubo doesn't return |
} | ||
|
||
export interface PinLsResult { | ||
cid: CID | ||
type: PinType | string | ||
metadata?: Record<string, any> | ||
name?: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If Kubo doesn’t return this field, does it need to be in the interface?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kubo does return it if you call pin.ls with the name
param. Otherwise not. So yes it needs to be there as optional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the reason it's not returned by default is that one CID can have multiple names it's pinned under.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, gotcha - so it just needs a test that shows this then all is good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, so now we test for both cases:
should list all types of pins
tests thatname
isn't returned in the regular caseshould list multiple partially matched named pins
andshould list specific named pin
tests that name is returned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's perfect, thanks for making those changes.
## [5.1.0](v5.0.2...v5.1.0) (2025-02-15) ### Features * support name in pin.ls ([#260](#260)) ([df1d483](df1d483)), closes [/docs.ipfs.tech/reference/kubo/rpc/#api-v0](https://github.com/ipfs//docs.ipfs.tech/reference/kubo/rpc//issues/api-v0) ### Dependencies * bump @multiformats/multiaddr-to-uri from 10.1.2 to 11.0.0 ([#249](#249)) ([dafa529](dafa529)) * bump parse-duration from 1.1.2 to 2.1.2 ([#257](#257)) ([3d28859](3d28859)) * **dev:** bump nock from 13.5.6 to 14.0.1 ([#259](#259)) ([06f6f1e](06f6f1e))
🎉 This PR is included in version 5.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Thanks @achingbrain ! |
According to the Kubo docs (and practical experience) the pin label (name) is returned top level on the pin item (not in Metadata)
Also doesn't seem like
Metadata
is a thing anymore, but left it in case.