@warleon/n8n-nodes-payload-cms 1.3.8 → 1.4.0
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.
|
@@ -378,9 +378,9 @@ class PayloadCms {
|
|
|
378
378
|
//console.log("In Authenticated Request auth token:", authToken);
|
|
379
379
|
// Add authorization header
|
|
380
380
|
config.headers = {
|
|
381
|
-
...config.headers,
|
|
382
381
|
Authorization: authToken,
|
|
383
382
|
"Content-Type": "application/json",
|
|
383
|
+
...config.headers,
|
|
384
384
|
};
|
|
385
385
|
config.validateStatus = (status) => {
|
|
386
386
|
return status < 500;
|
|
@@ -490,29 +490,9 @@ class PayloadCms {
|
|
|
490
490
|
let requestConfig = {};
|
|
491
491
|
// handle binary inputs
|
|
492
492
|
const binaryPropertyName = additionalOptions.upload;
|
|
493
|
-
returnData.push({
|
|
494
|
-
json: {
|
|
495
|
-
debug: `upload name: ${binaryPropertyName}`,
|
|
496
|
-
},
|
|
497
|
-
});
|
|
498
493
|
if (binaryPropertyName) {
|
|
499
|
-
returnData.push({
|
|
500
|
-
json: {
|
|
501
|
-
debug: "entered file data, form-data path",
|
|
502
|
-
},
|
|
503
|
-
});
|
|
504
494
|
const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
|
|
505
|
-
returnData.push({
|
|
506
|
-
json: {
|
|
507
|
-
debug: `binarydata type: ${binaryData.mimeType}`,
|
|
508
|
-
},
|
|
509
|
-
});
|
|
510
495
|
const fileBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
|
|
511
|
-
returnData.push({
|
|
512
|
-
json: {
|
|
513
|
-
debug: `fileBuffer size: ${fileBuffer.length}`,
|
|
514
|
-
},
|
|
515
|
-
});
|
|
516
496
|
const fileName = binaryData.fileName;
|
|
517
497
|
const mimeType = binaryData.mimeType;
|
|
518
498
|
const formData = new form_data_1.default();
|
|
@@ -520,19 +500,9 @@ class PayloadCms {
|
|
|
520
500
|
filename: fileName,
|
|
521
501
|
contentType: mimeType,
|
|
522
502
|
});
|
|
523
|
-
returnData.push({
|
|
524
|
-
json: {
|
|
525
|
-
debug: `formData append file: ${fileName}`,
|
|
526
|
-
},
|
|
527
|
-
});
|
|
528
503
|
if (data) {
|
|
529
504
|
const sanitizeData = typeof data === "string" ? JSON.parse(data) : data;
|
|
530
505
|
formData.append("_payload", JSON.stringify(sanitizeData));
|
|
531
|
-
returnData.push({
|
|
532
|
-
json: {
|
|
533
|
-
debug: `formData append data: ${data}`,
|
|
534
|
-
},
|
|
535
|
-
});
|
|
536
506
|
}
|
|
537
507
|
requestConfig = {
|
|
538
508
|
method: method,
|
|
@@ -542,15 +512,11 @@ class PayloadCms {
|
|
|
542
512
|
data: formData,
|
|
543
513
|
headers: {
|
|
544
514
|
...formData.getHeaders(),
|
|
515
|
+
"Content-Type": "multipart/form-data",
|
|
545
516
|
},
|
|
546
517
|
};
|
|
547
518
|
}
|
|
548
519
|
else {
|
|
549
|
-
returnData.push({
|
|
550
|
-
json: {
|
|
551
|
-
debug: "entered normal data, json data path",
|
|
552
|
-
},
|
|
553
|
-
});
|
|
554
520
|
requestConfig = {
|
|
555
521
|
method: method,
|
|
556
522
|
url,
|
|
@@ -561,14 +527,6 @@ class PayloadCms {
|
|
|
561
527
|
typeof data === "string" ? JSON.parse(data) : data;
|
|
562
528
|
}
|
|
563
529
|
}
|
|
564
|
-
returnData.push({
|
|
565
|
-
json: {
|
|
566
|
-
debug: {
|
|
567
|
-
msg: "AXIOS CONFIG",
|
|
568
|
-
requestConfig,
|
|
569
|
-
},
|
|
570
|
-
},
|
|
571
|
-
});
|
|
572
530
|
const response = await PayloadCms.prototype.makeAuthenticatedRequest.call(this, requestConfig);
|
|
573
531
|
returnData.push({
|
|
574
532
|
json: response.data,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warleon/n8n-nodes-payload-cms",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
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",
|