n8n-nodes-sotoros-gotenberg 1.0.4 → 1.0.5

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.
@@ -77,7 +77,8 @@ class Gotenberg {
77
77
  name: 'listPropertyName',
78
78
  type: 'string',
79
79
  default: 'items',
80
- description: 'Name of the JSON property that contains the array/list of items from the aggregation node (e.g., "items", "data")',
80
+ description: 'Name of the JSON property that contains the array/list of items from the aggregation node (e.g., "items", "data"). ' +
81
+ 'Leave empty if the aggregated item JSON itself is an array.',
81
82
  },
82
83
  {
83
84
  displayName: 'Binary Property',
@@ -201,15 +202,37 @@ class Gotenberg {
201
202
  };
202
203
  try {
203
204
  // Извлекаем список из JSON свойства агрегированного элемента
204
- const listData = aggregatedItem.json[listPropertyName];
205
- if (!listData) {
206
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Property "${listPropertyName}" not found in aggregated item. Please check the property name.`);
205
+ let listData;
206
+ // Если listPropertyName пустой или не указан, проверяем, является ли сам json массивом
207
+ if (!listPropertyName || listPropertyName.trim() === '') {
208
+ if (Array.isArray(aggregatedItem.json)) {
209
+ listData = aggregatedItem.json;
210
+ }
211
+ else {
212
+ // Показываем доступные свойства для помощи пользователю
213
+ const availableProperties = Object.keys(aggregatedItem.json || {}).join(', ');
214
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `List Property is empty, but aggregated item JSON is not an array. ` +
215
+ `Available properties: ${availableProperties || 'none'}. ` +
216
+ `Please specify the property name that contains the array of items.`);
217
+ }
207
218
  }
208
- if (!Array.isArray(listData)) {
209
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Property "${listPropertyName}" is not an array. Expected an array of items from aggregation node.`);
219
+ else {
220
+ listData = aggregatedItem.json[listPropertyName];
221
+ if (!listData) {
222
+ // Показываем доступные свойства для помощи пользователю
223
+ const availableProperties = Object.keys(aggregatedItem.json || {}).join(', ');
224
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Property "${listPropertyName}" not found in aggregated item. ` +
225
+ `Available properties: ${availableProperties || 'none'}. ` +
226
+ `Please check the property name.`);
227
+ }
228
+ if (!Array.isArray(listData)) {
229
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Property "${listPropertyName}" is not an array. ` +
230
+ `Current type: ${typeof listData}. ` +
231
+ `Expected an array of items from aggregation node.`);
232
+ }
210
233
  }
211
234
  if (listData.length === 0) {
212
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The list in property "${listPropertyName}" is empty. No items to process.`);
235
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The list ${listPropertyName ? `in property "${listPropertyName}"` : ''} is empty. No items to process.`);
213
236
  }
214
237
  // Создаем FormData для отправки в Gotenberg - один запрос для всех элементов списка
215
238
  const formData = new form_data_1.default();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-sotoros-gotenberg",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "n8n custom node for Gotenberg integration with binary data support",
5
5
  "keywords": [
6
6
  "n8n-community-node",