@walkeros/explorer 2.1.0 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/AGENT.md +19 -0
  2. package/STYLE.md +6 -0
  3. package/dist/chunk-3TPAJIVM.mjs +580 -0
  4. package/dist/chunk-3TPAJIVM.mjs.map +1 -0
  5. package/dist/components/atoms/button-link.stories.d.ts +1 -3
  6. package/dist/components/atoms/button-link.stories.d.ts.map +1 -1
  7. package/dist/components/atoms/button-link.stories.js +1 -15
  8. package/dist/components/atoms/button-link.stories.js.map +1 -1
  9. package/dist/components/atoms/code.d.ts +29 -1
  10. package/dist/components/atoms/code.d.ts.map +1 -1
  11. package/dist/components/atoms/code.js +76 -8
  12. package/dist/components/atoms/code.js.map +1 -1
  13. package/dist/components/atoms/code.stories.d.ts +0 -7
  14. package/dist/components/atoms/code.stories.d.ts.map +1 -1
  15. package/dist/components/atoms/code.stories.js +0 -34
  16. package/dist/components/atoms/code.stories.js.map +1 -1
  17. package/dist/components/molecules/code-box.d.ts +6 -1
  18. package/dist/components/molecules/code-box.d.ts.map +1 -1
  19. package/dist/components/molecules/code-box.js +53 -3
  20. package/dist/components/molecules/code-box.js.map +1 -1
  21. package/dist/components/molecules/code-box.stories.d.ts +45 -9
  22. package/dist/components/molecules/code-box.stories.d.ts.map +1 -1
  23. package/dist/components/molecules/code-box.stories.js +106 -45
  24. package/dist/components/molecules/code-box.stories.js.map +1 -1
  25. package/dist/components/molecules/code-snippet.stories.d.ts +0 -8
  26. package/dist/components/molecules/code-snippet.stories.d.ts.map +1 -1
  27. package/dist/components/molecules/code-snippet.stories.js +0 -19
  28. package/dist/components/molecules/code-snippet.stories.js.map +1 -1
  29. package/dist/components/molecules/flow-map/FlowMap.stories.d.ts +0 -32
  30. package/dist/components/molecules/flow-map/FlowMap.stories.d.ts.map +1 -1
  31. package/dist/components/molecules/flow-map/FlowMap.stories.js +0 -330
  32. package/dist/components/molecules/flow-map/FlowMap.stories.js.map +1 -1
  33. package/dist/components/molecules/flow-map/FlowMap.transformers.stories.d.ts +0 -16
  34. package/dist/components/molecules/flow-map/FlowMap.transformers.stories.d.ts.map +1 -1
  35. package/dist/components/molecules/flow-map/FlowMap.transformers.stories.js +0 -78
  36. package/dist/components/molecules/flow-map/FlowMap.transformers.stories.js.map +1 -1
  37. package/dist/components/molecules/preview.d.ts.map +1 -1
  38. package/dist/components/molecules/preview.js +32 -22
  39. package/dist/components/molecules/preview.js.map +1 -1
  40. package/dist/index.d.cts +191 -3
  41. package/dist/index.d.ts +9 -0
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +11 -0
  44. package/dist/index.js.map +1 -1
  45. package/dist/index.mjs +1059 -43
  46. package/dist/index.mjs.map +1 -1
  47. package/dist/{monaco-types-OLSF6MIE.mjs → monaco-types-7HYTHECU.mjs} +2 -2
  48. package/dist/styles.css +31 -0
  49. package/dist/types/intellisense.d.ts +31 -0
  50. package/dist/types/intellisense.d.ts.map +1 -0
  51. package/dist/types/intellisense.js +2 -0
  52. package/dist/types/intellisense.js.map +1 -0
  53. package/dist/utils/monaco-intellisense-flow-extractor.d.ts +13 -0
  54. package/dist/utils/monaco-intellisense-flow-extractor.d.ts.map +1 -0
  55. package/dist/utils/monaco-intellisense-flow-extractor.js +161 -0
  56. package/dist/utils/monaco-intellisense-flow-extractor.js.map +1 -0
  57. package/dist/utils/monaco-json-schema.d.ts +11 -0
  58. package/dist/utils/monaco-json-schema.d.ts.map +1 -1
  59. package/dist/utils/monaco-json-schema.js +13 -3
  60. package/dist/utils/monaco-json-schema.js.map +1 -1
  61. package/dist/utils/monaco-schema-contract.d.ts +8 -0
  62. package/dist/utils/monaco-schema-contract.d.ts.map +1 -0
  63. package/dist/utils/monaco-schema-contract.js +73 -0
  64. package/dist/utils/monaco-schema-contract.js.map +1 -0
  65. package/dist/utils/monaco-schema-enrichment.d.ts +26 -0
  66. package/dist/utils/monaco-schema-enrichment.d.ts.map +1 -0
  67. package/dist/utils/monaco-schema-enrichment.js +31 -0
  68. package/dist/utils/monaco-schema-enrichment.js.map +1 -0
  69. package/dist/utils/monaco-schema-flow-setup.d.ts +10 -0
  70. package/dist/utils/monaco-schema-flow-setup.d.ts.map +1 -0
  71. package/dist/utils/monaco-schema-flow-setup.js +201 -0
  72. package/dist/utils/monaco-schema-flow-setup.js.map +1 -0
  73. package/dist/utils/monaco-schema-variables.d.ts +4 -0
  74. package/dist/utils/monaco-schema-variables.d.ts.map +1 -0
  75. package/dist/utils/monaco-schema-variables.js +26 -0
  76. package/dist/utils/monaco-schema-variables.js.map +1 -0
  77. package/dist/utils/monaco-walkeros-completions.d.ts +15 -0
  78. package/dist/utils/monaco-walkeros-completions.d.ts.map +1 -0
  79. package/dist/utils/monaco-walkeros-completions.js +65 -0
  80. package/dist/utils/monaco-walkeros-completions.js.map +1 -0
  81. package/dist/utils/monaco-walkeros-decorations.d.ts +29 -0
  82. package/dist/utils/monaco-walkeros-decorations.d.ts.map +1 -0
  83. package/dist/utils/monaco-walkeros-decorations.js +87 -0
  84. package/dist/utils/monaco-walkeros-decorations.js.map +1 -0
  85. package/dist/utils/monaco-walkeros-markers.d.ts +13 -0
  86. package/dist/utils/monaco-walkeros-markers.d.ts.map +1 -0
  87. package/dist/utils/monaco-walkeros-markers.js +69 -0
  88. package/dist/utils/monaco-walkeros-markers.js.map +1 -0
  89. package/dist/utils/monaco-walkeros-providers.d.ts +19 -0
  90. package/dist/utils/monaco-walkeros-providers.d.ts.map +1 -0
  91. package/dist/utils/monaco-walkeros-providers.js +229 -0
  92. package/dist/utils/monaco-walkeros-providers.js.map +1 -0
  93. package/package.json +1 -1
  94. package/dist/chunk-YKT4D7MG.mjs +0 -3087
  95. package/dist/chunk-YKT4D7MG.mjs.map +0 -1
  96. /package/dist/{monaco-types-OLSF6MIE.mjs.map → monaco-types-7HYTHECU.mjs.map} +0 -0
@@ -1,3087 +0,0 @@
1
- "use client"
2
-
3
- // src/utils/monaco-context-types.ts
4
- var FN_CONTEXT_TYPES = `
5
- // WalkerOS Core Types
6
- declare namespace WalkerOS {
7
- // Utility types
8
- type DeepPartial<T> = {
9
- [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
10
- };
11
-
12
- type PromiseOrValue<T> = T | Promise<T>;
13
-
14
- // Property types
15
- type PropertyType = boolean | string | number | {
16
- [key: string]: Property;
17
- };
18
-
19
- type Property = PropertyType | Array<PropertyType>;
20
-
21
- interface Properties {
22
- [key: string]: Property | undefined;
23
- }
24
-
25
- interface OrderedProperties {
26
- [key: string]: [Property, number] | undefined;
27
- }
28
-
29
- // Consent
30
- interface Consent {
31
- [name: string]: boolean;
32
- }
33
-
34
- // User
35
- interface User extends Properties {
36
- id?: string;
37
- device?: string;
38
- session?: string;
39
- hash?: string;
40
- address?: string;
41
- email?: string;
42
- phone?: string;
43
- userAgent?: string;
44
- browser?: string;
45
- browserVersion?: string;
46
- deviceType?: string;
47
- language?: string;
48
- country?: string;
49
- region?: string;
50
- city?: string;
51
- zip?: string;
52
- timezone?: string;
53
- os?: string;
54
- osVersion?: string;
55
- screenSize?: string;
56
- ip?: string;
57
- internal?: boolean;
58
- }
59
-
60
- // Version
61
- interface Version extends Properties {
62
- source: string;
63
- tagging: number;
64
- }
65
-
66
- // Source
67
- type SourceType = 'web' | 'server' | 'app' | 'other' | string;
68
-
69
- interface Source extends Properties {
70
- type: SourceType;
71
- id: string;
72
- previous_id: string;
73
- }
74
-
75
- // Entity
76
- type Entities = Array<Entity>;
77
-
78
- interface Entity {
79
- entity: string;
80
- data: Properties;
81
- nested: Entities;
82
- context: OrderedProperties;
83
- }
84
-
85
- // Event
86
- interface Event {
87
- name: string;
88
- data: Properties;
89
- context: OrderedProperties;
90
- globals: Properties;
91
- custom: Properties;
92
- user: User;
93
- nested: Entities;
94
- consent: Consent;
95
- id: string;
96
- trigger: string;
97
- entity: string;
98
- action: string;
99
- timestamp: number;
100
- timing: number;
101
- group: string;
102
- count: number;
103
- version: Version;
104
- source: Source;
105
- }
106
-
107
- type DeepPartialEvent = DeepPartial<Event>;
108
- }
109
-
110
- // Mapping Types
111
- declare namespace Mapping {
112
- type ValueType = string | ValueConfig;
113
- type Value = ValueType | Array<ValueType>;
114
- type Values = Array<Value>;
115
-
116
- interface ValueConfig {
117
- condition?: Condition;
118
- consent?: WalkerOS.Consent;
119
- fn?: Fn;
120
- key?: string;
121
- loop?: Loop;
122
- map?: Map;
123
- set?: Value[];
124
- validate?: Validate;
125
- value?: WalkerOS.PropertyType;
126
- }
127
-
128
- type Loop = [Value, Value];
129
-
130
- type Map = {
131
- [key: string]: Value;
132
- };
133
-
134
- interface Options {
135
- consent?: WalkerOS.Consent;
136
- collector?: Collector.Instance;
137
- props?: unknown;
138
- }
139
-
140
- type Condition = (
141
- value: WalkerOS.DeepPartialEvent | unknown,
142
- mapping?: Value,
143
- collector?: Collector.Instance
144
- ) => WalkerOS.PromiseOrValue<boolean>;
145
-
146
- type Fn = (
147
- value: WalkerOS.DeepPartialEvent | unknown,
148
- mapping: Value,
149
- options: Options
150
- ) => WalkerOS.PromiseOrValue<WalkerOS.Property | unknown>;
151
-
152
- type Validate = (value?: unknown) => WalkerOS.PromiseOrValue<boolean>;
153
- }
154
-
155
- // Collector Types (minimal for fn context)
156
- declare namespace Collector {
157
- interface Instance {
158
- push: any;
159
- command: any;
160
- allowed: boolean;
161
- config: any;
162
- consent: WalkerOS.Consent;
163
- count: number;
164
- custom: WalkerOS.Properties;
165
- globals: WalkerOS.Properties;
166
- group: string;
167
- queue: any[];
168
- round: number;
169
- session: any;
170
- timing: number;
171
- user: WalkerOS.User;
172
- version: string;
173
- [key: string]: any;
174
- }
175
- }
176
-
177
- // Parameter declarations for fn context
178
- declare const value: WalkerOS.DeepPartialEvent | unknown;
179
- declare const mapping: Mapping.Value;
180
- declare const options: Mapping.Options;
181
- `;
182
- var CONDITION_CONTEXT_TYPES = `
183
- // WalkerOS Core Types
184
- declare namespace WalkerOS {
185
- // Utility types
186
- type DeepPartial<T> = {
187
- [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
188
- };
189
-
190
- type PromiseOrValue<T> = T | Promise<T>;
191
-
192
- // Property types
193
- type PropertyType = boolean | string | number | {
194
- [key: string]: Property;
195
- };
196
-
197
- type Property = PropertyType | Array<PropertyType>;
198
-
199
- interface Properties {
200
- [key: string]: Property | undefined;
201
- }
202
-
203
- interface OrderedProperties {
204
- [key: string]: [Property, number] | undefined;
205
- }
206
-
207
- // Consent
208
- interface Consent {
209
- [name: string]: boolean;
210
- }
211
-
212
- // User
213
- interface User extends Properties {
214
- id?: string;
215
- device?: string;
216
- session?: string;
217
- hash?: string;
218
- address?: string;
219
- email?: string;
220
- phone?: string;
221
- userAgent?: string;
222
- browser?: string;
223
- browserVersion?: string;
224
- deviceType?: string;
225
- language?: string;
226
- country?: string;
227
- region?: string;
228
- city?: string;
229
- zip?: string;
230
- timezone?: string;
231
- os?: string;
232
- osVersion?: string;
233
- screenSize?: string;
234
- ip?: string;
235
- internal?: boolean;
236
- }
237
-
238
- // Version
239
- interface Version extends Properties {
240
- source: string;
241
- tagging: number;
242
- }
243
-
244
- // Source
245
- type SourceType = 'web' | 'server' | 'app' | 'other' | string;
246
-
247
- interface Source extends Properties {
248
- type: SourceType;
249
- id: string;
250
- previous_id: string;
251
- }
252
-
253
- // Entity
254
- type Entities = Array<Entity>;
255
-
256
- interface Entity {
257
- entity: string;
258
- data: Properties;
259
- nested: Entities;
260
- context: OrderedProperties;
261
- }
262
-
263
- // Event
264
- interface Event {
265
- name: string;
266
- data: Properties;
267
- context: OrderedProperties;
268
- globals: Properties;
269
- custom: Properties;
270
- user: User;
271
- nested: Entities;
272
- consent: Consent;
273
- id: string;
274
- trigger: string;
275
- entity: string;
276
- action: string;
277
- timestamp: number;
278
- timing: number;
279
- group: string;
280
- count: number;
281
- version: Version;
282
- source: Source;
283
- }
284
-
285
- type DeepPartialEvent = DeepPartial<Event>;
286
- }
287
-
288
- // Mapping Types
289
- declare namespace Mapping {
290
- type ValueType = string | ValueConfig;
291
- type Value = ValueType | Array<ValueType>;
292
-
293
- interface ValueConfig {
294
- condition?: Condition;
295
- consent?: WalkerOS.Consent;
296
- fn?: Fn;
297
- key?: string;
298
- loop?: Loop;
299
- map?: Map;
300
- set?: Value[];
301
- validate?: Validate;
302
- value?: WalkerOS.PropertyType;
303
- }
304
-
305
- type Loop = [Value, Value];
306
-
307
- type Map = {
308
- [key: string]: Value;
309
- };
310
-
311
- type Condition = (
312
- value: WalkerOS.DeepPartialEvent | unknown,
313
- mapping?: Value,
314
- collector?: Collector.Instance
315
- ) => WalkerOS.PromiseOrValue<boolean>;
316
-
317
- type Fn = (
318
- value: WalkerOS.DeepPartialEvent | unknown,
319
- mapping: Value,
320
- options: any
321
- ) => WalkerOS.PromiseOrValue<WalkerOS.Property | unknown>;
322
-
323
- type Validate = (value?: unknown) => WalkerOS.PromiseOrValue<boolean>;
324
- }
325
-
326
- // Collector Types (full interface for condition context)
327
- declare namespace Collector {
328
- interface SessionData extends WalkerOS.Properties {
329
- isStart: boolean;
330
- storage: boolean;
331
- id?: string;
332
- start?: number;
333
- marketing?: true;
334
- updated?: number;
335
- isNew?: boolean;
336
- device?: string;
337
- count?: number;
338
- runs?: number;
339
- }
340
-
341
- interface Config {
342
- run?: boolean;
343
- tagging: number;
344
- globalsStatic: WalkerOS.Properties;
345
- sessionStatic: Partial<SessionData>;
346
- verbose: boolean;
347
- onError?: any;
348
- onLog?: any;
349
- }
350
-
351
- interface Instance {
352
- push: any;
353
- command: any;
354
- allowed: boolean;
355
- config: Config;
356
- consent: WalkerOS.Consent;
357
- count: number;
358
- custom: WalkerOS.Properties;
359
- sources: any;
360
- destinations: any;
361
- globals: WalkerOS.Properties;
362
- group: string;
363
- hooks: any;
364
- on: any;
365
- queue: any[];
366
- round: number;
367
- session: undefined | SessionData;
368
- timing: number;
369
- user: WalkerOS.User;
370
- version: string;
371
- }
372
- }
373
-
374
- // Parameter declarations for condition context
375
- declare const value: WalkerOS.DeepPartialEvent | unknown;
376
- declare const mapping: Mapping.Value;
377
- declare const collector: Collector.Instance | undefined;
378
- `;
379
- var VALIDATE_CONTEXT_TYPES = `
380
- // Parameter declaration for validate context
381
- declare const value: unknown;
382
- `;
383
- function getContextTypes(contextType) {
384
- switch (contextType) {
385
- case "fn":
386
- return FN_CONTEXT_TYPES;
387
- case "condition":
388
- return CONDITION_CONTEXT_TYPES;
389
- case "validate":
390
- return VALIDATE_CONTEXT_TYPES;
391
- default:
392
- return "";
393
- }
394
- }
395
-
396
- // walkeros-types:virtual:walkeros-core-types
397
- var virtual_walkeros_core_types_default = `/**
398
- * Core collector configuration interface
399
- */
400
- interface Config$7 {
401
- /** Whether to run collector automatically */
402
- run?: boolean;
403
- /** Version for event tagging */
404
- tagging: number;
405
- /** Static global properties even on a new run */
406
- globalsStatic: Properties;
407
- /** Static session data even on a new run */
408
- sessionStatic: Partial<SessionData>;
409
- /** Logger configuration */
410
- logger?: Config$4;
411
- }
412
- /**
413
- * Initialization configuration that extends Config with initial state
414
- */
415
- interface InitConfig extends Partial<Config$7> {
416
- /** Initial consent state */
417
- consent?: Consent;
418
- /** Initial user data */
419
- user?: User;
420
- /** Initial global properties */
421
- globals?: Properties;
422
- /** Source configurations */
423
- sources?: InitSources;
424
- /** Destination configurations */
425
- destinations?: InitDestinations;
426
- /** Transformer configurations */
427
- transformers?: InitTransformers;
428
- /** Initial custom properties */
429
- custom?: Properties;
430
- }
431
- interface SessionData extends Properties {
432
- isStart: boolean;
433
- storage: boolean;
434
- id?: string;
435
- start?: number;
436
- marketing?: true;
437
- updated?: number;
438
- isNew?: boolean;
439
- device?: string;
440
- count?: number;
441
- runs?: number;
442
- }
443
- interface Status {
444
- startedAt: number;
445
- in: number;
446
- out: number;
447
- failed: number;
448
- sources: Record<string, SourceStatus>;
449
- destinations: Record<string, DestinationStatus>;
450
- }
451
- interface SourceStatus {
452
- count: number;
453
- lastAt?: number;
454
- duration: number;
455
- }
456
- interface DestinationStatus {
457
- count: number;
458
- failed: number;
459
- lastAt?: number;
460
- duration: number;
461
- }
462
- interface Sources {
463
- [id: string]: Instance;
464
- }
465
- interface Destinations$1 {
466
- [id: string]: Instance$3;
467
- }
468
- interface Transformers$1 {
469
- [id: string]: Instance$1;
470
- }
471
- type CommandType = 'action' | 'config' | 'consent' | 'context' | 'destination' | 'elb' | 'globals' | 'hook' | 'init' | 'link' | 'run' | 'user' | 'walker' | string;
472
- /**
473
- * Options passed to collector.push() from sources.
474
- * NOT a Context - just push metadata.
475
- */
476
- interface PushOptions {
477
- id?: string;
478
- ingest?: unknown;
479
- mapping?: Config$3;
480
- preChain?: string[];
481
- }
482
- /**
483
- * Push function signature - handles events only
484
- */
485
- interface PushFn$1 {
486
- (event: DeepPartialEvent, options?: PushOptions): Promise<PushResult>;
487
- }
488
- /**
489
- * Command function signature - handles walker commands only
490
- */
491
- interface CommandFn {
492
- (command: 'config', config: Partial<Config$7>): Promise<PushResult>;
493
- (command: 'consent', consent: Consent): Promise<PushResult>;
494
- <T extends Types$3>(command: 'destination', destination: Init$2<T> | Instance$3<T>, config?: Config$6<T>): Promise<PushResult>;
495
- <K extends keyof Functions>(command: 'hook', name: K, hookFn: Functions[K]): Promise<PushResult>;
496
- (command: 'on', type: Types$2, rules: SingleOrArray<Options>): Promise<PushResult>;
497
- (command: 'user', user: User): Promise<PushResult>;
498
- (command: 'run', runState?: {
499
- consent?: Consent;
500
- user?: User;
501
- globals?: Properties;
502
- custom?: Properties;
503
- }): Promise<PushResult>;
504
- (command: string, data?: unknown, options?: unknown): Promise<PushResult>;
505
- }
506
- interface Instance$4 {
507
- push: PushFn$1;
508
- command: CommandFn;
509
- allowed: boolean;
510
- config: Config$7;
511
- consent: Consent;
512
- count: number;
513
- custom: Properties;
514
- sources: Sources;
515
- destinations: Destinations$1;
516
- transformers: Transformers$1;
517
- globals: Properties;
518
- group: string;
519
- hooks: Functions;
520
- logger: Instance$2;
521
- on: OnConfig;
522
- queue: Events;
523
- round: number;
524
- session: undefined | SessionData;
525
- status: Status;
526
- timing: number;
527
- user: User;
528
- version: string;
529
- pending: {
530
- sources: InitSources;
531
- destinations: InitDestinations;
532
- };
533
- }
534
-
535
- type collector_CommandFn = CommandFn;
536
- type collector_CommandType = CommandType;
537
- type collector_DestinationStatus = DestinationStatus;
538
- type collector_InitConfig = InitConfig;
539
- type collector_PushOptions = PushOptions;
540
- type collector_SessionData = SessionData;
541
- type collector_SourceStatus = SourceStatus;
542
- type collector_Sources = Sources;
543
- type collector_Status = Status;
544
- declare namespace collector {
545
- export type { collector_CommandFn as CommandFn, collector_CommandType as CommandType, Config$7 as Config, collector_DestinationStatus as DestinationStatus, Destinations$1 as Destinations, collector_InitConfig as InitConfig, Instance$4 as Instance, PushFn$1 as PushFn, collector_PushOptions as PushOptions, collector_SessionData as SessionData, collector_SourceStatus as SourceStatus, collector_Sources as Sources, collector_Status as Status, Transformers$1 as Transformers };
546
- }
547
-
548
- /**
549
- * Base context interface for walkerOS stages.
550
- * Sources, Transformers, and Destinations extend this.
551
- */
552
- interface Base<C = unknown, E = unknown> {
553
- collector: Instance$4;
554
- logger: Instance$2;
555
- config: C;
556
- env: E;
557
- }
558
-
559
- type context_Base<C = unknown, E = unknown> = Base<C, E>;
560
- declare namespace context {
561
- export type { context_Base as Base };
562
- }
563
-
564
- interface Contract$1 {
565
- version: string;
566
- globals: Globals;
567
- context: Contexts;
568
- entities: Entities$1;
569
- }
570
- interface Globals {
571
- [name: string]: Global;
572
- }
573
- interface Contexts {
574
- [name: string]: Context$5;
575
- }
576
- interface Entities$1 {
577
- [name: string]: Entity$1;
578
- }
579
- interface Properties$2 {
580
- [name: string]: Property$2;
581
- }
582
- interface Global extends Property$2 {
583
- }
584
- interface Context$5 extends Property$2 {
585
- }
586
- interface Entity$1 {
587
- data: Properties$2;
588
- actions: Actions;
589
- }
590
- interface Actions {
591
- [name: string]: Action;
592
- }
593
- interface Action {
594
- trigger?: Trigger;
595
- }
596
- type Trigger = string;
597
- interface Property$2 {
598
- type?: PropertyType$1;
599
- required?: boolean;
600
- values?: PropertyValues;
601
- }
602
- type PropertyType$1 = 'boolean' | 'string' | 'number';
603
- type PropertyValues = Array<Property>;
604
-
605
- type data_Action = Action;
606
- type data_Actions = Actions;
607
- type data_Contexts = Contexts;
608
- type data_Global = Global;
609
- type data_Globals = Globals;
610
- type data_PropertyValues = PropertyValues;
611
- type data_Trigger = Trigger;
612
- declare namespace data {
613
- export type { data_Action as Action, data_Actions as Actions, Context$5 as Context, data_Contexts as Contexts, Contract$1 as Contract, Entities$1 as Entities, Entity$1 as Entity, data_Global as Global, data_Globals as Globals, Properties$2 as Properties, Property$2 as Property, PropertyType$1 as PropertyType, data_PropertyValues as PropertyValues, data_Trigger as Trigger };
614
- }
615
-
616
- /**
617
- * Base environment requirements interface for walkerOS destinations
618
- *
619
- * This defines the core interface that destinations can use to declare
620
- * their runtime environment requirements. Platform-specific extensions
621
- * should extend this interface.
622
- */
623
- interface BaseEnv$2 {
624
- /**
625
- * Generic global properties that destinations may require
626
- * Platform-specific implementations can extend this interface
627
- */
628
- [key: string]: unknown;
629
- }
630
- /**
631
- * Type bundle for destination generics.
632
- * Groups Settings, InitSettings, Mapping, and Env into a single type parameter.
633
- */
634
- interface Types$3<S = unknown, M = unknown, E = BaseEnv$2, I = S> {
635
- settings: S;
636
- initSettings: I;
637
- mapping: M;
638
- env: E;
639
- }
640
- /**
641
- * Generic constraint for Types - ensures T has required properties for indexed access
642
- */
643
- type TypesGeneric$2 = {
644
- settings: any;
645
- initSettings: any;
646
- mapping: any;
647
- env: any;
648
- };
649
- /**
650
- * Type extractors for consistent usage with Types bundle
651
- */
652
- type Settings$2<T extends TypesGeneric$2 = Types$3> = T['settings'];
653
- type InitSettings$2<T extends TypesGeneric$2 = Types$3> = T['initSettings'];
654
- type Mapping$1<T extends TypesGeneric$2 = Types$3> = T['mapping'];
655
- type Env$2<T extends TypesGeneric$2 = Types$3> = T['env'];
656
- /**
657
- * Inference helper: Extract Types from Instance
658
- */
659
- type TypesOf$2<I> = I extends Instance$3<infer T> ? T : never;
660
- interface Instance$3<T extends TypesGeneric$2 = Types$3> {
661
- config: Config$6<T>;
662
- queuePush?: Events;
663
- queueOn?: Array<{
664
- type: Types$2;
665
- data?: unknown;
666
- }>;
667
- dlq?: DLQ;
668
- batches?: BatchRegistry<Mapping$1<T>>;
669
- type?: string;
670
- env?: Env$2<T>;
671
- init?: InitFn$1<T>;
672
- push: PushFn<T>;
673
- pushBatch?: PushBatchFn<T>;
674
- on?: OnFn;
675
- }
676
- interface Config$6<T extends TypesGeneric$2 = Types$3> {
677
- /** Required consent states to push events; queues events when not granted. */
678
- consent?: Consent;
679
- /** Implementation-specific configuration passed to the init function. */
680
- settings?: InitSettings$2<T>;
681
- /** Global data transformation applied to all events; result passed as context.data to push. */
682
- data?: Value | Values;
683
- /** Runtime dependencies merged from code and config env; extensible per destination. */
684
- env?: Env$2<T>;
685
- /** Destination identifier; auto-generated if not provided. */
686
- id?: string;
687
- /** Whether the destination has been initialized; prevents re-initialization. */
688
- init?: boolean;
689
- /** Whether to load external scripts (e.g., gtag.js); destination-specific behavior. */
690
- loadScript?: boolean;
691
- /** Logger configuration (level, handler) to override the collector's defaults. */
692
- logger?: Config$4;
693
- /** Entity-action rules to filter, rename, transform, and batch events for this destination. */
694
- mapping?: Rules<Rule<Mapping$1<T>>>;
695
- /** Pre-processing rules applied to all events before mapping; modifies events in-place. */
696
- policy?: Policy$1;
697
- /** Whether to queue events when consent is not granted; defaults to true. */
698
- queue?: boolean;
699
- /** Defer destination initialization until these collector events fire (e.g., \`['consent']\`). */
700
- require?: string[];
701
- /** Transformer chain to run after collector processing but before this destination. */
702
- before?: string | string[];
703
- }
704
- type PartialConfig$1<T extends TypesGeneric$2 = Types$3> = Config$6<Types$3<Partial<Settings$2<T>> | Settings$2<T>, Partial<Mapping$1<T>> | Mapping$1<T>, Env$2<T>>>;
705
- interface Policy$1 {
706
- [key: string]: Value;
707
- }
708
- type Code<T extends TypesGeneric$2 = Types$3> = Instance$3<T>;
709
- type Init$2<T extends TypesGeneric$2 = Types$3> = {
710
- code: Code<T>;
711
- config?: Partial<Config$6<T>>;
712
- env?: Partial<Env$2<T>>;
713
- before?: string | string[];
714
- };
715
- interface InitDestinations {
716
- [key: string]: Init$2<any>;
717
- }
718
- interface Destinations {
719
- [key: string]: Instance$3;
720
- }
721
- /**
722
- * Context provided to destination functions.
723
- * Extends base context with destination-specific properties.
724
- */
725
- interface Context$4<T extends TypesGeneric$2 = Types$3> extends Base<Config$6<T>, Env$2<T>> {
726
- id: string;
727
- data?: Data$1;
728
- }
729
- interface PushContext<T extends TypesGeneric$2 = Types$3> extends Context$4<T> {
730
- ingest?: unknown;
731
- rule?: Rule<Mapping$1<T>>;
732
- }
733
- interface PushBatchContext<T extends TypesGeneric$2 = Types$3> extends Context$4<T> {
734
- ingest?: unknown;
735
- rule?: Rule<Mapping$1<T>>;
736
- }
737
- type InitFn$1<T extends TypesGeneric$2 = Types$3> = (context: Context$4<T>) => PromiseOrValue<void | false | Config$6<T>>;
738
- type PushFn<T extends TypesGeneric$2 = Types$3> = (event: Event, context: PushContext<T>) => PromiseOrValue<void | unknown>;
739
- type PushBatchFn<T extends TypesGeneric$2 = Types$3> = (batch: Batch<Mapping$1<T>>, context: PushBatchContext<T>) => void;
740
- type PushEvent<Mapping = unknown> = {
741
- event: Event;
742
- mapping?: Rule<Mapping>;
743
- };
744
- type PushEvents<Mapping = unknown> = Array<PushEvent<Mapping>>;
745
- interface Batch<Mapping> {
746
- key: string;
747
- events: Events;
748
- data: Array<Data$1>;
749
- mapping?: Rule<Mapping>;
750
- }
751
- interface BatchRegistry<Mapping> {
752
- [mappingKey: string]: {
753
- batched: Batch<Mapping>;
754
- batchFn: () => void;
755
- };
756
- }
757
- type Data$1 = Property | undefined | Array<Property | undefined>;
758
- interface Ref {
759
- type: string;
760
- data?: unknown;
761
- error?: unknown;
762
- }
763
- type Push$1 = {
764
- queuePush?: Events;
765
- error?: unknown;
766
- };
767
- type DLQ = Array<[Event, unknown]>;
768
-
769
- type destination_Batch<Mapping> = Batch<Mapping>;
770
- type destination_BatchRegistry<Mapping> = BatchRegistry<Mapping>;
771
- type destination_Code<T extends TypesGeneric$2 = Types$3> = Code<T>;
772
- type destination_DLQ = DLQ;
773
- type destination_Destinations = Destinations;
774
- type destination_InitDestinations = InitDestinations;
775
- type destination_PushBatchContext<T extends TypesGeneric$2 = Types$3> = PushBatchContext<T>;
776
- type destination_PushBatchFn<T extends TypesGeneric$2 = Types$3> = PushBatchFn<T>;
777
- type destination_PushContext<T extends TypesGeneric$2 = Types$3> = PushContext<T>;
778
- type destination_PushEvent<Mapping = unknown> = PushEvent<Mapping>;
779
- type destination_PushEvents<Mapping = unknown> = PushEvents<Mapping>;
780
- type destination_PushFn<T extends TypesGeneric$2 = Types$3> = PushFn<T>;
781
- type destination_Ref = Ref;
782
- declare namespace destination {
783
- export type { BaseEnv$2 as BaseEnv, destination_Batch as Batch, destination_BatchRegistry as BatchRegistry, destination_Code as Code, Config$6 as Config, Context$4 as Context, destination_DLQ as DLQ, Data$1 as Data, destination_Destinations as Destinations, Env$2 as Env, Init$2 as Init, destination_InitDestinations as InitDestinations, InitFn$1 as InitFn, InitSettings$2 as InitSettings, Instance$3 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, Settings$2 as Settings, Types$3 as Types, TypesGeneric$2 as TypesGeneric, TypesOf$2 as TypesOf };
784
- }
785
-
786
- interface EventFn<R = Promise<PushResult>> {
787
- (partialEvent: DeepPartialEvent): R;
788
- (event: string): R;
789
- (event: string, data: Properties): R;
790
- }
791
- interface Fn$2<R = Promise<PushResult>, Config = unknown> extends EventFn<R>, WalkerCommands<R, Config> {
792
- }
793
- interface WalkerCommands<R = Promise<PushResult>, Config = unknown> {
794
- (event: 'walker config', config: Partial<Config>): R;
795
- (event: 'walker consent', consent: Consent): R;
796
- <T extends Types$3>(event: 'walker destination', destination: Init$2<T> | Instance$3<T>, config?: Config$6<T>): R;
797
- <K extends keyof Functions>(event: 'walker hook', name: K, hookFn: Functions[K]): R;
798
- (event: 'walker on', type: Types$2, rules: SingleOrArray<Options>): R;
799
- (event: 'walker user', user: User): R;
800
- (event: 'walker run', runState: {
801
- consent?: Consent;
802
- user?: User;
803
- globals?: Properties;
804
- custom?: Properties;
805
- }): R;
806
- }
807
- type Event$1<R = Promise<PushResult>> = (partialEvent: DeepPartialEvent) => R;
808
- type PushData<Config = unknown> = DeepPartial<Config> | Consent | User | Properties;
809
- interface PushResult {
810
- ok: boolean;
811
- event?: Event;
812
- done?: Record<string, Ref>;
813
- queued?: Record<string, Ref>;
814
- failed?: Record<string, Ref>;
815
- }
816
- type Layer = Array<IArguments | DeepPartialEvent | unknown[]>;
817
-
818
- type elb_EventFn<R = Promise<PushResult>> = EventFn<R>;
819
- type elb_Layer = Layer;
820
- type elb_PushData<Config = unknown> = PushData<Config>;
821
- type elb_PushResult = PushResult;
822
- type elb_WalkerCommands<R = Promise<PushResult>, Config = unknown> = WalkerCommands<R, Config>;
823
- declare namespace elb {
824
- export type { Event$1 as Event, elb_EventFn as EventFn, Fn$2 as Fn, elb_Layer as Layer, elb_PushData as PushData, elb_PushResult as PushResult, elb_WalkerCommands as WalkerCommands };
825
- }
826
-
827
- /**
828
- * Flow Configuration System
829
- *
830
- * Core types for walkerOS unified configuration.
831
- * Platform-agnostic, runtime-focused.
832
- *
833
- * The Flow system enables "one config to rule them all" - a single
834
- * walkeros.config.json file that manages multiple flows
835
- * (web_prod, web_stage, server_prod, etc.) with shared configuration,
836
- * variables, and reusable definitions.
837
- *
838
- * @packageDocumentation
839
- */
840
-
841
- /**
842
- * Primitive value types for variables
843
- */
844
- type Primitive = string | number | boolean;
845
- /**
846
- * Variables record type for interpolation.
847
- * Used at Setup, Config, Source, and Destination levels.
848
- */
849
- type Variables = Record<string, Primitive>;
850
- /**
851
- * Definitions record type for reusable configurations.
852
- * Used at Setup, Config, Source, and Destination levels.
853
- */
854
- type Definitions = Record<string, unknown>;
855
- /**
856
- * Inline code definition for sources/destinations/transformers.
857
- * Used instead of package when defining inline functions.
858
- */
859
- interface InlineCode {
860
- push: string;
861
- type?: string;
862
- init?: string;
863
- }
864
- /**
865
- * Packages configuration for build.
866
- */
867
- type Packages = Record<string, {
868
- version?: string;
869
- imports?: string[];
870
- path?: string;
871
- }>;
872
- /**
873
- * Web platform configuration.
874
- *
875
- * @remarks
876
- * Presence of this key indicates web platform (browser-based tracking).
877
- * Builds to IIFE format, ES2020 target, browser platform.
878
- */
879
- interface Web {
880
- /**
881
- * Window property name for collector instance.
882
- * @default "collector"
883
- */
884
- windowCollector?: string;
885
- /**
886
- * Window property name for elb function.
887
- * @default "elb"
888
- */
889
- windowElb?: string;
890
- }
891
- /**
892
- * Server platform configuration.
893
- *
894
- * @remarks
895
- * Presence of this key indicates server platform (Node.js).
896
- * Builds to ESM format, Node18 target, node platform.
897
- * Reserved for future server-specific options.
898
- */
899
- interface Server {
900
- }
901
- /**
902
- * Complete multi-flow configuration.
903
- * Root type for walkeros.config.json files.
904
- *
905
- * @remarks
906
- * If only one flow exists, it's auto-selected without --flow flag.
907
- * Convention: use "default" as the flow name for single-flow configs.
908
- *
909
- * @example
910
- * \`\`\`json
911
- * {
912
- * "version": 1,
913
- * "$schema": "https://walkeros.io/schema/flow/v1.json",
914
- * "variables": { "CURRENCY": "USD" },
915
- * "flows": {
916
- * "default": { "web": {}, ... }
917
- * }
918
- * }
919
- * \`\`\`
920
- */
921
- interface Setup {
922
- /**
923
- * Configuration schema version.
924
- */
925
- version: 1;
926
- /**
927
- * JSON Schema reference for IDE validation.
928
- * @example "https://walkeros.io/schema/flow/v1.json"
929
- */
930
- $schema?: string;
931
- /**
932
- * Folders to include in the bundle output.
933
- * These folders are copied to dist/ during bundle, making them available
934
- * at runtime for both local and Docker execution.
935
- *
936
- * @remarks
937
- * Use for credential files, configuration, or other runtime assets.
938
- * Paths are relative to the config file location.
939
- * Default: \`["./shared"]\` if the folder exists, otherwise \`[]\`.
940
- *
941
- * @example
942
- * \`\`\`json
943
- * {
944
- * "include": ["./credentials", "./config"]
945
- * }
946
- * \`\`\`
947
- */
948
- include?: string[];
949
- /**
950
- * Shared variables for interpolation.
951
- * Resolution: destination/source > Config > Setup level
952
- * Syntax: $var.name
953
- */
954
- variables?: Variables;
955
- /**
956
- * Reusable configuration definitions.
957
- * Syntax: $def.name
958
- */
959
- definitions?: Definitions;
960
- /**
961
- * Named flow configurations.
962
- * If only one flow exists, it's auto-selected.
963
- */
964
- flows: Record<string, Config$5>;
965
- }
966
- /**
967
- * Single flow configuration.
968
- * Represents one deployment target (e.g., web_prod, server_stage).
969
- *
970
- * @remarks
971
- * Platform is determined by presence of \`web\` or \`server\` key.
972
- * Exactly one must be present.
973
- *
974
- * Variables/definitions cascade: source/destination > config > setup
975
- */
976
- interface Config$5 {
977
- /**
978
- * Web platform configuration.
979
- * Presence indicates web platform (browser-based tracking).
980
- * Mutually exclusive with \`server\`.
981
- */
982
- web?: Web;
983
- /**
984
- * Server platform configuration.
985
- * Presence indicates server platform (Node.js).
986
- * Mutually exclusive with \`web\`.
987
- */
988
- server?: Server;
989
- /**
990
- * Source configurations (data capture).
991
- *
992
- * @remarks
993
- * Sources capture events from various origins:
994
- * - Browser DOM interactions (clicks, page views)
995
- * - DataLayer pushes
996
- * - HTTP requests (server-side)
997
- * - Cloud function triggers
998
- *
999
- * Key = unique source identifier (arbitrary)
1000
- * Value = source reference with package and config
1001
- *
1002
- * @example
1003
- * \`\`\`json
1004
- * {
1005
- * "sources": {
1006
- * "browser": {
1007
- * "package": "@walkeros/web-source-browser",
1008
- * "config": {
1009
- * "settings": {
1010
- * "pageview": true,
1011
- * "session": true
1012
- * }
1013
- * }
1014
- * }
1015
- * }
1016
- * }
1017
- * \`\`\`
1018
- */
1019
- sources?: Record<string, SourceReference>;
1020
- /**
1021
- * Destination configurations (data output).
1022
- *
1023
- * @remarks
1024
- * Destinations send processed events to external services:
1025
- * - Google Analytics (gtag)
1026
- * - Meta Pixel (fbq)
1027
- * - Custom APIs
1028
- * - Data warehouses
1029
- *
1030
- * Key = unique destination identifier (arbitrary)
1031
- * Value = destination reference with package and config
1032
- *
1033
- * @example
1034
- * \`\`\`json
1035
- * {
1036
- * "destinations": {
1037
- * "gtag": {
1038
- * "package": "@walkeros/web-destination-gtag",
1039
- * "config": {
1040
- * "settings": {
1041
- * "ga4": { "measurementId": "G-XXXXXXXXXX" }
1042
- * }
1043
- * }
1044
- * }
1045
- * }
1046
- * }
1047
- * \`\`\`
1048
- */
1049
- destinations?: Record<string, DestinationReference>;
1050
- /**
1051
- * Transformer configurations (event transformation).
1052
- *
1053
- * @remarks
1054
- * Transformers transform events in the pipeline:
1055
- * - Pre-collector: Between sources and collector
1056
- * - Post-collector: Between collector and destinations
1057
- *
1058
- * Key = unique transformer identifier (referenced by source.next or destination.before)
1059
- * Value = transformer reference with package and config
1060
- *
1061
- * @example
1062
- * \`\`\`json
1063
- * {
1064
- * "transformers": {
1065
- * "enrich": {
1066
- * "package": "@walkeros/transformer-enricher",
1067
- * "config": { "apiUrl": "https://api.example.com" },
1068
- * "next": "validate"
1069
- * },
1070
- * "validate": {
1071
- * "package": "@walkeros/transformer-validator"
1072
- * }
1073
- * }
1074
- * }
1075
- * \`\`\`
1076
- */
1077
- transformers?: Record<string, TransformerReference>;
1078
- /**
1079
- * Collector configuration (event processing).
1080
- *
1081
- * @remarks
1082
- * The collector is the central event processing engine.
1083
- * Configuration includes:
1084
- * - Consent management
1085
- * - Global properties
1086
- * - User identification
1087
- * - Processing rules
1088
- *
1089
- * @see {@link Collector.InitConfig} for complete options
1090
- *
1091
- * @example
1092
- * \`\`\`json
1093
- * {
1094
- * "collector": {
1095
- * "run": true,
1096
- * "tagging": 1,
1097
- * "consent": {
1098
- * "functional": true,
1099
- * "marketing": false
1100
- * },
1101
- * "globals": {
1102
- * "currency": "USD",
1103
- * "environment": "production"
1104
- * }
1105
- * }
1106
- * }
1107
- * \`\`\`
1108
- */
1109
- collector?: InitConfig;
1110
- /**
1111
- * NPM packages to bundle.
1112
- */
1113
- packages?: Packages;
1114
- /**
1115
- * Flow-level variables.
1116
- * Override Setup.variables, overridden by source/destination variables.
1117
- */
1118
- variables?: Variables;
1119
- /**
1120
- * Flow-level definitions.
1121
- * Extend Setup.definitions, overridden by source/destination definitions.
1122
- */
1123
- definitions?: Definitions;
1124
- }
1125
- /**
1126
- * Source reference with inline package syntax.
1127
- *
1128
- * @remarks
1129
- * References a source package and provides configuration.
1130
- * The package is automatically downloaded and imported during build.
1131
- * Alternatively, use \`code: true\` for inline code execution.
1132
- */
1133
- interface SourceReference {
1134
- /**
1135
- * Package specifier with optional version.
1136
- *
1137
- * @remarks
1138
- * Formats:
1139
- * - \`"@walkeros/web-source-browser"\` - Latest version
1140
- * - \`"@walkeros/web-source-browser@2.0.0"\` - Specific version
1141
- * - \`"@walkeros/web-source-browser@^2.0.0"\` - Semver range
1142
- *
1143
- * The CLI will:
1144
- * 1. Parse the package reference
1145
- * 2. Download from npm
1146
- * 3. Auto-detect default or named export
1147
- * 4. Generate import statement
1148
- *
1149
- * Optional when \`code: true\` is used for inline code execution.
1150
- *
1151
- * @example
1152
- * "package": "@walkeros/web-source-browser@latest"
1153
- */
1154
- package?: string;
1155
- /**
1156
- * Resolved import variable name or built-in code source.
1157
- *
1158
- * @remarks
1159
- * - String: Auto-resolved from packages[package].imports[0] during getFlowConfig(),
1160
- * or provided explicitly for advanced use cases.
1161
- * - InlineCode: Object with type, push, and optional init for inline code definition.
1162
- *
1163
- * @example
1164
- * // Using inline code object
1165
- * {
1166
- * "code": {
1167
- * "type": "logger",
1168
- * "push": "$code:(event) => console.log(event)"
1169
- * }
1170
- * }
1171
- */
1172
- code?: string | InlineCode;
1173
- /**
1174
- * Source-specific configuration.
1175
- *
1176
- * @remarks
1177
- * Structure depends on the source package.
1178
- * Passed to the source's initialization function.
1179
- *
1180
- * @example
1181
- * \`\`\`json
1182
- * {
1183
- * "config": {
1184
- * "settings": {
1185
- * "pageview": true,
1186
- * "session": true,
1187
- * "elb": "elb",
1188
- * "prefix": "data-elb"
1189
- * }
1190
- * }
1191
- * }
1192
- * \`\`\`
1193
- */
1194
- config?: unknown;
1195
- /**
1196
- * Source environment configuration.
1197
- *
1198
- * @remarks
1199
- * Environment-specific settings for the source.
1200
- * Merged with default source environment.
1201
- */
1202
- env?: unknown;
1203
- /**
1204
- * Mark as primary source (provides main ELB).
1205
- *
1206
- * @remarks
1207
- * The primary source's ELB function is returned by \`startFlow()\`.
1208
- * Only one source should be marked as primary per flow.
1209
- *
1210
- * @default false
1211
- */
1212
- primary?: boolean;
1213
- /**
1214
- * Source-level variables (highest priority in cascade).
1215
- * Overrides flow and setup variables.
1216
- */
1217
- variables?: Variables;
1218
- /**
1219
- * Source-level definitions (highest priority in cascade).
1220
- * Overrides flow and setup definitions.
1221
- */
1222
- definitions?: Definitions;
1223
- /**
1224
- * First transformer in post-source chain.
1225
- *
1226
- * @remarks
1227
- * Name of the transformer to execute after this source captures an event.
1228
- * If omitted, events route directly to the collector.
1229
- * Can be an array for explicit chain control (bypasses transformer.next resolution).
1230
- */
1231
- next?: string | string[];
1232
- }
1233
- /**
1234
- * Transformer reference with inline package syntax.
1235
- *
1236
- * @remarks
1237
- * References a transformer package and provides configuration.
1238
- * Transformers transform events in the pipeline between sources and destinations.
1239
- * Alternatively, use \`code: true\` for inline code execution.
1240
- */
1241
- interface TransformerReference {
1242
- /**
1243
- * Package specifier with optional version.
1244
- *
1245
- * @remarks
1246
- * Same format as SourceReference.package
1247
- * Optional when \`code: true\` is used for inline code execution.
1248
- *
1249
- * @example
1250
- * "package": "@walkeros/transformer-enricher@1.0.0"
1251
- */
1252
- package?: string;
1253
- /**
1254
- * Resolved import variable name or built-in code transformer.
1255
- *
1256
- * @remarks
1257
- * - String: Auto-resolved from packages[package].imports[0] during getFlowConfig(),
1258
- * or provided explicitly for advanced use cases.
1259
- * - InlineCode: Object with type, push, and optional init for inline code definition.
1260
- *
1261
- * @example
1262
- * // Using inline code object
1263
- * {
1264
- * "code": {
1265
- * "type": "enricher",
1266
- * "push": "$code:(event) => ({ ...event, data: { enriched: true } })"
1267
- * }
1268
- * }
1269
- */
1270
- code?: string | InlineCode;
1271
- /**
1272
- * Transformer-specific configuration.
1273
- *
1274
- * @remarks
1275
- * Structure depends on the transformer package.
1276
- * Passed to the transformer's initialization function.
1277
- */
1278
- config?: unknown;
1279
- /**
1280
- * Transformer environment configuration.
1281
- *
1282
- * @remarks
1283
- * Environment-specific settings for the transformer.
1284
- * Merged with default transformer environment.
1285
- */
1286
- env?: unknown;
1287
- /**
1288
- * Next transformer in chain.
1289
- *
1290
- * @remarks
1291
- * Name of the next transformer to execute after this one.
1292
- * If omitted:
1293
- * - Pre-collector: routes to collector
1294
- * - Post-collector: routes to destination
1295
- * Can be an array for explicit chain control (terminates chain walking).
1296
- */
1297
- next?: string | string[];
1298
- /**
1299
- * Transformer-level variables (highest priority in cascade).
1300
- * Overrides flow and setup variables.
1301
- */
1302
- variables?: Variables;
1303
- /**
1304
- * Transformer-level definitions (highest priority in cascade).
1305
- * Overrides flow and setup definitions.
1306
- */
1307
- definitions?: Definitions;
1308
- }
1309
- /**
1310
- * Destination reference with inline package syntax.
1311
- *
1312
- * @remarks
1313
- * References a destination package and provides configuration.
1314
- * Structure mirrors SourceReference for consistency.
1315
- */
1316
- interface DestinationReference {
1317
- /**
1318
- * Package specifier with optional version.
1319
- *
1320
- * @remarks
1321
- * Same format as SourceReference.package
1322
- * Optional when \`code: true\` is used for inline code execution.
1323
- *
1324
- * @example
1325
- * "package": "@walkeros/web-destination-gtag@2.0.0"
1326
- */
1327
- package?: string;
1328
- /**
1329
- * Resolved import variable name or built-in code destination.
1330
- *
1331
- * @remarks
1332
- * - String: Auto-resolved from packages[package].imports[0] during getFlowConfig(),
1333
- * or provided explicitly for advanced use cases.
1334
- * - InlineCode: Object with type, push, and optional init for inline code definition.
1335
- *
1336
- * @example
1337
- * // Using inline code object
1338
- * {
1339
- * "code": {
1340
- * "type": "logger",
1341
- * "push": "$code:(event) => console.log('Event:', event.name)"
1342
- * }
1343
- * }
1344
- */
1345
- code?: string | InlineCode;
1346
- /**
1347
- * Destination-specific configuration.
1348
- *
1349
- * @remarks
1350
- * Structure depends on the destination package.
1351
- * Typically includes:
1352
- * - settings: API keys, IDs, endpoints
1353
- * - mapping: Event transformation rules
1354
- * - consent: Required consent states
1355
- * - policy: Processing rules
1356
- *
1357
- * @example
1358
- * \`\`\`json
1359
- * {
1360
- * "config": {
1361
- * "settings": {
1362
- * "ga4": {
1363
- * "measurementId": "G-XXXXXXXXXX"
1364
- * }
1365
- * },
1366
- * "mapping": {
1367
- * "page": {
1368
- * "view": {
1369
- * "name": "page_view",
1370
- * "data": { ... }
1371
- * }
1372
- * }
1373
- * }
1374
- * }
1375
- * }
1376
- * \`\`\`
1377
- */
1378
- config?: unknown;
1379
- /**
1380
- * Destination environment configuration.
1381
- *
1382
- * @remarks
1383
- * Environment-specific settings for the destination.
1384
- * Merged with default destination environment.
1385
- */
1386
- env?: unknown;
1387
- /**
1388
- * Destination-level variables (highest priority in cascade).
1389
- * Overrides flow and setup variables.
1390
- */
1391
- variables?: Variables;
1392
- /**
1393
- * Destination-level definitions (highest priority in cascade).
1394
- * Overrides flow and setup definitions.
1395
- */
1396
- definitions?: Definitions;
1397
- /**
1398
- * First transformer in pre-destination chain.
1399
- *
1400
- * @remarks
1401
- * Name of the transformer to execute before sending events to this destination.
1402
- * If omitted, events are sent directly from the collector.
1403
- * Can be an array for explicit chain control (bypasses transformer.next resolution).
1404
- */
1405
- before?: string | string[];
1406
- }
1407
-
1408
- type flow_Definitions = Definitions;
1409
- type flow_DestinationReference = DestinationReference;
1410
- type flow_InlineCode = InlineCode;
1411
- type flow_Packages = Packages;
1412
- type flow_Primitive = Primitive;
1413
- type flow_Server = Server;
1414
- type flow_Setup = Setup;
1415
- type flow_SourceReference = SourceReference;
1416
- type flow_TransformerReference = TransformerReference;
1417
- type flow_Variables = Variables;
1418
- type flow_Web = Web;
1419
- declare namespace flow {
1420
- export type { Config$5 as Config, flow_Definitions as Definitions, flow_DestinationReference as DestinationReference, flow_InlineCode as InlineCode, flow_Packages as Packages, flow_Primitive as Primitive, flow_Server as Server, flow_Setup as Setup, flow_SourceReference as SourceReference, flow_TransformerReference as TransformerReference, flow_Variables as Variables, flow_Web as Web };
1421
- }
1422
-
1423
- type AnyFunction$1<P extends unknown[] = never[], R = unknown> = (...args: P) => R;
1424
- type Functions = {
1425
- [key: string]: AnyFunction$1;
1426
- };
1427
- interface Parameter<P extends unknown[], R> {
1428
- fn: (...args: P) => R;
1429
- result?: R;
1430
- }
1431
- type HookFn<T extends AnyFunction$1> = (params: Parameter<Parameters<T>, ReturnType<T>>, ...args: Parameters<T>) => ReturnType<T>;
1432
-
1433
- type hooks_Functions = Functions;
1434
- type hooks_HookFn<T extends AnyFunction$1> = HookFn<T>;
1435
- declare namespace hooks {
1436
- export type { AnyFunction$1 as AnyFunction, hooks_Functions as Functions, hooks_HookFn as HookFn };
1437
- }
1438
-
1439
- /**
1440
- * Log levels from most to least severe
1441
- */
1442
- declare enum Level {
1443
- ERROR = 0,
1444
- INFO = 1,
1445
- DEBUG = 2
1446
- }
1447
- /**
1448
- * Normalized error context extracted from Error objects
1449
- */
1450
- interface ErrorContext {
1451
- message: string;
1452
- name: string;
1453
- stack?: string;
1454
- cause?: unknown;
1455
- }
1456
- /**
1457
- * Context passed to log handlers
1458
- * If an Error was passed, it's normalized into the error property
1459
- */
1460
- interface LogContext {
1461
- [key: string]: unknown;
1462
- error?: ErrorContext;
1463
- }
1464
- /**
1465
- * Log message function signature
1466
- * Accepts string or Error as message, with optional context
1467
- */
1468
- type LogFn = (message: string | Error, context?: unknown | Error) => void;
1469
- /**
1470
- * Throw function signature - logs error then throws
1471
- * Returns never as it always throws
1472
- */
1473
- type ThrowFn = (message: string | Error, context?: unknown) => never;
1474
- /**
1475
- * Default handler function (passed to custom handlers for chaining)
1476
- */
1477
- type DefaultHandler = (level: Level, message: string, context: LogContext, scope: string[]) => void;
1478
- /**
1479
- * Custom log handler function
1480
- * Receives originalHandler to allow middleware-style chaining
1481
- */
1482
- type Handler = (level: Level, message: string, context: LogContext, scope: string[], originalHandler: DefaultHandler) => void;
1483
- /**
1484
- * Logger instance with scoping support
1485
- * All logs automatically include trace path from scoping
1486
- */
1487
- interface Instance$2 {
1488
- /**
1489
- * Log an error message (always visible unless silenced)
1490
- */
1491
- error: LogFn;
1492
- /**
1493
- * Log an informational message
1494
- */
1495
- info: LogFn;
1496
- /**
1497
- * Log a debug message
1498
- */
1499
- debug: LogFn;
1500
- /**
1501
- * Log an error message and throw an Error
1502
- * Combines logging and throwing in one call
1503
- */
1504
- throw: ThrowFn;
1505
- /**
1506
- * Create a scoped child logger with automatic trace path
1507
- * @param name - Scope name (e.g., destination type, destination key)
1508
- * @returns A new logger instance with the scope applied
1509
- */
1510
- scope: (name: string) => Instance$2;
1511
- }
1512
- /**
1513
- * Logger configuration options
1514
- */
1515
- interface Config$4 {
1516
- /**
1517
- * Minimum log level to display
1518
- * @default Level.ERROR
1519
- */
1520
- level?: Level | keyof typeof Level;
1521
- /**
1522
- * Custom log handler function
1523
- * Receives originalHandler to preserve default behavior
1524
- */
1525
- handler?: Handler;
1526
- }
1527
- /**
1528
- * Internal config with resolved values and scope
1529
- */
1530
- interface InternalConfig {
1531
- level: Level;
1532
- handler?: Handler;
1533
- scope: string[];
1534
- }
1535
- /**
1536
- * Logger factory function type
1537
- */
1538
- type Factory = (config?: Config$4) => Instance$2;
1539
-
1540
- type logger_DefaultHandler = DefaultHandler;
1541
- type logger_ErrorContext = ErrorContext;
1542
- type logger_Factory = Factory;
1543
- type logger_Handler = Handler;
1544
- type logger_InternalConfig = InternalConfig;
1545
- type logger_Level = Level;
1546
- declare const logger_Level: typeof Level;
1547
- type logger_LogContext = LogContext;
1548
- type logger_LogFn = LogFn;
1549
- type logger_ThrowFn = ThrowFn;
1550
- declare namespace logger {
1551
- export { type Config$4 as Config, type logger_DefaultHandler as DefaultHandler, type logger_ErrorContext as ErrorContext, type logger_Factory as Factory, type logger_Handler as Handler, type Instance$2 as Instance, type logger_InternalConfig as InternalConfig, logger_Level as Level, type logger_LogContext as LogContext, type logger_LogFn as LogFn, type logger_ThrowFn as ThrowFn };
1552
- }
1553
-
1554
- /**
1555
- * Shared mapping configuration interface.
1556
- * Used by both Source.Config and Destination.Config.
1557
- */
1558
- interface Config$3<T = unknown> {
1559
- consent?: Consent;
1560
- data?: Value | Values;
1561
- mapping?: Rules<Rule<T>>;
1562
- policy?: Policy;
1563
- }
1564
- interface Policy {
1565
- [key: string]: Value;
1566
- }
1567
- interface Rules<T = Rule> {
1568
- [entity: string]: Record<string, T | Array<T>> | undefined;
1569
- }
1570
- interface Rule<Settings = unknown> {
1571
- batch?: number;
1572
- batchFn?: (destination: Instance$3, collector: Instance$4) => void;
1573
- batched?: Batch<Settings>;
1574
- condition?: Condition;
1575
- consent?: Consent;
1576
- settings?: Settings;
1577
- data?: Data;
1578
- ignore?: boolean;
1579
- name?: string;
1580
- policy?: Policy;
1581
- }
1582
- interface Result {
1583
- eventMapping?: Rule;
1584
- mappingKey?: string;
1585
- }
1586
- type Data = Value | Values;
1587
- type Value = ValueType | Array<ValueType>;
1588
- type Values = Array<Value>;
1589
- type ValueType = string | ValueConfig;
1590
- interface ValueConfig {
1591
- condition?: Condition;
1592
- consent?: Consent;
1593
- fn?: Fn$1;
1594
- key?: string;
1595
- loop?: Loop;
1596
- map?: Map;
1597
- set?: Value[];
1598
- validate?: Validate;
1599
- value?: PropertyType;
1600
- }
1601
- type Condition = (value: DeepPartialEvent | unknown, mapping?: Value, collector?: Instance$4) => PromiseOrValue<boolean>;
1602
- type Fn$1 = (value: DeepPartialEvent | unknown, mapping: Value, options: Options$1) => PromiseOrValue<Property | unknown>;
1603
- type Loop = [Value, Value];
1604
- type Map = {
1605
- [key: string]: Value;
1606
- };
1607
- interface Options$1 {
1608
- consent?: Consent;
1609
- collector?: Instance$4;
1610
- props?: unknown;
1611
- }
1612
- type Validate = (value?: unknown) => PromiseOrValue<boolean>;
1613
-
1614
- type mapping_Condition = Condition;
1615
- type mapping_Data = Data;
1616
- type mapping_Loop = Loop;
1617
- type mapping_Map = Map;
1618
- type mapping_Policy = Policy;
1619
- type mapping_Result = Result;
1620
- type mapping_Rule<Settings = unknown> = Rule<Settings>;
1621
- type mapping_Rules<T = Rule> = Rules<T>;
1622
- type mapping_Validate = Validate;
1623
- type mapping_Value = Value;
1624
- type mapping_ValueConfig = ValueConfig;
1625
- type mapping_ValueType = ValueType;
1626
- type mapping_Values = Values;
1627
- declare namespace mapping {
1628
- export type { mapping_Condition as Condition, Config$3 as Config, mapping_Data as Data, Fn$1 as Fn, mapping_Loop as Loop, mapping_Map as Map, Options$1 as Options, mapping_Policy as Policy, mapping_Result as Result, mapping_Rule as Rule, mapping_Rules as Rules, mapping_Validate as Validate, mapping_Value as Value, mapping_ValueConfig as ValueConfig, mapping_ValueType as ValueType, mapping_Values as Values };
1629
- }
1630
-
1631
- type Config$2 = {
1632
- config?: Array<GenericConfig>;
1633
- consent?: Array<ConsentConfig>;
1634
- custom?: Array<GenericConfig>;
1635
- globals?: Array<GenericConfig>;
1636
- ready?: Array<ReadyConfig>;
1637
- run?: Array<RunConfig>;
1638
- session?: Array<SessionConfig>;
1639
- user?: Array<UserConfig>;
1640
- };
1641
- type Types$2 = keyof Config$2 | (string & {});
1642
- interface EventContextMap {
1643
- config: Partial<Config$7>;
1644
- consent: Consent;
1645
- custom: Properties;
1646
- globals: Properties;
1647
- ready: undefined;
1648
- run: undefined;
1649
- session: SessionData;
1650
- user: User;
1651
- }
1652
- type EventContext<T extends keyof EventContextMap> = EventContextMap[T];
1653
- type AnyEventContext = EventContextMap[keyof EventContextMap];
1654
- interface Context$3 {
1655
- consent?: Consent;
1656
- session?: unknown;
1657
- }
1658
- type Options = ConsentConfig | GenericConfig | ReadyConfig | RunConfig | SessionConfig | UserConfig;
1659
- interface ConsentConfig {
1660
- [key: string]: ConsentFn;
1661
- }
1662
- type ConsentFn = (collector: Instance$4, consent: Consent) => void;
1663
- type GenericConfig = GenericFn;
1664
- type GenericFn = (collector: Instance$4, data: unknown) => void;
1665
- type ReadyConfig = ReadyFn;
1666
- type ReadyFn = (collector: Instance$4) => void;
1667
- type RunConfig = RunFn;
1668
- type RunFn = (collector: Instance$4) => void;
1669
- type SessionConfig = SessionFn;
1670
- type SessionFn = (collector: Instance$4, session?: unknown) => void;
1671
- type UserConfig = UserFn;
1672
- type UserFn = (collector: Instance$4, user: User) => void;
1673
- interface OnConfig {
1674
- config?: GenericConfig[];
1675
- consent?: ConsentConfig[];
1676
- custom?: GenericConfig[];
1677
- globals?: GenericConfig[];
1678
- ready?: ReadyConfig[];
1679
- run?: RunConfig[];
1680
- session?: SessionConfig[];
1681
- user?: UserConfig[];
1682
- [key: string]: ConsentConfig[] | GenericConfig[] | ReadyConfig[] | RunConfig[] | SessionConfig[] | UserConfig[] | undefined;
1683
- }
1684
- type OnFn<T extends TypesGeneric$2 = Types$3> = (type: Types$2, context: Context$4<T>) => PromiseOrValue<void>;
1685
- type OnFnRuntime = (type: Types$2, context: Context$4) => PromiseOrValue<void>;
1686
-
1687
- type on_AnyEventContext = AnyEventContext;
1688
- type on_ConsentConfig = ConsentConfig;
1689
- type on_ConsentFn = ConsentFn;
1690
- type on_EventContext<T extends keyof EventContextMap> = EventContext<T>;
1691
- type on_EventContextMap = EventContextMap;
1692
- type on_GenericConfig = GenericConfig;
1693
- type on_GenericFn = GenericFn;
1694
- type on_OnConfig = OnConfig;
1695
- type on_OnFn<T extends TypesGeneric$2 = Types$3> = OnFn<T>;
1696
- type on_OnFnRuntime = OnFnRuntime;
1697
- type on_Options = Options;
1698
- type on_ReadyConfig = ReadyConfig;
1699
- type on_ReadyFn = ReadyFn;
1700
- type on_RunConfig = RunConfig;
1701
- type on_RunFn = RunFn;
1702
- type on_SessionConfig = SessionConfig;
1703
- type on_SessionFn = SessionFn;
1704
- type on_UserConfig = UserConfig;
1705
- type on_UserFn = UserFn;
1706
- declare namespace on {
1707
- export type { on_AnyEventContext as AnyEventContext, Config$2 as Config, on_ConsentConfig as ConsentConfig, on_ConsentFn as ConsentFn, Context$3 as Context, on_EventContext as EventContext, on_EventContextMap as EventContextMap, on_GenericConfig as GenericConfig, on_GenericFn as GenericFn, on_OnConfig as OnConfig, on_OnFn as OnFn, on_OnFnRuntime as OnFnRuntime, on_Options as Options, on_ReadyConfig as ReadyConfig, on_ReadyFn as ReadyFn, on_RunConfig as RunConfig, on_RunFn as RunFn, on_SessionConfig as SessionConfig, on_SessionFn as SessionFn, Types$2 as Types, on_UserConfig as UserConfig, on_UserFn as UserFn };
1708
- }
1709
-
1710
- type Next = string | string[];
1711
- /**
1712
- * Base environment interface for walkerOS transformers.
1713
- *
1714
- * Minimal like Destination - just an extensible object.
1715
- * Transformers receive dependencies through context, not env.
1716
- */
1717
- interface BaseEnv$1 {
1718
- [key: string]: unknown;
1719
- }
1720
- /**
1721
- * Type bundle for transformer generics.
1722
- * Groups Settings, InitSettings, and Env into a single type parameter.
1723
- * Follows the Source/Destination pattern.
1724
- *
1725
- * @template S - Settings configuration type
1726
- * @template E - Environment type
1727
- * @template I - InitSettings configuration type (user input)
1728
- */
1729
- interface Types$1<S = unknown, E = BaseEnv$1, I = S> {
1730
- settings: S;
1731
- initSettings: I;
1732
- env: E;
1733
- }
1734
- /**
1735
- * Generic constraint for Types - ensures T has required properties for indexed access.
1736
- */
1737
- type TypesGeneric$1 = {
1738
- settings: any;
1739
- initSettings: any;
1740
- env: any;
1741
- };
1742
- /**
1743
- * Type extractors for consistent usage with Types bundle.
1744
- */
1745
- type Settings$1<T extends TypesGeneric$1 = Types$1> = T['settings'];
1746
- type InitSettings$1<T extends TypesGeneric$1 = Types$1> = T['initSettings'];
1747
- type Env$1<T extends TypesGeneric$1 = Types$1> = T['env'];
1748
- /**
1749
- * Inference helper: Extract Types from Instance.
1750
- */
1751
- type TypesOf$1<I> = I extends Instance$1<infer T> ? T : never;
1752
- /**
1753
- * Transformer configuration.
1754
- */
1755
- interface Config$1<T extends TypesGeneric$1 = Types$1> {
1756
- settings?: InitSettings$1<T>;
1757
- env?: Env$1<T>;
1758
- id?: string;
1759
- logger?: Config$4;
1760
- next?: Next;
1761
- init?: boolean;
1762
- }
1763
- /**
1764
- * Context provided to transformer functions.
1765
- * Extends base context with transformer-specific properties.
1766
- */
1767
- interface Context$2<T extends TypesGeneric$1 = Types$1> extends Base<Config$1<T>, Env$1<T>> {
1768
- id: string;
1769
- ingest?: unknown;
1770
- }
1771
- /**
1772
- * Branch result for dynamic chain routing.
1773
- * Returned by transformers (e.g., router) to redirect the chain.
1774
- * The chain runner resolves \`next\` via walkChain() \u2014 same semantics
1775
- * as source.next or transformer.config.next.
1776
- *
1777
- * IMPORTANT: Always use the \`branch()\` factory function to create BranchResult.
1778
- * The \`__branch\` discriminant is required for reliable type detection.
1779
- */
1780
- interface BranchResult {
1781
- readonly __branch: true;
1782
- event: DeepPartialEvent;
1783
- next: Next;
1784
- }
1785
- /**
1786
- * The main transformer function.
1787
- * Uses DeepPartialEvent for consistency across pre/post collector.
1788
- *
1789
- * @param event - The event to process
1790
- * @param context - Transformer context with collector, config, env, logger
1791
- * @returns event - continue with modified event
1792
- * @returns void - continue with current event unchanged (passthrough)
1793
- * @returns false - stop chain, cancel further processing
1794
- */
1795
- type Fn<T extends TypesGeneric$1 = Types$1> = (event: DeepPartialEvent, context: Context$2<T>) => PromiseOrValue<DeepPartialEvent | false | void | BranchResult>;
1796
- /**
1797
- * Optional initialization function.
1798
- * Called once before first push.
1799
- *
1800
- * @param context - Transformer context
1801
- * @returns void - initialization successful
1802
- * @returns false - initialization failed, skip this transformer
1803
- * @returns Config<T> - return updated config
1804
- */
1805
- type InitFn<T extends TypesGeneric$1 = Types$1> = (context: Context$2<T>) => PromiseOrValue<void | false | Config$1<T>>;
1806
- /**
1807
- * Transformer instance returned by Init function.
1808
- */
1809
- interface Instance$1<T extends TypesGeneric$1 = Types$1> {
1810
- type: string;
1811
- config: Config$1<T>;
1812
- push: Fn<T>;
1813
- init?: InitFn<T>;
1814
- destroy?: () => void | Promise<void>;
1815
- }
1816
- /**
1817
- * Transformer initialization function.
1818
- * Creates a transformer instance from context.
1819
- */
1820
- type Init$1<T extends TypesGeneric$1 = Types$1> = (context: Context$2<Types$1<Partial<Settings$1<T>>, Env$1<T>, InitSettings$1<T>>>) => Instance$1<T> | Promise<Instance$1<T>>;
1821
- /**
1822
- * Configuration for initializing a transformer.
1823
- * Used in collector registration.
1824
- */
1825
- type InitTransformer<T extends TypesGeneric$1 = Types$1> = {
1826
- code: Init$1<T>;
1827
- config?: Partial<Config$1<T>>;
1828
- env?: Partial<Env$1<T>>;
1829
- next?: Next;
1830
- };
1831
- /**
1832
- * Transformers configuration for collector.
1833
- * Maps transformer IDs to their initialization configurations.
1834
- */
1835
- interface InitTransformers {
1836
- [transformerId: string]: InitTransformer<any>;
1837
- }
1838
- /**
1839
- * Active transformer instances registry.
1840
- */
1841
- interface Transformers {
1842
- [transformerId: string]: Instance$1;
1843
- }
1844
-
1845
- type transformer_BranchResult = BranchResult;
1846
- type transformer_Fn<T extends TypesGeneric$1 = Types$1> = Fn<T>;
1847
- type transformer_InitFn<T extends TypesGeneric$1 = Types$1> = InitFn<T>;
1848
- type transformer_InitTransformer<T extends TypesGeneric$1 = Types$1> = InitTransformer<T>;
1849
- type transformer_InitTransformers = InitTransformers;
1850
- type transformer_Next = Next;
1851
- type transformer_Transformers = Transformers;
1852
- declare namespace transformer {
1853
- export type { BaseEnv$1 as BaseEnv, transformer_BranchResult as BranchResult, Config$1 as Config, Context$2 as Context, Env$1 as Env, transformer_Fn as Fn, Init$1 as Init, transformer_InitFn as InitFn, InitSettings$1 as InitSettings, transformer_InitTransformer as InitTransformer, transformer_InitTransformers as InitTransformers, Instance$1 as Instance, transformer_Next as Next, Settings$1 as Settings, transformer_Transformers as Transformers, Types$1 as Types, TypesGeneric$1 as TypesGeneric, TypesOf$1 as TypesOf };
1854
- }
1855
-
1856
- interface Context$1 {
1857
- city?: string;
1858
- country?: string;
1859
- encoding?: string;
1860
- hash?: string;
1861
- ip?: string;
1862
- language?: string;
1863
- origin?: string;
1864
- region?: string;
1865
- userAgent?: string;
1866
- [key: string]: string | undefined;
1867
- }
1868
-
1869
- declare namespace request {
1870
- export type { Context$1 as Context };
1871
- }
1872
-
1873
- type Contracts = Array<Contract>;
1874
- type Contract = {
1875
- [entity: string]: {
1876
- [action: string]: Properties$1;
1877
- };
1878
- };
1879
- type Properties$1 = {
1880
- [key: string]: Property$1 | undefined;
1881
- };
1882
- type Property$1 = {
1883
- allowedKeys?: string[];
1884
- allowedValues?: unknown[];
1885
- maxLength?: number;
1886
- max?: number;
1887
- min?: number;
1888
- required?: boolean;
1889
- schema?: Properties$1;
1890
- strict?: boolean;
1891
- type?: string;
1892
- validate?: (value: unknown, key: string, event: AnyObject) => Property;
1893
- };
1894
-
1895
- type schema_Contract = Contract;
1896
- type schema_Contracts = Contracts;
1897
- declare namespace schema {
1898
- export type { schema_Contract as Contract, schema_Contracts as Contracts, Properties$1 as Properties, Property$1 as Property };
1899
- }
1900
-
1901
- /**
1902
- * Base Env interface for dependency injection into sources.
1903
- *
1904
- * Sources receive all their dependencies through this environment object,
1905
- * making them platform-agnostic and easily testable.
1906
- */
1907
- interface BaseEnv {
1908
- [key: string]: unknown;
1909
- push: PushFn$1;
1910
- command: CommandFn;
1911
- sources?: Sources;
1912
- elb: Fn$2;
1913
- logger: Instance$2;
1914
- }
1915
- /**
1916
- * Type bundle for source generics.
1917
- * Groups Settings, Mapping, Push, Env, and InitSettings into a single type parameter.
1918
- *
1919
- * @template S - Settings configuration type
1920
- * @template M - Mapping configuration type
1921
- * @template P - Push function signature (flexible to support HTTP handlers, etc.)
1922
- * @template E - Environment dependencies type
1923
- * @template I - InitSettings configuration type (user input)
1924
- */
1925
- interface Types<S = unknown, M = unknown, P = Fn$2, E = BaseEnv, I = S> {
1926
- settings: S;
1927
- initSettings: I;
1928
- mapping: M;
1929
- push: P;
1930
- env: E;
1931
- }
1932
- /**
1933
- * Generic constraint for Types - ensures T has required properties for indexed access
1934
- */
1935
- type TypesGeneric = {
1936
- settings: any;
1937
- initSettings: any;
1938
- mapping: any;
1939
- push: any;
1940
- env: any;
1941
- };
1942
- /**
1943
- * Type extractors for consistent usage with Types bundle
1944
- */
1945
- type Settings<T extends TypesGeneric = Types> = T['settings'];
1946
- type InitSettings<T extends TypesGeneric = Types> = T['initSettings'];
1947
- type Mapping<T extends TypesGeneric = Types> = T['mapping'];
1948
- type Push<T extends TypesGeneric = Types> = T['push'];
1949
- type Env<T extends TypesGeneric = Types> = T['env'];
1950
- /**
1951
- * Inference helper: Extract Types from Instance
1952
- */
1953
- type TypesOf<I> = I extends Instance<infer T> ? T : never;
1954
- interface Config<T extends TypesGeneric = Types> extends Config$3<Mapping<T>> {
1955
- /** Implementation-specific configuration passed to the init function. */
1956
- settings?: InitSettings<T>;
1957
- /** Runtime dependencies injected by the collector (push, command, logger, etc.). */
1958
- env?: Env<T>;
1959
- /** Source identifier; defaults to the InitSources object key. */
1960
- id?: string;
1961
- /** Logger configuration (level, handler) to override the collector's defaults. */
1962
- logger?: Config$4;
1963
- /** Mark as primary source; its push function becomes the exported \`elb\` from startFlow. */
1964
- primary?: boolean;
1965
- /** Defer source initialization until these collector events fire (e.g., \`['consent']\`). */
1966
- require?: string[];
1967
- /**
1968
- * Ingest metadata extraction mapping.
1969
- * Extracts values from raw request objects (Express req, Lambda event, etc.)
1970
- * using walkerOS mapping syntax. Extracted data flows to transformers/destinations.
1971
- *
1972
- * @example
1973
- * ingest: {
1974
- * ip: 'req.ip',
1975
- * ua: 'req.headers.user-agent',
1976
- * origin: 'req.headers.origin'
1977
- * }
1978
- */
1979
- ingest?: Data;
1980
- }
1981
- type PartialConfig<T extends TypesGeneric = Types> = Config<Types<Partial<Settings<T>> | Settings<T>, Partial<Mapping<T>> | Mapping<T>, Push<T>, Env<T>>>;
1982
- interface Instance<T extends TypesGeneric = Types> {
1983
- type: string;
1984
- config: Config<T>;
1985
- push: Push<T>;
1986
- destroy?(): void | Promise<void>;
1987
- on?(event: Types$2, context?: unknown): void | boolean | Promise<void | boolean>;
1988
- }
1989
- /**
1990
- * Context provided to source init function.
1991
- * Extends base context with source-specific properties.
1992
- */
1993
- interface Context<T extends TypesGeneric = Types> extends Base<Partial<Config<T>>, Env<T>> {
1994
- id: string;
1995
- /**
1996
- * Sets ingest metadata for the current request.
1997
- * Extracts values from the raw request using config.ingest mapping.
1998
- * The extracted data is passed through to transformers and destinations.
1999
- *
2000
- * @param value - Raw request object (Express req, Lambda event, etc.)
2001
- */
2002
- setIngest: (value: unknown) => Promise<void>;
2003
- }
2004
- type Init<T extends TypesGeneric = Types> = (context: Context<T>) => Instance<T> | Promise<Instance<T>>;
2005
- type InitSource<T extends TypesGeneric = Types> = {
2006
- code: Init<T>;
2007
- config?: Partial<Config<T>>;
2008
- env?: Partial<Env<T>>;
2009
- primary?: boolean;
2010
- next?: Next;
2011
- };
2012
- /**
2013
- * Sources configuration for collector.
2014
- * Maps source IDs to their initialization configurations.
2015
- */
2016
- interface InitSources {
2017
- [sourceId: string]: InitSource<any>;
2018
- }
2019
-
2020
- type source_BaseEnv = BaseEnv;
2021
- type source_Config<T extends TypesGeneric = Types> = Config<T>;
2022
- type source_Context<T extends TypesGeneric = Types> = Context<T>;
2023
- type source_Env<T extends TypesGeneric = Types> = Env<T>;
2024
- type source_Init<T extends TypesGeneric = Types> = Init<T>;
2025
- type source_InitSettings<T extends TypesGeneric = Types> = InitSettings<T>;
2026
- type source_InitSource<T extends TypesGeneric = Types> = InitSource<T>;
2027
- type source_InitSources = InitSources;
2028
- type source_Instance<T extends TypesGeneric = Types> = Instance<T>;
2029
- type source_Mapping<T extends TypesGeneric = Types> = Mapping<T>;
2030
- type source_PartialConfig<T extends TypesGeneric = Types> = PartialConfig<T>;
2031
- type source_Push<T extends TypesGeneric = Types> = Push<T>;
2032
- type source_Settings<T extends TypesGeneric = Types> = Settings<T>;
2033
- type source_Types<S = unknown, M = unknown, P = Fn$2, E = BaseEnv, I = S> = Types<S, M, P, E, I>;
2034
- type source_TypesGeneric = TypesGeneric;
2035
- type source_TypesOf<I> = TypesOf<I>;
2036
- declare namespace source {
2037
- export type { source_BaseEnv as BaseEnv, source_Config as Config, source_Context as Context, source_Env as Env, source_Init as Init, source_InitSettings as InitSettings, source_InitSource as InitSource, source_InitSources as InitSources, source_Instance as Instance, source_Mapping as Mapping, source_PartialConfig as PartialConfig, source_Push as Push, source_Settings as Settings, source_Types as Types, source_TypesGeneric as TypesGeneric, source_TypesOf as TypesOf };
2038
- }
2039
-
2040
- type AnyObject<T = unknown> = Record<string, T>;
2041
- type Elb = Fn$2;
2042
- type AnyFunction = (...args: unknown[]) => unknown;
2043
- type SingleOrArray<T> = T | Array<T>;
2044
- type Events = Array<Event>;
2045
- type PartialEvent = Partial<Event>;
2046
- type DeepPartialEvent = DeepPartial<Event>;
2047
- interface Event {
2048
- name: string;
2049
- data: Properties;
2050
- context: OrderedProperties;
2051
- globals: Properties;
2052
- custom: Properties;
2053
- user: User;
2054
- nested: Entities;
2055
- consent: Consent;
2056
- id: string;
2057
- trigger: string;
2058
- entity: string;
2059
- action: string;
2060
- timestamp: number;
2061
- timing: number;
2062
- group: string;
2063
- count: number;
2064
- version: Version;
2065
- source: Source;
2066
- }
2067
- interface Consent {
2068
- [name: string]: boolean;
2069
- }
2070
- interface User extends Properties {
2071
- id?: string;
2072
- device?: string;
2073
- session?: string;
2074
- hash?: string;
2075
- address?: string;
2076
- email?: string;
2077
- phone?: string;
2078
- userAgent?: string;
2079
- browser?: string;
2080
- browserVersion?: string;
2081
- deviceType?: string;
2082
- language?: string;
2083
- country?: string;
2084
- region?: string;
2085
- city?: string;
2086
- zip?: string;
2087
- timezone?: string;
2088
- os?: string;
2089
- osVersion?: string;
2090
- screenSize?: string;
2091
- ip?: string;
2092
- internal?: boolean;
2093
- }
2094
- interface Version extends Properties {
2095
- source: string;
2096
- tagging: number;
2097
- }
2098
- interface Source extends Properties {
2099
- type: SourceType;
2100
- id: string;
2101
- previous_id: string;
2102
- }
2103
- type SourceType = 'web' | 'server' | 'app' | 'other' | string;
2104
- type PropertyType = boolean | string | number | {
2105
- [key: string]: Property;
2106
- };
2107
- type Property = PropertyType | Array<PropertyType>;
2108
- interface Properties {
2109
- [key: string]: Property | undefined;
2110
- }
2111
- interface OrderedProperties {
2112
- [key: string]: [Property, number] | undefined;
2113
- }
2114
- type Entities = Array<Entity>;
2115
- interface Entity {
2116
- entity: string;
2117
- data: Properties;
2118
- nested: Entities;
2119
- context: OrderedProperties;
2120
- }
2121
- type ConsentHandler = Record<string, AnyFunction>;
2122
- type ActionHandler = AnyFunction;
2123
- type DeepPartial<T> = {
2124
- [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
2125
- };
2126
- type PromiseOrValue<T> = T | Promise<T>;
2127
-
2128
- type walkeros_ActionHandler = ActionHandler;
2129
- type walkeros_AnyFunction = AnyFunction;
2130
- type walkeros_AnyObject<T = unknown> = AnyObject<T>;
2131
- type walkeros_Consent = Consent;
2132
- type walkeros_ConsentHandler = ConsentHandler;
2133
- type walkeros_DeepPartial<T> = DeepPartial<T>;
2134
- type walkeros_DeepPartialEvent = DeepPartialEvent;
2135
- type walkeros_Elb = Elb;
2136
- type walkeros_Entities = Entities;
2137
- type walkeros_Entity = Entity;
2138
- type walkeros_Event = Event;
2139
- type walkeros_Events = Events;
2140
- type walkeros_OrderedProperties = OrderedProperties;
2141
- type walkeros_PartialEvent = PartialEvent;
2142
- type walkeros_PromiseOrValue<T> = PromiseOrValue<T>;
2143
- type walkeros_Properties = Properties;
2144
- type walkeros_Property = Property;
2145
- type walkeros_PropertyType = PropertyType;
2146
- type walkeros_SingleOrArray<T> = SingleOrArray<T>;
2147
- type walkeros_Source = Source;
2148
- type walkeros_SourceType = SourceType;
2149
- type walkeros_User = User;
2150
- type walkeros_Version = Version;
2151
- declare namespace walkeros {
2152
- export type { walkeros_ActionHandler as ActionHandler, walkeros_AnyFunction as AnyFunction, walkeros_AnyObject as AnyObject, walkeros_Consent as Consent, walkeros_ConsentHandler as ConsentHandler, walkeros_DeepPartial as DeepPartial, walkeros_DeepPartialEvent as DeepPartialEvent, walkeros_Elb as Elb, walkeros_Entities as Entities, walkeros_Entity as Entity, walkeros_Event as Event, walkeros_Events as Events, walkeros_OrderedProperties as OrderedProperties, walkeros_PartialEvent as PartialEvent, walkeros_PromiseOrValue as PromiseOrValue, walkeros_Properties as Properties, walkeros_Property as Property, walkeros_PropertyType as PropertyType, walkeros_SingleOrArray as SingleOrArray, walkeros_Source as Source, walkeros_SourceType as SourceType, walkeros_User as User, walkeros_Version as Version };
2153
- }
2154
-
2155
- type StorageType = 'local' | 'session' | 'cookie';
2156
- declare const Const: {
2157
- readonly Utils: {
2158
- readonly Storage: {
2159
- readonly Local: "local";
2160
- readonly Session: "session";
2161
- readonly Cookie: "cookie";
2162
- };
2163
- };
2164
- };
2165
-
2166
- type SendDataValue = Property | Properties;
2167
- type SendHeaders = {
2168
- [key: string]: string;
2169
- };
2170
- interface SendResponse {
2171
- ok: boolean;
2172
- data?: unknown;
2173
- error?: string;
2174
- }
2175
-
2176
- /**
2177
- * Creates a BranchResult for dynamic chain routing.
2178
- * Use this in transformer push functions to redirect the chain.
2179
- */
2180
- declare function branch(event: DeepPartialEvent, next: Next): BranchResult;
2181
-
2182
- /**
2183
- * Anonymizes an IPv4 address by setting the last octet to 0.
2184
- *
2185
- * @param ip The IP address to anonymize.
2186
- * @returns The anonymized IP address or an empty string if the IP is invalid.
2187
- */
2188
- declare function anonymizeIP(ip: string): string;
2189
-
2190
- /**
2191
- * Flow Configuration Utilities
2192
- *
2193
- * Functions for resolving and processing Flow configurations.
2194
- *
2195
- * @packageDocumentation
2196
- */
2197
-
2198
- /**
2199
- * Convert package name to valid JavaScript variable name.
2200
- * Used for deterministic default import naming.
2201
- * @example
2202
- * packageNameToVariable('@walkeros/server-destination-api')
2203
- * // \u2192 '_walkerosServerDestinationApi'
2204
- */
2205
- declare function packageNameToVariable(packageName: string): string;
2206
- /**
2207
- * Get resolved flow configuration for a named flow.
2208
- *
2209
- * @param setup - The complete setup configuration
2210
- * @param flowName - Flow name (auto-selected if only one exists)
2211
- * @returns Resolved Config with $var, $env, and $def patterns resolved
2212
- * @throws Error if flow selection is required but not specified, or flow not found
2213
- *
2214
- * @example
2215
- * \`\`\`typescript
2216
- * import { getFlowConfig } from '@walkeros/core';
2217
- *
2218
- * const setup = JSON.parse(fs.readFileSync('walkeros.config.json', 'utf8'));
2219
- *
2220
- * // Auto-select if only one flow
2221
- * const config = getFlowConfig(setup);
2222
- *
2223
- * // Or specify flow
2224
- * const prodConfig = getFlowConfig(setup, 'production');
2225
- * \`\`\`
2226
- */
2227
- declare function getFlowConfig(setup: Setup, flowName?: string): Config$5;
2228
- /**
2229
- * Get platform from config (web or server).
2230
- *
2231
- * @param config - Flow configuration
2232
- * @returns "web" or "server"
2233
- * @throws Error if neither web nor server is present
2234
- *
2235
- * @example
2236
- * \`\`\`typescript
2237
- * import { getPlatform } from '@walkeros/core';
2238
- *
2239
- * const platform = getPlatform(config);
2240
- * // Returns "web" or "server"
2241
- * \`\`\`
2242
- */
2243
- declare function getPlatform(config: Config$5): 'web' | 'server';
2244
-
2245
- /**
2246
- * @interface Assign
2247
- * @description Options for the assign function.
2248
- * @property merge - Merge array properties instead of overriding them.
2249
- * @property shallow - Create a shallow copy instead of updating the target object.
2250
- * @property extend - Extend the target with new properties instead of only updating existing ones.
2251
- */
2252
- interface Assign {
2253
- merge?: boolean;
2254
- shallow?: boolean;
2255
- extend?: boolean;
2256
- }
2257
- /**
2258
- * Merges objects with advanced options.
2259
- *
2260
- * @template T, U
2261
- * @param target - The target object to merge into.
2262
- * @param obj - The source object to merge from.
2263
- * @param options - Options for merging.
2264
- * @returns The merged object.
2265
- */
2266
- declare function assign<T extends object, U extends object>(target: T, obj?: U, options?: Assign): T & U;
2267
-
2268
- /**
2269
- * Gets a value from an object by a dot-notation string.
2270
- * Supports wildcards for arrays.
2271
- *
2272
- * @example
2273
- * getByPath({ data: { id: 1 } }, "data.id") // Returns 1
2274
- *
2275
- * @param event - The object to get the value from.
2276
- * @param key - The dot-notation string.
2277
- * @param defaultValue - The default value to return if the key is not found.
2278
- * @returns The value from the object or the default value.
2279
- */
2280
- declare function getByPath(event: unknown, key?: string, defaultValue?: unknown): unknown;
2281
- /**
2282
- * Sets a value in an object by a dot-notation string.
2283
- *
2284
- * @param obj - The object to set the value in.
2285
- * @param key - The dot-notation string.
2286
- * @param value - The value to set.
2287
- * @returns A new object with the updated value.
2288
- */
2289
- declare function setByPath<T = unknown>(obj: T, key: string, value: unknown): T;
2290
-
2291
- /**
2292
- * Casts a value to a specific type.
2293
- *
2294
- * @param value The value to cast.
2295
- * @returns The casted value.
2296
- */
2297
- declare function castValue(value: unknown): PropertyType;
2298
-
2299
- /**
2300
- * Creates a deep clone of a value.
2301
- * Supports primitive values, objects, arrays, dates, and regular expressions.
2302
- * Handles circular references.
2303
- *
2304
- * @template T
2305
- * @param org - The value to clone.
2306
- * @param visited - A map of visited objects to handle circular references.
2307
- * @returns The cloned value.
2308
- */
2309
- declare function clone<T>(org: T, visited?: WeakMap<object, unknown>): T;
2310
-
2311
- /**
2312
- * Checks if the required consent is granted.
2313
- *
2314
- * @param required - The required consent states.
2315
- * @param state - The current consent states.
2316
- * @param individual - Individual consent states to prioritize.
2317
- * @returns The granted consent states or false if not granted.
2318
- */
2319
- declare function getGrantedConsent(required: Consent | undefined, state?: Consent, individual?: Consent): false | Consent;
2320
-
2321
- /**
2322
- * Creates a new destination instance by merging a base destination with additional configuration.
2323
- *
2324
- * This utility enables elegant destination configuration while avoiding config side-effects
2325
- * that could occur when reusing destination objects across multiple collector instances.
2326
- *
2327
- * @param baseDestination - The base destination to extend
2328
- * @param config - Additional configuration to merge with the base destination's config
2329
- * @returns A new destination instance with merged configuration
2330
- *
2331
- * @example
2332
- * \`\`\`typescript
2333
- * // Types are inferred automatically from destinationGtag
2334
- * elb('walker destination', createDestination(destinationGtag, {
2335
- * settings: { ga4: { measurementId: 'G-123' } }
2336
- * }));
2337
- * \`\`\`
2338
- */
2339
- declare function createDestination<I extends Instance$3>(baseDestination: I, config: Partial<Config$6<TypesOf$2<I>>>): I;
2340
-
2341
- /**
2342
- * Creates a complete event with default values.
2343
- * Used for testing and debugging.
2344
- *
2345
- * @param props - Properties to override the default values.
2346
- * @returns A complete event.
2347
- */
2348
- declare function createEvent(props?: DeepPartialEvent): Event;
2349
- /**
2350
- * Creates a complete event with default values based on the event name.
2351
- * Used for testing and debugging.
2352
- *
2353
- * @param name - The name of the event to create.
2354
- * @param props - Properties to override the default values.
2355
- * @returns A complete event.
2356
- */
2357
- declare function getEvent(name?: string, props?: DeepPartialEvent): Event;
2358
-
2359
- /**
2360
- * Generates a random string of a given length.
2361
- *
2362
- * @param length - The length of the random string.
2363
- * @returns The random string.
2364
- */
2365
- declare function getId(length?: number): string;
2366
-
2367
- interface MarketingParameters {
2368
- [key: string]: string;
2369
- }
2370
- /**
2371
- * Extracts marketing parameters from a URL.
2372
- *
2373
- * @param url - The URL to extract the parameters from.
2374
- * @param custom - Custom marketing parameters to extract.
2375
- * @returns The extracted marketing parameters.
2376
- */
2377
- declare function getMarketingParameters(url: URL, custom?: MarketingParameters): Properties;
2378
-
2379
- /**
2380
- * Creates a debounced function that delays invoking \`fn\` until after \`wait\`
2381
- * milliseconds have elapsed since the last time the debounced function was
2382
- * invoked. The debounced function comes with a \`cancel\` method to cancel
2383
- * delayed \`fn\` invocations and a \`flush\` method to immediately invoke them.
2384
- *
2385
- * @template P, R
2386
- * @param fn The function to debounce.
2387
- * @param wait The number of milliseconds to delay.
2388
- * @param immediate Trigger the function on the leading edge, instead of the trailing.
2389
- * @returns The new debounced function.
2390
- */
2391
- declare function debounce<P extends unknown[], R>(fn: (...args: P) => R, wait?: number, immediate?: boolean): (...args: P) => Promise<R>;
2392
- declare function throttle<P extends unknown[], R>(fn: (...args: P) => R | undefined, delay?: number): (...args: P) => R | undefined;
2393
-
2394
- /**
2395
- * Checks if a value is an arguments object.
2396
- *
2397
- * @param value The value to check.
2398
- * @returns True if the value is an arguments object, false otherwise.
2399
- */
2400
- declare function isArguments(value: unknown): value is IArguments;
2401
- /**
2402
- * Checks if a value is an array.
2403
- *
2404
- * @param value The value to check.
2405
- * @returns True if the value is an array, false otherwise.
2406
- */
2407
- declare function isArray<T>(value: unknown): value is T[];
2408
- /**
2409
- * Checks if a value is a boolean.
2410
- *
2411
- * @param value The value to check.
2412
- * @returns True if the value is a boolean, false otherwise.
2413
- */
2414
- declare function isBoolean(value: unknown): value is boolean;
2415
- /**
2416
- * Checks if an entity is a walker command.
2417
- *
2418
- * @param entity The entity to check.
2419
- * @returns True if the entity is a walker command, false otherwise.
2420
- */
2421
- declare function isCommand(entity: string): entity is "walker";
2422
- /**
2423
- * Checks if a value is defined.
2424
- *
2425
- * @param value The value to check.
2426
- * @returns True if the value is defined, false otherwise.
2427
- */
2428
- declare function isDefined<T>(val: T | undefined): val is T;
2429
- /**
2430
- * Checks if a value is an element or the document.
2431
- *
2432
- * @param elem The value to check.
2433
- * @returns True if the value is an element or the document, false otherwise.
2434
- */
2435
- declare function isElementOrDocument(elem: unknown): elem is Element;
2436
- /**
2437
- * Checks if a value is a function.
2438
- *
2439
- * @param value The value to check.
2440
- * @returns True if the value is a function, false otherwise.
2441
- */
2442
- declare function isFunction(value: unknown): value is Function;
2443
- /**
2444
- * Checks if a value is a number.
2445
- *
2446
- * @param value The value to check.
2447
- * @returns True if the value is a number, false otherwise.
2448
- */
2449
- declare function isNumber(value: unknown): value is number;
2450
- /**
2451
- * Checks if a value is an object.
2452
- *
2453
- * @param value The value to check.
2454
- * @returns True if the value is an object, false otherwise.
2455
- */
2456
- declare function isObject(value: unknown): value is AnyObject;
2457
- /**
2458
- * Checks if two variables have the same type.
2459
- *
2460
- * @param variable The first variable.
2461
- * @param type The second variable.
2462
- * @returns True if the variables have the same type, false otherwise.
2463
- */
2464
- declare function isSameType<T>(variable: unknown, type: T): variable is typeof type;
2465
- /**
2466
- * Checks if a value is a string.
2467
- *
2468
- * @param value The value to check.
2469
- * @returns True if the value is a string, false otherwise.
2470
- */
2471
- declare function isString(value: unknown): value is string;
2472
-
2473
- /**
2474
- * Create a logger instance
2475
- *
2476
- * @param config - Logger configuration
2477
- * @returns Logger instance with all log methods and scoping support
2478
- *
2479
- * @example
2480
- * \`\`\`typescript
2481
- * // Basic usage
2482
- * const logger = createLogger({ level: 'DEBUG' });
2483
- * logger.info('Hello world');
2484
- *
2485
- * // With scoping
2486
- * const destLogger = logger.scope('gtag').scope('myInstance');
2487
- * destLogger.debug('Processing event'); // DEBUG [gtag:myInstance] Processing event
2488
- *
2489
- * // With custom handler
2490
- * const logger = createLogger({
2491
- * handler: (level, message, context, scope, originalHandler) => {
2492
- * // Custom logic (e.g., send to Sentry)
2493
- * originalHandler(level, message, context, scope);
2494
- * }
2495
- * });
2496
- * \`\`\`
2497
- *
2498
- * // TODO: Consider compile-time stripping of debug logs in production builds
2499
- * // e.g., if (__DEV__) { logger.debug(...) }
2500
- */
2501
- declare function createLogger(config?: Config$4): Instance$2;
2502
-
2503
- /**
2504
- * Gets the mapping for an event.
2505
- *
2506
- * @param event The event to get the mapping for (can be partial or full).
2507
- * @param mapping The mapping rules.
2508
- * @returns The mapping result.
2509
- */
2510
- declare function getMappingEvent(event: DeepPartialEvent | PartialEvent | Event, mapping?: Rules): Promise<Result>;
2511
- /**
2512
- * Gets a value from a mapping.
2513
- *
2514
- * @param value The value to get the mapping from.
2515
- * @param data The mapping data.
2516
- * @param options The mapping options.
2517
- * @returns The mapped value.
2518
- */
2519
- declare function getMappingValue(value: DeepPartialEvent | unknown | undefined, data?: Data, options?: Options$1): Promise<Property | undefined>;
2520
- /**
2521
- * Processes an event through mapping configuration.
2522
- *
2523
- * This is the unified mapping logic used by both sources and destinations.
2524
- * It applies transformations in this order:
2525
- * 1. Config-level policy - modifies the event itself (global rules)
2526
- * 2. Mapping rules - finds matching rule based on entity-action
2527
- * 3. Event-level policy - modifies the event based on specific mapping rule
2528
- * 4. Data transformation - creates context data
2529
- * 5. Ignore check and name override
2530
- *
2531
- * Sources can pass partial events, destinations pass full events.
2532
- * getMappingValue works with both partial and full events.
2533
- *
2534
- * @param event - The event to process (can be partial or full, will be mutated by policies)
2535
- * @param config - Mapping configuration (mapping, data, policy, consent)
2536
- * @param collector - Collector instance for context
2537
- * @returns Object with transformed event, data, mapping rule, and ignore flag
2538
- */
2539
- declare function processEventMapping<T extends DeepPartialEvent | Event>(event: T, config: Config$3, collector: Instance$4): Promise<{
2540
- event: T;
2541
- data?: Property;
2542
- mapping?: Rule;
2543
- mappingKey?: string;
2544
- ignore: boolean;
2545
- }>;
2546
-
2547
- /**
2548
- * Environment mocking utilities for walkerOS destinations
2549
- *
2550
- * Provides standardized tools for intercepting function calls in environment objects,
2551
- * enabling consistent testing patterns across all destinations.
2552
- */
2553
- type InterceptorFn = (path: string[], args: unknown[], original?: Function) => unknown;
2554
- /**
2555
- * Creates a proxied environment that intercepts function calls
2556
- *
2557
- * Uses Proxy to wrap environment objects and capture all function calls,
2558
- * allowing for call recording, mocking, or simulation.
2559
- *
2560
- * @param env - The environment object to wrap
2561
- * @param interceptor - Function called for each intercepted call
2562
- * @returns Proxied environment with interceptor applied
2563
- *
2564
- * @example
2565
- * \`\`\`typescript
2566
- * const calls: Array<{ path: string[]; args: unknown[] }> = [];
2567
- *
2568
- * const testEnv = mockEnv(env.push, (path, args) => {
2569
- * calls.push({ path, args });
2570
- * });
2571
- *
2572
- * // Use testEnv with destination
2573
- * await destination.push(event, { env: testEnv });
2574
- *
2575
- * // Analyze captured calls
2576
- * expect(calls).toContainEqual({
2577
- * path: ['window', 'gtag'],
2578
- * args: ['event', 'purchase', { value: 99.99 }]
2579
- * });
2580
- * \`\`\`
2581
- */
2582
- declare function mockEnv<T extends object>(env: T, interceptor: InterceptorFn): T;
2583
- /**
2584
- * Traverses environment object and replaces values using a replacer function
2585
- *
2586
- * Alternative to mockEnv for environments where Proxy is not suitable.
2587
- * Performs deep traversal and allows value transformation at each level.
2588
- *
2589
- * @param env - The environment object to traverse
2590
- * @param replacer - Function to transform values during traversal
2591
- * @returns New environment object with transformed values
2592
- *
2593
- * @example
2594
- * \`\`\`typescript
2595
- * const recordedCalls: APICall[] = [];
2596
- *
2597
- * const recordingEnv = traverseEnv(originalEnv, (value, path) => {
2598
- * if (typeof value === 'function') {
2599
- * return (...args: unknown[]) => {
2600
- * recordedCalls.push({
2601
- * path: path.join('.'),
2602
- * args: structuredClone(args)
2603
- * });
2604
- * return value(...args);
2605
- * };
2606
- * }
2607
- * return value;
2608
- * });
2609
- * \`\`\`
2610
- */
2611
- declare function traverseEnv<T extends object>(env: T, replacer: (value: unknown, path: string[]) => unknown): T;
2612
-
2613
- /**
2614
- * Mock logger instance for testing
2615
- * Includes all logger methods as jest.fn() plus tracking of scoped loggers
2616
- * Extends Instance to ensure type compatibility
2617
- */
2618
- interface MockLogger extends Instance$2 {
2619
- error: jest.Mock;
2620
- info: jest.Mock;
2621
- debug: jest.Mock;
2622
- throw: jest.Mock<never, [string | Error, unknown?]>;
2623
- scope: jest.Mock<MockLogger, [string]>;
2624
- /**
2625
- * Array of all scoped loggers created by this logger
2626
- * Useful for asserting on scoped logger calls in tests
2627
- */
2628
- scopedLoggers: MockLogger[];
2629
- }
2630
- /**
2631
- * Create a mock logger for testing
2632
- * All methods are jest.fn() that can be used for assertions
2633
- *
2634
- * @example
2635
- * \`\`\`typescript
2636
- * const mockLogger = createMockLogger();
2637
- *
2638
- * // Use in code under test
2639
- * someFunction(mockLogger);
2640
- *
2641
- * // Assert on calls
2642
- * expect(mockLogger.error).toHaveBeenCalledWith('error message');
2643
- *
2644
- * // Assert on scoped logger
2645
- * const scoped = mockLogger.scopedLoggers[0];
2646
- * expect(scoped.debug).toHaveBeenCalledWith('debug in scope');
2647
- * \`\`\`
2648
- */
2649
- declare function createMockLogger(): MockLogger;
2650
-
2651
- /**
2652
- * Checks if a value is a valid property type.
2653
- *
2654
- * @param value The value to check.
2655
- * @returns True if the value is a valid property type, false otherwise.
2656
- */
2657
- declare function isPropertyType(value: unknown): value is PropertyType;
2658
- /**
2659
- * Filters a value to only include valid property types.
2660
- *
2661
- * @param value The value to filter.
2662
- * @returns The filtered value or undefined.
2663
- */
2664
- declare function filterValues(value: unknown): Property | undefined;
2665
- /**
2666
- * Casts a value to a valid property type.
2667
- *
2668
- * @param value The value to cast.
2669
- * @returns The casted value or undefined.
2670
- */
2671
- declare function castToProperty(value: unknown): Property | undefined;
2672
-
2673
- /**
2674
- * Converts a request string to a data object.
2675
- *
2676
- * @param parameter The request string to convert.
2677
- * @returns The data object or undefined.
2678
- */
2679
- declare function requestToData(parameter: unknown): AnyObject | undefined;
2680
- /**
2681
- * Converts a data object to a request string.
2682
- *
2683
- * @param data The data object to convert.
2684
- * @returns The request string.
2685
- */
2686
- declare function requestToParameter(data: AnyObject | PropertyType): string;
2687
-
2688
- /**
2689
- * Transforms data to a string.
2690
- *
2691
- * @param data The data to transform.
2692
- * @returns The transformed data.
2693
- */
2694
- declare function transformData(data?: SendDataValue): string | undefined;
2695
- /**
2696
- * Gets the headers for a request.
2697
- *
2698
- * @param headers The headers to merge with the default headers.
2699
- * @returns The merged headers.
2700
- */
2701
- declare function getHeaders(headers?: SendHeaders): SendHeaders;
2702
-
2703
- /**
2704
- * Throws an error.
2705
- *
2706
- * @param error The error to throw.
2707
- */
2708
- declare function throwError(error: unknown): never;
2709
-
2710
- /**
2711
- * Trims quotes and whitespaces from a string.
2712
- *
2713
- * @param str The string to trim.
2714
- * @returns The trimmed string.
2715
- */
2716
- declare function trim(str: string): string;
2717
-
2718
- /**
2719
- * A utility function that wraps a function in a try-catch block.
2720
- *
2721
- * @template P, R, S
2722
- * @param fn The function to wrap.
2723
- * @param onError A function to call when an error is caught.
2724
- * @param onFinally A function to call in the finally block.
2725
- * @returns The wrapped function.
2726
- */
2727
- declare function tryCatch<P extends unknown[], R, S>(fn: (...args: P) => R | undefined, onError: (err: unknown) => S, onFinally?: () => void): (...args: P) => R | S;
2728
- declare function tryCatch<P extends unknown[], R>(fn: (...args: P) => R | undefined, onError?: undefined, onFinally?: () => void): (...args: P) => R | undefined;
2729
- /**
2730
- * A utility function that wraps an async function in a try-catch block.
2731
- *
2732
- * @template P, R, S
2733
- * @param fn The async function to wrap.
2734
- * @param onError A function to call when an error is caught.
2735
- * @param onFinally A function to call in the finally block.
2736
- * @returns The wrapped async function.
2737
- */
2738
- declare function tryCatchAsync<P extends unknown[], R, S>(fn: (...args: P) => R, onError: (err: unknown) => S, onFinally?: () => void | Promise<void>): (...args: P) => Promise<R | S>;
2739
- declare function tryCatchAsync<P extends unknown[], R>(fn: (...args: P) => R, onError?: undefined, onFinally?: () => void | Promise<void>): (...args: P) => Promise<R | undefined>;
2740
-
2741
- /**
2742
- * A utility function that wraps a function with hooks.
2743
- *
2744
- * @template P, R
2745
- * @param fn The function to wrap.
2746
- * @param name The name of the function.
2747
- * @param hooks The hooks to use.
2748
- * @returns The wrapped function.
2749
- */
2750
- declare function useHooks<P extends unknown[], R>(fn: (...args: P) => R, name: string, hooks: Functions): (...args: P) => R;
2751
-
2752
- /**
2753
- * Parses a user agent string to extract browser, OS, and device information.
2754
- *
2755
- * @param userAgent The user agent string to parse.
2756
- * @returns An object containing the parsed user agent information.
2757
- */
2758
- declare function parseUserAgent(userAgent?: string): User;
2759
- /**
2760
- * Gets the browser name from a user agent string.
2761
- *
2762
- * @param userAgent The user agent string.
2763
- * @returns The browser name or undefined.
2764
- */
2765
- declare function getBrowser(userAgent: string): string | undefined;
2766
- /**
2767
- * Gets the browser version from a user agent string.
2768
- *
2769
- * @param userAgent The user agent string.
2770
- * @returns The browser version or undefined.
2771
- */
2772
- declare function getBrowserVersion(userAgent: string): string | undefined;
2773
- /**
2774
- * Gets the OS name from a user agent string.
2775
- *
2776
- * @param userAgent The user agent string.
2777
- * @returns The OS name or undefined.
2778
- */
2779
- declare function getOS(userAgent: string): string | undefined;
2780
- /**
2781
- * Gets the OS version from a user agent string.
2782
- *
2783
- * @param userAgent The user agent string.
2784
- * @returns The OS version or undefined.
2785
- */
2786
- declare function getOSVersion(userAgent: string): string | undefined;
2787
- /**
2788
- * Gets the device type from a user agent string.
2789
- *
2790
- * @param userAgent The user agent string.
2791
- * @returns The device type or undefined.
2792
- */
2793
- declare function getDeviceType(userAgent: string): string | undefined;
2794
-
2795
- /**
2796
- * Validates an event against a set of contracts.
2797
- *
2798
- * @param obj The event to validate.
2799
- * @param customContracts The custom contracts to use.
2800
- * @returns The validated event.
2801
- */
2802
- declare function validateEvent(obj: unknown, customContracts?: Contracts): Event | never;
2803
- /**
2804
- * Validates a property against a schema.
2805
- *
2806
- * @param obj The object to validate.
2807
- * @param key The key of the property to validate.
2808
- * @param value The value of the property to validate.
2809
- * @param schema The schema to validate against.
2810
- * @returns The validated property.
2811
- */
2812
- declare function validateProperty(obj: AnyObject, key: string, value: unknown, schema: Property$1): Property | never;
2813
-
2814
- /**
2815
- * Inline Code Wrapping Utilities
2816
- *
2817
- * Converts inline code strings to executable functions.
2818
- * Used for mapping properties: condition, fn, validate.
2819
- *
2820
- * @packageDocumentation
2821
- */
2822
-
2823
- /**
2824
- * Wrap inline code string as Condition function.
2825
- *
2826
- * @param code - Inline code string
2827
- * @returns Condition function matching Mapping.Condition signature
2828
- *
2829
- * @remarks
2830
- * Available parameters in code:
2831
- * - \`value\` - The event or partial event being processed
2832
- * - \`mapping\` - Current mapping configuration
2833
- * - \`collector\` - Collector instance
2834
- *
2835
- * If code has no explicit return, it's auto-wrapped with \`return\`.
2836
- *
2837
- * @example
2838
- * \`\`\`typescript
2839
- * // One-liner (auto-wrapped)
2840
- * const fn = wrapCondition('value.data.total > 100');
2841
- * fn(event, mapping, collector); // returns boolean
2842
- *
2843
- * // Multi-statement (explicit return)
2844
- * const fn = wrapCondition('const threshold = 100; return value.data.total > threshold');
2845
- * \`\`\`
2846
- */
2847
- declare function wrapCondition(code: string): Condition;
2848
- /**
2849
- * Wrap inline code string as Fn function.
2850
- *
2851
- * @param code - Inline code string
2852
- * @returns Fn function matching Mapping.Fn signature
2853
- *
2854
- * @remarks
2855
- * Available parameters in code:
2856
- * - \`value\` - The event or partial event being processed
2857
- * - \`mapping\` - Current mapping configuration
2858
- * - \`options\` - Options object with consent and collector
2859
- *
2860
- * If code has no explicit return, it's auto-wrapped with \`return\`.
2861
- *
2862
- * @example
2863
- * \`\`\`typescript
2864
- * // One-liner (auto-wrapped)
2865
- * const fn = wrapFn('value.user.email.split("@")[1]');
2866
- * fn(event, mapping, options); // returns domain
2867
- *
2868
- * // Multi-statement (explicit return)
2869
- * const fn = wrapFn('const parts = value.user.email.split("@"); return parts[1].toUpperCase()');
2870
- * \`\`\`
2871
- */
2872
- declare function wrapFn(code: string): Fn$1;
2873
- /**
2874
- * Wrap inline code string as Validate function.
2875
- *
2876
- * @param code - Inline code string
2877
- * @returns Validate function matching Mapping.Validate signature
2878
- *
2879
- * @remarks
2880
- * Available parameters in code:
2881
- * - \`value\` - The current value being validated
2882
- *
2883
- * If code has no explicit return, it's auto-wrapped with \`return\`.
2884
- *
2885
- * @example
2886
- * \`\`\`typescript
2887
- * // One-liner (auto-wrapped)
2888
- * const fn = wrapValidate('value && value.length > 0');
2889
- * fn('hello'); // returns true
2890
- *
2891
- * // Multi-statement (explicit return)
2892
- * const fn = wrapValidate('if (!value) return false; return value.length > 0');
2893
- * \`\`\`
2894
- */
2895
- declare function wrapValidate(code: string): Validate;
2896
-
2897
- interface WalkerOSPackageInfo {
2898
- packageName: string;
2899
- version: string;
2900
- type?: string;
2901
- platform?: string;
2902
- schemas: Record<string, unknown>;
2903
- examples: Record<string, unknown>;
2904
- }
2905
- declare function fetchPackageSchema(packageName: string, options?: {
2906
- version?: string;
2907
- timeout?: number;
2908
- }): Promise<WalkerOSPackageInfo>;
2909
-
2910
- export { collector as Collector, Const, context as Context, data as Data, destination as Destination, elb as Elb, flow as Flow, hooks as Hooks, Level, logger as Logger, mapping as Mapping, type MarketingParameters, type MockLogger, on as On, request as Request, schema as Schema, type SendDataValue, type SendHeaders, type SendResponse, source as Source, type StorageType, transformer as Transformer, walkeros as WalkerOS, type WalkerOSPackageInfo, anonymizeIP, assign, branch, castToProperty, castValue, clone, createDestination, createEvent, createLogger, createMockLogger, debounce, fetchPackageSchema, filterValues, getBrowser, getBrowserVersion, getByPath, getDeviceType, getEvent, getFlowConfig, getGrantedConsent, getHeaders, getId, getMappingEvent, getMappingValue, getMarketingParameters, getOS, getOSVersion, getPlatform, isArguments, isArray, isBoolean, isCommand, isDefined, isElementOrDocument, isFunction, isNumber, isObject, isPropertyType, isSameType, isString, mockEnv, packageNameToVariable, parseUserAgent, processEventMapping, requestToData, requestToParameter, setByPath, throttle, throwError, transformData, traverseEnv, trim, tryCatch, tryCatchAsync, useHooks, validateEvent, validateProperty, wrapCondition, wrapFn, wrapValidate };
2911
- `;
2912
-
2913
- // src/utils/monaco-types.ts
2914
- var typeLibraries = /* @__PURE__ */ new Map();
2915
- function configureMonacoTypeScript(monaco) {
2916
- monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
2917
- target: monaco.languages.typescript.ScriptTarget.ES2020,
2918
- lib: ["es2020"],
2919
- allowNonTsExtensions: true,
2920
- moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,
2921
- module: monaco.languages.typescript.ModuleKind.CommonJS,
2922
- noEmit: true,
2923
- esModuleInterop: true,
2924
- jsx: monaco.languages.typescript.JsxEmit.React,
2925
- allowJs: true,
2926
- checkJs: false,
2927
- strict: false,
2928
- noImplicitAny: false,
2929
- strictNullChecks: false
2930
- });
2931
- monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
2932
- noSemanticValidation: false,
2933
- noSyntaxValidation: false,
2934
- diagnosticCodesToIgnore: [1108, 1005]
2935
- });
2936
- monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
2937
- target: monaco.languages.typescript.ScriptTarget.ES2020,
2938
- lib: ["es2020"],
2939
- allowNonTsExtensions: true,
2940
- moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,
2941
- module: monaco.languages.typescript.ModuleKind.CommonJS,
2942
- noEmit: true,
2943
- esModuleInterop: true,
2944
- jsx: monaco.languages.typescript.JsxEmit.React,
2945
- strict: false
2946
- });
2947
- }
2948
- function addTypeLibrary(monaco, uri, content) {
2949
- if (typeLibraries.has(uri)) {
2950
- return false;
2951
- }
2952
- const jsDisposable = monaco.languages.typescript.javascriptDefaults.addExtraLib(content, uri);
2953
- const tsDisposable = monaco.languages.typescript.typescriptDefaults.addExtraLib(content, uri);
2954
- typeLibraries.set(uri, {
2955
- uri,
2956
- content,
2957
- disposable: {
2958
- dispose: () => {
2959
- jsDisposable.dispose();
2960
- tsDisposable.dispose();
2961
- }
2962
- }
2963
- });
2964
- return true;
2965
- }
2966
- function removeTypeLibrary(uri) {
2967
- const lib = typeLibraries.get(uri);
2968
- if (!lib) {
2969
- return false;
2970
- }
2971
- lib.disposable?.dispose();
2972
- typeLibraries.delete(uri);
2973
- return true;
2974
- }
2975
- function updateTypeLibrary(monaco, uri, content) {
2976
- removeTypeLibrary(uri);
2977
- addTypeLibrary(monaco, uri, content);
2978
- }
2979
- async function loadTypeLibraryFromURL(monaco, url, uri) {
2980
- try {
2981
- const response = await fetch(url);
2982
- if (!response.ok) {
2983
- return false;
2984
- }
2985
- const content = await response.text();
2986
- const typeUri = uri || `file:///${url}`;
2987
- return addTypeLibrary(monaco, typeUri, content);
2988
- } catch {
2989
- return false;
2990
- }
2991
- }
2992
- function stripExternalImports(content) {
2993
- let cleaned = content.replace(
2994
- /^import\s+(?:type\s+)?(?:\*\s+as\s+\w+|\{[^}]*\}|[\w$]+)(?:\s*,\s*(?:\{[^}]*\}|\*\s+as\s+\w+))?\s+from\s+['"][^'"]+['"];?\s*$/gm,
2995
- ""
2996
- );
2997
- cleaned = cleaned.replace(
2998
- /^import\s+(?:type\s+)?(?:\{[^}]*\}|\*\s+as\s+\w+|[\w$]+)\s+from\s+['"][^'"]+['"];?\s*$/gms,
2999
- ""
3000
- );
3001
- cleaned = cleaned.replace(/import\s*\(\s*['"][^'"]+['"]\s*\)/g, "any");
3002
- cleaned = cleaned.replace(/\n{3,}/g, "\n\n");
3003
- return cleaned;
3004
- }
3005
- async function loadPackageTypes(monaco, options) {
3006
- const { package: packageName, version = "latest" } = options;
3007
- const uri = `file:///node_modules/${packageName}/index.d.ts`;
3008
- if (typeLibraries.has(uri)) {
3009
- return true;
3010
- }
3011
- const url = `https://cdn.jsdelivr.net/npm/${packageName}@${version}/dist/index.d.ts`;
3012
- try {
3013
- const response = await fetch(url);
3014
- if (!response.ok) {
3015
- return false;
3016
- }
3017
- let content = await response.text();
3018
- content = stripExternalImports(content);
3019
- const moduleContent = `declare module '${packageName}' {
3020
- ${content}
3021
- }`;
3022
- const success = addTypeLibrary(monaco, uri, moduleContent);
3023
- return success;
3024
- } catch {
3025
- return false;
3026
- }
3027
- }
3028
- function loadWalkerOSCoreTypes(monaco) {
3029
- const uri = "file:///node_modules/@walkeros/core/index.d.ts";
3030
- if (typeLibraries.has(uri)) {
3031
- return true;
3032
- }
3033
- const cleanedTypes = stripExternalImports(virtual_walkeros_core_types_default);
3034
- const moduleContent = `declare module '@walkeros/core' {
3035
- ${cleanedTypes}
3036
- }`;
3037
- return addTypeLibrary(monaco, uri, moduleContent);
3038
- }
3039
- function addFunctionContextTypes(monaco, context) {
3040
- const uri = `file:///context/${context.type}.d.ts`;
3041
- const contextTypes = getContextTypes(context.type);
3042
- updateTypeLibrary(monaco, uri, contextTypes);
3043
- }
3044
- function addDestinationType(monaco, destinationId, typeDefinition) {
3045
- const uri = `file:///destinations/${destinationId}.d.ts`;
3046
- updateTypeLibrary(monaco, uri, typeDefinition);
3047
- }
3048
- function removeDestinationType(destinationId) {
3049
- const uri = `file:///destinations/${destinationId}.d.ts`;
3050
- removeTypeLibrary(uri);
3051
- }
3052
- function registerWalkerOSTypes(monaco) {
3053
- configureMonacoTypeScript(monaco);
3054
- loadWalkerOSCoreTypes(monaco);
3055
- }
3056
- function initializeMonacoTypes(monaco) {
3057
- configureMonacoTypeScript(monaco);
3058
- loadWalkerOSCoreTypes(monaco);
3059
- addFunctionContextTypes(monaco, { type: "condition" });
3060
- }
3061
- function getLoadedTypeLibraries() {
3062
- return Array.from(typeLibraries.keys());
3063
- }
3064
- function clearAllTypeLibraries() {
3065
- for (const [uri, lib] of typeLibraries.entries()) {
3066
- lib.disposable?.dispose();
3067
- }
3068
- typeLibraries.clear();
3069
- }
3070
-
3071
- export {
3072
- configureMonacoTypeScript,
3073
- addTypeLibrary,
3074
- removeTypeLibrary,
3075
- updateTypeLibrary,
3076
- loadTypeLibraryFromURL,
3077
- loadPackageTypes,
3078
- loadWalkerOSCoreTypes,
3079
- addFunctionContextTypes,
3080
- addDestinationType,
3081
- removeDestinationType,
3082
- registerWalkerOSTypes,
3083
- initializeMonacoTypes,
3084
- getLoadedTypeLibraries,
3085
- clearAllTypeLibraries
3086
- };
3087
- //# sourceMappingURL=chunk-YKT4D7MG.mjs.map