Skip to content

Commit 0570bb9

Browse files
committed
Add build scripts to package.json files and update TypeScript configuration across examples and packages
1 parent aea50c6 commit 0570bb9

File tree

10 files changed

+40
-24
lines changed

10 files changed

+40
-24
lines changed

examples/ai-codegen/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"description": "AI code generator - Generate ObjectStack apps from natural language",
55
"private": true,
66
"main": "objectstack.config.ts",
7+
"scripts": {
8+
"build": "tsc --noEmit"
9+
},
710
"dependencies": {
811
"@objectstack/spec": "workspace:*"
912
}

examples/ai-sales/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"description": "AI-powered sales assistant with intelligent automation",
55
"private": true,
66
"main": "objectstack.config.ts",
7+
"scripts": {
8+
"build": "tsc --noEmit"
9+
},
710
"dependencies": {
811
"@objectstack/spec": "workspace:*"
912
}

examples/host/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"private": true,
55
"scripts": {
66
"dev": "tsx src/index.ts",
7+
"build": "tsc --noEmit",
78
"clean": "rm -rf dist node_modules"
89
},
910
"dependencies": {

examples/host/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ObjectKernel, DriverPlugin, AppManifestPlugin, ObjectQL } from '@objectstack/runtime';
1+
import { ObjectKernel, DriverPlugin, AppManifestPlugin } from '@objectstack/runtime';
22
import { InMemoryDriver } from '@objectstack/driver-memory';
33
import { ObjectQLPlugin } from '@objectstack/objectql';
44
import { HonoServerPlugin } from '@objectstack/plugin-hono-server';

examples/host/tsconfig.json

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
{
2+
"extends": "../../tsconfig.json",
23
"compilerOptions": {
3-
"target": "ES2020",
4-
"module": "CommonJS",
5-
"moduleResolution": "node",
6-
"strict": true,
7-
"esModuleInterop": true,
8-
"skipLibCheck": true,
9-
"forceConsistentCasingInFileNames": true,
10-
"outDir": "./dist"
4+
"outDir": "./dist",
5+
"module": "esnext"
116
},
12-
"include": ["src/**/*"]
7+
"include": ["src/**/*"],
8+
"exclude": ["node_modules", "dist"]
139
}

packages/objectql/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import { SchemaRegistry } from './registry';
66

77
// Export Registry for consumers
88
export { SchemaRegistry } from './registry';
9+
export { ObjectStackProtocolImplementation } from './protocol';
10+
911

1012
export type HookHandler = (context: HookContext) => Promise<void> | void;
1113

packages/plugin-msw/src/msw-plugin.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ import { setupWorker } from 'msw/browser';
33
import {
44
Plugin,
55
PluginContext,
6-
ObjectStackRuntimeProtocol,
7-
ObjectKernel
6+
ObjectKernel,
7+
ObjectStackProtocolImplementation,
8+
IDataEngine
89
} from '@objectstack/runtime';
10+
import { IObjectStackProtocol } from '@objectstack/spec/api';
11+
// import { IDataEngine } from '@objectstack/core';
912

1013
export interface MSWPluginOptions {
1114
/**
@@ -33,10 +36,10 @@ export interface MSWPluginOptions {
3336
* ObjectStack Server Mock - Provides mock database functionality
3437
*/
3538
export class ObjectStackServer {
36-
private static protocol: ObjectStackRuntimeProtocol | null = null;
39+
private static protocol: IObjectStackProtocol | null = null;
3740
private static logger: ((message: string, ...meta: any[]) => void) | null = null;
3841

39-
static init(protocol: ObjectStackRuntimeProtocol, logger?: (message: string, ...meta: any[]) => void) {
42+
static init(protocol: IObjectStackProtocol, logger?: (message: string, ...meta: any[]) => void) {
4043
this.protocol = protocol;
4144
this.logger = logger || console.log;
4245
}
@@ -173,7 +176,7 @@ export class MSWPlugin implements Plugin {
173176
private options: MSWPluginOptions;
174177
private worker: any;
175178
private handlers: Array<any> = [];
176-
private protocol?: ObjectStackRuntimeProtocol;
179+
private protocol?: IObjectStackProtocol;
177180

178181
constructor(options: MSWPluginOptions = {}) {
179182
this.options = {
@@ -196,12 +199,12 @@ export class MSWPlugin implements Plugin {
196199
* Start phase
197200
*/
198201
async start(ctx: PluginContext) {
199-
// Get the kernel and create protocol
200-
if (ctx.getKernel) {
201-
const kernel = ctx.getKernel();
202-
this.protocol = new ObjectStackRuntimeProtocol(kernel);
203-
} else {
204-
throw new Error('[MSWPlugin] Cannot access kernel from context - getKernel() not available');
202+
try {
203+
const dataEngine = ctx.getService<IDataEngine>('objectql');
204+
this.protocol = new ObjectStackProtocolImplementation(dataEngine);
205+
} catch (e) {
206+
console.error('[MSWPlugin] Failed to initialize protocol', e);
207+
throw new Error('[MSWPlugin] Failed to initialize protocol (missing objectql service?)');
205208
}
206209

207210
this.setupHandlers();

packages/runtime/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Export core engine
2-
export { ObjectQL, SchemaRegistry } from '@objectstack/objectql';
2+
export { ObjectQL, SchemaRegistry, ObjectStackProtocolImplementation } from '@objectstack/objectql';
33

44
// Export Kernels
55
export { ObjectKernel } from '@objectstack/core';

packages/spec/src/stack.zod.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ export const ObjectStackDefinitionSchema = z.object({
9191
roles: z.array(RoleSchema).optional().describe('User Roles hierarchy'),
9292
permissions: z.array(PermissionSetSchema).optional().describe('Permission Sets and Profiles'),
9393

94+
/**
95+
* ObjectAPI: API Layer
96+
*/
97+
apis: z.array(ApiEndpointSchema).optional().describe('API Endpoints'),
98+
9499
/**
95100
* ObjectAI: Artificial Intelligence Layer
96101
*/

packages/types/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
"name": "@objectstack/types",
33
"version": "0.4.2",
44
"description": "Shared interfaces describing the ObjectStack Runtime environment",
5-
"main": "src/index.ts",
6-
"types": "src/index.ts",
5+
"main": "dist/index.js",
6+
"types": "dist/index.d.ts",
7+
"scripts": {
8+
"build": "tsc"
9+
},
710
"dependencies": {
811
"@objectstack/spec": "workspace:*"
912
},

0 commit comments

Comments
 (0)