@acontplus/core 1.0.12 → 1.0.14

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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acontplus/core",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "Core library for Acontplus projects, providing essential utilities and functionalities.",
5
5
  "dependencies": {
6
6
  "@acontplus/utils": "^1.0.6",
package/src/index.d.ts CHANGED
@@ -5,4 +5,5 @@ export * from './lib/models';
5
5
  export * from './lib/ports';
6
6
  export * from './lib/pricing';
7
7
  export * from './lib/types';
8
+ export * from './lib/use-cases';
8
9
  export * from './lib/value-objects';
package/src/index.js CHANGED
@@ -5,5 +5,6 @@ export * from './lib/models';
5
5
  export * from './lib/ports';
6
6
  export * from './lib/pricing';
7
7
  export * from './lib/types';
8
+ export * from './lib/use-cases';
8
9
  export * from './lib/value-objects';
9
10
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/core/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/core/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,8 @@
1
+ export interface DecodedToken {
2
+ exp: number;
3
+ iat: number;
4
+ sub: string;
5
+ email: string;
6
+ name: string;
7
+ roles?: string[];
8
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../packages/core/src/lib/models/auth.ts"],"names":[],"mappings":""}
@@ -1,4 +1,5 @@
1
1
  export * from './api-response';
2
+ export * from './auth';
2
3
  export * from './base-entity';
3
4
  export * from './paginated-result';
4
5
  export * from './pagination-params';
@@ -1,4 +1,5 @@
1
1
  export * from './api-response';
2
+ export * from './auth';
2
3
  export * from './base-entity';
3
4
  export * from './paginated-result';
4
5
  export * from './pagination-params';
@@ -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"}
@@ -1,4 +1,4 @@
1
1
  export interface UserData {
2
2
  email: string;
3
- name: string;
3
+ displayName: string;
4
4
  }
@@ -0,0 +1 @@
1
+ export * from './use-case';
@@ -0,0 +1,2 @@
1
+ export * from './use-case';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/core/src/lib/use-cases/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
@@ -0,0 +1,3 @@
1
+ export interface UseCase<TRequest = void, TResponse = void> {
2
+ execute(request: TRequest): TResponse | Promise<TResponse>;
3
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=use-case.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-case.js","sourceRoot":"","sources":["../../../../../../packages/core/src/lib/use-cases/use-case.ts"],"names":[],"mappings":""}