@couleetech/n8n-nodes-enlightenedmsp 1.2.6 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class TimeclockClockIn implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TimeclockClockIn = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const GraphqlBase_1 = require("./GraphqlBase");
6
+ class TimeclockApi extends GraphqlBase_1.GraphqlBase {
7
+ async clockIn(userId, note) {
8
+ const query = `
9
+ mutation timeclockClockin($userId: String!, $note: String) {
10
+ timeclockClockin(userId: $userId, note: $note) {
11
+ id
12
+ userId
13
+ clockInTime
14
+ note
15
+ }
16
+ }
17
+ `;
18
+ const variables = {
19
+ userId,
20
+ note,
21
+ };
22
+ return this.executeGraphql(query, variables);
23
+ }
24
+ }
25
+ class TimeclockClockIn {
26
+ constructor() {
27
+ this.description = {
28
+ displayName: 'Timeclock Clock In',
29
+ name: 'timeclockClockIn',
30
+ icon: 'file:enlightenedmsp.svg',
31
+ group: ['transform'],
32
+ version: 1,
33
+ description: 'Clock in a user in the timeclock system',
34
+ defaults: {
35
+ name: 'Timeclock Clock In',
36
+ },
37
+ inputs: ['main'],
38
+ outputs: ['main'],
39
+ credentials: [
40
+ {
41
+ name: 'enlightenedMspGraphql',
42
+ required: true,
43
+ },
44
+ ],
45
+ properties: [
46
+ {
47
+ displayName: 'User ID',
48
+ name: 'userId',
49
+ type: 'string',
50
+ default: '',
51
+ required: true,
52
+ description: 'The ID of the user to clock in',
53
+ },
54
+ {
55
+ displayName: 'Note',
56
+ name: 'note',
57
+ type: 'string',
58
+ default: '',
59
+ required: false,
60
+ description: 'Optional note for the clock-in entry',
61
+ },
62
+ ],
63
+ };
64
+ }
65
+ async execute() {
66
+ const credentials = await GraphqlBase_1.GraphqlBase.getCredentials(this);
67
+ const api = new TimeclockApi(credentials.endpoint, credentials.apiKey, credentials.userId);
68
+ const items = this.getInputData();
69
+ const returnData = [];
70
+ for (let i = 0; i < items.length; i++) {
71
+ try {
72
+ const userId = this.getNodeParameter('userId', i);
73
+ const note = this.getNodeParameter('note', i, '');
74
+ const response = await api.clockIn(userId, note);
75
+ returnData.push({
76
+ json: response.timeclockClockin,
77
+ });
78
+ }
79
+ catch (error) {
80
+ if (this.continueOnFail()) {
81
+ returnData.push({
82
+ json: {
83
+ error: error.message,
84
+ },
85
+ });
86
+ continue;
87
+ }
88
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
89
+ }
90
+ }
91
+ return [returnData];
92
+ }
93
+ }
94
+ exports.TimeclockClockIn = TimeclockClockIn;
@@ -0,0 +1,5 @@
1
+ import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class TimeclockClockOut implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TimeclockClockOut = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const GraphqlBase_1 = require("./GraphqlBase");
6
+ class TimeclockApi extends GraphqlBase_1.GraphqlBase {
7
+ async clockOut(userId, note) {
8
+ const query = `
9
+ mutation timeclockClockout($userId: String!, $note: String) {
10
+ timeclockClockout(userId: $userId, note: $note) {
11
+ id
12
+ userId
13
+ clockInTime
14
+ clockOutTime
15
+ note
16
+ }
17
+ }
18
+ `;
19
+ const variables = {
20
+ userId,
21
+ note,
22
+ };
23
+ return this.executeGraphql(query, variables);
24
+ }
25
+ }
26
+ class TimeclockClockOut {
27
+ constructor() {
28
+ this.description = {
29
+ displayName: 'Timeclock Clock Out',
30
+ name: 'timeclockClockOut',
31
+ icon: 'file:enlightenedmsp.svg',
32
+ group: ['transform'],
33
+ version: 1,
34
+ description: 'Clock out a user in the timeclock system',
35
+ defaults: {
36
+ name: 'Timeclock Clock Out',
37
+ },
38
+ inputs: ['main'],
39
+ outputs: ['main'],
40
+ credentials: [
41
+ {
42
+ name: 'enlightenedMspGraphql',
43
+ required: true,
44
+ },
45
+ ],
46
+ properties: [
47
+ {
48
+ displayName: 'User ID',
49
+ name: 'userId',
50
+ type: 'string',
51
+ default: '',
52
+ required: true,
53
+ description: 'The ID of the user to clock out',
54
+ },
55
+ {
56
+ displayName: 'Note',
57
+ name: 'note',
58
+ type: 'string',
59
+ default: '',
60
+ required: false,
61
+ description: 'Optional note for the clock-out entry',
62
+ },
63
+ ],
64
+ };
65
+ }
66
+ async execute() {
67
+ const credentials = await GraphqlBase_1.GraphqlBase.getCredentials(this);
68
+ const api = new TimeclockApi(credentials.endpoint, credentials.apiKey, credentials.userId);
69
+ const items = this.getInputData();
70
+ const returnData = [];
71
+ for (let i = 0; i < items.length; i++) {
72
+ try {
73
+ const userId = this.getNodeParameter('userId', i);
74
+ const note = this.getNodeParameter('note', i, '');
75
+ const response = await api.clockOut(userId, note);
76
+ returnData.push({
77
+ json: response.timeclockClockout,
78
+ });
79
+ }
80
+ catch (error) {
81
+ if (this.continueOnFail()) {
82
+ returnData.push({
83
+ json: {
84
+ error: error.message,
85
+ },
86
+ });
87
+ continue;
88
+ }
89
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
90
+ }
91
+ }
92
+ return [returnData];
93
+ }
94
+ }
95
+ exports.TimeclockClockOut = TimeclockClockOut;
@@ -1,3 +1,6 @@
1
1
  import { TicketCreated } from './TicketCreated.node';
2
2
  import { UpdateTicket } from './UpdateTicket.node';
3
- export { TicketCreated, UpdateTicket };
3
+ import { SearchTicket } from './SearchTicket.node';
4
+ import { TimeclockClockIn } from './TimeclockClockIn.node';
5
+ import { TimeclockClockOut } from './TimeclockClockOut.node';
6
+ export { TicketCreated, UpdateTicket, SearchTicket, TimeclockClockIn, TimeclockClockOut };
@@ -1,7 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UpdateTicket = exports.TicketCreated = void 0;
3
+ exports.TimeclockClockOut = exports.TimeclockClockIn = exports.SearchTicket = exports.UpdateTicket = exports.TicketCreated = void 0;
4
4
  const TicketCreated_node_1 = require("./TicketCreated.node");
5
5
  Object.defineProperty(exports, "TicketCreated", { enumerable: true, get: function () { return TicketCreated_node_1.TicketCreated; } });
6
6
  const UpdateTicket_node_1 = require("./UpdateTicket.node");
7
7
  Object.defineProperty(exports, "UpdateTicket", { enumerable: true, get: function () { return UpdateTicket_node_1.UpdateTicket; } });
8
+ const SearchTicket_node_1 = require("./SearchTicket.node");
9
+ Object.defineProperty(exports, "SearchTicket", { enumerable: true, get: function () { return SearchTicket_node_1.SearchTicket; } });
10
+ const TimeclockClockIn_node_1 = require("./TimeclockClockIn.node");
11
+ Object.defineProperty(exports, "TimeclockClockIn", { enumerable: true, get: function () { return TimeclockClockIn_node_1.TimeclockClockIn; } });
12
+ const TimeclockClockOut_node_1 = require("./TimeclockClockOut.node");
13
+ Object.defineProperty(exports, "TimeclockClockOut", { enumerable: true, get: function () { return TimeclockClockOut_node_1.TimeclockClockOut; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@couleetech/n8n-nodes-enlightenedmsp",
3
- "version": "1.2.6",
3
+ "version": "1.3.0",
4
4
  "description": "n8n node for EnlightenedMSP ticketing and workflow automation",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",
@@ -40,7 +40,9 @@
40
40
  "nodes": [
41
41
  "dist/nodes/EnlightenedMsp/UpdateTicket.node.js",
42
42
  "dist/nodes/EnlightenedMsp/SearchTicket.node.js",
43
- "dist/nodes/EnlightenedMsp/TicketCreated.node.js"
43
+ "dist/nodes/EnlightenedMsp/TicketCreated.node.js",
44
+ "dist/nodes/EnlightenedMsp/TimeclockClockIn.node.js",
45
+ "dist/nodes/EnlightenedMsp/TimeclockClockOut.node.js"
44
46
  ],
45
47
  "credentials": [
46
48
  "dist/credentials/EnlightenedMspApi.credentials.js",