Skip to content

Commit 802d03a

Browse files
authored
Merge branch 'main' into copilot/set-up-copilot-instructions
2 parents 6853b99 + f046f0c commit 802d03a

14 files changed

Lines changed: 2861 additions & 20 deletions

File tree

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.1.2/schema.json",
3+
"changelog": ["@changesets/cli/changelog", { "repo": "objectstack-ai/spec" }],
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '20'
25+
cache: 'npm'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Build
31+
run: npm run build

.github/workflows/release.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency: ${{ github.workflow }}-${{ github.ref }}
9+
10+
jobs:
11+
release:
12+
name: Release
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '20'
25+
cache: 'npm'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Build
31+
run: npm run build
32+
33+
- name: Create Release Pull Request or Publish to npm
34+
id: changesets
35+
uses: changesets/action@v1
36+
with:
37+
publish: npm run release
38+
version: npm run version
39+
commit: 'chore: version packages'
40+
title: 'chore: version packages'
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ node_modules/
33

44
# Build output
55
dist/
6+
*.tsbuildinfo
67

78
# IDE
89
.vscode/
910
.idea/
1011
*.swp
1112
*.swo
13+
*~
1214

1315
# OS
1416
.DS_Store
@@ -25,3 +27,12 @@ coverage/
2527
# Temporary files
2628
*.tmp
2729
.cache/
30+
yarn-debug.log*
31+
yarn-error.log*
32+
33+
# Testing
34+
coverage/
35+
36+
# Temporary files
37+
tmp/
38+
temp/

README.md

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,5 +129,157 @@ npm run clean
129129
```
130130

131131
## 📄 License
132+
# ObjectStack Specification
133+
134+
The ObjectStack Protocol & Specification repository defines the core type definitions and interfaces for the ObjectStack ecosystem. This repository serves as the "Constitution" of the system, providing the contract between backend (ObjectQL) parsers and frontend (ObjectUI) renderers.
135+
136+
## Purpose
137+
138+
This repository contains:
139+
- **TypeScript Interfaces**: Shared types for the entire ObjectStack ecosystem
140+
- **No Logic**: Only type definitions, no runtime code or business logic
141+
- **Universal Compatibility**: Works in Node.js, Browser, and Electron environments
142+
143+
## Metamodel Interfaces
144+
145+
The metamodel defines the structure for describing data models in ObjectStack:
146+
147+
### Core Interfaces
148+
149+
#### `FieldType`
150+
Defines the available field data types:
151+
- Text types: `text`, `textarea`, `email`, `url`
152+
- Numeric types: `number`, `currency`, `percentage`
153+
- Date/Time types: `date`, `datetime`
154+
- Relation types: `lookup`
155+
- Selection types: `select`, `multiselect`
156+
- Special types: `boolean`, `json`, `file`, `image`
157+
158+
#### `ObjectField`
159+
Represents a field definition within an entity:
160+
```typescript
161+
interface ObjectField {
162+
name: string; // Field identifier
163+
label: string; // Display label
164+
type: FieldType; // Data type
165+
required?: boolean; // Validation
166+
unique?: boolean; // Constraint
167+
lookupEntity?: string; // For lookup fields
168+
// ... and more options
169+
}
170+
```
171+
172+
#### `ObjectEntity`
173+
Represents a complete entity (data model) definition:
174+
```typescript
175+
interface ObjectEntity {
176+
name: string; // Entity identifier
177+
label: string; // Singular display label
178+
pluralLabel: string; // Plural display label
179+
fields: ObjectField[]; // Field definitions
180+
primaryKey?: string; // Primary key field
181+
displayField?: string; // Display field for lookups
182+
// ... and more options
183+
}
184+
```
185+
186+
#### `ObjectView`
187+
Represents a view configuration for presenting entity data:
188+
```typescript
189+
interface ObjectView {
190+
name: string; // View identifier
191+
label: string; // Display label
192+
entityName: string; // Target entity
193+
type: ViewType; // Presentation type (list, form, detail, etc.)
194+
fields?: string[]; // Fields to display
195+
columns?: ViewColumn[]; // Column configuration
196+
filters?: ViewFilter[]; // Default filters
197+
sort?: ViewSort[]; // Default sort order
198+
// ... and more options
199+
}
200+
```
201+
202+
## Usage
203+
204+
### Installation
205+
206+
```bash
207+
npm install @objectstack/spec
208+
```
209+
210+
### Importing Types
211+
212+
```typescript
213+
// Import all metamodel types
214+
import { ObjectEntity, ObjectField, ObjectView, FieldType } from '@objectstack/spec';
215+
216+
// Or import specific types
217+
import type { ObjectEntity } from '@objectstack/spec';
218+
```
219+
220+
### Example: Defining an Entity
221+
222+
```typescript
223+
import { ObjectEntity, ObjectField } from '@objectstack/spec';
224+
225+
const userEntity: ObjectEntity = {
226+
name: 'User',
227+
label: 'User',
228+
pluralLabel: 'Users',
229+
description: 'System user account',
230+
fields: [
231+
{
232+
name: 'id',
233+
label: 'ID',
234+
type: 'text',
235+
required: true,
236+
readonly: true
237+
},
238+
{
239+
name: 'email',
240+
label: 'Email',
241+
type: 'email',
242+
required: true,
243+
unique: true
244+
},
245+
{
246+
name: 'name',
247+
label: 'Full Name',
248+
type: 'text',
249+
required: true
250+
},
251+
{
252+
name: 'role',
253+
label: 'Role',
254+
type: 'select',
255+
required: true,
256+
options: [
257+
{ value: 'admin', label: 'Administrator' },
258+
{ value: 'user', label: 'User' }
259+
]
260+
}
261+
],
262+
primaryKey: 'id',
263+
displayField: 'name'
264+
};
265+
```
266+
267+
## Building
268+
269+
```bash
270+
npm install
271+
npm run build
272+
```
273+
274+
This will compile TypeScript files to JavaScript and generate type declarations in the `dist/` directory.
275+
276+
## Philosophy
277+
278+
Following the ObjectStack Protocol:
279+
- **Strict Types, No Logic**: This repository contains only type definitions
280+
- **Documentation as Code**: Every interface property has TSDoc comments for IntelliSense
281+
- **Universal Compatibility**: Pure TypeScript with no platform-specific dependencies
282+
283+
## License
132284

133285
MIT

0 commit comments

Comments
 (0)