UNPKG

keystone-seeder

Version:
22 lines (21 loc) 697 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.initializeContext = initializeContext; const context_1 = require("@keystone-6/core/context"); /** * Initialize the Keystone context for database operations */ async function initializeContext(config, prismaModule) { try { const context = (0, context_1.getContext)(config, prismaModule); console.log("(seeder)", "Connecting to DB..."); if (typeof config.db.onConnect === "function") { await config.db.onConnect(context); } return context; } catch (error) { console.error("Error initializing context:", error); throw error; } }