Skip to content
Merged
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ for await (const p of profiles.all()) { ... }
await profiles.remove(userId);
```

A hand-written adapter is `{ dialect: "postgres" | "sqlite", query(text, params) }` and receives `?` placeholders. A Postgres client wrapped to look like `@libsql/client` (anything with `execute()` that is not `@profullstack/libsql-pg`) is taken for SQLite: pass `dialect: "postgres"`.

There is no foreign key to a users table: the host's may be named anything or live elsewhere. Deleting a user is the host's job, so call `remove()` there.

## CLI and MCP
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@profullstack/profile",
"version": "0.1.1",
"version": "0.1.2",
"type": "module",
"description": "One user profile for every property: email, first_name, last_name, company_domain, job_title, linkedin_url. Validation, signup form fields, storage on Postgres/Turso/Supabase, HTTP handlers, CSV export, CLI and MCP.",
"keywords": [
Expand Down
16 changes: 12 additions & 4 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ import {
csvRow,
} from "./index.js";

const VERSION = "0.1.1";
const VERSION = "0.1.2";

const USAGE = `profile - signup profile fields (${COLUMNS.join(", ")})

profile migrate create the table, or add missing columns
profile schema [--dialect sqlite] print the DDL for a migration file
profile schema [--dialect sqlite] [--key-type text]
print the DDL for a migration file
profile get <user-id> one profile
profile find <email> look a profile up by email
profile set <user-id> --first-name Ada --company-domain acme.com ...
Expand Down Expand Up @@ -60,7 +61,7 @@ function parseArgs(argv) {

/** Flags named like the fields (or their aliases) become a profile input. */
function fieldFlags(flags) {
const skip = new Set(["table", "key", "format", "out", "since", "complete", "dialect", "help", "json"]);
const skip = new Set(["table", "key", "key_type", "format", "out", "since", "complete", "dialect", "help", "json"]);
return Object.fromEntries(Object.entries(flags).filter(([k]) => !skip.has(k)));
}

Expand Down Expand Up @@ -239,7 +240,14 @@ if (cmd === "mcp") {
process.exit(0);
}
if (cmd === "schema") {
print(schemaSql({ dialect: flags.dialect === "sqlite" ? "sqlite" : "postgres", table: flags.table, key: flags.key }));
print(
schemaSql({
dialect: flags.dialect === "sqlite" ? "sqlite" : "postgres",
table: flags.table,
key: flags.key,
keyType: flags.key_type,
}),
);
process.exit(0);
}
if (cmd === "check") {
Expand Down
Loading