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

Prod Release #196

Merged
merged 31 commits into from
Sep 28, 2023
Merged

Prod Release #196

merged 31 commits into from
Sep 28, 2023

Conversation

morgsmccauley
Copy link
Collaborator

No description provided.

morgsmccauley and others added 27 commits August 4, 2023 16:43
Co-authored-by: Darun Seethammagari <[email protected]>
Regex for getting table names was not matching against valid schemas. I improved the regex to cover a much larger array of inputs and also made failure in generating the db methods not block the overall execution of the indexer. Now, it will only fail if the indexing code uses db methods but the methods fail to generate.
Adding functionality for update, upsert, delete. Added relevant tests as well as performed simple integration tests using existing tests. No problems found there. Will do a full test in dev after push as well by updating a forked social_feed indexer to use context.db exclusively.
Proceed with historical filtering when missing block numbers are
encountered.
darunrs and others added 4 commits September 27, 2023 11:50
…#193)

This commit adds functionality for generating TypeScript interfaces and
a context object which reflect rows in each table defined in the SQL
table and respective functions for insert, select, upsert, update, and
delete which all take in a strongly formatted object. This allows for
autocomplete and type assertions for writing objects or calling
functions related to each defined table.

This is accomplished by using the library
[node-sql-parser](https://www.npmjs.com/package/node-sql-parser) which
contains functions for converting valid Postgres DDL into an AST or list
of tables.

In the frontend, I have added a button which triggers code gen and
attaches the types to Monaco. In addition, I set up listeners on
monaco's mounting status as well as on the schemaTypes state variable
which I introduced to store the generated types. These typesa re also
saved to localStorage to be retrieved. The following actions trigger a
code generation to take place: clicking the code gen button (Next to
format button), switching to the indexingLogic.js tab, when monaco
mounts, and when the schema and code are retrieved from local storage.
The AST is parsed using the new PgSchemaTypeGen class. The end result is
a context object formatted like so: context.db.TableName.methodName({}).

NOTE: The context object added to monaco is done so as a global
variable. Currently our indexers pass in a context parameter. This
causes the local parameter to shadow the global one, which prevents
autocomplete or type checking. In order to use the global one, the
context object must be removed from the function declaration for
getBlock.

In the backend, the context object received a similar refactor to the
context.db.TableName.methodName format. It also uses the parser library
but solely to get the table names to generate the context object.
Copy link
Contributor

@roshaans roshaans left a comment

Choose a reason for hiding this comment

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

We should have faster prod release cycles so we are not merging this many things.

@morgsmccauley morgsmccauley merged commit efe183a into stable Sep 28, 2023
11 checks passed
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.

5 participants