Skip to content

Latest commit

 

History

History
94 lines (76 loc) · 3.37 KB

ARCH.md

File metadata and controls

94 lines (76 loc) · 3.37 KB

OBIS architecture notes

Folders:

  • _mock-server/ - For running a "fake" HSBC site for testing
  • common/ - General client/server helpers
  • plugins/<bank-name>/plugin.json
  • ui/ - OBIS main UI + statements-browser

The OBIS UI is built with Mithril.js and Statebot, hence the state-charts:

Application state-chart

stateDiagram-v2
  %% Happy path
  %%
    idle --> getting_accounts
    getting_accounts --> found_accounts
    found_accounts --> getting_statements
    getting_statements --> found_statements
    found_statements --> getting_entries
    getting_entries --> found_entries

  %% Downloading Zip
  %%
    found_entries --> download_all
    download_all --> found_entries

  %% Failures
  %%
    getting_accounts --> failed_accounts
    failed_accounts --> idle
    getting_statements --> failed_statements
    failed_statements --> idle
    getting_entries --> failed_entries
    failed_entries --> idle

Loading

The HSBC UK parser uses JMESPath, which takes a great deal of tedium out of parsing JSON API responses.

Build system overview

Build commands:

pnpm run build:all    # create dist/
pnpm run debug        # watch build + run mock-data server
pnpm run debug:live   # run server for testing against a live site

Flow:

.----------.
| build.js |
'-+--------'
  |
  |   .---------.                            .----------------.
  +---> esbuild +--------------------------+-> bookmarklet.js +--------+
  |   '---------'                          | '----------------'        |
  |                                        |                           |
  |   .----------------------------.       | .---------.               |
  +---> src/plugins/**/plugin.json |       +-> main.js +---------------+
      '---+------------------------'         '---------'               |
          |                                                            |
          |   .------------------------.     .-------------------.     |
          +---> { name } = plugin.json +-----> ${name}/plugin.js |     |
          |   '------------------------'     '----+--------------'     |
          |                                       |                    |
          |                                  .----v----.               |
          |   .-----------------.            | esbuild +-----+         |
          +---> Create registry |            '---------'     |         |
              | > plugins.js    |                            |         |
              '--------+--------'                            |         |
                       |                                     |         |
                       |                               .-----v-----.   |
                       |                               |           |   |
                       +------------------------------->   dist/   <---+
                                                       |           |
                                                       '-----------'

Module aliases

@/ = src/common

Configured: Used by:
package.json module-alias/register used by build.js and _mock-server
jsconfig.json esbuild