-
Notifications
You must be signed in to change notification settings - Fork 1
Fix TypeScript compilation errors across core, metadata, and objectql packages #542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -437,13 +437,13 @@ export class ObjectQL implements IDataEngine { | |||||||
| await this.triggerHooks('beforeFind', hookContext); | ||||||||
|
|
||||||||
| try { | ||||||||
| const result = await driver.find(object, hookContext.input.ast, hookContext.input.options); | ||||||||
| const result = await driver.find(object, hookContext.input.ast as QueryAST, hookContext.input.options as any); | ||||||||
|
|
||||||||
| hookContext.event = 'afterFind'; | ||||||||
| hookContext.result = result; | ||||||||
| await this.triggerHooks('afterFind', hookContext); | ||||||||
|
|
||||||||
| return hookContext.result; | ||||||||
| return hookContext.result as any[]; | ||||||||
|
Comment on lines
+440
to
+446
|
||||||||
| } catch (e) { | ||||||||
| this.logger.error('Find operation failed', e as Error, { object }); | ||||||||
| throw e; | ||||||||
|
|
@@ -480,13 +480,13 @@ export class ObjectQL implements IDataEngine { | |||||||
| if (Array.isArray(hookContext.input.data)) { | ||||||||
| // Bulk Create | ||||||||
| if (driver.bulkCreate) { | ||||||||
| result = await driver.bulkCreate(object, hookContext.input.data, hookContext.input.options); | ||||||||
| result = await driver.bulkCreate(object, hookContext.input.data as any[], hookContext.input.options as any); | ||||||||
| } else { | ||||||||
| // Fallback loop | ||||||||
| result = await Promise.all(hookContext.input.data.map((item: any) => driver.create(object, item, hookContext.input.options))); | ||||||||
| result = await Promise.all((hookContext.input.data as any[]).map((item: any) => driver.create(object, item, hookContext.input.options as any))); | ||||||||
| } | ||||||||
| } else { | ||||||||
| result = await driver.create(object, hookContext.input.data, hookContext.input.options); | ||||||||
| result = await driver.create(object, hookContext.input.data, hookContext.input.options as any); | ||||||||
| } | ||||||||
|
Comment on lines
+483
to
490
|
||||||||
|
|
||||||||
| hookContext.event = 'afterInsert'; | ||||||||
|
|
@@ -529,11 +529,11 @@ export class ObjectQL implements IDataEngine { | |||||||
| let result; | ||||||||
| if (hookContext.input.id) { | ||||||||
| // Single update by ID | ||||||||
| result = await driver.update(object, hookContext.input.id, hookContext.input.data, hookContext.input.options); | ||||||||
| result = await driver.update(object, hookContext.input.id as string, hookContext.input.data, hookContext.input.options as any); | ||||||||
|
||||||||
| result = await driver.update(object, hookContext.input.id as string, hookContext.input.data, hookContext.input.options as any); | |
| result = await driver.update(object, hookContext.input.id, hookContext.input.data, hookContext.input.options as any); |
Copilot
AI
Feb 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update hooks are conventionally passed the payload in context.input.doc (per @objectstack/spec), but this implementation uses context.input.data. This makes it easy for hook authors to use the wrong key and have their changes ignored. Consider standardizing on doc (or supporting doc ?? data when reading).
Copilot
AI
Feb 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hookContext.input.id is asserted to string here, but driver IDs are typed as any (and may be numbers/UUID objects depending on the driver). The as string assertion can mislead callers/maintainers and hides mismatches. Prefer leaving it as unknown narrowed/cast to the driver’s expected id type (typically any), or validate/coerce explicitly if a string ID is required.
| result = await driver.delete(object, hookContext.input.id as string, hookContext.input.options as any); | |
| // Pass ID through without falsely asserting it is a string; drivers accept any ID type. | |
| result = await driver.delete(object, hookContext.input.id as any, hookContext.input.options as any); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new Date(response.headers.get('last-modified') || Date.now()).toISOString()will throw aRangeErroriflast-modifiedis present but not parseable as a date. Consider guarding against invalid dates (e.g., checkNumber.isNaN(date.getTime())and omitmtimeor fall back tonew Date().toISOString()).