mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-29 02:41:07 +00:00
refactor(feishu): remove stale explicit-any escapes
This commit is contained in:
@@ -14,6 +14,16 @@ function json(data: unknown) {
|
||||
}
|
||||
|
||||
type LarkResponse<T = unknown> = { code?: number; msg?: string; data?: T };
|
||||
type BitableRecordCreatePayload = NonNullable<
|
||||
Parameters<Lark.Client["bitable"]["appTableRecord"]["create"]>[0]
|
||||
>;
|
||||
type BitableRecordUpdatePayload = NonNullable<
|
||||
Parameters<Lark.Client["bitable"]["appTableRecord"]["update"]>[0]
|
||||
>;
|
||||
type BitableRecordFields = NonNullable<NonNullable<BitableRecordCreatePayload["data"]>["fields"]>;
|
||||
type BitableRecordUpdateFields = NonNullable<
|
||||
NonNullable<BitableRecordUpdatePayload["data"]>["fields"]
|
||||
>;
|
||||
|
||||
export class LarkApiError extends Error {
|
||||
readonly code: number;
|
||||
@@ -212,12 +222,11 @@ async function createRecord(
|
||||
client: Lark.Client,
|
||||
appToken: string,
|
||||
tableId: string,
|
||||
fields: Record<string, unknown>,
|
||||
fields: BitableRecordFields,
|
||||
) {
|
||||
const res = await client.bitable.appTableRecord.create({
|
||||
path: { app_token: appToken, table_id: tableId },
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
data: { fields: fields as any },
|
||||
data: { fields },
|
||||
});
|
||||
ensureLarkSuccess(res, "bitable.appTableRecord.create", { appToken, tableId });
|
||||
|
||||
@@ -424,12 +433,11 @@ async function updateRecord(
|
||||
appToken: string,
|
||||
tableId: string,
|
||||
recordId: string,
|
||||
fields: Record<string, unknown>,
|
||||
fields: NonNullable<NonNullable<BitableRecordUpdatePayload["data"]>["fields"]>,
|
||||
) {
|
||||
const res = await client.bitable.appTableRecord.update({
|
||||
path: { app_token: appToken, table_id: tableId, record_id: recordId },
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
data: { fields: fields as any },
|
||||
data: { fields },
|
||||
});
|
||||
ensureLarkSuccess(res, "bitable.appTableRecord.update", { appToken, tableId, recordId });
|
||||
|
||||
@@ -645,7 +653,7 @@ export function registerFeishuBitableTools(api: OpenClawPluginApi) {
|
||||
registerBitableTool<{
|
||||
app_token: string;
|
||||
table_id: string;
|
||||
fields: Record<string, unknown>;
|
||||
fields: BitableRecordFields;
|
||||
accountId?: string;
|
||||
}>({
|
||||
name: "feishu_bitable_create_record",
|
||||
@@ -666,7 +674,7 @@ export function registerFeishuBitableTools(api: OpenClawPluginApi) {
|
||||
app_token: string;
|
||||
table_id: string;
|
||||
record_id: string;
|
||||
fields: Record<string, unknown>;
|
||||
fields: BitableRecordUpdateFields;
|
||||
accountId?: string;
|
||||
}>({
|
||||
name: "feishu_bitable_update_record",
|
||||
|
||||
@@ -78,7 +78,6 @@ function collectDescendants(
|
||||
* @param parentBlockId - Parent block to insert into (defaults to docToken)
|
||||
* @param index - Position within parent's children (-1 = end)
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- SDK block types
|
||||
async function insertBatch(
|
||||
client: Lark.Client,
|
||||
docToken: string,
|
||||
@@ -125,7 +124,6 @@ async function insertBatch(
|
||||
* each batch advances this by the number of first-level IDs inserted so far.
|
||||
* @returns Inserted children blocks and any skipped block IDs
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- SDK block types
|
||||
export async function insertBlocksInBatches(
|
||||
client: Lark.Client,
|
||||
docToken: string,
|
||||
|
||||
@@ -44,6 +44,11 @@ interface Segment {
|
||||
bold?: boolean;
|
||||
}
|
||||
|
||||
type DocxPatchPayload = NonNullable<Parameters<Lark.Client["docx"]["documentBlock"]["patch"]>[0]>;
|
||||
type DocxTextElement = NonNullable<
|
||||
NonNullable<NonNullable<DocxPatchPayload["data"]>["update_text_elements"]>["elements"]
|
||||
>[number];
|
||||
|
||||
/**
|
||||
* Parse color markup into segments.
|
||||
*
|
||||
@@ -120,8 +125,7 @@ export async function updateColorText(
|
||||
) {
|
||||
const segments = parseColorMarkup(content);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- SDK type
|
||||
const elements: any[] = segments.map((seg) => ({
|
||||
const elements: DocxTextElement[] = segments.map((seg) => ({
|
||||
text_run: {
|
||||
content: seg.text,
|
||||
text_element_style: {
|
||||
|
||||
@@ -65,7 +65,6 @@ export function calculateAdaptiveColumnWidths(
|
||||
const cellIds = normalizeChildBlockIds(tableBlock.children);
|
||||
|
||||
// Build block lookup map
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const blockMap = new Map<string, FeishuDocxBlock>();
|
||||
for (const block of blocks) {
|
||||
if (block.block_id) {
|
||||
|
||||
@@ -160,7 +160,6 @@ export function registerFeishuPermTools(api: OpenClawPluginApi) {
|
||||
await removeMember(client, p.token, p.type, p.member_type, p.member_id),
|
||||
);
|
||||
default:
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- exhaustive check fallback
|
||||
return unknownToolActionResult((p as { action?: unknown }).action);
|
||||
}
|
||||
} catch (err) {
|
||||
|
||||
@@ -217,7 +217,6 @@ export function registerFeishuWikiTools(api: OpenClawPluginApi) {
|
||||
case "rename":
|
||||
return jsonToolResult(await renameNode(client, p.space_id, p.node_token, p.title));
|
||||
default:
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- exhaustive check fallback
|
||||
return unknownToolActionResult((p as { action?: unknown }).action);
|
||||
}
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user