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

[Dicussion]: Possible to use formula parser as a backend library? #2187

Open
dberardo-com opened this issue Mar 8, 2023 · 7 comments
Open

Comments

@dberardo-com
Copy link

I see a "formulas" folder in the code:

  • is it possible to extract the formula parser logic as an "own package" or does it share dependencies with the rest of the application?
  • would it be possible to use the formula parser for some backend only applications, without the need of a web browser frontend ?
@pro-odoo
Copy link
Collaborator

pro-odoo commented Mar 8, 2023

Hello,

For now, the formula parser logic is linked to others parts of the application, such as the list/definitions of functions in order to compile their arguments. It would require a little work to extract completely the parser, but it's possible.

I didn't try but I think it would be possible to use o-spreadsheet for backend application. You can import helpers from o-spreadsheet and use the parser from there.

@dberardo-com
Copy link
Author

i think i will give it a try. if it is just a matter of moving dependencies around (as in moving files and folders) then that should not be a problem, but if it depends on "owl", which is a frontend library, then it is not possible.

I understand that this is not the case, right ?

@pro-odoo
Copy link
Collaborator

pro-odoo commented Mar 8, 2023

owl is a frontend library but can be used in the backend. While the App of owl is not mounted, it should be good.

@dberardo-com
Copy link
Author

makes sense. is there any good place (doc / code / type definitions) where you would advise getting started to understand the parser's logic ?

i would like to make an initial assessment whether it would make sense to run it as server-side module

@rrahir
Copy link
Collaborator

rrahir commented Mar 16, 2023

Complementary information, we tried to install the library as a backend (full nodejs app) and it cannot run as it is. the data model is relying on the owl library as well, which simply cannot run on a nodejs server because it uses the web API. Sorry for misleading you. However, we are currently considering different approaches to make the lib backend-only asap.

In the meantime, the whole parsing logic is, as @pro-odoo mentioned, related to other parts of the code, but the main logic is in https://github.com/odoo/o-spreadsheet/blob/saas-16.2/src/formulas/parser.ts.

I think you could easily rebundle the parsing on your own by extracting that file and the imports it requires.

@dberardo-com
Copy link
Author

thanks for the reply. Is there any update on this matter ?

@rrahir
Copy link
Collaborator

rrahir commented Nov 20, 2023

We have are not currently working on the possibility to make the lib run as a node application. As mentionned in my previous message, you can easily rebundle the parsing by yourself.

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

No branches or pull requests

3 participants