@walkeros/core 0.5.0 → 0.6.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/dev.d.mts +82 -45
- package/dist/dev.d.ts +82 -45
- package/dist/index.d.mts +9 -1
- package/dist/index.d.ts +9 -1
- 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 +2 -2
package/dist/dev.d.mts
CHANGED
|
@@ -497,14 +497,14 @@ declare const PartialEventSchema: z.ZodObject<{
|
|
|
497
497
|
* Zod 4 deliberately removed .deepPartial() due to internal type complexity issues.
|
|
498
498
|
*/
|
|
499
499
|
declare const DeepPartialEventSchema: z.ZodTypeAny;
|
|
500
|
-
declare const eventJsonSchema: z.core.
|
|
501
|
-
declare const partialEventJsonSchema: z.core.
|
|
502
|
-
declare const userJsonSchema: z.core.
|
|
503
|
-
declare const propertiesJsonSchema: z.core.
|
|
504
|
-
declare const orderedPropertiesJsonSchema: z.core.
|
|
505
|
-
declare const entityJsonSchema: z.core.
|
|
506
|
-
declare const sourceTypeJsonSchema: z.core.
|
|
507
|
-
declare const consentJsonSchema: z.core.
|
|
500
|
+
declare const eventJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
501
|
+
declare const partialEventJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
502
|
+
declare const userJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
503
|
+
declare const propertiesJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
504
|
+
declare const orderedPropertiesJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
505
|
+
declare const entityJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
506
|
+
declare const sourceTypeJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
507
|
+
declare const consentJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
508
508
|
|
|
509
509
|
declare const walkeros_ConsentSchema: typeof ConsentSchema;
|
|
510
510
|
declare const walkeros_DeepPartialEventSchema: typeof DeepPartialEventSchema;
|
|
@@ -702,15 +702,15 @@ declare const ResultSchema$1: z.ZodObject<{
|
|
|
702
702
|
}, z.core.$strip>>;
|
|
703
703
|
mappingKey: z.ZodOptional<z.ZodString>;
|
|
704
704
|
}, z.core.$strip>;
|
|
705
|
-
declare const valueJsonSchema: z.core.
|
|
706
|
-
declare const valueConfigJsonSchema: z.core.
|
|
707
|
-
declare const loopJsonSchema: z.core.
|
|
708
|
-
declare const setJsonSchema: z.core.
|
|
709
|
-
declare const mapJsonSchema: z.core.
|
|
710
|
-
declare const policyJsonSchema: z.core.
|
|
711
|
-
declare const ruleJsonSchema: z.core.
|
|
712
|
-
declare const rulesJsonSchema: z.core.
|
|
713
|
-
declare const configJsonSchema$4: z.core.
|
|
705
|
+
declare const valueJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
706
|
+
declare const valueConfigJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
707
|
+
declare const loopJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
708
|
+
declare const setJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
709
|
+
declare const mapJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
710
|
+
declare const policyJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
711
|
+
declare const ruleJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
712
|
+
declare const rulesJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
713
|
+
declare const configJsonSchema$4: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
714
714
|
|
|
715
715
|
declare const mapping_LoopSchema: typeof LoopSchema;
|
|
716
716
|
declare const mapping_MapSchema: typeof MapSchema;
|
|
@@ -2649,13 +2649,13 @@ declare const DLQSchema: z.ZodArray<z.ZodTuple<[z.ZodObject<{
|
|
|
2649
2649
|
previous_id: z.ZodString;
|
|
2650
2650
|
}, z.core.$strip>>;
|
|
2651
2651
|
}, z.core.$strip>, z.ZodUnknown], null>>;
|
|
2652
|
-
declare const configJsonSchema$3: z.core.
|
|
2653
|
-
declare const partialConfigJsonSchema$1: z.core.
|
|
2654
|
-
declare const contextJsonSchema: z.core.
|
|
2655
|
-
declare const pushContextJsonSchema$1: z.core.
|
|
2656
|
-
declare const batchJsonSchema: z.core.
|
|
2657
|
-
declare const instanceJsonSchema$2: z.core.
|
|
2658
|
-
declare const resultJsonSchema: z.core.
|
|
2652
|
+
declare const configJsonSchema$3: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
2653
|
+
declare const partialConfigJsonSchema$1: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
2654
|
+
declare const contextJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
2655
|
+
declare const pushContextJsonSchema$1: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
2656
|
+
declare const batchJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
2657
|
+
declare const instanceJsonSchema$2: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
2658
|
+
declare const resultJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
2659
2659
|
|
|
2660
2660
|
declare const destination_BatchSchema: typeof BatchSchema;
|
|
2661
2661
|
declare const destination_ContextSchema: typeof ContextSchema;
|
|
@@ -3006,12 +3006,12 @@ declare const InstanceSchema$1: z.ZodObject<{
|
|
|
3006
3006
|
}, z.core.$strip>>;
|
|
3007
3007
|
version: z.ZodString;
|
|
3008
3008
|
}, z.core.$strip>;
|
|
3009
|
-
declare const commandTypeJsonSchema: z.core.
|
|
3010
|
-
declare const configJsonSchema$2: z.core.
|
|
3011
|
-
declare const sessionDataJsonSchema: z.core.
|
|
3012
|
-
declare const initConfigJsonSchema: z.core.
|
|
3013
|
-
declare const pushContextJsonSchema: z.core.
|
|
3014
|
-
declare const instanceJsonSchema$1: z.core.
|
|
3009
|
+
declare const commandTypeJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3010
|
+
declare const configJsonSchema$2: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3011
|
+
declare const sessionDataJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3012
|
+
declare const initConfigJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3013
|
+
declare const pushContextJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3014
|
+
declare const instanceJsonSchema$1: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3015
3015
|
|
|
3016
3016
|
declare const collector_CommandTypeSchema: typeof CommandTypeSchema;
|
|
3017
3017
|
declare const collector_DestinationsSchema: typeof DestinationsSchema;
|
|
@@ -3343,12 +3343,12 @@ declare const InitSourcesSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
3343
3343
|
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
3344
3344
|
primary: z.ZodOptional<z.ZodBoolean>;
|
|
3345
3345
|
}, z.core.$strip>>;
|
|
3346
|
-
declare const baseEnvJsonSchema: z.core.
|
|
3347
|
-
declare const configJsonSchema$1: z.core.
|
|
3348
|
-
declare const partialConfigJsonSchema: z.core.
|
|
3349
|
-
declare const instanceJsonSchema: z.core.
|
|
3350
|
-
declare const initSourceJsonSchema: z.core.
|
|
3351
|
-
declare const initSourcesJsonSchema: z.core.
|
|
3346
|
+
declare const baseEnvJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3347
|
+
declare const configJsonSchema$1: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3348
|
+
declare const partialConfigJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3349
|
+
declare const instanceJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3350
|
+
declare const initSourceJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3351
|
+
declare const initSourcesJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3352
3352
|
|
|
3353
3353
|
declare const source_BaseEnvSchema: typeof BaseEnvSchema;
|
|
3354
3354
|
declare const source_InitSchema: typeof InitSchema;
|
|
@@ -3684,7 +3684,44 @@ declare function safeParseConfig(data: unknown): z.ZodSafeParseResult<{
|
|
|
3684
3684
|
* );
|
|
3685
3685
|
* ```
|
|
3686
3686
|
*/
|
|
3687
|
-
declare const setupJsonSchema: z.core.
|
|
3687
|
+
declare const setupJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
|
|
3688
|
+
version: z.ZodLiteral<1>;
|
|
3689
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
3690
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
3691
|
+
definitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3692
|
+
flows: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
3693
|
+
web: z.ZodOptional<z.ZodObject<{
|
|
3694
|
+
windowCollector: z.ZodOptional<z.ZodString>;
|
|
3695
|
+
windowElb: z.ZodOptional<z.ZodString>;
|
|
3696
|
+
}, z.core.$strip>>;
|
|
3697
|
+
server: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
3698
|
+
sources: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
3699
|
+
package: z.ZodString;
|
|
3700
|
+
code: z.ZodOptional<z.ZodString>;
|
|
3701
|
+
config: z.ZodOptional<z.ZodUnknown>;
|
|
3702
|
+
env: z.ZodOptional<z.ZodUnknown>;
|
|
3703
|
+
primary: z.ZodOptional<z.ZodBoolean>;
|
|
3704
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
3705
|
+
definitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3706
|
+
}, z.core.$strip>>>;
|
|
3707
|
+
destinations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
3708
|
+
package: z.ZodString;
|
|
3709
|
+
code: z.ZodOptional<z.ZodString>;
|
|
3710
|
+
config: z.ZodOptional<z.ZodUnknown>;
|
|
3711
|
+
env: z.ZodOptional<z.ZodUnknown>;
|
|
3712
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
3713
|
+
definitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3714
|
+
}, z.core.$strip>>>;
|
|
3715
|
+
collector: z.ZodOptional<z.ZodUnknown>;
|
|
3716
|
+
packages: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
3717
|
+
version: z.ZodOptional<z.ZodString>;
|
|
3718
|
+
imports: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
3719
|
+
path: z.ZodOptional<z.ZodString>;
|
|
3720
|
+
}, z.core.$strip>>>;
|
|
3721
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
3722
|
+
definitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3723
|
+
}, z.core.$strip>>;
|
|
3724
|
+
}, z.core.$strip>>;
|
|
3688
3725
|
/**
|
|
3689
3726
|
* Generate JSON Schema for Flow.Config.
|
|
3690
3727
|
*
|
|
@@ -3693,7 +3730,7 @@ declare const setupJsonSchema: z.core.JSONSchema.JSONSchema;
|
|
|
3693
3730
|
*
|
|
3694
3731
|
* @returns JSON Schema (Draft 7) representation of ConfigSchema
|
|
3695
3732
|
*/
|
|
3696
|
-
declare const configJsonSchema: z.core.
|
|
3733
|
+
declare const configJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3697
3734
|
/**
|
|
3698
3735
|
* Generate JSON Schema for SourceReference.
|
|
3699
3736
|
*
|
|
@@ -3702,7 +3739,7 @@ declare const configJsonSchema: z.core.JSONSchema.JSONSchema;
|
|
|
3702
3739
|
*
|
|
3703
3740
|
* @returns JSON Schema (Draft 7) representation of SourceReferenceSchema
|
|
3704
3741
|
*/
|
|
3705
|
-
declare const sourceReferenceJsonSchema: z.core.
|
|
3742
|
+
declare const sourceReferenceJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3706
3743
|
/**
|
|
3707
3744
|
* Generate JSON Schema for DestinationReference.
|
|
3708
3745
|
*
|
|
@@ -3711,7 +3748,7 @@ declare const sourceReferenceJsonSchema: z.core.JSONSchema.JSONSchema;
|
|
|
3711
3748
|
*
|
|
3712
3749
|
* @returns JSON Schema (Draft 7) representation of DestinationReferenceSchema
|
|
3713
3750
|
*/
|
|
3714
|
-
declare const destinationReferenceJsonSchema: z.core.
|
|
3751
|
+
declare const destinationReferenceJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3715
3752
|
|
|
3716
3753
|
declare const flow_ConfigSchema: typeof ConfigSchema;
|
|
3717
3754
|
declare const flow_DefinitionsSchema: typeof DefinitionsSchema;
|
|
@@ -3813,11 +3850,11 @@ declare const HandlerSchema: z.ZodObject<{
|
|
|
3813
3850
|
Error: z.ZodAny;
|
|
3814
3851
|
Log: z.ZodAny;
|
|
3815
3852
|
}, z.core.$strip>;
|
|
3816
|
-
declare const storageTypeJsonSchema: z.core.
|
|
3817
|
-
declare const storageJsonSchema: z.core.
|
|
3818
|
-
declare const errorHandlerJsonSchema: z.core.
|
|
3819
|
-
declare const logHandlerJsonSchema: z.core.
|
|
3820
|
-
declare const handlerJsonSchema: z.core.
|
|
3853
|
+
declare const storageTypeJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3854
|
+
declare const storageJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3855
|
+
declare const errorHandlerJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3856
|
+
declare const logHandlerJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3857
|
+
declare const handlerJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3821
3858
|
|
|
3822
3859
|
declare const utilities_ErrorHandlerSchema: typeof ErrorHandlerSchema;
|
|
3823
3860
|
declare const utilities_HandlerSchema: typeof HandlerSchema;
|
package/dist/dev.d.ts
CHANGED
|
@@ -497,14 +497,14 @@ declare const PartialEventSchema: z.ZodObject<{
|
|
|
497
497
|
* Zod 4 deliberately removed .deepPartial() due to internal type complexity issues.
|
|
498
498
|
*/
|
|
499
499
|
declare const DeepPartialEventSchema: z.ZodTypeAny;
|
|
500
|
-
declare const eventJsonSchema: z.core.
|
|
501
|
-
declare const partialEventJsonSchema: z.core.
|
|
502
|
-
declare const userJsonSchema: z.core.
|
|
503
|
-
declare const propertiesJsonSchema: z.core.
|
|
504
|
-
declare const orderedPropertiesJsonSchema: z.core.
|
|
505
|
-
declare const entityJsonSchema: z.core.
|
|
506
|
-
declare const sourceTypeJsonSchema: z.core.
|
|
507
|
-
declare const consentJsonSchema: z.core.
|
|
500
|
+
declare const eventJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
501
|
+
declare const partialEventJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
502
|
+
declare const userJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
503
|
+
declare const propertiesJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
504
|
+
declare const orderedPropertiesJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
505
|
+
declare const entityJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
506
|
+
declare const sourceTypeJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
507
|
+
declare const consentJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
508
508
|
|
|
509
509
|
declare const walkeros_ConsentSchema: typeof ConsentSchema;
|
|
510
510
|
declare const walkeros_DeepPartialEventSchema: typeof DeepPartialEventSchema;
|
|
@@ -702,15 +702,15 @@ declare const ResultSchema$1: z.ZodObject<{
|
|
|
702
702
|
}, z.core.$strip>>;
|
|
703
703
|
mappingKey: z.ZodOptional<z.ZodString>;
|
|
704
704
|
}, z.core.$strip>;
|
|
705
|
-
declare const valueJsonSchema: z.core.
|
|
706
|
-
declare const valueConfigJsonSchema: z.core.
|
|
707
|
-
declare const loopJsonSchema: z.core.
|
|
708
|
-
declare const setJsonSchema: z.core.
|
|
709
|
-
declare const mapJsonSchema: z.core.
|
|
710
|
-
declare const policyJsonSchema: z.core.
|
|
711
|
-
declare const ruleJsonSchema: z.core.
|
|
712
|
-
declare const rulesJsonSchema: z.core.
|
|
713
|
-
declare const configJsonSchema$4: z.core.
|
|
705
|
+
declare const valueJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
706
|
+
declare const valueConfigJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
707
|
+
declare const loopJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
708
|
+
declare const setJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
709
|
+
declare const mapJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
710
|
+
declare const policyJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
711
|
+
declare const ruleJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
712
|
+
declare const rulesJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
713
|
+
declare const configJsonSchema$4: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
714
714
|
|
|
715
715
|
declare const mapping_LoopSchema: typeof LoopSchema;
|
|
716
716
|
declare const mapping_MapSchema: typeof MapSchema;
|
|
@@ -2649,13 +2649,13 @@ declare const DLQSchema: z.ZodArray<z.ZodTuple<[z.ZodObject<{
|
|
|
2649
2649
|
previous_id: z.ZodString;
|
|
2650
2650
|
}, z.core.$strip>>;
|
|
2651
2651
|
}, z.core.$strip>, z.ZodUnknown], null>>;
|
|
2652
|
-
declare const configJsonSchema$3: z.core.
|
|
2653
|
-
declare const partialConfigJsonSchema$1: z.core.
|
|
2654
|
-
declare const contextJsonSchema: z.core.
|
|
2655
|
-
declare const pushContextJsonSchema$1: z.core.
|
|
2656
|
-
declare const batchJsonSchema: z.core.
|
|
2657
|
-
declare const instanceJsonSchema$2: z.core.
|
|
2658
|
-
declare const resultJsonSchema: z.core.
|
|
2652
|
+
declare const configJsonSchema$3: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
2653
|
+
declare const partialConfigJsonSchema$1: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
2654
|
+
declare const contextJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
2655
|
+
declare const pushContextJsonSchema$1: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
2656
|
+
declare const batchJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
2657
|
+
declare const instanceJsonSchema$2: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
2658
|
+
declare const resultJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
2659
2659
|
|
|
2660
2660
|
declare const destination_BatchSchema: typeof BatchSchema;
|
|
2661
2661
|
declare const destination_ContextSchema: typeof ContextSchema;
|
|
@@ -3006,12 +3006,12 @@ declare const InstanceSchema$1: z.ZodObject<{
|
|
|
3006
3006
|
}, z.core.$strip>>;
|
|
3007
3007
|
version: z.ZodString;
|
|
3008
3008
|
}, z.core.$strip>;
|
|
3009
|
-
declare const commandTypeJsonSchema: z.core.
|
|
3010
|
-
declare const configJsonSchema$2: z.core.
|
|
3011
|
-
declare const sessionDataJsonSchema: z.core.
|
|
3012
|
-
declare const initConfigJsonSchema: z.core.
|
|
3013
|
-
declare const pushContextJsonSchema: z.core.
|
|
3014
|
-
declare const instanceJsonSchema$1: z.core.
|
|
3009
|
+
declare const commandTypeJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3010
|
+
declare const configJsonSchema$2: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3011
|
+
declare const sessionDataJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3012
|
+
declare const initConfigJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3013
|
+
declare const pushContextJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3014
|
+
declare const instanceJsonSchema$1: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3015
3015
|
|
|
3016
3016
|
declare const collector_CommandTypeSchema: typeof CommandTypeSchema;
|
|
3017
3017
|
declare const collector_DestinationsSchema: typeof DestinationsSchema;
|
|
@@ -3343,12 +3343,12 @@ declare const InitSourcesSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
3343
3343
|
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
3344
3344
|
primary: z.ZodOptional<z.ZodBoolean>;
|
|
3345
3345
|
}, z.core.$strip>>;
|
|
3346
|
-
declare const baseEnvJsonSchema: z.core.
|
|
3347
|
-
declare const configJsonSchema$1: z.core.
|
|
3348
|
-
declare const partialConfigJsonSchema: z.core.
|
|
3349
|
-
declare const instanceJsonSchema: z.core.
|
|
3350
|
-
declare const initSourceJsonSchema: z.core.
|
|
3351
|
-
declare const initSourcesJsonSchema: z.core.
|
|
3346
|
+
declare const baseEnvJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3347
|
+
declare const configJsonSchema$1: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3348
|
+
declare const partialConfigJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3349
|
+
declare const instanceJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3350
|
+
declare const initSourceJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3351
|
+
declare const initSourcesJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3352
3352
|
|
|
3353
3353
|
declare const source_BaseEnvSchema: typeof BaseEnvSchema;
|
|
3354
3354
|
declare const source_InitSchema: typeof InitSchema;
|
|
@@ -3684,7 +3684,44 @@ declare function safeParseConfig(data: unknown): z.ZodSafeParseResult<{
|
|
|
3684
3684
|
* );
|
|
3685
3685
|
* ```
|
|
3686
3686
|
*/
|
|
3687
|
-
declare const setupJsonSchema: z.core.
|
|
3687
|
+
declare const setupJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
|
|
3688
|
+
version: z.ZodLiteral<1>;
|
|
3689
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
3690
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
3691
|
+
definitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3692
|
+
flows: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
3693
|
+
web: z.ZodOptional<z.ZodObject<{
|
|
3694
|
+
windowCollector: z.ZodOptional<z.ZodString>;
|
|
3695
|
+
windowElb: z.ZodOptional<z.ZodString>;
|
|
3696
|
+
}, z.core.$strip>>;
|
|
3697
|
+
server: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
3698
|
+
sources: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
3699
|
+
package: z.ZodString;
|
|
3700
|
+
code: z.ZodOptional<z.ZodString>;
|
|
3701
|
+
config: z.ZodOptional<z.ZodUnknown>;
|
|
3702
|
+
env: z.ZodOptional<z.ZodUnknown>;
|
|
3703
|
+
primary: z.ZodOptional<z.ZodBoolean>;
|
|
3704
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
3705
|
+
definitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3706
|
+
}, z.core.$strip>>>;
|
|
3707
|
+
destinations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
3708
|
+
package: z.ZodString;
|
|
3709
|
+
code: z.ZodOptional<z.ZodString>;
|
|
3710
|
+
config: z.ZodOptional<z.ZodUnknown>;
|
|
3711
|
+
env: z.ZodOptional<z.ZodUnknown>;
|
|
3712
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
3713
|
+
definitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3714
|
+
}, z.core.$strip>>>;
|
|
3715
|
+
collector: z.ZodOptional<z.ZodUnknown>;
|
|
3716
|
+
packages: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
3717
|
+
version: z.ZodOptional<z.ZodString>;
|
|
3718
|
+
imports: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
3719
|
+
path: z.ZodOptional<z.ZodString>;
|
|
3720
|
+
}, z.core.$strip>>>;
|
|
3721
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
3722
|
+
definitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3723
|
+
}, z.core.$strip>>;
|
|
3724
|
+
}, z.core.$strip>>;
|
|
3688
3725
|
/**
|
|
3689
3726
|
* Generate JSON Schema for Flow.Config.
|
|
3690
3727
|
*
|
|
@@ -3693,7 +3730,7 @@ declare const setupJsonSchema: z.core.JSONSchema.JSONSchema;
|
|
|
3693
3730
|
*
|
|
3694
3731
|
* @returns JSON Schema (Draft 7) representation of ConfigSchema
|
|
3695
3732
|
*/
|
|
3696
|
-
declare const configJsonSchema: z.core.
|
|
3733
|
+
declare const configJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3697
3734
|
/**
|
|
3698
3735
|
* Generate JSON Schema for SourceReference.
|
|
3699
3736
|
*
|
|
@@ -3702,7 +3739,7 @@ declare const configJsonSchema: z.core.JSONSchema.JSONSchema;
|
|
|
3702
3739
|
*
|
|
3703
3740
|
* @returns JSON Schema (Draft 7) representation of SourceReferenceSchema
|
|
3704
3741
|
*/
|
|
3705
|
-
declare const sourceReferenceJsonSchema: z.core.
|
|
3742
|
+
declare const sourceReferenceJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3706
3743
|
/**
|
|
3707
3744
|
* Generate JSON Schema for DestinationReference.
|
|
3708
3745
|
*
|
|
@@ -3711,7 +3748,7 @@ declare const sourceReferenceJsonSchema: z.core.JSONSchema.JSONSchema;
|
|
|
3711
3748
|
*
|
|
3712
3749
|
* @returns JSON Schema (Draft 7) representation of DestinationReferenceSchema
|
|
3713
3750
|
*/
|
|
3714
|
-
declare const destinationReferenceJsonSchema: z.core.
|
|
3751
|
+
declare const destinationReferenceJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3715
3752
|
|
|
3716
3753
|
declare const flow_ConfigSchema: typeof ConfigSchema;
|
|
3717
3754
|
declare const flow_DefinitionsSchema: typeof DefinitionsSchema;
|
|
@@ -3813,11 +3850,11 @@ declare const HandlerSchema: z.ZodObject<{
|
|
|
3813
3850
|
Error: z.ZodAny;
|
|
3814
3851
|
Log: z.ZodAny;
|
|
3815
3852
|
}, z.core.$strip>;
|
|
3816
|
-
declare const storageTypeJsonSchema: z.core.
|
|
3817
|
-
declare const storageJsonSchema: z.core.
|
|
3818
|
-
declare const errorHandlerJsonSchema: z.core.
|
|
3819
|
-
declare const logHandlerJsonSchema: z.core.
|
|
3820
|
-
declare const handlerJsonSchema: z.core.
|
|
3853
|
+
declare const storageTypeJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3854
|
+
declare const storageJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3855
|
+
declare const errorHandlerJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3856
|
+
declare const logHandlerJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3857
|
+
declare const handlerJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
3821
3858
|
|
|
3822
3859
|
declare const utilities_ErrorHandlerSchema: typeof ErrorHandlerSchema;
|
|
3823
3860
|
declare const utilities_HandlerSchema: typeof HandlerSchema;
|
package/dist/index.d.mts
CHANGED
|
@@ -211,6 +211,7 @@ interface Instance$2<T extends TypesGeneric$1 = Types$2> {
|
|
|
211
211
|
config: Config$5<T>;
|
|
212
212
|
queue?: Events;
|
|
213
213
|
dlq?: DLQ;
|
|
214
|
+
batches?: BatchRegistry<Mapping$1<T>>;
|
|
214
215
|
type?: string;
|
|
215
216
|
env?: Env$1<T>;
|
|
216
217
|
init?: InitFn<T>;
|
|
@@ -281,6 +282,12 @@ interface Batch<Mapping> {
|
|
|
281
282
|
data: Array<Data$1>;
|
|
282
283
|
mapping?: Rule<Mapping>;
|
|
283
284
|
}
|
|
285
|
+
interface BatchRegistry<Mapping> {
|
|
286
|
+
[mappingKey: string]: {
|
|
287
|
+
batched: Batch<Mapping>;
|
|
288
|
+
batchFn: () => void;
|
|
289
|
+
};
|
|
290
|
+
}
|
|
284
291
|
type Data$1 = Property | undefined | Array<Property | undefined>;
|
|
285
292
|
type Ref = {
|
|
286
293
|
id: string;
|
|
@@ -298,6 +305,7 @@ type Result$1 = {
|
|
|
298
305
|
};
|
|
299
306
|
|
|
300
307
|
type destination_Batch<Mapping> = Batch<Mapping>;
|
|
308
|
+
type destination_BatchRegistry<Mapping> = BatchRegistry<Mapping>;
|
|
301
309
|
type destination_Code<T extends TypesGeneric$1 = Types$2> = Code<T>;
|
|
302
310
|
type destination_DLQ = DLQ;
|
|
303
311
|
type destination_Destinations = Destinations;
|
|
@@ -312,7 +320,7 @@ type destination_PushEvents<Mapping = unknown> = PushEvents<Mapping>;
|
|
|
312
320
|
type destination_PushFn<T extends TypesGeneric$1 = Types$2> = PushFn<T>;
|
|
313
321
|
type destination_Ref = Ref;
|
|
314
322
|
declare namespace destination {
|
|
315
|
-
export type { BaseEnv$1 as BaseEnv, destination_Batch as Batch, destination_Code as Code, Config$5 as Config, Context$2 as Context, destination_DLQ as DLQ, Data$1 as Data, destination_Destinations as Destinations, Env$1 as Env, Init$1 as Init, destination_InitContext as InitContext, destination_InitDestinations as InitDestinations, destination_InitFn as InitFn, InitSettings$1 as InitSettings, Instance$2 as Instance, Mapping$1 as Mapping, PartialConfig$1 as PartialConfig, Policy$1 as Policy, Push$1 as Push, destination_PushBatchContext as PushBatchContext, destination_PushBatchFn as PushBatchFn, destination_PushContext as PushContext, destination_PushEvent as PushEvent, destination_PushEvents as PushEvents, destination_PushFn as PushFn, destination_Ref as Ref, Result$1 as Result, Settings$1 as Settings, Types$2 as Types, TypesGeneric$1 as TypesGeneric, TypesOf$1 as TypesOf };
|
|
323
|
+
export type { BaseEnv$1 as BaseEnv, destination_Batch as Batch, destination_BatchRegistry as BatchRegistry, destination_Code as Code, Config$5 as Config, Context$2 as Context, destination_DLQ as DLQ, Data$1 as Data, destination_Destinations as Destinations, Env$1 as Env, Init$1 as Init, destination_InitContext as InitContext, destination_InitDestinations as InitDestinations, destination_InitFn as InitFn, InitSettings$1 as InitSettings, Instance$2 as Instance, Mapping$1 as Mapping, PartialConfig$1 as PartialConfig, Policy$1 as Policy, Push$1 as Push, destination_PushBatchContext as PushBatchContext, destination_PushBatchFn as PushBatchFn, destination_PushContext as PushContext, destination_PushEvent as PushEvent, destination_PushEvents as PushEvents, destination_PushFn as PushFn, destination_Ref as Ref, Result$1 as Result, Settings$1 as Settings, Types$2 as Types, TypesGeneric$1 as TypesGeneric, TypesOf$1 as TypesOf };
|
|
316
324
|
}
|
|
317
325
|
|
|
318
326
|
interface EventFn<R = Promise<PushResult>> {
|
package/dist/index.d.ts
CHANGED
|
@@ -211,6 +211,7 @@ interface Instance$2<T extends TypesGeneric$1 = Types$2> {
|
|
|
211
211
|
config: Config$5<T>;
|
|
212
212
|
queue?: Events;
|
|
213
213
|
dlq?: DLQ;
|
|
214
|
+
batches?: BatchRegistry<Mapping$1<T>>;
|
|
214
215
|
type?: string;
|
|
215
216
|
env?: Env$1<T>;
|
|
216
217
|
init?: InitFn<T>;
|
|
@@ -281,6 +282,12 @@ interface Batch<Mapping> {
|
|
|
281
282
|
data: Array<Data$1>;
|
|
282
283
|
mapping?: Rule<Mapping>;
|
|
283
284
|
}
|
|
285
|
+
interface BatchRegistry<Mapping> {
|
|
286
|
+
[mappingKey: string]: {
|
|
287
|
+
batched: Batch<Mapping>;
|
|
288
|
+
batchFn: () => void;
|
|
289
|
+
};
|
|
290
|
+
}
|
|
284
291
|
type Data$1 = Property | undefined | Array<Property | undefined>;
|
|
285
292
|
type Ref = {
|
|
286
293
|
id: string;
|
|
@@ -298,6 +305,7 @@ type Result$1 = {
|
|
|
298
305
|
};
|
|
299
306
|
|
|
300
307
|
type destination_Batch<Mapping> = Batch<Mapping>;
|
|
308
|
+
type destination_BatchRegistry<Mapping> = BatchRegistry<Mapping>;
|
|
301
309
|
type destination_Code<T extends TypesGeneric$1 = Types$2> = Code<T>;
|
|
302
310
|
type destination_DLQ = DLQ;
|
|
303
311
|
type destination_Destinations = Destinations;
|
|
@@ -312,7 +320,7 @@ type destination_PushEvents<Mapping = unknown> = PushEvents<Mapping>;
|
|
|
312
320
|
type destination_PushFn<T extends TypesGeneric$1 = Types$2> = PushFn<T>;
|
|
313
321
|
type destination_Ref = Ref;
|
|
314
322
|
declare namespace destination {
|
|
315
|
-
export type { BaseEnv$1 as BaseEnv, destination_Batch as Batch, destination_Code as Code, Config$5 as Config, Context$2 as Context, destination_DLQ as DLQ, Data$1 as Data, destination_Destinations as Destinations, Env$1 as Env, Init$1 as Init, destination_InitContext as InitContext, destination_InitDestinations as InitDestinations, destination_InitFn as InitFn, InitSettings$1 as InitSettings, Instance$2 as Instance, Mapping$1 as Mapping, PartialConfig$1 as PartialConfig, Policy$1 as Policy, Push$1 as Push, destination_PushBatchContext as PushBatchContext, destination_PushBatchFn as PushBatchFn, destination_PushContext as PushContext, destination_PushEvent as PushEvent, destination_PushEvents as PushEvents, destination_PushFn as PushFn, destination_Ref as Ref, Result$1 as Result, Settings$1 as Settings, Types$2 as Types, TypesGeneric$1 as TypesGeneric, TypesOf$1 as TypesOf };
|
|
323
|
+
export type { BaseEnv$1 as BaseEnv, destination_Batch as Batch, destination_BatchRegistry as BatchRegistry, destination_Code as Code, Config$5 as Config, Context$2 as Context, destination_DLQ as DLQ, Data$1 as Data, destination_Destinations as Destinations, Env$1 as Env, Init$1 as Init, destination_InitContext as InitContext, destination_InitDestinations as InitDestinations, destination_InitFn as InitFn, InitSettings$1 as InitSettings, Instance$2 as Instance, Mapping$1 as Mapping, PartialConfig$1 as PartialConfig, Policy$1 as Policy, Push$1 as Push, destination_PushBatchContext as PushBatchContext, destination_PushBatchFn as PushBatchFn, destination_PushContext as PushContext, destination_PushEvent as PushEvent, destination_PushEvents as PushEvents, destination_PushFn as PushFn, destination_Ref as Ref, Result$1 as Result, Settings$1 as Settings, Types$2 as Types, TypesGeneric$1 as TypesGeneric, TypesOf$1 as TypesOf };
|
|
316
324
|
}
|
|
317
325
|
|
|
318
326
|
interface EventFn<R = Promise<PushResult>> {
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,i=(e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})},s={};i(s,{Collector:()=>c,Const:()=>j,Data:()=>a,Destination:()=>u,Elb:()=>l,Flow:()=>f,Hooks:()=>p,Level:()=>g,Logger:()=>d,Mapping:()=>m,On:()=>y,Request:()=>b,Schema:()=>h,Source:()=>v,WalkerOS:()=>w,anonymizeIP:()=>O,assign:()=>T,castToProperty:()=>ue,castValue:()=>W,clone:()=>z,createDestination:()=>J,createEvent:()=>X,createLogger:()=>ie,createMockLogger:()=>he,debounce:()=>ee,filterValues:()=>ae,getBrowser:()=>$e,getBrowserVersion:()=>Ae,getByPath:()=>H,getDeviceType:()=>Ne,getEvent:()=>Q,getFlowConfig:()=>P,getGrantedConsent:()=>G,getHeaders:()=>Oe,getId:()=>Y,getMappingEvent:()=>pe,getMappingValue:()=>de,getMarketingParameters:()=>Z,getOS:()=>Pe,getOSVersion:()=>Me,getPlatform:()=>M,isArguments:()=>C,isArray:()=>D,isBoolean:()=>I,isCommand:()=>V,isDefined:()=>_,isElementOrDocument:()=>L,isFunction:()=>R,isNumber:()=>F,isObject:()=>B,isPropertyType:()=>ce,isSameType:()=>K,isString:()=>U,mockEnv:()=>ye,packageNameToVariable:()=>S,parseUserAgent:()=>Se,processEventMapping:()=>me,requestToData:()=>ve,requestToParameter:()=>we,setByPath:()=>q,throttle:()=>te,throwError:()=>xe,transformData:()=>je,traverseEnv:()=>be,trim:()=>Ee,tryCatch:()=>le,tryCatchAsync:()=>fe,useHooks:()=>ke,validateEvent:()=>Te,validateProperty:()=>Ce,wrapCondition:()=>Ie,wrapFn:()=>Ve,wrapValidate:()=>_e}),module.exports=(e=s,((e,i,s,c)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let a of r(i))o.call(e,a)||a===s||t(e,a,{get:()=>i[a],enumerable:!(c=n(i,a))||c.enumerable});return e})(t({},"__esModule",{value:!0}),e));var c={},a={},u={},l={},f={},p={},d={};i(d,{Level:()=>g});var g=(e=>(e[e.ERROR=0]="ERROR",e[e.INFO=1]="INFO",e[e.DEBUG=2]="DEBUG",e))(g||{}),m={},y={},b={},h={},v={},w={},j={Utils:{Storage:{Local:"local",Session:"session",Cookie:"cookie"}}};function O(e){return/^(?:\d{1,3}\.){3}\d{1,3}$/.test(e)?e.replace(/\.\d+$/,".0"):""}function x(...e){const t={};for(const n of e)n&&Object.assign(t,n);return t}function E(...e){const t={};for(const n of e)n&&Object.assign(t,n);return t}function k(e,t){if("string"==typeof e)return e.replace(/\$\{([^}:]+)(?::([^}]*))?\}/g,(e,n,r)=>{if("undefined"!=typeof process&&void 0!==process.env?.[n])return process.env[n];if(void 0!==t[n])return String(t[n]);if(void 0!==r)return r;throw new Error(`Variable "${n}" not found and no default provided`)});if(Array.isArray(e))return e.map(e=>k(e,t));if(null!==e&&"object"==typeof e){const n={};for(const[r,o]of Object.entries(e))n[r]=k(o,t);return n}return e}function S(e){const t=e.startsWith("@"),n=e.replace("@","").replace(/[/-]/g,"_").split("_").filter(e=>e.length>0).map((e,t)=>0===t?e:e.charAt(0).toUpperCase()+e.slice(1)).join("");return t?"_"+n:n}function $(e,t,n){if(t)return t;if(!e||!n)return;return n[e]?S(e):void 0}function A(e,t){if(null!==e&&"object"==typeof e){if("$ref"in e&&"string"==typeof e.$ref){const n=e.$ref,r=n.match(/^#\/definitions\/(.+)$/);if(r){const e=r[1];if(void 0===t[e])throw new Error(`Definition "${e}" not found`);return A(t[e],t)}throw new Error(`Invalid $ref format: ${n}`)}if(Array.isArray(e))return e.map(e=>A(e,t));const n={};for(const[r,o]of Object.entries(e))n[r]=A(o,t);return n}return e}function P(e,t){const n=Object.keys(e.flows);if(!t){if(1!==n.length)throw new Error(`Multiple flows found (${n.join(", ")}). Please specify a flow.`);t=n[0]}const r=e.flows[t];if(!r)throw new Error(`Flow "${t}" not found. Available: ${n.join(", ")}`);const o=JSON.parse(JSON.stringify(r));if(o.sources)for(const[t,n]of Object.entries(o.sources)){const i=x(e.variables,r.variables,n.variables),s=E(e.definitions,r.definitions,n.definitions);let c=A(n.config,s);c=k(c,i);const a=$(n.package,n.code,o.packages);o.sources[t]={...n,config:c,...a&&{code:a}}}if(o.destinations)for(const[t,n]of Object.entries(o.destinations)){const i=x(e.variables,r.variables,n.variables),s=E(e.definitions,r.definitions,n.definitions);let c=A(n.config,s);c=k(c,i);const a=$(n.package,n.code,o.packages);o.destinations[t]={...n,config:c,...a&&{code:a}}}if(o.collector){const t=x(e.variables,r.variables),n=E(e.definitions,r.definitions);let i=A(o.collector,n);i=k(i,t),o.collector=i}return o}function M(e){if(void 0!==e.web)return"web";if(void 0!==e.server)return"server";throw new Error("Config must have web or server key")}var N={merge:!0,shallow:!0,extend:!0};function T(e,t={},n={}){n={...N,...n};const r=Object.entries(t).reduce((t,[r,o])=>{const i=e[r];return n.merge&&Array.isArray(i)&&Array.isArray(o)?t[r]=o.reduce((e,t)=>e.includes(t)?e:[...e,t],[...i]):(n.extend||r in e)&&(t[r]=o),t},{});return n.shallow?{...e,...r}:(Object.assign(e,r),e)}function C(e){return"[object Arguments]"===Object.prototype.toString.call(e)}function D(e){return Array.isArray(e)}function I(e){return"boolean"==typeof e}function V(e){return"walker"===e}function _(e){return void 0!==e}function L(e){return e===document||e instanceof Element}function R(e){return"function"==typeof e}function F(e){return"number"==typeof e&&!Number.isNaN(e)}function B(e){return"object"==typeof e&&null!==e&&!D(e)&&"[object Object]"===Object.prototype.toString.call(e)}function K(e,t){return typeof e==typeof t}function U(e){return"string"==typeof e}function z(e,t=new WeakMap){if("object"!=typeof e||null===e)return e;if(t.has(e))return t.get(e);const n=Object.prototype.toString.call(e);if("[object Object]"===n){const n={};t.set(e,n);for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=z(e[r],t));return n}if("[object Array]"===n){const n=[];return t.set(e,n),e.forEach(e=>{n.push(z(e,t))}),n}if("[object Date]"===n)return new Date(e.getTime());if("[object RegExp]"===n){const t=e;return new RegExp(t.source,t.flags)}return e}function H(e,t="",n){const r=t.split(".");let o=e;for(let e=0;e<r.length;e++){const t=r[e];if("*"===t&&D(o)){const t=r.slice(e+1).join("."),i=[];for(const e of o){const r=H(e,t,n);i.push(r)}return i}if(o=o instanceof Object?o[t]:void 0,!o)break}return _(o)?o:n}function q(e,t,n){if(!B(e))return e;const r=z(e),o=t.split(".");let i=r;for(let e=0;e<o.length;e++){const t=o[e];e===o.length-1?i[t]=n:(t in i&&"object"==typeof i[t]&&null!==i[t]||(i[t]={}),i=i[t])}return r}function W(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}function G(e,t={},n={}){const r={...t,...n},o={};let i=void 0===e;return Object.keys(r).forEach(t=>{r[t]&&(o[t]=!0,e&&e[t]&&(i=!0))}),!!i&&o}function J(e,t){const n={...e};return n.config=T(e.config,t,{shallow:!0,merge:!0,extend:!0}),e.config.settings&&t.settings&&(n.config.settings=T(e.config.settings,t.settings,{shallow:!0,merge:!0,extend:!0})),e.config.mapping&&t.mapping&&(n.config.mapping=T(e.config.mapping,t.mapping,{shallow:!0,merge:!0,extend:!0})),n}function X(e={}){const t=e.timestamp||(new Date).setHours(0,13,37,0),n=e.group||"gr0up",r=e.count||1,o=T({name:"entity action",data:{string:"foo",number:1,boolean:!0,array:[0,"text",!1],not:void 0},context:{dev:["test",1]},globals:{lang:"elb"},custom:{completely:"random"},user:{id:"us3r",device:"c00k13",session:"s3ss10n"},nested:[{entity:"child",data:{is:"subordinated"},nested:[],context:{element:["child",0]}}],consent:{functional:!0},id:`${t}-${n}-${r}`,trigger:"test",entity:"entity",action:"action",timestamp:t,timing:3.14,group:n,count:r,version:{source:"0.5.0",tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},e,{merge:!1});if(e.name){const[t,n]=e.name.split(" ")??[];t&&n&&(o.entity=t,o.action=n)}return o}function Q(e="entity action",t={}){const n=t.timestamp||(new Date).setHours(0,13,37,0),r={data:{id:"ers",name:"Everyday Ruck Snack",color:"black",size:"l",price:420}},o={data:{id:"cc",name:"Cool Cap",size:"one size",price:42}};return X({...{"cart view":{data:{currency:"EUR",value:2*r.data.price},context:{shopping:["cart",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",data:{...r.data,quantity:2},context:{shopping:["cart",0]},nested:[]}],trigger:"load"},"checkout view":{data:{step:"payment",currency:"EUR",value:r.data.price+o.data.price},context:{shopping:["checkout",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...r,context:{shopping:["checkout",0]},nested:[]},{entity:"product",...o,context:{shopping:["checkout",0]},nested:[]}],trigger:"load"},"order complete":{data:{id:"0rd3r1d",currency:"EUR",shipping:5.22,taxes:73.76,total:555},context:{shopping:["complete",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...r,context:{shopping:["complete",0]},nested:[]},{entity:"product",...o,context:{shopping:["complete",0]},nested:[]},{entity:"gift",data:{name:"Surprise"},context:{shopping:["complete",0]},nested:[]}],trigger:"load"},"page view":{data:{domain:"www.example.com",title:"walkerOS documentation",referrer:"https://www.walkeros.io/",search:"?foo=bar",hash:"#hash",id:"/docs/"},globals:{pagegroup:"docs"},trigger:"load"},"product add":{...r,context:{shopping:["intent",0]},globals:{pagegroup:"shop"},nested:[],trigger:"click"},"product view":{...r,context:{shopping:["detail",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"product visible":{data:{...r.data,position:3,promo:!0},context:{shopping:["discover",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"promotion visible":{data:{name:"Setting up tracking easily",position:"hero"},context:{ab_test:["engagement",0]},globals:{pagegroup:"homepage"},trigger:"visible"},"session start":{data:{id:"s3ss10n",start:n,isNew:!0,count:1,runs:1,isStart:!0,storage:!0,referrer:"",device:"c00k13"},user:{id:"us3r",device:"c00k13",session:"s3ss10n",hash:"h4sh",address:"street number",email:"user@example.com",phone:"+49 123 456 789",userAgent:"Mozilla...",browser:"Chrome",browserVersion:"90",deviceType:"desktop",language:"de-DE",country:"DE",region:"HH",city:"Hamburg",zip:"20354",timezone:"Berlin",os:"walkerOS",osVersion:"1.0",screenSize:"1337x420",ip:"127.0.0.0",internal:!0,custom:"value"}}}[e],...t,name:e})}function Y(e=6){let t="";for(let n=36;t.length<e;)t+=(Math.random()*n|0).toString(n);return t}function Z(e,t={}){const n="clickId",r={},o={utm_campaign:"campaign",utm_content:"content",utm_medium:"medium",utm_source:"source",utm_term:"term",dclid:n,fbclid:n,gclid:n,msclkid:n,ttclid:n,twclid:n,igshid:n,sclid:n};return Object.entries(T(o,t)).forEach(([t,o])=>{const i=e.searchParams.get(t);i&&(o===n&&(o=t,r[n]=t),r[o]=i)}),r}function ee(e,t=1e3,n=!1){let r,o=null,i=!1;return(...s)=>new Promise(c=>{const a=n&&!i;o&&clearTimeout(o),o=setTimeout(()=>{o=null,n&&!i||(r=e(...s),c(r))},t),a&&(i=!0,r=e(...s),c(r))})}function te(e,t=1e3){let n=null;return function(...r){if(null===n)return n=setTimeout(()=>{n=null},t),e(...r)}}function ne(e){return{message:e.message,name:e.name,stack:e.stack,cause:e.cause}}function re(e,t){let n,r={};return e instanceof Error?(n=e.message,r.error=ne(e)):n=e,void 0!==t&&(t instanceof Error?r.error=ne(t):"object"==typeof t&&null!==t?(r={...r,...t},"error"in r&&r.error instanceof Error&&(r.error=ne(r.error))):r.value=t),{message:n,context:r}}var oe=(e,t,n,r)=>{const o=`${g[e]}${r.length>0?` [${r.join(":")}]`:""}`,i=Object.keys(n).length>0;0===e?i?console.error(o,t,n):console.error(o,t):i?console.log(o,t,n):console.log(o,t)};function ie(e={}){return se({level:void 0!==e.level?function(e){return"string"==typeof e?g[e]:e}(e.level):0,handler:e.handler,scope:[]})}function se(e){const{level:t,handler:n,scope:r}=e,o=(e,o,i)=>{if(e<=t){const t=re(o,i);n?n(e,t.message,t.context,r,oe):oe(e,t.message,t.context,r)}};return{error:(e,t)=>o(0,e,t),info:(e,t)=>o(1,e,t),debug:(e,t)=>o(2,e,t),throw:(e,t)=>{const o=re(e,t);throw n?n(0,o.message,o.context,r,oe):oe(0,o.message,o.context,r),new Error(o.message)},scope:e=>se({level:t,handler:n,scope:[...r,e]})}}function ce(e){return I(e)||U(e)||F(e)||!_(e)||D(e)&&e.every(ce)||B(e)&&Object.values(e).every(ce)}function ae(e){return I(e)||U(e)||F(e)?e:C(e)?ae(Array.from(e)):D(e)?e.map(e=>ae(e)).filter(e=>void 0!==e):B(e)?Object.entries(e).reduce((e,[t,n])=>{const r=ae(n);return void 0!==r&&(e[t]=r),e},{}):void 0}function ue(e){return ce(e)?e:void 0}function le(e,t,n){return function(...r){try{return e(...r)}catch(e){if(!t)return;return t(e)}finally{n?.()}}}function fe(e,t,n){return async function(...r){try{return await e(...r)}catch(e){if(!t)return;return await t(e)}finally{await(n?.())}}}async function pe(e,t){const[n,r]=(e.name||"").split(" ");if(!t||!n||!r)return{};let o,i="",s=n,c=r;const a=t=>{if(t)return(t=D(t)?t:[t]).find(t=>!t.condition||t.condition(e))};t[s]||(s="*");const u=t[s];return u&&(u[c]||(c="*"),o=a(u[c])),o||(s="*",c="*",o=a(t[s]?.[c])),o&&(i=`${s} ${c}`),{eventMapping:o,mappingKey:i}}async function de(e,t={},n={}){if(!_(e))return;const r=B(e)&&e.consent||n.consent||n.collector?.consent,o=D(t)?t:[t];for(const t of o){const o=await fe(ge)(e,t,{...n,consent:r});if(_(o))return o}}async function ge(e,t,n={}){const{collector:r,consent:o}=n;return(D(t)?t:[t]).reduce(async(t,i)=>{const s=await t;if(s)return s;const c=U(i)?{key:i}:i;if(!Object.keys(c).length)return;const{condition:a,consent:u,fn:l,key:f,loop:p,map:d,set:g,validate:m,value:y}=c;if(a&&!await fe(a)(e,i,r))return;if(u&&!G(u,o))return y;let b=_(y)?y:e;if(l&&(b=await fe(l)(e,i,n)),f&&(b=H(e,f,y)),p){const[t,r]=p,o="this"===t?[e]:await de(e,t,n);D(o)&&(b=(await Promise.all(o.map(e=>de(e,r,n)))).filter(_))}else d?b=await Object.entries(d).reduce(async(t,[r,o])=>{const i=await t,s=await de(e,o,n);return _(s)&&(i[r]=s),i},Promise.resolve({})):g&&(b=await Promise.all(g.map(t=>ge(e,t,n))));m&&!await fe(m)(b)&&(b=void 0);const h=ue(b);return _(h)?h:ue(y)},Promise.resolve(void 0))}async function me(e,t,n){t.policy&&await Promise.all(Object.entries(t.policy).map(async([t,r])=>{const o=await de(e,r,{collector:n});e=q(e,t,o)}));const{eventMapping:r,mappingKey:o}=await pe(e,t.mapping);r?.policy&&await Promise.all(Object.entries(r.policy).map(async([t,r])=>{const o=await de(e,r,{collector:n});e=q(e,t,o)}));let i=t.data&&await de(e,t.data,{collector:n});if(r){if(r.ignore)return{event:e,data:i,mapping:r,mappingKey:o,ignore:!0};if(r.name&&(e.name=r.name),r.data){const t=r.data&&await de(e,r.data,{collector:n});i=B(i)&&B(t)?T(i,t):t}}return{event:e,data:i,mapping:r,mappingKey:o,ignore:!1}}function ye(e,t){const n=(e,r=[])=>new Proxy(e,{get(e,o){const i=e[o],s=[...r,o];return"function"==typeof i?(...e)=>t(s,e,i):i&&"object"==typeof i?n(i,s):i}});return n(e)}function be(e,t){const n=(e,r=[])=>{if(!e||"object"!=typeof e)return e;const o=Array.isArray(e)?[]:{};for(const[i,s]of Object.entries(e)){const e=[...r,i];Array.isArray(o)?o[Number(i)]=t(s,e):o[i]=t(s,e),s&&"object"==typeof s&&"function"!=typeof s&&(Array.isArray(o)?o[Number(i)]=n(s,e):o[i]=n(s,e))}return o};return n(e)}function he(){const e=[],t=jest.fn(e=>{const t=e instanceof Error?e.message:e;throw new Error(t)}),n=jest.fn(t=>{const n=he();return e.push(n),n});return{error:jest.fn(),info:jest.fn(),debug:jest.fn(),throw:t,scope:n,scopedLoggers:e}}function ve(e){const t=String(e),n=t.split("?")[1]||t;return le(()=>{const e=new URLSearchParams(n),t={};return e.forEach((e,n)=>{const r=n.split(/[[\]]+/).filter(Boolean);let o=t;r.forEach((t,n)=>{const i=n===r.length-1;if(D(o)){const s=parseInt(t,10);i?o[s]=W(e):(o[s]=o[s]||(isNaN(parseInt(r[n+1],10))?{}:[]),o=o[s])}else B(o)&&(i?o[t]=W(e):(o[t]=o[t]||(isNaN(parseInt(r[n+1],10))?{}:[]),o=o[t]))})}),t})()}function we(e){if(!e)return"";const t=[],n=encodeURIComponent;function r(e,o){null!=o&&(D(o)?o.forEach((t,n)=>r(`${e}[${n}]`,t)):B(o)?Object.entries(o).forEach(([t,n])=>r(`${e}[${t}]`,n)):t.push(`${n(e)}=${n(String(o))}`))}return"object"!=typeof e?n(e):(Object.entries(e).forEach(([e,t])=>r(e,t)),t.join("&"))}function je(e){return void 0===e||K(e,"")?e:JSON.stringify(e)}function Oe(e={}){return T({"Content-Type":"application/json; charset=utf-8"},e)}function xe(e){throw new Error(String(e))}function Ee(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function ke(e,t,n){return function(...r){let o;const i="post"+t,s=n["pre"+t],c=n[i];return o=s?s({fn:e},...r):e(...r),c&&(o=c({fn:e,result:o},...r)),o}}function Se(e){return e?{userAgent:e,browser:$e(e),browserVersion:Ae(e),os:Pe(e),osVersion:Me(e),deviceType:Ne(e)}:{}}function $e(e){const t=[{name:"Edge",substr:"Edg"},{name:"Chrome",substr:"Chrome"},{name:"Safari",substr:"Safari",exclude:"Chrome"},{name:"Firefox",substr:"Firefox"},{name:"IE",substr:"MSIE"},{name:"IE",substr:"Trident"}];for(const n of t)if(e.includes(n.substr)&&(!n.exclude||!e.includes(n.exclude)))return n.name}function Ae(e){const t=[/Edg\/([0-9]+)/,/Chrome\/([0-9]+)/,/Version\/([0-9]+).*Safari/,/Firefox\/([0-9]+)/,/MSIE ([0-9]+)/,/rv:([0-9]+).*Trident/];for(const n of t){const t=e.match(n);if(t)return t[1]}}function Pe(e){const t=[{name:"Windows",substr:"Windows NT"},{name:"macOS",substr:"Mac OS X"},{name:"Android",substr:"Android"},{name:"iOS",substr:"iPhone OS"},{name:"Linux",substr:"Linux"}];for(const n of t)if(e.includes(n.substr))return n.name}function Me(e){const t=e.match(/(?:Windows NT|Mac OS X|Android|iPhone OS) ([0-9._]+)/);return t?t[1].replace(/_/g,"."):void 0}function Ne(e){let t="Desktop";return/Tablet|iPad/i.test(e)?t="Tablet":/Mobi|Android|iPhone|iPod|BlackBerry|Opera Mini|IEMobile|WPDesktop/i.test(e)&&(t="Mobile"),t}function Te(e,t=[]){let n,r,o;K(e,{})||xe("Invalid object"),K(e.name,"")?(n=e.name,[r,o]=n.split(" "),r&&o||xe("Invalid event name")):K(e.entity,"")&&K(e.action,"")?(r=e.entity,o=e.action,n=`${r} ${o}`):xe("Missing or invalid name, entity, or action");const i={name:n,data:{},context:{},custom:{},globals:{},user:{},nested:[],consent:{},id:"",trigger:"",entity:r,action:o,timestamp:0,timing:0,group:"",count:0,version:{source:"",tagging:0},source:{type:"",id:"",previous_id:""}};return[{"*":{"*":{name:{maxLength:255},user:{allowedKeys:["id","device","session"]},consent:{allowedValues:[!0,!1]},timestamp:{min:0},timing:{min:0},count:{min:0},version:{allowedKeys:["source","tagging"]},source:{allowedKeys:["type","id","previous_id"]}}}}].concat(t).reduce((e,t)=>["*",r].reduce((e,n)=>["*",o].reduce((e,r)=>{const o=t[n]?.[r];return o?e.concat([o]):e},e),e),[]).reduce((t,n)=>{const r=Object.keys(n).filter(e=>{const t=n[e];return!0===t?.required});return[...Object.keys(e),...r].reduce((t,r)=>{const o=n[r];let i=e[r];return o&&(i=le(Ce,e=>{xe(String(e))})(t,r,i,o)),K(i,t[r])&&(t[r]=i),t},t)},i)}function Ce(e,t,n,r){if(r.validate&&(n=le(r.validate,e=>{xe(String(e))})(n,t,e)),r.required&&void 0===n&&xe("Missing required property"),K(n,""))r.maxLength&&n.length>r.maxLength&&(r.strict&&xe("Value exceeds maxLength"),n=n.substring(0,r.maxLength));else if(K(n,1))K(r.min,1)&&n<r.min?(r.strict&&xe("Value below min"),n=r.min):K(r.max,1)&&n>r.max&&(r.strict&&xe("Value exceeds max"),n=r.max);else if(K(n,{})){if(r.schema){const e=r.schema;Object.keys(e).reduce((t,n)=>{const r=e[n];let o=t[n];return r&&(r.type&&typeof o!==r.type&&xe(`Type doesn't match (${n})`),o=le(Ce,e=>{xe(String(e))})(t,n,o,r)),o},n)}for(const e of Object.keys(n))r.allowedKeys&&!r.allowedKeys.includes(e)&&(r.strict&&xe("Key not allowed"),delete n[e])}return n}function De(e){return function(e){return/\breturn\b/.test(e)}(e)?e:`return ${e}`}function Ie(e){const t=De(e);return new Function("value","mapping","collector",t)}function Ve(e){const t=De(e);return new Function("value","mapping","options",t)}function _e(e){const t=De(e);return new Function("value",t)}//# sourceMappingURL=index.js.map
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,i=(e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})},s={};i(s,{Collector:()=>c,Const:()=>j,Data:()=>a,Destination:()=>u,Elb:()=>l,Flow:()=>f,Hooks:()=>p,Level:()=>g,Logger:()=>d,Mapping:()=>m,On:()=>y,Request:()=>b,Schema:()=>h,Source:()=>v,WalkerOS:()=>w,anonymizeIP:()=>O,assign:()=>T,castToProperty:()=>ue,castValue:()=>W,clone:()=>z,createDestination:()=>J,createEvent:()=>X,createLogger:()=>ie,createMockLogger:()=>he,debounce:()=>ee,filterValues:()=>ae,getBrowser:()=>$e,getBrowserVersion:()=>Ae,getByPath:()=>H,getDeviceType:()=>Ne,getEvent:()=>Q,getFlowConfig:()=>P,getGrantedConsent:()=>G,getHeaders:()=>Oe,getId:()=>Y,getMappingEvent:()=>pe,getMappingValue:()=>de,getMarketingParameters:()=>Z,getOS:()=>Pe,getOSVersion:()=>Me,getPlatform:()=>M,isArguments:()=>C,isArray:()=>D,isBoolean:()=>I,isCommand:()=>V,isDefined:()=>_,isElementOrDocument:()=>L,isFunction:()=>R,isNumber:()=>F,isObject:()=>B,isPropertyType:()=>ce,isSameType:()=>K,isString:()=>U,mockEnv:()=>ye,packageNameToVariable:()=>S,parseUserAgent:()=>Se,processEventMapping:()=>me,requestToData:()=>ve,requestToParameter:()=>we,setByPath:()=>q,throttle:()=>te,throwError:()=>xe,transformData:()=>je,traverseEnv:()=>be,trim:()=>Ee,tryCatch:()=>le,tryCatchAsync:()=>fe,useHooks:()=>ke,validateEvent:()=>Te,validateProperty:()=>Ce,wrapCondition:()=>Ie,wrapFn:()=>Ve,wrapValidate:()=>_e}),module.exports=(e=s,((e,i,s,c)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let a of r(i))o.call(e,a)||a===s||t(e,a,{get:()=>i[a],enumerable:!(c=n(i,a))||c.enumerable});return e})(t({},"__esModule",{value:!0}),e));var c={},a={},u={},l={},f={},p={},d={};i(d,{Level:()=>g});var g=(e=>(e[e.ERROR=0]="ERROR",e[e.INFO=1]="INFO",e[e.DEBUG=2]="DEBUG",e))(g||{}),m={},y={},b={},h={},v={},w={},j={Utils:{Storage:{Local:"local",Session:"session",Cookie:"cookie"}}};function O(e){return/^(?:\d{1,3}\.){3}\d{1,3}$/.test(e)?e.replace(/\.\d+$/,".0"):""}function x(...e){const t={};for(const n of e)n&&Object.assign(t,n);return t}function E(...e){const t={};for(const n of e)n&&Object.assign(t,n);return t}function k(e,t){if("string"==typeof e)return e.replace(/\$\{([^}:]+)(?::([^}]*))?\}/g,(e,n,r)=>{if("undefined"!=typeof process&&void 0!==process.env?.[n])return process.env[n];if(void 0!==t[n])return String(t[n]);if(void 0!==r)return r;throw new Error(`Variable "${n}" not found and no default provided`)});if(Array.isArray(e))return e.map(e=>k(e,t));if(null!==e&&"object"==typeof e){const n={};for(const[r,o]of Object.entries(e))n[r]=k(o,t);return n}return e}function S(e){const t=e.startsWith("@"),n=e.replace("@","").replace(/[/-]/g,"_").split("_").filter(e=>e.length>0).map((e,t)=>0===t?e:e.charAt(0).toUpperCase()+e.slice(1)).join("");return t?"_"+n:n}function $(e,t,n){if(t)return t;if(!e||!n)return;return n[e]?S(e):void 0}function A(e,t){if(null!==e&&"object"==typeof e){if("$ref"in e&&"string"==typeof e.$ref){const n=e.$ref,r=n.match(/^#\/definitions\/(.+)$/);if(r){const e=r[1];if(void 0===t[e])throw new Error(`Definition "${e}" not found`);return A(t[e],t)}throw new Error(`Invalid $ref format: ${n}`)}if(Array.isArray(e))return e.map(e=>A(e,t));const n={};for(const[r,o]of Object.entries(e))n[r]=A(o,t);return n}return e}function P(e,t){const n=Object.keys(e.flows);if(!t){if(1!==n.length)throw new Error(`Multiple flows found (${n.join(", ")}). Please specify a flow.`);t=n[0]}const r=e.flows[t];if(!r)throw new Error(`Flow "${t}" not found. Available: ${n.join(", ")}`);const o=JSON.parse(JSON.stringify(r));if(o.sources)for(const[t,n]of Object.entries(o.sources)){const i=x(e.variables,r.variables,n.variables),s=E(e.definitions,r.definitions,n.definitions);let c=A(n.config,s);c=k(c,i);const a=$(n.package,n.code,o.packages);o.sources[t]={...n,config:c,...a&&{code:a}}}if(o.destinations)for(const[t,n]of Object.entries(o.destinations)){const i=x(e.variables,r.variables,n.variables),s=E(e.definitions,r.definitions,n.definitions);let c=A(n.config,s);c=k(c,i);const a=$(n.package,n.code,o.packages);o.destinations[t]={...n,config:c,...a&&{code:a}}}if(o.collector){const t=x(e.variables,r.variables),n=E(e.definitions,r.definitions);let i=A(o.collector,n);i=k(i,t),o.collector=i}return o}function M(e){if(void 0!==e.web)return"web";if(void 0!==e.server)return"server";throw new Error("Config must have web or server key")}var N={merge:!0,shallow:!0,extend:!0};function T(e,t={},n={}){n={...N,...n};const r=Object.entries(t).reduce((t,[r,o])=>{const i=e[r];return n.merge&&Array.isArray(i)&&Array.isArray(o)?t[r]=o.reduce((e,t)=>e.includes(t)?e:[...e,t],[...i]):(n.extend||r in e)&&(t[r]=o),t},{});return n.shallow?{...e,...r}:(Object.assign(e,r),e)}function C(e){return"[object Arguments]"===Object.prototype.toString.call(e)}function D(e){return Array.isArray(e)}function I(e){return"boolean"==typeof e}function V(e){return"walker"===e}function _(e){return void 0!==e}function L(e){return e===document||e instanceof Element}function R(e){return"function"==typeof e}function F(e){return"number"==typeof e&&!Number.isNaN(e)}function B(e){return"object"==typeof e&&null!==e&&!D(e)&&"[object Object]"===Object.prototype.toString.call(e)}function K(e,t){return typeof e==typeof t}function U(e){return"string"==typeof e}function z(e,t=new WeakMap){if("object"!=typeof e||null===e)return e;if(t.has(e))return t.get(e);const n=Object.prototype.toString.call(e);if("[object Object]"===n){const n={};t.set(e,n);for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=z(e[r],t));return n}if("[object Array]"===n){const n=[];return t.set(e,n),e.forEach(e=>{n.push(z(e,t))}),n}if("[object Date]"===n)return new Date(e.getTime());if("[object RegExp]"===n){const t=e;return new RegExp(t.source,t.flags)}return e}function H(e,t="",n){const r=t.split(".");let o=e;for(let e=0;e<r.length;e++){const t=r[e];if("*"===t&&D(o)){const t=r.slice(e+1).join("."),i=[];for(const e of o){const r=H(e,t,n);i.push(r)}return i}if(o=o instanceof Object?o[t]:void 0,!o)break}return _(o)?o:n}function q(e,t,n){if(!B(e))return e;const r=z(e),o=t.split(".");let i=r;for(let e=0;e<o.length;e++){const t=o[e];e===o.length-1?i[t]=n:(t in i&&"object"==typeof i[t]&&null!==i[t]||(i[t]={}),i=i[t])}return r}function W(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}function G(e,t={},n={}){const r={...t,...n},o={};let i=void 0===e;return Object.keys(r).forEach(t=>{r[t]&&(o[t]=!0,e&&e[t]&&(i=!0))}),!!i&&o}function J(e,t){const n={...e};return n.config=T(e.config,t,{shallow:!0,merge:!0,extend:!0}),e.config.settings&&t.settings&&(n.config.settings=T(e.config.settings,t.settings,{shallow:!0,merge:!0,extend:!0})),e.config.mapping&&t.mapping&&(n.config.mapping=T(e.config.mapping,t.mapping,{shallow:!0,merge:!0,extend:!0})),n}function X(e={}){const t=e.timestamp||(new Date).setHours(0,13,37,0),n=e.group||"gr0up",r=e.count||1,o=T({name:"entity action",data:{string:"foo",number:1,boolean:!0,array:[0,"text",!1],not:void 0},context:{dev:["test",1]},globals:{lang:"elb"},custom:{completely:"random"},user:{id:"us3r",device:"c00k13",session:"s3ss10n"},nested:[{entity:"child",data:{is:"subordinated"},nested:[],context:{element:["child",0]}}],consent:{functional:!0},id:`${t}-${n}-${r}`,trigger:"test",entity:"entity",action:"action",timestamp:t,timing:3.14,group:n,count:r,version:{source:"0.6.0",tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},e,{merge:!1});if(e.name){const[t,n]=e.name.split(" ")??[];t&&n&&(o.entity=t,o.action=n)}return o}function Q(e="entity action",t={}){const n=t.timestamp||(new Date).setHours(0,13,37,0),r={data:{id:"ers",name:"Everyday Ruck Snack",color:"black",size:"l",price:420}},o={data:{id:"cc",name:"Cool Cap",size:"one size",price:42}};return X({...{"cart view":{data:{currency:"EUR",value:2*r.data.price},context:{shopping:["cart",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",data:{...r.data,quantity:2},context:{shopping:["cart",0]},nested:[]}],trigger:"load"},"checkout view":{data:{step:"payment",currency:"EUR",value:r.data.price+o.data.price},context:{shopping:["checkout",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...r,context:{shopping:["checkout",0]},nested:[]},{entity:"product",...o,context:{shopping:["checkout",0]},nested:[]}],trigger:"load"},"order complete":{data:{id:"0rd3r1d",currency:"EUR",shipping:5.22,taxes:73.76,total:555},context:{shopping:["complete",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...r,context:{shopping:["complete",0]},nested:[]},{entity:"product",...o,context:{shopping:["complete",0]},nested:[]},{entity:"gift",data:{name:"Surprise"},context:{shopping:["complete",0]},nested:[]}],trigger:"load"},"page view":{data:{domain:"www.example.com",title:"walkerOS documentation",referrer:"https://www.walkeros.io/",search:"?foo=bar",hash:"#hash",id:"/docs/"},globals:{pagegroup:"docs"},trigger:"load"},"product add":{...r,context:{shopping:["intent",0]},globals:{pagegroup:"shop"},nested:[],trigger:"click"},"product view":{...r,context:{shopping:["detail",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"product visible":{data:{...r.data,position:3,promo:!0},context:{shopping:["discover",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"promotion visible":{data:{name:"Setting up tracking easily",position:"hero"},context:{ab_test:["engagement",0]},globals:{pagegroup:"homepage"},trigger:"visible"},"session start":{data:{id:"s3ss10n",start:n,isNew:!0,count:1,runs:1,isStart:!0,storage:!0,referrer:"",device:"c00k13"},user:{id:"us3r",device:"c00k13",session:"s3ss10n",hash:"h4sh",address:"street number",email:"user@example.com",phone:"+49 123 456 789",userAgent:"Mozilla...",browser:"Chrome",browserVersion:"90",deviceType:"desktop",language:"de-DE",country:"DE",region:"HH",city:"Hamburg",zip:"20354",timezone:"Berlin",os:"walkerOS",osVersion:"1.0",screenSize:"1337x420",ip:"127.0.0.0",internal:!0,custom:"value"}}}[e],...t,name:e})}function Y(e=6){let t="";for(let n=36;t.length<e;)t+=(Math.random()*n|0).toString(n);return t}function Z(e,t={}){const n="clickId",r={},o={utm_campaign:"campaign",utm_content:"content",utm_medium:"medium",utm_source:"source",utm_term:"term",dclid:n,fbclid:n,gclid:n,msclkid:n,ttclid:n,twclid:n,igshid:n,sclid:n};return Object.entries(T(o,t)).forEach(([t,o])=>{const i=e.searchParams.get(t);i&&(o===n&&(o=t,r[n]=t),r[o]=i)}),r}function ee(e,t=1e3,n=!1){let r,o=null,i=!1;return(...s)=>new Promise(c=>{const a=n&&!i;o&&clearTimeout(o),o=setTimeout(()=>{o=null,n&&!i||(r=e(...s),c(r))},t),a&&(i=!0,r=e(...s),c(r))})}function te(e,t=1e3){let n=null;return function(...r){if(null===n)return n=setTimeout(()=>{n=null},t),e(...r)}}function ne(e){return{message:e.message,name:e.name,stack:e.stack,cause:e.cause}}function re(e,t){let n,r={};return e instanceof Error?(n=e.message,r.error=ne(e)):n=e,void 0!==t&&(t instanceof Error?r.error=ne(t):"object"==typeof t&&null!==t?(r={...r,...t},"error"in r&&r.error instanceof Error&&(r.error=ne(r.error))):r.value=t),{message:n,context:r}}var oe=(e,t,n,r)=>{const o=`${g[e]}${r.length>0?` [${r.join(":")}]`:""}`,i=Object.keys(n).length>0;0===e?i?console.error(o,t,n):console.error(o,t):i?console.log(o,t,n):console.log(o,t)};function ie(e={}){return se({level:void 0!==e.level?function(e){return"string"==typeof e?g[e]:e}(e.level):0,handler:e.handler,scope:[]})}function se(e){const{level:t,handler:n,scope:r}=e,o=(e,o,i)=>{if(e<=t){const t=re(o,i);n?n(e,t.message,t.context,r,oe):oe(e,t.message,t.context,r)}};return{error:(e,t)=>o(0,e,t),info:(e,t)=>o(1,e,t),debug:(e,t)=>o(2,e,t),throw:(e,t)=>{const o=re(e,t);throw n?n(0,o.message,o.context,r,oe):oe(0,o.message,o.context,r),new Error(o.message)},scope:e=>se({level:t,handler:n,scope:[...r,e]})}}function ce(e){return I(e)||U(e)||F(e)||!_(e)||D(e)&&e.every(ce)||B(e)&&Object.values(e).every(ce)}function ae(e){return I(e)||U(e)||F(e)?e:C(e)?ae(Array.from(e)):D(e)?e.map(e=>ae(e)).filter(e=>void 0!==e):B(e)?Object.entries(e).reduce((e,[t,n])=>{const r=ae(n);return void 0!==r&&(e[t]=r),e},{}):void 0}function ue(e){return ce(e)?e:void 0}function le(e,t,n){return function(...r){try{return e(...r)}catch(e){if(!t)return;return t(e)}finally{n?.()}}}function fe(e,t,n){return async function(...r){try{return await e(...r)}catch(e){if(!t)return;return await t(e)}finally{await(n?.())}}}async function pe(e,t){const[n,r]=(e.name||"").split(" ");if(!t||!n||!r)return{};let o,i="",s=n,c=r;const a=t=>{if(t)return(t=D(t)?t:[t]).find(t=>!t.condition||t.condition(e))};t[s]||(s="*");const u=t[s];return u&&(u[c]||(c="*"),o=a(u[c])),o||(s="*",c="*",o=a(t[s]?.[c])),o&&(i=`${s} ${c}`),{eventMapping:o,mappingKey:i}}async function de(e,t={},n={}){if(!_(e))return;const r=B(e)&&e.consent||n.consent||n.collector?.consent,o=D(t)?t:[t];for(const t of o){const o=await fe(ge)(e,t,{...n,consent:r});if(_(o))return o}}async function ge(e,t,n={}){const{collector:r,consent:o}=n;return(D(t)?t:[t]).reduce(async(t,i)=>{const s=await t;if(s)return s;const c=U(i)?{key:i}:i;if(!Object.keys(c).length)return;const{condition:a,consent:u,fn:l,key:f,loop:p,map:d,set:g,validate:m,value:y}=c;if(a&&!await fe(a)(e,i,r))return;if(u&&!G(u,o))return y;let b=_(y)?y:e;if(l&&(b=await fe(l)(e,i,n)),f&&(b=H(e,f,y)),p){const[t,r]=p,o="this"===t?[e]:await de(e,t,n);D(o)&&(b=(await Promise.all(o.map(e=>de(e,r,n)))).filter(_))}else d?b=await Object.entries(d).reduce(async(t,[r,o])=>{const i=await t,s=await de(e,o,n);return _(s)&&(i[r]=s),i},Promise.resolve({})):g&&(b=await Promise.all(g.map(t=>ge(e,t,n))));m&&!await fe(m)(b)&&(b=void 0);const h=ue(b);return _(h)?h:ue(y)},Promise.resolve(void 0))}async function me(e,t,n){t.policy&&await Promise.all(Object.entries(t.policy).map(async([t,r])=>{const o=await de(e,r,{collector:n});e=q(e,t,o)}));const{eventMapping:r,mappingKey:o}=await pe(e,t.mapping);r?.policy&&await Promise.all(Object.entries(r.policy).map(async([t,r])=>{const o=await de(e,r,{collector:n});e=q(e,t,o)}));let i=t.data&&await de(e,t.data,{collector:n});if(r){if(r.ignore)return{event:e,data:i,mapping:r,mappingKey:o,ignore:!0};if(r.name&&(e.name=r.name),r.data){const t=r.data&&await de(e,r.data,{collector:n});i=B(i)&&B(t)?T(i,t):t}}return{event:e,data:i,mapping:r,mappingKey:o,ignore:!1}}function ye(e,t){const n=(e,r=[])=>new Proxy(e,{get(e,o){const i=e[o],s=[...r,o];return"function"==typeof i?(...e)=>t(s,e,i):i&&"object"==typeof i?n(i,s):i}});return n(e)}function be(e,t){const n=(e,r=[])=>{if(!e||"object"!=typeof e)return e;const o=Array.isArray(e)?[]:{};for(const[i,s]of Object.entries(e)){const e=[...r,i];Array.isArray(o)?o[Number(i)]=t(s,e):o[i]=t(s,e),s&&"object"==typeof s&&"function"!=typeof s&&(Array.isArray(o)?o[Number(i)]=n(s,e):o[i]=n(s,e))}return o};return n(e)}function he(){const e=[],t=jest.fn(e=>{const t=e instanceof Error?e.message:e;throw new Error(t)}),n=jest.fn(t=>{const n=he();return e.push(n),n});return{error:jest.fn(),info:jest.fn(),debug:jest.fn(),throw:t,scope:n,scopedLoggers:e}}function ve(e){const t=String(e),n=t.split("?")[1]||t;return le(()=>{const e=new URLSearchParams(n),t={};return e.forEach((e,n)=>{const r=n.split(/[[\]]+/).filter(Boolean);let o=t;r.forEach((t,n)=>{const i=n===r.length-1;if(D(o)){const s=parseInt(t,10);i?o[s]=W(e):(o[s]=o[s]||(isNaN(parseInt(r[n+1],10))?{}:[]),o=o[s])}else B(o)&&(i?o[t]=W(e):(o[t]=o[t]||(isNaN(parseInt(r[n+1],10))?{}:[]),o=o[t]))})}),t})()}function we(e){if(!e)return"";const t=[],n=encodeURIComponent;function r(e,o){null!=o&&(D(o)?o.forEach((t,n)=>r(`${e}[${n}]`,t)):B(o)?Object.entries(o).forEach(([t,n])=>r(`${e}[${t}]`,n)):t.push(`${n(e)}=${n(String(o))}`))}return"object"!=typeof e?n(e):(Object.entries(e).forEach(([e,t])=>r(e,t)),t.join("&"))}function je(e){return void 0===e||K(e,"")?e:JSON.stringify(e)}function Oe(e={}){return T({"Content-Type":"application/json; charset=utf-8"},e)}function xe(e){throw new Error(String(e))}function Ee(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function ke(e,t,n){return function(...r){let o;const i="post"+t,s=n["pre"+t],c=n[i];return o=s?s({fn:e},...r):e(...r),c&&(o=c({fn:e,result:o},...r)),o}}function Se(e){return e?{userAgent:e,browser:$e(e),browserVersion:Ae(e),os:Pe(e),osVersion:Me(e),deviceType:Ne(e)}:{}}function $e(e){const t=[{name:"Edge",substr:"Edg"},{name:"Chrome",substr:"Chrome"},{name:"Safari",substr:"Safari",exclude:"Chrome"},{name:"Firefox",substr:"Firefox"},{name:"IE",substr:"MSIE"},{name:"IE",substr:"Trident"}];for(const n of t)if(e.includes(n.substr)&&(!n.exclude||!e.includes(n.exclude)))return n.name}function Ae(e){const t=[/Edg\/([0-9]+)/,/Chrome\/([0-9]+)/,/Version\/([0-9]+).*Safari/,/Firefox\/([0-9]+)/,/MSIE ([0-9]+)/,/rv:([0-9]+).*Trident/];for(const n of t){const t=e.match(n);if(t)return t[1]}}function Pe(e){const t=[{name:"Windows",substr:"Windows NT"},{name:"macOS",substr:"Mac OS X"},{name:"Android",substr:"Android"},{name:"iOS",substr:"iPhone OS"},{name:"Linux",substr:"Linux"}];for(const n of t)if(e.includes(n.substr))return n.name}function Me(e){const t=e.match(/(?:Windows NT|Mac OS X|Android|iPhone OS) ([0-9._]+)/);return t?t[1].replace(/_/g,"."):void 0}function Ne(e){let t="Desktop";return/Tablet|iPad/i.test(e)?t="Tablet":/Mobi|Android|iPhone|iPod|BlackBerry|Opera Mini|IEMobile|WPDesktop/i.test(e)&&(t="Mobile"),t}function Te(e,t=[]){let n,r,o;K(e,{})||xe("Invalid object"),K(e.name,"")?(n=e.name,[r,o]=n.split(" "),r&&o||xe("Invalid event name")):K(e.entity,"")&&K(e.action,"")?(r=e.entity,o=e.action,n=`${r} ${o}`):xe("Missing or invalid name, entity, or action");const i={name:n,data:{},context:{},custom:{},globals:{},user:{},nested:[],consent:{},id:"",trigger:"",entity:r,action:o,timestamp:0,timing:0,group:"",count:0,version:{source:"",tagging:0},source:{type:"",id:"",previous_id:""}};return[{"*":{"*":{name:{maxLength:255},user:{allowedKeys:["id","device","session"]},consent:{allowedValues:[!0,!1]},timestamp:{min:0},timing:{min:0},count:{min:0},version:{allowedKeys:["source","tagging"]},source:{allowedKeys:["type","id","previous_id"]}}}}].concat(t).reduce((e,t)=>["*",r].reduce((e,n)=>["*",o].reduce((e,r)=>{const o=t[n]?.[r];return o?e.concat([o]):e},e),e),[]).reduce((t,n)=>{const r=Object.keys(n).filter(e=>{const t=n[e];return!0===t?.required});return[...Object.keys(e),...r].reduce((t,r)=>{const o=n[r];let i=e[r];return o&&(i=le(Ce,e=>{xe(String(e))})(t,r,i,o)),K(i,t[r])&&(t[r]=i),t},t)},i)}function Ce(e,t,n,r){if(r.validate&&(n=le(r.validate,e=>{xe(String(e))})(n,t,e)),r.required&&void 0===n&&xe("Missing required property"),K(n,""))r.maxLength&&n.length>r.maxLength&&(r.strict&&xe("Value exceeds maxLength"),n=n.substring(0,r.maxLength));else if(K(n,1))K(r.min,1)&&n<r.min?(r.strict&&xe("Value below min"),n=r.min):K(r.max,1)&&n>r.max&&(r.strict&&xe("Value exceeds max"),n=r.max);else if(K(n,{})){if(r.schema){const e=r.schema;Object.keys(e).reduce((t,n)=>{const r=e[n];let o=t[n];return r&&(r.type&&typeof o!==r.type&&xe(`Type doesn't match (${n})`),o=le(Ce,e=>{xe(String(e))})(t,n,o,r)),o},n)}for(const e of Object.keys(n))r.allowedKeys&&!r.allowedKeys.includes(e)&&(r.strict&&xe("Key not allowed"),delete n[e])}return n}function De(e){return function(e){return/\breturn\b/.test(e)}(e)?e:`return ${e}`}function Ie(e){const t=De(e);return new Function("value","mapping","collector",t)}function Ve(e){const t=De(e);return new Function("value","mapping","options",t)}function _e(e){const t=De(e);return new Function("value",t)}//# sourceMappingURL=index.js.map
|