function processAlgebraicTypeCreationRequest()

in src/algebraic-types.ts [124:167]


function processAlgebraicTypeCreationRequest(
  options: GenerationOptions,
  future: Promise.Future<
    Either.Either<Error.Error[], AlgebraicTypeCreationContext>
  >,
  either: Either.Either<Error.Error[], PathAndTypeInfo>,
): Promise.Future<
  Logging.Context<Either.Either<Error.Error[], FileWriter.FileWriteRequest>>
> {
  return Promise.map(function (
    creationContextEither: Either.Either<
      Error.Error[],
      AlgebraicTypeCreationContext
    >,
  ) {
    return Logging.munit(
      Either.mbind(function (pathAndTypeInfo: PathAndTypeInfo) {
        return Either.mbind(function (
          creationContext: AlgebraicTypeCreationContext,
        ) {
          const request: AlgebraicTypeCreation.Request = {
            diagnosticIgnores: creationContext.diagnosticIgnores,
            baseClassLibraryName: creationContext.baseClassLibraryName,
            baseClassName: creationContext.baseClassName,
            path: pathAndTypeInfo.path,
            outputPath: options.outputPath,
            outputFlags: options.outputFlags,
            typeInformation: typeInformationContainingDefaultIncludes(
              pathAndTypeInfo.typeInformation,
              creationContext.defaultIncludes,
            ),
          };

          return AlgebraicTypeCreation.fileWriteRequest(
            request,
            creationContext.plugins,
          );
        },
        creationContextEither);
      }, either),
    );
  },
  future);
}