@walkeros/core 0.4.1 → 0.5.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/README.md +45 -8
- package/dist/dev.d.mts +132 -33
- package/dist/dev.d.ts +132 -33
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/index.d.mts +508 -206
- package/dist/index.d.ts +508 -206
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/dev.d.ts
CHANGED
|
@@ -3371,7 +3371,7 @@ declare namespace source {
|
|
|
3371
3371
|
* Mirrors: types/flow.ts
|
|
3372
3372
|
* Purpose: Runtime validation and JSON Schema generation for Flow configurations
|
|
3373
3373
|
*
|
|
3374
|
-
* The Flow system provides unified configuration across all walkerOS
|
|
3374
|
+
* The Flow system provides unified configuration across all walkerOS flows.
|
|
3375
3375
|
* These schemas enable:
|
|
3376
3376
|
* - Runtime validation of config files
|
|
3377
3377
|
* - Clear error messages for configuration issues
|
|
@@ -3389,6 +3389,33 @@ declare namespace source {
|
|
|
3389
3389
|
* Used in Setup.variables and Config.env.
|
|
3390
3390
|
*/
|
|
3391
3391
|
declare const PrimitiveSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
3392
|
+
/**
|
|
3393
|
+
* Variables schema for interpolation.
|
|
3394
|
+
*/
|
|
3395
|
+
declare const VariablesSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
3396
|
+
/**
|
|
3397
|
+
* Definitions schema for reusable configurations.
|
|
3398
|
+
*/
|
|
3399
|
+
declare const DefinitionsSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
3400
|
+
/**
|
|
3401
|
+
* Packages schema for build configuration.
|
|
3402
|
+
*/
|
|
3403
|
+
declare const PackagesSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
3404
|
+
version: z.ZodOptional<z.ZodString>;
|
|
3405
|
+
imports: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
3406
|
+
path: z.ZodOptional<z.ZodString>;
|
|
3407
|
+
}, z.core.$strip>>;
|
|
3408
|
+
/**
|
|
3409
|
+
* Web platform configuration schema.
|
|
3410
|
+
*/
|
|
3411
|
+
declare const WebSchema: z.ZodObject<{
|
|
3412
|
+
windowCollector: z.ZodOptional<z.ZodString>;
|
|
3413
|
+
windowElb: z.ZodOptional<z.ZodString>;
|
|
3414
|
+
}, z.core.$strip>;
|
|
3415
|
+
/**
|
|
3416
|
+
* Server platform configuration schema.
|
|
3417
|
+
*/
|
|
3418
|
+
declare const ServerSchema: z.ZodObject<{}, z.core.$loose>;
|
|
3392
3419
|
/**
|
|
3393
3420
|
* Source reference schema.
|
|
3394
3421
|
*
|
|
@@ -3398,9 +3425,12 @@ declare const PrimitiveSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.
|
|
|
3398
3425
|
*/
|
|
3399
3426
|
declare const SourceReferenceSchema: z.ZodObject<{
|
|
3400
3427
|
package: z.ZodString;
|
|
3428
|
+
code: z.ZodOptional<z.ZodString>;
|
|
3401
3429
|
config: z.ZodOptional<z.ZodUnknown>;
|
|
3402
3430
|
env: z.ZodOptional<z.ZodUnknown>;
|
|
3403
3431
|
primary: z.ZodOptional<z.ZodBoolean>;
|
|
3432
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
3433
|
+
definitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3404
3434
|
}, z.core.$strip>;
|
|
3405
3435
|
/**
|
|
3406
3436
|
* Destination reference schema.
|
|
@@ -3411,66 +3441,96 @@ declare const SourceReferenceSchema: z.ZodObject<{
|
|
|
3411
3441
|
*/
|
|
3412
3442
|
declare const DestinationReferenceSchema: z.ZodObject<{
|
|
3413
3443
|
package: z.ZodString;
|
|
3444
|
+
code: z.ZodOptional<z.ZodString>;
|
|
3414
3445
|
config: z.ZodOptional<z.ZodUnknown>;
|
|
3415
3446
|
env: z.ZodOptional<z.ZodUnknown>;
|
|
3447
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
3448
|
+
definitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3416
3449
|
}, z.core.$strip>;
|
|
3417
3450
|
/**
|
|
3418
|
-
*
|
|
3451
|
+
* Single flow configuration schema.
|
|
3419
3452
|
*
|
|
3420
3453
|
* @remarks
|
|
3421
|
-
* Represents a single deployment
|
|
3422
|
-
*
|
|
3454
|
+
* Represents a single deployment target (e.g., web_prod, server_stage).
|
|
3455
|
+
* Platform is determined by presence of `web` or `server` key.
|
|
3456
|
+
* Exactly one must be present.
|
|
3423
3457
|
*/
|
|
3424
3458
|
declare const ConfigSchema: z.ZodObject<{
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
}
|
|
3459
|
+
web: z.ZodOptional<z.ZodObject<{
|
|
3460
|
+
windowCollector: z.ZodOptional<z.ZodString>;
|
|
3461
|
+
windowElb: z.ZodOptional<z.ZodString>;
|
|
3462
|
+
}, z.core.$strip>>;
|
|
3463
|
+
server: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
3429
3464
|
sources: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
3430
3465
|
package: z.ZodString;
|
|
3466
|
+
code: z.ZodOptional<z.ZodString>;
|
|
3431
3467
|
config: z.ZodOptional<z.ZodUnknown>;
|
|
3432
3468
|
env: z.ZodOptional<z.ZodUnknown>;
|
|
3433
3469
|
primary: z.ZodOptional<z.ZodBoolean>;
|
|
3470
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
3471
|
+
definitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3434
3472
|
}, z.core.$strip>>>;
|
|
3435
3473
|
destinations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
3436
3474
|
package: z.ZodString;
|
|
3475
|
+
code: z.ZodOptional<z.ZodString>;
|
|
3437
3476
|
config: z.ZodOptional<z.ZodUnknown>;
|
|
3438
3477
|
env: z.ZodOptional<z.ZodUnknown>;
|
|
3478
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
3479
|
+
definitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3439
3480
|
}, z.core.$strip>>>;
|
|
3440
3481
|
collector: z.ZodOptional<z.ZodUnknown>;
|
|
3441
|
-
|
|
3442
|
-
|
|
3482
|
+
packages: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
3483
|
+
version: z.ZodOptional<z.ZodString>;
|
|
3484
|
+
imports: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
3485
|
+
path: z.ZodOptional<z.ZodString>;
|
|
3486
|
+
}, z.core.$strip>>>;
|
|
3487
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
3488
|
+
definitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3489
|
+
}, z.core.$strip>;
|
|
3443
3490
|
/**
|
|
3444
3491
|
* Flow setup schema - root configuration.
|
|
3445
3492
|
*
|
|
3446
3493
|
* @remarks
|
|
3447
3494
|
* This is the complete schema for walkeros.config.json files.
|
|
3448
|
-
* Contains multiple named
|
|
3495
|
+
* Contains multiple named flows with shared variables and definitions.
|
|
3449
3496
|
*/
|
|
3450
3497
|
declare const SetupSchema: z.ZodObject<{
|
|
3451
3498
|
version: z.ZodLiteral<1>;
|
|
3452
3499
|
$schema: z.ZodOptional<z.ZodString>;
|
|
3453
3500
|
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
3454
3501
|
definitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
}
|
|
3502
|
+
flows: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
3503
|
+
web: z.ZodOptional<z.ZodObject<{
|
|
3504
|
+
windowCollector: z.ZodOptional<z.ZodString>;
|
|
3505
|
+
windowElb: z.ZodOptional<z.ZodString>;
|
|
3506
|
+
}, z.core.$strip>>;
|
|
3507
|
+
server: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
3460
3508
|
sources: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
3461
3509
|
package: z.ZodString;
|
|
3510
|
+
code: z.ZodOptional<z.ZodString>;
|
|
3462
3511
|
config: z.ZodOptional<z.ZodUnknown>;
|
|
3463
3512
|
env: z.ZodOptional<z.ZodUnknown>;
|
|
3464
3513
|
primary: z.ZodOptional<z.ZodBoolean>;
|
|
3514
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
3515
|
+
definitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3465
3516
|
}, z.core.$strip>>>;
|
|
3466
3517
|
destinations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
3467
3518
|
package: z.ZodString;
|
|
3519
|
+
code: z.ZodOptional<z.ZodString>;
|
|
3468
3520
|
config: z.ZodOptional<z.ZodUnknown>;
|
|
3469
3521
|
env: z.ZodOptional<z.ZodUnknown>;
|
|
3522
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
3523
|
+
definitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3470
3524
|
}, z.core.$strip>>>;
|
|
3471
3525
|
collector: z.ZodOptional<z.ZodUnknown>;
|
|
3472
|
-
|
|
3473
|
-
|
|
3526
|
+
packages: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
3527
|
+
version: z.ZodOptional<z.ZodString>;
|
|
3528
|
+
imports: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
3529
|
+
path: z.ZodOptional<z.ZodString>;
|
|
3530
|
+
}, z.core.$strip>>>;
|
|
3531
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
3532
|
+
definitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3533
|
+
}, z.core.$strip>>;
|
|
3474
3534
|
}, z.core.$strip>;
|
|
3475
3535
|
/**
|
|
3476
3536
|
* Parse and validate Flow.Setup configuration.
|
|
@@ -3486,7 +3546,7 @@ declare const SetupSchema: z.ZodObject<{
|
|
|
3486
3546
|
*
|
|
3487
3547
|
* const raw = JSON.parse(readFileSync('walkeros.config.json', 'utf8'));
|
|
3488
3548
|
* const config = parseSetup(raw);
|
|
3489
|
-
* console.log(`Found ${Object.keys(config.
|
|
3549
|
+
* console.log(`Found ${Object.keys(config.flows).length} flows`);
|
|
3490
3550
|
* ```
|
|
3491
3551
|
*/
|
|
3492
3552
|
declare function parseSetup(data: unknown): z.infer<typeof SetupSchema>;
|
|
@@ -3510,31 +3570,48 @@ declare function parseSetup(data: unknown): z.infer<typeof SetupSchema>;
|
|
|
3510
3570
|
*/
|
|
3511
3571
|
declare function safeParseSetup(data: unknown): z.ZodSafeParseResult<{
|
|
3512
3572
|
version: 1;
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3573
|
+
flows: Record<string, {
|
|
3574
|
+
web?: {
|
|
3575
|
+
windowCollector?: string | undefined;
|
|
3576
|
+
windowElb?: string | undefined;
|
|
3577
|
+
} | undefined;
|
|
3578
|
+
server?: {
|
|
3579
|
+
[x: string]: unknown;
|
|
3580
|
+
} | undefined;
|
|
3516
3581
|
sources?: Record<string, {
|
|
3517
3582
|
package: string;
|
|
3583
|
+
code?: string | undefined;
|
|
3518
3584
|
config?: unknown;
|
|
3519
3585
|
env?: unknown;
|
|
3520
3586
|
primary?: boolean | undefined;
|
|
3587
|
+
variables?: Record<string, string | number | boolean> | undefined;
|
|
3588
|
+
definitions?: Record<string, unknown> | undefined;
|
|
3521
3589
|
}> | undefined;
|
|
3522
3590
|
destinations?: Record<string, {
|
|
3523
3591
|
package: string;
|
|
3592
|
+
code?: string | undefined;
|
|
3524
3593
|
config?: unknown;
|
|
3525
3594
|
env?: unknown;
|
|
3595
|
+
variables?: Record<string, string | number | boolean> | undefined;
|
|
3596
|
+
definitions?: Record<string, unknown> | undefined;
|
|
3526
3597
|
}> | undefined;
|
|
3527
3598
|
collector?: unknown;
|
|
3528
|
-
|
|
3599
|
+
packages?: Record<string, {
|
|
3600
|
+
version?: string | undefined;
|
|
3601
|
+
imports?: string[] | undefined;
|
|
3602
|
+
path?: string | undefined;
|
|
3603
|
+
}> | undefined;
|
|
3604
|
+
variables?: Record<string, string | number | boolean> | undefined;
|
|
3605
|
+
definitions?: Record<string, unknown> | undefined;
|
|
3529
3606
|
}>;
|
|
3530
3607
|
$schema?: string | undefined;
|
|
3531
3608
|
variables?: Record<string, string | number | boolean> | undefined;
|
|
3532
3609
|
definitions?: Record<string, unknown> | undefined;
|
|
3533
3610
|
}>;
|
|
3534
3611
|
/**
|
|
3535
|
-
* Parse and validate Flow.Config (single
|
|
3612
|
+
* Parse and validate Flow.Config (single flow).
|
|
3536
3613
|
*
|
|
3537
|
-
* @param data - Raw JSON data for single
|
|
3614
|
+
* @param data - Raw JSON data for single flow
|
|
3538
3615
|
* @returns Validated Flow.Config object
|
|
3539
3616
|
* @throws ZodError if validation fails
|
|
3540
3617
|
*
|
|
@@ -3542,33 +3619,50 @@ declare function safeParseSetup(data: unknown): z.ZodSafeParseResult<{
|
|
|
3542
3619
|
* ```typescript
|
|
3543
3620
|
* import { parseConfig } from '@walkeros/core/dev';
|
|
3544
3621
|
*
|
|
3545
|
-
* const
|
|
3546
|
-
* console.log(`Platform: ${
|
|
3622
|
+
* const flowConfig = parseConfig(rawFlowData);
|
|
3623
|
+
* console.log(`Platform: ${flowConfig.web ? 'web' : 'server'}`);
|
|
3547
3624
|
* ```
|
|
3548
3625
|
*/
|
|
3549
3626
|
declare function parseConfig(data: unknown): z.infer<typeof ConfigSchema>;
|
|
3550
3627
|
/**
|
|
3551
3628
|
* Safely parse Flow.Config without throwing.
|
|
3552
3629
|
*
|
|
3553
|
-
* @param data - Raw JSON data for single
|
|
3630
|
+
* @param data - Raw JSON data for single flow
|
|
3554
3631
|
* @returns Success result with data or error result with issues
|
|
3555
3632
|
*/
|
|
3556
3633
|
declare function safeParseConfig(data: unknown): z.ZodSafeParseResult<{
|
|
3557
|
-
|
|
3558
|
-
|
|
3634
|
+
web?: {
|
|
3635
|
+
windowCollector?: string | undefined;
|
|
3636
|
+
windowElb?: string | undefined;
|
|
3637
|
+
} | undefined;
|
|
3638
|
+
server?: {
|
|
3639
|
+
[x: string]: unknown;
|
|
3640
|
+
} | undefined;
|
|
3559
3641
|
sources?: Record<string, {
|
|
3560
3642
|
package: string;
|
|
3643
|
+
code?: string | undefined;
|
|
3561
3644
|
config?: unknown;
|
|
3562
3645
|
env?: unknown;
|
|
3563
3646
|
primary?: boolean | undefined;
|
|
3647
|
+
variables?: Record<string, string | number | boolean> | undefined;
|
|
3648
|
+
definitions?: Record<string, unknown> | undefined;
|
|
3564
3649
|
}> | undefined;
|
|
3565
3650
|
destinations?: Record<string, {
|
|
3566
3651
|
package: string;
|
|
3652
|
+
code?: string | undefined;
|
|
3567
3653
|
config?: unknown;
|
|
3568
3654
|
env?: unknown;
|
|
3655
|
+
variables?: Record<string, string | number | boolean> | undefined;
|
|
3656
|
+
definitions?: Record<string, unknown> | undefined;
|
|
3569
3657
|
}> | undefined;
|
|
3570
3658
|
collector?: unknown;
|
|
3571
|
-
|
|
3659
|
+
packages?: Record<string, {
|
|
3660
|
+
version?: string | undefined;
|
|
3661
|
+
imports?: string[] | undefined;
|
|
3662
|
+
path?: string | undefined;
|
|
3663
|
+
}> | undefined;
|
|
3664
|
+
variables?: Record<string, string | number | boolean> | undefined;
|
|
3665
|
+
definitions?: Record<string, unknown> | undefined;
|
|
3572
3666
|
}>;
|
|
3573
3667
|
/**
|
|
3574
3668
|
* Generate JSON Schema for Flow.Setup.
|
|
@@ -3595,7 +3689,7 @@ declare const setupJsonSchema: z.core.JSONSchema.JSONSchema;
|
|
|
3595
3689
|
* Generate JSON Schema for Flow.Config.
|
|
3596
3690
|
*
|
|
3597
3691
|
* @remarks
|
|
3598
|
-
* Used for validating individual
|
|
3692
|
+
* Used for validating individual flow configurations.
|
|
3599
3693
|
*
|
|
3600
3694
|
* @returns JSON Schema (Draft 7) representation of ConfigSchema
|
|
3601
3695
|
*/
|
|
@@ -3620,10 +3714,15 @@ declare const sourceReferenceJsonSchema: z.core.JSONSchema.JSONSchema;
|
|
|
3620
3714
|
declare const destinationReferenceJsonSchema: z.core.JSONSchema.JSONSchema;
|
|
3621
3715
|
|
|
3622
3716
|
declare const flow_ConfigSchema: typeof ConfigSchema;
|
|
3717
|
+
declare const flow_DefinitionsSchema: typeof DefinitionsSchema;
|
|
3623
3718
|
declare const flow_DestinationReferenceSchema: typeof DestinationReferenceSchema;
|
|
3719
|
+
declare const flow_PackagesSchema: typeof PackagesSchema;
|
|
3624
3720
|
declare const flow_PrimitiveSchema: typeof PrimitiveSchema;
|
|
3721
|
+
declare const flow_ServerSchema: typeof ServerSchema;
|
|
3625
3722
|
declare const flow_SetupSchema: typeof SetupSchema;
|
|
3626
3723
|
declare const flow_SourceReferenceSchema: typeof SourceReferenceSchema;
|
|
3724
|
+
declare const flow_VariablesSchema: typeof VariablesSchema;
|
|
3725
|
+
declare const flow_WebSchema: typeof WebSchema;
|
|
3627
3726
|
declare const flow_configJsonSchema: typeof configJsonSchema;
|
|
3628
3727
|
declare const flow_destinationReferenceJsonSchema: typeof destinationReferenceJsonSchema;
|
|
3629
3728
|
declare const flow_parseConfig: typeof parseConfig;
|
|
@@ -3633,7 +3732,7 @@ declare const flow_safeParseSetup: typeof safeParseSetup;
|
|
|
3633
3732
|
declare const flow_setupJsonSchema: typeof setupJsonSchema;
|
|
3634
3733
|
declare const flow_sourceReferenceJsonSchema: typeof sourceReferenceJsonSchema;
|
|
3635
3734
|
declare namespace flow {
|
|
3636
|
-
export { flow_ConfigSchema as ConfigSchema, flow_DestinationReferenceSchema as DestinationReferenceSchema, flow_PrimitiveSchema as PrimitiveSchema, flow_SetupSchema as SetupSchema, flow_SourceReferenceSchema as SourceReferenceSchema, flow_configJsonSchema as configJsonSchema, flow_destinationReferenceJsonSchema as destinationReferenceJsonSchema, flow_parseConfig as parseConfig, flow_parseSetup as parseSetup, flow_safeParseConfig as safeParseConfig, flow_safeParseSetup as safeParseSetup, flow_setupJsonSchema as setupJsonSchema, flow_sourceReferenceJsonSchema as sourceReferenceJsonSchema };
|
|
3735
|
+
export { flow_ConfigSchema as ConfigSchema, flow_DefinitionsSchema as DefinitionsSchema, flow_DestinationReferenceSchema as DestinationReferenceSchema, flow_PackagesSchema as PackagesSchema, flow_PrimitiveSchema as PrimitiveSchema, flow_ServerSchema as ServerSchema, flow_SetupSchema as SetupSchema, flow_SourceReferenceSchema as SourceReferenceSchema, flow_VariablesSchema as VariablesSchema, flow_WebSchema as WebSchema, flow_configJsonSchema as configJsonSchema, flow_destinationReferenceJsonSchema as destinationReferenceJsonSchema, flow_parseConfig as parseConfig, flow_parseSetup as parseSetup, flow_safeParseConfig as safeParseConfig, flow_safeParseSetup as safeParseSetup, flow_setupJsonSchema as setupJsonSchema, flow_sourceReferenceJsonSchema as sourceReferenceJsonSchema };
|
|
3637
3736
|
}
|
|
3638
3737
|
|
|
3639
3738
|
/**
|
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,t=Object.prototype.hasOwnProperty,r=(e,i)=>{for(var o in i)n(e,o,{get:i[o],enumerable:!0})},a={};r(a,{schemas:()=>s,z:()=>c.z,zodToSchema:()=>si}),module.exports=(e=a,((e,r,a,s)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let c of o(r))t.call(e,c)||c===a||n(e,c,{get:()=>r[c],enumerable:!(s=i(r,c))||s.enumerable});return e})(n({},"__esModule",{value:!0}),e));var s={};r(s,{BaseContextConfig:()=>H,BatchConfig:()=>_,CollectorSchemas:()=>mn,ConsentSchema:()=>ie,Counter:()=>g,DeepPartialEventSchema:()=>de,DestinationReferenceSchema:()=>_n,DestinationSchemas:()=>Ne,DestinationsMapConfig:()=>F,DisabledConfig:()=>q,EntitiesSchema:()=>se,EntitySchema:()=>ae,EventSchema:()=>ce,FlowConfigSchema:()=>Gn,FlowSchemas:()=>Wn,GenericEnvConfig:()=>U,GenericSettingsConfig:()=>T,HandlersConfig:()=>x,IdConfig:()=>L,Identifier:()=>m,InitConfig:()=>O,LoopSchema:()=>we,MapSchema:()=>Ce,MappingResultSchema:()=>xe,MappingSchemas:()=>Se,OptionalPrimitiveValue:()=>z,OrderedPropertiesSchema:()=>ee,PartialEventSchema:()=>le,PolicySchema:()=>Pe,PrimaryConfig:()=>M,PrimitiveSchema:()=>An,PrimitiveValue:()=>h,ProcessingControlConfig:()=>G,PropertiesSchema:()=>Z,PropertySchema:()=>Y,PropertyTypeSchema:()=>X,QueueConfig:()=>R,RequiredBoolean:()=>u,RequiredNumber:()=>p,RequiredString:()=>d,RuleSchema:()=>Je,RulesSchema:()=>Ee,RuntimeInstanceConfig:()=>A,SetSchema:()=>ke,SetupSchema:()=>Qn,SourceReferenceSchema:()=>Hn,SourceSchema:()=>re,SourceSchemas:()=>En,SourceTypeSchema:()=>ne,SourcesMapConfig:()=>Q,TaggingVersion:()=>f,Timestamp:()=>b,UserSchema:()=>oe,UtilitySchemas:()=>S,ValueConfigSchema:()=>je,ValueSchema:()=>ve,ValuesSchema:()=>ye,VerboseConfig:()=>I,VersionSchema:()=>te,WalkerOSSchemas:()=>$,configJsonSchema:()=>Zn,consentJsonSchema:()=>ze,createArraySchema:()=>ti,createConsentConfig:()=>W,createDataTransformationConfig:()=>B,createEnumSchema:()=>ri,createMappingRulesConfig:()=>N,createObjectSchema:()=>ii,createPolicyConfig:()=>V,createTupleSchema:()=>ai,destinationReferenceJsonSchema:()=>ni,entityJsonSchema:()=>fe,eventJsonSchema:()=>pe,loopJsonSchema:()=>Le,mapJsonSchema:()=>qe,orderedPropertiesJsonSchema:()=>ge,parseConfig:()=>Kn,parseSetup:()=>Fn,partialEventJsonSchema:()=>ue,policyJsonSchema:()=>Me,propertiesJsonSchema:()=>be,ruleJsonSchema:()=>Te,rulesJsonSchema:()=>Ue,safeParseConfig:()=>Xn,safeParseSetup:()=>$n,setJsonSchema:()=>Oe,setupJsonSchema:()=>Yn,sourceReferenceJsonSchema:()=>ei,sourceTypeJsonSchema:()=>he,userJsonSchema:()=>me,valueConfigJsonSchema:()=>Re,valueJsonSchema:()=>Ie,z:()=>c.z,zodToSchema:()=>si});var c=require("zod");function l(e,n,i="draft-7"){return c.z.toJSONSchema(e,{target:i})}var d=c.z.string(),p=c.z.number(),u=c.z.boolean(),m=c.z.string().min(1),b=c.z.number().int().positive(),g=c.z.number().int().nonnegative(),f=c.z.number().describe("Tagging version number"),h=c.z.union([c.z.string(),c.z.number(),c.z.boolean()]),z=h.optional(),S={};r(S,{ErrorHandlerSchema:()=>w,HandlerSchema:()=>C,LogHandlerSchema:()=>k,StorageSchema:()=>y,StorageTypeSchema:()=>v,errorHandlerJsonSchema:()=>J,handlerJsonSchema:()=>D,logHandlerJsonSchema:()=>E,storageJsonSchema:()=>P,storageTypeJsonSchema:()=>j});var v=c.z.enum(["local","session","cookie"]).describe("Storage mechanism: local, session, or cookie"),y=c.z.object({Local:c.z.literal("local"),Session:c.z.literal("session"),Cookie:c.z.literal("cookie")}).describe("Storage type constants for type-safe references"),w=c.z.any().describe("Error handler function: (error, state?) => void"),k=c.z.any().describe("Log handler function: (message, verbose?) => void"),C=c.z.object({Error:w.describe("Error handler function"),Log:k.describe("Log handler function")}).describe("Handler interface with error and log functions"),j=l(v),P=l(y),J=l(w),E=l(k),D=l(C),x=c.z.object({onError:w.optional().describe("Error handler function: (error, state?) => void"),onLog:k.optional().describe("Log handler function: (message, verbose?) => void")}).partial(),I=c.z.object({verbose:c.z.boolean().describe("Enable verbose logging for debugging").optional()}).partial(),R=c.z.object({queue:c.z.boolean().describe("Whether to queue events when consent is not granted").optional()}).partial(),L=c.z.object({}).partial(),O=c.z.object({init:c.z.boolean().describe("Whether to initialize immediately").optional(),loadScript:c.z.boolean().describe("Whether to load external script (for web destinations)").optional()}).partial(),q=c.z.object({disabled:c.z.boolean().describe("Set to true to disable").optional()}).partial(),M=c.z.object({primary:c.z.boolean().describe("Mark as primary (only one can be primary)").optional()}).partial(),T=c.z.object({settings:c.z.any().optional().describe("Implementation-specific configuration")}).partial(),U=c.z.object({env:c.z.any().optional().describe("Environment dependencies (platform-specific)")}).partial();function B(e,n){return c.z.object({data:c.z.union([e,n]).optional().describe("Data transformation rules")}).partial()}function N(e){return c.z.object({mapping:e.optional().describe("Event mapping rules")}).partial()}function V(e){return c.z.object({policy:e.optional().describe("Pre-processing policy rules")}).partial()}function W(e){return c.z.object({consent:e.optional().describe("Required consent states")}).partial()}var A=c.z.object({type:c.z.string().optional().describe("Instance type identifier"),config:c.z.unknown().describe("Instance configuration")}).partial(),H=c.z.object({collector:c.z.unknown().describe("Collector instance (runtime object)"),config:c.z.unknown().describe("Configuration"),env:c.z.unknown().describe("Environment dependencies")}).partial(),_=c.z.object({batch:c.z.number().optional().describe("Batch size: bundle N events for batch processing"),batched:c.z.unknown().optional().describe("Batch of events to be processed")}).partial(),G=c.z.object({ignore:c.z.boolean().describe("Set to true to skip processing").optional(),condition:c.z.string().optional().describe("Condition function: return true to process")}).partial(),Q=c.z.object({sources:c.z.record(c.z.string(),c.z.unknown()).describe("Map of source instances")}).partial(),F=c.z.object({destinations:c.z.record(c.z.string(),c.z.unknown()).describe("Map of destination instances")}).partial(),$={};r($,{ConsentSchema:()=>ie,DeepPartialEventSchema:()=>de,EntitiesSchema:()=>se,EntitySchema:()=>ae,EventSchema:()=>ce,OrderedPropertiesSchema:()=>ee,PartialEventSchema:()=>le,PropertiesSchema:()=>Z,PropertySchema:()=>Y,PropertyTypeSchema:()=>X,SourceSchema:()=>re,SourceTypeSchema:()=>ne,UserSchema:()=>oe,VersionSchema:()=>te,consentJsonSchema:()=>ze,entityJsonSchema:()=>fe,eventJsonSchema:()=>pe,orderedPropertiesJsonSchema:()=>ge,partialEventJsonSchema:()=>ue,propertiesJsonSchema:()=>be,sourceTypeJsonSchema:()=>he,userJsonSchema:()=>me});var K,X=c.z.lazy(()=>c.z.union([c.z.boolean(),c.z.string(),c.z.number(),c.z.record(c.z.string(),Y)])),Y=c.z.lazy(()=>c.z.union([X,c.z.array(X)])),Z=c.z.record(c.z.string(),Y.optional()).describe("Flexible property collection with optional values"),ee=c.z.record(c.z.string(),c.z.tuple([Y,c.z.number()]).optional()).describe("Ordered properties with [value, order] tuples for priority control"),ne=c.z.union([c.z.enum(["web","server","app","other"]),c.z.string()]).describe("Source type: web, server, app, other, or custom"),ie=c.z.record(c.z.string(),c.z.boolean()).describe("Consent requirement mapping (group name → state)"),oe=Z.and(c.z.object({id:c.z.string().optional().describe("User identifier"),device:c.z.string().optional().describe("Device identifier"),session:c.z.string().optional().describe("Session identifier"),hash:c.z.string().optional().describe("Hashed identifier"),address:c.z.string().optional().describe("User address"),email:c.z.string().email().optional().describe("User email address"),phone:c.z.string().optional().describe("User phone number"),userAgent:c.z.string().optional().describe("Browser user agent string"),browser:c.z.string().optional().describe("Browser name"),browserVersion:c.z.string().optional().describe("Browser version"),deviceType:c.z.string().optional().describe("Device type (mobile, desktop, tablet)"),os:c.z.string().optional().describe("Operating system"),osVersion:c.z.string().optional().describe("Operating system version"),screenSize:c.z.string().optional().describe("Screen dimensions"),language:c.z.string().optional().describe("User language"),country:c.z.string().optional().describe("User country"),region:c.z.string().optional().describe("User region/state"),city:c.z.string().optional().describe("User city"),zip:c.z.string().optional().describe("User postal code"),timezone:c.z.string().optional().describe("User timezone"),ip:c.z.string().optional().describe("User IP address"),internal:c.z.boolean().optional().describe("Internal user flag (employee, test user)")})).describe("User identification and properties"),te=Z.and(c.z.object({source:d.describe('Walker implementation version (e.g., "2.0.0")'),tagging:f})).describe("Walker version information"),re=Z.and(c.z.object({type:ne.describe("Source type identifier"),id:d.describe("Source identifier (typically URL on web)"),previous_id:d.describe("Previous source identifier (typically referrer on web)")})).describe("Event source information"),ae=c.z.lazy(()=>c.z.object({entity:c.z.string().describe("Entity name"),data:Z.describe("Entity-specific properties"),nested:c.z.array(ae).describe("Nested child entities"),context:ee.describe("Entity context data")})).describe("Nested entity structure with recursive nesting support"),se=c.z.array(ae).describe("Array of nested entities"),ce=c.z.object({name:c.z.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'),data:Z.describe("Event-specific properties"),context:ee.describe("Ordered context properties with priorities"),globals:Z.describe("Global properties shared across events"),custom:Z.describe("Custom implementation-specific properties"),user:oe.describe("User identification and attributes"),nested:se.describe("Related nested entities"),consent:ie.describe("Consent states at event time"),id:m.describe("Unique event identifier (timestamp-based)"),trigger:d.describe("Event trigger identifier"),entity:d.describe("Parsed entity from event name"),action:d.describe("Parsed action from event name"),timestamp:b.describe("Unix timestamp in milliseconds since epoch"),timing:p.describe("Event processing timing information"),group:d.describe("Event grouping identifier"),count:g.describe("Event count in session"),version:te.describe("Walker version information"),source:re.describe("Event source information")}).describe("Complete walkerOS event structure"),le=ce.partial().describe("Partial event structure with all fields optional"),de=ce.partial().describe("Partial event structure with all top-level fields optional"),pe=l(ce),ue=l(le),me=l(oe),be=l(Z),ge=l(ee),fe=l(ae),he=l(ne),ze=l(ie),Se={};r(Se,{ConfigSchema:()=>De,LoopSchema:()=>we,MapSchema:()=>Ce,PolicySchema:()=>Pe,ResultSchema:()=>xe,RuleSchema:()=>Je,RulesSchema:()=>Ee,SetSchema:()=>ke,ValueConfigSchema:()=>je,ValueSchema:()=>ve,ValuesSchema:()=>ye,configJsonSchema:()=>Be,loopJsonSchema:()=>Le,mapJsonSchema:()=>qe,policyJsonSchema:()=>Me,ruleJsonSchema:()=>Te,rulesJsonSchema:()=>Ue,setJsonSchema:()=>Oe,valueConfigJsonSchema:()=>Re,valueJsonSchema:()=>Ie});var ve=c.z.lazy(()=>c.z.union([c.z.string().describe('String value or property path (e.g., "data.id")'),c.z.number().describe("Numeric value"),c.z.boolean().describe("Boolean value"),c.z.lazy(()=>K),c.z.array(ve).describe("Array of values")])),ye=c.z.array(ve).describe("Array of transformation values"),we=c.z.lazy(()=>c.z.tuple([ve,ve]).describe("Loop transformation: [source, transform] tuple for array processing")),ke=c.z.lazy(()=>c.z.array(ve).describe("Set: Array of values for selection or combination")),Ce=c.z.lazy(()=>c.z.record(c.z.string(),ve).describe("Map: Object mapping keys to transformation values")),je=K=c.z.object({key:c.z.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'),value:c.z.union([c.z.string(),c.z.number(),c.z.boolean()]).optional().describe("Static primitive value"),fn:c.z.string().optional().describe("Custom transformation function as string (serialized)"),map:Ce.optional().describe("Object mapping: transform event data to structured output"),loop:we.optional().describe("Loop transformation: [source, transform] for array processing"),set:ke.optional().describe("Set of values: combine or select from multiple values"),consent:ie.optional().describe("Required consent states to include this value"),condition:c.z.string().optional().describe("Condition function as string: return true to include value"),validate:c.z.string().optional().describe("Validation function as string: return true if value is valid")}).refine(e=>Object.keys(e).length>0,{message:"ValueConfig must have at least one property"}).describe("Value transformation configuration with multiple strategies"),Pe=c.z.record(c.z.string(),ve).describe("Policy rules for event pre-processing (key → value mapping)"),Je=c.z.object({batch:c.z.number().optional().describe("Batch size: bundle N events for batch processing"),condition:c.z.string().optional().describe("Condition function as string: return true to process event"),consent:ie.optional().describe("Required consent states to process this event"),settings:c.z.any().optional().describe("Destination-specific settings for this event mapping"),data:c.z.union([ve,ye]).optional().describe("Data transformation rules for event"),ignore:c.z.boolean().optional().describe("Set to true to skip processing this event"),name:c.z.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'),policy:Pe.optional().describe("Event-level policy overrides (applied after config-level policy)")}).describe("Mapping rule for specific entity-action combination"),Ee=c.z.record(c.z.string(),c.z.record(c.z.string(),c.z.union([Je,c.z.array(Je)])).optional()).describe("Nested mapping rules: { entity: { action: Rule | Rule[] } } with wildcard support"),De=c.z.object({consent:ie.optional().describe("Required consent states to process any events"),data:c.z.union([ve,ye]).optional().describe("Global data transformation applied to all events"),mapping:Ee.optional().describe("Entity-action specific mapping rules"),policy:Pe.optional().describe("Pre-processing policy rules applied before mapping")}).describe("Shared mapping configuration for sources and destinations"),xe=c.z.object({eventMapping:Je.optional().describe("Resolved mapping rule for event"),mappingKey:c.z.string().optional().describe('Mapping key used (e.g., "product.view")')}).describe("Mapping resolution result"),Ie=l(ve),Re=l(je),Le=l(we),Oe=l(ke),qe=l(Ce),Me=l(Pe),Te=l(Je),Ue=l(Ee),Be=l(De),Ne={};r(Ne,{BatchSchema:()=>$e,ConfigSchema:()=>Ve,ContextSchema:()=>He,DLQSchema:()=>rn,DataSchema:()=>Ke,DestinationPolicySchema:()=>Ae,DestinationsSchema:()=>en,InitDestinationsSchema:()=>Ze,InitSchema:()=>Ye,InstanceSchema:()=>Xe,PartialConfigSchema:()=>We,PushBatchContextSchema:()=>Ge,PushContextSchema:()=>_e,PushEventSchema:()=>Qe,PushEventsSchema:()=>Fe,PushResultSchema:()=>on,RefSchema:()=>nn,ResultSchema:()=>tn,batchJsonSchema:()=>dn,configJsonSchema:()=>an,contextJsonSchema:()=>cn,instanceJsonSchema:()=>pn,partialConfigJsonSchema:()=>sn,pushContextJsonSchema:()=>ln,resultJsonSchema:()=>un});var Ve=c.z.object({consent:ie.optional().describe("Required consent states to send events to this destination"),settings:c.z.any().describe("Implementation-specific configuration").optional(),data:c.z.union([ve,ye]).optional().describe("Global data transformation applied to all events for this destination"),env:c.z.any().describe("Environment dependencies (platform-specific)").optional(),id:m.describe("Destination instance identifier (defaults to destination key)").optional(),init:c.z.boolean().describe("Whether to initialize immediately").optional(),loadScript:c.z.boolean().describe("Whether to load external script (for web destinations)").optional(),mapping:Ee.optional().describe("Entity-action specific mapping rules for this destination"),policy:Pe.optional().describe("Pre-processing policy rules applied before event mapping"),queue:c.z.boolean().describe("Whether to queue events when consent is not granted").optional(),verbose:c.z.boolean().describe("Enable verbose logging for debugging").optional(),onError:w.optional(),onLog:k.optional()}).describe("Destination configuration"),We=Ve.partial().describe("Partial destination configuration with all fields optional"),Ae=Pe.describe("Destination policy rules for event pre-processing"),He=c.z.object({collector:c.z.unknown().describe("Collector instance (runtime object)"),config:Ve.describe("Destination configuration"),data:c.z.union([c.z.unknown(),c.z.array(c.z.unknown())]).optional().describe("Transformed event data"),env:c.z.unknown().describe("Environment dependencies")}).describe("Destination context for init and push functions"),_e=He.extend({mapping:Je.optional().describe("Resolved mapping rule for this specific event")}).describe("Push context with event-specific mapping"),Ge=_e.describe("Batch push context with event-specific mapping"),Qe=c.z.object({event:ce.describe("The event to process"),mapping:Je.optional().describe("Mapping rule for this event")}).describe("Event with optional mapping for batch processing"),Fe=c.z.array(Qe).describe("Array of events with mappings"),$e=c.z.object({key:c.z.string().describe('Batch key (usually mapping key like "product.view")'),events:c.z.array(ce).describe("Array of events in batch"),data:c.z.array(c.z.union([c.z.unknown(),c.z.array(c.z.unknown())]).optional()).describe("Transformed data for each event"),mapping:Je.optional().describe("Shared mapping rule for batch")}).describe("Batch of events grouped by mapping key"),Ke=c.z.union([c.z.unknown(),c.z.array(c.z.unknown())]).optional().describe("Transformed event data (Property, undefined, or array)"),Xe=c.z.object({config:Ve.describe("Destination configuration"),queue:c.z.array(ce).optional().describe("Queued events awaiting consent"),dlq:c.z.array(c.z.tuple([ce,c.z.unknown()])).optional().describe("Dead letter queue (failed events with errors)"),type:c.z.string().optional().describe("Destination type identifier"),env:c.z.unknown().optional().describe("Environment dependencies"),init:c.z.unknown().optional().describe("Initialization function"),push:c.z.unknown().describe("Push function for single events"),pushBatch:c.z.unknown().optional().describe("Batch push function"),on:c.z.unknown().optional().describe("Event lifecycle hook function")}).describe("Destination instance (runtime object with functions)"),Ye=c.z.object({code:Xe.describe("Destination instance with implementation"),config:We.optional().describe("Partial configuration overrides"),env:c.z.unknown().optional().describe("Partial environment overrides")}).describe("Destination initialization configuration"),Ze=c.z.record(c.z.string(),Ye).describe("Map of destination IDs to initialization configurations"),en=c.z.record(c.z.string(),Xe).describe("Map of destination IDs to runtime instances"),nn=c.z.object({id:c.z.string().describe("Destination ID"),destination:Xe.describe("Destination instance")}).describe("Destination reference (ID + instance)"),on=c.z.object({queue:c.z.array(ce).optional().describe("Events queued (awaiting consent)"),error:c.z.unknown().optional().describe("Error if push failed")}).describe("Push operation result"),tn=c.z.object({successful:c.z.array(nn).describe("Destinations that processed successfully"),queued:c.z.array(nn).describe("Destinations that queued events"),failed:c.z.array(nn).describe("Destinations that failed to process")}).describe("Overall destination processing result"),rn=c.z.array(c.z.tuple([ce,c.z.unknown()])).describe("Dead letter queue: [(event, error), ...]"),an=l(Ve),sn=l(We),cn=l(He),ln=l(_e),dn=l($e),pn=l(Xe),un=l(tn),mn={};r(mn,{CommandTypeSchema:()=>bn,ConfigSchema:()=>gn,DestinationsSchema:()=>vn,InitConfigSchema:()=>hn,InstanceSchema:()=>yn,PushContextSchema:()=>zn,SessionDataSchema:()=>fn,SourcesSchema:()=>Sn,commandTypeJsonSchema:()=>wn,configJsonSchema:()=>kn,initConfigJsonSchema:()=>jn,instanceJsonSchema:()=>Jn,pushContextJsonSchema:()=>Pn,sessionDataJsonSchema:()=>Cn});var bn=c.z.union([c.z.enum(["action","config","consent","context","destination","elb","globals","hook","init","link","run","user","walker"]),c.z.string()]).describe("Collector command type: standard commands or custom string for extensions"),gn=c.z.object({run:c.z.boolean().describe("Whether to run collector automatically on initialization").optional(),tagging:f,globalsStatic:Z.describe("Static global properties that persist across collector runs"),sessionStatic:c.z.record(c.z.string(),c.z.unknown()).describe("Static session data that persists across collector runs"),verbose:c.z.boolean().describe("Enable verbose logging for debugging"),onError:w.optional(),onLog:k.optional()}).describe("Core collector configuration"),fn=Z.and(c.z.object({isStart:c.z.boolean().describe("Whether this is a new session start"),storage:c.z.boolean().describe("Whether storage is available"),id:m.describe("Session identifier").optional(),start:b.describe("Session start timestamp").optional(),marketing:c.z.literal(!0).optional().describe("Marketing attribution flag"),updated:b.describe("Last update timestamp").optional(),isNew:c.z.boolean().describe("Whether this is a new session").optional(),device:m.describe("Device identifier").optional(),count:g.describe("Event count in session").optional(),runs:g.describe("Number of runs").optional()})).describe("Session state and tracking data"),hn=gn.partial().extend({consent:ie.optional().describe("Initial consent state"),user:oe.optional().describe("Initial user data"),globals:Z.optional().describe("Initial global properties"),sources:c.z.unknown().optional().describe("Source configurations"),destinations:c.z.unknown().optional().describe("Destination configurations"),custom:Z.optional().describe("Initial custom implementation-specific properties")}).describe("Collector initialization configuration with initial state"),zn=c.z.object({mapping:De.optional().describe("Source-level mapping configuration")}).describe("Push context with optional source mapping"),Sn=c.z.record(c.z.string(),c.z.unknown()).describe("Map of source IDs to source instances"),vn=c.z.record(c.z.string(),c.z.unknown()).describe("Map of destination IDs to destination instances"),yn=c.z.object({push:c.z.unknown().describe("Push function for processing events"),command:c.z.unknown().describe("Command function for walker commands"),allowed:c.z.boolean().describe("Whether event processing is allowed"),config:gn.describe("Current collector configuration"),consent:ie.describe("Current consent state"),count:c.z.number().describe("Event count (increments with each event)"),custom:Z.describe("Custom implementation-specific properties"),sources:Sn.describe("Registered source instances"),destinations:vn.describe("Registered destination instances"),globals:Z.describe("Current global properties"),group:c.z.string().describe("Event grouping identifier"),hooks:c.z.unknown().describe("Lifecycle hook functions"),on:c.z.unknown().describe("Event lifecycle configuration"),queue:c.z.array(ce).describe("Queued events awaiting processing"),round:c.z.number().describe("Collector run count (increments with each run)"),session:c.z.union([fn]).describe("Current session state"),timing:c.z.number().describe("Event processing timing information"),user:oe.describe("Current user data"),version:c.z.string().describe("Walker implementation version")}).describe("Collector instance with state and methods"),wn=l(bn),kn=l(gn),Cn=l(fn),jn=l(hn),Pn=l(zn),Jn=l(yn),En={};r(En,{BaseEnvSchema:()=>Dn,ConfigSchema:()=>xn,InitSchema:()=>Ln,InitSourceSchema:()=>On,InitSourcesSchema:()=>qn,InstanceSchema:()=>Rn,PartialConfigSchema:()=>In,baseEnvJsonSchema:()=>Mn,configJsonSchema:()=>Tn,initSourceJsonSchema:()=>Nn,initSourcesJsonSchema:()=>Vn,instanceJsonSchema:()=>Bn,partialConfigJsonSchema:()=>Un});var Dn=c.z.object({push:c.z.unknown().describe("Collector push function"),command:c.z.unknown().describe("Collector command function"),sources:c.z.unknown().optional().describe("Map of registered source instances"),elb:c.z.unknown().describe("Public API function (alias for collector.push)")}).catchall(c.z.unknown()).describe("Base environment for dependency injection - platform-specific sources extend this"),xn=De.extend({settings:c.z.any().describe("Implementation-specific configuration").optional(),env:Dn.optional().describe("Environment dependencies (platform-specific)"),id:m.describe("Source identifier (defaults to source key)").optional(),onError:w.optional(),disabled:c.z.boolean().describe("Set to true to disable").optional(),primary:c.z.boolean().describe("Mark as primary (only one can be primary)").optional()}).describe("Source configuration with mapping and environment"),In=xn.partial().describe("Partial source configuration with all fields optional"),Rn=c.z.object({type:c.z.string().describe('Source type identifier (e.g., "browser", "dataLayer")'),config:xn.describe("Current source configuration"),push:c.z.any().describe("Push function - THE HANDLER (flexible signature for platform compatibility)"),destroy:c.z.any().optional().describe("Cleanup function called when source is removed"),on:c.z.unknown().optional().describe("Lifecycle hook function for event types")}).describe("Source instance with push handler and lifecycle methods"),Ln=c.z.any().describe("Source initialization function: (config, env) => Instance | Promise<Instance>"),On=c.z.object({code:Ln.describe("Source initialization function"),config:In.optional().describe("Partial configuration overrides"),env:Dn.partial().optional().describe("Partial environment overrides"),primary:c.z.boolean().optional().describe("Mark as primary source (only one can be primary)")}).describe("Source initialization configuration"),qn=c.z.record(c.z.string(),On).describe("Map of source IDs to initialization configurations"),Mn=l(Dn),Tn=l(xn),Un=l(In),Bn=l(Rn),Nn=l(On),Vn=l(qn),Wn={};r(Wn,{ConfigSchema:()=>Gn,DestinationReferenceSchema:()=>_n,PrimitiveSchema:()=>An,SetupSchema:()=>Qn,SourceReferenceSchema:()=>Hn,configJsonSchema:()=>Zn,destinationReferenceJsonSchema:()=>ni,parseConfig:()=>Kn,parseSetup:()=>Fn,safeParseConfig:()=>Xn,safeParseSetup:()=>$n,setupJsonSchema:()=>Yn,sourceReferenceJsonSchema:()=>ei});var An=c.z.union([c.z.string(),c.z.number(),c.z.boolean()]).describe("Primitive value: string, number, or boolean"),Hn=c.z.object({package:c.z.string().min(1,"Package name cannot be empty").describe('Package specifier with optional version (e.g., "@walkeros/web-source-browser@2.0.0")'),config:c.z.unknown().optional().describe("Source-specific configuration object"),env:c.z.unknown().optional().describe("Source environment configuration"),primary:c.z.boolean().optional().describe("Mark as primary source (provides main elb). Only one source should be primary.")}).describe("Source package reference with configuration"),_n=c.z.object({package:c.z.string().min(1,"Package name cannot be empty").describe('Package specifier with optional version (e.g., "@walkeros/web-destination-gtag@2.0.0")'),config:c.z.unknown().optional().describe("Destination-specific configuration object"),env:c.z.unknown().optional().describe("Destination environment configuration")}).describe("Destination package reference with configuration"),Gn=c.z.object({platform:c.z.enum(["web","server"],{error:'Platform must be "web" or "server"'}).describe('Target platform: "web" for browser-based tracking, "server" for Node.js server-side collection'),sources:c.z.record(c.z.string(),Hn).optional().describe("Source configurations (data capture) keyed by unique identifier"),destinations:c.z.record(c.z.string(),_n).optional().describe("Destination configurations (data output) keyed by unique identifier"),collector:c.z.unknown().optional().describe("Collector configuration for event processing (uses Collector.InitConfig)"),env:c.z.record(c.z.string(),c.z.string()).optional().describe("Environment-specific variables (override root-level variables)")}).passthrough().describe("Single environment configuration for one deployment target"),Qn=c.z.object({version:c.z.literal(1,{error:"Only version 1 is currently supported"}).describe("Configuration schema version (currently only 1 is supported)"),$schema:c.z.string().url("Schema URL must be a valid URL").optional().describe('JSON Schema reference for IDE validation (e.g., "https://walkeros.io/schema/flow/v1.json")'),variables:c.z.record(c.z.string(),An).optional().describe("Shared variables for interpolation across all environments (use ${VAR_NAME:default} syntax)"),definitions:c.z.record(c.z.string(),c.z.unknown()).optional().describe("Reusable configuration definitions (reference with JSON Schema $ref syntax)"),environments:c.z.record(c.z.string(),Gn).refine(e=>Object.keys(e).length>0,{message:"At least one environment is required"}).describe("Named environment configurations (e.g., web_prod, server_stage)")}).describe("Complete multi-environment walkerOS configuration (walkeros.config.json)");function Fn(e){return Qn.parse(e)}function $n(e){return Qn.safeParse(e)}function Kn(e){return Gn.parse(e)}function Xn(e){return Gn.safeParse(e)}var Yn=c.z.toJSONSchema(Qn,{target:"draft-7"}),Zn=l(Gn),ei=l(Hn),ni=l(_n);function ii(e,n){const i=[],o={};for(const[n,t]of Object.entries(e)){t.required&&i.push(n);const e={type:t.type};if(t.description&&(e.description=t.description),t.pattern&&(e.pattern=t.pattern),void 0!==t.minLength&&(e.minLength=t.minLength),void 0!==t.maxLength&&(e.maxLength=t.maxLength),void 0!==t.minimum&&(e.minimum=t.minimum),void 0!==t.maximum&&(e.maximum=t.maximum),t.enum&&(e.enum=[...t.enum]),void 0!==t.default&&(e.default=t.default),"object"===t.type&&t.properties){const n={};for(const[e,i]of Object.entries(t.properties))n[e]=oi(i);e.properties=n}"array"===t.type&&t.items&&(e.items=oi(t.items)),o[n]=e}const t={type:"object",properties:o};return n&&(t.title=n),i.length>0&&(t.required=i),t}function oi(e){const n={type:e.type};if(e.description&&(n.description=e.description),e.pattern&&(n.pattern=e.pattern),void 0!==e.minLength&&(n.minLength=e.minLength),void 0!==e.maxLength&&(n.maxLength=e.maxLength),void 0!==e.minimum&&(n.minimum=e.minimum),void 0!==e.maximum&&(n.maximum=e.maximum),e.enum&&(n.enum=[...e.enum]),void 0!==e.default&&(n.default=e.default),"object"===e.type&&e.properties){const i={};for(const[n,o]of Object.entries(e.properties))i[n]=oi(o);n.properties=i}return"array"===e.type&&e.items&&(n.items=oi(e.items)),n}function ti(e,n){const i={type:"array",items:oi(e)};return void 0!==n?.minItems&&(i.minItems=n.minItems),void 0!==n?.maxItems&&(i.maxItems=n.maxItems),n?.description&&(i.description=n.description),n?.title&&(i.title=n.title),i}function ri(e,n="string",i){const o={type:n,enum:[...e]};return i?.description&&(o.description=i.description),i?.title&&(o.title=i.title),o}function ai(e,n,i){return ti({type:"object"},{minItems:2,maxItems:2,description:i||"Tuple with exactly 2 elements [source, transform]"})}function si(e){return c.z.toJSONSchema(e,{target:"draft-7"})}//# sourceMappingURL=dev.js.map
|
|
1
|
+
"use strict";var e,i=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,t=Object.prototype.hasOwnProperty,r=(e,n)=>{for(var o in n)i(e,o,{get:n[o],enumerable:!0})},a={};r(a,{schemas:()=>s,z:()=>c.z,zodToSchema:()=>un}),module.exports=(e=a,((e,r,a,s)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let c of o(r))t.call(e,c)||c===a||i(e,c,{get:()=>r[c],enumerable:!(s=n(r,c))||s.enumerable});return e})(i({},"__esModule",{value:!0}),e));var s={};r(s,{BaseContextConfig:()=>H,BatchConfig:()=>_,CollectorSchemas:()=>ui,ConsentSchema:()=>ne,Counter:()=>g,DeepPartialEventSchema:()=>de,DestinationReferenceSchema:()=>Qi,DestinationSchemas:()=>Ve,DestinationsMapConfig:()=>$,DisabledConfig:()=>O,EntitiesSchema:()=>se,EntitySchema:()=>ae,EventSchema:()=>ce,FlowConfigSchema:()=>Ki,FlowSchemas:()=>Wi,GenericEnvConfig:()=>T,GenericSettingsConfig:()=>N,HandlersConfig:()=>x,IdConfig:()=>L,Identifier:()=>m,InitConfig:()=>M,LoopSchema:()=>we,MapSchema:()=>Ce,MappingResultSchema:()=>xe,MappingSchemas:()=>Se,OptionalPrimitiveValue:()=>z,OrderedPropertiesSchema:()=>ee,PartialEventSchema:()=>le,PolicySchema:()=>Pe,PrimaryConfig:()=>q,PrimitiveSchema:()=>Bi,PrimitiveValue:()=>h,ProcessingControlConfig:()=>F,PropertiesSchema:()=>Z,PropertySchema:()=>Y,PropertyTypeSchema:()=>X,QueueConfig:()=>R,RequiredBoolean:()=>u,RequiredNumber:()=>p,RequiredString:()=>d,RuleSchema:()=>Je,RulesSchema:()=>Ee,RuntimeInstanceConfig:()=>A,SetSchema:()=>ke,SetupSchema:()=>Xi,SourceReferenceSchema:()=>$i,SourceSchema:()=>re,SourceSchemas:()=>Ji,SourceTypeSchema:()=>ie,SourcesMapConfig:()=>G,TaggingVersion:()=>f,Timestamp:()=>b,UserSchema:()=>oe,UtilitySchemas:()=>S,ValueConfigSchema:()=>je,ValueSchema:()=>ve,ValuesSchema:()=>ye,VerboseConfig:()=>I,VersionSchema:()=>te,WalkerOSSchemas:()=>Q,configJsonSchema:()=>tn,consentJsonSchema:()=>ze,createArraySchema:()=>ln,createConsentConfig:()=>B,createDataTransformationConfig:()=>U,createEnumSchema:()=>dn,createMappingRulesConfig:()=>V,createObjectSchema:()=>sn,createPolicyConfig:()=>W,createTupleSchema:()=>pn,destinationReferenceJsonSchema:()=>an,entityJsonSchema:()=>fe,eventJsonSchema:()=>pe,loopJsonSchema:()=>Le,mapJsonSchema:()=>Oe,orderedPropertiesJsonSchema:()=>ge,parseConfig:()=>en,parseSetup:()=>Yi,partialEventJsonSchema:()=>ue,policyJsonSchema:()=>qe,propertiesJsonSchema:()=>be,ruleJsonSchema:()=>Ne,rulesJsonSchema:()=>Te,safeParseConfig:()=>nn,safeParseSetup:()=>Zi,setJsonSchema:()=>Me,setupJsonSchema:()=>on,sourceReferenceJsonSchema:()=>rn,sourceTypeJsonSchema:()=>he,userJsonSchema:()=>me,valueConfigJsonSchema:()=>Re,valueJsonSchema:()=>Ie,z:()=>c.z,zodToSchema:()=>un});var c=require("zod");function l(e,i,n="draft-7"){return c.z.toJSONSchema(e,{target:n})}var d=c.z.string(),p=c.z.number(),u=c.z.boolean(),m=c.z.string().min(1),b=c.z.number().int().positive(),g=c.z.number().int().nonnegative(),f=c.z.number().describe("Tagging version number"),h=c.z.union([c.z.string(),c.z.number(),c.z.boolean()]),z=h.optional(),S={};r(S,{ErrorHandlerSchema:()=>w,HandlerSchema:()=>C,LogHandlerSchema:()=>k,StorageSchema:()=>y,StorageTypeSchema:()=>v,errorHandlerJsonSchema:()=>J,handlerJsonSchema:()=>D,logHandlerJsonSchema:()=>E,storageJsonSchema:()=>P,storageTypeJsonSchema:()=>j});var v=c.z.enum(["local","session","cookie"]).describe("Storage mechanism: local, session, or cookie"),y=c.z.object({Local:c.z.literal("local"),Session:c.z.literal("session"),Cookie:c.z.literal("cookie")}).describe("Storage type constants for type-safe references"),w=c.z.any().describe("Error handler function: (error, state?) => void"),k=c.z.any().describe("Log handler function: (message, verbose?) => void"),C=c.z.object({Error:w.describe("Error handler function"),Log:k.describe("Log handler function")}).describe("Handler interface with error and log functions"),j=l(v),P=l(y),J=l(w),E=l(k),D=l(C),x=c.z.object({onError:w.optional().describe("Error handler function: (error, state?) => void"),onLog:k.optional().describe("Log handler function: (message, verbose?) => void")}).partial(),I=c.z.object({verbose:c.z.boolean().describe("Enable verbose logging for debugging").optional()}).partial(),R=c.z.object({queue:c.z.boolean().describe("Whether to queue events when consent is not granted").optional()}).partial(),L=c.z.object({}).partial(),M=c.z.object({init:c.z.boolean().describe("Whether to initialize immediately").optional(),loadScript:c.z.boolean().describe("Whether to load external script (for web destinations)").optional()}).partial(),O=c.z.object({disabled:c.z.boolean().describe("Set to true to disable").optional()}).partial(),q=c.z.object({primary:c.z.boolean().describe("Mark as primary (only one can be primary)").optional()}).partial(),N=c.z.object({settings:c.z.any().optional().describe("Implementation-specific configuration")}).partial(),T=c.z.object({env:c.z.any().optional().describe("Environment dependencies (platform-specific)")}).partial();function U(e,i){return c.z.object({data:c.z.union([e,i]).optional().describe("Data transformation rules")}).partial()}function V(e){return c.z.object({mapping:e.optional().describe("Event mapping rules")}).partial()}function W(e){return c.z.object({policy:e.optional().describe("Pre-processing policy rules")}).partial()}function B(e){return c.z.object({consent:e.optional().describe("Required consent states")}).partial()}var A=c.z.object({type:c.z.string().optional().describe("Instance type identifier"),config:c.z.unknown().describe("Instance configuration")}).partial(),H=c.z.object({collector:c.z.unknown().describe("Collector instance (runtime object)"),config:c.z.unknown().describe("Configuration"),env:c.z.unknown().describe("Environment dependencies")}).partial(),_=c.z.object({batch:c.z.number().optional().describe("Batch size: bundle N events for batch processing"),batched:c.z.unknown().optional().describe("Batch of events to be processed")}).partial(),F=c.z.object({ignore:c.z.boolean().describe("Set to true to skip processing").optional(),condition:c.z.string().optional().describe("Condition function: return true to process")}).partial(),G=c.z.object({sources:c.z.record(c.z.string(),c.z.unknown()).describe("Map of source instances")}).partial(),$=c.z.object({destinations:c.z.record(c.z.string(),c.z.unknown()).describe("Map of destination instances")}).partial(),Q={};r(Q,{ConsentSchema:()=>ne,DeepPartialEventSchema:()=>de,EntitiesSchema:()=>se,EntitySchema:()=>ae,EventSchema:()=>ce,OrderedPropertiesSchema:()=>ee,PartialEventSchema:()=>le,PropertiesSchema:()=>Z,PropertySchema:()=>Y,PropertyTypeSchema:()=>X,SourceSchema:()=>re,SourceTypeSchema:()=>ie,UserSchema:()=>oe,VersionSchema:()=>te,consentJsonSchema:()=>ze,entityJsonSchema:()=>fe,eventJsonSchema:()=>pe,orderedPropertiesJsonSchema:()=>ge,partialEventJsonSchema:()=>ue,propertiesJsonSchema:()=>be,sourceTypeJsonSchema:()=>he,userJsonSchema:()=>me});var K,X=c.z.lazy(()=>c.z.union([c.z.boolean(),c.z.string(),c.z.number(),c.z.record(c.z.string(),Y)])),Y=c.z.lazy(()=>c.z.union([X,c.z.array(X)])),Z=c.z.record(c.z.string(),Y.optional()).describe("Flexible property collection with optional values"),ee=c.z.record(c.z.string(),c.z.tuple([Y,c.z.number()]).optional()).describe("Ordered properties with [value, order] tuples for priority control"),ie=c.z.union([c.z.enum(["web","server","app","other"]),c.z.string()]).describe("Source type: web, server, app, other, or custom"),ne=c.z.record(c.z.string(),c.z.boolean()).describe("Consent requirement mapping (group name → state)"),oe=Z.and(c.z.object({id:c.z.string().optional().describe("User identifier"),device:c.z.string().optional().describe("Device identifier"),session:c.z.string().optional().describe("Session identifier"),hash:c.z.string().optional().describe("Hashed identifier"),address:c.z.string().optional().describe("User address"),email:c.z.string().email().optional().describe("User email address"),phone:c.z.string().optional().describe("User phone number"),userAgent:c.z.string().optional().describe("Browser user agent string"),browser:c.z.string().optional().describe("Browser name"),browserVersion:c.z.string().optional().describe("Browser version"),deviceType:c.z.string().optional().describe("Device type (mobile, desktop, tablet)"),os:c.z.string().optional().describe("Operating system"),osVersion:c.z.string().optional().describe("Operating system version"),screenSize:c.z.string().optional().describe("Screen dimensions"),language:c.z.string().optional().describe("User language"),country:c.z.string().optional().describe("User country"),region:c.z.string().optional().describe("User region/state"),city:c.z.string().optional().describe("User city"),zip:c.z.string().optional().describe("User postal code"),timezone:c.z.string().optional().describe("User timezone"),ip:c.z.string().optional().describe("User IP address"),internal:c.z.boolean().optional().describe("Internal user flag (employee, test user)")})).describe("User identification and properties"),te=Z.and(c.z.object({source:d.describe('Walker implementation version (e.g., "2.0.0")'),tagging:f})).describe("Walker version information"),re=Z.and(c.z.object({type:ie.describe("Source type identifier"),id:d.describe("Source identifier (typically URL on web)"),previous_id:d.describe("Previous source identifier (typically referrer on web)")})).describe("Event source information"),ae=c.z.lazy(()=>c.z.object({entity:c.z.string().describe("Entity name"),data:Z.describe("Entity-specific properties"),nested:c.z.array(ae).describe("Nested child entities"),context:ee.describe("Entity context data")})).describe("Nested entity structure with recursive nesting support"),se=c.z.array(ae).describe("Array of nested entities"),ce=c.z.object({name:c.z.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'),data:Z.describe("Event-specific properties"),context:ee.describe("Ordered context properties with priorities"),globals:Z.describe("Global properties shared across events"),custom:Z.describe("Custom implementation-specific properties"),user:oe.describe("User identification and attributes"),nested:se.describe("Related nested entities"),consent:ne.describe("Consent states at event time"),id:m.describe("Unique event identifier (timestamp-based)"),trigger:d.describe("Event trigger identifier"),entity:d.describe("Parsed entity from event name"),action:d.describe("Parsed action from event name"),timestamp:b.describe("Unix timestamp in milliseconds since epoch"),timing:p.describe("Event processing timing information"),group:d.describe("Event grouping identifier"),count:g.describe("Event count in session"),version:te.describe("Walker version information"),source:re.describe("Event source information")}).describe("Complete walkerOS event structure"),le=ce.partial().describe("Partial event structure with all fields optional"),de=ce.partial().describe("Partial event structure with all top-level fields optional"),pe=l(ce),ue=l(le),me=l(oe),be=l(Z),ge=l(ee),fe=l(ae),he=l(ie),ze=l(ne),Se={};r(Se,{ConfigSchema:()=>De,LoopSchema:()=>we,MapSchema:()=>Ce,PolicySchema:()=>Pe,ResultSchema:()=>xe,RuleSchema:()=>Je,RulesSchema:()=>Ee,SetSchema:()=>ke,ValueConfigSchema:()=>je,ValueSchema:()=>ve,ValuesSchema:()=>ye,configJsonSchema:()=>Ue,loopJsonSchema:()=>Le,mapJsonSchema:()=>Oe,policyJsonSchema:()=>qe,ruleJsonSchema:()=>Ne,rulesJsonSchema:()=>Te,setJsonSchema:()=>Me,valueConfigJsonSchema:()=>Re,valueJsonSchema:()=>Ie});var ve=c.z.lazy(()=>c.z.union([c.z.string().describe('String value or property path (e.g., "data.id")'),c.z.number().describe("Numeric value"),c.z.boolean().describe("Boolean value"),c.z.lazy(()=>K),c.z.array(ve).describe("Array of values")])),ye=c.z.array(ve).describe("Array of transformation values"),we=c.z.lazy(()=>c.z.tuple([ve,ve]).describe("Loop transformation: [source, transform] tuple for array processing")),ke=c.z.lazy(()=>c.z.array(ve).describe("Set: Array of values for selection or combination")),Ce=c.z.lazy(()=>c.z.record(c.z.string(),ve).describe("Map: Object mapping keys to transformation values")),je=K=c.z.object({key:c.z.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'),value:c.z.union([c.z.string(),c.z.number(),c.z.boolean()]).optional().describe("Static primitive value"),fn:c.z.string().optional().describe("Custom transformation function as string (serialized)"),map:Ce.optional().describe("Object mapping: transform event data to structured output"),loop:we.optional().describe("Loop transformation: [source, transform] for array processing"),set:ke.optional().describe("Set of values: combine or select from multiple values"),consent:ne.optional().describe("Required consent states to include this value"),condition:c.z.string().optional().describe("Condition function as string: return true to include value"),validate:c.z.string().optional().describe("Validation function as string: return true if value is valid")}).refine(e=>Object.keys(e).length>0,{message:"ValueConfig must have at least one property"}).describe("Value transformation configuration with multiple strategies"),Pe=c.z.record(c.z.string(),ve).describe("Policy rules for event pre-processing (key → value mapping)"),Je=c.z.object({batch:c.z.number().optional().describe("Batch size: bundle N events for batch processing"),condition:c.z.string().optional().describe("Condition function as string: return true to process event"),consent:ne.optional().describe("Required consent states to process this event"),settings:c.z.any().optional().describe("Destination-specific settings for this event mapping"),data:c.z.union([ve,ye]).optional().describe("Data transformation rules for event"),ignore:c.z.boolean().optional().describe("Set to true to skip processing this event"),name:c.z.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'),policy:Pe.optional().describe("Event-level policy overrides (applied after config-level policy)")}).describe("Mapping rule for specific entity-action combination"),Ee=c.z.record(c.z.string(),c.z.record(c.z.string(),c.z.union([Je,c.z.array(Je)])).optional()).describe("Nested mapping rules: { entity: { action: Rule | Rule[] } } with wildcard support"),De=c.z.object({consent:ne.optional().describe("Required consent states to process any events"),data:c.z.union([ve,ye]).optional().describe("Global data transformation applied to all events"),mapping:Ee.optional().describe("Entity-action specific mapping rules"),policy:Pe.optional().describe("Pre-processing policy rules applied before mapping")}).describe("Shared mapping configuration for sources and destinations"),xe=c.z.object({eventMapping:Je.optional().describe("Resolved mapping rule for event"),mappingKey:c.z.string().optional().describe('Mapping key used (e.g., "product.view")')}).describe("Mapping resolution result"),Ie=l(ve),Re=l(je),Le=l(we),Me=l(ke),Oe=l(Ce),qe=l(Pe),Ne=l(Je),Te=l(Ee),Ue=l(De),Ve={};r(Ve,{BatchSchema:()=>Qe,ConfigSchema:()=>We,ContextSchema:()=>He,DLQSchema:()=>ti,DataSchema:()=>Ke,DestinationPolicySchema:()=>Ae,DestinationsSchema:()=>ei,InitDestinationsSchema:()=>Ze,InitSchema:()=>Ye,InstanceSchema:()=>Xe,PartialConfigSchema:()=>Be,PushBatchContextSchema:()=>Fe,PushContextSchema:()=>_e,PushEventSchema:()=>Ge,PushEventsSchema:()=>$e,PushResultSchema:()=>ni,RefSchema:()=>ii,ResultSchema:()=>oi,batchJsonSchema:()=>li,configJsonSchema:()=>ri,contextJsonSchema:()=>si,instanceJsonSchema:()=>di,partialConfigJsonSchema:()=>ai,pushContextJsonSchema:()=>ci,resultJsonSchema:()=>pi});var We=c.z.object({consent:ne.optional().describe("Required consent states to send events to this destination"),settings:c.z.any().describe("Implementation-specific configuration").optional(),data:c.z.union([ve,ye]).optional().describe("Global data transformation applied to all events for this destination"),env:c.z.any().describe("Environment dependencies (platform-specific)").optional(),id:m.describe("Destination instance identifier (defaults to destination key)").optional(),init:c.z.boolean().describe("Whether to initialize immediately").optional(),loadScript:c.z.boolean().describe("Whether to load external script (for web destinations)").optional(),mapping:Ee.optional().describe("Entity-action specific mapping rules for this destination"),policy:Pe.optional().describe("Pre-processing policy rules applied before event mapping"),queue:c.z.boolean().describe("Whether to queue events when consent is not granted").optional(),verbose:c.z.boolean().describe("Enable verbose logging for debugging").optional(),onError:w.optional(),onLog:k.optional()}).describe("Destination configuration"),Be=We.partial().describe("Partial destination configuration with all fields optional"),Ae=Pe.describe("Destination policy rules for event pre-processing"),He=c.z.object({collector:c.z.unknown().describe("Collector instance (runtime object)"),config:We.describe("Destination configuration"),data:c.z.union([c.z.unknown(),c.z.array(c.z.unknown())]).optional().describe("Transformed event data"),env:c.z.unknown().describe("Environment dependencies")}).describe("Destination context for init and push functions"),_e=He.extend({mapping:Je.optional().describe("Resolved mapping rule for this specific event")}).describe("Push context with event-specific mapping"),Fe=_e.describe("Batch push context with event-specific mapping"),Ge=c.z.object({event:ce.describe("The event to process"),mapping:Je.optional().describe("Mapping rule for this event")}).describe("Event with optional mapping for batch processing"),$e=c.z.array(Ge).describe("Array of events with mappings"),Qe=c.z.object({key:c.z.string().describe('Batch key (usually mapping key like "product.view")'),events:c.z.array(ce).describe("Array of events in batch"),data:c.z.array(c.z.union([c.z.unknown(),c.z.array(c.z.unknown())]).optional()).describe("Transformed data for each event"),mapping:Je.optional().describe("Shared mapping rule for batch")}).describe("Batch of events grouped by mapping key"),Ke=c.z.union([c.z.unknown(),c.z.array(c.z.unknown())]).optional().describe("Transformed event data (Property, undefined, or array)"),Xe=c.z.object({config:We.describe("Destination configuration"),queue:c.z.array(ce).optional().describe("Queued events awaiting consent"),dlq:c.z.array(c.z.tuple([ce,c.z.unknown()])).optional().describe("Dead letter queue (failed events with errors)"),type:c.z.string().optional().describe("Destination type identifier"),env:c.z.unknown().optional().describe("Environment dependencies"),init:c.z.unknown().optional().describe("Initialization function"),push:c.z.unknown().describe("Push function for single events"),pushBatch:c.z.unknown().optional().describe("Batch push function"),on:c.z.unknown().optional().describe("Event lifecycle hook function")}).describe("Destination instance (runtime object with functions)"),Ye=c.z.object({code:Xe.describe("Destination instance with implementation"),config:Be.optional().describe("Partial configuration overrides"),env:c.z.unknown().optional().describe("Partial environment overrides")}).describe("Destination initialization configuration"),Ze=c.z.record(c.z.string(),Ye).describe("Map of destination IDs to initialization configurations"),ei=c.z.record(c.z.string(),Xe).describe("Map of destination IDs to runtime instances"),ii=c.z.object({id:c.z.string().describe("Destination ID"),destination:Xe.describe("Destination instance")}).describe("Destination reference (ID + instance)"),ni=c.z.object({queue:c.z.array(ce).optional().describe("Events queued (awaiting consent)"),error:c.z.unknown().optional().describe("Error if push failed")}).describe("Push operation result"),oi=c.z.object({successful:c.z.array(ii).describe("Destinations that processed successfully"),queued:c.z.array(ii).describe("Destinations that queued events"),failed:c.z.array(ii).describe("Destinations that failed to process")}).describe("Overall destination processing result"),ti=c.z.array(c.z.tuple([ce,c.z.unknown()])).describe("Dead letter queue: [(event, error), ...]"),ri=l(We),ai=l(Be),si=l(He),ci=l(_e),li=l(Qe),di=l(Xe),pi=l(oi),ui={};r(ui,{CommandTypeSchema:()=>mi,ConfigSchema:()=>bi,DestinationsSchema:()=>Si,InitConfigSchema:()=>fi,InstanceSchema:()=>vi,PushContextSchema:()=>hi,SessionDataSchema:()=>gi,SourcesSchema:()=>zi,commandTypeJsonSchema:()=>yi,configJsonSchema:()=>wi,initConfigJsonSchema:()=>Ci,instanceJsonSchema:()=>Pi,pushContextJsonSchema:()=>ji,sessionDataJsonSchema:()=>ki});var mi=c.z.union([c.z.enum(["action","config","consent","context","destination","elb","globals","hook","init","link","run","user","walker"]),c.z.string()]).describe("Collector command type: standard commands or custom string for extensions"),bi=c.z.object({run:c.z.boolean().describe("Whether to run collector automatically on initialization").optional(),tagging:f,globalsStatic:Z.describe("Static global properties that persist across collector runs"),sessionStatic:c.z.record(c.z.string(),c.z.unknown()).describe("Static session data that persists across collector runs"),verbose:c.z.boolean().describe("Enable verbose logging for debugging"),onError:w.optional(),onLog:k.optional()}).describe("Core collector configuration"),gi=Z.and(c.z.object({isStart:c.z.boolean().describe("Whether this is a new session start"),storage:c.z.boolean().describe("Whether storage is available"),id:m.describe("Session identifier").optional(),start:b.describe("Session start timestamp").optional(),marketing:c.z.literal(!0).optional().describe("Marketing attribution flag"),updated:b.describe("Last update timestamp").optional(),isNew:c.z.boolean().describe("Whether this is a new session").optional(),device:m.describe("Device identifier").optional(),count:g.describe("Event count in session").optional(),runs:g.describe("Number of runs").optional()})).describe("Session state and tracking data"),fi=bi.partial().extend({consent:ne.optional().describe("Initial consent state"),user:oe.optional().describe("Initial user data"),globals:Z.optional().describe("Initial global properties"),sources:c.z.unknown().optional().describe("Source configurations"),destinations:c.z.unknown().optional().describe("Destination configurations"),custom:Z.optional().describe("Initial custom implementation-specific properties")}).describe("Collector initialization configuration with initial state"),hi=c.z.object({mapping:De.optional().describe("Source-level mapping configuration")}).describe("Push context with optional source mapping"),zi=c.z.record(c.z.string(),c.z.unknown()).describe("Map of source IDs to source instances"),Si=c.z.record(c.z.string(),c.z.unknown()).describe("Map of destination IDs to destination instances"),vi=c.z.object({push:c.z.unknown().describe("Push function for processing events"),command:c.z.unknown().describe("Command function for walker commands"),allowed:c.z.boolean().describe("Whether event processing is allowed"),config:bi.describe("Current collector configuration"),consent:ne.describe("Current consent state"),count:c.z.number().describe("Event count (increments with each event)"),custom:Z.describe("Custom implementation-specific properties"),sources:zi.describe("Registered source instances"),destinations:Si.describe("Registered destination instances"),globals:Z.describe("Current global properties"),group:c.z.string().describe("Event grouping identifier"),hooks:c.z.unknown().describe("Lifecycle hook functions"),on:c.z.unknown().describe("Event lifecycle configuration"),queue:c.z.array(ce).describe("Queued events awaiting processing"),round:c.z.number().describe("Collector run count (increments with each run)"),session:c.z.union([gi]).describe("Current session state"),timing:c.z.number().describe("Event processing timing information"),user:oe.describe("Current user data"),version:c.z.string().describe("Walker implementation version")}).describe("Collector instance with state and methods"),yi=l(mi),wi=l(bi),ki=l(gi),Ci=l(fi),ji=l(hi),Pi=l(vi),Ji={};r(Ji,{BaseEnvSchema:()=>Ei,ConfigSchema:()=>Di,InitSchema:()=>Ri,InitSourceSchema:()=>Li,InitSourcesSchema:()=>Mi,InstanceSchema:()=>Ii,PartialConfigSchema:()=>xi,baseEnvJsonSchema:()=>Oi,configJsonSchema:()=>qi,initSourceJsonSchema:()=>Ui,initSourcesJsonSchema:()=>Vi,instanceJsonSchema:()=>Ti,partialConfigJsonSchema:()=>Ni});var Ei=c.z.object({push:c.z.unknown().describe("Collector push function"),command:c.z.unknown().describe("Collector command function"),sources:c.z.unknown().optional().describe("Map of registered source instances"),elb:c.z.unknown().describe("Public API function (alias for collector.push)")}).catchall(c.z.unknown()).describe("Base environment for dependency injection - platform-specific sources extend this"),Di=De.extend({settings:c.z.any().describe("Implementation-specific configuration").optional(),env:Ei.optional().describe("Environment dependencies (platform-specific)"),id:m.describe("Source identifier (defaults to source key)").optional(),onError:w.optional(),disabled:c.z.boolean().describe("Set to true to disable").optional(),primary:c.z.boolean().describe("Mark as primary (only one can be primary)").optional()}).describe("Source configuration with mapping and environment"),xi=Di.partial().describe("Partial source configuration with all fields optional"),Ii=c.z.object({type:c.z.string().describe('Source type identifier (e.g., "browser", "dataLayer")'),config:Di.describe("Current source configuration"),push:c.z.any().describe("Push function - THE HANDLER (flexible signature for platform compatibility)"),destroy:c.z.any().optional().describe("Cleanup function called when source is removed"),on:c.z.unknown().optional().describe("Lifecycle hook function for event types")}).describe("Source instance with push handler and lifecycle methods"),Ri=c.z.any().describe("Source initialization function: (config, env) => Instance | Promise<Instance>"),Li=c.z.object({code:Ri.describe("Source initialization function"),config:xi.optional().describe("Partial configuration overrides"),env:Ei.partial().optional().describe("Partial environment overrides"),primary:c.z.boolean().optional().describe("Mark as primary source (only one can be primary)")}).describe("Source initialization configuration"),Mi=c.z.record(c.z.string(),Li).describe("Map of source IDs to initialization configurations"),Oi=l(Ei),qi=l(Di),Ni=l(xi),Ti=l(Ii),Ui=l(Li),Vi=l(Mi),Wi={};r(Wi,{ConfigSchema:()=>Ki,DefinitionsSchema:()=>Hi,DestinationReferenceSchema:()=>Qi,PackagesSchema:()=>_i,PrimitiveSchema:()=>Bi,ServerSchema:()=>Gi,SetupSchema:()=>Xi,SourceReferenceSchema:()=>$i,VariablesSchema:()=>Ai,WebSchema:()=>Fi,configJsonSchema:()=>tn,destinationReferenceJsonSchema:()=>an,parseConfig:()=>en,parseSetup:()=>Yi,safeParseConfig:()=>nn,safeParseSetup:()=>Zi,setupJsonSchema:()=>on,sourceReferenceJsonSchema:()=>rn});var Bi=c.z.union([c.z.string(),c.z.number(),c.z.boolean()]).describe("Primitive value: string, number, or boolean"),Ai=c.z.record(c.z.string(),Bi).describe("Variables for interpolation"),Hi=c.z.record(c.z.string(),c.z.unknown()).describe("Reusable configuration definitions"),_i=c.z.record(c.z.string(),c.z.object({version:c.z.string().optional(),imports:c.z.array(c.z.string()).optional(),path:c.z.string().optional()})).describe("NPM packages to bundle"),Fi=c.z.object({windowCollector:c.z.string().optional().describe('Window property name for collector instance (default: "collector")'),windowElb:c.z.string().optional().describe('Window property name for elb function (default: "elb")')}).describe("Web platform configuration"),Gi=c.z.object({}).passthrough().describe("Server platform configuration (reserved for future options)"),$i=c.z.object({package:c.z.string().min(1,"Package name cannot be empty").describe('Package specifier with optional version (e.g., "@walkeros/web-source-browser@2.0.0")'),code:c.z.string().optional().describe('Named export to use from the package (e.g., "sourceExpress"). If omitted, uses default export.'),config:c.z.unknown().optional().describe("Source-specific configuration object"),env:c.z.unknown().optional().describe("Source environment configuration"),primary:c.z.boolean().optional().describe("Mark as primary source (provides main elb). Only one source should be primary."),variables:Ai.optional().describe("Source-level variables (highest priority in cascade)"),definitions:Hi.optional().describe("Source-level definitions (highest priority in cascade)")}).describe("Source package reference with configuration"),Qi=c.z.object({package:c.z.string().min(1,"Package name cannot be empty").describe('Package specifier with optional version (e.g., "@walkeros/web-destination-gtag@2.0.0")'),code:c.z.string().optional().describe('Named export to use from the package (e.g., "destinationAnalytics"). If omitted, uses default export.'),config:c.z.unknown().optional().describe("Destination-specific configuration object"),env:c.z.unknown().optional().describe("Destination environment configuration"),variables:Ai.optional().describe("Destination-level variables (highest priority in cascade)"),definitions:Hi.optional().describe("Destination-level definitions (highest priority in cascade)")}).describe("Destination package reference with configuration"),Ki=c.z.object({web:Fi.optional().describe("Web platform configuration (browser-based tracking). Mutually exclusive with server."),server:Gi.optional().describe("Server platform configuration (Node.js). Mutually exclusive with web."),sources:c.z.record(c.z.string(),$i).optional().describe("Source configurations (data capture) keyed by unique identifier"),destinations:c.z.record(c.z.string(),Qi).optional().describe("Destination configurations (data output) keyed by unique identifier"),collector:c.z.unknown().optional().describe("Collector configuration for event processing (uses Collector.InitConfig)"),packages:_i.optional().describe("NPM packages to bundle"),variables:Ai.optional().describe("Flow-level variables (override Setup.variables, overridden by source/destination variables)"),definitions:Hi.optional().describe("Flow-level definitions (extend Setup.definitions, overridden by source/destination definitions)")}).refine(e=>{const i=void 0!==e.web,n=void 0!==e.server;return(i||n)&&!(i&&n)},{message:'Exactly one of "web" or "server" must be present'}).describe("Single flow configuration for one deployment target"),Xi=c.z.object({version:c.z.literal(1,{error:"Only version 1 is currently supported"}).describe("Configuration schema version (currently only 1 is supported)"),$schema:c.z.string().url("Schema URL must be a valid URL").optional().describe('JSON Schema reference for IDE validation (e.g., "https://walkeros.io/schema/flow/v1.json")'),variables:Ai.optional().describe("Shared variables for interpolation across all flows (use ${VAR_NAME} or ${VAR_NAME:default} syntax)"),definitions:Hi.optional().describe('Reusable configuration definitions (reference with JSON Schema $ref syntax: { "$ref": "#/definitions/name" })'),flows:c.z.record(c.z.string(),Ki).refine(e=>Object.keys(e).length>0,{message:"At least one flow is required"}).describe("Named flow configurations (e.g., production, staging, development)")}).describe("Complete multi-flow walkerOS configuration (walkeros.config.json)");function Yi(e){return Xi.parse(e)}function Zi(e){return Xi.safeParse(e)}function en(e){return Ki.parse(e)}function nn(e){return Ki.safeParse(e)}var on=c.z.toJSONSchema(Xi,{target:"draft-7"}),tn=l(Ki),rn=l($i),an=l(Qi);function sn(e,i){const n=[],o={};for(const[i,t]of Object.entries(e)){t.required&&n.push(i);const e={type:t.type};if(t.description&&(e.description=t.description),t.pattern&&(e.pattern=t.pattern),void 0!==t.minLength&&(e.minLength=t.minLength),void 0!==t.maxLength&&(e.maxLength=t.maxLength),void 0!==t.minimum&&(e.minimum=t.minimum),void 0!==t.maximum&&(e.maximum=t.maximum),t.enum&&(e.enum=[...t.enum]),void 0!==t.default&&(e.default=t.default),"object"===t.type&&t.properties){const i={};for(const[e,n]of Object.entries(t.properties))i[e]=cn(n);e.properties=i}"array"===t.type&&t.items&&(e.items=cn(t.items)),o[i]=e}const t={type:"object",properties:o};return i&&(t.title=i),n.length>0&&(t.required=n),t}function cn(e){const i={type:e.type};if(e.description&&(i.description=e.description),e.pattern&&(i.pattern=e.pattern),void 0!==e.minLength&&(i.minLength=e.minLength),void 0!==e.maxLength&&(i.maxLength=e.maxLength),void 0!==e.minimum&&(i.minimum=e.minimum),void 0!==e.maximum&&(i.maximum=e.maximum),e.enum&&(i.enum=[...e.enum]),void 0!==e.default&&(i.default=e.default),"object"===e.type&&e.properties){const n={};for(const[i,o]of Object.entries(e.properties))n[i]=cn(o);i.properties=n}return"array"===e.type&&e.items&&(i.items=cn(e.items)),i}function ln(e,i){const n={type:"array",items:cn(e)};return void 0!==i?.minItems&&(n.minItems=i.minItems),void 0!==i?.maxItems&&(n.maxItems=i.maxItems),i?.description&&(n.description=i.description),i?.title&&(n.title=i.title),n}function dn(e,i="string",n){const o={type:i,enum:[...e]};return n?.description&&(o.description=n.description),n?.title&&(o.title=n.title),o}function pn(e,i,n){return ln({type:"object"},{minItems:2,maxItems:2,description:n||"Tuple with exactly 2 elements [source, transform]"})}function un(e){return c.z.toJSONSchema(e,{target:"draft-7"})}//# sourceMappingURL=dev.js.map
|