UNPKG

n8n-nodes-feishu-fork

Version:

n8n custom nodes for n8n to interact with Feishu/Lark, including Lark Bot, Lark MCP, and Lark Trigger.

82 lines 3.28 kB
"use strict"; 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.CalendarEventSearch, value: "searchEvents", order: 90, options: [ description_1.DESCRIPTIONS.CALENDAR_ID, description_1.DESCRIPTIONS.SEARCH_KEY, description_1.DESCRIPTIONS.WHETHER_PAGING, description_1.DESCRIPTIONS.PAGE_SIZE, description_1.DESCRIPTIONS.PAGE_TOKEN, { ...description_1.DESCRIPTIONS.REQUEST_BODY, displayName: 'Filter(过滤器)', required: false, name: 'filter', }, { displayName: wording_1.WORDING.Options, name: 'options', type: 'collection', placeholder: wording_1.WORDING.AddField, default: {}, options: [description_1.DESCRIPTIONS.USER_ID_TYPE], }, { displayName: `<a target="_blank" href="https://open.feishu.cn/document/server-docs/calendar-v4/calendar-event/search">${wording_1.WORDING.OpenDocument}</a>`, name: 'notice', type: 'notice', default: '', }, ], async call(index) { const calendarId = this.getNodeParameter('calendar_id', index, undefined, { extractValue: true, }); const query = this.getNodeParameter('search_key', index); const filter = this.getNodeParameter('filter', index, '', { ensureType: 'json', }); const whetherPaging = this.getNodeParameter('whether_paging', index, false); const pageSize = this.getNodeParameter('page_size', index, 100); let pageToken = this.getNodeParameter('page_token', index, ''); const options = this.getNodeParameter('options', index, {}); const userIdType = options.user_id_type || 'open_id'; const allEvents = []; let hasMore = false; do { const { data: { page_token, items }, } = await RequestUtils_1.default.request.call(this, { method: 'POST', url: `/open-apis/calendar/v4/calendars/${calendarId}/events/search`, qs: { user_id_type: userIdType, ...(pageToken && { page_token: pageToken }), ...(pageSize && { page_size: pageSize }), }, body: { query, ...(Object.keys(filter).length > 0 && { filter }), }, }); hasMore = page_token ? true : false; pageToken = page_token; if (items) { allEvents.push(...items); } } while (!whetherPaging && hasMore); return { has_more: hasMore, ...(pageToken && { page_token: pageToken }), items: allEvents, }; }, }; //# sourceMappingURL=EventSearch.operation.js.map