@nora-link/client 2.0.0 → 2.1.0

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/README.md CHANGED
@@ -30,7 +30,27 @@ You can acess the tunnel by navigating to [https://noralink.eu/home](https://nor
30
30
 
31
31
  ## Available subdomains
32
32
 
33
- Currently only a subset of subdomains are available to use with your own tunnels, from the following: *admin, api, app, control, dashboard, home, my, nodered, smarthome, test*.
33
+ Currently only a subset of subdomains are available to use with your own tunnels, from the following:
34
+ - `ev`
35
+ - `evse`
36
+ - `mower`
37
+ - `zigbee-garage`
38
+ - `cnc`
39
+ - `nodered-living`
40
+ - `zigbee-home`
41
+ - `zigbee`
42
+ - `nas`
43
+ - `music`
44
+ - `test`
45
+ - `smarthome`
46
+ - `nodered`
47
+ - `my`
48
+ - `home`
49
+ - `control`
50
+ - `api`
51
+ - `admin`
52
+ - `app`
53
+ - `dashboard`
34
54
 
35
55
  If you want a new subdomain, add a request here: [Request a new subdomain thread](https://github.com/andrei-tatar/nora-link-client/issues/1).
36
56
 
@@ -60,4 +80,4 @@ If you want a new subdomain, add a request here: [Request a new subdomain thread
60
80
 
61
81
  This service is currently free to use, but as our cloud costs grow, we plan to charge for use to cover the costs. This
62
82
  means that while basic features will remain free, full access and advanced features will require a subscription. We
63
- appreciate your understanding and support as we continue to improve our service.
83
+ appreciate your understanding and support as we continue to improve our service.
package/dist/cli.js CHANGED
@@ -4,47 +4,54 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const commander_1 = require("commander");
5
5
  const client_1 = require("./client");
6
6
  const logger_1 = require("./logger");
7
- const { name, version } = require('../package.json');
7
+ const { name, version } = require("../package.json");
8
+ const TRUST_HTTPS_CERT_PREFIX = "trust!";
8
9
  commander_1.program
9
10
  .name(name)
10
- .version(version, '-v, --version')
11
- .usage('[OPTIONS]...')
11
+ .version(version, "-v, --version")
12
+ .usage("[OPTIONS]...")
12
13
  .showHelpAfterError()
13
- .option('-d, --debug', 'output extra debugging', false)
14
- .option('-n, --non-secure', 'don\'t use secure connection', false)
15
- .option('-h, --host <hostname>', 'Server host name')
16
- .option('-l, --log <log-level>', `min log level to display. Options: ${logger_1.LOG_LEVEL.join(',')}`, (value, previous) => {
14
+ .option("-d, --debug", "output extra debugging", false)
15
+ .option("-n, --non-secure", "don't use secure connection", false)
16
+ .option("-h, --host <hostname>", "Server host name")
17
+ .option("-l, --log <log-level>", `min log level to display. Options: ${logger_1.LOG_LEVEL.join(",")}`, (value, previous) => {
17
18
  const v = value?.toLowerCase();
18
19
  if (logger_1.LOG_LEVEL.includes(v)) {
19
20
  return v;
20
21
  }
21
22
  return previous;
22
- }, 'info')
23
- .requiredOption('-f, --forward <subdomain|label|url...>', 'Tunnel subdomain to local url. Label is optional')
24
- .requiredOption('-k, --key <api-key>', 'Api Key')
25
- .addHelpText('afterAll', 'To tunnel a local port to the subdomain `test`, you can use `-f "test|localhost:3000"`')
26
- .addHelpText('afterAll', 'To tunnel an ip to the subdomain `test`, you can use `-f "test|192.168.1.130"`')
27
- .addHelpText('afterAll', 'To tunnel a local hostname to the subdomain `test` with label `My App`, you can use `-f "test|My App|local-host.local"`')
23
+ }, "info")
24
+ .requiredOption("-f, --forward <subdomain|label|url...>", "Tunnel subdomain to local url. Label is optional")
25
+ .requiredOption("-k, --key <api-key>", "Api Key")
26
+ .addHelpText("afterAll", 'To tunnel a local port to the subdomain `test`, you can use `-f "test|localhost:3000"`')
27
+ .addHelpText("afterAll", 'To tunnel an ip to the subdomain `test`, you can use `-f "test|192.168.1.130"`')
28
+ .addHelpText("afterAll", 'To tunnel a local hostname to the subdomain `test` with label `My App`, you can use `-f "test|My App|local-host.local"`')
29
+ .addHelpText("afterAll", 'To tunnel an https url with a self-signed/invalid certificate, prefix the url with `trust!`, e.g. `-f "test|trust!https://localhost:3000"`')
28
30
  .parse();
29
31
  const options = commander_1.program.opts();
30
32
  let tunnels = [];
31
33
  if (Array.isArray(options.forward)) {
32
34
  tunnels = options.forward
33
- .filter((v) => typeof v === 'string')
34
- .map(v => {
35
- const [subdomain, labelOrUrl, urlPart] = v.split('|');
35
+ .filter((v) => typeof v === "string")
36
+ .map((v) => {
37
+ const [subdomain, labelOrUrl, urlPart] = v.split("|");
36
38
  const label = urlPart ? labelOrUrl : subdomain;
37
39
  let url = urlPart ?? labelOrUrl;
40
+ let rejectUnauthorized;
41
+ if (url.startsWith(`${TRUST_HTTPS_CERT_PREFIX}https://`)) {
42
+ rejectUnauthorized = false;
43
+ url = url.replace(TRUST_HTTPS_CERT_PREFIX, "");
44
+ }
38
45
  const urlHasProtocol = /^https?:\/\//.test(url);
39
46
  if (!urlHasProtocol) {
40
47
  //if missing protocol, assume http
41
48
  url = `http://${url}`;
42
49
  }
43
- return { subdomain, url, label };
50
+ return { subdomain, url, label, rejectUnauthorized };
44
51
  });
45
52
  }
46
53
  if (!tunnels.length) {
47
- console.info('no valid tunnels specified');
54
+ console.info("no valid tunnels specified");
48
55
  process.exit(1);
49
56
  }
50
57
  else {
@@ -55,7 +62,7 @@ else {
55
62
  tunnels,
56
63
  apiKey: options.key,
57
64
  logger,
58
- }).handle$.subscribe(status => {
65
+ }).handle$.subscribe((status) => {
59
66
  logger.info(`[nora-link] ${status}`);
60
67
  });
61
68
  }
package/dist/client.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- import { BehaviorSubject, Observable } from 'rxjs';
2
- import { Logger } from './logger';
1
+ import { BehaviorSubject, Observable } from "rxjs";
2
+ import { Logger } from "./logger";
3
3
  export interface TunnelOptions {
4
4
  subdomain: string;
5
5
  url: string;
6
6
  label: string;
7
7
  removeHostHeader?: boolean;
8
+ rejectUnauthorized?: boolean;
8
9
  }
9
10
  export interface ClientConnectionOptions {
10
11
  agent?: string;
@@ -29,7 +30,7 @@ export declare class Client {
29
30
  apiKey: string;
30
31
  token: string;
31
32
  } | null>;
32
- readonly handle$: Observable<'connected' | 'connecting' | 'disconnected' | 'idle'>;
33
+ readonly handle$: Observable<"connected" | "connecting" | "disconnected" | "idle">;
33
34
  private send;
34
35
  private getStreamData;
35
36
  private httpRequest;
package/dist/client.js CHANGED
@@ -7,6 +7,7 @@ exports.Client = void 0;
7
7
  const rxjs_1 = require("rxjs");
8
8
  const ws_1 = __importDefault(require("ws"));
9
9
  const node_http_1 = require("node:http");
10
+ const node_https_1 = require("node:https");
10
11
  const node_querystring_1 = require("node:querystring");
11
12
  const const_1 = require("./const");
12
13
  const firebase_1 = require("./firebase");
@@ -18,36 +19,38 @@ class Client {
18
19
  constructor(options) {
19
20
  this.options = options;
20
21
  if (!options.agent) {
21
- const { name, version } = require('../package.json');
22
+ const { name, version } = require("../package.json");
22
23
  options.agent = `${name}@${version}`;
23
24
  }
24
- this.clientId = options.clientId ?? (0, node_crypto_1.randomBytes)(16).toString('base64url');
25
+ this.clientId = options.clientId ?? (0, node_crypto_1.randomBytes)(16).toString("base64url");
25
26
  }
26
- server$ = new rxjs_1.Observable(observer => {
27
- const subdomains = this.options.tunnels.map(v => `${v.subdomain}|${v.label}`);
27
+ server$ = new rxjs_1.Observable((observer) => {
28
+ const subdomains = this.options.tunnels.map((v) => `${v.subdomain}|${v.label}`);
28
29
  const qs = (0, node_querystring_1.stringify)({ s: subdomains, c: this.clientId });
29
- const protocol = (this.options.secure ?? true) ? 'wss' : 'ws';
30
+ const protocol = (this.options.secure ?? true) ? "wss" : "ws";
30
31
  const headers = {
31
32
  authorization: `Bearer ${this.options.apiKey}`,
32
- ...(this.options.agent ? {
33
- 'user-agent': this.options.agent,
34
- } : {}),
33
+ ...(this.options.agent
34
+ ? {
35
+ "user-agent": this.options.agent,
36
+ }
37
+ : {}),
35
38
  };
36
- const hostname = this.options.hostname ?? 'noralink.eu';
39
+ const hostname = this.options.hostname ?? "noralink.eu";
37
40
  const ws = new ws_1.default(`${protocol}://${hostname}/api/tunnel?${qs}`, {
38
41
  headers,
39
42
  followRedirects: true,
40
43
  });
41
- ws.on('open', () => {
44
+ ws.on("open", () => {
42
45
  observer.next(ws);
43
46
  });
44
- ws.on('error', (err) => {
47
+ ws.on("error", (err) => {
45
48
  observer.error(err);
46
49
  });
47
- ws.on('close', () => observer.complete());
50
+ ws.on("close", () => observer.complete());
48
51
  return () => ws.close();
49
52
  }).pipe((0, rxjs_1.share)({ connector: () => new rxjs_1.ReplaySubject(1) }));
50
- data$ = this.server$.pipe((0, rxjs_1.switchMap)(ws => new rxjs_1.Observable(observer => {
53
+ data$ = this.server$.pipe((0, rxjs_1.switchMap)((ws) => new rxjs_1.Observable((observer) => {
51
54
  const handler = (msg) => {
52
55
  Buffer.isBuffer(msg) && observer.next(msg);
53
56
  };
@@ -55,16 +58,16 @@ class Client {
55
58
  const closeHandler = (code, reason) => {
56
59
  observer.error(new Error(`${code} - ${reason.toString()}`));
57
60
  };
58
- ws.on('message', handler);
59
- ws.once('error', errorHandler);
60
- ws.once('close', closeHandler);
61
+ ws.on("message", handler);
62
+ ws.once("error", errorHandler);
63
+ ws.once("close", closeHandler);
61
64
  return () => {
62
- ws.off('message', handler);
63
- ws.off('error', errorHandler);
64
- ws.off('close', closeHandler);
65
+ ws.off("message", handler);
66
+ ws.off("error", errorHandler);
67
+ ws.off("close", closeHandler);
65
68
  ws.close();
66
69
  };
67
- })), (0, rxjs_1.map)(v => {
70
+ })), (0, rxjs_1.map)((v) => {
68
71
  if (v.length < 18) {
69
72
  return null;
70
73
  }
@@ -84,28 +87,28 @@ class Client {
84
87
  type,
85
88
  msg,
86
89
  };
87
- }), (0, rxjs_1.filter)(v => !!v), (0, rxjs_1.share)());
90
+ }), (0, rxjs_1.filter)((v) => !!v), (0, rxjs_1.share)());
88
91
  connectToServer$ = (0, rxjs_1.merge)(this.server$.pipe(
89
92
  //wait a bit before deeming `connected`. Server might close the connection for various reasons.
90
93
  (0, rxjs_1.delay)(500), (0, rxjs_1.tap)(() => {
91
94
  this.retryCount = 1;
92
- }), (0, rxjs_1.map)(_ => 'connected')), this.data$.pipe((0, rxjs_1.mergeMap)(({ id, msg, type }) => {
95
+ }), (0, rxjs_1.map)((_) => "connected")), this.data$.pipe((0, rxjs_1.mergeMap)(({ id, msg, type }) => {
93
96
  switch (type) {
94
- case 'http':
95
- case 'ws':
97
+ case "http":
98
+ case "ws":
96
99
  return this.httpRequest({
97
100
  type,
98
101
  options: JSON.parse(msg.toString()),
99
102
  data$: this.getStreamData(id),
100
103
  send: (type, msg) => this.send(id, type, msg),
101
104
  });
102
- case 'go-idle':
105
+ case "go-idle":
103
106
  const { db, dbKey, apiKey, token } = JSON.parse(msg.toString());
104
107
  this.idle$.next({ db, dbKey, apiKey, token });
105
108
  break;
106
109
  }
107
110
  return rxjs_1.EMPTY;
108
- }))).pipe((0, rxjs_1.startWith)('connecting'), (0, rxjs_1.catchError)(err => (0, rxjs_1.concat)((0, rxjs_1.of)('disconnected'), (0, rxjs_1.throwError)(() => err))), (0, rxjs_1.retry)({
111
+ }))).pipe((0, rxjs_1.startWith)("connecting"), (0, rxjs_1.catchError)((err) => (0, rxjs_1.concat)((0, rxjs_1.of)("disconnected"), (0, rxjs_1.throwError)(() => err))), (0, rxjs_1.retry)({
109
112
  delay: (err) => {
110
113
  const delaySeconds = Math.round(Math.min(600, Math.pow(1.8, this.retryCount - 1)));
111
114
  this.options.logger?.error(`[nora-link] connection error ${this.retryCount}: ${err}`);
@@ -115,16 +118,16 @@ class Client {
115
118
  },
116
119
  }), (0, rxjs_1.share)());
117
120
  idle$ = new rxjs_1.BehaviorSubject(null);
118
- handle$ = this.idle$.pipe((0, rxjs_1.switchMap)(idle => idle
121
+ handle$ = this.idle$.pipe((0, rxjs_1.switchMap)((idle) => idle
119
122
  ? (0, firebase_1.goIdleAndWaitForSignal)({
120
123
  ...idle,
121
- subdomains: this.options.tunnels.map(t => t.subdomain),
124
+ subdomains: this.options.tunnels.map((t) => t.subdomain),
122
125
  goOutOfIdle: () => this.idle$.next(null),
123
126
  logger: this.options.logger,
124
127
  })
125
128
  : this.connectToServer$));
126
129
  send(id, type, msg) {
127
- return this.server$.pipe((0, rxjs_1.first)(), (0, rxjs_1.switchMap)(ws => {
130
+ return this.server$.pipe((0, rxjs_1.first)(), (0, rxjs_1.switchMap)((ws) => {
128
131
  const typeBuffer = Buffer.from(type);
129
132
  let offset = 0;
130
133
  const all = Buffer.alloc(18 + typeBuffer.length + (msg?.length ?? 0));
@@ -133,7 +136,7 @@ class Client {
133
136
  offset = all.writeUint8(typeBuffer.length, offset);
134
137
  offset += typeBuffer.copy(all, offset);
135
138
  msg?.copy(all, offset);
136
- return new rxjs_1.Observable(observer => {
139
+ return new rxjs_1.Observable((observer) => {
137
140
  ws.send(all, (err) => {
138
141
  if (err)
139
142
  observer.error(err);
@@ -146,69 +149,71 @@ class Client {
146
149
  getStreamData(id) {
147
150
  return this.data$.pipe((0, rxjs_1.filter)((m) => m.id.equals(id)), (0, rxjs_1.map)(({ id, ...rest }) => rest));
148
151
  }
149
- httpRequest({ type, options, data$, send }) {
152
+ httpRequest({ type, options, data$, send, }) {
150
153
  const { url, subdomain, method, headers } = options;
151
- return new rxjs_1.Observable(reqObserver => {
152
- this.options.logger?.trace(`[nora-link] START ${method} ${url}`);
153
- const tunnel = this.options.tunnels.find(v => v.subdomain === subdomain);
154
+ return new rxjs_1.Observable((reqObserver) => {
155
+ this.options.logger?.trace(`[nora-link] START ${type} ${method} ${url}`);
156
+ const tunnel = this.options.tunnels.find((v) => v.subdomain === subdomain);
154
157
  if (!tunnel) {
155
158
  throw new Error(`subdomain ${subdomain} not registered`);
156
159
  }
160
+ const { protocol, hostname, port, pathname } = new URL(tunnel.url);
157
161
  if (tunnel.removeHostHeader ?? true) {
158
162
  delete headers["host"];
159
163
  }
160
- const { hostname, port, pathname } = new URL(tunnel.url);
161
- const req = (0, node_http_1.request)({
164
+ const isHttps = protocol === "https:";
165
+ const req = (isHttps ? node_https_1.request : node_http_1.request)({
162
166
  host: hostname,
163
167
  port: port,
164
- path: pathname === '/' ? url : `${pathname}${url}`,
168
+ path: pathname === "/" ? url : `${pathname}${url}`,
165
169
  method,
166
170
  headers,
171
+ ...(isHttps ? { rejectUnauthorized: tunnel.rejectUnauthorized } : {}),
167
172
  });
168
- req.on('error', (err) => reqObserver.error(err));
169
- if (type === 'ws') {
173
+ req.on("error", (err) => reqObserver.error(err));
174
+ if (type === "ws") {
170
175
  req.flushHeaders();
171
- const handleUpgrade$ = new rxjs_1.Observable(observer => {
176
+ const handleUpgrade$ = new rxjs_1.Observable((observer) => {
172
177
  const handler = (res, socket) => {
173
178
  observer.next({ res, socket });
174
179
  observer.complete();
175
180
  };
176
- req.once('upgrade', handler);
177
- return () => req.off('upgrade', handler);
181
+ req.once("upgrade", handler);
182
+ return () => req.off("upgrade", handler);
178
183
  }).pipe((0, rxjs_1.concatMap)(({ res, socket }) => {
179
- const tx$ = new rxjs_1.Observable(observer => {
184
+ const tx$ = new rxjs_1.Observable((observer) => {
180
185
  const head = [
181
186
  `HTTP/${res.httpVersion} ${res.statusCode} ${res.statusMessage}`,
182
- ...(Object.entries(res.headers).map(([k, v]) => `${k}: ${v}`)),
183
- '',
184
- '',
185
- ].join('\r\n');
187
+ ...Object.entries(res.headers).map(([k, v]) => `${k}: ${v}`),
188
+ "",
189
+ "",
190
+ ].join("\r\n");
186
191
  observer.next(send(const_1.MessageTypes.DATA, Buffer.from(head)));
187
- socket.on('data', data => {
192
+ socket.on("data", (data) => {
188
193
  observer.next(send(const_1.MessageTypes.DATA, Buffer.from(data)));
189
194
  });
190
- socket.once('end', () => {
195
+ socket.once("end", () => {
191
196
  observer.next(send(const_1.MessageTypes.END));
192
197
  //TODO: don't really like this:
193
198
  reqObserver.complete();
194
199
  });
195
- socket.once('error', (err) => {
200
+ socket.once("error", (err) => {
196
201
  observer.error(err);
197
202
  });
198
203
  return () => socket.end();
199
- }).pipe((0, rxjs_1.concatMap)(obs => obs), (0, rxjs_1.ignoreElements)());
200
- const rx$ = data$.pipe((0, rxjs_1.concatMap)(({ type, msg }) => new rxjs_1.Observable(observer => {
204
+ }).pipe((0, rxjs_1.concatMap)((obs) => obs), (0, rxjs_1.ignoreElements)());
205
+ const rx$ = data$.pipe((0, rxjs_1.concatMap)(({ type, msg }) => new rxjs_1.Observable((observer) => {
201
206
  switch (type) {
202
- case 'data':
203
- socket.write(msg, err => {
207
+ case "data":
208
+ socket.write(msg, (err) => {
204
209
  err ? observer.error(err) : observer.complete();
205
210
  });
206
211
  break;
207
- case 'end':
212
+ case "end":
208
213
  socket.end(() => observer.next(1));
209
214
  break;
210
215
  }
211
- })), (0, rxjs_1.takeWhile)(_ => false), (0, rxjs_1.ignoreElements)(), (0, rxjs_1.finalize)(() => {
216
+ })), (0, rxjs_1.takeWhile)((_) => false), (0, rxjs_1.ignoreElements)(), (0, rxjs_1.finalize)(() => {
212
217
  //TODO: don't really like this:
213
218
  reqObserver.complete();
214
219
  }));
@@ -216,35 +221,35 @@ class Client {
216
221
  }));
217
222
  return handleUpgrade$.subscribe(reqObserver);
218
223
  }
219
- if (type === 'http') {
220
- const handleResponse$ = new rxjs_1.Observable(observer => {
224
+ if (type === "http") {
225
+ const handleResponse$ = new rxjs_1.Observable((observer) => {
221
226
  const handler = (res) => {
222
227
  observer.next(res);
223
228
  observer.complete();
224
229
  };
225
- req.once('response', handler);
226
- return () => req.off('response', handler);
227
- }).pipe((0, rxjs_1.concatMap)((res) => new rxjs_1.Observable(observer => {
230
+ req.once("response", handler);
231
+ return () => req.off("response", handler);
232
+ }).pipe((0, rxjs_1.concatMap)((res) => new rxjs_1.Observable((observer) => {
228
233
  const head$ = send(const_1.MessageTypes.HEAD, Buffer.from(JSON.stringify({
229
234
  statusCode: res.statusCode,
230
- headers: res.headers
235
+ headers: res.headers,
231
236
  })));
232
237
  observer.next(head$);
233
238
  const dataHandler = (data) => observer.next(send(const_1.MessageTypes.DATA, data));
234
- res.on('data', dataHandler);
235
- res.once('end', () => {
239
+ res.on("data", dataHandler);
240
+ res.once("end", () => {
236
241
  observer.next(send(const_1.MessageTypes.END));
237
242
  observer.complete();
238
243
  });
239
- res.once('error', err => {
244
+ res.once("error", (err) => {
240
245
  observer.error(err);
241
246
  });
242
- return () => res.off('data', dataHandler);
243
- })), (0, rxjs_1.concatMap)(o => o), (0, rxjs_1.ignoreElements)());
244
- const rx$ = data$.pipe((0, rxjs_1.concatMap)(({ type, msg }) => new rxjs_1.Observable(observer => {
247
+ return () => res.off("data", dataHandler);
248
+ })), (0, rxjs_1.concatMap)((o) => o), (0, rxjs_1.ignoreElements)());
249
+ const rx$ = data$.pipe((0, rxjs_1.concatMap)(({ type, msg }) => new rxjs_1.Observable((observer) => {
245
250
  switch (type) {
246
251
  case const_1.MessageTypes.DATA:
247
- req.write(msg, err => {
252
+ req.write(msg, (err) => {
248
253
  err ? observer.error(err) : observer.complete();
249
254
  });
250
255
  break;
@@ -252,16 +257,15 @@ class Client {
252
257
  req.end(() => observer.next(1));
253
258
  break;
254
259
  }
255
- })), (0, rxjs_1.takeWhile)(_ => false), (0, rxjs_1.ignoreElements)());
256
- return (0, rxjs_1.merge)(handleResponse$, rx$)
257
- .subscribe(reqObserver);
260
+ })), (0, rxjs_1.takeWhile)((_) => false), (0, rxjs_1.ignoreElements)());
261
+ return (0, rxjs_1.merge)(handleResponse$, rx$).subscribe(reqObserver);
258
262
  }
259
263
  return () => req.end();
260
- }).pipe((0, rxjs_1.catchError)(err => {
264
+ }).pipe((0, rxjs_1.catchError)((err) => {
261
265
  this.options.logger?.warn(`[nora-link] error handling request: ${err}`);
262
266
  return send(const_1.MessageTypes.BADGATEWAY);
263
267
  }), (0, rxjs_1.finalize)(() => {
264
- this.options.logger?.trace(`[nora-link] DONE ${method} ${url}`);
268
+ this.options.logger?.trace(`[nora-link] DONE ${type} ${method} ${url}`);
265
269
  }));
266
270
  }
267
271
  }
package/dist/const.js CHANGED
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MessageTypes = void 0;
4
4
  exports.MessageTypes = {
5
- HEAD: 'head',
6
- DATA: 'data',
7
- END: 'end',
8
- CLOSE: 'close',
9
- BADGATEWAY: 'err-502',
5
+ HEAD: "head",
6
+ DATA: "data",
7
+ END: "end",
8
+ CLOSE: "close",
9
+ BADGATEWAY: "err-502",
10
10
  };
package/dist/logger.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export declare const LOG_LEVEL: readonly ["trace", "debug", "info", "warn", "error"];
2
- export type LogLevel = typeof LOG_LEVEL[number];
2
+ export type LogLevel = (typeof LOG_LEVEL)[number];
3
3
  export type Logger = {
4
4
  [P in LogLevel]: (msg: string) => void;
5
5
  };
package/dist/logger.js CHANGED
@@ -2,13 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LOG_LEVEL = void 0;
4
4
  exports.createConsoleLogger = createConsoleLogger;
5
- exports.LOG_LEVEL = [
6
- 'trace',
7
- 'debug',
8
- 'info',
9
- 'warn',
10
- 'error'
11
- ];
5
+ exports.LOG_LEVEL = ["trace", "debug", "info", "warn", "error"];
12
6
  function createConsoleLogger(minLevel) {
13
7
  const minLevelIndex = exports.LOG_LEVEL.indexOf(minLevel);
14
8
  function log(kind, ...args) {
@@ -22,6 +16,6 @@ function createConsoleLogger(minLevel) {
22
16
  return new Proxy({}, {
23
17
  get: function (_, name) {
24
18
  return log.bind(null, name);
25
- }
19
+ },
26
20
  });
27
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nora-link/client",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "noralink.eu client",
5
5
  "bin": {
6
6
  "noralink": "dist/cli.js"