Skip to content

Commit adf7365

Browse files
Copilothotlong
andcommitted
fix: Resolve type errors in core package and enhance DriverInterface
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 0d7caaf commit adf7365

3 files changed

Lines changed: 41 additions & 3 deletions

File tree

packages/foundation/core/src/repository.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ export class ObjectRepository {
5656
return undefined;
5757
}
5858

59-
// Backward compatibility: if it's already an array (old format), pass through
59+
// Backward compatibility: if it's already an array (old format), convert to FilterNode
6060
if (Array.isArray(filters)) {
61-
return filters as FilterNode;
61+
return filters as unknown as FilterNode;
6262
}
6363

6464
// If it's an empty object, return undefined
@@ -128,7 +128,7 @@ export class ObjectRepository {
128128
}
129129
}
130130

131-
return nodes.length === 1 ? nodes[0] : nodes;
131+
return (nodes.length === 1 ? nodes[0] : nodes) as unknown as FilterNode;
132132
}
133133

134134
/**

packages/foundation/core/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"rootDir": "src"
66
},
77
"include": ["src/**/*"],
8+
"exclude": ["node_modules", "dist", "../../../node_modules/@objectstack+objectql"],
89
"references": [
910
{ "path": "../types" }
1011
]

packages/objectstack/spec/src/index.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ export interface App {
261261
export interface ObjectStackManifest {
262262
/** Manifest version */
263263
version: string;
264+
/** Manifest ID */
265+
id?: string;
264266
/** Application info */
265267
app?: App;
266268
/** List of objects */
@@ -285,6 +287,41 @@ export interface DriverInterface {
285287
jsonFields?: boolean;
286288
arrayFields?: boolean;
287289
};
290+
/** Connect to the database */
291+
connect?(): Promise<void>;
292+
/** Disconnect from the database */
293+
disconnect?(): Promise<void>;
294+
/** Find records */
295+
find?(objectName: string, query: any, options?: any): Promise<any[]>;
296+
/** Find a single record */
297+
findOne?(objectName: string, id: string | number, query?: any, options?: any): Promise<any>;
298+
/** Create a record */
299+
create?(objectName: string, data: any, options?: any): Promise<any>;
300+
/** Update a record */
301+
update?(objectName: string, id: string | number, data: any, options?: any): Promise<any>;
302+
/** Delete a record */
303+
delete?(objectName: string, id: string | number, options?: any): Promise<any>;
304+
/** Count records */
305+
count?(objectName: string, filters: any, options?: any): Promise<number>;
306+
/** Execute a command */
307+
execute?(command: any, parameters?: any[], options?: any): Promise<any>;
308+
/** Bulk operations */
309+
bulkCreate?(objectName: string, data: any[], options?: any): Promise<any>;
310+
bulkUpdate?(objectName: string, updates: Array<{id: string | number, data: any}>, options?: any): Promise<any>;
311+
bulkDelete?(objectName: string, ids: Array<string | number>, options?: any): Promise<any>;
312+
/** Aggregation */
313+
distinct?(objectName: string, field: string, filters?: any, options?: any): Promise<any[]>;
314+
aggregate?(objectName: string, aggregations: any[], filters?: any, options?: any): Promise<any[]>;
315+
/** Transaction support */
316+
beginTransaction?(): Promise<any>;
317+
commitTransaction?(transaction: any): Promise<void>;
318+
rollbackTransaction?(transaction: any): Promise<void>;
319+
/** Schema initialization */
320+
init?(objects: any[]): Promise<void>;
321+
/** Schema introspection */
322+
introspectSchema?(): Promise<any>;
323+
/** Health check */
324+
checkHealth?(): Promise<boolean>;
288325
}
289326

290327
/**

0 commit comments

Comments
 (0)