-
Notifications
You must be signed in to change notification settings - Fork 196
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
fix(cli,world): resolve table by just name #2850
Conversation
🦋 Changeset detectedLatest commit: 77d9e82 The changes in this PR will be included in the next version bump. This PR includes changesets to release 23 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -11,3 +11,5 @@ export * from "../encodeSystemCallsFrom"; | |||
export * from "../actions/callFrom"; | |||
|
|||
export * from "../callWithSignatureTypes"; | |||
|
|||
export { resolveTableId, resolveWithContext } from "../config/v2/dynamicResolution"; |
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 am intentionally exporting resolveTableId
in the internal bundle for now as I want to reconsider the API before we make it concrete.
|
||
export type DynamicResolution = { | ||
type: DynamicResolutionType; | ||
// TODO: add systemAddress support | ||
type: "tableId"; |
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.
this is an internal thing and changing this to strings instead of enums leads to better errors in the resolveWithContext
function
} | ||
if (tableEntries.length > 1) { | ||
throw new Error( | ||
`Found more than one table with name "${input.input}". Try using one of the following table names instead: ${tableEntries.map(([tableName]) => tableName).join(", ")}`, |
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.
nice!
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.
Needs a changeset but aside from that lgtm
resolveTableId
(or specifically the context passed intoresolveWithContext
) changed slightly in #2803 where we started using namespaced table names, which broke some previous usages of just table names without a namespace. This adds back in support for just table names, with an error thrown if we can't resolve the table due to collisions (with an actionable error message to quickly resolve).We had set up a new
resolveTableId
with the new config but never used it/exported it, so this also fixes that and removes the long-deprecated one as well as the now-unused v1 modules config.