function processObjectSpecCreationRequest()

in src/object-specs.ts [111:154]


function processObjectSpecCreationRequest(
  options: GenerationOptions,
  future: Promise.Future<
    Either.Either<Error.Error[], ObjectSpecCreationContext>
  >,
  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[],
      ObjectSpecCreationContext
    >,
  ) {
    return Logging.munit(
      Either.mbind(function (pathAndTypeInfo: PathAndTypeInfo) {
        return Either.mbind(function (
          creationContext: ObjectSpecCreationContext,
        ) {
          const request: ObjectSpecCreation.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 ObjectSpecCreation.fileWriteRequest(
            request,
            creationContext.plugins,
          );
        },
        creationContextEither);
      }, either),
    );
  },
  future);
}