Skip to content

Commit

Permalink
prevent reexports
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderkirtzel committed Feb 17, 2025
1 parent 97baa1b commit 9dd0024
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 22 deletions.
6 changes: 3 additions & 3 deletions packages/sources/node/src/types/destination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {
Mapping as WalkerOSMapping,
WalkerOS,
} from '@elbwalker/types';
import type { SourceNode } from '.';
import type { Instance } from './source';

export interface Destination<Custom = unknown, CustomEvent = unknown>
extends WalkerOSDestination.Destination<Custom, CustomEvent> {
Expand All @@ -20,7 +20,7 @@ export type DestinationInit = Partial<Omit<Destination, 'push'>> &

export type InitFn<PartialConfig = unknown, Config = unknown> = (
config: PartialConfig,
instance?: SourceNode.Instance,
instance?: Instance,
) => Promise<void | Config | false>;

export type PushFn<Custom, CustomEvent> = (
Expand All @@ -41,7 +41,7 @@ export interface EventMapping<CustomEvent = unknown>

export interface Options {
data?: WalkerOSDestination.Data;
instance?: SourceNode.Instance;
instance?: Instance;
}

export type PushEvent<CustomEvent = unknown> =
Expand Down
20 changes: 11 additions & 9 deletions packages/sources/node/src/types/elb.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { Elb, WalkerOS } from '@elbwalker/types';
import { DestinationNode, SourceNode } from '.';
import type { Destination, DestinationInit, Config } from './destination';
import { PushResult as PushResultDest } from './destination';
import { State, Status } from './source';

export interface Fn<R = Return, D = PushData, O = PushOptions>
extends Elb.Fn<R, D, O>,
Expand All @@ -8,22 +10,22 @@ export interface Fn<R = Return, D = PushData, O = PushOptions>

export type CommandDestination<R = void> = (
event: 'walker destination',
destination: DestinationNode.Destination | DestinationNode.DestinationInit,
config?: DestinationNode.Config,
destination: Destination | DestinationInit,
config?: Config,
) => R;
export type CommandRun<R = void> = (event: 'walker run') => R;

export type PushData =
| Elb.PushData
| DestinationNode.Destination
| DestinationNode.DestinationInit
| Partial<SourceNode.State>;
| Destination
| DestinationInit
| Partial<State>;

export type PushOptions = Elb.PushOptions | DestinationNode.Config;
export type PushOptions = Elb.PushOptions | Config;

export interface PushResult extends DestinationNode.PushResult {
export interface PushResult extends PushResultDest {
event?: WalkerOS.Event;
status: SourceNode.Status;
status: Status;
}

export type Return<R = Promise<PushResult>> = R;
22 changes: 12 additions & 10 deletions packages/sources/node/src/types/source.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import type { WalkerOS, Schema, Handler, Hooks } from '@elbwalker/types';
import type { DestinationNode, Elb, On } from '.';
import type { Fn, PushData, PushOptions, PushResult } from './elb';
import type { Destination } from './destination';
import type { Config as OnConfig } from './on';

export interface Instance extends State, WalkerOS.Instance {
config: Config;
destinations: Destinations;
version: string;
push: Elb.Fn;
push: Fn;
}

export interface State extends WalkerOS.State {
config: Config;
destinations: Destinations;
on: On.Config;
on: OnConfig;
session: undefined | WalkerOS.SessionData;
timing: number;
}
Expand All @@ -30,26 +32,26 @@ export interface InitConfig extends Partial<Config> {
custom?: WalkerOS.Properties;
destinations?: Destinations;
hooks?: Hooks.Functions;
on?: On.Config;
on?: Config;
tagging?: number;
user?: WalkerOS.User;
}

export interface AddDestination {
(id: string, destination: DestinationNode.Destination): void;
(id: string, destination: Destination): void;
}

export type HandleCommand = (
instance: Instance,
action: string,
data?: Elb.PushData,
options?: Elb.PushOptions,
) => Promise<Elb.PushResult>;
data?: PushData,
options?: PushOptions,
) => Promise<PushResult>;

export type HandleEvent = (
instance: Instance,
event: WalkerOS.Event,
) => Promise<Elb.PushResult>;
) => Promise<PushResult>;

export interface Command {
name: string;
Expand All @@ -62,7 +64,7 @@ export interface Status {
}

export interface Destinations {
[key: string]: DestinationNode.Destination;
[key: string]: Destination;
}

export type PrependInstance<Fn extends (...args: never) => ReturnType<Fn>> = (
Expand Down

0 comments on commit 9dd0024

Please sign in to comment.