@wabot-dev/framework 0.9.15 → 0.9.16

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.
@@ -245,10 +245,16 @@ class ProjectRunner {
245
245
  }
246
246
  async resolveDefaultChatAdapters() {
247
247
  const keys = Object.keys(DEFAULT_ADAPTER_LOADERS);
248
+ const emptyKeys = [];
248
249
  const results = await Promise.all(keys.map(async (key) => {
249
250
  const { apiKeyEnv, load } = DEFAULT_ADAPTER_LOADERS[key];
250
- if (!process.env[apiKeyEnv])
251
+ const value = process.env[apiKeyEnv];
252
+ if (value === undefined)
251
253
  return null;
254
+ if (value.trim() === '') {
255
+ emptyKeys.push(apiKeyEnv);
256
+ return null;
257
+ }
252
258
  try {
253
259
  const adapter = await load();
254
260
  if (!adapter)
@@ -260,6 +266,10 @@ class ProjectRunner {
260
266
  return null;
261
267
  }
262
268
  }));
269
+ if (emptyKeys.length > 0) {
270
+ throw new Error(`Chat adapter API key(s) defined but empty: ${emptyKeys.join(', ')}. ` +
271
+ `Set a value in your .env or remove the variable entirely.`);
272
+ }
263
273
  return results.filter((a) => a != null);
264
274
  }
265
275
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wabot-dev/framework",
3
- "version": "0.9.15",
3
+ "version": "0.9.16",
4
4
  "description": "Framework for IA Chat Bots",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",