@archtx/utils 1.1.16 → 1.1.18
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/make-uuid.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* The default size we implement here is 14 char,
|
|
7
7
|
*
|
|
8
|
-
* Note: for size, check the
|
|
8
|
+
* Note: for size, check the collision probability calculator: https://zelark.github.io/nano-id-cc/
|
|
9
9
|
*
|
|
10
10
|
* @param prefix
|
|
11
11
|
* @param opts
|
package/dist/make-uuid.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { customAlphabet } from 'nanoid';
|
|
2
|
+
const CUSTOM_ALPHABET = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz-';
|
|
3
|
+
const generator = customAlphabet(CUSTOM_ALPHABET, 20);
|
|
2
4
|
/**
|
|
3
5
|
* This func is used by Entities to create `id` fields, some Entities embed the OrganizationEntity's `id` in their
|
|
4
6
|
* own `id`, in these cases, the `organizationId` is passed as an arg. The position of the embedded organizationId
|
|
@@ -6,7 +8,7 @@ import { nanoid } from 'nanoid';
|
|
|
6
8
|
*
|
|
7
9
|
* The default size we implement here is 14 char,
|
|
8
10
|
*
|
|
9
|
-
* Note: for size, check the
|
|
11
|
+
* Note: for size, check the collision probability calculator: https://zelark.github.io/nano-id-cc/
|
|
10
12
|
*
|
|
11
13
|
* @param prefix
|
|
12
14
|
* @param opts
|
|
@@ -16,8 +18,8 @@ export const makeUuid = (prefix, opts) => {
|
|
|
16
18
|
const psfx = opts?.postfix ? `${opts?.postfix}` : '';
|
|
17
19
|
// no spaces or line-breaks allowed
|
|
18
20
|
// The only special chars allowed are "-" and "_"
|
|
19
|
-
return `${prfx}${
|
|
21
|
+
return `${prfx}${generator(opts?.size)}${psfx}`
|
|
20
22
|
.trim()
|
|
21
|
-
.replace(/[
|
|
23
|
+
.replace(/[^a-zA-Z0-9\-_]/g, '');
|
|
22
24
|
};
|
|
23
25
|
//# sourceMappingURL=make-uuid.js.map
|
package/dist/make-uuid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-uuid.js","sourceRoot":"","sources":["../src/make-uuid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"make-uuid.js","sourceRoot":"","sources":["../src/make-uuid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAEvC,MAAM,eAAe,GACnB,kEAAkE,CAAA;AACpE,MAAM,SAAS,GAAG,cAAc,CAAC,eAAe,EAAE,EAAE,CAAC,CAAA;AAErD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,MAAwB,EACxB,IAA0C,EAC1C,EAAE;IACF,MAAM,IAAI,GAAG,MAAM,IAAI,EAAE,CAAA;IACzB,MAAM,IAAI,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IAEpD,mCAAmC;IACnC,iDAAiD;IACjD,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,EAAE;SAC5C,IAAI,EAAE;SACN,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAA;AACpC,CAAC,CAAA"}
|
package/dist/make-uuid.test.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-uuid.test.js","sourceRoot":"","sources":["../src/make-uuid.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"make-uuid.test.js","sourceRoot":"","sources":["../src/make-uuid.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAC,IAAI,EAAC,MAAM,EAAE,MAAM,QAAQ,CAAA;AA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@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archtx/utils",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.18",
|
|
4
4
|
"description": "Utility functions and helpers for JS software",
|
|
5
5
|
"main": "dist/exports.js",
|
|
6
6
|
"type": "module",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"clean-deep": "^3.4.0",
|
|
27
27
|
"lodash-es": "^4.17.21",
|
|
28
|
-
"nanoid": "^5.
|
|
28
|
+
"nanoid": "^5.1.4"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@typescript-eslint/eslint-plugin": "^5.48.1",
|