Skip to content

Interface: GovernanceClient ​

Properties ​

approvals ​

ts
approvals: object;

comment ​

ts
comment: (id, body) => Promise<{
  approvalId: string;
  authorId: string;
  body: string;
  createdAt: Date;
  id: string;
}>;

Adds a message to the discussion (definitions:write or definitions:approve).

Parameters ​
id ​

string

body ​

string

Returns ​

Promise<{ approvalId: string; authorId: string; body: string; createdAt: Date; id: string; }>

comments ​

ts
comments: (id) => Promise<object[]>;

A request's discussion, oldest first.

Parameters ​
id ​

string

Returns ​

Promise<object[]>

get ​

ts
get: (id) => Promise<{
  approval: {
     comment?: string | null;
     decidedAt?: Date | null;
     decidedBy?: string | null;
     decision?: "withdrawn" | "approved" | "rejected" | null;
     decisionComment?: string | null;
     id: string;
     key: string;
     kind: "workflow" | "rule" | "rule_set" | "collection_flow";
     requestedAt: Date;
     requestedBy: string;
     tenantId: string;
     version: number;
  };
  approvers: object[];
  backtest:   | {
     createdAt: Date;
     error?: string | null;
     finishedAt?: Date | null;
     id: string;
     progress: {
        done: number;
        total: number;
     };
     requestedBy: string;
     ruleKey?: string | null;
     ruleSetKey?: string | null;
     ruleVersion?: number | null;
     sample: {
        lastDays: number;
        limit: number;
     };
     status: "failed" | "completed" | "running" | "queued";
     summary?:   | {
        daily?: object[];
        decisions?: Record<string, number>;
        durationMs: number;
        evaluated: number;
        outcomes: z.ZodRecord<z.ZodEnum<{
           error: ...;
           fail: ...;
           pass: ...;
           skipped: ...;
        }>, z.ZodNumber>;
        overlap: z.ZodRecord<z.ZodString, z.ZodNumber>;
        sampleFailures: object[];
        wouldChange: z.ZodRecord<z.ZodString, z.ZodNumber>;
      }
        | null;
     temporalWorkflowId?: string | null;
     tenantId: string;
     workflowKey?: string | null;
     workflowVersion?: number | null;
   }
     | null;
  comments: object[];
  definition: unknown;
  dependencies: object[];
  diff:   | {
     changes: object[];
     delta: unknown;
     from: number;
     key: string;
     kind: "workflow" | "rule" | "rule_set" | "collection_flow";
     steps?: object[];
     to: number;
   }
     | null;
  publishedVersion: number | null;
  usage: object[];
}>;

One request with its version, diff, backtest, links, approvers and discussion.

Parameters ​
id ​

string

Returns ​

Promise<{ approval: { comment?: string | null; decidedAt?: Date | null; decidedBy?: string | null; decision?: "withdrawn" | "approved" | "rejected" | null; decisionComment?: string | null; id: string; key: string; kind: "workflow" | "rule" | "rule_set" | "collection_flow"; requestedAt: Date; requestedBy: string; tenantId: string; version: number; }; approvers: object[]; backtest: | { createdAt: Date; error?: string | null; finishedAt?: Date | null; id: string; progress: { done: number; total: number; }; requestedBy: string; ruleKey?: string | null; ruleSetKey?: string | null; ruleVersion?: number | null; sample: { lastDays: number; limit: number; }; status: "failed" | "completed" | "running" | "queued"; summary?: | { daily?: object[]; decisions?: Record<string, number>; durationMs: number; evaluated: number; outcomes: z.ZodRecord<z.ZodEnum<{ error: ...; fail: ...; pass: ...; skipped: ...; }>, z.ZodNumber>; overlap: z.ZodRecord<z.ZodString, z.ZodNumber>; sampleFailures: object[]; wouldChange: z.ZodRecord<z.ZodString, z.ZodNumber>; } | null; temporalWorkflowId?: string | null; tenantId: string; workflowKey?: string | null; workflowVersion?: number | null; } | null; comments: object[]; definition: unknown; dependencies: object[]; diff: | { changes: object[]; delta: unknown; from: number; key: string; kind: "workflow" | "rule" | "rule_set" | "collection_flow"; steps?: object[]; to: number; } | null; publishedVersion: number | null; usage: object[]; }>

list ​

ts
list: (query?) => Promise<Page<{
  comment?: string | null;
  decidedAt?: Date | null;
  decidedBy?: string | null;
  decision?: "withdrawn" | "approved" | "rejected" | null;
  decisionComment?: string | null;
  id: string;
  key: string;
  kind: "workflow" | "rule" | "rule_set" | "collection_flow";
  requestedAt: Date;
  requestedBy: string;
  tenantId: string;
  version: number;
}>>;

Approval requests, open by default, filtered and paged, with the total.

Parameters ​
query? ​

ApprovalListQuery

Returns ​

Promise<Page<{ comment?: string | null; decidedAt?: Date | null; decidedBy?: string | null; decision?: "withdrawn" | "approved" | "rejected" | null; decisionComment?: string | null; id: string; key: string; kind: "workflow" | "rule" | "rule_set" | "collection_flow"; requestedAt: Date; requestedBy: string; tenantId: string; version: number; }>>


approve ​

ts
approve: (kind, key, version, body?) => Promise<{
  approval: {
     comment?: string | null;
     decidedAt?: Date | null;
     decidedBy?: string | null;
     decision?: "withdrawn" | "approved" | "rejected" | null;
     decisionComment?: string | null;
     id: string;
     key: string;
     kind: "workflow" | "rule" | "rule_set" | "collection_flow";
     requestedAt: Date;
     requestedBy: string;
     tenantId: string;
     version: number;
  };
  definition: unknown;
}>;

Approves and publishes a pending version (definitions:approve).

Parameters ​

kind ​

"workflow" | "rule" | "rule_set" | "collection_flow"

key ​

string

version ​

number

body? ​
comment? ​

string

Returns ​

Promise<{ approval: { comment?: string | null; decidedAt?: Date | null; decidedBy?: string | null; decision?: "withdrawn" | "approved" | "rejected" | null; decisionComment?: string | null; id: string; key: string; kind: "workflow" | "rule" | "rule_set" | "collection_flow"; requestedAt: Date; requestedBy: string; tenantId: string; version: number; }; definition: unknown; }>


diff ​

ts
diff: (kind, key, query?) => Promise<{
  changes: object[];
  delta: unknown;
  from: number;
  key: string;
  kind: "workflow" | "rule" | "rule_set" | "collection_flow";
  steps?: object[];
  to: number;
}>;

Structured diff between two versions with a readable summary per change.

Parameters ​

kind ​

"workflow" | "rule" | "rule_set" | "collection_flow"

key ​

string

query? ​

DiffQuery

Returns ​

Promise<{ changes: object[]; delta: unknown; from: number; key: string; kind: "workflow" | "rule" | "rule_set" | "collection_flow"; steps?: object[]; to: number; }>


getVersion ​

ts
getVersion: (kind, key, version) => Promise<unknown>;

The full definition entity of one version, e.g. to restore it as a draft.

Parameters ​

kind ​

"workflow" | "rule" | "rule_set" | "collection_flow"

key ​

string

version ​

number

Returns ​

Promise<unknown>


reject ​

ts
reject: (kind, key, version, body?) => Promise<{
  approval: {
     comment?: string | null;
     decidedAt?: Date | null;
     decidedBy?: string | null;
     decision?: "withdrawn" | "approved" | "rejected" | null;
     decisionComment?: string | null;
     id: string;
     key: string;
     kind: "workflow" | "rule" | "rule_set" | "collection_flow";
     requestedAt: Date;
     requestedBy: string;
     tenantId: string;
     version: number;
  };
  definition: unknown;
}>;

Sends a pending version back to draft (definitions:approve).

Parameters ​

kind ​

"workflow" | "rule" | "rule_set" | "collection_flow"

key ​

string

version ​

number

body? ​
comment? ​

string

Returns ​

Promise<{ approval: { comment?: string | null; decidedAt?: Date | null; decidedBy?: string | null; decision?: "withdrawn" | "approved" | "rejected" | null; decisionComment?: string | null; id: string; key: string; kind: "workflow" | "rule" | "rule_set" | "collection_flow"; requestedAt: Date; requestedBy: string; tenantId: string; version: number; }; definition: unknown; }>


requestApproval ​

ts
requestApproval: (kind, key, version, body?) => Promise<{
  comment?: string | null;
  decidedAt?: Date | null;
  decidedBy?: string | null;
  decision?: "withdrawn" | "approved" | "rejected" | null;
  decisionComment?: string | null;
  id: string;
  key: string;
  kind: "workflow" | "rule" | "rule_set" | "collection_flow";
  requestedAt: Date;
  requestedBy: string;
  tenantId: string;
  version: number;
}>;

Moves a draft to pending_approval (definitions:write).

Parameters ​

kind ​

"workflow" | "rule" | "rule_set" | "collection_flow"

key ​

string

version ​

number

body? ​
comment? ​

string

Returns ​

Promise<{ comment?: string | null; decidedAt?: Date | null; decidedBy?: string | null; decision?: "withdrawn" | "approved" | "rejected" | null; decisionComment?: string | null; id: string; key: string; kind: "workflow" | "rule" | "rule_set" | "collection_flow"; requestedAt: Date; requestedBy: string; tenantId: string; version: number; }>


versions ​

ts
versions: (kind, key) => Promise<object[]>;

Every version of a definition, with status, author and approval (definitions:read).

Parameters ​

kind ​

"workflow" | "rule" | "rule_set" | "collection_flow"

key ​

string

Returns ​

Promise<object[]>


withdraw ​

ts
withdraw: (kind, key, version, body?) => Promise<{
  approval: {
     comment?: string | null;
     decidedAt?: Date | null;
     decidedBy?: string | null;
     decision?: "withdrawn" | "approved" | "rejected" | null;
     decisionComment?: string | null;
     id: string;
     key: string;
     kind: "workflow" | "rule" | "rule_set" | "collection_flow";
     requestedAt: Date;
     requestedBy: string;
     tenantId: string;
     version: number;
  };
  definition: unknown;
}>;

Withdraws an open request; the version goes back to draft (definitions:write, by its requester or an admin; 403 not_requester otherwise).

Parameters ​

kind ​

"workflow" | "rule" | "rule_set" | "collection_flow"

key ​

string

version ​

number

body? ​
comment? ​

string

Returns ​

Promise<{ approval: { comment?: string | null; decidedAt?: Date | null; decidedBy?: string | null; decision?: "withdrawn" | "approved" | "rejected" | null; decisionComment?: string | null; id: string; key: string; kind: "workflow" | "rule" | "rule_set" | "collection_flow"; requestedAt: Date; requestedBy: string; tenantId: string; version: number; }; definition: unknown; }>

Released under the Apache-2.0 License.