Skip to content

Commit d10f649

Browse files
committed
fix: register system object definitions in AuthPlugin for auto-discovery
1 parent 74cf532 commit d10f649

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

packages/plugins/plugin-auth/src/auth-plugin.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
import { Plugin, PluginContext, IHttpServer } from '@objectstack/core';
44
import { AuthConfig } from '@objectstack/spec/system';
55
import { AuthManager } from './auth-manager.js';
6+
import {
7+
SysUser, SysSession, SysAccount, SysVerification,
8+
SysOrganization, SysMember, SysInvitation,
9+
SysTeam, SysTeamMember,
10+
SysApiKey, SysTwoFactor,
11+
} from './objects/index.js';
612

713
/**
814
* Auth Plugin Options
@@ -43,6 +49,7 @@ export interface AuthPluginOptions extends Partial<AuthConfig> {
4349
*
4450
* This plugin registers:
4551
* - `auth` service (auth manager instance) — always
52+
* - `app.com.objectstack.system` service (system object definitions) — always
4653
* - HTTP routes for authentication endpoints — only when HTTP server is available
4754
*
4855
* Integrates with better-auth library to provide comprehensive
@@ -88,7 +95,23 @@ export class AuthPlugin implements Plugin {
8895

8996
// Register auth service
9097
ctx.registerService('auth', this.authManager);
91-
98+
99+
// Register system objects as an app service so ObjectQLPlugin
100+
// auto-discovers them via the `app.*` convention.
101+
ctx.registerService('app.com.objectstack.system', {
102+
id: 'com.objectstack.system',
103+
name: 'System',
104+
version: '1.0.0',
105+
type: 'plugin',
106+
namespace: 'sys',
107+
objects: [
108+
SysUser, SysSession, SysAccount, SysVerification,
109+
SysOrganization, SysMember, SysInvitation,
110+
SysTeam, SysTeamMember,
111+
SysApiKey, SysTwoFactor,
112+
],
113+
});
114+
92115
ctx.logger.info('Auth Plugin initialized successfully');
93116
}
94117

0 commit comments

Comments
 (0)