-
Notifications
You must be signed in to change notification settings - Fork 1
fix: resolve TypeScript compilation errors in ObjectQL engine datasource mapping #1144
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 |
|---|---|---|
|
|
@@ -618,13 +618,14 @@ export class ObjectQL implements IDataEngine { | |
| } | ||
|
|
||
| // 3. Check package's defaultDatasource | ||
| if (object?.packageId) { | ||
| const manifest = this.manifests.get(object.packageId); | ||
| const owner = SchemaRegistry.getObjectOwner(objectName); | ||
| if (owner?.packageId) { | ||
| const manifest = this.manifests.get(owner.packageId); | ||
| if (manifest?.defaultDatasource && manifest.defaultDatasource !== 'default') { | ||
| if (this.drivers.has(manifest.defaultDatasource)) { | ||
| this.logger.debug('Resolved datasource from package manifest', { | ||
| object: objectName, | ||
| package: object.packageId, | ||
| package: owner.packageId, | ||
| datasource: manifest.defaultDatasource | ||
| }); | ||
| return this.drivers.get(manifest.defaultDatasource)!; | ||
|
Comment on lines
+621
to
631
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,11 @@ import type { Auth, BetterAuthOptions } from 'better-auth'; | |
| import { organization } from 'better-auth/plugins/organization'; | ||
| import { twoFactor } from 'better-auth/plugins/two-factor'; | ||
| import { magicLink } from 'better-auth/plugins/magic-link'; | ||
| import type { AuthConfig } from '@objectstack/spec/system'; | ||
| import type { | ||
| AuthConfig, | ||
| EmailAndPasswordConfig, | ||
| AuthPluginConfig, | ||
| } from '@objectstack/spec/system'; | ||
| import type { IDataEngine } from '@objectstack/core'; | ||
| import { createObjectQLAdapterFactory } from './objectql-adapter.js'; | ||
| import { | ||
|
|
@@ -374,20 +378,20 @@ export class AuthManager { | |
| } | ||
|
|
||
| // Extract email/password config (safe fields only) | ||
| const emailPasswordConfig = this.config.emailAndPassword || {}; | ||
| const emailPasswordConfig: Partial<EmailAndPasswordConfig> = this.config.emailAndPassword ?? {}; | ||
| const emailPassword = { | ||
| enabled: emailPasswordConfig.enabled !== false, // Default to true | ||
| disableSignUp: emailPasswordConfig.disableSignUp, | ||
| requireEmailVerification: emailPasswordConfig.requireEmailVerification, | ||
| disableSignUp: emailPasswordConfig.disableSignUp ?? false, | ||
| requireEmailVerification: emailPasswordConfig.requireEmailVerification ?? false, | ||
|
Comment on lines
+381
to
+385
|
||
| }; | ||
|
|
||
| // Extract enabled features | ||
| const pluginConfig = this.config.plugins || {}; | ||
| const pluginConfig: Partial<AuthPluginConfig> = this.config.plugins ?? {}; | ||
| const features = { | ||
| twoFactor: pluginConfig.twoFactor || false, | ||
| passkeys: pluginConfig.passkeys || false, | ||
| magicLink: pluginConfig.magicLink || false, | ||
| organization: pluginConfig.organization || false, | ||
| twoFactor: pluginConfig.twoFactor ?? false, | ||
| passkeys: pluginConfig.passkeys ?? false, | ||
| magicLink: pluginConfig.magicLink ?? false, | ||
| organization: pluginConfig.organization ?? false, | ||
| }; | ||
|
|
||
| return { | ||
|
|
||
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.
SchemaRegistry.getObjectOwner()only looks up by FQN key (it does not resolve short names or physicaltableName). IngetDriver(),objectNameis often the resolved physical table name (viaresolveObjectName()), sogetObjectOwner(objectName)will usually returnundefinedand skip packagedefaultDatasourcerouting. Use the resolved schema's FQN (object?.name) when callinggetObjectOwner, or add a registry helper that resolves owner from any object identifier.