n8n-nodes-feishu-lark
Version:
n8n custom nodes for n8n to interact with Feishu/Lark, including Lark Bot, Lark MCP, and Lark Trigger.
146 lines • 5.76 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const RequestUtils_1 = __importDefault(require("../../../help/utils/RequestUtils"));
const wording_1 = require("../../../help/wording");
const description_1 = require("../../../help/description");
exports.default = {
name: wording_1.WORDING.UpdateSheet,
value: "updateSheet",
order: 184,
options: [
description_1.DESCRIPTIONS.SPREADSHEET_ID,
description_1.DESCRIPTIONS.SHEET_ID,
description_1.DESCRIPTIONS.TITLE,
{
displayName: 'Lock Sheet(锁定工作表)',
name: 'lock',
description: 'Whether to lock the sheet',
type: 'boolean',
required: true,
default: false,
},
{
displayName: 'Lock Info(锁定信息)',
name: 'lockInfo',
description: 'Lock info',
type: 'string',
default: '',
displayOptions: {
show: {
lock: [true],
},
},
},
{
displayName: wording_1.WORDING.Options,
name: 'options',
type: 'collection',
placeholder: wording_1.WORDING.AddField,
default: {},
options: [
description_1.DESCRIPTIONS.SHEET_INDEX,
{
displayName: 'Frozen Column Count(冻结列数)',
name: 'frozenColumnCount',
description: 'Column index to freeze up to. 0 means no columns are frozen.',
type: 'number',
default: 0,
typeOptions: {
minValue: 0,
numberPrecision: 0,
},
},
{
displayName: 'Frozen Row Count(冻结行数)',
name: 'frozenRowCount',
description: 'Row index to freeze up to. 0 means no rows are frozen.',
type: 'number',
default: 0,
typeOptions: {
minValue: 0,
numberPrecision: 0,
},
},
{
displayName: 'Hidden Sheet(隐藏工作表)',
name: 'hidden',
description: 'Whether to hide the sheet',
default: false,
type: 'boolean',
},
{
displayName: 'User IDs(工作表权限用户 ID)',
name: 'userIds',
description: 'User IDs',
type: 'json',
default: '[]',
displayOptions: {
show: {
user_id_type: ['open_id', 'union_id'],
},
},
},
description_1.DESCRIPTIONS.USER_ID_TYPE,
],
},
{
displayName: `<a target="_blank" href="https://open.feishu.cn/document/server-docs/docs/sheets-v3/spreadsheet-sheet/update-sheet-properties">${wording_1.WORDING.OpenDocument}</a>`,
name: 'notice',
type: 'notice',
default: '',
},
],
async call(index) {
const spreadsheetId = this.getNodeParameter('spreadsheet_id', index, undefined, {
extractValue: true,
});
const sheetId = this.getNodeParameter('sheet_id', index, undefined, {
extractValue: true,
});
const title = this.getNodeParameter('title', index, '');
const lock = this.getNodeParameter('lock', index, false);
const lockInfo = this.getNodeParameter('lockInfo', index, '');
const options = this.getNodeParameter('options', index, {});
const sheetIndex = options.sheet_index || 0;
const hidden = options.hidden || false;
const frozenRowCount = options.frozenRowCount || undefined;
const frozenColumnCount = options.frozenColumnCount || undefined;
const userIds = options.userIds || undefined;
const userIdType = options.user_id_type || undefined;
const body = {
requests: [
{
updateSheet: {
properties: {
sheetId: sheetId,
...(title && { title }),
index: sheetIndex,
hidden: hidden,
...(frozenRowCount && { frozenRowCount }),
...(frozenColumnCount && { frozenColCount: frozenColumnCount }),
protect: {
lock: lock ? 'LOCK' : 'UNLOCK',
...(lockInfo && { lockInfo }),
...(userIds && { userIDs: userIds }),
},
},
},
},
],
};
const { data: { replies }, } = await RequestUtils_1.default.request.call(this, {
method: 'POST',
url: `/open-apis/sheets/v2/spreadsheets/${spreadsheetId}/sheets_batch_update`,
qs: {
...(userIdType && { user_id_type: userIdType }),
},
body,
});
const { updateSheet: { properties }, } = replies[0];
return properties;
},
};
//# sourceMappingURL=SheetsUpdate.operation.js.map