@adaptive-ds/n8n-nodes-publer 1.1.11 → 1.1.13
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/LICENSE +21 -0
- package/README.md +65 -50
- package/dist/credentials/PublerApi.credentials.d.ts +0 -1
- package/dist/credentials/PublerApi.credentials.js +0 -8
- package/dist/credentials/PublerApi.credentials.js.map +1 -1
- package/dist/nodes/PublerAccounts/PublerAccounts.node.d.ts +5 -0
- package/dist/nodes/PublerAccounts/PublerAccounts.node.js +121 -0
- package/dist/nodes/PublerAccounts/PublerAccounts.node.js.map +1 -0
- package/dist/nodes/PublerAccounts/PublerAccounts.spec.js +9 -0
- package/dist/nodes/PublerAccounts/PublerAccounts.spec.js.map +1 -0
- package/dist/nodes/PublerCompetitorAnalysis/PublerCompetitorAnalysis.node.d.ts +5 -0
- package/dist/nodes/PublerCompetitorAnalysis/PublerCompetitorAnalysis.node.js +219 -0
- package/dist/nodes/PublerCompetitorAnalysis/PublerCompetitorAnalysis.node.js.map +1 -0
- package/dist/nodes/PublerCompetitorAnalysis/PublerCompetitorAnalysis.spec.js +9 -0
- package/dist/nodes/PublerCompetitorAnalysis/PublerCompetitorAnalysis.spec.js.map +1 -0
- package/dist/nodes/PublerCompetitorList/PublerCompetitorList.node.d.ts +5 -0
- package/dist/nodes/PublerCompetitorList/PublerCompetitorList.node.js +131 -0
- package/dist/nodes/PublerCompetitorList/PublerCompetitorList.node.js.map +1 -0
- package/dist/nodes/PublerCompetitorList/PublerCompetitorList.spec.js +9 -0
- package/dist/nodes/PublerCompetitorList/PublerCompetitorList.spec.js.map +1 -0
- package/dist/nodes/PublerJobStatus/PublerJobStatus.node.d.ts +5 -0
- package/dist/nodes/PublerJobStatus/PublerJobStatus.node.js +131 -0
- package/dist/nodes/PublerJobStatus/PublerJobStatus.node.js.map +1 -0
- package/dist/nodes/PublerJobStatus/PublerJobStatus.spec.js +9 -0
- package/dist/nodes/PublerJobStatus/PublerJobStatus.spec.js.map +1 -0
- package/dist/nodes/PublerMe/PublerMe.node.js +30 -51
- package/dist/nodes/PublerMe/PublerMe.node.js.map +1 -1
- package/dist/nodes/PublerMe/PublerMe.spec.js +3 -2
- package/dist/nodes/PublerMe/PublerMe.spec.js.map +1 -1
- package/dist/nodes/PublerMediaImportFromUrl/PublerMediaImportFromUrl.node.d.ts +5 -0
- package/dist/nodes/PublerMediaImportFromUrl/PublerMediaImportFromUrl.node.js +194 -0
- package/dist/nodes/PublerMediaImportFromUrl/PublerMediaImportFromUrl.node.js.map +1 -0
- package/dist/nodes/PublerMediaImportFromUrl/PublerMediaImportFromUrl.spec.js +9 -0
- package/dist/nodes/PublerMediaImportFromUrl/PublerMediaImportFromUrl.spec.js.map +1 -0
- package/dist/nodes/PublerPostSchedule/PublerPostSchedule.node.d.ts +5 -0
- package/dist/nodes/PublerPostSchedule/PublerPostSchedule.node.js +259 -0
- package/dist/nodes/PublerPostSchedule/PublerPostSchedule.node.js.map +1 -0
- package/dist/nodes/PublerPostSchedule/PublerPostSchedule.spec.js +9 -0
- package/dist/nodes/PublerPostSchedule/PublerPostSchedule.spec.js.map +1 -0
- package/dist/nodes/PublerPostScheduleText/PublerPostScheduleText.node.d.ts +5 -0
- package/dist/nodes/PublerPostScheduleText/PublerPostScheduleText.node.js +176 -0
- package/dist/nodes/PublerPostScheduleText/PublerPostScheduleText.node.js.map +1 -0
- package/dist/nodes/PublerPostScheduleText/PublerPostScheduleText.spec.js +9 -0
- package/dist/nodes/PublerPostScheduleText/PublerPostScheduleText.spec.js.map +1 -0
- package/dist/nodes/PublerWorkspaceList/PublerWorkspaceList.node.d.ts +5 -0
- package/dist/nodes/PublerWorkspaceList/PublerWorkspaceList.node.js +99 -0
- package/dist/nodes/PublerWorkspaceList/PublerWorkspaceList.node.js.map +1 -0
- package/dist/nodes/PublerWorkspaceList/PublerWorkspaceList.spec.js +9 -0
- package/dist/nodes/PublerWorkspaceList/PublerWorkspaceList.spec.js.map +1 -0
- package/dist/package.json +38 -55
- package/package.json +38 -55
- package/dist/nodes/PublerAnalytics/PublerAnalytics.node.d.ts +0 -4
- package/dist/nodes/PublerAnalytics/PublerAnalytics.node.js +0 -75
- package/dist/nodes/PublerAnalytics/PublerAnalytics.node.js.map +0 -1
- package/dist/nodes/PublerAnalytics/PublerAnalytics.spec.js +0 -8
- package/dist/nodes/PublerAnalytics/PublerAnalytics.spec.js.map +0 -1
- package/dist/nodes/PublerAnalytics/logo.svg +0 -44
- package/dist/nodes/PublerAnalytics/openapi.json +0 -777
- package/dist/nodes/PublerBasic/PublerBasic.node.d.ts +0 -4
- package/dist/nodes/PublerBasic/PublerBasic.node.js +0 -75
- package/dist/nodes/PublerBasic/PublerBasic.node.js.map +0 -1
- package/dist/nodes/PublerBasic/PublerBasic.spec.js +0 -8
- package/dist/nodes/PublerBasic/PublerBasic.spec.js.map +0 -1
- package/dist/nodes/PublerBasic/logo.svg +0 -44
- package/dist/nodes/PublerBasic/openapi.json +0 -507
- package/dist/nodes/PublerCompetitors/PublerCompetitors.node.d.ts +0 -4
- package/dist/nodes/PublerCompetitors/PublerCompetitors.node.js +0 -75
- package/dist/nodes/PublerCompetitors/PublerCompetitors.node.js.map +0 -1
- package/dist/nodes/PublerCompetitors/PublerCompetitors.spec.js +0 -8
- package/dist/nodes/PublerCompetitors/PublerCompetitors.spec.js.map +0 -1
- package/dist/nodes/PublerCompetitors/logo.svg +0 -44
- package/dist/nodes/PublerCompetitors/openapi.json +0 -264
- package/dist/nodes/PublerLocations/PublerLocations.node.d.ts +0 -4
- package/dist/nodes/PublerLocations/PublerLocations.node.js +0 -75
- package/dist/nodes/PublerLocations/PublerLocations.node.js.map +0 -1
- package/dist/nodes/PublerLocations/PublerLocations.spec.js +0 -8
- package/dist/nodes/PublerLocations/PublerLocations.spec.js.map +0 -1
- package/dist/nodes/PublerLocations/logo.svg +0 -44
- package/dist/nodes/PublerLocations/openapi.json +0 -205
- package/dist/nodes/PublerMe/logo.svg +0 -44
- package/dist/nodes/PublerMedia/PublerMedia.node.d.ts +0 -4
- package/dist/nodes/PublerMedia/PublerMedia.node.js +0 -75
- package/dist/nodes/PublerMedia/PublerMedia.node.js.map +0 -1
- package/dist/nodes/PublerMedia/PublerMedia.spec.js +0 -8
- package/dist/nodes/PublerMedia/PublerMedia.spec.js.map +0 -1
- package/dist/nodes/PublerMedia/logo.svg +0 -44
- package/dist/nodes/PublerMedia/openapi.json +0 -346
- package/dist/nodes/PublerPosts/PublerPosts.node.d.ts +0 -4
- package/dist/nodes/PublerPosts/PublerPosts.node.js +0 -75
- package/dist/nodes/PublerPosts/PublerPosts.node.js.map +0 -1
- package/dist/nodes/PublerPosts/PublerPosts.spec.js +0 -8
- package/dist/nodes/PublerPosts/PublerPosts.spec.js.map +0 -1
- package/dist/nodes/PublerPosts/logo.svg +0 -44
- package/dist/nodes/PublerPosts/openapi.json +0 -536
- package/dist/nodes/PublerPostsPublish/PublerPostsPublish.node.d.ts +0 -4
- package/dist/nodes/PublerPostsPublish/PublerPostsPublish.node.js +0 -75
- package/dist/nodes/PublerPostsPublish/PublerPostsPublish.node.js.map +0 -1
- package/dist/nodes/PublerPostsPublish/PublerPostsPublish.spec.js +0 -8
- package/dist/nodes/PublerPostsPublish/PublerPostsPublish.spec.js.map +0 -1
- package/dist/nodes/PublerPostsPublish/logo.svg +0 -44
- package/dist/nodes/PublerPostsPublish/openapi.json +0 -229
- package/dist/nodes/PublerPostsSchedule/PublerPostsSchedule.node.d.ts +0 -4
- package/dist/nodes/PublerPostsSchedule/PublerPostsSchedule.node.js +0 -75
- package/dist/nodes/PublerPostsSchedule/PublerPostsSchedule.node.js.map +0 -1
- package/dist/nodes/PublerPostsSchedule/PublerPostsSchedule.spec.js +0 -8
- package/dist/nodes/PublerPostsSchedule/PublerPostsSchedule.spec.js.map +0 -1
- package/dist/nodes/PublerPostsSchedule/logo.svg +0 -44
- package/dist/nodes/PublerPostsSchedule/openapi.json +0 -235
- /package/dist/nodes/{PublerAnalytics/PublerAnalytics.spec.d.ts → PublerAccounts/PublerAccounts.spec.d.ts} +0 -0
- /package/dist/nodes/{PublerBasic/PublerBasic.spec.d.ts → PublerCompetitorAnalysis/PublerCompetitorAnalysis.spec.d.ts} +0 -0
- /package/dist/nodes/{PublerCompetitors/PublerCompetitors.spec.d.ts → PublerCompetitorList/PublerCompetitorList.spec.d.ts} +0 -0
- /package/dist/nodes/{PublerLocations/PublerLocations.spec.d.ts → PublerJobStatus/PublerJobStatus.spec.d.ts} +0 -0
- /package/dist/nodes/{PublerMedia/PublerMedia.spec.d.ts → PublerMediaImportFromUrl/PublerMediaImportFromUrl.spec.d.ts} +0 -0
- /package/dist/nodes/{PublerPosts/PublerPosts.spec.d.ts → PublerPostSchedule/PublerPostSchedule.spec.d.ts} +0 -0
- /package/dist/nodes/{PublerPostsPublish/PublerPostsPublish.spec.d.ts → PublerPostScheduleText/PublerPostScheduleText.spec.d.ts} +0 -0
- /package/dist/nodes/{PublerPostsSchedule/PublerPostsSchedule.spec.d.ts → PublerWorkspaceList/PublerWorkspaceList.spec.d.ts} +0 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PublerCompetitorList = void 0;
|
|
4
|
+
class PublerCompetitorList {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.description = {
|
|
7
|
+
displayName: "Publer Competitor List",
|
|
8
|
+
name: "publerCompetitorList",
|
|
9
|
+
icon: "file:logo.svg",
|
|
10
|
+
group: ["input"],
|
|
11
|
+
version: 1,
|
|
12
|
+
description: "List competitor accounts for a social media account",
|
|
13
|
+
defaults: {
|
|
14
|
+
name: "Publer Competitor List",
|
|
15
|
+
},
|
|
16
|
+
inputs: ["main"],
|
|
17
|
+
outputs: ["main"],
|
|
18
|
+
credentials: [
|
|
19
|
+
{
|
|
20
|
+
name: "publerApi",
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
properties: [
|
|
25
|
+
{
|
|
26
|
+
displayName: "Account ID",
|
|
27
|
+
name: "accountId",
|
|
28
|
+
type: "string",
|
|
29
|
+
default: "",
|
|
30
|
+
required: true,
|
|
31
|
+
description: "The social media account ID to list competitors for",
|
|
32
|
+
placeholder: "647a0edddb2797b89044e2c1",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
displayName: "Workspace ID",
|
|
36
|
+
name: "workspaceId",
|
|
37
|
+
type: "string",
|
|
38
|
+
default: "",
|
|
39
|
+
required: true,
|
|
40
|
+
description: "The workspace ID that contains the account",
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
async execute() {
|
|
46
|
+
const items = this.getInputData();
|
|
47
|
+
const returnData = [];
|
|
48
|
+
const credentials = await this.getCredentials("publerApi");
|
|
49
|
+
const apiToken = credentials.apiToken;
|
|
50
|
+
if (!apiToken) {
|
|
51
|
+
this.logger.error("API Token is missing", {
|
|
52
|
+
credentialName: "publerApi",
|
|
53
|
+
});
|
|
54
|
+
throw new Error("API Token is required");
|
|
55
|
+
}
|
|
56
|
+
this.logger.debug("Credentials retrieved", {
|
|
57
|
+
hasApiToken: !!apiToken,
|
|
58
|
+
itemCount: items.length,
|
|
59
|
+
});
|
|
60
|
+
const workspaceId = this.getNodeParameter("workspaceId", 0);
|
|
61
|
+
if (!workspaceId) {
|
|
62
|
+
this.logger.error("Workspace ID is missing", {
|
|
63
|
+
nodeName: this.getNode().name,
|
|
64
|
+
});
|
|
65
|
+
throw new Error("Workspace ID is required for this operation");
|
|
66
|
+
}
|
|
67
|
+
this.logger.debug("Node parameters retrieved", {
|
|
68
|
+
hasWorkspaceId: !!workspaceId,
|
|
69
|
+
});
|
|
70
|
+
this.logger.info("Starting execution", { itemCount: items.length });
|
|
71
|
+
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
|
72
|
+
try {
|
|
73
|
+
const accountId = this.getNodeParameter("accountId", itemIndex);
|
|
74
|
+
const endpoint = `https://app.publer.com/api/v1/competitors/${accountId}`;
|
|
75
|
+
this.logger.info("Making API request", {
|
|
76
|
+
itemIndex,
|
|
77
|
+
endpoint,
|
|
78
|
+
method: "GET",
|
|
79
|
+
accountId,
|
|
80
|
+
workspaceId: workspaceId,
|
|
81
|
+
});
|
|
82
|
+
const response = await this.helpers.requestWithAuthentication.call(this, "publerApi", {
|
|
83
|
+
method: "GET",
|
|
84
|
+
url: endpoint,
|
|
85
|
+
headers: {
|
|
86
|
+
Authorization: `Bearer-API ${apiToken}`,
|
|
87
|
+
Accept: "application/json",
|
|
88
|
+
"Publer-Workspace-Id": workspaceId,
|
|
89
|
+
},
|
|
90
|
+
json: true,
|
|
91
|
+
});
|
|
92
|
+
this.logger.info("API request successful", {
|
|
93
|
+
itemIndex,
|
|
94
|
+
endpoint,
|
|
95
|
+
responseType: typeof response,
|
|
96
|
+
});
|
|
97
|
+
this.logger.debug("Response data", {
|
|
98
|
+
itemIndex,
|
|
99
|
+
responseKeys: response ? Object.keys(response) : [],
|
|
100
|
+
});
|
|
101
|
+
returnData.push({
|
|
102
|
+
json: response,
|
|
103
|
+
pairedItem: { item: itemIndex },
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
this.logger.error("API request failed", {
|
|
108
|
+
itemIndex,
|
|
109
|
+
error: error.message,
|
|
110
|
+
stack: error.stack,
|
|
111
|
+
});
|
|
112
|
+
if (this.continueOnFail()) {
|
|
113
|
+
this.logger.warn("Continuing on fail", { itemIndex });
|
|
114
|
+
returnData.push({
|
|
115
|
+
json: { error: error.message },
|
|
116
|
+
pairedItem: { item: itemIndex },
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
throw error;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
this.logger.info("Execution completed", {
|
|
125
|
+
processedItems: returnData.length,
|
|
126
|
+
});
|
|
127
|
+
return [returnData];
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.PublerCompetitorList = PublerCompetitorList;
|
|
131
|
+
//# sourceMappingURL=PublerCompetitorList.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PublerCompetitorList.node.js","sourceRoot":"","sources":["../../../nodes/PublerCompetitorList/PublerCompetitorList.node.ts"],"names":[],"mappings":";;;AAEA,MAAa,oBAAoB;IAAjC;QACE,gBAAW,GAAyB;YAClC,WAAW,EAAE,wBAAwB;YACrC,IAAI,EAAE,sBAAsB;YAC5B,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,CAAC,OAAO,CAAC;YAChB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,qDAAqD;YAClE,QAAQ,EAAE;gBACR,IAAI,EAAE,wBAAwB;aAC/B;YACD,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE;gBACX;oBACE,IAAI,EAAE,WAAW;oBACjB,QAAQ,EAAE,IAAI;iBACf;aACF;YACD,UAAU,EAAE;gBACV;oBACE,WAAW,EAAE,YAAY;oBACzB,IAAI,EAAE,WAAW;oBACjB,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,EAAE;oBACX,QAAQ,EAAE,IAAI;oBACd,WAAW,EAAE,qDAAqD;oBAClE,WAAW,EAAE,0BAA0B;iBACxC;gBACD;oBACE,WAAW,EAAE,cAAc;oBAC3B,IAAI,EAAE,aAAa;oBACnB,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,EAAE;oBACX,QAAQ,EAAE,IAAI;oBACd,WAAW,EAAE,4CAA4C;iBAC1D;aACF;SACF,CAAA;IAmGH,CAAC;IAjGC,KAAK,CAAC,OAAO;QACX,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAA;QACjC,MAAM,UAAU,GAAyB,EAAE,CAAA;QAE3C,MAAM,WAAW,GAAG,MAAM,IAAI,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oB,EAAE,EAAE,SAAS,EAAE,CAAC,CAAA;oBACrD,UAAU,CAAC,IAAI,CAAC;wBACd,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE;wBAC9B,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;qBAChC,CAAC,CAAA;gBACJ,CAAC;qBAAM,CAAC;oBACN,MAAM,KAAK,CAAA;gBACb,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,EAAE;YACtC,cAAc,EAAE,UAAU,CAAC,MAAM;SAClC,CAAC,CAAA;QAEF,OAAO,CAAC,UAAU,CAAC,CAAA;IACrB,CAAC;CACF;AAzID,oDAyIC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const bun_test_1 = require("bun:test");
|
|
4
|
+
const PublerCompetitorList_node_1 = require("./PublerCompetitorList.node");
|
|
5
|
+
(0, bun_test_1.test)("PublerCompetitorList", () => {
|
|
6
|
+
const node = new PublerCompetitorList_node_1.PublerCompetitorList();
|
|
7
|
+
(0, bun_test_1.expect)(node.description.properties).toBeDefined();
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=PublerCompetitorList.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PublerCompetitorList.spec.js","sourceRoot":"","sources":["../../../nodes/PublerCompetitorList/PublerCompetitorList.spec.ts"],"names":[],"mappings":";;AAAA,uCAAuC;AACvC,2EAAkE;AAElE,IAAA,eAAI,EAAC,sBAAsB,EAAE,GAAG,EAAE;IAChC,MAAM,IAAI,GAAG,IAAI,gDAAoB,EAAE,CAAA;IACvC,IAAA,iBAAM,EAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,CAAA;AACnD,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from "n8n-workflow";
|
|
2
|
+
export declare class PublerJobStatus implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PublerJobStatus = void 0;
|
|
4
|
+
class PublerJobStatus {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.description = {
|
|
7
|
+
displayName: "Publer Job Status",
|
|
8
|
+
name: "publerJobStatus",
|
|
9
|
+
icon: "file:logo.svg",
|
|
10
|
+
group: ["input"],
|
|
11
|
+
version: 1,
|
|
12
|
+
description: "Check the status of async jobs in Publer (e.g., media imports, bulk operations)",
|
|
13
|
+
defaults: {
|
|
14
|
+
name: "Publer Job Status",
|
|
15
|
+
},
|
|
16
|
+
inputs: ["main"],
|
|
17
|
+
outputs: ["main"],
|
|
18
|
+
credentials: [
|
|
19
|
+
{
|
|
20
|
+
name: "publerApi",
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
properties: [
|
|
25
|
+
{
|
|
26
|
+
displayName: "Job ID",
|
|
27
|
+
name: "jobId",
|
|
28
|
+
type: "string",
|
|
29
|
+
default: "",
|
|
30
|
+
required: true,
|
|
31
|
+
description: "The ID of the job to check",
|
|
32
|
+
placeholder: "12345",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
displayName: "Workspace ID",
|
|
36
|
+
name: "workspaceId",
|
|
37
|
+
type: "string",
|
|
38
|
+
default: "",
|
|
39
|
+
required: true,
|
|
40
|
+
description: "The workspace ID where the job was created",
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
async execute() {
|
|
46
|
+
const items = this.getInputData();
|
|
47
|
+
const returnData = [];
|
|
48
|
+
const credentials = await this.getCredentials("publerApi");
|
|
49
|
+
const apiToken = credentials.apiToken;
|
|
50
|
+
if (!apiToken) {
|
|
51
|
+
this.logger.error("API Token is missing", {
|
|
52
|
+
credentialName: "publerApi",
|
|
53
|
+
});
|
|
54
|
+
throw new Error("API Token is required");
|
|
55
|
+
}
|
|
56
|
+
this.logger.debug("Credentials retrieved", {
|
|
57
|
+
hasApiToken: !!apiToken,
|
|
58
|
+
itemCount: items.length,
|
|
59
|
+
});
|
|
60
|
+
const workspaceId = this.getNodeParameter("workspaceId", 0);
|
|
61
|
+
if (!workspaceId) {
|
|
62
|
+
this.logger.error("Workspace ID is missing", {
|
|
63
|
+
nodeName: this.getNode().name,
|
|
64
|
+
});
|
|
65
|
+
throw new Error("Workspace ID is required for this operation");
|
|
66
|
+
}
|
|
67
|
+
this.logger.debug("Node parameters retrieved", {
|
|
68
|
+
hasWorkspaceId: !!workspaceId,
|
|
69
|
+
});
|
|
70
|
+
this.logger.info("Starting execution", { itemCount: items.length });
|
|
71
|
+
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
|
72
|
+
try {
|
|
73
|
+
const jobId = this.getNodeParameter("jobId", itemIndex);
|
|
74
|
+
const endpoint = `https://app.publer.com/api/v1/job_status/${jobId}`;
|
|
75
|
+
this.logger.info("Making API request", {
|
|
76
|
+
itemIndex,
|
|
77
|
+
endpoint,
|
|
78
|
+
method: "GET",
|
|
79
|
+
jobId,
|
|
80
|
+
workspaceId: workspaceId,
|
|
81
|
+
});
|
|
82
|
+
const response = await this.helpers.requestWithAuthentication.call(this, "publerApi", {
|
|
83
|
+
method: "GET",
|
|
84
|
+
url: endpoint,
|
|
85
|
+
headers: {
|
|
86
|
+
Authorization: `Bearer-API ${apiToken}`,
|
|
87
|
+
Accept: "application/json",
|
|
88
|
+
"Publer-Workspace-Id": workspaceId,
|
|
89
|
+
},
|
|
90
|
+
json: true,
|
|
91
|
+
});
|
|
92
|
+
this.logger.info("API request successful", {
|
|
93
|
+
itemIndex,
|
|
94
|
+
endpoint,
|
|
95
|
+
responseType: typeof response,
|
|
96
|
+
});
|
|
97
|
+
this.logger.debug("Response data", {
|
|
98
|
+
itemIndex,
|
|
99
|
+
responseKeys: response ? Object.keys(response) : [],
|
|
100
|
+
});
|
|
101
|
+
returnData.push({
|
|
102
|
+
json: response,
|
|
103
|
+
pairedItem: { item: itemIndex },
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
this.logger.error("API request failed", {
|
|
108
|
+
itemIndex,
|
|
109
|
+
error: error.message,
|
|
110
|
+
stack: error.stack,
|
|
111
|
+
});
|
|
112
|
+
if (this.continueOnFail()) {
|
|
113
|
+
this.logger.warn("Continuing on fail", { itemIndex });
|
|
114
|
+
returnData.push({
|
|
115
|
+
json: { error: error.message },
|
|
116
|
+
pairedItem: { item: itemIndex },
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
throw error;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
this.logger.info("Execution completed", {
|
|
125
|
+
processedItems: returnData.length,
|
|
126
|
+
});
|
|
127
|
+
return [returnData];
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.PublerJobStatus = PublerJobStatus;
|
|
131
|
+
//# sourceMappingURL=PublerJobStatus.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PublerJobStatus.node.js","sourceRoot":"","sources":["../../../nodes/PublerJobStatus/PublerJobStatus.node.ts"],"names":[],"mappings":";;;AAEA,MAAa,eAAe;IAA5B;QACE,gBAAW,GAAyB;YAClC,WAAW,EAAE,mBAAmB;YAChC,IAAI,EAAE,iBAAiB;YACvB,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,CAAC,OAAO,CAAC;YAChB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,iFAAiF;YAC9F,QAAQ,E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+1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const bun_test_1 = require("bun:test");
|
|
4
|
+
const PublerJobStatus_node_1 = require("./PublerJobStatus.node");
|
|
5
|
+
(0, bun_test_1.test)("PublerJobStatus", () => {
|
|
6
|
+
const node = new PublerJobStatus_node_1.PublerJobStatus();
|
|
7
|
+
(0, bun_test_1.expect)(node.description.properties).toBeDefined();
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=PublerJobStatus.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PublerJobStatus.spec.js","sourceRoot":"","sources":["../../../nodes/PublerJobStatus/PublerJobStatus.spec.ts"],"names":[],"mappings":";;AAAA,uCAAuC;AACvC,iEAAwD;AAExD,IAAA,eAAI,EAAC,iBAAiB,EAAE,GAAG,EAAE;IAC3B,MAAM,IAAI,GAAG,IAAI,sCAAe,EAAE,CAAA;IAClC,IAAA,iBAAM,EAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,CAAA;AACnD,CAAC,CAAC,CAAA"}
|
|
@@ -21,23 +21,7 @@ class PublerMe {
|
|
|
21
21
|
required: true,
|
|
22
22
|
},
|
|
23
23
|
],
|
|
24
|
-
properties: [
|
|
25
|
-
{
|
|
26
|
-
displayName: "Operation",
|
|
27
|
-
name: "operation",
|
|
28
|
-
type: "options",
|
|
29
|
-
noDataExpression: true,
|
|
30
|
-
options: [
|
|
31
|
-
{
|
|
32
|
-
name: "Get Current User",
|
|
33
|
-
value: "getCurrentUser",
|
|
34
|
-
description: "Get information about the currently authenticated user",
|
|
35
|
-
action: "Get current user",
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
default: "getCurrentUser",
|
|
39
|
-
},
|
|
40
|
-
],
|
|
24
|
+
properties: [],
|
|
41
25
|
};
|
|
42
26
|
}
|
|
43
27
|
async execute() {
|
|
@@ -55,45 +39,41 @@ class PublerMe {
|
|
|
55
39
|
hasApiToken: !!apiToken,
|
|
56
40
|
itemCount: items.length,
|
|
57
41
|
});
|
|
58
|
-
|
|
59
|
-
this.logger.info("Starting execution", { operation, itemCount: items.length });
|
|
42
|
+
this.logger.info("Starting execution", { itemCount: items.length });
|
|
60
43
|
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
|
61
44
|
try {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
});
|
|
91
|
-
}
|
|
45
|
+
const endpoint = "https://app.publer.com/api/v1/users/me";
|
|
46
|
+
this.logger.info("Making API request", {
|
|
47
|
+
itemIndex,
|
|
48
|
+
endpoint,
|
|
49
|
+
method: "GET",
|
|
50
|
+
});
|
|
51
|
+
const response = await this.helpers.requestWithAuthentication.call(this, "publerApi", {
|
|
52
|
+
method: "GET",
|
|
53
|
+
url: endpoint,
|
|
54
|
+
headers: {
|
|
55
|
+
Authorization: `Bearer-API ${apiToken}`,
|
|
56
|
+
Accept: "application/json",
|
|
57
|
+
},
|
|
58
|
+
json: true,
|
|
59
|
+
});
|
|
60
|
+
this.logger.info("API request successful", {
|
|
61
|
+
itemIndex,
|
|
62
|
+
endpoint,
|
|
63
|
+
responseType: typeof response,
|
|
64
|
+
});
|
|
65
|
+
this.logger.debug("Response data", {
|
|
66
|
+
itemIndex,
|
|
67
|
+
responseKeys: response ? Object.keys(response) : [],
|
|
68
|
+
});
|
|
69
|
+
returnData.push({
|
|
70
|
+
json: response,
|
|
71
|
+
pairedItem: { item: itemIndex },
|
|
72
|
+
});
|
|
92
73
|
}
|
|
93
74
|
catch (error) {
|
|
94
75
|
this.logger.error("API request failed", {
|
|
95
76
|
itemIndex,
|
|
96
|
-
operation,
|
|
97
77
|
error: error.message,
|
|
98
78
|
stack: error.stack,
|
|
99
79
|
});
|
|
@@ -110,7 +90,6 @@ class PublerMe {
|
|
|
110
90
|
}
|
|
111
91
|
}
|
|
112
92
|
this.logger.info("Execution completed", {
|
|
113
|
-
operation,
|
|
114
93
|
processedItems: returnData.length,
|
|
115
94
|
});
|
|
116
95
|
return [returnData];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PublerMe.node.js","sourceRoot":"","sources":["../../../nodes/PublerMe/PublerMe.node.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"PublerMe.node.js","sourceRoot":"","sources":["../../../nodes/PublerMe/PublerMe.node.ts"],"names":[],"mappings":";;;AAEA,MAAa,QAAQ;IAArB;QACE,gBAAW,GAAyB;YAClC,WAAW,EAAE,WAAW;YACxB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,CAAC,OAAO,CAAC;YAChB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,wDAAwD;YACrE,QAAQ,EAAE;gBACR,IAAI,EAAE,WAAW;aAClB;YACD,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE;gBACX;oBACE,IAAI,EAAE,WAAW;oBACjB,QAAQ,EAAE,IAAI;iBACf;aACF;YACD,UAAU,EAAE,EAAE;SACf,CAAA;IAmFH,CAAC;IAjFC,KAAK,CAAC,OAAO;QACX,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAA;QACjC,MAAM,UAAU,GAAyB,EAAE,CAAA;QAE3C,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CA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BAEF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,EAAE;oBACjC,SAAS;oBACT,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE;iBACpD,CAAC,CAAA;gBAEF,UAAU,CAAC,IAAI,CAAC;oBACd,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;iBAChC,CAAC,CAAA;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,EAAE;oBACtC,SAAS;oBACT,KAAK,EAAE,KAAK,CAAC,OAAO;oBACpB,KAAK,EAAE,KAAK,CAAC,KAAK;iBACnB,CAAC,CAAA;gBAEF,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC1B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,SAAS,EAAE,CAAC,CAAA;oBACrD,UAAU,CAAC,IAAI,CAAC;wBACd,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE;wBAC9B,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;qBAChC,CAAC,CAAA;gBACJ,CAAC;qBAAM,CAAC;oBACN,MAAM,KAAK,CAAA;gBACb,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,EAAE;YACtC,cAAc,EAAE,UAAU,CAAC,MAAM;SAClC,CAAC,CAAA;QAEF,OAAO,CAAC,UAAU,CAAC,CAAA;IACrB,CAAC;CACF;AAvGD,4BAuGC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const bun_test_1 = require("bun:test");
|
|
3
4
|
const PublerMe_node_1 = require("./PublerMe.node");
|
|
4
|
-
test("PublerMe", () => {
|
|
5
|
+
(0, bun_test_1.test)("PublerMe", () => {
|
|
5
6
|
const node = new PublerMe_node_1.PublerMe();
|
|
6
|
-
expect(node.description.properties).toBeDefined();
|
|
7
|
+
(0, bun_test_1.expect)(node.description.properties).toBeDefined();
|
|
7
8
|
});
|
|
8
9
|
//# sourceMappingURL=PublerMe.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PublerMe.spec.js","sourceRoot":"","sources":["../../../nodes/PublerMe/PublerMe.spec.ts"],"names":[],"mappings":";;AAAA,mDAA0C;AAE1C,
|
|
1
|
+
{"version":3,"file":"PublerMe.spec.js","sourceRoot":"","sources":["../../../nodes/PublerMe/PublerMe.spec.ts"],"names":[],"mappings":";;AAAA,uCAAuC;AACvC,mDAA0C;AAE1C,IAAA,eAAI,EAAC,UAAU,EAAE,GAAG,EAAE;IACpB,MAAM,IAAI,GAAG,IAAI,wBAAQ,EAAE,CAAA;IAC3B,IAAA,iBAAM,EAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,CAAA;AACnD,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from "n8n-workflow";
|
|
2
|
+
export declare class PublerMediaImportFromUrl implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PublerMediaImportFromUrl = void 0;
|
|
4
|
+
class PublerMediaImportFromUrl {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.description = {
|
|
7
|
+
displayName: "Publer Media Import From URL",
|
|
8
|
+
name: "publerMediaImportFromUrl",
|
|
9
|
+
icon: "file:logo.svg",
|
|
10
|
+
group: ["input"],
|
|
11
|
+
version: 1,
|
|
12
|
+
description: "Import media files from a URL into your Publer media library",
|
|
13
|
+
defaults: {
|
|
14
|
+
name: "Publer Media Import From URL",
|
|
15
|
+
},
|
|
16
|
+
inputs: ["main"],
|
|
17
|
+
outputs: ["main"],
|
|
18
|
+
credentials: [
|
|
19
|
+
{
|
|
20
|
+
name: "publerApi",
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
properties: [
|
|
25
|
+
{
|
|
26
|
+
displayName: "Media URL",
|
|
27
|
+
name: "mediaUrl",
|
|
28
|
+
type: "string",
|
|
29
|
+
default: "",
|
|
30
|
+
required: true,
|
|
31
|
+
description: "The URL of the media file to import",
|
|
32
|
+
placeholder: "https://example.com/image.jpg",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
displayName: "Media Name",
|
|
36
|
+
name: "mediaName",
|
|
37
|
+
type: "string",
|
|
38
|
+
default: "",
|
|
39
|
+
required: true,
|
|
40
|
+
description: "Name for the imported media file",
|
|
41
|
+
placeholder: "my-image.jpg",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
displayName: "Caption",
|
|
45
|
+
name: "caption",
|
|
46
|
+
type: "string",
|
|
47
|
+
default: "",
|
|
48
|
+
description: "Optional caption for the media",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
displayName: "Source",
|
|
52
|
+
name: "source",
|
|
53
|
+
type: "string",
|
|
54
|
+
default: "",
|
|
55
|
+
description: "Optional source attribution for the media",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
displayName: "Upload Type",
|
|
59
|
+
name: "uploadType",
|
|
60
|
+
type: "options",
|
|
61
|
+
default: "single",
|
|
62
|
+
options: [
|
|
63
|
+
{ name: "Single", value: "single" },
|
|
64
|
+
{ name: "Bulk", value: "bulk" },
|
|
65
|
+
{ name: "Thumbnail", value: "thumbnail" },
|
|
66
|
+
],
|
|
67
|
+
description: "Type of upload operation",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
displayName: "Direct Upload",
|
|
71
|
+
name: "directUpload",
|
|
72
|
+
type: "boolean",
|
|
73
|
+
default: false,
|
|
74
|
+
description: "Whether to upload directly to S3 (slower, but required if you need the final media URL immediately)",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
displayName: "Save to Library",
|
|
78
|
+
name: "inLibrary",
|
|
79
|
+
type: "boolean",
|
|
80
|
+
default: false,
|
|
81
|
+
description: "Whether to save the media to your library",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
displayName: "Workspace ID",
|
|
85
|
+
name: "workspaceId",
|
|
86
|
+
type: "string",
|
|
87
|
+
default: "",
|
|
88
|
+
required: true,
|
|
89
|
+
description: "The workspace ID to import the media into",
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
async execute() {
|
|
95
|
+
const items = this.getInputData();
|
|
96
|
+
const returnData = [];
|
|
97
|
+
const credentials = await this.getCredentials("publerApi");
|
|
98
|
+
const apiToken = credentials.apiToken;
|
|
99
|
+
if (!apiToken) {
|
|
100
|
+
this.logger.error("API Token is missing", {
|
|
101
|
+
credentialName: "publerApi",
|
|
102
|
+
});
|
|
103
|
+
throw new Error("API Token is required");
|
|
104
|
+
}
|
|
105
|
+
this.logger.debug("Credentials retrieved", {
|
|
106
|
+
hasApiToken: !!apiToken,
|
|
107
|
+
itemCount: items.length,
|
|
108
|
+
});
|
|
109
|
+
this.logger.info("Starting execution", { itemCount: items.length });
|
|
110
|
+
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
|
111
|
+
try {
|
|
112
|
+
const mediaUrl = this.getNodeParameter("mediaUrl", itemIndex);
|
|
113
|
+
const mediaName = this.getNodeParameter("mediaName", itemIndex);
|
|
114
|
+
const caption = this.getNodeParameter("caption", itemIndex, "");
|
|
115
|
+
const source = this.getNodeParameter("source", itemIndex, "");
|
|
116
|
+
const uploadType = this.getNodeParameter("uploadType", itemIndex, "single");
|
|
117
|
+
const directUpload = this.getNodeParameter("directUpload", itemIndex, false);
|
|
118
|
+
const inLibrary = this.getNodeParameter("inLibrary", itemIndex, false);
|
|
119
|
+
const workspaceId = this.getNodeParameter("workspaceId", itemIndex);
|
|
120
|
+
const endpoint = "https://app.publer.com/api/v1/media/from-url";
|
|
121
|
+
this.logger.info("Making API request", {
|
|
122
|
+
itemIndex,
|
|
123
|
+
endpoint,
|
|
124
|
+
method: "POST",
|
|
125
|
+
mediaUrl,
|
|
126
|
+
});
|
|
127
|
+
const mediaItem = {
|
|
128
|
+
url: mediaUrl,
|
|
129
|
+
name: mediaName,
|
|
130
|
+
};
|
|
131
|
+
if (caption) {
|
|
132
|
+
mediaItem.caption = caption;
|
|
133
|
+
}
|
|
134
|
+
if (source) {
|
|
135
|
+
mediaItem.source = source;
|
|
136
|
+
}
|
|
137
|
+
const body = {
|
|
138
|
+
media: [mediaItem],
|
|
139
|
+
type: uploadType,
|
|
140
|
+
direct_upload: directUpload,
|
|
141
|
+
in_library: inLibrary,
|
|
142
|
+
};
|
|
143
|
+
const response = await this.helpers.requestWithAuthentication.call(this, "publerApi", {
|
|
144
|
+
method: "POST",
|
|
145
|
+
url: endpoint,
|
|
146
|
+
headers: {
|
|
147
|
+
Authorization: `Bearer-API ${apiToken}`,
|
|
148
|
+
Accept: "application/json",
|
|
149
|
+
"Content-Type": "application/json",
|
|
150
|
+
"Publer-Workspace-Id": workspaceId,
|
|
151
|
+
},
|
|
152
|
+
body,
|
|
153
|
+
json: true,
|
|
154
|
+
});
|
|
155
|
+
this.logger.info("API request successful", {
|
|
156
|
+
itemIndex,
|
|
157
|
+
endpoint,
|
|
158
|
+
responseType: typeof response,
|
|
159
|
+
});
|
|
160
|
+
this.logger.debug("Response data", {
|
|
161
|
+
itemIndex,
|
|
162
|
+
responseKeys: response ? Object.keys(response) : [],
|
|
163
|
+
});
|
|
164
|
+
returnData.push({
|
|
165
|
+
json: response,
|
|
166
|
+
pairedItem: { item: itemIndex },
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
this.logger.error("API request failed", {
|
|
171
|
+
itemIndex,
|
|
172
|
+
error: error.message,
|
|
173
|
+
stack: error.stack,
|
|
174
|
+
});
|
|
175
|
+
if (this.continueOnFail()) {
|
|
176
|
+
this.logger.warn("Continuing on fail", { itemIndex });
|
|
177
|
+
returnData.push({
|
|
178
|
+
json: { error: error.message },
|
|
179
|
+
pairedItem: { item: itemIndex },
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
throw error;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
this.logger.info("Execution completed", {
|
|
188
|
+
processedItems: returnData.length,
|
|
189
|
+
});
|
|
190
|
+
return [returnData];
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
exports.PublerMediaImportFromUrl = PublerMediaImportFromUrl;
|
|
194
|
+
//# sourceMappingURL=PublerMediaImportFromUrl.node.js.map
|