mirror of https://github.com/openclaw/openclaw.git
53 lines
1.3 KiB
TypeScript
53 lines
1.3 KiB
TypeScript
import { Type, type Static } from "@sinclair/typebox";
|
|
|
|
const TokenType = Type.Union([
|
|
Type.Literal("doc"),
|
|
Type.Literal("docx"),
|
|
Type.Literal("sheet"),
|
|
Type.Literal("bitable"),
|
|
Type.Literal("folder"),
|
|
Type.Literal("file"),
|
|
Type.Literal("wiki"),
|
|
Type.Literal("mindnote"),
|
|
]);
|
|
|
|
const MemberType = Type.Union([
|
|
Type.Literal("email"),
|
|
Type.Literal("openid"),
|
|
Type.Literal("userid"),
|
|
Type.Literal("unionid"),
|
|
Type.Literal("openchat"),
|
|
Type.Literal("opendepartmentid"),
|
|
]);
|
|
|
|
const Permission = Type.Union([
|
|
Type.Literal("view"),
|
|
Type.Literal("edit"),
|
|
Type.Literal("full_access"),
|
|
]);
|
|
|
|
export const FeishuPermSchema = Type.Union([
|
|
Type.Object({
|
|
action: Type.Literal("list"),
|
|
token: Type.String({ description: "File token" }),
|
|
type: TokenType,
|
|
}),
|
|
Type.Object({
|
|
action: Type.Literal("add"),
|
|
token: Type.String({ description: "File token" }),
|
|
type: TokenType,
|
|
member_type: MemberType,
|
|
member_id: Type.String({ description: "Member ID (email, open_id, user_id, etc.)" }),
|
|
perm: Permission,
|
|
}),
|
|
Type.Object({
|
|
action: Type.Literal("remove"),
|
|
token: Type.String({ description: "File token" }),
|
|
type: TokenType,
|
|
member_type: MemberType,
|
|
member_id: Type.String({ description: "Member ID to remove" }),
|
|
}),
|
|
]);
|
|
|
|
export type FeishuPermParams = Static<typeof FeishuPermSchema>;
|