@worktables/n8n-nodes-worktables-staging 1.0.16 → 1.0.18

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.
@@ -73,6 +73,7 @@ class Worktables {
73
73
  { name: 'Update', value: 'update', description: 'Operations related to updates' },
74
74
  { name: 'Team', value: 'team', description: 'Operations related to teams' },
75
75
  { name: 'User', value: 'user', description: 'Operations related to users' },
76
+ { name: 'Notification', value: 'notification', description: 'Send notifications to users' },
76
77
  {
77
78
  name: 'Download File',
78
79
  value: 'downloadFile',
@@ -418,6 +419,88 @@ class Worktables {
418
419
  show: { resource: ['user'] },
419
420
  },
420
421
  },
422
+ {
423
+ displayName: 'Operation',
424
+ name: 'operation',
425
+ type: 'options',
426
+ noDataExpression: true,
427
+ options: [
428
+ {
429
+ name: 'Send Notification',
430
+ value: 'sendNotification',
431
+ description: 'Send a notification to a user',
432
+ action: 'Send a notification',
433
+ },
434
+ ],
435
+ default: 'sendNotification',
436
+ required: true,
437
+ displayOptions: {
438
+ show: { resource: ['notification'] },
439
+ },
440
+ },
441
+ {
442
+ displayName: 'User ID',
443
+ name: 'notificationUserId',
444
+ type: 'string',
445
+ default: '',
446
+ required: true,
447
+ description: 'The ID of the user to send the notification to',
448
+ displayOptions: {
449
+ show: {
450
+ resource: ['notification'],
451
+ operation: ['sendNotification'],
452
+ },
453
+ },
454
+ },
455
+ {
456
+ displayName: 'Target ID',
457
+ name: 'notificationTargetId',
458
+ type: 'string',
459
+ default: '',
460
+ required: true,
461
+ description: 'The ID of the target item (e.g. item ID)',
462
+ displayOptions: {
463
+ show: {
464
+ resource: ['notification'],
465
+ operation: ['sendNotification'],
466
+ },
467
+ },
468
+ },
469
+ {
470
+ displayName: 'Target Type',
471
+ name: 'notificationTargetType',
472
+ type: 'options',
473
+ options: [
474
+ { name: 'Project', value: 'Project' },
475
+ { name: 'Post', value: 'Post' },
476
+ ],
477
+ default: 'Project',
478
+ required: true,
479
+ description: 'The type of the target',
480
+ displayOptions: {
481
+ show: {
482
+ resource: ['notification'],
483
+ operation: ['sendNotification'],
484
+ },
485
+ },
486
+ },
487
+ {
488
+ displayName: 'Message',
489
+ name: 'notificationMessage',
490
+ type: 'string',
491
+ typeOptions: {
492
+ rows: 4,
493
+ },
494
+ default: '',
495
+ required: true,
496
+ description: 'The notification text to send',
497
+ displayOptions: {
498
+ show: {
499
+ resource: ['notification'],
500
+ operation: ['sendNotification'],
501
+ },
502
+ },
503
+ },
421
504
  {
422
505
  displayName: 'Query',
423
506
  name: 'runQuery',
@@ -6602,8 +6685,8 @@ class Worktables {
6602
6685
  console.warn(`Item ${i}: Binary field '${binaryName}' not found. Skipping.`);
6603
6686
  continue;
6604
6687
  }
6605
- const fileBuffer = Buffer.from(binaryData.data, 'base64');
6606
- const fileName = (0, worktablesHelpers_1.formatFileName)(binaryData.fileName, binaryData.fileExtension, 'upload', 'dat');
6688
+ const fileBuffer = await this.helpers.getBinaryDataBuffer(i, binaryName);
6689
+ const fileName = (0, worktablesHelpers_1.formatFileName)(binaryData.fileName, binaryData.fileExtension);
6607
6690
  const form = new form_data_1.default();
6608
6691
  form.append('query', `mutation ($file: File!) {
6609
6692
  add_file_to_update (update_id: ${updateId}, file: $file) {
@@ -6611,7 +6694,7 @@ class Worktables {
6611
6694
  }
6612
6695
  }`);
6613
6696
  form.append('variables[file]', fileBuffer, {
6614
- filename: `${fileName}.${binaryData.fileExtension || 'txt'}`,
6697
+ filename: fileName,
6615
6698
  contentType: binaryData.mimeType || 'application/octet-stream',
6616
6699
  });
6617
6700
  const uploadResponse = await axios_1.default.post('https://api.monday.com/v2/file', form, {
@@ -6664,8 +6747,8 @@ class Worktables {
6664
6747
  console.warn(`Item ${i}: Binary field '${binaryName}' not found. Skipping.`);
6665
6748
  continue;
6666
6749
  }
6667
- const fileBuffer = Buffer.from(binaryData.data, 'base64');
6668
- const fileName = (0, worktablesHelpers_1.formatFileName)(binaryData.fileName, binaryData.fileExtension, 'upload', 'dat');
6750
+ const fileBuffer = await this.helpers.getBinaryDataBuffer(i, binaryName);
6751
+ const fileName = (0, worktablesHelpers_1.formatFileName)(binaryData.fileName, binaryData.fileExtension);
6669
6752
  const form = new form_data_1.default();
6670
6753
  form.append('query', `mutation ($file: File!) {
6671
6754
  add_file_to_update (update_id: ${updateId}, file: $file) {
@@ -6673,7 +6756,7 @@ class Worktables {
6673
6756
  }
6674
6757
  }`);
6675
6758
  form.append('variables[file]', fileBuffer, {
6676
- filename: `${fileName}.${binaryData.fileExtension || 'txt'}`,
6759
+ filename: fileName,
6677
6760
  contentType: binaryData.mimeType || 'application/octet-stream',
6678
6761
  });
6679
6762
  const uploadResponse = await axios_1.default.post('https://api.monday.com/v2/file', form, {
@@ -6772,7 +6855,7 @@ class Worktables {
6772
6855
  console.warn(`Item ${i}: Binary field '${binaryName}' not found. Skipping.`);
6773
6856
  continue;
6774
6857
  }
6775
- const fileBuffer = Buffer.from(binaryData.data, 'base64');
6858
+ const fileBuffer = await this.helpers.getBinaryDataBuffer(i, binaryName);
6776
6859
  const fileName = (0, worktablesHelpers_1.formatFileName)(binaryData.fileName, binaryData.fileExtension);
6777
6860
  console.log(`Item ${i} - Uploading file '${fileName}' from '${binaryName}'`);
6778
6861
  const form = new form_data_1.default();
@@ -7127,6 +7210,35 @@ class Worktables {
7127
7210
  }
7128
7211
  break;
7129
7212
  }
7213
+ case 'notification': {
7214
+ switch (operation) {
7215
+ case 'sendNotification': {
7216
+ const userId = this.getNodeParameter('notificationUserId', 0);
7217
+ const targetId = this.getNodeParameter('notificationTargetId', 0);
7218
+ const targetType = this.getNodeParameter('notificationTargetType', 0);
7219
+ const text = this.getNodeParameter('notificationMessage', 0);
7220
+ const mutation = `mutation ($userId: ID!, $targetId: ID!, $text: String!, $targetType: NotificationTargetType!) {
7221
+ create_notification(
7222
+ user_id: $userId,
7223
+ target_id: $targetId,
7224
+ text: $text,
7225
+ target_type: $targetType
7226
+ ) {
7227
+ text
7228
+ }
7229
+ }`;
7230
+ const variables = {
7231
+ userId,
7232
+ targetId,
7233
+ text,
7234
+ targetType,
7235
+ };
7236
+ response = await (0, worktablesHelpers_1.makeGraphQLRequest)(this, mutation, headers, variables);
7237
+ break;
7238
+ }
7239
+ }
7240
+ break;
7241
+ }
7130
7242
  default:
7131
7243
  throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: `Unsupported resource: ${resource}` });
7132
7244
  }