Skip to content

Commit dd278a8

Browse files
direct pushes
1 parent 853a710 commit dd278a8

File tree

5 files changed

+12
-21
lines changed

5 files changed

+12
-21
lines changed

packages/sources/node/src/lib/handle.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,3 @@ export const handleCommand: SourceNode.HandleCommand = async (
5353

5454
return createPushResult(result);
5555
};
56-
57-
export const handleEvent: SourceNode.HandleEvent = async (instance, event) => {
58-
return await pushToDestinations(instance, event);
59-
};

packages/sources/node/src/lib/push.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import type { WalkerOS } from '@elbwalker/types';
22
import type { SourceNode, Elb } from '../types';
3-
import { assign, isCommand, isSameType, tryCatchAsync } from '@elbwalker/utils';
4-
import { handleCommand, handleEvent } from './handle';
3+
import {
4+
assign,
5+
isCommand,
6+
isSameType,
7+
pushToDestinations,
8+
tryCatchAsync,
9+
} from '@elbwalker/utils';
10+
import { handleCommand } from './handle';
511

612
export function createPush(instance: SourceNode.Instance): Elb.Fn {
713
const push = async (
@@ -39,7 +45,7 @@ export function createPush(instance: SourceNode.Instance): Elb.Fn {
3945
result = assign(result, commandResult);
4046
} else if (event) {
4147
// Regular event
42-
const eventResult = await handleEvent(instance, event);
48+
const eventResult = await pushToDestinations(instance, event);
4349
result = assign(result, eventResult);
4450
result.event = event;
4551
}

packages/sources/node/src/types/source.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ export type HandleCommand = (
3838
options?: PushOptions,
3939
) => Promise<Elb.PushResult>;
4040

41-
export type HandleEvent = (
42-
instance: Instance,
43-
event: WalkerOS.Event,
44-
) => Promise<Elb.PushResult>;
45-
4641
export interface Command {
4742
name: string;
4843
data: unknown;

packages/sources/walkerjs/src/lib/handle.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,3 @@ export async function handleCommand(
8383

8484
return createPushResult(result);
8585
}
86-
87-
export async function handleEvent(
88-
instance: SourceWalkerjs.Instance,
89-
event: WalkerOS.Event,
90-
): Promise<Elb.PushResult> {
91-
return await pushToDestinations(instance, event);
92-
}

packages/sources/walkerjs/src/lib/push.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { WalkerOS } from '@elbwalker/types';
22
import type { Elb, SourceWalkerjs } from '../types';
3-
import { handleCommand, handleEvent } from './handle';
3+
import { handleCommand } from './handle';
44
import {
55
Const,
66
assign,
@@ -11,6 +11,7 @@ import {
1111
isObject,
1212
isSameType,
1313
isString,
14+
pushToDestinations,
1415
tryCatchAsync,
1516
useHooks,
1617
} from '@elbwalker/utils';
@@ -56,7 +57,7 @@ export function createPush(instance: SourceWalkerjs.Instance): Elb.Fn {
5657
await handleCommand(instance, command, pushData, options);
5758
} else if (event) {
5859
// Regular event
59-
await handleEvent(instance, event);
60+
await pushToDestinations(instance, event);
6061
}
6162

6263
return assign({ status: { ok: true } }, result);

0 commit comments

Comments
 (0)