Skip to content

Commit

Permalink
feat(w3up-client): export additional modules (#1110)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gozala authored Nov 9, 2023
1 parent 78ce4ee commit 5ce43bc
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 4 deletions.
12 changes: 12 additions & 0 deletions packages/w3up-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@
"node": "./src/index.node.js",
"import": "./src/index.js"
},
"./account": {
"types": "./dist/src/account.d.ts",
"import": "./src/account.js"
},
"./space": {
"types": "./dist/src/space.d.ts",
"import": "./src/space.js"
},
"./result": {
"types": "./dist/src/result.d.ts",
"import": "./src/result.js"
},
"./client": {
"types": "./dist/src/client.d.ts",
"import": "./src/client.js"
Expand Down
2 changes: 2 additions & 0 deletions packages/w3up-client/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { AgentData } from '@web3-storage/access/agent'
import { StoreIndexedDB } from '@web3-storage/access/stores/store-indexeddb'
import { generate } from '@ucanto/principal/rsa'
import { Client } from './client.js'
export * as Result from './result.js'
export * as Account from './account.js'

/**
* Create a new w3up client.
Expand Down
2 changes: 2 additions & 0 deletions packages/w3up-client/src/index.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { AgentData } from '@web3-storage/access/agent'
import { StoreConf } from '@web3-storage/access/stores/store-conf'
import { generate } from '@ucanto/principal/ed25519'
import { Client } from './client.js'
export * as Result from './result.js'
export * as Account from './account.js'

/**
* Create a new w3up client.
Expand Down
5 changes: 3 additions & 2 deletions packages/w3up-client/src/space.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ export class Space {
/**
* The given space name.
*/
name() {
return this.#meta.name
get name() {
/* c8 ignore next */
return String(this.#meta.name ?? '')
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/w3up-client/test/client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ describe('Client', () => {
const spaces = alice.spaces()
assert.equal(spaces.length, 1)
assert.equal(spaces[0].did(), space.did())
assert.equal(spaces[0].name(), name)
assert.equal(spaces[0].name, name)
})

it('should add space', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/w3up-client/test/space.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('spaces', () => {
const isRegistered = true
const space = new Space(signer.did(), { name, isRegistered })
assert.equal(space.did(), signer.did())
assert.equal(space.name(), name)
assert.equal(space.name, name)
assert.equal(space.registered(), isRegistered)
assert.equal(space.meta().name, name)
})
Expand Down

0 comments on commit 5ce43bc

Please sign in to comment.