asterisk / node-ari-client

Node.js client for ARI. This library is best effort with limited support.
Other
249 stars 98 forks source link

Warnings on deprecated libraries and dependencies when installed on Node V12.22.09 #153

Open juanrcuervo opened 1 year ago

juanrcuervo commented 1 year ago

The following warnings are received when installing node-ari-client on Node version 12.22.9 root@core2:~# npm install ari-client npm WARN deprecated sprintf@0.1.1: The sprintf package is deprecated in favor of sprintf-js. npm WARN deprecated har-validator@5.1.5: this library is no longer supported npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated swagger-client@2.0.26: No longer maintained, please upgrade to swagger-client@3.

Seems like a little code rewrite is needed. Any volunteers ? I´d be glad to help

dioris-moreno commented 1 year ago

I agree, Juan. I'm in.

Regarding uuid

The only function used from this module is v4 in line 84 of resources.js. I use this function in multiple projects, and it wouldn't represent any significant change migrating to the latest version of uuid (9.0.0).

Regarding request

It's only used in line 114 of client.js and only to check if the Asterisk host is reachable before creating the swagger client.

Here we can find a list of Alternative libraries to request #3143.

It seems like node-fetch would be a good option (with the smallest footprint) considering the ari-client needs.

Regarding har-validator

This module is a dependency of request, so migrating request would eliminate this issue.

Regarding sprintf

I found it's a dependency of the shred module, but I have no idea what it's used for. Any thoughts?

Regarding the swagger-client!

Here is a problem: the swagger format. All the ARI definition JSON files are in the test/fixtures folder. These JSON files are part of the Asterisk installation and comply with version 1.1 of swagger. The problem is the format of Swagger 2.0 and above is different, and the maintained versions of the library no longer support the 1.1 formats. Migrating to a newer swagger client implies migrating the ARI definition JSON files, which are part of Asterisk. In other words: upgrading the swagger-client would be impossible.

One option could be to fork the swagger-client 2.x. Any ideas?