Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions packages/app-shell/src/views/metadata-admin/anchors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export function registerBuiltinAnchors(): void {
},
});

// flow / workflow may reference an object at the root or under `on`
// flow may reference an object at the root or under `on`
registerMetadataResource({
type: 'flow',
anchors: [{
Expand All @@ -201,16 +201,8 @@ export function registerBuiltinAnchors(): void {
],
createDefaults: { nodes: [], edges: [] },
});
registerMetadataResource({
type: 'workflow',
anchors: [{
anchorType: 'object',
match: anchorByField(['object', 'on.object']),
groupLabel: 'Workflow Rules',
order: 51,
}],
createFields: ['name', 'objectName', 'triggerType', 'description'],
});
// ADR-0020: `workflow` retired as a metadata type — record state machines
// are a `state_machine` validation rule on the object (no separate anchor).

// trigger.object → object (low-level DB-style triggers)
registerMetadataResource({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ const LOADERS: Record<string, SchemaLoader> = {

// automation
flow: async () => (await import('@objectstack/spec/automation')).FlowSchema as unknown as ZodLikeSchema,
workflow: async () => (await import('@objectstack/spec/automation')).StateMachineSchema as unknown as ZodLikeSchema,
// `workflow` is no longer a standalone metadata type (ADR-0020) — record
// state machines are a `state_machine` validation rule on the object,
// validated as part of ObjectSchema; there is no top-level workflow schema.
// `approval` is no longer a standalone metadata type — it's a flow node
// (`type: 'approval'`, ADR-0019). Its config (ApprovalNodeConfigSchema) is
// validated as part of the enclosing flow; there is no top-level schema, so
Expand Down
4 changes: 2 additions & 2 deletions packages/app-shell/src/views/metadata-admin/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const TYPE_LABELS_EN: Record<string, string> = {
report: 'Report',
// Automation
flow: 'Flow',
workflow: 'Workflow',
// ADR-0020: `workflow` retired as a metadata type.
approval: 'Approval Process',
// System
datasource: 'Datasource',
Expand Down Expand Up @@ -86,7 +86,7 @@ const TYPE_LABELS_ZH: Record<string, string> = {
action: '操作',
report: '报表',
flow: '流程',
workflow: '工作流',
// ADR-0020: `workflow` 已不再是独立元数据类型。
approval: '审批流程',
datasource: '数据源',
translation: '翻译',
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { registerMetadataInspector } from '../inspector-registry';
import { registerMetadataDefaultInspector } from '../default-inspector-registry';
import { DashboardWidgetInspector } from './DashboardWidgetInspector';
import { FlowInspector } from './FlowInspector';
import { WorkflowActionInspector } from './WorkflowActionInspector';
import { AppNavInspector } from './AppNavInspector';
import { ViewInspector, ViewDefaultInspector } from './ViewInspector';
import { PageBlockInspector } from './PageBlockInspector';
Expand All @@ -22,7 +21,9 @@ export function registerBuiltinInspectors(): void {
// edited through FlowInspector, not a standalone step inspector. FlowInspector
// routes node vs. edge selections to the right scoped editor.
registerMetadataInspector('flow', FlowInspector);
registerMetadataInspector('workflow', WorkflowActionInspector);
// ADR-0020: `workflow` retired as a metadata type — no workflow-action
// inspector. State machines live on the object as a `state_machine`
// validation rule.
registerMetadataInspector('app', AppNavInspector);
registerMetadataInspector('view', ViewInspector);
registerMetadataDefaultInspector('view', ViewDefaultInspector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,23 +206,26 @@ function TypeBody({ type, d }: { type: string; d: Record<string, unknown> }) {
}

case 'state_machine': {
const transitions = Array.isArray(d.transitions)
? (d.transitions as Array<{ from?: string | string[]; to?: string }>)
: [];
// ADR-0020 shape: transitions is a `{ fromState: [allowedToStates] }` map.
const transitionMap =
d.transitions && typeof d.transitions === 'object' && !Array.isArray(d.transitions)
? (d.transitions as Record<string, string[]>)
: {};
const entries = Object.entries(transitionMap);
const field = d.field as string | undefined;
return (
<Section title={`Transitions${field ? ` on ${field}` : ''}`} icon={Workflow}>
{transitions.length === 0 ? (
{entries.length === 0 ? (
<div className="text-xs text-amber-700 dark:text-amber-400">No transitions declared.</div>
) : (
<ul className="rounded border bg-background divide-y text-xs">
{transitions.map((t, i) => (
<li key={i} className="flex items-center gap-2 px-2.5 py-1.5">
<span className="font-mono">
{Array.isArray(t.from) ? t.from.join(' | ') : (t.from ?? '*')}
</span>
{entries.map(([from, tos]) => (
<li key={from} className="flex items-center gap-2 px-2.5 py-1.5">
<span className="font-mono">{from}</span>
<ArrowRight className="h-3 w-3 text-muted-foreground" />
<span className="font-mono text-emerald-700 dark:text-emerald-400">{t.to ?? '?'}</span>
<span className="font-mono text-emerald-700 dark:text-emerald-400">
{Array.isArray(tos) && tos.length > 0 ? tos.join(' | ') : '∅ (dead-end)'}
</span>
</li>
))}
</ul>
Expand Down
Loading
Loading