This repository has been archived on 2026-09-13. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
BPOS-MVP/api-report/packages/contracts/src/org.d.ts
T

194 lines
7.3 KiB
TypeScript

/**
* 员工、岗位与权限(编码规范 §4 · `org`;语义出处 OS 02 员工管理)。
*
* 权限按岗位授予:客体三类(数据 域.对象[.字段] / 治理功能 / 任务)× 动作三种(读 / 写 / 治理)。
* 任务负责人与被征答人对所涉内容**天然可见**,不另行授权。
* 单组织、≤50 人:不做多租户,不引 OAuth/OIDC(编码规范 §4 鉴权定调)。
*/
import { z } from 'zod';
export declare const positionSchema: z.ZodObject<{
id: z.core.$ZodBranded<z.ZodString, "PositionId", "out">;
code: z.ZodString;
name: z.ZodString;
note: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
export type Position = z.infer<typeof positionSchema>;
export declare const STAFF_STATES: readonly ["active", "disabled"];
export declare const staffStateSchema: z.ZodEnum<{
active: "active";
disabled: "disabled";
}>;
export type StaffState = z.infer<typeof staffStateSchema>;
export declare const staffSchema: z.ZodObject<{
id: z.core.$ZodBranded<z.ZodString, "StaffId", "out">;
account: z.ZodString;
name: z.ZodString;
positionId: z.core.$ZodBranded<z.ZodString, "PositionId", "out">;
state: z.ZodDefault<z.ZodEnum<{
active: "active";
disabled: "disabled";
}>>;
}, z.core.$strip>;
export type Staff = z.infer<typeof staffSchema>;
export declare const GRANT_ACTIONS: readonly ["read", "write", "govern"];
export declare const grantActionSchema: z.ZodEnum<{
read: "read";
write: "write";
govern: "govern";
}>;
export type GrantAction = z.infer<typeof grantActionSchema>;
export declare const GRANT_ACTION_LABEL: Readonly<Record<GrantAction, string>>;
/** 治理台九功能 —— 授权客体之一 */
export declare const GOVERNANCE_FUNCTIONS: readonly ["task", "staff", "process", "trigger", "activity", "tool", "data", "memory", "system"];
export declare const governanceFunctionSchema: z.ZodEnum<{
data: "data";
task: "task";
trigger: "trigger";
system: "system";
tool: "tool";
activity: "activity";
staff: "staff";
process: "process";
memory: "memory";
}>;
export type GovernanceFunction = z.infer<typeof governanceFunctionSchema>;
export declare const GOVERNANCE_FUNCTION_LABEL: Readonly<Record<GovernanceFunction, string>>;
export declare const grantObjectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
kind: z.ZodLiteral<"data">;
domain: z.ZodString;
object: z.ZodString;
field: z.ZodOptional<z.ZodString>;
}, z.core.$strip>, z.ZodObject<{
kind: z.ZodLiteral<"governance">;
function: z.ZodEnum<{
data: "data";
task: "task";
trigger: "trigger";
system: "system";
tool: "tool";
activity: "activity";
staff: "staff";
process: "process";
memory: "memory";
}>;
}, z.core.$strip>, z.ZodObject<{
kind: z.ZodLiteral<"task">;
activityId: z.ZodOptional<z.ZodString>;
}, z.core.$strip>], "kind">;
export type GrantObject = z.infer<typeof grantObjectSchema>;
export declare const grantSchema: z.ZodObject<{
positionId: z.core.$ZodBranded<z.ZodString, "PositionId", "out">;
object: z.ZodDiscriminatedUnion<[z.ZodObject<{
kind: z.ZodLiteral<"data">;
domain: z.ZodString;
object: z.ZodString;
field: z.ZodOptional<z.ZodString>;
}, z.core.$strip>, z.ZodObject<{
kind: z.ZodLiteral<"governance">;
function: z.ZodEnum<{
data: "data";
task: "task";
trigger: "trigger";
system: "system";
tool: "tool";
activity: "activity";
staff: "staff";
process: "process";
memory: "memory";
}>;
}, z.core.$strip>, z.ZodObject<{
kind: z.ZodLiteral<"task">;
activityId: z.ZodOptional<z.ZodString>;
}, z.core.$strip>], "kind">;
action: z.ZodEnum<{
read: "read";
write: "write";
govern: "govern";
}>;
}, z.core.$strip>;
export type Grant = z.infer<typeof grantSchema>;
/** 员工停用前,其在途任务与待答卡须先改派完毕 */
export declare const disableCheckSchema: z.ZodObject<{
staffId: z.core.$ZodBranded<z.ZodString, "StaffId", "out">;
blocked: z.ZodBoolean;
openTasks: z.ZodDefault<z.ZodArray<z.ZodObject<{
taskId: z.ZodString;
title: z.ZodString;
}, z.core.$strip>>>;
openCards: z.ZodDefault<z.ZodArray<z.ZodObject<{
cardId: z.ZodString;
title: z.ZodString;
}, z.core.$strip>>>;
openApprovals: z.ZodDefault<z.ZodArray<z.ZodObject<{
approvalId: z.ZodString;
title: z.ZodString;
}, z.core.$strip>>>;
}, z.core.$strip>;
export type DisableCheck = z.infer<typeof disableCheckSchema>;
export declare const sessionSchema: z.ZodObject<{
staff: z.ZodObject<{
id: z.core.$ZodBranded<z.ZodString, "StaffId", "out">;
account: z.ZodString;
name: z.ZodString;
positionId: z.core.$ZodBranded<z.ZodString, "PositionId", "out">;
state: z.ZodDefault<z.ZodEnum<{
active: "active";
disabled: "disabled";
}>>;
}, z.core.$strip>;
position: z.ZodObject<{
id: z.core.$ZodBranded<z.ZodString, "PositionId", "out">;
code: z.ZodString;
name: z.ZodString;
note: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
grants: z.ZodArray<z.ZodObject<{
positionId: z.core.$ZodBranded<z.ZodString, "PositionId", "out">;
object: z.ZodDiscriminatedUnion<[z.ZodObject<{
kind: z.ZodLiteral<"data">;
domain: z.ZodString;
object: z.ZodString;
field: z.ZodOptional<z.ZodString>;
}, z.core.$strip>, z.ZodObject<{
kind: z.ZodLiteral<"governance">;
function: z.ZodEnum<{
data: "data";
task: "task";
trigger: "trigger";
system: "system";
tool: "tool";
activity: "activity";
staff: "staff";
process: "process";
memory: "memory";
}>;
}, z.core.$strip>, z.ZodObject<{
kind: z.ZodLiteral<"task">;
activityId: z.ZodOptional<z.ZodString>;
}, z.core.$strip>], "kind">;
action: z.ZodEnum<{
read: "read";
write: "write";
govern: "govern";
}>;
}, z.core.$strip>>;
}, z.core.$strip>;
export type Session = z.infer<typeof sessionSchema>;
/**
* 工作组 —— 一组「岗位 → 员工」的绑定,起单时装载、随工作流走。
*
* **不是第五种负责人策略**(OS 03「策略封闭四选」不动):
* 四策略回答的是「这个岗位该派给谁」,工作组直接给出了答案,策略于是无从发问。
* 键是**岗位 code**(BD / PM / FAE …),与流程包 `owner.position` 同一口径。
*/
export declare const workGroupSchema: z.ZodObject<{
id: z.ZodString;
name: z.ZodString;
ownerId: z.core.$ZodBranded<z.ZodString, "StaffId", "out">;
members: z.ZodRecord<z.ZodString, z.core.$ZodBranded<z.ZodString, "StaffId", "out">>;
}, z.core.$strip>;
export type WorkGroup = z.infer<typeof workGroupSchema>;
/** 装进工作流的**快照**:改组不改已起的单(留痕不被改写) */
export declare const workGroupBindingSchema: z.ZodRecord<z.ZodString, z.core.$ZodBranded<z.ZodString, "StaffId", "out">>;
export type WorkGroupBinding = z.infer<typeof workGroupBindingSchema>;