feat: implement session management with SessionService and SessionPlugin; refactor query execution to handle session cookies; update token and query handling for improved session tracking
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
import "module/squel";
|
||||
import "plugin/db";
|
||||
import "plugin/axios";
|
||||
import "plugin/session";
|
||||
|
||||
function createSQL(id) {
|
||||
return squel.select().from("test").where("id = ?", id).toString();
|
||||
@ -23,6 +24,10 @@ async function main(input, headers) {
|
||||
|
||||
// log(a);
|
||||
|
||||
log(await session.get("test"));
|
||||
|
||||
await session.set("test", 1);
|
||||
|
||||
const res = await db.query(`
|
||||
SELECT SLEEP(10000);
|
||||
`);
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import createMigration from "../functions/createMigration";
|
||||
import createDatabase from "../functions/createDatabase";
|
||||
import createDatabaseNode from "../functions/createDatabaseNode";
|
||||
import createProject from "../functions/createProject";
|
||||
// import createMigration from "../functions/createMigration";
|
||||
// import createDatabase from "../functions/createDatabase";
|
||||
// import createDatabaseNode from "../functions/createDatabaseNode";
|
||||
// import createProject from "../functions/createProject";
|
||||
import createQuery from "../functions/createQuery";
|
||||
import databaseMigrationUp from "../functions/databaseMigrationUp";
|
||||
// import databaseMigrationUp from "../functions/databaseMigrationUp";
|
||||
import runQuery from "../functions/runQuery";
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
@ -45,6 +45,7 @@ import * as path from "path";
|
||||
const result = await runQuery(query.id, { id: 1 });
|
||||
|
||||
console.log("Query Result:", result.data);
|
||||
console.log("headers:", result.headers);
|
||||
} catch (error) {
|
||||
console.error("Error during test execution");
|
||||
}
|
||||
|
||||
@ -6,7 +6,12 @@ export default async (token: string, queryData: Record<string, any>) => {
|
||||
const response = await axios.post(
|
||||
`${config.url}/query/run/${token}`,
|
||||
queryData,
|
||||
{ headers: { "x-api-token": "efbeccd6-dde1-47dc-b3aa-4fbd773d5429" } }
|
||||
{
|
||||
headers: {
|
||||
"x-api-token": "efbeccd6-dde1-47dc-b3aa-4fbd773d5429",
|
||||
Cookie: `x-session-id=psaCHcYFMrt6RnUz_1760094020243`,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
return response;
|
||||
|
||||
Reference in New Issue
Block a user