CSPro logic interpreter as ESM6 and fetch CSWeb package.json files

What would you like to see in CSPro?
Post Reply
htuser
Posts: 649
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

CSPro logic interpreter as ESM6 and fetch CSWeb package.json files

Post by htuser »

Dear CSPro Developer Team,
a) I'm agree with this CSProuser viewtopic.php?t=5675 that we need an open CSPro. It's possible if you give us a way to integrate CSPro in any JS framework (such as React) and allow us to design standalone apps. An ESM6 module of the CSPro logic interpreter would facilitate this. Right now we already have this for:
i) SQlite (https://github.com/sqlite/sqlite-wasm);
ii) PostgreSQL (https://github.com/electric-sql/pglite);
iii) And more complicated languages such as:
iii-1) Python(https://pyscript.net/) ;
iii-2) R (https://docs.r-wasm.org/webr/latest/).
iii-3) PHP (https://github.com/seanmorris/php-wasm);

And by the way you're integrating JS in CSPro (writing CSPro logic inside HTML in reports etc) I think, you're not too far from fulfilling this ultimate request!

b) I would like to fetch the package.json file for comparing signatures between server and local packages files before launching syncapp. Please can you expose this file from CSWeb?
Thanks in advance,
Last edited by htuser on August 17th, 2024, 6:22 pm, edited 1 time in total.
G.VOLNY, a CSProuser from Haiti, since 2004
Gregory Martin
Posts: 1860
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: CSPro logic interpreter as ESM6 and fetch CSWeb package.json files

Post by Gregory Martin »

Regarding b) If you know the local package files, you can send them up to the GET /apps/{application_name} endpoint using the x-csw-package-files header. The header should contain a JSON array, with objects with the following keys: path, signature (the file MD5), and onlyOnFirstInstall. This header needs to be gzipped and then Base64-encoded. You can look at AppsController.php to see how this is handled.

So there actually isn't a way just to get the signatures, but if you know those of the local files, you can at least prevent CSWeb from sending down files you already have.
htuser
Posts: 649
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

Re: CSPro logic interpreter as ESM6 and fetch CSWeb package.json files

Post by htuser »

Thanks Greg for reply.
As you know, on Android devices, there's a package.json file containing signatures of pen and pff files. You also have this file on CSWeb. What I thought was to use JS to fetch the CSWeb's package.json then read the signature and compare it with the local one before launching SyncApp for Android or an user defined syncApp used for Windows
if getos()=20 then
            syncapp
();
        else       
        syncfile
(GET, "/apps/IPB_V1.zip","./");
        decompress("IPB_V1.zip","./");
    filedelete (pathconcat(Application,"*.zip"));
    filedelete (pathconcat(Application,"*.csds"));
endif;
If you know the local package files, you can send them up to the GET /apps/{application_name} endpoint using the x-csw-package-files header
I don't understand why I should put the local package.json to CSWeb because we already have the same file on the server. I assume that the package.json file change on the server each time a new version of the application is deployed. And the local one is equal to the server once you use syncApp (or user defined function for Windows OS). So, I only need to unzip(decompress) the package and read the signatures from the package.json located on CSWeb /apps/{application_name} repository.
Best,
G.VOLNY, a CSProuser from Haiti, since 2004
Post Reply