kortique commited on
Commit
e525cad
·
1 Parent(s): 6a14446

add locale settings to all pages "advanced development"

Browse files
docs/advanced-development/creating-custom-node.mdx CHANGED
@@ -2,108 +2,6 @@
2
  sidebar_position: 1
3
  ---
4
 
5
- # Создание кастомной ноды
6
-
7
- Создание кастомных нод позволяет обойти ограничения, которые связаны со стандартной библиотекой нод Piper, или же даже просто улучшить функционал текущих нод.
8
-
9
- Давайте создадим кастомную ноду **Merge text to JSON**, которая принимает несколько текстовых строк и объединяет их в один JSON массив.
10
-
11
- ## **1. Загрузка ноды из библиотеки нод**
12
-
13
- Для создания кастомной ноды начните с загрузки существующей ноды, которая наиболее близка к вашим требованиям. Перейдите в библиотеку нод, используя значок **плюс (+)** в верхнем левом углу рабочего пространства пайплайны и выберите ноду **Input Text** для модификации, поскольку в ней минимум кода и она работает со строками.
14
-
15
- После добавления ноды откройте её настройки.
16
-
17
- ![Панель настроек ноды](../img/create-node-1.png)
18
-
19
- Панель настроек включает несколько вкладок:
20
-
21
- - **Inputs** - Текущие параметры ноды, их настройка, загрузка изображений
22
- - **Design** - Создание входных и выходных параметров, определение их свойств
23
- - **Script** - Редактирование кода JavaScript, логика ноды
24
- - **Environment** - Настройка переменных окружения
25
- - **Catalog** - Просмотр метаданных ноды и её публикация
26
- - **YAML** - Доступ к YAML ноды
27
-
28
- ## **2. Настройка ноды**
29
-
30
- Кастомизация начинается со вкладки **Design**, где определяется структура ноды.
31
-
32
- ![Вкладка Design](../img/create-node-2.png)
33
-
34
- ### Основные свойства
35
- - **ID** - Внутреннее имя, используемое в коде (строчные латинские буквы, без пробелов)
36
- - **Title** - Отображаемое имя, видимое пользователю
37
-
38
- Для нашей ноды прежние значения необходимо заменить на:
39
- - ID: `merge_text_to_json`
40
- - Title: `Merge text to JSON`
41
-
42
- ### Добавление входных параметров
43
-
44
- Нашей ноде нужно 4 строковых входа. Чтобы добавить новый вход:
45
-
46
- 1. Раскройте меню-гамбургер **Inputs**
47
- 2. Введите имя нового входа: `string1`
48
- 3. Нажмите **Add**
49
-
50
- ![Добавление нового входного параметра](../img/create-node-3.png)
51
-
52
- Настройте параметры входа:
53
- - **Type**: string (то есть текст)
54
- - **Title**: String 1 (название, отображаемое на ноде)
55
-
56
- ![Настройка свойств входа](../img/create-node-4.png)
57
-
58
- Повторите этот процесс для создания входов `string2`, `string3` и `string4`.
59
-
60
- Чтобы удалить прежний входной параметр `input_text`, снимите галочку с него в меню Inputs.
61
-
62
- ![Удаление оригинального входа](../img/create-node-5.png)
63
-
64
- Если визуально изменения не произошли, нужно временно открыть другую вкладку и потом вернуться в Design.
65
-
66
- ### Расширенные настройки входных параметров
67
-
68
- Доступ к детальным настройкам входных параметров открывается через меню-гамбургер.
69
-
70
- ![Выпадающее меню настроек входных параметров](../img/create-node-6.png)
71
-
72
- Доступные опции включают:
73
-
74
- - **Order** (число) - Задаёт порядок расположения входов в ноде
75
- - **Description** (текст) - Текст всплывающей подсказки для параметра
76
- - **Required** (boolean) - True делает параметр обязательным
77
- - **Group** (текст) - Группирует связанные настройки
78
- - **Enum** (текст) - Создает выпадающие списки с предопределенными значениями
79
- - **Multiline** (boolean) - Расширяет поля String для длинного текста
80
- - **Min, Max** (число) - Устанавливает ограниче��ия для полей Integer
81
- - **Step** (число) - Преобразует поле Integer в ползунок с шагом, равным значению Step
82
- - **Default** - Устанавливает значения по умолчанию
83
- - **Placeholder** (текст) - Показывает подсказку в пустых полях String
84
- - **Schema** - Техническое поле для скриптов
85
- - **Extensions** (текст) - Добавляет специальную функциональность (например, draw-mask для задания маски на загруженном изображении)
86
-
87
- ![Пример конфигурации расширений](../img/create-node-7.png)
88
-
89
- ### Настройка выходных параметров
90
-
91
- Создайте выходной параметр. Для этого удалите прежний выход `output_text` и добавьте новый `json_output` со следующими параметрами:
92
- - **Type**: JSON
93
- - **Title**: JSON
94
-
95
- Итогое окно Design должно выглядеть примерно так:
96
-
97
- ![Отредлактированная вкладка Design](../img/create-node-8.png)
98
-
99
- :::tip Совет
100
- Отслеживайте ваши изменения во вкладке **Inputs**, чтобы видеть, как модификации влияют на структуру ноды.
101
- :::
102
-
103
- Про следующий шаг - написание логики скрипта ноды, в разделе **Вкладка Node Script**.
104
-
105
- --- eng ---
106
-
107
  # Creating Custom Nodes
108
 
109
  Creating custom nodes allows you to bypass limitations associated with Piper's standard node library, or even simply improve the functionality of current nodes.
 
2
  sidebar_position: 1
3
  ---
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  # Creating Custom Nodes
6
 
7
  Creating custom nodes allows you to bypass limitations associated with Piper's standard node library, or even simply improve the functionality of current nodes.
docs/advanced-development/node-script.mdx CHANGED
@@ -2,113 +2,6 @@
2
  sidebar_position: 2
3
  ---
4
 
5
- # Вкладка Script в настройках ноды
6
-
7
- Вкладка **Script** предназначена для размещения кода JavaScript, отвечающего за программную логику ноды. Здесь вы определяете, что именно делает ваша нода - обрабатывает ли она текст, вызывает API, трансформирует данные или выполняет вычисления.
8
-
9
- ![Интерфейс вкладки Script](../img/script_tab.jpg)
10
-
11
- ## Структура кода
12
-
13
- Все ноды Piper, включая кастомные, следуют определенной структуре JavaScript:
14
-
15
- ```javascript
16
- export async function run({ inputs }) {
17
- const { FatalError, NextNode } = DEFINITIONS;
18
-
19
- // Ваш код здесь
20
-
21
- return NextNode.from({
22
- outputs: {
23
- // Ваши результаты
24
- }
25
- });
26
- }
27
- ```
28
-
29
- Эта структура гарантирует, что ваша нода может правильно получать данные от предыдущих нод и передавать результаты следующим в вашем пайплайне.
30
-
31
- ### Оригинальный код Input Text
32
- Базовая нода **Input Text** имеет эту простую структуру:
33
-
34
- ```javascript
35
- export async function run({ inputs }) {
36
- const { FatalError, NextNode } = DEFINITIONS;
37
-
38
- const text = inputs.input_text;
39
-
40
- return NextNode.from({
41
- outputs: {
42
- output_text: text
43
- }
44
- });
45
- }
46
- ```
47
-
48
- ### Кастомный код Merge Text to JSON
49
- Нам нужно заменить это логикой, которая обрабатывает несколько строковых входов и создает JSON массив:
50
-
51
- ```javascript
52
- export async function run({ inputs }) {
53
- const { FatalError, NextNode } = DEFINITIONS;
54
-
55
- const jsonArray = [];
56
-
57
- if (inputs.string1) {
58
- jsonArray.push(inputs.string1);
59
- }
60
- if (inputs.string2) {
61
- jsonArray.push(inputs.string2);
62
- }
63
- if (inputs.string3) {
64
- jsonArray.push(inputs.string3);
65
- }
66
- if (inputs.string4) {
67
- jsonArray.push(inputs.string4);
68
- }
69
-
70
- return NextNode.from({
71
- outputs: {
72
- json_output: jsonArray
73
- }
74
- });
75
- }
76
- ```
77
- ## Понимание кастомной логики
78
-
79
- Кастомный скрипт реализует следующую логику:
80
-
81
- 1. **Инициализация пустого массива** - `const jsonArray = []` создает пустой массив для хранения наших текстовых строк
82
- 2. **Проверка каждого входа** - Условия `if` проверяют, что каждый вход имеет значение перед добавлением
83
- 3. **Построение массива** - Только непустые входы добавляются в `jsonArray` с помощью `push()`
84
- 4. **Возврат JSON выхода** - Финальный массив возвращается как `json_output`, соответствуя нашей конфигурации во вкладке Design
85
-
86
- Этот подход гарантирует, что:
87
- - Пустые или неопределенные входы игнорируются
88
- - Только валидные текстовые строки включаются в финальный JSON массив
89
- - Формат выхода соответствует JSON типу, который мы определили во вкладке Design
90
-
91
- ## Типы выполнения
92
-
93
- Выберите подходящий тип выполнения в зависимости от того, сколько времени требуется вашей ноде для работы:
94
-
95
- | Тип | Время | Описание |
96
- |------------|-------------|-----------------------|
97
- | Rapid | 0-20 sec | Быстрые операции |
98
- | Regular | 21-60 sec | Стандартная обработка |
99
- | Deferred | 60-120 sec | Сложные операции |
100
- | Protracted | 120-300 sec | Тяжелые задачи обработки |
101
-
102
- Для нашей ноды **Merge text to JSON** подходит выполнение **Rapid**, поскольку мы только манипулируем текстовыми строками и нет обращений к стороннему сервису по API.
103
-
104
- ## Сохранение изменений
105
-
106
- Всегда сохраняйте изменения в скрипте, нажимая кнопку **Save** внизу интерфейса. Любые изменения в коде следует сохранять по нажатию клавиши Save внизу интерфейса.
107
-
108
- Вкладка Script - это я��ро функциональности вашей ноды, где вы преобразуете входные данные в выходные с помощью кода JavaScript.
109
-
110
- --- eng ---
111
-
112
  # Script Tab in Node Settings
113
 
114
  The **Script** tab is designed for placing JavaScript code that handles the node's programmatic logic. Here you define what exactly your node does - whether it processes text, calls APIs, transforms data, or performs calculations.
 
2
  sidebar_position: 2
3
  ---
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  # Script Tab in Node Settings
6
 
7
  The **Script** tab is designed for placing JavaScript code that handles the node's programmatic logic. Here you define what exactly your node does - whether it processes text, calls APIs, transforms data, or performs calculations.
docs/advanced-development/node-yaml.mdx CHANGED
@@ -2,152 +2,6 @@
2
  sidebar_position: 3
3
  ---
4
 
5
- # Вкладка YAML в настройках ноды
6
-
7
- Вкладка **YAML** объединяет все данные из других вкладок (Design, Script, Environment, Catalog) в единое представление, которое определяет всё о вашей ноде - от технических метаданных до её позиции в рабочем пространстве пайплайна.
8
-
9
- ![Интерфейс вкладки YAML](../img/node-yaml.png)
10
-
11
- ## Что такое YAML представление?
12
-
13
- Вкладка YAML служит "исходным кодом" вашей ноды. Она объединяет:
14
-
15
- - Определения входных и выходных данных из вкладки Design
16
- - JavaScript код из вкладки Script
17
- - Технические метаданные из вкладки Catalog
18
- - Переменные окружения из вкладки Environment
19
- - Позиционирование ноды и связи внутри пайплайна
20
-
21
- Это полное представление позволяет точно дублировать ноды, копируя их YAML конфигурацию в другие пайплайны.
22
-
23
- ## Структура YAML
24
-
25
- YAML конфигурация организована в логические секции:
26
-
27
- ### Техническая информация
28
- ```yaml
29
- _id: merge_text_to_json
30
- version: 1
31
- category:
32
- _id: processing
33
- title: en=Processing;ru=Обработка
34
- package: custom
35
- title: en=Merge text to JSON;ru=Объединение текста в JSON
36
- source: node
37
- execution: regular
38
- ```
39
-
40
- Эти поля определяют идентификатор ноды, версию, классификацию по категориям и привязку к пакету.
41
-
42
- ### Скрипт выполнения
43
- ```yaml
44
- script: |-
45
- export async function run({ inputs }) {
46
- const { NextNode } = DEFINITIONS;
47
-
48
- const jsonArray = [];
49
-
50
- if (inputs.string1) {
51
- jsonArray.push(inputs.string1);
52
- }
53
- if (inputs.string2) {
54
- jsonArray.push(inputs.string2);
55
- }
56
- if (inputs.string3) {
57
- jsonArray.push(inputs.string3);
58
- }
59
- if (inputs.string4) {
60
- jsonArray.push(inputs.string4);
61
- }
62
-
63
- return NextNode.from({
64
- outputs: {
65
- json_output: jsonArray
66
- }
67
- });
68
- }
69
- ```
70
-
71
- Содержит полный кастомный JavaScript код, который мы написали во вкладке Script.
72
-
73
- ### Позиционирование ноды
74
- ```yaml
75
- arrange:
76
- x: 170
77
- y: 290
78
- ```
79
-
80
- Определяет точное положение ноды в рабочем пространстве пайплайна.
81
-
82
- ### Определения входных/выходных данных
83
- ```yaml
84
- inputs:
85
- string1:
86
- title: en=String 1;ru=Строка 1
87
- type: string
88
- required: false
89
- string2:
90
- title: en=String 2;ru=Строка 2
91
- type: string
92
- required: false
93
- string3:
94
- title: en=String 3;ru=Строка 3
95
- type: string
96
- required: false
97
- string4:
98
- title: en=String 4;ru=Строка 4
99
- type: string
100
- required: false
101
-
102
- outputs:
103
- json_output:
104
- title: en=JSON;ru=JSON
105
- type: json
106
- ```
107
-
108
- Полные спецификации для всех 4 входных параметров и 1 выходного параметра, которые мы настроили во вкладке Design.
109
-
110
- ### Информация каталога (опционально)
111
- ```yaml
112
- catalog:
113
- _id: merge_text_to_json
114
- version: 1
115
- category:
116
- _id: service_nodes
117
- title: Service Nodes
118
- package: service_nodes
119
- ```
120
-
121
- Метаданные для публикации и организации вашей кастомной ноды в каталоге.
122
-
123
- ### Переменные окружения (опционально)
124
- ```yaml
125
- environment:
126
- OPEN_PAAS_USER:
127
- title: PaaS user
128
- type: string
129
- scope: global
130
- ```
131
-
132
- Все переменные окружения и API ключи, необходимые для подключения ноды к внешним провайдерам.
133
-
134
- ## Копирование и повторное использование нод
135
-
136
- Самая мощная функция вкладки YAML - возможность создания точных дубликатов ноды:
137
-
138
- 1. **Скопируйте YAML** - Выделите весь код во вкладке YAML и скопируйте его
139
- 2. **Создайте новую ноду** - Добавьте новую ноду в любой пайплайн
140
- 3. **Вставьте конфигурацию** - Замените YAML новой ноды на скопированный код
141
- 4. **Сохраните изменения** - Нода будет воссоздана с идентичной функцио��альностью
142
-
143
- Этот процесс сохраняет все настройки, код и конфигурацию, делая простым повторное использование любых нод в разных пайплайнах.
144
-
145
- ## Только для чтения
146
-
147
- Вкладка YAML в основном предназначена для просмотра и копирования. Хотя вы можете видеть полную конфигурацию ноды здесь, изменения следует вносить через соответствующие вкладки (Script для изменений кода, Design для модификации входных/выходных данных и т.д.), чтобы обеспечить правильную валидацию и форматирование.
148
-
149
- --- eng ---
150
-
151
  # YAML Tab in Node Settings
152
 
153
  The **YAML** tab combines all data from other tabs (Design, Script, Environment, Catalog) into a unified view that defines everything about your node - from technical metadata to its position in the pipeline workspace.
 
2
  sidebar_position: 3
3
  ---
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  # YAML Tab in Node Settings
6
 
7
  The **YAML** tab combines all data from other tabs (Design, Script, Environment, Catalog) into a unified view that defines everything about your node - from technical metadata to its position in the pipeline workspace.
i18n/ru/docusaurus-plugin-content-docs/current/advanced-development/creating-custom-node.mdx CHANGED
@@ -100,106 +100,4 @@ sidebar_position: 1
100
  Отслеживайте ваши изменения во вкладке **Inputs**, чтобы видеть, как модификации влияют на структуру ноды.
101
  :::
102
 
103
- Про следующий шаг - написание логики скрипта ноды, в разделе **Вкладка Node Script**.
104
-
105
- --- eng ---
106
-
107
- # Creating Custom Nodes
108
-
109
- Creating custom nodes allows you to bypass limitations associated with Piper's standard node library, or even simply improve the functionality of current nodes.
110
-
111
- Let's create a custom **Merge text to JSON** node that takes multiple text strings and combines them into a single JSON array.
112
-
113
- ## **1. Loading a Node from the Node Library**
114
-
115
- To create a custom node, start by loading an existing node that's closest to your requirements. Navigate to the node library using the **plus (+)** icon in the top left corner of the pipeline workspace and select the **Input Text** node for modification, since it has minimal code and works with strings.
116
-
117
- After adding the node, open its settings.
118
-
119
- ![Node Settings Panel](../img/create-node-1.png)
120
-
121
- The settings panel includes several tabs:
122
-
123
- - **Inputs** - Current node parameters, their configuration, image loading
124
- - **Design** - Creating input and output parameters, defining their properties
125
- - **Script** - Editing JavaScript code, node logic
126
- - **Environment** - Configure environment variables
127
- - **Catalog** - View node metadata and publish it
128
- - **YAML** - Access the node's YAML
129
-
130
- ## **2. Node Configuration**
131
-
132
- Customization begins in the **Design** tab, where the node structure is defined.
133
-
134
- ![Design Tab](../img/create-node-2.png)
135
-
136
- ### Basic Properties
137
- - **ID** - Internal name used in code (lowercase Latin letters, no spaces)
138
- - **Title** - Display name visible to the user
139
-
140
- For our node, the previous values need to be replaced with:
141
- - ID: `merge_text_to_json`
142
- - Title: `Merge text to JSON`
143
-
144
- ### Adding Input Parameters
145
-
146
- Our node needs 4 string inputs. To add a new input:
147
-
148
- 1. Expand the **Inputs** hamburger menu
149
- 2. Enter the new input name: `string1`
150
- 3. Click **Add**
151
-
152
- ![Adding New Input Parameter](../img/create-node-3.png)
153
-
154
- Configure the input parameters:
155
- - **Type**: string (i.e., text)
156
- - **Title**: String 1 (name displayed on the node)
157
-
158
- ![Configuring Input Properties](../img/create-node-4.png)
159
-
160
- Repeat this process to create inputs `string2`, `string3`, and `string4`.
161
-
162
- To remove the previous input parameter `input_text`, uncheck it in the Inputs menu.
163
-
164
- ![Removing Original Input](../img/create-node-5.png)
165
-
166
- If no visual changes occur, you need to temporarily open another tab and then return to Design.
167
-
168
- ### Advanced Input Parameter Settings
169
-
170
- Access to detailed settings is opened through the hamburger menu.
171
-
172
- ![Input Parameter Settings Dropdown Menu](../img/create-node-6.png)
173
-
174
- Available options include:
175
-
176
- - **Order** (number) - Sets the order of inputs in the node
177
- - **Description** (text) - Tooltip text for the parameter
178
- - **Required** (boolean) - True makes the parameter mandatory
179
- - **Group** (text) - Groups related settings
180
- - **Enum** (text) - Creates dropdown lists with predefined values
181
- - **Multiline** (boolean) - Expands String fields for long text
182
- - **Min, Max** (number) - Sets constraints for Integer fields
183
- - **Step** (number) - Converts Integer field to slider with step equal to Step value
184
- - **Default** - Sets default values
185
- - **Placeholder** (text) - Shows hints in empty String fields
186
- - **Schema** - Technical field for scripts
187
- - **Extensions** (text) - Adds special functionality (e.g., draw-mask for setting masks on uploaded images)
188
-
189
- ![Example Extension Configuration](../img/create-node-7.png)
190
-
191
- ### Configuring Output Parameters
192
-
193
- Create an output parameter. To do this, delete the previous output `output_text` and add a new `json_output` with the following parameters:
194
- - **Type**: JSON
195
- - **Title**: JSON
196
-
197
- The final Design window should look something like this:
198
-
199
- ![Edited Design Tab](../img/create-node-8.png)
200
-
201
- :::tip Tip
202
- Monitor your changes in the **Inputs** tab to see how modifications affect the node structure.
203
- :::
204
-
205
- The next step - writing the node's script logic, is covered in the **Node Script Tab** section.
 
100
  Отслеживайте ваши изменения во вкладке **Inputs**, чтобы видеть, как модификации влияют на структуру ноды.
101
  :::
102
 
103
+ Про следующий шаг - написание логики скрипта ноды, в разделе **Вкладка Node Script**.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
i18n/ru/docusaurus-plugin-content-docs/current/advanced-development/node-script.mdx CHANGED
@@ -105,112 +105,4 @@ export async function run({ inputs }) {
105
 
106
  Всегда сохраняйте изменения в скрипте, нажимая кнопку **Save** внизу интерфейса. Любые изменения в коде следует сохранять по нажатию клавиши Save внизу интерфейса.
107
 
108
- Вкладка Script - это ядро функциональности вашей ноды, где вы преобразуете входные данные в выходные с помощью кода JavaScript.
109
-
110
- --- eng ---
111
-
112
- # Script Tab in Node Settings
113
-
114
- The **Script** tab is designed for placing JavaScript code that handles the node's programmatic logic. Here you define what exactly your node does - whether it processes text, calls APIs, transforms data, or performs calculations.
115
-
116
- ![Script tab interface](../img/script_tab.jpg)
117
-
118
- ## Code Structure
119
-
120
- All Piper nodes, including custom ones, follow a specific JavaScript structure:
121
-
122
- ```javascript
123
- export async function run({ inputs }) {
124
- const { FatalError, NextNode } = DEFINITIONS;
125
-
126
- // Your code here
127
-
128
- return NextNode.from({
129
- outputs: {
130
- // Your results
131
- }
132
- });
133
- }
134
- ```
135
-
136
- This structure ensures that your node can properly receive data from previous nodes and pass results to the next ones in your pipeline.
137
-
138
- ### Original Input Text Code
139
- The basic **Input Text** node has this simple structure:
140
-
141
- ```javascript
142
- export async function run({ inputs }) {
143
- const { FatalError, NextNode } = DEFINITIONS;
144
-
145
- const text = inputs.input_text;
146
-
147
- return NextNode.from({
148
- outputs: {
149
- output_text: text
150
- }
151
- });
152
- }
153
- ```
154
-
155
- ### Custom Merge Text to JSON Code
156
- We need to replace this with logic that processes multiple string inputs and creates a JSON array:
157
-
158
- ```javascript
159
- export async function run({ inputs }) {
160
- const { FatalError, NextNode } = DEFINITIONS;
161
-
162
- const jsonArray = [];
163
-
164
- if (inputs.string1) {
165
- jsonArray.push(inputs.string1);
166
- }
167
- if (inputs.string2) {
168
- jsonArray.push(inputs.string2);
169
- }
170
- if (inputs.string3) {
171
- jsonArray.push(inputs.string3);
172
- }
173
- if (inputs.string4) {
174
- jsonArray.push(inputs.string4);
175
- }
176
-
177
- return NextNode.from({
178
- outputs: {
179
- json_output: jsonArray
180
- }
181
- });
182
- }
183
- ```
184
-
185
- ## Understanding Custom Logic
186
-
187
- The custom script implements the following logic:
188
-
189
- 1. **Initialize empty array** - `const jsonArray = []` creates an empty array to store our text strings
190
- 2. **Check each input** - `if` conditions check that each input has a value before adding
191
- 3. **Build array** - Only non-empty inputs are added to `jsonArray` using `push()`
192
- 4. **Return JSON output** - The final array is returned as `json_output`, matching our configuration in the Design tab
193
-
194
- This approach ensures that:
195
- - Empty or undefined inputs are ignored
196
- - Only valid text strings are included in the final JSON array
197
- - The output format matches the JSON type we defined in the Design tab
198
-
199
- ## Execution Types
200
-
201
- Choose the appropriate execution type based on how much time your node requires to work:
202
-
203
- | Type | Time | Description |
204
- |------------|-------------|-----------------------|
205
- | Rapid | 0-20 sec | Fast operations |
206
- | Regular | 21-60 sec | Standard processing |
207
- | Deferred | 60-120 sec | Complex operations |
208
- | Protracted | 120-300 sec | Heavy processing tasks |
209
-
210
- For our **Merge text to JSON** node, **Rapid** execution is suitable since we're only manipulating text strings and there are no API calls to external services.
211
-
212
- ## Saving Changes
213
-
214
- Always save changes to the script by clicking the **Save** button at the bottom of the interface. Any changes to the code should be saved by pressing the Save button at the bottom of the interface.
215
-
216
- The Script tab is the core of your node's functionality, where you transform input data into output using JavaScript code.
 
105
 
106
  Всегда сохраняйте изменения в скрипте, нажимая кнопку **Save** внизу интерфейса. Любые изменения в коде следует сохранять по нажатию клавиши Save внизу интерфейса.
107
 
108
+ Вкладка Script - это ядро функциональности вашей ноды, где вы преобразуете входные данные в выходные с помощью кода JavaScript.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
i18n/ru/docusaurus-plugin-content-docs/current/advanced-development/node-yaml.mdx CHANGED
@@ -144,150 +144,4 @@ environment:
144
 
145
  ## Только для чтения
146
 
147
- Вкладка YAML в основном предназначена для просмотра и копирования. Хотя вы можете видеть полную конфигурацию ноды здесь, изменения следует вносить через соответствующие вкладки (Script для изменений кода, Design для модификации входных/выходных данных и т.д.), чтобы обеспечить правильную валидацию и форматирование.
148
-
149
- --- eng ---
150
-
151
- # YAML Tab in Node Settings
152
-
153
- The **YAML** tab combines all data from other tabs (Design, Script, Environment, Catalog) into a unified view that defines everything about your node - from technical metadata to its position in the pipeline workspace.
154
-
155
- ![YAML Tab Interface](../img/node-yaml.png)
156
-
157
- ## What is the YAML View?
158
-
159
- The YAML tab serves as the "source code" of your node. It combines:
160
-
161
- - Input and output definitions from the Design tab
162
- - JavaScript code from the Script tab
163
- - Technical metadata from the Catalog tab
164
- - Environment variables from the Environment tab
165
- - Node positioning and connections within the pipeline
166
-
167
- This complete representation allows you to precisely duplicate nodes by copying their YAML configuration to other pipelines.
168
-
169
- ## YAML Structure
170
-
171
- The YAML configuration is organized into logical sections:
172
-
173
- ### Technical Information
174
- ```yaml
175
- _id: merge_text_to_json
176
- version: 1
177
- category:
178
- _id: processing
179
- title: en=Processing;ru=Обработка
180
- package: custom
181
- title: en=Merge text to JSON;ru=Объединение текста в JSON
182
- source: node
183
- execution: regular
184
- ```
185
-
186
- These fields define the node's identifier, version, category classification, and package binding.
187
-
188
- ### Execution Script
189
- ```yaml
190
- script: |-
191
- export async function run({ inputs }) {
192
- const { NextNode } = DEFINITIONS;
193
-
194
- const jsonArray = [];
195
-
196
- if (inputs.string1) {
197
- jsonArray.push(inputs.string1);
198
- }
199
- if (inputs.string2) {
200
- jsonArray.push(inputs.string2);
201
- }
202
- if (inputs.string3) {
203
- jsonArray.push(inputs.string3);
204
- }
205
- if (inputs.string4) {
206
- jsonArray.push(inputs.string4);
207
- }
208
-
209
- return NextNode.from({
210
- outputs: {
211
- json_output: jsonArray
212
- }
213
- });
214
- }
215
- ```
216
-
217
- Contains the complete custom JavaScript code that we wrote in the Script tab.
218
-
219
- ### Node Positioning
220
- ```yaml
221
- arrange:
222
- x: 170
223
- y: 290
224
- ```
225
-
226
- Defines the exact position of the node in the pipeline workspace.
227
-
228
- ### Input/Output Definitions
229
- ```yaml
230
- inputs:
231
- string1:
232
- title: en=String 1;ru=Строка 1
233
- type: string
234
- required: false
235
- string2:
236
- title: en=String 2;ru=Строка 2
237
- type: string
238
- required: false
239
- string3:
240
- title: en=String 3;ru=Строка 3
241
- type: string
242
- required: false
243
- string4:
244
- title: en=String 4;ru=Строка 4
245
- type: string
246
- required: false
247
-
248
- outputs:
249
- json_output:
250
- title: en=JSON;ru=JSON
251
- type: json
252
- ```
253
-
254
- Complete specifications for all 4 input parameters and 1 output parameter that we configured in the Design tab.
255
-
256
- ### Catalog Information (Optional)
257
- ```yaml
258
- catalog:
259
- _id: merge_text_to_json
260
- version: 1
261
- category:
262
- _id: service_nodes
263
- title: Service Nodes
264
- package: service_nodes
265
- ```
266
-
267
- Metadata for publishing and organizing your custom node in the catalog.
268
-
269
- ### Environment Variables (Optional)
270
- ```yaml
271
- environment:
272
- OPEN_PAAS_USER:
273
- title: PaaS user
274
- type: string
275
- scope: global
276
- ```
277
-
278
- All environment variables and API keys required to connect the node to external providers.
279
-
280
- ## Copying and Reusing Nodes
281
-
282
- The most powerful feature of the YAML tab is the ability to create exact duplicates of nodes:
283
-
284
- 1. **Copy YAML** - Select all code in the YAML tab and copy it
285
- 2. **Create New Node** - Add a new node to any pipeline
286
- 3. **Paste Configuration** - Replace the new node's YAML with the copied code
287
- 4. **Save Changes** - The node will be recreated with identical functionality
288
-
289
- This process preserves all settings, code, and configuration, making it simple to reuse any nodes across different pipelines.
290
-
291
- ## Read-Only
292
-
293
- The YAML tab is primarily intended for viewing and copying. While you can see the complete node configuration here, changes should be made through the appropriate tabs (Script for code changes, Design for input/output modifications, etc.) to ensure proper validation and formatting.
 
144
 
145
  ## Только для чтения
146
 
147
+ Вкладка YAML в основном предназначена для просмотра и копирования. Хотя вы можете видеть полную конфигурацию ноды здесь, изменения следует вносить через соответствующие вкладки (Script для изменений кода, Design для модификации входных/выходных данных и т.д.), чтобы обеспечить правильную валидацию и форматирование.