@intutic/id 1.0.1
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/LICENSE +21 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -0
- package/package.json +24 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Intutic
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPORTED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate a prefixed unique ID.
|
|
3
|
+
*
|
|
4
|
+
* All IDs in Intutic use a short prefix followed by an underscore and a
|
|
5
|
+
* nanoid-generated string. This makes IDs human-readable and debuggable
|
|
6
|
+
* while remaining globally unique.
|
|
7
|
+
*
|
|
8
|
+
* @param prefix - 2–3 character prefix (e.g., `'wk'` for workspace, `'tc'` for tool call)
|
|
9
|
+
* @returns A prefixed unique ID like `wk_V1StGXR8_Z5jdHi6B-myT`
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { newId } from '@intutic/id'
|
|
14
|
+
*
|
|
15
|
+
* const workspaceId = newId('wk') // → 'wk_V1StGXR8_Z5jdHi6B-myT'
|
|
16
|
+
* const toolCallId = newId('tc') // → 'tc_1SRtkN_8KbFh3GtyU2xz9'
|
|
17
|
+
* const eventId = newId('ev') // → 'ev_qWeR7y_AsDfGhJkLzXcVb'
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function newId(prefix: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Generate an ISO 8601 timestamp string.
|
|
23
|
+
*
|
|
24
|
+
* Always use this function instead of `Date.now()` or manual date formatting.
|
|
25
|
+
* This ensures consistent timestamp format across the entire codebase.
|
|
26
|
+
*
|
|
27
|
+
* @returns An ISO 8601 timestamp like `2025-06-08T21:38:09.000Z`
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* import { newIso } from '@intutic/id'
|
|
32
|
+
*
|
|
33
|
+
* const createdAt = newIso() // → '2025-06-08T21:38:09.123Z'
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function newIso(): string;
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,MAAM,IAAI,MAAM,CAE/B"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.newId = newId;
|
|
4
|
+
exports.newIso = newIso;
|
|
5
|
+
const nanoid_1 = require("nanoid");
|
|
6
|
+
/**
|
|
7
|
+
* Generate a prefixed unique ID.
|
|
8
|
+
*
|
|
9
|
+
* All IDs in Intutic use a short prefix followed by an underscore and a
|
|
10
|
+
* nanoid-generated string. This makes IDs human-readable and debuggable
|
|
11
|
+
* while remaining globally unique.
|
|
12
|
+
*
|
|
13
|
+
* @param prefix - 2–3 character prefix (e.g., `'wk'` for workspace, `'tc'` for tool call)
|
|
14
|
+
* @returns A prefixed unique ID like `wk_V1StGXR8_Z5jdHi6B-myT`
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { newId } from '@intutic/id'
|
|
19
|
+
*
|
|
20
|
+
* const workspaceId = newId('wk') // → 'wk_V1StGXR8_Z5jdHi6B-myT'
|
|
21
|
+
* const toolCallId = newId('tc') // → 'tc_1SRtkN_8KbFh3GtyU2xz9'
|
|
22
|
+
* const eventId = newId('ev') // → 'ev_qWeR7y_AsDfGhJkLzXcVb'
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
function newId(prefix) {
|
|
26
|
+
return `${prefix}_${(0, nanoid_1.nanoid)(21)}`;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Generate an ISO 8601 timestamp string.
|
|
30
|
+
*
|
|
31
|
+
* Always use this function instead of `Date.now()` or manual date formatting.
|
|
32
|
+
* This ensures consistent timestamp format across the entire codebase.
|
|
33
|
+
*
|
|
34
|
+
* @returns An ISO 8601 timestamp like `2025-06-08T21:38:09.000Z`
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* import { newIso } from '@intutic/id'
|
|
39
|
+
*
|
|
40
|
+
* const createdAt = newIso() // → '2025-06-08T21:38:09.123Z'
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
function newIso() {
|
|
44
|
+
return new Date().toISOString();
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAqBA,sBAEC;AAiBD,wBAEC;AA1CD,mCAA+B;AAE/B;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,KAAK,CAAC,MAAc;IAClC,OAAO,GAAG,MAAM,IAAI,IAAA,eAAM,EAAC,EAAE,CAAC,EAAE,CAAA;AAClC,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAgB,MAAM;IACpB,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;AACjC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@intutic/id",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"./dist"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"test": "vitest run --passWithNoTests",
|
|
15
|
+
"typecheck": "tsc --noEmit"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"nanoid": "^3.3.12"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"typescript": "^5.5",
|
|
22
|
+
"vitest": "^3"
|
|
23
|
+
}
|
|
24
|
+
}
|