@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.
- package/dist/index.d.mts +12 -7
- package/dist/index.d.ts +12 -7
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/dist/__tests__/auto-run.test.d.ts +0 -2
- package/dist/__tests__/auto-run.test.d.ts.map +0 -1
- package/dist/__tests__/auto-run.test.js +0 -102
- package/dist/__tests__/auto-run.test.js.map +0 -1
- package/dist/__tests__/consent.test.d.ts +0 -2
- package/dist/__tests__/consent.test.d.ts.map +0 -1
- package/dist/__tests__/consent.test.js +0 -21
- package/dist/__tests__/consent.test.js.map +0 -1
- package/dist/__tests__/create-flow.test.d.ts +0 -2
- package/dist/__tests__/create-flow.test.d.ts.map +0 -1
- package/dist/__tests__/create-flow.test.js +0 -69
- package/dist/__tests__/create-flow.test.js.map +0 -1
- package/dist/__tests__/destination-code.test.d.ts +0 -2
- package/dist/__tests__/destination-code.test.d.ts.map +0 -1
- package/dist/__tests__/destination-code.test.js +0 -396
- package/dist/__tests__/destination-code.test.js.map +0 -1
- package/dist/__tests__/destination.test.d.ts +0 -2
- package/dist/__tests__/destination.test.d.ts.map +0 -1
- package/dist/__tests__/destination.test.js +0 -471
- package/dist/__tests__/destination.test.js.map +0 -1
- package/dist/__tests__/handle.test.d.ts +0 -2
- package/dist/__tests__/handle.test.d.ts.map +0 -1
- package/dist/__tests__/handle.test.js +0 -78
- package/dist/__tests__/handle.test.js.map +0 -1
- package/dist/__tests__/mapping.test.d.ts +0 -2
- package/dist/__tests__/mapping.test.d.ts.map +0 -1
- package/dist/__tests__/mapping.test.js +0 -310
- package/dist/__tests__/mapping.test.js.map +0 -1
- package/dist/__tests__/source.test.d.ts +0 -2
- package/dist/__tests__/source.test.d.ts.map +0 -1
- package/dist/__tests__/source.test.js +0 -306
- package/dist/__tests__/source.test.js.map +0 -1
- package/dist/__tests__/start-flow.test.d.ts +0 -2
- package/dist/__tests__/start-flow.test.d.ts.map +0 -1
- package/dist/__tests__/start-flow.test.js +0 -167
- package/dist/__tests__/start-flow.test.js.map +0 -1
- package/dist/__tests__/walker-entity.test.d.ts +0 -2
- package/dist/__tests__/walker-entity.test.d.ts.map +0 -1
- package/dist/__tests__/walker-entity.test.js +0 -52
- package/dist/__tests__/walker-entity.test.js.map +0 -1
- package/dist/collector.d.ts +0 -3
- package/dist/collector.d.ts.map +0 -1
- package/dist/collector.js +0 -60
- package/dist/collector.js.map +0 -1
- package/dist/command.d.ts +0 -12
- package/dist/command.d.ts.map +0 -1
- package/dist/command.js +0 -20
- package/dist/command.js.map +0 -1
- package/dist/consent.d.ts +0 -10
- package/dist/consent.d.ts.map +0 -1
- package/dist/consent.js +0 -30
- package/dist/consent.js.map +0 -1
- package/dist/constants.d.ts +0 -13
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -35
- package/dist/constants.js.map +0 -1
- package/dist/destination-code.d.ts +0 -4
- package/dist/destination-code.d.ts.map +0 -1
- package/dist/destination-code.js +0 -72
- package/dist/destination-code.js.map +0 -1
- package/dist/destination.d.ts +0 -61
- package/dist/destination.d.ts.map +0 -1
- package/dist/destination.js +0 -325
- package/dist/destination.js.map +0 -1
- package/dist/dev.d.ts.map +0 -1
- package/dist/elb.d.ts +0 -11
- package/dist/elb.d.ts.map +0 -1
- package/dist/elb.js +0 -60
- package/dist/elb.js.map +0 -1
- package/dist/flow.d.ts +0 -4
- package/dist/flow.d.ts.map +0 -1
- package/dist/flow.js +0 -44
- package/dist/flow.js.map +0 -1
- package/dist/handle.d.ts +0 -29
- package/dist/handle.d.ts.map +0 -1
- package/dist/handle.js +0 -161
- package/dist/handle.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/on.d.ts +0 -19
- package/dist/on.d.ts.map +0 -1
- package/dist/on.js +0 -127
- package/dist/on.js.map +0 -1
- package/dist/push.d.ts +0 -11
- package/dist/push.d.ts.map +0 -1
- package/dist/push.js +0 -43
- package/dist/push.js.map +0 -1
- package/dist/source.d.ts +0 -10
- package/dist/source.d.ts.map +0 -1
- package/dist/source.js +0 -47
- package/dist/source.js.map +0 -1
- package/dist/types/code.d.ts +0 -23
- package/dist/types/code.d.ts.map +0 -1
- package/dist/types/code.js +0 -2
- package/dist/types/code.js.map +0 -1
- package/dist/types/collector.d.ts +0 -19
- package/dist/types/collector.d.ts.map +0 -1
- package/dist/types/collector.js +0 -2
- package/dist/types/collector.js.map +0 -1
- package/dist/types/index.d.ts +0 -3
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -4
- package/dist/types/index.js.map +0 -1
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { startFlow } from '../flow';
|
|
2
|
-
describe('Source Start Flow Integration', () => {
|
|
3
|
-
it('should return ELB source push as elb when no sources', async () => {
|
|
4
|
-
const { collector, elb } = await startFlow({
|
|
5
|
-
run: false,
|
|
6
|
-
});
|
|
7
|
-
// elb should be the ELB source's push function
|
|
8
|
-
expect(collector.sources.elb).toBeDefined();
|
|
9
|
-
expect(elb).toBe(collector.sources.elb.push);
|
|
10
|
-
});
|
|
11
|
-
it('should return first source push as elb by default', async () => {
|
|
12
|
-
const customPush = async () => ({
|
|
13
|
-
ok: true,
|
|
14
|
-
successful: [],
|
|
15
|
-
queued: [],
|
|
16
|
-
failed: [],
|
|
17
|
-
});
|
|
18
|
-
const mockSource = async () => ({
|
|
19
|
-
type: 'mock',
|
|
20
|
-
config: {},
|
|
21
|
-
push: customPush,
|
|
22
|
-
});
|
|
23
|
-
const { collector, elb } = await startFlow({
|
|
24
|
-
sources: {
|
|
25
|
-
mockSource: {
|
|
26
|
-
code: mockSource,
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
run: false,
|
|
30
|
-
});
|
|
31
|
-
// elb should be first source's push by default
|
|
32
|
-
expect(elb).toBe(customPush);
|
|
33
|
-
expect(elb).not.toBe(collector.push);
|
|
34
|
-
});
|
|
35
|
-
it('should return primary source push as elb when marked', async () => {
|
|
36
|
-
const customPush = async () => ({
|
|
37
|
-
ok: true,
|
|
38
|
-
successful: [],
|
|
39
|
-
queued: [],
|
|
40
|
-
failed: [],
|
|
41
|
-
});
|
|
42
|
-
const mockSource = async () => ({
|
|
43
|
-
type: 'mock',
|
|
44
|
-
config: {},
|
|
45
|
-
push: customPush,
|
|
46
|
-
});
|
|
47
|
-
const { collector, elb } = await startFlow({
|
|
48
|
-
sources: {
|
|
49
|
-
mockSource: {
|
|
50
|
-
code: mockSource,
|
|
51
|
-
primary: true, // Mark as primary
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
run: false,
|
|
55
|
-
});
|
|
56
|
-
// elb should be the source's push method
|
|
57
|
-
expect(elb).toBe(customPush);
|
|
58
|
-
expect(elb).not.toBe(collector.push);
|
|
59
|
-
// Verify primary flag is stored in source config
|
|
60
|
-
expect(collector.sources.mockSource.config.primary).toBe(true);
|
|
61
|
-
});
|
|
62
|
-
it('should override first source with primary flag', async () => {
|
|
63
|
-
const firstPush = async () => ({
|
|
64
|
-
ok: true,
|
|
65
|
-
successful: [],
|
|
66
|
-
queued: [],
|
|
67
|
-
failed: [],
|
|
68
|
-
});
|
|
69
|
-
const secondPush = async () => ({
|
|
70
|
-
ok: true,
|
|
71
|
-
successful: [],
|
|
72
|
-
queued: [],
|
|
73
|
-
failed: [],
|
|
74
|
-
});
|
|
75
|
-
const mockSource1 = async () => ({
|
|
76
|
-
type: 'mock1',
|
|
77
|
-
config: {},
|
|
78
|
-
push: firstPush,
|
|
79
|
-
});
|
|
80
|
-
const mockSource2 = async () => ({
|
|
81
|
-
type: 'mock2',
|
|
82
|
-
config: {},
|
|
83
|
-
push: secondPush,
|
|
84
|
-
});
|
|
85
|
-
const { elb } = await startFlow({
|
|
86
|
-
sources: {
|
|
87
|
-
first: {
|
|
88
|
-
code: mockSource1,
|
|
89
|
-
},
|
|
90
|
-
second: {
|
|
91
|
-
code: mockSource2,
|
|
92
|
-
primary: true, // Explicitly mark second as primary
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
run: false,
|
|
96
|
-
});
|
|
97
|
-
// Should use explicitly marked primary, not first source
|
|
98
|
-
expect(elb).toBe(secondPush);
|
|
99
|
-
expect(elb).not.toBe(firstPush);
|
|
100
|
-
});
|
|
101
|
-
it('should initialize complete setup from flow config', async () => {
|
|
102
|
-
const mockPushCalls = [];
|
|
103
|
-
const mockSource = async (config, env) => {
|
|
104
|
-
expect(config).toEqual({
|
|
105
|
-
settings: {
|
|
106
|
-
test: 'value',
|
|
107
|
-
},
|
|
108
|
-
});
|
|
109
|
-
expect(env).toMatchObject({
|
|
110
|
-
push: expect.any(Function),
|
|
111
|
-
command: expect.any(Function),
|
|
112
|
-
sources: expect.any(Object),
|
|
113
|
-
elb: expect.any(Function),
|
|
114
|
-
foo: 'bar',
|
|
115
|
-
});
|
|
116
|
-
return {
|
|
117
|
-
type: 'mock',
|
|
118
|
-
config: {
|
|
119
|
-
settings: config.settings || {},
|
|
120
|
-
},
|
|
121
|
-
push: env.push, // Required push method
|
|
122
|
-
};
|
|
123
|
-
};
|
|
124
|
-
const { collector, elb } = await startFlow({
|
|
125
|
-
sources: {
|
|
126
|
-
mockSource: {
|
|
127
|
-
code: mockSource,
|
|
128
|
-
config: {
|
|
129
|
-
settings: {
|
|
130
|
-
test: 'value',
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
env: {
|
|
134
|
-
foo: 'bar',
|
|
135
|
-
// elb will be injected by collector
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
destinations: {
|
|
140
|
-
test: {
|
|
141
|
-
code: {
|
|
142
|
-
type: 'test',
|
|
143
|
-
config: {},
|
|
144
|
-
push: (event) => {
|
|
145
|
-
mockPushCalls.push(event);
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
});
|
|
151
|
-
expect(collector.sources.mockSource).toEqual({
|
|
152
|
-
type: 'mock',
|
|
153
|
-
config: {
|
|
154
|
-
settings: { test: 'value' },
|
|
155
|
-
},
|
|
156
|
-
push: expect.any(Function),
|
|
157
|
-
});
|
|
158
|
-
expect(collector.sources.elb).toBeDefined();
|
|
159
|
-
await elb({ name: 'manual event', data: { test: 'data' } });
|
|
160
|
-
expect(mockPushCalls).toHaveLength(1);
|
|
161
|
-
expect(mockPushCalls[0]).toMatchObject({
|
|
162
|
-
name: 'manual event',
|
|
163
|
-
data: { test: 'data' },
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
//# sourceMappingURL=start-flow.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"start-flow.test.js","sourceRoot":"","sources":["../../src/__tests__/start-flow.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGpC,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;IAC7C,EAAE,CAAC,sDAAsD,EAAE,KAAK,IAAI,EAAE;QACpE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,MAAM,SAAS,CAAC;YACzC,GAAG,EAAE,KAAK;SACX,CAAC,CAAC;QAEH,+CAA+C;QAC/C,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;QAC5C,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mDAAmD,EAAE,KAAK,IAAI,EAAE;QACjE,MAAM,UAAU,GAAW,KAAK,IAAI,EAAE,CAAC,CAAC;YACtC,EAAE,EAAE,IAAI;YACR,UAAU,EAAE,EAAE;YACd,MAAM,EAAE,EAAE;YACV,MAAM,E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AM;wBACZ,MAAM,EAAE,EAAE;wBACV,IAAI,EAAE,CAAC,KAAqB,EAAE,EAAE;4BAC9B,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;wBAC5B,CAAC;qBACF;iBACF;aACF;SACF,CAAC,CAAC;QAEH,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;YAC3C,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE;gBACN,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;aAC5B;YACD,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;SAC3B,CAAC,CAAC;QACH,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;QAE5C,MAAM,GAAG,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;QAE5D,MAAM,CAAC,aAAa,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACtC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;YACrC,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACvB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"walker-entity.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/walker-entity.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { startFlow } from '../flow';
|
|
2
|
-
describe('Walker Entity Events', () => {
|
|
3
|
-
it('allows "walker" as entity name for regular events', async () => {
|
|
4
|
-
const mockPush = jest.fn().mockResolvedValue(undefined);
|
|
5
|
-
const mockDestination = {
|
|
6
|
-
push: mockPush,
|
|
7
|
-
};
|
|
8
|
-
const { elb } = await startFlow({
|
|
9
|
-
destinations: {
|
|
10
|
-
test: {
|
|
11
|
-
code: mockDestination,
|
|
12
|
-
config: {},
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
// This should now work - "walker" as entity name
|
|
17
|
-
await elb({ name: 'walker view', data: { page: 'home' } });
|
|
18
|
-
expect(mockPush).toHaveBeenCalledWith(expect.objectContaining({
|
|
19
|
-
entity: 'walker',
|
|
20
|
-
action: 'view',
|
|
21
|
-
name: 'walker view',
|
|
22
|
-
data: { page: 'home' },
|
|
23
|
-
}), expect.any(Object));
|
|
24
|
-
});
|
|
25
|
-
it('distinguishes between walker events and walker commands', async () => {
|
|
26
|
-
const mockPush = jest.fn().mockResolvedValue(undefined);
|
|
27
|
-
const mockDestination = {
|
|
28
|
-
push: mockPush,
|
|
29
|
-
};
|
|
30
|
-
const { elb, collector } = await startFlow({
|
|
31
|
-
destinations: {
|
|
32
|
-
test: {
|
|
33
|
-
code: mockDestination,
|
|
34
|
-
config: {},
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
// Regular walker entity event
|
|
39
|
-
await elb({ name: 'walker view', data: { page: 'home' } });
|
|
40
|
-
// Walker command (goes through command, not push)
|
|
41
|
-
await elb('walker consent', { marketing: true });
|
|
42
|
-
// Only the event should hit the destination
|
|
43
|
-
expect(mockPush).toHaveBeenCalledTimes(1);
|
|
44
|
-
expect(mockPush).toHaveBeenCalledWith(expect.objectContaining({
|
|
45
|
-
entity: 'walker',
|
|
46
|
-
action: 'view',
|
|
47
|
-
}), expect.any(Object));
|
|
48
|
-
// Command should update collector state
|
|
49
|
-
expect(collector.consent.marketing).toBe(true);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
//# sourceMappingURL=walker-entity.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"walker-entity.test.js","sourceRoot":"","sources":["../../src/__tests__/walker-entity.test.ts"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5B,MAAM,EAAE,EAAE;iBACX;aACF;SACF,CAAC,CAAC;QAEH,8BAA8B;QAC9B,MAAM,GAAG,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;QAE3D,kDAAkD;QAClD,MAAM,GAAG,CAAC,gBAAgB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAEjD,4CAA4C;QAC5C,MAAM,CAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC1C,MAAM,CAAC,QAAQ,CAAC,CAAC,oBAAoB,CACnC,MAAM,CAAC,gBAAgB,CAAC;YACtB,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE,MAAM;SACf,CAAC,EACF,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CACnB,CAAC;QAEF,wCAAwC;QACxC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/collector.d.ts
DELETED
package/dist/collector.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collector.d.ts","sourceRoot":"","sources":["../src/collector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,gBAAgB,CAAC;AAUlE,wBAAsB,SAAS,CAC7B,UAAU,EAAE,SAAS,CAAC,UAAU,GAC/B,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAqE7B"}
|
package/dist/collector.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { assign, createLogger } from '@walkeros/core';
|
|
2
|
-
import { commonHandleCommand } from './handle';
|
|
3
|
-
import { initDestinations } from './destination';
|
|
4
|
-
import { createPush } from './push';
|
|
5
|
-
import { createCommand } from './command';
|
|
6
|
-
export async function collector(initConfig) {
|
|
7
|
-
const version = __VERSION__;
|
|
8
|
-
const defaultConfig = {
|
|
9
|
-
globalsStatic: {},
|
|
10
|
-
sessionStatic: {},
|
|
11
|
-
tagging: 0,
|
|
12
|
-
run: true,
|
|
13
|
-
};
|
|
14
|
-
const config = assign(defaultConfig, initConfig, {
|
|
15
|
-
merge: false,
|
|
16
|
-
extend: false,
|
|
17
|
-
});
|
|
18
|
-
// Create logger with config from initConfig
|
|
19
|
-
const loggerConfig = {
|
|
20
|
-
level: initConfig.logger?.level,
|
|
21
|
-
handler: initConfig.logger?.handler,
|
|
22
|
-
};
|
|
23
|
-
const logger = createLogger(loggerConfig);
|
|
24
|
-
// Enhanced globals with static globals from config
|
|
25
|
-
const finalGlobals = { ...config.globalsStatic, ...initConfig.globals };
|
|
26
|
-
const collector = {
|
|
27
|
-
allowed: false,
|
|
28
|
-
config,
|
|
29
|
-
consent: initConfig.consent || {},
|
|
30
|
-
count: 0,
|
|
31
|
-
custom: initConfig.custom || {},
|
|
32
|
-
destinations: {},
|
|
33
|
-
globals: finalGlobals,
|
|
34
|
-
group: '',
|
|
35
|
-
hooks: {},
|
|
36
|
-
logger,
|
|
37
|
-
on: {},
|
|
38
|
-
queue: [],
|
|
39
|
-
round: 0,
|
|
40
|
-
session: undefined,
|
|
41
|
-
timing: Date.now(),
|
|
42
|
-
user: initConfig.user || {},
|
|
43
|
-
version,
|
|
44
|
-
sources: {},
|
|
45
|
-
push: undefined, // Placeholder, will be set below
|
|
46
|
-
command: undefined, // Placeholder, will be set below
|
|
47
|
-
};
|
|
48
|
-
// Set the push and command functions with the collector reference
|
|
49
|
-
collector.push = createPush(collector, (event) => ({
|
|
50
|
-
timing: Math.round((Date.now() - collector.timing) / 10) / 100,
|
|
51
|
-
source: { type: 'collector', id: '', previous_id: '' },
|
|
52
|
-
...event,
|
|
53
|
-
}));
|
|
54
|
-
collector.command = createCommand(collector, commonHandleCommand);
|
|
55
|
-
// Initialize destinations after collector is fully created
|
|
56
|
-
// Sources are initialized in startFlow after ELB source is created
|
|
57
|
-
collector.destinations = await initDestinations(collector, initConfig.destinations || {});
|
|
58
|
-
return collector;
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=collector.js.map
|
package/dist/collector.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collector.js","sourceRoot":"","sources":["../src/collector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAK1C,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,UAAgC;IAEhC,MAAM,OAAO,GAAG,WAAW,CAAC;IAE5B,MAAM,aAAa,GAAqB;QACtC,aAAa,EAAE,EAAE;QACjB,aAAa,EAAE,EAAE;QACjB,OAAO,EAAE,CAAC;QACV,GAAG,EAAE,IAAI;KACV,CAAC;IAEF,MAAM,MAAM,GAAqB,MAAM,CAAC,aAAa,EAAE,UAAU,EAAE;QACjE,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,KAAK;KACd,CAAC,CAAC;IAEH,4CAA4C;IAC5C,MAAM,YAAY,GAAkB;QAClC,KAAK,EAAE,UAAU,CAAC,MAAM,EAAE,KAAK;QAC/B,OAAO,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO;KACpC,CAAC;IACF,MAAM,MAAM,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;IAE1C,mDAAmD;IACnD,MAAM,YAAY,GAAG,EAAE,GAAG,MAAM,CAAC,aAAa,EAAE,GAAG,UAAU,CAAC,OAAO,EAAE,CAAC;IAExE,MAAM,SAAS,GAAuB;QACpC,OAAO,EAAE,KA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-
import type { Collector } from '@walkeros/core';
|
|
2
|
-
import type { HandleCommandFn } from './types/collector';
|
|
3
|
-
/**
|
|
4
|
-
* Creates the command function for the collector.
|
|
5
|
-
* Handles walker commands (config, consent, destination, etc.)
|
|
6
|
-
*
|
|
7
|
-
* @param collector - The walkerOS collector instance
|
|
8
|
-
* @param handleCommand - Command handler function
|
|
9
|
-
* @returns The command function
|
|
10
|
-
*/
|
|
11
|
-
export declare function createCommand<T extends Collector.Instance>(collector: T, handleCommand: HandleCommandFn<T>): Collector.CommandFn;
|
|
12
|
-
//# sourceMappingURL=command.d.ts.map
|
package/dist/command.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAO,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIzD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,SAAS,CAAC,QAAQ,EACxD,SAAS,EAAE,CAAC,EACZ,aAAa,EAAE,eAAe,CAAC,CAAC,CAAC,GAChC,SAAS,CAAC,SAAS,CAmBrB"}
|
package/dist/command.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useHooks, tryCatchAsync } from '@walkeros/core';
|
|
2
|
-
import { createPushResult } from './destination';
|
|
3
|
-
/**
|
|
4
|
-
* Creates the command function for the collector.
|
|
5
|
-
* Handles walker commands (config, consent, destination, etc.)
|
|
6
|
-
*
|
|
7
|
-
* @param collector - The walkerOS collector instance
|
|
8
|
-
* @param handleCommand - Command handler function
|
|
9
|
-
* @returns The command function
|
|
10
|
-
*/
|
|
11
|
-
export function createCommand(collector, handleCommand) {
|
|
12
|
-
return useHooks(async (command, data, options) => {
|
|
13
|
-
return await tryCatchAsync(async () => {
|
|
14
|
-
return await handleCommand(collector, command, data, options);
|
|
15
|
-
}, () => {
|
|
16
|
-
return createPushResult({ ok: false });
|
|
17
|
-
})();
|
|
18
|
-
}, 'Command', collector.hooks);
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=command.js.map
|
package/dist/command.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAC3B,SAAY,EACZ,aAAiC;IAEjC,OAAO,QAAQ,CACb,KAAK,EACH,OAAe,EACf,IAAc,EACd,OAAiB,EACQ,EAAE;QAC3B,OAAO,MAAM,aAAa,CACxB,KAAK,IAA6B,EAAE;YAClC,OAAO,MAAM,aAAa,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAChE,CAAC,EACD,GAAG,EAAE;YACH,OAAO,gBAAgB,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACzC,CAAC,CACF,EAAE,CAAC;IACN,CAAC,EACD,SAAS,EACT,SAAS,CAAC,KAAK,CACO,CAAC;AAC3B,CAAC"}
|
package/dist/consent.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Collector, WalkerOS, Elb } from '@walkeros/core';
|
|
2
|
-
/**
|
|
3
|
-
* Sets the consent state and processes the queue.
|
|
4
|
-
*
|
|
5
|
-
* @param collector - The walkerOS collector instance.
|
|
6
|
-
* @param data - The consent data to set.
|
|
7
|
-
* @returns The result of the push operation.
|
|
8
|
-
*/
|
|
9
|
-
export declare function setConsent(collector: Collector.Instance, data: WalkerOS.Consent): Promise<Elb.PushResult>;
|
|
10
|
-
//# sourceMappingURL=consent.d.ts.map
|
package/dist/consent.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"consent.d.ts","sourceRoot":"","sources":["../src/consent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAK/D;;;;;;GAMG;AACH,wBAAsB,UAAU,CAC9B,SAAS,EAAE,SAAS,CAAC,QAAQ,EAC7B,IAAI,EAAE,QAAQ,CAAC,OAAO,GACrB,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAwBzB"}
|
package/dist/consent.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { assign } from '@walkeros/core';
|
|
2
|
-
import { pushToDestinations, createPushResult } from './destination';
|
|
3
|
-
import { onApply } from './on';
|
|
4
|
-
/**
|
|
5
|
-
* Sets the consent state and processes the queue.
|
|
6
|
-
*
|
|
7
|
-
* @param collector - The walkerOS collector instance.
|
|
8
|
-
* @param data - The consent data to set.
|
|
9
|
-
* @returns The result of the push operation.
|
|
10
|
-
*/
|
|
11
|
-
export async function setConsent(collector, data) {
|
|
12
|
-
const { consent } = collector;
|
|
13
|
-
let runQueue = false;
|
|
14
|
-
const update = {};
|
|
15
|
-
Object.entries(data).forEach(([name, granted]) => {
|
|
16
|
-
const state = !!granted;
|
|
17
|
-
update[name] = state;
|
|
18
|
-
// Only run queue if state was set to true
|
|
19
|
-
runQueue = runQueue || state;
|
|
20
|
-
});
|
|
21
|
-
// Update consent state
|
|
22
|
-
collector.consent = assign(consent, update);
|
|
23
|
-
// Run on consent events
|
|
24
|
-
onApply(collector, 'consent', undefined, update);
|
|
25
|
-
// Process previous events if not disabled
|
|
26
|
-
return runQueue
|
|
27
|
-
? pushToDestinations(collector)
|
|
28
|
-
: createPushResult({ ok: true });
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=consent.js.map
|
package/dist/consent.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"consent.js","sourceRoot":"","sources":["../src/consent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,SAA6B,EAC7B,IAAsB;IAEtB,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,CAAC;IAE9B,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,MAAM,MAAM,GAAqB,EAAE,CAAC;IACpC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE;QAC/C,MAAM,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC;QAExB,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QAErB,0CAA0C;QAC1C,QAAQ,GAAG,QAAQ,IAAI,KAAK,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,uBAAuB;IACvB,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAE5C,wBAAwB;IACxB,OAAO,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAEjD,0CAA0C;IAC1C,OAAO,QAAQ;QACb,CAAC,CAAC,kBAAkB,CAAC,SAAS,CAAC;QAC/B,CAAC,CAAC,gBAAgB,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AACrC,CAAC"}
|
package/dist/constants.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Collector } from '@walkeros/core';
|
|
2
|
-
import type { CommandTypes, StorageType } from './types/collector';
|
|
3
|
-
export declare const Commands: Record<CommandTypes, Collector.CommandType>;
|
|
4
|
-
export declare const Const: {
|
|
5
|
-
Commands: Record<CommandTypes, string>;
|
|
6
|
-
Utils: {
|
|
7
|
-
Storage: {
|
|
8
|
-
[key: string]: StorageType;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export default Const;
|
|
13
|
-
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEnE,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,WAAW,CAoBvD,CAAC;AAYX,eAAO,MAAM,KAAK;;;;;;;CAGjB,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
package/dist/constants.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export const Commands = {
|
|
2
|
-
Action: 'action',
|
|
3
|
-
Actions: 'actions',
|
|
4
|
-
Config: 'config',
|
|
5
|
-
Consent: 'consent',
|
|
6
|
-
Context: 'context',
|
|
7
|
-
Custom: 'custom',
|
|
8
|
-
Destination: 'destination',
|
|
9
|
-
Elb: 'elb',
|
|
10
|
-
Globals: 'globals',
|
|
11
|
-
Hook: 'hook',
|
|
12
|
-
Init: 'init',
|
|
13
|
-
Link: 'link',
|
|
14
|
-
On: 'on',
|
|
15
|
-
Prefix: 'data-elb',
|
|
16
|
-
Ready: 'ready',
|
|
17
|
-
Run: 'run',
|
|
18
|
-
Session: 'session',
|
|
19
|
-
User: 'user',
|
|
20
|
-
Walker: 'walker',
|
|
21
|
-
};
|
|
22
|
-
const UtilsStorage = {
|
|
23
|
-
Cookie: 'cookie',
|
|
24
|
-
Local: 'local',
|
|
25
|
-
Session: 'session',
|
|
26
|
-
};
|
|
27
|
-
const Utils = {
|
|
28
|
-
Storage: UtilsStorage,
|
|
29
|
-
};
|
|
30
|
-
export const Const = {
|
|
31
|
-
Commands,
|
|
32
|
-
Utils,
|
|
33
|
-
};
|
|
34
|
-
export default Const;
|
|
35
|
-
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,QAAQ,GAAgD;IACnE,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,aAAa;IAC1B,GAAG,EAAE,KAAK;IACV,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,EAAE,EAAE,IAAI;IACR,MAAM,EAAE,UAAU;IAClB,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,KAAK;IACV,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;CACR,CAAC;AAEX,MAAM,YAAY,GAAmC;IACnD,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;CACV,CAAC;AAEX,MAAM,KAAK,GAAG;IACZ,OAAO,EAAE,YAAY;CACtB,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,QAAQ;IACR,KAAK;CACN,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"destination-code.d.ts","sourceRoot":"","sources":["../src/destination-code.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,QAqEzC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
package/dist/destination-code.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
export const destinationCode = {
|
|
2
|
-
type: 'code',
|
|
3
|
-
config: {},
|
|
4
|
-
init(context) {
|
|
5
|
-
const { config, logger } = context;
|
|
6
|
-
const settings = config.settings;
|
|
7
|
-
// Inject scripts (fire and forget)
|
|
8
|
-
const scripts = settings?.scripts;
|
|
9
|
-
if (scripts && typeof document !== 'undefined') {
|
|
10
|
-
for (const src of scripts) {
|
|
11
|
-
const script = document.createElement('script');
|
|
12
|
-
script.src = src;
|
|
13
|
-
script.async = true;
|
|
14
|
-
document.head.appendChild(script);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
// Execute init code
|
|
18
|
-
const initCode = settings?.init;
|
|
19
|
-
if (!initCode)
|
|
20
|
-
return;
|
|
21
|
-
try {
|
|
22
|
-
const fn = new Function('context', initCode);
|
|
23
|
-
fn(context);
|
|
24
|
-
}
|
|
25
|
-
catch (e) {
|
|
26
|
-
logger.error('Code destination init error:', e);
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
push(event, context) {
|
|
30
|
-
const { mapping, config, logger } = context;
|
|
31
|
-
const pushCode = mapping?.push ??
|
|
32
|
-
config.settings?.push;
|
|
33
|
-
if (!pushCode)
|
|
34
|
-
return;
|
|
35
|
-
try {
|
|
36
|
-
const fn = new Function('event', 'context', pushCode);
|
|
37
|
-
fn(event, context);
|
|
38
|
-
}
|
|
39
|
-
catch (e) {
|
|
40
|
-
logger.error('Code destination push error:', e);
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
pushBatch(batch, context) {
|
|
44
|
-
const { mapping, config, logger } = context;
|
|
45
|
-
const pushBatchCode = mapping?.pushBatch ??
|
|
46
|
-
config.settings?.pushBatch;
|
|
47
|
-
if (!pushBatchCode)
|
|
48
|
-
return;
|
|
49
|
-
try {
|
|
50
|
-
const fn = new Function('batch', 'context', pushBatchCode);
|
|
51
|
-
fn(batch, context);
|
|
52
|
-
}
|
|
53
|
-
catch (e) {
|
|
54
|
-
logger.error('Code destination pushBatch error:', e);
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
on(type, context) {
|
|
58
|
-
const { config, logger } = context;
|
|
59
|
-
const onCode = config.settings?.on;
|
|
60
|
-
if (!onCode)
|
|
61
|
-
return;
|
|
62
|
-
try {
|
|
63
|
-
const fn = new Function('type', 'context', onCode);
|
|
64
|
-
fn(type, context);
|
|
65
|
-
}
|
|
66
|
-
catch (e) {
|
|
67
|
-
logger.error('Code destination on error:', e);
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
export default destinationCode;
|
|
72
|
-
//# sourceMappingURL=destination-code.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"destination-code.js","sourceRoot":"","sources":["../src/destination-code.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,eAAe,GAAyB;IACnD,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,EAAE;IAEV,IAAI,CAAC,OAAO;QACV,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QACnC,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAgC,CAAC;QAEzD,mCAAmC;QACnC,MAAM,OAAO,GAAG,QAAQ,EAAE,OAAO,CAAC;QAClC,IAAI,OAAO,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;YAC/C,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;gBAC1B,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;gBAChD,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC;gBACjB,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;gBACpB,QAAQ,CAAC,IAAI,CAAC,WAAW,C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a,CAAC,CAAC;YAC3D,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACrB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,CAAC,KAAK,CAAC,mCAAmC,EAAE,CAAC,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IAED,EAAE,CAAC,IAAI,EAAE,OAAO;QACd,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QACnC,MAAM,MAAM,GAAI,MAAM,CAAC,QAAiC,EAAE,EAAE,CAAC;QAC7D,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;YACnD,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACpB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,CAAC,KAAK,CAAC,4BAA4B,EAAE,CAAC,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;CACF,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
package/dist/destination.d.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { Collector, WalkerOS, Elb, Destination } from '@walkeros/core';
|
|
2
|
-
/**
|
|
3
|
-
* Adds a new destination to the collector.
|
|
4
|
-
*
|
|
5
|
-
* @param collector - The walkerOS collector instance.
|
|
6
|
-
* @param data - The destination's init data.
|
|
7
|
-
* @param options - The destination's config.
|
|
8
|
-
* @returns The result of the push operation.
|
|
9
|
-
*/
|
|
10
|
-
export declare function addDestination(collector: Collector.Instance, data: Destination.Init, options?: Destination.Config): Promise<Elb.PushResult>;
|
|
11
|
-
/**
|
|
12
|
-
* Pushes an event to all or a subset of destinations.
|
|
13
|
-
*
|
|
14
|
-
* @param collector - The walkerOS collector instance.
|
|
15
|
-
* @param event - The event to push.
|
|
16
|
-
* @param destinations - The destinations to push to.
|
|
17
|
-
* @returns The result of the push operation.
|
|
18
|
-
*/
|
|
19
|
-
export declare function pushToDestinations(collector: Collector.Instance, event?: WalkerOS.Event, destinations?: Collector.Destinations): Promise<Elb.PushResult>;
|
|
20
|
-
/**
|
|
21
|
-
* Initializes a destination.
|
|
22
|
-
*
|
|
23
|
-
* @template Destination
|
|
24
|
-
* @param collector - The walkerOS collector instance.
|
|
25
|
-
* @param destination - The destination to initialize.
|
|
26
|
-
* @returns Whether the destination was initialized successfully.
|
|
27
|
-
*/
|
|
28
|
-
export declare function destinationInit<Destination extends Destination.Instance>(collector: Collector.Instance, destination: Destination): Promise<boolean>;
|
|
29
|
-
/**
|
|
30
|
-
* Pushes an event to a single destination.
|
|
31
|
-
* Handles mapping, batching, and consent checks.
|
|
32
|
-
*
|
|
33
|
-
* @template Destination
|
|
34
|
-
* @param collector - The walkerOS collector instance.
|
|
35
|
-
* @param destination - The destination to push to.
|
|
36
|
-
* @param event - The event to push.
|
|
37
|
-
* @returns Whether the event was pushed successfully.
|
|
38
|
-
*/
|
|
39
|
-
export declare function destinationPush<Destination extends Destination.Instance>(collector: Collector.Instance, destination: Destination, event: WalkerOS.Event): Promise<boolean>;
|
|
40
|
-
/**
|
|
41
|
-
* Creates a standardized result object for push operations.
|
|
42
|
-
*
|
|
43
|
-
* @param partialResult - A partial result to merge with the default result.
|
|
44
|
-
* @returns The push result.
|
|
45
|
-
*/
|
|
46
|
-
export declare function createPushResult(partialResult?: Partial<Elb.PushResult>): Elb.PushResult;
|
|
47
|
-
/**
|
|
48
|
-
* Initializes a map of destinations using ONLY the unified code/config/env pattern.
|
|
49
|
-
* Does NOT call destination.init() - that happens later during push with proper consent checks.
|
|
50
|
-
*
|
|
51
|
-
* @param destinations - The destinations to initialize.
|
|
52
|
-
* @param collector - The collector instance for destination init context.
|
|
53
|
-
* @returns The initialized destinations.
|
|
54
|
-
*/
|
|
55
|
-
export declare function initDestinations(_collector: Collector.Instance, destinations?: Destination.InitDestinations): Promise<Collector.Destinations>;
|
|
56
|
-
/**
|
|
57
|
-
* Merges destination environment with config environment
|
|
58
|
-
* Config env takes precedence over destination env for overrides
|
|
59
|
-
*/
|
|
60
|
-
export declare function mergeEnvironments(destinationEnv?: Destination.Env, configEnv?: Destination.Env): Destination.Env;
|
|
61
|
-
//# sourceMappingURL=destination.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"destination.d.ts","sourceRoot":"","sources":["../src/destination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAmB5E;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,SAAS,EAAE,SAAS,CAAC,QAAQ,EAC7B,IAAI,EAAE,WAAW,CAAC,IAAI,EACtB,OAAO,CAAC,EAAE,WAAW,CAAC,MAAM,GAC3B,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CA2BzB;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,SAAS,CAAC,QAAQ,EAC7B,KAAK,CAAC,EAAE,QAAQ,CAAC,KAAK,EACtB,YAAY,CAAC,EAAE,SAAS,CAAC,YAAY,GACpC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAuIzB;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,WAAW,SAAS,WAAW,CAAC,QAAQ,EAC5E,SAAS,EAAE,SAAS,CAAC,QAAQ,EAC7B,WAAW,EAAE,WAAW,GACvB,OAAO,CAAC,OAAO,CAAC,CAmClB;AAED;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CAAC,WAAW,SAAS,WAAW,CAAC,QAAQ,EAC5E,SAAS,EAAE,SAAS,CAAC,QAAQ,EAC7B,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,QAAQ,CAAC,KAAK,GACpB,OAAO,CAAC,OAAO,CAAC,CA2FlB;AAED;;;;;GAKG;AACH,wBAAgB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