@hexabot-ai/types 3.0.2-alpha.0 → 3.0.2-alpha.10
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/README.md +2 -2
- package/dist/cjs/chat/label.js +0 -1
- package/dist/cjs/user/index.js +5 -1
- package/dist/cjs/user/mcp-token.js +31 -0
- package/dist/esm/chat/label.js +0 -1
- package/dist/esm/user/index.js +1 -0
- package/dist/esm/user/mcp-token.js +28 -0
- package/dist/types/chat/label-group.d.ts +0 -2
- package/dist/types/chat/label-group.d.ts.map +1 -1
- package/dist/types/chat/label.d.ts +0 -4
- package/dist/types/chat/label.d.ts.map +1 -1
- package/dist/types/chat/subscriber.d.ts +0 -2
- package/dist/types/chat/subscriber.d.ts.map +1 -1
- package/dist/types/user/index.d.ts +1 -0
- package/dist/types/user/index.d.ts.map +1 -1
- package/dist/types/user/mcp-token.d.ts +113 -0
- package/dist/types/user/mcp-token.d.ts.map +1 -0
- package/dist/types/user/user.d.ts +0 -2
- package/dist/types/user/user.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/chat/label.ts +0 -1
- package/src/index.test.ts +20 -0
- package/src/user/index.ts +9 -0
- package/src/user/mcp-token.ts +53 -0
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ Shared zod-first runtime contracts for Hexabot API entity outputs.
|
|
|
11
11
|
- `cms`: `ContentType*`, `Content*`, `Menu*`
|
|
12
12
|
- `i18n`: `Language*`, `Translation*`
|
|
13
13
|
- `setting`: `Setting*`, `Metadata*`
|
|
14
|
-
- `user`: `UserProfile*`, `Model*`, `Permission*`, `Role*`, `Credential*`, `User*`
|
|
14
|
+
- `user`: `UserProfile*`, `Model*`, `Permission*`, `Role*`, `Credential*`, `McpToken*`, `User*`
|
|
15
15
|
- `workflow`: `Workflow*`, `WorkflowVersion*`, `WorkflowRun*`, `MemoryDefinition*`, `MemoryRecord*`, `McpServer*`
|
|
16
16
|
- `utils/test/dummy`: `Dummy*`
|
|
17
17
|
- `attachment`: `Attachment*`
|
|
@@ -163,7 +163,7 @@ Unknown keys are stripped by default.
|
|
|
163
163
|
- Legacy API enum/type paths can re-export from this package without value changes.
|
|
164
164
|
- Schema parsing preserves nullable/optional normalization used by API entity outputs.
|
|
165
165
|
- Mixed owner/triggeredBy contracts (`Subscriber | User`) are supported in workflow full contracts.
|
|
166
|
-
- Sensitive output parity is preserved for credentials (`value`
|
|
166
|
+
- Sensitive output parity is preserved for credentials and MCP tokens (`value` and token hashes are not part of output contracts).
|
|
167
167
|
|
|
168
168
|
## Breaking-Change Notes
|
|
169
169
|
|
package/dist/cjs/chat/label.js
CHANGED
|
@@ -19,7 +19,6 @@ const labelAliasMap = {
|
|
|
19
19
|
const labelStubObjectSchema = base_1.baseStubSchema.extend({
|
|
20
20
|
title: zod_1.z.string(),
|
|
21
21
|
name: zod_1.z.string(),
|
|
22
|
-
label_id: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).nullable().optional(),
|
|
23
22
|
description: nullableOptionalStringSchema,
|
|
24
23
|
builtin: zod_1.z.coerce.boolean(),
|
|
25
24
|
});
|
package/dist/cjs/user/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Full terms: see LICENSE.md.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.credentialStubSchema = exports.credentialSchema = exports.credentialFullSchema = exports.permissionStubSchema = exports.permissionSchema = exports.permissionFullSchema = exports.modelStubSchema = exports.modelSchema = exports.modelFullSchema = exports.roleStubSchema = exports.roleSchema = exports.roleFullSchema = exports.userStubSchema = exports.userSchema = exports.userFullSchema = exports.userProfileAssignedStubSchema = exports.userProfileAssignedSchema = exports.userProfileAssignedFullSchema = exports.userProfileStubSchema = exports.userProfileSchema = exports.userProfileFullSchema = exports.MethodToAction = exports.Action = void 0;
|
|
8
|
+
exports.mcpTokenStubSchema = exports.mcpTokenSchema = exports.mcpTokenFullSchema = exports.credentialStubSchema = exports.credentialSchema = exports.credentialFullSchema = exports.permissionStubSchema = exports.permissionSchema = exports.permissionFullSchema = exports.modelStubSchema = exports.modelSchema = exports.modelFullSchema = exports.roleStubSchema = exports.roleSchema = exports.roleFullSchema = exports.userStubSchema = exports.userSchema = exports.userFullSchema = exports.userProfileAssignedStubSchema = exports.userProfileAssignedSchema = exports.userProfileAssignedFullSchema = exports.userProfileStubSchema = exports.userProfileSchema = exports.userProfileFullSchema = exports.MethodToAction = exports.Action = void 0;
|
|
9
9
|
var domain_1 = require("./domain");
|
|
10
10
|
Object.defineProperty(exports, "Action", { enumerable: true, get: function () { return domain_1.Action; } });
|
|
11
11
|
Object.defineProperty(exports, "MethodToAction", { enumerable: true, get: function () { return domain_1.MethodToAction; } });
|
|
@@ -37,3 +37,7 @@ var credential_1 = require("./credential");
|
|
|
37
37
|
Object.defineProperty(exports, "credentialFullSchema", { enumerable: true, get: function () { return credential_1.credentialFullSchema; } });
|
|
38
38
|
Object.defineProperty(exports, "credentialSchema", { enumerable: true, get: function () { return credential_1.credentialSchema; } });
|
|
39
39
|
Object.defineProperty(exports, "credentialStubSchema", { enumerable: true, get: function () { return credential_1.credentialStubSchema; } });
|
|
40
|
+
var mcp_token_1 = require("./mcp-token");
|
|
41
|
+
Object.defineProperty(exports, "mcpTokenFullSchema", { enumerable: true, get: function () { return mcp_token_1.mcpTokenFullSchema; } });
|
|
42
|
+
Object.defineProperty(exports, "mcpTokenSchema", { enumerable: true, get: function () { return mcp_token_1.mcpTokenSchema; } });
|
|
43
|
+
Object.defineProperty(exports, "mcpTokenStubSchema", { enumerable: true, get: function () { return mcp_token_1.mcpTokenStubSchema; } });
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Hexabot — Fair Core License (FCL-1.0-ALv2)
|
|
4
|
+
* Copyright (c) 2026 Hexastack.
|
|
5
|
+
* Full terms: see LICENSE.md.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.mcpTokenFullSchema = exports.mcpTokenSchema = exports.mcpTokenStubSchema = void 0;
|
|
9
|
+
const zod_1 = require("zod");
|
|
10
|
+
const aliases_1 = require("../shared/aliases");
|
|
11
|
+
const base_1 = require("../shared/base");
|
|
12
|
+
const preprocess_1 = require("../shared/preprocess");
|
|
13
|
+
const user_1 = require("./user");
|
|
14
|
+
const nullableDateSchema = (0, preprocess_1.preprocess)((value) => (value == null ? null : value), zod_1.z.coerce.date().nullable());
|
|
15
|
+
const mcpTokenAliasMap = {
|
|
16
|
+
ownerId: "owner",
|
|
17
|
+
};
|
|
18
|
+
const mcpTokenStubObjectSchema = base_1.baseStubSchema.extend({
|
|
19
|
+
name: zod_1.z.string(),
|
|
20
|
+
tokenPrefix: zod_1.z.string(),
|
|
21
|
+
expiresAt: nullableDateSchema,
|
|
22
|
+
lastUsedAt: nullableDateSchema,
|
|
23
|
+
revokedAt: nullableDateSchema,
|
|
24
|
+
});
|
|
25
|
+
exports.mcpTokenStubSchema = mcpTokenStubObjectSchema;
|
|
26
|
+
exports.mcpTokenSchema = (0, preprocess_1.preprocess)((value) => (0, aliases_1.withAliases)(value, mcpTokenAliasMap), mcpTokenStubObjectSchema.extend({
|
|
27
|
+
owner: (0, preprocess_1.preprocess)((value) => (value == null ? null : (0, aliases_1.asId)(value)), zod_1.z.string()),
|
|
28
|
+
}));
|
|
29
|
+
exports.mcpTokenFullSchema = mcpTokenStubObjectSchema.extend({
|
|
30
|
+
owner: (0, preprocess_1.preprocess)((value) => (value == null ? null : value), zod_1.z.lazy(() => user_1.userSchema).nullable()),
|
|
31
|
+
});
|
package/dist/esm/chat/label.js
CHANGED
|
@@ -16,7 +16,6 @@ const labelAliasMap = {
|
|
|
16
16
|
const labelStubObjectSchema = baseStubSchema.extend({
|
|
17
17
|
title: z.string(),
|
|
18
18
|
name: z.string(),
|
|
19
|
-
label_id: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
20
19
|
description: nullableOptionalStringSchema,
|
|
21
20
|
builtin: z.coerce.boolean(),
|
|
22
21
|
});
|
package/dist/esm/user/index.js
CHANGED
|
@@ -11,3 +11,4 @@ export { roleFullSchema, roleSchema, roleStubSchema, } from "./role";
|
|
|
11
11
|
export { modelFullSchema, modelSchema, modelStubSchema, } from "./model";
|
|
12
12
|
export { permissionFullSchema, permissionSchema, permissionStubSchema, } from "./permission";
|
|
13
13
|
export { credentialFullSchema, credentialSchema, credentialStubSchema, } from "./credential";
|
|
14
|
+
export { mcpTokenFullSchema, mcpTokenSchema, mcpTokenStubSchema, } from "./mcp-token";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Hexabot — Fair Core License (FCL-1.0-ALv2)
|
|
3
|
+
* Copyright (c) 2026 Hexastack.
|
|
4
|
+
* Full terms: see LICENSE.md.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { asId, withAliases } from "../shared/aliases";
|
|
8
|
+
import { baseStubSchema } from "../shared/base";
|
|
9
|
+
import { preprocess } from "../shared/preprocess";
|
|
10
|
+
import { userSchema } from "./user";
|
|
11
|
+
const nullableDateSchema = preprocess((value) => (value == null ? null : value), z.coerce.date().nullable());
|
|
12
|
+
const mcpTokenAliasMap = {
|
|
13
|
+
ownerId: "owner",
|
|
14
|
+
};
|
|
15
|
+
const mcpTokenStubObjectSchema = baseStubSchema.extend({
|
|
16
|
+
name: z.string(),
|
|
17
|
+
tokenPrefix: z.string(),
|
|
18
|
+
expiresAt: nullableDateSchema,
|
|
19
|
+
lastUsedAt: nullableDateSchema,
|
|
20
|
+
revokedAt: nullableDateSchema,
|
|
21
|
+
});
|
|
22
|
+
export const mcpTokenStubSchema = mcpTokenStubObjectSchema;
|
|
23
|
+
export const mcpTokenSchema = preprocess((value) => withAliases(value, mcpTokenAliasMap), mcpTokenStubObjectSchema.extend({
|
|
24
|
+
owner: preprocess((value) => (value == null ? null : asId(value)), z.string()),
|
|
25
|
+
}));
|
|
26
|
+
export const mcpTokenFullSchema = mcpTokenStubObjectSchema.extend({
|
|
27
|
+
owner: preprocess((value) => (value == null ? null : value), z.lazy(() => userSchema).nullable()),
|
|
28
|
+
});
|
|
@@ -24,7 +24,6 @@ export declare const labelGroupFullSchema: z.ZodObject<{
|
|
|
24
24
|
title: string;
|
|
25
25
|
name: string;
|
|
26
26
|
builtin: boolean;
|
|
27
|
-
label_id?: Record<string, unknown> | null | undefined;
|
|
28
27
|
description?: string | null | undefined;
|
|
29
28
|
group?: string | null | undefined;
|
|
30
29
|
users?: undefined;
|
|
@@ -35,7 +34,6 @@ export declare const labelGroupFullSchema: z.ZodObject<{
|
|
|
35
34
|
title: string;
|
|
36
35
|
name: string;
|
|
37
36
|
builtin: boolean;
|
|
38
|
-
label_id?: Record<string, unknown> | null | undefined;
|
|
39
37
|
description?: string | null | undefined;
|
|
40
38
|
group?: string | null | undefined;
|
|
41
39
|
users?: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label-group.d.ts","sourceRoot":"","sources":["../../../src/chat/label-group.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,eAAO,MAAM,oBAAoB;;;;;iBAAyB,CAAC;AAE3D,eAAO,MAAM,gBAAgB;;;;;;iBAE3B,CAAC;AAEH,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"label-group.d.ts","sourceRoot":"","sources":["../../../src/chat/label-group.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,eAAO,MAAM,oBAAoB;;;;;iBAAyB,CAAC;AAE3D,eAAO,MAAM,gBAAgB;;;;;;iBAE3B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;iBAK/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -5,7 +5,6 @@ export declare const labelStubSchema: z.ZodObject<{
|
|
|
5
5
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
6
6
|
title: z.ZodString;
|
|
7
7
|
name: z.ZodString;
|
|
8
|
-
label_id: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
9
8
|
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
10
9
|
builtin: z.ZodCoercedBoolean<unknown>;
|
|
11
10
|
}, z.core.$strip>;
|
|
@@ -16,7 +15,6 @@ export declare const labelSchema: z.ZodType<{
|
|
|
16
15
|
title: string;
|
|
17
16
|
name: string;
|
|
18
17
|
builtin: boolean;
|
|
19
|
-
label_id?: Record<string, unknown> | null | undefined;
|
|
20
18
|
description?: string | null | undefined;
|
|
21
19
|
group?: string | null | undefined;
|
|
22
20
|
users?: undefined;
|
|
@@ -27,7 +25,6 @@ export declare const labelSchema: z.ZodType<{
|
|
|
27
25
|
title: string;
|
|
28
26
|
name: string;
|
|
29
27
|
builtin: boolean;
|
|
30
|
-
label_id?: Record<string, unknown> | null | undefined;
|
|
31
28
|
description?: string | null | undefined;
|
|
32
29
|
group?: string | null | undefined;
|
|
33
30
|
users?: undefined;
|
|
@@ -38,7 +35,6 @@ export declare const labelFullSchema: z.ZodObject<{
|
|
|
38
35
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
39
36
|
title: z.ZodString;
|
|
40
37
|
name: z.ZodString;
|
|
41
|
-
label_id: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
42
38
|
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
43
39
|
builtin: z.ZodCoercedBoolean<unknown>;
|
|
44
40
|
users: z.ZodOptional<z.ZodType<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../src/chat/label.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../src/chat/label.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoBxB,eAAO,MAAM,eAAe;;;;;;;;iBAAwB,CAAC;AAErD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;YASvB,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAS1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEhD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -98,7 +98,6 @@ export declare const subscriberFullSchema: z.ZodObject<{
|
|
|
98
98
|
title: string;
|
|
99
99
|
name: string;
|
|
100
100
|
builtin: boolean;
|
|
101
|
-
label_id?: Record<string, unknown> | null | undefined;
|
|
102
101
|
description?: string | null | undefined;
|
|
103
102
|
group?: string | null | undefined;
|
|
104
103
|
users?: undefined;
|
|
@@ -109,7 +108,6 @@ export declare const subscriberFullSchema: z.ZodObject<{
|
|
|
109
108
|
title: string;
|
|
110
109
|
name: string;
|
|
111
110
|
builtin: boolean;
|
|
112
|
-
label_id?: Record<string, unknown> | null | undefined;
|
|
113
111
|
description?: string | null | undefined;
|
|
114
112
|
group?: string | null | undefined;
|
|
115
113
|
users?: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriber.d.ts","sourceRoot":"","sources":["../../../src/chat/subscriber.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoCxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;iBAAuB,CAAC;AAEzD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAG5B,CAAC;AAEF,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"subscriber.d.ts","sourceRoot":"","sources":["../../../src/chat/subscriber.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoCxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;iBAAuB,CAAC;AAEzD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAG5B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiB/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -6,4 +6,5 @@ export { roleFullSchema, roleSchema, roleStubSchema, type Role, type RoleFull, t
|
|
|
6
6
|
export { modelFullSchema, modelSchema, modelStubSchema, type Model, type ModelFull, type ModelStub, } from "./model";
|
|
7
7
|
export { permissionFullSchema, permissionSchema, permissionStubSchema, type Permission, type PermissionFull, type PermissionStub, } from "./permission";
|
|
8
8
|
export { credentialFullSchema, credentialSchema, credentialStubSchema, type Credential, type CredentialFull, type CredentialStub, } from "./credential";
|
|
9
|
+
export { mcpTokenFullSchema, mcpTokenSchema, mcpTokenStubSchema, type McpToken, type McpTokenFull, type McpTokenStub, } from "./mcp-token";
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/user/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,MAAM,EACN,cAAc,EACd,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,MAAM,EACX,KAAK,SAAS,GACf,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,6BAA6B,EAC7B,yBAAyB,EACzB,6BAA6B,EAC7B,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,YAAY,GAClB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,cAAc,EACd,UAAU,EACV,cAAc,EACd,KAAK,IAAI,EACT,KAAK,QAAQ,EACb,KAAK,QAAQ,GACd,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,cAAc,EACd,UAAU,EACV,cAAc,EACd,KAAK,IAAI,EACT,KAAK,QAAQ,EACb,KAAK,QAAQ,GACd,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,eAAe,EACf,WAAW,EACX,eAAe,EACf,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,SAAS,GACf,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,cAAc,GACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,cAAc,GACpB,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/user/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,MAAM,EACN,cAAc,EACd,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,MAAM,EACX,KAAK,SAAS,GACf,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,6BAA6B,EAC7B,yBAAyB,EACzB,6BAA6B,EAC7B,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,YAAY,GAClB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,cAAc,EACd,UAAU,EACV,cAAc,EACd,KAAK,IAAI,EACT,KAAK,QAAQ,EACb,KAAK,QAAQ,GACd,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,cAAc,EACd,UAAU,EACV,cAAc,EACd,KAAK,IAAI,EACT,KAAK,QAAQ,EACb,KAAK,QAAQ,GACd,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,eAAe,EACf,WAAW,EACX,eAAe,EACf,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,SAAS,GACf,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,cAAc,GACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,cAAc,GACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,YAAY,GAClB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const mcpTokenStubSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
5
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
tokenPrefix: z.ZodString;
|
|
8
|
+
expiresAt: z.ZodType<Date | null, unknown, z.core.$ZodTypeInternals<Date | null, unknown>>;
|
|
9
|
+
lastUsedAt: z.ZodType<Date | null, unknown, z.core.$ZodTypeInternals<Date | null, unknown>>;
|
|
10
|
+
revokedAt: z.ZodType<Date | null, unknown, z.core.$ZodTypeInternals<Date | null, unknown>>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export declare const mcpTokenSchema: z.ZodType<{
|
|
13
|
+
id: string;
|
|
14
|
+
createdAt: Date;
|
|
15
|
+
updatedAt: Date;
|
|
16
|
+
name: string;
|
|
17
|
+
tokenPrefix: string;
|
|
18
|
+
expiresAt: Date | null;
|
|
19
|
+
lastUsedAt: Date | null;
|
|
20
|
+
revokedAt: Date | null;
|
|
21
|
+
owner: string;
|
|
22
|
+
}, unknown, z.core.$ZodTypeInternals<{
|
|
23
|
+
id: string;
|
|
24
|
+
createdAt: Date;
|
|
25
|
+
updatedAt: Date;
|
|
26
|
+
name: string;
|
|
27
|
+
tokenPrefix: string;
|
|
28
|
+
expiresAt: Date | null;
|
|
29
|
+
lastUsedAt: Date | null;
|
|
30
|
+
revokedAt: Date | null;
|
|
31
|
+
owner: string;
|
|
32
|
+
}, unknown>>;
|
|
33
|
+
export declare const mcpTokenFullSchema: z.ZodObject<{
|
|
34
|
+
id: z.ZodString;
|
|
35
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
36
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
37
|
+
name: z.ZodString;
|
|
38
|
+
tokenPrefix: z.ZodString;
|
|
39
|
+
expiresAt: z.ZodType<Date | null, unknown, z.core.$ZodTypeInternals<Date | null, unknown>>;
|
|
40
|
+
lastUsedAt: z.ZodType<Date | null, unknown, z.core.$ZodTypeInternals<Date | null, unknown>>;
|
|
41
|
+
revokedAt: z.ZodType<Date | null, unknown, z.core.$ZodTypeInternals<Date | null, unknown>>;
|
|
42
|
+
owner: z.ZodType<{
|
|
43
|
+
id: string;
|
|
44
|
+
createdAt: Date;
|
|
45
|
+
updatedAt: Date;
|
|
46
|
+
firstName: string;
|
|
47
|
+
lastName: string;
|
|
48
|
+
language: string | null;
|
|
49
|
+
timezone: number;
|
|
50
|
+
locale: string | null;
|
|
51
|
+
gender: string | null;
|
|
52
|
+
country: string | null;
|
|
53
|
+
foreignId: string | null;
|
|
54
|
+
assignedAt: Date | null;
|
|
55
|
+
lastvisit: Date | null;
|
|
56
|
+
retainedFrom: Date | null;
|
|
57
|
+
channel: {
|
|
58
|
+
name: string | null;
|
|
59
|
+
data?: Record<string, any> | null | undefined;
|
|
60
|
+
};
|
|
61
|
+
username: string;
|
|
62
|
+
email: string;
|
|
63
|
+
sendEmail: boolean;
|
|
64
|
+
state: boolean;
|
|
65
|
+
resetCount: number;
|
|
66
|
+
resetToken: string | null;
|
|
67
|
+
labels: string[];
|
|
68
|
+
assignedTo: string | null;
|
|
69
|
+
roles: string[];
|
|
70
|
+
avatar: string | null;
|
|
71
|
+
provider?: {
|
|
72
|
+
strategy: "local";
|
|
73
|
+
sub?: string | undefined;
|
|
74
|
+
} | undefined;
|
|
75
|
+
} | null, unknown, z.core.$ZodTypeInternals<{
|
|
76
|
+
id: string;
|
|
77
|
+
createdAt: Date;
|
|
78
|
+
updatedAt: Date;
|
|
79
|
+
firstName: string;
|
|
80
|
+
lastName: string;
|
|
81
|
+
language: string | null;
|
|
82
|
+
timezone: number;
|
|
83
|
+
locale: string | null;
|
|
84
|
+
gender: string | null;
|
|
85
|
+
country: string | null;
|
|
86
|
+
foreignId: string | null;
|
|
87
|
+
assignedAt: Date | null;
|
|
88
|
+
lastvisit: Date | null;
|
|
89
|
+
retainedFrom: Date | null;
|
|
90
|
+
channel: {
|
|
91
|
+
name: string | null;
|
|
92
|
+
data?: Record<string, any> | null | undefined;
|
|
93
|
+
};
|
|
94
|
+
username: string;
|
|
95
|
+
email: string;
|
|
96
|
+
sendEmail: boolean;
|
|
97
|
+
state: boolean;
|
|
98
|
+
resetCount: number;
|
|
99
|
+
resetToken: string | null;
|
|
100
|
+
labels: string[];
|
|
101
|
+
assignedTo: string | null;
|
|
102
|
+
roles: string[];
|
|
103
|
+
avatar: string | null;
|
|
104
|
+
provider?: {
|
|
105
|
+
strategy: "local";
|
|
106
|
+
sub?: string | undefined;
|
|
107
|
+
} | undefined;
|
|
108
|
+
} | null, unknown>>;
|
|
109
|
+
}, z.core.$strip>;
|
|
110
|
+
export type McpTokenStub = z.infer<typeof mcpTokenStubSchema>;
|
|
111
|
+
export type McpToken = z.infer<typeof mcpTokenSchema>;
|
|
112
|
+
export type McpTokenFull = z.infer<typeof mcpTokenFullSchema>;
|
|
113
|
+
//# sourceMappingURL=mcp-token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-token.d.ts","sourceRoot":"","sources":["../../../src/user/mcp-token.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuBxB,eAAO,MAAM,kBAAkB;;;;;;;;;iBAA2B,CAAC;AAE3D,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;YAQ1B,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAK7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -138,7 +138,6 @@ export declare const userFullSchema: z.ZodObject<{
|
|
|
138
138
|
title: string;
|
|
139
139
|
name: string;
|
|
140
140
|
builtin: boolean;
|
|
141
|
-
label_id?: Record<string, unknown> | null | undefined;
|
|
142
141
|
description?: string | null | undefined;
|
|
143
142
|
group?: string | null | undefined;
|
|
144
143
|
users?: undefined;
|
|
@@ -149,7 +148,6 @@ export declare const userFullSchema: z.ZodObject<{
|
|
|
149
148
|
title: string;
|
|
150
149
|
name: string;
|
|
151
150
|
builtin: boolean;
|
|
152
|
-
label_id?: Record<string, unknown> | null | undefined;
|
|
153
151
|
description?: string | null | undefined;
|
|
154
152
|
group?: string | null | undefined;
|
|
155
153
|
users?: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/user/user.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiCxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAuB,CAAC;AAEnD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAoBtB,CAAC;AAEF,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/user/user.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiCxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAuB,CAAC;AAEnD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAoBtB,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiBzB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAE9C,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
|
package/package.json
CHANGED
package/src/chat/label.ts
CHANGED
|
@@ -20,7 +20,6 @@ const labelAliasMap = {
|
|
|
20
20
|
const labelStubObjectSchema = baseStubSchema.extend({
|
|
21
21
|
title: z.string(),
|
|
22
22
|
name: z.string(),
|
|
23
|
-
label_id: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
24
23
|
description: nullableOptionalStringSchema,
|
|
25
24
|
builtin: z.coerce.boolean(),
|
|
26
25
|
});
|
package/src/index.test.ts
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
IncomingMessageType,
|
|
32
32
|
labelFullSchema,
|
|
33
33
|
labelSchema,
|
|
34
|
+
mcpTokenSchema,
|
|
34
35
|
mcpServerFullSchema,
|
|
35
36
|
mcpServerSchema,
|
|
36
37
|
memoryRecordFullSchema,
|
|
@@ -682,6 +683,25 @@ describe("@hexabot-ai/types schemas", () => {
|
|
|
682
683
|
expect("value" in credential).toBe(false);
|
|
683
684
|
});
|
|
684
685
|
|
|
686
|
+
it("keeps MCP token outputs free of token hashes", () => {
|
|
687
|
+
const token = mcpTokenSchema.parse({
|
|
688
|
+
id: "mt_1",
|
|
689
|
+
createdAt: now,
|
|
690
|
+
updatedAt: now,
|
|
691
|
+
name: "Codex",
|
|
692
|
+
tokenPrefix: "hbt_mcp_abcd",
|
|
693
|
+
tokenHash: "secret-hash",
|
|
694
|
+
ownerId: "u_1",
|
|
695
|
+
expiresAt: null,
|
|
696
|
+
lastUsedAt: null,
|
|
697
|
+
revokedAt: null,
|
|
698
|
+
});
|
|
699
|
+
|
|
700
|
+
expect(token.name).toBe("Codex");
|
|
701
|
+
expect(token.owner).toBe("u_1");
|
|
702
|
+
expect("tokenHash" in token).toBe(false);
|
|
703
|
+
});
|
|
704
|
+
|
|
685
705
|
it("computes workflow derived fields via parser bridge", () => {
|
|
686
706
|
const parser = jest.fn((yml: string) => ({
|
|
687
707
|
defs: {},
|
package/src/user/index.ts
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Hexabot — Fair Core License (FCL-1.0-ALv2)
|
|
3
|
+
* Copyright (c) 2026 Hexastack.
|
|
4
|
+
* Full terms: see LICENSE.md.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
|
|
9
|
+
import { asId, withAliases } from "../shared/aliases";
|
|
10
|
+
import { baseStubSchema } from "../shared/base";
|
|
11
|
+
import { preprocess } from "../shared/preprocess";
|
|
12
|
+
|
|
13
|
+
import { userSchema } from "./user";
|
|
14
|
+
|
|
15
|
+
const nullableDateSchema = preprocess(
|
|
16
|
+
(value) => (value == null ? null : value),
|
|
17
|
+
z.coerce.date().nullable(),
|
|
18
|
+
);
|
|
19
|
+
const mcpTokenAliasMap = {
|
|
20
|
+
ownerId: "owner",
|
|
21
|
+
} as const;
|
|
22
|
+
const mcpTokenStubObjectSchema = baseStubSchema.extend({
|
|
23
|
+
name: z.string(),
|
|
24
|
+
tokenPrefix: z.string(),
|
|
25
|
+
expiresAt: nullableDateSchema,
|
|
26
|
+
lastUsedAt: nullableDateSchema,
|
|
27
|
+
revokedAt: nullableDateSchema,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const mcpTokenStubSchema = mcpTokenStubObjectSchema;
|
|
31
|
+
|
|
32
|
+
export const mcpTokenSchema = preprocess(
|
|
33
|
+
(value) => withAliases(value, mcpTokenAliasMap),
|
|
34
|
+
mcpTokenStubObjectSchema.extend({
|
|
35
|
+
owner: preprocess(
|
|
36
|
+
(value) => (value == null ? null : asId(value)),
|
|
37
|
+
z.string(),
|
|
38
|
+
),
|
|
39
|
+
}),
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
export const mcpTokenFullSchema = mcpTokenStubObjectSchema.extend({
|
|
43
|
+
owner: preprocess(
|
|
44
|
+
(value) => (value == null ? null : value),
|
|
45
|
+
z.lazy(() => userSchema).nullable(),
|
|
46
|
+
),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export type McpTokenStub = z.infer<typeof mcpTokenStubSchema>;
|
|
50
|
+
|
|
51
|
+
export type McpToken = z.infer<typeof mcpTokenSchema>;
|
|
52
|
+
|
|
53
|
+
export type McpTokenFull = z.infer<typeof mcpTokenFullSchema>;
|