pinggy 0.5.3 → 0.5.6

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/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { TunnelConfigurationV1, TunnelUsageType, TunnelInstance, TunnelType, RemoteManagementConfig } from '@pinggy/pinggy';
2
+ import { TunnelConfigurationV1, TunnelUsageType, TunnelInstance, TunnelType, HaProxyVersion, RemoteManagementConfig } from '@pinggy/pinggy';
3
3
  export { TunnelConfigurationV1 } from '@pinggy/pinggy';
4
4
  import { Worker } from 'node:worker_threads';
5
5
  import { z } from 'zod';
@@ -297,12 +297,24 @@ declare class TunnelManager implements ITunnelManager {
297
297
  * @throws Error if neither configId nor tunnelId is provided, or if tunnel is not found
298
298
  */
299
299
  getTunnelConfig(configId?: string, tunnelId?: string): Promise<TunnelConfigurationV1>;
300
+ /**
301
+ * Stop a tunnel instance and wait for the stop to settle, capped by a
302
+ * timeout. Failure is logged, not thrown: the caller replaces the
303
+ * instance either way and a hung stop must not block that forever.
304
+ */
305
+ private stopInstanceGuarded;
300
306
  /**
301
307
  * Restarts a tunnel with its current configuration.
302
308
  * This function will stop the tunnel if it's running and start it again.
303
309
  * All configurations including additional forwarding rules are preserved.
304
310
  */
305
311
  restartTunnel(tunnelid: string): Promise<void>;
312
+ /**
313
+ * Carry lifecycle state from a replaced tunnel over to its replacement:
314
+ * keep createdAt, start the replacement if the old tunnel was running,
315
+ * otherwise keep it stopped with the original timestamps.
316
+ */
317
+ private applyPreservedLifecycle;
306
318
  /**
307
319
  * Updates the configuration of an existing tunnel.
308
320
  *
@@ -571,13 +583,13 @@ declare const TunnelConfigV1Schema: z.ZodObject<{
571
583
  forwarding: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodObject<{
572
584
  listenAddress: z.ZodOptional<z.ZodString>;
573
585
  address: z.ZodString;
574
- type: z.ZodEnum<{
586
+ type: z.ZodDefault<z.ZodEnum<{
575
587
  http: TunnelType.Http;
576
588
  tcp: TunnelType.Tcp;
577
589
  tls: TunnelType.Tls;
578
590
  udp: TunnelType.Udp;
579
591
  tlstcp: TunnelType.TlsTcp;
580
- }>;
592
+ }>>;
581
593
  }, z.core.$strip>>]>;
582
594
  ipWhitelist: z.ZodOptional<z.ZodArray<z.ZodString>>;
583
595
  basicAuth: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -599,18 +611,12 @@ declare const TunnelConfigV1Schema: z.ZodObject<{
599
611
  httpsOnly: z.ZodOptional<z.ZodBoolean>;
600
612
  originalRequestUrl: z.ZodOptional<z.ZodBoolean>;
601
613
  allowPreflight: z.ZodOptional<z.ZodBoolean>;
602
- optional: z.ZodOptional<z.ZodObject<{
603
- sniServerName: z.ZodOptional<z.ZodString>;
604
- ssl: z.ZodOptional<z.ZodBoolean>;
605
- additionalArguments: z.ZodOptional<z.ZodString>;
606
- serve: z.ZodOptional<z.ZodString>;
607
- manage: z.ZodOptional<z.ZodString>;
608
- remoteManagement: z.ZodOptional<z.ZodObject<{
609
- serverUrl: z.ZodString;
610
- apiKey: z.ZodString;
611
- }, z.core.$strip>>;
612
- noTui: z.ZodOptional<z.ZodBoolean>;
613
- }, z.core.$catchall<z.ZodUnknown>>>;
614
+ haProxy: z.ZodOptional<z.ZodEnum<{
615
+ v1: HaProxyVersion.V1;
616
+ v2: HaProxyVersion.V2;
617
+ }>>;
618
+ serve: z.ZodOptional<z.ZodString>;
619
+ optional: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
614
620
  }, z.core.$strip>;
615
621
  type TunnelConfigV1 = z.infer<typeof TunnelConfigV1Schema>;
616
622
  declare const TUNNEL_CONFIG_V1_KEYS: (keyof TunnelConfigV1)[];
@@ -747,6 +753,7 @@ type IPCRoutes = {
747
753
  [Route.RestartTunnel]: {
748
754
  req: {
749
755
  tunnelid: string;
756
+ noWait?: boolean;
750
757
  };
751
758
  res: TunnelResponse | ErrorResponse;
752
759
  };
@@ -909,7 +916,7 @@ declare class IPCClient {
909
916
  startTunnel(name: string, mode: SessionMode): Promise<TunnelResponseV2 | ErrorResponse>;
910
917
  startTunnelWithConfig(config: TunnelConfigV1, mode: SessionMode, noWait?: boolean): Promise<TunnelResponseV2 | ErrorResponse>;
911
918
  stopTunnel(tunnelid: string): Promise<TunnelResponse | ErrorResponse>;
912
- restartTunnel(tunnelid: string): Promise<TunnelResponse | ErrorResponse>;
919
+ restartTunnel(tunnelid: string, noWait?: boolean): Promise<TunnelResponse | ErrorResponse>;
913
920
  startTunnelV1(config: TunnelConfig, mode: SessionMode, noWait?: boolean): Promise<TunnelResponse | ErrorResponse>;
914
921
  listTunnelsV1(): Promise<TunnelResponse[] | ErrorResponse>;
915
922
  updateConfig(config: TunnelConfig, noWait?: boolean): Promise<TunnelResponse | ErrorResponse>;
@@ -1093,7 +1100,7 @@ declare class TunnelClient {
1093
1100
  handleRemoveStoppedTunnelByTunnelId(tunnelId: string): boolean | ErrorResponse;
1094
1101
  handleRemoveStoppedTunnelByConfigId(configId: string): boolean | ErrorResponse;
1095
1102
  handleGet(tunnelId: string): Promise<TunnelResponse | ErrorResponse>;
1096
- handleRestart(tunnelId: string): Promise<TunnelResponse | ErrorResponse>;
1103
+ handleRestart(tunnelId: string, noWait?: boolean): Promise<TunnelResponse | ErrorResponse>;
1097
1104
  shutdown(): Promise<void>;
1098
1105
  /**
1099
1106
  * Tear down the daemon hosted in THIS process, if any. Stops all tunnels
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { TunnelConfigurationV1, TunnelUsageType, TunnelInstance, TunnelType, RemoteManagementConfig } from '@pinggy/pinggy';
2
+ import { TunnelConfigurationV1, TunnelUsageType, TunnelInstance, TunnelType, HaProxyVersion, RemoteManagementConfig } from '@pinggy/pinggy';
3
3
  export { TunnelConfigurationV1 } from '@pinggy/pinggy';
4
4
  import { Worker } from 'node:worker_threads';
5
5
  import { z } from 'zod';
@@ -297,12 +297,24 @@ declare class TunnelManager implements ITunnelManager {
297
297
  * @throws Error if neither configId nor tunnelId is provided, or if tunnel is not found
298
298
  */
299
299
  getTunnelConfig(configId?: string, tunnelId?: string): Promise<TunnelConfigurationV1>;
300
+ /**
301
+ * Stop a tunnel instance and wait for the stop to settle, capped by a
302
+ * timeout. Failure is logged, not thrown: the caller replaces the
303
+ * instance either way and a hung stop must not block that forever.
304
+ */
305
+ private stopInstanceGuarded;
300
306
  /**
301
307
  * Restarts a tunnel with its current configuration.
302
308
  * This function will stop the tunnel if it's running and start it again.
303
309
  * All configurations including additional forwarding rules are preserved.
304
310
  */
305
311
  restartTunnel(tunnelid: string): Promise<void>;
312
+ /**
313
+ * Carry lifecycle state from a replaced tunnel over to its replacement:
314
+ * keep createdAt, start the replacement if the old tunnel was running,
315
+ * otherwise keep it stopped with the original timestamps.
316
+ */
317
+ private applyPreservedLifecycle;
306
318
  /**
307
319
  * Updates the configuration of an existing tunnel.
308
320
  *
@@ -571,13 +583,13 @@ declare const TunnelConfigV1Schema: z.ZodObject<{
571
583
  forwarding: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodObject<{
572
584
  listenAddress: z.ZodOptional<z.ZodString>;
573
585
  address: z.ZodString;
574
- type: z.ZodEnum<{
586
+ type: z.ZodDefault<z.ZodEnum<{
575
587
  http: TunnelType.Http;
576
588
  tcp: TunnelType.Tcp;
577
589
  tls: TunnelType.Tls;
578
590
  udp: TunnelType.Udp;
579
591
  tlstcp: TunnelType.TlsTcp;
580
- }>;
592
+ }>>;
581
593
  }, z.core.$strip>>]>;
582
594
  ipWhitelist: z.ZodOptional<z.ZodArray<z.ZodString>>;
583
595
  basicAuth: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -599,18 +611,12 @@ declare const TunnelConfigV1Schema: z.ZodObject<{
599
611
  httpsOnly: z.ZodOptional<z.ZodBoolean>;
600
612
  originalRequestUrl: z.ZodOptional<z.ZodBoolean>;
601
613
  allowPreflight: z.ZodOptional<z.ZodBoolean>;
602
- optional: z.ZodOptional<z.ZodObject<{
603
- sniServerName: z.ZodOptional<z.ZodString>;
604
- ssl: z.ZodOptional<z.ZodBoolean>;
605
- additionalArguments: z.ZodOptional<z.ZodString>;
606
- serve: z.ZodOptional<z.ZodString>;
607
- manage: z.ZodOptional<z.ZodString>;
608
- remoteManagement: z.ZodOptional<z.ZodObject<{
609
- serverUrl: z.ZodString;
610
- apiKey: z.ZodString;
611
- }, z.core.$strip>>;
612
- noTui: z.ZodOptional<z.ZodBoolean>;
613
- }, z.core.$catchall<z.ZodUnknown>>>;
614
+ haProxy: z.ZodOptional<z.ZodEnum<{
615
+ v1: HaProxyVersion.V1;
616
+ v2: HaProxyVersion.V2;
617
+ }>>;
618
+ serve: z.ZodOptional<z.ZodString>;
619
+ optional: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
614
620
  }, z.core.$strip>;
615
621
  type TunnelConfigV1 = z.infer<typeof TunnelConfigV1Schema>;
616
622
  declare const TUNNEL_CONFIG_V1_KEYS: (keyof TunnelConfigV1)[];
@@ -747,6 +753,7 @@ type IPCRoutes = {
747
753
  [Route.RestartTunnel]: {
748
754
  req: {
749
755
  tunnelid: string;
756
+ noWait?: boolean;
750
757
  };
751
758
  res: TunnelResponse | ErrorResponse;
752
759
  };
@@ -909,7 +916,7 @@ declare class IPCClient {
909
916
  startTunnel(name: string, mode: SessionMode): Promise<TunnelResponseV2 | ErrorResponse>;
910
917
  startTunnelWithConfig(config: TunnelConfigV1, mode: SessionMode, noWait?: boolean): Promise<TunnelResponseV2 | ErrorResponse>;
911
918
  stopTunnel(tunnelid: string): Promise<TunnelResponse | ErrorResponse>;
912
- restartTunnel(tunnelid: string): Promise<TunnelResponse | ErrorResponse>;
919
+ restartTunnel(tunnelid: string, noWait?: boolean): Promise<TunnelResponse | ErrorResponse>;
913
920
  startTunnelV1(config: TunnelConfig, mode: SessionMode, noWait?: boolean): Promise<TunnelResponse | ErrorResponse>;
914
921
  listTunnelsV1(): Promise<TunnelResponse[] | ErrorResponse>;
915
922
  updateConfig(config: TunnelConfig, noWait?: boolean): Promise<TunnelResponse | ErrorResponse>;
@@ -1093,7 +1100,7 @@ declare class TunnelClient {
1093
1100
  handleRemoveStoppedTunnelByTunnelId(tunnelId: string): boolean | ErrorResponse;
1094
1101
  handleRemoveStoppedTunnelByConfigId(configId: string): boolean | ErrorResponse;
1095
1102
  handleGet(tunnelId: string): Promise<TunnelResponse | ErrorResponse>;
1096
- handleRestart(tunnelId: string): Promise<TunnelResponse | ErrorResponse>;
1103
+ handleRestart(tunnelId: string, noWait?: boolean): Promise<TunnelResponse | ErrorResponse>;
1097
1104
  shutdown(): Promise<void>;
1098
1105
  /**
1099
1106
  * Tear down the daemon hosted in THIS process, if any. Stops all tunnels
package/dist/index.js CHANGED
@@ -14,8 +14,8 @@ import {
14
14
  initiateRemoteManagement,
15
15
  isDaemonRunning,
16
16
  startRemoteManagement
17
- } from "./chunk-GK2PQ7KX.js";
18
- import "./chunk-5YHD6M35.js";
17
+ } from "./chunk-HN4YLM7U.js";
18
+ import "./chunk-YTJEV27N.js";
19
19
  import {
20
20
  bulkReplace,
21
21
  configureStorageLogger,
@@ -33,15 +33,15 @@ import {
33
33
  validateName,
34
34
  validateNameForStorage,
35
35
  validateNameStrict
36
- } from "./chunk-WM7I57AA.js";
36
+ } from "./chunk-YWXADADB.js";
37
37
  import {
38
38
  TunnelManager,
39
39
  printer_default
40
- } from "./chunk-DLNUDW6G.js";
40
+ } from "./chunk-PQSLSIDA.js";
41
41
  import "./chunk-UB26QJ4T.js";
42
42
  import {
43
43
  enablePackageLogging
44
- } from "./chunk-7G6SJEEA.js";
44
+ } from "./chunk-P7WNBN7F.js";
45
45
  import {
46
46
  ensureTunnelConfigDir,
47
47
  getDaemonInfoPath,
@@ -139,7 +139,7 @@ async function verifyAndLoad() {
139
139
  process.exit(1);
140
140
  }
141
141
  }
142
- await import("./main-B2EBHFN2.js");
142
+ await import("./main-WXFARRMN.js");
143
143
  }
144
144
  verifyAndLoad().catch((err) => {
145
145
  printer_default.fatal(`Failed to start CLI:, ${err}`);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  IPCClient
3
- } from "./chunk-5YHD6M35.js";
3
+ } from "./chunk-YTJEV27N.js";
4
4
  export {
5
5
  IPCClient
6
6
  };
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runDaemonChild
4
- } from "./chunk-BBPR2LJB.js";
4
+ } from "./chunk-OH6FSLYF.js";
5
5
  import {
6
6
  RemoteManagementUnauthorizedError,
7
7
  TunnelOperations,
@@ -13,19 +13,19 @@ import {
13
13
  getRemoteManagementState,
14
14
  initiateRemoteManagement,
15
15
  isDaemonRunning
16
- } from "./chunk-GK2PQ7KX.js";
16
+ } from "./chunk-HN4YLM7U.js";
17
17
  import "./chunk-MT44NAXX.js";
18
18
  import {
19
19
  DaemonHost
20
- } from "./chunk-5YHD6M35.js";
21
- import "./chunk-WM7I57AA.js";
20
+ } from "./chunk-YTJEV27N.js";
21
+ import "./chunk-YWXADADB.js";
22
22
  import {
23
23
  TunnelManager
24
- } from "./chunk-DLNUDW6G.js";
24
+ } from "./chunk-PQSLSIDA.js";
25
25
  import "./chunk-UB26QJ4T.js";
26
26
  import {
27
27
  enablePackageLogging
28
- } from "./chunk-7G6SJEEA.js";
28
+ } from "./chunk-P7WNBN7F.js";
29
29
  import "./chunk-GBYF2H4H.js";
30
30
  export {
31
31
  DaemonHost,
@@ -3,7 +3,7 @@ import {
3
3
  } from "../chunk-UB26QJ4T.js";
4
4
  import {
5
5
  logger
6
- } from "../chunk-7G6SJEEA.js";
6
+ } from "../chunk-P7WNBN7F.js";
7
7
 
8
8
  // src/workers/file_serve_worker.ts
9
9
  import { parentPort, workerData } from "worker_threads";
package/jest.config.cjs CHANGED
@@ -6,6 +6,7 @@ const presetConfig = createDefaultEsmPreset();
6
6
  module.exports = {
7
7
  ...presetConfig,
8
8
  testEnvironment: "node",
9
+ testPathIgnorePatterns: ['/node_modules/', '/.claude/', '/dist/'],
9
10
  moduleNameMapper: {
10
11
  // This handles the .js extension in your TS imports
11
12
  '^(\\.{1,2}/.*)\\.js$': '$1',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinggy",
3
- "version": "0.5.3",
3
+ "version": "0.5.6",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "description": "Create secure, shareable tunnels to your localhost and manage them from the command line. ",
@@ -52,7 +52,7 @@
52
52
  ]
53
53
  },
54
54
  "dependencies": {
55
- "@pinggy/pinggy": "^0.4.9",
55
+ "@pinggy/pinggy": "^0.5.1",
56
56
  "blessed": "^0.1.81",
57
57
  "clipboardy": "^5.0.0",
58
58
  "mime": "^4.1.0",