-
Notifications
You must be signed in to change notification settings - Fork 29
feat: Simple API to test new api against current service #254
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
base: main
Are you sure you want to change the base?
Conversation
Pasting @richtera 's rationale here for reviewers:
|
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.
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.
CI is failing because you updated Lit dependencies but did not update the lockfile.
upload: uploadServiceConnection(), | ||
filecoin: filecoinServiceConnection(), | ||
gateway: gatewayServiceConnection(), | ||
/** @type {(options: Partial<import('./types.js').ServiceConfOptions>) => import('./types.js').ServiceConf} */ |
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.
Might make this a bit easier to understand:
/** @type {(options: Partial<import('./types.js').ServiceConfOptions>) => import('./types.js').ServiceConf} */ | |
/** | |
* @param {Partial<import('./types.js').ServiceConfOptions>} [options] | |
* @returns {import('./types.js').ServiceConf} | |
*/ |
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.
Ok will check my changes, rebase to upstream and fix this. I am compiling a slightly newer branch, which has changed I didn't want to release yet.
gateway: ConnectionView<ContentServeService> | ||
} | ||
|
||
export interface ServiceConfOptions { |
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.
Since this is a type specifically for options, perhaps the properties should be defined as optional (?
) rather than using Partial
everywhere.
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 a good idea.
export interface ServiceConfOptions { | ||
access: | ||
| ConnectionView<AccessService> | ||
| { id?: import('./types.js').Principal<DID>; url: URL } |
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.
Importing import('./types.js').Principal
is circular - just import Principal
from the existing @ucanto/interface
import and use it here.
It needs to exist due to the different services the client talks to and us wanting to be able to change it for dev/testing purposes. The Personally I'd like to keep the separation in code so that they can become different later if needs be, but I don't mind condensing the 3 to 1 until that time if you feel strongly about it. |
I guess it's possible to make a variant type. The external configuration only needs the url most of the time and not a lot of the other properties. But it's very much a subjective thing for sure. I tried to not touch the original ServiceConf, because it has properties the rest of the code requires. |
… or a connection.
09f9d10
to
8f47eae
Compare
feat: Add simple API change for create method to accept partial serviceConf
Allow passing in serviceConf which has either a set of connections or { id?: Principal, url: URL }.
If the principal is not provided construct a did:web: from the hostname.