@acontplus/core 1.0.12 → 1.0.13
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 +63 -2
- package/package.json +1 -1
- package/src/lib/models/auth.d.ts +8 -0
- package/src/lib/models/auth.js +2 -0
- package/src/lib/models/auth.js.map +1 -0
- package/src/lib/models/index.d.ts +1 -0
- package/src/lib/models/index.js +1 -0
- package/src/lib/models/index.js.map +1 -1
- package/src/lib/models/user-data.d.ts +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,69 @@
|
|
|
1
1
|
# @acontplus/core
|
|
2
2
|
|
|
3
|
-
Core library for AcontPlus applications.
|
|
3
|
+
Core library for AcontPlus applications, providing essential utilities and functionalities for business logic, calculations, and configuration management.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @acontplus/core
|
|
8
|
+
npm install @acontplus/core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **Pricing Calculations**: Comprehensive pricing utilities including discount calculators, line item calculators, pricing calculators, profit calculators, and tax calculators
|
|
14
|
+
- **Constants**: Predefined constants for SRI (Servicio de Rentas Internas) document types and separators
|
|
15
|
+
- **Environment Configuration**: Type-safe environment configuration interfaces
|
|
16
|
+
- **Models & Value Objects**: Domain models and value objects for business entities
|
|
17
|
+
- **Ports & Adapters**: Clean architecture patterns with ports and adapters for external integrations
|
|
18
|
+
- **Type Definitions**: Comprehensive TypeScript type definitions for type safety
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
### Pricing Calculations
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { DiscountCalculator, TaxCalculator, PricingCalculator } from '@acontplus/core';
|
|
26
|
+
|
|
27
|
+
// Calculate discounts
|
|
28
|
+
const discountCalc = new DiscountCalculator();
|
|
29
|
+
const discount = discountCalc.calculate(100, 10); // 10% discount on $100
|
|
30
|
+
|
|
31
|
+
// Calculate taxes
|
|
32
|
+
const taxCalc = new TaxCalculator();
|
|
33
|
+
const tax = taxCalc.calculate(100, 0.12); // 12% tax on $100
|
|
34
|
+
|
|
35
|
+
// Complex pricing calculations
|
|
36
|
+
const pricingCalc = new PricingCalculator();
|
|
37
|
+
const finalPrice = pricingCalc.calculateTotal(items, discounts, taxes);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Constants
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import { SRI_DOCUMENT_TYPE, SEPARATOR_KEY_CODE } from '@acontplus/core';
|
|
44
|
+
|
|
45
|
+
// Use SRI document types for Ecuadorian tax system
|
|
46
|
+
const documentType = SRI_DOCUMENT_TYPE.RUC; // '04'
|
|
47
|
+
|
|
48
|
+
// Use separator constants
|
|
49
|
+
const separator = SEPARATOR_KEY_CODE.SLASH; // '|'
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Environment Configuration
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { Environment } from '@acontplus/core';
|
|
56
|
+
|
|
57
|
+
const environment: Environment = {
|
|
58
|
+
apiBaseUrl: 'https://api.example.com',
|
|
59
|
+
isProduction: false,
|
|
60
|
+
tokenKey: 'auth_token',
|
|
61
|
+
refreshTokenKey: 'refresh_token',
|
|
62
|
+
clientId: 'your-client-id',
|
|
63
|
+
loginRoute: '/login'
|
|
64
|
+
};
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Running unit tests
|
|
68
|
+
|
|
69
|
+
Run `nx test core` to execute the unit tests.
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../packages/core/src/lib/models/auth.ts"],"names":[],"mappings":""}
|
package/src/lib/models/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/core/src/lib/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/core/src/lib/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC"}
|