feat(FN-3766): add cli press sqlite store and credential helpers
Implements SQLite-based storage and credential management for the CLI printing press plugin, including type definitions, a persistent `cli-press-store`, and credential helpers, with updated routes, tests, and documentation. Fusion-Task-Id: FN-3766
This commit is contained in:
@@ -3,6 +3,7 @@ import { createServer } from "node:http";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { Database } from "@fusion/core";
|
||||
import { createCliPrintingPressRoutes } from "../routes/wizard-routes.js";
|
||||
import type { ServiceDraft } from "../wizard/types.js";
|
||||
|
||||
@@ -49,7 +50,9 @@ describe("run routes", () => {
|
||||
res.end("pong");
|
||||
});
|
||||
const rootDir = await mkdtemp(join(tmpdir(), "cli-printing-press-run-routes-"));
|
||||
const ctx = { taskStore: { getRootDir: () => rootDir } } as any;
|
||||
const db = new Database(join(rootDir, ".fusion"), { inMemory: true });
|
||||
db.init();
|
||||
const ctx = { taskStore: { getRootDir: () => rootDir, getDatabase: () => db } } as any;
|
||||
|
||||
const createRes = await route("POST", "/drafts").handler({ params: {}, body: makeDraft(baseUrl) }, ctx);
|
||||
const id = (createRes.body as { id: string }).id;
|
||||
@@ -71,7 +74,9 @@ describe("run routes", () => {
|
||||
}, 50);
|
||||
});
|
||||
const rootDir = await mkdtemp(join(tmpdir(), "cli-printing-press-run-routes-"));
|
||||
const ctx = { taskStore: { getRootDir: () => rootDir } } as any;
|
||||
const db = new Database(join(rootDir, ".fusion"), { inMemory: true });
|
||||
db.init();
|
||||
const ctx = { taskStore: { getRootDir: () => rootDir, getDatabase: () => db } } as any;
|
||||
|
||||
const createRes = await route("POST", "/drafts").handler({ params: {}, body: makeDraft(baseUrl) }, ctx);
|
||||
const id = (createRes.body as { id: string }).id;
|
||||
|
||||
@@ -2,6 +2,7 @@ import { mkdtemp } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { Database } from "@fusion/core";
|
||||
import { createCliPrintingPressRoutes } from "../routes/wizard-routes";
|
||||
import type { ServiceDraft } from "../wizard/types";
|
||||
|
||||
@@ -19,7 +20,9 @@ function route(method: string, path: string) {
|
||||
describe("wizard routes", () => {
|
||||
it("handles create/get/delete lifecycle", async () => {
|
||||
const rootDir = await mkdtemp(join(tmpdir(), "cli-printing-press-routes-"));
|
||||
const ctx = { taskStore: { getRootDir: () => rootDir } } as any;
|
||||
const db = new Database(join(rootDir, ".fusion"), { inMemory: true });
|
||||
db.init();
|
||||
const ctx = { taskStore: { getRootDir: () => rootDir, getDatabase: () => db } } as any;
|
||||
|
||||
const createRes = await route("POST", "/drafts").handler({ params: {}, body: makeDraft() }, ctx);
|
||||
expect(createRes.status).toBe(201);
|
||||
|
||||
Reference in New Issue
Block a user