https://github.com/uber5/u5-derive
Given complex business logic in Javascript and MongoDB, derive properties functionally
https://github.com/uber5/u5-derive
Last synced: 22 days ago
JSON representation
Given complex business logic in Javascript and MongoDB, derive properties functionally
- Host: GitHub
- URL: https://github.com/uber5/u5-derive
- Owner: Uber5
- Created: 2017-04-03T04:51:27.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T21:39:22.000Z (over 3 years ago)
- Last Synced: 2025-02-07T08:57:34.702Z (over 1 year ago)
- Language: JavaScript
- Size: 2.17 MB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# u5-derive
Given complex business logic in Javascript and MongoDB, derive properties functionally.
In other words:
* Given
* business data in MongoDB,
* a description of derivable properties (see ./samples/simple/domain.js)
* When
* state changes
* then
* Derive properties.
# Status
Erm, don't use, not ready.
# Run a REPL
This is experimental, it runs a REPL for one of the samples:
```
./node_modules/.bin/babel-node ./samples/simple/index.js
```
# Documentation
There is [experimental documentation](https://uber5.github.io/u5-derive/public/current/).
## Generate Documentation
Checkout `gh-pages` branch, then run `./scripts/update-docs.sh`. (It *should*
merge master and build docs etc.)
# Run Tests
* Make *sure* you do the configuration to your MongoDB instance below.
* Note that by default `mongodb://localhost/u5-derive-test` will be used when
running the test, as per
[__tests__/config.js](./src/__tests__/config.js).
* Once done:
```bash
npm run test
```
# Configuration
Currently needed:
- `MONGO_TAIL_URL`
- `MONGO_TAIL_DATABASE_NAME`
- `MONGO_URL`
In addition, your local mongod may have to be configured as a standalone replica set:
* Make sure you run `mongod` with the parameter `--replSet test` (where "test"
is the name of the replSet, could be a different name).
* initiate the replSet (inside a mongo shell) with:
```
rs.initiate({ _id: "test", version: 1, members: [ { _id: 1, host: "localhost:27017" } ] })
```
If you don't do this, you may get errors about "cursor not tailable" or similar.
# On the Implementation and Terminology
(just a beginning)
In order to speak about domain models, we require potentially unfamiliar, abstract
terminology: We can't say any more
"one person has many addresses" (concrete), we have to look at
"is it a to-one or a to-many association".
For this, terminology should (but currently isn't, at least not fully) aligned
with the
[UML terminology](https://en.wikipedia.org/wiki/Glossary_of_Unified_Modeling_Language_terms).