Skip to content

Commit c794beb

Browse files
Copilothotlong
andcommitted
Fix: Remove @objectstack/spec imports and add stub types for backward compatibility
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 1f3b02b commit c794beb

5 files changed

Lines changed: 75 additions & 11 deletions

File tree

packages/foundation/core/src/app.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ export class ObjectQL implements IObjectQL {
7474
for (const [name, driver] of Object.entries(this.datasources)) {
7575
this.stackEngine.registerDriver(driver as any, name === 'default');
7676
}
77-
}
7877

7978
if (config.connection) {
8079
throw new Error("Connection strings are not supported in core directly. Use @objectql/platform-node's createDriverFromConnection or pass a driver instance to 'datasources'.");

packages/foundation/types/src/action.ts

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

9-
// Import and re-export types from the Protocol Constitution (@objectstack/spec)
10-
import type { Action } from '@objectstack/spec';
9+
// Note: Types from @objectstack/spec would be imported here when available
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
1617
*/
17-
export type { Action as SpecAction };
18+
// export type { Action as SpecAction };
1819

1920
/**
2021
* RUNTIME-SPECIFIC TYPES

packages/foundation/types/src/driver.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ export interface Driver {
8989

9090
// Additional methods for DriverInterface compatibility
9191
execute?(command: any, parameters?: any[], options?: any): Promise<any>;
92-
findOne?(objectName: string, id: string | number, query?: any, options?: any): Promise<any>;
9392
bulkCreate?(objectName: string, data: any[], options?: any): Promise<any>;
9493
bulkUpdate?(objectName: string, updates: Array<{id: string | number, data: any}>, options?: any): Promise<any>;
9594
bulkDelete?(objectName: string, ids: Array<string | number>, options?: any): Promise<any>;

packages/foundation/types/src/field.ts

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

9-
// Import types from the Protocol Constitution (@objectstack/spec)
10-
import type { FieldType as ProtocolFieldType, Field, SelectOption as SpecSelectOption } from '@objectstack/spec';
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';
1111

1212
/**
1313
* Re-export Protocol Types from the Constitution
1414
* These are the wire-protocol standard types defined in @objectstack/spec
15+
* TODO: Re-enable when @objectstack/spec is available
1516
*/
16-
export type { Field as SpecField, SpecSelectOption, ProtocolFieldType };
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)
50+
*/
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+
}
1781

1882
/**
1983
* RUNTIME-SPECIFIC TYPES

packages/foundation/types/src/object.ts

Lines changed: 4 additions & 3 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-
// Import and re-export types from the Protocol Constitution (@objectstack/spec)
10-
import type { ServiceObject, IndexSchema } from '@objectstack/spec';
9+
// Note: Types from @objectstack/spec would be imported here when available
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
1718
*/
18-
export type { ServiceObject as SpecObject, IndexSchema };
19+
// export type { ServiceObject as SpecObject, IndexSchema };
1920

2021
/**
2122
* RUNTIME-SPECIFIC TYPES

0 commit comments

Comments
 (0)