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

Separate out the ServiceClient #1

Merged
merged 14 commits into from
Mar 12, 2024
Merged

Separate out the ServiceClient #1

merged 14 commits into from
Mar 12, 2024

Conversation

amrc-benmorrow
Copy link
Contributor

Pull the ServiceClient code out from the rest of @amrc-factoryplus/utilities.

This still includes more code than I wanted it to, because it's difficult to separate out the dependencies. But this package is now webpackable.

@amrc-benmorrow amrc-benmorrow self-assigned this Mar 12, 2024
@amrc-benmorrow amrc-benmorrow linked an issue Mar 12, 2024 that may be closed by this pull request
@amrc-benmorrow amrc-benmorrow marked this pull request as draft March 12, 2024 11:19
This currently still includes the Sparkplug Node implementation, which
I'm not sure should be in here at all.
Accept a new `browser` config option to the ServiceClient. This will
cause MQTT URLs to be rewritten to websocket URLs.
* Don't depend on @fp/utilities at all. For now just pull the Debug
  class into this package.

* Request an optional dep on gssapi.js like before.
We have real fetch on a browser.
Dynamic import/export in JS is a bit of a pain.
Node recommends to use these but in fact they just inhibit webpacking.
For now we will have code relying on this. Ideally they'd want to be
removed, or moved into their own packages.
This includes a lot of metrics to support command escalation over MQTT.

These are still used by the services to generate their Sparkplug packets
but they were always a bit of a hack. Either they can stay in utilities
as compatibility until they are replaced or they can go out to a
separate package.
Node v20 provides globalThis.fetch, but it doesn't cache, so we still
need to replace it with got-fetch. Key off the browser key provided to
the ServiceClient instead.
@amrc-benmorrow amrc-benmorrow marked this pull request as ready for review March 12, 2024 12:01
@amrc-benmorrow amrc-benmorrow merged commit 4630c60 into main Mar 12, 2024
@amrc-benmorrow amrc-benmorrow deleted the feature/bm-initial branch March 12, 2024 12:02
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.

This library needs breaking up
1 participant