teddi-x
Version:
Teddi (teddi-x) is a Node package that extends security to vertical agents., applications, and tooling built on, for, or with AI.
77 lines (67 loc) • 2.79 kB
JavaScript
// Import the modules directly from their respective files
import { secureFetch } from "./utils/secureFetch.js";
import { withSecureFetch } from "./utils/withSecureFetch.js";
import { getProxyUrl } from "./utils/getProxyUrl.js";
import { getHash, validateHash } from "./utils/getHash.js";
// Test the direct imports from utility modules
console.log("==== Testing Utility Module Exports ====");
console.log("secureFetch exists:", typeof secureFetch === "function");
console.log("withSecureFetch exists:", typeof withSecureFetch === "function");
console.log("getProxyUrl exists:", typeof getProxyUrl === "function");
console.log("getHash exists:", typeof getHash === "function");
console.log("validateHash exists:", typeof validateHash === "function");
// Test direct imports of integrations
console.log("\n==== Testing Integration Direct Imports ====");
const testDirectImports = async () => {
try {
// Test importing Supabase
const supabaseModule = await import("./integrations/supabase.js");
console.log("Direct supabase import successful:", !!supabaseModule.default);
// Test importing OpenAI
const openaiModule = await import("./integrations/openai.js");
console.log("Direct openai import successful:", !!openaiModule.default);
} catch (error) {
console.error("Direct imports failed:", error);
}
};
// Test the utility functions
console.log("\n==== Testing Utility Functions ====");
console.log("secureFetch is a function:", typeof secureFetch === "function");
console.log(
"withSecureFetch is a function:",
typeof withSecureFetch === "function"
);
console.log("getProxyUrl is a function:", typeof getProxyUrl === "function");
// Create a client implementation manually (since createClient isn't exported)
console.log("\n==== Testing Manual Client Implementation ====");
const manualClient = {
supabase: async () => {
const supabaseModule = await import("./integrations/supabase.js");
return supabaseModule.default;
},
openai: async () => {
const openaiModule = await import("./integrations/openai.js");
return openaiModule.default;
},
};
// Test the manual client implementation
const testManualClient = async () => {
try {
const supabase = await manualClient.supabase();
console.log("Manual client supabase import successful:", !!supabase);
const openai = await manualClient.openai();
console.log("Manual client openai import successful:", !!openai);
} catch (error) {
console.error("Manual client import failed:", error);
}
};
// Run the async tests sequentially
const runTests = async () => {
await testDirectImports();
await testManualClient();
console.log(
"\nAll available exports properly imported. No circular dependency issues detected!"
);
};
// Run the tests
runTests();