@warleon/n8n-nodes-payload-cms 1.4.0 → 1.4.1

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.
@@ -390,6 +390,12 @@ class PayloadCms {
390
390
  async execute() {
391
391
  const items = this.getInputData();
392
392
  const returnData = [];
393
+ const executionId = this.getExecutionId();
394
+ const metadata = {
395
+ __n8n_nodes_payload_cms__: {
396
+ executionId,
397
+ },
398
+ };
393
399
  for (let i = 0; i < items.length; i++) {
394
400
  try {
395
401
  const resource = this.getNodeParameter("resource", i);
@@ -501,9 +507,13 @@ class PayloadCms {
501
507
  contentType: mimeType,
502
508
  });
503
509
  if (data) {
504
- const sanitizeData = typeof data === "string" ? JSON.parse(data) : data;
505
- formData.append("_payload", JSON.stringify(sanitizeData));
510
+ typeof data === "string" ? JSON.parse(data) : data;
506
511
  }
512
+ else {
513
+ data = {};
514
+ }
515
+ const sanitizeData = { ...data, ...metadata };
516
+ formData.append("_payload", JSON.stringify(sanitizeData));
507
517
  requestConfig = {
508
518
  method: method,
509
519
  maxBodyLength: Infinity,
@@ -523,9 +533,12 @@ class PayloadCms {
523
533
  params,
524
534
  };
525
535
  if (data) {
526
- requestConfig.data =
527
- typeof data === "string" ? JSON.parse(data) : data;
536
+ data = typeof data === "string" ? JSON.parse(data) : data;
537
+ }
538
+ else {
539
+ data = {};
528
540
  }
541
+ requestConfig.data = { ...data, ...metadata };
529
542
  }
530
543
  const response = await PayloadCms.prototype.makeAuthenticatedRequest.call(this, requestConfig);
531
544
  returnData.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warleon/n8n-nodes-payload-cms",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Dynamic n8n node for Payload CMS that auto-discovers collections and operations forked and extended from https://github.com/leadership-institute/n8n-payload-dynamic",
5
5
  "main": "dist/index.js",
6
6
  "author": "warleon",