@necto/id 1.6.6 → 1.6.8

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.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var e=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var u=(t,r)=>{for(var o in r)e(t,o,{get:r[o],enumerable:!0})},g=(t,r,o,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let m of f(r))!p.call(t,m)&&m!==o&&e(t,m,{get:()=>r[m],enumerable:!(n=A(r,m))||n.enumerable});return t};var b=t=>g(e({},"__esModule",{value:!0}),t);var E={};u(E,{id:()=>y});module.exports=b(E);var a=require("@necto/assert"),i=require("@necto/constants"),s=require("@necto/crypto");function y(t=21,r=Array.from([...i.ALPHABET.LOWERCASE,...i.ALPHABET.CAPITALIZED])){(0,a.assert)(t>0,"Length must be a positive integer.");let o=(0,s.randomBytes)(t);return Array.from(o).map(n=>r[n%r.length]).join("")}0&&(module.exports={id});
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`@necto/assert`),t=require(`@necto/constants`),n=require(`@necto/crypto`);function r(r=21,i=Array.from([...t.ALPHABET.LOWERCASE,...t.ALPHABET.CAPITALIZED])){(0,e.assert)(r>0,`Length must be a positive integer.`);let a=(0,n.randomBytes)(r);return Array.from(a).map(e=>i[e%i.length]).join(``)}exports.id=r;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/id.ts"],"sourcesContent":["/**\n * Copyright (c) Corinvo, LLC. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nexport * from './id';\n","/**\n * Copyright (c) Corinvo, LLC. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { assert } from '@necto/assert';\nimport { ALPHABET } from '@necto/constants';\nimport { randomBytes } from '@necto/crypto';\n\n/**\n * Generates a random ID of the specified length using the provided character set.\n * @param length - The length of the ID to generate.\n * @param charset - The character set to use for generating the ID (default: ALPHABET_COMBINED).\n * @returns A randomly generated ID string.\n */\nexport function id(\n length = 21,\n charset: string[] = Array.from([\n ...ALPHABET.LOWERCASE,\n ...ALPHABET.CAPITALIZED\n ])\n): string {\n assert(length > 0, 'Length must be a positive integer.');\n\n const randomValues: Uint8Array = randomBytes(length);\n return Array.from(randomValues as Iterable<number>)\n .map((value: number): string => charset[value % charset.length])\n .join('');\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,QAAAE,IAAA,eAAAC,EAAAH,GCQA,IAAAI,EAAuB,yBACvBC,EAAyB,4BACzBC,EAA4B,yBAQrB,SAASC,EACdC,EAAS,GACTC,EAAoB,MAAM,KAAK,CAC7B,GAAG,WAAS,UACZ,GAAG,WAAS,WACd,CAAC,EACO,IACR,UAAOD,EAAS,EAAG,oCAAoC,EAEvD,IAAME,KAA2B,eAAYF,CAAM,EACnD,OAAO,MAAM,KAAKE,CAAgC,EAC/C,IAAKC,GAA0BF,EAAQE,EAAQF,EAAQ,MAAM,CAAC,EAC9D,KAAK,EAAE,CACZ","names":["index_exports","__export","id","__toCommonJS","import_assert","import_constants","import_crypto","id","length","charset","randomValues","value"]}
1
+ {"version":3,"file":"index.cjs","names":["ALPHABET"],"sources":["../src/id.ts"],"sourcesContent":["/**\n * Copyright (c) Corinvo, LLC. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { assert } from '@necto/assert';\nimport { ALPHABET } from '@necto/constants';\nimport { randomBytes } from '@necto/crypto';\n\n/**\n * Generates a random ID of the specified length using the provided character set.\n * @param length - The length of the ID to generate.\n * @param charset - The character set to use for generating the ID (default: ALPHABET_COMBINED).\n * @returns A randomly generated ID string.\n */\nexport function id(\n length = 21,\n charset: string[] = Array.from([\n ...ALPHABET.LOWERCASE,\n ...ALPHABET.CAPITALIZED\n ])\n): string {\n assert(length > 0, 'Length must be a positive integer.');\n\n const randomValues: Uint8Array = randomBytes(length);\n return Array.from(randomValues as Iterable<number>)\n .map((value: number): string => charset[value % charset.length])\n .join('');\n}\n"],"mappings":"2JAkBA,SAAgB,EACd,EAAS,GACT,EAAoB,MAAM,KAAK,CAC7B,GAAGA,EAAAA,SAAS,UACZ,GAAGA,EAAAA,SAAS,YACb,CAAC,CACM,EACR,EAAA,EAAA,QAAO,EAAS,EAAG,qCAAqC,CAExD,IAAM,GAAA,EAAA,EAAA,aAAuC,EAAO,CACpD,OAAO,MAAM,KAAK,EAAiC,CAChD,IAAK,GAA0B,EAAQ,EAAQ,EAAQ,QAAQ,CAC/D,KAAK,GAAG"}
package/dist/index.d.cts CHANGED
@@ -1,3 +1,4 @@
1
+ //#region src/id.d.ts
1
2
  /**
2
3
  * Copyright (c) Corinvo, LLC. and affiliates.
3
4
  *
@@ -12,5 +13,6 @@
12
13
  * @returns A randomly generated ID string.
13
14
  */
14
15
  declare function id(length?: number, charset?: string[]): string;
15
-
16
+ //#endregion
16
17
  export { id };
18
+ //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ //#region src/id.d.ts
1
2
  /**
2
3
  * Copyright (c) Corinvo, LLC. and affiliates.
3
4
  *
@@ -12,5 +13,6 @@
12
13
  * @returns A randomly generated ID string.
13
14
  */
14
15
  declare function id(length?: number, charset?: string[]): string;
15
-
16
+ //#endregion
16
17
  export { id };
18
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{assert as e}from"@necto/assert";import{ALPHABET as o}from"@necto/constants";import{randomBytes as i}from"@necto/crypto";function f(r=21,t=Array.from([...o.LOWERCASE,...o.CAPITALIZED])){e(r>0,"Length must be a positive integer.");let m=i(r);return Array.from(m).map(n=>t[n%t.length]).join("")}export{f as id};
1
+ import{assert as e}from"@necto/assert";import{ALPHABET as t}from"@necto/constants";import{randomBytes as n}from"@necto/crypto";function r(r=21,i=Array.from([...t.LOWERCASE,...t.CAPITALIZED])){e(r>0,`Length must be a positive integer.`);let a=n(r);return Array.from(a).map(e=>i[e%i.length]).join(``)}export{r as id};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/id.ts"],"sourcesContent":["/**\n * Copyright (c) Corinvo, LLC. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { assert } from '@necto/assert';\nimport { ALPHABET } from '@necto/constants';\nimport { randomBytes } from '@necto/crypto';\n\n/**\n * Generates a random ID of the specified length using the provided character set.\n * @param length - The length of the ID to generate.\n * @param charset - The character set to use for generating the ID (default: ALPHABET_COMBINED).\n * @returns A randomly generated ID string.\n */\nexport function id(\n length = 21,\n charset: string[] = Array.from([\n ...ALPHABET.LOWERCASE,\n ...ALPHABET.CAPITALIZED\n ])\n): string {\n assert(length > 0, 'Length must be a positive integer.');\n\n const randomValues: Uint8Array = randomBytes(length);\n return Array.from(randomValues as Iterable<number>)\n .map((value: number): string => charset[value % charset.length])\n .join('');\n}\n"],"mappings":"AAQA,OAAS,UAAAA,MAAc,gBACvB,OAAS,YAAAC,MAAgB,mBACzB,OAAS,eAAAC,MAAmB,gBAQrB,SAASC,EACdC,EAAS,GACTC,EAAoB,MAAM,KAAK,CAC7B,GAAGJ,EAAS,UACZ,GAAGA,EAAS,WACd,CAAC,EACO,CACRD,EAAOI,EAAS,EAAG,oCAAoC,EAEvD,IAAME,EAA2BJ,EAAYE,CAAM,EACnD,OAAO,MAAM,KAAKE,CAAgC,EAC/C,IAAKC,GAA0BF,EAAQE,EAAQF,EAAQ,MAAM,CAAC,EAC9D,KAAK,EAAE,CACZ","names":["assert","ALPHABET","randomBytes","id","length","charset","randomValues","value"]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/id.ts"],"sourcesContent":["/**\n * Copyright (c) Corinvo, LLC. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { assert } from '@necto/assert';\nimport { ALPHABET } from '@necto/constants';\nimport { randomBytes } from '@necto/crypto';\n\n/**\n * Generates a random ID of the specified length using the provided character set.\n * @param length - The length of the ID to generate.\n * @param charset - The character set to use for generating the ID (default: ALPHABET_COMBINED).\n * @returns A randomly generated ID string.\n */\nexport function id(\n length = 21,\n charset: string[] = Array.from([\n ...ALPHABET.LOWERCASE,\n ...ALPHABET.CAPITALIZED\n ])\n): string {\n assert(length > 0, 'Length must be a positive integer.');\n\n const randomValues: Uint8Array = randomBytes(length);\n return Array.from(randomValues as Iterable<number>)\n .map((value: number): string => charset[value % charset.length])\n .join('');\n}\n"],"mappings":"+HAkBA,SAAgB,EACd,EAAS,GACT,EAAoB,MAAM,KAAK,CAC7B,GAAG,EAAS,UACZ,GAAG,EAAS,YACb,CAAC,CACM,CACR,EAAO,EAAS,EAAG,qCAAqC,CAExD,IAAM,EAA2B,EAAY,EAAO,CACpD,OAAO,MAAM,KAAK,EAAiC,CAChD,IAAK,GAA0B,EAAQ,EAAQ,EAAQ,QAAQ,CAC/D,KAAK,GAAG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@necto/id",
3
- "version": "1.6.6",
3
+ "version": "1.6.8",
4
4
  "type": "module",
5
5
  "description": "Necto's library for generating algorithmic ID's based on specified parameters.",
6
6
  "main": "./dist/index.cjs",
@@ -25,18 +25,14 @@
25
25
  ],
26
26
  "author": "Corinvo OSS Team",
27
27
  "license": "MIT",
28
- "devDependencies": {
29
- "@types/node": "^22.14.1",
30
- "@types/randombytes": "^2.0.3",
31
- "tsup": "^8.4.0"
32
- },
33
28
  "dependencies": {
34
- "@necto/assert": "1.0.0",
35
- "@necto/crypto": "1.0.0",
36
- "@necto/constants": "1.4.5"
29
+ "@necto/assert": "1.0.1",
30
+ "@necto/crypto": "1.0.1",
31
+ "@necto/constants": "2.0.1"
37
32
  },
38
- "scripts": {
39
- "build": "tsup --minify",
40
- "build:watch": "tsup --watch"
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "https://github.com/nectoutil/NodeKit",
36
+ "directory": "packages/@necto/necto-id"
41
37
  }
42
38
  }