@acontplus/core 1.1.2 → 1.1.4

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
@@ -88,17 +88,17 @@ const finalPrice = pricingCalc.calculateTotal(items, discounts, taxes);
88
88
  ### Value Objects
89
89
 
90
90
  ```typescript
91
- import { Money, EntityId, IdentificationNumber, AuthTokens } from '@acontplus/core';
91
+ import { MoneyVo, EntityIdVo, IdentificationNumberVo, AuthTokens } from '@acontplus/core';
92
92
 
93
93
  // Money value object for financial calculations
94
- const price = new Money(99.99, 'USD');
95
- const discountedPrice = price.subtract(new Money(10.0, 'USD'));
94
+ const price = new MoneyVo(99.99, 'USD');
95
+ const discountedPrice = price.subtract(new MoneyVo(10.0, 'USD'));
96
96
 
97
97
  // Entity ID for domain entities
98
- const customerId = new EntityId(12345);
98
+ const customerId = new EntityIdVo('12345');
99
99
 
100
100
  // Identification number with validation
101
- const ecuadorianId = new IdentificationNumber('1234567890');
101
+ const ecuadorianId = new IdentificationNumberVo('1234567890');
102
102
 
103
103
  // Authentication tokens
104
104
  const tokens = new AuthTokens('access_token', 'refresh_token');
@@ -166,11 +166,20 @@ class CreateCustomerUseCase extends UseCase<CreateCustomerRequest, Customer> {
166
166
  ### Constants
167
167
 
168
168
  ```typescript
169
- import { APP_CONSTANTS } from '@acontplus/core';
169
+ import {
170
+ SRI_DOCUMENT_TYPE,
171
+ SRI_DOCUMENT_TYPE_CUSTOM,
172
+ SEPARATOR_KEY_CODE,
173
+ SEPARADORES_REGEX,
174
+ } from '@acontplus/core';
175
+
176
+ // SRI document type constants
177
+ const invoiceType = SRI_DOCUMENT_TYPE.FACTURA;
178
+ const customType = SRI_DOCUMENT_TYPE_CUSTOM.PROFORMA;
170
179
 
171
- // Application constants
172
- const maxRetries = APP_CONSTANTS.MAX_RETRY_ATTEMPTS;
173
- const timeout = APP_CONSTANTS.DEFAULT_TIMEOUT;
180
+ // Separator constants
181
+ const separatorCode = SEPARATOR_KEY_CODE.DASH;
182
+ const separatorPattern = SEPARADORES_REGEX;
174
183
  ```
175
184
 
176
185
  ### Environment Configuration
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@acontplus/core",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Enterprise-grade core library implementing Domain-Driven Design (DDD) and Clean Architecture patterns. Provides value objects, use cases, entities, HTTP adapters, pricing calculations, API response handling, and foundational utilities for Angular applications.",
5
5
  "peerDependencies": {
6
- "@acontplus/utils": "^1.0.11",
6
+ "@acontplus/utils": "^1.1.0",
7
7
  "tslib": "^2.8.1",
8
8
  "typescript": "^5.9.2"
9
9
  },
@@ -60,12 +60,12 @@
60
60
  "author": "Ivan Paz <ifer343@gmail.com>",
61
61
  "license": "MIT",
62
62
  "bugs": {
63
- "url": "https://github.com/Acontplus-S-A-S/acontplus-libs/issues"
63
+ "url": "https://github.com/acontplus/acontplus-libs/issues"
64
64
  },
65
- "homepage": "https://github.com/Acontplus-S-A-S/acontplus-libs#readme",
65
+ "homepage": "https://github.com/acontplus/acontplus-libs#readme",
66
66
  "repository": {
67
67
  "type": "git",
68
- "url": "git+https://github.com/Acontplus-S-A-S/acontplus-libs.git"
68
+ "url": "git+https://github.com/acontplus/acontplus-libs.git"
69
69
  },
70
70
  "publishConfig": {
71
71
  "access": "public",
@@ -1,18 +1,30 @@
1
1
  import { BaseVo } from './base.vo';
2
2
  /**
3
- * Generates a UUID v4 with fallback for environments where crypto.randomUUID() is not available.
4
- * Uses crypto.randomUUID() when available, falls back to manual UUID generation.
3
+ * Generates a UUID v4 using cryptographically secure methods.
4
+ * 1. crypto.randomUUID() (Node.js 19+, modern browsers)
5
+ * 2. crypto.getRandomValues() (Node.js 15+, all modern browsers)
5
6
  */
6
7
  function generateUUID() {
8
+ // Modern browsers and Node.js 19+
7
9
  if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
8
10
  return crypto.randomUUID();
9
11
  }
10
- // Fallback for older environments (Node.js < 19, older browsers)
11
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
12
- const r = (Math.random() * 16) | 0;
13
- const v = c === 'x' ? r : (r & 0x3) | 0x8;
14
- return v.toString(16);
15
- });
12
+ // Modern browsers and Node.js 15+
13
+ const cryptoObj = typeof crypto !== 'undefined'
14
+ ? crypto
15
+ : (typeof globalThis !== 'undefined' && globalThis.crypto) ||
16
+ (typeof window !== 'undefined' && window.crypto) ||
17
+ null;
18
+ if (cryptoObj && typeof cryptoObj.getRandomValues === 'function') {
19
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
20
+ const array = new Uint8Array(1);
21
+ cryptoObj.getRandomValues(array);
22
+ const r = array[0] % 16;
23
+ const v = c === 'x' ? r : (r & 0x3) | 0x8;
24
+ return v.toString(16);
25
+ });
26
+ }
27
+ throw new Error('Crypto API not available - modern environment required');
16
28
  }
17
29
  export class EntityIdVo extends BaseVo {
18
30
  constructor(value) {
@@ -1 +1 @@
1
- {"version":3,"file":"entity-id.vo.js","sourceRoot":"","sources":["../../../../../../packages/core/src/lib/value-objects/entity-id.vo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC;;;GAGG;AACH,SAAS,YAAY;IACnB,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU,EAAE,CAAC;QAC7E,OAAO,MAAM,CAAC,UAAU,EAAE,CAAC;IAC7B,CAAC;IACD,iEAAiE;IACjE,OAAO,sCAAsC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE;QACjE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QACnC,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;QAC1C,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,OAAO,UAAW,SAAQ,MAAc;IAC5C,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;IAED,MAAM,CAAC,QAAQ;QACb,OAAO,IAAI,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC;IACxC,CAAC;IAES,QAAQ,CAAC,KAAa;QAC9B,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"entity-id.vo.js","sourceRoot":"","sources":["../../../../../../packages/core/src/lib/value-objects/entity-id.vo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC;;;;GAIG;AACH,SAAS,YAAY;IACnB,kCAAkC;IAClC,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU,EAAE,CAAC;QAC7E,OAAO,MAAM,CAAC,UAAU,EAAE,CAAC;IAC7B,CAAC;IAED,kCAAkC;IAClC,MAAM,SAAS,GACb,OAAO,MAAM,KAAK,WAAW;QAC3B,CAAC,CAAC,MAAM;QACR,CAAC,CAAC,CAAC,OAAO,UAAU,KAAK,WAAW,IAAI,UAAU,CAAC,MAAM,CAAC;YACxD,CAAC,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,MAAM,CAAC;YAChD,IAAI,CAAC;IAEX,IAAI,SAAS,IAAI,OAAO,SAAS,CAAC,eAAe,KAAK,UAAU,EAAE,CAAC;QACjE,OAAO,sCA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