@acontplus/core 1.1.2 → 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acontplus/core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
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
6
|
"@acontplus/utils": "^1.0.11",
|
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
import { BaseVo } from './base.vo';
|
|
2
2
|
/**
|
|
3
|
-
* Generates a UUID v4
|
|
4
|
-
*
|
|
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
|
-
//
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
// Modern browsers and Node.js 15+
|
|
13
|
+
const cryptoObj = typeof crypto !== 'undefined' ? crypto :
|
|
14
|
+
(typeof globalThis !== 'undefined' && globalThis.crypto) ||
|
|
15
|
+
(typeof window !== 'undefined' && window.crypto) ||
|
|
16
|
+
null;
|
|
17
|
+
if (cryptoObj && typeof cryptoObj.getRandomValues === 'function') {
|
|
18
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
|
19
|
+
const array = new Uint8Array(1);
|
|
20
|
+
cryptoObj.getRandomValues(array);
|
|
21
|
+
const r = array[0] % 16;
|
|
22
|
+
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
23
|
+
return v.toString(16);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
throw new Error('Crypto API not available - modern environment required');
|
|
16
27
|
}
|
|
17
28
|
export class EntityIdVo extends BaseVo {
|
|
18
29
|
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
|
|
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,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QACxD,CAAC,OAAO,UAAU,KAAK,WAAW,IAAI,UAAU,CAAC,MAAM,CAAC;YACxD,CAAC,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,MAAM,CAAC;YAChD,IAAI,CAAC;IAEP,IAAI,SAAS,IAAI,OAAO,SAAS,CAAC,eAAe,KAAK,UAAU,EAAE,CAAC;QACjE,OAAO,sCAAsC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE;YACjE,MAAM,KAAK,GAAG,IAAI,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