Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/objectql/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class ObjectQLPlugin implements Plugin {

ctx.logger.info('ObjectQL engine started', {
driversRegistered: this.ql?.['drivers']?.size || 0,
objectsRegistered: this.ql?.registry?.listObjects?.()?.length || 0
objectsRegistered: this.ql?.registry?.getAllObjects?.()?.length || 0
});
}

Expand Down
33 changes: 26 additions & 7 deletions packages/objectql/src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
UpdateManyDataRequest,
DeleteManyDataRequest
} from '@objectstack/spec/api';
import type { MetadataCacheRequest, MetadataCacheResponse, ServiceInfo } from '@objectstack/spec/api';
import type { MetadataCacheRequest, MetadataCacheResponse, ServiceInfo, ApiRoutes } from '@objectstack/spec/api';

// We import SchemaRegistry directly since this class lives in the same package
import { SchemaRegistry } from './registry.js';
Expand Down Expand Up @@ -103,21 +103,40 @@ export class ObjectStackProtocolImplementation implements ObjectStackProtocol {
};

// Build endpoints (only include available services)
const endpoints: Record<string, string> = {
data: '/api/data',
metadata: '/api/meta',
// Map service names to ApiRoutes keys
const serviceToEndpointKey: Record<string, keyof ApiRoutes> = {
Comment on lines +106 to +107
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

serviceToEndpointKey is typed as Record<string, keyof ApiRoutes>, which implies every service name maps to a valid ApiRoutes key. Only a subset is actually mapped (unknown services yield undefined at runtime). Consider typing this as a partial mapping (e.g. Partial<Record<string, keyof ApiRoutes>> or a satisfies-based object) so the type matches behavior and keeps type-safety as services are added.

Suggested change
// Map service names to ApiRoutes keys
const serviceToEndpointKey: Record<string, keyof ApiRoutes> = {
// Map service names to ApiRoutes keys (only a subset of services are mapped)
const serviceToEndpointKey: Partial<Record<string, keyof ApiRoutes>> = {

Copilot uses AI. Check for mistakes.
auth: 'auth',
automation: 'automation',
ui: 'ui',
workflow: 'workflow',
realtime: 'realtime',
notification: 'notifications',
ai: 'ai',
i18n: 'i18n',
graphql: 'graphql',
'file-storage': 'storage',
};

const optionalEndpoints: Partial<ApiRoutes> = {
analytics: '/api/analytics',
};

// Add routes for available plugin services
for (const [serviceName, config] of Object.entries(SERVICE_CONFIG)) {
if (registeredServices.has(serviceName)) {
// Map service name to endpoint key (some services use different names)
const endpointKey = serviceName === 'file-storage' ? 'storage' : serviceName;
endpoints[endpointKey] = config.route;
const endpointKey = serviceToEndpointKey[serviceName];
if (endpointKey) {
optionalEndpoints[endpointKey] = config.route;
}
}
}

const endpoints: ApiRoutes = {
data: '/api/data',
metadata: '/api/meta',
...optionalEndpoints,
};

return {
version: '1.0',
apiName: 'ObjectStack API',
Expand Down
Loading
Loading