pinggy 0.5.1 → 0.5.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/dist/{chunk-VJ4VSZGX.js → chunk-C3ZMLIC4.js} +21 -5
- package/dist/{chunk-Y65A4BL2.js → chunk-LFK74BMU.js} +56 -21
- package/dist/{chunk-HUP6YWH6.js → chunk-WM7I57AA.js} +119 -20
- package/dist/{configStore-TSGRNOE3.js → configStore-HP3NXPH4.js} +13 -3
- package/dist/{daemonChild-KXERF36J.js → daemonChild-6QA4AVAN.js} +3 -3
- package/dist/index.cjs +239 -46
- package/dist/index.d.cts +157 -3
- package/dist/index.d.ts +157 -3
- package/dist/index.js +51 -4
- package/dist/{main-KXUDW6W5.js → main-K6ZEWZQ7.js} +3 -3
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { TunnelConfigurationV1, TunnelUsageType, TunnelInstance, TunnelType, RemoteManagementConfig } from '@pinggy/pinggy';
|
|
3
|
+
export { TunnelConfigurationV1 } from '@pinggy/pinggy';
|
|
3
4
|
import { Worker } from 'node:worker_threads';
|
|
4
5
|
import { z } from 'zod';
|
|
5
6
|
import winston from 'winston';
|
|
@@ -556,6 +557,9 @@ declare const TunnelConfigV1Schema: z.ZodObject<{
|
|
|
556
557
|
version: z.ZodString;
|
|
557
558
|
name: z.ZodString;
|
|
558
559
|
configId: z.ZodString;
|
|
560
|
+
hostKeyCheck: z.ZodOptional<z.ZodBoolean>;
|
|
561
|
+
platformValue: z.ZodOptional<z.ZodString>;
|
|
562
|
+
isQRCode: z.ZodOptional<z.ZodBoolean>;
|
|
559
563
|
serverAddress: z.ZodOptional<z.ZodString>;
|
|
560
564
|
token: z.ZodOptional<z.ZodString>;
|
|
561
565
|
autoReconnect: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -595,10 +599,21 @@ declare const TunnelConfigV1Schema: z.ZodObject<{
|
|
|
595
599
|
httpsOnly: z.ZodOptional<z.ZodBoolean>;
|
|
596
600
|
originalRequestUrl: z.ZodOptional<z.ZodBoolean>;
|
|
597
601
|
allowPreflight: z.ZodOptional<z.ZodBoolean>;
|
|
598
|
-
|
|
599
|
-
|
|
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>>>;
|
|
600
614
|
}, z.core.$strip>;
|
|
601
615
|
type TunnelConfigV1 = z.infer<typeof TunnelConfigV1Schema>;
|
|
616
|
+
declare const TUNNEL_CONFIG_V1_KEYS: (keyof TunnelConfigV1)[];
|
|
602
617
|
|
|
603
618
|
/**
|
|
604
619
|
* Typed IPC route contract shared by IPCClient (caller) and IPCServer (handler).
|
|
@@ -1124,4 +1139,143 @@ declare function closeRemoteManagement(timeoutMs?: number): Promise<RemoteManage
|
|
|
1124
1139
|
declare function startRemoteManagement(remoteManagementConfig: RemoteManagementConfig, tunnelHandler?: TunnelHandler): Promise<RemoteManagementState>;
|
|
1125
1140
|
declare function getRemoteManagementState(): RemoteManagementState;
|
|
1126
1141
|
|
|
1127
|
-
|
|
1142
|
+
interface SavedTunnelConfig {
|
|
1143
|
+
name: string;
|
|
1144
|
+
configId: string;
|
|
1145
|
+
autoStart: boolean;
|
|
1146
|
+
createdAt: string;
|
|
1147
|
+
updatedAt: string;
|
|
1148
|
+
tunnelConfig: TunnelConfigurationV1;
|
|
1149
|
+
/**
|
|
1150
|
+
* App-owned UI state (e.g. `regioncode`, `isServerAddress`). The CLI
|
|
1151
|
+
* and daemon never read this;
|
|
1152
|
+
*/
|
|
1153
|
+
uiMetadata?: Record<string, unknown>;
|
|
1154
|
+
}
|
|
1155
|
+
/**
|
|
1156
|
+
* Minimal logger interface for the storage module. Defaults to the cli-js
|
|
1157
|
+
* winston logger (silent unless the CLI configures it). Non-CLI consumers
|
|
1158
|
+
* (e.g. the Electron app) override it via {@link configureStorageLogger} to
|
|
1159
|
+
* route storage logs into their own logging pipeline
|
|
1160
|
+
*/
|
|
1161
|
+
interface StorageLogger {
|
|
1162
|
+
info: (message: string, ...meta: unknown[]) => void;
|
|
1163
|
+
warn: (message: string, ...meta: unknown[]) => void;
|
|
1164
|
+
error: (message: string, ...meta: unknown[]) => void;
|
|
1165
|
+
}
|
|
1166
|
+
declare function configureStorageLogger(l: StorageLogger): void;
|
|
1167
|
+
/**
|
|
1168
|
+
* Sanitizes a tunnel name to be filesystem-safe.
|
|
1169
|
+
* Allows alphanumeric, hyphens, underscores only.
|
|
1170
|
+
*/
|
|
1171
|
+
declare function sanitizeName(name: string): string;
|
|
1172
|
+
/**
|
|
1173
|
+
* Strict name validation used by the CLI's own save path: alphanumeric +
|
|
1174
|
+
* `_`/`-`, ≤128 chars, no reserved subcommand names.
|
|
1175
|
+
*/
|
|
1176
|
+
declare function validateNameStrict(name: string): Error | null;
|
|
1177
|
+
/**
|
|
1178
|
+
* Relaxed name validation used by app-driven writes (`{ strict: false }`). The
|
|
1179
|
+
* app allows spaces/unicode in display names, so this only rejects what would
|
|
1180
|
+
* break the filesystem layout or collide with a CLI subcommand: path
|
|
1181
|
+
* separators, NUL/control characters, empty/whitespace-only names, and reserved
|
|
1182
|
+
* subcommand names. The JSON `name` keeps the original; the filename is always
|
|
1183
|
+
* sanitized via {@link sanitizeName}.
|
|
1184
|
+
*/
|
|
1185
|
+
declare function validateNameForStorage(name: string): Error | null;
|
|
1186
|
+
/**
|
|
1187
|
+
* Backwards-compatible alias for {@link validateNameStrict}. Existing CLI
|
|
1188
|
+
* callers (`subcommands.ts`, `buildAndStartTunnel.ts`) import `validateName`.
|
|
1189
|
+
*/
|
|
1190
|
+
declare const validateName: typeof validateNameStrict;
|
|
1191
|
+
/**
|
|
1192
|
+
* List all saved tunnel configs from the config directory.
|
|
1193
|
+
*/
|
|
1194
|
+
declare function listSavedConfigs(): SavedTunnelConfig[];
|
|
1195
|
+
/**
|
|
1196
|
+
* Find a config by its exact display name (the JSON `name`). Exact on purpose:
|
|
1197
|
+
* `sanitizeName` is many-to-one (`"My Tunnel"`/`"My_Tunnel"` → `My_Tunnel`), so
|
|
1198
|
+
* it builds filenames, never decides identity. Narrows by sanitized prefix then
|
|
1199
|
+
* confirms the exact `name`; on a same-name/different-`configId` tie, newest wins.
|
|
1200
|
+
*/
|
|
1201
|
+
declare function findConfigByName(name: string): SavedTunnelConfig | null;
|
|
1202
|
+
/**
|
|
1203
|
+
* Find a config by name or configId (supports partial configId match).
|
|
1204
|
+
*/
|
|
1205
|
+
declare function findConfig(nameOrId: string): SavedTunnelConfig | null;
|
|
1206
|
+
/**
|
|
1207
|
+
* Save a tunnel config to the config store.
|
|
1208
|
+
* Rejects duplicate names.
|
|
1209
|
+
*
|
|
1210
|
+
* @param options.strict When `true` (default) names are validated with
|
|
1211
|
+
* {@link validateNameStrict}; when `false` (app-driven writes) with the
|
|
1212
|
+
* relaxed {@link validateNameForStorage}.
|
|
1213
|
+
*/
|
|
1214
|
+
declare function saveConfig(name: string, configId: string, tunnelConfig: TunnelConfigurationV1, autoStart?: boolean, options?: {
|
|
1215
|
+
strict?: boolean;
|
|
1216
|
+
}): SavedTunnelConfig;
|
|
1217
|
+
/**
|
|
1218
|
+
* Insert or update a full saved record, keyed by `configId` (the stable
|
|
1219
|
+
* identity). If a record with the same `configId` exists under a different
|
|
1220
|
+
* filename — because its `name` changed — the old file is deleted before the
|
|
1221
|
+
* new one is written, so there is never a stale duplicate on disk. Only
|
|
1222
|
+
* validates the name when creating a brand-new record;
|
|
1223
|
+
*/
|
|
1224
|
+
declare function upsertConfig(saved: SavedTunnelConfig, options?: {
|
|
1225
|
+
strict?: boolean;
|
|
1226
|
+
}): SavedTunnelConfig;
|
|
1227
|
+
/**
|
|
1228
|
+
* Replace a *bounded* set of configs in one pass. Every config in `configs` is
|
|
1229
|
+
* upserted;
|
|
1230
|
+
*/
|
|
1231
|
+
declare function bulkReplace(configs: SavedTunnelConfig[], knownConfigIds: Set<string>, options?: {
|
|
1232
|
+
strict?: boolean;
|
|
1233
|
+
}): {
|
|
1234
|
+
written: string[];
|
|
1235
|
+
deleted: string[];
|
|
1236
|
+
};
|
|
1237
|
+
/**
|
|
1238
|
+
* Load a saved tunnel config by name.
|
|
1239
|
+
*/
|
|
1240
|
+
declare function loadConfigByName(name: string): SavedTunnelConfig | null;
|
|
1241
|
+
/**
|
|
1242
|
+
* Delete a saved tunnel config by name or configId.
|
|
1243
|
+
* Returns the deleted config's name if found, null otherwise.
|
|
1244
|
+
*/
|
|
1245
|
+
declare function deleteConfig(nameOrId: string): string | null;
|
|
1246
|
+
/**
|
|
1247
|
+
* Update the autoStart flag on a saved config.
|
|
1248
|
+
* Returns the updated config, or null if not found.
|
|
1249
|
+
*/
|
|
1250
|
+
declare function updateConfigAutoStart(nameOrId: string, autoStart: boolean): SavedTunnelConfig | null;
|
|
1251
|
+
/**
|
|
1252
|
+
* Update the tunnel configuration of a saved config.
|
|
1253
|
+
* Returns the updated config, or null if not found.
|
|
1254
|
+
*/
|
|
1255
|
+
declare function updateTunnelConfig(nameOrId: string, tunnelConfig: TunnelConfigurationV1): SavedTunnelConfig | null;
|
|
1256
|
+
/**
|
|
1257
|
+
* Get all configs marked for auto-start.
|
|
1258
|
+
*/
|
|
1259
|
+
declare function getAutoStartConfigs(): SavedTunnelConfig[];
|
|
1260
|
+
|
|
1261
|
+
/**
|
|
1262
|
+
* Returns the base Pinggy config directory for the current platform.
|
|
1263
|
+
* - Linux/macOS: $XDG_CONFIG_HOME/pinggy or ~/.config/pinggy
|
|
1264
|
+
* - Windows: %APPDATA%/pinggy
|
|
1265
|
+
*/
|
|
1266
|
+
declare function getPinggyConfigDir(): string;
|
|
1267
|
+
/**
|
|
1268
|
+
* Returns the directory where tunnel config files are stored.
|
|
1269
|
+
*/
|
|
1270
|
+
declare function getTunnelConfigDir(): string;
|
|
1271
|
+
/**
|
|
1272
|
+
* Ensures the tunnel config directory exists, creating it recursively if needed.
|
|
1273
|
+
*/
|
|
1274
|
+
declare function ensureTunnelConfigDir(): string;
|
|
1275
|
+
/**
|
|
1276
|
+
* Returns the path to the daemon info file (daemon.json).
|
|
1277
|
+
* Contains port + PID so the foreground CLI can find the running daemon.
|
|
1278
|
+
*/
|
|
1279
|
+
declare function getDaemonInfoPath(): string;
|
|
1280
|
+
|
|
1281
|
+
export { type AdditionalForwarding, type DisconnectListener, type ErrorListener, type FinalConfig, type ITunnelManager, type ManagedTunnel, type ReconnectingListener, type ReconnectionCompletedListener, type ReconnectionFailedListener, RemoteManagementUnauthorizedError, type SavedTunnelConfig, type StartListener, type StatsListener, type Status, type StorageLogger, TUNNEL_CONFIG_V1_KEYS, TunnelClient, type TunnelConfigV1, TunnelConfigV1Schema, TunnelErrorCodeType, type TunnelList, TunnelManager, TunnelOperations, type TunnelResponse, TunnelStateType, type TunnelStatus, TunnelWarningCode, type TunnelWorkerErrorListner, type Warning, type WillReconnectListener, bulkReplace, closeRemoteManagement, configureStorageLogger, deleteConfig, enablePackageLogging, ensureTunnelConfigDir, findConfig, findConfigByName, getAutoStartConfigs, getDaemonInfoPath, getPinggyConfigDir, getRemoteManagementState, getTunnelConfigDir, initiateRemoteManagement, listSavedConfigs, loadConfigByName, sanitizeName, saveConfig, startRemoteManagement, updateConfigAutoStart, updateTunnelConfig, upsertConfig, validateName, validateNameForStorage, validateNameStrict };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { TunnelConfigurationV1, TunnelUsageType, TunnelInstance, TunnelType, RemoteManagementConfig } from '@pinggy/pinggy';
|
|
3
|
+
export { TunnelConfigurationV1 } from '@pinggy/pinggy';
|
|
3
4
|
import { Worker } from 'node:worker_threads';
|
|
4
5
|
import { z } from 'zod';
|
|
5
6
|
import winston from 'winston';
|
|
@@ -556,6 +557,9 @@ declare const TunnelConfigV1Schema: z.ZodObject<{
|
|
|
556
557
|
version: z.ZodString;
|
|
557
558
|
name: z.ZodString;
|
|
558
559
|
configId: z.ZodString;
|
|
560
|
+
hostKeyCheck: z.ZodOptional<z.ZodBoolean>;
|
|
561
|
+
platformValue: z.ZodOptional<z.ZodString>;
|
|
562
|
+
isQRCode: z.ZodOptional<z.ZodBoolean>;
|
|
559
563
|
serverAddress: z.ZodOptional<z.ZodString>;
|
|
560
564
|
token: z.ZodOptional<z.ZodString>;
|
|
561
565
|
autoReconnect: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -595,10 +599,21 @@ declare const TunnelConfigV1Schema: z.ZodObject<{
|
|
|
595
599
|
httpsOnly: z.ZodOptional<z.ZodBoolean>;
|
|
596
600
|
originalRequestUrl: z.ZodOptional<z.ZodBoolean>;
|
|
597
601
|
allowPreflight: z.ZodOptional<z.ZodBoolean>;
|
|
598
|
-
|
|
599
|
-
|
|
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>>>;
|
|
600
614
|
}, z.core.$strip>;
|
|
601
615
|
type TunnelConfigV1 = z.infer<typeof TunnelConfigV1Schema>;
|
|
616
|
+
declare const TUNNEL_CONFIG_V1_KEYS: (keyof TunnelConfigV1)[];
|
|
602
617
|
|
|
603
618
|
/**
|
|
604
619
|
* Typed IPC route contract shared by IPCClient (caller) and IPCServer (handler).
|
|
@@ -1124,4 +1139,143 @@ declare function closeRemoteManagement(timeoutMs?: number): Promise<RemoteManage
|
|
|
1124
1139
|
declare function startRemoteManagement(remoteManagementConfig: RemoteManagementConfig, tunnelHandler?: TunnelHandler): Promise<RemoteManagementState>;
|
|
1125
1140
|
declare function getRemoteManagementState(): RemoteManagementState;
|
|
1126
1141
|
|
|
1127
|
-
|
|
1142
|
+
interface SavedTunnelConfig {
|
|
1143
|
+
name: string;
|
|
1144
|
+
configId: string;
|
|
1145
|
+
autoStart: boolean;
|
|
1146
|
+
createdAt: string;
|
|
1147
|
+
updatedAt: string;
|
|
1148
|
+
tunnelConfig: TunnelConfigurationV1;
|
|
1149
|
+
/**
|
|
1150
|
+
* App-owned UI state (e.g. `regioncode`, `isServerAddress`). The CLI
|
|
1151
|
+
* and daemon never read this;
|
|
1152
|
+
*/
|
|
1153
|
+
uiMetadata?: Record<string, unknown>;
|
|
1154
|
+
}
|
|
1155
|
+
/**
|
|
1156
|
+
* Minimal logger interface for the storage module. Defaults to the cli-js
|
|
1157
|
+
* winston logger (silent unless the CLI configures it). Non-CLI consumers
|
|
1158
|
+
* (e.g. the Electron app) override it via {@link configureStorageLogger} to
|
|
1159
|
+
* route storage logs into their own logging pipeline
|
|
1160
|
+
*/
|
|
1161
|
+
interface StorageLogger {
|
|
1162
|
+
info: (message: string, ...meta: unknown[]) => void;
|
|
1163
|
+
warn: (message: string, ...meta: unknown[]) => void;
|
|
1164
|
+
error: (message: string, ...meta: unknown[]) => void;
|
|
1165
|
+
}
|
|
1166
|
+
declare function configureStorageLogger(l: StorageLogger): void;
|
|
1167
|
+
/**
|
|
1168
|
+
* Sanitizes a tunnel name to be filesystem-safe.
|
|
1169
|
+
* Allows alphanumeric, hyphens, underscores only.
|
|
1170
|
+
*/
|
|
1171
|
+
declare function sanitizeName(name: string): string;
|
|
1172
|
+
/**
|
|
1173
|
+
* Strict name validation used by the CLI's own save path: alphanumeric +
|
|
1174
|
+
* `_`/`-`, ≤128 chars, no reserved subcommand names.
|
|
1175
|
+
*/
|
|
1176
|
+
declare function validateNameStrict(name: string): Error | null;
|
|
1177
|
+
/**
|
|
1178
|
+
* Relaxed name validation used by app-driven writes (`{ strict: false }`). The
|
|
1179
|
+
* app allows spaces/unicode in display names, so this only rejects what would
|
|
1180
|
+
* break the filesystem layout or collide with a CLI subcommand: path
|
|
1181
|
+
* separators, NUL/control characters, empty/whitespace-only names, and reserved
|
|
1182
|
+
* subcommand names. The JSON `name` keeps the original; the filename is always
|
|
1183
|
+
* sanitized via {@link sanitizeName}.
|
|
1184
|
+
*/
|
|
1185
|
+
declare function validateNameForStorage(name: string): Error | null;
|
|
1186
|
+
/**
|
|
1187
|
+
* Backwards-compatible alias for {@link validateNameStrict}. Existing CLI
|
|
1188
|
+
* callers (`subcommands.ts`, `buildAndStartTunnel.ts`) import `validateName`.
|
|
1189
|
+
*/
|
|
1190
|
+
declare const validateName: typeof validateNameStrict;
|
|
1191
|
+
/**
|
|
1192
|
+
* List all saved tunnel configs from the config directory.
|
|
1193
|
+
*/
|
|
1194
|
+
declare function listSavedConfigs(): SavedTunnelConfig[];
|
|
1195
|
+
/**
|
|
1196
|
+
* Find a config by its exact display name (the JSON `name`). Exact on purpose:
|
|
1197
|
+
* `sanitizeName` is many-to-one (`"My Tunnel"`/`"My_Tunnel"` → `My_Tunnel`), so
|
|
1198
|
+
* it builds filenames, never decides identity. Narrows by sanitized prefix then
|
|
1199
|
+
* confirms the exact `name`; on a same-name/different-`configId` tie, newest wins.
|
|
1200
|
+
*/
|
|
1201
|
+
declare function findConfigByName(name: string): SavedTunnelConfig | null;
|
|
1202
|
+
/**
|
|
1203
|
+
* Find a config by name or configId (supports partial configId match).
|
|
1204
|
+
*/
|
|
1205
|
+
declare function findConfig(nameOrId: string): SavedTunnelConfig | null;
|
|
1206
|
+
/**
|
|
1207
|
+
* Save a tunnel config to the config store.
|
|
1208
|
+
* Rejects duplicate names.
|
|
1209
|
+
*
|
|
1210
|
+
* @param options.strict When `true` (default) names are validated with
|
|
1211
|
+
* {@link validateNameStrict}; when `false` (app-driven writes) with the
|
|
1212
|
+
* relaxed {@link validateNameForStorage}.
|
|
1213
|
+
*/
|
|
1214
|
+
declare function saveConfig(name: string, configId: string, tunnelConfig: TunnelConfigurationV1, autoStart?: boolean, options?: {
|
|
1215
|
+
strict?: boolean;
|
|
1216
|
+
}): SavedTunnelConfig;
|
|
1217
|
+
/**
|
|
1218
|
+
* Insert or update a full saved record, keyed by `configId` (the stable
|
|
1219
|
+
* identity). If a record with the same `configId` exists under a different
|
|
1220
|
+
* filename — because its `name` changed — the old file is deleted before the
|
|
1221
|
+
* new one is written, so there is never a stale duplicate on disk. Only
|
|
1222
|
+
* validates the name when creating a brand-new record;
|
|
1223
|
+
*/
|
|
1224
|
+
declare function upsertConfig(saved: SavedTunnelConfig, options?: {
|
|
1225
|
+
strict?: boolean;
|
|
1226
|
+
}): SavedTunnelConfig;
|
|
1227
|
+
/**
|
|
1228
|
+
* Replace a *bounded* set of configs in one pass. Every config in `configs` is
|
|
1229
|
+
* upserted;
|
|
1230
|
+
*/
|
|
1231
|
+
declare function bulkReplace(configs: SavedTunnelConfig[], knownConfigIds: Set<string>, options?: {
|
|
1232
|
+
strict?: boolean;
|
|
1233
|
+
}): {
|
|
1234
|
+
written: string[];
|
|
1235
|
+
deleted: string[];
|
|
1236
|
+
};
|
|
1237
|
+
/**
|
|
1238
|
+
* Load a saved tunnel config by name.
|
|
1239
|
+
*/
|
|
1240
|
+
declare function loadConfigByName(name: string): SavedTunnelConfig | null;
|
|
1241
|
+
/**
|
|
1242
|
+
* Delete a saved tunnel config by name or configId.
|
|
1243
|
+
* Returns the deleted config's name if found, null otherwise.
|
|
1244
|
+
*/
|
|
1245
|
+
declare function deleteConfig(nameOrId: string): string | null;
|
|
1246
|
+
/**
|
|
1247
|
+
* Update the autoStart flag on a saved config.
|
|
1248
|
+
* Returns the updated config, or null if not found.
|
|
1249
|
+
*/
|
|
1250
|
+
declare function updateConfigAutoStart(nameOrId: string, autoStart: boolean): SavedTunnelConfig | null;
|
|
1251
|
+
/**
|
|
1252
|
+
* Update the tunnel configuration of a saved config.
|
|
1253
|
+
* Returns the updated config, or null if not found.
|
|
1254
|
+
*/
|
|
1255
|
+
declare function updateTunnelConfig(nameOrId: string, tunnelConfig: TunnelConfigurationV1): SavedTunnelConfig | null;
|
|
1256
|
+
/**
|
|
1257
|
+
* Get all configs marked for auto-start.
|
|
1258
|
+
*/
|
|
1259
|
+
declare function getAutoStartConfigs(): SavedTunnelConfig[];
|
|
1260
|
+
|
|
1261
|
+
/**
|
|
1262
|
+
* Returns the base Pinggy config directory for the current platform.
|
|
1263
|
+
* - Linux/macOS: $XDG_CONFIG_HOME/pinggy or ~/.config/pinggy
|
|
1264
|
+
* - Windows: %APPDATA%/pinggy
|
|
1265
|
+
*/
|
|
1266
|
+
declare function getPinggyConfigDir(): string;
|
|
1267
|
+
/**
|
|
1268
|
+
* Returns the directory where tunnel config files are stored.
|
|
1269
|
+
*/
|
|
1270
|
+
declare function getTunnelConfigDir(): string;
|
|
1271
|
+
/**
|
|
1272
|
+
* Ensures the tunnel config directory exists, creating it recursively if needed.
|
|
1273
|
+
*/
|
|
1274
|
+
declare function ensureTunnelConfigDir(): string;
|
|
1275
|
+
/**
|
|
1276
|
+
* Returns the path to the daemon info file (daemon.json).
|
|
1277
|
+
* Contains port + PID so the foreground CLI can find the running daemon.
|
|
1278
|
+
*/
|
|
1279
|
+
declare function getDaemonInfoPath(): string;
|
|
1280
|
+
|
|
1281
|
+
export { type AdditionalForwarding, type DisconnectListener, type ErrorListener, type FinalConfig, type ITunnelManager, type ManagedTunnel, type ReconnectingListener, type ReconnectionCompletedListener, type ReconnectionFailedListener, RemoteManagementUnauthorizedError, type SavedTunnelConfig, type StartListener, type StatsListener, type Status, type StorageLogger, TUNNEL_CONFIG_V1_KEYS, TunnelClient, type TunnelConfigV1, TunnelConfigV1Schema, TunnelErrorCodeType, type TunnelList, TunnelManager, TunnelOperations, type TunnelResponse, TunnelStateType, type TunnelStatus, TunnelWarningCode, type TunnelWorkerErrorListner, type Warning, type WillReconnectListener, bulkReplace, closeRemoteManagement, configureStorageLogger, deleteConfig, enablePackageLogging, ensureTunnelConfigDir, findConfig, findConfigByName, getAutoStartConfigs, getDaemonInfoPath, getPinggyConfigDir, getRemoteManagementState, getTunnelConfigDir, initiateRemoteManagement, listSavedConfigs, loadConfigByName, sanitizeName, saveConfig, startRemoteManagement, updateConfigAutoStart, updateTunnelConfig, upsertConfig, validateName, validateNameForStorage, validateNameStrict };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
RemoteManagementUnauthorizedError,
|
|
4
|
+
TUNNEL_CONFIG_V1_KEYS,
|
|
4
5
|
TunnelClient,
|
|
6
|
+
TunnelConfigV1Schema,
|
|
5
7
|
TunnelErrorCodeType,
|
|
6
8
|
TunnelOperations,
|
|
7
9
|
TunnelStateType,
|
|
@@ -10,8 +12,26 @@ import {
|
|
|
10
12
|
getRemoteManagementState,
|
|
11
13
|
initiateRemoteManagement,
|
|
12
14
|
startRemoteManagement
|
|
13
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-C3ZMLIC4.js";
|
|
14
16
|
import "./chunk-BFARGPGP.js";
|
|
17
|
+
import {
|
|
18
|
+
bulkReplace,
|
|
19
|
+
configureStorageLogger,
|
|
20
|
+
deleteConfig,
|
|
21
|
+
findConfig,
|
|
22
|
+
findConfigByName,
|
|
23
|
+
getAutoStartConfigs,
|
|
24
|
+
listSavedConfigs,
|
|
25
|
+
loadConfigByName,
|
|
26
|
+
sanitizeName,
|
|
27
|
+
saveConfig,
|
|
28
|
+
updateConfigAutoStart,
|
|
29
|
+
updateTunnelConfig,
|
|
30
|
+
upsertConfig,
|
|
31
|
+
validateName,
|
|
32
|
+
validateNameForStorage,
|
|
33
|
+
validateNameStrict
|
|
34
|
+
} from "./chunk-WM7I57AA.js";
|
|
15
35
|
import {
|
|
16
36
|
TunnelManager,
|
|
17
37
|
printer_default
|
|
@@ -20,7 +40,12 @@ import "./chunk-UB26QJ4T.js";
|
|
|
20
40
|
import {
|
|
21
41
|
enablePackageLogging
|
|
22
42
|
} from "./chunk-7G6SJEEA.js";
|
|
23
|
-
import
|
|
43
|
+
import {
|
|
44
|
+
ensureTunnelConfigDir,
|
|
45
|
+
getDaemonInfoPath,
|
|
46
|
+
getPinggyConfigDir,
|
|
47
|
+
getTunnelConfigDir
|
|
48
|
+
} from "./chunk-GBYF2H4H.js";
|
|
24
49
|
|
|
25
50
|
// src/utils/detect_vc_redist_on_windows.ts
|
|
26
51
|
import fs from "fs";
|
|
@@ -112,22 +137,44 @@ async function verifyAndLoad() {
|
|
|
112
137
|
process.exit(1);
|
|
113
138
|
}
|
|
114
139
|
}
|
|
115
|
-
await import("./main-
|
|
140
|
+
await import("./main-K6ZEWZQ7.js");
|
|
116
141
|
}
|
|
117
142
|
verifyAndLoad().catch((err) => {
|
|
118
143
|
printer_default.fatal(`Failed to start CLI:, ${err}`);
|
|
119
144
|
});
|
|
120
145
|
export {
|
|
121
146
|
RemoteManagementUnauthorizedError,
|
|
147
|
+
TUNNEL_CONFIG_V1_KEYS,
|
|
122
148
|
TunnelClient,
|
|
149
|
+
TunnelConfigV1Schema,
|
|
123
150
|
TunnelErrorCodeType,
|
|
124
151
|
TunnelManager,
|
|
125
152
|
TunnelOperations,
|
|
126
153
|
TunnelStateType,
|
|
127
154
|
TunnelWarningCode,
|
|
155
|
+
bulkReplace,
|
|
128
156
|
closeRemoteManagement,
|
|
157
|
+
configureStorageLogger,
|
|
158
|
+
deleteConfig,
|
|
129
159
|
enablePackageLogging,
|
|
160
|
+
ensureTunnelConfigDir,
|
|
161
|
+
findConfig,
|
|
162
|
+
findConfigByName,
|
|
163
|
+
getAutoStartConfigs,
|
|
164
|
+
getDaemonInfoPath,
|
|
165
|
+
getPinggyConfigDir,
|
|
130
166
|
getRemoteManagementState,
|
|
167
|
+
getTunnelConfigDir,
|
|
131
168
|
initiateRemoteManagement,
|
|
132
|
-
|
|
169
|
+
listSavedConfigs,
|
|
170
|
+
loadConfigByName,
|
|
171
|
+
sanitizeName,
|
|
172
|
+
saveConfig,
|
|
173
|
+
startRemoteManagement,
|
|
174
|
+
updateConfigAutoStart,
|
|
175
|
+
updateTunnelConfig,
|
|
176
|
+
upsertConfig,
|
|
177
|
+
validateName,
|
|
178
|
+
validateNameForStorage,
|
|
179
|
+
validateNameStrict
|
|
133
180
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
runDaemonChild
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-LFK74BMU.js";
|
|
5
5
|
import {
|
|
6
6
|
RemoteManagementUnauthorizedError,
|
|
7
7
|
TunnelOperations,
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
getRemoteManagementState,
|
|
14
14
|
initiateRemoteManagement,
|
|
15
15
|
isDaemonRunning
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-C3ZMLIC4.js";
|
|
17
17
|
import "./chunk-MT44NAXX.js";
|
|
18
18
|
import "./chunk-BFARGPGP.js";
|
|
19
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-WM7I57AA.js";
|
|
20
20
|
import {
|
|
21
21
|
TunnelManager
|
|
22
22
|
} from "./chunk-DLNUDW6G.js";
|