@warleon/n8n-nodes-payload-cms 1.5.0 → 1.5.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.
@@ -19,7 +19,6 @@ export declare class PayloadCms implements INodeType {
19
19
  getCollections(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
20
20
  getGlobals(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
21
21
  getEndpoints(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
22
- getPayloadFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
23
22
  };
24
23
  };
25
24
  discoverCollections(this: ILoadOptionsFunctions): Promise<SanitizedCollectionConfig[]>;
@@ -41,7 +41,6 @@ const n8n_workflow_1 = require("n8n-workflow");
41
41
  const axios_1 = __importStar(require("axios"));
42
42
  const form_data_1 = __importDefault(require("form-data"));
43
43
  const qs_esm_1 = require("qs-esm");
44
- const utils_1 = require("./utils");
45
44
  class PayloadCms {
46
45
  static collectionsCache = new Map();
47
46
  static globalsCache = new Map();
@@ -428,33 +427,6 @@ class PayloadCms {
428
427
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to load endpoints: ${error instanceof Error ? error.message : "Unknown error"}`);
429
428
  }
430
429
  },
431
- async getPayloadFields() {
432
- const resource = this.getCurrentNodeParameter("resource");
433
- switch (resource) {
434
- case "collection":
435
- const collectionSlug = this.getCurrentNodeParameter("collection");
436
- const collection = PayloadCms.collectionsCache
437
- .get(this.getInstanceId())
438
- ?.find((c) => c.slug === collectionSlug);
439
- if (!collection) {
440
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to load fields for collection ${collectionSlug}: collection not found`);
441
- }
442
- return collection.fields.flatMap((f) => (0, utils_1.payloadField2N8nOption)(f));
443
- break;
444
- case "global":
445
- const globalSlug = this.getCurrentNodeParameter("collection");
446
- const global = PayloadCms.globalsCache
447
- .get(this.getInstanceId())
448
- ?.find((g) => g.slug === globalSlug);
449
- if (!global) {
450
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to load fields for global ${globalSlug}: global not found`);
451
- }
452
- return global.fields.flatMap((f) => (0, utils_1.payloadField2N8nOption)(f));
453
- break;
454
- default:
455
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to load fields for resource ${resource}: resource not supported`);
456
- }
457
- },
458
430
  },
459
431
  };
460
432
  async discoverCollections() {
@@ -638,7 +610,8 @@ class PayloadCms {
638
610
  const endpoint = this.getNodeParameter("endpoint", i);
639
611
  url = `${baseUrl}${apiPrefix}${endpoint}`;
640
612
  method = operation.toUpperCase();
641
- data = this.getNodeParameter("data", i);
613
+ if (method !== "GET")
614
+ data = this.getNodeParameter("data", i);
642
615
  }
643
616
  let requestConfig = {};
644
617
  // handle binary inputs
@@ -662,7 +635,7 @@ class PayloadCms {
662
635
  const sanitizeData = { ...metadata, ...data };
663
636
  formData.append("_payload", JSON.stringify(sanitizeData));
664
637
  requestConfig = {
665
- method: method,
638
+ method,
666
639
  maxBodyLength: Infinity,
667
640
  url,
668
641
  params,
@@ -675,7 +648,7 @@ class PayloadCms {
675
648
  }
676
649
  else {
677
650
  requestConfig = {
678
- method: method,
651
+ method,
679
652
  url,
680
653
  params,
681
654
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warleon/n8n-nodes-payload-cms",
3
- "version": "1.5.0",
3
+ "version": "1.5.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",