Conversation
94ff252 to
4a66703
Compare
samholmes
left a comment
There was a problem hiding this comment.
All optional except for one concern
| export interface CouchPool { | ||
| /** The default connection, to use for most queries. */ | ||
| default: ServerScope | ||
|
|
||
| /** The cluster name being used for the default connection. */ | ||
| defaultName: string | ||
|
|
||
| /** Lists the clusters that are available for connection. */ | ||
| clusterNames: string[] | ||
|
|
||
| /** | ||
| * Grab a connection to a specific cluster. | ||
| * Throws if the name is missing. | ||
| */ | ||
| connect: (name: string) => ServerScope | ||
|
|
||
| /** Grabs authentication information for a specific cluster. */ | ||
| getCredential: (name: string) => CouchCredential | undefined | ||
|
|
||
| /** Grab a connection, returning undefined if the cluster is missing. */ | ||
| maybeConnect: (name: string) => ServerScope | undefined | ||
| } |
There was a problem hiding this comment.
Really good API. A part of me wonders if we can do without the maybeConnect via static type checking. connect can still throw, but wouldn't ever be written to through if it constrained it's parameter. Inferring the name keys from connectCouch is where it gets tricky though because you inject 'default' into the internal type, but I suppose the internal type doesn't need to be constrained by the name keys.
There was a problem hiding this comment.
The input comes from cleaner-config in the login server, so there's no type information at that point. In other situations, we get the list of credentials from the info server, so it's even worse.
samholmes
left a comment
There was a problem hiding this comment.
I approve with changes optional
48b7fbd to
aed6555
Compare
aed6555 to
0ef6d21
Compare
CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
noneDescription
none