@mody-park-cha-raja/finance_common 4.30.1-beta.4 → 4.31.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,18 +1,123 @@
|
|
|
1
|
-
#
|
|
2
|
-
### @mody-park-cha-raja/finance_common
|
|
1
|
+
# @mody-park-cha-raja/finance_common
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
Common interfaces, models, enums, and utilities for the Mody Park Cha Raja finance ecosystem
|
|
3
|
+
Common interfaces, models, enums, and utilities for the Mody Park Cha Raja finance ecosystem.
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
This is the **shared source of truth** for domain definitions used by the backend, web frontend, and mobile app. It is published to the npm registry as a private package and consumed by all three applications.
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
Part of the Finance workspace — see the [parent README](../README.md).
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
`npm install @mody-park-cha-raja/finance_common`
|
|
9
|
+
---
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
## What's Inside
|
|
12
|
+
|
|
13
|
+
The package ships TypeScript types and runtime enums/utilities organized by concern:
|
|
14
|
+
|
|
15
|
+
| Directory | Contents |
|
|
16
|
+
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| `interfaces/` | DTOs and shared interfaces |
|
|
18
|
+
| `models/` | Entity models (`base`, `donation`, `sponsor`, `expense`, `vendor`, `flat`, `transaction`, `user`, + history variants, etc.) |
|
|
19
|
+
| `enums/` | Enums (`PaymentType`, `TransactionType`, `ExpenseType`, `SponsorTier`, `SponsorFor`, `VendorType`, `EntityStatus`, `UserRole`, `ReferenceIdPrefix`, etc.) |
|
|
20
|
+
| `types/` | Shared types |
|
|
21
|
+
| `validators/` | Validation helpers / regexes |
|
|
22
|
+
| `utils/` | Utility functions |
|
|
23
|
+
| `helpers/` | Helper functions |
|
|
24
|
+
| `data/` | Static data / flow configs |
|
|
25
|
+
| `flow-configs/` | Flow configurations |
|
|
26
|
+
|
|
27
|
+
All public exports are re-exported from `src/index.ts`.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install @mody-park-cha-raja/finance_common
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
> This is a private package — installers must have access to the npm registry scope it is published under.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import {
|
|
45
|
+
PaymentType,
|
|
46
|
+
SponsorTier,
|
|
47
|
+
DonationEntityModel,
|
|
48
|
+
TransactionType,
|
|
49
|
+
ISearchRequest,
|
|
50
|
+
} from "@mody-park-cha-raja/finance_common";
|
|
51
|
+
|
|
52
|
+
// Use enums / models throughout your feature code
|
|
53
|
+
const donation: Partial<DonationEntityModel> = {
|
|
54
|
+
paymentType: PaymentType.UPI,
|
|
55
|
+
amount: 1100,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const tier: SponsorTier = SponsorTier.Gold;
|
|
59
|
+
|
|
60
|
+
// Reference DTO/interfaces for your API layer
|
|
61
|
+
function search(): ISearchRequest {
|
|
62
|
+
return { page: 1, limit: 20 };
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Build & Test
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm run build # bundle the package (tsup) → dist/
|
|
72
|
+
npm test # run tests
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The build output is produced by **tsup**. `prepublishOnly` runs the build automatically before any publish.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Publishing
|
|
80
|
+
|
|
81
|
+
> ⚠️ **Important:** This is a published npm package. Changes affect **all dependent repositories** (backend, frontend, mobile). Follow the full workflow in `docs/PUBLISHING.md` before publishing.
|
|
82
|
+
|
|
83
|
+
### Versioning & publish scripts
|
|
84
|
+
|
|
85
|
+
| Script | Description |
|
|
86
|
+
| ---------------- | --------------------------------------------------------------------------- |
|
|
87
|
+
| `build` | Build the package with tsup |
|
|
88
|
+
| `link` | Build + `npm link` for local development |
|
|
89
|
+
| `publish:beta` | Build → prerelease (`--preid=beta`) → push tags → publish with `--tag beta` |
|
|
90
|
+
| `full-publish` | Build → `npm version patch` → push tags → publish public |
|
|
91
|
+
| `minor-publish` | Build → minor version bump → publish |
|
|
92
|
+
| `major-publish` | Build → major version bump → publish |
|
|
93
|
+
| `prepublishOnly` | Automatically builds before publishing |
|
|
94
|
+
|
|
95
|
+
### Standard cross-repo flow
|
|
96
|
+
|
|
97
|
+
1. Modify `finance-common` first.
|
|
98
|
+
2. Build and test the package.
|
|
99
|
+
3. Publish the new version (`npm run minor-publish`, `publish:beta`, etc.).
|
|
100
|
+
4. Update the package in **all** affected repositories (`npm install @mody-park-cha-raja/finance_common@<new-version>`).
|
|
101
|
+
5. Run final validation against the published package.
|
|
102
|
+
|
|
103
|
+
The root `deploy-web.sh` automates publishing a minor version and propagating it across all apps.
|
|
104
|
+
|
|
105
|
+
### Version policy
|
|
106
|
+
|
|
107
|
+
- Maintain **backward compatibility** unless a version is explicitly breaking.
|
|
108
|
+
- Inform consumers of any breaking changes and provide a migration path where required.
|
|
109
|
+
- Do **not** remove existing exports without a migration path.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Contributing
|
|
114
|
+
|
|
115
|
+
- Read this repo's `AGENTS.md` and `docs/` (ARCHITECTURE, CONVENTIONS, AI-GUIDELINES, PUBLISHING) before making changes.
|
|
116
|
+
- Export only necessary types and utilities.
|
|
117
|
+
- Never commit `.env` / secret files or `.npmrc` credentials.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## License
|
|
16
122
|
|
|
17
|
-
#License:
|
|
18
123
|
ISC
|