Files
template-app/modules/knowledge/module.shared.ts
T

49 lines
2.1 KiB
TypeScript

// Shared, runtime-neutral knowledge manifest data. The normal app binds its worker implementations
// of the index/remove jobs; the Convex binding file (module.convex.ts) ships fail-closed for a
// future wiring — the module stays Postgres-only until the search effect and the jobs have their
// composed Node actions (see README.md).
import type { ModuleManifest } from "@conusai-kit/core"
import { repositoryBindings } from "@conusai-kit/data"
import { KNOWLEDGE_PROCEDURE_IMPLS } from "./adapters/procedures.js"
import {
COLLECTION_CREATED,
DOCUMENT_AI_DISABLED,
DOCUMENT_AI_ENABLED,
KNOWLEDGE_ENTITIES,
KNOWLEDGE_FLAG_DEFAULTS,
} from "./contract/index.js"
import { en, lt } from "./i18n/index.js"
const tables = repositoryBindings(...KNOWLEDGE_ENTITIES)
export const KNOWLEDGE_MODULE_BASE: ModuleManifest = {
id: "knowledge",
version: "0.1.0",
kit: "^0.1.0",
requires: ["tenancy", "files"],
permissions: {
// Searching and reading the status is a member's act; the kit's member maps onto "editor".
"knowledge.knowledge.search": "editor",
// Managing collections, indexing and removing documents, and the enablement flow are
// administrative acts.
"knowledge.collection.manage": "admin",
"knowledge.knowledge.manage": "admin",
"knowledge.settings.manage": "admin",
},
procedures: KNOWLEDGE_PROCEDURE_IMPLS,
repositories: { postgres: tables },
migrations: { postgres: "migrations" },
// The module ships the Postgres profile; the Convex binding file (module.convex.ts) ships
// fail-closed for a future wiring and is deliberately NOT registered in convex/ — the search
// effect, the jobs and the enablement flow all leave the process and have no composed Convex
// Node actions yet (see README.md).
profiles: ["postgres"],
audit: [COLLECTION_CREATED, DOCUMENT_AI_ENABLED, DOCUMENT_AI_DISABLED],
flags: Object.fromEntries(Object.entries(KNOWLEDGE_FLAG_DEFAULTS).map(([flag, value]) => [flag, { default: value }])),
ui: {
nav: [{ scope: "project", label: "knowledge.title", href: "knowledge", permission: "knowledge.knowledge.search" }],
},
i18n: { en, lt },
}