miolo-cli 3.0.0-beta.211 → 3.0.0-beta.212
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/fetcher/fetcher.mjs +6 -1
- package/src/fetcher/index.mjs +2 -2
- package/src/index.mjs +11 -8
package/package.json
CHANGED
package/src/fetcher/fetcher.mjs
CHANGED
|
@@ -4,9 +4,10 @@ class Fetcher {
|
|
|
4
4
|
/**
|
|
5
5
|
* @param {*} config {hostname, port, force_hostname, silent_fail: false}
|
|
6
6
|
*/
|
|
7
|
-
constructor(config) {
|
|
7
|
+
constructor(config, socket = undefined) {
|
|
8
8
|
this.config = config
|
|
9
9
|
this.http_auth = undefined
|
|
10
|
+
this.socket = socket
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
set_http_auth(auth) {
|
|
@@ -19,6 +20,10 @@ class Fetcher {
|
|
|
19
20
|
get_headers() {
|
|
20
21
|
const headers = {}
|
|
21
22
|
|
|
23
|
+
if (this.socket?.id) {
|
|
24
|
+
headers["x-socket-id"] = this.socket.id
|
|
25
|
+
}
|
|
26
|
+
|
|
22
27
|
if (this.http_auth) {
|
|
23
28
|
let { username, password } = this.http_auth
|
|
24
29
|
username = username || ""
|
package/src/fetcher/index.mjs
CHANGED
package/src/index.mjs
CHANGED
|
@@ -7,20 +7,23 @@ export function miolo_client(context) {
|
|
|
7
7
|
const { config } = context
|
|
8
8
|
const logger = init_logger(config?.log_level || "warn")
|
|
9
9
|
|
|
10
|
-
logger.verbose(`[miolo-cli] init_fetcher`)
|
|
11
|
-
const fetcher = init_fetcher(config)
|
|
12
|
-
|
|
13
|
-
if (config?.catcher_url) {
|
|
14
|
-
logger.verbose(`[miolo-cli] init_catcher at ${config?.catcher_url}`)
|
|
15
|
-
init_catcher(config?.catcher_url, fetcher)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
10
|
let socket
|
|
19
11
|
if (config?.socket?.enabled === true) {
|
|
20
12
|
logger.verbose(`[miolo-cli] init_socket at ${config?.socket?.url || "default url"}`)
|
|
21
13
|
const url = config?.socket?.url
|
|
22
14
|
const options = config?.socket?.options
|
|
23
15
|
socket = init_socket(url, options)
|
|
16
|
+
logger.verbose(
|
|
17
|
+
`[miolo-cli] socket initiated at ${socket?.url || "default url"} with id ${socket?.id}`
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
logger.verbose(`[miolo-cli] init_fetcher`)
|
|
22
|
+
const fetcher = init_fetcher(config, socket)
|
|
23
|
+
|
|
24
|
+
if (config?.catcher_url) {
|
|
25
|
+
logger.verbose(`[miolo-cli] init_catcher at ${config?.catcher_url}`)
|
|
26
|
+
init_catcher(config?.catcher_url, fetcher)
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
const miolo_obj = {
|