@walkeros/cli 1.2.0 → 1.3.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.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Flow, Elb } from '@walkeros/core';
2
2
  export { Flow } from '@walkeros/core';
3
3
  import { BuildOptions as BuildOptions$1 } from 'esbuild';
4
+ import { z } from '@walkeros/core/dev';
4
5
 
5
6
  /**
6
7
  * CLI Build Configuration
@@ -162,6 +163,25 @@ interface GlobalOptions {
162
163
  silent?: boolean;
163
164
  }
164
165
 
166
+ /**
167
+ * Input Detector
168
+ *
169
+ * Detects whether CLI input is a config JSON or pre-built bundle.
170
+ * Supports both local files and URLs.
171
+ */
172
+ type Platform$1 = 'web' | 'server';
173
+
174
+ declare function getToken(): string | undefined;
175
+ declare function getAuthHeaders(): Record<string, string>;
176
+ declare function authenticatedFetch(url: string, init?: RequestInit): Promise<Response>;
177
+ declare function resolveBaseUrl(): string;
178
+ declare function requireProjectId(): string;
179
+ interface ApiRequestOptions extends RequestInit {
180
+ responseFormat?: 'json' | 'raw';
181
+ timeout?: number;
182
+ }
183
+ declare function apiRequest(path: string, options?: ApiRequestOptions): Promise<unknown>;
184
+
165
185
  interface BundleStats {
166
186
  totalSize: number;
167
187
  packages: {
@@ -173,7 +193,8 @@ interface BundleStats {
173
193
  }
174
194
 
175
195
  interface BundleCommandOptions {
176
- config: string;
196
+ config?: string;
197
+ output?: string;
177
198
  flow?: string;
178
199
  all?: boolean;
179
200
  stats?: boolean;
@@ -239,7 +260,8 @@ interface ApiCall {
239
260
  }
240
261
 
241
262
  interface SimulateCommandOptions {
242
- config: string;
263
+ config?: string;
264
+ output?: string;
243
265
  event?: string;
244
266
  flow?: string;
245
267
  json?: boolean;
@@ -257,6 +279,36 @@ interface SimulationResult {
257
279
  duration?: number;
258
280
  }
259
281
 
282
+ /**
283
+ * Simulate Command Schemas
284
+ *
285
+ * Zod schemas for simulate command parameter validation.
286
+ */
287
+
288
+ /**
289
+ * Platform schema.
290
+ *
291
+ * @remarks
292
+ * Validates platform type for event simulation.
293
+ */
294
+ declare const PlatformSchema: z.ZodEnum<{
295
+ web: "web";
296
+ server: "server";
297
+ }>;
298
+ type Platform = z.infer<typeof PlatformSchema>;
299
+ /**
300
+ * Simulate options schema.
301
+ *
302
+ * @remarks
303
+ * Options for the programmatic simulate() API.
304
+ */
305
+ declare const SimulateOptionsSchema: z.ZodObject<{
306
+ silent: z.ZodOptional<z.ZodBoolean>;
307
+ verbose: z.ZodOptional<z.ZodBoolean>;
308
+ json: z.ZodOptional<z.ZodBoolean>;
309
+ }, z.core.$strip>;
310
+ type SimulateOptions = z.infer<typeof SimulateOptionsSchema>;
311
+
260
312
  /**
261
313
  * CLI command handler for simulate command
262
314
  */
@@ -295,29 +347,83 @@ declare function simulateCommand(options: SimulateCommandOptions): Promise<void>
295
347
  * );
296
348
  * ```
297
349
  */
298
- declare function simulate(configOrPath: string | unknown, event: unknown, options?: {
299
- silent?: boolean;
300
- verbose?: boolean;
301
- json?: boolean;
350
+ declare function simulate(configOrPath: string | unknown, event: unknown, options?: SimulateOptions & {
351
+ flow?: string;
352
+ platform?: Platform;
302
353
  }): Promise<SimulationResult>;
303
354
 
304
355
  /**
305
356
  * Push command options
306
357
  */
307
358
  interface PushCommandOptions {
308
- config: string;
359
+ config?: string;
309
360
  event: string;
361
+ output?: string;
310
362
  flow?: string;
311
363
  json?: boolean;
312
364
  verbose?: boolean;
313
365
  silent?: boolean;
314
366
  platform?: 'web' | 'server';
315
367
  }
368
+ /**
369
+ * Push execution result
370
+ */
371
+ interface PushResult {
372
+ success: boolean;
373
+ elbResult?: Elb.PushResult;
374
+ duration: number;
375
+ error?: string;
376
+ }
377
+
378
+ /**
379
+ * Push Command Schemas
380
+ *
381
+ * Zod schemas for push command parameter validation.
382
+ */
383
+
384
+ /**
385
+ * Push options schema.
386
+ *
387
+ * @remarks
388
+ * Options for the programmatic push() API.
389
+ */
390
+ declare const PushOptionsSchema: z.ZodObject<{
391
+ silent: z.ZodOptional<z.ZodBoolean>;
392
+ verbose: z.ZodOptional<z.ZodBoolean>;
393
+ json: z.ZodOptional<z.ZodBoolean>;
394
+ }, z.core.$strip>;
395
+ type PushOptions = z.infer<typeof PushOptionsSchema>;
316
396
 
317
397
  /**
318
398
  * CLI command handler for push command
319
399
  */
320
400
  declare function pushCommand(options: PushCommandOptions): Promise<void>;
401
+ /**
402
+ * High-level push function for programmatic usage.
403
+ *
404
+ * WARNING: This makes real API calls to real endpoints.
405
+ * Events will be sent to configured destinations (analytics, CRM, etc.).
406
+ *
407
+ * @param configOrPath - Path to flow configuration file or pre-built bundle
408
+ * @param event - Event object to push
409
+ * @param options - Push options
410
+ * @param options.silent - Suppress all output (default: false)
411
+ * @param options.verbose - Enable verbose logging (default: false)
412
+ * @param options.json - Format output as JSON (default: false)
413
+ * @returns Push result with success status, elb result, and duration
414
+ *
415
+ * @example
416
+ * ```typescript
417
+ * const result = await push('./walker.config.json', {
418
+ * name: 'page view',
419
+ * data: { title: 'Home Page', path: '/', url: 'https://example.com' }
420
+ * });
421
+ * ```
422
+ */
423
+ declare function push(configOrPath: string | unknown, event: unknown, options?: PushOptions & {
424
+ flow?: string;
425
+ platform?: Platform$1;
426
+ }): Promise<PushResult>;
321
427
 
322
428
  /**
323
429
  * Run Command Types
@@ -447,4 +553,53 @@ declare function validate(type: ValidationType, input: unknown, options?: {
447
553
  flow?: string;
448
554
  }): Promise<ValidateResult>;
449
555
 
450
- export { type BuildOptions, type BundleStats, type CLIBuildOptions, type GlobalOptions, type MinifyOptions, type RunCommandOptions, type RunMode, type RunOptions, type RunResult, type SimulationResult, type ValidateResult, type ValidationError, type ValidationType, type ValidationWarning, bundle, bundleCommand, pushCommand, run, runCommand, simulate, simulateCommand, validate };
556
+ declare function listProjects(): Promise<unknown>;
557
+ declare function getProject(options?: {
558
+ projectId?: string;
559
+ }): Promise<unknown>;
560
+ declare function createProject(options: {
561
+ name: string;
562
+ }): Promise<unknown>;
563
+ declare function updateProject(options: {
564
+ projectId?: string;
565
+ name: string;
566
+ }): Promise<unknown>;
567
+ declare function deleteProject(options?: {
568
+ projectId?: string;
569
+ }): Promise<unknown>;
570
+
571
+ declare function whoami(): Promise<unknown>;
572
+
573
+ interface ListFlowsOptions {
574
+ projectId?: string;
575
+ sort?: 'name' | 'updated_at' | 'created_at';
576
+ order?: 'asc' | 'desc';
577
+ includeDeleted?: boolean;
578
+ }
579
+ declare function listFlows(options?: ListFlowsOptions): Promise<unknown>;
580
+ declare function getFlow(options: {
581
+ flowId: string;
582
+ projectId?: string;
583
+ }): Promise<unknown>;
584
+ declare function createFlow(options: {
585
+ name: string;
586
+ content: Record<string, unknown>;
587
+ projectId?: string;
588
+ }): Promise<unknown>;
589
+ declare function updateFlow(options: {
590
+ flowId: string;
591
+ name?: string;
592
+ content?: Record<string, unknown>;
593
+ projectId?: string;
594
+ }): Promise<unknown>;
595
+ declare function deleteFlow(options: {
596
+ flowId: string;
597
+ projectId?: string;
598
+ }): Promise<unknown>;
599
+ declare function duplicateFlow(options: {
600
+ flowId: string;
601
+ name?: string;
602
+ projectId?: string;
603
+ }): Promise<unknown>;
604
+
605
+ export { type ApiRequestOptions, type BuildOptions, type BundleStats, type CLIBuildOptions, type GlobalOptions, type ListFlowsOptions, type MinifyOptions, type PushResult, type RunCommandOptions, type RunMode, type RunOptions, type RunResult, type SimulationResult, type ValidateResult, type ValidationError, type ValidationType, type ValidationWarning, apiRequest, authenticatedFetch, bundle, bundleCommand, createFlow, createProject, deleteFlow, deleteProject, duplicateFlow, getAuthHeaders, getFlow, getProject, getToken, listFlows, listProjects, push, pushCommand, requireProjectId, resolveBaseUrl, run, runCommand, simulate, simulateCommand, updateFlow, updateProject, validate, whoami };