n8n-nodes-base
Version:
Base nodes of n8n
59 lines • 1.8 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.description = void 0;
exports.execute = execute;
const utilities_1 = require("../../../../utils/utilities");
const descriptions_1 = require("../../descriptions");
const transport_1 = require("../../transport");
const properties = [
{
displayName: 'Delete From ...',
name: 'location',
type: 'options',
options: [
{
name: 'Case',
value: 'case',
},
{
name: 'Knowledge Base',
value: 'knowledgeBase',
},
],
default: 'knowledgeBase',
},
{
...descriptions_1.caseRLC,
displayOptions: {
show: {
location: ['case'],
},
},
},
descriptions_1.pageRLC,
];
const displayOptions = {
show: {
resource: ['page'],
operation: ['deletePage'],
},
};
exports.description = (0, utilities_1.updateDisplayOptions)(displayOptions, properties);
async function execute(i) {
const location = this.getNodeParameter('location', i);
const pageId = this.getNodeParameter('pageId', i, '', { extractValue: true });
let endpoint;
if (location === 'case') {
const caseId = this.getNodeParameter('caseId', i, '', { extractValue: true });
endpoint = `/v1/case/${caseId}/page/${pageId}`;
}
else {
endpoint = `/v1/page/${pageId}`;
}
await transport_1.theHiveApiRequest.call(this, 'DELETE', endpoint);
const executionData = this.helpers.constructExecutionMetaData((0, utilities_1.wrapData)({ success: true }), {
itemData: { item: i },
});
return executionData;
}
//# sourceMappingURL=deletePage.operation.js.map