n8n-nodes-ume-v4 4.0.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.
Files changed (58) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +204 -0
  3. package/dist/credentials/UmeApi.credentials.d.ts +7 -0
  4. package/dist/credentials/UmeApi.credentials.js +41 -0
  5. package/dist/index.d.ts +4 -0
  6. package/dist/index.js +9 -0
  7. package/dist/nodes/FacebookComment/FacebookComment.node.d.ts +5 -0
  8. package/dist/nodes/FacebookComment/FacebookComment.node.js +155 -0
  9. package/dist/nodes/FacebookCommentLike/FacebookCommentLike.node.d.ts +5 -0
  10. package/dist/nodes/FacebookCommentLike/FacebookCommentLike.node.js +122 -0
  11. package/dist/nodes/FacebookLike/FacebookLike.node.d.ts +5 -0
  12. package/dist/nodes/FacebookLike/FacebookLike.node.js +160 -0
  13. package/dist/nodes/FacebookShare/FacebookShare.node.d.ts +5 -0
  14. package/dist/nodes/FacebookShare/FacebookShare.node.js +141 -0
  15. package/dist/nodes/FacebookStoryView/FacebookStoryView.node.d.ts +5 -0
  16. package/dist/nodes/FacebookStoryView/FacebookStoryView.node.js +122 -0
  17. package/dist/nodes/FacebookView/FacebookView.node.d.ts +5 -0
  18. package/dist/nodes/FacebookView/FacebookView.node.js +127 -0
  19. package/dist/nodes/InstagramComment/InstagramComment.node.d.ts +5 -0
  20. package/dist/nodes/InstagramComment/InstagramComment.node.js +145 -0
  21. package/dist/nodes/InstagramLike/InstagramLike.node.d.ts +5 -0
  22. package/dist/nodes/InstagramLike/InstagramLike.node.js +138 -0
  23. package/dist/nodes/InstagramView/InstagramView.node.d.ts +5 -0
  24. package/dist/nodes/InstagramView/InstagramView.node.js +151 -0
  25. package/dist/nodes/TikTokComment/TikTokComment.node.d.ts +5 -0
  26. package/dist/nodes/TikTokComment/TikTokComment.node.js +136 -0
  27. package/dist/nodes/TikTokCommentLike/TikTokCommentLike.node.d.ts +5 -0
  28. package/dist/nodes/TikTokCommentLike/TikTokCommentLike.node.js +122 -0
  29. package/dist/nodes/TikTokFavorite/TikTokFavorite.node.d.ts +5 -0
  30. package/dist/nodes/TikTokFavorite/TikTokFavorite.node.js +127 -0
  31. package/dist/nodes/TikTokLike/TikTokLike.node.d.ts +5 -0
  32. package/dist/nodes/TikTokLike/TikTokLike.node.js +141 -0
  33. package/dist/nodes/TikTokShare/TikTokShare.node.d.ts +5 -0
  34. package/dist/nodes/TikTokShare/TikTokShare.node.js +131 -0
  35. package/dist/nodes/TikTokView/TikTokView.node.d.ts +5 -0
  36. package/dist/nodes/TikTokView/TikTokView.node.js +136 -0
  37. package/dist/nodes/Ume/Ume.node.d.ts +5 -0
  38. package/dist/nodes/Ume/Ume.node.js +244 -0
  39. package/dist/nodes/Ume/operations-data.json +2246 -0
  40. package/dist/nodes/UmeSocialSeeding/UmeSocialSeeding.node.d.ts +5 -0
  41. package/dist/nodes/UmeSocialSeeding/UmeSocialSeeding.node.js +203 -0
  42. package/dist/nodes/UmeSocialSeeding/UmeSocialSeedingHelpers.d.ts +4 -0
  43. package/dist/nodes/UmeSocialSeeding/UmeSocialSeedingHelpers.js +382 -0
  44. package/dist/nodes/UmeSocialSeeding/operations-data.json +673 -0
  45. package/dist/nodes/UmeSocialSeeding/reaction.png +0 -0
  46. package/dist/nodes/UmeSocialSeeding/server-info.json +431 -0
  47. package/dist/nodes/UmeSocialSeeding/services-data-backup.json +3525 -0
  48. package/dist/nodes/UmeSocialSeeding/services-data-old.json +2704 -0
  49. package/dist/nodes/UmeSocialSeeding/services-data.json +7341 -0
  50. package/dist/nodes/UmeSocialSeeding/services-data.json.backup +3525 -0
  51. package/dist/nodes/UmeSocialSeeding/services-data.json.backup.1759909364606 +1927 -0
  52. package/dist/nodes/YouTubeComment/YouTubeComment.node.d.ts +5 -0
  53. package/dist/nodes/YouTubeComment/YouTubeComment.node.js +152 -0
  54. package/dist/nodes/YouTubeLike/YouTubeLike.node.d.ts +5 -0
  55. package/dist/nodes/YouTubeLike/YouTubeLike.node.js +141 -0
  56. package/dist/nodes/YouTubeView/YouTubeView.node.d.ts +5 -0
  57. package/dist/nodes/YouTubeView/YouTubeView.node.js +142 -0
  58. package/package.json +62 -0
@@ -0,0 +1,5 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from "n8n-workflow";
2
+ export declare class Ume implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
@@ -0,0 +1,244 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ var _a, _b, _c, _d;
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.Ume = void 0;
8
+ const n8n_workflow_1 = require("n8n-workflow");
9
+ const operations_data_json_1 = __importDefault(require("./operations-data.json"));
10
+ const BASE_URL_FALLBACK = "https://ume.com.vn/api";
11
+ const resources = operations_data_json_1.default
12
+ .filter((resource) => Array.isArray(resource.operations) && resource.operations.length > 0);
13
+ const resourceOptions = resources.map((resource) => ({
14
+ name: resource.name,
15
+ value: resource.value,
16
+ }));
17
+ const operationIndex = {};
18
+ const dynamicProperties = [];
19
+ function toDisplayLabel(name) {
20
+ return name
21
+ .replace(/_/g, " ")
22
+ .replace(/\s+/g, " ")
23
+ .replace(/\b\w/g, (char) => char.toUpperCase())
24
+ .trim();
25
+ }
26
+ for (const resource of resources) {
27
+ const operations = Array.isArray(resource.operations) ? resource.operations : [];
28
+ if (operations.length === 0) {
29
+ continue;
30
+ }
31
+ if (resource.info) {
32
+ const infoRows = Math.min(15, resource.info.split(/\r?\n/).length + 1);
33
+ dynamicProperties.push({
34
+ displayName: 'Notes',
35
+ name: `${resource.value}Info`,
36
+ type: 'string',
37
+ default: resource.info,
38
+ description: 'Reference only; this text is not sent to the API.',
39
+ typeOptions: {
40
+ rows: infoRows,
41
+ },
42
+ displayOptions: {
43
+ show: {
44
+ resource: [resource.value],
45
+ },
46
+ },
47
+ noDataExpression: true,
48
+ });
49
+ }
50
+ dynamicProperties.push({
51
+ displayName: "Operation",
52
+ name: "operation",
53
+ type: "options",
54
+ noDataExpression: true,
55
+ options: operations.map((operation) => ({
56
+ name: operation.displayName || toDisplayLabel(operation.name),
57
+ value: operation.value,
58
+ description: operation.description,
59
+ })),
60
+ default: (_b = (_a = operations[0]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "",
61
+ displayOptions: {
62
+ show: {
63
+ resource: [resource.value],
64
+ },
65
+ },
66
+ description: "Select the UME API action to perform.",
67
+ });
68
+ for (const operation of operations) {
69
+ operationIndex[operation.value] = {
70
+ ...operation,
71
+ resource: resource.value,
72
+ };
73
+ const parameters = Array.isArray(operation.parameters) ? operation.parameters : [];
74
+ for (const parameter of parameters) {
75
+ const optionValues = Array.isArray(parameter.options)
76
+ ? parameter.options.filter((value) => value.trim().length > 0)
77
+ : [];
78
+ const property = {
79
+ displayName: toDisplayLabel(parameter.name),
80
+ name: parameter.name,
81
+ type: optionValues.length > 1 ? "options" : "string",
82
+ default: (_c = parameter.defaultValue) !== null && _c !== void 0 ? _c : (optionValues.length === 1 ? optionValues[0] : ""),
83
+ displayOptions: {
84
+ show: {
85
+ resource: [resource.value],
86
+ operation: [operation.value],
87
+ },
88
+ },
89
+ required: false,
90
+ };
91
+ if (optionValues.length > 1) {
92
+ property.options = optionValues.map((value) => ({
93
+ name: value,
94
+ value,
95
+ }));
96
+ property.default = (_d = parameter.defaultValue) !== null && _d !== void 0 ? _d : optionValues[0];
97
+ property.description = "Choices: " + optionValues.join(", ");
98
+ }
99
+ dynamicProperties.push(property);
100
+ }
101
+ }
102
+ }
103
+ const additionalParametersProperty = {
104
+ displayName: "Additional Parameters",
105
+ name: "additionalParameters",
106
+ type: "fixedCollection",
107
+ typeOptions: {
108
+ multipleValues: true,
109
+ },
110
+ placeholder: "Add Parameter",
111
+ default: {},
112
+ description: "Send extra form fields that are not listed above.",
113
+ options: [
114
+ {
115
+ displayName: "Parameter",
116
+ name: "parameter",
117
+ values: [
118
+ {
119
+ displayName: "Key",
120
+ name: "key",
121
+ type: "string",
122
+ default: "",
123
+ required: true,
124
+ },
125
+ {
126
+ displayName: "Value",
127
+ name: "value",
128
+ type: "string",
129
+ default: "",
130
+ },
131
+ ],
132
+ },
133
+ ],
134
+ };
135
+ class Ume {
136
+ constructor() {
137
+ var _a, _b;
138
+ this.description = {
139
+ displayName: "UME",
140
+ name: "ume",
141
+ group: ["transform"],
142
+ version: 1,
143
+ subtitle: '={{$parameter["operation"]}}',
144
+ description: "Automate actions against the UME social service API.",
145
+ defaults: {
146
+ name: "UME",
147
+ },
148
+ inputs: ["main"],
149
+ outputs: ["main"],
150
+ credentials: [
151
+ {
152
+ name: "umeApi",
153
+ required: true,
154
+ },
155
+ ],
156
+ properties: [
157
+ {
158
+ displayName: "Resource",
159
+ name: "resource",
160
+ type: "options",
161
+ noDataExpression: true,
162
+ options: resourceOptions,
163
+ default: (_b = (_a = resourceOptions[0]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "",
164
+ description: "Social platform to target.",
165
+ },
166
+ ...dynamicProperties,
167
+ additionalParametersProperty,
168
+ ],
169
+ };
170
+ }
171
+ async execute() {
172
+ var _a, _b;
173
+ const returnData = [];
174
+ const items = this.getInputData();
175
+ const credentials = (await this.getCredentials("umeApi"));
176
+ if (!credentials || !credentials.token) {
177
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), "API token is missing in the UME credentials.");
178
+ }
179
+ const baseUrl = ((_a = credentials.baseUrl) !== null && _a !== void 0 ? _a : BASE_URL_FALLBACK).replace(/\/+$/, "");
180
+ for (let itemIndex = 0; itemIndex < items.length; itemIndex += 1) {
181
+ const operationValue = this.getNodeParameter("operation", itemIndex);
182
+ const operation = operationIndex[operationValue];
183
+ if (!operation) {
184
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operationValue}`, {
185
+ itemIndex,
186
+ });
187
+ }
188
+ const parameters = Array.isArray(operation.parameters) ? operation.parameters : [];
189
+ const formBody = {
190
+ token: credentials.token,
191
+ };
192
+ for (const parameter of parameters) {
193
+ const value = this.getNodeParameter(parameter.name, itemIndex, "");
194
+ if (value !== "" && value !== undefined && value !== null) {
195
+ const resolvedValue = typeof value === "object" ? JSON.stringify(value) : String(value);
196
+ formBody[parameter.name] = resolvedValue;
197
+ }
198
+ }
199
+ if (operation.staticParams) {
200
+ for (const [key, staticValue] of Object.entries(operation.staticParams)) {
201
+ formBody[key] = staticValue;
202
+ }
203
+ }
204
+ const additionalParameters = this.getNodeParameter("additionalParameters", itemIndex, {});
205
+ if (Array.isArray(additionalParameters.parameter)) {
206
+ for (const entry of additionalParameters.parameter) {
207
+ if (!entry || !entry.key) {
208
+ continue;
209
+ }
210
+ const entryValue = (_b = entry.value) !== null && _b !== void 0 ? _b : "";
211
+ formBody[entry.key] = String(entryValue);
212
+ }
213
+ }
214
+ const endpoint = operation.path.replace(/^\/+/, "");
215
+ const requestOptions = {
216
+ method: operation.method,
217
+ uri: `${baseUrl}/${endpoint}`,
218
+ form: formBody,
219
+ json: true,
220
+ };
221
+ let responseData;
222
+ try {
223
+ responseData = await this.helpers.request(requestOptions);
224
+ }
225
+ catch (error) {
226
+ if (error instanceof n8n_workflow_1.NodeOperationError) {
227
+ throw error;
228
+ }
229
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex });
230
+ }
231
+ const responseObject = typeof responseData === "object" && responseData !== null
232
+ ? responseData
233
+ : { data: responseData };
234
+ returnData.push({
235
+ json: responseObject,
236
+ pairedItem: {
237
+ item: itemIndex,
238
+ },
239
+ });
240
+ }
241
+ return [returnData];
242
+ }
243
+ }
244
+ exports.Ume = Ume;