Compare commits
40 Commits
Author | SHA1 | Date | |
---|---|---|---|
5d73b337aa | |||
aa8fd8b47d | |||
2bc50c6714 | |||
3f8e2045e5 | |||
da6676fdc1 | |||
96d50962ea | |||
5377a91cfd | |||
71f8dc7685 | |||
44de2dadab | |||
d848387715 | |||
0d9d365673 | |||
e731e017bb | |||
834ba90170 | |||
d78183e596 | |||
82d30a93c8 | |||
51d894cba7 | |||
bef9349216 | |||
2017634f87 | |||
56460edeb2 | |||
e2851b36d0 | |||
7f9ef12b61 | |||
d3e39fcdf2 | |||
f79c03afc5 | |||
804d7f51f9 | |||
e5cae293eb | |||
49bc354d01 | |||
c7ce7af521 | |||
84c6a599ac | |||
64e334761e | |||
d2014b8e96 | |||
fd3932976d | |||
c0539be66e | |||
00e5a96f05 | |||
53aada4638 | |||
9724813028 | |||
e5b39e0709 | |||
12242006aa | |||
2e0164eaf0 | |||
163f4c0154 | |||
7afcabf3f9 |
66
.gitea/workflows/default_nottags.yaml
Normal file
66
.gitea/workflows/default_nottags.yaml
Normal file
@ -0,0 +1,66 @@
|
||||
name: Default (not tags)
|
||||
|
||||
on:
|
||||
push:
|
||||
tags-ignore:
|
||||
- '**'
|
||||
|
||||
env:
|
||||
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
||||
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||
|
||||
jobs:
|
||||
security:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install pnpm and npmci
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
|
||||
- name: Run npm prepare
|
||||
run: npmci npm prepare
|
||||
|
||||
- name: Audit production dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --prod
|
||||
continue-on-error: true
|
||||
|
||||
- name: Audit development dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --dev
|
||||
continue-on-error: true
|
||||
|
||||
test:
|
||||
if: ${{ always() }}
|
||||
needs: security
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Test stable
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm test
|
||||
|
||||
- name: Test build
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm build
|
124
.gitea/workflows/default_tags.yaml
Normal file
124
.gitea/workflows/default_tags.yaml
Normal file
@ -0,0 +1,124 @@
|
||||
name: Default (tags)
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
env:
|
||||
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
||||
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||
|
||||
jobs:
|
||||
security:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Audit production dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --prod
|
||||
continue-on-error: true
|
||||
|
||||
- name: Audit development dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --dev
|
||||
continue-on-error: true
|
||||
|
||||
test:
|
||||
if: ${{ always() }}
|
||||
needs: security
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Test stable
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm test
|
||||
|
||||
- name: Test build
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm build
|
||||
|
||||
release:
|
||||
needs: test
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Release
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm publish
|
||||
|
||||
metadata:
|
||||
needs: test
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
continue-on-error: true
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Code quality
|
||||
run: |
|
||||
npmci command npm install -g typescript
|
||||
npmci npm install
|
||||
|
||||
- name: Trigger
|
||||
run: npmci trigger
|
||||
|
||||
- name: Build docs and upload artifacts
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
pnpm install -g @git.zone/tsdoc
|
||||
npmci command tsdoc
|
||||
continue-on-error: true
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -15,8 +15,6 @@ node_modules/
|
||||
|
||||
# builds
|
||||
dist/
|
||||
dist_web/
|
||||
dist_serve/
|
||||
dist_ts_web/
|
||||
dist_*/
|
||||
|
||||
# custom
|
126
.gitlab-ci.yml
126
.gitlab-ci.yml
@ -1,16 +1,16 @@
|
||||
# gitzone standard
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
# gitzone ci_default
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- .npmci_cache/
|
||||
key: "$CI_BUILD_STAGE"
|
||||
- .npmci_cache/
|
||||
key: '$CI_BUILD_STAGE'
|
||||
|
||||
stages:
|
||||
- security
|
||||
- test
|
||||
- release
|
||||
- metadata
|
||||
- security
|
||||
- test
|
||||
- release
|
||||
- metadata
|
||||
|
||||
# ====================
|
||||
# security stage
|
||||
@ -18,102 +18,114 @@ stages:
|
||||
mirror:
|
||||
stage: security
|
||||
script:
|
||||
- npmci git mirror
|
||||
- npmci git mirror
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
snyk:
|
||||
auditProductionDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install -g snyk
|
||||
- npmci command npm install --ignore-scripts
|
||||
- npmci command snyk test
|
||||
- npmci command npm install --production --ignore-scripts
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command npm audit --audit-level=high --only=prod --production
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
- docker
|
||||
|
||||
auditDevDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install --ignore-scripts
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command npm audit --audit-level=high --only=dev
|
||||
tags:
|
||||
- docker
|
||||
allow_failure: true
|
||||
|
||||
# ====================
|
||||
# test stage
|
||||
# ====================
|
||||
|
||||
testLTS:
|
||||
testStable:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install lts
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
testSTABLE:
|
||||
- docker
|
||||
|
||||
testBuild:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci command npm run build
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
- docker
|
||||
|
||||
release:
|
||||
stage: release
|
||||
script:
|
||||
- npmci node install stable
|
||||
- npmci npm publish
|
||||
- npmci node install stable
|
||||
- npmci npm publish
|
||||
only:
|
||||
- tags
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
# ====================
|
||||
# metadata stage
|
||||
# ====================
|
||||
codequality:
|
||||
stage: metadata
|
||||
image: docker:stable
|
||||
allow_failure: true
|
||||
services:
|
||||
- docker:stable-dind
|
||||
only:
|
||||
- tags
|
||||
script:
|
||||
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
||||
- docker run
|
||||
--env SOURCE_CODE="$PWD"
|
||||
--volume "$PWD":/code
|
||||
--volume /var/run/docker.sock:/var/run/docker.sock
|
||||
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
|
||||
artifacts:
|
||||
paths: [codeclimate.json]
|
||||
- npmci command npm install -g tslint typescript
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
||||
tags:
|
||||
- docker
|
||||
- priv
|
||||
- lossless
|
||||
- docker
|
||||
- priv
|
||||
|
||||
trigger:
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci trigger
|
||||
- npmci trigger
|
||||
only:
|
||||
- tags
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
pages:
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci command npm install -g @gitzone/tsdoc
|
||||
- npmci node install lts
|
||||
- npmci command npm install -g @git.zone/tsdoc
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command tsdoc
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
only:
|
||||
@ -121,5 +133,5 @@ pages:
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
paths:
|
||||
- public
|
||||
- public
|
||||
allow_failure: true
|
||||
|
11
.vscode/launch.json
vendored
Normal file
11
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"command": "npm test",
|
||||
"name": "Run npm test",
|
||||
"request": "launch",
|
||||
"type": "node-terminal"
|
||||
}
|
||||
]
|
||||
}
|
26
.vscode/settings.json
vendored
Normal file
26
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"json.schemas": [
|
||||
{
|
||||
"fileMatch": ["/npmextra.json"],
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"npmci": {
|
||||
"type": "object",
|
||||
"description": "settings for npmci"
|
||||
},
|
||||
"gitzone": {
|
||||
"type": "object",
|
||||
"description": "settings for gitzone",
|
||||
"properties": {
|
||||
"projectType": {
|
||||
"type": "string",
|
||||
"enum": ["website", "element", "service", "npm", "wcc"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
50
changelog.md
Normal file
50
changelog.md
Normal file
@ -0,0 +1,50 @@
|
||||
# Changelog
|
||||
|
||||
## 2024-07-05 - 1.0.28 - fix(documentation)
|
||||
Updated documentation in readme.md
|
||||
|
||||
- Fixed and elaborated on the installation steps for npm and yarn.
|
||||
- Added usage examples and interfaces overview sections.
|
||||
- Included sections on advanced usage scenarios like handling multiple CSV files, transaction filtering and aggregation.
|
||||
|
||||
## 2024-07-02 - 1.0.27 - fix(core)
|
||||
Fix npm package availability links and status badges in readme.md
|
||||
|
||||
- Updated npm, GitLab, and GitHub links in readme.md.
|
||||
- Enhanced status badges for clearer visibility.
|
||||
|
||||
## 2024-07-02 - 1.0.26 - fix(core)
|
||||
Update package.json dependencies and metadata
|
||||
|
||||
- Updated devDependencies versions in package.json
|
||||
|
||||
## 2023-11-17 - 1.0.25 - core
|
||||
Fixes and updates to the core functionalities.
|
||||
|
||||
- update
|
||||
|
||||
## 2023-11-16 - 1.0.15 to 1.0.24 - core
|
||||
Series of fixes and updates to the core functionalities.
|
||||
|
||||
- update
|
||||
|
||||
## 2021-04-16 - 1.0.11 to 1.0.15 - core
|
||||
Series of fixes and updates to the core functionalities.
|
||||
|
||||
- update
|
||||
|
||||
## 2019-07-07 - 1.0.8 - core
|
||||
Fixes and added new features related to CSV parsing.
|
||||
|
||||
- add Base class for CSV Parsers
|
||||
|
||||
## 2019-06-24 - 1.0.5 to 1.0.7 - core
|
||||
Series of fixes and updates to the core functionalities.
|
||||
|
||||
- update
|
||||
|
||||
## 2019-05-23 - 1.0.1 to 1.0.4 - core
|
||||
Initial series of updates and fixes following project launch.
|
||||
|
||||
- update
|
||||
|
2
license
2
license
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2019 Lossless GmbH (hello@lossless.com)
|
||||
Copyright (c) 2019 Task Venture Capital GmbH (hello@task.vc)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -1,13 +1,23 @@
|
||||
{
|
||||
"gitzone": {
|
||||
"projectType": "npm",
|
||||
"module": {
|
||||
"githost": "gitlab.com",
|
||||
"gitscope": "financeplus",
|
||||
"gitrepo": "finplus-interfaces",
|
||||
"shortDescription": "an interface package for the financeplus organization",
|
||||
"npmPackagename": "@financeplus/finplus-interfaces",
|
||||
"gitscope": "fin.cx",
|
||||
"gitrepo": "portablefinance",
|
||||
"description": "An interface package for handling financial transactions and account data within the financeplus organization.",
|
||||
"npmPackagename": "@fin.cx/portablefinance",
|
||||
"license": "MIT",
|
||||
"projectDomain": "finance.plus"
|
||||
"projectDomain": "fin.cx",
|
||||
"keywords": [
|
||||
"finance",
|
||||
"financial transactions",
|
||||
"payment accounts",
|
||||
"interfaces",
|
||||
"vouchers",
|
||||
"csv",
|
||||
"typescript"
|
||||
]
|
||||
}
|
||||
},
|
||||
"npmci": {
|
||||
|
1644
package-lock.json
generated
1644
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
61
package.json
61
package.json
@ -1,24 +1,55 @@
|
||||
{
|
||||
"name": "@financeplus/finplus-interfaces",
|
||||
"version": "1.0.8",
|
||||
"name": "@fin.cx/portablefinance",
|
||||
"version": "1.0.28",
|
||||
"private": false,
|
||||
"description": "an interface package for the financeplus organization",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"description": "An interface package for handling financial transactions and account data within the financeplus organization.",
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
"author": "Lossless GmbH",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "(tstest test/)",
|
||||
"build": "(tsbuild)",
|
||||
"format": "(gitzone format)"
|
||||
"test": "(tstest test/ --web)",
|
||||
"build": "(tsbuild --web)",
|
||||
"buildDocs": "tsdoc"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.0.22",
|
||||
"@gitzone/tstest": "^1.0.15",
|
||||
"@pushrocks/tapbundle": "^3.0.7",
|
||||
"@types/node": "^10.11.7",
|
||||
"tslint": "^5.11.0",
|
||||
"tslint-config-prettier": "^1.15.0"
|
||||
"@git.zone/tsbuild": "^2.1.25",
|
||||
"@git.zone/tsrun": "^1.2.46",
|
||||
"@git.zone/tstest": "^1.0.52",
|
||||
"@push.rocks/tapbundle": "^5.0.15",
|
||||
"@types/node": "^20.9.0"
|
||||
},
|
||||
"dependencies": {}
|
||||
"files": [
|
||||
"ts/**/*",
|
||||
"ts_web/**/*",
|
||||
"dist/**/*",
|
||||
"dist_*/**/*",
|
||||
"dist_ts/**/*",
|
||||
"dist_ts_web/**/*",
|
||||
"assets/**/*",
|
||||
"cli.js",
|
||||
"npmextra.json",
|
||||
"readme.md"
|
||||
],
|
||||
"browserslist": [
|
||||
"last 1 chrome versions"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://gitlab.com/fin.cx/portablefinance.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://gitlab.com/fin.cx/portablefinance/issues"
|
||||
},
|
||||
"homepage": "https://gitlab.com/fin.cx/portablefinance#readme",
|
||||
"type": "module",
|
||||
"keywords": [
|
||||
"finance",
|
||||
"financial transactions",
|
||||
"payment accounts",
|
||||
"interfaces",
|
||||
"vouchers",
|
||||
"csv",
|
||||
"typescript"
|
||||
]
|
||||
}
|
||||
|
5701
pnpm-lock.yaml
generated
Normal file
5701
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
0
readme.hints.md
Normal file
0
readme.hints.md
Normal file
245
readme.md
245
readme.md
@ -1,26 +1,235 @@
|
||||
# @financeplus/finplus-interfaces
|
||||
# @fin.cx/portablefinance
|
||||
an interface package for the financeplus organization
|
||||
|
||||
## Availabililty and Links
|
||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@financeplus/finplus-interfaces)
|
||||
* [gitlab.com (source)](https://gitlab.com/financeplus/finplus-interfaces)
|
||||
* [github.com (source mirror)](https://github.com/financeplus/finplus-interfaces)
|
||||
* [docs (typedoc)](https://financeplus.gitlab.io/finplus-interfaces/)
|
||||
## Install
|
||||
To install the `@fin.cx/portablefinance` package, you can use npm or yarn. Make sure you have Node.js installed on your machine.
|
||||
|
||||
## Status for master
|
||||
[](https://gitlab.com/financeplus/finplus-interfaces/commits/master)
|
||||
[](https://gitlab.com/financeplus/finplus-interfaces/commits/master)
|
||||
[](https://www.npmjs.com/package/@financeplus/finplus-interfaces)
|
||||
[](https://snyk.io/test/npm/@financeplus/finplus-interfaces)
|
||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
[](https://prettier.io/)
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install @fin.cx/portablefinance
|
||||
```
|
||||
|
||||
Using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @fin.cx/portablefinance
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
For further information read the linked docs at the top of this readme.
|
||||
```typescript
|
||||
import {
|
||||
AcCsvParser,
|
||||
IMonetaryTransaction,
|
||||
IPaymentAccount,
|
||||
IMonthlyCheckpoint,
|
||||
IVoucher,
|
||||
ICsvDescriptor
|
||||
} from '@fin.cx/portablefinance';
|
||||
|
||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||
// 1. Define a CSV Parser
|
||||
class MyCsvParser extends AcCsvParser<IMonetaryTransaction> {
|
||||
public paymentProviderName = 'mybank';
|
||||
public description = 'Custom CSV Parser for MyBank';
|
||||
private transactions: IMonetaryTransaction[] = [];
|
||||
|
||||
[](https://maintainedby.lossless.com)
|
||||
public addCsvDecriptor(csvDescriptorArg: ICsvDescriptor): void {
|
||||
// Implement the logic to parse the CSV and populate transactions array
|
||||
// For simplicity, assume the CSV is correctly formatted and contains the necessary transaction details.
|
||||
this.transactions = [
|
||||
{
|
||||
id: 'txn1',
|
||||
data: {
|
||||
paymentAccountId: 'acc1',
|
||||
originTransactionId: 'orig1',
|
||||
originAccountId: 'origAcc1',
|
||||
additionalIds: ['add1', 'add2'],
|
||||
date: Date.now(),
|
||||
amount: 1000,
|
||||
description: 'Payment for services',
|
||||
name: 'Service Payment',
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
public async getTransactions(): Promise<IMonetaryTransaction[]> {
|
||||
return this.transactions;
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Define a Payment Account
|
||||
const myVoucher: IVoucher = {
|
||||
voucherDate: new Date(),
|
||||
voucherId: 'vch1',
|
||||
voucherStatus: 'uploaded',
|
||||
voucherBinaryString: 'binarystringdata',
|
||||
};
|
||||
|
||||
const myAccount: IPaymentAccount = {
|
||||
id: 'acc1',
|
||||
data: {
|
||||
status: 'active',
|
||||
connectionData: {
|
||||
bankAdapterType: 'mybank',
|
||||
credentials: {
|
||||
username: 'user',
|
||||
password: 'pass',
|
||||
},
|
||||
},
|
||||
currency: 'USD',
|
||||
name: 'MyBankAccount',
|
||||
checkpoints: {
|
||||
'2021': {
|
||||
1: {
|
||||
start: new Date('2021-01-01').getTime(),
|
||||
end: new Date('2021-01-31').getTime(),
|
||||
pdfVoucher: myVoucher,
|
||||
},
|
||||
2: {
|
||||
start: new Date('2021-02-01').getTime(),
|
||||
end: new Date('2021-02-28').getTime(),
|
||||
pdfVoucher: myVoucher,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// 3. Working with Transactions and Accounts
|
||||
(async () => {
|
||||
const csvParser = new MyCsvParser();
|
||||
const csvDescriptor: ICsvDescriptor = {
|
||||
name: 'transactions.csv',
|
||||
contentString: 'dummy content', // Replace with actual CSV content
|
||||
};
|
||||
|
||||
csvParser.addCsvDecriptor(csvDescriptor);
|
||||
|
||||
const transactions = await csvParser.getTransactions();
|
||||
console.log('Parsed Transactions:', transactions);
|
||||
|
||||
console.log('Payment Account:', myAccount);
|
||||
})();
|
||||
```
|
||||
|
||||
In this example, we demonstrate how to:
|
||||
|
||||
1. Define a custom CSV parser class (`MyCsvParser`) that extends the `AcCsvParser` abstract class.
|
||||
2. Implement the `addCsvDecriptor` method to parse CSV content and populate transactions.
|
||||
3. Define a sample payment account (`myAccount`) with necessary details.
|
||||
4. Integrate the parser and account information in an asynchronous function to showcase the usage of parsed transactions and account data.
|
||||
|
||||
### Interfaces Overview
|
||||
|
||||
#### IVoucher Interface
|
||||
The `IVoucher` interface is used to represent payment vouchers, with the following fields:
|
||||
|
||||
* `voucherDate`: Date – The date the voucher was created.
|
||||
* `voucherId`: string – Unique identifier for the voucher.
|
||||
* `voucherStatus`: 'uploaded' | 'transmitted' – The status of the voucher.
|
||||
* `voucherBinaryString`: string – The binary string representation of the voucher content.
|
||||
|
||||
#### IMonetaryTransaction Interface
|
||||
The `IMonetaryTransaction` interface is used to represent monetary transactions, with the following fields:
|
||||
|
||||
* `id`: string – Unique identifier for the transaction.
|
||||
* `data`: object – Contains key details about the transaction:
|
||||
* `paymentAccountId`: string – Identifier for the payment account involved in the transaction.
|
||||
* `originTransactionId`: string – Identifier for the original transaction (in case of related transactions).
|
||||
* `originAccountId`: string – Identifier for the account from where the transaction originated.
|
||||
* `additionalIds`: string[] – Additional identifiers related to the transaction.
|
||||
* `date`: number – Date of the transaction (timestamp).
|
||||
* `amount`: number – Amount involved in the transaction.
|
||||
* `description`: string – Description of the transaction.
|
||||
* `name`: string – Name associated with the transaction.
|
||||
* Optional properties for additional voucher data and metadata.
|
||||
|
||||
#### IPaymentAccount Interface
|
||||
The `IPaymentAccount` interface represents a payment account with various properties, organized into nested structures.
|
||||
|
||||
* `id`: string – Unique identifier for the payment account.
|
||||
* `data`: object – Contains the core data for the payment account:
|
||||
* `status`: 'active' | 'inactive' | 'deleted' – Status of the account.
|
||||
* `connectionData`: object – Holds connection-related data such as type and credentials.
|
||||
* `currency`: 'EUR' | 'USD' – Currency of the account.
|
||||
* `name`: string – Name of the account.
|
||||
* `checkpoints`: object – Monthly checkpoint data structured by year.
|
||||
|
||||
#### ICsvDescriptor Interface
|
||||
The `ICsvDescriptor` interface describes a CSV file, consisting of:
|
||||
|
||||
* `name`: string – Name of the CSV file.
|
||||
* `contentString`: string – The content of the CSV file as a string.
|
||||
|
||||
### Abstract Class AcCsvParser
|
||||
The `AcCsvParser` abstract class serves as a blueprint for creating specific CSV parsers for different payment providers. It includes:
|
||||
|
||||
* `paymentProviderName`: Abstract property for the name of the payment provider.
|
||||
* `description`: Abstract property for a description of the parser.
|
||||
* `addCsvDecriptor`: Abstract method accepting a `ICsvDescriptor` object to process CSV data.
|
||||
* `getTransactions`: Abstract method returning a promise which resolves to an array of `IMonetaryTransaction` objects.
|
||||
|
||||
### Advanced Usage
|
||||
Beyond the basic usage demonstrated above, the `@fin.cx/portablefinance` package can be utilized for more advanced financial data management scenarios:
|
||||
|
||||
#### Handling Multiple CSV Files
|
||||
```typescript
|
||||
// Define multiple CSV descriptors
|
||||
const csvDescriptors: ICsvDescriptor[] = [
|
||||
{
|
||||
name: 'transactions_jan.csv',
|
||||
contentString: 'dummy content January', // Replace with actual content
|
||||
},
|
||||
{
|
||||
name: 'transactions_feb.csv',
|
||||
contentString: 'dummy content February', // Replace with actual content
|
||||
},
|
||||
];
|
||||
|
||||
// Add and parse all CSV files
|
||||
csvDescriptors.forEach((descriptor) => {
|
||||
csvParser.addCsvDecriptor(descriptor);
|
||||
});
|
||||
|
||||
// Retrieve and process all transactions
|
||||
const allTransactions = await csvParser.getTransactions();
|
||||
console.log('All Transactions:', allTransactions);
|
||||
```
|
||||
|
||||
#### Transaction Filtering and Aggregation
|
||||
```typescript
|
||||
// Filter transactions by date or amount
|
||||
const filteredTransactions = allTransactions.filter((transaction) => {
|
||||
return transaction.data.amount > 500; // Example: transactions greater than 500
|
||||
});
|
||||
|
||||
console.log('Filtered Transactions:', filteredTransactions);
|
||||
|
||||
// Aggregate transaction amounts
|
||||
const totalAmount = allTransactions.reduce((acc, transaction) => acc + transaction.data.amount, 0);
|
||||
console.log('Total Transaction Amount:', totalAmount);
|
||||
```
|
||||
|
||||
#### Integration with Payment Accounts
|
||||
```typescript
|
||||
// Assume we have multiple accounts
|
||||
const accounts: IPaymentAccount[] = [myAccount]; // Add more accounts as needed
|
||||
|
||||
// Link transactions to payment accounts
|
||||
const transactionsByAccount = accounts.map((account) => {
|
||||
return {
|
||||
accountId: account.id,
|
||||
transactions: allTransactions.filter((txn) => txn.data.paymentAccountId === account.id),
|
||||
};
|
||||
});
|
||||
|
||||
console.log('Transactions by Account:', transactionsByAccount);
|
||||
```
|
||||
|
||||
This comprehensive usage example covers the complete set of features provided by the `@fin.cx/portablefinance` package, demonstrating how to extend the abstract CSV parser, work with interfaces, handle multiple CSV files, filter and aggregate transactions, and integrate them with payment accounts. Feel free to customize the example based on your specific use cases and workflows.
|
||||
|
||||
For further information, consult the linked documentation at the top of this README.
|
||||
|
||||
Happy coding! 😊
|
20
test/test.ts
20
test/test.ts
@ -1,9 +1,19 @@
|
||||
import { expect, tap } from '@pushrocks/tapbundle';
|
||||
import * as finplusInterfaces from '../ts/index';
|
||||
import { expect, tap } from '@push.rocks/tapbundle';
|
||||
import * as finplusInterfaces from '../ts/index.js';
|
||||
|
||||
tap.test('first test', async () => {
|
||||
let dummyCsvParser : finplusInterfaces.ICsvParser;
|
||||
dummyCsvParser;
|
||||
interface ITestTransaction {
|
||||
date: Date;
|
||||
amount: number;
|
||||
}
|
||||
|
||||
tap.test('implement test csv parser', async () => {
|
||||
class MyCsvParser extends finplusInterfaces.AcCsvParser<ITestTransaction> {
|
||||
paymentProviderName: 'bunq';
|
||||
public transactionArray: ITestTransaction[] = [];
|
||||
public async getTransactions(): Promise<ITestTransaction[]> {
|
||||
return this.transactionArray;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @push.rocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@fin.cx/portablefinance',
|
||||
version: '1.0.28',
|
||||
description: 'An interface package for handling financial transactions and account data within the financeplus organization.'
|
||||
}
|
9
ts/abstractclasses/csvparser.ts
Normal file
9
ts/abstractclasses/csvparser.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import type { ICsvDescriptor } from '../interfaces/csvdescriptor.js';
|
||||
import { type IMonetaryTransaction } from '../interfaces/transaction.js';
|
||||
|
||||
export abstract class AcCsvParser<TOriginalTrnasction> {
|
||||
public abstract paymentProviderName: string;
|
||||
public abstract description: string;
|
||||
public abstract addCsvDecriptor(csvDescriptorArg: ICsvDescriptor): void;
|
||||
public abstract getTransactions(): Promise<IMonetaryTransaction[]>;
|
||||
}
|
1
ts/abstractclasses/index.ts
Normal file
1
ts/abstractclasses/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './csvparser.js';
|
@ -1,4 +1,2 @@
|
||||
import * as plugins from './finplus-interfaces.plugins';
|
||||
|
||||
export * from './interfaces/csvparser';
|
||||
|
||||
export * from './abstractclasses/index.js';
|
||||
export * from './interfaces/index.js';
|
||||
|
4
ts/interfaces/csvdescriptor.ts
Normal file
4
ts/interfaces/csvdescriptor.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export interface ICsvDescriptor {
|
||||
name: string;
|
||||
contentString: string;
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
export abstract class AcCsvParser<T> {
|
||||
public abstract transactionArray: T[];
|
||||
public abstract async getTransactions (): Promise<T>;
|
||||
}
|
@ -1 +1,4 @@
|
||||
export * from './csvparser';
|
||||
export * from './csvdescriptor.js';
|
||||
export * from './paymentaccount.js';
|
||||
export * from './transaction.js';
|
||||
export * from './voucher.js';
|
||||
|
36
ts/interfaces/paymentaccount.ts
Normal file
36
ts/interfaces/paymentaccount.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import { type IVoucher } from './voucher.js';
|
||||
|
||||
export interface IMonthlyCheckpoint {
|
||||
start: number;
|
||||
end: number;
|
||||
pdfVoucher: IVoucher;
|
||||
}
|
||||
|
||||
export interface IPaymentAccount {
|
||||
id: string;
|
||||
data: {
|
||||
status: 'active' | 'inactive' | 'deleted';
|
||||
connectionData: {
|
||||
bankAdapterType: string;
|
||||
credentials: unknown;
|
||||
};
|
||||
currency: 'EUR' | 'USD';
|
||||
name: string;
|
||||
checkpoints: {
|
||||
[key: string]: {
|
||||
1: IMonthlyCheckpoint;
|
||||
2: IMonthlyCheckpoint;
|
||||
3: IMonthlyCheckpoint;
|
||||
4: IMonthlyCheckpoint;
|
||||
5: IMonthlyCheckpoint;
|
||||
6: IMonthlyCheckpoint;
|
||||
7: IMonthlyCheckpoint;
|
||||
8: IMonthlyCheckpoint;
|
||||
9: IMonthlyCheckpoint;
|
||||
10: IMonthlyCheckpoint;
|
||||
11: IMonthlyCheckpoint;
|
||||
12: IMonthlyCheckpoint;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
21
ts/interfaces/transaction.ts
Normal file
21
ts/interfaces/transaction.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { type IVoucher } from './voucher.js';
|
||||
|
||||
export interface IMonetaryTransaction {
|
||||
id: string;
|
||||
data: {
|
||||
paymentAccountId: string;
|
||||
originTransactionId: string;
|
||||
originAccountId: string;
|
||||
additionalIds: string[];
|
||||
date: number;
|
||||
amount: number;
|
||||
description: string;
|
||||
name: string;
|
||||
voucherData?: IVoucher;
|
||||
justForLooks?: {
|
||||
paymentAcountName: string;
|
||||
voucherSizeInMB: number;
|
||||
dateIso?: string;
|
||||
};
|
||||
};
|
||||
}
|
6
ts/interfaces/voucher.ts
Normal file
6
ts/interfaces/voucher.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export interface IVoucher {
|
||||
voucherDate: Date;
|
||||
voucherId: string;
|
||||
voucherStatus: 'uploaded' | 'transmitted';
|
||||
voucherBinaryString: string;
|
||||
}
|
14
tsconfig.json
Normal file
14
tsconfig.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"experimentalDecorators": true,
|
||||
"useDefineForClassFields": false,
|
||||
"target": "ES2022",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"esModuleInterop": true,
|
||||
"verbatimModuleSyntax": true
|
||||
},
|
||||
"exclude": [
|
||||
"dist_*/**/*.d.ts"
|
||||
]
|
||||
}
|
17
tslint.json
17
tslint.json
@ -1,17 +0,0 @@
|
||||
{
|
||||
"extends": ["tslint:latest", "tslint-config-prettier"],
|
||||
"rules": {
|
||||
"semicolon": [true, "always"],
|
||||
"no-console": false,
|
||||
"ordered-imports": false,
|
||||
"object-literal-sort-keys": false,
|
||||
"member-ordering": {
|
||||
"options":{
|
||||
"order": [
|
||||
"static-method"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultSeverity": "warning"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user