0.6.17 • Published 1 year ago
autoflare v0.6.17
Autoflare
Autoflare is a declarative lightweight library for dynamic error-driven SQL schema synchronization, and automatic management and implementations of various Cloudflare services and features.
Installation
To install Autoflare, run the following command in your terminal:
npm install autoflare
Usage
Declarative Schema Error-driven Synchronization (Note: Can only create)
import { AutoFlareD1, SQLColumn, SQLTable, CURRENT_TIMESTAMP } from "autoflare/d1";
let db: AutoFlareD1 = new AutoFlareD1(YOUR_D1_BINDING);
db.tables.set("user", new SQLTable("user", [
new SQLColumn("uid").binary(16).notNull().unique().index(),
new SQLColumn("username").varchar(32).notNull().unique().index(),
new SQLColumn("email").varchar(64).notNull().unique().index(),
new SQLColumn("display_name").varchar(64).notNull(),
new SQLColumn("hashed_password").varchar(64).notNull(),
new SQLColumn("is_email_verified").boolean().notNull().default(0),
new SQLColumn("updated_at").datetime().notNull().default(CURRENT_TIMESTAMP),
new SQLColumn("created_at").datetime().notNull().default(CURRENT_TIMESTAMP)
]));
const res = await db.exec('SELECT * FROM user WHERE username = ?', [ 'anon' ]);
// Table doesn't exist? It'll be created automatically!
console.log(res.success); // true
Easy MailChannels
import { sendEmail, type EmailContent, Recipient } from "autoflare";
const htmlContent: EmailContent = {
type: "text/html", // or "text/plain"
value: `
<p>Hi, ${name}!</p>
<p>We've come to talk to you about your car's extended warranty.</p>
<p>Just kidding, we're just testing out MailChannels!</p>
<p>Have a nice day!</p>
`
};
return await sendEmail(
[ new Recipient(email, name) ],
"MailChannels Test Email",
[ htmlContent ],
{ email: "noreply@your_app.com", name: "YOUR_APP" }
);
0.6.7
1 year ago
0.6.6
1 year ago
0.6.9
1 year ago
0.6.8
1 year ago
0.6.10
1 year ago
0.6.12
1 year ago
0.6.11
1 year ago
0.6.17
1 year ago
0.6.14
1 year ago
0.6.13
1 year ago
0.6.16
1 year ago
0.6.15
1 year ago
0.6.5
1 year ago
0.6.4
1 year ago
0.5.10
1 year ago
0.5.11
1 year ago
0.5.16
1 year ago
0.5.14
1 year ago
0.5.15
1 year ago
0.5.12
1 year ago
0.5.13
1 year ago
0.6.3
1 year ago
0.6.2
1 year ago
0.6.1
1 year ago
0.6.0
1 year ago
0.5.9
1 year ago
0.5.8
1 year ago
0.5.7
1 year ago
0.5.6
1 year ago
0.5.5
1 year ago
0.5.4
1 year ago
0.5.3
1 year ago
0.5.2
1 year ago
0.5.1
1 year ago
0.5.0
1 year ago
0.4.9
1 year ago
0.4.8
1 year ago
0.4.7
1 year ago
0.4.6
1 year ago
0.4.5
1 year ago
0.4.4
1 year ago
0.4.3
1 year ago
0.4.2
1 year ago