feat: deno-first storage package with sqlite host and graph schemas
Scaffolded @alkdev/storage from @ade/storage_sqlite and @ade/core/graphs: - graphs/ module: TypeBox schema types + SchemaBuilder (from @ade/core/graphs) - sqlite/ module: Drizzle table defs, relations, injectable client (from @ade/storage_sqlite) - pg/ module: placeholder for Postgres host - deno.json configured for JSR with subpath exports (./graphs, ./sqlite, ./pg) - Imports swapped: @sinclair/typebox → @alkdev/typebox, drizzle-typebox → @alkdev/drizzlebox - Client is now injectable (no hardcoded env vars or module-level side effects) - no-slow-types lint excluded (Drizzle generics); --allow-slow-types on publish
This commit is contained in:
30
src/sqlite/tables/actors.ts
Normal file
30
src/sqlite/tables/actors.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { sqliteTable, text } from "drizzle-orm/sqlite-core";
|
||||
import { createInsertSchema, createSelectSchema } from "@alkdev/drizzlebox";
|
||||
import { Type, type Static } from "@alkdev/typebox";
|
||||
import { commonCols, ACTOR_TYPE } from "./common.ts";
|
||||
|
||||
export const actors = sqliteTable("actors", {
|
||||
...commonCols,
|
||||
name: text("name").notNull(),
|
||||
type: text("type", { enum: ["human", "llm", "agent"] }).notNull(),
|
||||
});
|
||||
|
||||
export const SelectActor = createSelectSchema(actors, {
|
||||
metadata: Type.Object({}, { additionalProperties: true }),
|
||||
createdAt: Type.Date(),
|
||||
updatedAt: Type.Date(),
|
||||
});
|
||||
|
||||
export type SelectActor = Static<typeof SelectActor>;
|
||||
|
||||
export const InsertActor = createInsertSchema(actors, {
|
||||
name: Type.String({ minLength: 1, maxLength: 255 }),
|
||||
type: Type.Union([
|
||||
Type.Literal(ACTOR_TYPE.Human),
|
||||
Type.Literal(ACTOR_TYPE.Llm),
|
||||
Type.Literal(ACTOR_TYPE.Agent),
|
||||
]),
|
||||
metadata: Type.Optional(Type.Object({}, { additionalProperties: true })),
|
||||
});
|
||||
|
||||
export type InsertActor = Static<typeof InsertActor>;
|
||||
Reference in New Issue
Block a user