core-mb 1.1.5 → 1.1.7
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/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/uuid.helper.d.ts +13 -0
- package/dist/uuid.helper.js +26 -0
- package/package.json +3 -2
- package/src/index.ts +2 -1
- package/src/uuid.helper.ts +23 -0
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate UUID v4
|
|
3
|
+
*/
|
|
4
|
+
export declare const uuid: () => string;
|
|
5
|
+
/**
|
|
6
|
+
* Generate UUID without hyphens (32 chars)
|
|
7
|
+
*/
|
|
8
|
+
export declare const uuidCompact: () => string;
|
|
9
|
+
/**
|
|
10
|
+
* Generate UUID with prefix
|
|
11
|
+
* Example: EXP_550e8400-e29b-41d4-a716-446655440000
|
|
12
|
+
*/
|
|
13
|
+
export declare const uuidWithPrefix: (prefix: string) => string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.uuidWithPrefix = exports.uuidCompact = exports.uuid = void 0;
|
|
4
|
+
const uuid_1 = require("uuid");
|
|
5
|
+
/**
|
|
6
|
+
* Generate UUID v4
|
|
7
|
+
*/
|
|
8
|
+
const uuid = () => {
|
|
9
|
+
return (0, uuid_1.v4)();
|
|
10
|
+
};
|
|
11
|
+
exports.uuid = uuid;
|
|
12
|
+
/**
|
|
13
|
+
* Generate UUID without hyphens (32 chars)
|
|
14
|
+
*/
|
|
15
|
+
const uuidCompact = () => {
|
|
16
|
+
return (0, uuid_1.v4)().replace(/-/g, "");
|
|
17
|
+
};
|
|
18
|
+
exports.uuidCompact = uuidCompact;
|
|
19
|
+
/**
|
|
20
|
+
* Generate UUID with prefix
|
|
21
|
+
* Example: EXP_550e8400-e29b-41d4-a716-446655440000
|
|
22
|
+
*/
|
|
23
|
+
const uuidWithPrefix = (prefix) => {
|
|
24
|
+
return `${prefix}_${(0, uuid_1.v4)()}`;
|
|
25
|
+
};
|
|
26
|
+
exports.uuidWithPrefix = uuidWithPrefix;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "core-mb",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"description": "Core utility functions for the MB ecosystem in TypeScript",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"typescript"
|
|
20
20
|
],
|
|
21
21
|
"author": "Marco Bytes",
|
|
22
|
-
"license": "
|
|
22
|
+
"license": "MIT",
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|
|
25
25
|
"url": "git+https://github.com/marcojourney/core-mb.git"
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"class-transformer": "^0.5.1",
|
|
43
43
|
"class-validator": "^0.14.2",
|
|
44
|
+
"uuid": "^13.0.0",
|
|
44
45
|
"winston": "^3.17.0"
|
|
45
46
|
}
|
|
46
47
|
}
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from "uuid";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Generate UUID v4
|
|
5
|
+
*/
|
|
6
|
+
export const uuid = (): string => {
|
|
7
|
+
return uuidv4();
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Generate UUID without hyphens (32 chars)
|
|
12
|
+
*/
|
|
13
|
+
export const uuidCompact = (): string => {
|
|
14
|
+
return uuidv4().replace(/-/g, "");
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Generate UUID with prefix
|
|
19
|
+
* Example: EXP_550e8400-e29b-41d4-a716-446655440000
|
|
20
|
+
*/
|
|
21
|
+
export const uuidWithPrefix = (prefix: string): string => {
|
|
22
|
+
return `${prefix}_${uuidv4()}`;
|
|
23
|
+
};
|