Skip to content

Commit bfa9af1

Browse files
committed
Merge branch 'main' into copilot/refactor-playground-for-evaluation
2 parents 457d1f9 + aecd3a0 commit bfa9af1

21 files changed

Lines changed: 2206 additions & 360 deletions

File tree

packages/components/src/renderers/layout/card.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ ComponentRegistry.register('card',
3434
title: 'Card Title',
3535
description: 'Card description goes here',
3636
className: 'w-full'
37+
},
38+
isContainer: true,
39+
resizable: true,
40+
resizeConstraints: {
41+
width: true,
42+
height: true,
43+
minWidth: 200,
44+
minHeight: 100
3745
}
3846
}
3947
);

packages/components/src/renderers/layout/container.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ ComponentRegistry.register('container',
8181
children: [
8282
{ type: 'text', content: 'Container content goes here' }
8383
]
84+
},
85+
isContainer: true,
86+
resizable: true,
87+
resizeConstraints: {
88+
width: true,
89+
height: true,
90+
minWidth: 200,
91+
minHeight: 100
8492
}
8593
}
8694
);

packages/components/src/renderers/layout/grid.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ ComponentRegistry.register('grid',
8686
{ type: 'card', title: 'Card 3', description: 'Third card' },
8787
{ type: 'card', title: 'Card 4', description: 'Fourth card' }
8888
]
89+
},
90+
isContainer: true,
91+
resizable: true,
92+
resizeConstraints: {
93+
width: true,
94+
height: true,
95+
minWidth: 200,
96+
minHeight: 100
8997
}
9098
}
9199
);

packages/core/src/registry/Registry.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ export type ComponentMeta = {
2222
defaultProps?: Record<string, any>; // Default props when dropped
2323
defaultChildren?: SchemaNode[]; // Default children when dropped
2424
examples?: Record<string, any>; // Example configurations
25+
isContainer?: boolean; // Whether the component can have children
26+
resizable?: boolean; // Whether the component can be resized in the designer
27+
resizeConstraints?: {
28+
width?: boolean;
29+
height?: boolean;
30+
minWidth?: number;
31+
maxWidth?: number;
32+
minHeight?: number;
33+
maxHeight?: number;
34+
};
2535
};
2636

2737
export type ComponentConfig<T = any> = ComponentMeta & {

packages/data-objectql/README.md

Lines changed: 56 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,33 @@
11
# @object-ui/data-objectql
22

3-
ObjectQL Data Source Adapter for Object UI - Seamlessly connect your Object UI components with ObjectQL API backends.
3+
ObjectQL Data Source Adapter for Object UI - Seamlessly connect your Object UI components with ObjectQL API backends using the official **@objectql/sdk**.
44

55
## Features
66

7+
-**Official SDK Integration** - Built on top of @objectql/sdk for reliable API communication
78
-**Universal DataSource Interface** - Implements the standard Object UI data source protocol
89
-**Full TypeScript Support** - Complete type definitions and IntelliSense
910
-**React Hooks** - Easy-to-use hooks for data fetching and mutations
1011
-**Automatic Query Conversion** - Converts universal query params to ObjectQL format
1112
-**Error Handling** - Robust error handling with typed error responses
1213
-**Authentication** - Built-in support for token-based authentication
13-
-**Multi-tenant** - Space ID support for multi-tenant environments
14+
-**Universal Runtime** - Works in browsers, Node.js, and edge runtimes
1415

1516
## Installation
1617

1718
```bash
1819
# Using npm
19-
npm install @object-ui/data-objectql
20+
npm install @object-ui/data-objectql @objectql/sdk
2021

2122
# Using yarn
22-
yarn add @object-ui/data-objectql
23+
yarn add @object-ui/data-objectql @objectql/sdk
2324

2425
# Using pnpm
25-
pnpm add @object-ui/data-objectql
26+
pnpm add @object-ui/data-objectql @objectql/sdk
2627
```
2728

29+
**Note**: The package now depends on `@objectql/sdk` and `@objectql/types`, which provide the underlying HTTP client and type definitions.
30+
2831
## Quick Start
2932

3033
### Basic Usage
@@ -144,15 +147,14 @@ new ObjectQLDataSource(config: ObjectQLConfig)
144147
```typescript
145148
interface ObjectQLConfig {
146149
baseUrl: string; // ObjectQL API base URL
147-
version?: string; // API version (default: 'v1')
148150
token?: string; // Authentication token
149-
spaceId?: string; // Space ID for multi-tenant
150151
headers?: Record<string, string>; // Additional headers
151152
timeout?: number; // Request timeout (default: 30000ms)
152-
withCredentials?: boolean; // Include credentials (default: true)
153153
}
154154
```
155155

156+
**Note**: This configuration is compatible with `@objectql/sdk`'s `DataApiClientConfig`. Additional options supported by the SDK can also be passed.
157+
156158
#### Methods
157159

158160
##### find(resource, params)
@@ -378,6 +380,51 @@ const result = await dataSource.find('contacts');
378380
const contact: Contact = result.data[0]; // Typed!
379381
```
380382

383+
## Architecture
384+
385+
This adapter is built on top of the official ObjectQL SDK:
386+
387+
```
388+
Object UI Components
389+
390+
@object-ui/data-objectql (this package)
391+
392+
@objectql/sdk (DataApiClient)
393+
394+
ObjectQL Server API
395+
```
396+
397+
### Benefits of Using the Official SDK
398+
399+
- **Reliability**: Uses the official, well-tested ObjectQL HTTP client
400+
- **Compatibility**: Always compatible with the latest ObjectQL server versions
401+
- **Type Safety**: Leverages @objectql/types for consistent type definitions
402+
- **Universal Runtime**: Works in browsers, Node.js, Deno, and edge runtimes
403+
- **Automatic Updates**: SDK improvements automatically benefit this adapter
404+
405+
## Migration from Previous Versions
406+
407+
If you're upgrading from a previous version that used custom fetch logic:
408+
409+
1. Update your dependencies to include `@objectql/sdk`:
410+
```bash
411+
pnpm add @objectql/sdk @objectql/types
412+
```
413+
414+
2. The configuration interface has been simplified. Remove deprecated options:
415+
- `version` - The SDK handles API versioning internally
416+
- `spaceId` - Use custom headers if needed
417+
- `withCredentials` - The SDK manages this automatically
418+
419+
3. Filter formats now support both object and array notation:
420+
```typescript
421+
// Object format (converted to array internally)
422+
$filter: { status: 'active', age: 18 }
423+
424+
// Array format (FilterExpression - native ObjectQL format)
425+
$filter: [['status', '=', 'active'], ['age', '=', 18]]
426+
```
427+
381428
## License
382429

383430
MIT
@@ -387,3 +434,4 @@ MIT
387434
- [Object UI Documentation](https://www.objectui.org)
388435
- [GitHub Repository](https://github.com/objectstack-ai/objectui)
389436
- [ObjectQL Documentation](https://www.objectql.com)
437+
- [ObjectQL SDK](https://github.com/objectstack-ai/objectql)

packages/data-objectql/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@
4141
"directory": "packages/data-objectql"
4242
},
4343
"dependencies": {
44-
"@object-ui/types": "workspace:*"
44+
"@object-ui/types": "workspace:*",
45+
"@objectql/sdk": "^1.8.2",
46+
"@objectql/types": "^1.8.2"
4547
},
4648
"devDependencies": {
4749
"typescript": "^5.0.0",

0 commit comments

Comments
 (0)