postgresdk 0.4.0 → 0.5.1-alpha.0

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.
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Core database operations that are framework-agnostic.
3
+ * These functions handle the actual database logic and can be used by any framework adapter.
4
+ */
5
+ export interface DatabaseClient {
6
+ query: (text: string, params?: any[]) => Promise<{
7
+ rows: any[];
8
+ }>;
9
+ }
10
+ export interface OperationContext {
11
+ pg: DatabaseClient;
12
+ table: string;
13
+ pkColumns: string[];
14
+ softDeleteColumn?: string | null;
15
+ includeDepthLimit: number;
16
+ }
17
+ /**
18
+ * CREATE operation - Insert a new record
19
+ */
20
+ export declare function createRecord(ctx: OperationContext, data: Record<string, any>): Promise<{
21
+ data?: any;
22
+ error?: string;
23
+ issues?: any;
24
+ status: number;
25
+ }>;
26
+ /**
27
+ * READ operation - Get a record by primary key
28
+ */
29
+ export declare function getByPk(ctx: OperationContext, pkValues: any[]): Promise<{
30
+ data?: any;
31
+ error?: string;
32
+ status: number;
33
+ }>;
34
+ /**
35
+ * LIST operation - Get multiple records with optional filters
36
+ */
37
+ export declare function listRecords(ctx: OperationContext, params: {
38
+ limit?: number;
39
+ offset?: number;
40
+ include?: any;
41
+ }): Promise<{
42
+ data?: any;
43
+ error?: string;
44
+ issues?: any;
45
+ needsIncludes?: boolean;
46
+ includeSpec?: any;
47
+ status: number;
48
+ }>;
49
+ /**
50
+ * UPDATE operation - Update a record by primary key
51
+ */
52
+ export declare function updateRecord(ctx: OperationContext, pkValues: any[], updateData: Record<string, any>): Promise<{
53
+ data?: any;
54
+ error?: string;
55
+ issues?: any;
56
+ status: number;
57
+ }>;
58
+ /**
59
+ * DELETE operation - Delete or soft-delete a record by primary key
60
+ */
61
+ export declare function deleteRecord(ctx: OperationContext, pkValues: any[]): Promise<{
62
+ data?: any;
63
+ error?: string;
64
+ status: number;
65
+ }>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Emits the core operations module that contains framework-agnostic database logic
3
+ */
4
+ export declare function emitCoreOperations(): string;
@@ -6,4 +6,4 @@ import type { Model } from "./introspect";
6
6
  * - Loads children in batches per edge kind
7
7
  * - Stitches onto parent rows (mutates copies)
8
8
  */
9
- export declare function emitIncludeLoader(graph: Graph, model: Model, maxDepth: number): string;
9
+ export declare function emitIncludeLoader(graph: Graph, model: Model, maxDepth: number, useJsExtensions?: boolean): string;
@@ -0,0 +1,5 @@
1
+ import type { Table } from "./introspect";
2
+ /**
3
+ * Emits the Hono server router file that exports helper functions for route registration
4
+ */
5
+ export declare function emitHonoRouter(tables: Table[], hasAuth: boolean, useJsExtensions?: boolean): string;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Hono-specific route generation that uses core operations
3
+ */
4
+ import type { Table } from "./introspect";
5
+ import type { Graph } from "./rel-classify";
6
+ export declare function emitHonoRoutes(table: Table, _graph: Graph, opts: {
7
+ softDeleteColumn: string | null;
8
+ includeDepthLimit: number;
9
+ authStrategy?: string;
10
+ useJsExtensions?: boolean;
11
+ }): string;