change semantics

Update README deployment steps and add deploy:secrets script to package.json

update local inference script and README

update lockfile

reconfigure package scripts for development

update test execution

pass server tests

Update README with revised Bun commands and workspace details

remove pnpm package manager designator

create bun server
This commit is contained in:
geoffsee
2025-06-02 18:41:16 -04:00
committed by Geoff Seemueller
parent 1055cda2f1
commit 497eb22ad8
218 changed files with 1273 additions and 4987 deletions

View File

@@ -0,0 +1,57 @@
// ContactService.ts
import { types, flow, getSnapshot } from "mobx-state-tree";
import ContactRecord from "../models/ContactRecord.ts";
export default types
.model("ContactStore", {})
.volatile((self) => ({
env: {} as Env,
ctx: {} as ExecutionContext,
}))
.actions((self) => ({
setEnv(env: Env) {
self.env = env;
},
setCtx(ctx: ExecutionContext) {
self.ctx = ctx;
},
handleContact: flow(function* (request: Request) {
try {
const {
markdown: message,
email,
firstname,
lastname,
} = yield request.json();
const contactRecord = ContactRecord.create({
message,
timestamp: new Date().toISOString(),
email,
firstname,
lastname,
});
const contactId = crypto.randomUUID();
yield self.env.KV_STORAGE.put(
`contact:${contactId}`,
JSON.stringify(getSnapshot(contactRecord)),
);
yield self.env.EMAIL_SERVICE.sendMail({
to: "geoff@seemueller.io",
plaintextMessage: `WEBSITE CONTACT FORM SUBMISSION
${firstname} ${lastname}
${email}
${message}`,
});
return new Response("Contact record saved successfully", {
status: 200,
});
} catch (error) {
console.error("Error processing contact request:", error);
return new Response("Failed to process contact request", {
status: 500,
});
}
}),
}));