Skip to content
Closed
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
1 change: 1 addition & 0 deletions packages/cli/src/utils/api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ export async function apiRequest<T = unknown>(path: string, options: RequestInit

return res.json() as Promise<T>;
}

1 change: 1 addition & 0 deletions packages/cli/src/utils/context-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,3 +282,4 @@ export class ContextGenerator {
return prompt;
}
}

1 change: 1 addition & 0 deletions packages/cli/src/utils/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ export function getServerUrl(): string {
const creds = loadCredentials();
return creds?.server_url ?? "https://api.betterbase.io"; // Falls back to cloud
}

1 change: 1 addition & 0 deletions packages/cli/src/utils/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,4 @@ export function done(startMs: number, msg?: string): void {
const elapsed = ((Date.now() - startMs) / 1000).toFixed(2);
console.log(`\n${chalk.green(sym.success)} ${msg ?? "Done"} ${chalk.dim(`(${elapsed}s)`)}`);
}

1 change: 1 addition & 0 deletions packages/cli/src/utils/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,4 @@ export async function select(options: {

return response.value;
}

1 change: 1 addition & 0 deletions packages/cli/src/utils/provider-prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,3 +299,4 @@ TURSO_AUTH_TOKEN=

return content;
}

1 change: 1 addition & 0 deletions packages/cli/src/utils/route-scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,4 @@ export class RouteScanner {
return undefined;
}
}

1 change: 1 addition & 0 deletions packages/cli/src/utils/scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,3 +345,4 @@ export class SchemaScanner {
};
}
}

1 change: 1 addition & 0 deletions packages/cli/src/utils/schema-scanner.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { SchemaScanner } from "./scanner";
export type { ColumnInfo, TableInfo } from "./scanner";

1 change: 1 addition & 0 deletions packages/cli/src/utils/spinner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ export async function withSpinner<T>(
throw err;
}
}

1 change: 1 addition & 0 deletions packages/shared/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export const CONFIG_FILE_NAME = "betterbase.config.ts";
export const MIGRATIONS_DIR = "drizzle";
export const FUNCTIONS_DIR = "src/functions";
export const POLICIES_DIR = "src/db/policies";

1 change: 1 addition & 0 deletions packages/shared/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ export class UnauthorizedError extends BetterBaseError {
this.name = "UnauthorizedError";
}
}

1 change: 1 addition & 0 deletions packages/shared/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ export {
formatBytes,
serializeError,
} from "./utils";

1 change: 1 addition & 0 deletions packages/shared/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ export interface PaginationParams {
limit?: number;
offset?: number;
}

1 change: 1 addition & 0 deletions packages/shared/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,4 @@ export function formatBytes(bytes: number): string {

return `${Number.parseFloat((bytes / k ** index).toFixed(2))} ${units[index]}`;
}

2 changes: 1 addition & 1 deletion templates/iac/betterbase/cron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
// import { api } from "./_generated/api";
//
// Example: run cleanup every day at midnight UTC
// cron("daily-cleanup", "0 0 * * *", api.mutations.todos.cleanup, {});
// cron("daily-cleanup", "0 0 * * *", api.mutations.todos.cleanup, {});
26 changes: 13 additions & 13 deletions templates/iac/betterbase/mutations/todos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ import { mutation } from "@betterbase/core/iac";
import { v } from "@betterbase/core/iac";

export const createTodo = mutation({
args: { text: v.string() },
handler: async (ctx, args) => {
return ctx.db.insert("todos", { text: args.text, completed: false });
},
args: { text: v.string() },
handler: async (ctx, args) => {
return ctx.db.insert("todos", { text: args.text, completed: false });
},
});

export const toggleTodo = mutation({
args: { id: v.id("todos"), completed: v.boolean() },
handler: async (ctx, args) => {
await ctx.db.patch("todos", args.id, { completed: args.completed });
},
args: { id: v.id("todos"), completed: v.boolean() },
handler: async (ctx, args) => {
await ctx.db.patch("todos", args.id, { completed: args.completed });
},
});

export const deleteTodo = mutation({
args: { id: v.id("todos") },
handler: async (ctx, args) => {
await ctx.db.delete("todos", args.id);
},
});
args: { id: v.id("todos") },
handler: async (ctx, args) => {
await ctx.db.delete("todos", args.id);
},
});
18 changes: 9 additions & 9 deletions templates/iac/betterbase/queries/todos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { query } from "@betterbase/core/iac";
import { v } from "@betterbase/core/iac";

export const listTodos = query({
args: {},
handler: async (ctx) => {
return ctx.db.query("todos").order("desc").take(100).collect();
},
args: {},
handler: async (ctx) => {
return ctx.db.query("todos").order("desc").take(100).collect();
},
});

export const getTodo = query({
args: { id: v.id("todos") },
handler: async (ctx, args) => {
return ctx.db.get("todos", args.id);
},
});
args: { id: v.id("todos") },
handler: async (ctx, args) => {
return ctx.db.get("todos", args.id);
},
});
16 changes: 8 additions & 8 deletions templates/iac/betterbase/schema.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { defineSchema, defineTable, v } from "@betterbase/core/iac";

export default defineSchema({
todos: defineTable({
text: v.string(),
completed: v.boolean(),
authorId: v.optional(v.string()),
})
.index("by_author", ["authorId"])
.index("by_completed", ["completed", "_createdAt"]),
});
todos: defineTable({
text: v.string(),
completed: v.boolean(),
authorId: v.optional(v.string()),
})
.index("by_author", ["authorId"])
.index("by_completed", ["completed", "_createdAt"]),
});
Loading