@walkeros/collector 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/index.d.mts +12 -7
  2. package/dist/index.d.ts +12 -7
  3. package/dist/index.js +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +1 -1
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +3 -3
  8. package/dist/__tests__/auto-run.test.d.ts +0 -2
  9. package/dist/__tests__/auto-run.test.d.ts.map +0 -1
  10. package/dist/__tests__/auto-run.test.js +0 -102
  11. package/dist/__tests__/auto-run.test.js.map +0 -1
  12. package/dist/__tests__/consent.test.d.ts +0 -2
  13. package/dist/__tests__/consent.test.d.ts.map +0 -1
  14. package/dist/__tests__/consent.test.js +0 -21
  15. package/dist/__tests__/consent.test.js.map +0 -1
  16. package/dist/__tests__/create-flow.test.d.ts +0 -2
  17. package/dist/__tests__/create-flow.test.d.ts.map +0 -1
  18. package/dist/__tests__/create-flow.test.js +0 -69
  19. package/dist/__tests__/create-flow.test.js.map +0 -1
  20. package/dist/__tests__/destination-code.test.d.ts +0 -2
  21. package/dist/__tests__/destination-code.test.d.ts.map +0 -1
  22. package/dist/__tests__/destination-code.test.js +0 -396
  23. package/dist/__tests__/destination-code.test.js.map +0 -1
  24. package/dist/__tests__/destination.test.d.ts +0 -2
  25. package/dist/__tests__/destination.test.d.ts.map +0 -1
  26. package/dist/__tests__/destination.test.js +0 -471
  27. package/dist/__tests__/destination.test.js.map +0 -1
  28. package/dist/__tests__/handle.test.d.ts +0 -2
  29. package/dist/__tests__/handle.test.d.ts.map +0 -1
  30. package/dist/__tests__/handle.test.js +0 -78
  31. package/dist/__tests__/handle.test.js.map +0 -1
  32. package/dist/__tests__/mapping.test.d.ts +0 -2
  33. package/dist/__tests__/mapping.test.d.ts.map +0 -1
  34. package/dist/__tests__/mapping.test.js +0 -310
  35. package/dist/__tests__/mapping.test.js.map +0 -1
  36. package/dist/__tests__/source.test.d.ts +0 -2
  37. package/dist/__tests__/source.test.d.ts.map +0 -1
  38. package/dist/__tests__/source.test.js +0 -306
  39. package/dist/__tests__/source.test.js.map +0 -1
  40. package/dist/__tests__/start-flow.test.d.ts +0 -2
  41. package/dist/__tests__/start-flow.test.d.ts.map +0 -1
  42. package/dist/__tests__/start-flow.test.js +0 -167
  43. package/dist/__tests__/start-flow.test.js.map +0 -1
  44. package/dist/__tests__/walker-entity.test.d.ts +0 -2
  45. package/dist/__tests__/walker-entity.test.d.ts.map +0 -1
  46. package/dist/__tests__/walker-entity.test.js +0 -52
  47. package/dist/__tests__/walker-entity.test.js.map +0 -1
  48. package/dist/collector.d.ts +0 -3
  49. package/dist/collector.d.ts.map +0 -1
  50. package/dist/collector.js +0 -60
  51. package/dist/collector.js.map +0 -1
  52. package/dist/command.d.ts +0 -12
  53. package/dist/command.d.ts.map +0 -1
  54. package/dist/command.js +0 -20
  55. package/dist/command.js.map +0 -1
  56. package/dist/consent.d.ts +0 -10
  57. package/dist/consent.d.ts.map +0 -1
  58. package/dist/consent.js +0 -30
  59. package/dist/consent.js.map +0 -1
  60. package/dist/constants.d.ts +0 -13
  61. package/dist/constants.d.ts.map +0 -1
  62. package/dist/constants.js +0 -35
  63. package/dist/constants.js.map +0 -1
  64. package/dist/destination-code.d.ts +0 -4
  65. package/dist/destination-code.d.ts.map +0 -1
  66. package/dist/destination-code.js +0 -72
  67. package/dist/destination-code.js.map +0 -1
  68. package/dist/destination.d.ts +0 -61
  69. package/dist/destination.d.ts.map +0 -1
  70. package/dist/destination.js +0 -325
  71. package/dist/destination.js.map +0 -1
  72. package/dist/dev.d.ts.map +0 -1
  73. package/dist/elb.d.ts +0 -11
  74. package/dist/elb.d.ts.map +0 -1
  75. package/dist/elb.js +0 -60
  76. package/dist/elb.js.map +0 -1
  77. package/dist/flow.d.ts +0 -4
  78. package/dist/flow.d.ts.map +0 -1
  79. package/dist/flow.js +0 -44
  80. package/dist/flow.js.map +0 -1
  81. package/dist/handle.d.ts +0 -29
  82. package/dist/handle.d.ts.map +0 -1
  83. package/dist/handle.js +0 -161
  84. package/dist/handle.js.map +0 -1
  85. package/dist/index.d.ts.map +0 -1
  86. package/dist/on.d.ts +0 -19
  87. package/dist/on.d.ts.map +0 -1
  88. package/dist/on.js +0 -127
  89. package/dist/on.js.map +0 -1
  90. package/dist/push.d.ts +0 -11
  91. package/dist/push.d.ts.map +0 -1
  92. package/dist/push.js +0 -43
  93. package/dist/push.js.map +0 -1
  94. package/dist/source.d.ts +0 -10
  95. package/dist/source.d.ts.map +0 -1
  96. package/dist/source.js +0 -47
  97. package/dist/source.js.map +0 -1
  98. package/dist/types/code.d.ts +0 -23
  99. package/dist/types/code.d.ts.map +0 -1
  100. package/dist/types/code.js +0 -2
  101. package/dist/types/code.js.map +0 -1
  102. package/dist/types/collector.d.ts +0 -19
  103. package/dist/types/collector.d.ts.map +0 -1
  104. package/dist/types/collector.js +0 -2
  105. package/dist/types/collector.js.map +0 -1
  106. package/dist/types/index.d.ts +0 -3
  107. package/dist/types/index.d.ts.map +0 -1
  108. package/dist/types/index.js +0 -4
  109. package/dist/types/index.js.map +0 -1
@@ -1,325 +0,0 @@
1
- import { assign, clone, debounce, getId, getGrantedConsent, isDefined, isObject, processEventMapping, tryCatchAsync, useHooks, } from '@walkeros/core';
2
- import { destinationCode } from './destination-code';
3
- function resolveCode(code) {
4
- return code === true ? destinationCode : code;
5
- }
6
- /**
7
- * Adds a new destination to the collector.
8
- *
9
- * @param collector - The walkerOS collector instance.
10
- * @param data - The destination's init data.
11
- * @param options - The destination's config.
12
- * @returns The result of the push operation.
13
- */
14
- export async function addDestination(collector, data, options) {
15
- const { code, config: dataConfig = {}, env = {} } = data;
16
- const config = options || dataConfig || { init: false };
17
- const resolved = resolveCode(code);
18
- const destination = {
19
- ...resolved,
20
- config,
21
- env: mergeEnvironments(resolved.env, env),
22
- };
23
- let id = destination.config.id; // Use given id
24
- if (!id) {
25
- // Generate a new id if none was given
26
- do {
27
- id = getId(4);
28
- } while (collector.destinations[id]);
29
- }
30
- // Add the destination
31
- collector.destinations[id] = destination;
32
- // Process previous events if not disabled
33
- if (destination.config.queue !== false)
34
- destination.queue = [...collector.queue];
35
- return pushToDestinations(collector, undefined, { [id]: destination });
36
- }
37
- /**
38
- * Pushes an event to all or a subset of destinations.
39
- *
40
- * @param collector - The walkerOS collector instance.
41
- * @param event - The event to push.
42
- * @param destinations - The destinations to push to.
43
- * @returns The result of the push operation.
44
- */
45
- export async function pushToDestinations(collector, event, destinations) {
46
- const { allowed, consent, globals, user } = collector;
47
- // Check if collector is allowed to push
48
- if (!allowed)
49
- return createPushResult({ ok: false });
50
- // Add event to the collector queue
51
- if (event)
52
- collector.queue.push(event);
53
- // Use given destinations or use internal destinations
54
- if (!destinations)
55
- destinations = collector.destinations;
56
- const results = await Promise.all(
57
- // Process all destinations in parallel
58
- Object.entries(destinations || {}).map(async ([id, destination]) => {
59
- // Create a queue of events to be processed
60
- let currentQueue = (destination.queue || []).map((event) => ({
61
- ...event,
62
- consent,
63
- }));
64
- // Reset original queue while processing to enable async processing
65
- destination.queue = [];
66
- // Add event to queue stack
67
- if (event) {
68
- // Clone the event to avoid mutating the original event
69
- const currentEvent = clone(event);
70
- // Note: Policy is now applied in processEventMapping() within destinationPush()
71
- // Add event to queue stack
72
- currentQueue.push(currentEvent);
73
- }
74
- // Nothing to do here if the queue is empty
75
- if (!currentQueue.length)
76
- return { id, destination, skipped: true };
77
- const allowedEvents = [];
78
- const skippedEvents = currentQueue.filter((queuedEvent) => {
79
- const grantedConsent = getGrantedConsent(destination.config.consent, // Required
80
- consent, // Current collector state
81
- queuedEvent.consent);
82
- if (grantedConsent) {
83
- queuedEvent.consent = grantedConsent; // Save granted consent states only
84
- allowedEvents.push(queuedEvent); // Add to allowed queue
85
- return false; // Remove from destination queue
86
- }
87
- return true; // Keep denied events in the queue
88
- });
89
- // Add skipped events back to the queue
90
- destination.queue.concat(skippedEvents);
91
- // Execution shall not pass if no events are allowed
92
- if (!allowedEvents.length) {
93
- return { id, destination, queue: currentQueue }; // Don't push if not allowed
94
- }
95
- // Initialize the destination if needed
96
- const isInitialized = await tryCatchAsync(destinationInit)(collector, destination);
97
- if (!isInitialized)
98
- return { id, destination, queue: currentQueue };
99
- // Process the destinations event queue
100
- let error = false;
101
- if (!destination.dlq)
102
- destination.dlq = [];
103
- // Process allowed events and store failed ones in the dead letter queue (DLQ)
104
- await Promise.all(allowedEvents.map(async (event) => {
105
- // Merge event with collector state, prioritizing event properties
106
- event.globals = assign(globals, event.globals);
107
- event.user = assign(user, event.user);
108
- await tryCatchAsync(destinationPush, (err) => {
109
- // Log the error with destination scope
110
- const destType = destination.type || 'unknown';
111
- collector.logger.scope(destType).error('Push failed', {
112
- error: err,
113
- event: event.name,
114
- });
115
- error = true; // oh no
116
- // Add failed event to destinations DLQ
117
- destination.dlq.push([event, err]);
118
- return false;
119
- })(collector, destination, event);
120
- return event;
121
- }));
122
- return { id, destination, error };
123
- }));
124
- const successful = [];
125
- const queued = [];
126
- const failed = [];
127
- for (const result of results) {
128
- if (result.skipped)
129
- continue;
130
- const destination = result.destination;
131
- const ref = { id: result.id, destination };
132
- if (result.error) {
133
- failed.push(ref);
134
- }
135
- else if (result.queue && result.queue.length) {
136
- // Merge queue with existing queue
137
- destination.queue = (destination.queue || []).concat(result.queue);
138
- queued.push(ref);
139
- }
140
- else {
141
- successful.push(ref);
142
- }
143
- }
144
- return createPushResult({
145
- ok: !failed.length,
146
- event,
147
- successful,
148
- queued,
149
- failed,
150
- });
151
- }
152
- /**
153
- * Initializes a destination.
154
- *
155
- * @template Destination
156
- * @param collector - The walkerOS collector instance.
157
- * @param destination - The destination to initialize.
158
- * @returns Whether the destination was initialized successfully.
159
- */
160
- export async function destinationInit(collector, destination) {
161
- // Check if the destination was initialized properly or try to do so
162
- if (destination.init && !destination.config.init) {
163
- // Create scoped logger for this destination: [type:id] or [unknown:id]
164
- const destType = destination.type || 'unknown';
165
- const destLogger = collector.logger.scope(destType);
166
- const context = {
167
- collector,
168
- config: destination.config,
169
- env: mergeEnvironments(destination.env, destination.config.env),
170
- logger: destLogger,
171
- };
172
- destLogger.debug('init');
173
- const configResult = await useHooks(destination.init, 'DestinationInit', collector.hooks)(context);
174
- // Actively check for errors (when false)
175
- if (configResult === false)
176
- return configResult; // don't push if init is false
177
- // Update the destination config if it was returned
178
- destination.config = {
179
- ...(configResult || destination.config),
180
- init: true, // Remember that the destination was initialized
181
- };
182
- destLogger.debug('init done');
183
- }
184
- return true; // Destination is ready to push
185
- }
186
- /**
187
- * Pushes an event to a single destination.
188
- * Handles mapping, batching, and consent checks.
189
- *
190
- * @template Destination
191
- * @param collector - The walkerOS collector instance.
192
- * @param destination - The destination to push to.
193
- * @param event - The event to push.
194
- * @returns Whether the event was pushed successfully.
195
- */
196
- export async function destinationPush(collector, destination, event) {
197
- const { config } = destination;
198
- const processed = await processEventMapping(event, config, collector);
199
- if (processed.ignore)
200
- return false;
201
- // Create scoped logger for this destination: [type] or [unknown]
202
- const destType = destination.type || 'unknown';
203
- const destLogger = collector.logger.scope(destType);
204
- const context = {
205
- collector,
206
- config,
207
- data: processed.data,
208
- mapping: processed.mapping,
209
- env: mergeEnvironments(destination.env, config.env),
210
- logger: destLogger,
211
- };
212
- const eventMapping = processed.mapping;
213
- const mappingKey = processed.mappingKey || '* *';
214
- if (eventMapping?.batch && destination.pushBatch) {
215
- // Initialize batch registry on destination (not on shared mapping config)
216
- destination.batches = destination.batches || {};
217
- // Get or create batch state for this mapping key
218
- if (!destination.batches[mappingKey]) {
219
- const batched = {
220
- key: mappingKey,
221
- events: [],
222
- data: [],
223
- };
224
- destination.batches[mappingKey] = {
225
- batched,
226
- batchFn: debounce(() => {
227
- const batchState = destination.batches[mappingKey];
228
- const currentBatched = batchState.batched;
229
- const batchContext = {
230
- collector,
231
- config,
232
- // Note: batch.data contains all transformed data; context.data is for single events
233
- data: undefined,
234
- mapping: eventMapping,
235
- env: mergeEnvironments(destination.env, config.env),
236
- logger: destLogger,
237
- };
238
- destLogger.debug('push batch', {
239
- events: currentBatched.events.length,
240
- });
241
- useHooks(destination.pushBatch, 'DestinationPushBatch', collector.hooks)(currentBatched, batchContext);
242
- destLogger.debug('push batch done');
243
- // Reset batch
244
- currentBatched.events = [];
245
- currentBatched.data = [];
246
- }, eventMapping.batch),
247
- };
248
- }
249
- // Add event to batch
250
- const batchState = destination.batches[mappingKey];
251
- batchState.batched.events.push(processed.event);
252
- if (isDefined(processed.data))
253
- batchState.batched.data.push(processed.data);
254
- // Trigger debounced batch
255
- batchState.batchFn();
256
- }
257
- else {
258
- destLogger.debug('push', { event: processed.event.name });
259
- // It's time to go to the destination's side now
260
- await useHooks(destination.push, 'DestinationPush', collector.hooks)(processed.event, context);
261
- destLogger.debug('push done');
262
- }
263
- return true;
264
- }
265
- /**
266
- * Creates a standardized result object for push operations.
267
- *
268
- * @param partialResult - A partial result to merge with the default result.
269
- * @returns The push result.
270
- */
271
- export function createPushResult(partialResult) {
272
- return assign({
273
- ok: !partialResult?.failed?.length,
274
- successful: [],
275
- queued: [],
276
- failed: [],
277
- }, partialResult);
278
- }
279
- /**
280
- * Initializes a map of destinations using ONLY the unified code/config/env pattern.
281
- * Does NOT call destination.init() - that happens later during push with proper consent checks.
282
- *
283
- * @param destinations - The destinations to initialize.
284
- * @param collector - The collector instance for destination init context.
285
- * @returns The initialized destinations.
286
- */
287
- export async function initDestinations(_collector, destinations = {}) {
288
- const result = {};
289
- for (const [name, destinationDef] of Object.entries(destinations)) {
290
- const { code, config = {}, env = {} } = destinationDef;
291
- const resolved = resolveCode(code);
292
- const mergedConfig = {
293
- ...resolved.config,
294
- ...config,
295
- };
296
- const mergedEnv = mergeEnvironments(resolved.env, env);
297
- result[name] = {
298
- ...resolved,
299
- config: mergedConfig,
300
- env: mergedEnv,
301
- };
302
- }
303
- return result;
304
- }
305
- /**
306
- * Merges destination environment with config environment
307
- * Config env takes precedence over destination env for overrides
308
- */
309
- export function mergeEnvironments(destinationEnv, configEnv) {
310
- // If neither environment exists, return empty object
311
- if (!destinationEnv && !configEnv)
312
- return {};
313
- // If only one exists, return it
314
- if (!configEnv)
315
- return destinationEnv;
316
- if (!destinationEnv)
317
- return configEnv;
318
- // Both exist - merge objects with configEnv taking precedence
319
- if (isObject(destinationEnv) && isObject(configEnv)) {
320
- return { ...destinationEnv, ...configEnv };
321
- }
322
- // If they're not both objects, config env overrides destination env
323
- return configEnv;
324
- }
325
- //# sourceMappingURL=destination.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"destination.js","sourceRoot":"","sources":["../src/destination.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EACN,KAAK,EACL,QAAQ,EACR,KAAK,EACL,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,mBAAmB,EACnB,aAAa,EACb,QAAQ,GACT,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,SAAS,WAAW,CAAC,IAAiC;IACpD,OAAO,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC;AAChD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,SAA6B,EAC7B,IAAsB,EACtB,OAA4B;IAE5B,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,GAAG,EAAE,EAAE,GAAG,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;IACzD,MAAM,MAAM,GAAG,OAAO,IAAI,UAAU,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IAExD,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,WAAW,GAAyB;QACxC,GAAG,QAAQ;QACX,MAAM;QACN,GAAG,EAAE,iBAAiB,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;KAC1C,CAAC;IAEF,IAAI,EA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AEtC,8DAA8D;IAC9D,IAAI,QAAQ,CAAC,cAAc,CAAC,IAAI,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QACpD,OAAO,EAAE,GAAG,cAAc,EAAE,GAAG,SAAS,EAAE,CAAC;IAC7C,CAAC;IAED,oEAAoE;IACpE,OAAO,SAAS,CAAC;AACnB,CAAC"}
package/dist/dev.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../src/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE7E,eAAO,MAAM,OAAO,EAAE;IAAE,QAAQ,EAAE,UAAU,CAAA;CAE3C,CAAC"}
package/dist/elb.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import type { Collector, Source } from '@walkeros/core';
2
- /**
3
- * Creates the default ELB source.
4
- * Routes between collector.push and collector.command based on input.
5
- * Provides backward-compatible flexible argument interface.
6
- *
7
- * @param collector - The walkerOS collector instance
8
- * @returns ELB source instance
9
- */
10
- export declare function createElbSource(collector: Collector.Instance): Source.Instance;
11
- //# sourceMappingURL=elb.d.ts.map
package/dist/elb.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"elb.d.ts","sourceRoot":"","sources":["../src/elb.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAiB,MAAM,gBAAgB,CAAC;AAEvE;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,SAAS,CAAC,QAAQ,GAC5B,MAAM,CAAC,QAAQ,CA8DjB"}
package/dist/elb.js DELETED
@@ -1,60 +0,0 @@
1
- /**
2
- * Creates the default ELB source.
3
- * Routes between collector.push and collector.command based on input.
4
- * Provides backward-compatible flexible argument interface.
5
- *
6
- * @param collector - The walkerOS collector instance
7
- * @returns ELB source instance
8
- */
9
- export function createElbSource(collector) {
10
- return {
11
- type: 'elb',
12
- config: {},
13
- // The push function is the elb() interface users interact with
14
- push: async (eventOrCommand, data, options, context, nested, custom) => {
15
- // Detect walker commands
16
- if (typeof eventOrCommand === 'string' &&
17
- eventOrCommand.startsWith('walker ')) {
18
- const command = eventOrCommand.replace('walker ', '');
19
- return collector.command(command, data, options);
20
- }
21
- // Build event object
22
- let event;
23
- if (typeof eventOrCommand === 'string') {
24
- // Convert string to object: elb('page view', { title: 'Home' })
25
- event = { name: eventOrCommand };
26
- if (data && typeof data === 'object' && !Array.isArray(data)) {
27
- event.data = data;
28
- }
29
- }
30
- else if (eventOrCommand && typeof eventOrCommand === 'object') {
31
- // Use object directly: elb({ name: 'page view', data: {...} })
32
- event = eventOrCommand;
33
- // Merge additional data if provided
34
- if (data && typeof data === 'object' && !Array.isArray(data)) {
35
- event.data = {
36
- ...(event.data || {}),
37
- ...data,
38
- };
39
- }
40
- }
41
- else {
42
- // Invalid input
43
- return { ok: false, successful: [], queued: [], failed: [] };
44
- }
45
- // Add optional properties if provided
46
- if (context && typeof context === 'object') {
47
- event.context = context;
48
- }
49
- if (nested && Array.isArray(nested)) {
50
- event.nested = nested;
51
- }
52
- if (custom && typeof custom === 'object') {
53
- event.custom = custom;
54
- }
55
- // Call collector.push with event object
56
- return collector.push(event);
57
- },
58
- };
59
- }
60
- //# sourceMappingURL=elb.js.map
package/dist/elb.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"elb.js","sourceRoot":"","sources":["../src/elb.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAC7B,SAA6B;IAE7B,OAAO;QACL,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,EAAE;QAEV,+DAA+D;QAC/D,IAAI,EAAE,KAAK,EACT,cAAwB,EACxB,IAAc,EACd,OAAiB,EACjB,OAAiB,EACjB,MAA0B,EAC1B,MAA4B,EACH,EAAE;YAC3B,yBAAyB;YACzB,IACE,OAAO,cAAc,KAAK,QAAQ;gBAClC,cAAc,CA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IAAI,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;gBACpC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;YACxB,CAAC;YACD,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;gBACzC,KAAK,CAAC,MAAM,GAAG,MAA6B,CAAC;YAC/C,CAAC;YAED,wCAAwC;YACxC,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;KACF,CAAC;AACJ,CAAC"}
package/dist/flow.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import type { Collector, Elb } from '@walkeros/core';
2
- import type { StartFlow } from './types';
3
- export declare function startFlow<ElbPush extends Elb.Fn = Elb.Fn>(initConfig?: Collector.InitConfig): Promise<StartFlow<ElbPush>>;
4
- //# sourceMappingURL=flow.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"flow.d.ts","sourceRoot":"","sources":["../src/flow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAKzC,wBAAsB,SAAS,CAAC,OAAO,SAAS,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,EAC7D,UAAU,CAAC,EAAE,SAAS,CAAC,UAAU,GAChC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAkD7B"}
package/dist/flow.js DELETED
@@ -1,44 +0,0 @@
1
- import { collector } from './collector';
2
- import { createElbSource } from './elb';
3
- import { initSources } from './source';
4
- export async function startFlow(initConfig) {
5
- initConfig = initConfig || {};
6
- const instance = await collector(initConfig);
7
- // Create and register ELB source first
8
- const elbSource = createElbSource(instance);
9
- instance.sources.elb = elbSource;
10
- // Now initialize other sources with ELB source available
11
- const additionalSources = await initSources(instance, initConfig.sources || {});
12
- Object.assign(instance.sources, additionalSources);
13
- const { consent, user, globals, custom } = initConfig;
14
- if (consent)
15
- await instance.command('consent', consent);
16
- if (user)
17
- await instance.command('user', user);
18
- if (globals)
19
- Object.assign(instance.globals, globals);
20
- if (custom)
21
- Object.assign(instance.custom, custom);
22
- if (instance.config.run)
23
- await instance.command('run');
24
- // Determine the primary elb:
25
- // 1. Use explicitly marked primary source
26
- // 2. Use first non-elb source if any exist
27
- // 3. Fallback to ELB source
28
- let primaryElb = elbSource.push;
29
- const sources = Object.values(instance.sources).filter((source) => source.type !== 'elb');
30
- // First, check for explicitly marked primary source
31
- const markedPrimary = sources.find((source) => source.config.primary);
32
- if (markedPrimary) {
33
- primaryElb = markedPrimary.push;
34
- }
35
- else if (sources.length > 0) {
36
- // Use first source as default
37
- primaryElb = sources[0].push;
38
- }
39
- return {
40
- collector: instance,
41
- elb: primaryElb,
42
- };
43
- }
44
- //# sourceMappingURL=flow.js.map
package/dist/flow.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"flow.js","sourceRoot":"","sources":["../src/flow.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,UAAiC;IAEjC,UAAU,GAAG,UAAU,IAAI,EAAE,CAAC;IAC9B,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,UAAU,CAAC,CAAC;IAE7C,uCAAuC;IACvC,MAAM,SAAS,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC5C,QAAQ,CAAC,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC;IAEjC,yDAAyD;IACzD,MAAM,iBAAiB,GAAG,MAAM,WAAW,CACzC,QAAQ,EACR,UAAU,CAAC,OAAO,IAAI,EAAE,CACzB,CAAC;IACF,MAAM,CAAC,MAAM,C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;IAED,OAAO;QACL,SAAS,EAAE,QAAQ;QACnB,GAAG,EAAE,UAAqB;KAC3B,CAAC;AACJ,CAAC"}
package/dist/handle.d.ts DELETED
@@ -1,29 +0,0 @@
1
- import type { Collector, WalkerOS, Elb } from '@walkeros/core';
2
- import type { RunState } from './types/collector';
3
- /**
4
- * Handles common commands.
5
- *
6
- * @param collector The walkerOS collector instance.
7
- * @param action The action to handle.
8
- * @param data The data to handle.
9
- * @param options The options to handle.
10
- * @returns A promise that resolves with the push result or undefined.
11
- */
12
- export declare function commonHandleCommand(collector: Collector.Instance, action: string, data?: unknown, options?: unknown): Promise<Elb.PushResult>;
13
- /**
14
- * Creates a full event from a partial event.
15
- *
16
- * @param collector The walkerOS collector instance.
17
- * @param partialEvent The partial event to transform.
18
- * @returns The full event.
19
- */
20
- export declare function createEvent(collector: Collector.Instance, partialEvent: WalkerOS.PartialEvent): WalkerOS.Event;
21
- /**
22
- * Runs the collector by setting it to allowed state and processing queued events.
23
- *
24
- * @param collector The walkerOS collector instance.
25
- * @param state Optional state to merge with the collector (user, globals, consent, custom).
26
- * @returns A promise that resolves with the push result.
27
- */
28
- export declare function runCollector(collector: Collector.Instance, state?: RunState): Promise<Elb.PushResult>;
29
- //# sourceMappingURL=handle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handle.d.ts","sourceRoot":"","sources":["../src/handle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAe,GAAG,EAAM,MAAM,gBAAgB,CAAC;AAOhF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,SAAS,EAAE,SAAS,CAAC,QAAQ,EAC7B,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,OAAO,GAChB,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAkFzB;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,SAAS,EAAE,SAAS,CAAC,QAAQ,EAC7B,YAAY,EAAE,QAAQ,CAAC,YAAY,GAClC,QAAQ,CAAC,KAAK,CAuDhB;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,SAAS,EAAE,SAAS,CAAC,QAAQ,EAC7B,KAAK,CAAC,EAAE,QAAQ,GACf,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAuDzB"}