blockmine 1.15.0 → 1.15.1

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/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # История версий
2
2
 
3
3
 
4
+ ### [1.15.1](https://github.com/blockmineJS/blockmine/compare/v1.15.0...v1.15.1) (2025-07-19)
5
+
6
+
7
+ ### 🐛 Исправления
8
+
9
+ * фикс. создание триггеров при установке из стора графа ([7980413](https://github.com/blockmineJS/blockmine/commit/79804133a6ff5d6f41769e7db2b6c4f1027e33f6))
10
+
4
11
  ## [1.15.0](https://github.com/blockmineJS/blockmine/compare/v1.14.1...v1.15.0) (2025-07-19)
5
12
 
6
13
 
@@ -1152,6 +1152,17 @@ router.post('/:botId/event-graphs', authorize('management:edit'), async (req, re
1152
1152
 
1153
1153
  console.log('[API] Final graphJsonString:', graphJsonString);
1154
1154
 
1155
+ let eventTypes = [];
1156
+ try {
1157
+ const parsedGraph = JSON.parse(graphJsonString);
1158
+ if (parsedGraph.nodes && Array.isArray(parsedGraph.nodes)) {
1159
+ const eventNodes = parsedGraph.nodes.filter(node => node.type && node.type.startsWith('event:'));
1160
+ eventTypes = [...new Set(eventNodes.map(node => node.type.split(':')[1]))];
1161
+ }
1162
+ } catch (error) {
1163
+ console.warn('[API] Не удалось извлечь типы событий из графа:', error.message);
1164
+ }
1165
+
1155
1166
  const newEventGraph = await prisma.eventGraph.create({
1156
1167
  data: {
1157
1168
  botId,
@@ -1160,8 +1171,12 @@ router.post('/:botId/event-graphs', authorize('management:edit'), async (req, re
1160
1171
  isEnabled: isEnabled,
1161
1172
  graphJson: graphJsonString,
1162
1173
  variables: variables || '[]',
1163
- eventType: eventType || 'custom'
1174
+ eventType: eventType || 'custom',
1175
+ triggers: {
1176
+ create: eventTypes.map(eventType => ({ eventType }))
1177
+ }
1164
1178
  },
1179
+ include: { triggers: true }
1165
1180
  });
1166
1181
 
1167
1182
  console.log('[API] Created event graph:', newEventGraph);
@@ -75,6 +75,17 @@ router.post('/',
75
75
  }
76
76
 
77
77
  try {
78
+ let eventTypes = [];
79
+ try {
80
+ const parsedGraph = JSON.parse(graphJsonString);
81
+ if (parsedGraph.nodes && Array.isArray(parsedGraph.nodes)) {
82
+ const eventNodes = parsedGraph.nodes.filter(node => node.type && node.type.startsWith('event:'));
83
+ eventTypes = [...new Set(eventNodes.map(node => node.type.split(':')[1]))];
84
+ }
85
+ } catch (error) {
86
+ console.warn('[API] Не удалось извлечь типы событий из графа:', error.message);
87
+ }
88
+
78
89
  const newGraph = await prisma.eventGraph.create({
79
90
  data: {
80
91
  botId: parseInt(botId),
@@ -82,8 +93,12 @@ router.post('/',
82
93
  isEnabled: isEnabled,
83
94
  graphJson: graphJsonString,
84
95
  variables: variables || '[]',
85
- pluginOwnerId: req.body.pluginOwnerId || null
86
- }
96
+ pluginOwnerId: req.body.pluginOwnerId || null,
97
+ triggers: {
98
+ create: eventTypes.map(eventType => ({ eventType }))
99
+ }
100
+ },
101
+ include: { triggers: true }
87
102
  });
88
103
 
89
104
  res.status(201).json(newGraph);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blockmine",
3
- "version": "1.15.0",
3
+ "version": "1.15.1",
4
4
  "description": "Мощная панель управления ботами для Майнкрафта.",
5
5
  "author": "merka",
6
6
  "license": "MIT",