create-mikstack 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-mikstack",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,9 +19,9 @@
19
19
  "zero:start": "zero-cache-dev"
20
20
  },
21
21
  "dependencies": {
22
- "@mikstack/email": "^0.1.0",
22
+ "@mikstack/email": "^0.1.1",
23
23
  "@mikstack/form": "^0.1.0",
24
- "@mikstack/notifications": "^0.1.0",
24
+ "@mikstack/notifications": "^0.1.1",
25
25
  "@rocicorp/zero": "^0.25.12",
26
26
  "better-auth": "^1.4.18",
27
27
  "drizzle-orm": "^0.45.1",
@@ -23,7 +23,6 @@ function createAuth() {
23
23
  sendMagicLink: async ({ email, url }) => {
24
24
  await notif.send({
25
25
  type: "magic-link",
26
- userId: email, // before user exists, use email as userId
27
26
  recipientEmail: email,
28
27
  data: { url },
29
28
  });
@@ -5,7 +5,7 @@ export const user = pgTable("user", {
5
5
  id: text("id").primaryKey(),
6
6
  name: text("name").notNull(),
7
7
  email: text("email").notNull().unique(),
8
- emailVerified: timestamp("email_verified"),
8
+ emailVerified: boolean("email_verified").notNull().default(false),
9
9
  image: text("image"),
10
10
  createdAt: timestamp("created_at").notNull().defaultNow(),
11
11
  updatedAt: timestamp("updated_at").notNull().defaultNow(),
@@ -47,8 +47,8 @@ export const verification = pgTable("verification", {
47
47
  identifier: text("identifier").notNull(),
48
48
  value: text("value").notNull(),
49
49
  expiresAt: timestamp("expires_at").notNull(),
50
- createdAt: timestamp("created_at"),
51
- updatedAt: timestamp("updated_at"),
50
+ createdAt: timestamp("created_at").notNull().defaultNow(),
51
+ updatedAt: timestamp("updated_at").notNull().defaultNow(),
52
52
  });
53
53
 
54
54
  // Notification tables (managed by @mikstack/notifications)
@@ -56,9 +56,7 @@ export const notificationDelivery = pgTable("notification_delivery", {
56
56
  id: text("id")
57
57
  .primaryKey()
58
58
  .$defaultFn(() => crypto.randomUUID()),
59
- userId: text("user_id")
60
- .notNull()
61
- .references(() => user.id),
59
+ userId: text("user_id").references(() => user.id),
62
60
  type: text("type").notNull(),
63
61
  channel: text("channel").notNull(),
64
62
  status: text("status", { enum: ["pending", "sent", "delivered", "failed"] })
@@ -15,10 +15,19 @@ export const GET: RequestHandler = async ({ params }) => {
15
15
 
16
16
  if (!delivery?.content) error(404);
17
17
 
18
- const content = delivery.content as { html?: string };
18
+ const content = delivery.content as { html?: string; subject?: string };
19
19
  if (!content.html) error(404, "No HTML content for this delivery");
20
20
 
21
- return new Response(content.html, {
21
+ const escaped = content.html.replaceAll("&", "&").replaceAll('"', """);
22
+ const title = content.subject ? `<title>${content.subject}</title>` : "";
23
+
24
+ const wrapper = `<!DOCTYPE html>
25
+ <html>
26
+ <head><meta charset="utf-8">${title}<style>*{margin:0;padding:0}html,body{height:100%}iframe{width:100%;height:100%;border:none}</style></head>
27
+ <body><iframe srcdoc="${escaped}"></iframe></body>
28
+ </html>`;
29
+
30
+ return new Response(wrapper, {
22
31
  headers: { "content-type": "text/html; charset=utf-8" },
23
32
  });
24
33
  };