Skip to content

Commit 492f992

Browse files
authored
Merge pull request #632 from objectstack-ai/copilot/fix-build-and-test-again
2 parents 31e0d1a + 57b35f2 commit 492f992

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

packages/plugins/driver-memory/src/memory-analytics.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ export class MemoryAnalyticsService implements IAnalyticsService {
5656
this.logger.debug('Executing analytics query', { cube: query.cube, measures: query.measures });
5757

5858
// Get cube definition
59+
if (!query.cube) {
60+
throw new Error('Cube name is required');
61+
}
5962
const cube = this.cubes.get(query.cube);
6063
if (!cube) {
6164
throw new Error(`Cube not found: ${query.cube}`);
@@ -265,6 +268,9 @@ export class MemoryAnalyticsService implements IAnalyticsService {
265268
* Generate SQL representation for debugging/transparency
266269
*/
267270
async generateSql(query: AnalyticsQuery): Promise<{ sql: string; params: unknown[] }> {
271+
if (!query.cube) {
272+
throw new Error('Cube name is required');
273+
}
268274
const cube = this.cubes.get(query.cube);
269275
if (!cube) {
270276
throw new Error(`Cube not found: ${query.cube}`);

packages/spec/src/api/protocol.zod.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,10 +1057,10 @@ export type GetMetaItemCachedResponse = z.infer<typeof GetMetaItemCachedResponse
10571057
export type GetUiViewRequest = z.infer<typeof GetUiViewRequestSchema>;
10581058
export type GetUiViewResponse = z.infer<typeof GetUiViewResponseSchema>;
10591059

1060-
export type AnalyticsQueryRequest = z.infer<typeof AnalyticsQueryRequestSchema>;
1061-
export type AnalyticsResultResponse = z.infer<typeof AnalyticsResultResponseSchema>;
1062-
export type GetAnalyticsMetaRequest = z.infer<typeof GetAnalyticsMetaRequestSchema>;
1063-
export type GetAnalyticsMetaResponse = z.infer<typeof AnalyticsMetadataResponseSchema>;
1060+
type AnalyticsQueryRequest = z.infer<typeof AnalyticsQueryRequestSchema>;
1061+
type AnalyticsResultResponse = z.infer<typeof AnalyticsResultResponseSchema>;
1062+
type GetAnalyticsMetaRequest = z.infer<typeof GetAnalyticsMetaRequestSchema>;
1063+
type GetAnalyticsMetaResponse = z.infer<typeof AnalyticsMetadataResponseSchema>;
10641064

10651065
export type AutomationTriggerRequest = z.infer<typeof AutomationTriggerRequestSchema>;
10661066
export type AutomationTriggerResponse = z.infer<typeof AutomationTriggerResponseSchema>;

packages/spec/src/contracts/analytics-service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
* An analytical query definition
1818
*/
1919
export interface AnalyticsQuery {
20-
/** Target cube name */
21-
cube: string;
20+
/** Target cube name. Optional when cube is specified at a higher level (e.g. API request wrapper or cube-scoped endpoint). Implementations should validate presence at runtime. */
21+
cube?: string;
2222
/** Measures to compute (e.g. ['orders.count', 'orders.totalRevenue']) */
23-
measures?: string[];
23+
measures: string[];
2424
/** Dimensions to group by (e.g. ['orders.status', 'orders.createdAt']) */
2525
dimensions?: string[];
2626
/** Filter conditions */

0 commit comments

Comments
 (0)