@classytic/revenue 1.0.6 → 1.1.3
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 +582 -633
- package/dist/application/services/index.d.mts +4 -0
- package/dist/application/services/index.mjs +3 -0
- package/dist/base-CsTlVQJe.d.mts +136 -0
- package/dist/base-DCoyIUj6.mjs +152 -0
- package/dist/category-resolver-DV83N8ok.mjs +284 -0
- package/dist/commission-split-BzB8cd39.mjs +485 -0
- package/dist/core/events.d.mts +294 -0
- package/dist/core/events.mjs +100 -0
- package/dist/core/index.d.mts +9 -0
- package/dist/core/index.mjs +8 -0
- package/dist/enums/index.d.mts +157 -0
- package/dist/enums/index.mjs +56 -0
- package/dist/errors-CorrWz7A.d.mts +787 -0
- package/dist/escrow.enums-CZGrrdg7.mjs +101 -0
- package/dist/escrow.enums-DwdLuuve.d.mts +78 -0
- package/dist/idempotency-DaYcUGY1.mjs +172 -0
- package/dist/index-Dsp7H5Wb.d.mts +471 -0
- package/dist/index.d.mts +9 -0
- package/dist/index.mjs +38 -0
- package/dist/infrastructure/plugins/index.d.mts +239 -0
- package/dist/infrastructure/plugins/index.mjs +345 -0
- package/dist/money-CvrDOijQ.mjs +271 -0
- package/dist/money-DPG8AtJ8.d.mts +112 -0
- package/dist/payment.enums-HAuAS9Pp.d.mts +70 -0
- package/dist/payment.enums-tEFVa-Xp.mjs +69 -0
- package/dist/plugin-BbK0OVHy.d.mts +327 -0
- package/dist/plugin-Cd_V04Em.mjs +210 -0
- package/dist/providers/index.d.mts +3 -0
- package/dist/providers/index.mjs +3 -0
- package/dist/reconciliation/index.d.mts +193 -0
- package/dist/reconciliation/index.mjs +192 -0
- package/dist/retry-HHCOXYdn.d.mts +186 -0
- package/dist/revenue-9scqKSef.mjs +553 -0
- package/dist/schemas/index.d.mts +2665 -0
- package/dist/schemas/index.mjs +717 -0
- package/dist/schemas/validation.d.mts +375 -0
- package/dist/schemas/validation.mjs +325 -0
- package/dist/settlement.enums-DFhkqZEY.d.mts +132 -0
- package/dist/settlement.schema-D5uWB5tP.d.mts +344 -0
- package/dist/settlement.service-BxuiHpNC.d.mts +594 -0
- package/dist/settlement.service-CUxbUTzT.mjs +2510 -0
- package/dist/split.enums-BrjabxIX.mjs +86 -0
- package/dist/split.enums-DmskfLOM.d.mts +43 -0
- package/dist/tax-BoCt5cEd.d.mts +61 -0
- package/dist/tax-EQ15DO81.mjs +162 -0
- package/dist/transaction.enums-pCyMFT4Z.mjs +96 -0
- package/dist/utils/index.d.mts +428 -0
- package/dist/utils/index.mjs +346 -0
- package/package.json +48 -33
- package/dist/actions-Ctf2XUL-.d.ts +0 -519
- package/dist/core/index.d.ts +0 -890
- package/dist/core/index.js +0 -3005
- package/dist/core/index.js.map +0 -1
- package/dist/enums/index.d.ts +0 -138
- package/dist/enums/index.js +0 -263
- package/dist/enums/index.js.map +0 -1
- package/dist/index-BnEXsnLJ.d.ts +0 -378
- package/dist/index-C5SsOrV0.d.ts +0 -534
- package/dist/index.d.ts +0 -43
- package/dist/index.js +0 -4498
- package/dist/index.js.map +0 -1
- package/dist/payment.enums-B_RwB8iR.d.ts +0 -184
- package/dist/providers/index.d.ts +0 -132
- package/dist/providers/index.js +0 -122
- package/dist/providers/index.js.map +0 -1
- package/dist/retry-80lBCmSe.d.ts +0 -234
- package/dist/schemas/index.d.ts +0 -1051
- package/dist/schemas/index.js +0 -627
- package/dist/schemas/index.js.map +0 -1
- package/dist/schemas/validation.d.ts +0 -384
- package/dist/schemas/validation.js +0 -302
- package/dist/schemas/validation.js.map +0 -1
- package/dist/services/index.d.ts +0 -3
- package/dist/services/index.js +0 -1702
- package/dist/services/index.js.map +0 -1
- package/dist/split.schema-DLVF3XBI.d.ts +0 -1122
- package/dist/transaction.enums-7uBnuswI.d.ts +0 -87
- package/dist/utils/index.d.ts +0 -24
- package/dist/utils/index.js +0 -1140
- package/dist/utils/index.js.map +0 -1
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Monetization Enums
|
|
3
|
-
* @classytic/revenue
|
|
4
|
-
*
|
|
5
|
-
* General monetization enums and constants
|
|
6
|
-
*/
|
|
7
|
-
declare const MONETIZATION_TYPES: {
|
|
8
|
-
readonly FREE: "free";
|
|
9
|
-
readonly PURCHASE: "purchase";
|
|
10
|
-
readonly SUBSCRIPTION: "subscription";
|
|
11
|
-
};
|
|
12
|
-
type MonetizationTypes = typeof MONETIZATION_TYPES;
|
|
13
|
-
type MonetizationTypeValue = MonetizationTypes[keyof MonetizationTypes];
|
|
14
|
-
declare const MONETIZATION_TYPE_VALUES: MonetizationTypeValue[];
|
|
15
|
-
declare function isMonetizationType(value: unknown): value is MonetizationTypeValue;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Transaction Enums
|
|
19
|
-
* @classytic/revenue
|
|
20
|
-
*
|
|
21
|
-
* Library-managed transaction enums only.
|
|
22
|
-
* Users should define their own categories and merge with these.
|
|
23
|
-
*/
|
|
24
|
-
/**
|
|
25
|
-
* Transaction Type - Income vs Expense
|
|
26
|
-
*
|
|
27
|
-
* INCOME: Money coming in (payments, subscriptions, purchases)
|
|
28
|
-
* EXPENSE: Money going out (refunds, payouts)
|
|
29
|
-
*
|
|
30
|
-
* Users can map these in their config via transactionTypeMapping
|
|
31
|
-
*/
|
|
32
|
-
declare const TRANSACTION_TYPE: {
|
|
33
|
-
readonly INCOME: "income";
|
|
34
|
-
readonly EXPENSE: "expense";
|
|
35
|
-
};
|
|
36
|
-
type TransactionType = typeof TRANSACTION_TYPE;
|
|
37
|
-
type TransactionTypeValue = TransactionType[keyof TransactionType];
|
|
38
|
-
declare const TRANSACTION_TYPE_VALUES: TransactionTypeValue[];
|
|
39
|
-
/**
|
|
40
|
-
* Transaction Status - Library-managed states
|
|
41
|
-
*/
|
|
42
|
-
declare const TRANSACTION_STATUS: {
|
|
43
|
-
readonly PENDING: "pending";
|
|
44
|
-
readonly PAYMENT_INITIATED: "payment_initiated";
|
|
45
|
-
readonly PROCESSING: "processing";
|
|
46
|
-
readonly REQUIRES_ACTION: "requires_action";
|
|
47
|
-
readonly VERIFIED: "verified";
|
|
48
|
-
readonly COMPLETED: "completed";
|
|
49
|
-
readonly FAILED: "failed";
|
|
50
|
-
readonly CANCELLED: "cancelled";
|
|
51
|
-
readonly EXPIRED: "expired";
|
|
52
|
-
readonly REFUNDED: "refunded";
|
|
53
|
-
readonly PARTIALLY_REFUNDED: "partially_refunded";
|
|
54
|
-
};
|
|
55
|
-
type TransactionStatus = typeof TRANSACTION_STATUS;
|
|
56
|
-
type TransactionStatusValue = TransactionStatus[keyof TransactionStatus];
|
|
57
|
-
declare const TRANSACTION_STATUS_VALUES: TransactionStatusValue[];
|
|
58
|
-
/**
|
|
59
|
-
* Categories managed by this library
|
|
60
|
-
*
|
|
61
|
-
* SUBSCRIPTION: Recurring subscription payments
|
|
62
|
-
* PURCHASE: One-time purchases
|
|
63
|
-
*
|
|
64
|
-
* Users should spread these into their own category enums:
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* import { LIBRARY_CATEGORIES } from '@classytic/revenue';
|
|
68
|
-
*
|
|
69
|
-
* export const MY_CATEGORIES = {
|
|
70
|
-
* ...LIBRARY_CATEGORIES,
|
|
71
|
-
* SALARY: 'salary',
|
|
72
|
-
* RENT: 'rent',
|
|
73
|
-
* EQUIPMENT: 'equipment',
|
|
74
|
-
* } as const;
|
|
75
|
-
*/
|
|
76
|
-
declare const LIBRARY_CATEGORIES: {
|
|
77
|
-
readonly SUBSCRIPTION: "subscription";
|
|
78
|
-
readonly PURCHASE: "purchase";
|
|
79
|
-
};
|
|
80
|
-
type LibraryCategories = typeof LIBRARY_CATEGORIES;
|
|
81
|
-
type LibraryCategoryValue = LibraryCategories[keyof LibraryCategories];
|
|
82
|
-
declare const LIBRARY_CATEGORY_VALUES: LibraryCategoryValue[];
|
|
83
|
-
declare function isLibraryCategory(value: unknown): value is LibraryCategoryValue;
|
|
84
|
-
declare function isTransactionType(value: unknown): value is TransactionTypeValue;
|
|
85
|
-
declare function isTransactionStatus(value: unknown): value is TransactionStatusValue;
|
|
86
|
-
|
|
87
|
-
export { LIBRARY_CATEGORIES as L, MONETIZATION_TYPES as M, TRANSACTION_TYPE as T, type TransactionType as a, TRANSACTION_TYPE_VALUES as b, TRANSACTION_STATUS as c, type TransactionStatus as d, TRANSACTION_STATUS_VALUES as e, type LibraryCategories as f, type LibraryCategoryValue as g, LIBRARY_CATEGORY_VALUES as h, isLibraryCategory as i, isTransactionType as j, isTransactionStatus as k, type MonetizationTypes as l, MONETIZATION_TYPE_VALUES as m, isMonetizationType as n, type TransactionTypeValue as o, type TransactionStatusValue as p, type MonetizationTypeValue as q };
|
package/dist/utils/index.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export { O as DurationUnit, E as EDITABLE_MONETIZATION_FIELDS_PRE_VERIFICATION, h as IdempotencyConfig, c as IdempotencyError, I as IdempotencyManager, e as IdempotencyRecord, g as IdempotencyStore, z as MANUAL_TRANSACTION_CREATE_FIELDS, A as MANUAL_TRANSACTION_UPDATE_FIELDS, b as MemoryIdempotencyStore, M as Money, a as MoneyValue, P as PROTECTED_MONETIZATION_FIELDS, T as TRANSACTION_MANAGEMENT_TYPE, N as TransactionManagementType, B as addDuration, i as calculateCommission, n as calculateCommissionWithSplits, k as calculateOrganizationPayout, C as calculatePeriodRange, D as calculateProratedAmount, j as calculateSplits, J as canCancelSubscription, K as canPauseSubscription, H as canRenewSubscription, L as canResumeSubscription, y as canSelfVerify, d as createIdempotencyManager, f as fromSmallestUnit, w as getAllowedUpdateFields, v as getTransactionType, p as isCategoryValid, u as isManualTransaction, q as isMonetizationTransaction, G as isSubscriptionActive, l as logger, l as loggerDefault, o as resolveCategory, F as resolveIntervalToDuration, r as reverseCommission, m as reverseSplits, s as setLogger, t as toSmallestUnit, x as validateFieldUpdate } from '../actions-Ctf2XUL-.js';
|
|
2
|
-
export { C as CircuitBreaker, w as CircuitBreakerConfig, q as CircuitOpenError, v as CircuitState, x as RetryConfig, n as RetryExhaustedError, y as RetryState, k as calculateDelay, p as createCircuitBreaker, l as isRetryableError, s as resilientExecute, r as retry, j as retryWithResult } from '../retry-80lBCmSe.js';
|
|
3
|
-
import { B as HooksRegistry, L as Logger } from '../index-C5SsOrV0.js';
|
|
4
|
-
import 'mongoose';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Hook Utilities
|
|
8
|
-
* @classytic/revenue
|
|
9
|
-
*
|
|
10
|
-
* Fire-and-forget hook execution - never blocks main flow
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Trigger hooks asynchronously without waiting
|
|
15
|
-
* Errors are logged but never thrown
|
|
16
|
-
*
|
|
17
|
-
* @param hooks - Hooks object
|
|
18
|
-
* @param event - Event name
|
|
19
|
-
* @param data - Event data
|
|
20
|
-
* @param logger - Logger instance
|
|
21
|
-
*/
|
|
22
|
-
declare function triggerHook(hooks: HooksRegistry, event: string, data: unknown, logger: Logger): void;
|
|
23
|
-
|
|
24
|
-
export { triggerHook };
|