Skip to content

Commit f1fd8c2

Browse files
feat: Create @objectstack stub packages and update @objectql/types dependencies
Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
1 parent 3967485 commit f1fd8c2

14 files changed

Lines changed: 369 additions & 83 deletions

File tree

packages/foundation/types/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@objectql/types",
3-
"version": "3.0.1",
3+
"version": "4.0.0-beta.1",
44
"description": "Pure TypeScript type definitions and interfaces for the ObjectQL protocol - The Contract",
55
"keywords": [
66
"objectql",
@@ -26,11 +26,13 @@
2626
"generate:schemas": "node scripts/generate-schemas.js",
2727
"test": "jest --passWithNoTests"
2828
},
29-
"dependencies": {
29+
"peerDependencies": {
3030
"@objectstack/spec": "^0.2.0",
3131
"@objectstack/runtime": "^0.2.0"
3232
},
3333
"devDependencies": {
34+
"@objectstack/spec": "workspace:*",
35+
"@objectstack/runtime": "workspace:*",
3436
"ts-json-schema-generator": "^2.4.0"
3537
}
3638
}

packages/foundation/types/src/action.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
// Note: Types from @objectstack/spec would be imported here when available
10-
// import type { Action } from '@objectstack/spec';
9+
// Import protocol types from @objectstack/spec
10+
import type { Action } from '@objectstack/spec';
1111
import { FieldConfig } from "./field";
1212
import { HookAPI } from "./hook"; // Reuse the restricted API interface
1313

1414
/**
1515
* Re-export Protocol Types from the Constitution
16-
* TODO: Re-enable when @objectstack/spec is available
16+
*
17+
* @deprecated Import directly from @objectstack/spec instead
1718
*/
18-
// export type { Action as SpecAction };
19+
export type { Action as SpecAction };
1920

2021
/**
2122
* RUNTIME-SPECIFIC TYPES

packages/foundation/types/src/field.ts

Lines changed: 9 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -6,78 +6,20 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
// Note: Types from @objectstack/spec would be imported here when available
10-
// import type { FieldType as ProtocolFieldType, Field, SelectOption as SpecSelectOption } from '@objectstack/spec';
9+
// Import protocol types from @objectstack/spec
10+
import type {
11+
FieldType as ProtocolFieldType,
12+
Field,
13+
SelectOption as SpecSelectOption
14+
} from '@objectstack/spec';
1115

1216
/**
1317
* Re-export Protocol Types from the Constitution
1418
* These are the wire-protocol standard types defined in @objectstack/spec
15-
* TODO: Re-enable when @objectstack/spec is available
16-
*/
17-
// export type { Field as SpecField, SpecSelectOption, ProtocolFieldType };
18-
19-
/**
20-
* Protocol Field Types (stub definitions until @objectstack/spec is available)
21-
* These match the core field types from the ObjectStack specification
22-
*/
23-
type ProtocolFieldType =
24-
| 'text'
25-
| 'textarea'
26-
| 'number'
27-
| 'boolean'
28-
| 'date'
29-
| 'datetime'
30-
| 'time'
31-
| 'select'
32-
| 'lookup'
33-
| 'master_detail'
34-
| 'formula'
35-
| 'summary'
36-
| 'autonumber'
37-
| 'url'
38-
| 'email'
39-
| 'phone'
40-
| 'currency'
41-
| 'percent'
42-
| 'markdown'
43-
| 'html'
44-
| 'password'
45-
| 'file'
46-
| 'image';
47-
48-
/**
49-
* Base Field interface (stub definition until @objectstack/spec is available)
19+
*
20+
* @deprecated Import directly from @objectstack/spec instead
5021
*/
51-
interface Field {
52-
name: string;
53-
label: string;
54-
type: string;
55-
description?: string;
56-
options?: Array<{label: string; value: string}>;
57-
required?: boolean;
58-
multiple?: boolean;
59-
unique?: boolean;
60-
deleteBehavior?: string;
61-
hidden?: boolean;
62-
readonly?: boolean;
63-
encryption?: boolean;
64-
index?: boolean;
65-
externalId?: boolean;
66-
searchable?: boolean;
67-
defaultValue?: any;
68-
maxLength?: number;
69-
minLength?: number;
70-
min?: number;
71-
max?: number;
72-
precision?: number;
73-
scale?: number;
74-
formula?: string;
75-
reference?: string;
76-
referenceFilters?: any;
77-
writeRequiresMasterRead?: boolean;
78-
expression?: string;
79-
summaryOperations?: string[];
80-
}
22+
export type { Field as SpecField, SpecSelectOption, ProtocolFieldType };
8123

8224
/**
8325
* RUNTIME-SPECIFIC TYPES

packages/foundation/types/src/object.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
// Note: Types from @objectstack/spec would be imported here when available
10-
// import type { ServiceObject, IndexSchema } from '@objectstack/spec';
9+
// Import protocol types from @objectstack/spec
10+
import type { ServiceObject, IndexSchema } from '@objectstack/spec';
1111
import { FieldConfig } from './field';
1212
import { ActionConfig } from './action';
1313
import { AnyValidationRule } from './validation';
1414

1515
/**
1616
* Re-export Protocol Types from the Constitution
17-
* TODO: Re-enable when @objectstack/spec is available
17+
*
18+
* @deprecated Import directly from @objectstack/spec instead
1819
*/
19-
// export type { ServiceObject as SpecObject, IndexSchema };
20+
export type { ServiceObject as SpecObject, IndexSchema };
2021

2122
/**
2223
* RUNTIME-SPECIFIC TYPES
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# @objectstack/runtime
2+
3+
ObjectStack Runtime - Core Runtime Types
4+
5+
This package contains the runtime type definitions for the ObjectStack ecosystem.
6+
7+
## Purpose
8+
9+
This stub package is part of the ObjectQL v4.0 migration to the @objectstack ecosystem. It provides:
10+
- RuntimePlugin interface
11+
- RuntimeContext interface
12+
- ObjectStackKernel interface
13+
14+
## Migration Notes
15+
16+
This is a workspace stub package created during the ObjectQL type system cleanup phase. The real `@objectstack/runtime` package will be published separately to npm.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "@objectstack/runtime",
3+
"version": "0.2.0",
4+
"description": "ObjectStack Runtime - Core Runtime Types",
5+
"keywords": [
6+
"objectstack",
7+
"runtime",
8+
"types"
9+
],
10+
"license": "MIT",
11+
"main": "dist/index.js",
12+
"types": "dist/index.d.ts",
13+
"files": [
14+
"dist"
15+
],
16+
"scripts": {
17+
"build": "tsc",
18+
"test": "echo 'No tests for stub package'"
19+
}
20+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/**
2+
* @objectstack/runtime
3+
* ObjectStack Runtime Types
4+
*
5+
* This package defines the runtime types for the ObjectStack ecosystem.
6+
*/
7+
8+
/**
9+
* Runtime Context
10+
* Provides access to the ObjectStack kernel during plugin execution
11+
*/
12+
export interface RuntimeContext {
13+
/** The ObjectStack kernel instance */
14+
engine: any; // ObjectStackKernel
15+
}
16+
17+
/**
18+
* Runtime Plugin
19+
* Interface for ObjectStack plugins
20+
*/
21+
export interface RuntimePlugin {
22+
/** Plugin name */
23+
name: string;
24+
/** Plugin version */
25+
version?: string;
26+
/** Install hook - called during kernel initialization */
27+
install?: (ctx: RuntimeContext) => void | Promise<void>;
28+
/** Start hook - called when kernel starts */
29+
onStart?: (ctx: RuntimeContext) => void | Promise<void>;
30+
/** Stop hook - called when kernel stops */
31+
onStop?: (ctx: RuntimeContext) => void | Promise<void>;
32+
}
33+
34+
/**
35+
* ObjectStack Kernel
36+
* The core runtime engine
37+
*/
38+
export interface ObjectStackKernel {
39+
/** Query interface (QL) */
40+
ql: any;
41+
/** Start the kernel */
42+
start(): Promise<void>;
43+
/** Stop the kernel */
44+
stop?(): Promise<void>;
45+
/** Seed initial data */
46+
seed?(): Promise<void>;
47+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "../../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"outDir": "./dist",
5+
"rootDir": "./src",
6+
"declaration": true
7+
},
8+
"include": ["src/**/*"]
9+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# @objectstack/spec
2+
3+
ObjectStack Protocol Specification - Type Definitions
4+
5+
This package contains the canonical wire-protocol type definitions for the ObjectStack ecosystem.
6+
7+
## Purpose
8+
9+
This stub package is part of the ObjectQL v4.0 migration to the @objectstack ecosystem. It provides:
10+
- Protocol field types (FieldType, Field, SelectOption)
11+
- Protocol object types (ServiceObject, IndexSchema)
12+
- Protocol action types (Action)
13+
- Protocol query types (FilterCondition)
14+
15+
## Migration Notes
16+
17+
This is a workspace stub package created during the ObjectQL type system cleanup phase. The real `@objectstack/spec` package will be published separately to npm.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "@objectstack/spec",
3+
"version": "0.2.0",
4+
"description": "ObjectStack Protocol Specification - Type Definitions",
5+
"keywords": [
6+
"objectstack",
7+
"protocol",
8+
"spec",
9+
"types"
10+
],
11+
"license": "MIT",
12+
"main": "dist/index.js",
13+
"types": "dist/index.d.ts",
14+
"files": [
15+
"dist"
16+
],
17+
"scripts": {
18+
"build": "tsc",
19+
"test": "echo 'No tests for stub package'"
20+
}
21+
}

0 commit comments

Comments
 (0)