@elsium-ai/testing 0.2.3 → 0.4.0
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/dist/index.js +48 -0
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -310,6 +310,54 @@ function createStream(executor) {
|
|
|
310
310
|
});
|
|
311
311
|
return new ElsiumStream(source);
|
|
312
312
|
}
|
|
313
|
+
// ../core/src/logger.ts
|
|
314
|
+
var LOG_LEVELS = {
|
|
315
|
+
debug: 0,
|
|
316
|
+
info: 1,
|
|
317
|
+
warn: 2,
|
|
318
|
+
error: 3
|
|
319
|
+
};
|
|
320
|
+
function createLogger(options = {}) {
|
|
321
|
+
const { level = "info", pretty = false, context = {} } = options;
|
|
322
|
+
const minLevel = LOG_LEVELS[level];
|
|
323
|
+
function log(logLevel, message, data) {
|
|
324
|
+
if (LOG_LEVELS[logLevel] < minLevel)
|
|
325
|
+
return;
|
|
326
|
+
const entry = {
|
|
327
|
+
...context,
|
|
328
|
+
level: logLevel,
|
|
329
|
+
message,
|
|
330
|
+
timestamp: new Date().toISOString(),
|
|
331
|
+
...data ? { data } : {}
|
|
332
|
+
};
|
|
333
|
+
const output = pretty ? JSON.stringify(entry, null, 2) : JSON.stringify(entry);
|
|
334
|
+
if (logLevel === "error") {
|
|
335
|
+
console.error(output);
|
|
336
|
+
} else if (logLevel === "warn") {
|
|
337
|
+
console.warn(output);
|
|
338
|
+
} else {
|
|
339
|
+
console.log(output);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
return {
|
|
343
|
+
debug: (msg, data) => log("debug", msg, data),
|
|
344
|
+
info: (msg, data) => log("info", msg, data),
|
|
345
|
+
warn: (msg, data) => log("warn", msg, data),
|
|
346
|
+
error: (msg, data) => log("error", msg, data),
|
|
347
|
+
child(childContext) {
|
|
348
|
+
return createLogger({
|
|
349
|
+
level,
|
|
350
|
+
pretty,
|
|
351
|
+
context: { ...context, ...childContext }
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
// ../core/src/schema.ts
|
|
357
|
+
var log = createLogger();
|
|
358
|
+
// ../core/src/registry.ts
|
|
359
|
+
var log2 = createLogger();
|
|
360
|
+
var BLOCKED_KEYS = new Set(["__proto__", "constructor", "prototype"]);
|
|
313
361
|
// src/mock-provider.ts
|
|
314
362
|
function mockProvider(options = {}) {
|
|
315
363
|
const { responses = [], defaultResponse, onRequest } = options;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elsium-ai/testing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Testing utilities, mock providers, fixtures, and eval framework for ElsiumAI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Eric Utrera <ebutrera9103@gmail.com>",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"dev": "bun --watch src/index.ts"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@elsium-ai/core": "^0.
|
|
30
|
-
"@elsium-ai/gateway": "^0.
|
|
31
|
-
"@elsium-ai/agents": "^0.
|
|
32
|
-
"@elsium-ai/tools": "^0.
|
|
29
|
+
"@elsium-ai/core": "^0.4.0",
|
|
30
|
+
"@elsium-ai/gateway": "^0.4.0",
|
|
31
|
+
"@elsium-ai/agents": "^0.4.0",
|
|
32
|
+
"@elsium-ai/tools": "^0.4.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"typescript": "^5.7.0"
|