Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
802 changes: 789 additions & 13 deletions frontend/src/components/actors/actor-database.tsx

Large diffs are not rendered by default.

78 changes: 78 additions & 0 deletions frontend/src/components/actors/actor-inspector-context.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

138 changes: 103 additions & 35 deletions frontend/src/components/actors/database/database-table.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 65 additions & 0 deletions rivetkit-typescript/packages/rivetkit/src/actor/router.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Hono } from "hono";

Check failure on line 1 in rivetkit-typescript/packages/rivetkit/src/actor/router.ts

View workflow job for this annotation

GitHub Actions / RivetKit / Quality Check

format

Formatter would have printed the following content:
import {
type ActionOpts,
type ActionOutput,
Expand All @@ -19,6 +19,10 @@
loggerMiddleware,
} from "@/common/router";
import { noopNext } from "@/common/utils";
import {
isSqliteBindingArray,
isSqliteBindingObject,
} from "@/db/shared";
import { inspectorLogger } from "@/inspector/log";
import type { RegistryConfig } from "@/registry/config";
import { type GetUpgradeWebSocket, VERSION } from "@/utils";
Expand Down Expand Up @@ -286,6 +290,67 @@
return c.json(result);
});

router.post("/inspector/database/execute", async (c) => {
const authResponse = await inspectorAuth(c);
if (authResponse) return authResponse;

const actor = await actorDriver.loadActor(c.env.actorId);
const body = await c.req.json<{
sql?: unknown;
args?: unknown;
properties?: unknown;
}>();

if (typeof body.sql !== "string" || body.sql.trim() === "") {
return c.json({ error: "sql is required" }, 400);
}

if (
Array.isArray(body.args) &&
body.properties &&
typeof body.properties === "object"
) {
return c.json(
{
error: "use either args or properties, not both",
},
400,
);
}

if (body.args !== undefined && !isSqliteBindingArray(body.args)) {
return c.json(
{
error: "args must be a SQLite binding array",
},
400,
);
}

if (
body.properties !== undefined &&
!isSqliteBindingObject(body.properties)
) {
return c.json(
{
error: "properties must be a SQLite binding object",
},
400,
);
}

const args = isSqliteBindingArray(body.args) ? body.args : [];
const properties = isSqliteBindingObject(body.properties)
? body.properties
: undefined;
const result = await actor.inspector.executeDatabaseSqlJson(
body.sql,
args,
properties,
);
return c.json(result);
});

router.get("/inspector/summary", async (c) => {
const authResponse = await inspectorAuth(c);
if (authResponse) return authResponse;
Expand Down
Loading
Loading