Skip to content
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

Merged
merged 8 commits into from
May 22, 2024
Merged

Conversation

holic
Copy link
Member

@holic holic commented May 21, 2024

resolveTableId (or specifically the context passed into resolveWithContext) 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.

Copy link

changeset-bot bot commented May 21, 2024

🦋 Changeset detected

Latest commit: 77d9e82

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 23 packages
Name Type
@latticexyz/cli Patch
@latticexyz/world Patch
mock-game-contracts Patch
@latticexyz/dev-tools Patch
@latticexyz/store-sync Patch
@latticexyz/world-modules Patch
@latticexyz/store-indexer Patch
@latticexyz/abi-ts Patch
@latticexyz/block-logs-stream Patch
@latticexyz/common Patch
@latticexyz/config Patch
create-mud Patch
@latticexyz/faucet Patch
@latticexyz/gas-report Patch
@latticexyz/protocol-parser Patch
@latticexyz/query Patch
@latticexyz/react Patch
@latticexyz/recs Patch
@latticexyz/schema-type Patch
solhint-config-mud Patch
solhint-plugin-mud Patch
@latticexyz/store Patch
@latticexyz/utils Patch

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";
Copy link
Member Author

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";
Copy link
Member Author

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

@holic holic marked this pull request as ready for review May 21, 2024 16:31
@holic holic requested review from alvrs and yonadaa as code owners May 21, 2024 16:31
}
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(", ")}`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

alvrs
alvrs previously approved these changes May 21, 2024
Copy link
Member

@alvrs alvrs left a 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

@holic holic merged commit 9be2bb8 into main May 22, 2024
11 of 12 checks passed
@holic holic deleted the holic/module-install-args branch May 22, 2024 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants