@henry2323/n8n-nodes-calendar-tool-wrapper 0.1.2 → 0.1.4

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.
package/dist/index.d.ts CHANGED
@@ -1 +1,7 @@
1
- export {};
1
+ import { INodeType } from 'n8n-workflow';
2
+ import { CalendarToolWrapperX } from './nodes/CalendarToolWrapperX/CalendarToolWrapperX.node';
3
+ export { CalendarToolWrapperX };
4
+ export declare const nodeTypes: INodeType[];
5
+ export declare const nodeDescriptions: {
6
+ calendarToolWrapperX: import("n8n-workflow").INodeTypeDescription;
7
+ };
package/dist/index.js CHANGED
@@ -1,6 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nodeDescriptions = exports.nodeTypes = exports.CalendarToolWrapperX = void 0;
3
4
  const CalendarToolWrapperX_node_1 = require("./nodes/CalendarToolWrapperX/CalendarToolWrapperX.node");
4
- module.exports = {
5
- CalendarToolWrapperX: CalendarToolWrapperX_node_1.CalendarToolWrapperX
5
+ Object.defineProperty(exports, "CalendarToolWrapperX", { enumerable: true, get: function () { return CalendarToolWrapperX_node_1.CalendarToolWrapperX; } });
6
+ // Export the node type for n8n registration
7
+ exports.nodeTypes = [
8
+ new CalendarToolWrapperX_node_1.CalendarToolWrapperX(),
9
+ ];
10
+ // Export the node description
11
+ exports.nodeDescriptions = {
12
+ calendarToolWrapperX: new CalendarToolWrapperX_node_1.CalendarToolWrapperX().description,
6
13
  };
@@ -1,14 +1,6 @@
1
- import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
- declare module 'n8n-workflow' {
3
- interface INodeTypeDescription {
4
- aiTool?: {
5
- name: string;
6
- description: string;
7
- parametersSchema: Record<string, unknown>;
8
- };
9
- }
10
- }
1
+ import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
11
2
  export declare class CalendarToolWrapperX implements INodeType {
12
3
  description: INodeTypeDescription;
4
+ constructor();
13
5
  execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
14
6
  }
@@ -2,63 +2,69 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CalendarToolWrapperX = void 0;
4
4
  const n8n_workflow_1 = require("n8n-workflow");
5
- const subWorkflowTemplate = require("./subWorkflowTemplate.json");
6
5
  class CalendarToolWrapperX {
7
- // @ts-ignore - Adding custom aiTool property to type definition
8
- description = {
9
- displayName: 'Calendar Tool Wrapper X',
10
- name: 'calendarToolWrapperX',
11
- // icon: 'file:RunKeys.svg', // Removed icon property
12
- group: ['ai'],
13
- version: 1.2,
14
- description: 'Wraps Microsoft Calendar Tool for AI operations',
15
- inputs: ['main'],
16
- outputs: ['main'],
17
- credentials: [
18
- {
19
- name: 'microsoftOutlookOAuth2Api',
20
- required: true
21
- }
22
- ],
23
- properties: [
24
- {
25
- displayName: 'Calendar ID',
26
- name: 'calendarId',
27
- type: 'string',
28
- default: '',
29
- required: true,
30
- description: 'Target calendar ID for operations',
6
+ description;
7
+ constructor() {
8
+ this.description = {
9
+ displayName: 'Calendar Tool Wrapper X',
10
+ name: 'calendarToolWrapperX',
11
+ icon: 'file:RunKeys.svg',
12
+ group: ['transform'],
13
+ version: 1,
14
+ description: 'Wraps Microsoft Calendar Tool for AI operations',
15
+ defaults: {
16
+ name: 'Calendar Tool Wrapper X',
17
+ color: '#772244',
31
18
  },
32
- {
33
- displayName: 'Return All Events',
34
- name: 'returnAll',
35
- type: 'boolean',
36
- default: false,
37
- description: 'Whether to return all results or only first page',
38
- }
39
- ],
40
- aiTool: {
41
- name: 'calendarQuery',
42
- description: 'Query Microsoft Calendar events',
43
- parametersSchema: require('./calendarTool.schema.json')
44
- }
45
- };
19
+ inputs: ["main" /* NodeConnectionType.Main */],
20
+ outputs: ["main" /* NodeConnectionType.Main */],
21
+ credentials: [
22
+ {
23
+ name: 'microsoftOutlookOAuth2Api',
24
+ required: true,
25
+ },
26
+ ],
27
+ properties: [
28
+ {
29
+ displayName: 'Calendar ID',
30
+ name: 'calendarId',
31
+ type: 'string',
32
+ default: '',
33
+ required: true,
34
+ description: 'Target calendar ID for operations',
35
+ },
36
+ {
37
+ displayName: 'Return All Events',
38
+ name: 'returnAll',
39
+ type: 'boolean',
40
+ default: false,
41
+ description: 'Whether to return all results or only first page',
42
+ },
43
+ ],
44
+ // Custom property for AI integration
45
+ subtitle: '={{$parameter["calendarId"]}}',
46
+ };
47
+ }
46
48
  async execute() {
47
49
  const items = this.getInputData();
48
50
  try {
49
- const credentialsId = this.getNodeParameter('credentialsId', 0);
50
51
  const calendarId = this.getNodeParameter('calendarId', 0);
51
52
  const returnAll = this.getNodeParameter('returnAll', 0);
53
+ // Get credentials
54
+ const credentials = await this.getCredentials('microsoftOutlookOAuth2Api');
55
+ if (!credentials) {
56
+ throw new Error('No credentials provided');
57
+ }
52
58
  // Configure calendar tool node
53
59
  const calendarNode = {
54
- type: 'n8n-nodes-base.microsoftOutlookTool',
60
+ type: 'n8n-nodes-base.microsoftOutlook',
55
61
  typeVersion: 2,
56
62
  position: [1000, 340],
57
63
  name: 'Microsoft_Calendar_Tool',
58
64
  credentials: {
59
65
  microsoftOutlookOAuth2Api: {
60
- id: credentialsId
61
- }
66
+ id: credentials.id,
67
+ },
62
68
  },
63
69
  parameters: {
64
70
  resource: 'calendarEvent',
@@ -66,11 +72,12 @@ class CalendarToolWrapperX {
66
72
  calendarId,
67
73
  returnAll,
68
74
  options: {
69
- fromAllCalendars: false
70
- }
71
- }
75
+ fromAllCalendars: false,
76
+ },
77
+ },
72
78
  };
73
- // Clone and configure workflow template
79
+ // Load and configure workflow template
80
+ const subWorkflowTemplate = require('./subWorkflowTemplate.json');
74
81
  const template = JSON.parse(JSON.stringify(subWorkflowTemplate));
75
82
  template.nodes.push(calendarNode);
76
83
  // Update connection references
@@ -84,53 +91,25 @@ class CalendarToolWrapperX {
84
91
  const executionResult = await this.executeWorkflow(workflowInfo, items);
85
92
  // Handle empty results
86
93
  if (!executionResult?.data?.[0]) {
87
- return [
88
- [], // Main output
89
- [{ json: { toolOutput: [] } }] // AI tool output
90
- ];
94
+ return [[{ json: { events: [] } }]];
91
95
  }
92
- // Format AI tool output
93
- const toolOutput = executionResult.data[0].map((item) => ({
94
- eventId: item.json.id,
95
- summary: item.json.subject,
96
- start: item.json.start,
97
- end: item.json.end
96
+ // Format output
97
+ const formattedOutput = executionResult.data[0].map((item) => ({
98
+ json: {
99
+ eventId: item.json.id,
100
+ summary: item.json.subject,
101
+ start: item.json.start,
102
+ end: item.json.end,
103
+ calendar: calendarId,
104
+ },
98
105
  }));
99
- return [
100
- [], // Empty main output
101
- [{
102
- json: {
103
- tool: this.getNode().type.description.aiTool?.name,
104
- parameters: { calendarId, returnAll },
105
- toolOutput
106
- }
107
- }]
108
- ];
106
+ return [formattedOutput];
109
107
  }
110
108
  catch (error) {
111
109
  if (this.continueOnFail()) {
112
- if (error instanceof Error) {
113
- error.context = { itemIndex: 0 };
114
- }
115
- return [
116
- [],
117
- [{
118
- json: {
119
- error: error.message,
120
- parameters: {
121
- calendarId: this.getNodeParameter('calendarId', 0),
122
- returnAll: this.getNodeParameter('returnAll', 0)
123
- }
124
- }
125
- }]
126
- ];
110
+ return [[{ json: { error: error instanceof Error ? error.message : 'An error occurred' } }]];
127
111
  }
128
- const errorContext = {
129
- nodeId: this.getNode().id,
130
- itemIndex: 0,
131
- workflowId: this.getWorkflow().id
132
- };
133
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, errorContext);
112
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), error);
134
113
  }
135
114
  }
136
115
  }
package/index.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const CalendarToolWrapperX_node_1 = require("./nodes/CalendarToolWrapperX/CalendarToolWrapperX.node");
4
+ module.exports = {
5
+ CalendarToolWrapperX: CalendarToolWrapperX_node_1.CalendarToolWrapperX
6
+ };
package/package.json CHANGED
@@ -1,42 +1,56 @@
1
1
  {
2
2
  "name": "@henry2323/n8n-nodes-calendar-tool-wrapper",
3
- "version": "0.1.2",
4
- "type": "commonjs",
5
- "engines": {
6
- "node": ">=18.0.0"
7
- },
3
+ "version": "0.1.4",
8
4
  "description": "Wrapper for Microsoft Calendar AI Tool integration",
9
5
  "keywords": [
10
- "n8n-community-node-package"
6
+ "n8n-community-node-package",
7
+ "n8n",
8
+ "n8n-node",
9
+ "calendar",
10
+ "microsoft-calendar",
11
+ "ai-tool"
11
12
  ],
12
13
  "license": "MIT",
14
+ "homepage": "https://github.com/henry2323/n8n-nodes-calendar-tool-wrapper",
15
+ "author": {
16
+ "name": "Henry",
17
+ "email": ""
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/henry2323/n8n-nodes-calendar-tool-wrapper"
22
+ },
23
+ "main": "index.js",
13
24
  "scripts": {
14
- "clean": "rimraf dist",
15
- "build": "tsc",
25
+ "build": "tsc && copyfiles -u 1 nodes/**/*.json nodes/**/*.svg dist/",
16
26
  "dev": "tsc --watch",
17
- "prepublishOnly": "npm run build"
27
+ "format": "prettier nodes --write",
28
+ "lint": "eslint nodes package.json",
29
+ "lintfix": "eslint nodes package.json --fix",
30
+ "prepublishOnly": "npm run build",
31
+ "clean": "rimraf dist"
18
32
  },
19
- "author": "Henry",
20
- "private": false,
21
- "main": "dist/nodes/CalendarToolWrapperX/CalendarToolWrapperX.node.js",
22
- "types": "dist/nodes/CalendarToolWrapperX/CalendarToolWrapperX.node.d.ts",
23
33
  "files": [
24
34
  "dist"
25
35
  ],
26
36
  "n8n": {
27
- "n8nNodesApiVersion": 2,
37
+ "n8nNodesApiVersion": 1,
38
+ "credentials": [],
28
39
  "nodes": [
29
40
  "dist/nodes/CalendarToolWrapperX/CalendarToolWrapperX.node.js"
30
41
  ]
31
42
  },
32
- "dependencies": {
33
- "n8n-nodes-base": "^1.16.0",
34
- "n8n-workflow": "^1.16.0",
35
- "copyfiles": "^2.4.1"
43
+ "publishConfig": {
44
+ "access": "public"
36
45
  },
37
46
  "devDependencies": {
38
47
  "@types/node": "^20.11.0",
39
- "typescript": "^5.3.3",
48
+ "typescript": "~5.3.3",
49
+ "copyfiles": "^2.4.1",
40
50
  "rimraf": "^5.0.5"
51
+ },
52
+ "dependencies": {
53
+ "n8n-core": "~1.5.0",
54
+ "n8n-workflow": "~1.5.0"
41
55
  }
42
56
  }
@@ -1,14 +0,0 @@
1
- import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
- declare module 'n8n-workflow' {
3
- interface INodeTypeDescription {
4
- aiTool?: {
5
- name: string;
6
- description: string;
7
- parametersSchema: Record<string, unknown>;
8
- };
9
- }
10
- }
11
- export declare class CalendarToolWrapperX implements INodeType {
12
- description: INodeTypeDescription;
13
- execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
14
- }
@@ -1,137 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CalendarToolWrapperX = void 0;
4
- const n8n_workflow_1 = require("n8n-workflow");
5
- const subWorkflowTemplate = require("./subWorkflowTemplate.json");
6
- class CalendarToolWrapperX {
7
- // @ts-ignore - Adding custom aiTool property to type definition
8
- description = {
9
- displayName: 'Calendar Tool Wrapper X',
10
- name: 'calendarToolWrapperX',
11
- icon: 'file:RunKeys.svg',
12
- group: ['ai'],
13
- version: 1.2,
14
- description: 'Wraps Microsoft Calendar Tool for AI operations',
15
- inputs: ['main'],
16
- outputs: ['main'],
17
- credentials: [
18
- {
19
- name: 'microsoftOutlookOAuth2Api',
20
- required: true
21
- }
22
- ],
23
- properties: [
24
- {
25
- displayName: 'Calendar ID',
26
- name: 'calendarId',
27
- type: 'string',
28
- default: '',
29
- required: true,
30
- description: 'Target calendar ID for operations',
31
- },
32
- {
33
- displayName: 'Return All Events',
34
- name: 'returnAll',
35
- type: 'boolean',
36
- default: false,
37
- description: 'Whether to return all results or only first page',
38
- }
39
- ],
40
- aiTool: {
41
- name: 'calendarQuery',
42
- description: 'Query Microsoft Calendar events',
43
- parametersSchema: require('./calendarTool.schema.json')
44
- }
45
- };
46
- async execute() {
47
- const items = this.getInputData();
48
- try {
49
- const credentialsId = this.getNodeParameter('credentialsId', 0);
50
- const calendarId = this.getNodeParameter('calendarId', 0);
51
- const returnAll = this.getNodeParameter('returnAll', 0);
52
- // Configure calendar tool node
53
- const calendarNode = {
54
- type: 'n8n-nodes-base.microsoftOutlookTool',
55
- typeVersion: 2,
56
- position: [1000, 340],
57
- name: 'Microsoft_Calendar_Tool',
58
- credentials: {
59
- microsoftOutlookOAuth2Api: {
60
- id: credentialsId
61
- }
62
- },
63
- parameters: {
64
- resource: 'calendarEvent',
65
- operation: 'getAll',
66
- calendarId,
67
- returnAll,
68
- options: {
69
- fromAllCalendars: false
70
- }
71
- }
72
- };
73
- // Clone and configure workflow template
74
- const template = JSON.parse(JSON.stringify(subWorkflowTemplate));
75
- template.nodes.push(calendarNode);
76
- // Update connection references
77
- if (template.connections?.Start?.main?.[0]?.[0]) {
78
- template.connections.Start.main[0][0].node = calendarNode.name;
79
- }
80
- // Execute sub-workflow
81
- const workflowInfo = {
82
- code: template,
83
- };
84
- const executionResult = await this.executeWorkflow(workflowInfo, items);
85
- // Handle empty results
86
- if (!executionResult?.data?.[0]) {
87
- return [
88
- [], // Main output
89
- [{ json: { toolOutput: [] } }] // AI tool output
90
- ];
91
- }
92
- // Format AI tool output
93
- const toolOutput = executionResult.data[0].map((item) => ({
94
- eventId: item.json.id,
95
- summary: item.json.subject,
96
- start: item.json.start,
97
- end: item.json.end
98
- }));
99
- return [
100
- [], // Empty main output
101
- [{
102
- json: {
103
- tool: this.getNode().type.description.aiTool?.name,
104
- parameters: { calendarId, returnAll },
105
- toolOutput
106
- }
107
- }]
108
- ];
109
- }
110
- catch (error) {
111
- if (this.continueOnFail()) {
112
- if (error instanceof Error) {
113
- error.context = { itemIndex: 0 };
114
- }
115
- return [
116
- [],
117
- [{
118
- json: {
119
- error: error.message,
120
- parameters: {
121
- calendarId: this.getNodeParameter('calendarId', 0),
122
- returnAll: this.getNodeParameter('returnAll', 0)
123
- }
124
- }
125
- }]
126
- ];
127
- }
128
- const errorContext = {
129
- nodeId: this.getNode().id,
130
- itemIndex: 0,
131
- workflowId: this.getWorkflow().id
132
- };
133
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, errorContext);
134
- }
135
- }
136
- }
137
- exports.CalendarToolWrapperX = CalendarToolWrapperX;
@@ -1,14 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="1.70666in" height="1.70666in" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd" viewBox="0 0 1706.66 1706.66" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xodm="http://www.corel.com/coreldraw/odm/2003">
2
- <defs>
3
- <style type="text/css">
4
-
5
- .fil0 {fill:black}
6
-
7
- </style>
8
- </defs>
9
- <g id="Layer_x0020_1">
10
- <metadata id="CorelCorpID_0Corel-Layer"></metadata>
11
- <path class="fil0" d="M506.04 1706.52c-5.14,0 -10.26,-1.97 -14.17,-5.9l-190.76 -191.56c-8.31,-8.34 -8.33,-32.94 0.04,-41.33l82.71 -82.71 -82.71 -82.69c-3.75,-3.76 -5.86,-8.84 -5.86,-14.15l0 -149.83c0,-5.31 2.11,-10.39 5.86,-14.15l82.71 -82.69 -82.71 -82.69c-3.75,-3.76 -5.86,-8.85 -5.86,-14.15l0 -148.86c-145.17,-84.38 -226.2,-246.4 -206.97,-413.17 24.46,-212.4 204.41,-372.59 418.56,-372.59 232.33,0 421.35,189.02 421.35,421.35 0,150.5 -80.08,289.06 -209.78,364.45l0 699.13c0,5.31 -2.11,10.41 -5.89,14.18l-192.41 191.57c-3.9,3.86 -9,5.8 -14.11,5.8zm82.03 -1159.54l-150.53 0c-29.43,0 -53.33,-23.89 -53.33,-53.33l0 -171.05c0,-29.43 23.89,-53.33 53.33,-53.33l150.53 0c29.43,0 53.33,23.89 53.33,53.33l0 171.05c0,29.44 -23.89,53.33 -53.33,53.33zm-23.83 904.15c-11.04,0 -20,-8.97 -20,-20l0 -612.91c0,-26.33 39.99,-26.33 39.99,0l0 612.91c0,11.03 -8.96,20 -20,20z" id="id_103" style="fill: rgb(148, 66, 189);"></path>
12
- <path class="fil0" d="M1530.29 1529l-266.21 -71.24c-11.36,-3.07 -23.71,-24.37 -20.65,-35.8l30.27 -112.97 -112.98 -30.29c-5.11,-1.37 -9.5,-4.72 -12.13,-9.31l-74.92 -129.77c-2.65,-4.58 -3.37,-10.06 -2,-15.18l30.26 -112.96 -112.98 -30.29c-5.11,-1.38 -9.48,-4.72 -12.14,-9.32l-74.41 -128.92c-51.44,-0.18 -102.66,-9.86 -150.62,-28.31l0 -0.11c102.67,-65.66 173.75,-169.04 199.3,-286.05l80.46 -47.36c25.46,-14.69 34.22,-47.4 19.52,-72.86l-85.53 -148.14c-10.41,-18.03 -29.82,-27.67 -49.31,-26.56 -40.16,-82.76 -104.7,-151.6 -184.22,-197.11 193.13,-86.71 427.75,-13.59 536.31,174.41 75.26,130.34 75.19,290.36 0.56,420.52l349.59 605.5c2.65,4.6 3.37,10.08 1.98,15.22l-70.87 262.12c-2.4,8.9 -10.46,14.78 -19.28,14.78zm-46.7 -239.04c-6.9,0 -13.63,-3.59 -17.33,-10.02l-306.44 -530.78c-13.15,-22.81 21.46,-42.78 34.63,-20l306.44 530.79c7.74,13.42 -2.11,30 -17.3,30z" id="id_104" style="fill: rgb(107, 21, 150);"></path>
13
- </g>
14
- </svg>
@@ -1,17 +0,0 @@
1
- {
2
- "type": "object",
3
- "properties": {
4
- "calendarId": {
5
- "type": "string",
6
- "title": "Calendar ID",
7
- "description": "The ID of the calendar to query"
8
- },
9
- "returnAll": {
10
- "type": "boolean",
11
- "title": "Return All Events",
12
- "description": "Whether to return all events or only up to a limit",
13
- "default": false
14
- }
15
- },
16
- "required": ["calendarId"]
17
- }
@@ -1,34 +0,0 @@
1
- {
2
- "nodes": [
3
- {
4
- "parameters": {},
5
- "id": "dacc52e8-fef9-4cc3-9fca-623fa81b3c5f",
6
- "name": "Start",
7
- "type": "n8n-nodes-base.executeWorkflowTrigger",
8
- "typeVersion": 1,
9
- "position": [
10
- 720,
11
- 340
12
- ]
13
- }
14
- ],
15
- "settings":{
16
- "saveManualExecutions":false,
17
- "saveExecutionProgress":false,
18
- "saveDataErrorExecution": "none",
19
- "saveDataSuccessExecution": "none"
20
- },
21
- "connections": {
22
- "Start": {
23
- "main": [
24
- [
25
- {
26
- "node": "",
27
- "type": "main",
28
- "index": 0
29
- }
30
- ]
31
- ]
32
- }
33
- }
34
- }