wapi-client 0.8.3 → 0.8.12

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.
@@ -22,6 +22,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
22
  import { ERROR_TYPES, getError, StreamError } from "./errors";
23
23
  import { JSONRPC } from "../api/jsonrpc/jsonrpc.enums";
24
24
  import { ReadStream } from "./isomorphic/node/streams";
25
+ import { debugLog } from "./debug";
25
26
  var StreamPromise = class {
26
27
  constructor(makeRequest) {
27
28
  this.streamObject = new ReadStream({
@@ -34,6 +35,7 @@ var StreamPromise = class {
34
35
  this.makeRequest = makeRequest;
35
36
  }
36
37
  start(asMode) {
38
+ debugLog("start request as", asMode);
37
39
  if (this.mode && this.mode !== asMode) {
38
40
  throw new Error("Already in use as " + this.mode);
39
41
  }
@@ -57,6 +59,7 @@ var StreamPromise = class {
57
59
  this.streamObject.on(
58
60
  "data",
59
61
  (chunk) => {
62
+ debugLog("stream data", chunk);
60
63
  if (!chunk) {
61
64
  this.outStreamObject.push(chunk);
62
65
  }
@@ -82,6 +85,7 @@ var StreamPromise = class {
82
85
  this.outStreamObject.push(chunk);
83
86
  }
84
87
  ).on("end", () => {
88
+ debugLog("stream ended");
85
89
  const lastMessage = internalArr.pop();
86
90
  if (!lastMessage) {
87
91
  return;
@@ -103,6 +107,7 @@ var StreamPromise = class {
103
107
  this.outStreamObject.push(lastMessage);
104
108
  this.outStreamObject.push(null);
105
109
  }).on("error", (err) => {
110
+ debugLog("stream error", err);
106
111
  this.outStreamObject.destroy(err);
107
112
  });
108
113
  return;
@@ -113,6 +118,7 @@ var StreamPromise = class {
113
118
  "data",
114
119
  (chunk) => {
115
120
  var _a;
121
+ debugLog("streamPromise data", chunk);
116
122
  if (chunk === void 0) {
117
123
  return;
118
124
  }
@@ -133,6 +139,7 @@ var StreamPromise = class {
133
139
  internalMap.set(chunk.prop, arr);
134
140
  }
135
141
  ).on("end", () => {
142
+ debugLog("streamPromise end");
136
143
  const lastMessage = internalArr.pop();
137
144
  if (!lastMessage) {
138
145
  return;
@@ -166,7 +173,10 @@ var StreamPromise = class {
166
173
  result
167
174
  );
168
175
  }
169
- }).on("error", this.reject);
176
+ }).on("error", (reason) => {
177
+ debugLog("streamPromise error", reason);
178
+ return this.reject(reason);
179
+ });
170
180
  }
171
181
  }
172
182
  then(onfulfilled, onrejected) {
@@ -9730,7 +9730,8 @@ declare module 'wapi-client/api/base-client' {
9730
9730
  _connection: WebSocket | HttpConnectionClient;
9731
9731
  $connect: Promise<ISocketId> | Promise<undefined> | undefined;
9732
9732
  connectionType: WapiClientType;
9733
- jwt: string;
9733
+ host: string;
9734
+ protected jwt: string;
9734
9735
  isConnected: boolean;
9735
9736
  socId: undefined | string;
9736
9737
  hooks: ClientHooks;