import { type BlockExecutor } from '../orchestration-schema.js'; /** * @serverBlockDoc * { * "version": 1, * "functionName": "cascadeDelete", * "displayName": "声明式级联删除", * "category": "database", * "description": "按 root 与 relations 描述的单数据源关系树锁定、采集并逆拓扑删除记录,所有 DELETE 位于同一个串行化事务。", * "inputs": [ * { "key": "datasource", "type": "string", "required": true, "description": "保存关系树中全部表的数据源。" }, * { "key": "root", "type": "CascadeRoot", "required": true, "description": "根节点 id/table/keyField/conditions;conditions 必须产生非空 WHERE。" }, * { "key": "relations", "type": "CascadeRelation[]", "required": false, "description": "子节点及其 parent/foreignKey 单字段关系。" }, * { "key": "collect", "type": "CascadeCollect[]", "required": false, "description": "删除前从指定节点采集字段。mode=values 要求一个 ProcessableKey 字段并返回值数组;mode=rows 支持 1 到 32 个字段并返回对象数组。可配置 processors、去重和排序。maxCollectedRows 按所有 collect 的候选行数之和、在 distinct 前计数。" }, * { "key": "limits", "type": "CascadeLimits", "required": false, "description": "根记录、总影响记录和总采集记录安全上限。" } * ], * "outputs": [ * { "key": "affected", "type": "number", "description": "根节点删除行数。" }, * { "key": "affectedByNode", "type": "Record", "description": "按节点 id 返回删除行数。" }, * { "key": "totalAffected", "type": "number", "description": "全部节点删除行数之和。" }, * { "key": "collected", "type": "Record", "description": "按 collect.key 返回删除前采集并处理后的值。" } * ], * "errors": [ * { "code": "BLOCK_INVALID_CASCADE", "description": "关系图、节点、采集或删除一致性无效。" }, * { "code": "BLOCK_CASCADE_UNSCOPED", "description": "root.conditions 没有产生 WHERE。" }, * { "code": "BLOCK_CASCADE_LIMIT_EXCEEDED", "description": "配置或运行行数超过安全上限。" }, * { "code": "BLOCK_SQL_UNSUPPORTED", "description": "执行器未提供数据源事务运行器。" } * ], * "config": [], * "runtime": [ * { "key": "requiresDatasource", "type": "boolean", "value": true, "description": "全部表必须属于同一个 datasource。" }, * { "key": "transaction", "type": "string", "value": "serializable, retries=2", "description": "锁定、采集和删除使用一个可重试串行化事务。" } * ], * "examples": [ * { "title": "删除员工及其授权", "block": { "uuid": "delete_employee", "functionName": "cascadeDelete", "inputs": { "datasource": "Mokelay", "root": { "id": "employee", "table": "employees", "keyField": "id", "conditions": [{ "group": false, "fieldName": "id", "fieldValue": 1, "conditionType": "EQ" }] }, "relations": [{ "id": "identities", "table": "employee_auth_identities", "keyField": "id", "parent": "employee", "foreignKey": "employee_id" }], "collect": [] }, "outputs": ["affected", "affectedByNode", "totalAffected", "collected"], "nextBlock": null } } * ] * } */ export declare const executeCascadeDeleteBlock: BlockExecutor;