-
Notifications
You must be signed in to change notification settings - Fork 66
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
Replace imports of modules/cal with modules/std/cal #1120
Conversation
@scotttrinh , @jaclarke I'm really not sure should the driver behave differently depending on the server version, @jaclarke just told me we don't use the typename info from the codecs anywhere so I guess we don't need to make any changes there. Or we can update |
@scotttrinh I believe for the
|
It would be necessary if we added a new type, similar to multirange, that needed access to, for instance, If we want to optimize this and encode some of our knowledge here, we can just iterate over the modules we know got moved, but then I'd want to have a comment here explaining to someone coming after us that these modules used to live in the global module namespace and where moved, so we must special case them, and still iterate over all four of those modules (cal, fts, math, and pg). |
I think we should return the unprefixed name for now since it works in both cases unless you've defined your own module with these exact module+type/function names. If we ever change the behavior here (not likely!) we can revisit. Or if users report issues where they're shadowing these modules on purpose and cannot get the TS driver to work, we can look into a workaround. |
packages/generate/src/edgeql-js.ts
Outdated
|
||
// in server versions >=6 cal, fts, math and pg are moved inside std module | ||
if (f.path.split(".")[0] === "range" && version.major > 5) { | ||
newContents = newContents.replace("modules/cal", "modules/std/cal"); |
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 guess this is unlikely to accidentally replace the wrong thing in the file, but maybe we should make this generate time replacement more explicit in the syntax files? Maybe by re-naming the mock modules dir we import from to something like MOCK_MODULES
, then doing replacement on all modules imports that match the pattern?
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 seems like a good idea in general. I think we need to add some additional code to ensure that we don't copy the MOCK_MODULES
directory at generate time because I think maybe the whole syntax dir is copied verbatim and then generation replaces stuff?
I don't think implementing this should be blocking though, we've already decided these fake modules existing is fine so this isn't any more confusing than what we had before 😅
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.
yes, I think this is how it works. I didn't update the PR with MOCK_MODULES rename and update...
if you think the rest is enough we can push this and if needed I can add further updates
I added comments that explains more why we do what we do
fcc7bea
to
f538f5f
Compare
fixes #1119
From the research I did I only found the wrong
cal
imports insiderange.ts
.