-
Notifications
You must be signed in to change notification settings - Fork 23
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: allow multiple providers #595
Changes from all commits
ca0f975
140b5f9
ca5e70b
2aec2b9
e2a01f5
487d3f1
3d62ba1
1cbe46b
ba4a937
6ba6565
d7ae195
b042f1d
c3fca01
03d597f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
import * as Ucanto from '@ucanto/interface' | ||
import { ProviderAdd } from '@web3-storage/capabilities/src/types' | ||
|
||
export type AlphaStorageProvider = 'did:web:web3.storage:providers:w3up-alpha' | ||
|
||
/** | ||
* action which results in provisionment of a space consuming a storage provider | ||
*/ | ||
export interface Provision<ServiceDID extends Ucanto.DID<'web'>> { | ||
invocation: Ucanto.Invocation<ProviderAdd> | ||
space: Ucanto.DID<'key'> | ||
account: Ucanto.DID<'mailto'> | ||
provider: AlphaStorageProvider | ServiceDID | ||
provider: ServiceDID | ||
} | ||
|
||
/** | ||
* stores instances of a storage provider being consumed by a consumer | ||
*/ | ||
export interface ProvisionsStorage<ServiceDID extends Ucanto.DID<'web'>> { | ||
service: ServiceDID | ||
services: ServiceDID[] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: I'd remove these from the interface entirely. When I was designing provider protocol I was assuming that we would have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did start out that way but it's a bigger change set and neither of you were awake for me to double check with ;) |
||
hasStorageProvider: (consumer: Ucanto.DID<'key'>) => Promise<boolean> | ||
/** | ||
* ensure item is stored | ||
* | ||
* @param item - provision to store | ||
*/ | ||
put: (item: Provision<ServiceDID>) => Promise<void> | ||
put: ( | ||
item: Provision<ServiceDID> | ||
) => Promise<Ucanto.Result<{}, Ucanto.Failure>> | ||
|
||
/** | ||
* get number of stored items | ||
|
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.
Nit: I would personally loose the generic and use
Ucanto.DID<'web'>
here. Which I think would make ts-expect-error in file above go away as well.