@skriptfabrik/n8n-nodes-clockify-enhanced 0.4.2 → 0.4.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/.eslintignore +1 -0
- package/.eslintrc.json +30 -0
- package/CHANGELOG.md +27 -0
- package/jest.config.ts +11 -0
- package/package.json +4 -7
- package/project.json +37 -0
- package/src/api.d.ts +14974 -0
- package/src/nodes/ClockifyEnhanced/ClockifyEnhanced.node.spec.ts +920 -0
- package/src/nodes/ClockifyEnhanced/ClockifyEnhanced.node.ts +387 -0
- package/src/nodes/ClockifyEnhanced/ClockifyEnhancedTrigger.node.spec.ts +870 -0
- package/src/nodes/ClockifyEnhanced/ClockifyEnhancedTrigger.node.ts +356 -0
- package/src/nodes/ClockifyEnhanced/descriptions/ProjectDescription.ts +120 -0
- package/src/nodes/ClockifyEnhanced/descriptions/ProjectMembershipsDescription.ts +125 -0
- package/tsconfig.json +28 -0
- package/tsconfig.lib.json +10 -0
- package/tsconfig.spec.json +13 -0
- package/src/nodes/ClockifyEnhanced/ClockifyEnhanced.node.d.ts +0 -15
- package/src/nodes/ClockifyEnhanced/ClockifyEnhanced.node.js +0 -232
- package/src/nodes/ClockifyEnhanced/ClockifyEnhanced.node.js.map +0 -1
- package/src/nodes/ClockifyEnhanced/ClockifyEnhancedTrigger.node.d.ts +0 -52
- package/src/nodes/ClockifyEnhanced/ClockifyEnhancedTrigger.node.js +0 -297
- package/src/nodes/ClockifyEnhanced/ClockifyEnhancedTrigger.node.js.map +0 -1
- package/src/nodes/ClockifyEnhanced/descriptions/ProjectDescription.d.ts +0 -3
- package/src/nodes/ClockifyEnhanced/descriptions/ProjectDescription.js +0 -117
- package/src/nodes/ClockifyEnhanced/descriptions/ProjectDescription.js.map +0 -1
- package/src/nodes/ClockifyEnhanced/descriptions/ProjectMembershipsDescription.d.ts +0 -3
- package/src/nodes/ClockifyEnhanced/descriptions/ProjectMembershipsDescription.js +0 -122
- package/src/nodes/ClockifyEnhanced/descriptions/ProjectMembershipsDescription.js.map +0 -1
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { clockifyApiRequest } from 'n8n-nodes-base/dist/nodes/Clockify/GenericFunctions';
|
|
2
|
+
import type {
|
|
3
|
+
IDataObject,
|
|
4
|
+
IHookFunctions,
|
|
5
|
+
ILoadOptionsFunctions,
|
|
6
|
+
INodePropertyOptions,
|
|
7
|
+
INodeType,
|
|
8
|
+
INodeTypeDescription,
|
|
9
|
+
IWebhookFunctions,
|
|
10
|
+
IWebhookResponseData,
|
|
11
|
+
} from 'n8n-workflow';
|
|
12
|
+
import { components } from '../../api';
|
|
13
|
+
|
|
14
|
+
export type Workspace = components['schemas']['WorkspaceDtoV1'];
|
|
15
|
+
export type Webhook = components['schemas']['WebhookDtoV1'];
|
|
16
|
+
export type WebhookCreate = components['schemas']['CreateWebhookRequestV1'];
|
|
17
|
+
export type Webhooks = components['schemas']['WebhooksDtoV1'];
|
|
18
|
+
|
|
19
|
+
export interface StaticData extends IDataObject {
|
|
20
|
+
webhookAuthToken?: string;
|
|
21
|
+
webhookId?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export enum WebhookEvent {
|
|
25
|
+
APPROVAL_REQUEST_STATUS_UPDATED = 'APPROVAL_REQUEST_STATUS_UPDATED',
|
|
26
|
+
BALANCE_UPDATED = 'BALANCE_UPDATED',
|
|
27
|
+
INVOICE_UPDATED = 'INVOICE_UPDATED',
|
|
28
|
+
NEW_APPROVAL_REQUEST = 'NEW_APPROVAL_REQUEST',
|
|
29
|
+
NEW_CLIENT = 'NEW_CLIENT',
|
|
30
|
+
NEW_INVOICE = 'NEW_INVOICE',
|
|
31
|
+
NEW_PROJECT = 'NEW_PROJECT',
|
|
32
|
+
NEW_TAG = 'NEW_TAG',
|
|
33
|
+
NEW_TASK = 'NEW_TASK',
|
|
34
|
+
NEW_TIME_ENTRY = 'NEW_TIME_ENTRY',
|
|
35
|
+
NEW_TIMER_STARTED = 'NEW_TIMER_STARTED',
|
|
36
|
+
TIME_ENTRY_DELETED = 'TIME_ENTRY_DELETED',
|
|
37
|
+
TIME_ENTRY_UPDATED = 'TIME_ENTRY_UPDATED',
|
|
38
|
+
TIME_OFF_REQUEST_APPROVED = 'TIME_OFF_REQUEST_APPROVED',
|
|
39
|
+
TIME_OFF_REQUEST_REJECTED = 'TIME_OFF_REQUEST_REJECTED',
|
|
40
|
+
TIME_OFF_REQUEST_WITHDRAWN = 'TIME_OFF_REQUEST_WITHDRAWN',
|
|
41
|
+
TIME_OFF_REQUESTED = 'TIME_OFF_REQUESTED',
|
|
42
|
+
TIMER_STOPPED = 'TIMER_STOPPED',
|
|
43
|
+
USER_ACTIVATED_ON_WORKSPACE = 'USER_ACTIVATED_ON_WORKSPACE',
|
|
44
|
+
USER_DEACTIVATED_ON_WORKSPACE = 'USER_DEACTIVATED_ON_WORKSPACE',
|
|
45
|
+
USER_DELETED_FROM_WORKSPACE = 'USER_DELETED_FROM_WORKSPACE',
|
|
46
|
+
USER_EMAIL_CHANGED = 'USER_EMAIL_CHANGED',
|
|
47
|
+
USER_JOINED_WORKSPACE = 'USER_JOINED_WORKSPACE',
|
|
48
|
+
USER_UPDATED = 'USER_UPDATED',
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export class ClockifyEnhancedTrigger implements INodeType {
|
|
52
|
+
description: INodeTypeDescription = {
|
|
53
|
+
displayName: 'Clockify Enhanced Trigger',
|
|
54
|
+
name: 'clockifyEnhancedTrigger',
|
|
55
|
+
icon: 'file:icons/clockify-enhanced.svg',
|
|
56
|
+
group: ['trigger'],
|
|
57
|
+
version: 1,
|
|
58
|
+
subtitle: '={{$parameter["name"]}}',
|
|
59
|
+
description: 'Listen to Clockify events',
|
|
60
|
+
defaults: {
|
|
61
|
+
name: 'Clockify Enhanced Trigger',
|
|
62
|
+
},
|
|
63
|
+
inputs: [],
|
|
64
|
+
outputs: ['main'],
|
|
65
|
+
credentials: [
|
|
66
|
+
{
|
|
67
|
+
name: 'clockifyApi',
|
|
68
|
+
required: true,
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
webhooks: [
|
|
72
|
+
{
|
|
73
|
+
name: 'default',
|
|
74
|
+
httpMethod: 'POST',
|
|
75
|
+
responseMode: 'onReceived',
|
|
76
|
+
path: 'webhook',
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
properties: [
|
|
80
|
+
{
|
|
81
|
+
displayName: 'Workspace Name or ID',
|
|
82
|
+
name: 'workspaceId',
|
|
83
|
+
type: 'options',
|
|
84
|
+
description:
|
|
85
|
+
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
|
86
|
+
typeOptions: {
|
|
87
|
+
loadOptionsMethod: 'listWorkspaces',
|
|
88
|
+
},
|
|
89
|
+
required: true,
|
|
90
|
+
default: '',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
displayName: 'Webhook Name',
|
|
94
|
+
name: 'name',
|
|
95
|
+
type: 'string',
|
|
96
|
+
required: true,
|
|
97
|
+
default: '',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
displayName: 'Webhook Event',
|
|
101
|
+
name: 'webhookEvent',
|
|
102
|
+
type: 'options',
|
|
103
|
+
options: [
|
|
104
|
+
{
|
|
105
|
+
name: 'Approval Request Status Updated',
|
|
106
|
+
value: WebhookEvent.APPROVAL_REQUEST_STATUS_UPDATED,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'Balance Updated',
|
|
110
|
+
value: WebhookEvent.BALANCE_UPDATED,
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'Client Created',
|
|
114
|
+
value: WebhookEvent.NEW_CLIENT,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: 'Invoice Created',
|
|
118
|
+
value: WebhookEvent.NEW_INVOICE,
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: 'Invoice Updated',
|
|
122
|
+
value: WebhookEvent.INVOICE_UPDATED,
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: 'New Approval Request',
|
|
126
|
+
value: WebhookEvent.NEW_APPROVAL_REQUEST,
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'Project Created',
|
|
130
|
+
value: WebhookEvent.NEW_PROJECT,
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: 'Tag Created',
|
|
134
|
+
value: WebhookEvent.NEW_TAG,
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: 'Task Created',
|
|
138
|
+
value: WebhookEvent.NEW_TASK,
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
name: 'Time Entry Created',
|
|
142
|
+
value: WebhookEvent.NEW_TIME_ENTRY,
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: 'Time Entry Deleted',
|
|
146
|
+
value: WebhookEvent.TIME_ENTRY_DELETED,
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: 'Time Entry Updated',
|
|
150
|
+
value: WebhookEvent.TIME_ENTRY_UPDATED,
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: 'Time Off Request Approved',
|
|
154
|
+
value: WebhookEvent.TIME_OFF_REQUEST_APPROVED,
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
name: 'Time Off Request Rejected',
|
|
158
|
+
value: WebhookEvent.TIME_OFF_REQUEST_REJECTED,
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: 'Time Off Request Withdrawn',
|
|
162
|
+
value: WebhookEvent.TIME_OFF_REQUEST_WITHDRAWN,
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
name: 'Time Off Requested',
|
|
166
|
+
value: WebhookEvent.TIME_OFF_REQUESTED,
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: 'Timer Started',
|
|
170
|
+
value: WebhookEvent.NEW_TIMER_STARTED,
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: 'Timer Stopped',
|
|
174
|
+
value: WebhookEvent.TIMER_STOPPED,
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: 'User Activated On Workspace',
|
|
178
|
+
value: WebhookEvent.USER_ACTIVATED_ON_WORKSPACE,
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
name: 'User Deactivated On Workspace',
|
|
182
|
+
value: WebhookEvent.USER_DEACTIVATED_ON_WORKSPACE,
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
name: 'User Deleted From Workspace',
|
|
186
|
+
value: WebhookEvent.USER_DELETED_FROM_WORKSPACE,
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
name: 'User Email Changed',
|
|
190
|
+
value: WebhookEvent.USER_EMAIL_CHANGED,
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
name: 'User Joined Workspace',
|
|
194
|
+
value: WebhookEvent.USER_JOINED_WORKSPACE,
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
name: 'User Updated',
|
|
198
|
+
value: WebhookEvent.USER_UPDATED,
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
required: true,
|
|
202
|
+
default: `${WebhookEvent.APPROVAL_REQUEST_STATUS_UPDATED}`,
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
methods = {
|
|
208
|
+
loadOptions: {
|
|
209
|
+
async listWorkspaces(
|
|
210
|
+
this: ILoadOptionsFunctions,
|
|
211
|
+
): Promise<INodePropertyOptions[]> {
|
|
212
|
+
const returnData: INodePropertyOptions[] = [];
|
|
213
|
+
|
|
214
|
+
const workspaces: Workspace[] = await clockifyApiRequest.call(
|
|
215
|
+
this,
|
|
216
|
+
'GET',
|
|
217
|
+
'workspaces',
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
for (const workspace of workspaces) {
|
|
221
|
+
if (workspace.name === undefined || workspace.id === undefined) {
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
returnData.push({
|
|
226
|
+
name: workspace.name,
|
|
227
|
+
value: workspace.id,
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return returnData;
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
webhookMethods = {
|
|
237
|
+
default: {
|
|
238
|
+
async checkExists(this: IHookFunctions): Promise<boolean> {
|
|
239
|
+
const workspaceId = this.getNodeParameter('workspaceId');
|
|
240
|
+
|
|
241
|
+
const responseData: Webhooks = await clockifyApiRequest.call(
|
|
242
|
+
this,
|
|
243
|
+
'GET',
|
|
244
|
+
`workspaces/${workspaceId}/webhooks`,
|
|
245
|
+
);
|
|
246
|
+
|
|
247
|
+
if (responseData.webhooks === undefined) {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const webhookUrl = this.getNodeWebhookUrl('default');
|
|
252
|
+
const webhookData: StaticData = this.getWorkflowStaticData('node');
|
|
253
|
+
|
|
254
|
+
for (const webhook of responseData.webhooks) {
|
|
255
|
+
if (webhook.url === webhookUrl) {
|
|
256
|
+
webhookData.webhookAuthToken = webhook.authToken;
|
|
257
|
+
webhookData.webhookId = webhook.id;
|
|
258
|
+
return true;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return false;
|
|
263
|
+
},
|
|
264
|
+
async create(this: IHookFunctions): Promise<boolean> {
|
|
265
|
+
const workspaceId = this.getNodeParameter('workspaceId');
|
|
266
|
+
const name = this.getNodeParameter('name') as string;
|
|
267
|
+
const webhookUrl = this.getNodeWebhookUrl('default') as string;
|
|
268
|
+
const webhookEvent = this.getNodeParameter(
|
|
269
|
+
'webhookEvent',
|
|
270
|
+
) as WebhookEvent;
|
|
271
|
+
|
|
272
|
+
const body: WebhookCreate = {
|
|
273
|
+
name,
|
|
274
|
+
triggerSource: [],
|
|
275
|
+
triggerSourceType: 'WORKSPACE_ID',
|
|
276
|
+
url: webhookUrl,
|
|
277
|
+
webhookEvent,
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
const responseData: Webhook = await clockifyApiRequest.call(
|
|
281
|
+
this,
|
|
282
|
+
'POST',
|
|
283
|
+
`workspaces/${workspaceId}/webhooks`,
|
|
284
|
+
body,
|
|
285
|
+
);
|
|
286
|
+
|
|
287
|
+
if (
|
|
288
|
+
responseData.authToken === undefined ||
|
|
289
|
+
responseData.id === undefined
|
|
290
|
+
) {
|
|
291
|
+
return false;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const webhookData: StaticData = this.getWorkflowStaticData('node');
|
|
295
|
+
|
|
296
|
+
webhookData.webhookAuthToken = responseData.authToken;
|
|
297
|
+
webhookData.webhookId = responseData.id;
|
|
298
|
+
|
|
299
|
+
return true;
|
|
300
|
+
},
|
|
301
|
+
async delete(this: IHookFunctions): Promise<boolean> {
|
|
302
|
+
const webhookData: StaticData = this.getWorkflowStaticData('node');
|
|
303
|
+
|
|
304
|
+
if (webhookData.webhookId === undefined) {
|
|
305
|
+
return true;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
const workspaceId = this.getNodeParameter('workspaceId');
|
|
309
|
+
|
|
310
|
+
try {
|
|
311
|
+
await clockifyApiRequest.call(
|
|
312
|
+
this,
|
|
313
|
+
'DELETE',
|
|
314
|
+
`workspaces/${workspaceId}/webhooks/${webhookData.webhookId}`,
|
|
315
|
+
);
|
|
316
|
+
} catch (error) {
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
delete webhookData.webhookAuthToken;
|
|
321
|
+
delete webhookData.webhookId;
|
|
322
|
+
|
|
323
|
+
return true;
|
|
324
|
+
},
|
|
325
|
+
},
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
|
|
329
|
+
const headerData = this.getHeaderData();
|
|
330
|
+
|
|
331
|
+
if (
|
|
332
|
+
headerData['clockify-signature'] === undefined ||
|
|
333
|
+
headerData['clockify-webhook-event-type'] === undefined
|
|
334
|
+
) {
|
|
335
|
+
return {};
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
const webhookData: StaticData = this.getWorkflowStaticData('node');
|
|
339
|
+
|
|
340
|
+
if (headerData['clockify-signature'] !== webhookData.webhookAuthToken) {
|
|
341
|
+
return {};
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
const webhookEvent = this.getNodeParameter('webhookEvent');
|
|
345
|
+
|
|
346
|
+
if (headerData['clockify-webhook-event-type'] !== webhookEvent) {
|
|
347
|
+
return {};
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
const req = this.getRequestObject();
|
|
351
|
+
|
|
352
|
+
return {
|
|
353
|
+
workflowData: [this.helpers.returnJsonArray(req.body)],
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { INodeProperties } from 'n8n-workflow';
|
|
2
|
+
|
|
3
|
+
export const projectOperations: INodeProperties[] = [
|
|
4
|
+
{
|
|
5
|
+
displayName: 'Operation',
|
|
6
|
+
name: 'operation',
|
|
7
|
+
type: 'options',
|
|
8
|
+
noDataExpression: true,
|
|
9
|
+
displayOptions: {
|
|
10
|
+
show: {
|
|
11
|
+
resource: ['project'],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
options: [
|
|
15
|
+
{
|
|
16
|
+
name: 'Update',
|
|
17
|
+
value: 'update',
|
|
18
|
+
description: 'Update a project',
|
|
19
|
+
action: 'Update a project',
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
default: 'update',
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
export const projectFields: INodeProperties[] = [
|
|
27
|
+
/* -------------------------------------------------------------------------- */
|
|
28
|
+
/* project:update */
|
|
29
|
+
/* -------------------------------------------------------------------------- */
|
|
30
|
+
{
|
|
31
|
+
displayName: 'Project Name or ID',
|
|
32
|
+
name: 'projectId',
|
|
33
|
+
type: 'options',
|
|
34
|
+
description:
|
|
35
|
+
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
|
36
|
+
typeOptions: {
|
|
37
|
+
loadOptionsDependsOn: ['workspaceId'],
|
|
38
|
+
loadOptionsMethod: 'loadProjects',
|
|
39
|
+
},
|
|
40
|
+
required: true,
|
|
41
|
+
default: '',
|
|
42
|
+
displayOptions: {
|
|
43
|
+
show: {
|
|
44
|
+
operation: ['update'],
|
|
45
|
+
resource: ['project'],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
displayName: 'Update Fields',
|
|
51
|
+
name: 'updateFields',
|
|
52
|
+
type: 'collection',
|
|
53
|
+
placeholder: 'Add Field',
|
|
54
|
+
displayOptions: {
|
|
55
|
+
show: {
|
|
56
|
+
operation: ['update'],
|
|
57
|
+
resource: ['project'],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
default: {},
|
|
61
|
+
options: [
|
|
62
|
+
{
|
|
63
|
+
displayName: 'Archived',
|
|
64
|
+
name: 'archived',
|
|
65
|
+
type: 'boolean',
|
|
66
|
+
default: false,
|
|
67
|
+
description: 'Whether project is archived or not',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
displayName: 'Billable',
|
|
71
|
+
name: 'billable',
|
|
72
|
+
type: 'boolean',
|
|
73
|
+
default: true,
|
|
74
|
+
description: 'Whether project is billable or not',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
displayName: 'Client Name or ID',
|
|
78
|
+
name: 'clientId',
|
|
79
|
+
type: 'options',
|
|
80
|
+
description:
|
|
81
|
+
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
|
82
|
+
typeOptions: {
|
|
83
|
+
loadOptionsDependsOn: ['workspaceId'],
|
|
84
|
+
loadOptionsMethod: 'loadClients',
|
|
85
|
+
},
|
|
86
|
+
default: '',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
displayName: 'Color',
|
|
90
|
+
name: 'color',
|
|
91
|
+
type: 'color',
|
|
92
|
+
default: '#0000FF',
|
|
93
|
+
description:
|
|
94
|
+
"Color format ^#(?:[0-9a-fA-F]{6}){1}$. Explanation: A valid color code should start with '#' and consist of six hexadecimal characters, representing a color in hexadecimal format. Color value is in standard RGB hexadecimal format",
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
displayName: 'Is Public',
|
|
98
|
+
name: 'isPublic',
|
|
99
|
+
type: 'boolean',
|
|
100
|
+
default: false,
|
|
101
|
+
description: 'Whether project is public or not',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
displayName: 'Name',
|
|
105
|
+
name: 'name',
|
|
106
|
+
type: 'string',
|
|
107
|
+
default: '',
|
|
108
|
+
description:
|
|
109
|
+
'Name of the project which must be at least 2 characters long and less than 250 characters',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
displayName: 'Note',
|
|
113
|
+
name: 'note',
|
|
114
|
+
type: 'string',
|
|
115
|
+
default: '',
|
|
116
|
+
description: 'Note about the project',
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
];
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { type INodeProperties } from 'n8n-workflow';
|
|
2
|
+
|
|
3
|
+
export const projectMembershipOperations: INodeProperties[] = [
|
|
4
|
+
{
|
|
5
|
+
displayName: 'Operation',
|
|
6
|
+
name: 'operation',
|
|
7
|
+
type: 'options',
|
|
8
|
+
noDataExpression: true,
|
|
9
|
+
displayOptions: {
|
|
10
|
+
show: {
|
|
11
|
+
resource: ['project membership'],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
options: [
|
|
15
|
+
{
|
|
16
|
+
name: 'Patch',
|
|
17
|
+
value: 'patch',
|
|
18
|
+
description: 'Patch the project membership',
|
|
19
|
+
action: 'Patch the project membership',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'Assign',
|
|
23
|
+
value: 'assign',
|
|
24
|
+
description: 'Assign users to a project',
|
|
25
|
+
action: 'Assign users to a project',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'Remove',
|
|
29
|
+
value: 'remove',
|
|
30
|
+
description: 'Remove users from a project',
|
|
31
|
+
action: 'Remove users from a project',
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
default: 'patch',
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
export const projectMembershipFields: INodeProperties[] = [
|
|
39
|
+
/* -------------------------------------------------------------------------- */
|
|
40
|
+
/* projectmembership:update */
|
|
41
|
+
/* -------------------------------------------------------------------------- */
|
|
42
|
+
{
|
|
43
|
+
displayName: 'Project Name or ID',
|
|
44
|
+
name: 'projectId',
|
|
45
|
+
type: 'options',
|
|
46
|
+
typeOptions: {
|
|
47
|
+
loadOptionsDependsOn: ['workspaceId'],
|
|
48
|
+
loadOptionsMethod: 'loadProjects',
|
|
49
|
+
},
|
|
50
|
+
default: '',
|
|
51
|
+
description:
|
|
52
|
+
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
|
53
|
+
displayOptions: {
|
|
54
|
+
show: {
|
|
55
|
+
operation: ['patch', 'assign', 'remove'],
|
|
56
|
+
resource: ['project membership'],
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
required: true,
|
|
60
|
+
requiresDataPath: 'single',
|
|
61
|
+
validateType: 'string',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
displayName: 'User Names or IDs',
|
|
65
|
+
name: 'memberships',
|
|
66
|
+
type: 'multiOptions',
|
|
67
|
+
typeOptions: {
|
|
68
|
+
loadOptionsDependsOn: ['workspaceId'],
|
|
69
|
+
loadOptionsMethod: 'loadUsers',
|
|
70
|
+
},
|
|
71
|
+
default: [],
|
|
72
|
+
description:
|
|
73
|
+
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
|
74
|
+
displayOptions: {
|
|
75
|
+
show: {
|
|
76
|
+
operation: ['patch'],
|
|
77
|
+
resource: ['project membership'],
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
requiresDataPath: 'multiple',
|
|
81
|
+
validateType: 'array',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
displayName: 'User Names or IDs',
|
|
85
|
+
name: 'userIdsToAssign',
|
|
86
|
+
type: 'multiOptions',
|
|
87
|
+
typeOptions: {
|
|
88
|
+
loadOptionsDependsOn: ['workspaceId', 'projectId'],
|
|
89
|
+
loadOptionsMethod: 'loadNonProjectUsers',
|
|
90
|
+
},
|
|
91
|
+
default: [],
|
|
92
|
+
description:
|
|
93
|
+
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
|
94
|
+
displayOptions: {
|
|
95
|
+
show: {
|
|
96
|
+
operation: ['assign'],
|
|
97
|
+
resource: ['project membership'],
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
required: true,
|
|
101
|
+
requiresDataPath: 'multiple',
|
|
102
|
+
validateType: 'array',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
displayName: 'User Names or IDs',
|
|
106
|
+
name: 'userIdsToRemove',
|
|
107
|
+
type: 'multiOptions',
|
|
108
|
+
typeOptions: {
|
|
109
|
+
loadOptionsDependsOn: ['workspaceId', 'projectId'],
|
|
110
|
+
loadOptionsMethod: 'loadProjectUsers',
|
|
111
|
+
},
|
|
112
|
+
default: [],
|
|
113
|
+
description:
|
|
114
|
+
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
|
115
|
+
displayOptions: {
|
|
116
|
+
show: {
|
|
117
|
+
operation: ['remove'],
|
|
118
|
+
resource: ['project membership'],
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
required: true,
|
|
122
|
+
requiresDataPath: 'multiple',
|
|
123
|
+
validateType: 'array',
|
|
124
|
+
},
|
|
125
|
+
];
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"forceConsistentCasingInFileNames": true,
|
|
6
|
+
"noImplicitOverride": true,
|
|
7
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
8
|
+
"noImplicitReturns": true,
|
|
9
|
+
"noFallthroughCasesInSwitch": true,
|
|
10
|
+
"strictBindCallApply": false,
|
|
11
|
+
"strictFunctionTypes": true,
|
|
12
|
+
"strictNullChecks": true,
|
|
13
|
+
"strictPropertyInitialization": true,
|
|
14
|
+
"noImplicitAny": true,
|
|
15
|
+
"noImplicitThis": true,
|
|
16
|
+
"useUnknownInCatchVariables": true
|
|
17
|
+
},
|
|
18
|
+
"files": [],
|
|
19
|
+
"include": [],
|
|
20
|
+
"references": [
|
|
21
|
+
{
|
|
22
|
+
"path": "./tsconfig.lib.json"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"path": "./tsconfig.spec.json"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type IExecuteFunctions, type ILoadOptionsFunctions, type INodeExecutionData, type INodePropertyOptions, type INodeType, type INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
-
export declare class ClockifyEnhanced implements INodeType {
|
|
3
|
-
description: INodeTypeDescription;
|
|
4
|
-
methods: {
|
|
5
|
-
loadOptions: {
|
|
6
|
-
loadWorkspaces(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
7
|
-
loadClients(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
8
|
-
loadProjects(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
9
|
-
loadUsers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
10
|
-
loadNonProjectUsers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
11
|
-
loadProjectUsers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
15
|
-
}
|