Skip to content
Merged
2 changes: 1 addition & 1 deletion examples/ai-analyst/src/ai-config.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Agent, NLQModelConfig, QueryTemplate } from '@objectstack/spec';
import type { Agent, NLQModelConfig, QueryTemplate } from '@objectstack/spec/ai';
/**
* AI Data Analyst Agent
*/
Expand Down
2 changes: 1 addition & 1 deletion examples/ai-analyst/src/ai-config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Agent, NLQModelConfig, QueryTemplate } from '@objectstack/spec';
import type { Agent, NLQModelConfig, QueryTemplate } from '@objectstack/spec/ai';

/**
* AI Data Analyst Agent
Expand Down
2 changes: 1 addition & 1 deletion examples/ai-codegen/src/ai-config.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Agent, ModelRegistry, RAGPipelineConfig } from '@objectstack/spec';
import type { Agent, ModelRegistry, RAGPipelineConfig } from '@objectstack/spec/ai';
/**
* ObjectStack Code Generator Agent
*/
Expand Down
2 changes: 1 addition & 1 deletion examples/ai-codegen/src/ai-config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Agent, ModelRegistry, RAGPipelineConfig } from '@objectstack/spec';
import type { Agent, ModelRegistry, RAGPipelineConfig } from '@objectstack/spec/ai';

/**
* ObjectStack Code Generator Agent
Expand Down
2 changes: 1 addition & 1 deletion examples/ai-sales/src/ai-config.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Agent, ModelRegistry, RAGPipelineConfig } from '@objectstack/spec';
import type { Agent, ModelRegistry, RAGPipelineConfig } from '@objectstack/spec/ai';
/**
* AI Sales Assistant Agent
*/
Expand Down
2 changes: 1 addition & 1 deletion examples/ai-sales/src/ai-config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Agent, ModelRegistry, RAGPipelineConfig } from '@objectstack/spec';
import type { Agent, ModelRegistry, RAGPipelineConfig } from '@objectstack/spec/ai';

/**
* AI Sales Assistant Agent
Expand Down
2 changes: 1 addition & 1 deletion examples/ai-support/src/ai-config.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Agent, ModelRegistry, RAGPipelineConfig, FieldSynonymConfig } from '@objectstack/spec';
import type { Agent, ModelRegistry, RAGPipelineConfig, FieldSynonymConfig } from '@objectstack/spec/ai';
/**
* AI Support Assistant - Agent Configuration
*/
Expand Down
2 changes: 1 addition & 1 deletion examples/ai-support/src/ai-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {
ModelRegistry,
RAGPipelineConfig,
FieldSynonymConfig,
} from '@objectstack/spec';
} from '@objectstack/spec/ai';

/**
* AI Support Assistant - Agent Configuration
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/objectstack.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App } from '@objectstack/spec';
import { App } from '@objectstack/spec/ui';
import { Account } from './src/domains/crm/account.object';
import { Contact } from './src/domains/crm/contact.object';
import { Opportunity } from './src/domains/crm/opportunity.object';
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/domains/crm/account.object.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ObjectSchema, Field } from '@objectstack/spec';
import { ObjectSchema, Field } from '@objectstack/spec/data';

export const Account = ObjectSchema.create({
name: 'account',
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/domains/crm/case.object.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ObjectSchema, Field } from '@objectstack/spec';
import { ObjectSchema, Field } from '@objectstack/spec/data';

export const Case = ObjectSchema.create({
name: 'case',
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/domains/crm/contact.object.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ObjectSchema, Field } from '@objectstack/spec';
import { ObjectSchema, Field } from '@objectstack/spec/data';

export const Contact = ObjectSchema.create({
name: 'contact',
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/domains/crm/lead.object.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ObjectSchema, Field } from '@objectstack/spec';
import { ObjectSchema, Field } from '@objectstack/spec/data';

export const Lead = ObjectSchema.create({
name: 'lead',
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/domains/crm/opportunity.object.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ObjectSchema, Field } from '@objectstack/spec';
import { ObjectSchema, Field } from '@objectstack/spec/data';

export const Opportunity = ObjectSchema.create({
name: 'opportunity',
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/domains/crm/task.object.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ObjectSchema, Field } from '@objectstack/spec';
import { ObjectSchema, Field } from '@objectstack/spec/data';

export const Task = ObjectSchema.create({
name: 'task',
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/server/apis.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ApiEndpoint } from '@objectstack/spec';
import { ApiEndpoint } from '@objectstack/spec/system';

/**
* Custom API: Close Won Opportunities
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/ui/actions.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Action } from '@objectstack/spec';
import type { Action } from '@objectstack/spec/ui';
export declare const ConvertLeadAction: Action;
export declare const CloneOpportunityAction: Action;
export declare const MarkPrimaryContactAction: Action;
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/ui/actions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Action } from '@objectstack/spec';
import type { Action } from '@objectstack/spec/ui';

// Convert Lead to Account, Contact, and Opportunity
export const ConvertLeadAction: Action = {
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/ui/dashboards.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Dashboard } from '@objectstack/spec';
import type { Dashboard } from '@objectstack/spec/ui';
export declare const SalesDashboard: Dashboard;
export declare const ServiceDashboard: Dashboard;
export declare const ExecutiveDashboard: Dashboard;
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/ui/dashboards.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Dashboard } from '@objectstack/spec';
import type { Dashboard } from '@objectstack/spec/ui';

// Sales Performance Dashboard
export const SalesDashboard: Dashboard = {
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/ui/reports.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Report } from '@objectstack/spec';
import type { Report } from '@objectstack/spec/ui';
export declare const OpportunitiesByStageReport: Report;
export declare const WonOpportunitiesByOwnerReport: Report;
export declare const AccountsByIndustryTypeReport: Report;
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/ui/reports.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Report } from '@objectstack/spec';
import type { Report } from '@objectstack/spec/ui';

// Sales Report - Opportunities by Stage
export const OpportunitiesByStageReport: Report = {
Expand Down
2 changes: 1 addition & 1 deletion examples/plugin-bi/objectstack.config.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ObjectStackManifest } from '@objectstack/spec';
import { ObjectStackManifest } from '@objectstack/spec/system';
declare const BiPlugin: ObjectStackManifest;
export default BiPlugin;
//# sourceMappingURL=objectstack.config.d.ts.map
2 changes: 1 addition & 1 deletion examples/plugin-bi/objectstack.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ObjectStackManifest } from '@objectstack/spec';
import { ObjectStackManifest } from '@objectstack/spec/system';

const BiPlugin: ObjectStackManifest = {
id: 'com.objectstack.bi',
Expand Down
2 changes: 1 addition & 1 deletion examples/plugin-bi/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PluginDefinition } from '@objectstack/spec';
import { PluginDefinition } from '@objectstack/spec/system';
export declare class BiEngine {
constructor();
registerDataset(path: string): void;
Expand Down
2 changes: 1 addition & 1 deletion examples/plugin-bi/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PluginDefinition, PluginContextData } from '@objectstack/spec';
import { PluginDefinition, PluginContextData } from '@objectstack/spec/system';

export class BiEngine {
constructor() {
Expand Down
2 changes: 1 addition & 1 deletion examples/todo/objectstack.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App } from '@objectstack/spec';
import { App } from '@objectstack/spec/ui';
import { TodoTask } from './src/domains/todo/task.object';

export default App.create({
Expand Down
2 changes: 1 addition & 1 deletion examples/todo/src/domains/todo/task.object.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ObjectSchema, Field } from '@objectstack/spec';
import { ObjectSchema, Field } from '@objectstack/spec/data';

export const TodoTask = ObjectSchema.create({
name: 'todo_task',
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { QueryAST, FilterNode, SortNode, AggregationNode, WindowFunctionNode } from '@objectstack/spec';
import { QueryAST, FilterNode, SortNode, AggregationNode, WindowFunctionNode } from '@objectstack/spec/data';

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused import WindowFunctionNode.

Copilot Autofix

AI 1 day ago

In general, to fix an unused import, either remove it if it's not needed, or start using it in the code if it was meant to be used. Since there is no sign that WindowFunctionNode is required for existing functionality and no references to it appear in the snippet, the safest, non-functional change is to delete just that symbol from the import list.

Concretely, in packages/client/src/index.ts, edit the import on line 1 to remove WindowFunctionNode from the destructuring while leaving the other imported types intact. No additional imports, methods, or definitions are needed, and this change will not affect runtime behavior because type-only imports are erased at compile time, and this one was unused anyway.

Suggested changeset 1
packages/client/src/index.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/client/src/index.ts b/packages/client/src/index.ts
--- a/packages/client/src/index.ts
+++ b/packages/client/src/index.ts
@@ -1,4 +1,4 @@
-import { QueryAST, FilterNode, SortNode, AggregationNode, WindowFunctionNode } from '@objectstack/spec/data';
+import { QueryAST, FilterNode, SortNode, AggregationNode } from '@objectstack/spec/data';
 
 export interface ClientConfig {
   baseUrl: string;
EOF
@@ -1,4 +1,4 @@
import { QueryAST, FilterNode, SortNode, AggregationNode, WindowFunctionNode } from '@objectstack/spec/data';
import { QueryAST, FilterNode, SortNode, AggregationNode } from '@objectstack/spec/data';

export interface ClientConfig {
baseUrl: string;
Copilot is powered by AI and may make mistakes. Always verify output.

export interface ClientConfig {
baseUrl: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/driver-memory/objectstack.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ObjectStackManifest } from '@objectstack/spec';
import { ObjectStackManifest } from '@objectstack/spec/system';

const MemoryDriverPlugin: ObjectStackManifest = {
id: 'com.objectstack.driver.memory',
Expand Down
8 changes: 2 additions & 6 deletions packages/driver-memory/src/memory-driver.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import {
DriverInterface,
DriverOptions,
QueryAST,
QueryInput
} from '@objectstack/spec';
import { QueryAST, QueryInput } from '@objectstack/spec/data';

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused import QueryAST.

Copilot Autofix

AI 1 day ago

In general, to fix an unused import, you either (a) start using it meaningfully in the module, or (b) remove it from the import list. Since there is no evidence that QueryAST should be used (no related logic exists in the shown code), the safest and least intrusive fix is to remove only QueryAST from the import declaration while keeping QueryInput as-is.

Concretely, in packages/driver-memory/src/memory-driver.ts at line 1, change the import from destructuring both symbols to importing only QueryInput. No other lines or imports need to be touched, and no additional methods or definitions are required. This preserves existing functionality while resolving the unused-import warning.

Suggested changeset 1
packages/driver-memory/src/memory-driver.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/driver-memory/src/memory-driver.ts b/packages/driver-memory/src/memory-driver.ts
--- a/packages/driver-memory/src/memory-driver.ts
+++ b/packages/driver-memory/src/memory-driver.ts
@@ -1,4 +1,4 @@
-import { QueryAST, QueryInput } from '@objectstack/spec/data';
+import { QueryInput } from '@objectstack/spec/data';
 import { DriverInterface, DriverOptions } from '@objectstack/spec/system';
 
 /**
EOF
@@ -1,4 +1,4 @@
import { QueryAST, QueryInput } from '@objectstack/spec/data';
import { QueryInput } from '@objectstack/spec/data';
import { DriverInterface, DriverOptions } from '@objectstack/spec/system';

/**
Copilot is powered by AI and may make mistakes. Always verify output.
import { DriverInterface, DriverOptions } from '@objectstack/spec/system';

/**
* Example: In-Memory Driver
Expand Down
3 changes: 2 additions & 1 deletion packages/objectql/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DriverInterface, DriverOptions, QueryAST, ObjectStackManifest } from '@objectstack/spec';
import { QueryAST } from '@objectstack/spec/data';
import { DriverInterface, DriverOptions, ObjectStackManifest } from '@objectstack/spec/system';
import { SchemaRegistry } from './registry';

// Export Registry for consumers
Expand Down
4 changes: 3 additions & 1 deletion packages/objectql/src/registry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { ServiceObject, App, ObjectStackManifest } from '@objectstack/spec';
import { ServiceObject } from '@objectstack/spec/data';
import { App } from '@objectstack/spec/ui';
import { ObjectStackManifest } from '@objectstack/spec/system';

/**
* Global Schema Registry
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/src/kernel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ServiceObject } from '@objectstack/spec';
import { ServiceObject } from '@objectstack/spec/data';
import { SchemaRegistry, ObjectQL } from '@objectstack/objectql';

/**
Expand Down
132 changes: 127 additions & 5 deletions packages/spec/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,115 @@ The specification is divided into three protocols:

## 📚 Usage

### Import Styles

**Important:** This package does NOT export types at the root level to prevent naming conflicts. You must use one of the following import styles:

#### 1. Namespace Imports from Root

Import protocol namespaces from the package root:

```typescript
import { Data, UI, System, AI, API } from '@objectstack/spec';

const field: Data.Field = {
name: 'task_name',
type: 'text',
label: 'Task Name',
};

const user: System.User = {
id: 'user_123',
email: 'user@example.com',
// ...
};

const agent: AI.Agent = {
name: 'sales_assistant',
// ...
};
```

**Pros:**
- Single import line for multiple protocols
- Clear namespace boundaries
- No naming conflicts

#### 2. Namespace Imports via Subpath

Import protocol domains individually:

```typescript
import * as Data from '@objectstack/spec/data';
import * as UI from '@objectstack/spec/ui';
import * as System from '@objectstack/spec/system';
import * as AI from '@objectstack/spec/ai';
import * as API from '@objectstack/spec/api';

const field: Data.Field = {
name: 'task_name',
type: 'text',
label: 'Task Name',
};

const user: System.User = {
id: 'user_123',
email: 'user@example.com',
// ...
};
```

**Pros:**
- Explicit about which protocols are used
- Better tree-shaking (only imports needed protocols)
- Clear namespace boundaries

#### 3. Direct Subpath Imports

Import specific types from subpaths:

```typescript
import { Field, FieldType, ObjectSchema } from '@objectstack/spec/data';
import { User, Session } from '@objectstack/spec/system';
import { App, View } from '@objectstack/spec/ui';

const field: Field = {
name: 'task_name',
type: 'text',
label: 'Task Name',
};

const user: User = {
id: 'user_123',
email: 'user@example.com',
// ...
};
```

**Pros:**
- Most concise syntax
- Good for importing specific types
- No namespace prefix needed

**Cons:**
- Need to know which subpath contains each type
- Multiple import statements for different protocols

### Validation (Runtime)

```typescript
import { ObjectSchema } from '@objectstack/spec';
// Style 1: Namespace from root
import { Data } from '@objectstack/spec';
const result = Data.ObjectSchema.safeParse(userConfig);

// Style 2: Namespace via subpath
import * as Data from '@objectstack/spec/data';
const result = Data.ObjectSchema.safeParse(userConfig);

// Style 3: Direct subpath import
import { ObjectSchema } from '@objectstack/spec/data';
const result = ObjectSchema.safeParse(userConfig);

if (!result.success) {
console.error("Invalid Object definition", result.error);
}
Expand All @@ -58,14 +161,33 @@ if (!result.success) {
### Type Definitions (Compile Time)

```typescript
import type { Object, Field } from '@objectstack/spec';
// Style 1: Namespace from root
import type { Data } from '@objectstack/spec';
const myField: Data.Field = {
name: "task_name",
type: "text",
label: "Task Name"
};

const myObject: Object = {
name: "project_task",
fields: { ... }
// Style 2: Direct subpath import
import type { Field } from '@objectstack/spec/data';
const myField: Field = {
name: "task_name",
type: "text",
label: "Task Name"
};
```

Using namespace imports for multiple protocols:

```typescript
import type * as Data from '@objectstack/spec/data';
import type * as System from '@objectstack/spec/system';

const field: Data.Field = { /* ... */ };
const user: System.User = { /* ... */ };
```

### JSON Schema (Tooling)
The package includes valid JSON Schemas in the `/json-schema` directory.
These can be used with:
Expand Down
Loading
Loading