@classytic/revenue 1.1.3 → 2.0.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/CHANGELOG.md +90 -0
- package/README.md +638 -632
- package/dist/audit-B39B0Sdq.mjs +53 -0
- package/dist/audit-DZ0eTr9g.d.mts +89 -0
- package/dist/bridges/index.d.mts +2 -0
- package/dist/bridges/index.mjs +1 -0
- package/dist/context-DRqSeTPM.d.mts +35 -0
- package/dist/core/state-machines.d.mts +35 -0
- package/dist/core/state-machines.mjs +134 -0
- package/dist/engine-types-CcjIb4Fy.d.mts +611 -0
- package/dist/enums/index.d.mts +3 -157
- package/dist/enums/index.mjs +3 -55
- package/dist/errors-DHa8JVQ-.mjs +92 -0
- package/dist/escrow.schema-BBv9oVEW.mjs +322 -0
- package/dist/escrow.schema-CC8XuD46.d.mts +629 -0
- package/dist/event-constants-CEMitnIV.mjs +53 -0
- package/dist/events/index.d.mts +3 -0
- package/dist/events/index.mjs +4 -0
- package/dist/index.d.mts +77 -9
- package/dist/index.mjs +465 -29
- package/dist/monetization.enums-BtiU3t8o.mjs +39 -0
- package/dist/monetization.enums-D2xbxXJM.d.mts +34 -0
- package/dist/plugins/plugin.interface.d.mts +28 -0
- package/dist/plugins/plugin.interface.mjs +26 -0
- package/dist/providers/index.d.mts +2 -3
- package/dist/providers/index.mjs +2 -2
- package/dist/{base-DCoyIUj6.mjs → registry-DhFMsSn5.mjs} +34 -36
- package/dist/{base-CsTlVQJe.d.mts → registry-SvIGPAx_.d.mts} +73 -66
- package/dist/repositories/create-repositories.d.mts +21 -0
- package/dist/repositories/create-repositories.mjs +12 -0
- package/dist/revenue-bridges-sdlrR85c.d.mts +145 -0
- package/dist/revenue-event-catalog-BX3g7RUi.d.mts +823 -0
- package/dist/revenue-event-catalog-LqxPnsU_.mjs +388 -0
- package/dist/settlement.repository-Cy3mMWGH.mjs +771 -0
- package/dist/shared/index.d.mts +2 -0
- package/dist/shared/index.mjs +4 -0
- package/dist/split.enums-CQE3ekH1.mjs +172 -0
- package/dist/split.enums-Dw4zCrcZ.d.mts +154 -0
- package/dist/splits-BAfY-a9P.mjs +123 -0
- package/dist/validators/index.d.mts +2 -0
- package/dist/validators/index.mjs +3 -0
- package/package.json +32 -36
- package/dist/application/services/index.d.mts +0 -4
- package/dist/application/services/index.mjs +0 -3
- package/dist/category-resolver-DV83N8ok.mjs +0 -284
- package/dist/commission-split-BzB8cd39.mjs +0 -485
- package/dist/core/events.d.mts +0 -294
- package/dist/core/events.mjs +0 -100
- package/dist/core/index.d.mts +0 -9
- package/dist/core/index.mjs +0 -8
- package/dist/errors-CorrWz7A.d.mts +0 -787
- package/dist/escrow.enums-CZGrrdg7.mjs +0 -101
- package/dist/escrow.enums-DwdLuuve.d.mts +0 -78
- package/dist/idempotency-DaYcUGY1.mjs +0 -172
- package/dist/index-Dsp7H5Wb.d.mts +0 -471
- package/dist/infrastructure/plugins/index.d.mts +0 -239
- package/dist/infrastructure/plugins/index.mjs +0 -345
- package/dist/money-CvrDOijQ.mjs +0 -271
- package/dist/money-DPG8AtJ8.d.mts +0 -112
- package/dist/payment.enums-HAuAS9Pp.d.mts +0 -70
- package/dist/payment.enums-tEFVa-Xp.mjs +0 -69
- package/dist/plugin-BbK0OVHy.d.mts +0 -327
- package/dist/plugin-Cd_V04Em.mjs +0 -210
- package/dist/reconciliation/index.d.mts +0 -193
- package/dist/reconciliation/index.mjs +0 -192
- package/dist/retry-HHCOXYdn.d.mts +0 -186
- package/dist/revenue-9scqKSef.mjs +0 -553
- package/dist/schemas/index.d.mts +0 -2665
- package/dist/schemas/index.mjs +0 -717
- package/dist/schemas/validation.d.mts +0 -375
- package/dist/schemas/validation.mjs +0 -325
- package/dist/settlement.enums-DFhkqZEY.d.mts +0 -132
- package/dist/settlement.schema-D5uWB5tP.d.mts +0 -344
- package/dist/settlement.service-BxuiHpNC.d.mts +0 -594
- package/dist/settlement.service-CUxbUTzT.mjs +0 -2510
- package/dist/split.enums-BrjabxIX.mjs +0 -86
- package/dist/split.enums-DmskfLOM.d.mts +0 -43
- package/dist/tax-BoCt5cEd.d.mts +0 -61
- package/dist/tax-EQ15DO81.mjs +0 -162
- package/dist/transaction.enums-pCyMFT4Z.mjs +0 -96
- package/dist/utils/index.d.mts +0 -428
- package/dist/utils/index.mjs +0 -346
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
4
|
+
adhering to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
5
|
+
|
|
6
|
+
## [2.0.0] — major rewrite
|
|
7
|
+
|
|
8
|
+
Payment lifecycle engine refactored around unified transactions, an
|
|
9
|
+
explicit state-machine core, and a compact 9-subpath surface. The old
|
|
10
|
+
`src/application/services/*` indirection + `src/core/container.ts` /
|
|
11
|
+
`src/core/events.ts` / `src/core/revenue.ts` / `src/core/plugin.ts` /
|
|
12
|
+
`src/core/result.ts` layers are gone — repositories + the engine factory
|
|
13
|
+
are the surface.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **`/core` subpath** — exposes `state-machines.ts` (TRANSACTION/HOLD/SPLIT
|
|
18
|
+
transitions + the generic `StateMachine<TState>` runtime) and the
|
|
19
|
+
`StateChangeEvent` shape so hosts can wire audit trails without pulling
|
|
20
|
+
in the full engine.
|
|
21
|
+
- **`/bridges` subpath** — host-side integration bridges (pricing, credit,
|
|
22
|
+
catalog, etc.) as typed ports; no side effects, no runtime coupling.
|
|
23
|
+
- **`/providers` subpath** — payment-provider adapter contracts consumed
|
|
24
|
+
by concrete adapter packages (`@classytic/revenue-manual` today; Stripe,
|
|
25
|
+
SSLCommerz, bKash etc. as separate packages).
|
|
26
|
+
- **`/utils` subpath** — shared helpers (audit trail, context resolution,
|
|
27
|
+
money conversion).
|
|
28
|
+
- **Unified transaction model** — single `Transaction` document carries
|
|
29
|
+
payment, subscription, escrow hold, split, and settlement context.
|
|
30
|
+
Status transitions validated by the state-machine core.
|
|
31
|
+
- **Audit trail helpers** (`appendAuditEvent`, `getAuditTrail`,
|
|
32
|
+
`getLastStateChange`) in `/utils`. Every state change emits a typed
|
|
33
|
+
`StateChangeEvent` (resourceType, resourceId, fromState, toState,
|
|
34
|
+
changedAt, changedBy?, reason?, metadata?).
|
|
35
|
+
- **Split-payment + tax features** and bug fixes from the 1.1 line folded
|
|
36
|
+
into 2.0.
|
|
37
|
+
- **Multi-payment support** on a single transaction (partial capture,
|
|
38
|
+
retry-with-different-method).
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- **Dropped `src/application/services/*`** (escrow/monetization/payment/
|
|
43
|
+
settlement/subscription/transaction services). Equivalent logic now
|
|
44
|
+
lives on the repositories or the engine factory.
|
|
45
|
+
- **Dropped `src/core/` scaffolding** (container.ts, events.ts,
|
|
46
|
+
plugin.ts, result.ts, revenue.ts, state-machine/ subdir) in favor of
|
|
47
|
+
the flatter `state-machines.ts` + engine factory shape.
|
|
48
|
+
- **Peer deps standardized on `>=`** — `@classytic/mongokit >=3.11.0`,
|
|
49
|
+
`@classytic/primitives >=0.1.0`, `@classytic/repo-core >=0.2.0`,
|
|
50
|
+
`mongoose >=9.4.1`, `zod >=4.0.0`.
|
|
51
|
+
- **DevDeps:** `@classytic/primitives` moved off `file:` link onto
|
|
52
|
+
`>=0.1.0` now that primitives ships on npm.
|
|
53
|
+
- **Build migrated to tsdown** — per `tsdown.config.ts`, nine entries
|
|
54
|
+
aligned with the subpath exports.
|
|
55
|
+
|
|
56
|
+
### Removed
|
|
57
|
+
|
|
58
|
+
- `src/application/index.ts` + every service module under it.
|
|
59
|
+
- `src/core/container.ts`, `events.ts`, `plugin.ts`, `result.ts`,
|
|
60
|
+
`revenue.ts`, and the `state-machine/` subdirectory (replaced by
|
|
61
|
+
`state-machines.ts`).
|
|
62
|
+
- Internal barrels under `src/` — only `src/index.ts` re-exports now.
|
|
63
|
+
|
|
64
|
+
### Peer compatibility
|
|
65
|
+
|
|
66
|
+
Consumers on 1.x that imported from `@classytic/revenue` root will need
|
|
67
|
+
to migrate:
|
|
68
|
+
- Any `services.transaction.*` / `services.payment.*` / `services.escrow.*`
|
|
69
|
+
/ `services.settlement.*` / `services.subscription.*` / `services.monetization.*`
|
|
70
|
+
calls move to the engine repositories.
|
|
71
|
+
- Custom state transitions move from the old container-based events to
|
|
72
|
+
the `StateMachine<TState>` API in `/core`.
|
|
73
|
+
- Providers move to the `/providers` contract; the manual reference
|
|
74
|
+
implementation ships as `@classytic/revenue-manual`.
|
|
75
|
+
|
|
76
|
+
### Tests
|
|
77
|
+
|
|
78
|
+
252 tests across 25 files (unit + integration + scenarios), run via
|
|
79
|
+
`vitest` at the workspace root. `mongodb-memory-server` for integration.
|
|
80
|
+
|
|
81
|
+
## [1.1.x]
|
|
82
|
+
|
|
83
|
+
Refinements on the 1.x line — split payment feature, tax feature, bug
|
|
84
|
+
fixes. Unified transaction shape landed here before the 2.0 restructure.
|
|
85
|
+
|
|
86
|
+
## [1.0.0]
|
|
87
|
+
|
|
88
|
+
Initial stable release on npm. Payment lifecycle engine —
|
|
89
|
+
transactions, subscriptions, escrow, settlements, commissions.
|
|
90
|
+
MongoKit-powered, framework-agnostic, Arc-compatible event shape.
|