Skip to content

Commit

Permalink
chore: minor code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
danielduarte committed Sep 9, 2023
1 parent 297b266 commit f433316
Show file tree
Hide file tree
Showing 39 changed files with 1,849 additions and 892 deletions.
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
2. Click on '...'
3. Scroll down to '...'
4. See error

**Expected behavior**
Expand All @@ -25,7 +25,7 @@ If applicable, add screenshots to help explain your problem.

**Environment (please complete the following information):**
- OS: [e.g. iOS]
- Node JS version: [e.g. chrome, safari]
- Node.js version: [e.g. 20.5.0, 10]
- Version: [e.g. 1.2.0]

**Additional context**
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
node-version: [12.x, 14.x, 16.x, 17.x]
node-version: [12.x, 14.x, 16.x, 17.x, 18.x]

steps:
- uses: actions/checkout@v2
Expand Down
3 changes: 1 addition & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json.schemastore.org/prettierrc",
"$schema": "https://json.schemastore.org/prettierrc",
"printWidth": 150,
"trailingComma": "all",
"singleQuote": true,
Expand All @@ -10,7 +10,6 @@
"requirePragma": false,
"proseWrap": "preserve",
"plugins": [],
"pluginSearchDirs": [],
"insertPragma": false,
"endOfLine": "auto",
"arrowParens": "avoid",
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center"><a href="https://danielduarte.github.io/flowed/"><img width="445" height="100" src="./doc/flowed-logo.svg" alt="Flowed Logo"></a></p>
<p align="center">A fast and reliable flow engine for orchestration and more uses in <em>Node.js</em>, <em>Deno</em> and the browser.</p>
<p align="center">
<p style="text-align: center"><a href="https://danielduarte.github.io/flowed/"><img width="445" height="100" src="./doc/flowed-logo.svg" alt="Flowed Logo"></a></p>
<p style="text-align: center">A fast and reliable flow engine for orchestration and more uses in <em>Node.js</em>, <em>Deno</em> and the browser.</p>
<p style="text-align: center">
<a href="https://github.com/danielduarte/flowed/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/flowed?color=%23007ec6" alt="License"></a>
<a href="https://www.npmjs.com/package/flowed"><img src="https://img.shields.io/npm/v/flowed" alt="NPM Package Version"></a>
<a href="https://app.fossa.com/attribution/e587cd9b-f7f8-4fa6-88b1-f81832d9ce07"><img src="https://app.fossa.com/api/projects/custom%2B13599%2Fgithub.com%2Fdanielduarte%2Fflowed.svg?type=shield" alt="FOSSA Status"></a>
Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Supported Versions

| Version | Supported |
| -------- | ------------------ |
|----------|--------------------|
| >= 1.0.0 | :white_check_mark: |
| < 1.0.0 | :x: |

Expand Down
10 changes: 5 additions & 5 deletions doc/resolver-library.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Note that the context is not passed as parameter because it is shared from the o
**params**:
- `flowSpec`: Flow spec to be run as a sub-flow.
- `flowParams`: Key-Value object to be used as parameters for the sub-flow.
- `flowExpectedResults`: String array to specified the expected results.
- `flowExpectedResults`: String array to specify the expected results.
- `flowResolvers`: Resolvers map to run the sub-flow.

**results**:
Expand All @@ -133,8 +133,8 @@ If one execution fails, the resolver ends with an exception (in both parallel an
- `count`: Number of times the task is going to be executed.
- `taskParams`: Array of Key-Value objects with params.
- `resolverAutomapParams`: Boolean to indicate if params in task are going to be auto-mapped or need explicit mapping. Defaults to false.
- `resolverAutomapResults`: Boolean to indicate if resuts in task are going to be auto-mapped or need explicit mapping. Defaults to false.
- `flowId`: Flow Id to be used in debugging messages.
- `resolverAutomapResults`: Boolean to indicate if results in task are going to be auto-mapped or need explicit mapping. Defaults to false.
- `flowId`: Flow id to be used in debugging messages.
- `parallel`: Boolean to specify if the task instances can run in parallel or in sequence (waiting one to finish before starting the next one).

**results**:
Expand All @@ -157,8 +157,8 @@ The task instances can be run in parallel or in sequence. In both cases the orde
- `spec`: Task spec.
- `params`: Array of Key-Value objects with params.
- `automapParams`: Boolean to indicate if params in task are going to be auto-mapped or need explicit mapping. Defaults to false.
- `automapResults`: Boolean to indicate if resuts in task are going to be auto-mapped or need explicit mapping. Defaults to false.
- `flowId`: Flow Id to be used in debugging messages.
- `automapResults`: Boolean to indicate if results in task are going to be auto-mapped or need explicit mapping. Defaults to false.
- `flowId`: Flow id to be used in debugging messages.
- `parallel`: Boolean to specify if the task instances can run in parallel or in sequence (waiting one to finish before starting the next one).

**results**:
Expand Down
10 changes: 5 additions & 5 deletions doc/tutorial.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Use Case

> A system needs to verify user locations to limit the access to certail features.
> A system needs to verify user locations to limit the access to certain features.
> Depending on the user location, she/he is authorized or not.

Expand Down Expand Up @@ -312,7 +312,7 @@ In real world, database access, HTTP requests, file operations, etc. will not be

So in our example class `LoadAuthLocations`, we wouldn't actually run that way.
Instead, you'd need to use the Flowed support for async tasks.
In order to support asynchronic tasks, Flowed takes advantage of `Promise`s.
In order to support asynchronous tasks, Flowed takes advantage of `Promise`s.

And that's as easy as returning a Promise that resolves to the expected results.

Expand All @@ -330,10 +330,10 @@ class LoadAuthLocations {
Note that we've added the `async` keyword to `exec`, and we've used the `await` syntax.
Also remember that all `async` functions returns a Promise, even when it is not explicit.

According to each flow tasks' dependences, Flowed will run concurrently as many tasks as possible, letting the OS parallelize all the I/O opertions maximizing the performance and abstracting the programmer to manage the tasks dependences and concurrency.
According to each flow tasks' dependencies, Flowed will run concurrently as many tasks as possible, letting the OS parallelize all the I/O operations maximizing the performance and abstracting the programmer to manage the tasks dependencies and concurrency.


## Connect with the outsite
## Connect with the outside

To make this thing really useful, we need a way to connect with the outside of the flow.
Even when a flow can execute useful tasks without giving a explicit output (writing to databases, etc), it is very usual to get some direct output from the flow.
Expand All @@ -343,7 +343,7 @@ For example, in this case we want to know if the user is authorized, which is th
We will run the flow then, indicating that the expected results are `['isAuthorized']`.


In a similar way, it is very important for flexibility and reusability purposes to provide some way of parametrization for the flows.
In a similar way, it is very important for flexibility and re-usability purposes to provide some way of parametrization for the flows.
Analyzing the flow in this example, we can easily see that no task is providing the `'sessionId'`. This is because it will be given from the outside, at the time of the execution.
That is, it is a flow parameter.
We provide parameters as a name-value mapping like this:
Expand Down
Loading

0 comments on commit f433316

Please sign in to comment.