plazbot-cli 0.2.7 → 0.2.9
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.
|
@@ -105,9 +105,11 @@ exports.createCommand = new commander_1.Command('create')
|
|
|
105
105
|
}
|
|
106
106
|
console.log();
|
|
107
107
|
logger_1.logger.dim('Siguiente paso: plazbot agent chat -a ' + (result.agentId || '<agentId>'));
|
|
108
|
+
console.log();
|
|
108
109
|
if (options.dev) {
|
|
109
110
|
logger_1.logger.warning('Ambiente: desarrollo');
|
|
110
111
|
}
|
|
112
|
+
process.exit(0);
|
|
111
113
|
}
|
|
112
114
|
catch (error) {
|
|
113
115
|
const message = error instanceof Error ? error.message : 'Error desconocido al crear el agente';
|
|
@@ -84,7 +84,9 @@ async function connectChannelFlow(ctx) {
|
|
|
84
84
|
let prevIntegrationIds = new Set();
|
|
85
85
|
try {
|
|
86
86
|
const wkRes = await axios_1.default.get(`${baseUrl}/api/workspace/${ctx.workspaceId}`, { headers });
|
|
87
|
-
|
|
87
|
+
// La API retorna un array [{ integrations: [...] }]
|
|
88
|
+
const wsData = Array.isArray(wkRes.data) ? wkRes.data[0] : wkRes.data;
|
|
89
|
+
const integrations = wsData?.integrations || [];
|
|
88
90
|
prevIntegrationIds = new Set(integrations.map((i) => i.id));
|
|
89
91
|
}
|
|
90
92
|
catch {
|
|
@@ -133,7 +135,9 @@ async function connectChannelFlow(ctx) {
|
|
|
133
135
|
break;
|
|
134
136
|
try {
|
|
135
137
|
const wkRes = await axios_1.default.get(`${baseUrl}/api/workspace/${ctx.workspaceId}`, { headers });
|
|
136
|
-
|
|
138
|
+
// La API retorna un array [{ integrations: [...] }]
|
|
139
|
+
const wsData = Array.isArray(wkRes.data) ? wkRes.data[0] : wkRes.data;
|
|
140
|
+
const integrations = wsData?.integrations || [];
|
|
137
141
|
// Buscar integraciones nuevas (cualquier ID que no existia antes)
|
|
138
142
|
const newOnes = integrations.filter((ig) => !prevIntegrationIds.has(ig.id));
|
|
139
143
|
if (newOnes.length > 0) {
|
package/package.json
CHANGED
|
@@ -77,11 +77,14 @@ export const createCommand = new Command('create')
|
|
|
77
77
|
|
|
78
78
|
console.log();
|
|
79
79
|
logger.dim('Siguiente paso: plazbot agent chat -a ' + (result.agentId || '<agentId>'));
|
|
80
|
+
console.log();
|
|
80
81
|
|
|
81
82
|
if (options.dev) {
|
|
82
83
|
logger.warning('Ambiente: desarrollo');
|
|
83
84
|
}
|
|
84
85
|
|
|
86
|
+
process.exit(0);
|
|
87
|
+
|
|
85
88
|
} catch (error) {
|
|
86
89
|
const message = error instanceof Error ? error.message : 'Error desconocido al crear el agente';
|
|
87
90
|
logger.error(message);
|
|
@@ -186,7 +186,9 @@ async function connectChannelFlow(ctx: WizardContext): Promise<AgentChannel[]> {
|
|
|
186
186
|
let prevIntegrationIds: Set<string> = new Set();
|
|
187
187
|
try {
|
|
188
188
|
const wkRes = await axios.get(`${baseUrl}/api/workspace/${ctx.workspaceId}`, { headers });
|
|
189
|
-
|
|
189
|
+
// La API retorna un array [{ integrations: [...] }]
|
|
190
|
+
const wsData = Array.isArray(wkRes.data) ? wkRes.data[0] : wkRes.data;
|
|
191
|
+
const integrations = wsData?.integrations || [];
|
|
190
192
|
prevIntegrationIds = new Set(integrations.map((i: any) => i.id));
|
|
191
193
|
} catch {
|
|
192
194
|
// Si falla, se parte de vacio
|
|
@@ -231,7 +233,9 @@ async function connectChannelFlow(ctx: WizardContext): Promise<AgentChannel[]> {
|
|
|
231
233
|
if (skipped) break;
|
|
232
234
|
try {
|
|
233
235
|
const wkRes = await axios.get(`${baseUrl}/api/workspace/${ctx.workspaceId}`, { headers });
|
|
234
|
-
|
|
236
|
+
// La API retorna un array [{ integrations: [...] }]
|
|
237
|
+
const wsData = Array.isArray(wkRes.data) ? wkRes.data[0] : wkRes.data;
|
|
238
|
+
const integrations = wsData?.integrations || [];
|
|
235
239
|
|
|
236
240
|
// Buscar integraciones nuevas (cualquier ID que no existia antes)
|
|
237
241
|
const newOnes = integrations.filter((ig: any) => !prevIntegrationIds.has(ig.id));
|