Skip to content

Commit

Permalink
Move enums from @types to @symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
alicja-gruzdz committed Feb 13, 2024
1 parent da6d2b4 commit 92ddbeb
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 37 deletions.
3 changes: 1 addition & 2 deletions packages/host/src/lib/csi-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
STHRestAPI,
STHConfiguration,
InstanceLimits,
InstanceStatus,
MonitoringMessageData,
InstanceStats,
OpResponse,
Expand All @@ -33,7 +32,7 @@ import {
MessageUtilities,
InstanceAdapterError,
} from "@scramjet/model";
import { CommunicationChannel as CC, RunnerExitCode, RunnerMessageCode } from "@scramjet/symbols";
import { CommunicationChannel as CC, InstanceStatus, RunnerExitCode, RunnerMessageCode } from "@scramjet/symbols";
import { Duplex, PassThrough, Readable } from "stream";
import { development } from "@scramjet/sth-config";

Expand Down
3 changes: 2 additions & 1 deletion packages/host/src/lib/serviceDiscovery/topic.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { TransformOptions, Readable, Transform } from "stream";
import { ContentType, WorkState, ReadableState, WritableState, StreamType, StreamOrigin, TopicHandler, TopicOptions, TopicState, ParsedMessage } from "@scramjet/types";
import { ContentType, StreamOrigin, TopicHandler, TopicOptions, TopicState, ParsedMessage } from "@scramjet/types";
import TopicId from "./topicId";
import { ReadableState, StreamType, WorkState, WritableState } from "@scramjet/symbols";

export enum TopicEvent {
StateChanged = "stateChanged",
Expand Down
2 changes: 2 additions & 0 deletions packages/symbols/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ export { SequenceMessageCode } from "./sequence-status-code";
export { OpRecordCode } from "./op-record-code";
export { APIErrorCode } from "./api-error-codes";
export { DisconnectHubErrors } from "./disconnect-error-codes";
export { InstanceStatus } from "./instance-status";

export * from "./sd-stream-handler-state";
export * from "./headers";
10 changes: 10 additions & 0 deletions packages/symbols/src/instance-status.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

export const enum InstanceStatus {
INITIALIZING = "initializing",
STARTING = "starting",
RUNNING = "running",
STOPPING = "stopping",
KILLING = "killing",
COMPLETED = "completed",
ERRORED = "errored",
}
23 changes: 23 additions & 0 deletions packages/symbols/src/sd-stream-handler-state.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export enum WorkState {
Flowing = "flowing",
Close = "close",
Error = "error"
}

export enum WritableState {
Finish = "finish",
Writable = "writable",
Drain = "drain"
}

export enum ReadableState {
Readable = "readable",
Pause = "pause",
End = "end"
}

export enum StreamType {
Instance = "instance",
Topic = "topic",
Api = "api"
}
3 changes: 2 additions & 1 deletion packages/types/src/instance-store.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { InstanceStatus } from "@scramjet/symbols";
import { AppConfig } from "./app-config";
import { InstanceArgs, InstanceId, InstanceStatus } from "./instance";
import { InstanceArgs, InstanceId } from "./instance";
import { SequenceInfoInstance } from "./sequence-adapter";

export type Instance = {
Expand Down
10 changes: 0 additions & 10 deletions packages/types/src/instance.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
export type InstanceId = string;

export type InstanceArgs = any[];

export const enum InstanceStatus {
INITIALIZING = "initializing",
STARTING = "starting",
RUNNING = "running",
STOPPING = "stopping",
KILLING = "killing",
COMPLETED ="completed",
ERRORED = "errored",
}
24 changes: 1 addition & 23 deletions packages/types/src/sd-stream-handler.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,7 @@
export enum WorkState {
Flowing = "flowing",
Close = "close",
Error = "error"
}

export enum WritableState {
Finish = "finish",
Writable = "writable",
Drain = "drain"
}

export enum ReadableState {
Readable = "readable",
Pause = "pause",
End = "end"
}
import { WorkState, WritableState, ReadableState, StreamType } from "@scramjet/symbols";

export type StreamState = WorkState | WritableState | ReadableState;

export enum StreamType {
Instance = "instance",
Topic = "topic",
Api = "api"
}

export type StreamOptions = Record<string, any>;

export type OriginType = "space" | "hub"
Expand Down

0 comments on commit 92ddbeb

Please sign in to comment.