Skip to content

Commit

Permalink
finish impement find depdencies
Browse files Browse the repository at this point in the history
  • Loading branch information
WMXPY committed Oct 15, 2023
1 parent 13248ec commit fec945e
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions src/orchestration/procedure/find-depdencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ export const findProcedureDependencies = (
): Array<PubProcedureConfiguration<PUB_PROCEDURE_TYPE>> => {

const dependencyProcedures: Array<PubProcedureConfiguration<PUB_PROCEDURE_TYPE>> =
connections
.filter((connection: PubConnectionConfiguration<PUB_CONNECTION_TYPE>) =>
connection.nextProcedure.type === PUB_CONNECTION_PROCEDURE_REFERENCE_TYPE.PROCEDURE,
)
record.cachedConfiguration.configuration.connections
.filter((connection: PubConnectionConfiguration<PUB_CONNECTION_TYPE>) => {
return connection.type === PUB_CONNECTION_TYPE.DIRECT;
})
.filter((connection: PubConnectionConfiguration<PUB_CONNECTION_TYPE>) => {
return connection.nextProcedure.type === PUB_CONNECTION_PROCEDURE_REFERENCE_TYPE.PROCEDURE;
})
.map((connection: PubConnectionConfiguration<PUB_CONNECTION_TYPE>) => {

const nextProcedure: PubConnectionProcedureReference<
Expand All @@ -28,18 +31,24 @@ export const findProcedureDependencies = (
PUB_CONNECTION_PROCEDURE_REFERENCE_TYPE.PROCEDURE
>;

const procedure: PubProcedureConfiguration<PUB_PROCEDURE_TYPE> | null =
return nextProcedure.payload.procedureIdentifier;
})
.filter((nextProcedureIdentifier: string) => {
return nextProcedureIdentifier === procedure.identifier;
})
.map((nextProcedureIdentifier: string) => {

const dependencyProcedure: PubProcedureConfiguration<PUB_PROCEDURE_TYPE> | null =
record.cachedConfiguration.getProcedureByIdentifier(
nextProcedure.payload.procedureIdentifier,
nextProcedureIdentifier,
);

if (!procedure) {
if (dependencyProcedure === null) {
throw PubExecuteConfigurationProcedureNotFoundError.withIdentifier(
nextProcedure.payload.procedureIdentifier,
nextProcedureIdentifier,
);
}

return procedure;
return dependencyProcedure;
});

return dependencyProcedures;
Expand Down

0 comments on commit fec945e

Please sign in to comment.