molex-ftp-client 2.2.0 → 2.2.2

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/lib/FTPClient.js CHANGED
@@ -253,6 +253,26 @@ class FTPClient extends EventEmitter
253
253
  };
254
254
  }
255
255
 
256
+ /**
257
+ * Get current client state for debugging
258
+ * @returns {Object}
259
+ */
260
+ getState()
261
+ {
262
+ return {
263
+ connected: this.connected,
264
+ authenticated: this.authenticated,
265
+ host: this._connection?.host || null,
266
+ port: this._connection?.port || null,
267
+ user: this._connection?.user || null,
268
+ commandCount: this._commandCount,
269
+ lastCommand: this._lastCommand,
270
+ timeout: this.timeout,
271
+ debug: this.debug,
272
+ keepAlive: this.keepAlive
273
+ };
274
+ }
275
+
256
276
  /**
257
277
  * Check if connected and authenticated
258
278
  * @returns {boolean}
package/lib/connection.js CHANGED
@@ -18,6 +18,11 @@ class FTPConnection {
18
18
  * @returns {Promise<void>}
19
19
  */
20
20
  async connect({ host, port = 21, user = 'anonymous', password = 'anonymous@' }) {
21
+ // Store connection parameters for getState()
22
+ this.host = host;
23
+ this.port = port;
24
+ this.user = user;
25
+
21
26
  this.client._debug(`Connecting to ${host}:${port} as ${user}`);
22
27
 
23
28
  return new Promise((resolve, reject) => {
@@ -171,6 +176,10 @@ class FTPConnection {
171
176
  }
172
177
  this.client.connected = false;
173
178
  this.client.authenticated = false;
179
+ // Reset connection parameters
180
+ this.host = null;
181
+ this.port = null;
182
+ this.user = null;
174
183
  this.client._debug('Connection closed');
175
184
  }
176
185
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "molex-ftp-client",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "description": "Lightweight FTP client using native Node.js TCP sockets (net module) with zero dependencies",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -30,5 +30,8 @@
30
30
  "homepage": "https://github.com/tonywied17/molex-ftp-client#readme",
31
31
  "engines": {
32
32
  "node": ">=12.0.0"
33
+ },
34
+ "publishConfig": {
35
+ "registry": "https://registry.npmjs.org/"
33
36
  }
34
37
  }