@caleb-collar/steamcmd 1.0.0-alpha.1 → 1.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.
@@ -0,0 +1,263 @@
1
+ /**
2
+ * @module steamcmd
3
+ * @description Node.js wrapper for SteamCMD - download, install, and manage Steam applications
4
+ * @author Björn Dahlgren
5
+ * @license MIT
6
+ * @see https://github.com/dahlgren/node-steamcmd
7
+ */
8
+ import { EventEmitter } from 'node:events';
9
+ import { type DownloadEmitter, DownloadError, type DownloadOptions, type DownloadProgress, downloadWithProgress } from './download.js';
10
+ import { type InstallEmitter, InstallError, type InstallOptions, type InstallProgress, installWithProgress, type SteamPlatform } from './install.js';
11
+ /**
12
+ * Custom error class for SteamCMD operations
13
+ */
14
+ export declare class SteamCmdError extends Error {
15
+ name: "SteamCmdError";
16
+ code: string;
17
+ cause?: Error;
18
+ constructor(message: string, code: string, cause?: Error);
19
+ }
20
+ /**
21
+ * Options for getInstalledApps() function
22
+ */
23
+ export interface GetInstalledAppsOptions {
24
+ /** Installation directory to scan */
25
+ path: string;
26
+ }
27
+ /**
28
+ * Information about an installed Steam application
29
+ */
30
+ export interface InstalledApp {
31
+ /** Steam application ID */
32
+ appId: number;
33
+ /** Application name */
34
+ name: string;
35
+ /** Installation directory name */
36
+ installDir: string | null;
37
+ /** Size on disk in bytes */
38
+ sizeOnDisk: number;
39
+ /** Build ID (version) */
40
+ buildId: number;
41
+ /** Last update timestamp */
42
+ lastUpdated: Date | null;
43
+ /** State flags */
44
+ state: number;
45
+ }
46
+ /**
47
+ * Options for update() function
48
+ */
49
+ export interface UpdateOptions {
50
+ /** Steam application ID to update */
51
+ applicationId: number | string;
52
+ /** Installation directory path */
53
+ path?: string;
54
+ /** Steam username for authentication */
55
+ username?: string;
56
+ /** Steam password for authentication */
57
+ password?: string;
58
+ /** Steam Guard code for two-factor authentication */
59
+ steamGuardCode?: string;
60
+ /** Target platform for download */
61
+ platform?: SteamPlatform;
62
+ /** Progress callback */
63
+ onProgress?: (progress: InstallProgress) => void;
64
+ /** Output callback */
65
+ onOutput?: (data: string, type: 'stdout' | 'stderr') => void;
66
+ }
67
+ /**
68
+ * Options for validate() function
69
+ */
70
+ export interface ValidateOptions {
71
+ /** Steam application ID to validate */
72
+ applicationId: number | string;
73
+ /** Installation directory path */
74
+ path?: string;
75
+ /** Steam username for authentication */
76
+ username?: string;
77
+ /** Steam password for authentication */
78
+ password?: string;
79
+ /** Steam Guard code for two-factor authentication */
80
+ steamGuardCode?: string;
81
+ /** Progress callback */
82
+ onProgress?: (progress: InstallProgress) => void;
83
+ /** Output callback */
84
+ onOutput?: (data: string, type: 'stdout' | 'stderr') => void;
85
+ }
86
+ /**
87
+ * Options for getInstalledVersion() function
88
+ */
89
+ export interface GetInstalledVersionOptions {
90
+ /** Steam application ID */
91
+ applicationId: number | string;
92
+ /** Installation directory path */
93
+ path: string;
94
+ }
95
+ /**
96
+ * Version information for an installed application
97
+ */
98
+ export interface InstalledVersion {
99
+ /** Steam application ID */
100
+ appId: number;
101
+ /** Application name */
102
+ name: string;
103
+ /** Build ID (version) */
104
+ buildId: number;
105
+ /** Last update timestamp */
106
+ lastUpdated: Date | null;
107
+ }
108
+ /**
109
+ * Information about the SteamCMD installation
110
+ */
111
+ export interface SteamCmdInfo {
112
+ /** Directory where SteamCMD is installed */
113
+ directory: string;
114
+ /** Path to the SteamCMD executable, or null if unsupported platform */
115
+ executable: string | null;
116
+ /** Current platform identifier */
117
+ platform: NodeJS.Platform;
118
+ /** Whether the current platform is supported */
119
+ isSupported: boolean;
120
+ }
121
+ /**
122
+ * Callback function type for install operations
123
+ */
124
+ export type InstallCallback = (error: Error | null) => void;
125
+ /**
126
+ * Operation type for createProgressEmitter
127
+ */
128
+ export type OperationType = 'install' | 'update' | 'validate';
129
+ /**
130
+ * EventEmitter for general SteamCMD operations with progress events
131
+ */
132
+ export interface ProgressEmitter extends EventEmitter {
133
+ on(event: 'progress', listener: (progress: InstallProgress | DownloadProgress) => void): this;
134
+ on(event: 'output', listener: (data: string, type: 'stdout' | 'stderr') => void): this;
135
+ on(event: 'complete', listener: () => void): this;
136
+ on(event: 'error', listener: (error: Error) => void): this;
137
+ once(event: 'progress', listener: (progress: InstallProgress | DownloadProgress) => void): this;
138
+ once(event: 'output', listener: (data: string, type: 'stdout' | 'stderr') => void): this;
139
+ once(event: 'complete', listener: () => void): this;
140
+ once(event: 'error', listener: (error: Error) => void): this;
141
+ emit(event: 'progress', progress: InstallProgress | DownloadProgress): boolean;
142
+ emit(event: 'output', data: string, type: 'stdout' | 'stderr'): boolean;
143
+ emit(event: 'complete'): boolean;
144
+ emit(event: 'error', error: Error): boolean;
145
+ }
146
+ /**
147
+ * Check if SteamCMD is installed and executable
148
+ * @returns True if SteamCMD is available
149
+ */
150
+ export declare function isInstalled(): Promise<boolean>;
151
+ /**
152
+ * Ensure SteamCMD is installed, downloading if necessary
153
+ * @param options Download options
154
+ * @throws {SteamCmdError} If download fails
155
+ */
156
+ export declare function ensureInstalled(options?: DownloadOptions): Promise<void>;
157
+ /**
158
+ * Install a Steam application or Workshop item
159
+ *
160
+ * @param options Installation options
161
+ * @param callback Optional callback. If omitted, returns a Promise.
162
+ * @returns Promise if no callback provided
163
+ *
164
+ * @example
165
+ * // Promise-based usage with progress
166
+ * await steamcmd.install({
167
+ * applicationId: 740,
168
+ * path: './server',
169
+ * onProgress: (p) => console.log(`${p.phase}: ${p.percent}%`)
170
+ * });
171
+ *
172
+ * @example
173
+ * // Callback-based usage (legacy)
174
+ * steamcmd.install({ applicationId: 740 }, (err) => {
175
+ * if (err) console.error(err);
176
+ * });
177
+ */
178
+ export declare function steamCmdInstall(options: InstallOptions, callback?: InstallCallback): Promise<void> | void;
179
+ /**
180
+ * Get information about the SteamCMD installation
181
+ * @returns SteamCMD paths and status
182
+ */
183
+ export declare function getInfo(): SteamCmdInfo;
184
+ /**
185
+ * Get a list of installed Steam applications in a directory
186
+ * @param options Options with path to scan
187
+ * @returns Array of installed app information
188
+ *
189
+ * @example
190
+ * const apps = await steamcmd.getInstalledApps({ path: './server' });
191
+ * // [{ appId: 740, name: 'Counter-Strike Global Offensive - Dedicated Server', ... }]
192
+ */
193
+ export declare function getInstalledApps(options: GetInstalledAppsOptions): Promise<InstalledApp[]>;
194
+ /**
195
+ * Update an installed Steam application
196
+ * @param options Update options
197
+ *
198
+ * @example
199
+ * await steamcmd.update({
200
+ * applicationId: 740,
201
+ * path: './server',
202
+ * onProgress: (p) => console.log(`${p.phase}: ${p.percent}%`)
203
+ * });
204
+ */
205
+ export declare function update(options: UpdateOptions): Promise<void>;
206
+ /**
207
+ * Validate an installed Steam application
208
+ * @param options Validation options
209
+ *
210
+ * @example
211
+ * await steamcmd.validate({
212
+ * applicationId: 740,
213
+ * path: './server'
214
+ * });
215
+ */
216
+ export declare function validate(options: ValidateOptions): Promise<void>;
217
+ /**
218
+ * Get the installed version (build ID) of a Steam application
219
+ * @param options Options with applicationId and path
220
+ * @returns Version information or null if not installed
221
+ *
222
+ * @example
223
+ * const version = await steamcmd.getInstalledVersion({
224
+ * applicationId: 740,
225
+ * path: './server'
226
+ * });
227
+ * // { appId: 740, buildId: 12345678, lastUpdated: Date }
228
+ */
229
+ export declare function getInstalledVersion(options: GetInstalledVersionOptions): Promise<InstalledVersion | null>;
230
+ /**
231
+ * Create an EventEmitter for SteamCMD operations with real-time progress
232
+ * @param _operation Operation type ('install', 'update', 'validate')
233
+ * @param options Operation options
234
+ * @returns Emitter that fires 'progress', 'output', 'error', and 'complete' events
235
+ *
236
+ * @example
237
+ * const emitter = steamcmd.createProgressEmitter('install', { applicationId: 740 });
238
+ * emitter.on('progress', (p) => console.log(`${p.phase}: ${p.percent}%`));
239
+ * emitter.on('output', (data, type) => console.log(`[${type}] ${data}`));
240
+ * emitter.on('complete', () => console.log('Done!'));
241
+ * emitter.on('error', (err) => console.error(err));
242
+ */
243
+ export declare function createProgressEmitter(_operation: OperationType, options: InstallOptions): ProgressEmitter;
244
+ declare const _default: {
245
+ install: typeof steamCmdInstall;
246
+ isInstalled: typeof isInstalled;
247
+ ensureInstalled: typeof ensureInstalled;
248
+ getInfo: typeof getInfo;
249
+ SteamCmdError: typeof SteamCmdError;
250
+ getInstalledApps: typeof getInstalledApps;
251
+ update: typeof update;
252
+ validate: typeof validate;
253
+ getInstalledVersion: typeof getInstalledVersion;
254
+ createProgressEmitter: typeof createProgressEmitter;
255
+ DownloadError: typeof DownloadError;
256
+ InstallError: typeof InstallError;
257
+ downloadWithProgress: typeof downloadWithProgress;
258
+ installWithProgress: typeof installWithProgress;
259
+ };
260
+ export default _default;
261
+ export { steamCmdInstall as install, downloadWithProgress, installWithProgress, DownloadError, InstallError, };
262
+ export type { DownloadOptions, DownloadProgress, DownloadEmitter, InstallOptions, InstallProgress, InstallEmitter, SteamPlatform, };
263
+ //# sourceMappingURL=steamcmd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"steamcmd.d.ts","sourceRoot":"","sources":["../src/steamcmd.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAK1C,OAAiB,EACf,KAAK,eAAe,EACpB,aAAa,EACb,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,oBAAoB,EACrB,MAAM,eAAe,CAAA;AAEtB,OAAgB,EACd,KAAK,cAAc,EACnB,YAAY,EACZ,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,mBAAmB,EACnB,KAAK,aAAa,EACnB,MAAM,cAAc,CAAA;AAMrB;;GAEG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,IAAI,EAAG,eAAe,CAAS;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,KAAK,CAAA;gBAED,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAOzD;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,q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AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,IAAI,CAAC,CAiBf;AAmCD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,cAAc,EACvB,QAAQ,CAAC,EAAE,eAAe,GACzB,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAUtB;AAED;;;GAGG;AACH,wBAAgB,OAAO,IAAI,YAAY,CAOtC;AA0BD;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,YAAY,EAAE,CAAC,CA4CzB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAUlE;AAED;;;;;;;;;GASG;AACH,wBAAsB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAUtE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CA8BlC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,aAAa,EACzB,OAAO,EAAE,cAAc,GACtB,eAAe,CAiCjB;;;;;;;;;;;;;;;;;AAGD,wBAkBC;AAGD,OAAO,EACL,eAAe,IAAI,OAAO,EAC1B,oBAAoB,EACpB,mBAAmB,EACnB,aAAa,EACb,YAAY,GACb,CAAA;AAGD,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,eAAe,EACf,cAAc,EACd,aAAa,GACd,CAAA"}
@@ -0,0 +1,389 @@
1
+ "use strict";
2
+ /**
3
+ * @module steamcmd
4
+ * @description Node.js wrapper for SteamCMD - download, install, and manage Steam applications
5
+ * @author Björn Dahlgren
6
+ * @license MIT
7
+ * @see https://github.com/dahlgren/node-steamcmd
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || (function () {
26
+ var ownKeys = function(o) {
27
+ ownKeys = Object.getOwnPropertyNames || function (o) {
28
+ var ar = [];
29
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
30
+ return ar;
31
+ };
32
+ return ownKeys(o);
33
+ };
34
+ return function (mod) {
35
+ if (mod && mod.__esModule) return mod;
36
+ var result = {};
37
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
38
+ __setModuleDefault(result, mod);
39
+ return result;
40
+ };
41
+ })();
42
+ var __importDefault = (this && this.__importDefault) || function (mod) {
43
+ return (mod && mod.__esModule) ? mod : { "default": mod };
44
+ };
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.InstallError = exports.DownloadError = exports.installWithProgress = exports.downloadWithProgress = exports.SteamCmdError = void 0;
47
+ exports.isInstalled = isInstalled;
48
+ exports.ensureInstalled = ensureInstalled;
49
+ exports.steamCmdInstall = steamCmdInstall;
50
+ exports.install = steamCmdInstall;
51
+ exports.getInfo = getInfo;
52
+ exports.getInstalledApps = getInstalledApps;
53
+ exports.update = update;
54
+ exports.validate = validate;
55
+ exports.getInstalledVersion = getInstalledVersion;
56
+ exports.createProgressEmitter = createProgressEmitter;
57
+ const node_events_1 = require("node:events");
58
+ const node_fs_1 = __importDefault(require("node:fs"));
59
+ const node_path_1 = __importDefault(require("node:path"));
60
+ const node_util_1 = require("node:util");
61
+ const download_js_1 = __importStar(require("./download.js"));
62
+ Object.defineProperty(exports, "DownloadError", { enumerable: true, get: function () { return download_js_1.DownloadError; } });
63
+ Object.defineProperty(exports, "downloadWithProgress", { enumerable: true, get: function () { return download_js_1.downloadWithProgress; } });
64
+ const env = __importStar(require("./env.js"));
65
+ const install_js_1 = __importStar(require("./install.js"));
66
+ Object.defineProperty(exports, "InstallError", { enumerable: true, get: function () { return install_js_1.InstallError; } });
67
+ Object.defineProperty(exports, "installWithProgress", { enumerable: true, get: function () { return install_js_1.installWithProgress; } });
68
+ const access = (0, node_util_1.promisify)(node_fs_1.default.access);
69
+ const readdir = (0, node_util_1.promisify)(node_fs_1.default.readdir);
70
+ const readFile = (0, node_util_1.promisify)(node_fs_1.default.readFile);
71
+ /**
72
+ * Custom error class for SteamCMD operations
73
+ */
74
+ class SteamCmdError extends Error {
75
+ name = 'SteamCmdError';
76
+ code;
77
+ cause;
78
+ constructor(message, code, cause) {
79
+ super(message);
80
+ this.code = code;
81
+ if (cause) {
82
+ this.cause = cause;
83
+ }
84
+ }
85
+ }
86
+ exports.SteamCmdError = SteamCmdError;
87
+ /**
88
+ * Check if SteamCMD is installed and executable
89
+ * @returns True if SteamCMD is available
90
+ */
91
+ async function isInstalled() {
92
+ const executablePath = env.executable();
93
+ if (!executablePath)
94
+ return false;
95
+ try {
96
+ await access(executablePath, node_fs_1.default.constants.X_OK);
97
+ return true;
98
+ }
99
+ catch {
100
+ return false;
101
+ }
102
+ }
103
+ /**
104
+ * Ensure SteamCMD is installed, downloading if necessary
105
+ * @param options Download options
106
+ * @throws {SteamCmdError} If download fails
107
+ */
108
+ async function ensureInstalled(options) {
109
+ const opts = options || {};
110
+ const installed = await isInstalled();
111
+ if (installed)
112
+ return;
113
+ console.log('SteamCMD needs to be installed');
114
+ try {
115
+ await (0, download_js_1.default)({ onProgress: opts.onProgress });
116
+ console.log('SteamCMD was installed');
117
+ }
118
+ catch (err) {
119
+ throw new SteamCmdError('Failed to install SteamCMD', 'INSTALL_FAILED', err instanceof Error ? err : undefined);
120
+ }
121
+ }
122
+ /**
123
+ * Async implementation of install
124
+ * @private
125
+ */
126
+ async function steamCmdInstallAsync(options) {
127
+ // Validate options early
128
+ if (!options || typeof options !== 'object') {
129
+ throw new SteamCmdError('Options must be an object', 'INVALID_OPTIONS');
130
+ }
131
+ // Ensure SteamCMD is installed (pass download progress)
132
+ await ensureInstalled({
133
+ onProgress: options.onProgress,
134
+ });
135
+ // Run installation
136
+ const executablePath = env.executable();
137
+ if (!executablePath) {
138
+ throw new SteamCmdError('Platform not supported', 'UNSUPPORTED_PLATFORM');
139
+ }
140
+ try {
141
+ await (0, install_js_1.default)(executablePath, options);
142
+ }
143
+ catch (err) {
144
+ const message = err instanceof Error ? err.message : String(err);
145
+ throw new SteamCmdError(`Installation failed: ${message}`, 'RUN_FAILED', err instanceof Error ? err : undefined);
146
+ }
147
+ }
148
+ /**
149
+ * Install a Steam application or Workshop item
150
+ *
151
+ * @param options Installation options
152
+ * @param callback Optional callback. If omitted, returns a Promise.
153
+ * @returns Promise if no callback provided
154
+ *
155
+ * @example
156
+ * // Promise-based usage with progress
157
+ * await steamcmd.install({
158
+ * applicationId: 740,
159
+ * path: './server',
160
+ * onProgress: (p) => console.log(`${p.phase}: ${p.percent}%`)
161
+ * });
162
+ *
163
+ * @example
164
+ * // Callback-based usage (legacy)
165
+ * steamcmd.install({ applicationId: 740 }, (err) => {
166
+ * if (err) console.error(err);
167
+ * });
168
+ */
169
+ function steamCmdInstall(options, callback) {
170
+ // Support Promise-based usage
171
+ if (typeof callback !== 'function') {
172
+ return steamCmdInstallAsync(options);
173
+ }
174
+ // Legacy callback-based usage
175
+ steamCmdInstallAsync(options)
176
+ .then(() => callback(null))
177
+ .catch((err) => callback(err));
178
+ }
179
+ /**
180
+ * Get information about the SteamCMD installation
181
+ * @returns SteamCMD paths and status
182
+ */
183
+ function getInfo() {
184
+ return {
185
+ directory: env.directory(),
186
+ executable: env.executable(),
187
+ platform: env.platform(),
188
+ isSupported: env.isPlatformSupported(),
189
+ };
190
+ }
191
+ /**
192
+ * Parse Steam app manifest file (.acf)
193
+ * @param manifestPath Path to the manifest file
194
+ * @returns Parsed manifest data
195
+ * @private
196
+ */
197
+ async function parseAppManifest(manifestPath) {
198
+ const content = await readFile(manifestPath, 'utf8');
199
+ const result = {};
200
+ // Simple VDF parser for app manifests
201
+ const lines = content.split('\n');
202
+ for (const line of lines) {
203
+ const match = line.match(/"(\w+)"\s+"([^"]*)"/);
204
+ if (match?.[1] && match[2] !== undefined) {
205
+ result[match[1]] = match[2];
206
+ }
207
+ }
208
+ return result;
209
+ }
210
+ /**
211
+ * Get a list of installed Steam applications in a directory
212
+ * @param options Options with path to scan
213
+ * @returns Array of installed app information
214
+ *
215
+ * @example
216
+ * const apps = await steamcmd.getInstalledApps({ path: './server' });
217
+ * // [{ appId: 740, name: 'Counter-Strike Global Offensive - Dedicated Server', ... }]
218
+ */
219
+ async function getInstalledApps(options) {
220
+ if (!options || !options.path) {
221
+ throw new SteamCmdError('path option is required', 'INVALID_OPTIONS');
222
+ }
223
+ const steamappsDir = node_path_1.default.join(options.path, 'steamapps');
224
+ const apps = [];
225
+ try {
226
+ await access(steamappsDir, node_fs_1.default.constants.R_OK);
227
+ }
228
+ catch {
229
+ // No steamapps directory, return empty array
230
+ return apps;
231
+ }
232
+ try {
233
+ const files = await readdir(steamappsDir);
234
+ const manifestFiles = files.filter((f) => f.startsWith('appmanifest_') && f.endsWith('.acf'));
235
+ for (const file of manifestFiles) {
236
+ try {
237
+ const manifest = await parseAppManifest(node_path_1.default.join(steamappsDir, file));
238
+ apps.push({
239
+ appId: parseInt(manifest['appid'] || '0', 10),
240
+ name: manifest['name'] || 'Unknown',
241
+ installDir: manifest['installdir'] || null,
242
+ sizeOnDisk: parseInt(manifest['SizeOnDisk'] || '0', 10),
243
+ buildId: parseInt(manifest['buildid'] || '0', 10),
244
+ lastUpdated: manifest['LastUpdated']
245
+ ? new Date(parseInt(manifest['LastUpdated'], 10) * 1000)
246
+ : null,
247
+ state: parseInt(manifest['StateFlags'] || '0', 10),
248
+ });
249
+ }
250
+ catch {
251
+ // Skip invalid manifest files
252
+ }
253
+ }
254
+ }
255
+ catch {
256
+ // Error reading directory
257
+ }
258
+ return apps;
259
+ }
260
+ /**
261
+ * Update an installed Steam application
262
+ * @param options Update options
263
+ *
264
+ * @example
265
+ * await steamcmd.update({
266
+ * applicationId: 740,
267
+ * path: './server',
268
+ * onProgress: (p) => console.log(`${p.phase}: ${p.percent}%`)
269
+ * });
270
+ */
271
+ async function update(options) {
272
+ if (!options || !options.applicationId) {
273
+ throw new SteamCmdError('applicationId option is required', 'INVALID_OPTIONS');
274
+ }
275
+ // update is essentially the same as install - SteamCMD handles both
276
+ return steamCmdInstallAsync(options);
277
+ }
278
+ /**
279
+ * Validate an installed Steam application
280
+ * @param options Validation options
281
+ *
282
+ * @example
283
+ * await steamcmd.validate({
284
+ * applicationId: 740,
285
+ * path: './server'
286
+ * });
287
+ */
288
+ async function validate(options) {
289
+ if (!options || !options.applicationId) {
290
+ throw new SteamCmdError('applicationId option is required', 'INVALID_OPTIONS');
291
+ }
292
+ // validate is the same as install - SteamCMD always validates
293
+ return steamCmdInstallAsync(options);
294
+ }
295
+ /**
296
+ * Get the installed version (build ID) of a Steam application
297
+ * @param options Options with applicationId and path
298
+ * @returns Version information or null if not installed
299
+ *
300
+ * @example
301
+ * const version = await steamcmd.getInstalledVersion({
302
+ * applicationId: 740,
303
+ * path: './server'
304
+ * });
305
+ * // { appId: 740, buildId: 12345678, lastUpdated: Date }
306
+ */
307
+ async function getInstalledVersion(options) {
308
+ if (!options || !options.applicationId || !options.path) {
309
+ throw new SteamCmdError('applicationId and path options are required', 'INVALID_OPTIONS');
310
+ }
311
+ const appId = Number(options.applicationId);
312
+ const manifestPath = node_path_1.default.join(options.path, 'steamapps', `appmanifest_${appId}.acf`);
313
+ try {
314
+ await access(manifestPath, node_fs_1.default.constants.R_OK);
315
+ const manifest = await parseAppManifest(manifestPath);
316
+ return {
317
+ appId: parseInt(manifest['appid'] || '0', 10),
318
+ name: manifest['name'] || 'Unknown',
319
+ buildId: parseInt(manifest['buildid'] || '0', 10),
320
+ lastUpdated: manifest['LastUpdated']
321
+ ? new Date(parseInt(manifest['LastUpdated'], 10) * 1000)
322
+ : null,
323
+ };
324
+ }
325
+ catch {
326
+ return null;
327
+ }
328
+ }
329
+ /**
330
+ * Create an EventEmitter for SteamCMD operations with real-time progress
331
+ * @param _operation Operation type ('install', 'update', 'validate')
332
+ * @param options Operation options
333
+ * @returns Emitter that fires 'progress', 'output', 'error', and 'complete' events
334
+ *
335
+ * @example
336
+ * const emitter = steamcmd.createProgressEmitter('install', { applicationId: 740 });
337
+ * emitter.on('progress', (p) => console.log(`${p.phase}: ${p.percent}%`));
338
+ * emitter.on('output', (data, type) => console.log(`[${type}] ${data}`));
339
+ * emitter.on('complete', () => console.log('Done!'));
340
+ * emitter.on('error', (err) => console.error(err));
341
+ */
342
+ function createProgressEmitter(_operation, options) {
343
+ const emitter = new node_events_1.EventEmitter();
344
+ process.nextTick(async () => {
345
+ try {
346
+ // Ensure SteamCMD is installed first
347
+ await ensureInstalled({
348
+ onProgress: (progress) => emitter.emit('progress', progress),
349
+ });
350
+ // Run the operation
351
+ const executablePath = env.executable();
352
+ if (!executablePath) {
353
+ throw new SteamCmdError('Platform not supported', 'UNSUPPORTED_PLATFORM');
354
+ }
355
+ const operationOptions = {
356
+ ...options,
357
+ onProgress: (progress) => emitter.emit('progress', progress),
358
+ onOutput: (data, type) => emitter.emit('output', data, type),
359
+ };
360
+ await (0, install_js_1.default)(executablePath, operationOptions);
361
+ emitter.emit('complete');
362
+ }
363
+ catch (err) {
364
+ emitter.emit('error', err instanceof Error ? err : new Error(String(err)));
365
+ }
366
+ });
367
+ return emitter;
368
+ }
369
+ // Default export for CommonJS compatibility
370
+ exports.default = {
371
+ install: steamCmdInstall,
372
+ isInstalled,
373
+ ensureInstalled,
374
+ getInfo,
375
+ SteamCmdError,
376
+ // New functions
377
+ getInstalledApps,
378
+ update,
379
+ validate,
380
+ getInstalledVersion,
381
+ createProgressEmitter,
382
+ // Re-export error classes for consumers
383
+ DownloadError: download_js_1.DownloadError,
384
+ InstallError: install_js_1.InstallError,
385
+ // Re-export progress helpers
386
+ downloadWithProgress: download_js_1.downloadWithProgress,
387
+ installWithProgress: install_js_1.installWithProgress,
388
+ };
389
+ //# sourceMappingURL=steamcmd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"steamcmd.js","sourceRoot":"","sources":["../src/steamcmd.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqMH,kCAUC;AAOD,0CAmBC;AAwDD,0CAaC;AAqQoB,kCAAO;AA/P5B,0BAOC;AAmCD,4CA8CC;AAaD,wBAUC;AAYD,4BAUC;AAcD,kDAgCC;AAeD,sDAoCC;AAxhBD,6CAA0C;AAC1C,sDAAwB;AACxB,0DAA4B;AAC5B,yCAAqC;AAErC,6DAMsB;AAyiBpB,8FA7iBA,2BAAa,OA6iBA;AAFb,qGAxiBA,kCAAoB,OAwiBA;AAtiBtB,8CAA+B;AAC/B,2DAOqB;AAiiBnB,6FAtiBA,yBAAY,OAsiBA;AAFZ,oGAjiBA,gCAAmB,OAiiBA;AA7hBrB,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,iBAAE,CAAC,MAAM,CAAC,CAAA;AACnC,MAAM,OAAO,GAAG,IAAA,qBAAS,EAAC,iBAAE,CAAC,OAAO,CAAC,CAAA;AACrC,MAAM,QAAQ,GAAG,IAAA,qBAAS,EAAC,iBAAE,CAAC,QAA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