UNPKG

n8n-nodes-base

Version:

Base nodes of n8n

82 lines 2.83 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.description = void 0; exports.execute = execute; const utilities_1 = require("../../../../../../utils/utilities"); const constants_1 = require("../../../../constants"); const transport_1 = require("../../transport"); exports.description = [ { displayName: 'Document', name: 'documentId', type: 'resourceLocator', default: { mode: 'list', value: '' }, required: true, modes: [ { displayName: 'From List', name: 'list', type: 'list', typeOptions: { searchListMethod: 'spreadSheetsSearch', searchable: true, }, }, { displayName: 'By URL', name: 'url', type: 'string', extractValue: { type: 'regex', regex: constants_1.GOOGLE_DRIVE_FILE_URL_REGEX, }, validation: [ { type: 'regex', properties: { regex: constants_1.GOOGLE_DRIVE_FILE_URL_REGEX, errorMessage: 'Not a valid Google Drive File URL', }, }, ], }, { displayName: 'By ID', name: 'id', type: 'string', validation: [ { type: 'regex', properties: { regex: '[a-zA-Z0-9\\-_]{2,}', errorMessage: 'Not a valid Google Drive File ID', }, }, ], url: '=https://docs.google.com/spreadsheets/d/{{$value}}/edit', }, ], displayOptions: { show: { resource: ['spreadsheet'], operation: ['deleteSpreadsheet'], }, }, }, ]; async function execute() { const items = this.getInputData(); const returnData = []; for (let i = 0; i < items.length; i++) { const documentId = this.getNodeParameter('documentId', i, undefined, { extractValue: true, }); await transport_1.apiRequest.call(this, 'DELETE', '', {}, {}, `https://www.googleapis.com/drive/v3/files/${documentId}`); const executionData = this.helpers.constructExecutionMetaData((0, utilities_1.wrapData)({ success: true }), { itemData: { item: i }, }); returnData.push(...executionData); } return returnData; } //# sourceMappingURL=delete.operation.js.map