Open llermaly opened 1 year ago
@rupal-bq how can we release this as a node module ? @llermaly does that solve your usecase? would you be willing to contribute ?
@anirudha , yes, a node module would make it .
I have never built a package but I can contribute creating a draft based on the solution I'm using so you can go from there. Let me know how can I be useful
It is possible to use it , see the attached snippet:
const report = require("@opensearch-project/reporting-cli");
const options = {
url: "http://localhost:5601/goto/8fa30d307ea81f81a5edc692e189c297?security_tenant=private",
auth: "basic",
credentials: "admin:admin",
transport: "smtp",
smtphost: "smtp.gmail.com",
smtpport: 465,
smtpsecure: true,
smtpusername: "gllermaly",
smtppassword: "xxxxxxxxxxxxxxxxx",
from: "test@test.com",
to: "test@test.com" ,
format: "pdf",
};
const sendReport = async () => {
await report.handler(options);
};
sendReport();
So looks like it is just about documenting it. Thougts? any objection on just invoking the hander without going through the CLI flow?
@rupal-bq how can we release this as a node module ?
@anirudha will need to make some minor changes, test and release next version.
So looks like it is just about documenting it. Thougts? any objection on just invoking the hander without going through the CLI flow?
@llermaly handler function can be surely used for this purpose but earlier it was created to support scheduled reports with AWS Lambda and Lambda can only write to /tmp directory so the file path is hardcoded for handler function. https://github.com/opensearch-project/reporting-cli/blob/main/src/run.js#L13. If you used it as is, report will be downloaded in /tmp folder. This needs to be fixed before documenting about support as a nodejs package.
Also, currently all logs are available only on console. For using this a nodejs package, i think we should return errors/success.
Is your feature request related to a problem?
I would like to integrate the CLI to an existing nodejs backend , and instead of using something like the child_process module , or using the source code in javascript directly, would be nice to have a way to invoke the methods directly from nodejs just importing the reporting-cli package.
What solution would you like?
Allow the module to be imported in nodejs and executing calls, e.g:
Is this something that can be done without you creating an additional package?
Thanks