@@ -39,69 +39,19 @@ export const DataEngineQueryOptionsSchema = z.object({
3939 * Data Engine Interface Schema
4040 *
4141 * Defines the contract for data engine implementations.
42+ * (Deprecated: Moved to @objectstack/core/contracts/data-engine)
4243 */
44+ /*
4345export const DataEngineSchema = z.object({
44- /**
45- * Insert a new record
46- *
47- * @param objectName - Name of the object/table (e.g., 'user', 'order')
48- * @param data - Data to insert
49- * @returns Promise resolving to the created record (including generated ID)
50- */
51- insert : z . function ( )
52- . args ( z . string ( ) , z . any ( ) )
53- . returns ( z . promise ( z . any ( ) ) )
54- . describe ( 'Insert a new record' ) ,
55-
56- /**
57- * Find records matching a query
58- *
59- * @param objectName - Name of the object/table
60- * @param query - Query conditions (optional)
61- * @returns Promise resolving to an array of matching records
62- */
63- find : z . function ( )
64- . args ( z . string ( ) )
65- . returns ( z . promise ( z . array ( z . any ( ) ) ) )
66- . describe ( 'Find records matching a query' ) ,
67-
68- /**
69- * Update a record by ID
70- *
71- * @param objectName - Name of the object/table
72- * @param id - Record ID
73- * @param data - Updated data (partial update)
74- * @returns Promise resolving to the updated record
75- */
76- update : z . function ( )
77- . args ( z . string ( ) , z . any ( ) , z . any ( ) )
78- . returns ( z . promise ( z . any ( ) ) )
79- . describe ( 'Update a record by ID' ) ,
80-
81- /**
82- * Delete a record by ID
83- *
84- * @param objectName - Name of the object/table
85- * @param id - Record ID
86- * @returns Promise resolving to true if deleted, false otherwise
87- */
88- delete : z . function ( )
89- . args ( z . string ( ) , z . any ( ) )
90- . returns ( z . promise ( z . boolean ( ) ) )
91- . describe ( 'Delete a record by ID' ) ,
46+ ...
9247}).describe('Data Engine Interface');
48+ */
9349
9450/**
9551 * TypeScript types derived from schemas
9652 */
9753export type DataEngineFilter = z . infer < typeof DataEngineFilterSchema > ;
9854export type DataEngineQueryOptions = z . infer < typeof DataEngineQueryOptionsSchema > ;
9955
100- // Define the TypeScript interface manually for better type safety
101- // Zod function schema doesn't handle optional parameters well
102- export interface IDataEngine {
103- insert ( objectName : string , data : any ) : Promise < any > ;
104- find ( objectName : string , query ?: DataEngineQueryOptions ) : Promise < any [ ] > ;
105- update ( objectName : string , id : any , data : any ) : Promise < any > ;
106- delete ( objectName : string , id : any ) : Promise < boolean > ;
107- }
56+ // Moved IDataEngine interface to @objectstack /core to separate runtime contract from data schema
57+ // Moved IDataEngine interface to @objectstack /core to separate runtime contract from data schema
0 commit comments