Skip to content

Commit

Permalink
fixed: types
Browse files Browse the repository at this point in the history
  • Loading branch information
Viktor Pasynok committed Nov 3, 2024
1 parent 63fc82e commit 8e6d984
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/compose/index.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
import { type AnyContainer } from '../createContainer';

// todo: avoid cycle deps
// todo: compose fn to wrap em all | like basic compose fn + passing api (no need to save em all. just reverse pipe)
// todo: think about dynamic feature stop
// todo: clearNode $strictDepsResolvingStatus after start
// // // compose.up -> wait for all deps -> check enable -> set status -> start if pending
// compose.up -> wait for all deps -> check enable -> set status -> start if pending

const upFn = (list: AnyContainer[]) => {
const upFn = (containers: AnyContainer[]) => {
const CONTAINER_IDS = new Set();

for (const container of list) {
for (const container of containers) {
if (CONTAINER_IDS.has(container.id)) {
throw new Error(`Duplicate container ID found: ${container.id}`);
}
CONTAINER_IDS.add(container.id);
}

for (const container of list) {
}
};

const compose = { up: upFn };

export { compose };
// todo: think about dynamic feature stop
2 changes: 2 additions & 0 deletions src/createContainer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ type Container<Id extends string, StartFn extends AnyStartFn> = {
id: Id;
$status: Store<Status>;
start: StartFn;
dependsOn?: AnyContainer[];
optionalDependsOn?: AnyContainer[];
};
type AnyContainer = Container<string, AnyStartFn>;

Expand Down

0 comments on commit 8e6d984

Please sign in to comment.