@intutic/id 0.1.0
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 +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 +21 -0
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,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@intutic/id",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"main": ".dist/index.js",
|
|
5
|
+
"types": ".dist/index.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
".dist"
|
|
8
|
+
],
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"test": "vitest run",
|
|
12
|
+
"typecheck": "tsc --noEmit"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"nanoid": "^3.3.12"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"typescript": "^5.5",
|
|
19
|
+
"vitest": "^3"
|
|
20
|
+
}
|
|
21
|
+
}
|