Files
template-app/modules/account/module.ts
T

35 lines
1.7 KiB
TypeScript

// The account module's manifest (joint contract §12): the person's own account -- export my data, and
// delete my account -- over every installed module's share of it.
//
// A module that keeps something about a person contributes its export and erasure to kit-tenancy's
// `tenancy.account` point (guides and support do, from their own manifests); this module composes
// them, adds this app's own rows, and owns the deletion ledger that makes a deletion durable. Nothing
// here names another module, so removing guides or support (`kit template:prune --without`) removes
// their share and leaves this module as it is.
import { contribute, defineModule } from "@conusai-kit/core"
import { repositoryBindings } from "@conusai-kit/data"
import { accountData } from "@conusai-kit/tenancy"
import { ACCOUNT_JOBS, ACCOUNT_PROCEDURES, accountOwnData } from "./adapters/procedures.js"
import { ACCOUNT_ENTITIES } from "./contract/index.js"
import { en, lt } from "./i18n/index.js"
const tables = repositoryBindings(...ACCOUNT_ENTITIES)
export const accountModule = defineModule({
id: "account",
version: "0.1.0",
kit: "^0.1.0",
requires: ["tenancy", "auth"],
procedures: ACCOUNT_PROCEDURES,
repositories: { postgres: tables, convex: tables },
migrations: { postgres: "migrations" },
// Both profiles. On Convex the tables come from the entities (convex/schema.ts), the export and the
// deletion are generated actions whose store is one internal query or mutation per step
// (convex/account.ts), and the sweep is a Convex cron instead of the worker's job.
profiles: ["postgres", "convex"],
jobs: ACCOUNT_JOBS,
extends: [contribute(accountData, [accountOwnData])],
i18n: { en, lt },
})