@objectstack/objectql 0.9.1 → 1.0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @objectstack/objectql
2
2
 
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - Major version release for ObjectStack Protocol v1.0.
8
+ - Stabilized Protocol Definitions
9
+ - Enhanced Runtime Plugin Support
10
+ - Fixed Type Compliance across Monorepo
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+ - @objectstack/spec@1.0.0
16
+ - @objectstack/core@1.0.0
17
+ - @objectstack/types@1.0.0
18
+
19
+ ## 0.9.2
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies
24
+ - @objectstack/spec@0.9.2
25
+ - @objectstack/core@0.9.2
26
+ - @objectstack/types@0.9.2
27
+
3
28
  ## 0.9.1
4
29
 
5
30
  ### Patch Changes
package/README.md CHANGED
@@ -1,374 +1,23 @@
1
- # ObjectQL Engine
1
+ # @objectstack/objectql
2
2
 
3
- **ObjectQL** is a schema-driven, cross-datasource query engine for the [ObjectStack](https://github.com/steedos/objectstack) ecosystem. It acts as a virtual "Meta-Database" that unifies access to SQL, NoSQL, and API data sources under a single semantic layer.
3
+ The **Data Engine** for ObjectStack. It acts as a semantic layer between your application code and the underlying database.
4
4
 
5
5
  ## Features
6
6
 
7
- - **Protocol Agnostic**: Uses standard `ObjectSchema` and `QueryAST` from `@objectstack/spec`.
8
- - **Cross-Datasource**: Routes queries to the correct driver (Postgres, MongoDB, Redis, etc.) based on Object definition.
9
- - **Unified API**: Single `find`, `insert`, `update`, `delete` API regardless of the underlying storage.
10
- - **Plugin System**: Load objects and logic via standard Manifests.
11
- - **Middleware**: (Planned) Support for Hooks and Validators.
7
+ - **Universal API**: A consistent query interface (`find`, `insert`, `update`, `delete`) regardless of the storage backend.
8
+ - **Schema Validation**: Enforces Zod schemas defined in `@objectstack/spec`.
9
+ - **Query Resolution**: Translates ObjectStack queries into driver-specific commands.
10
+ - **Driver Architecture**: Pluggable storage (Memory, MongoDB, SQL, etc.).
12
11
 
13
12
  ## Usage
14
13
 
15
- ### 1. Standalone Usage
16
-
17
14
  ```typescript
18
15
  import { ObjectQL } from '@objectstack/objectql';
19
- import { InMemoryDriver } from '@objectstack/driver-memory'; // Note: Package name might export InMemoryDriver now
20
-
21
- async function main() {
22
- // 1. Initialize Engine
23
- const ql = new ObjectQL();
24
-
25
- // 2. Register Drivers
26
- const memDriver = new InMemoryDriver({ name: 'default' });
27
- ql.registerDriver(memDriver, true);
28
-
29
- // 3. Load Schema (via Plugin/Manifest)
30
- await ql.use({
31
- name: 'my-app',
32
- objects: [
33
- {
34
- name: 'todo',
35
- fields: {
36
- title: { type: 'text' },
37
- completed: { type: 'boolean' }
38
- },
39
- datasource: 'default'
40
- }
41
- ]
42
- });
43
-
44
- await ql.init();
45
-
46
- // 4. Execute Queries
47
- // Insert
48
- await ql.insert('todo', { title: 'Buy Milk', completed: false });
49
-
50
- // Find (Simple)
51
- const todos = await ql.find('todo', { completed: false });
52
-
53
- // Find (Advanced AST)
54
- const results = await ql.find('todo', {
55
- where: {
56
- title: { $contains: 'Milk' }
57
- },
58
- limit: 10,
59
- orderBy: [{ field: 'title', order: 'desc' }]
60
- });
61
-
62
- console.log(results);
63
- }
64
- ```
65
-
66
- ### 2. Using with ObjectKernel (Recommended)
67
-
68
- When building full applications, use the `ObjectKernel` to manage plugins and configuration.
69
16
 
70
- ```typescript
71
- import { ObjectKernel } from '@objectstack/core';
72
- import { DriverPlugin } from '@objectstack/runtime';
73
- import { ObjectQLPlugin } from '@objectstack/objectql';
74
- import { InMemoryDriver } from '@objectstack/driver-memory';
75
-
76
- const kernel = new ObjectKernel();
77
-
78
- // Register Engine and Drivers as Kernel Plugins
79
- kernel.use(new ObjectQLPlugin())
80
- .use(new DriverPlugin(new InMemoryDriver(), 'default'));
81
-
82
- await kernel.bootstrap();
83
-
84
- // The engine automatically discovers drivers and apps registered in the kernel.
85
- ```
86
-
87
- ## Architecture
88
-
89
- - **SchemaRegistry**: Central store for all metadata (Objects, Apps, Config).
90
- - **DriverRegistry**: Manages connections to physical data sources.
91
- - **QueryPlanner**: (Internal) Normalizes simplified queries into `QueryAST`.
92
- - **Executor**: Routes AST to the correct driver.
93
-
94
- ## Advanced Examples
95
-
96
- ### Complex Queries
97
-
98
- ```typescript
99
- // Filtering with multiple conditions
100
- const activeTasks = await ql.find('todo_task', {
101
- where: {
102
- $and: [
103
- { status: 'active' },
104
- { priority: { $gte: 3 } },
105
- { due_date: { $lte: new Date() } }
106
- ]
107
- },
108
- orderBy: [
109
- { field: 'priority', order: 'desc' },
110
- { field: 'due_date', order: 'asc' }
111
- ],
112
- limit: 50
17
+ // Querying data
18
+ const engine = kernel.getService('objectql');
19
+ const users = await engine.find('user', {
20
+ where: { role: 'admin' },
21
+ top: 10
113
22
  });
114
-
115
- // Text search
116
- const searchResults = await ql.find('todo_task', {
117
- where: {
118
- $or: [
119
- { title: { $contains: 'urgent' } },
120
- { description: { $contains: 'urgent' } }
121
- ]
122
- }
123
- });
124
-
125
- // Nested conditions
126
- const complexQuery = await ql.find('project', {
127
- where: {
128
- $and: [
129
- { status: { $in: ['active', 'planning'] } },
130
- {
131
- $or: [
132
- { budget: { $gt: 100000 } },
133
- { priority: { $eq: 1 } }
134
- ]
135
- }
136
- ]
137
- }
138
- });
139
- ```
140
-
141
- ### Batch Operations
142
-
143
- ```typescript
144
- // Batch insert
145
- const newTasks = [
146
- { title: 'Task 1', priority: 1 },
147
- { title: 'Task 2', priority: 2 },
148
- { title: 'Task 3', priority: 3 }
149
- ];
150
-
151
- for (const task of newTasks) {
152
- await ql.insert('todo_task', task);
153
- }
154
-
155
- // Batch update
156
- const tasksToUpdate = await ql.find('todo_task', {
157
- where: { status: 'pending' }
158
- });
159
-
160
- for (const task of tasksToUpdate) {
161
- await ql.update('todo_task', task.id, {
162
- status: 'in_progress',
163
- started_at: new Date()
164
- });
165
- }
166
23
  ```
167
-
168
- ### Working with Relationships
169
-
170
- ```typescript
171
- // One-to-Many: Get project with tasks
172
- const project = await ql.find('project', {
173
- where: { id: 'proj_123' },
174
- include: ['tasks'] // Assumes 'tasks' is a relation field
175
- });
176
-
177
- // Many-to-One: Get task with project details
178
- const task = await ql.find('todo_task', {
179
- where: { id: 'task_456' },
180
- include: ['project']
181
- });
182
-
183
- // Manual join (when driver doesn't support relations)
184
- const tasks = await ql.find('todo_task', {
185
- where: { project_id: 'proj_123' }
186
- });
187
-
188
- const project = await ql.find('project', {
189
- where: { id: 'proj_123' }
190
- });
191
-
192
- const projectWithTasks = {
193
- ...project[0],
194
- tasks: tasks
195
- };
196
- ```
197
-
198
- ### Aggregations
199
-
200
- ```typescript
201
- // Count records
202
- const totalTasks = await ql.count('todo_task', {
203
- where: { status: 'active' }
204
- });
205
-
206
- // Sum (if driver supports)
207
- const totalBudget = await ql.aggregate('project', {
208
- operation: 'sum',
209
- field: 'budget',
210
- where: { status: 'active' }
211
- });
212
-
213
- // Group by (if driver supports)
214
- const tasksByStatus = await ql.aggregate('todo_task', {
215
- operation: 'count',
216
- groupBy: ['status']
217
- });
218
- ```
219
-
220
- ### Multi-Datasource Queries
221
-
222
- ```typescript
223
- import { PostgresDriver } from '@objectstack/driver-postgres';
224
- import { MongoDBDriver } from '@objectstack/driver-mongodb';
225
- import { RedisDriver } from '@objectstack/driver-redis';
226
-
227
- const ql = new ObjectQL();
228
-
229
- // Register multiple drivers
230
- const pgDriver = new PostgresDriver({ connectionString: 'postgres://...' });
231
- const mongoDriver = new MongoDBDriver({ url: 'mongodb://...' });
232
- const redisDriver = new RedisDriver({ host: 'localhost' });
233
-
234
- ql.registerDriver(pgDriver, false, 'postgres');
235
- ql.registerDriver(mongoDriver, false, 'mongodb');
236
- ql.registerDriver(redisDriver, false, 'redis');
237
-
238
- // Configure objects to use different datasources
239
- await ql.use({
240
- name: 'multi-db-app',
241
- objects: [
242
- {
243
- name: 'user',
244
- datasource: 'postgres', // Users in PostgreSQL
245
- fields: { /* ... */ }
246
- },
247
- {
248
- name: 'product',
249
- datasource: 'mongodb', // Products in MongoDB
250
- fields: { /* ... */ }
251
- },
252
- {
253
- name: 'session',
254
- datasource: 'redis', // Sessions in Redis
255
- fields: { /* ... */ }
256
- }
257
- ]
258
- });
259
-
260
- await ql.init();
261
-
262
- // Query automatically routes to correct datasource
263
- const users = await ql.find('user'); // → PostgreSQL
264
- const products = await ql.find('product'); // → MongoDB
265
- const sessions = await ql.find('session'); // → Redis
266
- ```
267
-
268
- ### Custom Hooks and Middleware
269
-
270
- ```typescript
271
- // Register hooks for data operations
272
- ql.registerHook('beforeInsert', async (ctx) => {
273
- console.log(`Creating ${ctx.object}:`, ctx.data);
274
-
275
- // Add timestamps
276
- ctx.data.created_at = new Date();
277
- ctx.data.updated_at = new Date();
278
-
279
- // Validate
280
- if (ctx.object === 'user' && !ctx.data.email) {
281
- throw new Error('Email is required');
282
- }
283
- });
284
-
285
- ql.registerHook('afterInsert', async (ctx) => {
286
- console.log(`Created ${ctx.object}:`, ctx.result);
287
-
288
- // Trigger events - get event bus from kernel or context
289
- // Note: eventBus should be injected or accessed from context
290
- const eventBus = ctx.getService?.('event-bus');
291
- if (eventBus) {
292
- await eventBus.emit('data:created', {
293
- object: ctx.object,
294
- id: ctx.result.id
295
- });
296
- }
297
- });
298
-
299
- ql.registerHook('beforeUpdate', async (ctx) => {
300
- // Update timestamp
301
- ctx.data.updated_at = new Date();
302
- });
303
-
304
- ql.registerHook('beforeDelete', async (ctx) => {
305
- // Soft delete
306
- if (ctx.object === 'user') {
307
- throw new Error('Cannot delete users, use deactivate instead');
308
- }
309
- });
310
- ```
311
-
312
- ### Transaction Support
313
-
314
- ```typescript
315
- // If driver supports transactions
316
- const driver = ql.getDriver('default');
317
-
318
- if (driver.supports.transactions) {
319
- await driver.beginTransaction();
320
-
321
- try {
322
- await ql.insert('order', {
323
- customer_id: 'cust_123',
324
- total: 100.00
325
- });
326
-
327
- await ql.update('inventory', 'inv_456', {
328
- quantity: { $decrement: 1 }
329
- });
330
-
331
- await driver.commitTransaction();
332
- } catch (error) {
333
- await driver.rollbackTransaction();
334
- throw error;
335
- }
336
- }
337
- ```
338
-
339
- ### Schema Migration
340
-
341
- ```typescript
342
- // Add new field to existing object
343
- const currentSchema = ql.getSchema('todo_task');
344
-
345
- const updatedSchema = {
346
- ...currentSchema,
347
- fields: {
348
- ...currentSchema.fields,
349
- assignee: {
350
- type: 'lookup',
351
- reference: 'user',
352
- label: 'Assignee'
353
- }
354
- }
355
- };
356
-
357
- // Re-register schema
358
- ql.registerObject(updatedSchema);
359
-
360
- // Driver might need to sync schema
361
- const driver = ql.getDriver('default');
362
- if (driver.syncSchema) {
363
- await driver.syncSchema('todo_task', updatedSchema);
364
- }
365
- ```
366
-
367
- ## Roadmap
368
-
369
- - [x] Basic CRUD
370
- - [x] Driver Routing
371
- - [ ] Cross-Object Joins (Federation)
372
- - [ ] Validation Layer (Zod)
373
- - [ ] Access Control (ACL)
374
- - [ ] Caching Layer
package/dist/engine.d.ts CHANGED
@@ -15,6 +15,9 @@ export interface ObjectQLHostContext {
15
15
  * ObjectQL Engine
16
16
  *
17
17
  * Implements the IDataEngine interface for data persistence.
18
+ * Acts as the reference implementation for:
19
+ * - CoreServiceName.data (CRUD)
20
+ * - CoreServiceName.metadata (Schema Registry)
18
21
  */
19
22
  export declare class ObjectQL implements IDataEngine {
20
23
  private drivers;
@@ -23,6 +26,16 @@ export declare class ObjectQL implements IDataEngine {
23
26
  private hooks;
24
27
  private hostContext;
25
28
  constructor(hostContext?: Record<string, any>);
29
+ /**
30
+ * Service Status Report
31
+ * Used by Kernel to verify health and capabilities.
32
+ */
33
+ getStatus(): {
34
+ name: "data";
35
+ status: string;
36
+ version: string;
37
+ features: string[];
38
+ };
26
39
  /**
27
40
  * Expose the SchemaRegistry for plugins to register metadata
28
41
  */
@@ -50,13 +63,8 @@ export declare class ObjectQL implements IDataEngine {
50
63
  * Helper to get object definition
51
64
  */
52
65
  getSchema(objectName: string): {
53
- name: string;
54
- active: boolean;
55
- isSystem: boolean;
56
- abstract: boolean;
57
- datasource: string;
58
66
  fields: Record<string, {
59
- type: "number" | "boolean" | "tags" | "formula" | "date" | "lookup" | "file" | "code" | "text" | "textarea" | "email" | "url" | "phone" | "password" | "markdown" | "html" | "richtext" | "currency" | "percent" | "datetime" | "time" | "toggle" | "select" | "multiselect" | "radio" | "checkboxes" | "master_detail" | "tree" | "image" | "avatar" | "video" | "audio" | "summary" | "autonumber" | "location" | "address" | "json" | "color" | "rating" | "slider" | "signature" | "qrcode" | "progress" | "vector";
67
+ type: "number" | "boolean" | "code" | "date" | "lookup" | "text" | "textarea" | "email" | "url" | "phone" | "password" | "markdown" | "html" | "richtext" | "currency" | "percent" | "datetime" | "time" | "toggle" | "select" | "multiselect" | "radio" | "checkboxes" | "master_detail" | "tree" | "image" | "file" | "avatar" | "video" | "audio" | "formula" | "summary" | "autonumber" | "location" | "address" | "json" | "color" | "rating" | "slider" | "signature" | "qrcode" | "progress" | "tags" | "vector";
60
68
  required: boolean;
61
69
  searchable: boolean;
62
70
  multiple: boolean;
@@ -68,34 +76,52 @@ export declare class ObjectQL implements IDataEngine {
68
76
  encryption: boolean;
69
77
  index: boolean;
70
78
  externalId: boolean;
71
- name?: string | undefined;
79
+ options?: {
80
+ value: string;
81
+ label: string;
82
+ color?: string | undefined;
83
+ default?: boolean | undefined;
84
+ }[] | undefined;
85
+ expression?: string | undefined;
86
+ defaultValue?: any;
87
+ min?: number | undefined;
88
+ max?: number | undefined;
89
+ step?: number | undefined;
90
+ language?: string | undefined;
91
+ encryptionConfig?: {
92
+ enabled: boolean;
93
+ algorithm: "aes-256-gcm" | "aes-256-cbc" | "chacha20-poly1305";
94
+ keyManagement: {
95
+ provider: "local" | "aws-kms" | "azure-key-vault" | "gcp-kms" | "hashicorp-vault";
96
+ keyId?: string | undefined;
97
+ rotationPolicy?: {
98
+ enabled: boolean;
99
+ frequencyDays: number;
100
+ retainOldVersions: number;
101
+ autoRotate: boolean;
102
+ } | undefined;
103
+ };
104
+ scope: "table" | "field" | "database" | "record";
105
+ deterministicEncryption: boolean;
106
+ searchableEncryption: boolean;
107
+ } | undefined;
108
+ formula?: string | undefined;
72
109
  label?: string | undefined;
110
+ precision?: number | undefined;
111
+ name?: string | undefined;
73
112
  description?: string | undefined;
74
113
  format?: string | undefined;
75
- defaultValue?: any;
76
114
  maxLength?: number | undefined;
77
115
  minLength?: number | undefined;
78
- precision?: number | undefined;
79
116
  scale?: number | undefined;
80
- min?: number | undefined;
81
- max?: number | undefined;
82
- options?: {
83
- label: string;
84
- value: string;
85
- color?: string | undefined;
86
- default?: boolean | undefined;
87
- }[] | undefined;
88
117
  reference?: string | undefined;
89
118
  referenceFilters?: string[] | undefined;
90
119
  writeRequiresMasterRead?: boolean | undefined;
91
- expression?: string | undefined;
92
- formula?: string | undefined;
93
120
  summaryOperations?: {
94
121
  object: string;
122
+ function: "count" | "sum" | "avg" | "min" | "max";
95
123
  field: string;
96
- function: "min" | "max" | "count" | "sum" | "avg";
97
124
  } | undefined;
98
- language?: string | undefined;
99
125
  theme?: string | undefined;
100
126
  lineNumbers?: boolean | undefined;
101
127
  maxRating?: number | undefined;
@@ -106,7 +132,6 @@ export declare class ObjectQL implements IDataEngine {
106
132
  colorFormat?: "hex" | "rgb" | "rgba" | "hsl" | undefined;
107
133
  allowAlpha?: boolean | undefined;
108
134
  presetColors?: string[] | undefined;
109
- step?: number | undefined;
110
135
  showValue?: boolean | undefined;
111
136
  marks?: Record<string, string> | undefined;
112
137
  barcodeFormat?: "qr" | "ean13" | "ean8" | "code128" | "code39" | "upca" | "upce" | undefined;
@@ -115,7 +140,7 @@ export declare class ObjectQL implements IDataEngine {
115
140
  allowScanning?: boolean | undefined;
116
141
  currencyConfig?: {
117
142
  precision: number;
118
- currencyMode: "fixed" | "dynamic";
143
+ currencyMode: "dynamic" | "fixed";
119
144
  defaultCurrency: string;
120
145
  } | undefined;
121
146
  vectorConfig?: {
@@ -149,9 +174,9 @@ export declare class ObjectQL implements IDataEngine {
149
174
  storageBucket?: string | undefined;
150
175
  storagePrefix?: string | undefined;
151
176
  imageValidation?: {
177
+ autoRotate: boolean;
152
178
  generateThumbnails: boolean;
153
179
  preserveMetadata: boolean;
154
- autoRotate: boolean;
155
180
  minWidth?: number | undefined;
156
181
  maxWidth?: number | undefined;
157
182
  minHeight?: number | undefined;
@@ -166,26 +191,9 @@ export declare class ObjectQL implements IDataEngine {
166
191
  } | undefined;
167
192
  maxVersions?: number | undefined;
168
193
  } | undefined;
169
- encryptionConfig?: {
170
- enabled: boolean;
171
- algorithm: "aes-256-gcm" | "aes-256-cbc" | "chacha20-poly1305";
172
- keyManagement: {
173
- provider: "local" | "aws-kms" | "azure-key-vault" | "gcp-kms" | "hashicorp-vault";
174
- keyId?: string | undefined;
175
- rotationPolicy?: {
176
- enabled: boolean;
177
- frequencyDays: number;
178
- retainOldVersions: number;
179
- autoRotate: boolean;
180
- } | undefined;
181
- };
182
- scope: "field" | "table" | "record" | "database";
183
- deterministicEncryption: boolean;
184
- searchableEncryption: boolean;
185
- } | undefined;
186
194
  maskingRule?: {
187
195
  field: string;
188
- strategy: "hash" | "redact" | "partial" | "tokenize" | "randomize" | "nullify" | "substitute";
196
+ strategy: "partial" | "hash" | "redact" | "tokenize" | "randomize" | "nullify" | "substitute";
189
197
  preserveFormat: boolean;
190
198
  preserveLength: boolean;
191
199
  pattern?: string | undefined;
@@ -207,18 +215,28 @@ export declare class ObjectQL implements IDataEngine {
207
215
  } | undefined;
208
216
  } | undefined;
209
217
  }>;
218
+ name: string;
219
+ active: boolean;
220
+ isSystem: boolean;
221
+ abstract: boolean;
222
+ datasource: string;
223
+ search?: {
224
+ fields: string[];
225
+ displayFields?: string[] | undefined;
226
+ filters?: string[] | undefined;
227
+ } | undefined;
228
+ tags?: string[] | undefined;
210
229
  label?: string | undefined;
211
- pluralLabel?: string | undefined;
212
230
  description?: string | undefined;
231
+ pluralLabel?: string | undefined;
213
232
  icon?: string | undefined;
214
- tags?: string[] | undefined;
215
233
  tableName?: string | undefined;
216
234
  indexes?: {
217
- fields: string[];
218
235
  type: "hash" | "btree" | "gin" | "gist" | "fulltext";
236
+ fields: string[];
219
237
  unique: boolean;
220
- name?: string | undefined;
221
238
  partial?: string | undefined;
239
+ name?: string | undefined;
222
240
  }[] | undefined;
223
241
  tenancy?: {
224
242
  enabled: boolean;
@@ -245,20 +263,15 @@ export declare class ObjectQL implements IDataEngine {
245
263
  } | undefined;
246
264
  cdc?: {
247
265
  enabled: boolean;
248
- events: ("update" | "delete" | "insert")[];
266
+ events: ("insert" | "update" | "delete")[];
249
267
  destination: string;
250
268
  } | undefined;
251
269
  validations?: any[] | undefined;
252
270
  titleFormat?: string | undefined;
253
271
  compactLayout?: string[] | undefined;
254
- search?: {
255
- fields: string[];
256
- displayFields?: string[] | undefined;
257
- filters?: string[] | undefined;
258
- } | undefined;
259
272
  enable?: {
260
- trackHistory: boolean;
261
273
  searchable: boolean;
274
+ trackHistory: boolean;
262
275
  apiEnabled: boolean;
263
276
  files: boolean;
264
277
  feeds: boolean;
@@ -266,7 +279,7 @@ export declare class ObjectQL implements IDataEngine {
266
279
  trash: boolean;
267
280
  mru: boolean;
268
281
  clone: boolean;
269
- apiMethods?: ("search" | "list" | "update" | "delete" | "get" | "create" | "upsert" | "bulk" | "aggregate" | "history" | "restore" | "purge" | "import" | "export")[] | undefined;
282
+ apiMethods?: ("search" | "update" | "delete" | "get" | "list" | "create" | "upsert" | "bulk" | "aggregate" | "history" | "restore" | "purge" | "import" | "export")[] | undefined;
270
283
  } | undefined;
271
284
  } | undefined;
272
285
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EAC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@objectstack/core';
2
+ import { CoreServiceName } from '@objectstack/spec/system';
2
3
  import { SchemaRegistry } from './registry.js';
3
4
  /**
4
5
  * ObjectQL Engine
5
6
  *
6
7
  * Implements the IDataEngine interface for data persistence.
8
+ * Acts as the reference implementation for:
9
+ * - CoreServiceName.data (CRUD)
10
+ * - CoreServiceName.metadata (Schema Registry)
7
11
  */
8
12
  export class ObjectQL {
9
13
  constructor(hostContext = {}) {
@@ -23,6 +27,18 @@ export class ObjectQL {
23
27
  this.logger = hostContext.logger || createLogger({ level: 'info', format: 'pretty' });
24
28
  this.logger.info('ObjectQL Engine Instance Created');
25
29
  }
30
+ /**
31
+ * Service Status Report
32
+ * Used by Kernel to verify health and capabilities.
33
+ */
34
+ getStatus() {
35
+ return {
36
+ name: CoreServiceName.enum.data,
37
+ status: 'running',
38
+ version: '0.9.0',
39
+ features: ['crud', 'query', 'aggregate', 'transactions', 'metadata']
40
+ };
41
+ }
26
42
  /**
27
43
  * Expose the SchemaRegistry for plugins to register metadata
28
44
  */