@elobdev/zoho-projects-wrapper 0.1.0 → 0.1.2

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.
Files changed (120) hide show
  1. package/README.md +28 -8
  2. package/dist/client.d.ts +35 -0
  3. package/dist/client.d.ts.map +1 -0
  4. package/dist/client.js +66 -0
  5. package/dist/client.js.map +1 -0
  6. package/dist/errors.d.ts +22 -0
  7. package/dist/errors.d.ts.map +1 -0
  8. package/dist/errors.js +42 -0
  9. package/dist/errors.js.map +1 -0
  10. package/dist/http.d.ts +14 -0
  11. package/dist/http.d.ts.map +1 -0
  12. package/dist/http.js +136 -0
  13. package/dist/http.js.map +1 -0
  14. package/dist/index.d.ts +20 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +20 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/oauth.d.ts +20 -0
  19. package/dist/oauth.d.ts.map +1 -0
  20. package/dist/oauth.js +103 -0
  21. package/dist/oauth.js.map +1 -0
  22. package/dist/query.d.ts +5 -0
  23. package/dist/query.d.ts.map +1 -0
  24. package/dist/query.js +47 -0
  25. package/dist/query.js.map +1 -0
  26. package/dist/resource-base.d.ts +18 -0
  27. package/dist/resource-base.d.ts.map +1 -0
  28. package/dist/resource-base.js +46 -0
  29. package/dist/resource-base.js.map +1 -0
  30. package/dist/resources/custom-fields.d.ts +17 -0
  31. package/dist/resources/custom-fields.d.ts.map +1 -0
  32. package/dist/resources/custom-fields.js +11 -0
  33. package/dist/resources/custom-fields.js.map +1 -0
  34. package/dist/resources/issues.d.ts +67 -0
  35. package/dist/resources/issues.d.ts.map +1 -0
  36. package/dist/resources/issues.js +107 -0
  37. package/dist/resources/issues.js.map +1 -0
  38. package/dist/resources/module-meta.d.ts +2 -0
  39. package/dist/resources/module-meta.d.ts.map +1 -0
  40. package/dist/resources/module-meta.js +2 -0
  41. package/dist/resources/module-meta.js.map +1 -0
  42. package/dist/resources/phases.d.ts +46 -0
  43. package/dist/resources/phases.d.ts.map +1 -0
  44. package/dist/resources/phases.js +52 -0
  45. package/dist/resources/phases.js.map +1 -0
  46. package/dist/resources/portals.d.ts +15 -0
  47. package/dist/resources/portals.d.ts.map +1 -0
  48. package/dist/resources/portals.js +36 -0
  49. package/dist/resources/portals.js.map +1 -0
  50. package/dist/resources/project-groups.d.ts +18 -0
  51. package/dist/resources/project-groups.d.ts.map +1 -0
  52. package/dist/resources/project-groups.js +19 -0
  53. package/dist/resources/project-groups.js.map +1 -0
  54. package/dist/resources/projects.d.ts +33 -0
  55. package/dist/resources/projects.d.ts.map +1 -0
  56. package/dist/resources/projects.js +40 -0
  57. package/dist/resources/projects.js.map +1 -0
  58. package/dist/resources/records.d.ts +21 -0
  59. package/dist/resources/records.d.ts.map +1 -0
  60. package/dist/resources/records.js +31 -0
  61. package/dist/resources/records.js.map +1 -0
  62. package/dist/resources/settings.d.ts +46 -0
  63. package/dist/resources/settings.d.ts.map +1 -0
  64. package/dist/resources/settings.js +100 -0
  65. package/dist/resources/settings.js.map +1 -0
  66. package/dist/resources/tasklists.d.ts +38 -0
  67. package/dist/resources/tasklists.d.ts.map +1 -0
  68. package/dist/resources/tasklists.js +52 -0
  69. package/dist/resources/tasklists.js.map +1 -0
  70. package/dist/resources/tasks.d.ts +26 -0
  71. package/dist/resources/tasks.d.ts.map +1 -0
  72. package/dist/resources/tasks.js +34 -0
  73. package/dist/resources/tasks.js.map +1 -0
  74. package/dist/resources/time-logs.d.ts +56 -0
  75. package/dist/resources/time-logs.d.ts.map +1 -0
  76. package/dist/resources/time-logs.js +209 -0
  77. package/dist/resources/time-logs.js.map +1 -0
  78. package/dist/tools.d.ts +20 -0
  79. package/dist/tools.d.ts.map +1 -0
  80. package/dist/tools.js +652 -0
  81. package/dist/tools.js.map +1 -0
  82. package/dist/types.d.ts +532 -0
  83. package/dist/types.d.ts.map +1 -0
  84. package/dist/types.js +2 -0
  85. package/dist/types.js.map +1 -0
  86. package/package.json +19 -1
  87. package/.codex +0 -0
  88. package/docs/zoho- +0 -0
  89. package/docs/zoho-projects-api-matrix.md +0 -368
  90. package/src/client.ts +0 -75
  91. package/src/errors.ts +0 -34
  92. package/src/http.ts +0 -166
  93. package/src/index.ts +0 -19
  94. package/src/oauth.ts +0 -121
  95. package/src/query.ts +0 -51
  96. package/src/resource-base.ts +0 -59
  97. package/src/resources/custom-fields.ts +0 -27
  98. package/src/resources/issues.ts +0 -166
  99. package/src/resources/module-meta.ts +0 -1
  100. package/src/resources/phases.ts +0 -68
  101. package/src/resources/portals.ts +0 -46
  102. package/src/resources/project-groups.ts +0 -24
  103. package/src/resources/projects.ts +0 -56
  104. package/src/resources/records.ts +0 -40
  105. package/src/resources/settings.ts +0 -132
  106. package/src/resources/tasklists.ts +0 -94
  107. package/src/resources/tasks.ts +0 -43
  108. package/src/resources/time-logs.ts +0 -274
  109. package/src/tools.ts +0 -741
  110. package/src/types.ts +0 -546
  111. package/test/helpers.ts +0 -28
  112. package/test/http.test.ts +0 -49
  113. package/test/node-shims.d.ts +0 -9
  114. package/test/oauth.test.ts +0 -72
  115. package/test/path-alias-hooks.js +0 -10
  116. package/test/query.test.ts +0 -46
  117. package/test/register-path-alias.js +0 -3
  118. package/test/resources.test.ts +0 -504
  119. package/test/tools.test.ts +0 -30
  120. package/tsconfig.json +0 -20
package/dist/tools.js ADDED
@@ -0,0 +1,652 @@
1
+ import { ZohoProjectsClient } from './client.js';
2
+ function functionTool(name, description, parameters) {
3
+ return {
4
+ type: 'function',
5
+ function: {
6
+ name,
7
+ description,
8
+ parameters,
9
+ },
10
+ };
11
+ }
12
+ function objectSchema(properties, required = []) {
13
+ return {
14
+ type: 'object',
15
+ additionalProperties: false,
16
+ properties,
17
+ required,
18
+ };
19
+ }
20
+ function idField(description) {
21
+ return { anyOf: [{ type: 'integer' }, { type: 'string' }], description };
22
+ }
23
+ const commonQuerySchema = { type: 'object', additionalProperties: true };
24
+ const commonBodySchema = { type: 'object', additionalProperties: true };
25
+ const portalsTool = functionTool('zoho_projects_portals', 'Use portal-level Zoho Projects operations such as listing portals, backup, trash, restore, and delete.', objectSchema({
26
+ action: { type: 'string', enum: ['listPortals', 'getPortalDetails', 'scheduleDataBackup', 'getDataBackupStatus', 'getDataBackupHistory', 'getTrashedRecords', 'moveRecordsToTrash', 'deleteRecords', 'restoreRecordsFromTrash', 'emptyRecycleBin'] },
27
+ portal_id: idField('Portal ID.'),
28
+ export_id: idField('Backup export ID.'),
29
+ module: { type: 'string' },
30
+ record_id: idField('Single record ID.'),
31
+ body: commonBodySchema,
32
+ query: commonQuerySchema,
33
+ }, ['action']));
34
+ const projectsTool = functionTool('zoho_projects_projects', 'Use project-level Zoho Projects operations including CRUD and project comments.', objectSchema({
35
+ action: { type: 'string', enum: ['list', 'getById', 'create', 'update', 'deleteById', 'trash', 'listComments', 'getComment', 'addComment', 'updateComment', 'deleteComment', 'markFavouriteCustomView'] },
36
+ portal_id: idField('Portal ID.'),
37
+ project_id: idField('Project ID.'),
38
+ comment_id: idField('Comment ID.'),
39
+ custom_view_id: idField('Custom view ID.'),
40
+ body: commonBodySchema,
41
+ query: commonQuerySchema,
42
+ }, ['action']));
43
+ const projectGroupsTool = functionTool('zoho_projects_project_groups', 'Use project group operations.', objectSchema({
44
+ action: { type: 'string', enum: ['list', 'listMine', 'create', 'update', 'deleteById'] },
45
+ portal_id: idField('Portal ID.'),
46
+ group_id: idField('Project group ID.'),
47
+ body: commonBodySchema,
48
+ query: commonQuerySchema,
49
+ }, ['action']));
50
+ const phasesTool = functionTool('zoho_projects_phases', 'Use milestone/phase operations including CRUD, move, comments, and followers.', objectSchema({
51
+ action: { type: 'string', enum: ['list', 'listAll', 'getById', 'create', 'update', 'deleteById', 'move', 'statusTimeline', 'listComments', 'getComment', 'addComment', 'updateComment', 'deleteComment', 'getFollowers', 'addFollowers', 'removeFollowers'] },
52
+ portal_id: idField('Portal ID.'),
53
+ project_id: idField('Project ID.'),
54
+ phase_id: idField('Phase ID.'),
55
+ comment_id: idField('Comment ID.'),
56
+ body: commonBodySchema,
57
+ query: commonQuerySchema,
58
+ }, ['action']));
59
+ const tasklistsTool = functionTool('zoho_projects_tasklists', 'Use task list operations including CRUD, comments, followers, and make-as-template.', objectSchema({
60
+ action: { type: 'string', enum: ['list', 'listAll', 'getById', 'create', 'createDefault', 'update', 'deleteById', 'makeAsTemplate', 'getComments', 'getComment', 'addComment', 'updateComment', 'deleteComment', 'getFollowers', 'addFollowers', 'removeFollowers'] },
61
+ portal_id: idField('Portal ID.'),
62
+ project_id: idField('Project ID.'),
63
+ tasklist_id: idField('Task list ID.'),
64
+ comment_id: idField('Comment ID.'),
65
+ body: commonBodySchema,
66
+ query: commonQuerySchema,
67
+ }, ['action']));
68
+ const tasksTool = functionTool('zoho_projects_tasks', 'Use task operations including CRUD, lists, status history, and issue associations.', objectSchema({
69
+ action: { type: 'string', enum: ['listAll', 'listMyTasks', 'list', 'getById', 'create', 'update', 'deleteById', 'getStatusHistory', 'getAssociatedTasksByIssues'] },
70
+ portal_id: idField('Portal ID.'),
71
+ project_id: idField('Project ID.'),
72
+ task_id: idField('Task ID.'),
73
+ body: commonBodySchema,
74
+ query: commonQuerySchema,
75
+ issue_ids: { type: 'array', items: { anyOf: [{ type: 'integer' }, { type: 'string' }] } },
76
+ }, ['action']));
77
+ const issuesTool = functionTool('zoho_projects_issues', 'Use issue operations including CRUD, comments, attachments, followers, linking, and bulk actions.', objectSchema({
78
+ action: { type: 'string', enum: ['listAll', 'list', 'getById', 'create', 'update', 'deleteById', 'listCustomViews', 'move', 'getComments', 'getComment', 'addComment', 'updateComment', 'deleteComment', 'getFollowers', 'addFollowers', 'removeFollowers', 'getLinkedIssues', 'associateTasks', 'bulkAssociateTasks', 'bulkLinkIssues', 'getAttachments', 'addAttachments', 'removeAttachment', 'dissociateTask', 'getStatusTransition', 'addResolution', 'updateResolution', 'getAssociatedTasks', 'getAssociatedTasksByIssues', 'getCommentAttachment'] },
79
+ portal_id: idField('Portal ID.'),
80
+ project_id: idField('Project ID.'),
81
+ issue_id: idField('Issue ID.'),
82
+ comment_id: idField('Comment ID.'),
83
+ task_id: idField('Task ID.'),
84
+ attachment_id: idField('Attachment ID.'),
85
+ body: commonBodySchema,
86
+ query: commonQuerySchema,
87
+ issue_ids: { type: 'array', items: { anyOf: [{ type: 'integer' }, { type: 'string' }] } },
88
+ task_ids: { type: 'array', items: { anyOf: [{ type: 'integer' }, { type: 'string' }] } },
89
+ }, ['action']));
90
+ const recordsTool = functionTool('zoho_projects_records', 'Use dynamic module record operations such as create, edits, attachment counts, followers, and comments.', objectSchema({
91
+ action: { type: 'string', enum: ['createRecord', 'listEntityEdits', 'getEditsByAuditId', 'getAttachmentCount', 'getFollowers', 'addFollower', 'addOrRemoveFollowers', 'removeFollower', 'addComment'] },
92
+ portal_id: idField('Portal ID.'),
93
+ module_name: { type: 'string' },
94
+ entity_id: idField('Entity ID.'),
95
+ edit_id: idField('Edit/Audit ID.'),
96
+ body: commonBodySchema,
97
+ query: commonQuerySchema,
98
+ }, ['action']));
99
+ const settingsTool = functionTool('zoho_projects_settings', 'Use Zoho Projects module metadata and settings operations.', objectSchema({
100
+ action: { type: 'string', enum: ['listModules', 'getModule', 'createModule', 'updateModule', 'updateModuleStatus', 'trashModule', 'deleteModule', 'restoreModule', 'getModuleConfiguration', 'activateModule', 'deactivateModule', 'listLayouts', 'getDefaultLayout', 'getLayoutDetails', 'createLayout', 'updateLayout', 'deleteLayout', 'disassociateFieldFromLayout', 'getAssociatedEntitiesOfLayout', 'createOrUpdateSection', 'deleteSection', 'listFields', 'createOrUpdateField', 'deleteField', 'getAssociatedLayouts', 'getOptionsListForField', 'createBulkOptions', 'deleteOrDisassociateBulkOptions', 'updateBulkOptions', 'getModuleIntegrationField', 'getViews'] },
101
+ portal_id: idField('Portal ID.'),
102
+ module: { type: 'string' },
103
+ layout_id: idField('Layout ID.'),
104
+ field_id: idField('Field ID.'),
105
+ service_id: idField('Service ID.'),
106
+ view_id: idField('View ID.'),
107
+ body: commonBodySchema,
108
+ query: commonQuerySchema,
109
+ }, ['action']));
110
+ const timeLogsTool = functionTool('zoho_projects_time_logs', 'Use Zoho Projects time log operations, bulk time logs, reports, timers, pins, approvers, and settings.', objectSchema({
111
+ action: { type: 'string', enum: ['listPortalTimeLogs', 'listProjectTimeLogs', 'getTimeLogDetail', 'addTimeLog', 'bulkUpdateTimeLogs', 'bulkDeleteTimeLogs', 'getPortalTimeLogReport', 'getProjectTimeLogReport', 'getDefaultApprover', 'listPinnedPortalTimeLogs', 'listPinnedProjectTimeLogs', 'createPinnedPortalTimeLog', 'updatePinnedPortalTimeLog', 'deletePinnedPortalTimeLog', 'createPinnedProjectTimeLog', 'updatePinnedProjectTimeLog', 'deletePinnedProjectTimeLog', 'listRunningTimers', 'getTimerDetailsByLogId', 'startTimer', 'pauseTimer', 'resumeTimer', 'stopTimer', 'deleteTimer', 'getTimeLogSettingsMetaData', 'getTimeLogSettings', 'updateTimeLogSettings', 'listTaskLogs', 'addTaskLog', 'updateTaskLog', 'approveTaskLog', 'deleteTaskLog', 'listBugLogs', 'addBugLog', 'updateBugLog', 'approveBugLog', 'deleteBugLog', 'addGeneralLog', 'updateGeneralLog', 'approveGeneralLog', 'deleteGeneralLog', 'getTimesheetLayoutDetails', 'getAllTimesheetCustomFields'] },
112
+ portal_id: idField('Portal ID.'),
113
+ project_id: idField('Project ID.'),
114
+ task_id: idField('Task ID.'),
115
+ issue_id: idField('Issue/Bug ID.'),
116
+ log_id: idField('Time log ID.'),
117
+ timer_id: idField('Timer ID.'),
118
+ entity_type: { type: 'string', enum: ['task', 'issue'] },
119
+ body: commonBodySchema,
120
+ query: commonQuerySchema,
121
+ }, ['action']));
122
+ const requestTool = functionTool('zoho_projects_request', 'Use the raw Zoho Projects HTTP client for undocumented or experimental endpoints.', objectSchema({
123
+ path: { type: 'string', description: 'Path relative to the Zoho Projects API base, or an absolute URL.' },
124
+ method: { type: 'string', enum: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'] },
125
+ query: commonQuerySchema,
126
+ body: commonBodySchema,
127
+ }, ['path', 'method']));
128
+ export const zohoProjectsTools = [
129
+ portalsTool,
130
+ projectsTool,
131
+ projectGroupsTool,
132
+ phasesTool,
133
+ tasklistsTool,
134
+ tasksTool,
135
+ issuesTool,
136
+ recordsTool,
137
+ settingsTool,
138
+ timeLogsTool,
139
+ requestTool,
140
+ ];
141
+ function getNumberOrString(value) {
142
+ if (typeof value === 'string' || typeof value === 'number')
143
+ return value;
144
+ return undefined;
145
+ }
146
+ async function executePortal(context, input) {
147
+ const portalId = input.portal_id;
148
+ const query = input.query;
149
+ switch (input.action) {
150
+ case 'listPortals':
151
+ return context.client.portals.listPortals();
152
+ case 'getPortalDetails':
153
+ return context.client.portals.getPortalDetails(portalId);
154
+ case 'scheduleDataBackup':
155
+ return context.client.portals.scheduleDataBackup(portalId, String(input.access_code ?? ''));
156
+ case 'getDataBackupStatus':
157
+ return context.client.portals.getDataBackupStatus(portalId, input.export_id);
158
+ case 'getDataBackupHistory':
159
+ return context.client.portals.getDataBackupHistory(portalId);
160
+ case 'getTrashedRecords':
161
+ return context.client.portals.getTrashedRecords(portalId, query);
162
+ case 'moveRecordsToTrash':
163
+ return context.client.portals.moveRecordsToTrash(portalId, input.body);
164
+ case 'deleteRecords':
165
+ return context.client.portals.deleteRecords(portalId, input.body);
166
+ case 'restoreRecordsFromTrash':
167
+ return context.client.portals.restoreRecordsFromTrash(portalId, input.body);
168
+ case 'emptyRecycleBin':
169
+ return context.client.portals.emptyRecycleBin(portalId);
170
+ default:
171
+ throw new Error(`Unsupported portals action: ${String(input.action)}`);
172
+ }
173
+ }
174
+ async function executeProjects(context, input) {
175
+ const portalId = input.portal_id;
176
+ const projectId = input.project_id;
177
+ const query = input.query;
178
+ switch (input.action) {
179
+ case 'list':
180
+ return context.client.projects.list(portalId, query);
181
+ case 'getById':
182
+ return context.client.projects.getById(portalId, projectId);
183
+ case 'create':
184
+ return context.client.projects.create(portalId, input.body);
185
+ case 'update':
186
+ return context.client.projects.update(portalId, projectId, input.body);
187
+ case 'deleteById':
188
+ return context.client.projects.deleteById(portalId, projectId);
189
+ case 'trash':
190
+ return context.client.projects.trash(portalId, projectId);
191
+ case 'listComments':
192
+ return context.client.projects.listComments(portalId, projectId, query);
193
+ case 'getComment':
194
+ return context.client.projects.getComment(portalId, projectId, input.comment_id);
195
+ case 'addComment':
196
+ return context.client.projects.addComment(portalId, projectId, input.body);
197
+ case 'updateComment':
198
+ return context.client.projects.updateComment(portalId, projectId, input.comment_id, input.body);
199
+ case 'deleteComment':
200
+ return context.client.projects.deleteComment(portalId, projectId, input.comment_id);
201
+ case 'markFavouriteCustomView':
202
+ return context.client.projects.markFavouriteCustomView(portalId, input.custom_view_id);
203
+ default:
204
+ throw new Error(`Unsupported projects action: ${String(input.action)}`);
205
+ }
206
+ }
207
+ async function executeProjectGroups(context, input) {
208
+ const portalId = input.portal_id;
209
+ const groupId = input.group_id;
210
+ const query = input.query;
211
+ switch (input.action) {
212
+ case 'list':
213
+ return context.client.projectGroups.list(portalId, query);
214
+ case 'listMine':
215
+ return context.client.projectGroups.listMine(portalId, query);
216
+ case 'create':
217
+ return context.client.projectGroups.create(portalId, input.body);
218
+ case 'update':
219
+ return context.client.projectGroups.update(portalId, groupId, input.body);
220
+ case 'deleteById':
221
+ return context.client.projectGroups.deleteById(portalId, groupId);
222
+ default:
223
+ throw new Error(`Unsupported project groups action: ${String(input.action)}`);
224
+ }
225
+ }
226
+ async function executePhases(context, input) {
227
+ const portalId = input.portal_id;
228
+ const projectId = input.project_id;
229
+ const phaseId = input.phase_id;
230
+ const commentId = input.comment_id;
231
+ const query = input.query;
232
+ switch (input.action) {
233
+ case 'list':
234
+ return context.client.phases.list(portalId, projectId, query);
235
+ case 'listAll':
236
+ return context.client.phases.listAll(portalId, query);
237
+ case 'getById':
238
+ return context.client.phases.getById(portalId, projectId, phaseId);
239
+ case 'create':
240
+ return context.client.phases.create(portalId, projectId, input.body);
241
+ case 'update':
242
+ return context.client.phases.update(portalId, projectId, phaseId, input.body);
243
+ case 'deleteById':
244
+ return context.client.phases.deleteById(portalId, projectId, phaseId);
245
+ case 'move':
246
+ return context.client.phases.move(portalId, projectId, phaseId, input.body);
247
+ case 'statusTimeline':
248
+ return context.client.phases.statusTimeline(portalId, projectId, phaseId);
249
+ case 'listComments':
250
+ return context.client.phases.listComments(portalId, projectId, phaseId, query);
251
+ case 'getComment':
252
+ return context.client.phases.getComment(portalId, projectId, phaseId, commentId);
253
+ case 'addComment':
254
+ return context.client.phases.addComment(portalId, projectId, phaseId, input.body);
255
+ case 'updateComment':
256
+ return context.client.phases.updateComment(portalId, projectId, phaseId, commentId, input.body);
257
+ case 'deleteComment':
258
+ return context.client.phases.deleteComment(portalId, projectId, phaseId, commentId);
259
+ case 'getFollowers':
260
+ return context.client.phases.getFollowers(portalId, projectId, phaseId, query);
261
+ case 'addFollowers':
262
+ return context.client.phases.addFollowers(portalId, projectId, phaseId, input.body);
263
+ case 'removeFollowers':
264
+ return context.client.phases.removeFollowers(portalId, projectId, phaseId, input.body);
265
+ default:
266
+ throw new Error(`Unsupported phases action: ${String(input.action)}`);
267
+ }
268
+ }
269
+ async function executeTasklists(context, input) {
270
+ const portalId = input.portal_id;
271
+ const projectId = input.project_id;
272
+ const tasklistId = input.tasklist_id;
273
+ const commentId = input.comment_id;
274
+ const query = input.query;
275
+ switch (input.action) {
276
+ case 'list':
277
+ return context.client.tasklists.list(portalId, projectId, query);
278
+ case 'listAll':
279
+ return context.client.tasklists.listAll(portalId, query);
280
+ case 'getById':
281
+ return context.client.tasklists.getById(portalId, projectId, tasklistId);
282
+ case 'create':
283
+ return context.client.tasklists.create(portalId, projectId, input.body);
284
+ case 'createDefault':
285
+ return context.client.tasklists.createDefault(portalId, projectId, String(input.name ?? 'internal'));
286
+ case 'update':
287
+ return context.client.tasklists.update(portalId, projectId, tasklistId, input.body);
288
+ case 'deleteById':
289
+ return context.client.tasklists.deleteById(portalId, projectId, tasklistId);
290
+ case 'makeAsTemplate':
291
+ return context.client.tasklists.makeAsTemplate(portalId, projectId, tasklistId);
292
+ case 'getComments':
293
+ return context.client.tasklists.getComments(portalId, projectId, tasklistId, query);
294
+ case 'getComment':
295
+ return context.client.tasklists.getComment(portalId, projectId, tasklistId, commentId);
296
+ case 'addComment':
297
+ return context.client.tasklists.addComment(portalId, projectId, tasklistId, input.body);
298
+ case 'updateComment':
299
+ return context.client.tasklists.updateComment(portalId, projectId, tasklistId, commentId, input.body);
300
+ case 'deleteComment':
301
+ return context.client.tasklists.deleteComment(portalId, projectId, tasklistId, commentId);
302
+ case 'getFollowers':
303
+ return context.client.tasklists.getFollowers(portalId, projectId, tasklistId, query);
304
+ case 'addFollowers':
305
+ return context.client.tasklists.addFollowers(portalId, projectId, tasklistId, input.body);
306
+ case 'removeFollowers':
307
+ return context.client.tasklists.removeFollowers(portalId, projectId, tasklistId, input.body);
308
+ default:
309
+ throw new Error(`Unsupported tasklists action: ${String(input.action)}`);
310
+ }
311
+ }
312
+ async function executeTasks(context, input) {
313
+ const portalId = input.portal_id;
314
+ const projectId = input.project_id;
315
+ const taskId = input.task_id;
316
+ const query = input.query;
317
+ switch (input.action) {
318
+ case 'listAll':
319
+ return context.client.tasks.listAll(portalId, query);
320
+ case 'listMyTasks':
321
+ return context.client.tasks.listMyTasks(portalId, query);
322
+ case 'list':
323
+ return context.client.tasks.list(portalId, projectId, query);
324
+ case 'getById':
325
+ return context.client.tasks.getById(portalId, projectId, taskId);
326
+ case 'create':
327
+ return context.client.tasks.create(portalId, projectId, input.body);
328
+ case 'update':
329
+ return context.client.tasks.update(portalId, projectId, taskId, input.body);
330
+ case 'deleteById':
331
+ return context.client.tasks.deleteById(portalId, projectId, taskId);
332
+ case 'getStatusHistory':
333
+ return context.client.tasks.getStatusHistory(portalId, projectId, query);
334
+ case 'getAssociatedTasksByIssues':
335
+ return context.client.tasks.getAssociatedTasksByIssues(portalId, (input.issue_ids ?? []), query);
336
+ default:
337
+ throw new Error(`Unsupported tasks action: ${String(input.action)}`);
338
+ }
339
+ }
340
+ async function executeIssues(context, input) {
341
+ const portalId = input.portal_id;
342
+ const projectId = input.project_id;
343
+ const issueId = input.issue_id;
344
+ const commentId = input.comment_id;
345
+ const taskId = input.task_id;
346
+ const attachmentId = input.attachment_id;
347
+ const query = input.query;
348
+ switch (input.action) {
349
+ case 'listAll':
350
+ return context.client.issues.listAll(portalId, query);
351
+ case 'list':
352
+ return context.client.issues.list(portalId, projectId, query);
353
+ case 'getById':
354
+ return context.client.issues.getById(portalId, projectId, issueId);
355
+ case 'create':
356
+ return context.client.issues.create(portalId, projectId, input.body);
357
+ case 'update':
358
+ return context.client.issues.update(portalId, projectId, issueId, input.body);
359
+ case 'deleteById':
360
+ return context.client.issues.deleteById(portalId, projectId, issueId);
361
+ case 'listCustomViews':
362
+ return context.client.issues.listCustomViews(portalId, projectId);
363
+ case 'move':
364
+ return context.client.issues.move(portalId, projectId, issueId, input.body);
365
+ case 'getComments':
366
+ return context.client.issues.getComments(portalId, projectId, issueId, query);
367
+ case 'getComment':
368
+ return context.client.issues.getComment(portalId, projectId, issueId, commentId);
369
+ case 'addComment':
370
+ return context.client.issues.addComment(portalId, projectId, issueId, input.body);
371
+ case 'updateComment':
372
+ return context.client.issues.updateComment(portalId, projectId, issueId, commentId, input.body);
373
+ case 'deleteComment':
374
+ return context.client.issues.deleteComment(portalId, projectId, issueId, commentId);
375
+ case 'getFollowers':
376
+ return context.client.issues.getFollowers(portalId, projectId, issueId, query);
377
+ case 'addFollowers':
378
+ return context.client.issues.addFollowers(portalId, projectId, issueId, input.body);
379
+ case 'removeFollowers':
380
+ return context.client.issues.removeFollowers(portalId, projectId, issueId, input.body);
381
+ case 'getLinkedIssues':
382
+ return context.client.issues.getLinkedIssues(portalId, projectId, issueId);
383
+ case 'associateTasks':
384
+ return context.client.issues.associateTasks(portalId, projectId, issueId, input.body);
385
+ case 'bulkAssociateTasks':
386
+ return context.client.issues.bulkAssociateTasks(portalId, projectId, input.body);
387
+ case 'bulkLinkIssues':
388
+ return context.client.issues.bulkLinkIssues(portalId, projectId, input.body);
389
+ case 'getAttachments':
390
+ return context.client.issues.getAttachments(portalId, projectId, issueId);
391
+ case 'addAttachments':
392
+ return context.client.issues.addAttachments(portalId, projectId, issueId, input.body);
393
+ case 'removeAttachment':
394
+ return context.client.issues.removeAttachment(portalId, projectId, issueId, attachmentId);
395
+ case 'dissociateTask':
396
+ return context.client.issues.dissociateTask(portalId, projectId, issueId, taskId);
397
+ case 'getStatusTransition':
398
+ return context.client.issues.getStatusTransition(portalId, projectId, issueId);
399
+ case 'addResolution':
400
+ return context.client.issues.addResolution(portalId, projectId, issueId, input.body);
401
+ case 'updateResolution':
402
+ return context.client.issues.updateResolution(portalId, projectId, issueId, input.body);
403
+ case 'getAssociatedTasks':
404
+ return context.client.issues.getAssociatedTasks(portalId, projectId, issueId, query);
405
+ case 'getAssociatedTasksByIssues':
406
+ return context.client.issues.getAssociatedTasksByIssues(portalId, (input.issue_ids ?? []), query);
407
+ case 'getCommentAttachment':
408
+ return context.client.issues.getCommentAttachment(portalId, projectId, issueId, commentId);
409
+ default:
410
+ throw new Error(`Unsupported issues action: ${String(input.action)}`);
411
+ }
412
+ }
413
+ async function executeRecords(context, input) {
414
+ const portalId = input.portal_id;
415
+ const moduleName = String(input.module_name ?? '');
416
+ const entityId = input.entity_id;
417
+ const editId = input.edit_id;
418
+ const query = input.query;
419
+ switch (input.action) {
420
+ case 'createRecord':
421
+ return context.client.records.createRecord(portalId, moduleName, input.body);
422
+ case 'listEntityEdits':
423
+ return context.client.records.listEntityEdits(portalId, moduleName, entityId, query);
424
+ case 'getEditsByAuditId':
425
+ return context.client.records.getEditsByAuditId(portalId, moduleName, entityId, editId);
426
+ case 'getAttachmentCount':
427
+ return context.client.records.getAttachmentCount(portalId, moduleName, entityId);
428
+ case 'getFollowers':
429
+ return context.client.records.getFollowers(portalId, moduleName, entityId, query);
430
+ case 'addFollower':
431
+ return context.client.records.addFollower(portalId, moduleName, entityId);
432
+ case 'addOrRemoveFollowers':
433
+ return context.client.records.addOrRemoveFollowers(portalId, moduleName, entityId, input.body);
434
+ case 'removeFollower':
435
+ return context.client.records.removeFollower(portalId, moduleName, entityId);
436
+ case 'addComment':
437
+ return context.client.records.addComment(portalId, moduleName, entityId, input.body);
438
+ default:
439
+ throw new Error(`Unsupported records action: ${String(input.action)}`);
440
+ }
441
+ }
442
+ async function executeSettings(context, input) {
443
+ const portalId = input.portal_id;
444
+ const moduleName = String(input.module ?? '');
445
+ const layoutId = input.layout_id;
446
+ const fieldId = input.field_id;
447
+ const serviceId = input.service_id;
448
+ const viewId = input.view_id;
449
+ const query = input.query;
450
+ switch (input.action) {
451
+ case 'listModules':
452
+ return context.client.settings.listModules(portalId, query);
453
+ case 'getModule':
454
+ return context.client.settings.getModule(portalId, moduleName);
455
+ case 'createModule':
456
+ return context.client.settings.createModule(portalId, input.body);
457
+ case 'updateModule':
458
+ return context.client.settings.updateModule(portalId, moduleName, input.body);
459
+ case 'updateModuleStatus':
460
+ return context.client.settings.updateModuleStatus(portalId, moduleName, input.body);
461
+ case 'trashModule':
462
+ return context.client.settings.trashModule(portalId, moduleName, input.body);
463
+ case 'deleteModule':
464
+ return context.client.settings.deleteModule(portalId, moduleName);
465
+ case 'restoreModule':
466
+ return context.client.settings.restoreModule(portalId, moduleName, input.body);
467
+ case 'getModuleConfiguration':
468
+ return context.client.settings.getModuleConfiguration(portalId, moduleName);
469
+ case 'activateModule':
470
+ return context.client.settings.activateModule(portalId, moduleName);
471
+ case 'deactivateModule':
472
+ return context.client.settings.deactivateModule(portalId, moduleName);
473
+ case 'listLayouts':
474
+ return context.client.settings.listLayouts(portalId, query);
475
+ case 'getDefaultLayout':
476
+ return context.client.settings.getDefaultLayout(portalId, query);
477
+ case 'getLayoutDetails':
478
+ return context.client.settings.getLayoutDetails(portalId, layoutId);
479
+ case 'createLayout':
480
+ return context.client.settings.createLayout(portalId, input.body);
481
+ case 'updateLayout':
482
+ return context.client.settings.updateLayout(portalId, layoutId, input.body);
483
+ case 'deleteLayout':
484
+ return context.client.settings.deleteLayout(portalId, layoutId);
485
+ case 'disassociateFieldFromLayout':
486
+ return context.client.settings.disassociateFieldFromLayout(portalId, layoutId, fieldId);
487
+ case 'getAssociatedEntitiesOfLayout':
488
+ return context.client.settings.getAssociatedEntitiesOfLayout(portalId, layoutId);
489
+ case 'createOrUpdateSection':
490
+ return context.client.settings.createOrUpdateSection(portalId, layoutId, input.body);
491
+ case 'deleteSection':
492
+ return context.client.settings.deleteSection(portalId, layoutId, input.body);
493
+ case 'listFields':
494
+ return context.client.settings.listFields(portalId, query);
495
+ case 'createOrUpdateField':
496
+ return context.client.settings.createOrUpdateField(portalId, input.body);
497
+ case 'deleteField':
498
+ return context.client.settings.deleteField(portalId, input.body);
499
+ case 'getAssociatedLayouts':
500
+ return context.client.settings.getAssociatedLayouts(portalId, fieldId, query);
501
+ case 'getOptionsListForField':
502
+ return context.client.settings.getOptionsListForField(portalId, query);
503
+ case 'createBulkOptions':
504
+ return context.client.settings.createBulkOptions(portalId, input.body);
505
+ case 'deleteOrDisassociateBulkOptions':
506
+ return context.client.settings.deleteOrDisassociateBulkOptions(portalId, input.body);
507
+ case 'updateBulkOptions':
508
+ return context.client.settings.updateBulkOptions(portalId, input.body);
509
+ case 'getModuleIntegrationField':
510
+ return context.client.settings.getModuleIntegrationField(portalId, serviceId, moduleName);
511
+ case 'getViews':
512
+ return context.client.settings.getViews(portalId, viewId);
513
+ default:
514
+ throw new Error(`Unsupported settings action: ${String(input.action)}`);
515
+ }
516
+ }
517
+ async function executeTimeLogs(context, input) {
518
+ const portalId = input.portal_id;
519
+ const projectId = input.project_id;
520
+ const taskId = input.task_id;
521
+ const issueId = input.issue_id;
522
+ const logId = input.log_id;
523
+ const timerId = input.timer_id;
524
+ const entityType = input.entity_type;
525
+ const query = input.query;
526
+ switch (input.action) {
527
+ case 'listPortalTimeLogs':
528
+ return context.client.timeLogs.listPortalTimeLogs(portalId, query);
529
+ case 'listProjectTimeLogs':
530
+ return context.client.timeLogs.listProjectTimeLogs(portalId, projectId, query);
531
+ case 'getTimeLogDetail':
532
+ return context.client.timeLogs.getTimeLogDetail(portalId, projectId, logId, String(input.type ?? 'task'));
533
+ case 'addTimeLog':
534
+ return context.client.timeLogs.addTimeLog(portalId, projectId, input.body);
535
+ case 'bulkUpdateTimeLogs':
536
+ return context.client.timeLogs.bulkUpdateTimeLogs(portalId, input.body);
537
+ case 'bulkDeleteTimeLogs':
538
+ return context.client.timeLogs.bulkDeleteTimeLogs(portalId, input.body);
539
+ case 'getPortalTimeLogReport':
540
+ return context.client.timeLogs.getPortalTimeLogReport(portalId, query);
541
+ case 'getProjectTimeLogReport':
542
+ return context.client.timeLogs.getProjectTimeLogReport(portalId, projectId, query);
543
+ case 'getDefaultApprover':
544
+ return context.client.timeLogs.getDefaultApprover(portalId, projectId);
545
+ case 'listPinnedPortalTimeLogs':
546
+ return context.client.timeLogs.listPinnedPortalTimeLogs(portalId);
547
+ case 'listPinnedProjectTimeLogs':
548
+ return context.client.timeLogs.listPinnedProjectTimeLogs(portalId, projectId);
549
+ case 'createPinnedPortalTimeLog':
550
+ return context.client.timeLogs.createPinnedPortalTimeLog(portalId, input.body);
551
+ case 'updatePinnedPortalTimeLog':
552
+ return context.client.timeLogs.updatePinnedPortalTimeLog(portalId, input.body);
553
+ case 'deletePinnedPortalTimeLog':
554
+ return context.client.timeLogs.deletePinnedPortalTimeLog(portalId, input.body);
555
+ case 'createPinnedProjectTimeLog':
556
+ return context.client.timeLogs.createPinnedProjectTimeLog(portalId, projectId, input.body);
557
+ case 'updatePinnedProjectTimeLog':
558
+ return context.client.timeLogs.updatePinnedProjectTimeLog(portalId, projectId, input.body);
559
+ case 'deletePinnedProjectTimeLog':
560
+ return context.client.timeLogs.deletePinnedProjectTimeLog(portalId, projectId, input.body);
561
+ case 'listRunningTimers':
562
+ return context.client.timeLogs.listRunningTimers(portalId, query);
563
+ case 'getTimerDetailsByLogId':
564
+ return context.client.timeLogs.getTimerDetailsByLogId(portalId, projectId, entityType, logId);
565
+ case 'startTimer':
566
+ return context.client.timeLogs.startTimer(portalId, input.body);
567
+ case 'pauseTimer':
568
+ return context.client.timeLogs.pauseTimer(portalId, timerId, input.body);
569
+ case 'resumeTimer':
570
+ return context.client.timeLogs.resumeTimer(portalId, timerId, input.body);
571
+ case 'stopTimer':
572
+ return context.client.timeLogs.stopTimer(portalId, timerId, input.body);
573
+ case 'deleteTimer':
574
+ return context.client.timeLogs.deleteTimer(portalId, timerId);
575
+ case 'getTimeLogSettingsMetaData':
576
+ return context.client.timeLogs.getTimeLogSettingsMetaData(portalId);
577
+ case 'getTimeLogSettings':
578
+ return context.client.timeLogs.getTimeLogSettings(portalId);
579
+ case 'updateTimeLogSettings':
580
+ return context.client.timeLogs.updateTimeLogSettings(portalId, input.body);
581
+ case 'listTaskLogs':
582
+ return context.client.timeLogs.listTaskLogs(portalId, projectId, taskId, query);
583
+ case 'addTaskLog':
584
+ return context.client.timeLogs.addTaskLog(portalId, projectId, taskId, input.body);
585
+ case 'updateTaskLog':
586
+ return context.client.timeLogs.updateTaskLog(portalId, projectId, taskId, logId, input.body);
587
+ case 'approveTaskLog':
588
+ return context.client.timeLogs.approveTaskLog(portalId, projectId, taskId, logId, input.body);
589
+ case 'deleteTaskLog':
590
+ return context.client.timeLogs.deleteTaskLog(portalId, projectId, taskId, logId);
591
+ case 'listBugLogs':
592
+ return context.client.timeLogs.listBugLogs(portalId, projectId, issueId, query);
593
+ case 'addBugLog':
594
+ return context.client.timeLogs.addBugLog(portalId, projectId, issueId, input.body);
595
+ case 'updateBugLog':
596
+ return context.client.timeLogs.updateBugLog(portalId, projectId, issueId, logId, input.body);
597
+ case 'approveBugLog':
598
+ return context.client.timeLogs.approveBugLog(portalId, projectId, issueId, logId, input.body);
599
+ case 'deleteBugLog':
600
+ return context.client.timeLogs.deleteBugLog(portalId, projectId, issueId, logId);
601
+ case 'addGeneralLog':
602
+ return context.client.timeLogs.addGeneralLog(portalId, projectId, input.body);
603
+ case 'updateGeneralLog':
604
+ return context.client.timeLogs.updateGeneralLog(portalId, projectId, logId, input.body);
605
+ case 'approveGeneralLog':
606
+ return context.client.timeLogs.approveGeneralLog(portalId, projectId, logId, input.body);
607
+ case 'deleteGeneralLog':
608
+ return context.client.timeLogs.deleteGeneralLog(portalId, projectId, logId);
609
+ case 'getTimesheetLayoutDetails':
610
+ return context.client.timeLogs.getTimesheetLayoutDetails(portalId, projectId);
611
+ case 'getAllTimesheetCustomFields':
612
+ return context.client.timeLogs.getAllTimesheetCustomFields(portalId);
613
+ default:
614
+ throw new Error(`Unsupported time logs action: ${String(input.action)}`);
615
+ }
616
+ }
617
+ async function executeRequest(context, input) {
618
+ const path = input.path;
619
+ const method = input.method;
620
+ return context.client.request(path, {
621
+ method,
622
+ query: input.query,
623
+ body: input.body,
624
+ });
625
+ }
626
+ const executors = {
627
+ zoho_projects_portals: executePortal,
628
+ zoho_projects_projects: executeProjects,
629
+ zoho_projects_project_groups: executeProjectGroups,
630
+ zoho_projects_phases: executePhases,
631
+ zoho_projects_tasklists: executeTasklists,
632
+ zoho_projects_tasks: executeTasks,
633
+ zoho_projects_issues: executeIssues,
634
+ zoho_projects_records: executeRecords,
635
+ zoho_projects_settings: executeSettings,
636
+ zoho_projects_time_logs: executeTimeLogs,
637
+ zoho_projects_request: executeRequest,
638
+ };
639
+ export function executeZohoProjectsTool(client, toolName, input = {}) {
640
+ const executor = executors[toolName];
641
+ if (!executor) {
642
+ throw new Error(`Unknown Zoho Projects tool: ${toolName}`);
643
+ }
644
+ return executor({ client }, input);
645
+ }
646
+ export function createZohoProjectsToolContext(client) {
647
+ return { client };
648
+ }
649
+ export function hasZohoProjectsTool(toolName) {
650
+ return toolName in executors;
651
+ }
652
+ //# sourceMappingURL=tools.js.map