[–] [S] 2 points 2 months ago

You can handle complex branching using standard JavaScript. Since every pipeline is just a function returning data, you can use if/else or map to return different sub-pipelines and commands from within your logic functions. Here's an example:

const processUsersFlow = () => 
  effectPipe(
    fetchAllUsers,
    (users) => {
      const tasks = users.map(user => {
        if (user.isAdmin) return syncAdminPermissions(user); // Sub-pipeline
        if (user.isGuest) return cleanupGuestAccount(user);  // Sub-pipeline
        return notifyUser(user); // Simple Command
      });

      return Parallel(tasks); 
    }
  )();
  • source
  • parent
  • context
  • [–] [S] 1 point 7 months ago

    I think you might be focusing on the execution of the request rather than the orchestration. The decision of when and why to make an API request is absolutely business logic. In imperative code, that logic is hard-coded to the execution. By separating the intent from the execution, we can test that decision flow without spinning up the infrastructure.

  • source
  • parent
  • context
  • [–] [S] 1 point 7 months ago (2 children)

    Integration tests against a real database can and should still be performed. The idea here is the ability to test business logic in isolation without using mocks. Effect systems also have other benefits. You basically get cross-cutting concerns like logging and profiling for free. Every single database call, API request, and file read in your entire application can be easily logged and profiled.

  • source
  • parent
  • context
  • [–] [S] 1 point 8 months ago* (last edited 8 months ago) (2 children)

    Author here. In my experience, AI coding tools like Claude Code can write code in the Effect system style, and that could be a great starting point for getting developers not familiar with this approach on board.

    I considered adding JSDoc type annotations, but that would make the code a bit verbose.

  • source
  • parent
  • context
  • [–] [S] -1 points 2 years ago (1 child)

    Perhaps I was unclear. What I meant to say is that, whenever possible, we shouldn't have multiple versions of a field, especially when there is no corresponding plaintext password field in the database, as is the case here.

  • source
  • parent
  • context
  • [+] [S] -6 points 2 years ago (5 children)

    I appreciate the security concerns, but I wouldn't consider overriding the password property with the hashed password to be wrong. Raw passwords are typically only needed in three places: user creation, login, and password reset. I'd argue that having both password and hashedPassword properties in the user object may actually lead to confusion, since user objects are normally used in hundreds of places throughout the codebase. I think, when applicable, we should consider balancing security with code maintainability by avoiding redundancy and potential confusion.

  • source
  • parent
  • context
  • [–] [S] 7 points 2 years ago

    Seriously, why the negative tone? If I've offended you, I'm sorry. You might think that I'm wasting time, but there are multiple ways to skin a cat. I prefer not to use DEB packages for deployment, though others might.

  • source
  • parent
  • context
  • [–] [S] 4 points 2 years ago

    Cleanup can be as simple as deleting the latest deployment directory, if the script gets that far. The article is about using built-in Linux tools for 'easy' application deployments. One can also use dedicated tools, as you suggested, to further automate the deployment process.

  • source
  • parent
  • context
  • view more: next ›