@objectstack/runtime 3.2.1 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +10 -0
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/http-dispatcher.test.ts +3 -3
- package/src/http-dispatcher.ts +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@objectstack/runtime",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "ObjectStack Core Runtime & Query Engine",
|
|
6
6
|
"type": "module",
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"zod": "^4.3.6",
|
|
18
|
-
"@objectstack/core": "3.2.
|
|
19
|
-
"@objectstack/
|
|
20
|
-
"@objectstack/
|
|
21
|
-
"@objectstack/
|
|
18
|
+
"@objectstack/core": "3.2.2",
|
|
19
|
+
"@objectstack/rest": "3.2.2",
|
|
20
|
+
"@objectstack/spec": "3.2.2",
|
|
21
|
+
"@objectstack/types": "3.2.2"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"typescript": "^5.0.0",
|
|
@@ -216,7 +216,7 @@ describe('HttpDispatcher', () => {
|
|
|
216
216
|
it('should resolve analytics service from Promise (async factory)', async () => {
|
|
217
217
|
const mockAnalytics = {
|
|
218
218
|
query: vi.fn().mockResolvedValue({ rows: [{ id: 1 }], total: 1 }),
|
|
219
|
-
|
|
219
|
+
getMeta: vi.fn().mockResolvedValue({ tables: ['t1'] }),
|
|
220
220
|
generateSql: vi.fn().mockResolvedValue({ sql: 'SELECT 1' }),
|
|
221
221
|
};
|
|
222
222
|
// Inject as Promise (simulates async factory registration)
|
|
@@ -245,7 +245,7 @@ describe('HttpDispatcher', () => {
|
|
|
245
245
|
|
|
246
246
|
it('should handle GET /analytics/meta with async service', async () => {
|
|
247
247
|
const mockAnalytics = {
|
|
248
|
-
|
|
248
|
+
getMeta: vi.fn().mockResolvedValue({ tables: ['users', 'orders'] }),
|
|
249
249
|
};
|
|
250
250
|
(kernel as any).getService = vi.fn().mockResolvedValue(mockAnalytics);
|
|
251
251
|
|
|
@@ -600,7 +600,7 @@ describe('HttpDispatcher', () => {
|
|
|
600
600
|
|
|
601
601
|
describe('handleData', () => {
|
|
602
602
|
it('should pass expand and select to broker for GET /data/:object/:id', async () => {
|
|
603
|
-
mockBroker.call.mockResolvedValue({ object: 'order_item', id: 'oi_1', record: {
|
|
603
|
+
mockBroker.call.mockResolvedValue({ object: 'order_item', id: 'oi_1', record: { id: 'oi_1' } });
|
|
604
604
|
|
|
605
605
|
const result = await dispatcher.handleData(
|
|
606
606
|
'/order_item/oi_1', 'GET', {},
|
package/src/http-dispatcher.ts
CHANGED
|
@@ -526,7 +526,7 @@ export class HttpDispatcher {
|
|
|
526
526
|
* Handles Analytics requests
|
|
527
527
|
* path: sub-path after /analytics/
|
|
528
528
|
*/
|
|
529
|
-
async handleAnalytics(path: string, method: string, body: any,
|
|
529
|
+
async handleAnalytics(path: string, method: string, body: any, _context: HttpProtocolContext): Promise<HttpDispatcherResult> {
|
|
530
530
|
const analyticsService = await this.getService(CoreServiceName.enum.analytics);
|
|
531
531
|
if (!analyticsService) return { handled: false }; // 404 handled by caller if unhandled
|
|
532
532
|
|
|
@@ -535,20 +535,20 @@ export class HttpDispatcher {
|
|
|
535
535
|
|
|
536
536
|
// POST /analytics/query
|
|
537
537
|
if (subPath === 'query' && m === 'POST') {
|
|
538
|
-
const result = await analyticsService.query(body
|
|
538
|
+
const result = await analyticsService.query(body);
|
|
539
539
|
return { handled: true, response: this.success(result) };
|
|
540
540
|
}
|
|
541
541
|
|
|
542
542
|
// GET /analytics/meta
|
|
543
543
|
if (subPath === 'meta' && m === 'GET') {
|
|
544
|
-
const result = await analyticsService.
|
|
544
|
+
const result = await analyticsService.getMeta();
|
|
545
545
|
return { handled: true, response: this.success(result) };
|
|
546
546
|
}
|
|
547
547
|
|
|
548
548
|
// POST /analytics/sql (Dry-run or debug)
|
|
549
549
|
if (subPath === 'sql' && m === 'POST') {
|
|
550
550
|
// Assuming service has generateSql method
|
|
551
|
-
const result = await analyticsService.generateSql(body
|
|
551
|
+
const result = await analyticsService.generateSql(body);
|
|
552
552
|
return { handled: true, response: this.success(result) };
|
|
553
553
|
}
|
|
554
554
|
|