Skip to content

Commit b8a6aae

Browse files
committed
feat: update build scripts and add zod dependency; refactor API plugin handlers
1 parent 5a821a4 commit b8a6aae

9 files changed

Lines changed: 16 additions & 11 deletions

File tree

packages/client-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"main": "dist/index.js",
77
"types": "dist/index.d.ts",
88
"scripts": {
9-
"build": "tsup --config ../../tsup.config.ts"
9+
"build": "tsup src/index.tsx --config ../../tsup.config.ts"
1010
},
1111
"peerDependencies": {
1212
"react": ">=18.0.0"

packages/runtime/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"dependencies": {
1515
"@objectstack/core": "workspace:*",
1616
"@objectstack/spec": "workspace:*",
17-
"@objectstack/types": "workspace:*"
17+
"@objectstack/types": "workspace:*",
18+
"zod": "^3.24.1"
1819
},
1920
"devDependencies": {
2021
"typescript": "^5.0.0",

packages/runtime/src/api-registry-plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function createApiRegistryPlugin(config: ApiRegistryConfig = {}): Plugin
2121
name: 'com.objectstack.runtime.api-registry',
2222
version: '1.0.0',
2323

24-
init: async (ctx: PluginContext) => {
24+
init: async (_ctx: PluginContext) => {
2525
// No service registration, this is a consumer plugin
2626
},
2727

packages/runtime/src/rest-server.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { IHttpServer } from '@objectstack/core';
22
import { RouteManager } from './route-manager.js';
3-
import { RestServerConfig, CrudOperation, RestApiConfig, CrudEndpointsConfig, MetadataEndpointsConfig, BatchEndpointsConfig, RouteGenerationConfig } from '@objectstack/spec/api';
3+
import { RestServerConfig, RestApiConfig, CrudEndpointsConfig, MetadataEndpointsConfig, BatchEndpointsConfig, RouteGenerationConfig } from '@objectstack/spec/api';
44
import { ObjectStackProtocol } from '@objectstack/spec/api';
55

66
/**
@@ -89,7 +89,6 @@ type NormalizedRestServerConfig = {
8989
* restServer.registerRoutes();
9090
*/
9191
export class RestServer {
92-
private server: IHttpServer;
9392
private protocol: ObjectStackProtocol;
9493
private config: NormalizedRestServerConfig;
9594
private routeManager: RouteManager;
@@ -99,7 +98,6 @@ export class RestServer {
9998
protocol: ObjectStackProtocol,
10099
config: RestServerConfig = {}
101100
) {
102-
this.server = server;
103101
this.protocol = protocol;
104102
this.config = this.normalizeConfig(config);
105103
this.routeManager = new RouteManager(server);
@@ -212,7 +210,7 @@ export class RestServer {
212210
this.routeManager.register({
213211
method: 'GET',
214212
path: basePath,
215-
handler: async (req: any, res: any) => {
213+
handler: async (_req: any, res: any) => {
216214
try {
217215
const discovery = await this.protocol.getDiscovery({});
218216
res.json(discovery);
@@ -239,7 +237,7 @@ export class RestServer {
239237
this.routeManager.register({
240238
method: 'GET',
241239
path: metaPath,
242-
handler: async (req: any, res: any) => {
240+
handler: async (_req: any, res: any) => {
243241
try {
244242
const types = await this.protocol.getMetaTypes({});
245243
res.json(types);

packages/runtime/src/route-manager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { RouteHandler, IHttpServer } from '@objectstack/core';
22
import { System, Shared } from '@objectstack/spec';
3+
import { z } from 'zod';
34

45
type RouteHandlerMetadata = System.RouteHandlerMetadata;
5-
type HttpMethod = Shared.HttpMethod;
6+
type HttpMethod = z.infer<typeof Shared.HttpMethod>;
67

78
/**
89
* Route Entry

packages/runtime/src/runtime.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { ObjectKernel, Plugin, IHttpServer, ObjectKernelConfig } from '@objectstack/core';
2-
import { HttpServer } from './http-server.js';
32
import { createApiRegistryPlugin, ApiRegistryConfig } from './api-registry-plugin.js';
43

54
export interface RuntimeConfig {

packages/runtime/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"outDir": "./dist",
55
"rootDir": "./src"
66
},
7-
"include": ["src/**/*"]
7+
"include": ["src/**/*"],
8+
"exclude": ["node_modules", "dist", "**/*.spec.ts", "**/*.test.ts"]
89
}

packages/spec/tsup.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export default defineConfig({
1111
'src/automation/index.ts',
1212
'src/api/index.ts',
1313
'src/ui/index.ts',
14+
'src/hub/index.ts',
15+
'src/ai/index.ts',
1416
'src/permission/index.ts',
1517
'src/contracts/index.ts',
1618
'src/integration/index.ts'

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)