Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion content/docs/architecture/core.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
---
title: "@objectql/core"
title: "@objectql/core (Deprecated)"
description: The Runtime Engine - Core ORM, validation, and business logic compiler for ObjectQL
---

# @objectql/core

<Callout type="warn" title="Deprecated">
`@objectql/core` is deprecated. All core functionality is now available in [`@objectstack/objectql`](https://www.npmjs.com/package/@objectstack/objectql).
See the [Migration Guide](/docs/guides/objectql-migration) for step-by-step instructions.
</Callout>

**The Runtime Engine**: The core ORM and business logic compiler for ObjectQL. This package transforms abstract metadata (defined in `@objectql/types`) into executable database operations, validations, and business rules.

## Overview
Expand Down
3 changes: 2 additions & 1 deletion content/docs/guides/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"pages": [
"error-handling",
"architecture",
"migration-v5"
"migration-v5",
"objectql-migration"
]
}
139 changes: 139 additions & 0 deletions content/docs/guides/objectql-migration.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
---
title: "Migrating from @objectql/core"
description: "Step-by-step guide for migrating from @objectql/core to @objectstack/objectql"
---

# Migrating from `@objectql/core` to `@objectstack/objectql`

All core functionality previously provided by `@objectql/core` is now available upstream in `@objectstack/objectql`. This guide walks you through migrating your project so that `@objectql/core` can be removed.

## Why Migrate?

| | `@objectql/core` (deprecated) | `@objectstack/objectql` (recommended) |
| :--- | :--- | :--- |
| **Engine** | Bridge class extending upstream `ObjectQL` | Canonical `ObjectQL` engine |
| **Kernel Factory** | `createObjectQLKernel()` | `createObjectQLKernel()` (identical API) |
| **Introspection** | `toTitleCase`, `convertIntrospectedSchemaToObjects` | Same functions, same signatures |
| **Registry** | Re-exports from upstream | Direct exports |
| **MetadataRegistry** | `@objectql/types` `MetadataRegistry` class | `MetadataFacade` (async `IMetadataService`) |
| **Maintenance** | Planned deprecation | Actively maintained |

## Step 1 — Update Dependencies

```diff
// package.json
{
"dependencies": {
- "@objectql/core": "^4.x",
- "@objectql/types": "^4.x",
+ "@objectstack/objectql": "^3.0.4"
}
}
```

Then re-install:

```bash
pnpm install
```

## Step 2 — Update Imports

### Engine, Repository & Context

```diff
- import { ObjectQL, ObjectRepository, ScopedContext } from '@objectql/core';
+ import { ObjectQL, ObjectRepository, ScopedContext } from '@objectstack/objectql';
```

```diff
- import type { HookHandler, HookEntry, OperationContext, EngineMiddleware } from '@objectql/core';
+ import type { HookHandler, HookEntry, OperationContext, EngineMiddleware } from '@objectstack/objectql';
```

### Schema Registry

```diff
- import { SchemaRegistry } from '@objectql/core';
+ import { SchemaRegistry } from '@objectstack/objectql';
```

### Kernel Factory

```diff
- import { createObjectQLKernel } from '@objectql/core';
+ import { createObjectQLKernel } from '@objectstack/objectql';
```

### Utility Functions

```diff
- import { toTitleCase, convertIntrospectedSchemaToObjects } from '@objectql/core';
+ import { toTitleCase, convertIntrospectedSchemaToObjects } from '@objectstack/objectql';
```

### Introspection Types

```diff
- import type { IntrospectedSchema, IntrospectedTable } from '@objectql/types';
+ import type { IntrospectedSchema, IntrospectedTable } from '@objectstack/objectql';
```

## Step 3 — API Differences

### `createObjectQLKernel()`

The function signature is identical. The only change is the return type uses the upstream `ObjectKernel`:

```typescript
import { createObjectQLKernel } from '@objectstack/objectql';

const kernel = await createObjectQLKernel({
plugins: [myDriverPlugin],
});
await kernel.start();
```

### MetadataRegistry → MetadataFacade

If you were using `MetadataRegistry` from `@objectql/types`, the upstream equivalent is `MetadataFacade`. The key difference is that `MetadataFacade` methods are **async**:

```diff
- import { MetadataRegistry } from '@objectql/types';
- const registry = new MetadataRegistry();
- registry.register('object', myObject);
- const obj = registry.get('object', 'account');
+ import { MetadataFacade } from '@objectstack/objectql';
+ const facade = new MetadataFacade();
+ await facade.register('object', 'account', myObject);
+ const obj = await facade.get('object', 'account');
```

### ObjectQLPlugin

Both packages export an `ObjectQLPlugin`, but they serve different roles:

| | `@objectql/core` `ObjectQLPlugin` | `@objectstack/objectql` `ObjectQLPlugin` |
| :--- | :--- | :--- |
| Interface | `RuntimePlugin` (from `@objectql/types`) | `Plugin` (from `@objectstack/core`) |
| Role | Orchestrator composing sub-plugins (validator, formula, query) | Kernel plugin registering ObjectQL as core services |

If you were using the `@objectql/core` `ObjectQLPlugin` to compose sub-plugins (`ValidatorPlugin`, `FormulaPlugin`, `QueryPlugin`), those downstream plugins are **not** part of this migration — they remain in the `@objectql` ecosystem.

## Step 4 — Remove `@objectql/core`

Once all imports are updated and tests pass:

```bash
pnpm remove @objectql/core @objectql/types
```

## Checklist

- [ ] Replace `@objectql/core` dependency with `@objectstack/objectql` in `package.json`
- [ ] Update all `import` statements (engine, registry, kernel factory, utilities, types)
- [ ] Replace `MetadataRegistry` usage with `MetadataFacade` (add `await`)
- [ ] Verify `ObjectQLPlugin` usage matches the upstream interface
- [ ] Run `pnpm build` and fix any remaining type errors
- [ ] Run `pnpm test` to verify behavior
- [ ] Remove `@objectql/core` and `@objectql/types` from dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/

// Import ObjectQLPlugin types from @objectql/core instead of @objectstack/runtime
// to avoid ESM/CJS compatibility issues
// Plugin types defined locally to avoid ESM/CJS compatibility issues
type RuntimeContext = any;

interface ObjectQLPlugin {
Expand Down
7 changes: 5 additions & 2 deletions packages/foundation/core/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# @objectql/core

> **Implementation Status**: ✅ **Production Ready** - All core features fully implemented and tested. See [Implementation Status](https://github.com/objectstack-ai/objectql/blob/main/IMPLEMENTATION_STATUS.md) for complete details.
> ⚠️ **DEPRECATED**: This package is deprecated. Use [`@objectstack/objectql`](https://www.npmjs.com/package/@objectstack/objectql) instead.
> See the [Migration Guide](https://github.com/objectstack-ai/spec/blob/main/content/docs/guides/objectql-migration.mdx) for step-by-step instructions.

The core ORM and runtime engine for ObjectQL. This package handles object querying, CRUD operations, database driver coordination, transaction management, and **metadata-driven validation**. As of version 4.0.0, it wraps the **ObjectKernel** for plugin architecture and lifecycle management.
The core ORM and runtime engine for ObjectQL. All core functionality (ObjectQL engine, SchemaRegistry, createObjectQLKernel, utilities) is now available directly from `@objectstack/objectql`.

The `ObjectQLPlugin` (orchestrator composing sub-plugins like ValidatorPlugin, FormulaPlugin, QueryPlugin) remains in this package as it is specific to the `@objectql` ecosystem.

## Features

Expand Down
3 changes: 2 additions & 1 deletion packages/foundation/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "@objectql/core",
"version": "4.2.1",
"description": "Universal runtime engine for ObjectQL - AI-native metadata-driven ORM with validation, repository pattern, and driver orchestration",
"deprecated": "Use @objectstack/objectql instead. See https://github.com/objectstack-ai/spec/blob/main/content/docs/guides/objectql-migration.mdx",
"description": "DEPRECATED — Use @objectstack/objectql. Plugin orchestrator for ObjectQL sub-plugins (validator, formula, query).",
"keywords": [
"objectql",
"orm",
Expand Down
26 changes: 17 additions & 9 deletions packages/foundation/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
/**
* ObjectQL
* ObjectQL Core — DEPRECATED
* Copyright (c) 2026-present ObjectStack Inc.
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The copyright notice states "2026-present" but according to the system time, we're currently in February 2026. This is technically correct, but it's unusual to see a copyright starting from the current year without any past years included.

If ObjectQL code existed before 2026, the copyright should reflect the original year (e.g., "2024-present" or "2025-present"). If this is truly new code from 2026, then "2026-present" is fine, though you might consider just using "2026" until we enter 2027.

Suggested change
* Copyright (c) 2026-present ObjectStack Inc.
* Copyright (c) 2026 ObjectStack Inc.

Copilot uses AI. Check for mistakes.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @deprecated This package is deprecated. Migrate to `@objectstack/objectql`.
* See: https://github.com/objectstack-ai/spec/blob/main/content/docs/guides/objectql-migration.mdx
*/

// ── Convenience factory ──
export { createObjectQLKernel, type ObjectQLKernelOptions } from './kernel-factory';

// ── Re-export bridge engine (extends upstream with MetadataRegistry + legacy config) ──
// ── Bridge engine (deprecated — use @objectstack/objectql ObjectQL directly) ──
/** @deprecated Import ObjectQL from `@objectstack/objectql` instead. This bridge class will be removed in a future version. */
export { ObjectQL, type ObjectQLConfig } from './app';

// ── Convenience factory (local implementation — wraps upstream kernel) ──
export { createObjectQLKernel } from './kernel-factory';
export type { ObjectQLKernelOptions } from './kernel-factory';

// ── Re-exports from @objectstack/objectql (deprecated — import directly from upstream) ──
/** @deprecated Import from `@objectstack/objectql` instead. */
export { ObjectRepository, ScopedContext, SchemaRegistry } from '@objectstack/objectql';
/** @deprecated Import from `@objectstack/objectql` instead. */
export { toTitleCase, convertIntrospectedSchemaToObjects } from '@objectstack/objectql';
/** @deprecated Import from `@objectstack/objectql` instead. */
export type { HookHandler, HookEntry, OperationContext, EngineMiddleware, ObjectQLHostContext } from '@objectstack/objectql';

// ── Plugin orchestration ──
// ── Plugin orchestration (downstream — stays in @objectql ecosystem) ──
export * from './plugin';

// ── Utilities ──
export * from './util';
2 changes: 1 addition & 1 deletion packages/foundation/platform-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"test": "vitest run"
},
"dependencies": {
"@objectql/core": "workspace:*",
"@objectstack/objectql": "^3.0.4",
"@objectql/types": "workspace:*",
"@objectstack/spec": "^3.0.4",
"fast-glob": "^3.3.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/foundation/platform-node/src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as glob from 'fast-glob';
import * as path from 'path';
import { MetadataRegistry, ObjectConfig, LoaderPlugin, LoaderHandlerContext, FieldConfig } from '@objectql/types';
import * as yaml from 'js-yaml';
import { toTitleCase } from '@objectql/core';
import { toTitleCase } from '@objectstack/objectql';

export class ObjectLoader {
private plugins: LoaderPlugin[] = [];
Expand Down
1 change: 1 addition & 0 deletions packages/tools/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
},
"dependencies": {
"@objectql/types": "workspace:*",
"@objectstack/objectql": "^3.0.4",
"@objectql/core": "workspace:*",
"@objectql/plugin-validator": "workspace:*",
"@objectql/driver-sql": "workspace:*",
Expand Down
1 change: 1 addition & 0 deletions packages/tools/cli/src/commands/doctor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ async function checkDependencies(packageJson: any): Promise<DependencyCheck[]> {

// Check for ObjectQL core packages
const corePackages = [
'@objectstack/objectql',
'@objectql/core',
'@objectql/types',
'@objectql/cli'
Expand Down
2 changes: 1 addition & 1 deletion packages/tools/cli/src/commands/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ interface MigrateStatusOptions {
dir?: string;
}

const MIGRATION_TEMPLATE = `import { ObjectQL } from '@objectql/core';
const MIGRATION_TEMPLATE = `import { ObjectQL } from '@objectstack/objectql';

/**
* Migration: {{name}}
Expand Down
4 changes: 2 additions & 2 deletions packages/tools/cli/src/commands/repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import * as repl from 'repl';
import * as _path from 'path';
import * as _fs from 'fs';
import { ObjectQL } from '@objectql/core';
import { ObjectQL } from '@objectstack/objectql';
import { register } from 'ts-node';
import { resolveConfigFile } from '../utils/config-loader';

Expand Down Expand Up @@ -83,7 +83,7 @@ export async function startRepl(configPath?: string) {
get: () => {
// Dynamic require to avoid circular dependency — ObjectRepository is constructed
// from the user-provided app instance to enable convenient REPL access.
const { ObjectRepository } = require('@objectql/core');
const { ObjectRepository } = require('@objectstack/objectql');

const replContext: any = {
roles: ['admin'],
Expand Down
9 changes: 6 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading