diff --git a/src/contracts/envelope.ts b/src/contracts/envelope.ts new file mode 100644 index 0000000..ef21bdf --- /dev/null +++ b/src/contracts/envelope.ts @@ -0,0 +1,23 @@ +/** 真源:BPOS-Document-Share/BPOS服务消息协议.md §1.3(v1.2)。本文件是手工同步副本。 */ +export type JsonValue = string | number | boolean | null | JsonValue[] | { [k: string]: JsonValue }; +export type JsonObject = { [k: string]: JsonValue }; + +export interface Correlation { + taskId?: string; + workflowId?: string; + invocationId?: string; +} + +export interface EventEnvelope { + id: string; // 全局唯一消息 id,发布方生成 + type: TType; // 消息类型全名(即主题名) + correlation: Correlation; + payload: TPayload; + occurredAt: string; // ISO-8601 + trace?: string; // W3C traceparent +} + +export interface CommandEnvelope + extends EventEnvelope { + idempotencyKey: string; // BUS-01 +}