@walkeros/cli 0.3.1

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.
Files changed (181) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +285 -0
  3. package/dist/__tests__/bundle/bundler-integration.test.d.ts +2 -0
  4. package/dist/__tests__/bundle/bundler-integration.test.d.ts.map +1 -0
  5. package/dist/__tests__/bundle/bundler-integration.test.js +106 -0
  6. package/dist/__tests__/bundle/bundler-integration.test.js.map +1 -0
  7. package/dist/__tests__/bundle/bundler.test.d.ts +2 -0
  8. package/dist/__tests__/bundle/bundler.test.d.ts.map +1 -0
  9. package/dist/__tests__/bundle/bundler.test.js +281 -0
  10. package/dist/__tests__/bundle/bundler.test.js.map +1 -0
  11. package/dist/__tests__/bundle/programmatic.test.d.ts +2 -0
  12. package/dist/__tests__/bundle/programmatic.test.d.ts.map +1 -0
  13. package/dist/__tests__/bundle/programmatic.test.js +118 -0
  14. package/dist/__tests__/bundle/programmatic.test.js.map +1 -0
  15. package/dist/__tests__/bundle/serializer.test.d.ts +2 -0
  16. package/dist/__tests__/bundle/serializer.test.d.ts.map +1 -0
  17. package/dist/__tests__/bundle/serializer.test.js +173 -0
  18. package/dist/__tests__/bundle/serializer.test.js.map +1 -0
  19. package/dist/__tests__/bundle/template-engine.test.d.ts +2 -0
  20. package/dist/__tests__/bundle/template-engine.test.d.ts.map +1 -0
  21. package/dist/__tests__/bundle/template-engine.test.js +107 -0
  22. package/dist/__tests__/bundle/template-engine.test.js.map +1 -0
  23. package/dist/__tests__/cli-e2e.test.d.ts +8 -0
  24. package/dist/__tests__/cli-e2e.test.d.ts.map +1 -0
  25. package/dist/__tests__/cli-e2e.test.js +144 -0
  26. package/dist/__tests__/cli-e2e.test.js.map +1 -0
  27. package/dist/__tests__/cli.test.d.ts +2 -0
  28. package/dist/__tests__/cli.test.d.ts.map +1 -0
  29. package/dist/__tests__/cli.test.js +255 -0
  30. package/dist/__tests__/cli.test.js.map +1 -0
  31. package/dist/__tests__/config-loader.test.d.ts +7 -0
  32. package/dist/__tests__/config-loader.test.d.ts.map +1 -0
  33. package/dist/__tests__/config-loader.test.js +393 -0
  34. package/dist/__tests__/config-loader.test.js.map +1 -0
  35. package/dist/__tests__/core/config.test.d.ts +2 -0
  36. package/dist/__tests__/core/config.test.d.ts.map +1 -0
  37. package/dist/__tests__/core/config.test.js +72 -0
  38. package/dist/__tests__/core/config.test.js.map +1 -0
  39. package/dist/__tests__/core/logger.test.d.ts +2 -0
  40. package/dist/__tests__/core/logger.test.d.ts.map +1 -0
  41. package/dist/__tests__/core/logger.test.js +53 -0
  42. package/dist/__tests__/core/logger.test.js.map +1 -0
  43. package/dist/__tests__/simulate/programmatic.test.d.ts +2 -0
  44. package/dist/__tests__/simulate/programmatic.test.d.ts.map +1 -0
  45. package/dist/__tests__/simulate/programmatic.test.js +51 -0
  46. package/dist/__tests__/simulate/programmatic.test.js.map +1 -0
  47. package/dist/__tests__/simulate/simulator.test.d.ts +2 -0
  48. package/dist/__tests__/simulate/simulator.test.d.ts.map +1 -0
  49. package/dist/__tests__/simulate/simulator.test.js +29 -0
  50. package/dist/__tests__/simulate/simulator.test.js.map +1 -0
  51. package/dist/commands/bundle/bundler.d.ts +14 -0
  52. package/dist/commands/bundle/bundler.d.ts.map +1 -0
  53. package/dist/commands/bundle/bundler.js +372 -0
  54. package/dist/commands/bundle/bundler.js.map +1 -0
  55. package/dist/commands/bundle/index.d.ts +51 -0
  56. package/dist/commands/bundle/index.d.ts.map +1 -0
  57. package/dist/commands/bundle/index.js +200 -0
  58. package/dist/commands/bundle/index.js.map +1 -0
  59. package/dist/commands/bundle/package-manager.d.ts +7 -0
  60. package/dist/commands/bundle/package-manager.d.ts.map +1 -0
  61. package/dist/commands/bundle/package-manager.js +170 -0
  62. package/dist/commands/bundle/package-manager.js.map +1 -0
  63. package/dist/commands/bundle/serializer.d.ts +23 -0
  64. package/dist/commands/bundle/serializer.d.ts.map +1 -0
  65. package/dist/commands/bundle/serializer.js +127 -0
  66. package/dist/commands/bundle/serializer.js.map +1 -0
  67. package/dist/commands/bundle/stats.d.ts +23 -0
  68. package/dist/commands/bundle/stats.d.ts.map +1 -0
  69. package/dist/commands/bundle/stats.js +52 -0
  70. package/dist/commands/bundle/stats.js.map +1 -0
  71. package/dist/commands/bundle/template-engine.d.ts +18 -0
  72. package/dist/commands/bundle/template-engine.d.ts.map +1 -0
  73. package/dist/commands/bundle/template-engine.js +49 -0
  74. package/dist/commands/bundle/template-engine.js.map +1 -0
  75. package/dist/commands/run/__tests__/run.integration.test.d.ts +8 -0
  76. package/dist/commands/run/__tests__/run.integration.test.d.ts.map +1 -0
  77. package/dist/commands/run/__tests__/run.integration.test.js +53 -0
  78. package/dist/commands/run/__tests__/run.integration.test.js.map +1 -0
  79. package/dist/commands/run/__tests__/validators.test.d.ts +2 -0
  80. package/dist/commands/run/__tests__/validators.test.d.ts.map +1 -0
  81. package/dist/commands/run/__tests__/validators.test.js +80 -0
  82. package/dist/commands/run/__tests__/validators.test.js.map +1 -0
  83. package/dist/commands/run/index.d.ts +39 -0
  84. package/dist/commands/run/index.d.ts.map +1 -0
  85. package/dist/commands/run/index.js +251 -0
  86. package/dist/commands/run/index.js.map +1 -0
  87. package/dist/commands/run/types.d.ts +56 -0
  88. package/dist/commands/run/types.d.ts.map +1 -0
  89. package/dist/commands/run/types.js +7 -0
  90. package/dist/commands/run/types.js.map +1 -0
  91. package/dist/commands/run/validators.d.ts +29 -0
  92. package/dist/commands/run/validators.d.ts.map +1 -0
  93. package/dist/commands/run/validators.js +54 -0
  94. package/dist/commands/run/validators.js.map +1 -0
  95. package/dist/commands/simulate/index.d.ts +47 -0
  96. package/dist/commands/simulate/index.d.ts.map +1 -0
  97. package/dist/commands/simulate/index.js +121 -0
  98. package/dist/commands/simulate/index.js.map +1 -0
  99. package/dist/commands/simulate/simulator.d.ts +18 -0
  100. package/dist/commands/simulate/simulator.d.ts.map +1 -0
  101. package/dist/commands/simulate/simulator.js +236 -0
  102. package/dist/commands/simulate/simulator.js.map +1 -0
  103. package/dist/commands/simulate/tracker.d.ts +30 -0
  104. package/dist/commands/simulate/tracker.d.ts.map +1 -0
  105. package/dist/commands/simulate/tracker.js +96 -0
  106. package/dist/commands/simulate/tracker.js.map +1 -0
  107. package/dist/commands/simulate/types.d.ts +18 -0
  108. package/dist/commands/simulate/types.d.ts.map +1 -0
  109. package/dist/commands/simulate/types.js +2 -0
  110. package/dist/commands/simulate/types.js.map +1 -0
  111. package/dist/config/defaults.d.ts +33 -0
  112. package/dist/config/defaults.d.ts.map +1 -0
  113. package/dist/config/defaults.js +73 -0
  114. package/dist/config/defaults.js.map +1 -0
  115. package/dist/config/index.d.ts +14 -0
  116. package/dist/config/index.d.ts.map +1 -0
  117. package/dist/config/index.js +16 -0
  118. package/dist/config/index.js.map +1 -0
  119. package/dist/config/loader.d.ts +74 -0
  120. package/dist/config/loader.d.ts.map +1 -0
  121. package/dist/config/loader.js +136 -0
  122. package/dist/config/loader.js.map +1 -0
  123. package/dist/config/parser.d.ts +64 -0
  124. package/dist/config/parser.d.ts.map +1 -0
  125. package/dist/config/parser.js +137 -0
  126. package/dist/config/parser.js.map +1 -0
  127. package/dist/config/utils.d.ts +38 -0
  128. package/dist/config/utils.d.ts.map +1 -0
  129. package/dist/config/utils.js +66 -0
  130. package/dist/config/utils.js.map +1 -0
  131. package/dist/config/validators.d.ts +23 -0
  132. package/dist/config/validators.d.ts.map +1 -0
  133. package/dist/config/validators.js +45 -0
  134. package/dist/config/validators.js.map +1 -0
  135. package/dist/core/docker.d.ts +42 -0
  136. package/dist/core/docker.d.ts.map +1 -0
  137. package/dist/core/docker.js +114 -0
  138. package/dist/core/docker.js.map +1 -0
  139. package/dist/core/execution.d.ts +33 -0
  140. package/dist/core/execution.d.ts.map +1 -0
  141. package/dist/core/execution.js +57 -0
  142. package/dist/core/execution.js.map +1 -0
  143. package/dist/core/index.d.ts +6 -0
  144. package/dist/core/index.d.ts.map +1 -0
  145. package/dist/core/index.js +6 -0
  146. package/dist/core/index.js.map +1 -0
  147. package/dist/core/logger.d.ts +17 -0
  148. package/dist/core/logger.d.ts.map +1 -0
  149. package/dist/core/logger.js +74 -0
  150. package/dist/core/logger.js.map +1 -0
  151. package/dist/core/output.d.ts +30 -0
  152. package/dist/core/output.d.ts.map +1 -0
  153. package/dist/core/output.js +46 -0
  154. package/dist/core/output.js.map +1 -0
  155. package/dist/core/timer.d.ts +14 -0
  156. package/dist/core/timer.d.ts.map +1 -0
  157. package/dist/core/timer.js +29 -0
  158. package/dist/core/timer.js.map +1 -0
  159. package/dist/index.d.ts +614 -0
  160. package/dist/index.d.ts.map +1 -0
  161. package/dist/index.js +1940 -0
  162. package/dist/index.js.map +1 -0
  163. package/dist/types/bundle.d.ts +251 -0
  164. package/dist/types/bundle.d.ts.map +1 -0
  165. package/dist/types/bundle.js +10 -0
  166. package/dist/types/bundle.js.map +1 -0
  167. package/dist/types/global.d.ts +51 -0
  168. package/dist/types/global.d.ts.map +1 -0
  169. package/dist/types/global.js +30 -0
  170. package/dist/types/global.js.map +1 -0
  171. package/dist/types/index.d.ts +8 -0
  172. package/dist/types/index.d.ts.map +1 -0
  173. package/dist/types/index.js +8 -0
  174. package/dist/types/index.js.map +1 -0
  175. package/dist/types/template.d.ts +108 -0
  176. package/dist/types/template.d.ts.map +1 -0
  177. package/dist/types/template.js +10 -0
  178. package/dist/types/template.js.map +1 -0
  179. package/package.json +59 -0
  180. package/templates/base.hbs +44 -0
  181. package/templates/server.hbs +29 -0
@@ -0,0 +1,614 @@
1
+ import { Flow, Elb } from '@walkeros/core';
2
+ import { BuildOptions as BuildOptions$1 } from 'esbuild';
3
+
4
+ /**
5
+ * CLI Build Configuration
6
+ *
7
+ * Build-time options for the walkerOS CLI bundle generation.
8
+ * Completely separate from Flow.Config (runtime configuration).
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+
13
+ /**
14
+ * Build options for bundle generation.
15
+ *
16
+ * @remarks
17
+ * Contains all CLI-specific build settings including:
18
+ * - Package management (NPM packages to bundle)
19
+ * - Code injection (custom user code)
20
+ * - Output configuration (file paths, formats)
21
+ * - Esbuild settings (minification, source maps, etc.)
22
+ *
23
+ * Completely separate from Flow.Config which handles runtime event processing.
24
+ */
25
+ interface BuildOptions extends Pick<BuildOptions$1, 'format' | 'target' | 'minify' | 'sourcemap' | 'platform' | 'external'> {
26
+ /**
27
+ * NPM packages to bundle.
28
+ *
29
+ * @remarks
30
+ * Maps package name to version and imports configuration.
31
+ * Packages are downloaded from npm and bundled into the output.
32
+ *
33
+ * @example
34
+ * ```json
35
+ * {
36
+ * "@walkeros/core": {
37
+ * "version": "^0.2.0",
38
+ * "imports": ["getId", "tryCatch"]
39
+ * }
40
+ * }
41
+ * ```
42
+ */
43
+ packages: Record<string, {
44
+ version?: string;
45
+ imports?: string[];
46
+ }>;
47
+ /**
48
+ * User code to include in bundle.
49
+ *
50
+ * @remarks
51
+ * Custom JavaScript/TypeScript code that will be included in the bundle.
52
+ * Can reference imported packages and will be executed when bundle loads.
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * "export default () => startFlow({ sources: {...}, destinations: {...} })"
57
+ * ```
58
+ */
59
+ code: string;
60
+ /**
61
+ * Output file path.
62
+ *
63
+ * @remarks
64
+ * Absolute or relative path for the generated bundle.
65
+ * Directory will be created if it doesn't exist.
66
+ *
67
+ * @default "./dist/walker.js" (web) or "./dist/bundle.js" (server)
68
+ *
69
+ * @example
70
+ * "./dist/walker.min.js"
71
+ */
72
+ output: string;
73
+ /**
74
+ * Temporary directory for build artifacts.
75
+ *
76
+ * @remarks
77
+ * Used for:
78
+ * - Downloaded packages
79
+ * - Generated entry points
80
+ * - Intermediate build files
81
+ *
82
+ * Cleaned up after successful build unless shared with simulator.
83
+ *
84
+ * @default ".tmp"
85
+ */
86
+ tempDir?: string;
87
+ /**
88
+ * Custom template file path.
89
+ *
90
+ * @remarks
91
+ * Override the default template (base.hbs or server.hbs).
92
+ * Template receives variables: {{sources}}, {{destinations}}, {{collector}}, {{{CODE}}}
93
+ *
94
+ * @default undefined (uses platform-specific default)
95
+ *
96
+ * @example
97
+ * "./templates/custom.hbs"
98
+ */
99
+ template?: string;
100
+ /**
101
+ * Enable package caching.
102
+ *
103
+ * @remarks
104
+ * When enabled, downloaded packages are cached for faster subsequent builds.
105
+ *
106
+ * @default true
107
+ */
108
+ cache?: boolean;
109
+ /**
110
+ * Global variable name for IIFE bundles.
111
+ *
112
+ * @remarks
113
+ * Only used when format=iife.
114
+ * Creates a global variable on the window object.
115
+ *
116
+ * @default "walkerOS"
117
+ *
118
+ * @example
119
+ * ```json
120
+ * {
121
+ * "format": "iife",
122
+ * "globalName": "myTracker"
123
+ * }
124
+ * ```
125
+ *
126
+ * Results in: `window.myTracker = { ... }`
127
+ */
128
+ globalName?: string;
129
+ /**
130
+ * Minification options.
131
+ *
132
+ * @remarks
133
+ * Fine-tune minification behavior.
134
+ * Only applies when minify=true.
135
+ */
136
+ minifyOptions?: MinifyOptions;
137
+ }
138
+ /**
139
+ * Minification options.
140
+ *
141
+ * @remarks
142
+ * Controls esbuild's minification behavior.
143
+ */
144
+ interface MinifyOptions {
145
+ /**
146
+ * Minify identifiers (variable names).
147
+ *
148
+ * @default true
149
+ */
150
+ identifiers?: boolean;
151
+ /**
152
+ * Minify syntax (shorten code).
153
+ *
154
+ * @default true
155
+ */
156
+ syntax?: boolean;
157
+ /**
158
+ * Minify whitespace.
159
+ *
160
+ * @default true
161
+ */
162
+ whitespace?: boolean;
163
+ /**
164
+ * Keep original function/class names.
165
+ *
166
+ * @remarks
167
+ * Useful for debugging production bundles.
168
+ *
169
+ * @default false
170
+ */
171
+ keepNames?: boolean;
172
+ /**
173
+ * How to handle legal comments.
174
+ *
175
+ * @default "none"
176
+ */
177
+ legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external';
178
+ }
179
+ /**
180
+ * Single environment configuration.
181
+ *
182
+ * @remarks
183
+ * Combines Flow.Config (runtime) with BuildOptions (build-time).
184
+ * This is the structure stored in config files for each environment.
185
+ */
186
+ interface EnvironmentConfig {
187
+ /**
188
+ * Runtime event processing configuration.
189
+ *
190
+ * @remarks
191
+ * Defines sources, destinations, collector settings.
192
+ * From @walkeros/core - platform-agnostic.
193
+ */
194
+ flow: Flow.Config;
195
+ /**
196
+ * Build-time configuration.
197
+ *
198
+ * @remarks
199
+ * Defines how to bundle the flow configuration.
200
+ * CLI-specific settings.
201
+ */
202
+ build: BuildOptions;
203
+ }
204
+ /**
205
+ * Multi-environment setup configuration.
206
+ *
207
+ * @remarks
208
+ * Top-level config file format supporting multiple deployment environments.
209
+ * Each environment has separate flow and build configurations.
210
+ *
211
+ * @example
212
+ * ```json
213
+ * {
214
+ * "version": 1,
215
+ * "variables": {
216
+ * "GA_ID": "G-XXXXXXXXXX"
217
+ * },
218
+ * "environments": {
219
+ * "production": {
220
+ * "flow": { "platform": "web", ... },
221
+ * "build": { "packages": {...}, "output": "./dist/prod.js" }
222
+ * },
223
+ * "staging": {
224
+ * "flow": { "platform": "web", ... },
225
+ * "build": { "packages": {...}, "output": "./dist/staging.js" }
226
+ * }
227
+ * }
228
+ * }
229
+ * ```
230
+ */
231
+ interface Setup {
232
+ /**
233
+ * Configuration schema version.
234
+ */
235
+ version: 1;
236
+ /**
237
+ * JSON Schema reference for IDE validation.
238
+ */
239
+ $schema?: string;
240
+ /**
241
+ * Shared variables for interpolation across all environments.
242
+ */
243
+ variables?: Record<string, string | number | boolean>;
244
+ /**
245
+ * Reusable configuration definitions.
246
+ */
247
+ definitions?: Record<string, unknown>;
248
+ /**
249
+ * Environments with flow and build configurations.
250
+ */
251
+ environments: Record<string, EnvironmentConfig>;
252
+ }
253
+
254
+ /**
255
+ * Global CLI Options
256
+ *
257
+ * Options that apply to all commands.
258
+ */
259
+ /**
260
+ * Global options available across all CLI commands
261
+ */
262
+ interface GlobalOptions {
263
+ /**
264
+ * Execute using local Node.js environment (vs Docker container)
265
+ * @default false (Docker mode)
266
+ */
267
+ local?: boolean;
268
+ /**
269
+ * Show detailed execution logs
270
+ * @default false
271
+ */
272
+ verbose?: boolean;
273
+ /**
274
+ * Suppress all output except errors
275
+ * @default false
276
+ */
277
+ silent?: boolean;
278
+ /**
279
+ * Preview command without executing
280
+ * @default false
281
+ */
282
+ dryRun?: boolean;
283
+ }
284
+
285
+ interface BundleStats {
286
+ totalSize: number;
287
+ packages: {
288
+ name: string;
289
+ size: number;
290
+ }[];
291
+ buildTime: number;
292
+ treeshakingEffective: boolean;
293
+ }
294
+
295
+ interface BundleCommandOptions extends GlobalOptions {
296
+ config: string;
297
+ env?: string;
298
+ all?: boolean;
299
+ stats?: boolean;
300
+ json?: boolean;
301
+ cache?: boolean;
302
+ }
303
+ declare function bundleCommand(options: BundleCommandOptions): Promise<void>;
304
+ /**
305
+ * High-level bundle function for programmatic usage.
306
+ *
307
+ * Handles configuration loading, parsing, and logger creation internally.
308
+ *
309
+ * @param configOrPath - Bundle configuration object or path to config file
310
+ * @param options - Bundle options
311
+ * @param options.silent - Suppress all output (default: false)
312
+ * @param options.verbose - Enable verbose logging (default: false)
313
+ * @param options.stats - Collect and return bundle statistics (default: false)
314
+ * @param options.cache - Enable package caching (default: true)
315
+ * @returns Bundle statistics if stats option is true, otherwise void
316
+ *
317
+ * @example
318
+ * ```typescript
319
+ * // With config object
320
+ * await bundle({
321
+ * platform: 'web',
322
+ * packages: { '@walkeros/collector': { imports: ['startFlow'] } },
323
+ * sources: { browser: { code: 'sourceBrowser' } },
324
+ * destinations: { api: { code: 'destinationApi' } },
325
+ * code: 'export default startFlow({ sources, destinations })',
326
+ * output: './dist/walker.js'
327
+ * });
328
+ *
329
+ * // With config file
330
+ * await bundle('./walker.config.json', { stats: true });
331
+ * ```
332
+ */
333
+ declare function bundle(configOrPath: unknown, options?: {
334
+ silent?: boolean;
335
+ verbose?: boolean;
336
+ stats?: boolean;
337
+ cache?: boolean;
338
+ }): Promise<BundleStats | void>;
339
+
340
+ /**
341
+ * Call Tracker for Simulation
342
+ *
343
+ * Wraps mock environment functions to track API calls.
344
+ * Used with destination-provided examples/env.ts mocks.
345
+ */
346
+ interface ApiCall {
347
+ type: 'call';
348
+ path: string;
349
+ args: unknown[];
350
+ timestamp: number;
351
+ }
352
+
353
+ interface SimulateCommandOptions extends GlobalOptions {
354
+ config: string;
355
+ event?: string;
356
+ json?: boolean;
357
+ }
358
+ interface SimulationResult {
359
+ success: boolean;
360
+ error?: string;
361
+ collector?: unknown;
362
+ elbResult?: Elb.PushResult;
363
+ logs?: unknown[];
364
+ usage?: Record<string, ApiCall[]>;
365
+ duration?: number;
366
+ }
367
+
368
+ /**
369
+ * CLI command handler for simulate command
370
+ */
371
+ declare function simulateCommand(options: SimulateCommandOptions): Promise<void>;
372
+ /**
373
+ * High-level simulate function for programmatic usage.
374
+ *
375
+ * Handles configuration loading internally and returns structured results.
376
+ *
377
+ * @param configOrPath - Bundle configuration object or path to config file
378
+ * @param event - Event object to simulate
379
+ * @param options - Simulation options
380
+ * @param options.silent - Suppress all output (default: false)
381
+ * @param options.verbose - Enable verbose logging (default: false)
382
+ * @param options.json - Format output as JSON (default: false)
383
+ * @returns Simulation result with success status, elb result, and usage data
384
+ *
385
+ * @example
386
+ * ```typescript
387
+ * // With config file
388
+ * const result = await simulate('./walker.config.json', {
389
+ * name: 'page view',
390
+ * data: { title: 'Home Page', path: '/', url: 'https://example.com' }
391
+ * });
392
+ *
393
+ * // With config object
394
+ * const result = await simulate(
395
+ * {
396
+ * platform: 'web',
397
+ * packages: { '@walkeros/collector': { imports: ['startFlow'] } },
398
+ * code: '...',
399
+ * output: './bundle.js'
400
+ * },
401
+ * { name: 'page view' },
402
+ * { silent: true }
403
+ * );
404
+ * ```
405
+ */
406
+ declare function simulate(configOrPath: string | unknown, event: unknown, options?: {
407
+ silent?: boolean;
408
+ verbose?: boolean;
409
+ json?: boolean;
410
+ }): Promise<SimulationResult>;
411
+
412
+ /**
413
+ * Run Command Types
414
+ *
415
+ * Types for running walkerOS flows via CLI using @walkeros/docker as a library
416
+ */
417
+
418
+ /**
419
+ * Run mode - determines which execution mode to use
420
+ */
421
+ type RunMode = 'collect' | 'serve';
422
+ /**
423
+ * CLI command options for `walkeros run`
424
+ */
425
+ interface RunCommandOptions extends GlobalOptions {
426
+ /** Flow configuration file path (.json or pre-built .mjs) */
427
+ config: string;
428
+ /** Server port (overrides flow config) */
429
+ port?: number;
430
+ /** Server host (default: 0.0.0.0) */
431
+ host?: string;
432
+ /** Static directory for serve mode */
433
+ staticDir?: string;
434
+ /** Enable JSON output */
435
+ json?: boolean;
436
+ }
437
+ /**
438
+ * Programmatic run options (subset of CLI options)
439
+ */
440
+ interface RunOptions {
441
+ /** Flow configuration file path (.json or pre-built .mjs) */
442
+ config: string | unknown;
443
+ /** Server port */
444
+ port?: number;
445
+ /** Server host */
446
+ host?: string;
447
+ /** Static directory for serve mode */
448
+ staticDir?: string;
449
+ /** Suppress output */
450
+ silent?: boolean;
451
+ /** Verbose logging */
452
+ verbose?: boolean;
453
+ }
454
+ /**
455
+ * Result from running a flow
456
+ */
457
+ interface RunResult {
458
+ /** Whether the flow ran successfully */
459
+ success: boolean;
460
+ /** Exit code */
461
+ exitCode: number;
462
+ /** Error message if failed */
463
+ error?: string;
464
+ /** Execution duration in milliseconds */
465
+ duration: number;
466
+ }
467
+
468
+ /**
469
+ * Run Command
470
+ *
471
+ * Runs walkerOS flows using @walkeros/docker as a library
472
+ * No Docker daemon required - runs directly in Node.js
473
+ */
474
+
475
+ /**
476
+ * CLI command function for `walkeros run`
477
+ *
478
+ * @param mode - Run mode (collect | serve)
479
+ * @param options - Command options
480
+ */
481
+ declare function runCommand(mode: string, options: RunCommandOptions): Promise<void>;
482
+ /**
483
+ * Programmatic run function
484
+ *
485
+ * @param mode - Run mode (collect | serve)
486
+ * @param options - Run options
487
+ * @returns Run result
488
+ *
489
+ * @example
490
+ * ```typescript
491
+ * // Run with JSON config (bundles automatically)
492
+ * await run('collect', {
493
+ * config: './flow.json',
494
+ * port: 8080
495
+ * });
496
+ *
497
+ * // Run with pre-built bundle
498
+ * await run('collect', {
499
+ * config: './flow.mjs',
500
+ * port: 8080
501
+ * });
502
+ * ```
503
+ */
504
+ declare function run(mode: RunMode, options: RunOptions): Promise<RunResult>;
505
+
506
+ /**
507
+ * Template Configuration Types
508
+ *
509
+ * Type definitions for template processing and serialization.
510
+ * Used by the template engine and serializer.
511
+ *
512
+ * @packageDocumentation
513
+ */
514
+ /**
515
+ * Source or Destination configuration item for templates.
516
+ *
517
+ * @remarks
518
+ * This type is used in template processing where config objects
519
+ * are serialized to JavaScript code.
520
+ */
521
+ interface SourceDestinationItem {
522
+ /**
523
+ * JavaScript code reference (variable name or expression)
524
+ */
525
+ code: string;
526
+ /**
527
+ * Configuration object for the source/destination
528
+ */
529
+ config?: unknown;
530
+ /**
531
+ * Environment-specific variables
532
+ */
533
+ env?: unknown;
534
+ /**
535
+ * Allow additional properties for extensibility
536
+ */
537
+ [key: string]: unknown;
538
+ }
539
+ /**
540
+ * Template variables that can be used in Handlebars templates.
541
+ *
542
+ * @remarks
543
+ * These variables are available in template files for customization.
544
+ */
545
+ interface TemplateVariables {
546
+ /**
547
+ * Serialized sources configuration
548
+ */
549
+ sources: string;
550
+ /**
551
+ * Serialized destinations configuration
552
+ */
553
+ destinations: string;
554
+ /**
555
+ * Serialized collector configuration
556
+ */
557
+ collector: string;
558
+ /**
559
+ * User-provided code to be inserted
560
+ */
561
+ CODE: string;
562
+ /**
563
+ * Build configuration (optional)
564
+ */
565
+ build?: Record<string, unknown>;
566
+ }
567
+ /**
568
+ * Processed template variables after serialization.
569
+ *
570
+ * @remarks
571
+ * Internal type used by the serializer to represent processed configs.
572
+ */
573
+ interface ProcessedTemplateVariables {
574
+ /**
575
+ * Processed sources with serialized configs
576
+ */
577
+ sources?: Record<string, TemplateSource>;
578
+ /**
579
+ * Processed destinations with serialized configs
580
+ */
581
+ destinations?: Record<string, TemplateDestination>;
582
+ /**
583
+ * Processed collector configuration
584
+ */
585
+ collector?: Record<string, unknown> | string;
586
+ /**
587
+ * Allow additional properties
588
+ */
589
+ [key: string]: unknown;
590
+ }
591
+ /**
592
+ * Template source after processing.
593
+ *
594
+ * @internal
595
+ */
596
+ interface TemplateSource {
597
+ code: string;
598
+ config?: unknown | string;
599
+ env?: unknown;
600
+ [key: string]: unknown;
601
+ }
602
+ /**
603
+ * Template destination after processing.
604
+ *
605
+ * @internal
606
+ */
607
+ interface TemplateDestination {
608
+ code: string;
609
+ config?: unknown | string;
610
+ env?: unknown;
611
+ [key: string]: unknown;
612
+ }
613
+
614
+ export { type BuildOptions, type BundleStats, type EnvironmentConfig, type GlobalOptions, type ProcessedTemplateVariables, type RunCommandOptions, type RunMode, type RunOptions, type RunResult, type Setup, type SimulationResult, type SourceDestinationItem, type TemplateDestination, type TemplateSource, type TemplateVariables, bundle, bundleCommand, run, runCommand, simulate, simulateCommand };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAI5C,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,UAAU,EAAE,CAAC;AAItD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAIrC,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC7E,YAAY,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,YAAY,EACV,qBAAqB,EACrB,iBAAiB,EACjB,0BAA0B,EAC1B,cAAc,EACd,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,OAAO,EACP,iBAAiB,EACjB,UAAU,EACV,SAAS,GACV,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}