n8n-nodes-smartsuite
Version:
n8n community node for SmartSuite
39 lines • 1.45 kB
JavaScript
;
// src/nodes/SmartSuite/actions/orgManagement/getCurrentUser.operation.ts
Object.defineProperty(exports, "__esModule", { value: true });
exports.description = void 0;
exports.execute = execute;
const n8n_workflow_1 = require("n8n-workflow");
const utils_1 = require("../../helpers/utils");
const smartSuiteApi_1 = require("../../transport/smartSuiteApi");
/**
* SmartSuite Org Management → Get Current User
*/
exports.description = [
{
displayName: 'Operation',
name: 'operation',
type: 'hidden',
default: 'getCurrentUser',
displayOptions: {
show: {
resource: ['orgManagement'],
operation: ['getCurrentUser'],
},
},
description: 'Retrieve details of the current authenticated user',
},
];
async function execute() {
try {
(0, utils_1.debugLog)('[OrgMgmt] getCurrentUser.execute called', null, 1);
const user = (await smartSuiteApi_1.apiRequest.call(this, 'GET', '/users/me/'));
(0, utils_1.debugLog)('[OrgMgmt] Current user data', user, 3);
return this.helpers.returnJsonArray([user]);
}
catch (error) {
(0, utils_1.debugLog)('[OrgMgmt] getCurrentUser error', error, 1);
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error instanceof Error ? error.message : JSON.stringify(error));
}
}
//# sourceMappingURL=getCurrentUser.operation.js.map